Changeset 3778457
- Timestamp:
- 11/01/2026 07:18:39 PM (61 minutes ago)
- Location:
- venomaps
- Files:
-
- 60 added
- 4 edited
-
tags/2.2.0 (added)
-
tags/2.2.0/LICENSE (added)
-
tags/2.2.0/block (added)
-
tags/2.2.0/block/block.js (added)
-
tags/2.2.0/block/block.json (added)
-
tags/2.2.0/css (added)
-
tags/2.2.0/css/venomaps-admin-bundle.css (added)
-
tags/2.2.0/css/venomaps-admin-bundle.min.css (added)
-
tags/2.2.0/css/venomaps-bundle.css (added)
-
tags/2.2.0/css/venomaps-bundle.min.css (added)
-
tags/2.2.0/images (added)
-
tags/2.2.0/images/maps (added)
-
tags/2.2.0/images/maps/default.jpg (added)
-
tags/2.2.0/images/maps/maptiler (added)
-
tags/2.2.0/images/maps/maptiler/backdrop.jpg (added)
-
tags/2.2.0/images/maps/maptiler/basic.jpg (added)
-
tags/2.2.0/images/maps/maptiler/ocean.jpg (added)
-
tags/2.2.0/images/maps/maptiler/satellite.jpg (added)
-
tags/2.2.0/images/maps/maptiler/streets.jpg (added)
-
tags/2.2.0/images/maps/maptiler/toner.jpg (added)
-
tags/2.2.0/images/maps/maptiler/topo.jpg (added)
-
tags/2.2.0/images/maps/maptiler/winter.jpg (added)
-
tags/2.2.0/images/maps/stadiamaps (added)
-
tags/2.2.0/images/maps/stadiamaps/terrain.jpg (added)
-
tags/2.2.0/images/maps/stadiamaps/toner.jpg (added)
-
tags/2.2.0/images/maps/stadiamaps/watercolor.jpg (added)
-
tags/2.2.0/images/maps/thunderforest (added)
-
tags/2.2.0/images/maps/thunderforest/atlas.jpg (added)
-
tags/2.2.0/images/maps/thunderforest/landscape.jpg (added)
-
tags/2.2.0/images/maps/thunderforest/mobile-atlas.jpg (added)
-
tags/2.2.0/images/maps/thunderforest/neighbourhood.jpg (added)
-
tags/2.2.0/images/maps/thunderforest/opencyclemap.jpg (added)
-
tags/2.2.0/images/maps/thunderforest/outdoors.jpg (added)
-
tags/2.2.0/images/maps/thunderforest/pioneer.jpg (added)
-
tags/2.2.0/images/maps/thunderforest/spinal.jpg (added)
-
tags/2.2.0/images/maps/thunderforest/transport-dark.jpg (added)
-
tags/2.2.0/images/maps/thunderforest/transport.jpg (added)
-
tags/2.2.0/include (added)
-
tags/2.2.0/include/class-venomaps-edit.php (added)
-
tags/2.2.0/include/class-venomaps-options.php (added)
-
tags/2.2.0/include/class-venomaps-plugin.php (added)
-
tags/2.2.0/js (added)
-
tags/2.2.0/js/venomaps-admin-bundle.js (added)
-
tags/2.2.0/js/venomaps-admin-bundle.min.js (added)
-
tags/2.2.0/js/venomaps-bundle.js (added)
-
tags/2.2.0/js/venomaps-bundle.min.js (added)
-
tags/2.2.0/languages (added)
-
tags/2.2.0/languages/venomaps-en_US.l10n.php (added)
-
tags/2.2.0/languages/venomaps-en_US.mo (added)
-
tags/2.2.0/languages/venomaps-en_US.po (added)
-
tags/2.2.0/languages/venomaps-es_ES.l10n.php (added)
-
tags/2.2.0/languages/venomaps-es_ES.mo (added)
-
tags/2.2.0/languages/venomaps-es_ES.po (added)
-
tags/2.2.0/languages/venomaps-it_IT.l10n.php (added)
-
tags/2.2.0/languages/venomaps-it_IT.mo (added)
-
tags/2.2.0/languages/venomaps-it_IT.po (added)
-
tags/2.2.0/languages/venomaps.pot (added)
-
tags/2.2.0/readme.txt (added)
-
tags/2.2.0/uninstall.php (added)
-
tags/2.2.0/venomaps.php (added)
-
trunk/js/venomaps-bundle.js (modified) (3 diffs)
-
trunk/js/venomaps-bundle.min.js (modified) (1 diff)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/venomaps.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
venomaps/trunk/js/venomaps-bundle.js
r3778346 r3778457 51638 51638 51639 51639 const updateSearch = (term) => { 51640 const searchTerm = term.toLowerCase(); 51640 51641 // const searchTerm = term.toLowerCase(); 51642 const normalizedSearchTerm = term.toLowerCase().replace(/\s+/g, ' ').trim(); 51643 51641 51644 let featuresToShow = []; 51642 51645 … … 51644 51647 const panel = feature.get('panel'); 51645 51648 let isVisible = true; 51646 if (searchTerm.length > 2) { 51647 const infoboxText = panel?.querySelector('.wpol-infolabel')?.innerText.toLowerCase() || ''; 51648 isVisible = infoboxText.includes(searchTerm); 51649 if (normalizedSearchTerm.length > 2) { 51650 const rawText = panel?.querySelector('.wpol-infolabel')?.innerText || ''; 51651 51652 // 2. Normalizziamo anche il testo dell'infobox nello stesso modo 51653 const infoboxText = rawText.toLowerCase().replace(/\s+/g, ' ').trim(); 51654 51655 isVisible = infoboxText.includes(normalizedSearchTerm); 51649 51656 if (isVisible) featuresToShow.push(feature); 51650 51657 } … … 51654 51661 markerLayer.getSource().refresh(); 51655 51662 51656 if ( searchTerm.length > 2 && featuresToShow.length > 0) {51663 if (normalizedSearchTerm.length > 2 && featuresToShow.length > 0) { 51657 51664 const tempSource = new VectorSource({ features: featuresToShow }); 51658 51665 map.getView().fit(tempSource.getExtent(), { duration: 500, padding: [100, 100, 100, 100], maxZoom: 15 }); -
venomaps/trunk/js/venomaps-bundle.min.js
r3778346 r3778457 1 var venomaps=function(){"use strict";const t="__venomapsCanvasPatched";var e="add",i="remove",n="propertychange";function s(t){for(const e in t)delete t[e]}function r(t){let e;for(e in t)return!1;return!e}function o(t,e,i,n,s){if(s){const s=i;i=function(r){return t.removeEventListener(e,i),s.call(n??this,r)}}else n&&n!==t&&(i=i.bind(n));const r={target:t,type:e,listener:i};return t.addEventListener(e,i),r}function a(t,e,i,n){return o(t,e,i,n,!0)}function l(t){t&&t.target&&(t.target.removeEventListener(t.type,t.listener),s(t))}var h="change",c="error",u="contextmenu",d="click",g="dblclick",f="keydown",_="keypress",p="keyup",m="load",y="touchmove",x="wheel";class v{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}}function w(t,e){return t>e?1:t<e?-1:0}function C(t,e){return t<e?1:t>e?-1:0}function S(t,e,i){if(t[0]<=e)return 0;const n=t.length;if(e<=t[n-1])return n-1;if("function"==typeof i){for(let s=1;s<n;++s){const n=t[s];if(n===e)return s;if(n<e)return i(e,t[s-1],n)>0?s-1:s}return n-1}if(i>0){for(let i=1;i<n;++i)if(t[i]<e)return i-1;return n-1}if(i<0){for(let i=1;i<n;++i)if(t[i]<=e)return i;return n-1}for(let i=1;i<n;++i){if(t[i]==e)return i;if(t[i]<e)return t[i-1]-e<e-t[i]?i-1:i}return n-1}function E(t,e,i){for(;e<i;){const n=t[e];t[e]=t[i],t[i]=n,++e,--i}}function b(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 R(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 I(){throw new Error("Unimplemented abstract method.")}let M=0;function T(t){const e=t;return e.ol_uid||(e.ol_uid=String(++M))}function P(t){return!!t&&"function"==typeof t.then&&"function"==typeof t.catch}function F(){return!0}function L(){return!1}function k(){}function A(t){let e,i,n;return function(){const s=Array.prototype.slice.call(arguments);return i&&this===n&&R(s,i)||(n=this,i=s,e=t.apply(this,s)),e}}class O{constructor(t){this.propagationStopped,this.defaultPrevented,this.type=t,this.target=null}preventDefault(){this.defaultPrevented=!0}stopPropagation(){this.propagationStopped=!0}}class D extends v{constructor(t){super(),this.eventTarget_=t,this.pendingRemovals_=null,this.dispatching_=null,this.listeners_=null}addEventListener(t,e){if(!t||!e)return;const i=this.listeners_||(this.listeners_={}),n=i[t]||(i[t]=[]);n.includes(e)||n.push(e)}dispatchEvent(t){const e="string"==typeof t,i=e?t:t.type,n=this.listeners_&&this.listeners_[i];if(!n)return;const s=e?new O(t):t;s.target||(s.target=this.eventTarget_||this);const r=this.dispatching_||(this.dispatching_={}),o=this.pendingRemovals_||(this.pendingRemovals_={});let a;i in r||(r[i]=0,o[i]=0),++r[i];for(let t=0,e=n.length;t<e;++t)if(a="handleEvent"in n[t]?n[t].handleEvent(s):n[t].call(this,s),!1===a||s.propagationStopped){a=!1;break}if(0===--r[i]){let t=o[i];for(delete o[i];t--;)this.removeEventListener(i,k);delete r[i]}return a}disposeInternal(){this.listeners_&&s(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]=k,++this.pendingRemovals_[t]):(i.splice(n,1),0===i.length&&delete this.listeners_[t]))}}class G extends D{constructor(){super(),this.on=this.onInternal,this.once=this.onceInternal,this.un=this.unInternal,this.revision_=0}changed(){++this.revision_,this.dispatchEvent(h)}getRevision(){return this.revision_}onInternal(t,e){if(Array.isArray(t)){const i=t.length,n=new Array(i);for(let s=0;s<i;++s)n[s]=o(this,t[s],e);return n}return o(this,t,e)}onceInternal(t,e){let i;if(Array.isArray(t)){const n=t.length;i=new Array(n);for(let s=0;s<n;++s)i[s]=a(this,t[s],e)}else i=a(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)l(t[e]);else l(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)}}G.prototype.on,G.prototype.once,G.prototype.un;class z extends O{constructor(t,e,i){super(t),this.key=e,this.oldValue=i}}class N extends G{constructor(t){super(),this.on,this.once,this.un,T(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 z(i,t,e)),i=n,this.hasListener(i)&&this.dispatchEvent(new z(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],r(this.values_)&&(this.values_=null),e||this.notify(t,i)}}}const j="length";class X extends O{constructor(t,e,i){super(t),this.element=e,this.index=i}}class K 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(j)}insertAt(t,i){if(t<0||t>this.getLength())throw new Error("Index out of bounds: "+t);this.unique_&&this.assertUnique_(i),this.array_.splice(t,0,i),this.updateLength_(),this.dispatchEvent(new X(e,i,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 X(i,e,t)),e}setAt(t,n){if(t>=this.getLength())return void this.insertAt(t,n);if(t<0)throw new Error("Index out of bounds: "+t);this.unique_&&this.assertUnique_(n,t);const s=this.array_[t];this.array_[t]=n,this.dispatchEvent(new X(i,s,t)),this.dispatchEvent(new X(e,n,t))}updateLength_(){this.set(j,this.array_.length)}assertUnique_(t,e){const i=this.array_;for(let n=0,s=i.length;n<s;++n)if(i[n]===t&&n!==e)throw new Error("Duplicate item added to a unique collection")}}function W(t,e){if(!t)throw new Error(e)}class Y 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 Y,e=this.geometryName_;t.setGeometryName(e);const i=this.getPropertiesInternal();if(i){const n=this.getGeometry();for(const s in i)s===e&&n?t.set(s,n.clone()):t.set(s,i[s],!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_&&(l(this.geometryChangeKey_),this.geometryChangeKey_=null);const t=this.getGeometry();t&&(this.geometryChangeKey_=o(t,h,this.handleGeometryChange_,this)),this.changed()}setGeometry(t){this.set(this.geometryName_,t)}setStyle(t){this.style_=t??null,this.styleFunction_=t?function(t){if("function"==typeof t)return t;let e;if(Array.isArray(t))e=t;else{W("function"==typeof t.getZIndex,"Expected an `ol/style/Style` or an array of `ol/style/Style.js`");e=[t]}return function(){return e}}(t):void 0,this.changed()}setId(t){this.id_=t,this.changed()}setGeometryName(t){t!==this.geometryName_&&(this.removeChangeListener(this.geometryName_,this.handleGeometryChanged_),this.geometryName_=t,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),this.handleGeometryChanged_())}}var Z=0,B=1,V=2,U=4,q=8,$=16;function H(t){const e=rt();for(let i=0,n=t.length;i<n;++i)dt(e,t[i]);return e}function J(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 Q(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,s;return n=e<t[0]?t[0]-e:t[2]<e?e-t[2]:0,s=i<t[1]?t[1]-i:t[3]<i?i-t[3]:0,n*n+s*s}function et(t,e){return nt(t,e[0],e[1])}function it(t,e){return t[0]<=e[0]&&e[2]<=t[2]&&t[1]<=e[1]&&e[3]<=t[3]}function nt(t,e,i){return t[0]<=e&&e<=t[2]&&t[1]<=i&&i<=t[3]}function st(t,e){const i=t[0],n=t[1],s=t[2],r=t[3],o=e[0],a=e[1];let l=Z;return o<i?l|=$:o>s&&(l|=U),a<n?l|=q:a>r&&(l|=V),l===Z&&(l=B),l}function rt(){return[1/0,1/0,-1/0,-1/0]}function ot(t,e,i,n,s){return s?(s[0]=t,s[1]=e,s[2]=i,s[3]=n,s):[t,e,i,n]}function at(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 ht(t,e,i,n,s){return gt(at(s),t,e,i,n)}function ct(t,e){return t[0]==e[0]&&t[2]==e[2]&&t[1]==e[1]&&t[3]==e[3]}function ut(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 gt(t,e,i,n,s){for(;i<n;i+=s)ft(t,e[i],e[i+1]);return t}function ft(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(mt(t)),i||(i=e(yt(t)),i||(i=e(It(t)),i||(i=e(Rt(t)),i||!1)))}function pt(t){let e=0;return Pt(t)||(e=Mt(t)*St(t)),e}function mt(t){return[t[0],t[1]]}function yt(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=mt(t);else if("bottom-right"===e)i=yt(t);else if("top-left"===e)i=Rt(t);else{if("top-right"!==e)throw new Error("Invalid corner");i=It(t)}return i}function wt(t,e,i,n,s){const[r,o,a,l,h,c,u,d]=Ct(t,e,i,n);return ot(Math.min(r,a,h,u),Math.min(o,l,c,d),Math.max(r,a,h,u),Math.max(o,l,c,d),s)}function Ct(t,e,i,n){const s=e*n[0]/2,r=e*n[1]/2,o=Math.cos(i),a=Math.sin(i),l=s*o,h=s*a,c=r*o,u=r*a,d=t[0],g=t[1];return[d-l+u,g-h-c,d-l-u,g-h+c,d+l-u,g+h+c,d+l+u,g+h-c,d-l+u,g-h-c]}function St(t){return t[3]-t[1]}function Et(t,e,i){const n=i||[1/0,1/0,-1/0,-1/0];return Tt(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]):at(n),n}function bt(t,e){if(!Tt(t,e))return[t.slice()];if(it(e,t))return[];const[i,n,s,r]=t,o=Math.max(i,e[0]),a=Math.max(n,e[1]),l=Math.min(s,e[2]),h=Math.min(r,e[3]),c=[];return o>i&&c.push([i,n,o,r]),l<s&&c.push([l,n,s,r]),a>n&&c.push([o,n,l,a]),h<r&&c.push([o,h,l,r]),c}function Rt(t){return[t[0],t[3]]}function It(t){return[t[2],t[3]]}function Mt(t){return t[2]-t[0]}function Tt(t,e){return t[0]<=e[2]&&t[2]>=e[0]&&t[1]<=e[3]&&t[3]>=e[1]}function Pt(t){return t[2]<t[0]||t[3]<t[1]}function Ft(t,e){const i=e.getExtent(),n=xt(t);if(e.canWrapX()&&(n[0]<i[0]||n[0]>=i[2])){const e=Mt(i),s=Math.floor((n[0]-i[0])/e)*e;t[0]-=s,t[2]-=s}return t}function Lt(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]]];Ft(t,e);const s=Mt(n);if(Mt(t)>s&&!i)return[[n[0],t[1],n[2],t[3]]];if(t[0]<n[0])return[[t[0]+s,t[1],n[2],t[3]],[n[0],t[1],t[2],t[3]]];if(t[2]>n[2])return[[t[0],t[1],n[2],t[3]],[n[0],t[1],t[2]-s,t[3]]]}return[t]}function kt(t,e){let i=[t];for(let t=0,n=e.length;t<n&&i.length>0;++t){const n=[];for(let s=0,r=i.length;s<r;++s)n.push(...bt(i[s],e[t]));i=n}return i}function At(t,e,i){return Math.min(Math.max(t,e),i)}function Ot(t,e,i,n,s,r){const o=s-i,a=r-n;if(0!==o||0!==a){const l=((t-i)*o+(e-n)*a)/(o*o+a*a);l>1?(i=s,n=r):l>0&&(i+=o*l,n+=a*l)}return Dt(t,e,i,n)}function Dt(t,e,i,n){const s=i-t,r=n-e;return s*s+r*r}function Gt(t){return 180*t/Math.PI}function zt(t){return t*Math.PI/180}function Nt(t,e){const i=t%e;return i*e<0?i+e:i}function jt(t,e,i){return t+i*(e-t)}function Xt(t,e){const i=Math.pow(10,e);return Math.round(t*i)/i}function Kt(t,e){return Math.floor(Xt(t,e))}function Wt(t,e){return Math.ceil(Xt(t,e))}function Yt(t,e,i){if(t>=e&&t<i)return t;const n=i-e;return((t-e)%n+n)%n+e}function Zt(t,e,i){i=i||6371008.8;const n=zt(t[1]),s=zt(e[1]),r=(s-n)/2,o=zt(e[0]-t[0])/2,a=Math.sin(r)*Math.sin(r)+Math.sin(o)*Math.sin(o)*Math.cos(n)*Math.cos(s);return 2*i*Math.atan2(Math.sqrt(a),Math.sqrt(1-a))}function Bt(...t){console.warn(...t)}function Vt(t,e){return t[0]+=+e[0],t[1]+=+e[1],t}function Ut(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 qt(t,e){const i=Math.cos(e),n=Math.sin(e),s=t[0]*i-t[1]*n,r=t[1]*i+t[0]*n;return t[0]=s,t[1]=r,t}function $t(t,e){return t[0]*=e,t[1]*=e,t}function Ht(t,e){if(e.canWrapX()){const i=Mt(e.getExtent()),n=function(t,e,i){const n=e.getExtent();let s=0;e.canWrapX()&&(t[0]<n[0]||t[0]>n[2])&&(i=i||Mt(n),s=Math.floor((t[0]-n[0])/i));return s}(t,e,i);n&&(t[0]-=n*i)}return t}const Jt={radians:6370997/(2*Math.PI),degrees:2*Math.PI*6370997/360,ft:.3048,m:1,"us-ft":1200/3937};class Qt{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_||Jt[this.units_]}getWorldExtent(){return this.worldExtent_}getAxisOrientation(){return this.axisOrientation_}isGlobal(){return this.global_}setGlobal(t){this.global_=t,this.canWrapX_=!(!t||!this.extent_)}getDefaultTileGrid(){return this.defaultTileGrid_}setDefaultTileGrid(t){this.defaultTileGrid_=t}setExtent(t){this.extent_=t,this.canWrapX_=!(!this.global_||!t)}setWorldExtent(t){this.worldExtent_=t}setGetPointResolution(t){this.getPointResolutionFunc_=t}getPointResolutionFunc(){return this.getPointResolutionFunc_}}const te=6378137,ee=Math.PI*te,ie=[-ee,-ee,ee,ee],ne=[-180,-85,180,85],se=te*Math.log(Math.tan(Math.PI/2));class re extends Qt{constructor(t){super({code:t,units:"m",extent:ie,global:!0,worldExtent:ne,getPointResolution:function(t,e){return t/Math.cosh(e[1]/te)}})}}const oe=[new re("EPSG:3857"),new re("EPSG:102100"),new re("EPSG:102113"),new re("EPSG:900913"),new re("http://www.opengis.net/def/crs/EPSG/0/3857"),new re("http://www.opengis.net/gml/srs/epsg.xml#3857")];function ae(t,e,i,n){const s=t.length;i=void 0!==i&&i>1?i:2,n=n??i,void 0===e&&(e=i>2?t.slice():new Array(s));for(let i=0;i<s;i+=n){e[i]=ee*t[i]/180;let n=te*Math.log(Math.tan(Math.PI*(+t[i+1]+90)/360));n>se?n=se:n<-se&&(n=-se),e[i+1]=n}return e}function le(t,e,i,n){const s=t.length;i=void 0!==i&&i>1?i:2,n=n??i,void 0===e&&(e=i>2?t.slice():new Array(s));for(let i=0;i<s;i+=n)e[i]=180*t[i]/ee,e[i+1]=360*Math.atan(Math.exp(t[i+1]/te))/Math.PI-90;return e}const he=[-180,-90,180,90],ce=6378137*Math.PI/180;class ue extends Qt{constructor(t,e){super({code:t,units:"degrees",extent:he,axisOrientation:e,global:!0,metersPerUnit:ce,worldExtent:he})}}const de=[new ue("CRS:84"),new ue("EPSG:4326","neu"),new ue("urn:ogc:def:crs:OGC:1.3:CRS84"),new ue("urn:ogc:def:crs:OGC:2:84"),new ue("http://www.opengis.net/def/crs/OGC/1.3/CRS84"),new ue("http://www.opengis.net/gml/srs/epsg.xml#4326","neu"),new ue("http://www.opengis.net/def/crs/EPSG/0/4326","neu")];let ge={};let fe={};function _e(t,e,i){const n=t.getCode(),s=e.getCode();n in fe||(fe[n]={}),fe[n][s]=i}function pe(t,e){return t in fe&&e in fe[t]?fe[t][e]:null}const me=.9996,ye=.00669438,xe=ye*ye,ve=xe*ye,we=ye/(1-ye),Ce=Math.sqrt(1-ye),Se=(1-Ce)/(1+Ce),Ee=Se*Se,be=Ee*Se,Re=be*Se,Ie=Re*Se,Me=.9983242984503243,Te=15*xe/256+45*ve/1024,Pe=35*ve/3072,Fe=1.5*Se-27/32*be+269/512*Ie,Le=21/16*Ee-55/32*Re,ke=151/96*be-417/128*Ie,Ae=1097/512*Re,Oe=6378137;function De(t,e,i){const n=t-5e5,s=(i.north?e:e-1e7)/me/(Oe*Me),r=s+Fe*Math.sin(2*s)+Le*Math.sin(4*s)+ke*Math.sin(6*s)+Ae*Math.sin(8*s),o=Math.sin(r),a=o*o,l=Math.cos(r),h=o/l,c=h*h,u=c*c,d=1-ye*a,g=Math.sqrt(1-ye*a),f=we*l**2,_=f*f,p=n/(Oe/g*me),m=p*p,y=m*p,x=y*p,v=x*p,w=r-h/((1-ye)/d)*(m/2-x/24*(5+3*c+10*f-4*_-9*we))+v*p/720*(61+90*c+298*f+45*u-252*we-3*_);let C=(p-y/6*(1+2*c+f)+v/120*(5-2*f+28*c-3*_+8*we+24*u))/l;return C=Yt(C+zt(ze(i.number)),-Math.PI,Math.PI),[Gt(C),Gt(w)]}function Ge(t,e,i){t=Yt(t,-180,180),e<-80?e=-80:e>84&&(e=84);const n=zt(e),s=Math.sin(n),r=Math.cos(n),o=s/r,a=o*o,l=a*a,h=zt(t),c=zt(ze(i.number)),u=Oe/Math.sqrt(1-ye*s**2),d=we*r**2,g=r*Yt(h-c,-Math.PI,Math.PI),f=g*g,_=f*g,p=_*g,m=p*g,y=m*g,x=Oe*(Me*n-.002514607064228144*Math.sin(2*n)+Te*Math.sin(4*n)-Pe*Math.sin(6*n)),v=me*u*(g+_/6*(1-a+d)+m/120*(5-18*a+l+72*d-58*we))+5e5;let w=me*(x+u*o*(f/2+p/24*(5-a+9*d+4*d**2)+y/720*(61-58*a+l+600*d-330*we)));return i.north||(w+=1e7),[v,w]}function ze(t){return 6*(t-1)-180+3}const Ne=[/^EPSG:(\d+)$/,/^urn:ogc:def:crs:EPSG::(\d+)$/,/^http:\/\/www\.opengis\.net\/def\/crs\/EPSG\/0\/(\d+)$/];function je(t){let e=0;for(const i of Ne){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 Xe(t,e){return function(i,n,s,r){const o=i.length;s=void 0!==s&&s>1?s:2,r=r??s,n||(n=s>2?i.slice():new Array(o));for(let s=0;s<o;s+=r){const r=i[s],o=i[s+1],a=t(r,o,e);n[s]=a[0],n[s+1]=a[1]}return n}}const Ke=[function(t){const e=je(t.getCode());return e?{forward:Xe(Ge,e),inverse:Xe(De,e)}:null}],We=[function(t){return je(t)?new Qt({code:t,units:"m"}):null}];let Ye=!0;function Ze(t){Ye=!1}function Be(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 Ve(t){!function(t,e){ge[t]=e}(t.getCode(),t),_e(t,t,Be)}function Ue(t){if("string"!=typeof t)return void 0!==t?t:null;const e=ge[i=t]||ge[i.replace(/urn:(x-)?ogc:def:crs:EPSG:(.*:)?(\w+)$/,"EPSG:$3")]||null;var i;if(e)return e;for(const e of We){const i=e(t);if(i)return i}return null}function qe(t,e,i,n){const s=Ue(t);if(!s)return e;let r;const o=s.getPointResolutionFunc();if(o)r=o(e,i);else{const t=s.getUnits();if("degrees"==t&&!n||"degrees"==n)r=e;else{const n=ti(s,Ue("EPSG:4326"));if(n||"degrees"===t){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];n&&(t=n(t,t,2));r=(Zt(t.slice(0,2),t.slice(2,4))+Zt(t.slice(4,6),t.slice(6,8)))/2}else r=e*(s.getMetersPerUnit()??1);const o=s.getMetersPerUnit();void 0!==o&&(r/=o)}}return r}function $e(t){!function(t){t.forEach(Ve)}(t),t.forEach(function(e){t.forEach(function(t){e!==t&&_e(e,t,Be)})})}function He(t,e){return t?"string"==typeof t?Ue(t):t:Ue(e)}function Je(t,e){return Ze(),ni(t,"EPSG:4326","EPSG:3857")}function Qe(t,e){if(t===e)return!0;const i=t.getUnits()===e.getUnits();if(t.getCode()===e.getCode())return i;return ti(t,e)===Be&&i}function ti(t,e){if(!t||!e)return null;const i=t.getCode(),n=e.getCode();let s=pe(i,n);if(s)return s;let r=null,o=null;for(const i of Ke)r||(r=i(t)),o||(o=i(e));if(!r&&!o)return null;const a="EPSG:4326";if(!o&&r){const t=pe(a,n);t&&(s=ei(r.inverse,t))}else if(!r&&o){const t=pe(i,a);t&&(s=ei(t,o.forward))}else r&&o&&(s=ei(r.inverse,o.forward));return s&&(Ve(t),Ve(e),_e(t,e,s)),s}function ei(t,e){return function(i,n,s,r){return n=t(i,n,s,r),e(n,n,s,r)}}function ii(t,e){return ti(Ue(t),Ue(e))}function ni(t,e,i){const n=ii(e,i);if(!n){const t=Ue(e)?.getCode()??String(e),n=Ue(i)?.getCode()??String(i);throw new Error(`No transform available between ${t} and ${n}`)}return n(t,void 0,t.length)}function si(t,e){return t}function ri(t,e){return Ye&&!Ut(t,[0,0])&&t[0]>=-180&&t[0]<=180&&t[1]>=-90&&t[1]<=90&&(Ye=!1,Bt("Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.")),t}function oi(t,e){return t}function ai(t,e){return t}var li,hi,ci;$e(oe),$e(de),li=oe,hi=ae,ci=le,de.forEach(function(t){li.forEach(function(e){_e(t,e,hi),_e(e,t,ci)})});const ui=[1,0,0,1,0,0];function di(){return ui.slice(0)}function gi(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 fi(t,e,i,n,s,r,o,a){const l=Math.sin(r),h=Math.cos(r);return t[0]=n*h,t[1]=s*l,t[2]=-n*l,t[3]=s*h,t[4]=o*n*h-a*n*l+e,t[5]=o*s*l+a*s*h+i,t}function _i(t,e){const i=(n=e)[0]*n[3]-n[1]*n[2];var n;W(0!==i,"Transformation matrix cannot be inverted");const s=e[0],r=e[1],o=e[2],a=e[3],l=e[4],h=e[5];return t[0]=a/i,t[1]=-r/i,t[2]=-o/i,t[3]=s/i,t[4]=(o*h-a*l)/i,t[5]=-(s*h-r*l)/i,t}new Array(6);const pi=[1e5,1e5,1e5,1e5,2,2];function mi(t){return t.substring(7,t.length-1).split(",").map(parseFloat)}function yi(t,e,i,n,s,r,o){r=r||[],o=o||2;let a=0;for(let l=e;l<i;l+=n){const e=t[l],i=t[l+1];r[a++]=s[0]*e+s[2]*i+s[4],r[a++]=s[1]*e+s[3]*i+s[5];for(let e=2;e<o;e++)r[a++]=t[l+e]}return r&&r.length!=a&&(r.length=a),r}function xi(t,e,i,n,s,r,o){o=o||[];const a=Math.cos(s),l=Math.sin(s),h=r[0],c=r[1];let u=0;for(let s=e;s<i;s+=n){const e=t[s]-h,i=t[s+1]-c;o[u++]=h+e*a-i*l,o[u++]=c+e*l+i*a;for(let e=s+2;e<s+n;++e)o[u++]=t[e]}return o&&o.length!=u&&(o.length=u),o}const vi=di(),wi=[NaN,NaN];class Ci 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=A((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 I()}closestPointXY(t,e,i,n){return I()}containsXY(t,e){return 0===this.closestPointXY(t,e,wi,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 I()}getExtent(t){if(this.extentRevision_!=this.getRevision()){const t=this.computeExtent(this.extent_);(isNaN(t[0])||isNaN(t[1]))&&at(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){I()}scale(t,e,i){I()}simplify(t){return this.getSimplifiedGeometry(t*t)}getSimplifiedGeometry(t){return I()}getType(){return I()}applyTransform(t){I()}intersectsExtent(t){return I()}translate(t,e){I()}transform(t,e){const i=Ue(t);if(!i)return this;const n="tile-pixels"==i.getUnits()?function(t,n,s){const r=i.getExtent(),o=i.getWorldExtent(),a=St(o)/St(r);fi(vi,o[0],o[3],a,-a,0,0,0);const l=yi(t,0,t.length,s,vi,n),h=ii(i,e);return h?h(l,l,s):l}:ii(i,e);return n&&this.applyTransform(n),this}}class Si extends Ci{constructor(){super(),this.layout="XY",this.stride=2,this.flatCoordinates}computeExtent(t){return ht(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t)}getCoordinates(){return I()}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=bi(t),this.layout=t,this.flatCoordinates=e}setCoordinates(t,e){I()}setLayout(t,e,i){let n;if(t)n=bi(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=Ei(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();xi(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 s=this.getStride();!function(t,e,i,n,s,r,o,a){a=a||[];const l=o[0],h=o[1];let c=0;for(let o=e;o<i;o+=n){const e=t[o]-l,i=t[o+1]-h;a[c++]=l+s*e,a[c++]=h+r*i;for(let e=o+2;e<o+n;++e)a[c++]=t[e]}a&&a.length!=c&&(a.length=c)}(n,0,n.length,s,t,e,i,n),this.changed()}}translate(t,e){const i=this.getFlatCoordinates();if(i){const n=this.getStride();!function(t,e,i,n,s,r,o){o=o||[];let a=0;for(let l=e;l<i;l+=n){o[a++]=t[l]+s,o[a++]=t[l+1]+r;for(let e=l+2;e<l+n;++e)o[a++]=t[e]}o&&o.length!=a&&(o.length=a)}(i,0,i.length,n,t,e,i),this.changed()}}}function Ei(t){let e;return 2==t?e="XY":3==t?e="XYZ":4==t&&(e="XYZM"),e}function bi(t){let e;return"XY"==t?e=2:"XYZ"==t||"XYM"==t?e=3:"XYZM"==t&&(e=4),e}function Ri(t,e,i,n){let s=0;const r=t[i-n],o=t[i-n+1];let a=0,l=0;for(;e<i;e+=n){const i=t[e]-r,n=t[e+1]-o;s+=l*i-a*n,a=i,l=n}return s/2}function Ii(t,e,i,n){let s=0;for(let r=0,o=i.length;r<o;++r){const o=i[r];s+=Ri(t,e,o,n),e=o}return s}function Mi(t,e,i,n,s,r,o){const a=t[e],l=t[e+1],h=t[i]-a,c=t[i+1]-l;let u;if(0===h&&0===c)u=e;else{const d=((s-a)*h+(r-l)*c)/(h*h+c*c);if(d>1)u=i;else{if(d>0){for(let s=0;s<n;++s)o[s]=jt(t[e+s],t[i+s],d);return void(o.length=n)}u=e}}for(let e=0;e<n;++e)o[e]=t[u+e];o.length=n}function Ti(t,e,i,n,s){let r=t[e],o=t[e+1];for(e+=n;e<i;e+=n){const i=t[e],n=t[e+1],a=Dt(r,o,i,n);a>s&&(s=a),r=i,o=n}return s}function Pi(t,e,i,n,s){for(let r=0,o=i.length;r<o;++r){const o=i[r];s=Ti(t,e,o,n,s),e=o}return s}function Fi(t,e,i,n,s,r,o,a,l,h,c){if(e==i)return h;let u,d;if(0===s){if(d=Dt(o,a,t[e],t[e+1]),d<h){for(u=0;u<n;++u)l[u]=t[e+u];return l.length=n,d}return h}c=c||[NaN,NaN];let g=e+n;for(;g<i;)if(Mi(t,g-n,g,n,o,a,c),d=Dt(o,a,c[0],c[1]),d<h){for(h=d,u=0;u<n;++u)l[u]=c[u];l.length=n,g+=n}else g+=n*Math.max((Math.sqrt(d)-Math.sqrt(h))/s|0,1);if(r&&(Mi(t,i-n,e,n,o,a,c),d=Dt(o,a,c[0],c[1]),d<h)){for(h=d,u=0;u<n;++u)l[u]=c[u];l.length=n}return h}function Li(t,e,i,n,s,r,o,a,l,h,c){c=c||[NaN,NaN];for(let u=0,d=i.length;u<d;++u){const d=i[u];h=Fi(t,e,d,n,s,r,o,a,l,h,c),e=d}return h}function ki(t,e,i,n){for(let s=0,r=i.length;s<r;++s){const r=i[s];for(let i=0;i<n;++i)t[e++]=r[i]}return e}function Ai(t,e,i,n,s){s=s||[];let r=0;for(let o=0,a=i.length;o<a;++o){const a=ki(t,e,i[o],n);s[r++]=a,e=a}return s.length=r,s}function Oi(t,e,i,n,s){s=s||[];let r=0;for(let o=0,a=i.length;o<a;++o){const a=Ai(t,e,i[o],n,s[r]);0===a.length&&(a[0]=e),s[r++]=a,e=a[a.length-1]}return s.length=r,s}function Di(t,e,i,n,s){s=void 0!==s?s:[];let r=0;for(let o=e;o<i;o+=n)s[r++]=t.slice(o,o+n);return s.length=r,s}function Gi(t,e,i,n,s){s=void 0!==s?s:[];let r=0;for(let o=0,a=i.length;o<a;++o){const a=i[o];s[r++]=Di(t,e,a,n,s[r]),e=a}return s.length=r,s}function zi(t,e,i,n,s){s=void 0!==s?s:[];let r=0;for(let o=0,a=i.length;o<a;++o){const a=i[o];s[r++]=1===a.length&&a[0]===e?[]:Gi(t,e,a,n,s[r]),e=a[a.length-1]}return s.length=r,s}function Ni(t,e,i,n,s){return!_t(s,function(s){return!ji(t,e,i,n,s[0],s[1])})}function ji(t,e,i,n,s,r){let o=0,a=t[i-n],l=t[i-n+1];for(;e<i;e+=n){const i=t[e],n=t[e+1];l<=r?n>r&&(i-a)*(r-l)-(s-a)*(n-l)>0&&o++:n<=r&&(i-a)*(r-l)-(s-a)*(n-l)<0&&o--,a=i,l=n}return 0!==o}function Xi(t,e,i,n,s,r){if(0===i.length)return!1;if(!ji(t,e,i[0],n,s,r))return!1;for(let e=1,o=i.length;e<o;++e)if(ji(t,i[e-1],i[e],n,s,r))return!1;return!0}function Ki(t,e,i,n,s){let r;for(e+=n;e<i;e+=n)if(r=s(t.slice(e-n,e),t.slice(e,e+n)),r)return r;return!1}function Wi(t,e,i,n,s,r){return r=r??gt([1/0,1/0,-1/0,-1/0],t,e,i,n),!!Tt(s,r)&&(r[0]>=s[0]&&r[2]<=s[2]||r[1]>=s[1]&&r[3]<=s[3]||Ki(t,e,i,n,function(t,e){return function(t,e,i){let n=!1;const s=st(t,e),r=st(t,i);if(s===B||r===B)n=!0;else{const o=t[0],a=t[1],l=t[2],h=t[3],c=e[0],u=e[1],d=i[0],g=i[1],f=(g-u)/(d-c);let _,p;r&V&&!(s&V)&&(_=d-(g-h)/f,n=_>=o&&_<=l),n||!(r&U)||s&U||(p=g-(d-l)*f,n=p>=a&&p<=h),n||!(r&q)||s&q||(_=d-(g-a)/f,n=_>=o&&_<=l),n||!(r&$)||s&$||(p=g-(d-o)*f,n=p>=a&&p<=h)}return n}(s,t,e)}))}function Yi(t,e,i,n,s){return!!Wi(t,e,i,n,s)||(!!ji(t,e,i,n,s[0],s[1])||(!!ji(t,e,i,n,s[0],s[3])||(!!ji(t,e,i,n,s[2],s[1])||!!ji(t,e,i,n,s[2],s[3]))))}function Zi(t,e,i,n,s){if(!Yi(t,e,i[0],n,s))return!1;if(1===i.length)return!0;for(let e=1,r=i.length;e<r;++e)if(Ni(t,i[e-1],i[e],n,s)&&!Wi(t,i[e-1],i[e],n,s))return!1;return!0}function Bi(t,e,i,n,s,r,o){const a=(i-e)/n;if(a<3){for(;e<i;e+=n)r[o++]=t[e],r[o++]=t[e+1];return o}const l=new Array(a);l[0]=1,l[a-1]=1;const h=[e,i-n];let c=0;for(;h.length>0;){const i=h.pop(),r=h.pop();let o=0;const a=t[r],u=t[r+1],d=t[i],g=t[i+1];for(let e=r+n;e<i;e+=n){const i=Ot(t[e],t[e+1],a,u,d,g);i>o&&(c=e,o=i)}o>s&&(l[(c-e)/n]=1,r+n<c&&h.push(r,c),c+n<i&&h.push(c,i))}for(let i=0;i<a;++i)l[i]&&(r[o++]=t[e+i*n],r[o++]=t[e+i*n+1]);return o}function Vi(t,e,i,n,s,r,o,a){for(let l=0,h=i.length;l<h;++l){const h=i[l];o=Bi(t,e,h,n,s,r,o),a.push(o),e=h}return o}function Ui(t,e){return e*Math.round(t/e)}function qi(t,e,i,n,s,r,o){if(e==i)return o;let a,l,h=Ui(t[e],s),c=Ui(t[e+1],s);e+=n,r[o++]=h,r[o++]=c;do{if(a=Ui(t[e],s),l=Ui(t[e+1],s),(e+=n)==i)return r[o++]=a,r[o++]=l,o}while(a==h&&l==c);for(;e<i;){const i=Ui(t[e],s),u=Ui(t[e+1],s);if(e+=n,i==a&&u==l)continue;const d=a-h,g=l-c,f=i-h,_=u-c;d*_==g*f&&(d<0&&f<d||d==f||d>0&&f>d)&&(g<0&&_<g||g==_||g>0&&_>g)?(a=i,l=u):(r[o++]=a,r[o++]=l,h=a,c=l,a=i,l=u)}return r[o++]=a,r[o++]=l,o}function $i(t,e,i,n,s,r,o,a){for(let l=0,h=i.length;l<h;++l){const h=i[l];o=qi(t,e,h,n,s,r,o),a.push(o),e=h}return o}class Hi extends Si{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 Hi(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(Ti(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Fi(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!0,t,e,i,n))}getArea(){return Ri(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinates(){return Di(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getSimplifiedGeometryInternal(t){const e=[];return e.length=Bi(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e,0),new Hi(e,"XY")}getType(){return"LinearRing"}intersectsExtent(t){return Wi(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=ki(this.flatCoordinates,0,t,this.stride),this.changed()}}class Ji extends Si{constructor(t,e){super(),this.setCoordinates(t,e)}clone(){const t=new Ji(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(t,e,i,n){const s=this.flatCoordinates,r=Dt(t,e,s[0],s[1]);if(r<n){const t=this.stride;for(let e=0;e<t;++e)i[e]=s[e];return i.length=t,r}return n}getCoordinates(){return this.flatCoordinates.slice()}computeExtent(t){return lt(this.flatCoordinates,t)}getType(){return"Point"}intersectsExtent(t){return nt(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,n){for(let s=0;s<n;++s)t[e++]=i[s];return e}(this.flatCoordinates,0,t,this.stride),this.changed()}}function Qi(t,e,i,n,s,r,o){let a,l,h,c,u,d,g;const f=s[r+1],_=[];for(let s=0,r=i.length;s<r;++s){const r=i[s];for(c=t[r-n],d=t[r-n+1],a=e;a<r;a+=n)u=t[a],g=t[a+1],(f<=d&&g<=f||d<=f&&f<=g)&&(h=(f-d)/(g-d)*(u-c)+c,_.push(h)),c=u,d=g}let p=NaN,m=-1/0;for(_.sort(w),c=_[0],a=1,l=_.length;a<l;++a){u=_[a];const s=Math.abs(u-c);s>m&&(h=(c+u)/2,Xi(t,e,i,n,h,f)&&(p=h,m=s)),c=u}return isNaN(p)&&(p=s[r]),o?(o.push(p,f,m),o):[p,f,m]}function tn(t,e,i,n,s){let r=[];for(let o=0,a=i.length;o<a;++o){const a=i[o];r=Qi(t,e,a,n,s,2*o,r),e=a[a.length-1]}return r}function en(t,e,i,n){for(;e<i-n;){for(let s=0;s<n;++s){const r=t[e+s];t[e+s]=t[i-n+s],t[i-n+s]=r}e+=n,i-=n}}function nn(t,e,i,n){let s=0,r=t[i-n],o=t[i-n+1];for(;e<i;e+=n){const i=t[e],n=t[e+1];s+=(i-r)*(n+o),r=i,o=n}return 0===s?void 0:s>0}function sn(t,e,i,n,s){s=void 0!==s&&s;for(let r=0,o=i.length;r<o;++r){const o=i[r],a=nn(t,e,o,n);if(0===r){if(s&&a||!s&&!a)return!1}else if(s&&!a||!s&&a)return!1;e=o}return!0}function rn(t,e,i,n,s){for(let r=0,o=i.length;r<o;++r){const o=i[r];if(!sn(t,e,o,n,s))return!1;o.length&&(e=o[o.length-1])}return!0}function on(t,e,i,n,s){s=void 0!==s&&s;for(let r=0,o=i.length;r<o;++r){const o=i[r],a=nn(t,e,o,n);(0===r?s&&a||!s&&!a:s&&!a||!s&&a)&&en(t,e,o,n),e=o}return e}function an(t,e,i,n,s){for(let r=0,o=i.length;r<o;++r)e=on(t,e,i[r],n,s);return e}class ln extends Si{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?b(this.flatCoordinates,t.getFlatCoordinates()):this.flatCoordinates=t.getFlatCoordinates().slice(),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){const t=new ln(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(Pi(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Li(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!0,t,e,i,n))}containsXY(t,e){return Xi(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,e)}getArea(){return Ii(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride)}getCoordinates(t){let e;return void 0!==t?(e=this.getOrientedFlatCoordinates().slice(),on(e,0,this.ends_,this.stride,t)):e=this.flatCoordinates,Gi(e,0,this.ends_,this.stride)}getEnds(){return this.ends_}getFlatInteriorPoint(){if(this.flatInteriorPointRevision_!=this.getRevision()){const t=xt(this.getExtent());this.flatInteriorPoint_=Qi(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,0),this.flatInteriorPointRevision_=this.getRevision()}return this.flatInteriorPoint_}getInteriorPoint(){return new Ji(this.getFlatInteriorPoint(),"XYM")}getLinearRingCount(){return this.ends_.length}getLinearRing(t){return t<0||this.ends_.length<=t?null:new Hi(this.flatCoordinates.slice(0===t?0:this.ends_[t-1],this.ends_[t]),this.layout)}getLinearRings(){const t=this.layout,e=this.flatCoordinates,i=this.ends_,n=[];let s=0;for(let r=0,o=i.length;r<o;++r){const o=i[r],a=new Hi(e.slice(s,o),t);n.push(a),s=o}return n}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){const t=this.flatCoordinates;sn(t,0,this.ends_,this.stride)?this.orientedFlatCoordinates_=t:(this.orientedFlatCoordinates_=t.slice(),this.orientedFlatCoordinates_.length=on(this.orientedFlatCoordinates_,0,this.ends_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(t){const e=[],i=[];return e.length=$i(this.flatCoordinates,0,this.ends_,this.stride,Math.sqrt(t),e,0,i),new ln(e,"XY",i)}getType(){return"Polygon"}intersectsExtent(t){return Zi(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,2),this.flatCoordinates||(this.flatCoordinates=[]);const i=Ai(this.flatCoordinates,0,t,this.stride,this.ends_);this.flatCoordinates.length=0===i.length?0:i[i.length-1],this.changed()}}function hn(t){if(Pt(t))throw new Error("Cannot create polygon from empty extent");const e=t[0],i=t[1],n=t[2],s=t[3],r=[e,i,e,s,n,s,n,i,e,i];return new ln(r,"XY",[r.length])}var cn=0,un=1,dn=2,gn=3;const fn="undefined"!=typeof navigator&&void 0!==navigator.userAgent?navigator.userAgent.toLowerCase():"";fn.includes("safari")&&!fn.includes("chrom")&&(fn.includes("version/15.4")||/cpu (os|iphone os) 15_4 like mac os x/.test(fn));const _n=fn.includes("webkit")&&!fn.includes("edge"),pn=fn.includes("macintosh"),mn="undefined"!=typeof devicePixelRatio?devicePixelRatio:1,yn="undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof OffscreenCanvas&&self instanceof WorkerGlobalScope,xn="undefined"!=typeof Image&&Image.prototype.decode,vn=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}();function wn(t,e){return e&&(t.src=e),t.src&&xn?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(){r(),e(t)}function s(){r(),i(new Error("Image load error"))}function r(){t.removeEventListener("load",n),t.removeEventListener("error",s)}t.addEventListener("load",n),t.addEventListener("error",s)})}(t)}var Cn=0,Sn=1,En=2,bn=3,Rn=4;function In(t){return Math.pow(t,3)}function Mn(t){return 1-In(1-t)}function Tn(t){return 3*t*t-2*t*t*t}function Pn(t){return t}class Fn extends D{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(h)}release(){this.setState(Rn)}getKey(){return this.key+"/"+this.tileCoord}getTileCoord(){return this.tileCoord}getState(){return this.state}setState(t){if(this.state!==Rn){if(this.state!==bn&&this.state>t)throw new Error("Tile load sequence violation");this.state=t,this.changed()}}load(){I()}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:In(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()}}function Ln(t,e,i,n){let s;return s=i&&i.length?i.shift():yn?new class extends OffscreenCanvas{style={}}(t??300,e??150):document.createElement("canvas"),t&&(s.width=t),e&&(s.height=e),s.getContext("2d",n)}let kn;function An(){return kn||(kn=Ln(1,1)),kn}function On(t){const e=t.canvas;e.width=1,e.height=1,t.clearRect(0,0,1,1)}function Dn(t){let e=t.offsetWidth;const i=getComputedStyle(t);return e+=parseInt(i.marginLeft,10)+parseInt(i.marginRight,10),e}function Gn(t){let e=t.offsetHeight;const i=getComputedStyle(t);return e+=parseInt(i.marginTop,10)+parseInt(i.marginBottom,10),e}function zn(t,e){const i=e.parentNode;i&&i.replaceChild(t,e)}function Nn(t){for(;t.lastChild;)t.lastChild.remove()}function jn(){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 Xn(t){return"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof OffscreenCanvas&&t instanceof OffscreenCanvas}class Kn extends Fn{constructor(t,e,i,n,s,r){super(t,e,r),this.crossOrigin_=n?.crossOrigin,this.referrerPolicy_=n?.referrerPolicy,this.src_=i,this.key=i,this.image_,yn?this.image_=new OffscreenCanvas(1,1):(this.image_=new Image,null!==this.crossOrigin_&&void 0!==this.crossOrigin_&&(this.image_.crossOrigin=this.crossOrigin_),void 0!==this.referrerPolicy_&&(this.image_.referrerPolicy=this.referrerPolicy_)),this.unlisten_=null,this.tileLoadFunction_=s}getImage(){return this.image_}setImage(t){this.image_=t,this.state=En,this.unlistenImage_(),this.changed()}getCrossOrigin(){return this.crossOrigin_??null}getReferrerPolicy(){return this.referrerPolicy_}handleImageError_(){this.state=bn,this.unlistenImage_(),this.image_=function(){const t=Ln(1,1);return t.fillStyle="rgba(0,0,0,0)",t.fillRect(0,0,1,1),t.canvas}(),this.changed()}handleImageLoad_(){if(yn)this.state=En;else{const t=this.image_;t.naturalWidth&&t.naturalHeight?this.state=En:this.state=Rn}this.unlistenImage_(),this.changed()}load(){if(this.state==bn&&(this.state=Cn,this.image_=new Image,null!==this.crossOrigin_&&void 0!==this.crossOrigin_&&(this.image_.crossOrigin=this.crossOrigin_),void 0!==this.referrerPolicy_&&(this.image_.referrerPolicy=this.referrerPolicy_)),this.state==Cn){this.state=Sn,this.changed(),this.tileLoadFunction_(this,this.src_);const t=this.image_;t&&(this.unlisten_=function(t,e,i){const n=t;let s=!0,r=!1,o=!1;const h=[a(n,m,function(){o=!0,r||e()})];return n.src&&xn?(r=!0,n.decode().then(function(){s&&e()}).catch(function(t){s&&(o?e():i())})):h.push(a(n,c,i)),function(){s=!1,h.forEach(l)}}(t,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this)))}}unlistenImage_(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)}disposeInternal(){this.unlistenImage_(),this.image_=null,super.disposeInternal()}}class Wn{constructor(t,e,i){this.decay_=t,this.minVelocity_=e,this.delay_=i,this.points_=[],this.angle_=0,this.initialVelocity_=0}begin(){this.points_.length=0,this.angle_=0,this.initialVelocity_=0}update(t,e){this.points_.push(t,e,Date.now())}end(){if(this.points_.length<6)return!1;const t=Date.now()-this.delay_,e=this.points_.length-3;if(this.points_[e+2]<t)return!1;let i=e-3;for(;i>0&&this.points_[i+2]>t;)i-=3;const n=this.points_[e+2]-this.points_[i+2];if(n<1e3/60)return!1;const s=this.points_[e]-this.points_[i],r=this.points_[e+1]-this.points_[i+1];return this.angle_=Math.atan2(r,s),this.initialVelocity_=Math.sqrt(s*s+r*r)/n,this.initialVelocity_>this.minVelocity_}getDistance(){return(this.minVelocity_-this.initialVelocity_)/this.decay_}getAngle(){return this.angle_}}function Yn(t,e,i,n,s,r,o){let a,l;const h=(i-e)/n;if(1===h)a=e;else if(2===h)a=e,l=s;else if(0!==h){let r=t[e],o=t[e+1],h=0;const c=[0];for(let s=e+n;s<i;s+=n){const e=t[s],i=t[s+1];h+=Math.sqrt((e-r)*(e-r)+(i-o)*(i-o)),c.push(h),r=e,o=i}const u=s*h,d=function(t,e,i){let n,s;i=i||w;let r=0,o=t.length,a=!1;for(;r<o;)n=r+(o-r>>1),s=+i(t[n],e),s<0?r=n+1:(o=n,a=!s);return a?r:~r}(c,u);d<0?(l=(u-c[-d-2])/(c[-d-1]-c[-d-2]),a=e+(-d-2)*n):a=e+d*n}o=void 0!==o&&o>1?o:2,r=r||new Array(o);for(let e=0;e<o;++e)r[e]=void 0===a?NaN:void 0===l?t[a+e]:jt(t[a+e],t[a+n+e],l);return r}function Zn(t,e,i,n,s,r){if(i==e)return null;let o;if(s<t[e+n-1])return r?(o=t.slice(e,e+n),o[n-1]=s,o):null;if(t[i-1]<s)return r?(o=t.slice(i-n,i),o[n-1]=s,o):null;if(s==t[e+n-1])return t.slice(e,e+n);let a=e/n,l=i/n;for(;a<l;){const e=a+l>>1;s<t[(e+1)*n-1]?l=e:a=e+1}const h=t[a*n-1];if(s==h)return t.slice((a-1)*n,(a-1)*n+n);const c=(s-h)/(t[(a+1)*n-1]-h);o=[];for(let e=0;e<n-1;++e)o.push(jt(t[(a-1)*n+e],t[a*n+e],c));return o.push(s),o}function Bn(t,e,i,n){let s=t[e],r=t[e+1],o=0;for(let a=e+n;a<i;a+=n){const e=t[a],i=t[a+1];o+=Math.sqrt((e-s)*(e-s)+(i-r)*(i-r)),s=e,r=i}return o}class Vn extends Si{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){b(this.flatCoordinates,t),this.changed()}clone(){const t=new Vn(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(Ti(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Fi(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!1,t,e,i,n))}forEachSegment(t){return Ki(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,Zn(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e))}getCoordinates(){return Di(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinateAt(t,e){return Yn(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e,this.stride)}getLength(){return Bn(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=Bi(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e,0),new Vn(e,"XY")}getType(){return"LineString"}intersectsExtent(t){return Wi(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=ki(this.flatCoordinates,0,t,this.stride),this.changed()}}const Un=[NaN,NaN,NaN,0];let qn;const $n=/^rgba?\(\s*(\d+%?)\s+(\d+%?)\s+(\d+%?)(?:\s*\/\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,Hn=/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,Jn=/^rgba?\(\s*(\d+%)\s*,\s*(\d+%)\s*,\s*(\d+%)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,Qn=/^#([\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$/i;function ts(t,e){return t.endsWith("%")?Number(t.substring(0,t.length-1))/e:Number(t)}function es(t){throw new Error('failed to parse "'+t+'" as color')}function is(t){if(t.toLowerCase().startsWith("rgb")){const e=t.match(Hn)||t.match($n)||t.match(Jn);if(e){const t=e[4],i=100/255;return[At(ts(e[1],i)+.5|0,0,255),At(ts(e[2],i)+.5|0,0,255),At(ts(e[3],i)+.5|0,0,255),void 0!==t?At(ts(t,100),0,1):1]}es(t)}if(t.startsWith("#")){if(Qn.test(t)){const e=t.substring(1),i=e.length<=4?1:2,n=[0,0,0,255];for(let t=0,s=e.length;t<s;t+=i){let s=parseInt(e.substring(t,t+i),16);1===i&&(s+=s<<4),n[t/i]=s}return n[3]=n[3]/255,n}es(t)}const e=(qn||(qn=Ln(1,1,void 0,{willReadFrequently:!0,desynchronized:!0})),qn);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&&es(t));const n=e.fillStyle;if(n.startsWith("#")||n.startsWith("rgba"))return is(n);e.clearRect(0,0,1,1),e.fillRect(0,0,1,1);const s=Array.from(e.getImageData(0,0,1,1).data);return s[3]=Xt(s[3]/255,3),s}const ns={};let ss=0;function rs(t){if(4===t.length)return t;const e=t.slice();return e[3]=1,e}function os(t){return t>.0031308?269.025*Math.pow(t,1/2.4)-14.025:3294.6*t}function as(t){return t>.2068965?Math.pow(t,3):108/841*(t-4/29)}function ls(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 cs(t){const e=ls(t[0]),i=ls(t[1]),n=ls(t[2]),s=hs(.222488403*e+.716873169*i+.06060791*n),r=500*(hs(.452247074*e+.399439023*i+.148375274*n)-s),o=200*(s-hs(.016863605*e+.117638439*i+.865350722*n)),a=Math.atan2(o,r)*(180/Math.PI);return[116*s-16,Math.sqrt(r*r+o*o),a<0?a+360:a,t[3]]}function us(t){if("none"===t)return Un;if(ns.hasOwnProperty(t))return ns[t];if(ss>=1024){let t=0;for(const e in ns)3&t++||(delete ns[e],--ss)}const e=is(t);4!==e.length&&es(t);for(const i of e)isNaN(i)&&es(t);return ns[t]=e,++ss,e}function ds(t){return Array.isArray(t)?t:us(t)}function gs(t){let e=t[0];e!=(0|e)&&(e=e+.5|0);let i=t[1];i!=(0|i)&&(i=i+.5|0);let n=t[2];n!=(0|n)&&(n=n+.5|0);return"rgba("+e+","+i+","+n+","+(void 0===t[3]?1:Math.round(1e3*t[3])/1e3)+")"}function fs(t,e){return t+":"+(e?ds(e):"null")}const _s=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=fs(t,e);return i in this.cache_?this.cache_[i]:null}getPattern(t,e){const i=fs(t,e);return i in this.patternCache_?this.patternCache_[i]:null}set(t,e,i,n){const s=fs(t,e),r=s in this.cache_;if(i&&(this.cache_[s]=i),n&&i)if(i.getImageState()===cn&&i.load(),i.getImageState()===un)i.ready().then(()=>{const t=An().createPattern(i.getImage(1),"repeat");t&&(this.patternCache_[s]=t)});else{const t=An().createPattern(i.getImage(1),"repeat");t&&(this.patternCache_[s]=t)}r||++this.cacheSize_}setSize(t){this.maxCacheSize_=t,this.expire()}};let ps=null;class ms extends D{constructor(t,e,i,n,s){super(),this.hitDetectionImage_=null,this.image_=t,this.crossOrigin_=i?.crossOrigin??null,this.referrerPolicy_=i?.referrerPolicy,this.canvas_={},this.color_=s,this.imageState_=void 0===n?cn: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_&&this.imageState_===dn){const t=this.image_;if(!t)return!1;ps||(ps=Ln(1,1,void 0,{willReadFrequently:!0})),ps.drawImage(t,0,0);try{ps.getImageData(0,0,1,1),this.tainted_=!1}catch{ps=null,this.tainted_=!0}}return!0===this.tainted_}dispatchChangeEvent_(){this.dispatchEvent(h)}handleImageError_(){this.imageState_=gn,this.dispatchChangeEvent_()}handleImageLoad_(){this.imageState_=dn;const t=this.image_;t&&"width"in t&&"height"in t&&(this.size_=[t.width,t.height]),this.dispatchChangeEvent_()}getImage(t){this.image_||this.initializeImage_(),this.replaceColor_(t);const e=this.image_;return this.canvas_[t]?this.canvas_[t]:e}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_;if(!t)return this.image_;const e=t[0],i=t[1],n=Ln(e,i);n.fillRect(0,0,e,i),this.hitDetectionImage_=n.canvas}else this.hitDetectionImage_=this.image_;return this.hitDetectionImage_}getSize(){return this.size_}getSrc(){return this.src_}load(){if(this.imageState_===cn){this.image_||this.initializeImage_(),this.imageState_=un;try{void 0!==this.src_&&(this.image_.src=this.src_)}catch{this.handleImageError_()}this.image_ instanceof HTMLImageElement&&wn(this.image_,this.src_).then(t=>{this.image_=t,this.handleImageLoad_()}).catch(this.handleImageError_.bind(this))}}replaceColor_(t){if(!this.color_||this.canvas_[t]||this.imageState_!==dn)return;const e=this.image_;if(!e)return;const i=Ln(Math.ceil(e.width*t),Math.ceil(e.height*t)),n=i.canvas;var s;i.scale(t,t),i.drawImage(e,0,0),i.globalCompositeOperation="multiply",i.fillStyle="string"==typeof(s=this.color_)?s:gs(s),i.fillRect(0,0,n.width/t,n.height/t),i.globalCompositeOperation="destination-in",i.drawImage(e,0,0),this.canvas_[t]=n}ready(){return this.ready_||(this.ready_=new Promise(t=>{if(this.imageState_===dn||this.imageState_===gn)t();else{const e=()=>{this.imageState_!==dn&&this.imageState_!==gn||(this.removeEventListener(h,e),t())};this.addEventListener(h,e)}})),this.ready_}}function ys(t,e,i,n,s,r){let o=void 0===e?void 0:_s.get(e,s);return o||(o=new ms(t,t&&"src"in t?t.src||void 0:e,i,n,s),void 0!==e&&_s.set(e,s,o,r)),r&&o&&void 0!==e&&!_s.getPattern(e,s)&&_s.set(e,s,o,r),o}function xs(t){return t?Array.isArray(t)?gs(t):"object"==typeof t&&"src"in t?function(t){if(!t.offset||!t.size)return _s.getPattern(t.src,t.color??null);const e=t.src+":"+t.offset,i=_s.getPattern(e,t.color??null);if(i)return i;const n=_s.get(t.src,null);if(!n||n.getImageState()!==dn)return null;const s=Ln(t.size[0],t.size[1]);return s.drawImage(n.getImage(1),t.offset[0],t.offset[1],t.size[0],t.size[1],0,0,t.size[0],t.size[1]),ys(s.canvas,e,{},dn,t.color??null,!0),_s.getPattern(e,t.color??null)}(t):t:null}function vs(t,e,i,n,s,r,o,a){o=o??[],a=a??n;const l=t[e+n],h=t[e+n+1],c=t[i-2*n],u=t[i-2*n+1];let d,g,f,_,p,m,y,x,v=0;for(let w=e;w<i;w+=n){f=d,_=g,p=void 0,m=void 0,w+n<i&&(p=t[w+n],m=t[w+n+1]),r&&w===e&&(f=c,_=u),r&&w===i-n&&(p=l,m=h),d=t[w],g=t[w+1],[y,x]=ws(d,g,f,_,p,m,s),o[v++]=y,o[v++]=x;for(let e=2;e<a;e++)o[v++]=t[w+e]}return o.length!=v&&(o.length=v),o}function ws(t,e,i,n,s,r,o){let a,l;void 0!==i&&void 0!==n?(a=t-i,l=e-n):void 0!==s&&void 0!==r?(a=s-t,l=r-e):(a=1,l=0);const h=Math.hypot(a,l),c=a/h,u=l/h;if(a=-u,l=c,void 0===i||void 0===n)return[t+a*o,e+l*o];if(void 0===s||void 0===r)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])),s=[(e[0]-t[0])/n,(e[1]-t[1])/n],r=[-s[1],s[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(At(a[0]*s[0]+a[1]*s[1],-1,1));return l=Math.max(l,1e-5),a[0]*r[0]+a[1]*r[1]>0?l:2*Math.PI-l}([t,e],[i,n],[s,r]);if(Math.cos(d)>.998)return[t+c*o,e+u*o];const g=Math.cos(d/2),f=Math.sin(d/2);return[t+(f*a+g*l)*(1/f)*o,e+(-g*a+f*l)*(1/f)*o]}function Cs(t,e,i=!1){for(let n=0,s=t.length-2;n<s;n+=e){for(let s=i&&0===n?t.length-3*e:t.length-2*e;s>n+e;s-=e){const i=t[n],r=t[n+1],o=t[n+e],a=t[n+e+1],l=t[s],h=t[s+1],c=t[s+e],u=t[s+e+1],d=(u-h)*(o-i)-(c-l)*(a-r);if(0===d)continue;const g=((c-l)*(r-h)-(u-h)*(i-l))/d,f=((o-i)*(r-h)-(a-r)*(i-l))/d;if(g>0&&g<1&&f>0&&f<1){const l=i+g*(o-i),h=r+g*(a-r);t[n+e]=l,t[n+e+1]=h,t.splice(n+2*e,s-n-e);break}}}return t}class Ss{drawCustom(t,e,i,n,s){}drawGeometry(t){}setStyle(t){}drawCircle(t,e,i){}drawFeature(t,e,i){}drawGeometryCollection(t,e,i){}drawLineString(t,e,i){}drawMultiLineString(t,e,i){}drawMultiPoint(t,e,i){}drawMultiPolygon(t,e,i){}drawPoint(t,e,i){}drawPolygon(t,e,i){}drawText(t,e,i){}setFillStrokeStyle(t,e){}setImageStyle(t,e){}setTextStyle(t,e){}}const Es="ol-hidden",bs="ol-unselectable",Rs="ol-unsupported",Is="ol-control",Ms="ol-collapsed",Ts=new RegExp(["^\\s*(?=(?:(?:[-a-z]+\\s*){0,2}(italic|oblique))?)","(?=(?:(?:[-a-z]+\\s*){0,2}(small-caps))?)","(?=(?:(?:[-a-z]+\\s*){0,2}(bold(?:er)?|lighter|[1-9]00 ))?)","(?:(?:normal|\\1|\\2|\\3)\\s*){0,3}((?:xx?-)?","(?:small|large)|medium|smaller|larger|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx]))","(?:\\s*\\/\\s*(normal|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx])?))","?\\s*([-,\\\"\\'\\sa-z0-9]+?)\\s*$"].join(""),"i"),Ps=["style","variant","weight","size","lineHeight","family"],Fs={normal:400,bold:700},Ls=function(t){const e=t.match(Ts);if(!e)return null;const i={lineHeight:"normal",size:"1.2em",style:"normal",weight:"400",variant:"normal"};for(let t=0,n=Ps.length;t<n;++t){const n=e[t+1];void 0!==n&&(i[Ps[t]]="string"==typeof n?n.trim():n)}return isNaN(Number(i.weight))&&i.weight in Fs&&(i.weight=Fs[i.weight]),i.families=i.family.split(/,\s?/).map(t=>t.trim().replace(/^['"]|['"]$/g,"")),i},ks="10px sans-serif",As="#000",Os="round",Ds=[],Gs="round",zs="#000",Ns="center",js="middle",Xs=[0,0,0,0],Ks=new N;let Ws,Ys=null;const Zs={},Bs=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace","ui-rounded","emoji","math","fangsong"]);function Vs(t,e,i){return`${t} ${e} 16px "${i}"`}const Us=function(){const t=100;let e,i;async function n(t){await i.ready;const e=Ls(t);if(!e)return!1;const n=e.families[0].toLowerCase(),s=e.weight,r=[];if(i.forEach(t=>{const i=t.family.replace(/^['"]|['"]$/g,"").toLowerCase(),o=Fs[t.weight]||t.weight;i===n&&t.style===e.style&&o==s&&r.push(t)}),0===r.length)return!1;return(await Promise.all(r.map(t=>t.load().then(()=>!0,()=>!1)))).some(t=>t)}async function r(){await i.ready;let o=!0;const a=Ks.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)?(s(Zs),Ks.set(i,t)):(r+=10,Ks.set(i,r,!0),r<t&&(o=!1)))}e=void 0,o||(e=setTimeout(r,100))}return async function(t){i||(i=yn?self.fonts:document.fonts);const n=Ls(t);if(!n)return;const s=n.families;let o=!1;for(const t of s){if(Bs.has(t))continue;const e=Vs(n.style,n.weight,t);void 0===Ks.get(e)&&(Ks.set(e,0,!0),o=!0)}o&&(clearTimeout(e),e=setTimeout(r,100))}}(),qs=function(){let t;return function(e){let i=Zs[e];if(null==i){if(yn){const t=Ls(e),n=$s(e,"Žg");i=(!t||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);Zs[e]=i}return i}}();function $s(t,e){return Ys||(Ys=Ln(1,1)),t!=Ws&&(Ys.font=t,Ws=Ys.font),Ys.measureText(e)}function Hs(t,e){return $s(t,e).width}function Js(t,e,i){if(e in i)return i[e];const n=e.split("\n").reduce((e,i)=>Math.max(e,Hs(t,i)),0);return i[e]=n,n}function Qs(t,e,i,n,s,r,o,a,l,h,c){t.save(),1!==i&&(void 0===t.globalAlpha?t.globalAlpha=function(t){return t.globalAlpha*=i}:t.globalAlpha*=i),e&&t.transform.apply(t,e),n.contextInstructions?(t.translate(l,h),t.scale(c[0],c[1]),function(t,e){const i=e,n=t.contextInstructions;for(let t=0,e=n.length;t<e;t+=2)if(Array.isArray(n[t+1])){i[n[t]].apply(i,n[t+1])}else{i[n[t]]=n[t+1]}}(n,t)):c[0]<0||c[1]<0?(t.translate(l,h),t.scale(c[0],c[1]),t.drawImage(n,s,r,o,a,0,0,o,a)):t.drawImage(n,s,r,o,a,l,h,o*c[0],a*c[1]),t.restore()}class tr extends Ss{constructor(t,e,i,n,s,r,o){super(),this.context_=t,this.pixelRatio_=e,this.extent_=i,this.transform_=n,this.transformRotation_=n?Xt(Math.atan2(n[1],n[0]),10):0,this.viewRotation_=s,this.squaredTolerance_=r,this.userTransform_=o,this.contextFillState_=null,this.contextStrokeState_=null,this.contextTextState_=null,this.fillState_=null,this.strokeState_=null,this.image_=null,this.imageAnchorX_=0,this.imageAnchorY_=0,this.imageHeight_=0,this.imageOpacity_=0,this.imageOriginX_=0,this.imageOriginY_=0,this.imageRotateWithView_=!1,this.imageRotation_=0,this.imageScale_=[0,0],this.imageWidth_=0,this.text_="",this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=!1,this.textRotation_=0,this.textScale_=[0,0],this.textFillState_=null,this.textStrokeState_=null,this.textState_=null,this.pixelCoordinates_=[],this.tmpLocalTransform_=di()}drawImages_(t,e,i,n){if(!this.image_)return;const s=yi(t,e,i,n,this.transform_,this.pixelCoordinates_),r=this.context_,o=this.tmpLocalTransform_,a=r.globalAlpha;1!=this.imageOpacity_&&(r.globalAlpha=a*this.imageOpacity_);let l=this.imageRotation_;0===this.transformRotation_&&(l-=this.viewRotation_),this.imageRotateWithView_&&(l+=this.viewRotation_);for(let t=0,e=s.length;t<e;t+=2){const e=s[t]-this.imageAnchorX_,i=s[t+1]-this.imageAnchorY_;if(0!==l||1!=this.imageScale_[0]||1!=this.imageScale_[1]){const t=e+this.imageAnchorX_,n=i+this.imageAnchorY_;fi(o,t,n,1,1,l,-t,-n),r.save(),r.transform.apply(r,o),r.translate(t,n),r.scale(this.imageScale_[0],this.imageScale_[1]),r.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,-this.imageAnchorX_,-this.imageAnchorY_,this.imageWidth_,this.imageHeight_),r.restore()}else r.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,e,i,this.imageWidth_,this.imageHeight_)}1!=this.imageOpacity_&&(r.globalAlpha=a)}drawText_(t,e,i,n){if(!this.textState_||""===this.text_)return;this.textFillState_&&this.setContextFillState_(this.textFillState_),this.textStrokeState_&&this.setContextStrokeState_(this.textStrokeState_),this.setContextTextState_(this.textState_);const s=yi(t,e,i,n,this.transform_,this.pixelCoordinates_),r=this.context_;let o=this.textRotation_;for(0===this.transformRotation_&&(o-=this.viewRotation_),this.textRotateWithView_&&(o+=this.viewRotation_);e<i;e+=n){const t=s[e]+this.textOffsetX_,i=s[e+1]+this.textOffsetY_;0!==o||1!=this.textScale_[0]||1!=this.textScale_[1]?(r.save(),r.translate(t-this.textOffsetX_,i-this.textOffsetY_),r.rotate(o),r.translate(this.textOffsetX_,this.textOffsetY_),r.scale(this.textScale_[0],this.textScale_[1]),this.textStrokeState_&&r.strokeText(this.text_,0,0),this.textFillState_&&r.fillText(this.text_,0,0),r.restore()):(this.textStrokeState_&&r.strokeText(this.text_,t,i),this.textFillState_&&r.fillText(this.text_,t,i))}}moveToLineTo_(t,e,i,n,s,r){const o=this.context_,a=r??0;let l=yi(t,e,i,n,this.transform_,this.pixelCoordinates_);if(Math.abs(a)>0){const t=l.length,e=s||Math.abs(l[0]-l[t-2])<1e-6&&Math.abs(l[1]-l[t-1])<1e-6;l=vs(l,0,t,2,a,e,l),Cs(l,2,e)}o.moveTo(l[0],l[1]);let h=l.length;s&&(h-=2);for(let t=2;t<h;t+=2)o.lineTo(l[t],l[t+1]);return s&&o.closePath(),i}drawRings_(t,e,i,n,s){for(let r=0,o=i.length;r<o;++r)e=this.moveToLineTo_(t,e,i[r],n,!0,s);return e}drawCircle(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),Tt(this.extent_,t.getExtent())){if(this.fillState_||this.strokeState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const e=function(t,e,i){const n=t.getFlatCoordinates();if(!n)return null;const s=t.getStride();return yi(n,0,n.length,s,e,i)}(t,this.transform_,this.pixelCoordinates_);if(!e)return;const i=e[2]-e[0],n=e[3]-e[1],s=Math.sqrt(i*i+n*n),r=this.context_;r.beginPath(),r.arc(e[0],e[1],s,0,2*Math.PI),this.fillState_&&r.fill(),this.strokeState_&&r.stroke()}""!==this.text_&&this.drawText_(t.getCenter(),0,2,2)}}setStyle(t){this.setFillStrokeStyle(t.getFill()??null,t.getStroke()??null),this.setImageStyle(t.getImage()??null),this.setTextStyle(t.getText()??null)}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_)),Tt(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(Tt(this.extent_,e)){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);const e=this.context_,i=t.getFlatCoordinates();let n=0;const s=t.getEnds(),r=t.getStride();e.beginPath();for(let t=0,e=s.length;t<e;++t)n=this.moveToLineTo_(i,n,s[t],r,!1,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_)),Tt(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_)),Tt(this.extent_,t.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const e=this.context_,i=t.getOrientedFlatCoordinates();let n=0;const s=t.getEndss(),r=t.getStride();e.beginPath();for(let t=0,e=s.length;t<e;++t){const e=s[t];n=this.drawRings_(i,n,e,r,this.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),R(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:Ns;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:xs(e||As)||As}}else this.fillState_=null;if(e){const t=e.getColor(),i=e.getLineCap(),n=e.getLineDash(),s=e.getLineDashOffset(),r=e.getLineJoin(),o=e.getWidth(),a=e.getMiterLimit(),l=n||Ds,h=e.getOffset();this.strokeState_={lineCap:void 0!==i?i:Os,lineDash:1===this.pixelRatio_?l:l.map(t=>t*this.pixelRatio_),lineDashOffset:(s||0)*this.pixelRatio_,lineJoin:void 0!==r?r:Gs,lineWidth:(void 0!==o?o:1)*this.pixelRatio_,miterLimit:void 0!==a?a:10,strokeStyle:xs(t||zs)||zs,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(),s=t.getOrigin();if(!n||!s)return void(this.image_=null);this.image_=t.getImage(this.pixelRatio_),this.imageAnchorX_=n[0]*i,this.imageAnchorY_=n[1]*i,this.imageHeight_=e[1]*i,this.imageOpacity_=t.getOpacity(),this.imageOriginX_=s[0],this.imageOriginY_=s[1],this.imageRotateWithView_=t.getRotateWithView(),this.imageRotation_=t.getRotation();const r=t.getScaleArray();this.imageScale_=[r[0]*this.pixelRatio_/i,r[1]*this.pixelRatio_/i],this.imageWidth_=e[0]*i}setTextStyle(t){if(t){const e=t.getFill();if(e){const t=e.getColor();this.textFillState_={fillStyle:xs(t||As)||As}}else this.textFillState_=null;const i=t.getStroke();if(i){const t=i.getColor(),e=i.getLineCap(),n=i.getLineDash(),s=i.getLineDashOffset(),r=i.getLineJoin(),o=i.getWidth(),a=i.getMiterLimit();this.textStrokeState_={lineCap:void 0!==e?e:Os,lineDash:n||Ds,lineDashOffset:s||0,lineJoin:void 0!==r?r:Gs,lineWidth:void 0!==o?o:1,miterLimit:void 0!==a?a:10,strokeStyle:xs(t||zs)||zs}}else this.textStrokeState_=null;const n=t.getFont(),s=t.getOffsetX(),r=t.getOffsetY(),o=t.getRotateWithView(),a=t.getRotation(),l=t.getScaleArray(),h=t.getText(),c=t.getTextAlign(),u=t.getTextBaseline();this.textState_={font:void 0!==n?n:ks,textAlign:void 0!==c?c:Ns,textBaseline:void 0!==u?u:js},this.text_=void 0!==h?Array.isArray(h)?h.reduce((t,e,i)=>t+(i%2?" ":e),""):h:"",this.textOffsetX_=void 0!==s?this.pixelRatio_*s:0,this.textOffsetY_=void 0!==r?this.pixelRatio_*r:0,this.textRotateWithView_=void 0!==o&&o,this.textRotation_=void 0!==a?a:0,this.textScale_=[this.pixelRatio_*l[0],this.pixelRatio_*l[1]]}else this.text_=""}}const er={Point:function(t,e,i,n,s,r){const o=i.getImage(),a=i.getText(),l=a&&a.getText(),h=r&&o&&l?{}:void 0;if(o){if(o.getImageState()!=dn)return;const r=t.getBuilder(i.getZIndex(),"Image");r.setImageStyle(o,h),r.drawPoint(e,n,s)}if(l){const r=t.getBuilder(i.getZIndex(),"Text");r.setTextStyle(a,h),r.drawText(e,n,s)}},LineString:function(t,e,i,n,s){const r=i.getStroke();if(r){const o=t.getBuilder(i.getZIndex(),"LineString");o.setFillStrokeStyle(null,r),o.drawLineString(e,n,s)}const o=i.getText();if(o&&o.getText()){const r=t.getBuilder(i.getZIndex(),"Text");r.setTextStyle(o),r.drawText(e,n,s)}},Polygon:function(t,e,i,n,s){const r=i.getFill(),o=i.getStroke();if(r||o){const a=t.getBuilder(i.getZIndex(),"Polygon");a.setFillStrokeStyle(r,o),a.drawPolygon(e,n,s)}const a=i.getText();if(a&&a.getText()){const r=t.getBuilder(i.getZIndex(),"Text");r.setTextStyle(a),r.drawText(e,n,s)}},MultiPoint:function(t,e,i,n,s,r){const o=i.getImage(),a=o&&0!==o.getOpacity(),l=i.getText(),h=l&&l.getText(),c=r&&a&&h?{}:void 0;if(a){if(o.getImageState()!=dn)return;const r=t.getBuilder(i.getZIndex(),"Image");r.setImageStyle(o,c),r.drawMultiPoint(e,n,s)}if(h){const r=t.getBuilder(i.getZIndex(),"Text");r.setTextStyle(l,c),r.drawText(e,n,s)}},MultiLineString:function(t,e,i,n,s){const r=i.getStroke();if(r){const o=t.getBuilder(i.getZIndex(),"LineString");o.setFillStrokeStyle(null,r),o.drawMultiLineString(e,n,s)}const o=i.getText();if(o&&o.getText()){const r=t.getBuilder(i.getZIndex(),"Text");r.setTextStyle(o),r.drawText(e,n,s)}},MultiPolygon:function(t,e,i,n,s){const r=i.getFill(),o=i.getStroke();if(o||r){const a=t.getBuilder(i.getZIndex(),"Polygon");a.setFillStrokeStyle(r,o),a.drawMultiPolygon(e,n,s)}const a=i.getText();if(a&&a.getText()){const r=t.getBuilder(i.getZIndex(),"Text");r.setTextStyle(a),r.drawText(e,n,s)}},GeometryCollection:function(t,e,i,n,s,r){const o=e.getGeometriesArray();let a,l;for(a=0,l=o.length;a<l;++a){(0,er[o[a].getType()])(t,o[a],i,n,s,r)}},Circle:function(t,e,i,n,s){const r=i.getFill(),o=i.getStroke();if(r||o){const a=t.getBuilder(i.getZIndex(),"Circle");a.setFillStrokeStyle(r,o),a.drawCircle(e,n,s)}const a=i.getText();if(a&&a.getText()){const r=t.getBuilder(i.getZIndex(),"Text");r.setTextStyle(a),r.drawText(e,n,s)}}};function ir(t,e){return parseInt(T(t),10)-parseInt(T(e),10)}function nr(t,e){const i=sr(t,e);return i*i}function sr(t,e){return.5*t/e}function rr(t,e,i,n,s,r,o,a){const l=[],h=i.getImage();if(h){let t=!0;const e=h.getImageState();e==dn||e==gn?t=!1:e==cn&&h.load(),t&&l.push(h.ready())}const c=i.getFill();c&&c.loading()&&l.push(c.ready());const u=l.length>0;return u&&Promise.all(l).then(()=>s(null)),function(t,e,i,n,s,r,o){const a=i.getGeometryFunction()(e);if(!a)return;const l=a.simplifyTransformed(n,s),h=i.getRenderer();if(h)or(t,l,i,e,o);else{(0,er[l.getType()])(t,l,i,e,o,r)}}(t,e,i,n,r,o,a),u}function or(t,e,i,n,s){if("GeometryCollection"==e.getType()){const r=e.getGeometries();for(let e=0,o=r.length;e<o;++e)or(t,r[e],i,n,s);return}t.getBuilder(i.getZIndex(),"Default").drawCustom(e,n,i.getRenderer(),i.getHitDetectionRenderer(),s)}var ar="prerender",lr="postrender",hr="precompose",cr="postcompose",ur="rendercomplete";function dr(t,e){return function(i,n,s,r,o){!function(t,e,i,n,s,r,o){const a=new XMLHttpRequest;a.open("GET","function"==typeof t?t(i,n,s):t,!0),"arraybuffer"==e.getType()&&(a.responseType="arraybuffer"),a.withCredentials=!1,a.onload=function(t){if(!a.status||a.status>=200&&a.status<300){const t=e.getType();try{let n;"text"==t||"json"==t?n=a.responseText:"xml"==t?n=a.responseXML||a.responseText:"arraybuffer"==t&&(n=a.response),n?r(e.readFeatures(n,{extent:i,featureProjection:s}),e.readProjection(n)):o()}catch{o()}}else o()},a.onerror=o,a.send()}(t,e,i,n,s,(t,e)=>{this.addFeatures(t),void 0!==r&&r(t)},()=>{this.changed(),void 0!==o&&o()})}}function gr(t,e){return[[-1/0,-1/0,1/0,1/0]]}class fr extends Si{constructor(t,e,i){if(super(),this.ends_=[],this.maxDelta_=-1,this.maxDeltaRevision_=-1,Array.isArray(t[0]))this.setCoordinates(t,e);else if(void 0!==e&&i)this.setFlatCoordinates(e,t),this.ends_=i;else{const e=t,i=[],n=[];for(let t=0,s=e.length;t<s;++t){b(i,e[t].getFlatCoordinates()),n.push(i.length)}const s=0===e.length?this.getLayout():e[0].getLayout();this.setFlatCoordinates(s,i),this.ends_=n}}appendLineString(t){b(this.flatCoordinates,t.getFlatCoordinates().slice()),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){const t=new fr(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(Pi(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Li(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!1,t,e,i,n))}getCoordinateAtM(t,e,i){return"XYM"!=this.layout&&"XYZM"!=this.layout||0===this.flatCoordinates.length?null:(e=void 0!==e&&e,i=void 0!==i&&i,function(t,e,i,n,s,r,o){if(o)return Zn(t,e,i[i.length-1],n,s,r);let a;if(s<t[n-1])return r?(a=t.slice(0,n),a[n-1]=s,a):null;if(t[t.length-1]<s)return r?(a=t.slice(t.length-n),a[n-1]=s,a):null;for(let r=0,o=i.length;r<o;++r){const o=i[r];if(e!=o){if(s<t[e+n-1])return null;if(s<=t[o-1])return Zn(t,e,o,n,s,!1);e=o}}return null}(this.flatCoordinates,0,this.ends_,this.stride,t,e,i))}getCoordinates(){return Gi(this.flatCoordinates,0,this.ends_,this.stride)}getEnds(){return this.ends_}getLineString(t){return t<0||this.ends_.length<=t?null:new Vn(this.flatCoordinates.slice(0===t?0:this.ends_[t-1],this.ends_[t]),this.layout)}getLineStrings(){const t=this.flatCoordinates,e=this.ends_,i=this.layout,n=[];let s=0;for(let r=0,o=e.length;r<o;++r){const o=e[r],a=new Vn(t.slice(s,o),i);n.push(a),s=o}return n}getLength(){const t=this.ends_;let e=0,i=0;for(let n=0,s=t.length;n<s;++n)i+=Bn(this.flatCoordinates,e,t[n],this.stride),e=t[n];return i}getFlatMidpoints(){const t=[],e=this.flatCoordinates;let i=0;const n=this.ends_,s=this.stride;for(let r=0,o=n.length;r<o;++r){const o=n[r];b(t,Yn(e,i,o,s,.5)),i=o}return t}getSimplifiedGeometryInternal(t){const e=[],i=[];return e.length=Vi(this.flatCoordinates,0,this.ends_,this.stride,t,e,0,i),new fr(e,"XY",i)}getType(){return"MultiLineString"}intersectsExtent(t){return function(t,e,i,n,s){for(let r=0,o=i.length;r<o;++r){if(Wi(t,e,i[r],n,s))return!0;e=i[r]}return!1}(this.flatCoordinates,0,this.ends_,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,2),this.flatCoordinates||(this.flatCoordinates=[]);const i=Ai(this.flatCoordinates,0,t,this.stride,this.ends_);this.flatCoordinates.length=0===i.length?0:i[i.length-1],this.changed()}}class _r extends Si{constructor(t,e){super(),e&&!Array.isArray(t[0])?this.setFlatCoordinates(e,t):this.setCoordinates(t,e)}appendPoint(t){b(this.flatCoordinates,t.getFlatCoordinates()),this.changed()}clone(){const t=new _r(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 s=this.flatCoordinates,r=this.stride;for(let o=0,a=s.length;o<a;o+=r){const a=Dt(t,e,s[o],s[o+1]);if(a<n){n=a;for(let t=0;t<r;++t)i[t]=s[o+t];i.length=r}}return n}getCoordinates(){return Di(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getPoint(t){const e=this.flatCoordinates.length/this.stride;return t<0||e<=t?null:new Ji(this.flatCoordinates.slice(t*this.stride,(t+1)*this.stride),this.layout)}getPoints(){const t=this.flatCoordinates,e=this.layout,i=this.stride,n=[];for(let s=0,r=t.length;s<r;s+=i){const r=new Ji(t.slice(s,s+i),e);n.push(r)}return n}getType(){return"MultiPoint"}intersectsExtent(t){const e=this.flatCoordinates,i=this.stride;for(let n=0,s=e.length;n<s;n+=i){if(nt(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=ki(this.flatCoordinates,0,t,this.stride),this.changed()}}function pr(t,e,i,n){const s=[];let r=[1/0,1/0,-1/0,-1/0];for(let o=0,a=i.length;o<a;++o){const a=i[o];r=ht(t,e,a[0],n),s.push((r[0]+r[2])/2,(r[1]+r[3])/2),e=a[a.length-1]}return s}class mr extends Si{constructor(t,e,i){if(super(),this.endss_=[],this.flatInteriorPointsRevision_=-1,this.flatInteriorPoints_=null,this.maxDelta_=-1,this.maxDeltaRevision_=-1,this.orientedRevision_=-1,this.orientedFlatCoordinates_=null,!i&&!Array.isArray(t[0])){const n=t,s=[],r=[];for(let t=0,e=n.length;t<e;++t){const e=n[t],i=s.length,o=e.getEnds();for(let t=0,e=o.length;t<e;++t)o[t]+=i;b(s,e.getFlatCoordinates()),r.push(o)}e=0===n.length?this.getLayout():n[0].getLayout(),t=s,i=r}void 0!==e&&i?(this.setFlatCoordinates(e,t),this.endss_=i):this.setCoordinates(t,e)}appendPolygon(t){let e;if(this.flatCoordinates){const i=this.flatCoordinates.length;b(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 mr(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,s){for(let r=0,o=i.length;r<o;++r){const o=i[r];s=Pi(t,e,o,n,s),e=o[o.length-1]}return s}(this.flatCoordinates,0,this.endss_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),function(t,e,i,n,s,r,o,a,l,h,c){c=c||[NaN,NaN];for(let u=0,d=i.length;u<d;++u){const d=i[u];h=Li(t,e,d,n,s,r,o,a,l,h,c),e=d[d.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,s,r){if(0===i.length)return!1;for(let o=0,a=i.length;o<a;++o){const a=i[o];if(Xi(t,e,a,n,s,r))return!0;e=a[a.length-1]}return!1}(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,t,e)}getArea(){return function(t,e,i,n){let s=0;for(let r=0,o=i.length;r<o;++r){const o=i[r];s+=Ii(t,e,o,n),e=o[o.length-1]}return s}(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride)}getCoordinates(t){let e;return void 0!==t?(e=this.getOrientedFlatCoordinates().slice(),an(e,0,this.endss_,this.stride,t)):e=this.flatCoordinates,zi(e,0,this.endss_,this.stride)}getEndss(){return this.endss_}getFlatInteriorPoints(){if(this.flatInteriorPointsRevision_!=this.getRevision()){const t=pr(this.flatCoordinates,0,this.endss_,this.stride);this.flatInteriorPoints_=tn(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,t),this.flatInteriorPointsRevision_=this.getRevision()}return this.flatInteriorPoints_}getInteriorPoints(){return new _r(this.getFlatInteriorPoints().slice(),"XYM")}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){const t=this.flatCoordinates;rn(t,0,this.endss_,this.stride)?this.orientedFlatCoordinates_=t:(this.orientedFlatCoordinates_=t.slice(),this.orientedFlatCoordinates_.length=an(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,s,r,o,a){for(let l=0,h=i.length;l<h;++l){const h=i[l],c=[];o=$i(t,e,h,n,s,r,o,c),a.push(c),e=h[h.length-1]}return o}(this.flatCoordinates,0,this.endss_,this.stride,Math.sqrt(t),e,0,i),new mr(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 ln(this.flatCoordinates.slice(e,n),this.layout,i)}getPolygons(){const t=this.layout,e=this.flatCoordinates,i=this.endss_,n=[];let s=0;for(let r=0,o=i.length;r<o;++r){const o=i[r].slice(),a=o[o.length-1];if(0!==s)for(let t=0,e=o.length;t<e;++t)o[t]-=s;const l=new ln(e.slice(s,a),t,o);n.push(l),s=a}return n}getType(){return"MultiPolygon"}intersectsExtent(t){return function(t,e,i,n,s){for(let r=0,o=i.length;r<o;++r){const o=i[r];if(Zi(t,e,o,n,s))return!0;e=o[o.length-1]}return!1}(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,3),this.flatCoordinates||(this.flatCoordinates=[]);const i=Oi(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 yr=di();class xr{constructor(t,e,i,n,s,r){this.styleFunction,this.extent_,this.id_=r,this.type_=t,this.flatCoordinates_=e,this.flatInteriorPoints_=null,this.flatMidpoints_=null,this.ends_=i||null,this.properties_=s,this.squaredTolerance_,this.stride_=n,this.simplifiedGeometry_}get(t){return this.properties_[t]}getExtent(){return this.extent_||(this.extent_="Point"===this.type_?lt(this.flatCoordinates_):ht(this.flatCoordinates_,0,this.flatCoordinates_.length,this.stride_)),this.extent_}getFlatInteriorPoint(){if(!this.flatInteriorPoints_){const t=xt(this.getExtent());this.flatInteriorPoints_=Qi(this.flatCoordinates_,0,this.ends_,this.stride_,t,0)}return this.flatInteriorPoints_}getFlatInteriorPoints(){if(!this.flatInteriorPoints_){const t=function(t,e){const i=[];let n,s=0,r=0;for(let o=0,a=e.length;o<a;++o){const a=e[o],l=nn(t,s,a,2);if(void 0===n&&(n=l),l===n)i.push(e.slice(r,o+1));else{if(0===i.length)continue;i[i.length-1].push(e[r])}r=o+1,s=a}return i}(this.flatCoordinates_,this.ends_),e=pr(this.flatCoordinates_,0,t,this.stride_);this.flatInteriorPoints_=tn(this.flatCoordinates_,0,t,this.stride_,e)}return this.flatInteriorPoints_}getFlatMidpoint(){return this.flatMidpoints_||(this.flatMidpoints_=Yn(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,s=i.length;n<s;++n){const s=i[n],r=Yn(t,e,s,this.stride_,.5);b(this.flatMidpoints_,r),e=s}}return this.flatMidpoints_}getId(){return this.id_}getOrientedFlatCoordinates(){return this.flatCoordinates_}getGeometry(){return this}getSimplifiedGeometry(t){return this}simplifyTransformed(t,e){return this}getProperties(){return this.properties_}getPropertiesInternal(){return this.properties_}getStride(){return this.stride_}getStyleFunction(){return this.styleFunction}getType(){return this.type_}transform(t){const e=(t=Ue(t)).getExtent(),i=t.getWorldExtent();if(e&&i){const t=St(i)/St(e);fi(yr,i[0],i[3],t,-t,0,0,0),yi(this.flatCoordinates_,0,this.flatCoordinates_.length,this.stride_,yr,this.flatCoordinates_)}}applyTransform(t){t(this.flatCoordinates_,this.flatCoordinates_,this.stride_)}clone(){return new xr(this.type_,this.flatCoordinates_.slice(),this.ends_?.slice(),this.stride_,Object.assign({},this.properties_),this.id_)}getEnds(){return this.ends_}enableSimplifyTransformed(){return this.simplifyTransformed=A((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=Bi(i,0,this.simplifiedGeometry_.flatCoordinates_.length,this.simplifiedGeometry_.stride_,t,i,0),n=[i.length];break;case"MultiLineString":n=[],i.length=Vi(i,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,t,i,0,n);break;case"Polygon":n=[],i.length=$i(i,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,Math.sqrt(t),i,0,n)}return n&&(this.simplifiedGeometry_=new xr(this.type_,i,n,this.stride_,this.properties_,this.id_)),this.squaredTolerance_=t,this.simplifiedGeometry_}),this}}function vr(t,e,i=0,n=t.length-1,s=Cr){for(;n>i;){if(n-i>600){const r=n-i+1,o=e-i+1,a=Math.log(r),l=.5*Math.exp(2*a/3),h=.5*Math.sqrt(a*l*(r-l)/r)*(o-r/2<0?-1:1);vr(t,e,Math.max(i,Math.floor(e-o*l/r+h)),Math.min(n,Math.floor(e+(r-o)*l/r+h)),s)}const r=t[e];let o=i,a=n;for(wr(t,i,e),s(t[n],r)>0&&wr(t,i,n);o<a;){for(wr(t,o,a),o++,a--;s(t[o],r)<0;)o++;for(;s(t[a],r)>0;)a--}0===s(t[i],r)?wr(t,i,a):(a++,wr(t,a,n)),a<=e&&(i=a+1),e<=a&&(n=a-1)}}function wr(t,e,i){const n=t[e];t[e]=t[i],t[i]=n}function Cr(t,e){return t<e?-1:t>e?1:0}xr.prototype.getFlatCoordinates=xr.prototype.getOrientedFlatCoordinates;let Sr=class{constructor(t=9){this._maxEntries=Math.max(4,t),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()}all(){return this._all(this.data,[])}search(t){let e=this.data;const i=[];if(!Or(t,e))return i;const n=this.toBBox,s=[];for(;e;){for(let r=0;r<e.children.length;r++){const o=e.children[r],a=e.leaf?n(o):o;Or(t,a)&&(e.leaf?i.push(o):Ar(t,a)?this._all(o,i):s.push(o))}e=s.pop()}return i}collides(t){let e=this.data;if(!Or(t,e))return!1;const i=[];for(;e;){for(let n=0;n<e.children.length;n++){const s=e.children[n],r=e.leaf?this.toBBox(s):s;if(Or(t,r)){if(e.leaf||Ar(t,r))return!0;i.push(s)}}e=i.pop()}return!1}load(t){if(!t||!t.length)return this;if(t.length<this._minEntries){for(let e=0;e<t.length;e++)this.insert(t[e]);return this}let e=this._build(t.slice(),0,t.length-1,0);if(this.data.children.length)if(this.data.height===e.height)this._splitRoot(this.data,e);else{if(this.data.height<e.height){const t=this.data;this.data=e,e=t}this._insert(e,this.data.height-e.height-1,!0)}else this.data=e;return this}insert(t){return t&&this._insert(t,this.data.height-1),this}clear(){return this.data=Dr([]),this}remove(t,e){if(!t)return this;let i=this.data;const n=this.toBBox(t),s=[],r=[];let o,a,l;for(;i||s.length;){if(i||(i=s.pop(),a=s[s.length-1],o=r.pop(),l=!0),i.leaf){const n=Er(t,i.children,e);if(-1!==n)return i.children.splice(n,1),s.push(i),this._condense(s),this}l||i.leaf||!Ar(i,n)?a?(o++,i=a.children[o],l=!1):i=null:(s.push(i),r.push(o),o=0,a=i,i=i.children[0])}return this}toBBox(t){return t}compareMinX(t,e){return t.minX-e.minX}compareMinY(t,e){return t.minY-e.minY}toJSON(){return this.data}fromJSON(t){return this.data=t,this}_all(t,e){const i=[];for(;t;)t.leaf?e.push(...t.children):i.push(...t.children),t=i.pop();return e}_build(t,e,i,n){const s=i-e+1;let r,o=this._maxEntries;if(s<=o)return r=Dr(t.slice(e,i+1)),br(r,this.toBBox),r;n||(n=Math.ceil(Math.log(s)/Math.log(o)),o=Math.ceil(s/Math.pow(o,n-1))),r=Dr([]),r.leaf=!1,r.height=n;const a=Math.ceil(s/o),l=a*Math.ceil(Math.sqrt(o));Gr(t,e,i,l,this.compareMinX);for(let s=e;s<=i;s+=l){const e=Math.min(s+l-1,i);Gr(t,s,e,a,this.compareMinY);for(let i=s;i<=e;i+=a){const s=Math.min(i+a-1,e);r.children.push(this._build(t,i,s,n-1))}}return br(r,this.toBBox),r}_chooseSubtree(t,e,i,n){for(;n.push(e),!e.leaf&&n.length-1!==i;){let i,n=1/0,s=1/0;for(let r=0;r<e.children.length;r++){const o=e.children[r],a=Pr(o),l=Lr(t,o)-a;l<s?(s=l,n=a<n?a:n,i=o):l===s&&a<n&&(n=a,i=o)}e=i||e.children[0]}return e}_insert(t,e,i){const n=i?t:this.toBBox(t),s=[],r=this._chooseSubtree(n,this.data,e,s);for(r.children.push(t),Ir(r,n);e>=0&&s[e].children.length>this._maxEntries;)this._split(s,e),e--;this._adjustParentBBoxes(n,s,e)}_split(t,e){const i=t[e],n=i.children.length,s=this._minEntries;this._chooseSplitAxis(i,s,n);const r=this._chooseSplitIndex(i,s,n),o=Dr(i.children.splice(r,i.children.length-r));o.height=i.height,o.leaf=i.leaf,br(i,this.toBBox),br(o,this.toBBox),e?t[e-1].children.push(o):this._splitRoot(i,o)}_splitRoot(t,e){this.data=Dr([t,e]),this.data.height=t.height+1,this.data.leaf=!1,br(this.data,this.toBBox)}_chooseSplitIndex(t,e,i){let n,s=1/0,r=1/0;for(let o=e;o<=i-e;o++){const e=Rr(t,0,o,this.toBBox),a=Rr(t,o,i,this.toBBox),l=kr(e,a),h=Pr(e)+Pr(a);l<s?(s=l,n=o,r=h<r?h:r):l===s&&h<r&&(r=h,n=o)}return n||i-e}_chooseSplitAxis(t,e,i){const n=t.leaf?this.compareMinX:Mr,s=t.leaf?this.compareMinY:Tr;this._allDistMargin(t,e,i,n)<this._allDistMargin(t,e,i,s)&&t.children.sort(n)}_allDistMargin(t,e,i,n){t.children.sort(n);const s=this.toBBox,r=Rr(t,0,e,s),o=Rr(t,i-e,i,s);let a=Fr(r)+Fr(o);for(let n=e;n<i-e;n++){const e=t.children[n];Ir(r,t.leaf?s(e):e),a+=Fr(r)}for(let n=i-e-1;n>=e;n--){const e=t.children[n];Ir(o,t.leaf?s(e):e),a+=Fr(o)}return a}_adjustParentBBoxes(t,e,i){for(let n=i;n>=0;n--)Ir(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():br(t[i],this.toBBox)}};function Er(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 br(t,e){Rr(t,0,t.children.length,e,t)}function Rr(t,e,i,n,s){s||(s=Dr(null)),s.minX=1/0,s.minY=1/0,s.maxX=-1/0,s.maxY=-1/0;for(let r=e;r<i;r++){const e=t.children[r];Ir(s,t.leaf?n(e):e)}return s}function Ir(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 Mr(t,e){return t.minX-e.minX}function Tr(t,e){return t.minY-e.minY}function Pr(t){return(t.maxX-t.minX)*(t.maxY-t.minY)}function Fr(t){return t.maxX-t.minX+(t.maxY-t.minY)}function Lr(t,e){return(Math.max(e.maxX,t.maxX)-Math.min(e.minX,t.minX))*(Math.max(e.maxY,t.maxY)-Math.min(e.minY,t.minY))}function kr(t,e){const i=Math.max(t.minX,e.minX),n=Math.max(t.minY,e.minY),s=Math.min(t.maxX,e.maxX),r=Math.min(t.maxY,e.maxY);return Math.max(0,s-i)*Math.max(0,r-n)}function Ar(t,e){return t.minX<=e.minX&&t.minY<=e.minY&&e.maxX<=t.maxX&&e.maxY<=t.maxY}function Or(t,e){return e.minX<=t.maxX&&e.minY<=t.maxY&&e.maxX>=t.minX&&e.maxY>=t.minY}function Dr(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function Gr(t,e,i,n,s){const r=[e,i];for(;r.length;){if((i=r.pop())-(e=r.pop())<=n)continue;const o=e+Math.ceil((i-e)/n/2)*n;vr(t,o,e,i,s),r.push(e,o,o,i)}}class zr{constructor(t){this.rbush_=new Sr(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_[T(e)]=i}load(t,e){const i=new Array(e.length);for(let n=0,s=e.length;n<s;n++){const s=t[n],r=e[n],o={minX:s[0],minY:s[1],maxX:s[2],maxY:s[3],value:r};i[n]=o,this.items_[T(r)]=o}this.rbush_.load(i)}remove(t){const e=T(t),i=this.items_[e];return delete this.items_[e],null!==this.rbush_.remove(i)}update(t,e){const i=this.items_[T(e)];ct([i.minX,i.minY,i.maxX,i.maxY],t)||(this.remove(e),this.insert(t,e))}getAll(){return this.rbush_.all().map(function(t){return t.value})}getInExtent(t){const e={minX:t[0],minY:t[1],maxX:t[2],maxY:t[3]};return this.rbush_.search(e).map(function(t){return t.value})}forEach(t){return this.forEach_(this.getAll(),t)}forEachInExtent(t,e){return this.forEach_(this.getInExtent(t),e)}forEach_(t,e){let i;for(let n=0,s=t.length;n<s;n++)if(i=e(t[n]),i)return i;return i}isEmpty(){return r(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]}}class Nr extends N{constructor(t){super(),this.projection=Ue(t.projection),this.attributions_=jr(t.attributions),this.attributionsCollapsible_=t.attributionsCollapsible??!0,this.loading=!1,this.canRotate=!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_}ready(){const t=this.getState();return"ready"===t?Promise.resolve():"error"===t?Promise.reject(new Error("Source failed to load")):new Promise((t,e)=>{const i=()=>{const n=this.getState();"ready"===n?(this.un("change",i),t()):"error"===n&&(this.un("change",i),e(new Error("Source failed to load")))};this.on("change",i)})}getState(){return this.state_}getWrapX(){return this.wrapX_}getInterpolate(){return this.interpolate_}refresh(){this.changed()}setAttributions(t){this.attributions_=jr(t),this.changed()}setState(t){this.state_=t,this.changed()}}function jr(t){return t?"function"==typeof t?t:(Array.isArray(t)||(t=[t]),e=>t):null}var Xr="addfeature",Kr="changefeature",Wr="clear",Yr="removefeature",Zr="featuresloadstart",Br="featuresloadend",Vr="featuresloaderror";class Ur extends O{constructor(t,e,i){super(t),this.feature=e,this.features=i}}class qr extends Nr{constructor(t){super({attributions:(t=t||{}).attributions,interpolate:!0,projection:void 0,state:"ready",wrapX:void 0===t.wrapX||t.wrapX}),this.canRotate=!0,this.on,this.once,this.un,this.loader_=k,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_&&(W(this.format_,"`format` must be set when `url` is set"),this.loader_=dr(this.url_,this.format_)),this.strategy_=void 0!==t.strategy?t.strategy:gr;const e=void 0===t.useSpatialIndex||t.useSpatialIndex;let i,n;this.featuresRtree_=e?new zr:null,this.loadedExtentsRtree_=new zr,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 K(n)),void 0!==n&&this.addFeaturesInternal(n),void 0!==i&&this.bindFeaturesCollection_(i)}addFeature(t){this.addFeatureInternal(t),this.changed()}addFeatureInternal(t){const e=T(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 Ur(Xr,t))}setupChangeEvents_(t,e){e instanceof xr||(this.featureChangeKeys_[t]=[o(e,h,this.handleFeatureChange_,this),o(e,n,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 xr){const n=this.idIndex_[t];n instanceof xr?Array.isArray(n)?n.push(e):this.idIndex_[t]=[n,e]:i=!1}else i=!1;else this.idIndex_[t]=e}return i&&(W(!(t in this.uidIndex_),"The passed `feature` was already added to the source"),this.uidIndex_[t]=e),i}addFeatures(t){this.addFeaturesInternal(t),this.changed()}addFeaturesInternal(t){const e=[],i=[],n=[];for(let e=0,n=t.length;e<n;e++){const n=t[e],s=T(n);this.addToIndex_(s,n)&&i.push(n)}for(let t=0,s=i.length;t<s;t++){const s=i[t],r=T(s);this.setupChangeEvents_(r,s);const o=s.getGeometry();if(o){const t=o.getExtent();e.push(t),n.push(s)}else this.nullGeometryFeatures_[r]=s}if(this.featuresRtree_&&this.featuresRtree_.load(e,n),this.hasListener(Xr))for(let t=0,e=i.length;t<e;t++)this.dispatchEvent(new Ur(Xr,i[t]))}bindFeaturesCollection_(t){let n=!1;this.addEventListener(Xr,function(e){!n&&e.feature&&(n=!0,t.push(e.feature),n=!1)}),this.addEventListener(Yr,function(e){!n&&e.feature&&(n=!0,t.remove(e.feature),n=!1)}),t.addEventListener(e,t=>{n||(n=!0,this.addFeature(t.element),n=!1)}),t.addEventListener(i,t=>{n||(n=!0,this.removeFeature(t.element),n=!1)}),this.featuresCollection_=t}clear(t){if(t){for(const t in this.featureChangeKeys_){this.featureChangeKeys_[t].forEach(l)}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 Ur(Wr);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 xr||n&&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 xr||n&&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(),r(this.nullGeometryFeatures_)||b(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=this.featuresRtree_;return Lt(t,e).flatMap(t=>i.getInExtent(t))}return this.featuresCollection_?this.featuresCollection_.getArray().slice(0):[]}getClosestFeatureToCoordinate(t,e){const i=t[0],n=t[1];let s=null;const r=[NaN,NaN];let o=1/0;const a=[-1/0,-1/0,1/0,1/0];e=e||F;const l=this.featuresRtree_;return l?(l.forEachInExtent(a,function(t){if(e(t)){const e=t.getGeometry();if(!e)return;const l=o;if(o=e instanceof xr?0:e.closestPointXY(i,n,r,o),o<l){s=t;const e=Math.sqrt(o);a[0]=i-e,a[1]=n-e,a[2]=i+e,a[3]=n+e}}}),s):null}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=T(e),n=e.getGeometry();if(n){const t=n.getExtent();i in this.nullGeometryFeatures_?(delete this.nullGeometryFeatures_[i],this.featuresRtree_&&this.featuresRtree_.insert(t,e)):this.featuresRtree_&&this.featuresRtree_.update(t,e)}else i in this.nullGeometryFeatures_||(this.featuresRtree_&&this.featuresRtree_.remove(e),this.nullGeometryFeatures_[i]=e);const s=e.getId();if(void 0!==s){const t=s.toString();this.idIndex_[t]!==e&&(this.removeFromIdIndex_(e),this.idIndex_[t]=e)}else this.removeFromIdIndex_(e),this.uidIndex_[i]=e;this.changed(),this.dispatchEvent(new Ur(Kr,e))}hasFeature(t){const e=t.getId();if(void 0!==e){const i=this.idIndex_[String(e)];return Array.isArray(i)?i.includes(t):i===t}return T(t)in this.uidIndex_}isEmpty(){return this.featuresRtree_?this.featuresRtree_.isEmpty()&&r(this.nullGeometryFeatures_):!this.featuresCollection_||0===this.featuresCollection_.getLength()}loadFeatures(t,e,i){const n=this.loadedExtentsRtree_,s=this.strategy_(t,e,i);for(let t=0,r=s.length;t<r;++t){const r=s[t];if(!n.forEachInExtent(r,function(t){return it(t.extent,r)})){this.loading=Number(this.loading)+1,this.dispatchEvent(new Ur(Zr));const t=t=>{this.loading=Number(this.loading)-1,this.dispatchEvent(new Ur(Br,void 0,t))},s=()=>{this.changed(),this.loading=Number(this.loading)-1,this.dispatchEvent(new Ur(Vr))};let o=!1;const a=this.loader_.call(this,r,e,i,e=>o||t(e),()=>o||s());P(a)?(o=!0,a.then(e=>{const i=e;this.addFeatures(i),t(i)}).catch(s)):this.loader_.length<4&&(this.loading=!1),n.insert(r,{extent:r.slice()})}}}refresh(){this.clear(!0),this.loadedExtentsRtree_.clear(),super.refresh()}removeLoadedExtent(t){const e=this.loadedExtentsRtree_,i=[];e.forEachInExtent(t,function(t){i.push(t)}),i.forEach(i=>{e.remove(i);const n=bt(i.extent,t);for(const t of n)e.insert(t,{extent:t})})}removeFeatures(t){let e=!1;for(let i=0,n=t.length;i<n;++i)e=this.removeFeatureInternal(t[i])||e;e&&this.changed()}removeFeature(t){if(!t)return;this.removeFeatureInternal(t)&&this.changed()}removeFeatureInternal(t){const e=T(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(l),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(Yr)&&this.dispatchEvent(new Ur(Yr,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){W(this.format_,"`format` must be set when `url` is set"),this.url_=t,this.setLoader(dr(t,this.format_))}setOverlaps(t){this.overlaps_=t,this.changed()}}class $r{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 $r({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=ys(null,t.src,{crossOrigin:"anonymous"},void 0,t.offset?null:t.color?t.color:null,!(t.offset&&t.size));e.ready().then(()=>{this.patternImage_=null}),e.getImageState()===cn&&e.load(),e.getImageState()===un&&(this.patternImage_=e)}this.color_=t}getKey(){const t=this.getColor();return t?t instanceof CanvasPattern||t instanceof CanvasGradient?T(t):"object"==typeof t&&"src"in t?t.src+":"+t.offset:ds(t).toString():""}loading(){return!!this.patternImage_}ready(){return this.patternImage_?this.patternImage_.ready():Promise.resolve()}}class Hr{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 Hr({color:Array.isArray(t)?t.slice():t||void 0,lineCap:this.getLineCap(),lineDash:this.getLineDash()?.slice(),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}}function Jr(t){return t[0]>0&&t[1]>0}function Qr(t,e){return Array.isArray(t)?t:(void 0===e?e=[t,t]:(e[0]=t,e[1]=t),e)}class to{constructor(t){this.opacity_=t.opacity,this.rotateWithView_=t.rotateWithView,this.rotation_=t.rotation,this.scale_=t.scale,this.scaleArray_=Qr(t.scale),this.displacement_=t.displacement,this.declutterMode_=t.declutterMode}clone(){const t=this.getScale();return new to({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 I()}getImage(t){return I()}getHitDetectionImage(){return I()}getPixelRatio(t){return 1}getImageState(){return I()}getImageSize(){return I()}getOrigin(){return I()}getSize(){return I()}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_=Qr(t)}listenImageChange(t){I()}load(){I()}unlistenImageChange(t){I()}ready(){return Promise.resolve()}}class eo extends to{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()?un:dn,this.imageState_===un&&this.ready().then(()=>this.imageState_=dn),this.render()}clone(){const t=this.getScale(),e=new eo({fill:this.getFill()?.clone(),points:this.getPoints(),radius:this.getRadius(),radius2:this.getRadius2(),angle:this.getAngle(),stroke:this.getStroke()?.clone(),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=_s.get(i,null)?.getImage(1);if(!n){const e=this.renderOptions_,s=Math.ceil(e.size*t),r=Ln(s,s);this.draw_(e,r,t),n=r.canvas;const o=new ms(n,void 0,{},dn,null);_s.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,s=void 0===this.radius2_?n:this.radius2_;if(n<s){const t=n;n=s,s=t}const r=void 0===this.radius2_?this.points_:2*this.points_,o=2*Math.PI/r,a=s*Math.sin(o),l=n-Math.sqrt(s*s-a*a),h=Math.sqrt(a*a+l*l),c=h/a;if("miter"===t&&c<=i)return c*e;const u=e/2/c,d=e/2*(l/h),g=Math.sqrt((n+u)*(n+u)+d*d)-n;if(void 0===this.radius2_||"bevel"===t)return 2*g;const f=n*Math.sin(o),_=s-Math.sqrt(n*n-f*f),p=Math.sqrt(f*f+_*_)/f;if(p<=i){const t=p*e/2-s-n;return 2*Math.max(g,t)}return 2*g}createRenderOptions(){let t,e=Os,i=Gs,n=0,s=null,r=0,o=0;this.stroke_&&(t=xs(this.stroke_.getColor()??zs),o=this.stroke_.getWidth()??1,s=this.stroke_.getLineDash(),r=this.stroke_.getLineDashOffset()??0,i=this.stroke_.getLineJoin()??Gs,e=this.stroke_.getLineCap()??Os,n=this.stroke_.getMiterLimit()??10);const a=this.calculateLineJoinSize_(i,o,n),l=Math.max(this.radius,this.radius2_||0);return{strokeStyle:t,strokeWidth:o,size:Math.ceil(2*l+a),lineCap:e,lineDash:s,lineDashOffset:r,lineJoin:i,miterLimit:n}}render(){this.renderOptions_=this.createRenderOptions();const t=this.renderOptions_.size;this.hitDetectionCanvas_=null,this.size_=[t,t]}draw_(t,e,i){if(e.scale(i,i),e.translate(t.size/2,t.size/2),this.createPath_(e),this.fill_){let t=this.fill_.getColor();null===t&&(t=As),e.fillStyle=xs(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=ds(i)),null===i?n=1:Array.isArray(i)&&(n=4===i.length?i[3]:1),0===n&&(e=Ln(t.size,t.size),this.drawHitDetectionCanvas_(t,e))}return e?e.canvas:this.getImage(1)}createPath_(t){let e=this.points_;const i=this.radius;if(e===1/0)t.arc(0,0,i,0,2*Math.PI);else{const n=void 0===this.radius2_?i:this.radius2_;void 0!==this.radius2_&&(e*=2);const s=this.angle_-Math.PI/2,r=2*Math.PI/e;for(let o=0;o<e;o++){const e=s+o*r,a=o%2==0?i:n;t.lineTo(a*Math.cos(e),a*Math.sin(e))}t.closePath()}}drawHitDetectionCanvas_(t,e){e.translate(t.size/2,t.size/2),this.createPath_(e),e.fillStyle=As,e.fill(),t.strokeStyle&&(e.strokeStyle=t.strokeStyle,e.lineWidth=t.strokeWidth,t.lineDash&&(e.setLineDash(t.lineDash),e.lineDashOffset=t.lineDashOffset),e.lineJoin=t.lineJoin,e.miterLimit=t.miterLimit,e.stroke())}ready(){return this.fill_?this.fill_.ready():Promise.resolve()}}class io extends eo{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 io({fill:this.getFill()?.clone(),stroke:this.getStroke()?.clone(),radius:this.getRadius(),scale:Array.isArray(t)?t.slice():t,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()});return e.setOpacity(this.getOpacity()),e}}class no{constructor(t){t=t||{},this.geometry_=null,this.geometryFunction_=oo,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 no({geometry:t??void 0,fill:this.getFill()?.clone(),image:this.getImage()?.clone(),renderer:this.getRenderer()??void 0,stroke:this.getStroke()?.clone(),text:this.getText()?.clone(),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_=oo,this.geometry_=t}setZIndex(t){this.zIndex_=t}}let so=null;function ro(t,e){if(!so){const t=new $r({color:"rgba(255,255,255,0.4)"}),e=new Hr({color:"#3399CC",width:1.25});so=[new no({image:new io({fill:t,stroke:e,radius:5}),fill:t,stroke:e})]}return so}function oo(t){return t.getGeometry()}class ao{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_=Qr(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 $r({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 ao({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 $r?this.getFill().clone():this.getFill(),stroke:this.getStroke()?.clone(),offsetX:this.getOffsetX(),offsetY:this.getOffsetY(),backgroundFill:this.getBackgroundFill()?.clone(),backgroundStroke:this.getBackgroundStroke()?.clone(),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_=Qr(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}}var lo=0,ho=1;const co=0,uo=1,go=2,fo=3,_o=4,po=5,mo=6,yo=7,xo=8,vo=9,wo=10,Co=11,So=12,Eo=[xo],bo=[So],Ro=[uo],Io=[fo];class Mo extends Ss{constructor(t,e,i,n){super(),this.tolerance=t,this.maxExtent=e,this.pixelRatio=n,this.maxLineWidth=0,this.resolution=i,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_=null,this.bufferedMaxExtent_=null,this.instructions=[],this.coordinates=[],this.tmpCoordinate_=[],this.hitDetectionInstructions=[],this.state={}}applyPixelRatio(t){const e=this.pixelRatio;return 1==e?t:t.map(function(t){return t*e})}appendFlatPointCoordinates(t,e){const i=this.getBufferedMaxExtent(),n=this.tmpCoordinate_,s=this.coordinates;let r=s.length;for(let o=0,a=t.length;o<a;o+=e)n[0]=t[o],n[1]=t[o+1],et(i,n)&&(s[r++]=n[0],s[r++]=n[1]);return r}appendFlatLineCoordinates(t,e,i,n,s,r){const o=this.coordinates;let a=o.length;const l=this.getBufferedMaxExtent();r&&(e+=n);let h=t[e],c=t[e+1];const u=this.tmpCoordinate_;let d,g,f,_=!0;for(d=e+n;d<i;d+=n)u[0]=t[d],u[1]=t[d+1],f=st(l,u),f!==g?(_&&(o[a++]=h,o[a++]=c,_=!1),o[a++]=u[0],o[a++]=u[1]):f===B?(o[a++]=u[0],o[a++]=u[1],_=!1):_=!0,h=u[0],c=u[1],g=f;return(s&&_||d===e+n)&&(o[a++]=h,o[a++]=c),a}drawCustomCoordinates_(t,e,i,n,s){for(let r=0,o=i.length;r<o;++r){const o=i[r],a=this.appendFlatLineCoordinates(t,e,o,n,!1,!1);s.push(a),e=o}return e}drawCustom(t,e,i,n,s){this.beginGeometry(t,e,s);const r=t.getType(),o=t.getStride(),a=this.coordinates.length;let l,h,c,u,d;switch(r){case"MultiPolygon":l=t.getOrientedFlatCoordinates(),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([_o,a,c,t,i,zi,s]),this.hitDetectionInstructions.push([_o,a,c,t,n||i,zi,s]);break;case"Polygon":case"MultiLineString":u=[],l="Polygon"==r?t.getOrientedFlatCoordinates():t.getFlatCoordinates(),d=this.drawCustomCoordinates_(l,0,t.getEnds(),o,u),this.instructions.push([_o,a,u,t,i,Gi,s]),this.hitDetectionInstructions.push([_o,a,u,t,n||i,Gi,s]);break;case"LineString":case"Circle":l=t.getFlatCoordinates(),h=this.appendFlatLineCoordinates(l,0,l.length,o,!1,!1),this.instructions.push([_o,a,h,t,i,Di,s]),this.hitDetectionInstructions.push([_o,a,h,t,n||i,Di,s]);break;case"MultiPoint":l=t.getFlatCoordinates(),h=this.appendFlatPointCoordinates(l,o),h>a&&(this.instructions.push([_o,a,h,t,i,Di,s]),this.hitDetectionInstructions.push([_o,a,h,t,n||i,Di,s]));break;case"Point":l=t.getFlatCoordinates(),this.coordinates.push(l[0],l[1]),h=this.coordinates.length,this.instructions.push([_o,a,h,t,i,void 0,s]),this.hitDetectionInstructions.push([_o,a,h,t,n||i,void 0,s])}this.endGeometry(e)}beginGeometry(t,e,i){this.beginGeometryInstruction1_=[co,e,0,t,i],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[co,e,0,t,i],this.hitDetectionInstructions.push(this.beginGeometryInstruction2_)}finish(){return{instructions:this.instructions,hitDetectionInstructions:this.hitDetectionInstructions,coordinates:this.coordinates}}reverseHitDetectionInstructions(){const t=this.hitDetectionInstructions;let e;t.reverse();const i=t.length;let n,s,r=-1;for(e=0;e<i;++e)n=t[e],s=n[0],s==yo?r=e:s==co&&(n[2]=e,E(this.hitDetectionInstructions,r,e),r=-1)}fillStyleToState(t,e={}){if(t){const i=t.getColor();e.fillPatternScale=i&&"object"==typeof i&&"src"in i?this.pixelRatio:1,e.fillStyle=xs(i||As)??void 0}else e.fillStyle=void 0;return e}strokeStyleToState(t,e={}){if(t){const i=t.getColor();e.strokeStyle=xs(i||zs)??void 0;const n=t.getLineCap();e.lineCap=void 0!==n?n:Os;const s=t.getLineDash();e.lineDash=s?s.slice():Ds;const r=t.getLineDashOffset();e.lineDashOffset=r||0;const o=t.getLineJoin();e.lineJoin=void 0!==o?o:Gs;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=[wo,e];return"string"!=typeof e&&i.push(t.fillPatternScale),i}applyStroke(t){this.instructions.push(this.createStroke(t))}createStroke(t){return[Co,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,s=t.lineDash,r=t.lineDashOffset,o=t.lineJoin,a=t.lineWidth,l=t.miterLimit,h=t.strokeOffset;t.currentStrokeStyle==i&&t.currentLineCap==n&&(s==t.currentLineDash||s&&t.currentLineDash&&R(t.currentLineDash,s))&&t.currentLineDashOffset==r&&t.currentLineJoin==o&&t.currentLineWidth==a&&t.currentMiterLimit==l&&t.currentStrokeOffset==h||(e.call(this,t),t.currentStrokeStyle=i,t.currentLineCap=n,t.currentLineDash=s,t.currentLineDashOffset=r,t.currentLineJoin=o,t.currentLineWidth=a,t.currentMiterLimit=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=[yo,t];this.instructions.push(e),this.hitDetectionInstructions.push(e)}getBufferedMaxExtent(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=Q(this.maxExtent),this.maxLineWidth>0)){const t=this.resolution*(this.maxLineWidth+1)/2;J(this.bufferedMaxExtent_,t,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_}}class To extends Mo{constructor(t,e,i,n){super(t,e,i,n)}drawFlatCoordinatess_(t,e,i,n,s){const r=this.state,o=s??0,a=void 0!==r.fillStyle,l=void 0!==r.strokeStyle,h=i.length;this.instructions.push(Ro),this.hitDetectionInstructions.push(Ro);for(let s=0;s<h;++s){const r=i[s],a=this.coordinates.length,h=this.appendFlatLineCoordinates(t,e,r,n,!0,!l);this.instructions.push([vo,a,h,o*this.pixelRatio,!0]),this.hitDetectionInstructions.push([vo,a,h,o,!0]),l&&(this.instructions.push(Io),this.hitDetectionInstructions.push(Io)),e=r}return a&&(this.instructions.push(Eo),this.hitDetectionInstructions.push(Eo)),l&&(this.instructions.push(bo),this.hitDetectionInstructions.push(bo)),e}drawCircle(t,e,i){const n=this.state;if(!n)return;const s=n.fillStyle,r=n.strokeStyle,o=n.strokeOffset;if(void 0===s&&void 0===r)return;if(this.handleStrokeOffset_(()=>this.drawCircle(t,e,i)))return;this.setFillStrokeStyles_(),this.beginGeometry(t,e,i??0),void 0!==n.fillStyle&&this.hitDetectionInstructions.push([wo,As]),void 0!==n.strokeStyle&&this.hitDetectionInstructions.push([Co,zs,n.lineWidth,n.lineCap,n.lineJoin,n.miterLimit,Ds,0]);const a=t.getFlatCoordinates(),l=t.getStride(),h=this.coordinates.length;this.appendFlatLineCoordinates(a,0,a.length,l,!1,!1);const c=[go,h,o];this.instructions.push(Ro,c),this.hitDetectionInstructions.push(Ro,c),void 0!==n.fillStyle&&(this.instructions.push(Eo),this.hitDetectionInstructions.push(Eo)),void 0!==n.strokeStyle&&(this.instructions.push(bo),this.hitDetectionInstructions.push(bo)),this.endGeometry(e)}drawPolygon(t,e,i){const n=this.state;if(!n)return;const s=n.fillStyle,r=n.strokeStyle,o=n.strokeOffset;if(void 0===s&&void 0===r)return;if(this.handleStrokeOffset_(()=>this.drawPolygon(t,e,i)))return;this.setFillStrokeStyles_(),this.beginGeometry(t,e,i??0),void 0!==n.fillStyle&&this.hitDetectionInstructions.push([wo,As]),void 0!==n.strokeStyle&&this.hitDetectionInstructions.push([Co,zs,n.lineWidth,n.lineCap,n.lineJoin,n.miterLimit,Ds,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;if(!n)return;const s=n.fillStyle,r=n.strokeStyle,o=n.strokeOffset;if(void 0===s&&void 0===r)return;if(this.handleStrokeOffset_(()=>this.drawMultiPolygon(t,e,i)))return;this.setFillStrokeStyles_(),this.beginGeometry(t,e,i??0),void 0!==n.fillStyle&&this.hitDetectionInstructions.push([wo,As]),void 0!==n.strokeStyle&&this.hitDetectionInstructions.push([Co,zs,n.lineWidth,n.lineCap,n.lineJoin,n.miterLimit,Ds,0]);const a=t.getEndss(),l=t.getOrientedFlatCoordinates(),h=t.getStride();let c=0;for(let t=0,e=a.length;t<e;++t)c=this.drawFlatCoordinatess_(l,c,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]=Ui(e[i],t)}return super.finish()}setFillStrokeStyles_(){const t=this.state;t&&(this.updateFillStyle(t,this.createFill),this.updateStrokeStyle(t,this.applyStroke))}handleStrokeOffset_(t){const e=this.state,i=e.fillStyle,n=e.strokeStyle,s=e.strokeOffset??0;return Math.abs(s)>0&&void 0!==i&&void 0!==n&&(e.strokeStyle=void 0,e.strokeOffset=0,t(),e.fillStyle=void 0,e.strokeStyle=n,e.strokeOffset=s,t(),e.fillStyle=i,!0)}}let Po=0,Fo=1;function Lo(t,e,i,n,s,r,o,a){const l=o-s,h=a-r;let c=0,u=1;if(0===l){if(s<t||s>i)return!1}else{let e=(t-s)/l,n=(i-s)/l;if(e>n){const t=e;e=n,n=t}if(e>c&&(c=e),n<u&&(u=n),c>u)return!1}if(0===h){if(r<e||r>n)return!1}else{let t=(e-r)/h,i=(n-r)/h;if(t>i){const e=t;t=i,i=e}if(t>c&&(c=t),i<u&&(u=i),c>u)return!1}return Po=c,Fo=u,!0}function ko(t,e,i,n,s){const r=[];let o=i,a=0,l=e.slice(i,2);for(;a<t&&o+s<n;){const[i,n]=l.slice(-2),h=e[o+s],c=e[o+s+1],u=Math.sqrt((h-i)*(h-i)+(c-n)*(c-n));if(a+=u,a>=t){const e=(t-a+u)/u,d=jt(i,h,e),g=jt(n,c,e);l.push(d,g),r.push(l),l=[d,g],a==t&&(o+=s),a=0}else if(a<t)l.push(e[o+s],e[o+s+1]),o+=s;else{const t=u-a,e=jt(i,h,t/u),d=jt(n,c,t/u);l.push(e,d),r.push(l),l=[e,d],a=0,o+=s}}return a>0&&r.push(l),r}function Ao(t,e,i,n,s){let r,o,a,l,h,c,u,d,g,f,_=i,p=i,m=0,y=0,x=i;for(o=i;o<n;o+=s){const i=e[o],n=e[o+1];void 0!==h&&void 0!==c&&(g=i-h,f=n-c,l=Math.sqrt(g*g+f*f),void 0!==u&&void 0!==d&&void 0!==a&&(y+=a,r=Math.acos((u*g+d*f)/(a*l)),r>t&&(y>m&&(m=y,_=x,p=o),y=0,x=o-s)),a=l,u=g,d=f),h=i,c=n}return y+=l||0,y>m?[x,o]:[_,p]}const Oo={left:0,center:.5,right:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1};const Do={Circle:To,Default:Mo,Image:class extends Mo{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&&!et(this.maxExtent,t.getFlatCoordinates()))return;this.beginGeometry(t,e,i??0);const n=t.getFlatCoordinates(),s=t.getStride(),r=this.coordinates.length,o=this.appendFlatPointCoordinates(n,s),a=this.imagePixelRatio_??1,l=this.anchorX_??0,h=this.anchorY_??0,c=this.height_??0,u=this.originX_??0,d=this.originY_??0,g=this.scale_??[1,1],f=this.width_??0;this.instructions.push([mo,r,o,this.image_,l*a,h*a,Math.ceil(c*a),this.opacity_,u*a,d*a,this.rotateWithView_,this.rotation_,[g[0]*this.pixelRatio/a,g[1]*this.pixelRatio/a],Math.ceil(f*a),this.declutterMode_,this.declutterImageWithText_]),this.hitDetectionInstructions.push([mo,r,o,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,1,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(e)}drawMultiPoint(t,e,i){if(!this.image_)return;this.beginGeometry(t,e,i??0);const n=t.getFlatCoordinates(),s=[];for(let e=0,i=n.length;e<i;e+=t.getStride())this.maxExtent&&!et(this.maxExtent,n.slice(e,e+2))||s.push(n[e],n[e+1]);const r=this.coordinates.length,o=this.appendFlatPointCoordinates(s,2),a=this.imagePixelRatio_??1,l=this.anchorX_??0,h=this.anchorY_??0,c=this.height_??0,u=this.originX_??0,d=this.originY_??0,g=this.scale_??[1,1],f=this.width_??0;this.instructions.push([mo,r,o,this.image_,l*a,h*a,Math.ceil(c*a),this.opacity_,u*a,d*a,this.rotateWithView_,this.rotation_,[g[0]*this.pixelRatio/a,g[1]*this.pixelRatio/a],Math.ceil(f*a),this.declutterMode_,this.declutterImageWithText_]),this.hitDetectionInstructions.push([mo,r,o,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,1,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(e)}finish(){return this.reverseHitDetectionInstructions(),this.anchorX_=void 0,this.anchorY_=void 0,this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.height_=void 0,this.scale_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.width_=void 0,super.finish()}setImageStyle(t,e){const i=t.getAnchor(),n=t.getSize(),s=t.getOrigin();i&&n&&s&&(this.imagePixelRatio_=t.getPixelRatio(this.pixelRatio),this.anchorX_=i[0],this.anchorY_=i[1],this.hitDetectionImage_=t.getHitDetectionImage(),this.image_=t.getImage(this.pixelRatio),this.height_=n[1],this.opacity_=t.getOpacity(),this.originX_=s[0],this.originY_=s[1],this.rotateWithView_=t.getRotateWithView(),this.rotation_=t.getRotation(),this.scale_=t.getScaleArray(),this.width_=n[0],this.declutterMode_=t.getDeclutterMode(),this.declutterImageWithText_=e)}},LineString:class extends Mo{constructor(t,e,i,n){super(t,e,i,n)}drawFlatCoordinates_(t,e,i,n,s){const r=(s??0)*this.pixelRatio,o=this.coordinates.length,a=this.appendFlatLineCoordinates(t,e,i,n,!1,!1);return this.instructions.push([vo,o,a,r]),this.hitDetectionInstructions.push([vo,o,a,s??0]),i}drawLineString(t,e,i){const n=this.state;if(!n)return;const s=n.strokeStyle,r=n.lineWidth,o=n.strokeOffset;if(void 0===s||void 0===r)return;this.updateStrokeStyle(n,this.applyStroke),this.beginGeometry(t,e,i??0),this.hitDetectionInstructions.push([Co,zs,n.lineWidth,n.lineCap,n.lineJoin,n.miterLimit,Ds,0],Ro);const a=t.getFlatCoordinates(),l=t.getStride();this.drawFlatCoordinates_(a,0,a.length,l,o),this.hitDetectionInstructions.push(bo),this.endGeometry(e)}drawMultiLineString(t,e,i){const n=this.state;if(!n)return;const s=n.strokeStyle,r=n.lineWidth,o=n.strokeOffset;if(void 0===s||void 0===r)return;this.updateStrokeStyle(n,this.applyStroke),this.beginGeometry(t,e,i??0),this.hitDetectionInstructions.push([Co,zs,n.lineWidth,n.lineCap,n.lineJoin,n.miterLimit,Ds,0],Ro);const a=t.getEnds()??[],l=t.getFlatCoordinates(),h=t.getStride();let c=0;for(let t=0,e=a.length;t<e;++t)c=this.drawFlatCoordinates_(l,c,a[t],h,o);this.hitDetectionInstructions.push(bo),this.endGeometry(e)}finish(){const t=this.state;return t&&null!=t.lastStroke&&t.lastStroke!=this.coordinates.length&&this.instructions.push(bo),this.reverseHitDetectionInstructions(),this.state=null,super.finish()}applyStroke(t){null!=t.lastStroke&&t.lastStroke!=this.coordinates.length&&(this.instructions.push(bo),t.lastStroke=this.coordinates.length),t.lastStroke=0,super.applyStroke(t),this.instructions.push(Ro)}},Polygon:To,Text:class extends Mo{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[As]={fillStyle:As},this.textStrokeState_=null,this.strokeStates={},this.textState_={},this.textStates={},this.textKey_="",this.fillKey_="",this.strokeKey_="",this.declutterMode_=void 0,this.declutterImageWithText_=void 0}finish(){const t=super.finish();return t.textStates=this.textStates,t.fillStates=this.fillStates,t.strokeStates=this.strokeStates,t}drawText(t,e,i){const n=this.textFillState_,s=this.textStrokeState_,r=this.textState_;if(""===this.text_||!r||!n&&!s)return;const o=this.coordinates;let a=o.length;const l=t.getType();let h=null,c=t.getStride();if("line"!==r.placement||"LineString"!=l&&"MultiLineString"!=l&&"Polygon"!=l&&"MultiPolygon"!=l){let n=r.overflow?null:[];switch(l){case"Point":case"MultiPoint":h=t.getFlatCoordinates();break;case"LineString":h=t.getFlatMidpoint();break;case"Circle":h=t.getCenter();break;case"MultiLineString":h=t.getFlatMidpoints(),c=2;break;case"Polygon":h=t.getFlatInteriorPoint(),!r.overflow&&n&&n.push(h[2]/this.resolution),c=3;break;case"MultiPolygon":const e=t.getFlatInteriorPoints();h=[];for(let t=0,i=e.length;t<i;t+=3)!r.overflow&&n&&n.push(e[t+2]/this.resolution),h.push(e[t],e[t+1]);if(0===h.length)return;c=2;break;default:return}if(!h)return;const s=this.appendFlatPointCoordinates(h,c);if(s===a)return;if(n&&(s-a)/2!==h.length/c){const t=h;let e=a/2;n=n.filter((i,n)=>{const s=o[2*(e+n)]===t[n*c]&&o[2*(e+n)+1]===t[n*c+1];return s||--e,s})}this.saveTextStates_();const u=r.backgroundFill?this.createFill(this.fillStyleToState(r.backgroundFill)):null,d=r.backgroundStroke?this.createStroke(this.strokeStyleToState(r.backgroundStroke)):null;this.beginGeometry(t,e,i??0);const g=r.scale??[1,1];let f=r.padding??Xs;if(f!=Xs&&(g[0]<0||g[1]<0)){let t=f[0],e=f[1],i=f[2],n=f[3];g[0]<0&&(e=-e,n=-n),g[1]<0&&(t=-t,i=-i),f=[t,e,i,n]}const _=this.pixelRatio;this.instructions.push([mo,a,s,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[1,1],NaN,this.declutterMode_,this.declutterImageWithText_,f==Xs?Xs:f.map(function(t){return t*_}),u,d,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,n]);const p=1/_,m=u?u.slice(0):null;m&&(m[1]=As),this.hitDetectionInstructions.push([mo,a,s,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[p,p],NaN,this.declutterMode_,this.declutterImageWithText_,f,m,d,this.text_,this.textKey_,this.strokeKey_,this.fillKey_?As:this.fillKey_,this.textOffsetX_,this.textOffsetY_,n]),this.endGeometry(e)}else{const n=t.getExtent();if(!Tt(this.maxExtent,n))return;let s=[];if(h=t.getFlatCoordinates(),"LineString"==l)s=[h.length];else if("MultiLineString"==l)s=t.getEnds();else if("Polygon"==l)s=t.getEnds().slice(0,1);else if("MultiPolygon"==l){const e=t.getEndss();s=[];for(let t=0,i=e.length;t<i;++t)s.push(e[t][0])}if(void 0===r.textAlign&&("LineString"==l||"MultiLineString"==l)&&!it(this.getBufferedMaxExtent(),n)){const t=function(t,e,i,n){const s=n[0],r=n[1],o=n[2],a=n[3],l=[],h=[];let c,u,d=!1,g=0;for(let n=0,f=e.length;n<f;++n){const f=e[n];let _=t[g],p=t[g+1],m=!1;for(let e=g+i;e<f;e+=i){const i=t[e],n=t[e+1];if(Lo(s,r,o,a,_,p,i,n)){const t=i-_,e=n-p,s=_+Po*t,r=p+Po*e,o=_+Fo*t,a=p+Fo*e;d&&m&&s===c&&r===u?l.push(o,a):(d&&h.push(l.length),l.push(s,r,o,a),d=!0),c=o,u=a,m=!0}_=i,p=n}g=f}return d&&h.push(l.length),{flatCoordinates:l,ends:h}}(h,s,c,this.getBufferedMaxExtent());if(h=t.flatCoordinates,s=t.ends,c=2,0===s.length)return}this.beginGeometry(t,e,i??0);const u=r.repeat,d=u?void 0:r.textAlign;let g=0;for(let t=0,e=s.length;t<e;++t){let e;e=u?ko(u*this.resolution,h,g,s[t],c):[h.slice(g,s[t])];for(let i=0,n=e.length;i<n;++i){const n=e[i];let l=0,h=n.length;if(null==d){const t=Ao(r.maxAngle??Math.PI/4,n,0,n.length,2);l=t[0],h=t[1]}for(let t=l;t<h;t+=c)o.push(n[t],n[t+1]);const u=o.length;g=s[t],this.drawChars_(a,u),a=u}}this.endGeometry(e)}}saveTextStates_(){const t=this.textStrokeState_,e=this.textState_,i=this.textFillState_,n=this.strokeKey_;t&&(n in this.strokeStates||(this.strokeStates[n]={strokeStyle:t.strokeStyle,lineCap:t.lineCap,lineDashOffset:t.lineDashOffset,lineWidth:t.lineWidth,lineJoin:t.lineJoin,miterLimit:t.miterLimit,lineDash:t.lineDash}));const s=this.textKey_;s in this.textStates||(this.textStates[s]={font:e.font,textAlign:e.textAlign||Ns,justify:e.justify,textBaseline:e.textBaseline||js,scale:e.scale});const r=this.fillKey_;i&&(r in this.fillStates||(this.fillStates[r]={fillStyle:i.fillStyle}))}drawChars_(t,e){const i=this.textStrokeState_,n=this.textState_,s=this.strokeKey_,r=this.textKey_,o=this.fillKey_;this.saveTextStates_();const a=this.pixelRatio,l=Oo[n.textBaseline||js],h=this.textOffsetX_*a,c=this.textOffsetY_*a,u=this.text_,d=n.scale??[1,1],g=i?i.lineWidth*Math.abs(d[0])/2:0;this.instructions.push([po,t,e,l,n.overflow,o,n.maxAngle,a,c,s,g*a,u,r,1,this.declutterMode_,this.textKeepUpright_,h]),this.hitDetectionInstructions.push([po,t,e,l,n.overflow,o?As:o,n.maxAngle,a,c,s,g*a,u,r,1/a,this.declutterMode_,this.textKeepUpright_,h])}setTextStyle(t,e){let i,n,s;if(t){const e=t.getFill();e?(n=this.textFillState_,n||(n={},this.textFillState_=n),n.fillStyle=xs(e.getColor()||As)||As):(n=null,this.textFillState_=n);const r=t.getStroke();if(r){s=this.textStrokeState_,s||(s={},this.textStrokeState_=s);const t=r.getLineDash(),e=r.getLineDashOffset(),i=r.getWidth(),n=r.getMiterLimit();s.lineCap=r.getLineCap()||Os,s.lineDash=t?t.slice():Ds,s.lineDashOffset=void 0===e?0:e,s.lineJoin=r.getLineJoin()||Gs,s.lineWidth=void 0===i?1:i,s.miterLimit=void 0===n?10:n,s.strokeStyle=xs(r.getColor()||zs)||zs}else s=null,this.textStrokeState_=s;i=this.textState_;const o=t.getFont()||ks;Us(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()||js,i.backgroundFill=t.getBackgroundFill()??void 0,i.backgroundStroke=t.getBackgroundStroke()??void 0,i.padding=t.getPadding()||Xs,i.scale=void 0===a?[1,1]:a;const l=t.getOffsetX(),h=t.getOffsetY(),c=t.getRotateWithView(),u=t.getKeepUpright(),d=t.getRotation();this.text_=t.getText()||"",this.textOffsetX_=void 0===l?0:l,this.textOffsetY_=void 0===h?0:h,this.textRotateWithView_=void 0!==c&&c,this.textKeepUpright_=void 0===u||u,this.textRotation_=void 0===d?0:d,this.strokeKey_=s?("string"==typeof s.strokeStyle?s.strokeStyle:T(s.strokeStyle))+s.lineCap+s.lineDashOffset+"|"+s.lineWidth+s.lineJoin+s.miterLimit+"["+s.lineDash.join()+"]":"",this.textKey_=i.font+i.scale+(i.textAlign||"?")+(i.repeat||"?")+(i.justify||"?")+(i.textBaseline||"?"),this.fillKey_=n&&n.fillStyle?"string"==typeof n.fillStyle?n.fillStyle:"|"+T(n.fillStyle):""}else this.text_="";this.declutterMode_=t?t.getDeclutterMode():void 0,this.declutterImageWithText_=e}}};class Go{constructor(t,e,i,n){this.tolerance_=t,this.maxExtent_=e,this.pixelRatio_=n,this.resolution_=i,this.buildersByZIndex_={}}finish(){const t={};for(const e in this.buildersByZIndex_){t[e]=t[e]||{};const i=this.buildersByZIndex_[e];for(const n in i){const s=i[n].finish();t[e][n]=s}}return t}getBuilder(t,e){const i=void 0!==t?t.toString():"0";let n=this.buildersByZIndex_[i];void 0===n&&(n={},this.buildersByZIndex_[i]=n);let s=n[e];if(void 0===s){s=new(0,Do[e])(this.tolerance_,this.maxExtent_,this.resolution_,this.pixelRatio_),n[e]=s}return s}}let zo;const No=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 jo(t,e,i,n,s,r,o,a,l,h,c,u,d=!0){let g=t[e],f=t[e+1],_=0,p=0,m=0,y=0;function x(){_=g,p=f,g=t[e+=n],f=t[e+1],y+=m,m=Math.sqrt((g-_)*(g-_)+(f-p)*(f-p))}do{x()}while(e<i-n&&y+m<r);let v=0===m?0:(r-y)/m;const w=jt(_,g,v),C=jt(p,f,v),S=e-n,E=y,b=r+a*l(h,s,c);for(;e<i-n&&y+m<b;)x();v=0===m?0:(b-y)/m;const R=jt(_,g,v),I=jt(p,f,v);let M=!1;if(d)if(u){const t=[w,C,R,I];xi(t,0,4,2,u,t,t),M=t[0]>t[2]}else M=w>R;const T=Math.PI,P=[],F=S+n===e;let L;if(m=0,y=E,g=t[e=S],f=t[e+1],F){x(),L=Math.atan2(f-p,g-_),M&&(L+=L>0?-T:T);const t=(R+w)/2,e=(I+C)/2;return P[0]=[t,e,(b-r)/2,L,s],P}s=s.replace(/\n/g," ");const k=Array.from((zo||(zo=new Intl.Segmenter(void 0,{granularity:"grapheme"})),zo).segment(s),t=>t.segment),A=M!==No.test(s);for(let t=0,s=k.length;t<s;){x();let u=Math.atan2(f-p,g-_);if(M&&(u+=u>0?-T:T),void 0!==L){let t=u-L;if(t+=t>T?-2*T:t<-T?2*T:0,Math.abs(t)>o)return null}L=u;const d=t;let w=0;for(;t<s;++t){const o=a*l(h,k[A?s-t-1:t],c);if(e+n<i&&y+m<r+w+o/2)break;w+=o}if(t===d)continue;const C=(A?k.slice(s-t,s-d):k.slice(d,t)).join("");v=0===m?0:(r+w/2-y)/m;const S=jt(_,g,v),E=jt(p,f,v);P.push([S,E,w/2,u,C]),r+=w}return P}class Xo{constructor(){this.instructions_=[],this.zIndex=0,this.offset_=0,this.pendingMethod_,this.context_=new Proxy(An(),{get:(t,e)=>{if("function"==typeof t[e])return this.pendingMethod_=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_(this.pendingMethod_,t)};pushFunction(t){this.push_(t)}getContext(){return this.context_}draw(t){this.instructions_.forEach(e=>{for(let i=0,n=e.length;i<n;++i){const n=e[i];if("function"==typeof n){n(t);continue}const s=e[++i];"function"==typeof t[n]?t[n](...s):t[n]="function"==typeof s?s(t):s}})}clear(){this.instructions_.length=0,this.zIndex=0,this.offset_=0}offset(){this.offset_=this.instructions_.length,this.zIndex=0}}const Ko=[1/0,1/0,-1/0,-1/0],Wo=[],Yo=[],Zo=[],Bo=[];function Vo(t){return t[3].declutterBox}function Uo(t,e){return"start"===e?e=No.test(t)?"right":"left":"end"===e&&(e=No.test(t)?"left":"right"),Oo[e]}function qo(t,e,i){return i>0&&t.push("\n",""),t.push(e,""),t}function $o(t,e,i){return i%2==0&&(t+=e),t}class Ho{constructor(t,e,i,n,s){this.overlaps=i,this.pixelRatio=e,this.resolution=t,this.alignAndScaleFill_,this.instructions=n.instructions,this.coordinates=n.coordinates,this.coordinateCache_={},this.renderedTransform_=di(),this.hitDetectionInstructions=n.hitDetectionInstructions,this.pixelCoordinates_=null,this.viewRotation_=0,this.fillStates=n.fillStates||{},this.strokeStates=n.strokeStates||{},this.textStates=n.textStates||{},this.widths_={},this.labels_={},this.zIndexContext_=s?new Xo:null}getZIndexContext(){return this.zIndexContext_}createLabel(t,e,i,n){const s=t+e+i+n;if(this.labels_[s])return this.labels_[s];const r=n?this.strokeStates[n]:null,o=i?this.fillStates[i]:null,a=this.textStates[e],l=this.pixelRatio,h=[a.scale[0]*l,a.scale[1]*l],c=a.justify?Oo[a.justify]:Uo(Array.isArray(t)?t[0]:t,a.textAlign||Ns),u=n&&r.lineWidth?r.lineWidth:0,d=Array.isArray(t)?t:String(t).split("\n").reduce(qo,[]),{width:g,height:f,widths:_,heights:p,lineWidths:m}=function(t,e){const i=[],n=[],s=[];let r=0,o=0,a=0,l=0;for(let h=0,c=e.length;h<=c;h+=2){const u=e[h];if("\n"===u||h===c){r=Math.max(r,o),s.push(o),o=0,a+=l,l=0;continue}const d=e[h+1]||t.font,g=Hs(d,u);i.push(g),o+=g;const f=qs(d);n.push(f),l=Math.max(l,f)}return{width:r,height:a,widths:i,heights:n,lineWidths:s}}(a,d),y=g+u,x=[],v=(y+2)*h[0],w=(f+u)*h[1],C={width:v<0?Math.floor(v):Math.ceil(v),height:w<0?Math.floor(w):Math.ceil(w),contextInstructions:x};1==h[0]&&1==h[1]||x.push("scale",h),n&&r&&(x.push("strokeStyle",r.strokeStyle),x.push("lineWidth",u),x.push("lineCap",r.lineCap),x.push("lineJoin",r.lineJoin),x.push("miterLimit",r.miterLimit),x.push("setLineDash",[r.lineDash]),x.push("lineDashOffset",r.lineDashOffset)),i&&o&&x.push("fillStyle",o.fillStyle),x.push("textBaseline","middle"),x.push("textAlign","center");const S=.5-c;let E=c*y+S*u;const b=[],R=[];let I,M=0,T=0,P=0,F=0;for(let t=0,e=d.length;t<e;t+=2){const e=d[t];if("\n"===e){T+=M,M=0,E=c*y+S*u,++F;continue}const s=d[t+1]||a.font;s!==I&&(n&&b.push("font",s),i&&R.push("font",s),I=s),M=Math.max(M,p[P]);const r=[e,E+S*_[P]+c*(_[P]-m[F]),.5*(u+M)+T];E+=_[P],n&&b.push("strokeText",r),i&&R.push("fillText",r),++P}return Array.prototype.push.apply(x,b),Array.prototype.push.apply(x,R),this.labels_[s]=C,C}replayTextBackground_(t,e,i,n,s,r,o){t.beginPath(),t.moveTo.apply(t,e),t.lineTo.apply(t,i),t.lineTo.apply(t,n),t.lineTo.apply(t,s),t.lineTo.apply(t,e),r&&(this.alignAndScaleFill_=r[2],t.fillStyle=r[1],this.fill_(t)),o&&(this.setStrokeStyle_(t,o),t.stroke())}calculateImageOrLabelDimensions_(t,e,i,n,s,r,o,a,l,h,c,u,d,g,f,_){let p=i-(o*=u[0]),m=n-(a*=u[1]);const y=s+l>t?t-l:s,x=r+h>e?e-h:r,v=g[3]+y*u[0]+g[1],w=g[0]+x*u[1]+g[2],C=p-g[3],S=m-g[0];let E;return(f||0!==c)&&(Wo[0]=C,Bo[0]=C,Wo[1]=S,Yo[1]=S,Yo[0]=C+v,Zo[0]=Yo[0],Zo[1]=S+w,Bo[1]=Zo[1]),0!==c?(E=fi(di(),i,n,1,1,c,-i,-n),gi(E,Wo),gi(E,Yo),gi(E,Zo),gi(E,Bo),ot(Math.min(Wo[0],Yo[0],Zo[0],Bo[0]),Math.min(Wo[1],Yo[1],Zo[1],Bo[1]),Math.max(Wo[0],Yo[0],Zo[0],Bo[0]),Math.max(Wo[1],Yo[1],Zo[1],Bo[1]),Ko)):ot(Math.min(C,C+v),Math.min(S,S+w),Math.max(C,C+v),Math.max(S,S+w),Ko),d&&(p=Math.round(p),m=Math.round(m)),{drawImageX:p,drawImageY:m,drawImageW:y,drawImageH:x,originX:l,originY:h,declutterBox:{minX:Ko[0],minY:Ko[1],maxX:Ko[2],maxY:Ko[3],value:_},canvasTransform:E,scale:u}}replayImageOrLabelArgs_(t){return this.replayImageOrLabel_(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}replayImageOrLabel_(t,e,i,n,s,r,o){const a=!(!r&&!o),l=n.declutterBox,h=o?o[2]*n.scale[0]/2:0;return l.minX-h<=e[0]&&l.maxX+h>=0&&l.minY-h<=e[1]&&l.maxY+h>=0&&(a&&this.replayTextBackground_(t,Wo,Yo,Zo,Bo,r,o),Qs(t,n.canvasTransform,s,i,n.originX,n.originY,n.drawImageW,n.drawImageH,n.drawImageX,n.drawImageY,n.scale)),!0}fill_(t){const e=this.alignAndScaleFill_;if(e){const i=gi(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 s=this.textStates[e],r=this.createLabel(t,e,n,i),o=this.strokeStates[i],a=this.pixelRatio,l=Uo(Array.isArray(t)?t[0]:t,s.textAlign||Ns),h=Oo[s.textBaseline||js],c=o&&o.lineWidth?o.lineWidth:0;return{label:r,anchorX:l*(r.width/a-2*s.scale[0])+2*(.5-l)*c,anchorY:h*r.height/a+2*(.5-h)*c}}execute_(t,e,i,n,s,r,o,a){const l=this.zIndexContext_;let h;var c,u;this.pixelCoordinates_&&R(i,this.renderedTransform_)?h=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),h=yi(this.coordinates,0,this.coordinates.length,2,i,this.pixelCoordinates_),c=this.renderedTransform_,u=i,c[0]=u[0],c[1]=u[1],c[2]=u[2],c[3]=u[3],c[4]=u[4],c[5]=u[5]);let d=0;const g=n.length;let f,_=0;const p=[];let m,y,x,v,w,C,S,E,b,I,M,T,P,F=0,L=0;const k=this.coordinateCache_,A=this.viewRotation_,O=Math.round(1e12*Math.atan2(-i[1],i[0]))/1e12,D={context:t,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:A},G=this.instructions!=n||this.overlaps?0:200;let z,N,j,X;for(;d<g;){const i=n[d];switch(i[0]){case co:z=i[1],X=i[3],z.getGeometry()?void 0===o||Tt(o,X.getExtent())?++d:d=i[2]+1:d=i[2],l&&(l.zIndex=i[4]);break;case uo:F>G&&(this.fill_(t),F=0),L>G&&(t.stroke(),L=0),F||L||(t.beginPath(),w=NaN,C=NaN),++d;break;case go:_=i[1],x=i[2]??0;const n=h[_],c=h[_+1],u=h[_+2]-x-n,g=h[_+3]-x-c,R=Math.sqrt(u*u+g*g);t.moveTo(n+R,c),t.arc(n,c,R,0,2*Math.PI,!0),++d;break;case fo:t.closePath(),++d;break;case _o:_=i[1],f=i[2];const K=i[3],W=i[4],Y=i[5];D.geometry=K,D.feature=z,d in k||(k[d]=[]);const Z=k[d];Y?Y(h,_,f,2,Z):(Z[0]=h[_],Z[1]=h[_+1],Z.length=2),l&&(l.zIndex=i[6]),W(Z,D),++d;break;case mo:_=i[1],f=i[2],b=i[3],m=i[4],y=i[5];let B=i[6];const V=i[7],U=i[8],q=i[9],$=i[10];let H=i[11];const J=i[12];let Q=i[13];v=i[14]||"declutter";const tt=i[15];if(!b&&i.length>=20){I=i[19],M=i[20],T=i[21],P=i[22];const t=this.drawLabelWithPointPlacement_(I,M,T,P);b=t.label,i[3]=b;const e=i[23];m=(t.anchorX-e)*this.pixelRatio,i[4]=m;const n=i[24];y=(t.anchorY-n)*this.pixelRatio,i[5]=y,B=b.height,i[6]=B,Q=b.width,i[13]=Q}let et,it,nt,st;i.length>25&&(et=i[25]),i.length>17?(it=i[16],nt=i[17],st=i[18]):(it=Xs,nt=null,st=null),$&&O?H+=A:$||O||(H-=A);let rt=0;for(;_<f;_+=2){if(et&&et[rt++]<Q/this.pixelRatio)continue;const i=this.calculateImageOrLabelDimensions_(b.width,b.height,h[_],h[_+1],Q,B,m,y,U,q,H,J,s,it,!!nt||!!st,z),n=[t,e,b,i,V,nt,st];if(a){let t,e,s,r,o;if(tt){const i=f-_;if(!tt[i]){tt[i]={args:n,declutterMode:v};continue}const r=tt[i];t=r.args,e=r.declutterMode,delete tt[i],s=Vo(t)}if(!t||"declutter"===e&&a.collides(s)||(r=!0),"declutter"===v&&a.collides(i.declutterBox)||(o=!0),"declutter"===e&&"declutter"===v){const t=r&&o;r=t,o=t}r&&("none"!==e&&a.insert(s),this.replayImageOrLabelArgs_(t)),o&&("none"!==v&&a.insert(i.declutterBox),this.replayImageOrLabelArgs_(n))}else this.replayImageOrLabelArgs_(n)}++d;break;case po:const ot=i[1],at=i[2],lt=i[3],ht=i[4];P=i[5];const ct=i[6],ut=i[7],dt=i[8];T=i[9];const gt=i[10];I=i[11],Array.isArray(I)&&(I=I.reduce($o,"")),M=i[12];const ft=[i[13],i[13]];v=i[14]||"declutter";const _t=i[15],pt=i[16],mt=this.textStates[M],yt=mt.font,xt=[mt.scale[0]*ut,mt.scale[1]*ut];let vt;yt in this.widths_?vt=this.widths_[yt]:(vt={},this.widths_[yt]=vt);const wt=Bn(h,ot,at,2),Ct=Math.abs(xt[0])*Js(yt,I,vt);if(ht||Ct<=wt){const i=jo(h,ot,at,2,I,(wt-Ct)*Uo(I,this.textStates[M].textAlign),ct,Math.abs(xt[0]),Js,yt,vt,O?0:this.viewRotation_,_t);t:if(i){const n=[];let s,r,o,l,h;if(T)for(s=0,r=i.length;s<r;++s){h=i[s],o=h[4],l=this.createLabel(o,M,"",T),m=h[2]+(xt[0]<0?-gt:gt)-pt,y=lt*l.height+2*(.5-lt)*gt*xt[1]/xt[0]-dt;const r=this.calculateImageOrLabelDimensions_(l.width,l.height,h[0],h[1],l.width,l.height,m,y,0,0,h[3],ft,!1,Xs,!1,z);if(a&&"declutter"===v&&a.collides(r.declutterBox))break t;n.push([t,e,l,r,1,null,null])}if(P)for(s=0,r=i.length;s<r;++s){h=i[s],o=h[4],l=this.createLabel(o,M,P,""),m=h[2]-pt,y=lt*l.height-dt;const r=this.calculateImageOrLabelDimensions_(l.width,l.height,h[0],h[1],l.width,l.height,m,y,0,0,h[3],ft,!1,Xs,!1,z);if(a&&"declutter"===v&&a.collides(r.declutterBox))break t;n.push([t,e,l,r,1,null,null])}a&&"none"!==v&&a.load(n.map(Vo));for(let t=0,e=n.length;t<e;++t)this.replayImageOrLabelArgs_(n[t])}}++d;break;case yo:if(void 0!==r){z=i[1];const t=r(z,X,v);if(t)return t}++d;break;case xo:G?F++:this.fill_(t),++d;break;case vo:let St,Et,bt;if(_=i[1],f=i[2],x=i[3],x){const t=(i[4]??!1)||Math.abs(h[_]-h[f-2])<1e-6&&Math.abs(h[_+1]-h[f-1])<1e-6;vs(h,_,f,2,x,t,p),Cs(p,2,t),St=p,Et=0,bt=St.length}else St=h,Et=_,bt=f;N=St[Et],j=St[Et+1],t.moveTo(N,j),w=N+.5|0,C=j+.5|0;for(let e=Et+2;e<bt;e+=2)N=St[e],j=St[e+1],S=N+.5|0,E=j+.5|0,e!=bt-2&&S===w&&E===C||(t.lineTo(N,j),w=S,C=E);++d;break;case wo:this.alignAndScaleFill_=i[2],F?(this.fill_(t),F=0,L&&(t.stroke(),L=0)):L&&i[1]&&(t.stroke(),L=0),t.fillStyle=i[1],++d;break;case Co:F&&i[1]&&(this.fill_(t),F=0),L&&(t.stroke(),L=0),this.setStrokeStyle_(t,i),++d;break;case So:G?L++:t.stroke(),++d;break;default:++d}}F&&this.fill_(t),L&&t.stroke()}execute(t,e,i,n,s,r){this.viewRotation_=n,this.execute_(t,e,i,this.instructions,s,void 0,void 0,r)}executeHitDetection(t,e,i,n,s){return this.viewRotation_=i,this.execute_(t,[t.canvas.width,t.canvas.height],e,this.hitDetectionInstructions,!0,n,s)}}const Jo=["Polygon","Circle","LineString","Image","Text","Default"],Qo=["Image","Text"],ta=Jo.filter(t=>!Qo.includes(t));let ea=!1,ia=!1;class na{constructor(t,e,i,n,s,r,o){this.maxExtent_=t,this.overlaps_=n,this.pixelRatio_=i,this.resolution_=e,this.renderBuffer_=r,this.executorsByZIndex_={},this.hitDetectionContext_=null,this.hitDetectionTransform_=di(),this.renderedContext_=null,this.deferredZIndexContexts_={},this.createExecutors_(s,!!o)}clip(t,e){const i=this.getClipCoords(e);t.beginPath(),t.moveTo(i[0],i[1]),t.lineTo(i[2],i[3]),t.lineTo(i[4],i[5]),t.lineTo(i[6],i[7]),t.clip()}createExecutors_(t,e){for(const i in t){let n=this.executorsByZIndex_[i];void 0===n&&(n={},this.executorsByZIndex_[i]=n);const s=t[i];for(const t in s){const i=s[t];n[t]=new Ho(this.resolution_,this.pixelRatio_,this.overlaps_,i,e)}}}hasExecutors(t){for(const e in this.executorsByZIndex_){const i=this.executorsByZIndex_[e];for(let e=0,n=t.length;e<n;++e)if(t[e]in i)return!0}return!1}forEachFeatureAtCoordinate(t,e,i,n,s,r){!1===ia&&function(){let t=0;const e=e=>{const i=Ln(1,1,null,{willReadFrequently:e});let n=0;const s=performance.now();for(;performance.now()-s<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};ea=i[t],ia=!0}();const o=2*(n=Math.round(n))+1,a=fi(this.hitDetectionTransform_,n+.5,n+.5,1/e,-1/e,-i,-t[0],-t[1]),l=!this.hitDetectionContext_;l&&(this.hitDetectionContext_=Ln(o,o,null,{willReadFrequently:ea}));const h=this.hitDetectionContext_;let c;h.canvas.width!==o||h.canvas.height!==o?(h.canvas.width=o,h.canvas.height=o):l||h.clearRect(0,0,o,o),void 0!==this.renderBuffer_&&(c=[1/0,1/0,-1/0,-1/0],dt(c,t),J(c,e*(this.renderBuffer_+n),c));const u=function(t){if(void 0!==sa[t])return sa[t];const e=2*t+1,i=t*t,n=new Array(i+1);for(let s=0;s<=t;++s)for(let r=0;r<=t;++r){const o=s*s+r*r;if(o>i)break;let a=n[o];a||(a=[],n[o]=a),a.push(4*((t+s)*e+(t+r))+3),s>0&&a.push(4*((t-s)*e+(t+r))+3),r>0&&(a.push(4*((t+s)*e+(t-r))+3),s>0&&a.push(4*((t-s)*e+(t-r))+3))}const s=[];for(let t=0,e=n.length;t<e;++t)n[t]&&s.push(...n[t]);return sa[t]=s,s}(n);let d;const g=h;function f(t,e,i){const a=g.getImageData(0,0,o,o).data;for(let l=0,h=u.length;l<h;l++)if(a[u[l]]>0){if(!r||"none"===i||"Image"!==d&&"Text"!==d||r.includes(t)){const i=(u[l]-3)/4,r=n-i%o,a=n-(i/o|0),h=s(t,e,r*r+a*a);if(h)return h}g.clearRect(0,0,o,o);break}}const _=Object.keys(this.executorsByZIndex_).map(Number);let p,m,y,x,v;for(_.sort(w),p=_.length-1;p>=0;--p){const t=_[p].toString();for(y=this.executorsByZIndex_[t],m=Jo.length-1;m>=0;--m)if(d=Jo[m],x=y[d],void 0!==x&&(v=x.executeHitDetection(h,a,i,f,c),v))return v}}getClipCoords(t){const e=this.maxExtent_;if(!e)return null;const i=e[0],n=e[1],s=e[2],r=e[3],o=[i,n,i,r,s,r,s,n];return yi(o,0,8,2,t,o),o}isEmpty(){return r(this.executorsByZIndex_)}execute(t,e,i,n,s,r,o){const a=Object.keys(this.executorsByZIndex_).map(Number);a.sort(o?C:w),r=r||Jo;const l=Jo.length;for(let h=0,c=a.length;h<c;++h){const c=a[h].toString(),u=this.executorsByZIndex_[c];for(let c=0,d=r.length;c<d;++c){const d=r[c],g=u[d];if(void 0!==g){const r=null===o?void 0:g.getZIndexContext(),c=r?r.getContext():t,u=this.maxExtent_&&"Image"!==d&&"Text"!==d;if(u&&(c.save(),this.clip(c,i)),r&&"Text"!==d&&"Image"!==d?r.pushFunction(t=>g.execute(t,e,i,n,s,o)):g.execute(c,e,i,n,s,o),u&&c.restore(),r){r.offset();const t=a[h]*l+Jo.indexOf(d);this.deferredZIndexContexts_[t]||(this.deferredZIndexContexts_[t]=[]),this.deferredZIndexContexts_[t].push(r)}}}}this.renderedContext_=t}getDeferredZIndexContexts(){return this.deferredZIndexContexts_}getRenderedContext(){return this.renderedContext_}renderDeferred(){const t=this.deferredZIndexContexts_,e=Object.keys(t).map(Number).sort(w);for(let i=0,n=e.length;i<n;++i)t[e[i]].forEach(t=>{t.draw(this.renderedContext_),t.clear()}),t[e[i]].length=0}}const sa={};function ra(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 oa extends to{constructor(t){const e=void 0!==(t=t||{}).opacity?t.opacity:1,i=void 0!==t.rotation?t.rotation:0,n=void 0!==t.scale?t.scale:1,s=void 0!==t.rotateWithView&&t.rotateWithView;super({opacity:e,rotation:i,scale:n,displacement:void 0!==t.displacement?t.displacement:[0,0],rotateWithView:s,declutterMode:t.declutterMode}),this.anchor_=void 0!==t.anchor?t.anchor:[.5,.5],this.normalizedAnchor_=null,this.anchorOrigin_=void 0!==t.anchorOrigin?t.anchorOrigin:"top-left",this.anchorXUnits_=void 0!==t.anchorXUnits?t.anchorXUnits:"fraction",this.anchorYUnits_=void 0!==t.anchorYUnits?t.anchorYUnits:"fraction",this.crossOrigin_=void 0!==t.crossOrigin?t.crossOrigin:null,this.referrerPolicy_=t.referrerPolicy;const r=void 0!==t.img?t.img:null;let o,a=t.src;if(W(!(void 0!==a&&r),"`image` and `src` cannot be provided at the same time"),void 0!==a&&0!==a.length||!r||(a=r.src||T(r)),W(void 0!==a&&a.length>0,"A defined and non-empty `src` or `image` must be provided"),W(!((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=cn:void 0!==r&&(o="complete"in r?r.complete?r.src?dn:cn:un:dn),this.color_=void 0!==t.color?ds(t.color):null,this.iconImage_=ys(r,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();i&&this.setScale(ra(i[0],i[1],t.width,t.height))};return void this.listenImageChange(e)}}void 0!==e&&this.setScale(ra(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 oa({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?ds(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(),s=void 0!==i?cn:this.iconImage_.getImageState();this.iconImage_=ys(n,i,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},s,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_=ys(null,t,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},cn,this.color_)}getSize(){return this.size_?this.size_:this.iconImage_.getSize()}getWidth(){const t=this.getScaleArray();if(this.size_)return this.size_[0]*t[0];if(this.iconImage_.getImageState()==dn){const e=this.iconImage_.getSize();if(e)return e[0]*t[0]}}getHeight(){const t=this.getScaleArray();if(this.size_)return this.size_[1]*t[1];if(this.iconImage_.getImageState()==dn){const e=this.iconImage_.getSize();if(e)return e[1]*t[1]}}setScale(t){delete this.initialOptions_,super.setScale(t)}listenImageChange(t){this.iconImage_.addEventListener(h,t)}load(){this.iconImage_.load()}unlistenImageChange(t){this.iconImage_.removeEventListener(h,t)}ready(){return this.iconImage_.ready()}}const aa=.5;class la extends O{constructor(t,e,i,n){super(t),this.inversePixelTransform=e,this.frameState=i,this.context=n??void 0}}class ha extends G{constructor(t){super(),this.ready=!0,this.boundHandleImageChange_=this.handleImageChange_.bind(this),this.layer_=t,this.staleKeys_=new Array,this.maxStaleKeys=5,this.renderedSourceKey_}getStaleKeys(){return this.staleKeys_}prependStaleKey(t){this.staleKeys_.unshift(t),this.staleKeys_.length>this.maxStaleKeys&&(this.staleKeys_.length=this.maxStaleKeys)}updateStaleKeys(t){this.renderedSourceKey_?this.renderedSourceKey_!==t&&(this.prependStaleKey(this.renderedSourceKey_),this.renderedSourceKey_=t):this.renderedSourceKey_=t}getFeatures(t){return I()}getData(t){return null}prepareFrame(t){return I()}renderFrame(t,e){return I()}forEachFeatureAtCoordinate(t,e,i,n,s){}getLayer(){return this.layer_}handleFontsChanged(){}handleImageChange_(t){const e=t.target;e.getState()!==dn&&e.getState()!==gn||this.renderIfReadyAndVisible()}loadImage(t){let e=t.getState();return e!=dn&&e!=gn&&t.addEventListener(h,this.boundHandleImageChange_),e==cn&&(t.load(),e=t.getState()),e==dn}renderIfReadyAndVisible(){const t=this.getLayer();t&&t.getVisible()&&"ready"===t.getSourceState()&&t.changed()}renderDeferred(t){}disposeInternal(){this.layer_=void 0,super.disposeInternal()}}const ca=[];let ua=null;class da extends ha{constructor(t){super(t),this.wantRotation=!1,this.container=null,this.renderedResolution,this.tempTransform=di(),this.pixelTransform=di(),this.inversePixelTransform=di(),this.context=null,this.deferredContext_=null,this.containerReused=!1,this.frameState=null}getImageData(t,e,i){ua||(ua=Ln(1,1,void 0,{willReadFrequently:!0}));const n=ua;if(!n)return null;let s;n.clearRect(0,0,1,1);try{n.drawImage(t,e,i,1,1,0,0,1,1),s=n.getImageData(0,0,1,1).data}catch{return ua=null,null}return s}getBackground(t){let e=this.getLayer().getBackground();return"function"==typeof e&&(e=e(t.viewState.resolution)),e||void 0}useContainer(t,e,i,n,s){if(Xn(t)&&0===this.pixelTransform[1]&&0===this.pixelTransform[2]&&0===this.pixelTransform[4]&&0===this.pixelTransform[5]&&t.width===n&&t.height===s){const e=t,n=e.getContext("2d");if(n)return this.container=t,this.context=n,this.containerReused=!0,void(i&&(n.fillStyle=i,n.fillRect(0,0,e.width,e.height)))}const r=this.getLayer().getClassName();let o,a;if(t&&t.className===r&&(!i||t&&t.style.backgroundColor&&R(ds(t.style.backgroundColor),ds(i)))){const e=t.firstElementChild;Xn(e)&&(a=e.getContext("2d"))}if(a&&function(t,e){const i=mi(t),n=mi(e);for(let t=0;t<6;++t)if(0!==Math.round((i[t]-n[t])*pi[t]))return!1;return!0}(a.canvas.style.transform,e)?(this.container=t,this.context=a,this.containerReused=!0):this.containerReused?(this.container=null,this.context=null,this.containerReused=!1):this.container&&(this.container.style.backgroundColor=null),!this.container){o=yn?jn():document.createElement("div"),o.className=r;let t=o.style;t.position="absolute",t.width="100%",t.height="100%",a=Ln();const e=a.canvas;o.appendChild(e),t=e.style,t.position="absolute",t.left="0",t.transformOrigin="top left",this.container=o,this.context=a}this.containerReused||!i||this.container.style.backgroundColor||(this.container.style.backgroundColor=i)}clipUnrotated(t,e,i){const n=Rt(i),s=It(i),r=yt(i),o=mt(i);gi(e.coordinateToPixelTransform,n),gi(e.coordinateToPixelTransform,s),gi(e.coordinateToPixelTransform,r),gi(e.coordinateToPixelTransform,o);const a=this.inversePixelTransform;gi(a,n),gi(a,s),gi(a,r),gi(a,o),t.save(),t.beginPath(),t.moveTo(Math.round(n[0]),Math.round(n[1])),t.lineTo(Math.round(s[0]),Math.round(s[1])),t.lineTo(Math.round(r[0]),Math.round(r[1])),t.lineTo(Math.round(o[0]),Math.round(o[1])),t.clip()}prepareContainer(t,e){const i=t.extent,n=t.viewState.resolution,s=this.sourceRotates(),r=s?0:t.viewState.rotation,o=t.pixelRatio,a=s?Math.round(t.size[0]*o):Math.round(Mt(i)/n*o),l=s?Math.round(t.size[1]*o):Math.round(St(i)/n*o);fi(this.pixelTransform,t.size[0]/2,t.size[1]/2,1/o,1/o,r,-a/2,-l/2),_i(this.inversePixelTransform,this.pixelTransform);const h="matrix("+this.pixelTransform.join(", ")+")";const c=this.getBackground(t);if(this.useContainer(e,h,c,a,l),!this.containerReused){const t=this.context.canvas;t.width!=a||t.height!=l?(t.width=a,t.height=l):this.context.clearRect(0,0,a,l),h!==t.style.transform&&(t.style.transform=h)}}dispatchRenderEvent_(t,e,i){const n=this.getLayer();if(n.hasListener(t)){const s=new la(t,this.inversePixelTransform,i,e);n.dispatchEvent(s)}}preRender(t,e){this.frameState=e,e.declutter||this.dispatchRenderEvent_(ar,t,e)}postRender(t,e){e.declutter||this.dispatchRenderEvent_(lr,t,e)}renderDeferredInternal(t){}getRenderContext(t){return t.declutter&&!this.deferredContext_&&(this.deferredContext_=new Xo),t.declutter?this.deferredContext_.getContext():this.context}getCanvasContext(){const t=this.context;if(!t)throw new Error("Canvas context not initialized");return t}getContainerElement(){const t=this.container;if(!t)throw new Error("Canvas container not initialized");return t}renderDeferred(t){t.declutter&&(this.dispatchRenderEvent_(ar,this.context,t),t.declutter&&this.deferredContext_&&(this.deferredContext_.draw(this.context),this.deferredContext_.clear()),this.renderDeferredInternal(t),this.dispatchRenderEvent_(lr,this.context,t))}getRenderTransform(t,e,i,n,s,r,o){const a=s/2,l=r/2,h=n/e,c=-h,u=-t[0]+o,d=-t[1];return fi(this.tempTransform,a,l,h,c,-i,u,d)}sourceRotates(){return this.wantRotation&&!!this.getLayer().getSource()?.canRotate}disposeInternal(){delete this.frameState,super.disposeInternal()}}class ga extends da{constructor(t,e){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,void 0!==e?.wantRotation&&(this.wantRotation=e.wantRotation)}renderWorlds(t,e,i){const n=e.extent,s=e.viewState,r=s.center,o=s.resolution,a=s.projection,l=s.rotation,h=a.getExtent(),c=this.getLayer().getSource(),u=this.getLayer().getDeclutter(),d=e.pixelRatio,g=e.viewHints,f=!(g[lo]||g[ho]),_=this.context,p=_.canvas.width,m=_.canvas.height,y=c.getWrapX()&&a.canWrapX(),x=y?Mt(h):null,v=n,w=y?Math.ceil((v[2]-h[2])/x)+(this.extendX_?2:1):1;let C=y?Math.floor((v[0]-h[0])/x)-(this.extendX_?1:0):0;do{let n=this.getRenderTransform(r,o,this.sourceRotates()?l:0,d,p,m,C*x);e.declutter&&(n=n.slice(0)),t.execute(_,[_.canvas.width,_.canvas.height],n,l,f,void 0===i?Jo:i?Qo:ta,i?u&&e.declutter[u]:void 0)}while(++C<w)}setDrawContext_(){1!==this.opacity_&&(this.targetContext_=this.context,this.context=Ln(this.context.canvas.width,this.context.canvas.height,ca))}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,On(this.context),ca.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 s=this.context,r=this.replayGroup_;let o=r&&!r.isEmpty();if(!o){if(!(this.getLayer().hasListener(ar)||this.getLayer().hasListener(lr)))return this.container}this.setDrawContext_(),this.preRender(s,t),n.projection,this.clipExtent_=null;let a=!1;if(o&&i.extent&&this.clipping){const e=ai(i.extent);o=Tt(e,t.extent);o&&!it(e,t.extent)&&(t.declutter?this.clipExtent_=e:(this.clipUnrotated(s,t,e),a=!0))}return o&&this.renderWorlds(r,t,!this.getLayer().getDeclutter()&&void 0),a&&s.restore(),this.postRender(s,t),this.renderedRotation_!==n.rotation&&(this.renderedRotation_=n.rotation,this.hitDetectionImageData_=null),t.declutter||this.resetDrawContext_(),this.container}getFeatures(t){return new Promise(e=>{if(this.frameState&&!this.hitDetectionImageData_&&!this.animatingOrInteracting_){const t=this.frameState.size.slice(),e=this.renderedCenter_,i=this.renderedResolution_,n=this.renderedRotation_,s=this.renderedProjection_,r=this.wrappedRenderedExtent_,o=this.getLayer(),a=[],l=t[0]*aa,h=t[1]*aa;a.push(this.getRenderTransform(e,i,n,aa,l,h,0).slice());const c=o.getSource(),u=s.getExtent();if(c.getWrapX()&&s.canWrapX()&&!it(u,r)){let t=r[0];const s=Mt(u);let o,c=0;for(;t<u[0];)--c,o=s*c,a.push(this.getRenderTransform(e,i,n,aa,l,h,o).slice()),t+=s;for(c=0,t=r[2];t>u[2];)++c,o=s*c,a.push(this.getRenderTransform(e,i,n,aa,l,h,o).slice()),t-=s}const d=null;this.hitDetectionImageData_=function(t,e,i,n,s,r,o,a,l){const h=l?oi(s):s,c=Ln(t[0]*aa,t[1]*aa);c.imageSmoothingEnabled=!1;const u=c.canvas,d=new tr(c,aa,s,[1,0,0,1,0,0],o,a??0,l?ti(null,l)??void 0:void 0),g=i.length,f=Math.floor(16777215/g),_={};for(let t=1;t<=g;++t){const e=i[t-1],s=e.getStyleFunction()||n;if(!s)continue;let o=s(e,r);if(!o)continue;Array.isArray(o)||(o=[o]);const a=(t*f).toString(16).padStart(7,"#00000");for(let t=0,i=o.length;t<i;++t){const i=o[t],n=i.getGeometryFunction()(e);if(!n||!Tt(h,n.getExtent()))continue;const s=i.clone(),r=s.getFill();r&&r.setColor(a);const l=s.getStroke();l&&(l.setColor(a),l.setLineDash(null)),s.setText(null);const c=i.getImage();if(c){const t=c.getImageSize();if(!t)continue;const e=Ln(t[0],t[1],void 0,{alpha:!1}),i=e.canvas;e.fillStyle=a,e.fillRect(0,0,i.width,i.height),s.setImage(new oa({img:i,anchor:c.getAnchor()??void 0,anchorXUnits:"pixels",anchorYUnits:"pixels",offset:c.getOrigin()??void 0,opacity:1,size:c.getSize()??void 0,scale:c.getScale(),rotation:c.getRotation(),rotateWithView:c.getRotateWithView()}))}const u=s.getZIndex()||0;let d=_[u];d||(d={},_[u]=d,d.Polygon=[],d.Circle=[],d.LineString=[],d.Point=[]);const g=n.getType();if("GeometryCollection"===g){const t=n.getGeometriesArrayRecursive();for(let e=0,i=t.length;e<i;++e){const i=t[e];d[i.getType().replace("Multi","")].push(i,s)}}else d[g.replace("Multi","")].push(n,s)}}const p=Object.keys(_).map(Number).sort(w);for(let t=0,i=p.length;t<i;++t){const i=_[p[t]];for(const t in i){const n=i[t];for(let t=0,i=n.length;t<i;t+=2){d.setStyle(n[t+1]);for(let i=0,s=e.length;i<s;++i)d.setTransform(e[i]),d.drawGeometry(n[t])}}}return c.getImageData(0,0,u.width,u.height)}(t,a,this.renderedFeatures_,o.getStyleFunction(),r,i,n,nr(i,this.renderedPixelRatio_),d?s:null)}e(function(t,e,i){const n=[];if(i){const s=Math.floor(Math.round(t[0])*aa),r=Math.floor(Math.round(t[1])*aa),o=4*(At(s,0,i.width-1)+At(r,0,i.height-1)*i.width),a=i.data[o],l=i.data[o+1],h=i.data[o+2]+256*(l+256*a),c=Math.floor(16777215/e.length);h&&h%c===0&&n.push(e[h/c-1])}return n}(t,this.renderedFeatures_,this.hitDetectionImageData_))})}forEachFeatureAtCoordinate(t,e,i,n,s){if(!this.replayGroup_)return;const r=e.viewState.resolution,o=e.viewState.rotation,a=this.getLayer(),l={},h=this.getLayer().getDeclutter();return this.replayGroup_.forEachFeatureAtCoordinate(t,r,o,i,function(t,e,i){const r=T(t),o=l[r];if(o){if(!0!==o&&i<o.distanceSq){if(0===i)return l[r]=!0,s.splice(s.lastIndexOf(o),1),n(t,a,e);o.geometry=e,o.distanceSq=i}}else{if(0===i)return l[r]=!0,n(t,a,e);s.push(l[r]={feature:t,layer:a,geometry:e,distanceSq:i,callback:n})}},h?e.declutter?.[h]?.all().map(t=>t.value):null)}handleFontsChanged(){const t=this.getLayer();t.getVisible()&&this.replayGroup_&&t.changed()}handleStyleImageChange_(t){this.renderIfReadyAndVisible()}prepareFrame(t){const e=this.getLayer(),i=e.getSource();if(!i)return!1;const n=t.viewHints[lo],s=t.viewHints[ho],r=e.getUpdateWhileAnimating(),o=e.getUpdateWhileInteracting();if(this.ready&&!r&&n||!o&&s)return this.animatingOrInteracting_=!0,!0;this.animatingOrInteracting_=!1;const a=t.extent,l=t.viewState,h=l.projection,c=l.resolution,u=t.pixelRatio,d=e.getRevision(),g=e.getRenderBuffer();let f=e.getRenderOrder();void 0===f&&(f=ir);const _=l.center.slice(),p=J(a,g*c),m=p.slice(),y=[p.slice()],x=h.getExtent(),v=i.getWrapX()&&h.canWrapX();if(this.extendX_=!1,v){const t=i.getExtent();t&&!Pt(t)&&(this.extendX_=t[0]<x[0]||t[2]>x[2])}if(v&&(!it(x,t.extent)||this.extendX_)){const t=Mt(x),e=Math.max(Mt(p)/2,t);let i=x[0],n=x[2];this.extendX_&&(i-=t,n+=t),p[0]=i-e,p[2]=n+e,Ht(_,h);const s=Ft(y[0],h);s[0]<x[0]&&s[2]<x[2]?y.push([s[0]+t,s[1],s[2]+t,s[3]]):s[0]>x[0]&&s[2]>x[2]&&y.push([s[0]-t,s[1],s[2]-t,s[3]])}if(this.ready&&this.renderedResolution_==c&&this.renderedPixelRatio_===u&&this.renderedRevision_==d&&this.renderedRenderOrder_==f&&this.renderedFrameDeclutter_===!!t.declutter&&it(this.wrappedRenderedExtent_,p))return R(this.renderedExtent_,m)||(this.hitDetectionImageData_=null,this.renderedExtent_=m),this.renderedCenter_=_,this.replayGroupChanged=!1,!0;this.replayGroup_=null;const w=new Go(sr(c,u),p,c,u);let C;for(let t=0,e=y.length;t<e;++t)i.loadFeatures(y[t],c,h);const S=nr(c,u);let E=!0;const b=(t,i)=>{let n;const s=t.getStyleFunction()||e.getStyleFunction();if(s&&(n=s(t,c)),n){const e=this.renderFeature(t,S,n,w,C,this.getLayer().getDeclutter(),i);E=E&&!e}},I=oi(p),M=i.getFeaturesInExtent(I);f&&M.sort(f);for(let t=0,e=M.length;t<e;++t)b(M[t],t);this.renderedFeatures_=M,this.ready=E;const T=w.finish(),P=new na(p,c,u,i.getOverlaps(),T,e.getRenderBuffer(),!!t.declutter);return this.renderedResolution_=c,this.renderedRevision_=d,this.renderedRenderOrder_=f,this.renderedFrameDeclutter_=!!t.declutter,this.renderedExtent_=m,this.wrappedRenderedExtent_=p,this.renderedCenter_=_,this.renderedProjection_=h,this.renderedPixelRatio_=u,this.replayGroup_=P,this.hitDetectionImageData_=null,this.replayGroupChanged=!0,!0}renderFeature(t,e,i,n,s,r,o){if(!i)return!1;let a=!1;if(Array.isArray(i))for(let l=0,h=i.length;l<h;++l)a=rr(n,t,i[l],e,this.boundHandleStyleImageChange_,s,r,o)||a;else a=rr(n,t,i,e,this.boundHandleStyleImageChange_,s,r,o);return a}}let fa=0;const _a=1<<fa++,pa=1<<fa++,ma=1<<fa++,ya=1<<fa++,xa=1<<fa++,va=1<<fa++,wa=Math.pow(2,6)-1,Ca={[_a]:"boolean",[pa]:"number",[ma]:"string",[ya]:"color",[xa]:"number[]",[va]:"size"},Sa=Object.keys(Ca).map(Number).sort(w);function Ea(t){const e=[];for(const i of Sa)ba(t,i)&&e.push(Ca[i]);return 0===e.length?"untyped":e.length<3?e.join(" or "):e.slice(0,-1).join(", ")+", or "+e[e.length-1]}function ba(t,e){return(t&e)===e}function Ra(t,e){return!!(t&e)}function Ia(t,e){return t===e}function Ma(t){return t instanceof Error?t.message:String(t)}class Ta{constructor(t,e){if(!function(t){return t in Ca}(t))throw new Error(`literal expressions must have a specific type, got ${Ea(t)}`);this.type=t,this.value=e}}class Pa{constructor(t,e,...i){this.type=t,this.operator=e,this.args=i}}function Fa(t){return{variables:new Map,properties:new Map,featureId:!1,geometryType:!1,mCoordinate:!1,mapState:!1,inputVariables:t}}function La(t,e,i){switch(typeof t){case"boolean":if(Ia(e,ma))return new Ta(ma,t?"true":"false");if(!ba(e,_a))throw new Error(`got a boolean, but expected ${Ea(e)}`);return new Ta(_a,t);case"number":if(Ia(e,va))return new Ta(va,Qr(t));if(Ia(e,_a))return new Ta(_a,!!t);if(Ia(e,ma))return new Ta(ma,t.toString());if(!ba(e,pa))throw new Error(`got a number, but expected ${Ea(e)}`);return new Ta(pa,t);case"string":if(Ia(e,ya))return new Ta(ya,us(t));if(Ia(e,_a))return new Ta(_a,!!t);if(!ba(e,ma))throw new Error(`got a string, but expected ${Ea(e)}`);return new Ta(ma,t)}if(!Array.isArray(t))throw new Error("expression must be an array or a primitive value");if(0===t.length)throw new Error("empty expression");if("string"==typeof t[0])return function(t,e,i){const n=t[0],s=Il[n];if(!s)throw new Error(`unknown operator: ${n}`);return s(t,e,i)}(t,e,i);for(const e of t)if("number"!=typeof e)throw new Error("expected an array of numbers");if(Ia(e,va)){if(2!==t.length)throw new Error(`expected an array of two values for a size, got ${t.length}`);return new Ta(va,t)}if(Ia(e,ya)){if(3===t.length)return new Ta(ya,[...t,1]);if(4===t.length)return new Ta(ya,t);throw new Error(`expected an array of 3 or 4 values for a color, got ${t.length}`)}if(!ba(e,xa))throw new Error(`got an array of numbers, but expected ${Ea(e)}`);return new Ta(xa,t)}const ka="get",Aa="var",Oa="concat",Da="geometry-type",Ga="line-metric",za="any",Na="all",ja="!",Xa="resolution",Ka="zoom",Wa="time",Ya="==",Za="!=",Ba=">",Va=">=",Ua="<",qa="<=",$a="*",Ha="/",Ja="+",Qa="-",tl="clamp",el="%",il="^",nl="abs",sl="floor",rl="ceil",ol="round",al="sin",ll="cos",hl="atan",cl="sqrt",ul="match",dl="between",gl="interpolate",fl="interpolate-hcl",_l="coalesce",pl="case",ml="in",yl="number",xl="string",vl="array",wl="color",Cl="id",Sl="band",El="palette",bl="to-string",Rl="has",Il={[ka]:Gl(Fl(1,1/0),Ml),[Aa]:function(t,e,i){const n=t[1];if("string"!=typeof n)throw new Error("expected a string argument for var operation");let s=e;const r=i.inputVariables?.[n];if(void 0!==r){const t=La(r,wa,i);if(!(t instanceof Ta))throw new Error(`style variables should only be literal values (no expressions!), variable name: ${n}`);let o=t.type;if("string"==typeof r&&Ra(s,ya)&&!Ra(s,ma)?o=ya:Array.isArray(r)&&2===r.length&&Ra(s,va)&&!Ra(s,xa)&&(o=va),s&=o,0===s)throw new Error(`the type expected from the var operator (${Ea(e)}) did not have any overlap with the type of the corresponding style variables (${Ea(o)}), variable name: ${n}`)}if(i.variables.has(n)){const t=i.variables.get(n);if(s&=t,0===s)throw new Error(`a new type expected from the var operator (${Ea(e)}) did not have any overlap with the previous type expected for it (${Ea(t)}), variable name: ${n}`)}return i.variables.set(n,s),new Pa(s,"var",new Ta(ma,n))},[Rl]:Gl(Fl(1,1/0),Ml),[Cl]:Gl(function(t,e,i){i.featureId=!0},Pl),[Oa]:Gl(Fl(2,1/0),kl(ma)),[Da]:Gl(function(t,e,i){i.geometryType=!0},Pl),[Ga]:Gl(function(t,e,i){i.mCoordinate=!0},Pl),[Xa]:Gl(Tl,Pl),[Ka]:Gl(Tl,Pl),[Wa]:Gl(Tl,Pl),[za]:Gl(Fl(2,1/0),kl(_a)),[Na]:Gl(Fl(2,1/0),kl(_a)),[ja]:Gl(Fl(1,1),kl(_a)),[Ya]:Gl(Fl(2,2),Al()),[Za]:Gl(Fl(2,2),Al()),[Ba]:Gl(Fl(2,2),kl(pa)),[Va]:Gl(Fl(2,2),kl(pa)),[Ua]:Gl(Fl(2,2),kl(pa)),[qa]:Gl(Fl(2,2),kl(pa)),[$a]:Gl(Fl(2,1/0),Ll),[_l]:Gl(Fl(2,1/0),Ll),[Ha]:Gl(Fl(2,2),kl(pa)),[Ja]:Gl(Fl(2,1/0),kl(pa)),[Qa]:Gl(Fl(2,2),kl(pa)),[tl]:Gl(Fl(3,3),kl(pa)),[el]:Gl(Fl(2,2),kl(pa)),[il]:Gl(Fl(2,2),kl(pa)),[nl]:Gl(Fl(1,1),kl(pa)),[sl]:Gl(Fl(1,1),kl(pa)),[rl]:Gl(Fl(1,1),kl(pa)),[ol]:Gl(Fl(1,1),kl(pa)),[al]:Gl(Fl(1,1),kl(pa)),[ll]:Gl(Fl(1,1),kl(pa)),[hl]:Gl(Fl(1,2),kl(pa)),[cl]:Gl(Fl(1,1),kl(pa)),[ul]:Gl(Fl(4,1/0),Ol,function(t,e,i){const n=t.length-1,s=La(t[t.length-1],e,i);let r=ma|pa|_a;const o=new Array(n-2);for(let e=0;e<n-2;e+=2){try{r&=La(t[e+2],r,i).type}catch(t){const i=Ma(t);throw new Error(`failed to parse argument ${e+1} of match expression: ${i}`)}if(0===r)throw new Error("no common type was found among the arguments of match expression")}for(let e=0;e<n-2;e+=2){try{const n=La(t[e+2],r,i);o[e]=n}catch(t){const i=Ma(t);throw new Error(`failed to parse argument ${e+1} of match expression: ${i}`)}try{const n=La(t[e+3],s.type,i);o[e+1]=n}catch(t){throw new Error(`failed to parse argument ${e+2} of match expression: ${Ma(t)}`)}}return[La(t[1],r,i),...o,s]}),[dl]:Gl(Fl(3,3),kl(pa)),[gl]:Gl(Fl(6,1/0),Ol,Dl),[fl]:Gl(Fl(6,1/0),Ol,function(t,e,i){if(!ba(e,ya))throw new Error(`the ${t[0]} operator can only return a color, got ${Ea(e)}`)},Dl),[pl]:Gl(Fl(3,1/0),function(t,e,i){const n=t[0],s=t.length-1;if(s%2==0)throw new Error(`expected an odd number of arguments for ${n}, got ${s} instead`)},function(t,e,i){const n=La(t[t.length-1],e,i),s=new Array(t.length-1);for(let e=0;e<s.length-1;e+=2){try{const n=La(t[e+1],_a,i);s[e]=n}catch(t){throw new Error(`failed to parse argument ${e} of case expression: ${Ma(t)}`)}try{const r=La(t[e+2],n.type,i);s[e+1]=r}catch(t){throw new Error(`failed to parse argument ${e+1} of case expression: ${Ma(t)}`)}}return s[s.length-1]=n,s}),[ml]:Gl(Fl(2,2),function(t,e,i){let n,s=t[2];if(!Array.isArray(s))throw new Error('the second argument for the "in" operator must be an array');if("literal"===s[0]){if(s=s[1],!Array.isArray(s))throw new Error('failed to parse "in" expression: the literal operator must be followed by an array')}else if("string"==typeof s[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 s[0]?ma:pa;const r=new Array(s.length);for(let t=0;t<r.length;t++)try{const e=La(s[t],n,i);r[t]=e}catch(e){throw new Error(`failed to parse haystack item ${t} for "in" expression: ${Ma(e)}`)}return[La(t[1],n,i),...r]}),[yl]:Gl(Fl(1,1/0),kl(wa)),[xl]:Gl(Fl(1,1/0),kl(wa)),[vl]:Gl(Fl(1,1/0),kl(pa)),[wl]:Gl(Fl(1,4),kl(pa)),[Sl]:Gl(Fl(1,3),kl(pa)),[El]:Gl(Fl(2,2),function(t,e,i){let n;try{n=La(t[1],pa,i)}catch(t){throw new Error(`failed to parse first argument in palette expression: ${Ma(t)}`)}const s=t[2];if(!Array.isArray(s))throw new Error("the second argument of palette must be an array");const r=new Array(s.length);for(let t=0;t<r.length;t++){let e;try{e=La(s[t],ya,i)}catch(e){throw new Error(`failed to parse color at index ${t} in palette expression: ${Ma(e)}`)}if(!(e instanceof Ta))throw new Error(`the palette color at index ${t} must be a literal value`);r[t]=e}return[n,...r]}),[bl]:Gl(Fl(1,1),kl(_a|pa|ma|ya))};function Ml(t,e,i){const n=t.length-1,s=new Array(n);for(let r=0;r<n;++r){const n=t[r+1];switch(typeof n){case"number":s[r]=new Ta(pa,n);break;case"string":s[r]=new Ta(ma,n);break;default:throw new Error(`expected a string key or numeric array index for a get operation, got ${n}`)}0===r&&i.properties.set(String(n),e)}return s}function Tl(t,e,i){i.mapState=!0}function Pl(t,e,i){const n=t[0];if(1!==t.length)throw new Error(`expected no arguments for ${n} operation`);return[]}function Fl(t,e){return function(i,n,s){const r=i[0],o=i.length-1;if(t===e){if(o!==t){throw new Error(`expected ${t} argument${1===t?"":"s"} for ${r}, got ${o}`)}}else if(o<t||o>e){throw new Error(`expected ${e===1/0?`${t} or more`:`${t} to ${e}`} arguments for ${r}, got ${o}`)}}}function Ll(t,e,i){const n=t.length-1,s=new Array(n);for(let r=0;r<n;++r){const n=La(t[r+1],e,i);s[r]=n}return s}function kl(t){return function(e,i,n){const s=e.length-1,r=new Array(s);for(let i=0;i<s;++i){const s=La(e[i+1],t,n);r[i]=s}return r}}function Al(){return function(t,e,i){const n=t[0],s=t.length-1,r=new Array(s);let o=wa;for(let e=0;e<s;++e){o&=La(t[e+1],o,i).type}if(0===o)throw new Error(`no common type was found among the arguments of ${n}`);for(let e=0;e<s;++e){const n=La(t[e+1],o,i);r[e]=n}return r}}function Ol(t,e,i){const n=t[0],s=t.length-1;if(s%2==1)throw new Error(`expected an even number of arguments for operation ${n}, got ${s} instead`)}function Dl(t,e,i){const n=t[1];let s;switch(n[0]){case"linear":s=1;break;case"exponential":const t=n[1];if("number"!=typeof t||t<=0)throw new Error(`expected a number base for exponential interpolation, got ${JSON.stringify(t)} instead`);s=t;break;default:throw new Error(`invalid interpolation type: ${JSON.stringify(n)}`)}const r=new Ta(pa,s);let o;try{o=La(t[2],pa,i)}catch(t){throw new Error(`failed to parse argument 1 in interpolate expression: ${Ma(t)}`)}const a=new Array(t.length-3);for(let n=0;n<a.length;n+=2){try{const e=La(t[n+3],pa,i);a[n]=e}catch(t){throw new Error(`failed to parse argument ${n+2} for interpolate expression: ${Ma(t)}`)}try{const s=La(t[n+4],e,i);a[n+1]=s}catch(t){throw new Error(`failed to parse argument ${n+3} for interpolate expression: ${Ma(t)}`)}}return[r,o,...a]}function Gl(...t){return function(e,i,n){const s=e[0];let r=[];for(let s=0;s<t.length;s++){const o=t[s](e,i,n);if(s==t.length-1){if(!o)throw new Error("expected last argument validator to return the parsed args");r=o}}return new Pa(i,s,...r)}}function zl(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 zl(t.getGeometries()[0]);default:return""}}function Nl(t,e,i){return jl(La(t,e,i))}function jl(t,e){if(t instanceof Ta){if(t.type===ya&&"string"==typeof t.value){const e=us(t.value);return function(){return e}}return function(){return t.value}}const i=t.operator;switch(i){case yl:case xl:case _l:return function(t){const e=t.operator,i=t.args.length,n=new Array(i);for(let e=0;e<i;++e)n[e]=jl(t.args[e]);switch(e){case _l:return t=>{for(let e=0;e<i;++e){const i=n[e](t);if(null!=i)return i}throw new Error("Expected one of the values to be non-null")};case yl:case xl:return t=>{for(let s=0;s<i;++s){const i=n[s](t);if(typeof i===e)return i}throw new Error(`Expected one of the values to be a ${e}`)};default:throw new Error(`Unsupported assertion operator ${e}`)}}(t);case ka:case Aa:case Rl:return function(t){const e=t.args[0],i=e.value;switch(t.operator){case ka:return e=>{const n=t.args;let s=e.properties[i];for(let t=1,e=n.length;t<e;++t){s=s[n[t].value]}return s};case Aa:return t=>t.variables[i];case Rl:return e=>{const n=t.args;if(!(i in e.properties))return!1;let s=e.properties[i];for(let t=1,e=n.length;t<e;++t){const e=n[t].value;if(!s||!Object.hasOwn(s,e))return!1;s=s[e]}return!0};default:throw new Error(`Unsupported accessor operator ${t.operator}`)}}(t);case Cl:return t=>t.featureId??"";case Da:return t=>t.geometryType;case Oa:{const e=t.args.map(t=>jl(t));return t=>"".concat(...e.map(e=>(e(t)??"").toString()))}case Xa:return t=>t.resolution;case za:case Na:case dl:case ml:case ja:return function(t){const e=t.operator,i=t.args.length,n=new Array(i);for(let e=0;e<i;++e)n[e]=jl(t.args[e]);switch(e){case za:return t=>{for(let e=0;e<i;++e)if(n[e](t))return!0;return!1};case Na:return t=>{for(let e=0;e<i;++e)if(!n[e](t))return!1;return!0};case dl:return t=>{const e=n[0](t),i=n[1](t),s=n[2](t);return e>=i&&e<=s};case ml:return t=>{const e=n[0](t);for(let s=1;s<i;++s)if(e===n[s](t))return!0;return!1};case ja:return t=>!n[0](t);default:throw new Error(`Unsupported logical operator ${e}`)}}(t);case Ya:case Za:case Ua:case qa:case Ba:case Va:return function(t){const e=t.operator,i=jl(t.args[0]),n=jl(t.args[1]);switch(e){case Ya:return t=>i(t)===n(t);case Za:return t=>i(t)!==n(t);case Ua:return t=>i(t)<n(t);case qa:return t=>i(t)<=n(t);case Ba:return t=>i(t)>n(t);case Va:return t=>i(t)>=n(t);default:throw new Error(`Unsupported comparison operator ${e}`)}}(t);case $a:case Ha:case Ja:case Qa:case tl:case el:case il:case nl:case sl:case rl:case ol:case al:case ll:case hl:case cl:return function(t){const e=t.operator,i=t.args.length,n=new Array(i);for(let e=0;e<i;++e)n[e]=jl(t.args[e]);switch(e){case $a:return t=>{let e=1;for(let s=0;s<i;++s)e*=n[s](t);return e};case Ha:return t=>n[0](t)/n[1](t);case Ja:return t=>{let e=0;for(let s=0;s<i;++s)e+=n[s](t);return e};case Qa:return t=>n[0](t)-n[1](t);case tl:return t=>{const e=n[0](t),i=n[1](t);if(e<i)return i;const s=n[2](t);return e>s?s:e};case el:return t=>n[0](t)%n[1](t);case il:return t=>Math.pow(n[0](t),n[1](t));case nl:return t=>Math.abs(n[0](t));case sl:return t=>Math.floor(n[0](t));case rl:return t=>Math.ceil(n[0](t));case ol:return t=>Math.round(n[0](t));case al:return t=>Math.sin(n[0](t));case ll:return t=>Math.cos(n[0](t));case hl:return 2===i?t=>Math.atan2(n[0](t),n[1](t)):t=>Math.atan(n[0](t));case cl:return t=>Math.sqrt(n[0](t));default:throw new Error(`Unsupported numeric operator ${e}`)}}(t);case pl:return function(t){const e=t.args.length,i=new Array(e);for(let n=0;n<e;++n)i[n]=jl(t.args[n]);return t=>{for(let n=0;n<e-1;n+=2){if(i[n](t))return i[n+1](t)}return i[e-1](t)}}(t);case ul:return function(t){const e=t.args.length,i=new Array(e);for(let n=0;n<e;++n)i[n]=jl(t.args[n]);return t=>{const n=i[0](t);for(let s=1;s<e-1;s+=2)if(n===i[s](t))return i[s+1](t);return i[e-1](t)}}(t);case gl:case fl:return function(t){const e=t.args.length,i=new Array(e);for(let n=0;n<e;++n)i[n]=jl(t.args[n]);const n=t.operator===fl?Wl:Kl;return t=>{const s=i[0](t),r=i[1](t);let o,a;for(let l=2;l<e;l+=2){const e=i[l](t);let h=i[l+1](t);const c=Array.isArray(h);if(c&&(h=rs(h)),e>=r)return 2===l?h:c?n(s,r,o,a,e,h):Xl(s,r,o,a,e,h);o=e,a=h}return a}}(t);case bl:return function(t){const e=t.operator,i=t.args.length,n=new Array(i);for(let e=0;e<i;++e)n[e]=jl(t.args[e]);if(e===bl)return e=>{const i=n[0](e);return t.args[0].type===ya?gs(i):i.toString()};throw new Error(`Unsupported convert operator ${e}`)}(t);case vl:return function(t){const e=t.args.length,i=new Array(e);for(let n=0;n<e;++n)i[n]=jl(t.args[n]);if(t.type===ya&&(3===e||4===e)){const t=4===e?i[3]:null;return e=>[255*i[0](e),255*i[1](e),255*i[2](e),t?t(e):1]}return t=>{const n=new Array(e);for(let s=0;s<e;++s)n[s]=i[s](t);return n}}(t);case wl:return function(t){const e=t.args.length,i=new Array(e);for(let n=0;n<e;++n)i[n]=jl(t.args[n]);if(e<3){const t=2===e?i[1]:null;return e=>{const n=i[0](e);return[n,n,n,t?t(e):1]}}const n=4===e?i[3]:null;return t=>[i[0](t),i[1](t),i[2](t),n?n(t):1]}(t);default:throw new Error(`Unsupported operator ${i}`)}}function Xl(t,e,i,n,s,r){const o=s-i;if(0===o)return n;const a=e-i;return n+(1===t?a/o:(Math.pow(t,a)-1)/(Math.pow(t,o)-1))*(r-n)}function Kl(t,e,i,n,s,r){return 0===s-i?n:[Xl(t,e,i,n[0],s,r[0]),Xl(t,e,i,n[1],s,r[1]),Xl(t,e,i,n[2],s,r[2]),Xl(t,e,i,n[3],s,r[3])]}function Wl(t,e,i,n,s,r){if(0===s-i)return n;const o=cs(n),a=cs(r);let l=a[2]-o[2];l>180?l-=360:l<-180&&(l+=360);return function(t){const e=(t[0]+16)/116,i=t[1],n=t[2]*Math.PI/180,s=as(e),r=as(e+i/500*Math.cos(n)),o=as(e-i/200*Math.sin(n)),a=os(3.021973625*r-1.617392459*s-.404875592*o),l=os(-.943766287*r+1.916279586*s+.027607165*o),h=os(.069407491*r-.22898585*s+1.159737864*o);return[At(a+.5|0,0,255),At(l+.5|0,0,255),At(h+.5|0,0,255),t[3]]}([Xl(t,e,i,o[0],s,a[0]),Xl(t,e,i,o[1],s,a[1]),o[2]+Xl(t,e,i,0,s,l),Xl(t,e,i,n[3],s,r[3])])}function Yl(t){return!0}function Zl(t,e){const i=function(t,e){const i=t.length,n=new Array(i);for(let s=0;s<i;++s){const i=t[s],r="filter"in i&&void 0!==i.filter?Nl(i.filter,_a,e):Yl;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]=Vl(i.style[n],e)}else o=[Vl(i.style,e)];n[s]={filter:r,styles:o}}return function(e){const s=[];let r=!1;for(let o=0;o<i;++o){if((0,n[o].filter)(e)&&(!t[o].else||!r)){r=!0;for(const t of n[o].styles){const i=t(e);i&&s.push(i)}}}return s}}(t,e=e??Fa()),n={variables:{},properties:{},resolution:NaN,featureId:null,geometryType:""};return function(t,s){if(n.properties=t.getPropertiesInternal()??{},n.resolution=s,e.featureId){const e=t.getId();n.featureId=void 0!==e?e:null}if(e.geometryType){const e=t.getGeometry();e&&(n.geometryType=zl(e))}return i(n)}}function Bl(t,e){e=e??Fa();const i=t.length,n=new Array(i);for(let s=0;s<i;++s)n[s]=Vl(t[s],e);const s={variables:{},properties:{},resolution:NaN,featureId:null,geometryType:""},r=new Array(i);return function(t,o){if(s.properties=t.getPropertiesInternal()??{},s.resolution=o,e.featureId){const e=t.getId();s.featureId=void 0!==e?e:null}if(e.geometryType){const e=t.getGeometry();e&&(s.geometryType=zl(e))}let a=0;for(let t=0;t<i;++t){const e=n[t](s);e&&(r[a]=e,a+=1)}return r.length=a,r}}function Vl(t,e){const i=Ul(t,"",e),n=ql(t,"",e),s=function(t,e){const i="text-",n=Jl(t,i+"value",e);if(!n)return null;const s=Ul(t,i,e),r=Ul(t,i+"background-",e),o=ql(t,i,e),a=ql(t,i+"background-",e),l=Jl(t,i+"font",e),h=Hl(t,i+"max-angle",e),c=Hl(t,i+"offset-x",e),u=Hl(t,i+"offset-y",e),d=Ql(t,i+"overflow",e),g=Jl(t,i+"placement",e),f=Hl(t,i+"repeat",e),_=sh(t,i+"scale",e),p=Ql(t,i+"rotate-with-view",e),m=Hl(t,i+"rotation",e),y=Jl(t,i+"align",e),x=Jl(t,i+"justify",e),v=Jl(t,i+"baseline",e),w=Ql(t,i+"keep-upright",e),C=eh(t,i+"padding",e),S=lh(t,i+"declutter-mode"),E=new ao({declutterMode:S});return function(t){if(E.setText(n(t)),s&&E.setFill(s(t)),r&&E.setBackgroundFill(r(t)),o&&E.setStroke(o(t)),a&&E.setBackgroundStroke(a(t)),l&&E.setFont(l(t)),h&&E.setMaxAngle(h(t)),c&&E.setOffsetX(c(t)),u&&E.setOffsetY(u(t)),d&&E.setOverflow(d(t)),g){const e=g(t);if("point"!==e&&"line"!==e)throw new Error("Expected point or line for text-placement");E.setPlacement(e)}if(f&&E.setRepeat(f(t)),_&&E.setScale(_(t)),p&&E.setRotateWithView(p(t)),m&&E.setRotation(m(t)),y){const e=y(t);if("left"!==e&&"center"!==e&&"right"!==e&&"end"!==e&&"start"!==e)throw new Error("Expected left, right, center, start, or end for text-align");E.setTextAlign(e)}if(x){const e=x(t);if("left"!==e&&"right"!==e&&"center"!==e)throw new Error("Expected left, right, or center for text-justify");E.setJustify(e)}if(v){const e=v(t);if("bottom"!==e&&"top"!==e&&"middle"!==e&&"alphabetic"!==e&&"hanging"!==e)throw new Error("Expected bottom, top, middle, alphabetic, or hanging for text-baseline");E.setTextBaseline(e)}return C&&E.setPadding(C(t)),w&&E.setKeepUpright(w(t)),E}}(t,e),o=function(t,e){if("icon-src"in t)return function(t,e){const i="icon-",n=i+"src",s=ch($l(t,n),n),r=ih(t,i+"anchor",e),o=sh(t,i+"scale",e),a=Hl(t,i+"opacity",e),l=ih(t,i+"displacement",e),h=Hl(t,i+"rotation",e),c=Ql(t,i+"rotate-with-view",e),u=oh(t,i+"anchor-origin"),d=ah(t,i+"anchor-x-units"),g=ah(t,i+"anchor-y-units"),f=$l(t,i+"color");let _,p=null;if(void 0!==f){Array.isArray(f)&&f.length>0&&"string"==typeof f[0]?p=th(t,i+"color",e):_=dh(f,i+"color")}const m=function(t,e){const i=$l(t,e);if(void 0===i)return;if("string"!=typeof i)throw new Error(`Expected a string for ${e}`);return i}(t,i+"cross-origin"),y=function(t,e){const i=$l(t,e);if(void 0===i)return;return hh(i,e)}(t,i+"offset"),x=oh(t,i+"offset-origin"),v=rh(t,i+"width"),w=rh(t,i+"height"),C=function(t,e){const i=$l(t,e);if(void 0===i)return;if("number"==typeof i)return Qr(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=lh(t,i+"declutter-mode"),E={src:s,anchorOrigin:u,anchorXUnits:d,anchorYUnits:g,crossOrigin:m,offset:y,offsetOrigin:x,height:w,width:v,size:C,declutterMode:S};let b=null;return function(t){if(b)p&&b.setColor(p(t));else{const e=p?p(t):_;b=new oa(void 0!==e?Object.assign({},E,{color:e}):Object.assign({},E))}return a&&b.setOpacity(a(t)),l&&b.setDisplacement(l(t)),h&&b.setRotation(h(t)),c&&b.setRotateWithView(c(t)),o&&b.setScale(o(t)),r&&b.setAnchor(r(t)),b}}(t,e);if("shape-points"in t)return function(t,e){const i="shape-",n=i+"points",s=i+"radius",r=uh($l(t,n),n);if(!(s in t))throw new Error(`Expected a number for ${s}`);const o=Hl(t,s,e),a=$l(t,s),l="number"==typeof a?a:5,h=i+"radius2",c=Hl(t,h,e),u=$l(t,h),d="number"==typeof u?u:void 0,g=Ul(t,i,e),f=ql(t,i,e),_=sh(t,i+"scale",e),p=ih(t,i+"displacement",e),m=Hl(t,i+"rotation",e),y=Ql(t,i+"rotate-with-view",e),x=rh(t,i+"angle"),v=lh(t,i+"declutter-mode"),w=new eo({points:r,radius:l,radius2:d,angle:x,declutterMode:v});return function(t){return o&&w.setRadius(o(t)),c&&w.setRadius2(c(t)),g&&w.setFill(g(t)),f&&w.setStroke(f(t)),p&&w.setDisplacement(p(t)),m&&w.setRotation(m(t)),y&&w.setRotateWithView(y(t)),_&&w.setScale(_(t)),w}}(t,e);if("circle-radius"in t)return function(t,e){const i="circle-",n=Ul(t,i,e),s=ql(t,i,e),r=Hl(t,i+"radius",e),o=sh(t,i+"scale",e),a=ih(t,i+"displacement",e),l=Hl(t,i+"rotation",e),h=Ql(t,i+"rotate-with-view",e),c=lh(t,i+"declutter-mode"),u=new io({radius:5,declutterMode:c});return function(t){return r&&u.setRadius(r(t)),n&&u.setFill(n(t)),s&&u.setStroke(s(t)),a&&u.setDisplacement(a(t)),l&&u.setRotation(l(t)),h&&u.setRotateWithView(h(t)),o&&u.setScale(o(t)),u}}(t,e);return null}(t,e),a=Hl(t,"z-index",e);if(!(i||n||s||o||r(t)))throw new Error("No fill, stroke, point, or text symbolizer properties in style: "+JSON.stringify(t));const l=new no;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(s){const i=s(t);i&&(e=!1),l.setText(i)}if(o){const i=o(t);i&&(e=!1),l.setImage(i)}return a&&l.setZIndex(a(t)),e?null:l}}function Ul(t,e,i){let n;if(e+"fill-pattern-src"in t)n=function(t,e,i){const n=Jl(t,e+"pattern-src",i),s=nh(t,e+"pattern-offset",i),r=nh(t,e+"pattern-size",i),o=th(t,e+"color",i);return function(t){return n?{src:n(t),offset:s?s(t):null,size:r?r(t):null,color:o?o(t):null}:null}}(t,e+"fill-",i);else{if("none"===$l(t,e+"fill-color"))return t=>null;n=th(t,e+"fill-color",i)}if(!n)return null;const s=new $r;return function(t){const e=n(t);return e===Un?null:(s.setColor(e),s)}}function ql(t,e,i){const n=Hl(t,e+"stroke-width",i),s=th(t,e+"stroke-color",i);if(!n&&!s)return null;const r=Jl(t,e+"stroke-line-cap",i),o=Jl(t,e+"stroke-line-join",i),a=eh(t,e+"stroke-line-dash",i),l=Hl(t,e+"stroke-line-dash-offset",i),h=Hl(t,e+"stroke-miter-limit",i),c=Hl(t,e+"stroke-offset",i),u=new Hr;return function(t){if(s){const e=s(t);if(e===Un)return null;u.setColor(e)}if(n&&u.setWidth(n(t)),r){const e=r(t);if("butt"!==e&&"round"!==e&&"square"!==e)throw new Error("Expected butt, round, or square line cap");u.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");u.setLineJoin(e)}return a&&u.setLineDash(a(t)),l&&u.setLineDashOffset(l(t)),h&&u.setMiterLimit(h(t)),c&&u.setOffset(c(t)),u}}function $l(t,e){if(!(e in t))return;const i=t[e];return void 0===i?void 0:i}function Hl(t,e,i){const n=$l(t,e);if(void 0===n)return;const s=Nl(n,pa,i);return function(t){return uh(s(t),e)}}function Jl(t,e,i){const n=$l(t,e);if(void 0===n)return null;const s=Nl(n,ma,i);return function(t){return ch(s(t),e)}}function Ql(t,e,i){const n=$l(t,e);if(void 0===n)return null;const s=Nl(n,_a,i);return function(t){const i=s(t);if("boolean"!=typeof i)throw new Error(`Expected a boolean for ${e}`);return i}}function th(t,e,i){const n=$l(t,e);if(void 0===n)return null;const s=Nl(n,ya,i);return function(t){return dh(s(t),e)}}function eh(t,e,i){const n=$l(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 s=Nl(t,pa,i);return function(t){return uh(s(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 s=Nl(n,xa,i);return function(t){return hh(s(t),e)}}function ih(t,e,i){const n=$l(t,e);if(void 0===n)return null;const s=Nl(n,xa,i);return function(t){const i=hh(s(t),e);if(2!==i.length)throw new Error(`Expected two numbers for ${e}`);return i}}function nh(t,e,i){const n=$l(t,e);if(void 0===n)return null;const s=Nl(n,xa,i);return function(t){return gh(s(t),e)}}function sh(t,e,i){const n=$l(t,e);if(void 0===n)return null;const s=Nl(n,xa|pa,i);return function(t){return function(t,e){if("number"==typeof t)return t;return gh(t,e)}(s(t),e)}}function rh(t,e){const i=$l(t,e);if(void 0!==i){if("number"!=typeof i)throw new Error(`Expected a number for ${e}`);return i}}function oh(t,e){const i=$l(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 ah(t,e){const i=$l(t,e);if(void 0!==i){if("pixels"!==i&&"fraction"!==i)throw new Error(`Expected pixels or fraction for ${e}`);return i}}function lh(t,e){const i=$l(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 hh(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 ch(t,e){if("string"!=typeof t)throw new Error(`Expected a string for ${e}`);return t}function uh(t,e){if("number"!=typeof t)throw new Error(`Expected a number for ${e}`);return t}function dh(t,e){if("string"==typeof t)return t;const i=hh(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 gh(t,e){const i=hh(t,e);if(2!==i.length)throw new Error(`Expected an array of two numbers for ${e}`);return i}var fh={CENTER:"center",RESOLUTION:"resolution",ROTATION:"rotation"};function _h(t,e,i){return function(n,s,r,o,a){if(!n)return;if(!s&&!e)return n;const l=e?0:r[0]*(s??0),h=e?0:r[1]*(s??0),c=a?a[0]:0,u=a?a[1]:0;let d=t[0]+l/2+c,g=t[2]-l/2+c,f=t[1]+h/2+u,_=t[3]-h/2+u;d>g&&(d=(g+d)/2,g=d),f>_&&(f=(_+f)/2,_=f);let p=At(n[0],d,g),m=At(n[1],f,_);if(o&&i&&s){const t=30*s;p+=-t*Math.log(1+Math.max(0,d-n[0])/t)+t*Math.log(1+Math.max(0,n[0]-g)/t),m+=-t*Math.log(1+Math.max(0,f-n[1])/t)+t*Math.log(1+Math.max(0,n[1]-_)/t)}return[p,m]}}function ph(t){return t}function mh(t,e,i,n){const s=Mt(e)/i[0],r=St(e)/i[1];return n?Math.min(t,Math.max(s,r)):Math.min(t,Math.min(s,r))}function yh(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),At(n,i/2,2*e)}function xh(t,e,i,n,s){return i=void 0===i||i,function(r,o,a,l){if(void 0!==r){const o=n?mh(t,n,a,!!s):t;return i&&l?yh(r,o,e):At(r,e,o)}}}function vh(t){if(void 0!==t)return 0}function wh(t){if(void 0!==t)return t}const Ch=256;class Sh 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_=He(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&&Ze(),t.center&&(t.center=ri(t.center,this.projection_)),t.extent&&(t.extent=ai(t.extent,this.projection_)),this.applyOptions_(t)}applyOptions_(t){const e=Object.assign({},t);for(const t in fh)delete e[t];this.setProperties(e,!0);const i=function(t){let e,i,n;const s=28,r=2;let o=void 0!==t.minZoom?t.minZoom:0,a=void 0!==t.maxZoom?t.maxZoom:s;const l=void 0!==t.zoomFactor?t.zoomFactor:r,h=void 0!==t.multiWorld&&t.multiWorld,c=void 0===t.smoothResolutionConstraint||t.smoothResolutionConstraint,u=void 0!==t.showFullExtent&&t.showFullExtent,d=He(t.projection,"EPSG:3857"),g=d.getExtent();let f=t.constrainOnlyCenter,_=t.extent;h||_||!d.isGlobal()||(f=!1,_=g);if(void 0!==t.resolutions){const s=t.resolutions;i=s[o],n=void 0!==s[a]?s[a]:s[s.length-1],e=t.constrainResolution?function(t,e,i,n){return e=void 0===e||e,function(s,r,o,a){if(void 0!==s){const l=t[0],h=t[t.length-1],c=i?mh(l,i,o,!!n):l;if(a)return e?yh(s,c,h):At(s,h,c);const u=Math.min(c,s),d=Math.floor(S(t,u,r));return t[d]>c&&d<t.length-1?t[d+1]:t[d]}}}(s,c,!f&&_,u):xh(i,n,c,!f&&_,u)}else{const h=(g?Math.max(Mt(g),St(g)):360*Jt.degrees/d.getMetersPerUnit())/Ch/Math.pow(r,0),p=h/Math.pow(r,s-0);i=t.maxResolution,void 0!==i?o=0:i=h/Math.pow(l,o),n=t.minResolution,void 0===n&&(n=void 0!==t.maxZoom?void 0!==t.maxResolution?i/Math.pow(l,a):h/Math.pow(l,a):p),a=o+Math.floor(Math.log(i/n)/Math.log(l)),n=i/Math.pow(l,a-o),e=t.constrainResolution?function(t,e,i,n,s,r){return n=void 0===n||n,i=void 0!==i?i:0,function(o,a,l,h){if(void 0!==o){const c=s?mh(e,s,l,!!r):e;if(h)return n?yh(o,c,i):At(o,i,c);const u=1e-9,d=Math.ceil(Math.log(e/c)/Math.log(t)-u),g=-a*(.5-u)+.5,f=Math.min(c,o),_=Math.floor(Math.log(e/f)/Math.log(t)+g),p=Math.max(d,_);return At(e/Math.pow(t,p),i,c)}}}(l,i,n,c,!f&&_,u):xh(i,n,c,!f&&_,u)}return{constraint:e,maxResolution:i,minResolution:n,minZoom:o,zoomFactor:l}}(t);this.maxResolution_=i.maxResolution,this.minResolution_=i.minResolution,this.zoomFactor_=i.zoomFactor,this.resolutions_=t.resolutions,this.padding_=t.padding,this.minZoom_=i.minZoom;const n=function(t){if(void 0!==t.extent){const e=void 0===t.smoothExtentConstraint||t.smoothExtentConstraint;return _h(t.extent,t.constrainOnlyCenter,e)}const e=He(t.projection,"EPSG:3857");if(!0!==t.multiWorld&&e.isGlobal()){const t=e.getExtent().slice();return t[0]=-1/0,t[2]=1/0,_h(t,!1,!1)}return ph}(t),s=i.constraint,r=function(t){const e=void 0===t.enableRotation||t.enableRotation;if(e){const e=t.constrainRotation;return void 0===e||!0===e?function(){const t=zt(5);return function(e,i){return i||void 0===e?e:Math.abs(e)<=t?0:e}}():!1===e?wh:"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):wh}return vh}(t);this.constraints_={center:n,resolution:s,rotation:r},this.setRotation(void 0!==t.rotation?t.rotation:0),this.setCenterInternal(void 0!==t.center?t.center:null),void 0!==t.resolution?this.setResolution(t.resolution):void 0!==t.zoom&&this.setZoom(t.zoom)}get padding(){return this.padding_}set padding(t){let e=this.padding_;this.padding_=t;const i=this.getCenterInternal();if(i){const n=t||[0,0,0,0];e=e||[0,0,0,0];const s=this.getResolution(),r=s/2*(n[3]-e[3]+e[1]-n[1]),o=s/2*(n[0]-e[0]+e[2]-n[2]);this.setCenterInternal([i[0]+r,i[1]-o])}}getUpdatedOptions_(t){const e=this.getProperties();return void 0!==e.resolution?e.resolution=this.getResolution():e.zoom=this.getZoom(),e.center=this.getCenterInternal(),e.rotation=this.getRotation(),Object.assign({},e,t)}animate(t){this.isDef()&&!this.getAnimating()&&this.resolveConstraints(0);const e=new Array(arguments.length);for(let t=0;t<e.length;++t){let i=arguments[t];i.center&&(i=Object.assign({},i),i.center=ri(i.center,this.getProjection())),i.anchor&&(i=Object.assign({},i),i.anchor=ri(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&&Eh(e,!0));let s=Date.now(),r=this.targetCenter_.slice(),o=this.targetResolution_,a=this.targetRotation_;const l=[];for(;n<i;++n){const t=arguments[n],i={start:s,complete:!1,anchor:t.anchor,duration:void 0!==t.duration?t.duration:1e3,easing:t.easing||Tn,callback:e};if(t.center&&(i.sourceCenter=r,i.targetCenter=t.center.slice(),r=i.targetCenter),void 0!==t.zoom?(i.sourceResolution=o,i.targetResolution=this.getResolutionForZoom(t.zoom),o=i.targetResolution):t.resolution&&(i.sourceResolution=o,i.targetResolution=t.resolution,o=i.targetResolution),void 0!==t.rotation){i.sourceRotation=a;const e=Nt(t.rotation-a+Math.PI,2*Math.PI)-Math.PI;i.targetRotation=a+e,a=i.targetRotation}bh(i)?i.complete=!0:s+=i.duration,l.push(i)}this.animations_.push(l),this.setHint(lo,1),this.updateAnimations_()}getAnimating(){return this.hints_[lo]>0}getInteracting(){return this.hints_[ho]>0}cancelAnimations(){let t;this.setHint(lo,-this.hints_[lo]);for(let e=0,i=this.animations_.length;e<i;++e){const i=this.animations_[e];if(i[0].callback&&Eh(i[0].callback,!1),!t)for(let e=0,n=i.length;e<n;++e){const n=i[e];if(!n.complete){t=n.anchor;break}}}this.animations_.length=0,this.cancelAnchor_=t,this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN}updateAnimations_(){if(void 0!==this.updateAnimationKey_&&(cancelAnimationFrame(this.updateAnimationKey_),this.updateAnimationKey_=void 0),!this.getAnimating())return;const t=Date.now();let e=!1;for(let i=this.animations_.length-1;i>=0;--i){const n=this.animations_[i];let s=!0;for(let i=0,r=n.length;i<r;++i){const r=n[i];if(r.complete)continue;const o=t-r.start;let a=r.duration>0?o/r.duration:1;a>=1?(r.complete=!0,a=1):s=!1;const l=r.easing(a);if(r.sourceCenter){const t=r.sourceCenter[0],e=r.sourceCenter[1],i=r.targetCenter[0],n=r.targetCenter[1];this.nextCenter_=r.targetCenter;const s=t+l*(i-t),o=e+l*(n-e);this.targetCenter_=[s,o]}if(r.sourceResolution&&r.targetResolution){const t=1===l?r.targetResolution:r.sourceResolution+l*(r.targetResolution-r.sourceResolution);if(r.anchor){const e=this.getViewportSize_(this.getRotation()),i=this.constraints_.resolution(t,0,e,!0);this.targetCenter_=this.calculateCenterZoom(i,r.anchor)}this.nextResolution_=r.targetResolution,this.targetResolution_=t,this.applyTargetState_(!0)}if(void 0!==r.sourceRotation&&void 0!==r.targetRotation){const t=1===l?Nt(r.targetRotation+Math.PI,2*Math.PI)-Math.PI:r.sourceRotation+l*(r.targetRotation-r.sourceRotation);if(r.anchor){const e=this.constraints_.rotation(t,!0);this.targetCenter_=this.calculateCenterRotate(e,r.anchor)}this.nextRotation_=r.targetRotation,this.targetRotation_=t}if(this.applyTargetState_(!0),e=!0,!r.complete)break}if(s){this.animations_[i]=null,this.setHint(lo,-1),this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN;const t=n[0].callback;t&&Eh(t,!0)}}this.animations_=this.animations_.filter(Boolean),e&&void 0===this.updateAnimationKey_&&(this.updateAnimationKey_=requestAnimationFrame(this.updateAnimations_.bind(this)))}calculateCenterRotate(t,e){let i;const n=this.getCenterInternal();return void 0!==n&&(i=[n[0]-e[0],n[1]-e[1]],qt(i,t-this.getRotation()),Vt(i,e)),i}calculateCenterZoom(t,e){let i;const n=this.getCenterInternal(),s=this.getResolution();if(void 0!==n&&void 0!==s){i=[e[0]-t*(e[0]-n[0])/s,e[1]-t*(e[1]-n[1])/s]}return i}getViewportSize_(t){const e=this.viewportSize_;if(t){const i=e[0],n=e[1];return[Math.abs(i*Math.cos(t))+Math.abs(n*Math.sin(t)),Math.abs(i*Math.sin(t))+Math.abs(n*Math.cos(t))]}return e}setViewportSize(t){this.viewportSize_=Array.isArray(t)?t.slice():[100,100],this.getAnimating()||this.resolveConstraints(0)}getCenter(){const t=this.getCenterInternal();return t?si(t,this.getProjection()):t}getCenterInternal(){return this.get(fh.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 oi(this.calculateExtentInternal(t),this.getProjection())}calculateExtentInternal(t){t=t||this.getViewportSizeMinusPadding_();const e=this.getCenterInternal();W(e,"The view center is not defined");const i=this.getResolution();W(void 0!==i,"The view resolution is not defined");const n=this.getRotation();return W(void 0!==n,"The view rotation is not defined"),wt(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(fh.RESOLUTION)}getResolutions(){return this.resolutions_}getResolutionForExtent(t,e){return this.getResolutionForExtentInternal(ai(t,this.getProjection()),e)}getResolutionForExtentInternal(t,e){e=e||this.getViewportSizeMinusPadding_();const i=Mt(t)/e[0],n=St(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(fh.ROTATION)}getValueForResolutionFunction(t){const e=Math.log(t||2),i=this.getConstrainedResolution(this.maxResolution_),n=this.minResolution_,s=Math.log(i/n)/e;return function(t){return Math.log(i/t)/e/s}}getViewportSizeMinusPadding_(t){let e=this.getViewportSize_(t);const i=this.padding_;return i&&(e=[e[0]-i[1]-i[3],e[1]-i[0]-i[2]]),e}getState(){const t=this.getProjection(),e=this.getResolution(),i=this.getRotation();let n=this.getCenterInternal();const s=this.padding_;if(s){const t=this.getViewportSizeMinusPadding_();n=Rh(n,this.getViewportSize_(),[t[0]/2+s[3],t[1]/2+s[0]],e,i)}return{center:n.slice(0),projection:void 0!==t?t:null,resolution:e,nextCenter:this.nextCenter_,nextResolution:this.nextResolution_,nextRotation:this.nextRotation_,rotation:i,zoom:this.getZoom()}}getViewStateAndExtent(){return{viewState:this.getState(),extent:this.calculateExtent()}}getZoom(){let t;const e=this.getResolution();return void 0!==e&&(t=this.getZoomForResolution(e)),t}getZoomForResolution(t){let e,i,n=this.minZoom_||0;if(this.resolutions_){const s=S(this.resolutions_,t,1);n=s,e=this.resolutions_[s],i=s==this.resolutions_.length-1?2:e/this.resolutions_[s+1]}else e=this.maxResolution_,i=this.zoomFactor_;return n+Math.log(e/t)/Math.log(i)}getResolutionForZoom(t){if(this.resolutions_?.length){if(1===this.resolutions_.length)return this.resolutions_[0];const e=At(Math.floor(t),0,this.resolutions_.length-2),i=this.resolutions_[e]/this.resolutions_[e+1];return this.resolutions_[e]/Math.pow(i,At(t-e,0,1))}return this.maxResolution_/Math.pow(this.zoomFactor_,t-this.minZoom_)}fit(t,e){let i;if(W(Array.isArray(t)||"function"==typeof t.getSimplifiedGeometry,"Invalid extent or geometry provided as `geometry`"),Array.isArray(t)){W(!Pt(t),"Cannot fit empty extent provided as `geometry`");i=hn(ai(t,this.getProjection()))}else if("Circle"===t.getType()){const e=ai(t.getExtent(),this.getProjection());i=hn(e),i.rotate(this.getRotation(),xt(e))}else{const e=null;i=e?t.clone().transform(e,this.getProjection()):t}this.fitInternal(i,e)}rotatedExtentForGeometry(t){const e=this.getRotation(),i=Math.cos(e),n=Math.sin(-e),s=t.getFlatCoordinates(),r=t.getStride();let o=1/0,a=1/0,l=-1/0,h=-1/0;for(let t=0,e=s.length;t<e;t+=r){const e=s[t]*i-s[t+1]*n,r=s[t]*n+s[t+1]*i;o=Math.min(o,e),a=Math.min(a,r),l=Math.max(l,e),h=Math.max(h,r)}return[o,a,l,h]}fitInternal(t,e){let i=(e=e||{}).size;i||(i=this.getViewportSizeMinusPadding_());const n=void 0!==e.padding?e.padding:[0,0,0,0],s=void 0!==e.nearest&&e.nearest;let r;r=void 0!==e.minResolution?e.minResolution:void 0!==e.maxZoom?this.getResolutionForZoom(e.maxZoom):0;const o=this.rotatedExtentForGeometry(t);let a=this.getResolutionForExtentInternal(o,[i[0]-n[1]-n[3],i[1]-n[0]-n[2]]);a=isNaN(a)?r:Math.max(a,r),a=this.getConstrainedResolution(a,s?0:1);const l=this.getRotation(),h=Math.sin(l),c=Math.cos(l),u=xt(o);u[0]+=(n[1]-n[3])/2*a,u[1]+=(n[0]-n[2])/2*a;const d=u[0]*c-u[1]*h,g=u[1]*c+u[0]*h,f=this.getConstrainedCenter([d,g],a),_=e.callback?e.callback:k;void 0!==e.duration?this.animateInternal({resolution:a,center:f,duration:e.duration,easing:e.easing},_):(this.targetResolution_=a,this.targetCenter_=f,this.applyTargetState_(!1,!0),Eh(_,!0))}centerOn(t,e,i){this.centerOnInternal(ri(t,this.getProjection()),e,i)}centerOnInternal(t,e,i){this.setCenterInternal(Rh(t,e,i,this.getResolution(),this.getRotation()))}calculateCenterShift(t,e,i,n){let s;const r=this.padding_;if(r&&t){const o=this.getViewportSizeMinusPadding_(-i),a=Rh(t,n,[o[0]/2+r[3],o[1]/2+r[0]],e,i);s=[t[0]-a[0],t[1]-a[1]]}return s}isDef(){return!!this.getCenterInternal()&&void 0!==this.getResolution()}adjustCenter(t){const e=si(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&&ri(e,this.getProjection()),this.adjustResolutionInternal(t,e)}adjustResolutionInternal(t,e){const i=this.getAnimating()||this.getInteracting(),n=this.getViewportSize_(this.getRotation()),s=this.constraints_.resolution(this.targetResolution_*t,0,n,i);e&&(this.targetCenter_=this.calculateCenterZoom(s,e)),this.targetResolution_=this.targetResolution_*t,this.applyTargetState_()}adjustZoom(t,e){this.adjustResolution(Math.pow(this.zoomFactor_,-t),e)}adjustRotation(t,e){e&&(e=ri(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_=this.targetRotation_+t,this.applyTargetState_()}setCenter(t){this.setCenterInternal(t?ri(t,this.getProjection()):t)}setCenterInternal(t){this.targetCenter_=t,this.applyTargetState_()}setHint(t,e){return this.hints_[t]+=e,this.changed(),this.hints_[t]}setResolution(t){this.targetResolution_=t,this.applyTargetState_()}setRotation(t){this.targetRotation_=t,this.applyTargetState_()}setZoom(t){this.setResolution(this.getResolutionForZoom(t))}applyTargetState_(t,e){const i=this.getAnimating()||this.getInteracting()||e,n=this.constraints_.rotation(this.targetRotation_,i),s=this.getViewportSize_(n),r=this.constraints_.resolution(this.targetResolution_,0,s,i),o=this.constraints_.center(this.targetCenter_,r,s,i,this.calculateCenterShift(this.targetCenter_,r,n,s));this.get(fh.ROTATION)!==n&&this.set(fh.ROTATION,n),this.get(fh.RESOLUTION)!==r&&(this.set(fh.RESOLUTION,r),this.set("zoom",this.getZoom(),!0)),o&&this.get(fh.CENTER)&&Ut(this.get(fh.CENTER),o)||this.set(fh.CENTER,o),this.getAnimating()&&!t&&this.cancelAnimations(),this.cancelAnchor_=void 0}resolveConstraints(t,e,i){t=void 0!==t?t:200;const n=e||0,s=this.constraints_.rotation(this.targetRotation_),r=this.getViewportSize_(s),o=this.constraints_.resolution(this.targetResolution_,n,r),a=this.constraints_.center(this.targetCenter_,o,r,!1,this.calculateCenterShift(this.targetCenter_,o,s,r));if(0===t&&!this.cancelAnchor_)return this.targetResolution_=o,this.targetRotation_=s,this.targetCenter_=a,void this.applyTargetState_();i=i||(0===t?this.cancelAnchor_:void 0),this.cancelAnchor_=void 0,this.getResolution()===o&&this.getRotation()===s&&this.getCenterInternal()&&Ut(this.getCenterInternal(),a)||(this.getAnimating()&&this.cancelAnimations(),this.animateInternal({rotation:s,center:a,resolution:o,duration:t,easing:Mn,anchor:i}))}beginInteraction(){this.resolveConstraints(0),this.setHint(ho,1)}endInteraction(t,e,i){i=i&&ri(i,this.getProjection()),this.endInteractionInternal(t,e,i)}endInteractionInternal(t,e,i){this.getInteracting()&&(this.setHint(ho,-1),this.resolveConstraints(t,e,i))}getConstrainedCenter(t,e){const i=this.getViewportSize_(this.getRotation());return this.constraints_.center(t,e||this.getResolution(),i)}getConstrainedZoom(t,e){const i=this.getResolutionForZoom(t);return this.getZoomForResolution(this.getConstrainedResolution(i,e))}getConstrainedResolution(t,e){e=e||0;const i=this.getViewportSize_(this.getRotation());return this.constraints_.resolution(t,e,i)}}function Eh(t,e){setTimeout(function(){t(e)},0)}function bh(t){return!(t.sourceCenter&&t.targetCenter&&!Ut(t.sourceCenter,t.targetCenter))&&(t.sourceResolution===t.targetResolution&&t.sourceRotation===t.targetRotation)}function Rh(t,e,i,n,s){const r=Math.cos(-s);let o=Math.sin(-s),a=t[0]*r-t[1]*o,l=t[1]*r+t[0]*o;a+=(e[0]/2-i[0])*n,l+=(i[1]-e[1]/2)*n,o=-o;return[a*r-l*o,l*r+a*o]}var Ih="opacity",Mh="visible",Th="extent",Ph="zIndex",Fh="maxResolution",Lh="minResolution",kh="maxZoom",Ah="minZoom",Oh="source",Dh="map";class Gh 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[Ih]=void 0!==t.opacity?t.opacity:1,W("number"==typeof e[Ih],"Layer opacity must be a number"),e[Mh]=void 0===t.visible||t.visible,e[Ph]=t.zIndex,e[Fh]=void 0!==t.maxResolution?t.maxResolution:1/0,e[Lh]=void 0!==t.minResolution?t.minResolution:0,e[Ah]=void 0!==t.minZoom?t.minZoom:-1/0,e[kh]=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=At(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 I()}getLayerStatesArray(t){return I()}getExtent(){return this.get(Th)}getMaxResolution(){return this.get(Fh)}getMinResolution(){return this.get(Lh)}getMinZoom(){return this.get(Ah)}getMaxZoom(){return this.get(kh)}getOpacity(){return this.get(Ih)}getSourceState(){return I()}getVisible(){return this.get(Mh)}getZIndex(){return this.get(Ph)}setBackground(t){this.background_=t,this.changed()}setExtent(t){this.set(Th,t)}setMaxResolution(t){this.set(Fh,t)}setMinResolution(t){this.set(Lh,t)}setMaxZoom(t){this.set(kh,t)}setMinZoom(t){this.set(Ah,t)}setOpacity(t){W("number"==typeof t,"Layer opacity must be a number"),this.set(Ih,t)}setVisible(t){this.set(Mh,t)}setZIndex(t){this.set(Ph,t)}disposeInternal(){this.state_&&(this.state_.layer=null,this.state_=null),super.disposeInternal()}}class zh extends Gh{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(Oh,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(Oh)||null}getRenderSource(){return this.getSource()}getSourceState(){const t=this.getSource();return t?t.getState():"undefined"}handleSourceChange_(){this.changed();const t=this.getSource();t&&!this.sourceReady_&&"ready"===t.getState()&&(this.sourceReady_=!0,this.dispatchEvent("sourceready"))}handleSourcePropertyChange_(){this.sourceChangeKey_&&(l(this.sourceChangeKey_),this.sourceChangeKey_=null),this.sourceReady_=!1;const t=this.getSource();t&&(this.sourceChangeKey_=o(t,h,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();!t&&i&&(t=i.getView()),e=t instanceof Sh?{viewState:t.getState(),extent:t.calculateExtent()}:t;const n=e;let s;if(!n.layerStatesArray&&i&&(n.layerStatesArray=i.getLayerGroup().getLayerStatesArray()),n.layerStatesArray){if(s=n.layerStatesArray.find(t=>t.layer===this),!s)return!1}else s=this.getLayerState();const r=this.getExtent();return Nh(s,n.viewState)&&(!r||Tt(r,n.extent))}getAttributions(t){if(!this.isVisible(t))return[];const e=this.getSource()?.getAttributions();if(!e)return[];let i=e(t instanceof Sh?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(Dh,t)}getMapInternal(){return this.get(Dh)}setMap(t){this.mapPrecomposeKey_&&(l(this.mapPrecomposeKey_),this.mapPrecomposeKey_=null),t||this.changed(),this.mapRenderKey_&&(l(this.mapRenderKey_),this.mapRenderKey_=null),t&&(this.mapPrecomposeKey_=o(t,hr,this.handlePrecompose_,this),this.mapRenderKey_=o(this,h,t.render,t),this.changed())}handlePrecompose_(t){const e=t.frameState?.layerStatesArray;if(!e)return;const i=this.getLayerState(!1);W(!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(Oh,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 Nh(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 jh="renderOrder";class Xh extends zh{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(jh)}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}getUpdateWhileAnimating(){return this.updateWhileAnimating_}getUpdateWhileInteracting(){return this.updateWhileInteracting_}renderDeclutter(t,e){const i=this.getDeclutter();if(!i)return;t.declutter||(t.declutter={}),i in t.declutter==!1&&(t.declutter[i]=new Sr(9));const n=this.getRenderer();n&&n.renderDeclutter(t,e)}setRenderOrder(t){this.set(jh,t)}setStyle(t){this.style_=void 0===t?ro:t??null;const e=function(t){if(void 0===t)return ro;if(!t)return null;if("function"==typeof t)return t;if(t instanceof no)return t;if(Array.isArray(t)&&0===t.length)return[];if(Array.isArray(t)&&t[0]instanceof no){const e=t.length,i=new Array(e);for(let n=0;n<e;++n){const e=t[n];if(!(e instanceof no))throw new Error("Expected a list of style instances");i[n]=e}return i}const e=t;return function(t,e){if(e=e??Fa(),!Array.isArray(t))return Bl([t],e);const i=t.length;if("style"in t[0]){const n=new Array(i);for(let e=0;e<i;++e){const i=t[e];if(!("style"in i))throw new Error("Expected a list of rules with a style property");n[e]=i}return Zl(n,e)}return Bl(t,e)}(e)}(t);this.styleFunction_=null===t||null===e?void 0:function(t){let e;if("function"==typeof t)e=t;else{let i;Array.isArray(t)?i=t:(W("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()}}class Kh extends Xh{constructor(t){super(t)}createRenderer(){return new ga(this)}}class Wh extends O{constructor(t,e,i){super(t),this.map=e,this.frameState=void 0!==i?i:null}}class Yh extends Wh{constructor(t,e,i,n,s,r){super(t,e,s),this.originalEvent=i,this.pixel_=null,this.coordinate_=null,this.dragging=void 0!==n&&n,this.activePointers=r,this.ctrlKey=!1}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()}}var Zh={SINGLECLICK:"singleclick",CLICK:d,DBLCLICK:g,POINTERDRAG:"pointerdrag",POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"},Bh="pointermove",Vh="pointerdown";class Uh extends D{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();if(!i)throw new Error("Map viewport is required");this.activePointers_=[],this.trackedTouches_={},this.element_=i,this.pointerdownListenerKey_=o(i,Vh,this.handlePointerDown_,this),this.originalPointerMoveEvent_,this.relayedListenerKey_=o(i,Bh,this.relayMoveEvent_,this),this.boundHandleTouchMove_=this.handleTouchMove_.bind(this),this.element_.addEventListener(y,this.boundHandleTouchMove_,!!vn&&{passive:!1})}emulateClick_(t){let e=new Yh(Zh.CLICK,this.map_,t);this.dispatchEvent(e),void 0!==this.clickTimeoutId_?(clearTimeout(this.clickTimeoutId_),this.clickTimeoutId_=void 0,e=new Yh(Zh.DBLCLICK,this.map_,t),this.dispatchEvent(e)):this.clickTimeoutId_=setTimeout(()=>{this.clickTimeoutId_=void 0;const e=new Yh(Zh.SINGLECLICK,this.map_,t);this.dispatchEvent(e)},250)}updateActivePointers_(t){const e=t,i=e.pointerId;if(e.type==Zh.POINTERUP||e.type==Zh.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!=Zh.POINTERDOWN&&e.type!=Zh.POINTERMOVE||(this.trackedTouches_[i]=e);this.activePointers_=Object.values(this.trackedTouches_)}handlePointerUp_(t){this.updateActivePointers_(t);const e=new Yh(Zh.POINTERUP,this.map_,t,void 0,void 0,this.activePointers_);this.dispatchEvent(e),this.emulateClicks_&&!e.defaultPrevented&&!this.dragging_&&this.isMouseActionButton_(t)&&this.down_&&this.emulateClick_(this.down_),0===this.activePointers_.length&&(this.dragListenerKeys_.forEach(l),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 Yh(Zh.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(),e=this.element_;if(!e)return;if(this.dragListenerKeys_.push(o(t,Zh.POINTERMOVE,this.handlePointerMove_,this),o(t,Zh.POINTERUP,this.handlePointerUp_,this),o(e,Zh.POINTERCANCEL,this.handlePointerUp_,this)),e.getRootNode&&e.getRootNode()!==t){const t=e.getRootNode();this.dragListenerKeys_.push(o(t,Zh.POINTERUP,this.handlePointerUp_,this))}}}handlePointerMove_(t){if(this.isMoving_(t)){this.updateActivePointers_(t),this.dragging_=!0;const e=new Yh(Zh.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 Yh(Zh.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){const e=this.down_;return this.dragging_||null!==e&&(Math.abs(t.clientX-e.clientX)>this.moveTolerance_||Math.abs(t.clientY-e.clientY)>this.moveTolerance_)}disposeInternal(){const t=this.element_;this.relayedListenerKey_&&(l(this.relayedListenerKey_),this.relayedListenerKey_=void 0),t&&t.removeEventListener(y,this.boundHandleTouchMove_),this.pointerdownListenerKey_&&(l(this.pointerdownListenerKey_),this.pointerdownListenerKey_=void 0),this.dragListenerKeys_.forEach(l),this.dragListenerKeys_.length=0,this.element_=void 0,super.disposeInternal()}}var qh="postrender",$h="movestart",Hh="moveend",Jh="loadstart",Qh="loadend",tc="layergroup",ec="size",ic="target",nc="view";const sc=1/0;class rc{constructor(t,e){this.priorityFunction_=t,this.keyFunction_=e,this.elements_=[],this.priorities_=[],this.queuedElements_={}}clear(){this.elements_.length=0,this.priorities_.length=0,s(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){W(!(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!=sc&&(this.elements_.push(t),this.priorities_.push(e),this.queuedElements_[this.keyFunction_(t)]=!0,this.siftDown_(0,this.elements_.length-1),!0)}getCount(){return this.elements_.length}getLeftChildIndex_(t){return 2*t+1}getRightChildIndex_(t){return 2*t+2}getParentIndex_(t){return t-1>>1}heapify_(){let t;for(t=(this.elements_.length>>1)-1;t>=0;t--)this.siftUp_(t)}isEmpty(){return 0===this.elements_.length}isKeyQueued(t){return t in this.queuedElements_}isQueued(t){return this.isKeyQueued(this.keyFunction_(t))}siftUp_(t){const e=this.elements_,i=this.priorities_,n=e.length,s=e[t],r=i[t],o=t;for(;t<n>>1;){const s=this.getLeftChildIndex_(t),r=this.getRightChildIndex_(t),o=r<n&&i[r]<i[s]?r:s;e[t]=e[o],i[t]=i[o],t=o}e[t]=s,i[t]=r,this.siftDown_(o,t)}siftDown_(t,e){const i=this.elements_,n=this.priorities_,s=i[e],r=n[e];for(;e>t;){const t=this.getParentIndex_(e);if(!(n[t]>r))break;i[e]=i[t],n[e]=n[t],e=t}i[e]=s,n[e]=r}reprioritize(){const t=this.priorityFunction_,e=this.elements_,i=this.priorities_;let n=0;const s=e.length;let r,o,a;for(o=0;o<s;++o)r=e[o],a=t(r),a==sc?delete this.queuedElements_[this.keyFunction_(r)]:(i[n]=a,e[n++]=r);e.length=n,i.length=n,this.heapify_()}}class oc extends rc{constructor(t,e){super(e=>t.apply(null,e),t=>t[0].getKey()),this.boundHandleTileChange_=this.handleTileChange.bind(this),this.tileChangeCallback_=e,this.tilesLoading_=0,this.tilesLoadingKeys_={}}enqueue(t){const e=super.enqueue(t);if(e){t[0].addEventListener(h,this.boundHandleTileChange_)}return e}getTilesLoading(){return this.tilesLoading_}handleTileChange(t){const e=t.target,i=e.getState();if(i===En||i===bn||i===Rn){i!==bn&&e.removeEventListener(h,this.boundHandleTileChange_);const t=e.getKey();t in this.tilesLoadingKeys_&&(delete this.tilesLoadingKeys_[t],--this.tilesLoading_),this.tileChangeCallback_()}}loadMoreTiles(t,e){let i=0;for(;this.tilesLoading_<t&&i<e&&this.getCount()>0;){const t=this.dequeue()[0],e=t.getKey();t.getState()!==Cn||e in this.tilesLoadingKeys_||(this.tilesLoadingKeys_[e]=!0,++this.tilesLoading_,++i,t.load())}}}class ac 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)l(this.listenerKeys[t]);if(this.listenerKeys.length=0,this.map_=t,t){const e=this.target_??t.getOverlayContainerStopEvent();this.element&&e&&e.appendChild(this.element),this.render!==k&&this.listenerKeys.push(o(t,qh,this.render,this)),t.render()}}render(t){}setTarget(t){this.target_="string"==typeof t?document.getElementById(t):t}}class lc extends ac{constructor(t){t=t||{},super({element:document.createElement("div"),render:t.render,target:t.target}),this.ulElement_=document.createElement("ul"),this.collapsed_=void 0===t.collapsed||t.collapsed,this.userCollapsed_=this.collapsed_,this.overrideCollapsible_=void 0!==t.collapsible,this.collapsible_=void 0===t.collapsible||t.collapsible,this.collapsible_||(this.collapsed_=!1),this.attributions_=t.attributions;const e=void 0!==t.className?t.className:"ol-attribution",i=void 0!==t.tipLabel?t.tipLabel:"Attributions",n=void 0!==t.expandClassName?t.expandClassName:e+"-expand",s=void 0!==t.collapseLabel?t.collapseLabel:"›",r=void 0!==t.collapseClassName?t.collapseClassName:e+"-collapse";"string"==typeof s?(this.collapseLabel_=document.createElement("span"),this.collapseLabel_.textContent=s,this.collapseLabel_.className=r):this.collapseLabel_=s;const o=void 0!==t.label?t.label:"i";"string"==typeof o?(this.label_=document.createElement("span"),this.label_.textContent=o,this.label_.className=n):this.label_=o;const a=this.collapsible_&&!this.collapsed_?this.collapseLabel_:this.label_;this.toggleButton_=document.createElement("button"),this.toggleButton_.setAttribute("type","button"),this.toggleButton_.setAttribute("aria-expanded",String(!this.collapsed_)),this.toggleButton_.title=i,this.toggleButton_.appendChild(a),this.toggleButton_.addEventListener(d,this.handleClick_.bind(this),!1);const l=e+" "+bs+" "+Is+(this.collapsed_&&this.collapsible_?" "+Ms:"")+(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();if(!e)return[];const i=e.getAllLayers(),n=new Set(i.flatMap(e=>e.getAttributions(t)));if(void 0!==this.attributions_&&(Array.isArray(this.attributions_)?this.attributions_.forEach(t=>n.add(t)):n.add(this.attributions_)),!this.overrideCollapsible_){const t=!i.some(t=>!1===t.getSource()?.getAttributionsCollapsible());this.setCollapsible(t)}return Array.from(n)}async updateElement_(t){const e=this.element;if(!e)return;if(!t)return void(this.renderedVisible_&&(e.style.display="none",this.renderedVisible_=!1));const i=await Promise.all(this.collectSourceAttributions_(t).map(t=>{return e=()=>t,function(){let t;try{t=e()}catch(t){return Promise.reject(t)}return P(t)?t:Promise.resolve(t)}();var e})),n=i.length>0;if(this.renderedVisible_!=n&&(e.style.display=n?"":"none",this.renderedVisible_=n),!R(i,this.renderedAttributions_)){Nn(this.ulElement_);for(let t=0,e=i.length;t<e;++t){const e=document.createElement("li");e.innerHTML=i[t],this.ulElement_.appendChild(e)}this.renderedAttributions_=i}}handleClick_(t){t.preventDefault(),this.handleToggle_(),this.userCollapsed_=this.collapsed_}handleToggle_(){const t=this.element;t&&(t.classList.toggle(Ms),this.collapsed_?zn(this.collapseLabel_,this.label_):zn(this.label_,this.collapseLabel_),this.collapsed_=!this.collapsed_,this.toggleButton_.setAttribute("aria-expanded",String(!this.collapsed_)))}getCollapsible(){return this.collapsible_}setCollapsible(t){if(this.collapsible_===t)return;this.collapsible_=t;const e=this.element;e&&(e.classList.toggle("ol-uncollapsible"),this.userCollapsed_&&this.handleToggle_())}setCollapsed(t){this.userCollapsed_=t,this.collapsible_&&this.collapsed_!==t&&this.handleToggle_()}getCollapsed(){return this.collapsed_}render(t){this.updateElement_(t.frameState)}}class hc extends ac{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_,"string"==typeof i?(this.label_=document.createElement("span"),this.label_.className=n,this.label_.textContent=i):(this.label_=i,this.label_.classList.add(n));const s=t.tipLabel?t.tipLabel:"Reset rotation",r=document.createElement("button");r.className=e+"-reset",r.setAttribute("type","button"),r.title=s,r.appendChild(this.label_),r.addEventListener(d,this.handleClick_.bind(this),!1);const o=e+" "+bs+" "+Is,a=this.element;a.className=o,a.appendChild(r),this.callResetNorth_=t.resetNorth?t.resetNorth:void 0,this.duration_=void 0!==t.duration?t.duration:250,this.autoHide_=void 0===t.autoHide||t.autoHide,this.rotation_=void 0,this.autoHide_&&this.element.classList.add(Es)}handleClick_(t){t.preventDefault(),void 0!==this.callResetNorth_?this.callResetNorth_():this.resetNorth_()}resetNorth_(){const t=this.getMap();if(!t)return;const e=t.getView();if(!e)return;const i=e.getRotation();void 0!==i&&(this.duration_>0&&i%(2*Math.PI)!=0?e.animate({rotation:0,duration:this.duration_,easing:Mn}):e.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)",e=this.element;if(this.autoHide_&&e){const t=e.classList.contains(Es);t||0!==i?t&&0!==i&&e.classList.remove(Es):e.classList.add(Es)}this.label_.style.transform=t}this.rotation_=i}}class cc extends ac{constructor(t){t=t||{},super({element:document.createElement("div"),target:t.target});const e=void 0!==t.className?t.className:"ol-zoom",i=void 0!==t.delta?t.delta:1,n=void 0!==t.zoomInClassName?t.zoomInClassName:e+"-in",s=void 0!==t.zoomOutClassName?t.zoomOutClassName:e+"-out",r=void 0!==t.zoomInLabel?t.zoomInLabel:"+",o=void 0!==t.zoomOutLabel?t.zoomOutLabel:"–",a=void 0!==t.zoomInTipLabel?t.zoomInTipLabel:"Zoom in",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 r?document.createTextNode(r):r),h.addEventListener(d,this.handleClick_.bind(this,i),!1);const c=document.createElement("button");c.className=s,c.setAttribute("type","button"),c.title=l,c.appendChild("string"==typeof o?document.createTextNode(o):o),c.addEventListener(d,this.handleClick_.bind(this,-i),!1);const u=e+" "+bs+" "+Is,g=this.element;g.className=u,g.appendChild(h),g.appendChild(c),this.duration_=void 0!==t.duration?t.duration:250}handleClick_(t,e){e.preventDefault(),this.zoomByDelta_(t)}zoomByDelta_(t){const e=this.getMap();if(!e)return;const i=e.getView();if(!i)return;const n=i.getZoom();if(void 0!==n){const e=i.getConstrainedZoom(n+t);if(void 0===e)return;this.duration_>0?(i.getAnimating()&&i.cancelAnimations(),i.animate({zoom:e,duration:this.duration_,easing:Mn})):i.setZoom(e)}}}function uc(t){t=t||{};const e=new K;(void 0===t.zoom||t.zoom)&&e.push(new cc(t.zoomOptions));(void 0===t.rotate||t.rotate)&&e.push(new hc(t.rotateOptions));return(void 0===t.attribution||t.attribution)&&e.push(new lc(t.attributionOptions)),e}var dc="active";class gc 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(dc)}getMap(){return this.map_}handleEvent(t){return!0}setActive(t){this.set(dc,t)}setMap(t){this.map_=t}}function fc(t,e,i,n){const s=t.getZoom();if(void 0===s)return;const r=t.getConstrainedZoom(s+e);if(void 0===r)return;const o=t.getResolutionForZoom(r);void 0!==o&&(t.getAnimating()&&t.cancelAnimations(),t.animate({resolution:o,anchor:i,duration:void 0!==n?n:250,easing:Mn}))}class _c extends gc{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==Zh.DBLCLICK){const i=t.originalEvent,n=t.map,s=t.coordinate,r=i.shiftKey?-this.delta_:this.delta_;fc(n.getView(),r,s,this.duration_),i.preventDefault(),e=!0}return!e}}function pc(t){const e=arguments;return function(t){let i=!0;for(let n=0,s=e.length;n<s&&(i=i&&e[n](t),i);++n);return i}}const mc=function(t){const e=t.originalEvent;return e.altKey&&!(e.metaKey||e.ctrlKey)&&e.shiftKey},yc=function(t){const e=t.map.getTargetElement();if(!e)return!0;const i=e.getRootNode();return!(i instanceof ShadowRoot?i.host:e).hasAttribute("tabindex")||function(t){const e=t.map.getTargetElement();if(!e)return!1;const i=e.getRootNode(),n=t.map.getOwnerDocument().activeElement;return i instanceof ShadowRoot?i.host.contains(n):e.contains(n)}(t)},xc=F,vc=function(t){const e=t.originalEvent;return"pointerId"in e&&0==e.button&&!(_n&&pn&&e.ctrlKey)},wc=function(t){const e=t.originalEvent;return!e.altKey&&!(e.metaKey||e.ctrlKey)&&!e.shiftKey},Cc=function(t){const e=t.originalEvent;return!e.altKey&&!(e.metaKey||e.ctrlKey)&&e.shiftKey},Sc=function(t){const e=t.originalEvent,i=e.target.tagName;return"INPUT"!==i&&"SELECT"!==i&&"TEXTAREA"!==i&&!e.target.isContentEditable},Ec=function(t){const e=t.originalEvent;return"pointerId"in e&&"mouse"==e.pointerType},bc=function(t){const e=t.originalEvent;return"pointerId"in e&&e.isPrimary&&0===e.button};class Rc extends gc{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==Zh.POINTERDRAG)this.handleDragEvent(t),t.originalEvent.preventDefault();else if(t.type==Zh.POINTERUP){const e=this.handleUpEvent(t);this.handlingDownUpSequence=e&&this.targetPointers.length>0}}else if(t.type==Zh.POINTERDOWN){const i=this.handleDownEvent(t);this.handlingDownUpSequence=i,e=this.stopDown(i)}else t.type==Zh.POINTERMOVE&&this.handleMoveEvent(t);return!e}handleMoveEvent(t){}handleUpEvent(t){return!1}stopDown(t){return t}updateTrackedPointers_(t){t.activePointers&&(this.targetPointers=t.activePointers)}}function Ic(t){const e=t.length;let i=0,n=0;for(let s=0;s<e;s++)i+=t[s].clientX,n+=t[s].clientY;return{clientX:i/e,clientY:n/e}}class Mc extends Rc{constructor(t){super({stopDown:L}),t=t||{},this.kinetic_=t.kinetic,this.lastCentroid=null,this.lastPointersCount_,this.panning_=!1;const e=t.condition?t.condition:pc(wc,bc);this.condition_=t.onFocusOnly?pc(yc,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(Ic(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(),s=i.getResolution();void 0!==s&&($t(e,s),qt(e,i.getRotation()),i.adjustCenterInternal(e))}}else this.kinetic_&&this.kinetic_.begin();this.lastCentroid=n,this.lastPointersCount_=i.length,t.originalEvent.preventDefault()}handleUpEvent(t){const e=t.map,i=e.getView();if(0===this.targetPointers.length){if(!this.noKinetic_&&this.kinetic_&&this.kinetic_.end()){const t=this.kinetic_.getDistance(),n=this.kinetic_.getAngle(),s=i.getCenterInternal();if(s){const r=e.getPixelFromCoordinateInternal(s),o=e.getCoordinateFromPixelInternal([r[0]-t*Math.cos(n),r[1]-t*Math.sin(n)]);i.animateInternal({center:i.getConstrainedCenter(o),duration:500,easing:Mn})}}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}}class Tc extends Rc{constructor(t){t=t||{},super({stopDown:L}),this.condition_=t.condition?t.condition:mc,this.lastAngle_=void 0,this.duration_=void 0!==t.duration?t.duration:250}handleDragEvent(t){if(!Ec(t))return;const e=t.map,i=e.getView();if(i.getConstraints().rotation===vh)return;const n=e.getSize();if(!n)return;const s=t.pixel,r=Math.atan2(n[1]/2-s[1],s[0]-n[0]/2);if(void 0!==this.lastAngle_){const t=r-this.lastAngle_;i.adjustRotationInternal(-t)}this.lastAngle_=r}handleUpEvent(t){if(!Ec(t))return!0;return t.map.getView().endInteraction(this.duration_),!1}handleDownEvent(t){if(!Ec(t))return!1;if(vc(t)&&this.condition_(t)){return t.map.getView().beginInteraction(),this.lastAngle_=void 0,!0}return!1}}class Pc extends v{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_;if(!t||!e)return;const 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_){const t=this.map_.getOverlayContainer();t&&t.removeChild(this.element_);const e=this.element_.style;e.left="inherit",e.top="inherit",e.width="inherit",e.height="inherit"}if(this.map_=t,this.map_){const t=this.map_.getOverlayContainer();t&&t.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_;if(!t||!e)return;const i=[t,[t[0],e[1]],e,[e[0],t[1]]],n=this.map_,s=i.map(t=>n.getCoordinateFromPixelInternal(t)),r=s[0];if(!r)return;s[4]=r.slice();const o=s;this.geometry_?this.geometry_.setCoordinates([o]):this.geometry_=new ln([o])}getGeometry(){return this.geometry_}}const Fc="boxstart",Lc="boxdrag",kc="boxend",Ac="boxcancel";class Oc extends O{constructor(t,e,i){super(t),this.coordinate=e,this.mapBrowserEvent=i}}class Dc extends Rc{constructor(t){super(),this.on,this.once,this.un,t=t??{},this.box_=new Pc(t.className||"ol-dragbox"),this.minArea_=t.minArea??64,t.onBoxEnd&&(this.onBoxEnd=t.onBoxEnd),this.startPixel_=null,this.condition_=t.condition??vc,this.boxEndCondition_=t.boxEndCondition??this.defaultBoxEndCondition}defaultBoxEndCondition(t,e,i){const n=i[0]-e[0],s=i[1]-e[1];return n*n+s*s>=this.minArea_}getGeometry(){return this.box_.getGeometry()}handleDragEvent(t){this.startPixel_&&(this.box_.setPixels(this.startPixel_,t.pixel),this.dispatchEvent(new Oc(Lc,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 Oc(e?kc:Ac,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 Oc(Fc,t.coordinate,t)),!0)}onBoxEnd(t){}setActive(t){t||(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new Oc(Ac,this.startPixel_,null)),this.startPixel_=null)),super.setActive(t)}setMap(t){this.getMap()&&(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new Oc(Ac,this.startPixel_,null)),this.startPixel_=null)),super.setMap(t)}}class Gc extends Dc{constructor(t){super({condition:(t=t||{}).condition?t.condition:Cc,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();if(!e)return;const i=e.getView();let n=this.getGeometry();if(this.out_){const t=i.rotatedExtentForGeometry(n),e=i.getResolutionForExtentInternal(t),s=i.getResolution();if(void 0===e||void 0===s)return;const r=s/e;n=n.clone(),n.scale(r*r)}i.fitInternal(n,{duration:this.duration_,easing:Mn})}}var zc="ArrowLeft",Nc="ArrowUp",jc="ArrowRight",Xc="ArrowDown";class Kc extends gc{constructor(t){super(),t=t||{},this.defaultCondition_=function(t){return wc(t)&&Sc(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==f){const i=t.originalEvent,n=i.key;if(this.condition_(t)&&(n==Xc||n==zc||n==jc||n==Nc)){const s=t.map.getView(),r=s.getResolution();if(void 0===r)return!0;const o=r*this.pixelDelta_;let a=0,l=0;n==Xc?l=-o:n==zc?a=-o:n==jc?a=o:l=o;const h=[a,l];qt(h,s.getRotation()),function(t,e,i){const n=t.getCenterInternal();if(n){const s=[n[0]+e[0],n[1]+e[1]];t.animateInternal({duration:void 0!==i?i:250,easing:Pn,center:t.getConstrainedCenter(s)})}}(s,h,this.duration_),i.preventDefault(),e=!0}}return!e}}class Wc extends gc{constructor(t){super(),t=t||{},this.condition_=t.condition?t.condition:function(t){return!function(t){const e=t.originalEvent;return pn?e.metaKey:e.ctrlKey}(t)&&Sc(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==f||t.type==_){const i=t.originalEvent,n=i.key;if(this.condition_(t)&&("+"===n||"-"===n)){const s=t.map,r="+"===n?this.delta_:-this.delta_;fc(s.getView(),r,void 0,this.duration_),i.preventDefault(),e=!0}}return!e}}class Yc extends gc{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:xc;this.condition_=t.onFocusOnly?pc(yc,e):e,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_,this.mode_=void 0,this.trackpadEventGap_=400,this.trackpadTimeoutId_,this.deltaPerZoom_=300}endInteraction_(){this.trackpadTimeoutId_=void 0;const t=this.getMap();if(!t)return;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_):void 0)}handleEvent(t){if(!this.condition_(t))return!0;if(t.type!==x)return!0;const e=t.map,i=t.originalEvent;i.preventDefault();const n=i.ctrlKey&&!t.ctrlKey;this.useAnchor_&&(this.lastAnchor_=t.pixel);let s=i.deltaY;switch(i.deltaMode){case WheelEvent.DOM_DELTA_LINE:s*=40;break;case WheelEvent.DOM_DELTA_PAGE:s*=300}if(0===s)return!1;this.lastDelta_=s;const r=Date.now();void 0===this.startTime_&&(this.startTime_=r),(!this.mode_||r-this.startTime_>this.trackpadEventGap_)&&(this.mode_=Math.abs(s)<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&&(s*=3),o.adjustZoom(-s/this.deltaPerZoom_,this.lastAnchor_?e.getCoordinateFromPixel(this.lastAnchor_):void 0),this.startTime_=r,!1;this.totalDelta_+=s;const a=Math.max(this.timeout_-(r-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=-At(this.totalDelta_,-this.maxDelta_*this.deltaPerZoom_,this.maxDelta_*this.deltaPerZoom_)/this.deltaPerZoom_;(e.getConstrainResolution()||this.constrainResolution_)&&(i=i?i>0?1:-1:0),fc(e,i,this.lastAnchor_?t.getCoordinateFromPixel(this.lastAnchor_):void 0,this.duration_),this.mode_=void 0,this.totalDelta_=0,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_=void 0}setMouseAnchor(t){this.useAnchor_=t,t||(this.lastAnchor_=null)}}class Zc extends Rc{constructor(t){const e=t=t||{};e.stopDown||(e.stopDown=L),super(e),this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.threshold_=void 0!==t.threshold?t.threshold:.3,this.duration_=void 0!==t.duration?t.duration:250}handleDragEvent(t){let e=0;const i=this.targetPointers[0],n=this.targetPointers[1],s=Math.atan2(n.clientY-i.clientY,n.clientX-i.clientX);if(void 0!==this.lastAngle_){const t=s-this.lastAngle_;this.rotationDelta_+=t,!this.rotating_&&Math.abs(this.rotationDelta_)>this.threshold_&&(this.rotating_=!0),e=t}this.lastAngle_=s;const r=t.map,o=r.getView();o.getConstraints().rotation!==vh&&(this.anchor_=r.getCoordinateFromPixelInternal(r.getEventPixel(Ic(this.targetPointers)))??null,this.rotating_&&(r.render(),o.adjustRotationInternal(e,this.anchor_??void 0)))}handleUpEvent(t){if(this.targetPointers.length<2){return t.map.getView().endInteraction(this.duration_),!1}return!0}handleDownEvent(t){if(this.targetPointers.length>=2){const e=t.map;return this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.handlingDownUpSequence||e.getView().beginInteraction(),!0}return!1}}class Bc extends Rc{constructor(t){const e=t=t||{};e.stopDown||(e.stopDown=L),super(e),this.anchor_=null,this.duration_=void 0!==t.duration?t.duration:400,this.lastDistance_=void 0,this.lastScaleDelta_=1}handleDragEvent(t){let e=1;const i=this.targetPointers[0],n=this.targetPointers[1],s=i.clientX-n.clientX,r=i.clientY-n.clientY,o=Math.sqrt(s*s+r*r);void 0!==this.lastDistance_&&(e=this.lastDistance_/o),this.lastDistance_=o;const a=t.map,l=a.getView();1!=e&&(this.lastScaleDelta_=e),this.anchor_=a.getCoordinateFromPixelInternal(a.getEventPixel(Ic(this.targetPointers)))??null,a.render(),l.adjustResolutionInternal(e,this.anchor_??void 0)}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 Vc(t){t=t||{};const e=new K,i=new Wn(-.005,.05,100);(void 0===t.altShiftDragRotate||t.altShiftDragRotate)&&e.push(new Tc);(void 0===t.doubleClickZoom||t.doubleClickZoom)&&e.push(new _c({delta:t.zoomDelta,duration:t.zoomDuration}));(void 0===t.dragPan||t.dragPan)&&e.push(new Mc({onFocusOnly:t.onFocusOnly,kinetic:i}));(void 0===t.pinchRotate||t.pinchRotate)&&e.push(new Zc);(void 0===t.pinchZoom||t.pinchZoom)&&e.push(new Bc({duration:t.zoomDuration}));(void 0===t.keyboard||t.keyboard)&&(e.push(new Kc),e.push(new Wc({delta:t.zoomDelta,duration:t.zoomDuration})));(void 0===t.mouseWheelZoom||t.mouseWheelZoom)&&e.push(new Yc({onFocusOnly:t.onFocusOnly,duration:t.zoomDuration}));return(void 0===t.shiftDragZoom||t.shiftDragZoom)&&e.push(new Gc({duration:t.zoomDuration})),e}const Uc="addlayer",qc="removelayer";class $c extends O{constructor(t,e){super(t),this.layer=e}}const Hc="layers";class Jc extends Gh{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(Hc,this.handleLayersChanged_),i?Array.isArray(i)?i=new K(i.slice(),{unique:!0}):W("function"==typeof i.getArray,"Expected `layers` to be an array or a `Collection`"):i=new K(void 0,{unique:!0}),this.setLayers(i)}handleLayerChange_(){this.changed()}handleLayersChanged_(){this.layersListenerKeys_.forEach(l),this.layersListenerKeys_.length=0;const t=this.getLayers();this.layersListenerKeys_.push(o(t,e,this.handleLayersAdd_,this),o(t,i,this.handleLayersRemove_,this));for(const t in this.listenerKeys_)this.listenerKeys_[t].forEach(l);s(this.listenerKeys_);const n=t.getArray();for(let t=0,e=n.length;t<e;t++){const e=n[t];this.registerLayerListeners_(e),this.dispatchEvent(new $c(Uc,e))}this.changed()}registerLayerListeners_(t){const e=[o(t,n,this.handleLayerChange_,this),o(t,h,this.handleLayerChange_,this)];t instanceof Jc&&e.push(o(t,Uc,this.handleLayerGroupAdd_,this),o(t,qc,this.handleLayerGroupRemove_,this)),this.listenerKeys_[T(t)]=e}handleLayerGroupAdd_(t){this.dispatchEvent(new $c(Uc,t.layer))}handleLayerGroupRemove_(t){this.dispatchEvent(new $c(qc,t.layer))}handleLayersAdd_(t){const e=t.element;this.registerLayerListeners_(e),this.dispatchEvent(new $c(Uc,e)),this.changed()}handleLayersRemove_(t){const e=t.element,i=T(e);this.listenerKeys_[i].forEach(l),delete this.listenerKeys_[i],this.dispatchEvent(new $c(qc,e)),this.changed()}getLayers(){return this.get(Hc)}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 $c(qc,t[e]))}this.set(Hc,t)}getLayersArray(t){return t=void 0!==t?t:[],this.getLayers().forEach(function(e){e.getLayersArray(t)}),t}getLayerStatesArray(t){const e=void 0!==t?t:[],i=e.length;this.getLayers().forEach(function(t){t.getLayerStatesArray(e)});const n=this.getLayerState();let s=n.zIndex;t||void 0!==n.zIndex||(s=0);for(let t=i,r=e.length;t<r;t++){const i=e[t];i.opacity*=n.opacity,i.visible=i.visible&&n.visible,i.maxResolution=Math.min(i.maxResolution,n.maxResolution),i.minResolution=Math.max(i.minResolution,n.minResolution),i.minZoom=Math.max(i.minZoom,n.minZoom),i.maxZoom=Math.min(i.maxZoom,n.maxZoom),void 0!==n.extent&&(void 0!==i.extent?i.extent=Et(i.extent,n.extent):i.extent=n.extent),void 0===i.zIndex&&(i.zIndex=s)}return e}getSourceState(){return"ready"}}class Qc extends v{constructor(t){super(),this.map_=t}dispatchRenderEvent(t,e){I()}calculateMatrices2D(t){const e=t.viewState,i=t.coordinateToPixelTransform,n=t.pixelToCoordinateTransform;fi(i,t.size[0]/2,t.size[1]/2,1/e.resolution,-1/e.resolution,-e.rotation,-e.center[0],-e.center[1]),_i(n,i)}forEachFeatureAtCoordinate(t,e,i,n,s,r,o,a){let l;const h=e.viewState;function c(t,e,i,n){return s.call(r,e,t?i:null,n)}const u=h.projection,d=Ht(t.slice(),u),g=[[0,0]];if(u.canWrapX()&&n){const t=Mt(u.getExtent());g.push([-t,0],[t,0])}const f=e.layerStatesArray,_=f.length,p=[],m=[];for(let n=0;n<g.length;n++)for(let s=_-1;s>=0;--s){const r=f[s],u=r.layer;if(u.hasRenderer()&&Nh(r,h)&&o.call(a,u)){const s=u.getRenderer(),o=u.getSource();if(s&&o){const a=o.getWrapX()?d:t,h=c.bind(null,r.managed);m[0]=a[0]+g[n][0],m[1]=a[1]+g[n][1],l=s.forEachFeatureAtCoordinate(m,e,i,h,p)}if(l)return l}}if(0===p.length)return;const y=1/p.length;return p.forEach((t,e)=>t.distanceSq+=e*y),p.sort((t,e)=>t.distanceSq-e.distanceSq),p.some(t=>l=t.callback(t.feature,t.layer,t.geometry)),l}hasFeatureAtCoordinate(t,e,i,n,s,r){return void 0!==this.forEachFeatureAtCoordinate(t,e,i,n,F,this,s,r)}getMap(){return this.map_}renderFrame(t){I()}scheduleExpireIconCache(t){_s.canExpireCache()&&t.postRenderFunctions.push(tu)}}function tu(t,e){_s.expire()}class eu extends Qc{constructor(t){super(t),this.fontChangeListenerKey_=o(Ks,n,t.redrawText,t),this.element_=yn?jn():document.createElement("div");const e=this.element_.style;e.position="absolute",e.width="100%",e.height="100%",e.zIndex="0",this.element_.className=bs+" 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 la(t,void 0,e);i.dispatchEvent(n)}}disposeInternal(){l(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(hr,t);const e=t.layerStatesArray.sort((t,e)=>t.zIndex-e.zIndex);e.some(t=>t.layer instanceof Xh&&t.layer.getDeclutter())&&(t.declutter={});const i=t.viewState;this.children_.length=0;const n=this.getMap().getTargetElement();let s;Xn(n)&&(s=n.getContext("2d"),s.setTransform(1,0,0,1,0,0),s.clearRect(0,0,n.width,n.height));const r=[];let o=s?n:null;for(let n=0,s=e.length;n<s;++n){const s=e[n];t.layerIndex=n;const a=s.layer,l=a.getSourceState();if(!Nh(s,i)||"ready"!=l&&"undefined"!=l){a.unrender();continue}const h=a.render(t,o);h&&(h!==o&&(this.children_.push(h),o=h),r.push(s))}if(this.declutter(t,r),function(t,e){const i=t.childNodes;for(let n=0;;++n){const s=i[n],r=e[n];if(!s&&!r)break;s!==r&&(s?r?t.insertBefore(r,s):(t.removeChild(s),--n):t.appendChild(r))}}(this.element_,this.children_),s)for(const t of this.children_){const e=t.firstElementChild||t,i=t.style.backgroundColor;if(i&&(!Xn(e)||e.width>0)&&(s.fillStyle=i,s.fillRect(0,0,s.canvas.width,s.canvas.height)),!Xn(e)||0===e.width)continue;s.save();const n=t.style.opacity||e.style.opacity;s.globalAlpha=""===n?1:Number(n);const r=e.style.transform;if(r)s.transform(...mi(r));else{const t=parseFloat(e.style.width)/e.width,i=parseFloat(e.style.height)/e.height;s.transform(t,0,0,i,0,0)}s.drawImage(e,0,0),s.restore()}this.dispatchRenderEvent(cr,t),this.renderedVisible_||(this.element_.style.display="",this.renderedVisible_=!0),this.scheduleExpireIconCache(t)}declutter(t,e){if(t.declutter){for(let i=e.length-1;i>=0;--i){const n=e[i],s=n.layer;s.getDeclutter()&&s.renderDeclutter(t,n)}e.forEach(e=>e.layer?.renderDeferred(t))}}}function iu(t){t instanceof zh?t.setMapInternal(null):t instanceof Jc&&t.getLayers().forEach(iu)}function nu(t,e){if(t instanceof zh)t.setMapInternal(e);else if(t instanceof Jc){const i=t.getLayers().getArray();for(let t=0,n=i.length;t<n;++t)nu(i[t],e)}}let su=class extends N{constructor(t){super(),t=t||{},this.on,this.once,this.un;const n=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 Jc({layers:t.layers});let s,r,o;i[tc]=n,i[ic]=t.target,i[nc]=t.view instanceof Sh?t.view:new Sh,void 0!==t.controls&&(Array.isArray(t.controls)?s=new K(t.controls.slice()):(W("function"==typeof t.controls.getArray,"Expected `controls` to be an array or an `ol/Collection.js`"),s=t.controls));void 0!==t.interactions&&(Array.isArray(t.interactions)?r=new K(t.interactions.slice()):(W("function"==typeof t.interactions.getArray,"Expected `interactions` to be an array or an `ol/Collection.js`"),r=t.interactions));void 0!==t.overlays?Array.isArray(t.overlays)?o=new K(t.overlays.slice()):(W("function"==typeof t.overlays.getArray,"Expected `overlays` to be an array or an `ol/Collection.js`"),o=t.overlays):o=new K;return{controls:s,interactions:r,keyboardEventTarget:e,overlays:o,values:i}}(t);this.renderComplete_=!1,this.loaded_=!0,this.boundHandleBrowserEvent_=this.handleBrowserEvent.bind(this),this.ctrlKey_=!1,this.boundHandleCtrlKey_=this.handleCtrlKey_.bind(this),this.maxTilesLoading_=void 0!==t.maxTilesLoading?t.maxTilesLoading:16,this.pixelRatio_=void 0!==t.pixelRatio?t.pixelRatio:mn,this.postRenderTimeoutHandle_,this.animationDelayKey_,this.animationDelay_=this.animationDelay_.bind(this),this.coordinateToPixelTransform_=di(),this.pixelToCoordinateTransform_=di(),this.frameIndex_=0,this.frameState_=null,this.previousExtent_=null,this.viewPropertyListenerKey_=null,this.viewChangeListenerKey_=null,this.layerGroupPropertyListenerKeys_=null,this.viewport_,this.overlayContainer_,this.overlayContainerStopEvent_,yn||(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_=n.keyboardEventTarget,this.targetChangeHandlerKeys_=null,this.targetElement_=null,yn||(this.resizeObserver_=new ResizeObserver(()=>this.updateSize())),this.controls=n.controls||(yn?new K:uc()),this.interactions=n.interactions||(yn?new K:Vc({onFocusOnly:!0})),this.overlays_=n.overlays,this.overlayIdIndex_={},this.renderer_=null,this.postRenderFunctions_=[],this.tileQueue_=new oc(this.getTilePriority.bind(this),this.handleTileChange_.bind(this)),this.addChangeListener(tc,this.handleLayerGroupChanged_),this.addChangeListener(nc,this.handleViewChanged_),this.addChangeListener(ec,this.handleSizeChanged_),this.addChangeListener(ic,this.handleTargetChanged_),this.setProperties(n.values);const s=this;!t.view||t.view instanceof Sh||t.view.then(function(t){s.setView(new Sh(t))}),this.controls.addEventListener(e,t=>{t.element.setMap(this)}),this.controls.addEventListener(i,t=>{t.element.setMap(null)}),this.interactions.addEventListener(e,t=>{t.element.setMap(this)}),this.interactions.addEventListener(i,t=>{t.element.setMap(null)}),this.overlays_.addEventListener(e,t=>{this.addOverlayInternal_(t.element)}),this.overlays_.addEventListener(i,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){nu(t.layer,this)}addOverlay(t){this.getOverlays().push(t)}addOverlayInternal_(t){const e=t.getId();void 0!==e&&(this.overlayIdIndex_[e.toString()]=t),t.setMap(this)}disposeInternal(){this.controls.clear(),this.interactions.clear(),this.overlays_.clear(),this.resizeObserver_?.disconnect(),this.setTarget(null),super.disposeInternal()}forEachFeatureAtPixel(t,e,i){if(!this.frameState_||!this.renderer_)return;const n=this.getCoordinateFromPixelInternal(t),s=void 0!==(i=void 0!==i?i:{}).hitTolerance?i.hitTolerance:0,r=void 0!==i.layerFilter?i.layerFilter:F,o=!1!==i.checkWrapped;return this.renderer_.forEachFeatureAtCoordinate(n,this.frameState_,s,o,e,null,r,null)}getFeaturesAtPixel(t,e){const i=[];return this.forEachFeatureAtPixel(t,function(t){i.push(t)},e),i}getAllLayers(){const t=[];return function e(i){i.forEach(function(i){i instanceof Jc?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:F,s=void 0!==e.hitTolerance?e.hitTolerance:0,r=!1!==e.checkWrapped;return this.renderer_.hasFeatureAtCoordinate(i,this.frameState_,s,r,n,null)}getEventCoordinate(t){return this.getCoordinateFromPixel(this.getEventPixel(t))}getEventCoordinateInternal(t){return this.getCoordinateFromPixelInternal(this.getEventPixel(t))}getEventPixel(t){const e=this.viewport_.getBoundingClientRect(),i=this.getSize(),n=e.width/i[0],s=e.height/i[1],r="changedTouches"in t?t.changedTouches[0]:t;return[(r.clientX-e.left)/n,(r.clientY-e.top)/s]}getTarget(){return this.get(ic)}getTargetElement(){return this.targetElement_}getCoordinateFromPixel(t,e){const i=si(this.getCoordinateFromPixelInternal(t),this.getView().getProjection());if(e?.wrapX&&i){Ht(i,this.getView().getProjection())}return i}getCoordinateFromPixelInternal(t){const e=this.frameState_;return e?gi(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(tc)}setLayers(t){const e=this.getLayerGroup();if(t instanceof K)return void e.setLayers(t);const i=e.getLayers();i.clear(),i.extend(t)}getLayers(){return this.getLayerGroup().getLayers()}updateRenderComplete_(){this.renderComplete_=(this.hasListener(Jh)||this.hasListener(Qh)||this.hasListener(ur))&&!this.tileQueue_.getTilesLoading()&&!this.tileQueue_.getCount()&&!this.getLoadingOrNotReady()}getLoadingOrNotReady(){const t=this.getLayerGroup().getLayerStatesArray();for(let e=0,i=t.length;e<i;++e){const i=t[e];if(!i.visible)continue;const n=i.layer.getRenderer();if(n&&!n.ready)return!0;const s=i.layer.getSource();if(s&&s.loading)return!0}return!1}getPixelFromCoordinate(t,e){const i=this.getView().getProjection();let n=ri(t);return e?.wrapX&&this.frameState_&&(n=function(t,e,i){if(e.canWrapX()){const n=Mt(e.getExtent()),s=Math.round((i-t[0])/n);0!==s&&(t[0]+=s*n)}return t}(n.slice(),i,this.frameState_.viewState.center[0])),this.getPixelFromCoordinateInternal(n)}getPixelFromCoordinateInternal(t){const e=this.frameState_;return e?gi(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(ec)}getView(){return this.get(nc)}getViewport(){return this.viewport_}getOverlayContainer(){return this.overlayContainer_}getOverlayContainerStopEvent(){return this.overlayContainerStopEvent_}getOwnerDocument(){const t=this.getTargetElement();return t?t.ownerDocument:document}getTilePriority(t,e,i,n){return function(t,e,i,n,s){if(!t||!(i in t.wantedTiles))return sc;if(!t.wantedTiles[i][e.getKey()])return sc;const r=t.viewState.center,o=n[0]-r[0],a=n[1]-r[1];return 65536*Math.log(s)+Math.sqrt(o*o+a*a)/s}(this.frameState_,t,e,i,n)}handleBrowserEvent(t,e){e=e||t.type;const i=new Yh(e,this,t);this.handleMapBrowserEvent(i)}handleCtrlKey_(t){const e=t;this.ctrlKey_="Control"===e.key?e.type===f:e.ctrlKey}handleMapBrowserEvent(t){if(!1===t.originalEvent.ctrlKey&&(this.ctrlKey_=!1),t.ctrlKey=this.ctrlKey_,!this.frameState_)return;const e=t.originalEvent,i=e.type;if(i===Vh||i===x||i===f){const t=this.getOwnerDocument(),i=this.viewport_.getRootNode?this.viewport_.getRootNode():t,n=e.target,s=i instanceof ShadowRoot?i.host===n?i.host.ownerDocument:i:i===t?t.documentElement:i;if(this.overlayContainerStopEvent_.contains(n)||!s.contains(n))return}if(t.frameState=this.frameState_,!1!==this.dispatchEvent(t)){const e=this.getInteractions().getArray().slice();for(let i=e.length-1;i>=0;i--){const n=e[i];if(n.getMap()!==this||!n.getActive()||!this.getTargetElement())continue;if(!n.handleEvent(t)||t.propagationStopped)break}}}handlePostRender(){const t=this.frameState_,e=this.tileQueue_;if(!e.isEmpty()){let i=this.maxTilesLoading_,n=i;const s=t?t.viewHints:void 0;if(!!s&&(s[lo]||s[ho])){const e=Date.now()-t.time>8;i=e?0:8,n=e?0:2}if(e.getTilesLoading()<i){const t=e.getCount();e.reprioritize(),e.getCount()<t&&this.updateRenderComplete_(),e.loadMoreTiles(i,n)}}t&&this.renderer_&&!t.animate&&(this.renderComplete_?(this.hasListener(ur)&&this.renderer_.dispatchRenderEvent(ur,t),!1===this.loaded_&&(this.loaded_=!0,this.dispatchEvent(new Wh(Qh,this,t)))):!0===this.loaded_&&(this.loaded_=!1,this.dispatchEvent(new Wh(Jh,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_){const t=this.targetChangeHandlerKeys_;for(let e=0,i=t.length;e<i;++e)l(t[e]);this.targetChangeHandlerKeys_=null;const e=this.getOwnerDocument();e.removeEventListener(f,this.boundHandleCtrlKey_,!0),e.removeEventListener(p,this.boundHandleCtrlKey_,!0),this.ctrlKey_=!1,this.viewport_.removeEventListener(u,this.boundHandleBrowserEvent_),this.viewport_.removeEventListener(x,this.boundHandleBrowserEvent_),this.mapBrowserEventHandler_.dispose(),this.mapBrowserEventHandler_=null,this.viewport_.remove()}if(this.targetElement_&&!Xn(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(Xn(e)||e.appendChild(this.viewport_),this.renderer_||(this.renderer_=new eu(this)),!Xn(e)){this.mapBrowserEventHandler_=new Uh(this,this.moveTolerance_);for(const t in Zh)this.mapBrowserEventHandler_.addEventListener(Zh[t],this.handleMapBrowserEvent.bind(this));this.viewport_.addEventListener(u,this.boundHandleBrowserEvent_,!1),this.viewport_.addEventListener(x,this.boundHandleBrowserEvent_,!!vn&&{passive:!1});const t=this.getOwnerDocument();let i;if(t.addEventListener(f,this.boundHandleCtrlKey_,!0),t.addEventListener(p,this.boundHandleCtrlKey_,!0),this.keyboardEventTarget_)i=this.keyboardEventTarget_;else{const t=e.getRootNode();i=t instanceof ShadowRoot?t.host:e}if(this.targetChangeHandlerKeys_=[o(i,f,this.handleBrowserEvent,this),o(i,_,this.handleBrowserEvent,this)],!Xn(e)){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_&&(l(this.viewPropertyListenerKey_),this.viewPropertyListenerKey_=null),this.viewChangeListenerKey_&&(l(this.viewChangeListenerKey_),this.viewChangeListenerKey_=null);const t=this.getView();t&&(this.updateViewportSize_(this.getSize()),this.viewPropertyListenerKey_=o(t,n,this.handleViewPropertyChanged_,this),this.viewChangeListenerKey_=o(t,h,this.handleViewPropertyChanged_,this),t.resolveConstraints(0)),this.render()}handleLayerGroupChanged_(){this.layerGroupPropertyListenerKeys_&&(this.layerGroupPropertyListenerKeys_.forEach(l),this.layerGroupPropertyListenerKeys_=null);const t=this.getLayerGroup();t&&(this.handleLayerAdd_(new $c("addlayer",t)),this.layerGroupPropertyListenerKeys_=[o(t,n,this.render,this),o(t,h,this.render,this),o(t,"addlayer",this.handleLayerAdd_,this),o(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){iu(t.layer)}removeOverlay(t){return this.getOverlays().remove(t)}renderFrame_(t){const e=this.getSize(),i=this.getView(),n=this.frameState_;let s=null;if(void 0!==e&&Jr(e)&&i&&i.isDef()){const n=i.getHints(this.frameState_?this.frameState_.viewHints:void 0),r=i.getState();if(s={animate:!1,coordinateToPixelTransform:this.coordinateToPixelTransform_,declutter:null,extent:wt(r.center,r.resolution,r.rotation,e),index:this.frameIndex_++,layerIndex:0,layerStatesArray:this.getLayerGroup().getLayerStatesArray(),pixelRatio:this.pixelRatio_,pixelToCoordinateTransform:this.pixelToCoordinateTransform_,postRenderFunctions:[],size:e,tileQueue:this.tileQueue_,time:t,usedTiles:{},viewState:r,viewHints:n,wantedTiles:{},mapId:T(this),renderTargets:{}},r.nextCenter&&r.nextResolution){const t=isNaN(r.nextRotation)?r.rotation:r.nextRotation;s.nextExtent=wt(r.nextCenter,r.nextResolution,t,e)}}if(this.frameState_=s,this.renderer_.renderFrame(s),s){if(s.animate&&this.render(),Array.prototype.push.apply(this.postRenderFunctions_,s.postRenderFunctions),n){(!this.previousExtent_||!Pt(this.previousExtent_)&&!ct(s.extent,this.previousExtent_))&&(this.dispatchEvent(new Wh($h,this,n)),this.previousExtent_=at(this.previousExtent_))}this.previousExtent_&&!s.viewHints[lo]&&!s.viewHints[ho]&&!ct(s.extent,this.previousExtent_)&&(this.dispatchEvent(new Wh(Hh,this,s)),Q(s.extent,this.previousExtent_))}this.dispatchEvent(new Wh(qh,this,s)),this.updateRenderComplete_(),this.postRenderTimeoutHandle_||(this.postRenderTimeoutHandle_=setTimeout(()=>{this.postRenderTimeoutHandle_=void 0,this.handlePostRender()},0))}setLayerGroup(t){const e=this.getLayerGroup();e&&this.handleLayerRemove_(new $c("removelayer",e)),this.set(tc,t)}setSize(t){this.set(ec,t)}setTarget(t){this.set(ic,t)}setView(t){if(!t||t instanceof Sh)return void this.set(nc,t);this.set(nc,new Sh);const e=this;t.then(function(t){e.setView(new Sh(t))})}updateSize(){const t=this.getTargetElement();let e;if(t){let i,n;if(Xn(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)],!Jr(e)&&(t.offsetWidth||t.offsetHeight||t.getClientRects().length)&&Bt("No map visible because the map container's width or height are 0."))}const i=this.getSize();!e||i&&R(e,i)||(this.updateViewportSize_(e),this.setSize(e))}updateViewportSize_(t){const e=this.getView();e&&e.setViewportSize(t)}};const ru="element",ou="map",au="offset",lu="position",hu="positioning";class cu extends N{constructor(t){super(),this.on,this.once,this.un,this.options=t,this.id=t.id,this.insertFirst=void 0===t.insertFirst||t.insertFirst,this.stopEvent=void 0===t.stopEvent||t.stopEvent,this.element=document.createElement("div"),this.element.className=void 0!==t.className?t.className:"ol-overlay-container ol-selectable",this.element.style.position="absolute",this.element.style.pointerEvents="auto",this.autoPan=!0===t.autoPan?{}:t.autoPan||void 0,this.rendered={transform_:"",visible:!0},this.mapPostrenderListenerKey=null,this.addChangeListener(ru,this.handleElementChanged),this.addChangeListener(ou,this.handleMapChanged),this.addChangeListener(au,this.handleOffsetChanged),this.addChangeListener(lu,this.handlePositionChanged),this.addChangeListener(hu,this.handlePositioningChanged),void 0!==t.element&&this.setElement(t.element),this.setOffset(void 0!==t.offset?t.offset:[0,0]),this.setPositioning(t.positioning||"top-left"),void 0!==t.position&&this.setPosition(t.position)}getElement(){return this.get(ru)}getId(){return this.id}getMap(){return this.get(ou)||null}getOffset(){return this.get(au)}getPosition(){return this.get(lu)}getPositioning(){return this.get(hu)}handleElementChanged(){Nn(this.element);const t=this.getElement();t&&this.element.appendChild(t)}handleMapChanged(){this.mapPostrenderListenerKey&&(this.element?.remove(),l(this.mapPostrenderListenerKey),this.mapPostrenderListenerKey=null);const t=this.getMap();if(t){this.mapPostrenderListenerKey=o(t,qh,this.render,this),this.updatePixelPosition();const e=this.stopEvent?t.getOverlayContainerStopEvent():t.getOverlayContainer();e&&(this.insertFirst?e.insertBefore(this.element,e.childNodes[0]||null):e.appendChild(this.element)),this.performAutoPan()}}render(){this.updatePixelPosition()}handleOffsetChanged(){this.updatePixelPosition()}handlePositionChanged(){this.updatePixelPosition(),this.performAutoPan()}handlePositioningChanged(){this.updatePixelPosition()}setElement(t){this.set(ru,t)}setMap(t){this.set(ou,t)}setOffset(t){this.set(au,t)}setPosition(t){this.set(lu,t)}performAutoPan(){this.autoPan&&this.panIntoView(this.autoPan)}panIntoView(t){const e=this.getMap();if(!e||!e.getTargetElement()||!this.get(lu))return;const i=e.getSize(),n=this.getElement();if(!i||!n)return;const s=e.getTargetElement();if(!s)return;const r=this.getRect(s,i),o=this.getRect(n,[Dn(n),Gn(n)]),a=void 0===(t=t||{}).margin?20:t.margin;if(!it(r,o)){const i=o[0]-r[0],n=r[2]-o[2],s=o[1]-r[1],l=r[3]-o[3],h=[0,0];if(i<0?h[0]=i-a:n<0&&(h[0]=Math.abs(n)+a),s<0?h[1]=s-a:l<0&&(h[1]=Math.abs(l)+a),0!==h[0]||0!==h[1]){const i=e.getView().getCenterInternal(),n=e.getPixelFromCoordinateInternal(i);if(!n)return;const s=[n[0]+h[0],n[1]+h[1]],r=t.animation||{};e.getView().animateInternal({center:e.getCoordinateFromPixelInternal(s),duration:r.duration,easing:r.easing})}}}getRect(t,e){const i=t.getBoundingClientRect(),n=i.left+window.pageXOffset,s=i.top+window.pageYOffset;return[n,s,n+e[0],s+e[1]]}setPositioning(t){this.set(hu,t)}setVisible(t){this.rendered.visible!==t&&(this.element.style.display=t?"":"none",this.rendered.visible=t)}updatePixelPosition(){const t=this.getMap(),e=this.getPosition();if(!t||!t.isRendered()||!e)return void this.setVisible(!1);const i=t.getPixelFromCoordinate(e,{wrapX:!0}),n=t.getSize();this.updateRenderedPosition(i,n)}updateRenderedPosition(t,e){const i=this.element.style,n=this.getOffset(),s=this.getPositioning();this.setVisible(!0);let r="0%",o="0%";"bottom-right"==s||"center-right"==s||"top-right"==s?r="-100%":"bottom-center"!=s&&"center-center"!=s&&"top-center"!=s||(r="-50%"),"bottom-left"==s||"bottom-center"==s||"bottom-right"==s?o="-100%":"center-left"!=s&&"center-center"!=s&&"center-right"!=s||(o="-50%");const a=`translate(${r}, ${o}) translate(${`${t[0]+n[0]}px`}, ${`${t[1]+n[1]}px`})`;this.rendered.transform_!=a&&(this.rendered.transform_=a,i.transform=a)}getOptions(){return this.options}}class uu{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 du(t,e,i,n,s){return void 0!==s?(s.minX=t,s.maxX=e,s.minY=i,s.maxY=n,s):new uu(t,e,i,n)}class gu extends Ci{constructor(t){super(),this.geometries_=t,this.changeEventsKeys_=[],this.listenGeometriesChange_()}unlistenGeometriesChange_(){this.changeEventsKeys_.forEach(l),this.changeEventsKeys_.length=0}listenGeometriesChange_(){const t=this.geometries_;for(let e=0,i=t.length;e<i;++e)this.changeEventsKeys_.push(o(t[e],h,this.changed,this))}clone(){const t=new gu(fu(this.geometries_));return t.applyProperties(this),t}closestPointXY(t,e,i,n){if(n<tt(this.getExtent(),t,e))return n;const s=this.geometries_;for(let r=0,o=s.length;r<o;++r)n=s[r].closestPointXY(t,e,i,n);return n}containsXY(t,e){const i=this.geometries_;for(let n=0,s=i.length;n<s;++n)if(i[n].containsXY(t,e))return!0;return!1}computeExtent(t){at(t);const e=this.geometries_;for(let i=0,n=e.length;i<n;++i)ut(t,e[i].getExtent());return t}getGeometries(){return fu(this.geometries_)}getGeometriesArray(){return this.geometries_}getGeometriesArrayRecursive(){let t=[];const e=this.geometries_;for(let i=0,n=e.length;i<n;++i)e[i].getType()===this.getType()?t=t.concat(e[i].getGeometriesArrayRecursive()):t.push(e[i]);return t}getSimplifiedGeometry(t){if(this.simplifiedGeometryRevision!==this.getRevision()&&(this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=this.getRevision()),t<0||0!==this.simplifiedGeometryMaxMinSquaredTolerance&&t<this.simplifiedGeometryMaxMinSquaredTolerance)return this;const e=[],i=this.geometries_;let n=!1;for(let s=0,r=i.length;s<r;++s){const r=i[s],o=r.getSimplifiedGeometry(t);e.push(o),o!==r&&(n=!0)}if(n){return new gu(e)}return this.simplifiedGeometryMaxMinSquaredTolerance=t,this}getType(){return"GeometryCollection"}intersectsExtent(t){const e=this.geometries_;for(let i=0,n=e.length;i<n;++i)if(e[i].intersectsExtent(t))return!0;return!1}isEmpty(){return 0===this.geometries_.length}rotate(t,e){const i=this.geometries_;for(let n=0,s=i.length;n<s;++n)i[n].rotate(t,e);this.changed()}scale(t,e,i){i||(i=xt(this.getExtent()));const n=this.geometries_;for(let s=0,r=n.length;s<r;++s)n[s].scale(t,e,i);this.changed()}setGeometries(t){this.setGeometriesArray(fu(t))}setGeometriesArray(t){this.unlistenGeometriesChange_(),this.geometries_=t,this.listenGeometriesChange_(),this.changed()}applyTransform(t){const e=this.geometries_;for(let i=0,n=e.length;i<n;++i)e[i].applyTransform(t);this.changed()}translate(t,e){const i=this.geometries_;for(let n=0,s=i.length;n<s;++n)i[n].translate(t,e);this.changed()}disposeInternal(){this.unlistenGeometriesChange_(),super.disposeInternal()}}function fu(t){return t.map(t=>t.clone())}class _u{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 v&&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 W(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 W(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){W(!(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}}function pu(t,e,i,n){return void 0!==n?(n[0]=t,n[1]=e,n[2]=i,n):[t,e,i]}function mu(t,e,i,n,s){return`${T(t)},${e},${function(t,e,i){return t+"/"+e+"/"+i}(i,n,s)}`}const yu=/\{z\}/g,xu=/\{x\}/g,vu=/\{y\}/g,wu=/\{-y\}/g;let Cu;const Su=[];function Eu(t,e,i,n,s){t.beginPath(),t.moveTo(0,0),t.lineTo(e,i),t.lineTo(n,s),t.closePath(),t.save(),t.clip(),t.fillRect(0,0,Math.max(e,n)+1,Math.max(i,s)),t.restore()}function bu(t,e){return Math.abs(t[4*e]-210)>2||Math.abs(t[4*e+3]-191.25)>2}function Ru(t,e,i,n){const s=ni(i,e,t);let r=qe(e,n,i);const o=e.getMetersPerUnit();void 0!==o&&(r*=o);const a=t.getMetersPerUnit();void 0!==a&&(r/=a);const l=t.getExtent();if(!l||et(l,s)){const e=qe(t,r,s)/r;isFinite(e)&&e>0&&(r/=e)}return r}function Iu(t,e,i,n,s,r,o,a,l,h,c,u,d,g){const f=Ln(Math.round(i*t),Math.round(i*e),Su);if(u||(f.imageSmoothingEnabled=!1),0===l.length)return f.canvas;function _(t){return Math.round(t*i)/i}f.scale(i,i),f.globalCompositeOperation="lighter";const p=[1/0,1/0,-1/0,-1/0];let m;l.forEach(function(t,e,i){ut(p,t.extent)});const y=i/n,x=(u?1:1+Math.pow(2,-24))/y;{const t=Ln(Math.round(Mt(p)*y),Math.round(St(p)*y),Su);m=t,u||(t.imageSmoothingEnabled=!1),l.forEach(function(e,i,n){if(e.image.width>0&&e.image.height>0){if(e.clipExtent){t.save();const i=(e.clipExtent[0]-p[0])*y,n=-(e.clipExtent[3]-p[3])*y,s=Mt(e.clipExtent)*y,r=St(e.clipExtent)*y;t.rect(u?i:Math.round(i),u?n:Math.round(n),u?s:Math.round(i+s)-Math.round(i),u?r:Math.round(n+r)-Math.round(n)),t.clip()}const i=(e.extent[0]-p[0])*y,n=-(e.extent[3]-p[3])*y,s=Mt(e.extent)*y,r=St(e.extent)*y;t.drawImage(e.image,h,h,e.image.width-2*h,e.image.height-2*h,u?i:Math.round(i),u?n:Math.round(n),u?s:Math.round(i+s)-Math.round(i),u?r:Math.round(n+r)-Math.round(n)),e.clipExtent&&t.restore()}})}const v=Rt(o);return a.getTriangles().forEach(function(t,e,i){const n=t.source,s=t.target;let o=n[0][0],a=n[0][1],h=n[1][0],c=n[1][1],d=n[2][0],g=n[2][1];const y=_((s[0][0]-v[0])/r),w=_(-(s[0][1]-v[1])/r),C=_((s[1][0]-v[0])/r),S=_(-(s[1][1]-v[1])/r),E=_((s[2][0]-v[0])/r),b=_(-(s[2][1]-v[1])/r),R=o,I=a;o=0,a=0,h-=R,c-=I,d-=R,g-=I;const M=function(t){const e=t.length;for(let i=0;i<e;i++){let n=i,s=Math.abs(t[i][i]);for(let r=i+1;r<e;r++){const e=Math.abs(t[r][i]);e>s&&(s=e,n=r)}if(0===s)return null;const r=t[n];t[n]=t[i],t[i]=r;for(let n=i+1;n<e;n++){const s=-t[n][i]/t[i][i];for(let r=i;r<e+1;r++)i==r?t[n][r]=0:t[n][r]+=s*t[i][r]}}const i=new Array(e);for(let n=e-1;n>=0;n--){i[n]=t[n][e]/t[n][n];for(let s=n-1;s>=0;s--)t[s][e]-=t[s][n]*i[n]}return i}([[h,c,0,0,C-y],[d,g,0,0,E-y],[0,0,h,c,S-w],[0,0,d,g,b-w]]);if(!M)return;if(f.save(),f.beginPath(),function(){if(void 0===Cu){const t=Ln(6,6,Su);t.globalCompositeOperation="lighter",t.fillStyle="rgba(210, 0, 0, 0.75)",Eu(t,4,5,4,0),Eu(t,4,5,0,5);const e=t.getImageData(0,0,3,3).data;Cu=bu(e,0)||bu(e,4)||bu(e,8),On(t),Su.push(t.canvas)}return Cu}()||!u){f.moveTo(C,S);const t=4,e=y-C,i=w-S;for(let n=0;n<t;n++)f.lineTo(C+_((n+1)*e/t),S+_(n*i/(t-1))),n!=t-1&&f.lineTo(C+_((n+1)*e/t),S+_((n+1)*i/(t-1)));f.lineTo(E,b)}else f.moveTo(C,S),f.lineTo(y,w),f.lineTo(E,b);let T;if(f.clip(),f.transform(M[0],M[2],M[1],M[3],y,w),f.translate(p[0]-R,p[3]-I),m)T=m.canvas,f.scale(x,-x);else{const t=l[0],e=t.extent;T=t.image,f.scale(Mt(e)/T.width,-St(e)/T.height)}f.drawImage(T,0,0),f.restore()}),m&&(On(m),Su.push(m.canvas)),c&&(f.save(),f.globalCompositeOperation="source-over",f.strokeStyle="black",f.lineWidth=1,a.getTriangles().forEach(function(t,e,i){const n=t.target,s=(n[0][0]-v[0])/r,o=-(n[0][1]-v[1])/r,a=(n[1][0]-v[0])/r,l=-(n[1][1]-v[1])/r,h=(n[2][0]-v[0])/r,c=-(n[2][1]-v[1])/r;f.beginPath(),f.moveTo(a,l),f.lineTo(s,o),f.lineTo(h,c),f.closePath(),f.stroke()}),f.restore()),f.canvas}class Mu{constructor(t,e,i,n,s,r,o){this.sourceProj_=t,this.targetProj_=e;let a={};const l=o?(h=t=>gi(o,ni(t,this.targetProj_,this.sourceProj_)),function(t,e,i,n){const s=t.length;i=void 0!==i?i:2,n=n??i,e=void 0!==e?e:new Array(s);for(let r=0;r<s;r+=n){const s=h(t.slice(r,r+i)),o=s.length;for(let i=0,a=n;i<a;++i)e[r+i]=i>=o?t[r+i]:s[i]}return e}):ii(this.targetProj_,this.sourceProj_);var h;this.transformInv_=function(t){const e=t[0]+"/"+t[1];return a[e]||(a[e]=l(t)),a[e]},this.maxSourceExtent_=n,this.errorThresholdSquared_=s*s,this.triangles_=[],this.wrapsXInSource_=!1,this.canWrapXInSource_=this.sourceProj_.canWrapX()&&!!n&&!!this.sourceProj_.getExtent()&&Mt(n)>=Mt(this.sourceProj_.getExtent()),this.sourceWorldWidth_=this.sourceProj_.getExtent()?Mt(this.sourceProj_.getExtent()):void 0,this.targetWorldWidth_=this.targetProj_.getExtent()?Mt(this.targetProj_.getExtent()):void 0;const c=Rt(i),u=It(i),d=yt(i),g=mt(i),f=this.transformInv_(c),_=this.transformInv_(u),p=this.transformInv_(d),m=this.transformInv_(g),y=10+(r?Math.max(0,Math.ceil(Math.log2(pt(i)/(r*r*256*256)))):0);if(this.addQuad_(c,u,d,g,f,_,p,m,y),this.wrapsXInSource_){const t=this.sourceWorldWidth_;if(!t)return;let e=1/0;this.triangles_.forEach(function(t,i,n){e=Math.min(e,t.source[0][0],t.source[1][0],t.source[2][0])}),this.triangles_.forEach(i=>{if(Math.max(i.source[0][0],i.source[1][0],i.source[2][0])-e>t/2){const n=[[i.source[0][0],i.source[0][1]],[i.source[1][0],i.source[1][1]],[i.source[2][0],i.source[2][1]]];n[0][0]-e>t/2&&(n[0][0]-=t),n[1][0]-e>t/2&&(n[1][0]-=t),n[2][0]-e>t/2&&(n[2][0]-=t);const s=Math.min(n[0][0],n[1][0],n[2][0]);Math.max(n[0][0],n[1][0],n[2][0])-s<t/2&&(i.source=n)}})}a={}}addTriangle_(t,e,i,n,s,r){this.triangles_.push({source:[n,s,r],target:[t,e,i]})}addQuad_(t,e,i,n,s,r,o,a,l){const h=H([s,r,o,a]),c=this.sourceWorldWidth_,u=c?Mt(h)/c:void 0,d=this.sourceProj_.canWrapX()&&void 0!==u&&u>.5&&u<1;let g=!1;if(l>0){if(this.targetProj_.isGlobal()&&this.targetWorldWidth_){g=Mt(H([t,e,i,n]))/this.targetWorldWidth_>.25||g}!d&&this.sourceProj_.isGlobal()&&u&&(g=u>.25||g)}if(!g&&this.maxSourceExtent_&&isFinite(h[0])&&isFinite(h[1])&&isFinite(h[2])&&isFinite(h[3])&&!Tt(h,this.maxSourceExtent_))return;let f=0;if(!(g||isFinite(s[0])&&isFinite(s[1])&&isFinite(r[0])&&isFinite(r[1])&&isFinite(o[0])&&isFinite(o[1])&&isFinite(a[0])&&isFinite(a[1])))if(l>0)g=!0;else if(f=(isFinite(s[0])&&isFinite(s[1])?0:8)+(isFinite(r[0])&&isFinite(r[1])?0:4)+(isFinite(o[0])&&isFinite(o[1])?0:2)+(isFinite(a[0])&&isFinite(a[1])?0:1),1!=f&&2!=f&&4!=f&&8!=f)return;if(l>0){if(!g){const e=[(t[0]+i[0])/2,(t[1]+i[1])/2],n=this.transformInv_(e);let r;if(d){const t=c;r=(Nt(s[0],t)+Nt(o[0],t))/2-Nt(n[0],t)}else r=(s[0]+o[0])/2-n[0];const a=(s[1]+o[1])/2-n[1];g=r*r+a*a>this.errorThresholdSquared_}if(g){if(Math.abs(t[0]-i[0])<=Math.abs(t[1]-i[1])){const h=[(e[0]+i[0])/2,(e[1]+i[1])/2],c=this.transformInv_(h),u=[(n[0]+t[0])/2,(n[1]+t[1])/2],d=this.transformInv_(u);this.addQuad_(t,e,h,u,s,r,c,d,l-1),this.addQuad_(u,h,i,n,d,c,o,a,l-1)}else{const h=[(t[0]+e[0])/2,(t[1]+e[1])/2],c=this.transformInv_(h),u=[(i[0]+n[0])/2,(i[1]+n[1])/2],d=this.transformInv_(u);this.addQuad_(t,h,u,n,s,c,d,a,l-1),this.addQuad_(h,e,i,u,c,r,o,d,l-1)}return}}if(d){if(!this.canWrapXInSource_)return;this.wrapsXInSource_=!0}11&f||this.addTriangle_(t,i,n,s,o,a),14&f||this.addTriangle_(t,i,e,s,o,r),f&&(13&f||this.addTriangle_(e,n,t,r,a,s),7&f||this.addTriangle_(e,n,i,r,a,o))}calculateSourceExtent(){const t=[1/0,1/0,-1/0,-1/0];return this.triangles_.forEach(function(e,i,n){const s=e.source;dt(t,s[0]),dt(t,s[1]),dt(t,s[2])}),t}getTriangles(){return this.triangles_}}const Tu=[0,0,0];class Pu{constructor(t){let e=t.minZoom;const i=t.resolutions;let n;if(void 0===e&&i&&(e=i.findIndex(t=>void 0!==t)),this.minZoom=void 0!==e?e:0,this.resolutions_=i,W(function(t,e){const i=e||w;return t.every(function(e,n){if(0===n)return!0;const s=i(t[n-1],e);return!(s>0||0===s)})}(this.resolutions_,(t,e)=>e-t),"`resolutions` must be sorted in descending order"),!t.origins)for(let t=0,e=this.resolutions_.length-1;t<e;++t)if(n){if(this.resolutions_[t]/this.resolutions_[t+1]!==n){n=void 0;break}}else n=this.resolutions_[t]/this.resolutions_[t+1];this.zoomFactor_=n,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,W(this.origins_.length==this.resolutions_.length,"Number of `origins` and `resolutions` must be equal"));const s=t.extent;void 0===s||this.origin_||this.origins_||(this.origin_=Rt(s)),W(!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,W(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:Ch,W(!this.tileSize_&&this.tileSizes_||this.tileSize_&&!this.tileSizes_,"Either `tileSize` or `tileSizes` must be configured, never both"),this.extent_=void 0!==s?s:null,this.fullTileRanges_=null,this.tmpSize_=[0,0],this.tmpExtent_=[0,0,0,0],void 0!==t.tileRanges?this.fullTileRanges_=t.tileRanges:void 0!==t.sizes?this.fullTileRanges_=t.sizes.map((t,e)=>{const i=new uu(Math.min(0,t[0]),Math.max(t[0]-1,-1),Math.min(0,t[1]),Math.max(t[1]-1,-1));if(s){const t=this.getTileRangeForExtentAndZ(s,e);i.minX=Math.max(t.minX,i.minX),i.maxX=Math.min(t.maxX,i.maxX),i.minY=Math.max(t.minY,i.minY),i.maxY=Math.min(t.maxY,i.maxY)}return i}):s&&this.calculateTileRanges_(s)}forEachTileCoord(t,e,i){const n=this.getTileRangeForExtentAndZ(t,e);for(let t=n.minX,s=n.maxX;t<=s;++t)for(let s=n.minY,r=n.maxY;s<=r;++s)i([e,t,s])}forEachTileCoordParentTileRange(t,e,i,n){let s,r,o,a=null,l=t[0]-1;for(2===this.zoomFactor_?(r=t[1],o=t[2]):a=this.getTileCoordExtent(t,n);l>=this.minZoom;){if(void 0!==r&&void 0!==o?(r=Math.floor(r/2),o=Math.floor(o/2),s=du(r,r,o,o,i)):s=this.getTileRangeForExtentAndZ(a,l,i),e(l,s))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_?this.origins_[t]:[0,0]}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 du(i,i+1,n,n+1,e)}const n=this.getTileCoordExtent(t,i||this.tmpExtent_);return this.getTileRangeForExtentAndZ(n,t[0]+1,e)}return null}getTileRangeForTileCoordAndZ(t,e,i){if(e>this.maxZoom||e<this.minZoom)return null;const n=t[0],s=t[1],r=t[2];if(e===n)return du(s,s,r,r,i);if(this.zoomFactor_){const t=Math.pow(this.zoomFactor_,e-n),o=Math.floor(s*t),a=Math.floor(r*t);if(e<n)return du(o,o,a,a,i);return du(o,Math.floor(t*(s+1))-1,a,Math.floor(t*(r+1))-1,i)}const o=this.getTileCoordExtent(t,this.tmpExtent_);return this.getTileRangeForExtentAndZ(o,e,i)}getTileRangeForExtentAndZ(t,e,i){this.getTileCoordForXYAndZ_(t[0],t[3],e,!1,Tu);const n=Tu[1],s=Tu[2];this.getTileCoordForXYAndZ_(t[2],t[1],e,!0,Tu);return du(n,Tu[1],s,Tu[2],i)}getTileCoordCenter(t){const e=this.getOrigin(t[0]),i=this.getResolution(t[0]),n=Qr(this.getTileSize(t[0]),this.tmpSize_);return[e[0]+(t[1]+.5)*n[0]*i,e[1]-(t[2]+.5)*n[1]*i]}getTileCoordExtent(t,e){const i=this.getOrigin(t[0]),n=this.getResolution(t[0]),s=Qr(this.getTileSize(t[0]),this.tmpSize_),r=i[0]+t[1]*s[0]*n,o=i[1]-(t[2]+1)*s[1]*n;return ot(r,o,r+s[0]*n,o+s[1]*n,e)}getTileCoordForCoordAndResolution(t,e,i){return this.getTileCoordForXYAndResolution_(t[0],t[1],e,!1,i)}getTileCoordForXYAndResolution_(t,e,i,n,s){const r=this.getZForResolution(i),o=i/this.getResolution(r),a=this.getOrigin(r),l=Qr(this.getTileSize(r),this.tmpSize_);let h=o*(t-a[0])/i/l[0],c=o*(a[1]-e)/i/l[1];return n?(h=Wt(h,5)-1,c=Wt(c,5)-1):(h=Kt(h,5),c=Kt(c,5)),pu(r,h,c,s)}getTileCoordForXYAndZ_(t,e,i,n,s){const r=this.getOrigin(i),o=this.getResolution(i),a=Qr(this.getTileSize(i),this.tmpSize_);let l=(t-r[0])/o/a[0],h=(r[1]-e)/o/a[1];return n?(l=Wt(l,5)-1,h=Wt(h,5)-1):(l=Kt(l,5),h=Kt(h,5)),pu(i,l,h,s)}getTileCoordForCoordAndZ(t,e,i){return this.getTileCoordForXYAndZ_(t[0],t[1],e,!1,i)}getTileCoordResolution(t){return this.resolutions_[t[0]]}getTileSize(t){return this.tileSize_?this.tileSize_:this.tileSizes_?this.tileSizes_[t]:Ch}getFullTileRange(t){return this.fullTileRanges_?this.fullTileRanges_[t]:this.extent_?this.getTileRangeForExtentAndZ(this.extent_,t):null}getZForResolution(t,e){return At(S(this.resolutions_,t,e||0),this.minZoom,this.maxZoom)}tileCoordIntersectsViewport(t,e){return Yi(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 Fu(t){let e=t.getDefaultTileGrid();return e||(e=function(t,e,i,n){const s=ku(t);return function(t,e,i,n){n=void 0!==n?n:"top-left";const s=Lu(t,e,i);return new Pu({extent:t,origin:vt(t,n),resolutions:s,tileSize:i})}(s,e,i,n)}(t),t.setDefaultTileGrid(e)),e}function Lu(t,e,i,n){e=void 0!==e?e:42,i=Qr(void 0!==i?i:Ch);const s=St(t),r=Mt(t);n=void 0!==n&&n>0?n:Math.max(r/i[0],s/i[1]);const o=e+1,a=new Array(o);for(let t=0;t<o;++t)a[t]=n/Math.pow(2,t);return a}function ku(t){const e=Ue(t);if(!e)throw new Error("Unable to determine extent from unknown projection");let i=e.getExtent();if(!i){const t=e.getMetersPerUnit();if(void 0===t)throw new Error("Unable to determine extent from projection without units");const n=180*Jt.degrees/t;i=ot(-n,-n,n,n)}return i}function Au(t,e){return function(i,n,s){if(!i)return;let r;const o=i[0];if(e){const t=e.getFullTileRange(o);t&&(r=t.getHeight()-1)}return function(t,e,i,n,s){return t.replace(yu,e.toString()).replace(xu,i.toString()).replace(vu,n.toString()).replace(wu,function(){if(void 0===s)throw new Error("If the URL template has a {-y} placeholder, the grid extent must be known");return(s-n).toString()})}(t,o,i[1],i[2],r)}}function Ou(t,e){const i=t.length,n=new Array(i);for(let s=0;s<i;++s)n[s]=Au(t[s],e);return function(t){if(1===t.length)return t[0];return function(e,i,n){if(!e)return;const s=function(t){return e=t[0],i=t[1],n=t[2],(i<<e)+n;var e,i,n}(e),r=Nt(s,t.length);return t[r](e,i,n)}}(n)}class Du extends Fn{constructor(t,e,i,n,s,r,o,a,l,h,c,u){super(s,Cn,u),this.renderEdges_=void 0!==c&&c,this.pixelRatio_=o,this.gutter_=a,this.canvas_=null,this.sourceTileGrid_=e,this.targetTileGrid_=n,this.wrappedTileCoord_=r||s,this.sourceTiles_=[],this.sourcesListenerKeys_=null,this.sourceZ_=0,this.clipExtent_=t.canWrapX()&&t.getExtent()||void 0;const d=n.getTileCoordExtent(this.wrappedTileCoord_),g=this.targetTileGrid_.getExtent();let f=this.sourceTileGrid_.getExtent();const _=g?Et(d,g):d;if(0===pt(_))return void(this.state=Rn);const p=t.getExtent();p&&(f=f?Et(f,p):p);const m=n.getResolution(this.wrappedTileCoord_[0]),y=function(t,e,i,n){const s=xt(i);let r=Ru(t,e,s,n);return(!isFinite(r)||r<=0)&&_t(i,function(i){return r=Ru(t,e,i,n),isFinite(r)&&r>0}),r}(t,i,_,m);if(!isFinite(y)||y<=0)return void(this.state=Rn);const x=void 0!==h?h:.5;if(this.triangulation_=new Mu(t,i,_,f||void 0,y*x,m),0===this.triangulation_.getTriangles().length)return void(this.state=Rn);this.sourceZ_=e.getZForResolution(y);let v=this.triangulation_.calculateSourceExtent();if(f&&(t.canWrapX()?(v[1]=At(v[1],f[1],f[3]),v[3]=At(v[3],f[1],f[3])):v=Et(v,f)),pt(v)){let i=0,n=0;t.canWrapX()&&(i=Mt(p),n=Math.floor((v[0]-p[0])/i));Lt(v.slice(),t,!0).forEach(t=>{const s=e.getTileRangeForExtentAndZ(t,this.sourceZ_);for(let t=s.minX;t<=s.maxX;t++)for(let e=s.minY;e<=s.maxY;e++){const s=n*i;this.sourceTiles_.push({getTile:()=>l(this.sourceZ_,t,e,o),offset:s})}++n}),0===this.sourceTiles_.length&&(this.state=Rn)}else this.state=Rn}getImage(){return this.canvas_}reproject_(){const t=[];if(this.sourceTiles_.forEach(e=>{const i=e.tile;if(i&&i.getState()==En){const n=this.sourceTileGrid_.getTileCoordExtent(i.tileCoord);n[0]+=e.offset,n[2]+=e.offset;const s=this.clipExtent_?.slice();s&&(s[0]+=e.offset,s[2]+=e.offset);const r=i.getImage();if(!r)return;t.push({extent:n,clipExtent:s,image:r})}}),this.sourceTiles_.length=0,0===t.length)this.state=bn;else{const e=this.wrappedTileCoord_[0],i=this.targetTileGrid_.getTileSize(e),n="number"==typeof i?i:i[0],s="number"==typeof i?i:i[1],r=this.targetTileGrid_.getResolution(e),o=this.sourceTileGrid_.getResolution(this.sourceZ_),a=this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_);this.canvas_=Iu(n,s,this.pixelRatio_,o,this.sourceTileGrid_.getExtent(),r,a,this.triangulation_,t,this.gutter_,this.renderEdges_,this.interpolate),this.state=En}this.changed()}load(){for(const t of this.sourceTiles_)t.tile=t.getTile();if(this.state==Cn){this.state=Sn,this.changed();let t=0;this.sourcesListenerKeys_=[],this.sourceTiles_.forEach(e=>{const i=e.tile;if(!i)return;const n=i.getState();if(n==Cn||n==Sn){t++;const e=o(i,h,()=>{const n=i.getState();n!=En&&n!=bn&&n!=Rn||(l(e),t--,0===t&&(this.unlistenSources_(),this.reproject_()))});this.sourcesListenerKeys_.push(e)}}),0===t?setTimeout(this.reproject_.bind(this),0):this.sourceTiles_.forEach(function(t){const e=t.tile;if(!e)return;e.getState()==Cn&&e.load()})}}unlistenSources_(){this.sourcesListenerKeys_&&(this.sourcesListenerKeys_.forEach(l),this.sourcesListenerKeys_=null)}release(){this.canvas_&&(On(this.canvas_.getContext("2d")),Su.push(this.canvas_),this.canvas_=null),this.sourceTiles_.length=0,super.release()}}class Gu extends Nr{constructor(t){super({attributions:t.attributions,attributionsCollapsible:t.attributionsCollapsible,projection:t.projection,state:t.state,wrapX:t.wrapX,interpolate:t.interpolate}),this.on,this.once,this.un,this.tilePixelRatio_=void 0!==t.tilePixelRatio?t.tilePixelRatio:1,this.tileGrid=void 0!==t.tileGrid?t.tileGrid:null;const e=[256,256];this.tileGrid&&Qr(this.tileGrid.getTileSize(this.tileGrid.getMinZoom()),e),this.tmpSize=[0,0],this.key_=t.key||T(this),this.tileOptions={transition:t.transition,interpolate:t.interpolate},this.zDirection=t.zDirection?t.zDirection:0}getGutterForProjection(t){return 0}getKey(){return this.key_}setKey(t){this.key_!==t&&(this.key_=t,this.changed())}getResolutions(t){const e=t?this.getTileGridForProjection(t):this.tileGrid;return e?e.getResolutions():null}getTile(t,e,i,n,s,r){return I()}getTileGrid(){return this.tileGrid}getTileGridForProjection(t){return this.tileGrid?this.tileGrid:Fu(t)}getTilePixelRatio(t){return this.tilePixelRatio_}getTilePixelSize(t,e,i){const n=this.getTileGridForProjection(i),s=this.getTilePixelRatio(e),r=Qr(n.getTileSize(t),this.tmpSize);return 1==s?r:(o=r,a=s,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],s=t.getTileCoordCenter(e),r=ku(i);if(!et(r,s)){const e=Mt(r),i=Math.ceil((r[0]-s[0])/e);return s[0]+=e*i,t.getTileCoordForCoordAndZ(s,n)}return e}(n,t,i)),function(t,e){const i=t[0],n=t[1],s=t[2];if(e.getMinZoom()>i||i>e.getMaxZoom())return!1;const r=e.getFullTileRange(i);return!r||r.containsXY(n,s)}(t,n)?t:null}clear(){}refresh(){this.clear(),super.refresh()}}class zu extends O{constructor(t,e){super(t),this.tile=e}}var Nu="tileloadstart",ju="tileloadend",Xu="tileloaderror";class Ku extends Gu{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===Ku.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=T(e),n=e.getState();let s;n==Sn?(this.tileLoadingKeys_[i]=!0,s=Nu):i in this.tileLoadingKeys_&&(delete this.tileLoadingKeys_[i],s=n==bn?Xu:n==En?ju:void 0),null!=s&&this.dispatchEvent(new zu(s,e))}setTileLoadFunction(t){this.tileLoadFunction=t,this.changed()}setTileUrlFunction(t,e){this.tileUrlFunction=t,void 0!==e?this.setKey(e):this.changed()}setUrl(t){const e=function(t){const e=[];let i=/\{([a-z])-([a-z])\}/.exec(t);if(i){const n=i[1].charCodeAt(0),s=i[2].charCodeAt(0);let r;for(r=n;r<=s;++r)e.push(t.replace(i[0],String.fromCharCode(r)));return e}if(i=/\{(\d+)-(\d+)\}/.exec(t),i){const n=parseInt(i[2],10);for(let s=parseInt(i[1],10);s<=n;s++)e.push(t.replace(i[0],s.toString()));return e}return e.push(t),e}(t);this.urls=e,this.setUrls(e)}setUrls(t){this.urls=t;const e=t.join("\n");this.generateTileUrlFunction_?this.setTileUrlFunction(Ou(t,this.tileGrid),e):this.setKey(e)}tileUrlFunction(t,e,i){}}class Wu extends Ku{constructor(t){super({attributions:t.attributions,cacheSize:t.cacheSize,projection:t.projection,state:t.state,tileGrid:t.tileGrid,tileLoadFunction:t.tileLoadFunction?t.tileLoadFunction:Yu,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:Kn,this.tileGridForProjection={},this.reprojectionErrorThreshold_=t.reprojectionErrorThreshold,this.renderReprojectionEdges_=!1}getGutterForProjection(t){const e=this.getProjection();return e&&t&&!Qe(e,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||Qe(e,t)))return this.tileGrid;const i=T(t);return i in this.tileGridForProjection||(this.tileGridForProjection[i]=Fu(t)),this.tileGridForProjection[i]}createTile_(t,e,i,n,s,r){const o=[t,e,i],a=this.getTileCoordForTileUrlFunction(o,s),l=a?this.tileUrlFunction(a,n,s):void 0,c=new this.tileClass(o,void 0!==l?Cn:Rn,void 0!==l?l:"",{crossOrigin:this.crossOrigin,referrerPolicy:this.referrerPolicy},this.tileLoadFunction,this.tileOptions);return c.key=r,c.addEventListener(h,this.handleTileChange.bind(this)),c}getTile(t,e,i,n,s,r){const o=this.getProjection();if(!o||!s||Qe(o,s))return this.getTileInternal(t,e,i,n,o||s);const a=[t,e,i],l=this.getKey(),h=this.getTileGridForProjection(o),c=this.getTileGridForProjection(s),u=this.getTileCoordForTileUrlFunction(a,s)||a,d=new Du(o,h,s,c,a,u,this.getTilePixelRatio(n),this.getGutter(),(t,e,i,n)=>this.getTileInternal(t,e,i,n,o,r),this.reprojectionErrorThreshold_,this.renderReprojectionEdges_,this.tileOptions);return d.key=l,d}getTileInternal(t,e,i,n,s,r){const o=this.getKey(),a=mu(this,o,t,e,i);if(r&&r.containsKey(a)){return r.get(a)}const l=this.createTile_(t,e,i,n,s,o);return r?.set(a,l),l}setRenderReprojectionEdges(t){this.renderReprojectionEdges_!=t&&(this.renderReprojectionEdges_=t,this.changed())}setTileGridForProjection(t,e){const i=Ue(t);if(i){const t=T(i);t in this.tileGridForProjection||(this.tileGridForProjection[t]=e)}}}function Yu(t,e){if(yn){const i=t.getCrossOrigin();let n="same-origin",s="same-origin";"anonymous"===i||""===i?(n="cors",s="omit"):"use-credentials"===i&&(n="cors",s="include");const r={mode:n,credentials:s,referrerPolicy:t.getReferrerPolicy()};return void fetch(e,r).then(t=>{if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.blob()}).then(t=>createImageBitmap(t)).then(e=>{const i=t.getImage();if(!i)return;i.width=e.width,i.height=e.height;const n=i.getContext("2d");n&&(n.drawImage(e,0,0),e.close?.(),i.dispatchEvent(new Event("load")))}).catch(()=>{const e=t.getImage();e?.dispatchEvent(new Event("error"))})}t.getImage().src=e}class Zu extends Wu{constructor(t){const e=void 0!==(t=t||{}).projection?t.projection:"EPSG:3857",i=void 0!==t.tileGrid?t.tileGrid:function(t){const e=t||{},i=e.extent||Ue("EPSG:3857")?.getExtent();if(!i)throw new Error("Unable to determine extent for XYZ tile grid");const n={extent:i,minZoom:e.minZoom,tileSize:e.tileSize,resolutions:Lu(i,e.maxZoom,e.tileSize,e.maxResolution)};return new Pu(n)}({extent:ku(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_}}class Bu extends qr{constructor(t){super({attributions:(t=t||{}).attributions,wrapX:t.wrapX}),this.resolution=void 0,this.distance=void 0!==t.distance?t.distance:20,this.minDistance=t.minDistance||0,this.interpolationRatio=0,this.features=[],this.geometryFunction=t.geometryFunction||function(t){const e=t.getGeometry();return W(!e||"Point"===e.getType(),"The default `geometryFunction` can only handle `Point` or null geometries"),e},this.createCustomCluster_=t.createCluster,this.source=null,this.boundRefresh_=this.refresh.bind(this),this.updateDistance(this.distance,this.minDistance),this.setSource(t.source||null)}clear(t){this.features.length=0,super.clear(t)}getDistance(){return this.distance}getSource(){return this.source}loadFeatures(t,e,i){this.source?.loadFeatures(t,e,i),e!==this.resolution&&(this.resolution=e,this.refresh())}setDistance(t){this.updateDistance(t,this.minDistance)}setMinDistance(t){this.updateDistance(this.distance,t)}getMinDistance(){return this.minDistance}setSource(t){this.source&&this.source.removeEventListener(h,this.boundRefresh_),this.source=t,t&&t.addEventListener(h,this.boundRefresh_),this.refresh()}refresh(){this.clear(),this.cluster(),this.addFeatures(this.features)}updateDistance(t,e){const i=0===t?0:Math.min(e,t)/t,n=t!==this.distance||this.interpolationRatio!==i;this.distance=t,this.minDistance=e,this.interpolationRatio=i,n&&this.refresh()}cluster(){if(void 0===this.resolution||!this.source)return;const t=[1/0,1/0,-1/0,-1/0],e=this.distance*this.resolution,i=this.source.getFeatures(),n={};for(let s=0,r=i.length;s<r;s++){const r=i[s];if(!(T(r)in n)){const i=this.geometryFunction(r);if(i){lt(i.getCoordinates(),t),J(t,e,t);const s=this.source.getFeaturesInExtent(t).filter(function(t){const e=T(t);return!(e in n)&&(n[e]=!0,!0)});this.features.push(this.createCluster(s,t))}}}}createCluster(t,e){const i=[0,0];for(let e=t.length-1;e>=0;--e){const n=this.geometryFunction(t[e]);n?Vt(i,n.getCoordinates()):t.splice(e,1)}$t(i,1/t.length);const n=xt(e),s=this.interpolationRatio,r=new Ji([i[0]*(1-s)+n[0]*s,i[1]*(1-s)+n[1]*s]);return this.createCustomCluster_?this.createCustomCluster_(r,t):new Y({geometry:r,features:t})}}function Vu(t){return t instanceof Image||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageBitmap?t:null}function Uu(t){return t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Float32Array||t instanceof DataView?t:null}const qu=new Error("disposed"),$u=[256,256];class Hu extends Fn{constructor(t){const e=Cn;super(t.tileCoord,e,{transition:t.transition,interpolate:t.interpolate}),this.loader_=t.loader,this.data_=null,this.error_=null,this.size_=t.size||null,this.controller_=t.controller||null}getSize(){if(this.size_)return this.size_;const t=Vu(this.data_);return t?[t.width,t.height]:$u}getData(){return this.data_}getError(){return this.error_}load(){if(this.state!==Cn&&this.state!==bn)return;this.state=Sn,this.changed();const t=this;this.loader_().then(function(e){t.data_=e,t.state=En,t.changed()}).catch(function(e){t.error_=e,t.state=bn,t.changed()})}disposeInternal(){this.controller_&&(this.controller_.abort(qu),this.controller_=null),super.disposeInternal()}}class Ju extends Zu{constructor(t){let e;e=void 0!==(t=t||{}).attributions?t.attributions:['© <a href="https://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap</a> contributors.'];const i=void 0!==t.url?t.url:"https://tile.openstreetmap.org/{z}/{x}/{y}.png";super({attributions:e,attributionsCollapsible:!1,cacheSize:t.cacheSize,crossOrigin:void 0!==t.crossOrigin?t.crossOrigin:"anonymous",referrerPolicy:t.referrerPolicy||"origin-when-cross-origin",interpolate:t.interpolate,maxZoom:void 0!==t.maxZoom?t.maxZoom:19,reprojectionErrorThreshold:t.reprojectionErrorThreshold,tileLoadFunction:t.tileLoadFunction,transition:t.transition,url:i,wrapX:t.wrapX,zDirection:t.zDirection})}}function Qu(t,e,i){if(!(i in t))return t[i]=new Set([e]),!0;const n=t[i],s=n.has(e);return s||n.add(e),!s}function td(t,e,i){const n=t[i];return!!n&&n.delete(e)}function ed(t,e){const i=t.layerStatesArray[t.layerIndex];if(i.extent&&(e=Et(e,ai(i.extent,t.viewState.projection))),!i.layer)return e;const n=i.layer.getRenderSource();if(!n.getWrapX()){const i=n.getTileGridForProjection(t.viewState.projection).getExtent();i&&(e=Et(e,i))}return e}class id extends da{constructor(t,e){super(t),e=e||{},this.extentChanged=!0,this.renderComplete=!1,this.renderedExtent_=null,this.renderedPixelRatio,this.renderedProjection=null,this.renderedTiles=[],this.renderedSourceRevision_,this.tempExtent=[1/0,1/0,-1/0,-1/0],this.tempTileRange_=new uu(0,0,0,0),this.tempTileCoord_=pu(0,0,0);const i=void 0!==e.cacheSize?e.cacheSize:512;this.tileCache_=new _u(i),this.sourceTileCache_=null,this.layerExtent=null,this.maxStaleKeys=.5*i}getTileCache(){return this.tileCache_}getSourceTileCache(){return this.sourceTileCache_||(this.sourceTileCache_=new _u(512)),this.sourceTileCache_}getOrCreateTile(t,e,i,n){const s=this.tileCache_,r=this.getLayer().getSource();if(!r)return null;const o=mu(r,r.getKey(),t,e,i);let a;if(s.containsKey(o)){if(a=s.get(o),!a)return null}else{const l=n.viewState.projection,h=r.getProjection();if(a=r.getTile(t,e,i,n.pixelRatio,l,!h||Qe(h,l)?void 0:this.getSourceTileCache()),!a)return null;s.set(o,a)}return a}getTile(t,e,i,n){const s=this.getOrCreateTile(t,e,i,n);return s||null}getData(t){const e=this.frameState;if(!e)return null;const i=this.getLayer(),n=gi(e.pixelToCoordinateTransform,t.slice()),s=i.getExtent();if(s&&!et(s,n))return null;const r=e.viewState,o=i.getRenderSource();if(!o)return null;const a=o.getTileGridForProjection(r.projection),l=o.getTilePixelRatio(e.pixelRatio);for(let t=a.getZForResolution(r.resolution);t>=a.getMinZoom();--t){const i=a.getTileCoordForCoordAndZ(n,t),s=this.getTile(t,i[1],i[2],e);if(!s||s.getState()!==En)continue;const h=a.getOrigin(t),c=Qr(a.getTileSize(t)),u=a.getResolution(t);let d=null;if(s instanceof Kn||s instanceof Du)d=s.getImage();else if(s instanceof Hu){const t=s.getData();t&&(d=Vu(t))}if(!d)continue;const g=Math.floor(l*((n[0]-h[0])/u-i[1]*c[0])),f=Math.floor(l*((h[1]-n[1])/u-i[2]*c[1])),_=Math.round(l*o.getGutterForProjection(r.projection));return this.getImageData(d,g+_,f+_)}return null}readData(t){const e=this.getLayer().getRenderSource();if(!e)return null;const i=t.viewState,n=i.projection;if(e.getGutterForProjection(n))throw new Error("readData() does not support sources with a gutter");const s=e.getTileGridForProjection(n),r=i.resolution,o=t.extent,a=s.getZForResolution(r),l={};this.enqueueTiles(t,o,a,l,0);const h=l[a];if(!h)return null;const c=[];let u=!0;if(h.forEach(t=>{const e=t,i=e.getState();i===En?c.push(e):i!==bn&&i!==Rn&&(u=!1)}),!u||0===c.length)return null;const d=t.size[0],g=t.size[1],f=c[0],_=Uu(f.getData());if(!_||_ instanceof DataView)throw new Error("ol/renderer/canvas/TileLayer#readData only supports typed array tile data");const p=f.getSize(),m=Math.round(_.length/(p[0]*p[1])),y=new(0,_.constructor)(d*g*m);for(const t of c){const e=s.getTileCoordExtent(t.tileCoord,this.tempExtent),i=t.getSize(),n=Uu(t.getData()),a=(e[0]-o[0])/r-.5,l=(o[3]-e[3])/r-.5,h=Mt(e)/r,c=St(e)/r,u=i[0]/h,f=i[1]/c,_=Math.max(0,Math.ceil(a)),p=Math.min(d,Math.ceil(a+h)),x=Math.max(0,Math.ceil(l)),v=Math.min(g,Math.ceil(l+c));for(let t=x;t<v;++t){const e=Math.min(Math.floor((t-l)*f),i[1]-1);for(let s=_;s<p;++s){const r=Math.min(Math.floor((s-a)*u),i[0]-1),o=(e*i[0]+r)*m,l=(t*d+s)*m;for(let t=0;t<m;++t)y[l+t]=n[o+t]}}}return this.updateCacheSize(h.size),this.tileCache_.expireCache(),this.sourceTileCache_?.expireCache(),{data:y,width:d,height:g,bandCount:m}}prepareFrame(t){this.renderedProjection?t.viewState.projection!==this.renderedProjection&&(this.tileCache_.clear(),this.renderedProjection=t.viewState.projection):this.renderedProjection=t.viewState.projection;const e=this.getLayer().getSource();if(!e)return!1;const i=e.getRevision();return this.renderedSourceRevision_?this.renderedSourceRevision_!==i&&(this.renderedSourceRevision_=i,this.renderedSourceKey_===e.getKey()&&(this.tileCache_.clear(),this.sourceTileCache_?.clear())):this.renderedSourceRevision_=i,!0}enqueueTilesForNextExtent(){return!0}enqueueTiles(t,e,i,n,s){const r=t.viewState,o=this.getLayer(),a=o.getRenderSource();if(!a)return;const l=a.getTileGridForProjection(r.projection),h=T(a);h in t.wantedTiles||(t.wantedTiles[h]={});const c=t.wantedTiles[h],u=o.getMapInternal(),d=Math.max(i-s,l.getMinZoom(),l.getZForResolution(Math.min(o.getMaxResolution(),u?u.getView().getResolutionForZoom(Math.max(o.getMinZoom(),0)):l.getResolution(0)),a.zDirection)),g=r.rotation,f=g?Ct(r.center,r.resolution,g,t.size):void 0;for(let s=i;s>=d;--s){const i=l.getTileRangeForExtentAndZ(e,s,this.tempTileRange_),r=l.getResolution(s);for(let e=i.minX;e<=i.maxX;++e)for(let o=i.minY;o<=i.maxY;++o){if(g&&f&&!l.tileCoordIntersectsViewport([s,e,o],f))continue;const i=this.getTile(s,e,o,t);if(!i)continue;if(!Qu(n,i,s))continue;const a=i.getKey();if(c[a]=!0,i.getState()===Cn&&!t.tileQueue.isKeyQueued(a)){const n=pu(s,e,o,this.tempTileCoord_);t.tileQueue.enqueue([i,h,l.getTileCoordCenter(n),r])}}}}findStaleTile_(t,e){const i=this.tileCache_,n=t[0],s=t[1],r=t[2],o=this.getStaleKeys(),a=this.getLayer().getSource();if(!a)return!1;for(let t=0;t<o.length;++t){const l=mu(a,o[t],n,s,r);if(i.containsKey(l)){const t=i.peek(l);if(t&&t.getState()===En)return t.endTransition(T(this)),Qu(e,t,n),!0}}return!1}findAltTiles_(t,e,i,n){const s=t.getTileRangeForTileCoordAndZ(e,i,this.tempTileRange_);if(!s)return!1;let r=!0;const o=this.tileCache_,a=this.getLayer().getRenderSource();if(!a)return!1;const l=a.getKey();for(let t=s.minX;t<=s.maxX;++t)for(let e=s.minY;e<=s.maxY;++e){const s=mu(a,l,i,t,e);let h=!1;if(o.containsKey(s)){const t=o.peek(s);t&&t.getState()===En&&(Qu(n,t,i),h=!0)}h||(r=!1)}return r}renderFrame(t,e){this.renderComplete=!0;const i=t.layerStatesArray[t.layerIndex],n=t.viewState,s=n.projection,r=n.resolution,o=n.center,a=t.pixelRatio,l=this.getLayer(),h=l.getSource();if(!h)return this.getContainerElement();const c=h.getTileGridForProjection(s),u=c.getZForResolution(r,h.zDirection),d=c.getResolution(u);this.updateStaleKeys(h.getKey());let g=t.extent;const f=h.getTilePixelRatio(a);this.prepareContainer(t,e);const _=this.getCanvasContext().canvas.width,p=this.getCanvasContext().canvas.height;this.layerExtent=i.extent?ai(i.extent):null,this.layerExtent&&(g=Et(g,this.layerExtent));const m=d*_/2/f,y=d*p/2/f,x=[o[0]-m,o[1]-y,o[0]+m,o[1]+y],v={};this.renderedTiles.length=0;const C=l.getPreload();if(t.nextExtent&&this.enqueueTilesForNextExtent()){const e=c.getZForResolution(n.nextResolution??r,h.zDirection),i=ed(t,t.nextExtent);this.enqueueTiles(t,i,e,v,C)}const S=ed(t,g);if(this.enqueueTiles(t,S,u,v,0),C>0&&setTimeout(()=>{this.enqueueTiles(t,S,u-1,v,C-1)},0),!(u in v))return this.getContainerElement();const E=T(this),b=t.time;for(const e of v[u]){const i=e.getState();if(i===Rn)continue;const n=e.tileCoord;if(i===En){if(1===e.getAlpha(E,b)){e.endTransition(E);continue}}i!==bn&&(this.renderComplete=!1);if(this.findStaleTile_(n,v)){td(v,e,u),t.animate=!0;continue}if(this.findAltTiles_(c,n,u+1,v))continue;const s=c.getMinZoom();for(let t=u-1;t>=s;--t){if(this.findAltTiles_(c,n,t,v))break}}const R=d/r*a/f,I=this.getRenderContext(t);fi(this.tempTransform,_/2,p/2,R,R,0,-_/2,-p/2),this.layerExtent&&this.clipUnrotated(I,t,this.layerExtent),h.getInterpolate()||(I.imageSmoothingEnabled=!1),this.preRender(I,t);const M=Object.keys(v).map(Number);M.sort(w);const P=[],F=[],L=[];for(let e=M.length-1;e>=0;--e){const i=M[e],n=h.getTilePixelSize(i,a,s),r=c.getResolution(i)/d,o=n[0]*r*R,l=n[1]*r*R,g=c.getTileCoordForCoordAndZ(Rt(x),i),_=c.getTileCoordExtent(g),p=gi(this.tempTransform,[f*(_[0]-x[0])/d,f*(x[3]-_[3])/d]),m=f*h.getGutterForProjection(s);for(const e of v[i]){if(e.getState()!==En)continue;const n=e.tileCoord,s=g[1]-n[1],r=Math.round(p[0]-(s-1)*o),a=g[2]-n[2],c=Math.round(p[1]-(a-1)*l),d=Math.round(p[0]-s*o),f=Math.round(p[1]-a*l),_=r-d,y=c-f,x=i===u;if(x&&e.inTransition(E)){L.push({tile:e,x:d,y:f,w:_,h:y,gutter:m}),this.renderedTiles.unshift(e),this.updateUsedTiles(t.usedTiles,h,e);continue}const v=[d,f,d+_,f+y],w=[];for(let t=0,e=P.length;t<e;++t)i<F[t]&&Tt(v,P[t])&&w.push(P[t]);let C;w.length>0&&(C=kt(v,w)),P.push(v),F.push(i),this.drawTile(e,t,d,f,_,y,m,x,C),this.renderedTiles.unshift(e),this.updateUsedTiles(t.usedTiles,h,e)}}for(let e=0,i=L.length;e<i;++e){const{tile:i,x:n,y:s,w:r,h:o,gutter:a}=L[e];this.drawTile(i,t,n,s,r,o,a,!0,void 0)}if(this.renderedResolution=d,this.extentChanged=!this.renderedExtent_||!ct(this.renderedExtent_,x),this.renderedExtent_=x,this.renderedPixelRatio=a,this.postRender(this.getCanvasContext(),t),this.layerExtent&&I.restore(),I.imageSmoothingEnabled=!0,this.renderComplete){const e=(t,e)=>{const i=T(h),n=e.wantedTiles[i],s=n?Object.keys(n).length:0;this.updateCacheSize(s),this.tileCache_.expireCache(),this.sourceTileCache_?.expireCache()};t.postRenderFunctions.push(e)}return this.getContainerElement()}updateCacheSize(t){this.tileCache_.highWaterMark=Math.max(this.tileCache_.highWaterMark,2*t)}drawTile(t,e,i,n,s,r,o,a,l){let h;if(t instanceof Hu){const e=t.getData();if(!e)return;if(h=Vu(e),!h)throw new Error("Rendering array data is not yet supported")}else h=this.getTileImage(t);if(!h)return;const c=this.getRenderContext(e),u=T(this),d=e.layerStatesArray[e.layerIndex],g=d.opacity*(a?t.getAlpha(u,e.time):1),f=g!==c.globalAlpha;f&&(c.save(),c.globalAlpha=g);const _=h.width-2*o,p=h.height-2*o;if(l){const t=_/s,e=p/r;for(let s=0,r=l.length;s<r;++s){const r=l[s],a=r[0],u=r[1],d=r[2]-r[0],g=r[3]-r[1];c.drawImage(h,o+(a-i)*t,o+(u-n)*e,d*t,g*e,a,u,d,g)}}else c.drawImage(h,o,o,_,p,i,n,s,r);f&&c.restore(),g!==d.opacity?e.animate=!0:a&&t.endTransition(u)}getImage(){const t=this.getCanvasContext();return t?t.canvas:null}getTileImage(t){return t.getImage()??null}updateUsedTiles(t,e,i){const n=T(e);n in t||(t[n]={}),t[n][i.getKey()]=!0}}var nd="preload",sd="useInterimTilesOnError";class rd extends zh{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(nd)}setPreload(t){this.set(nd,t)}getUseInterimTilesOnError(){return this.get(sd)}setUseInterimTilesOnError(t){this.set(sd,t)}getData(t){return super.getData(t)}}class od extends rd{constructor(t){super(t)}createRenderer(){return new id(this,{cacheSize:this.getCacheSize()})}}const ad=["fullscreenchange","webkitfullscreenchange"],ld="enterfullscreen",hd="leavefullscreen";class cd extends ac{constructor(t){t=t||{},super({element:document.createElement("div"),target:t.target}),this.on,this.once,this.un,this.keys_=void 0!==t.keys&&t.keys,this.source_=t.source,this.isInFullscreen_=!1,this.boundHandleMapTargetChange_=this.handleMapTargetChange_.bind(this),this.cssClassName_=void 0!==t.className?t.className:"ol-full-screen",this.documentListeners_=[],this.activeClassName_=void 0!==t.activeClassName?t.activeClassName.split(" "):[this.cssClassName_+"-true"],this.inactiveClassName_=void 0!==t.inactiveClassName?t.inactiveClassName.split(" "):[this.cssClassName_+"-false"];const e=void 0!==t.label?t.label:"⛶";this.labelNode_="string"==typeof e?document.createTextNode(e):e;const i=void 0!==t.labelActive?t.labelActive:"×";this.labelActiveNode_="string"==typeof i?document.createTextNode(i):i;const n=t.tipLabel?t.tipLabel:"Toggle full-screen";this.button_=document.createElement("button"),this.button_.title=n,this.button_.setAttribute("type","button"),this.button_.appendChild(this.labelNode_),this.button_.addEventListener(d,this.handleClick_.bind(this),!1),this.setClassName_(this.button_,this.isInFullscreen_);const s=this.element;s.className=`${this.cssClassName_} ${bs} ${Is}`,s.appendChild(this.button_)}handleClick_(t){t.preventDefault(),this.handleFullScreen_()}handleFullScreen_(){const t=this.getMap();if(!t)return;const e=t.getOwnerDocument();if(ud(e))if(dd(e))!function(t){const e=t;t.exitFullscreen?t.exitFullscreen():e.webkitExitFullscreen&&e.webkitExitFullscreen()}(e);else{let i;if(i=this.source_?"string"==typeof this.source_?e.getElementById(this.source_):this.source_:t.getTargetElement(),!i)return;this.keys_?function(t){const e=t;e.webkitRequestFullscreen?e.webkitRequestFullscreen():gd(t)}(i):gd(i)}}handleFullScreenChange_(){const t=this.getMap();if(!t)return;const e=this.isInFullscreen_;this.isInFullscreen_=dd(t.getOwnerDocument()),e!==this.isInFullscreen_&&(this.setClassName_(this.button_,this.isInFullscreen_),this.isInFullscreen_?(zn(this.labelActiveNode_,this.labelNode_),this.dispatchEvent(ld)):(zn(this.labelNode_,this.labelActiveNode_),this.dispatchEvent(hd)),t.updateSize())}setClassName_(t,e){e?(t.classList.remove(...this.inactiveClassName_),t.classList.add(...this.activeClassName_)):(t.classList.remove(...this.activeClassName_),t.classList.add(...this.inactiveClassName_))}setMap(t){const e=this.getMap();e&&e.removeChangeListener(ic,this.boundHandleMapTargetChange_),super.setMap(t),this.handleMapTargetChange_(),t&&t.addChangeListener(ic,this.boundHandleMapTargetChange_)}handleMapTargetChange_(){const t=this.documentListeners_;for(let e=0,i=t.length;e<i;++e)l(t[e]);t.length=0;const e=this.getMap();if(e){const i=e.getOwnerDocument();ud(i)?this.element.classList.remove(Rs):this.element.classList.add(Rs);for(let e=0,n=ad.length;e<n;++e)t.push(o(i,ad[e],this.handleFullScreenChange_,this));this.handleFullScreenChange_()}}}function ud(t){const e=t.body;return!!(e.webkitRequestFullscreen||"requestFullscreen"in e&&t.fullscreenEnabled)}function dd(t){return!(!t.webkitIsFullScreen&&!t.fullscreenElement)}function gd(t){const e=t;t.requestFullscreen?t.requestFullscreen():e.webkitRequestFullscreen&&e.webkitRequestFullscreen()}class fd{constructor(){this.dataProjection=void 0,this.defaultFeatureProjection=void 0,this.featureClass=Y,this.supportedMediaTypes=void 0}getReadOptions(t,e){if(e){let i=e.dataProjection?Ue(e.dataProjection):this.readProjection(t);if(e.extent&&i&&"tile-pixels"===i.getUnits()){const t=Ue(i);t&&(t.setWorldExtent(e.extent),i=t)}e={dataProjection:i??void 0,featureProjection:e.featureProjection}}return this.adaptOptions(e)}adaptOptions(t){return Object.assign({dataProjection:this.dataProjection,featureProjection:this.defaultFeatureProjection,featureClass:this.featureClass},t)}getType(){return I()}readFeature(t,e){return I()}readFeatures(t,e){return I()}readGeometry(t,e){return I()}readProjection(t){return I()}writeFeature(t,e){return I()}writeFeatures(t,e){return I()}writeGeometry(t,e){return I()}}function _d(t,e,i){const n=i?Ue(i.featureProjection):null,s=i?Ue(i.dataProjection):null;let r=t;if(n&&s&&!Qe(n,s)){e&&(r=t.clone());const i=e?n:s,o=e?s:n;if("tile-pixels"===i.getUnits())r.transform(i,o);else{const t=ii(i,o);t&&r.applyTransform(t)}}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};r===t&&(r=t.clone()),r.applyTransform(n)}return r}function pd(t,e){const i=t.geometry;if(!i)return[];if(Array.isArray(i))return i.map(e=>pd({...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 s=(i.layout??"XY").length;return _d(new xr(n,"Polygon"===n?function(t,e,i){if(Array.isArray(e[0])){const n=e;return rn(t,0,n,i)||an(t=t.slice(),0,n,i),t}const n=e;return sn(t,0,n,i)||on(t=t.slice(),0,n,i),t}(i.flatCoordinates,i.ends,s):i.flatCoordinates,i.ends?.flat()??[],s,t.properties||{},t.id).enableSimplifyTransformed(),!1,e)}function md(t,e){if(!t)return null;if(Array.isArray(t)){const i=t.map(t=>md(t,e));return new gu(i)}const i=t.type,n=t.layout||"XY";let s;switch(i){case"Point":s=new Ji(t.flatCoordinates,n);break;case"LineString":s=new Vn(t.flatCoordinates,n);break;case"Polygon":s=new ln(t.flatCoordinates,n,t.ends);break;case"MultiPoint":s=new _r(t.flatCoordinates,n);break;case"MultiLineString":s=new fr(t.flatCoordinates,n,t.ends);break;case"MultiPolygon":s=new mr(t.flatCoordinates,n,t.ends);break;default:throw new Error("Unsupported geometry type: "+i)}return _d(s,!1,e)}class yd extends fd{constructor(){super()}getType(){return"json"}readFeature(t,e){const i=xd(t);return i?this.readFeatureFromObject(i,this.getReadOptions(t,e)):[]}readFeatures(t,e){const i=xd(t);return i?this.readFeaturesFromObject(i,this.getReadOptions(t,e)):[]}readFeatureFromObject(t,e){return I()}readFeaturesFromObject(t,e){return I()}readGeometry(t,e){const i=xd(t);if(!i)throw new Error("Expected a JSON object");return this.readGeometryFromObject(i,this.getReadOptions(t,e))}readGeometryFromObject(t,e){return I()}readProjection(t){const e=xd(t);if(!e)throw new Error("Expected a JSON object");return this.readProjectionFromObject(e)}readProjectionFromObject(t){return I()}writeFeature(t,e){return JSON.stringify(this.writeFeatureObject(t,e))}writeFeatureObject(t,e){return I()}writeFeatures(t,e){return JSON.stringify(this.writeFeaturesObject(t,e))}writeFeaturesObject(t,e){return I()}writeGeometry(t,e){return JSON.stringify(this.writeGeometryObject(t,e))}writeGeometryObject(t,e){return I()}}function xd(t){if("string"==typeof t){const e=JSON.parse(t);return e||null}return null!==t?t:null}class vd extends yd{constructor(t){t=t||{},super(),this.dataProjection=Ue(t.dataProjection?t.dataProjection:"EPSG:4326")??void 0,t.featureProjection&&(this.defaultFeatureProjection=Ue(t.featureProjection)??void 0),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){const i=t;let n;n="Feature"===i.type?i:{type:"Feature",geometry:t,properties:null};const s=wd(n.geometry);if(this.featureClass===xr)return pd({geometry:s??void 0,id:n.id,properties:n.properties??void 0},e);const r=new(0,this.featureClass);return this.geometryName_?r.setGeometryName(this.geometryName_):this.extractGeometryName_&&"geometry_name"in n&&n.geometry_name&&r.setGeometryName(n.geometry_name),r.setGeometry(md(s,e)),"id"in n&&r.setId(n.id),n.properties&&r.setProperties(n.properties,!0),r}readFeaturesFromObject(t,e){let i=null;if("FeatureCollection"===t.type){i=[];const n=t.features;for(let t=0,s=n.length;t<s;++t){const s=this.readFeatureFromObject(n[t],e);s&&i.push(s)}}else i=[this.readFeatureFromObject(t,e)];return i.flat()}readGeometryFromObject(t,e){return function(t,e){const i=wd(t);if(!i)return null;return md(i,e)}(t,e)}readProjectionFromObject(t){const e=t.crs;let i;if(e)if("name"==e.type)i=Ue(e.properties.name);else{if("EPSG"!==e.type)throw new Error("Unknown SRS type");i=Ue("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 s=t.getProperties(),o=t.getGeometry();return o&&(i.geometry=Cd(o,e),delete s[t.getGeometryName()]),r(s)||(i.properties=s),i}writeFeaturesObject(t,e){e=this.adaptOptions(e);const i=[];for(let n=0,s=t.length;n<s;++n)i.push(this.writeFeatureObject(t[n],e));return{type:"FeatureCollection",features:i}}writeGeometryObject(t,e){return Cd(t,this.adaptOptions(e))}}function wd(t,e){if(!t||"GeometryCollection"!==t.type&&Array.isArray(t.coordinates)&&!t.coordinates.length)return null;let i;switch(t.type){case"Point":i=function(t){const e=t.coordinates;return{type:"Point",flatCoordinates:e,layout:Ei(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:Ei(e[0]?.length||2)}}(t);break;case"Polygon":i=function(t){const e=t.coordinates,i=[],n=e[0]?.[0]?.length,s=Ai(i,0,e,n);return{type:"Polygon",flatCoordinates:i,ends:s,layout:Ei(n)}}(t);break;case"MultiPoint":i=function(t){const e=t.coordinates;return{type:"MultiPoint",flatCoordinates:e.flat(),layout:Ei(e[0]?.length||2)}}(t);break;case"MultiLineString":i=function(t){const e=t.coordinates,i=e[0]?.[0]?.length||2,n=[],s=Ai(n,0,e,i);return{type:"MultiLineString",flatCoordinates:n,ends:s,layout:Ei(i)}}(t);break;case"MultiPolygon":i=function(t){const e=t.coordinates,i=[],n=e[0]?.[0]?.[0].length||2,s=Oi(i,0,e,n);return{type:"MultiPolygon",flatCoordinates:i,ends:s,layout:Ei(n)}}(t);break;case"GeometryCollection":i=function(t){const e=t.geometries,i=[];for(const t of e){const e=wd(t);e&&i.push(e)}return i}(t);break;default:throw new Error("Unsupported GeoJSON type: "+t.type)}return i}function Cd(t,e){const i=(t=_d(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;e&&(i=e.rightHanded);return{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;e&&(i=e.rightHanded);return{type:"MultiPolygon",coordinates:t.getCoordinates(i)}}(t,e);break;case"GeometryCollection":n=function(t,e){e=Object.assign({},e),delete e.featureProjection;const i=t.getGeometriesArray().map(function(t){return Cd(t,e)});return{type:"GeometryCollection",geometries:i}}(t,e);break;case"Circle":n={type:"GeometryCollection",geometries:[]};break;default:throw new Error("Unsupported geometry type: "+i)}return n}!function(){if("undefined"==typeof window||window[t])return;if(!(/firefox/i.test(navigator.userAgent)||"undefined"!=typeof CSS&&CSS.supports("-moz-appearance","none"))||"undefined"==typeof HTMLCanvasElement)return;const e=HTMLCanvasElement.prototype.getContext;HTMLCanvasElement.prototype.getContext=function(t,i){return"2d"===t&&(i=Object.assign({},i,{willReadFrequently:!0})),e.call(this,t,i)},window[t]=!0}();const Sd={initVenoMaps(t){const e=JSON.parse(t.dataset.infomap),{mapid:i,lat:n,lon:s,zoom:r,cluster_color:o,cluster_bg:a,destination:l,routes:h,zoom_markers:c,disable_clusters:u}=e,d=decodeURIComponent(e.style_url),g=["#009CD7","#FF6347","#32CD32","#FFD700","#DA70D6","#1E90FF"];let f,_=null;const p=new qr,m=new qr,y=new qr,x=new Bu({distance:50,minDistance:20,source:p}),v=new Kh({source:m,zIndex:5}),w=new Kh({source:y,zIndex:6}),C=new Kh(u?{source:p,zIndex:10,style:t=>t.get("stile")||null}:{source:x,zIndex:10,style:t=>{const e=t.get("features").filter(t=>!1!==t.get("is_matching_search")),i=e.length;if(0===i)return null;if(i>1){const t=ds(a).slice();t[3]=.3;const e=Math.min(parseInt(Math.sqrt(i)+16),25);return[new no({image:new io({radius:7+e,fill:new $r({color:t})})}),new no({image:new io({radius:e,stroke:new Hr({color:o,width:2}),fill:new $r({color:a})}),text:new ao({text:i.toString(),fill:new $r({color:o}),font:"bold 12px sans-serif"})})]}return e[0].get("stile")}}),S=new no({stroke:new Hr({color:"#009CD7",width:7,lineCap:"round"})}),E=new no({stroke:new Hr({color:"#86B9D4",width:5,lineCap:"round"})}),b=async()=>{if(!("geolocation"in navigator))return;const t=document.getElementById("get-directions-"+i);t.disabled=!0,t.textContent="Trovo la posizione...",navigator.geolocation.getCurrentPosition(async e=>{y.clear();const i=e.coords.longitude,n=e.coords.latitude,s=new Y({geometry:new Ji(Je([i,n]))});s.setStyle(new no({image:new io({radius:8,fill:new $r({color:"#2a6fdb"}),stroke:new Hr({color:"#ffffff",width:2})})})),y.addFeature(s),t.textContent="Calcolo il percorso...";const r=`https://router.project-osrm.org/route/v1/driving/${i},${n};${l.lon},${l.lat}?overview=full&geometries=geojson&alternatives=true&steps=true`;try{const t=await fetch(r),e=await t.json();if("Ok"!==e.code||!e.routes||0===e.routes.length)throw new Error("No routes");e.routes.forEach((t,e)=>{const i=new Vn(t.geometry.coordinates).transform("EPSG:4326","EPSG:3857"),n=new Y({geometry:i});n.set("route_data",t),n.set("is_geolocation_route",!0),n.setStyle(0===e?S:E),y.addFeature(n)}),((t,e="Indicazioni")=>{if(!t||!t.legs)return;console.clear();const i=Math.round(t.duration/60),n=(t.distance/1e3).toFixed(2);console.log(`%c--- ${e} (Durata: ${i} min, Distanza: ${n} km) ---`,"color: #009CD7; font-weight: bold; font-size: 14px;"),t.legs[0].steps.forEach((t,e)=>{const i=(t.distance/1e3).toFixed(2),n=t.name?`su ${t.name}`:"",s=(t=>{let e="";const i=t.type,n=t.modifier;switch(i){case"depart":e="Parti";break;case"arrive":e="Sei arrivato a destinazione";break;case"merge":e="Immettiti";break;case"turn":case"fork":case"end of road":switch(n){case"right":e="Gira a destra";break;case"left":e="Gira a sinistra";break;case"slight right":e="Svolta leggermente a destra";break;case"slight left":e="Svolta leggermente a sinistra";break;case"sharp right":e="Svolta a gomito a destra";break;case"sharp left":e="Svolta a gomito a sinistra";break;case"straight":e="Continua dritto";break;case"uturn":e="Fai un'inversione a U"}"fork"===i&&(e=e.replace("Gira","Tieni"));break;case"new name":e="Continua dritto";break;case"continue":e=`Continua su ${n}`;break;case"roundabout":e=`Alla rotonda, prendi la ${t.exit}ª uscita`;break;case"rotary":e=`Entra nella rotatoria e prendi la ${t.exit}ª uscita`;break;default:e=`${i} ${n||""}`}return e.charAt(0).toUpperCase()+e.slice(1)})(t.maneuver);console.log(`${e+1}. ${s} ${n} (per ${i} km)`)})})(e.routes[0],"Indicazioni dalla tua posizione"),f.getView().fit(y.getExtent(),{padding:[50,50,50,50],duration:1e3})}catch(t){alert("Impossibile calcolare il percorso.")}finally{t.disabled=!1,t.textContent="Get Directions"}},()=>{alert("Posizione non disponibile."),t.disabled=!1,t.textContent="Get Directions"})},R=(()=>{const e=t.querySelector("#wrap-overlay-"+i);if(!e)return[];const n=e.querySelectorAll(".wpol-infomarker"),s=[],r=[];return n.forEach((t,e)=>{const n=JSON.parse(t.dataset.marker);if(!n.lon||!n.lat)return;const o=[parseFloat(n.lon),parseFloat(n.lat)],a=new Y(new Ji(Je(o))),l=parseFloat(n.size);a.set("stile",new no({image:new oa({src:t.querySelector("img").src,height:l,anchor:[.5,1],anchorXUnits:"fraction",anchorYUnits:"fraction",crossOrigin:"anonymous"})}));const h=document.getElementById("infopanel_"+i+"_"+e);if(h){const t=h.querySelector(".wpol-infopanel-close");t&&t.addEventListener("click",t=>{t.stopPropagation(),h.classList.add("infobox-closed"),h.classList.remove("was-open")}),r.push(new cu({position:Je(o),positioning:"bottom-center",offset:[0,-(l+12)],element:h})),a.set("panel",h)}s.push(a)}),p.addFeatures(s),r})();(()=>{if(!h||0===h.length)return;const t=new vd({dataProjection:"EPSG:4326",featureProjection:"EPSG:3857"});h.forEach((e,i)=>{if(e.geometry)try{const n=t.readFeature(e.geometry);n&&n.getGeometry()&&(n.set("route_data",e),n.set("route_title",e.title),n.setStyle(new no({stroke:new Hr({color:g[i%g.length],width:6,lineCap:"round",lineJoin:"round"})})),m.addFeature(n))}catch(t){console.error("Errore parsing GeoJSON",t)}})})();const I=Je([parseFloat(s),parseFloat(n)]);let M={url:d,attributions:t.querySelector(".venomaps-get-attribution")?.innerHTML||""};"default"===d&&(M={}),M.referrerPolicy=document.referrerPolicy||"strict-origin-when-cross-origin",f=new su({target:"venomaps_"+i,view:new Sh({center:I,zoom:r,maxZoom:18,minZoom:2}),layers:[new od({source:new Ju(M)}),v,w,C],controls:uc({attributionOptions:{collapsible:!0}}).extend([new cd]),interactions:Vc({mouseWheelZoom:Boolean(e.zoom_scroll)})}),R.forEach(t=>f.addOverlay(t));const T=t.querySelector(".venomaps-search");T&&T.addEventListener("input",t=>(t=>{const e=t.toLowerCase() ;let i=[];if(p.forEachFeature(t=>{const n=t.get("panel");let s=!0;e.length>2&&(s=(n?.querySelector(".wpol-infolabel")?.innerText.toLowerCase()||"").includes(e),s&&i.push(t)),t.set("is_matching_search",s)}),C.getSource().refresh(),e.length>2&&i.length>0){const t=new qr({features:i});f.getView().fit(t.getExtent(),{duration:500,padding:[100,100,100,100],maxZoom:15})}})(t.target.value));const P=document.getElementById("get-directions-"+i);P&&l&&P.addEventListener("click",b),f.on("click",t=>{_&&(f.removeOverlay(_),_=null);let e=!1;C.getFeatures(t.pixel).then(i=>{if(i.length>0){const t=i[0].get("features")||[i[0]],n=f.getView();if(t.length>1){const i=[1/0,1/0,-1/0,-1/0];t.forEach(t=>ut(i,t.getGeometry().getExtent())),n.fit(i,{duration:500,padding:[50,50,50,50]}),e=!0}else if(1===t.length){const i=t[0].get("panel");i&&(i.classList.remove("infobox-closed"),n.animate({center:t[0].getGeometry().getCoordinates(),duration:500}),e=!0)}}if(!e){const e=f.forEachFeatureAtPixel(t.pixel,(t,e)=>{if(e===v)return t});if(e&&e.get("route_title")){const i=e.get("route_title"),n=document.createElement("div");n.className="wpol-infopanel",n.innerHTML=`<div class="wpol-infolabel"><strong>${i}</strong></div><div class="wpol-arrow"></div>`,_=new cu({position:t.coordinate,positioning:"bottom-center",element:n,offset:[0,-15],stopEvent:!1}),f.addOverlay(_)}}})}),f.on("pointermove",t=>{const e=f.hasFeatureAtPixel(t.pixel,{layerFilter:t=>t===C});f.getTargetElement().style.cursor=e?"pointer":""}),c&&setTimeout(()=>{const t=[1/0,1/0,-1/0,-1/0];let e=!1;p.getFeatures().length>0&&(ut(t,p.getExtent()),e=!0),m.getFeatures().length>0&&(ut(t,m.getExtent()),e=!0),e&&t[0]<1/0&&f.getView().fit(t,{padding:[50,50,50,50],duration:1e3,maxZoom:16})},100)},init(){document.querySelectorAll(".wrap-venomaps:not([data-venomap-init])").forEach(t=>{t.setAttribute("data-venomap-init","1"),this.initVenoMaps(t)})}};return"undefined"!=typeof document&&("loading"===document.readyState?document.addEventListener("DOMContentLoaded",()=>Sd.init()):Sd.init()),Sd}();1 var venomaps=function(){"use strict";const t="__venomapsCanvasPatched";var e="add",i="remove",n="propertychange";function s(t){for(const e in t)delete t[e]}function r(t){let e;for(e in t)return!1;return!e}function o(t,e,i,n,s){if(s){const s=i;i=function(r){return t.removeEventListener(e,i),s.call(n??this,r)}}else n&&n!==t&&(i=i.bind(n));const r={target:t,type:e,listener:i};return t.addEventListener(e,i),r}function a(t,e,i,n){return o(t,e,i,n,!0)}function l(t){t&&t.target&&(t.target.removeEventListener(t.type,t.listener),s(t))}var h="change",c="error",u="contextmenu",d="click",g="dblclick",f="keydown",_="keypress",p="keyup",m="load",y="touchmove",x="wheel";class v{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}}function w(t,e){return t>e?1:t<e?-1:0}function C(t,e){return t<e?1:t>e?-1:0}function S(t,e,i){if(t[0]<=e)return 0;const n=t.length;if(e<=t[n-1])return n-1;if("function"==typeof i){for(let s=1;s<n;++s){const n=t[s];if(n===e)return s;if(n<e)return i(e,t[s-1],n)>0?s-1:s}return n-1}if(i>0){for(let i=1;i<n;++i)if(t[i]<e)return i-1;return n-1}if(i<0){for(let i=1;i<n;++i)if(t[i]<=e)return i;return n-1}for(let i=1;i<n;++i){if(t[i]==e)return i;if(t[i]<e)return t[i-1]-e<e-t[i]?i-1:i}return n-1}function E(t,e,i){for(;e<i;){const n=t[e];t[e]=t[i],t[i]=n,++e,--i}}function b(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 R(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 I(){throw new Error("Unimplemented abstract method.")}let M=0;function T(t){const e=t;return e.ol_uid||(e.ol_uid=String(++M))}function P(t){return!!t&&"function"==typeof t.then&&"function"==typeof t.catch}function F(){return!0}function L(){return!1}function k(){}function A(t){let e,i,n;return function(){const s=Array.prototype.slice.call(arguments);return i&&this===n&&R(s,i)||(n=this,i=s,e=t.apply(this,s)),e}}class O{constructor(t){this.propagationStopped,this.defaultPrevented,this.type=t,this.target=null}preventDefault(){this.defaultPrevented=!0}stopPropagation(){this.propagationStopped=!0}}class D extends v{constructor(t){super(),this.eventTarget_=t,this.pendingRemovals_=null,this.dispatching_=null,this.listeners_=null}addEventListener(t,e){if(!t||!e)return;const i=this.listeners_||(this.listeners_={}),n=i[t]||(i[t]=[]);n.includes(e)||n.push(e)}dispatchEvent(t){const e="string"==typeof t,i=e?t:t.type,n=this.listeners_&&this.listeners_[i];if(!n)return;const s=e?new O(t):t;s.target||(s.target=this.eventTarget_||this);const r=this.dispatching_||(this.dispatching_={}),o=this.pendingRemovals_||(this.pendingRemovals_={});let a;i in r||(r[i]=0,o[i]=0),++r[i];for(let t=0,e=n.length;t<e;++t)if(a="handleEvent"in n[t]?n[t].handleEvent(s):n[t].call(this,s),!1===a||s.propagationStopped){a=!1;break}if(0===--r[i]){let t=o[i];for(delete o[i];t--;)this.removeEventListener(i,k);delete r[i]}return a}disposeInternal(){this.listeners_&&s(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]=k,++this.pendingRemovals_[t]):(i.splice(n,1),0===i.length&&delete this.listeners_[t]))}}class G extends D{constructor(){super(),this.on=this.onInternal,this.once=this.onceInternal,this.un=this.unInternal,this.revision_=0}changed(){++this.revision_,this.dispatchEvent(h)}getRevision(){return this.revision_}onInternal(t,e){if(Array.isArray(t)){const i=t.length,n=new Array(i);for(let s=0;s<i;++s)n[s]=o(this,t[s],e);return n}return o(this,t,e)}onceInternal(t,e){let i;if(Array.isArray(t)){const n=t.length;i=new Array(n);for(let s=0;s<n;++s)i[s]=a(this,t[s],e)}else i=a(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)l(t[e]);else l(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)}}G.prototype.on,G.prototype.once,G.prototype.un;class z extends O{constructor(t,e,i){super(t),this.key=e,this.oldValue=i}}class N extends G{constructor(t){super(),this.on,this.once,this.un,T(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 z(i,t,e)),i=n,this.hasListener(i)&&this.dispatchEvent(new z(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],r(this.values_)&&(this.values_=null),e||this.notify(t,i)}}}const j="length";class X extends O{constructor(t,e,i){super(t),this.element=e,this.index=i}}class K 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(j)}insertAt(t,i){if(t<0||t>this.getLength())throw new Error("Index out of bounds: "+t);this.unique_&&this.assertUnique_(i),this.array_.splice(t,0,i),this.updateLength_(),this.dispatchEvent(new X(e,i,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 X(i,e,t)),e}setAt(t,n){if(t>=this.getLength())return void this.insertAt(t,n);if(t<0)throw new Error("Index out of bounds: "+t);this.unique_&&this.assertUnique_(n,t);const s=this.array_[t];this.array_[t]=n,this.dispatchEvent(new X(i,s,t)),this.dispatchEvent(new X(e,n,t))}updateLength_(){this.set(j,this.array_.length)}assertUnique_(t,e){const i=this.array_;for(let n=0,s=i.length;n<s;++n)if(i[n]===t&&n!==e)throw new Error("Duplicate item added to a unique collection")}}function W(t,e){if(!t)throw new Error(e)}class Y 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 Y,e=this.geometryName_;t.setGeometryName(e);const i=this.getPropertiesInternal();if(i){const n=this.getGeometry();for(const s in i)s===e&&n?t.set(s,n.clone()):t.set(s,i[s],!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_&&(l(this.geometryChangeKey_),this.geometryChangeKey_=null);const t=this.getGeometry();t&&(this.geometryChangeKey_=o(t,h,this.handleGeometryChange_,this)),this.changed()}setGeometry(t){this.set(this.geometryName_,t)}setStyle(t){this.style_=t??null,this.styleFunction_=t?function(t){if("function"==typeof t)return t;let e;if(Array.isArray(t))e=t;else{W("function"==typeof t.getZIndex,"Expected an `ol/style/Style` or an array of `ol/style/Style.js`");e=[t]}return function(){return e}}(t):void 0,this.changed()}setId(t){this.id_=t,this.changed()}setGeometryName(t){t!==this.geometryName_&&(this.removeChangeListener(this.geometryName_,this.handleGeometryChanged_),this.geometryName_=t,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),this.handleGeometryChanged_())}}var Z=0,B=1,V=2,U=4,q=8,$=16;function H(t){const e=rt();for(let i=0,n=t.length;i<n;++i)dt(e,t[i]);return e}function J(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 Q(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,s;return n=e<t[0]?t[0]-e:t[2]<e?e-t[2]:0,s=i<t[1]?t[1]-i:t[3]<i?i-t[3]:0,n*n+s*s}function et(t,e){return nt(t,e[0],e[1])}function it(t,e){return t[0]<=e[0]&&e[2]<=t[2]&&t[1]<=e[1]&&e[3]<=t[3]}function nt(t,e,i){return t[0]<=e&&e<=t[2]&&t[1]<=i&&i<=t[3]}function st(t,e){const i=t[0],n=t[1],s=t[2],r=t[3],o=e[0],a=e[1];let l=Z;return o<i?l|=$:o>s&&(l|=U),a<n?l|=q:a>r&&(l|=V),l===Z&&(l=B),l}function rt(){return[1/0,1/0,-1/0,-1/0]}function ot(t,e,i,n,s){return s?(s[0]=t,s[1]=e,s[2]=i,s[3]=n,s):[t,e,i,n]}function at(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 ht(t,e,i,n,s){return gt(at(s),t,e,i,n)}function ct(t,e){return t[0]==e[0]&&t[2]==e[2]&&t[1]==e[1]&&t[3]==e[3]}function ut(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 gt(t,e,i,n,s){for(;i<n;i+=s)ft(t,e[i],e[i+1]);return t}function ft(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(mt(t)),i||(i=e(yt(t)),i||(i=e(It(t)),i||(i=e(Rt(t)),i||!1)))}function pt(t){let e=0;return Pt(t)||(e=Mt(t)*St(t)),e}function mt(t){return[t[0],t[1]]}function yt(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=mt(t);else if("bottom-right"===e)i=yt(t);else if("top-left"===e)i=Rt(t);else{if("top-right"!==e)throw new Error("Invalid corner");i=It(t)}return i}function wt(t,e,i,n,s){const[r,o,a,l,h,c,u,d]=Ct(t,e,i,n);return ot(Math.min(r,a,h,u),Math.min(o,l,c,d),Math.max(r,a,h,u),Math.max(o,l,c,d),s)}function Ct(t,e,i,n){const s=e*n[0]/2,r=e*n[1]/2,o=Math.cos(i),a=Math.sin(i),l=s*o,h=s*a,c=r*o,u=r*a,d=t[0],g=t[1];return[d-l+u,g-h-c,d-l-u,g-h+c,d+l-u,g+h+c,d+l+u,g+h-c,d-l+u,g-h-c]}function St(t){return t[3]-t[1]}function Et(t,e,i){const n=i||[1/0,1/0,-1/0,-1/0];return Tt(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]):at(n),n}function bt(t,e){if(!Tt(t,e))return[t.slice()];if(it(e,t))return[];const[i,n,s,r]=t,o=Math.max(i,e[0]),a=Math.max(n,e[1]),l=Math.min(s,e[2]),h=Math.min(r,e[3]),c=[];return o>i&&c.push([i,n,o,r]),l<s&&c.push([l,n,s,r]),a>n&&c.push([o,n,l,a]),h<r&&c.push([o,h,l,r]),c}function Rt(t){return[t[0],t[3]]}function It(t){return[t[2],t[3]]}function Mt(t){return t[2]-t[0]}function Tt(t,e){return t[0]<=e[2]&&t[2]>=e[0]&&t[1]<=e[3]&&t[3]>=e[1]}function Pt(t){return t[2]<t[0]||t[3]<t[1]}function Ft(t,e){const i=e.getExtent(),n=xt(t);if(e.canWrapX()&&(n[0]<i[0]||n[0]>=i[2])){const e=Mt(i),s=Math.floor((n[0]-i[0])/e)*e;t[0]-=s,t[2]-=s}return t}function Lt(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]]];Ft(t,e);const s=Mt(n);if(Mt(t)>s&&!i)return[[n[0],t[1],n[2],t[3]]];if(t[0]<n[0])return[[t[0]+s,t[1],n[2],t[3]],[n[0],t[1],t[2],t[3]]];if(t[2]>n[2])return[[t[0],t[1],n[2],t[3]],[n[0],t[1],t[2]-s,t[3]]]}return[t]}function kt(t,e){let i=[t];for(let t=0,n=e.length;t<n&&i.length>0;++t){const n=[];for(let s=0,r=i.length;s<r;++s)n.push(...bt(i[s],e[t]));i=n}return i}function At(t,e,i){return Math.min(Math.max(t,e),i)}function Ot(t,e,i,n,s,r){const o=s-i,a=r-n;if(0!==o||0!==a){const l=((t-i)*o+(e-n)*a)/(o*o+a*a);l>1?(i=s,n=r):l>0&&(i+=o*l,n+=a*l)}return Dt(t,e,i,n)}function Dt(t,e,i,n){const s=i-t,r=n-e;return s*s+r*r}function Gt(t){return 180*t/Math.PI}function zt(t){return t*Math.PI/180}function Nt(t,e){const i=t%e;return i*e<0?i+e:i}function jt(t,e,i){return t+i*(e-t)}function Xt(t,e){const i=Math.pow(10,e);return Math.round(t*i)/i}function Kt(t,e){return Math.floor(Xt(t,e))}function Wt(t,e){return Math.ceil(Xt(t,e))}function Yt(t,e,i){if(t>=e&&t<i)return t;const n=i-e;return((t-e)%n+n)%n+e}function Zt(t,e,i){i=i||6371008.8;const n=zt(t[1]),s=zt(e[1]),r=(s-n)/2,o=zt(e[0]-t[0])/2,a=Math.sin(r)*Math.sin(r)+Math.sin(o)*Math.sin(o)*Math.cos(n)*Math.cos(s);return 2*i*Math.atan2(Math.sqrt(a),Math.sqrt(1-a))}function Bt(...t){console.warn(...t)}function Vt(t,e){return t[0]+=+e[0],t[1]+=+e[1],t}function Ut(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 qt(t,e){const i=Math.cos(e),n=Math.sin(e),s=t[0]*i-t[1]*n,r=t[1]*i+t[0]*n;return t[0]=s,t[1]=r,t}function $t(t,e){return t[0]*=e,t[1]*=e,t}function Ht(t,e){if(e.canWrapX()){const i=Mt(e.getExtent()),n=function(t,e,i){const n=e.getExtent();let s=0;e.canWrapX()&&(t[0]<n[0]||t[0]>n[2])&&(i=i||Mt(n),s=Math.floor((t[0]-n[0])/i));return s}(t,e,i);n&&(t[0]-=n*i)}return t}const Jt={radians:6370997/(2*Math.PI),degrees:2*Math.PI*6370997/360,ft:.3048,m:1,"us-ft":1200/3937};class Qt{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_||Jt[this.units_]}getWorldExtent(){return this.worldExtent_}getAxisOrientation(){return this.axisOrientation_}isGlobal(){return this.global_}setGlobal(t){this.global_=t,this.canWrapX_=!(!t||!this.extent_)}getDefaultTileGrid(){return this.defaultTileGrid_}setDefaultTileGrid(t){this.defaultTileGrid_=t}setExtent(t){this.extent_=t,this.canWrapX_=!(!this.global_||!t)}setWorldExtent(t){this.worldExtent_=t}setGetPointResolution(t){this.getPointResolutionFunc_=t}getPointResolutionFunc(){return this.getPointResolutionFunc_}}const te=6378137,ee=Math.PI*te,ie=[-ee,-ee,ee,ee],ne=[-180,-85,180,85],se=te*Math.log(Math.tan(Math.PI/2));class re extends Qt{constructor(t){super({code:t,units:"m",extent:ie,global:!0,worldExtent:ne,getPointResolution:function(t,e){return t/Math.cosh(e[1]/te)}})}}const oe=[new re("EPSG:3857"),new re("EPSG:102100"),new re("EPSG:102113"),new re("EPSG:900913"),new re("http://www.opengis.net/def/crs/EPSG/0/3857"),new re("http://www.opengis.net/gml/srs/epsg.xml#3857")];function ae(t,e,i,n){const s=t.length;i=void 0!==i&&i>1?i:2,n=n??i,void 0===e&&(e=i>2?t.slice():new Array(s));for(let i=0;i<s;i+=n){e[i]=ee*t[i]/180;let n=te*Math.log(Math.tan(Math.PI*(+t[i+1]+90)/360));n>se?n=se:n<-se&&(n=-se),e[i+1]=n}return e}function le(t,e,i,n){const s=t.length;i=void 0!==i&&i>1?i:2,n=n??i,void 0===e&&(e=i>2?t.slice():new Array(s));for(let i=0;i<s;i+=n)e[i]=180*t[i]/ee,e[i+1]=360*Math.atan(Math.exp(t[i+1]/te))/Math.PI-90;return e}const he=[-180,-90,180,90],ce=6378137*Math.PI/180;class ue extends Qt{constructor(t,e){super({code:t,units:"degrees",extent:he,axisOrientation:e,global:!0,metersPerUnit:ce,worldExtent:he})}}const de=[new ue("CRS:84"),new ue("EPSG:4326","neu"),new ue("urn:ogc:def:crs:OGC:1.3:CRS84"),new ue("urn:ogc:def:crs:OGC:2:84"),new ue("http://www.opengis.net/def/crs/OGC/1.3/CRS84"),new ue("http://www.opengis.net/gml/srs/epsg.xml#4326","neu"),new ue("http://www.opengis.net/def/crs/EPSG/0/4326","neu")];let ge={};let fe={};function _e(t,e,i){const n=t.getCode(),s=e.getCode();n in fe||(fe[n]={}),fe[n][s]=i}function pe(t,e){return t in fe&&e in fe[t]?fe[t][e]:null}const me=.9996,ye=.00669438,xe=ye*ye,ve=xe*ye,we=ye/(1-ye),Ce=Math.sqrt(1-ye),Se=(1-Ce)/(1+Ce),Ee=Se*Se,be=Ee*Se,Re=be*Se,Ie=Re*Se,Me=.9983242984503243,Te=15*xe/256+45*ve/1024,Pe=35*ve/3072,Fe=1.5*Se-27/32*be+269/512*Ie,Le=21/16*Ee-55/32*Re,ke=151/96*be-417/128*Ie,Ae=1097/512*Re,Oe=6378137;function De(t,e,i){const n=t-5e5,s=(i.north?e:e-1e7)/me/(Oe*Me),r=s+Fe*Math.sin(2*s)+Le*Math.sin(4*s)+ke*Math.sin(6*s)+Ae*Math.sin(8*s),o=Math.sin(r),a=o*o,l=Math.cos(r),h=o/l,c=h*h,u=c*c,d=1-ye*a,g=Math.sqrt(1-ye*a),f=we*l**2,_=f*f,p=n/(Oe/g*me),m=p*p,y=m*p,x=y*p,v=x*p,w=r-h/((1-ye)/d)*(m/2-x/24*(5+3*c+10*f-4*_-9*we))+v*p/720*(61+90*c+298*f+45*u-252*we-3*_);let C=(p-y/6*(1+2*c+f)+v/120*(5-2*f+28*c-3*_+8*we+24*u))/l;return C=Yt(C+zt(ze(i.number)),-Math.PI,Math.PI),[Gt(C),Gt(w)]}function Ge(t,e,i){t=Yt(t,-180,180),e<-80?e=-80:e>84&&(e=84);const n=zt(e),s=Math.sin(n),r=Math.cos(n),o=s/r,a=o*o,l=a*a,h=zt(t),c=zt(ze(i.number)),u=Oe/Math.sqrt(1-ye*s**2),d=we*r**2,g=r*Yt(h-c,-Math.PI,Math.PI),f=g*g,_=f*g,p=_*g,m=p*g,y=m*g,x=Oe*(Me*n-.002514607064228144*Math.sin(2*n)+Te*Math.sin(4*n)-Pe*Math.sin(6*n)),v=me*u*(g+_/6*(1-a+d)+m/120*(5-18*a+l+72*d-58*we))+5e5;let w=me*(x+u*o*(f/2+p/24*(5-a+9*d+4*d**2)+y/720*(61-58*a+l+600*d-330*we)));return i.north||(w+=1e7),[v,w]}function ze(t){return 6*(t-1)-180+3}const Ne=[/^EPSG:(\d+)$/,/^urn:ogc:def:crs:EPSG::(\d+)$/,/^http:\/\/www\.opengis\.net\/def\/crs\/EPSG\/0\/(\d+)$/];function je(t){let e=0;for(const i of Ne){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 Xe(t,e){return function(i,n,s,r){const o=i.length;s=void 0!==s&&s>1?s:2,r=r??s,n||(n=s>2?i.slice():new Array(o));for(let s=0;s<o;s+=r){const r=i[s],o=i[s+1],a=t(r,o,e);n[s]=a[0],n[s+1]=a[1]}return n}}const Ke=[function(t){const e=je(t.getCode());return e?{forward:Xe(Ge,e),inverse:Xe(De,e)}:null}],We=[function(t){return je(t)?new Qt({code:t,units:"m"}):null}];let Ye=!0;function Ze(t){Ye=!1}function Be(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 Ve(t){!function(t,e){ge[t]=e}(t.getCode(),t),_e(t,t,Be)}function Ue(t){if("string"!=typeof t)return void 0!==t?t:null;const e=ge[i=t]||ge[i.replace(/urn:(x-)?ogc:def:crs:EPSG:(.*:)?(\w+)$/,"EPSG:$3")]||null;var i;if(e)return e;for(const e of We){const i=e(t);if(i)return i}return null}function qe(t,e,i,n){const s=Ue(t);if(!s)return e;let r;const o=s.getPointResolutionFunc();if(o)r=o(e,i);else{const t=s.getUnits();if("degrees"==t&&!n||"degrees"==n)r=e;else{const n=ti(s,Ue("EPSG:4326"));if(n||"degrees"===t){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];n&&(t=n(t,t,2));r=(Zt(t.slice(0,2),t.slice(2,4))+Zt(t.slice(4,6),t.slice(6,8)))/2}else r=e*(s.getMetersPerUnit()??1);const o=s.getMetersPerUnit();void 0!==o&&(r/=o)}}return r}function $e(t){!function(t){t.forEach(Ve)}(t),t.forEach(function(e){t.forEach(function(t){e!==t&&_e(e,t,Be)})})}function He(t,e){return t?"string"==typeof t?Ue(t):t:Ue(e)}function Je(t,e){return Ze(),ni(t,"EPSG:4326","EPSG:3857")}function Qe(t,e){if(t===e)return!0;const i=t.getUnits()===e.getUnits();if(t.getCode()===e.getCode())return i;return ti(t,e)===Be&&i}function ti(t,e){if(!t||!e)return null;const i=t.getCode(),n=e.getCode();let s=pe(i,n);if(s)return s;let r=null,o=null;for(const i of Ke)r||(r=i(t)),o||(o=i(e));if(!r&&!o)return null;const a="EPSG:4326";if(!o&&r){const t=pe(a,n);t&&(s=ei(r.inverse,t))}else if(!r&&o){const t=pe(i,a);t&&(s=ei(t,o.forward))}else r&&o&&(s=ei(r.inverse,o.forward));return s&&(Ve(t),Ve(e),_e(t,e,s)),s}function ei(t,e){return function(i,n,s,r){return n=t(i,n,s,r),e(n,n,s,r)}}function ii(t,e){return ti(Ue(t),Ue(e))}function ni(t,e,i){const n=ii(e,i);if(!n){const t=Ue(e)?.getCode()??String(e),n=Ue(i)?.getCode()??String(i);throw new Error(`No transform available between ${t} and ${n}`)}return n(t,void 0,t.length)}function si(t,e){return t}function ri(t,e){return Ye&&!Ut(t,[0,0])&&t[0]>=-180&&t[0]<=180&&t[1]>=-90&&t[1]<=90&&(Ye=!1,Bt("Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.")),t}function oi(t,e){return t}function ai(t,e){return t}var li,hi,ci;$e(oe),$e(de),li=oe,hi=ae,ci=le,de.forEach(function(t){li.forEach(function(e){_e(t,e,hi),_e(e,t,ci)})});const ui=[1,0,0,1,0,0];function di(){return ui.slice(0)}function gi(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 fi(t,e,i,n,s,r,o,a){const l=Math.sin(r),h=Math.cos(r);return t[0]=n*h,t[1]=s*l,t[2]=-n*l,t[3]=s*h,t[4]=o*n*h-a*n*l+e,t[5]=o*s*l+a*s*h+i,t}function _i(t,e){const i=(n=e)[0]*n[3]-n[1]*n[2];var n;W(0!==i,"Transformation matrix cannot be inverted");const s=e[0],r=e[1],o=e[2],a=e[3],l=e[4],h=e[5];return t[0]=a/i,t[1]=-r/i,t[2]=-o/i,t[3]=s/i,t[4]=(o*h-a*l)/i,t[5]=-(s*h-r*l)/i,t}new Array(6);const pi=[1e5,1e5,1e5,1e5,2,2];function mi(t){return t.substring(7,t.length-1).split(",").map(parseFloat)}function yi(t,e,i,n,s,r,o){r=r||[],o=o||2;let a=0;for(let l=e;l<i;l+=n){const e=t[l],i=t[l+1];r[a++]=s[0]*e+s[2]*i+s[4],r[a++]=s[1]*e+s[3]*i+s[5];for(let e=2;e<o;e++)r[a++]=t[l+e]}return r&&r.length!=a&&(r.length=a),r}function xi(t,e,i,n,s,r,o){o=o||[];const a=Math.cos(s),l=Math.sin(s),h=r[0],c=r[1];let u=0;for(let s=e;s<i;s+=n){const e=t[s]-h,i=t[s+1]-c;o[u++]=h+e*a-i*l,o[u++]=c+e*l+i*a;for(let e=s+2;e<s+n;++e)o[u++]=t[e]}return o&&o.length!=u&&(o.length=u),o}const vi=di(),wi=[NaN,NaN];class Ci 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=A((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 I()}closestPointXY(t,e,i,n){return I()}containsXY(t,e){return 0===this.closestPointXY(t,e,wi,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 I()}getExtent(t){if(this.extentRevision_!=this.getRevision()){const t=this.computeExtent(this.extent_);(isNaN(t[0])||isNaN(t[1]))&&at(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){I()}scale(t,e,i){I()}simplify(t){return this.getSimplifiedGeometry(t*t)}getSimplifiedGeometry(t){return I()}getType(){return I()}applyTransform(t){I()}intersectsExtent(t){return I()}translate(t,e){I()}transform(t,e){const i=Ue(t);if(!i)return this;const n="tile-pixels"==i.getUnits()?function(t,n,s){const r=i.getExtent(),o=i.getWorldExtent(),a=St(o)/St(r);fi(vi,o[0],o[3],a,-a,0,0,0);const l=yi(t,0,t.length,s,vi,n),h=ii(i,e);return h?h(l,l,s):l}:ii(i,e);return n&&this.applyTransform(n),this}}class Si extends Ci{constructor(){super(),this.layout="XY",this.stride=2,this.flatCoordinates}computeExtent(t){return ht(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t)}getCoordinates(){return I()}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=bi(t),this.layout=t,this.flatCoordinates=e}setCoordinates(t,e){I()}setLayout(t,e,i){let n;if(t)n=bi(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=Ei(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();xi(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 s=this.getStride();!function(t,e,i,n,s,r,o,a){a=a||[];const l=o[0],h=o[1];let c=0;for(let o=e;o<i;o+=n){const e=t[o]-l,i=t[o+1]-h;a[c++]=l+s*e,a[c++]=h+r*i;for(let e=o+2;e<o+n;++e)a[c++]=t[e]}a&&a.length!=c&&(a.length=c)}(n,0,n.length,s,t,e,i,n),this.changed()}}translate(t,e){const i=this.getFlatCoordinates();if(i){const n=this.getStride();!function(t,e,i,n,s,r,o){o=o||[];let a=0;for(let l=e;l<i;l+=n){o[a++]=t[l]+s,o[a++]=t[l+1]+r;for(let e=l+2;e<l+n;++e)o[a++]=t[e]}o&&o.length!=a&&(o.length=a)}(i,0,i.length,n,t,e,i),this.changed()}}}function Ei(t){let e;return 2==t?e="XY":3==t?e="XYZ":4==t&&(e="XYZM"),e}function bi(t){let e;return"XY"==t?e=2:"XYZ"==t||"XYM"==t?e=3:"XYZM"==t&&(e=4),e}function Ri(t,e,i,n){let s=0;const r=t[i-n],o=t[i-n+1];let a=0,l=0;for(;e<i;e+=n){const i=t[e]-r,n=t[e+1]-o;s+=l*i-a*n,a=i,l=n}return s/2}function Ii(t,e,i,n){let s=0;for(let r=0,o=i.length;r<o;++r){const o=i[r];s+=Ri(t,e,o,n),e=o}return s}function Mi(t,e,i,n,s,r,o){const a=t[e],l=t[e+1],h=t[i]-a,c=t[i+1]-l;let u;if(0===h&&0===c)u=e;else{const d=((s-a)*h+(r-l)*c)/(h*h+c*c);if(d>1)u=i;else{if(d>0){for(let s=0;s<n;++s)o[s]=jt(t[e+s],t[i+s],d);return void(o.length=n)}u=e}}for(let e=0;e<n;++e)o[e]=t[u+e];o.length=n}function Ti(t,e,i,n,s){let r=t[e],o=t[e+1];for(e+=n;e<i;e+=n){const i=t[e],n=t[e+1],a=Dt(r,o,i,n);a>s&&(s=a),r=i,o=n}return s}function Pi(t,e,i,n,s){for(let r=0,o=i.length;r<o;++r){const o=i[r];s=Ti(t,e,o,n,s),e=o}return s}function Fi(t,e,i,n,s,r,o,a,l,h,c){if(e==i)return h;let u,d;if(0===s){if(d=Dt(o,a,t[e],t[e+1]),d<h){for(u=0;u<n;++u)l[u]=t[e+u];return l.length=n,d}return h}c=c||[NaN,NaN];let g=e+n;for(;g<i;)if(Mi(t,g-n,g,n,o,a,c),d=Dt(o,a,c[0],c[1]),d<h){for(h=d,u=0;u<n;++u)l[u]=c[u];l.length=n,g+=n}else g+=n*Math.max((Math.sqrt(d)-Math.sqrt(h))/s|0,1);if(r&&(Mi(t,i-n,e,n,o,a,c),d=Dt(o,a,c[0],c[1]),d<h)){for(h=d,u=0;u<n;++u)l[u]=c[u];l.length=n}return h}function Li(t,e,i,n,s,r,o,a,l,h,c){c=c||[NaN,NaN];for(let u=0,d=i.length;u<d;++u){const d=i[u];h=Fi(t,e,d,n,s,r,o,a,l,h,c),e=d}return h}function ki(t,e,i,n){for(let s=0,r=i.length;s<r;++s){const r=i[s];for(let i=0;i<n;++i)t[e++]=r[i]}return e}function Ai(t,e,i,n,s){s=s||[];let r=0;for(let o=0,a=i.length;o<a;++o){const a=ki(t,e,i[o],n);s[r++]=a,e=a}return s.length=r,s}function Oi(t,e,i,n,s){s=s||[];let r=0;for(let o=0,a=i.length;o<a;++o){const a=Ai(t,e,i[o],n,s[r]);0===a.length&&(a[0]=e),s[r++]=a,e=a[a.length-1]}return s.length=r,s}function Di(t,e,i,n,s){s=void 0!==s?s:[];let r=0;for(let o=e;o<i;o+=n)s[r++]=t.slice(o,o+n);return s.length=r,s}function Gi(t,e,i,n,s){s=void 0!==s?s:[];let r=0;for(let o=0,a=i.length;o<a;++o){const a=i[o];s[r++]=Di(t,e,a,n,s[r]),e=a}return s.length=r,s}function zi(t,e,i,n,s){s=void 0!==s?s:[];let r=0;for(let o=0,a=i.length;o<a;++o){const a=i[o];s[r++]=1===a.length&&a[0]===e?[]:Gi(t,e,a,n,s[r]),e=a[a.length-1]}return s.length=r,s}function Ni(t,e,i,n,s){return!_t(s,function(s){return!ji(t,e,i,n,s[0],s[1])})}function ji(t,e,i,n,s,r){let o=0,a=t[i-n],l=t[i-n+1];for(;e<i;e+=n){const i=t[e],n=t[e+1];l<=r?n>r&&(i-a)*(r-l)-(s-a)*(n-l)>0&&o++:n<=r&&(i-a)*(r-l)-(s-a)*(n-l)<0&&o--,a=i,l=n}return 0!==o}function Xi(t,e,i,n,s,r){if(0===i.length)return!1;if(!ji(t,e,i[0],n,s,r))return!1;for(let e=1,o=i.length;e<o;++e)if(ji(t,i[e-1],i[e],n,s,r))return!1;return!0}function Ki(t,e,i,n,s){let r;for(e+=n;e<i;e+=n)if(r=s(t.slice(e-n,e),t.slice(e,e+n)),r)return r;return!1}function Wi(t,e,i,n,s,r){return r=r??gt([1/0,1/0,-1/0,-1/0],t,e,i,n),!!Tt(s,r)&&(r[0]>=s[0]&&r[2]<=s[2]||r[1]>=s[1]&&r[3]<=s[3]||Ki(t,e,i,n,function(t,e){return function(t,e,i){let n=!1;const s=st(t,e),r=st(t,i);if(s===B||r===B)n=!0;else{const o=t[0],a=t[1],l=t[2],h=t[3],c=e[0],u=e[1],d=i[0],g=i[1],f=(g-u)/(d-c);let _,p;r&V&&!(s&V)&&(_=d-(g-h)/f,n=_>=o&&_<=l),n||!(r&U)||s&U||(p=g-(d-l)*f,n=p>=a&&p<=h),n||!(r&q)||s&q||(_=d-(g-a)/f,n=_>=o&&_<=l),n||!(r&$)||s&$||(p=g-(d-o)*f,n=p>=a&&p<=h)}return n}(s,t,e)}))}function Yi(t,e,i,n,s){return!!Wi(t,e,i,n,s)||(!!ji(t,e,i,n,s[0],s[1])||(!!ji(t,e,i,n,s[0],s[3])||(!!ji(t,e,i,n,s[2],s[1])||!!ji(t,e,i,n,s[2],s[3]))))}function Zi(t,e,i,n,s){if(!Yi(t,e,i[0],n,s))return!1;if(1===i.length)return!0;for(let e=1,r=i.length;e<r;++e)if(Ni(t,i[e-1],i[e],n,s)&&!Wi(t,i[e-1],i[e],n,s))return!1;return!0}function Bi(t,e,i,n,s,r,o){const a=(i-e)/n;if(a<3){for(;e<i;e+=n)r[o++]=t[e],r[o++]=t[e+1];return o}const l=new Array(a);l[0]=1,l[a-1]=1;const h=[e,i-n];let c=0;for(;h.length>0;){const i=h.pop(),r=h.pop();let o=0;const a=t[r],u=t[r+1],d=t[i],g=t[i+1];for(let e=r+n;e<i;e+=n){const i=Ot(t[e],t[e+1],a,u,d,g);i>o&&(c=e,o=i)}o>s&&(l[(c-e)/n]=1,r+n<c&&h.push(r,c),c+n<i&&h.push(c,i))}for(let i=0;i<a;++i)l[i]&&(r[o++]=t[e+i*n],r[o++]=t[e+i*n+1]);return o}function Vi(t,e,i,n,s,r,o,a){for(let l=0,h=i.length;l<h;++l){const h=i[l];o=Bi(t,e,h,n,s,r,o),a.push(o),e=h}return o}function Ui(t,e){return e*Math.round(t/e)}function qi(t,e,i,n,s,r,o){if(e==i)return o;let a,l,h=Ui(t[e],s),c=Ui(t[e+1],s);e+=n,r[o++]=h,r[o++]=c;do{if(a=Ui(t[e],s),l=Ui(t[e+1],s),(e+=n)==i)return r[o++]=a,r[o++]=l,o}while(a==h&&l==c);for(;e<i;){const i=Ui(t[e],s),u=Ui(t[e+1],s);if(e+=n,i==a&&u==l)continue;const d=a-h,g=l-c,f=i-h,_=u-c;d*_==g*f&&(d<0&&f<d||d==f||d>0&&f>d)&&(g<0&&_<g||g==_||g>0&&_>g)?(a=i,l=u):(r[o++]=a,r[o++]=l,h=a,c=l,a=i,l=u)}return r[o++]=a,r[o++]=l,o}function $i(t,e,i,n,s,r,o,a){for(let l=0,h=i.length;l<h;++l){const h=i[l];o=qi(t,e,h,n,s,r,o),a.push(o),e=h}return o}class Hi extends Si{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 Hi(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(Ti(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Fi(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!0,t,e,i,n))}getArea(){return Ri(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinates(){return Di(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getSimplifiedGeometryInternal(t){const e=[];return e.length=Bi(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e,0),new Hi(e,"XY")}getType(){return"LinearRing"}intersectsExtent(t){return Wi(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=ki(this.flatCoordinates,0,t,this.stride),this.changed()}}class Ji extends Si{constructor(t,e){super(),this.setCoordinates(t,e)}clone(){const t=new Ji(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(t,e,i,n){const s=this.flatCoordinates,r=Dt(t,e,s[0],s[1]);if(r<n){const t=this.stride;for(let e=0;e<t;++e)i[e]=s[e];return i.length=t,r}return n}getCoordinates(){return this.flatCoordinates.slice()}computeExtent(t){return lt(this.flatCoordinates,t)}getType(){return"Point"}intersectsExtent(t){return nt(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,n){for(let s=0;s<n;++s)t[e++]=i[s];return e}(this.flatCoordinates,0,t,this.stride),this.changed()}}function Qi(t,e,i,n,s,r,o){let a,l,h,c,u,d,g;const f=s[r+1],_=[];for(let s=0,r=i.length;s<r;++s){const r=i[s];for(c=t[r-n],d=t[r-n+1],a=e;a<r;a+=n)u=t[a],g=t[a+1],(f<=d&&g<=f||d<=f&&f<=g)&&(h=(f-d)/(g-d)*(u-c)+c,_.push(h)),c=u,d=g}let p=NaN,m=-1/0;for(_.sort(w),c=_[0],a=1,l=_.length;a<l;++a){u=_[a];const s=Math.abs(u-c);s>m&&(h=(c+u)/2,Xi(t,e,i,n,h,f)&&(p=h,m=s)),c=u}return isNaN(p)&&(p=s[r]),o?(o.push(p,f,m),o):[p,f,m]}function tn(t,e,i,n,s){let r=[];for(let o=0,a=i.length;o<a;++o){const a=i[o];r=Qi(t,e,a,n,s,2*o,r),e=a[a.length-1]}return r}function en(t,e,i,n){for(;e<i-n;){for(let s=0;s<n;++s){const r=t[e+s];t[e+s]=t[i-n+s],t[i-n+s]=r}e+=n,i-=n}}function nn(t,e,i,n){let s=0,r=t[i-n],o=t[i-n+1];for(;e<i;e+=n){const i=t[e],n=t[e+1];s+=(i-r)*(n+o),r=i,o=n}return 0===s?void 0:s>0}function sn(t,e,i,n,s){s=void 0!==s&&s;for(let r=0,o=i.length;r<o;++r){const o=i[r],a=nn(t,e,o,n);if(0===r){if(s&&a||!s&&!a)return!1}else if(s&&!a||!s&&a)return!1;e=o}return!0}function rn(t,e,i,n,s){for(let r=0,o=i.length;r<o;++r){const o=i[r];if(!sn(t,e,o,n,s))return!1;o.length&&(e=o[o.length-1])}return!0}function on(t,e,i,n,s){s=void 0!==s&&s;for(let r=0,o=i.length;r<o;++r){const o=i[r],a=nn(t,e,o,n);(0===r?s&&a||!s&&!a:s&&!a||!s&&a)&&en(t,e,o,n),e=o}return e}function an(t,e,i,n,s){for(let r=0,o=i.length;r<o;++r)e=on(t,e,i[r],n,s);return e}class ln extends Si{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?b(this.flatCoordinates,t.getFlatCoordinates()):this.flatCoordinates=t.getFlatCoordinates().slice(),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){const t=new ln(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(Pi(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Li(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!0,t,e,i,n))}containsXY(t,e){return Xi(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,e)}getArea(){return Ii(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride)}getCoordinates(t){let e;return void 0!==t?(e=this.getOrientedFlatCoordinates().slice(),on(e,0,this.ends_,this.stride,t)):e=this.flatCoordinates,Gi(e,0,this.ends_,this.stride)}getEnds(){return this.ends_}getFlatInteriorPoint(){if(this.flatInteriorPointRevision_!=this.getRevision()){const t=xt(this.getExtent());this.flatInteriorPoint_=Qi(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,0),this.flatInteriorPointRevision_=this.getRevision()}return this.flatInteriorPoint_}getInteriorPoint(){return new Ji(this.getFlatInteriorPoint(),"XYM")}getLinearRingCount(){return this.ends_.length}getLinearRing(t){return t<0||this.ends_.length<=t?null:new Hi(this.flatCoordinates.slice(0===t?0:this.ends_[t-1],this.ends_[t]),this.layout)}getLinearRings(){const t=this.layout,e=this.flatCoordinates,i=this.ends_,n=[];let s=0;for(let r=0,o=i.length;r<o;++r){const o=i[r],a=new Hi(e.slice(s,o),t);n.push(a),s=o}return n}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){const t=this.flatCoordinates;sn(t,0,this.ends_,this.stride)?this.orientedFlatCoordinates_=t:(this.orientedFlatCoordinates_=t.slice(),this.orientedFlatCoordinates_.length=on(this.orientedFlatCoordinates_,0,this.ends_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(t){const e=[],i=[];return e.length=$i(this.flatCoordinates,0,this.ends_,this.stride,Math.sqrt(t),e,0,i),new ln(e,"XY",i)}getType(){return"Polygon"}intersectsExtent(t){return Zi(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,2),this.flatCoordinates||(this.flatCoordinates=[]);const i=Ai(this.flatCoordinates,0,t,this.stride,this.ends_);this.flatCoordinates.length=0===i.length?0:i[i.length-1],this.changed()}}function hn(t){if(Pt(t))throw new Error("Cannot create polygon from empty extent");const e=t[0],i=t[1],n=t[2],s=t[3],r=[e,i,e,s,n,s,n,i,e,i];return new ln(r,"XY",[r.length])}var cn=0,un=1,dn=2,gn=3;const fn="undefined"!=typeof navigator&&void 0!==navigator.userAgent?navigator.userAgent.toLowerCase():"";fn.includes("safari")&&!fn.includes("chrom")&&(fn.includes("version/15.4")||/cpu (os|iphone os) 15_4 like mac os x/.test(fn));const _n=fn.includes("webkit")&&!fn.includes("edge"),pn=fn.includes("macintosh"),mn="undefined"!=typeof devicePixelRatio?devicePixelRatio:1,yn="undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof OffscreenCanvas&&self instanceof WorkerGlobalScope,xn="undefined"!=typeof Image&&Image.prototype.decode,vn=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}();function wn(t,e){return e&&(t.src=e),t.src&&xn?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(){r(),e(t)}function s(){r(),i(new Error("Image load error"))}function r(){t.removeEventListener("load",n),t.removeEventListener("error",s)}t.addEventListener("load",n),t.addEventListener("error",s)})}(t)}var Cn=0,Sn=1,En=2,bn=3,Rn=4;function In(t){return Math.pow(t,3)}function Mn(t){return 1-In(1-t)}function Tn(t){return 3*t*t-2*t*t*t}function Pn(t){return t}class Fn extends D{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(h)}release(){this.setState(Rn)}getKey(){return this.key+"/"+this.tileCoord}getTileCoord(){return this.tileCoord}getState(){return this.state}setState(t){if(this.state!==Rn){if(this.state!==bn&&this.state>t)throw new Error("Tile load sequence violation");this.state=t,this.changed()}}load(){I()}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:In(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()}}function Ln(t,e,i,n){let s;return s=i&&i.length?i.shift():yn?new class extends OffscreenCanvas{style={}}(t??300,e??150):document.createElement("canvas"),t&&(s.width=t),e&&(s.height=e),s.getContext("2d",n)}let kn;function An(){return kn||(kn=Ln(1,1)),kn}function On(t){const e=t.canvas;e.width=1,e.height=1,t.clearRect(0,0,1,1)}function Dn(t){let e=t.offsetWidth;const i=getComputedStyle(t);return e+=parseInt(i.marginLeft,10)+parseInt(i.marginRight,10),e}function Gn(t){let e=t.offsetHeight;const i=getComputedStyle(t);return e+=parseInt(i.marginTop,10)+parseInt(i.marginBottom,10),e}function zn(t,e){const i=e.parentNode;i&&i.replaceChild(t,e)}function Nn(t){for(;t.lastChild;)t.lastChild.remove()}function jn(){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 Xn(t){return"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof OffscreenCanvas&&t instanceof OffscreenCanvas}class Kn extends Fn{constructor(t,e,i,n,s,r){super(t,e,r),this.crossOrigin_=n?.crossOrigin,this.referrerPolicy_=n?.referrerPolicy,this.src_=i,this.key=i,this.image_,yn?this.image_=new OffscreenCanvas(1,1):(this.image_=new Image,null!==this.crossOrigin_&&void 0!==this.crossOrigin_&&(this.image_.crossOrigin=this.crossOrigin_),void 0!==this.referrerPolicy_&&(this.image_.referrerPolicy=this.referrerPolicy_)),this.unlisten_=null,this.tileLoadFunction_=s}getImage(){return this.image_}setImage(t){this.image_=t,this.state=En,this.unlistenImage_(),this.changed()}getCrossOrigin(){return this.crossOrigin_??null}getReferrerPolicy(){return this.referrerPolicy_}handleImageError_(){this.state=bn,this.unlistenImage_(),this.image_=function(){const t=Ln(1,1);return t.fillStyle="rgba(0,0,0,0)",t.fillRect(0,0,1,1),t.canvas}(),this.changed()}handleImageLoad_(){if(yn)this.state=En;else{const t=this.image_;t.naturalWidth&&t.naturalHeight?this.state=En:this.state=Rn}this.unlistenImage_(),this.changed()}load(){if(this.state==bn&&(this.state=Cn,this.image_=new Image,null!==this.crossOrigin_&&void 0!==this.crossOrigin_&&(this.image_.crossOrigin=this.crossOrigin_),void 0!==this.referrerPolicy_&&(this.image_.referrerPolicy=this.referrerPolicy_)),this.state==Cn){this.state=Sn,this.changed(),this.tileLoadFunction_(this,this.src_);const t=this.image_;t&&(this.unlisten_=function(t,e,i){const n=t;let s=!0,r=!1,o=!1;const h=[a(n,m,function(){o=!0,r||e()})];return n.src&&xn?(r=!0,n.decode().then(function(){s&&e()}).catch(function(t){s&&(o?e():i())})):h.push(a(n,c,i)),function(){s=!1,h.forEach(l)}}(t,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this)))}}unlistenImage_(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)}disposeInternal(){this.unlistenImage_(),this.image_=null,super.disposeInternal()}}class Wn{constructor(t,e,i){this.decay_=t,this.minVelocity_=e,this.delay_=i,this.points_=[],this.angle_=0,this.initialVelocity_=0}begin(){this.points_.length=0,this.angle_=0,this.initialVelocity_=0}update(t,e){this.points_.push(t,e,Date.now())}end(){if(this.points_.length<6)return!1;const t=Date.now()-this.delay_,e=this.points_.length-3;if(this.points_[e+2]<t)return!1;let i=e-3;for(;i>0&&this.points_[i+2]>t;)i-=3;const n=this.points_[e+2]-this.points_[i+2];if(n<1e3/60)return!1;const s=this.points_[e]-this.points_[i],r=this.points_[e+1]-this.points_[i+1];return this.angle_=Math.atan2(r,s),this.initialVelocity_=Math.sqrt(s*s+r*r)/n,this.initialVelocity_>this.minVelocity_}getDistance(){return(this.minVelocity_-this.initialVelocity_)/this.decay_}getAngle(){return this.angle_}}function Yn(t,e,i,n,s,r,o){let a,l;const h=(i-e)/n;if(1===h)a=e;else if(2===h)a=e,l=s;else if(0!==h){let r=t[e],o=t[e+1],h=0;const c=[0];for(let s=e+n;s<i;s+=n){const e=t[s],i=t[s+1];h+=Math.sqrt((e-r)*(e-r)+(i-o)*(i-o)),c.push(h),r=e,o=i}const u=s*h,d=function(t,e,i){let n,s;i=i||w;let r=0,o=t.length,a=!1;for(;r<o;)n=r+(o-r>>1),s=+i(t[n],e),s<0?r=n+1:(o=n,a=!s);return a?r:~r}(c,u);d<0?(l=(u-c[-d-2])/(c[-d-1]-c[-d-2]),a=e+(-d-2)*n):a=e+d*n}o=void 0!==o&&o>1?o:2,r=r||new Array(o);for(let e=0;e<o;++e)r[e]=void 0===a?NaN:void 0===l?t[a+e]:jt(t[a+e],t[a+n+e],l);return r}function Zn(t,e,i,n,s,r){if(i==e)return null;let o;if(s<t[e+n-1])return r?(o=t.slice(e,e+n),o[n-1]=s,o):null;if(t[i-1]<s)return r?(o=t.slice(i-n,i),o[n-1]=s,o):null;if(s==t[e+n-1])return t.slice(e,e+n);let a=e/n,l=i/n;for(;a<l;){const e=a+l>>1;s<t[(e+1)*n-1]?l=e:a=e+1}const h=t[a*n-1];if(s==h)return t.slice((a-1)*n,(a-1)*n+n);const c=(s-h)/(t[(a+1)*n-1]-h);o=[];for(let e=0;e<n-1;++e)o.push(jt(t[(a-1)*n+e],t[a*n+e],c));return o.push(s),o}function Bn(t,e,i,n){let s=t[e],r=t[e+1],o=0;for(let a=e+n;a<i;a+=n){const e=t[a],i=t[a+1];o+=Math.sqrt((e-s)*(e-s)+(i-r)*(i-r)),s=e,r=i}return o}class Vn extends Si{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){b(this.flatCoordinates,t),this.changed()}clone(){const t=new Vn(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(Ti(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Fi(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!1,t,e,i,n))}forEachSegment(t){return Ki(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,Zn(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e))}getCoordinates(){return Di(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinateAt(t,e){return Yn(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e,this.stride)}getLength(){return Bn(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=Bi(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e,0),new Vn(e,"XY")}getType(){return"LineString"}intersectsExtent(t){return Wi(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=ki(this.flatCoordinates,0,t,this.stride),this.changed()}}const Un=[NaN,NaN,NaN,0];let qn;const $n=/^rgba?\(\s*(\d+%?)\s+(\d+%?)\s+(\d+%?)(?:\s*\/\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,Hn=/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,Jn=/^rgba?\(\s*(\d+%)\s*,\s*(\d+%)\s*,\s*(\d+%)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,Qn=/^#([\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$/i;function ts(t,e){return t.endsWith("%")?Number(t.substring(0,t.length-1))/e:Number(t)}function es(t){throw new Error('failed to parse "'+t+'" as color')}function is(t){if(t.toLowerCase().startsWith("rgb")){const e=t.match(Hn)||t.match($n)||t.match(Jn);if(e){const t=e[4],i=100/255;return[At(ts(e[1],i)+.5|0,0,255),At(ts(e[2],i)+.5|0,0,255),At(ts(e[3],i)+.5|0,0,255),void 0!==t?At(ts(t,100),0,1):1]}es(t)}if(t.startsWith("#")){if(Qn.test(t)){const e=t.substring(1),i=e.length<=4?1:2,n=[0,0,0,255];for(let t=0,s=e.length;t<s;t+=i){let s=parseInt(e.substring(t,t+i),16);1===i&&(s+=s<<4),n[t/i]=s}return n[3]=n[3]/255,n}es(t)}const e=(qn||(qn=Ln(1,1,void 0,{willReadFrequently:!0,desynchronized:!0})),qn);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&&es(t));const n=e.fillStyle;if(n.startsWith("#")||n.startsWith("rgba"))return is(n);e.clearRect(0,0,1,1),e.fillRect(0,0,1,1);const s=Array.from(e.getImageData(0,0,1,1).data);return s[3]=Xt(s[3]/255,3),s}const ns={};let ss=0;function rs(t){if(4===t.length)return t;const e=t.slice();return e[3]=1,e}function os(t){return t>.0031308?269.025*Math.pow(t,1/2.4)-14.025:3294.6*t}function as(t){return t>.2068965?Math.pow(t,3):108/841*(t-4/29)}function ls(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 cs(t){const e=ls(t[0]),i=ls(t[1]),n=ls(t[2]),s=hs(.222488403*e+.716873169*i+.06060791*n),r=500*(hs(.452247074*e+.399439023*i+.148375274*n)-s),o=200*(s-hs(.016863605*e+.117638439*i+.865350722*n)),a=Math.atan2(o,r)*(180/Math.PI);return[116*s-16,Math.sqrt(r*r+o*o),a<0?a+360:a,t[3]]}function us(t){if("none"===t)return Un;if(ns.hasOwnProperty(t))return ns[t];if(ss>=1024){let t=0;for(const e in ns)3&t++||(delete ns[e],--ss)}const e=is(t);4!==e.length&&es(t);for(const i of e)isNaN(i)&&es(t);return ns[t]=e,++ss,e}function ds(t){return Array.isArray(t)?t:us(t)}function gs(t){let e=t[0];e!=(0|e)&&(e=e+.5|0);let i=t[1];i!=(0|i)&&(i=i+.5|0);let n=t[2];n!=(0|n)&&(n=n+.5|0);return"rgba("+e+","+i+","+n+","+(void 0===t[3]?1:Math.round(1e3*t[3])/1e3)+")"}function fs(t,e){return t+":"+(e?ds(e):"null")}const _s=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=fs(t,e);return i in this.cache_?this.cache_[i]:null}getPattern(t,e){const i=fs(t,e);return i in this.patternCache_?this.patternCache_[i]:null}set(t,e,i,n){const s=fs(t,e),r=s in this.cache_;if(i&&(this.cache_[s]=i),n&&i)if(i.getImageState()===cn&&i.load(),i.getImageState()===un)i.ready().then(()=>{const t=An().createPattern(i.getImage(1),"repeat");t&&(this.patternCache_[s]=t)});else{const t=An().createPattern(i.getImage(1),"repeat");t&&(this.patternCache_[s]=t)}r||++this.cacheSize_}setSize(t){this.maxCacheSize_=t,this.expire()}};let ps=null;class ms extends D{constructor(t,e,i,n,s){super(),this.hitDetectionImage_=null,this.image_=t,this.crossOrigin_=i?.crossOrigin??null,this.referrerPolicy_=i?.referrerPolicy,this.canvas_={},this.color_=s,this.imageState_=void 0===n?cn: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_&&this.imageState_===dn){const t=this.image_;if(!t)return!1;ps||(ps=Ln(1,1,void 0,{willReadFrequently:!0})),ps.drawImage(t,0,0);try{ps.getImageData(0,0,1,1),this.tainted_=!1}catch{ps=null,this.tainted_=!0}}return!0===this.tainted_}dispatchChangeEvent_(){this.dispatchEvent(h)}handleImageError_(){this.imageState_=gn,this.dispatchChangeEvent_()}handleImageLoad_(){this.imageState_=dn;const t=this.image_;t&&"width"in t&&"height"in t&&(this.size_=[t.width,t.height]),this.dispatchChangeEvent_()}getImage(t){this.image_||this.initializeImage_(),this.replaceColor_(t);const e=this.image_;return this.canvas_[t]?this.canvas_[t]:e}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_;if(!t)return this.image_;const e=t[0],i=t[1],n=Ln(e,i);n.fillRect(0,0,e,i),this.hitDetectionImage_=n.canvas}else this.hitDetectionImage_=this.image_;return this.hitDetectionImage_}getSize(){return this.size_}getSrc(){return this.src_}load(){if(this.imageState_===cn){this.image_||this.initializeImage_(),this.imageState_=un;try{void 0!==this.src_&&(this.image_.src=this.src_)}catch{this.handleImageError_()}this.image_ instanceof HTMLImageElement&&wn(this.image_,this.src_).then(t=>{this.image_=t,this.handleImageLoad_()}).catch(this.handleImageError_.bind(this))}}replaceColor_(t){if(!this.color_||this.canvas_[t]||this.imageState_!==dn)return;const e=this.image_;if(!e)return;const i=Ln(Math.ceil(e.width*t),Math.ceil(e.height*t)),n=i.canvas;var s;i.scale(t,t),i.drawImage(e,0,0),i.globalCompositeOperation="multiply",i.fillStyle="string"==typeof(s=this.color_)?s:gs(s),i.fillRect(0,0,n.width/t,n.height/t),i.globalCompositeOperation="destination-in",i.drawImage(e,0,0),this.canvas_[t]=n}ready(){return this.ready_||(this.ready_=new Promise(t=>{if(this.imageState_===dn||this.imageState_===gn)t();else{const e=()=>{this.imageState_!==dn&&this.imageState_!==gn||(this.removeEventListener(h,e),t())};this.addEventListener(h,e)}})),this.ready_}}function ys(t,e,i,n,s,r){let o=void 0===e?void 0:_s.get(e,s);return o||(o=new ms(t,t&&"src"in t?t.src||void 0:e,i,n,s),void 0!==e&&_s.set(e,s,o,r)),r&&o&&void 0!==e&&!_s.getPattern(e,s)&&_s.set(e,s,o,r),o}function xs(t){return t?Array.isArray(t)?gs(t):"object"==typeof t&&"src"in t?function(t){if(!t.offset||!t.size)return _s.getPattern(t.src,t.color??null);const e=t.src+":"+t.offset,i=_s.getPattern(e,t.color??null);if(i)return i;const n=_s.get(t.src,null);if(!n||n.getImageState()!==dn)return null;const s=Ln(t.size[0],t.size[1]);return s.drawImage(n.getImage(1),t.offset[0],t.offset[1],t.size[0],t.size[1],0,0,t.size[0],t.size[1]),ys(s.canvas,e,{},dn,t.color??null,!0),_s.getPattern(e,t.color??null)}(t):t:null}function vs(t,e,i,n,s,r,o,a){o=o??[],a=a??n;const l=t[e+n],h=t[e+n+1],c=t[i-2*n],u=t[i-2*n+1];let d,g,f,_,p,m,y,x,v=0;for(let w=e;w<i;w+=n){f=d,_=g,p=void 0,m=void 0,w+n<i&&(p=t[w+n],m=t[w+n+1]),r&&w===e&&(f=c,_=u),r&&w===i-n&&(p=l,m=h),d=t[w],g=t[w+1],[y,x]=ws(d,g,f,_,p,m,s),o[v++]=y,o[v++]=x;for(let e=2;e<a;e++)o[v++]=t[w+e]}return o.length!=v&&(o.length=v),o}function ws(t,e,i,n,s,r,o){let a,l;void 0!==i&&void 0!==n?(a=t-i,l=e-n):void 0!==s&&void 0!==r?(a=s-t,l=r-e):(a=1,l=0);const h=Math.hypot(a,l),c=a/h,u=l/h;if(a=-u,l=c,void 0===i||void 0===n)return[t+a*o,e+l*o];if(void 0===s||void 0===r)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])),s=[(e[0]-t[0])/n,(e[1]-t[1])/n],r=[-s[1],s[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(At(a[0]*s[0]+a[1]*s[1],-1,1));return l=Math.max(l,1e-5),a[0]*r[0]+a[1]*r[1]>0?l:2*Math.PI-l}([t,e],[i,n],[s,r]);if(Math.cos(d)>.998)return[t+c*o,e+u*o];const g=Math.cos(d/2),f=Math.sin(d/2);return[t+(f*a+g*l)*(1/f)*o,e+(-g*a+f*l)*(1/f)*o]}function Cs(t,e,i=!1){for(let n=0,s=t.length-2;n<s;n+=e){for(let s=i&&0===n?t.length-3*e:t.length-2*e;s>n+e;s-=e){const i=t[n],r=t[n+1],o=t[n+e],a=t[n+e+1],l=t[s],h=t[s+1],c=t[s+e],u=t[s+e+1],d=(u-h)*(o-i)-(c-l)*(a-r);if(0===d)continue;const g=((c-l)*(r-h)-(u-h)*(i-l))/d,f=((o-i)*(r-h)-(a-r)*(i-l))/d;if(g>0&&g<1&&f>0&&f<1){const l=i+g*(o-i),h=r+g*(a-r);t[n+e]=l,t[n+e+1]=h,t.splice(n+2*e,s-n-e);break}}}return t}class Ss{drawCustom(t,e,i,n,s){}drawGeometry(t){}setStyle(t){}drawCircle(t,e,i){}drawFeature(t,e,i){}drawGeometryCollection(t,e,i){}drawLineString(t,e,i){}drawMultiLineString(t,e,i){}drawMultiPoint(t,e,i){}drawMultiPolygon(t,e,i){}drawPoint(t,e,i){}drawPolygon(t,e,i){}drawText(t,e,i){}setFillStrokeStyle(t,e){}setImageStyle(t,e){}setTextStyle(t,e){}}const Es="ol-hidden",bs="ol-unselectable",Rs="ol-unsupported",Is="ol-control",Ms="ol-collapsed",Ts=new RegExp(["^\\s*(?=(?:(?:[-a-z]+\\s*){0,2}(italic|oblique))?)","(?=(?:(?:[-a-z]+\\s*){0,2}(small-caps))?)","(?=(?:(?:[-a-z]+\\s*){0,2}(bold(?:er)?|lighter|[1-9]00 ))?)","(?:(?:normal|\\1|\\2|\\3)\\s*){0,3}((?:xx?-)?","(?:small|large)|medium|smaller|larger|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx]))","(?:\\s*\\/\\s*(normal|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx])?))","?\\s*([-,\\\"\\'\\sa-z0-9]+?)\\s*$"].join(""),"i"),Ps=["style","variant","weight","size","lineHeight","family"],Fs={normal:400,bold:700},Ls=function(t){const e=t.match(Ts);if(!e)return null;const i={lineHeight:"normal",size:"1.2em",style:"normal",weight:"400",variant:"normal"};for(let t=0,n=Ps.length;t<n;++t){const n=e[t+1];void 0!==n&&(i[Ps[t]]="string"==typeof n?n.trim():n)}return isNaN(Number(i.weight))&&i.weight in Fs&&(i.weight=Fs[i.weight]),i.families=i.family.split(/,\s?/).map(t=>t.trim().replace(/^['"]|['"]$/g,"")),i},ks="10px sans-serif",As="#000",Os="round",Ds=[],Gs="round",zs="#000",Ns="center",js="middle",Xs=[0,0,0,0],Ks=new N;let Ws,Ys=null;const Zs={},Bs=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace","ui-rounded","emoji","math","fangsong"]);function Vs(t,e,i){return`${t} ${e} 16px "${i}"`}const Us=function(){const t=100;let e,i;async function n(t){await i.ready;const e=Ls(t);if(!e)return!1;const n=e.families[0].toLowerCase(),s=e.weight,r=[];if(i.forEach(t=>{const i=t.family.replace(/^['"]|['"]$/g,"").toLowerCase(),o=Fs[t.weight]||t.weight;i===n&&t.style===e.style&&o==s&&r.push(t)}),0===r.length)return!1;return(await Promise.all(r.map(t=>t.load().then(()=>!0,()=>!1)))).some(t=>t)}async function r(){await i.ready;let o=!0;const a=Ks.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)?(s(Zs),Ks.set(i,t)):(r+=10,Ks.set(i,r,!0),r<t&&(o=!1)))}e=void 0,o||(e=setTimeout(r,100))}return async function(t){i||(i=yn?self.fonts:document.fonts);const n=Ls(t);if(!n)return;const s=n.families;let o=!1;for(const t of s){if(Bs.has(t))continue;const e=Vs(n.style,n.weight,t);void 0===Ks.get(e)&&(Ks.set(e,0,!0),o=!0)}o&&(clearTimeout(e),e=setTimeout(r,100))}}(),qs=function(){let t;return function(e){let i=Zs[e];if(null==i){if(yn){const t=Ls(e),n=$s(e,"Žg");i=(!t||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);Zs[e]=i}return i}}();function $s(t,e){return Ys||(Ys=Ln(1,1)),t!=Ws&&(Ys.font=t,Ws=Ys.font),Ys.measureText(e)}function Hs(t,e){return $s(t,e).width}function Js(t,e,i){if(e in i)return i[e];const n=e.split("\n").reduce((e,i)=>Math.max(e,Hs(t,i)),0);return i[e]=n,n}function Qs(t,e,i,n,s,r,o,a,l,h,c){t.save(),1!==i&&(void 0===t.globalAlpha?t.globalAlpha=function(t){return t.globalAlpha*=i}:t.globalAlpha*=i),e&&t.transform.apply(t,e),n.contextInstructions?(t.translate(l,h),t.scale(c[0],c[1]),function(t,e){const i=e,n=t.contextInstructions;for(let t=0,e=n.length;t<e;t+=2)if(Array.isArray(n[t+1])){i[n[t]].apply(i,n[t+1])}else{i[n[t]]=n[t+1]}}(n,t)):c[0]<0||c[1]<0?(t.translate(l,h),t.scale(c[0],c[1]),t.drawImage(n,s,r,o,a,0,0,o,a)):t.drawImage(n,s,r,o,a,l,h,o*c[0],a*c[1]),t.restore()}class tr extends Ss{constructor(t,e,i,n,s,r,o){super(),this.context_=t,this.pixelRatio_=e,this.extent_=i,this.transform_=n,this.transformRotation_=n?Xt(Math.atan2(n[1],n[0]),10):0,this.viewRotation_=s,this.squaredTolerance_=r,this.userTransform_=o,this.contextFillState_=null,this.contextStrokeState_=null,this.contextTextState_=null,this.fillState_=null,this.strokeState_=null,this.image_=null,this.imageAnchorX_=0,this.imageAnchorY_=0,this.imageHeight_=0,this.imageOpacity_=0,this.imageOriginX_=0,this.imageOriginY_=0,this.imageRotateWithView_=!1,this.imageRotation_=0,this.imageScale_=[0,0],this.imageWidth_=0,this.text_="",this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=!1,this.textRotation_=0,this.textScale_=[0,0],this.textFillState_=null,this.textStrokeState_=null,this.textState_=null,this.pixelCoordinates_=[],this.tmpLocalTransform_=di()}drawImages_(t,e,i,n){if(!this.image_)return;const s=yi(t,e,i,n,this.transform_,this.pixelCoordinates_),r=this.context_,o=this.tmpLocalTransform_,a=r.globalAlpha;1!=this.imageOpacity_&&(r.globalAlpha=a*this.imageOpacity_);let l=this.imageRotation_;0===this.transformRotation_&&(l-=this.viewRotation_),this.imageRotateWithView_&&(l+=this.viewRotation_);for(let t=0,e=s.length;t<e;t+=2){const e=s[t]-this.imageAnchorX_,i=s[t+1]-this.imageAnchorY_;if(0!==l||1!=this.imageScale_[0]||1!=this.imageScale_[1]){const t=e+this.imageAnchorX_,n=i+this.imageAnchorY_;fi(o,t,n,1,1,l,-t,-n),r.save(),r.transform.apply(r,o),r.translate(t,n),r.scale(this.imageScale_[0],this.imageScale_[1]),r.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,-this.imageAnchorX_,-this.imageAnchorY_,this.imageWidth_,this.imageHeight_),r.restore()}else r.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,e,i,this.imageWidth_,this.imageHeight_)}1!=this.imageOpacity_&&(r.globalAlpha=a)}drawText_(t,e,i,n){if(!this.textState_||""===this.text_)return;this.textFillState_&&this.setContextFillState_(this.textFillState_),this.textStrokeState_&&this.setContextStrokeState_(this.textStrokeState_),this.setContextTextState_(this.textState_);const s=yi(t,e,i,n,this.transform_,this.pixelCoordinates_),r=this.context_;let o=this.textRotation_;for(0===this.transformRotation_&&(o-=this.viewRotation_),this.textRotateWithView_&&(o+=this.viewRotation_);e<i;e+=n){const t=s[e]+this.textOffsetX_,i=s[e+1]+this.textOffsetY_;0!==o||1!=this.textScale_[0]||1!=this.textScale_[1]?(r.save(),r.translate(t-this.textOffsetX_,i-this.textOffsetY_),r.rotate(o),r.translate(this.textOffsetX_,this.textOffsetY_),r.scale(this.textScale_[0],this.textScale_[1]),this.textStrokeState_&&r.strokeText(this.text_,0,0),this.textFillState_&&r.fillText(this.text_,0,0),r.restore()):(this.textStrokeState_&&r.strokeText(this.text_,t,i),this.textFillState_&&r.fillText(this.text_,t,i))}}moveToLineTo_(t,e,i,n,s,r){const o=this.context_,a=r??0;let l=yi(t,e,i,n,this.transform_,this.pixelCoordinates_);if(Math.abs(a)>0){const t=l.length,e=s||Math.abs(l[0]-l[t-2])<1e-6&&Math.abs(l[1]-l[t-1])<1e-6;l=vs(l,0,t,2,a,e,l),Cs(l,2,e)}o.moveTo(l[0],l[1]);let h=l.length;s&&(h-=2);for(let t=2;t<h;t+=2)o.lineTo(l[t],l[t+1]);return s&&o.closePath(),i}drawRings_(t,e,i,n,s){for(let r=0,o=i.length;r<o;++r)e=this.moveToLineTo_(t,e,i[r],n,!0,s);return e}drawCircle(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),Tt(this.extent_,t.getExtent())){if(this.fillState_||this.strokeState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const e=function(t,e,i){const n=t.getFlatCoordinates();if(!n)return null;const s=t.getStride();return yi(n,0,n.length,s,e,i)}(t,this.transform_,this.pixelCoordinates_);if(!e)return;const i=e[2]-e[0],n=e[3]-e[1],s=Math.sqrt(i*i+n*n),r=this.context_;r.beginPath(),r.arc(e[0],e[1],s,0,2*Math.PI),this.fillState_&&r.fill(),this.strokeState_&&r.stroke()}""!==this.text_&&this.drawText_(t.getCenter(),0,2,2)}}setStyle(t){this.setFillStrokeStyle(t.getFill()??null,t.getStroke()??null),this.setImageStyle(t.getImage()??null),this.setTextStyle(t.getText()??null)}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_)),Tt(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(Tt(this.extent_,e)){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);const e=this.context_,i=t.getFlatCoordinates();let n=0;const s=t.getEnds(),r=t.getStride();e.beginPath();for(let t=0,e=s.length;t<e;++t)n=this.moveToLineTo_(i,n,s[t],r,!1,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_)),Tt(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_)),Tt(this.extent_,t.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const e=this.context_,i=t.getOrientedFlatCoordinates();let n=0;const s=t.getEndss(),r=t.getStride();e.beginPath();for(let t=0,e=s.length;t<e;++t){const e=s[t];n=this.drawRings_(i,n,e,r,this.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),R(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:Ns;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:xs(e||As)||As}}else this.fillState_=null;if(e){const t=e.getColor(),i=e.getLineCap(),n=e.getLineDash(),s=e.getLineDashOffset(),r=e.getLineJoin(),o=e.getWidth(),a=e.getMiterLimit(),l=n||Ds,h=e.getOffset();this.strokeState_={lineCap:void 0!==i?i:Os,lineDash:1===this.pixelRatio_?l:l.map(t=>t*this.pixelRatio_),lineDashOffset:(s||0)*this.pixelRatio_,lineJoin:void 0!==r?r:Gs,lineWidth:(void 0!==o?o:1)*this.pixelRatio_,miterLimit:void 0!==a?a:10,strokeStyle:xs(t||zs)||zs,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(),s=t.getOrigin();if(!n||!s)return void(this.image_=null);this.image_=t.getImage(this.pixelRatio_),this.imageAnchorX_=n[0]*i,this.imageAnchorY_=n[1]*i,this.imageHeight_=e[1]*i,this.imageOpacity_=t.getOpacity(),this.imageOriginX_=s[0],this.imageOriginY_=s[1],this.imageRotateWithView_=t.getRotateWithView(),this.imageRotation_=t.getRotation();const r=t.getScaleArray();this.imageScale_=[r[0]*this.pixelRatio_/i,r[1]*this.pixelRatio_/i],this.imageWidth_=e[0]*i}setTextStyle(t){if(t){const e=t.getFill();if(e){const t=e.getColor();this.textFillState_={fillStyle:xs(t||As)||As}}else this.textFillState_=null;const i=t.getStroke();if(i){const t=i.getColor(),e=i.getLineCap(),n=i.getLineDash(),s=i.getLineDashOffset(),r=i.getLineJoin(),o=i.getWidth(),a=i.getMiterLimit();this.textStrokeState_={lineCap:void 0!==e?e:Os,lineDash:n||Ds,lineDashOffset:s||0,lineJoin:void 0!==r?r:Gs,lineWidth:void 0!==o?o:1,miterLimit:void 0!==a?a:10,strokeStyle:xs(t||zs)||zs}}else this.textStrokeState_=null;const n=t.getFont(),s=t.getOffsetX(),r=t.getOffsetY(),o=t.getRotateWithView(),a=t.getRotation(),l=t.getScaleArray(),h=t.getText(),c=t.getTextAlign(),u=t.getTextBaseline();this.textState_={font:void 0!==n?n:ks,textAlign:void 0!==c?c:Ns,textBaseline:void 0!==u?u:js},this.text_=void 0!==h?Array.isArray(h)?h.reduce((t,e,i)=>t+(i%2?" ":e),""):h:"",this.textOffsetX_=void 0!==s?this.pixelRatio_*s:0,this.textOffsetY_=void 0!==r?this.pixelRatio_*r:0,this.textRotateWithView_=void 0!==o&&o,this.textRotation_=void 0!==a?a:0,this.textScale_=[this.pixelRatio_*l[0],this.pixelRatio_*l[1]]}else this.text_=""}}const er={Point:function(t,e,i,n,s,r){const o=i.getImage(),a=i.getText(),l=a&&a.getText(),h=r&&o&&l?{}:void 0;if(o){if(o.getImageState()!=dn)return;const r=t.getBuilder(i.getZIndex(),"Image");r.setImageStyle(o,h),r.drawPoint(e,n,s)}if(l){const r=t.getBuilder(i.getZIndex(),"Text");r.setTextStyle(a,h),r.drawText(e,n,s)}},LineString:function(t,e,i,n,s){const r=i.getStroke();if(r){const o=t.getBuilder(i.getZIndex(),"LineString");o.setFillStrokeStyle(null,r),o.drawLineString(e,n,s)}const o=i.getText();if(o&&o.getText()){const r=t.getBuilder(i.getZIndex(),"Text");r.setTextStyle(o),r.drawText(e,n,s)}},Polygon:function(t,e,i,n,s){const r=i.getFill(),o=i.getStroke();if(r||o){const a=t.getBuilder(i.getZIndex(),"Polygon");a.setFillStrokeStyle(r,o),a.drawPolygon(e,n,s)}const a=i.getText();if(a&&a.getText()){const r=t.getBuilder(i.getZIndex(),"Text");r.setTextStyle(a),r.drawText(e,n,s)}},MultiPoint:function(t,e,i,n,s,r){const o=i.getImage(),a=o&&0!==o.getOpacity(),l=i.getText(),h=l&&l.getText(),c=r&&a&&h?{}:void 0;if(a){if(o.getImageState()!=dn)return;const r=t.getBuilder(i.getZIndex(),"Image");r.setImageStyle(o,c),r.drawMultiPoint(e,n,s)}if(h){const r=t.getBuilder(i.getZIndex(),"Text");r.setTextStyle(l,c),r.drawText(e,n,s)}},MultiLineString:function(t,e,i,n,s){const r=i.getStroke();if(r){const o=t.getBuilder(i.getZIndex(),"LineString");o.setFillStrokeStyle(null,r),o.drawMultiLineString(e,n,s)}const o=i.getText();if(o&&o.getText()){const r=t.getBuilder(i.getZIndex(),"Text");r.setTextStyle(o),r.drawText(e,n,s)}},MultiPolygon:function(t,e,i,n,s){const r=i.getFill(),o=i.getStroke();if(o||r){const a=t.getBuilder(i.getZIndex(),"Polygon");a.setFillStrokeStyle(r,o),a.drawMultiPolygon(e,n,s)}const a=i.getText();if(a&&a.getText()){const r=t.getBuilder(i.getZIndex(),"Text");r.setTextStyle(a),r.drawText(e,n,s)}},GeometryCollection:function(t,e,i,n,s,r){const o=e.getGeometriesArray();let a,l;for(a=0,l=o.length;a<l;++a){(0,er[o[a].getType()])(t,o[a],i,n,s,r)}},Circle:function(t,e,i,n,s){const r=i.getFill(),o=i.getStroke();if(r||o){const a=t.getBuilder(i.getZIndex(),"Circle");a.setFillStrokeStyle(r,o),a.drawCircle(e,n,s)}const a=i.getText();if(a&&a.getText()){const r=t.getBuilder(i.getZIndex(),"Text");r.setTextStyle(a),r.drawText(e,n,s)}}};function ir(t,e){return parseInt(T(t),10)-parseInt(T(e),10)}function nr(t,e){const i=sr(t,e);return i*i}function sr(t,e){return.5*t/e}function rr(t,e,i,n,s,r,o,a){const l=[],h=i.getImage();if(h){let t=!0;const e=h.getImageState();e==dn||e==gn?t=!1:e==cn&&h.load(),t&&l.push(h.ready())}const c=i.getFill();c&&c.loading()&&l.push(c.ready());const u=l.length>0;return u&&Promise.all(l).then(()=>s(null)),function(t,e,i,n,s,r,o){const a=i.getGeometryFunction()(e);if(!a)return;const l=a.simplifyTransformed(n,s),h=i.getRenderer();if(h)or(t,l,i,e,o);else{(0,er[l.getType()])(t,l,i,e,o,r)}}(t,e,i,n,r,o,a),u}function or(t,e,i,n,s){if("GeometryCollection"==e.getType()){const r=e.getGeometries();for(let e=0,o=r.length;e<o;++e)or(t,r[e],i,n,s);return}t.getBuilder(i.getZIndex(),"Default").drawCustom(e,n,i.getRenderer(),i.getHitDetectionRenderer(),s)}var ar="prerender",lr="postrender",hr="precompose",cr="postcompose",ur="rendercomplete";function dr(t,e){return function(i,n,s,r,o){!function(t,e,i,n,s,r,o){const a=new XMLHttpRequest;a.open("GET","function"==typeof t?t(i,n,s):t,!0),"arraybuffer"==e.getType()&&(a.responseType="arraybuffer"),a.withCredentials=!1,a.onload=function(t){if(!a.status||a.status>=200&&a.status<300){const t=e.getType();try{let n;"text"==t||"json"==t?n=a.responseText:"xml"==t?n=a.responseXML||a.responseText:"arraybuffer"==t&&(n=a.response),n?r(e.readFeatures(n,{extent:i,featureProjection:s}),e.readProjection(n)):o()}catch{o()}}else o()},a.onerror=o,a.send()}(t,e,i,n,s,(t,e)=>{this.addFeatures(t),void 0!==r&&r(t)},()=>{this.changed(),void 0!==o&&o()})}}function gr(t,e){return[[-1/0,-1/0,1/0,1/0]]}class fr extends Si{constructor(t,e,i){if(super(),this.ends_=[],this.maxDelta_=-1,this.maxDeltaRevision_=-1,Array.isArray(t[0]))this.setCoordinates(t,e);else if(void 0!==e&&i)this.setFlatCoordinates(e,t),this.ends_=i;else{const e=t,i=[],n=[];for(let t=0,s=e.length;t<s;++t){b(i,e[t].getFlatCoordinates()),n.push(i.length)}const s=0===e.length?this.getLayout():e[0].getLayout();this.setFlatCoordinates(s,i),this.ends_=n}}appendLineString(t){b(this.flatCoordinates,t.getFlatCoordinates().slice()),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){const t=new fr(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(Pi(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Li(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!1,t,e,i,n))}getCoordinateAtM(t,e,i){return"XYM"!=this.layout&&"XYZM"!=this.layout||0===this.flatCoordinates.length?null:(e=void 0!==e&&e,i=void 0!==i&&i,function(t,e,i,n,s,r,o){if(o)return Zn(t,e,i[i.length-1],n,s,r);let a;if(s<t[n-1])return r?(a=t.slice(0,n),a[n-1]=s,a):null;if(t[t.length-1]<s)return r?(a=t.slice(t.length-n),a[n-1]=s,a):null;for(let r=0,o=i.length;r<o;++r){const o=i[r];if(e!=o){if(s<t[e+n-1])return null;if(s<=t[o-1])return Zn(t,e,o,n,s,!1);e=o}}return null}(this.flatCoordinates,0,this.ends_,this.stride,t,e,i))}getCoordinates(){return Gi(this.flatCoordinates,0,this.ends_,this.stride)}getEnds(){return this.ends_}getLineString(t){return t<0||this.ends_.length<=t?null:new Vn(this.flatCoordinates.slice(0===t?0:this.ends_[t-1],this.ends_[t]),this.layout)}getLineStrings(){const t=this.flatCoordinates,e=this.ends_,i=this.layout,n=[];let s=0;for(let r=0,o=e.length;r<o;++r){const o=e[r],a=new Vn(t.slice(s,o),i);n.push(a),s=o}return n}getLength(){const t=this.ends_;let e=0,i=0;for(let n=0,s=t.length;n<s;++n)i+=Bn(this.flatCoordinates,e,t[n],this.stride),e=t[n];return i}getFlatMidpoints(){const t=[],e=this.flatCoordinates;let i=0;const n=this.ends_,s=this.stride;for(let r=0,o=n.length;r<o;++r){const o=n[r];b(t,Yn(e,i,o,s,.5)),i=o}return t}getSimplifiedGeometryInternal(t){const e=[],i=[];return e.length=Vi(this.flatCoordinates,0,this.ends_,this.stride,t,e,0,i),new fr(e,"XY",i)}getType(){return"MultiLineString"}intersectsExtent(t){return function(t,e,i,n,s){for(let r=0,o=i.length;r<o;++r){if(Wi(t,e,i[r],n,s))return!0;e=i[r]}return!1}(this.flatCoordinates,0,this.ends_,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,2),this.flatCoordinates||(this.flatCoordinates=[]);const i=Ai(this.flatCoordinates,0,t,this.stride,this.ends_);this.flatCoordinates.length=0===i.length?0:i[i.length-1],this.changed()}}class _r extends Si{constructor(t,e){super(),e&&!Array.isArray(t[0])?this.setFlatCoordinates(e,t):this.setCoordinates(t,e)}appendPoint(t){b(this.flatCoordinates,t.getFlatCoordinates()),this.changed()}clone(){const t=new _r(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 s=this.flatCoordinates,r=this.stride;for(let o=0,a=s.length;o<a;o+=r){const a=Dt(t,e,s[o],s[o+1]);if(a<n){n=a;for(let t=0;t<r;++t)i[t]=s[o+t];i.length=r}}return n}getCoordinates(){return Di(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getPoint(t){const e=this.flatCoordinates.length/this.stride;return t<0||e<=t?null:new Ji(this.flatCoordinates.slice(t*this.stride,(t+1)*this.stride),this.layout)}getPoints(){const t=this.flatCoordinates,e=this.layout,i=this.stride,n=[];for(let s=0,r=t.length;s<r;s+=i){const r=new Ji(t.slice(s,s+i),e);n.push(r)}return n}getType(){return"MultiPoint"}intersectsExtent(t){const e=this.flatCoordinates,i=this.stride;for(let n=0,s=e.length;n<s;n+=i){if(nt(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=ki(this.flatCoordinates,0,t,this.stride),this.changed()}}function pr(t,e,i,n){const s=[];let r=[1/0,1/0,-1/0,-1/0];for(let o=0,a=i.length;o<a;++o){const a=i[o];r=ht(t,e,a[0],n),s.push((r[0]+r[2])/2,(r[1]+r[3])/2),e=a[a.length-1]}return s}class mr extends Si{constructor(t,e,i){if(super(),this.endss_=[],this.flatInteriorPointsRevision_=-1,this.flatInteriorPoints_=null,this.maxDelta_=-1,this.maxDeltaRevision_=-1,this.orientedRevision_=-1,this.orientedFlatCoordinates_=null,!i&&!Array.isArray(t[0])){const n=t,s=[],r=[];for(let t=0,e=n.length;t<e;++t){const e=n[t],i=s.length,o=e.getEnds();for(let t=0,e=o.length;t<e;++t)o[t]+=i;b(s,e.getFlatCoordinates()),r.push(o)}e=0===n.length?this.getLayout():n[0].getLayout(),t=s,i=r}void 0!==e&&i?(this.setFlatCoordinates(e,t),this.endss_=i):this.setCoordinates(t,e)}appendPolygon(t){let e;if(this.flatCoordinates){const i=this.flatCoordinates.length;b(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 mr(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,s){for(let r=0,o=i.length;r<o;++r){const o=i[r];s=Pi(t,e,o,n,s),e=o[o.length-1]}return s}(this.flatCoordinates,0,this.endss_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),function(t,e,i,n,s,r,o,a,l,h,c){c=c||[NaN,NaN];for(let u=0,d=i.length;u<d;++u){const d=i[u];h=Li(t,e,d,n,s,r,o,a,l,h,c),e=d[d.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,s,r){if(0===i.length)return!1;for(let o=0,a=i.length;o<a;++o){const a=i[o];if(Xi(t,e,a,n,s,r))return!0;e=a[a.length-1]}return!1}(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,t,e)}getArea(){return function(t,e,i,n){let s=0;for(let r=0,o=i.length;r<o;++r){const o=i[r];s+=Ii(t,e,o,n),e=o[o.length-1]}return s}(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride)}getCoordinates(t){let e;return void 0!==t?(e=this.getOrientedFlatCoordinates().slice(),an(e,0,this.endss_,this.stride,t)):e=this.flatCoordinates,zi(e,0,this.endss_,this.stride)}getEndss(){return this.endss_}getFlatInteriorPoints(){if(this.flatInteriorPointsRevision_!=this.getRevision()){const t=pr(this.flatCoordinates,0,this.endss_,this.stride);this.flatInteriorPoints_=tn(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,t),this.flatInteriorPointsRevision_=this.getRevision()}return this.flatInteriorPoints_}getInteriorPoints(){return new _r(this.getFlatInteriorPoints().slice(),"XYM")}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){const t=this.flatCoordinates;rn(t,0,this.endss_,this.stride)?this.orientedFlatCoordinates_=t:(this.orientedFlatCoordinates_=t.slice(),this.orientedFlatCoordinates_.length=an(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,s,r,o,a){for(let l=0,h=i.length;l<h;++l){const h=i[l],c=[];o=$i(t,e,h,n,s,r,o,c),a.push(c),e=h[h.length-1]}return o}(this.flatCoordinates,0,this.endss_,this.stride,Math.sqrt(t),e,0,i),new mr(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 ln(this.flatCoordinates.slice(e,n),this.layout,i)}getPolygons(){const t=this.layout,e=this.flatCoordinates,i=this.endss_,n=[];let s=0;for(let r=0,o=i.length;r<o;++r){const o=i[r].slice(),a=o[o.length-1];if(0!==s)for(let t=0,e=o.length;t<e;++t)o[t]-=s;const l=new ln(e.slice(s,a),t,o);n.push(l),s=a}return n}getType(){return"MultiPolygon"}intersectsExtent(t){return function(t,e,i,n,s){for(let r=0,o=i.length;r<o;++r){const o=i[r];if(Zi(t,e,o,n,s))return!0;e=o[o.length-1]}return!1}(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,3),this.flatCoordinates||(this.flatCoordinates=[]);const i=Oi(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 yr=di();class xr{constructor(t,e,i,n,s,r){this.styleFunction,this.extent_,this.id_=r,this.type_=t,this.flatCoordinates_=e,this.flatInteriorPoints_=null,this.flatMidpoints_=null,this.ends_=i||null,this.properties_=s,this.squaredTolerance_,this.stride_=n,this.simplifiedGeometry_}get(t){return this.properties_[t]}getExtent(){return this.extent_||(this.extent_="Point"===this.type_?lt(this.flatCoordinates_):ht(this.flatCoordinates_,0,this.flatCoordinates_.length,this.stride_)),this.extent_}getFlatInteriorPoint(){if(!this.flatInteriorPoints_){const t=xt(this.getExtent());this.flatInteriorPoints_=Qi(this.flatCoordinates_,0,this.ends_,this.stride_,t,0)}return this.flatInteriorPoints_}getFlatInteriorPoints(){if(!this.flatInteriorPoints_){const t=function(t,e){const i=[];let n,s=0,r=0;for(let o=0,a=e.length;o<a;++o){const a=e[o],l=nn(t,s,a,2);if(void 0===n&&(n=l),l===n)i.push(e.slice(r,o+1));else{if(0===i.length)continue;i[i.length-1].push(e[r])}r=o+1,s=a}return i}(this.flatCoordinates_,this.ends_),e=pr(this.flatCoordinates_,0,t,this.stride_);this.flatInteriorPoints_=tn(this.flatCoordinates_,0,t,this.stride_,e)}return this.flatInteriorPoints_}getFlatMidpoint(){return this.flatMidpoints_||(this.flatMidpoints_=Yn(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,s=i.length;n<s;++n){const s=i[n],r=Yn(t,e,s,this.stride_,.5);b(this.flatMidpoints_,r),e=s}}return this.flatMidpoints_}getId(){return this.id_}getOrientedFlatCoordinates(){return this.flatCoordinates_}getGeometry(){return this}getSimplifiedGeometry(t){return this}simplifyTransformed(t,e){return this}getProperties(){return this.properties_}getPropertiesInternal(){return this.properties_}getStride(){return this.stride_}getStyleFunction(){return this.styleFunction}getType(){return this.type_}transform(t){const e=(t=Ue(t)).getExtent(),i=t.getWorldExtent();if(e&&i){const t=St(i)/St(e);fi(yr,i[0],i[3],t,-t,0,0,0),yi(this.flatCoordinates_,0,this.flatCoordinates_.length,this.stride_,yr,this.flatCoordinates_)}}applyTransform(t){t(this.flatCoordinates_,this.flatCoordinates_,this.stride_)}clone(){return new xr(this.type_,this.flatCoordinates_.slice(),this.ends_?.slice(),this.stride_,Object.assign({},this.properties_),this.id_)}getEnds(){return this.ends_}enableSimplifyTransformed(){return this.simplifyTransformed=A((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=Bi(i,0,this.simplifiedGeometry_.flatCoordinates_.length,this.simplifiedGeometry_.stride_,t,i,0),n=[i.length];break;case"MultiLineString":n=[],i.length=Vi(i,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,t,i,0,n);break;case"Polygon":n=[],i.length=$i(i,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,Math.sqrt(t),i,0,n)}return n&&(this.simplifiedGeometry_=new xr(this.type_,i,n,this.stride_,this.properties_,this.id_)),this.squaredTolerance_=t,this.simplifiedGeometry_}),this}}function vr(t,e,i=0,n=t.length-1,s=Cr){for(;n>i;){if(n-i>600){const r=n-i+1,o=e-i+1,a=Math.log(r),l=.5*Math.exp(2*a/3),h=.5*Math.sqrt(a*l*(r-l)/r)*(o-r/2<0?-1:1);vr(t,e,Math.max(i,Math.floor(e-o*l/r+h)),Math.min(n,Math.floor(e+(r-o)*l/r+h)),s)}const r=t[e];let o=i,a=n;for(wr(t,i,e),s(t[n],r)>0&&wr(t,i,n);o<a;){for(wr(t,o,a),o++,a--;s(t[o],r)<0;)o++;for(;s(t[a],r)>0;)a--}0===s(t[i],r)?wr(t,i,a):(a++,wr(t,a,n)),a<=e&&(i=a+1),e<=a&&(n=a-1)}}function wr(t,e,i){const n=t[e];t[e]=t[i],t[i]=n}function Cr(t,e){return t<e?-1:t>e?1:0}xr.prototype.getFlatCoordinates=xr.prototype.getOrientedFlatCoordinates;let Sr=class{constructor(t=9){this._maxEntries=Math.max(4,t),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()}all(){return this._all(this.data,[])}search(t){let e=this.data;const i=[];if(!Or(t,e))return i;const n=this.toBBox,s=[];for(;e;){for(let r=0;r<e.children.length;r++){const o=e.children[r],a=e.leaf?n(o):o;Or(t,a)&&(e.leaf?i.push(o):Ar(t,a)?this._all(o,i):s.push(o))}e=s.pop()}return i}collides(t){let e=this.data;if(!Or(t,e))return!1;const i=[];for(;e;){for(let n=0;n<e.children.length;n++){const s=e.children[n],r=e.leaf?this.toBBox(s):s;if(Or(t,r)){if(e.leaf||Ar(t,r))return!0;i.push(s)}}e=i.pop()}return!1}load(t){if(!t||!t.length)return this;if(t.length<this._minEntries){for(let e=0;e<t.length;e++)this.insert(t[e]);return this}let e=this._build(t.slice(),0,t.length-1,0);if(this.data.children.length)if(this.data.height===e.height)this._splitRoot(this.data,e);else{if(this.data.height<e.height){const t=this.data;this.data=e,e=t}this._insert(e,this.data.height-e.height-1,!0)}else this.data=e;return this}insert(t){return t&&this._insert(t,this.data.height-1),this}clear(){return this.data=Dr([]),this}remove(t,e){if(!t)return this;let i=this.data;const n=this.toBBox(t),s=[],r=[];let o,a,l;for(;i||s.length;){if(i||(i=s.pop(),a=s[s.length-1],o=r.pop(),l=!0),i.leaf){const n=Er(t,i.children,e);if(-1!==n)return i.children.splice(n,1),s.push(i),this._condense(s),this}l||i.leaf||!Ar(i,n)?a?(o++,i=a.children[o],l=!1):i=null:(s.push(i),r.push(o),o=0,a=i,i=i.children[0])}return this}toBBox(t){return t}compareMinX(t,e){return t.minX-e.minX}compareMinY(t,e){return t.minY-e.minY}toJSON(){return this.data}fromJSON(t){return this.data=t,this}_all(t,e){const i=[];for(;t;)t.leaf?e.push(...t.children):i.push(...t.children),t=i.pop();return e}_build(t,e,i,n){const s=i-e+1;let r,o=this._maxEntries;if(s<=o)return r=Dr(t.slice(e,i+1)),br(r,this.toBBox),r;n||(n=Math.ceil(Math.log(s)/Math.log(o)),o=Math.ceil(s/Math.pow(o,n-1))),r=Dr([]),r.leaf=!1,r.height=n;const a=Math.ceil(s/o),l=a*Math.ceil(Math.sqrt(o));Gr(t,e,i,l,this.compareMinX);for(let s=e;s<=i;s+=l){const e=Math.min(s+l-1,i);Gr(t,s,e,a,this.compareMinY);for(let i=s;i<=e;i+=a){const s=Math.min(i+a-1,e);r.children.push(this._build(t,i,s,n-1))}}return br(r,this.toBBox),r}_chooseSubtree(t,e,i,n){for(;n.push(e),!e.leaf&&n.length-1!==i;){let i,n=1/0,s=1/0;for(let r=0;r<e.children.length;r++){const o=e.children[r],a=Pr(o),l=Lr(t,o)-a;l<s?(s=l,n=a<n?a:n,i=o):l===s&&a<n&&(n=a,i=o)}e=i||e.children[0]}return e}_insert(t,e,i){const n=i?t:this.toBBox(t),s=[],r=this._chooseSubtree(n,this.data,e,s);for(r.children.push(t),Ir(r,n);e>=0&&s[e].children.length>this._maxEntries;)this._split(s,e),e--;this._adjustParentBBoxes(n,s,e)}_split(t,e){const i=t[e],n=i.children.length,s=this._minEntries;this._chooseSplitAxis(i,s,n);const r=this._chooseSplitIndex(i,s,n),o=Dr(i.children.splice(r,i.children.length-r));o.height=i.height,o.leaf=i.leaf,br(i,this.toBBox),br(o,this.toBBox),e?t[e-1].children.push(o):this._splitRoot(i,o)}_splitRoot(t,e){this.data=Dr([t,e]),this.data.height=t.height+1,this.data.leaf=!1,br(this.data,this.toBBox)}_chooseSplitIndex(t,e,i){let n,s=1/0,r=1/0;for(let o=e;o<=i-e;o++){const e=Rr(t,0,o,this.toBBox),a=Rr(t,o,i,this.toBBox),l=kr(e,a),h=Pr(e)+Pr(a);l<s?(s=l,n=o,r=h<r?h:r):l===s&&h<r&&(r=h,n=o)}return n||i-e}_chooseSplitAxis(t,e,i){const n=t.leaf?this.compareMinX:Mr,s=t.leaf?this.compareMinY:Tr;this._allDistMargin(t,e,i,n)<this._allDistMargin(t,e,i,s)&&t.children.sort(n)}_allDistMargin(t,e,i,n){t.children.sort(n);const s=this.toBBox,r=Rr(t,0,e,s),o=Rr(t,i-e,i,s);let a=Fr(r)+Fr(o);for(let n=e;n<i-e;n++){const e=t.children[n];Ir(r,t.leaf?s(e):e),a+=Fr(r)}for(let n=i-e-1;n>=e;n--){const e=t.children[n];Ir(o,t.leaf?s(e):e),a+=Fr(o)}return a}_adjustParentBBoxes(t,e,i){for(let n=i;n>=0;n--)Ir(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():br(t[i],this.toBBox)}};function Er(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 br(t,e){Rr(t,0,t.children.length,e,t)}function Rr(t,e,i,n,s){s||(s=Dr(null)),s.minX=1/0,s.minY=1/0,s.maxX=-1/0,s.maxY=-1/0;for(let r=e;r<i;r++){const e=t.children[r];Ir(s,t.leaf?n(e):e)}return s}function Ir(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 Mr(t,e){return t.minX-e.minX}function Tr(t,e){return t.minY-e.minY}function Pr(t){return(t.maxX-t.minX)*(t.maxY-t.minY)}function Fr(t){return t.maxX-t.minX+(t.maxY-t.minY)}function Lr(t,e){return(Math.max(e.maxX,t.maxX)-Math.min(e.minX,t.minX))*(Math.max(e.maxY,t.maxY)-Math.min(e.minY,t.minY))}function kr(t,e){const i=Math.max(t.minX,e.minX),n=Math.max(t.minY,e.minY),s=Math.min(t.maxX,e.maxX),r=Math.min(t.maxY,e.maxY);return Math.max(0,s-i)*Math.max(0,r-n)}function Ar(t,e){return t.minX<=e.minX&&t.minY<=e.minY&&e.maxX<=t.maxX&&e.maxY<=t.maxY}function Or(t,e){return e.minX<=t.maxX&&e.minY<=t.maxY&&e.maxX>=t.minX&&e.maxY>=t.minY}function Dr(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function Gr(t,e,i,n,s){const r=[e,i];for(;r.length;){if((i=r.pop())-(e=r.pop())<=n)continue;const o=e+Math.ceil((i-e)/n/2)*n;vr(t,o,e,i,s),r.push(e,o,o,i)}}class zr{constructor(t){this.rbush_=new Sr(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_[T(e)]=i}load(t,e){const i=new Array(e.length);for(let n=0,s=e.length;n<s;n++){const s=t[n],r=e[n],o={minX:s[0],minY:s[1],maxX:s[2],maxY:s[3],value:r};i[n]=o,this.items_[T(r)]=o}this.rbush_.load(i)}remove(t){const e=T(t),i=this.items_[e];return delete this.items_[e],null!==this.rbush_.remove(i)}update(t,e){const i=this.items_[T(e)];ct([i.minX,i.minY,i.maxX,i.maxY],t)||(this.remove(e),this.insert(t,e))}getAll(){return this.rbush_.all().map(function(t){return t.value})}getInExtent(t){const e={minX:t[0],minY:t[1],maxX:t[2],maxY:t[3]};return this.rbush_.search(e).map(function(t){return t.value})}forEach(t){return this.forEach_(this.getAll(),t)}forEachInExtent(t,e){return this.forEach_(this.getInExtent(t),e)}forEach_(t,e){let i;for(let n=0,s=t.length;n<s;n++)if(i=e(t[n]),i)return i;return i}isEmpty(){return r(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]}}class Nr extends N{constructor(t){super(),this.projection=Ue(t.projection),this.attributions_=jr(t.attributions),this.attributionsCollapsible_=t.attributionsCollapsible??!0,this.loading=!1,this.canRotate=!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_}ready(){const t=this.getState();return"ready"===t?Promise.resolve():"error"===t?Promise.reject(new Error("Source failed to load")):new Promise((t,e)=>{const i=()=>{const n=this.getState();"ready"===n?(this.un("change",i),t()):"error"===n&&(this.un("change",i),e(new Error("Source failed to load")))};this.on("change",i)})}getState(){return this.state_}getWrapX(){return this.wrapX_}getInterpolate(){return this.interpolate_}refresh(){this.changed()}setAttributions(t){this.attributions_=jr(t),this.changed()}setState(t){this.state_=t,this.changed()}}function jr(t){return t?"function"==typeof t?t:(Array.isArray(t)||(t=[t]),e=>t):null}var Xr="addfeature",Kr="changefeature",Wr="clear",Yr="removefeature",Zr="featuresloadstart",Br="featuresloadend",Vr="featuresloaderror";class Ur extends O{constructor(t,e,i){super(t),this.feature=e,this.features=i}}class qr extends Nr{constructor(t){super({attributions:(t=t||{}).attributions,interpolate:!0,projection:void 0,state:"ready",wrapX:void 0===t.wrapX||t.wrapX}),this.canRotate=!0,this.on,this.once,this.un,this.loader_=k,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_&&(W(this.format_,"`format` must be set when `url` is set"),this.loader_=dr(this.url_,this.format_)),this.strategy_=void 0!==t.strategy?t.strategy:gr;const e=void 0===t.useSpatialIndex||t.useSpatialIndex;let i,n;this.featuresRtree_=e?new zr:null,this.loadedExtentsRtree_=new zr,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 K(n)),void 0!==n&&this.addFeaturesInternal(n),void 0!==i&&this.bindFeaturesCollection_(i)}addFeature(t){this.addFeatureInternal(t),this.changed()}addFeatureInternal(t){const e=T(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 Ur(Xr,t))}setupChangeEvents_(t,e){e instanceof xr||(this.featureChangeKeys_[t]=[o(e,h,this.handleFeatureChange_,this),o(e,n,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 xr){const n=this.idIndex_[t];n instanceof xr?Array.isArray(n)?n.push(e):this.idIndex_[t]=[n,e]:i=!1}else i=!1;else this.idIndex_[t]=e}return i&&(W(!(t in this.uidIndex_),"The passed `feature` was already added to the source"),this.uidIndex_[t]=e),i}addFeatures(t){this.addFeaturesInternal(t),this.changed()}addFeaturesInternal(t){const e=[],i=[],n=[];for(let e=0,n=t.length;e<n;e++){const n=t[e],s=T(n);this.addToIndex_(s,n)&&i.push(n)}for(let t=0,s=i.length;t<s;t++){const s=i[t],r=T(s);this.setupChangeEvents_(r,s);const o=s.getGeometry();if(o){const t=o.getExtent();e.push(t),n.push(s)}else this.nullGeometryFeatures_[r]=s}if(this.featuresRtree_&&this.featuresRtree_.load(e,n),this.hasListener(Xr))for(let t=0,e=i.length;t<e;t++)this.dispatchEvent(new Ur(Xr,i[t]))}bindFeaturesCollection_(t){let n=!1;this.addEventListener(Xr,function(e){!n&&e.feature&&(n=!0,t.push(e.feature),n=!1)}),this.addEventListener(Yr,function(e){!n&&e.feature&&(n=!0,t.remove(e.feature),n=!1)}),t.addEventListener(e,t=>{n||(n=!0,this.addFeature(t.element),n=!1)}),t.addEventListener(i,t=>{n||(n=!0,this.removeFeature(t.element),n=!1)}),this.featuresCollection_=t}clear(t){if(t){for(const t in this.featureChangeKeys_){this.featureChangeKeys_[t].forEach(l)}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 Ur(Wr);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 xr||n&&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 xr||n&&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(),r(this.nullGeometryFeatures_)||b(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=this.featuresRtree_;return Lt(t,e).flatMap(t=>i.getInExtent(t))}return this.featuresCollection_?this.featuresCollection_.getArray().slice(0):[]}getClosestFeatureToCoordinate(t,e){const i=t[0],n=t[1];let s=null;const r=[NaN,NaN];let o=1/0;const a=[-1/0,-1/0,1/0,1/0];e=e||F;const l=this.featuresRtree_;return l?(l.forEachInExtent(a,function(t){if(e(t)){const e=t.getGeometry();if(!e)return;const l=o;if(o=e instanceof xr?0:e.closestPointXY(i,n,r,o),o<l){s=t;const e=Math.sqrt(o);a[0]=i-e,a[1]=n-e,a[2]=i+e,a[3]=n+e}}}),s):null}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=T(e),n=e.getGeometry();if(n){const t=n.getExtent();i in this.nullGeometryFeatures_?(delete this.nullGeometryFeatures_[i],this.featuresRtree_&&this.featuresRtree_.insert(t,e)):this.featuresRtree_&&this.featuresRtree_.update(t,e)}else i in this.nullGeometryFeatures_||(this.featuresRtree_&&this.featuresRtree_.remove(e),this.nullGeometryFeatures_[i]=e);const s=e.getId();if(void 0!==s){const t=s.toString();this.idIndex_[t]!==e&&(this.removeFromIdIndex_(e),this.idIndex_[t]=e)}else this.removeFromIdIndex_(e),this.uidIndex_[i]=e;this.changed(),this.dispatchEvent(new Ur(Kr,e))}hasFeature(t){const e=t.getId();if(void 0!==e){const i=this.idIndex_[String(e)];return Array.isArray(i)?i.includes(t):i===t}return T(t)in this.uidIndex_}isEmpty(){return this.featuresRtree_?this.featuresRtree_.isEmpty()&&r(this.nullGeometryFeatures_):!this.featuresCollection_||0===this.featuresCollection_.getLength()}loadFeatures(t,e,i){const n=this.loadedExtentsRtree_,s=this.strategy_(t,e,i);for(let t=0,r=s.length;t<r;++t){const r=s[t];if(!n.forEachInExtent(r,function(t){return it(t.extent,r)})){this.loading=Number(this.loading)+1,this.dispatchEvent(new Ur(Zr));const t=t=>{this.loading=Number(this.loading)-1,this.dispatchEvent(new Ur(Br,void 0,t))},s=()=>{this.changed(),this.loading=Number(this.loading)-1,this.dispatchEvent(new Ur(Vr))};let o=!1;const a=this.loader_.call(this,r,e,i,e=>o||t(e),()=>o||s());P(a)?(o=!0,a.then(e=>{const i=e;this.addFeatures(i),t(i)}).catch(s)):this.loader_.length<4&&(this.loading=!1),n.insert(r,{extent:r.slice()})}}}refresh(){this.clear(!0),this.loadedExtentsRtree_.clear(),super.refresh()}removeLoadedExtent(t){const e=this.loadedExtentsRtree_,i=[];e.forEachInExtent(t,function(t){i.push(t)}),i.forEach(i=>{e.remove(i);const n=bt(i.extent,t);for(const t of n)e.insert(t,{extent:t})})}removeFeatures(t){let e=!1;for(let i=0,n=t.length;i<n;++i)e=this.removeFeatureInternal(t[i])||e;e&&this.changed()}removeFeature(t){if(!t)return;this.removeFeatureInternal(t)&&this.changed()}removeFeatureInternal(t){const e=T(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(l),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(Yr)&&this.dispatchEvent(new Ur(Yr,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){W(this.format_,"`format` must be set when `url` is set"),this.url_=t,this.setLoader(dr(t,this.format_))}setOverlaps(t){this.overlaps_=t,this.changed()}}class $r{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 $r({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=ys(null,t.src,{crossOrigin:"anonymous"},void 0,t.offset?null:t.color?t.color:null,!(t.offset&&t.size));e.ready().then(()=>{this.patternImage_=null}),e.getImageState()===cn&&e.load(),e.getImageState()===un&&(this.patternImage_=e)}this.color_=t}getKey(){const t=this.getColor();return t?t instanceof CanvasPattern||t instanceof CanvasGradient?T(t):"object"==typeof t&&"src"in t?t.src+":"+t.offset:ds(t).toString():""}loading(){return!!this.patternImage_}ready(){return this.patternImage_?this.patternImage_.ready():Promise.resolve()}}class Hr{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 Hr({color:Array.isArray(t)?t.slice():t||void 0,lineCap:this.getLineCap(),lineDash:this.getLineDash()?.slice(),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}}function Jr(t){return t[0]>0&&t[1]>0}function Qr(t,e){return Array.isArray(t)?t:(void 0===e?e=[t,t]:(e[0]=t,e[1]=t),e)}class to{constructor(t){this.opacity_=t.opacity,this.rotateWithView_=t.rotateWithView,this.rotation_=t.rotation,this.scale_=t.scale,this.scaleArray_=Qr(t.scale),this.displacement_=t.displacement,this.declutterMode_=t.declutterMode}clone(){const t=this.getScale();return new to({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 I()}getImage(t){return I()}getHitDetectionImage(){return I()}getPixelRatio(t){return 1}getImageState(){return I()}getImageSize(){return I()}getOrigin(){return I()}getSize(){return I()}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_=Qr(t)}listenImageChange(t){I()}load(){I()}unlistenImageChange(t){I()}ready(){return Promise.resolve()}}class eo extends to{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()?un:dn,this.imageState_===un&&this.ready().then(()=>this.imageState_=dn),this.render()}clone(){const t=this.getScale(),e=new eo({fill:this.getFill()?.clone(),points:this.getPoints(),radius:this.getRadius(),radius2:this.getRadius2(),angle:this.getAngle(),stroke:this.getStroke()?.clone(),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=_s.get(i,null)?.getImage(1);if(!n){const e=this.renderOptions_,s=Math.ceil(e.size*t),r=Ln(s,s);this.draw_(e,r,t),n=r.canvas;const o=new ms(n,void 0,{},dn,null);_s.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,s=void 0===this.radius2_?n:this.radius2_;if(n<s){const t=n;n=s,s=t}const r=void 0===this.radius2_?this.points_:2*this.points_,o=2*Math.PI/r,a=s*Math.sin(o),l=n-Math.sqrt(s*s-a*a),h=Math.sqrt(a*a+l*l),c=h/a;if("miter"===t&&c<=i)return c*e;const u=e/2/c,d=e/2*(l/h),g=Math.sqrt((n+u)*(n+u)+d*d)-n;if(void 0===this.radius2_||"bevel"===t)return 2*g;const f=n*Math.sin(o),_=s-Math.sqrt(n*n-f*f),p=Math.sqrt(f*f+_*_)/f;if(p<=i){const t=p*e/2-s-n;return 2*Math.max(g,t)}return 2*g}createRenderOptions(){let t,e=Os,i=Gs,n=0,s=null,r=0,o=0;this.stroke_&&(t=xs(this.stroke_.getColor()??zs),o=this.stroke_.getWidth()??1,s=this.stroke_.getLineDash(),r=this.stroke_.getLineDashOffset()??0,i=this.stroke_.getLineJoin()??Gs,e=this.stroke_.getLineCap()??Os,n=this.stroke_.getMiterLimit()??10);const a=this.calculateLineJoinSize_(i,o,n),l=Math.max(this.radius,this.radius2_||0);return{strokeStyle:t,strokeWidth:o,size:Math.ceil(2*l+a),lineCap:e,lineDash:s,lineDashOffset:r,lineJoin:i,miterLimit:n}}render(){this.renderOptions_=this.createRenderOptions();const t=this.renderOptions_.size;this.hitDetectionCanvas_=null,this.size_=[t,t]}draw_(t,e,i){if(e.scale(i,i),e.translate(t.size/2,t.size/2),this.createPath_(e),this.fill_){let t=this.fill_.getColor();null===t&&(t=As),e.fillStyle=xs(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=ds(i)),null===i?n=1:Array.isArray(i)&&(n=4===i.length?i[3]:1),0===n&&(e=Ln(t.size,t.size),this.drawHitDetectionCanvas_(t,e))}return e?e.canvas:this.getImage(1)}createPath_(t){let e=this.points_;const i=this.radius;if(e===1/0)t.arc(0,0,i,0,2*Math.PI);else{const n=void 0===this.radius2_?i:this.radius2_;void 0!==this.radius2_&&(e*=2);const s=this.angle_-Math.PI/2,r=2*Math.PI/e;for(let o=0;o<e;o++){const e=s+o*r,a=o%2==0?i:n;t.lineTo(a*Math.cos(e),a*Math.sin(e))}t.closePath()}}drawHitDetectionCanvas_(t,e){e.translate(t.size/2,t.size/2),this.createPath_(e),e.fillStyle=As,e.fill(),t.strokeStyle&&(e.strokeStyle=t.strokeStyle,e.lineWidth=t.strokeWidth,t.lineDash&&(e.setLineDash(t.lineDash),e.lineDashOffset=t.lineDashOffset),e.lineJoin=t.lineJoin,e.miterLimit=t.miterLimit,e.stroke())}ready(){return this.fill_?this.fill_.ready():Promise.resolve()}}class io extends eo{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 io({fill:this.getFill()?.clone(),stroke:this.getStroke()?.clone(),radius:this.getRadius(),scale:Array.isArray(t)?t.slice():t,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()});return e.setOpacity(this.getOpacity()),e}}class no{constructor(t){t=t||{},this.geometry_=null,this.geometryFunction_=oo,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 no({geometry:t??void 0,fill:this.getFill()?.clone(),image:this.getImage()?.clone(),renderer:this.getRenderer()??void 0,stroke:this.getStroke()?.clone(),text:this.getText()?.clone(),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_=oo,this.geometry_=t}setZIndex(t){this.zIndex_=t}}let so=null;function ro(t,e){if(!so){const t=new $r({color:"rgba(255,255,255,0.4)"}),e=new Hr({color:"#3399CC",width:1.25});so=[new no({image:new io({fill:t,stroke:e,radius:5}),fill:t,stroke:e})]}return so}function oo(t){return t.getGeometry()}class ao{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_=Qr(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 $r({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 ao({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 $r?this.getFill().clone():this.getFill(),stroke:this.getStroke()?.clone(),offsetX:this.getOffsetX(),offsetY:this.getOffsetY(),backgroundFill:this.getBackgroundFill()?.clone(),backgroundStroke:this.getBackgroundStroke()?.clone(),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_=Qr(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}}var lo=0,ho=1;const co=0,uo=1,go=2,fo=3,_o=4,po=5,mo=6,yo=7,xo=8,vo=9,wo=10,Co=11,So=12,Eo=[xo],bo=[So],Ro=[uo],Io=[fo];class Mo extends Ss{constructor(t,e,i,n){super(),this.tolerance=t,this.maxExtent=e,this.pixelRatio=n,this.maxLineWidth=0,this.resolution=i,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_=null,this.bufferedMaxExtent_=null,this.instructions=[],this.coordinates=[],this.tmpCoordinate_=[],this.hitDetectionInstructions=[],this.state={}}applyPixelRatio(t){const e=this.pixelRatio;return 1==e?t:t.map(function(t){return t*e})}appendFlatPointCoordinates(t,e){const i=this.getBufferedMaxExtent(),n=this.tmpCoordinate_,s=this.coordinates;let r=s.length;for(let o=0,a=t.length;o<a;o+=e)n[0]=t[o],n[1]=t[o+1],et(i,n)&&(s[r++]=n[0],s[r++]=n[1]);return r}appendFlatLineCoordinates(t,e,i,n,s,r){const o=this.coordinates;let a=o.length;const l=this.getBufferedMaxExtent();r&&(e+=n);let h=t[e],c=t[e+1];const u=this.tmpCoordinate_;let d,g,f,_=!0;for(d=e+n;d<i;d+=n)u[0]=t[d],u[1]=t[d+1],f=st(l,u),f!==g?(_&&(o[a++]=h,o[a++]=c,_=!1),o[a++]=u[0],o[a++]=u[1]):f===B?(o[a++]=u[0],o[a++]=u[1],_=!1):_=!0,h=u[0],c=u[1],g=f;return(s&&_||d===e+n)&&(o[a++]=h,o[a++]=c),a}drawCustomCoordinates_(t,e,i,n,s){for(let r=0,o=i.length;r<o;++r){const o=i[r],a=this.appendFlatLineCoordinates(t,e,o,n,!1,!1);s.push(a),e=o}return e}drawCustom(t,e,i,n,s){this.beginGeometry(t,e,s);const r=t.getType(),o=t.getStride(),a=this.coordinates.length;let l,h,c,u,d;switch(r){case"MultiPolygon":l=t.getOrientedFlatCoordinates(),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([_o,a,c,t,i,zi,s]),this.hitDetectionInstructions.push([_o,a,c,t,n||i,zi,s]);break;case"Polygon":case"MultiLineString":u=[],l="Polygon"==r?t.getOrientedFlatCoordinates():t.getFlatCoordinates(),d=this.drawCustomCoordinates_(l,0,t.getEnds(),o,u),this.instructions.push([_o,a,u,t,i,Gi,s]),this.hitDetectionInstructions.push([_o,a,u,t,n||i,Gi,s]);break;case"LineString":case"Circle":l=t.getFlatCoordinates(),h=this.appendFlatLineCoordinates(l,0,l.length,o,!1,!1),this.instructions.push([_o,a,h,t,i,Di,s]),this.hitDetectionInstructions.push([_o,a,h,t,n||i,Di,s]);break;case"MultiPoint":l=t.getFlatCoordinates(),h=this.appendFlatPointCoordinates(l,o),h>a&&(this.instructions.push([_o,a,h,t,i,Di,s]),this.hitDetectionInstructions.push([_o,a,h,t,n||i,Di,s]));break;case"Point":l=t.getFlatCoordinates(),this.coordinates.push(l[0],l[1]),h=this.coordinates.length,this.instructions.push([_o,a,h,t,i,void 0,s]),this.hitDetectionInstructions.push([_o,a,h,t,n||i,void 0,s])}this.endGeometry(e)}beginGeometry(t,e,i){this.beginGeometryInstruction1_=[co,e,0,t,i],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[co,e,0,t,i],this.hitDetectionInstructions.push(this.beginGeometryInstruction2_)}finish(){return{instructions:this.instructions,hitDetectionInstructions:this.hitDetectionInstructions,coordinates:this.coordinates}}reverseHitDetectionInstructions(){const t=this.hitDetectionInstructions;let e;t.reverse();const i=t.length;let n,s,r=-1;for(e=0;e<i;++e)n=t[e],s=n[0],s==yo?r=e:s==co&&(n[2]=e,E(this.hitDetectionInstructions,r,e),r=-1)}fillStyleToState(t,e={}){if(t){const i=t.getColor();e.fillPatternScale=i&&"object"==typeof i&&"src"in i?this.pixelRatio:1,e.fillStyle=xs(i||As)??void 0}else e.fillStyle=void 0;return e}strokeStyleToState(t,e={}){if(t){const i=t.getColor();e.strokeStyle=xs(i||zs)??void 0;const n=t.getLineCap();e.lineCap=void 0!==n?n:Os;const s=t.getLineDash();e.lineDash=s?s.slice():Ds;const r=t.getLineDashOffset();e.lineDashOffset=r||0;const o=t.getLineJoin();e.lineJoin=void 0!==o?o:Gs;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=[wo,e];return"string"!=typeof e&&i.push(t.fillPatternScale),i}applyStroke(t){this.instructions.push(this.createStroke(t))}createStroke(t){return[Co,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,s=t.lineDash,r=t.lineDashOffset,o=t.lineJoin,a=t.lineWidth,l=t.miterLimit,h=t.strokeOffset;t.currentStrokeStyle==i&&t.currentLineCap==n&&(s==t.currentLineDash||s&&t.currentLineDash&&R(t.currentLineDash,s))&&t.currentLineDashOffset==r&&t.currentLineJoin==o&&t.currentLineWidth==a&&t.currentMiterLimit==l&&t.currentStrokeOffset==h||(e.call(this,t),t.currentStrokeStyle=i,t.currentLineCap=n,t.currentLineDash=s,t.currentLineDashOffset=r,t.currentLineJoin=o,t.currentLineWidth=a,t.currentMiterLimit=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=[yo,t];this.instructions.push(e),this.hitDetectionInstructions.push(e)}getBufferedMaxExtent(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=Q(this.maxExtent),this.maxLineWidth>0)){const t=this.resolution*(this.maxLineWidth+1)/2;J(this.bufferedMaxExtent_,t,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_}}class To extends Mo{constructor(t,e,i,n){super(t,e,i,n)}drawFlatCoordinatess_(t,e,i,n,s){const r=this.state,o=s??0,a=void 0!==r.fillStyle,l=void 0!==r.strokeStyle,h=i.length;this.instructions.push(Ro),this.hitDetectionInstructions.push(Ro);for(let s=0;s<h;++s){const r=i[s],a=this.coordinates.length,h=this.appendFlatLineCoordinates(t,e,r,n,!0,!l);this.instructions.push([vo,a,h,o*this.pixelRatio,!0]),this.hitDetectionInstructions.push([vo,a,h,o,!0]),l&&(this.instructions.push(Io),this.hitDetectionInstructions.push(Io)),e=r}return a&&(this.instructions.push(Eo),this.hitDetectionInstructions.push(Eo)),l&&(this.instructions.push(bo),this.hitDetectionInstructions.push(bo)),e}drawCircle(t,e,i){const n=this.state;if(!n)return;const s=n.fillStyle,r=n.strokeStyle,o=n.strokeOffset;if(void 0===s&&void 0===r)return;if(this.handleStrokeOffset_(()=>this.drawCircle(t,e,i)))return;this.setFillStrokeStyles_(),this.beginGeometry(t,e,i??0),void 0!==n.fillStyle&&this.hitDetectionInstructions.push([wo,As]),void 0!==n.strokeStyle&&this.hitDetectionInstructions.push([Co,zs,n.lineWidth,n.lineCap,n.lineJoin,n.miterLimit,Ds,0]);const a=t.getFlatCoordinates(),l=t.getStride(),h=this.coordinates.length;this.appendFlatLineCoordinates(a,0,a.length,l,!1,!1);const c=[go,h,o];this.instructions.push(Ro,c),this.hitDetectionInstructions.push(Ro,c),void 0!==n.fillStyle&&(this.instructions.push(Eo),this.hitDetectionInstructions.push(Eo)),void 0!==n.strokeStyle&&(this.instructions.push(bo),this.hitDetectionInstructions.push(bo)),this.endGeometry(e)}drawPolygon(t,e,i){const n=this.state;if(!n)return;const s=n.fillStyle,r=n.strokeStyle,o=n.strokeOffset;if(void 0===s&&void 0===r)return;if(this.handleStrokeOffset_(()=>this.drawPolygon(t,e,i)))return;this.setFillStrokeStyles_(),this.beginGeometry(t,e,i??0),void 0!==n.fillStyle&&this.hitDetectionInstructions.push([wo,As]),void 0!==n.strokeStyle&&this.hitDetectionInstructions.push([Co,zs,n.lineWidth,n.lineCap,n.lineJoin,n.miterLimit,Ds,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;if(!n)return;const s=n.fillStyle,r=n.strokeStyle,o=n.strokeOffset;if(void 0===s&&void 0===r)return;if(this.handleStrokeOffset_(()=>this.drawMultiPolygon(t,e,i)))return;this.setFillStrokeStyles_(),this.beginGeometry(t,e,i??0),void 0!==n.fillStyle&&this.hitDetectionInstructions.push([wo,As]),void 0!==n.strokeStyle&&this.hitDetectionInstructions.push([Co,zs,n.lineWidth,n.lineCap,n.lineJoin,n.miterLimit,Ds,0]);const a=t.getEndss(),l=t.getOrientedFlatCoordinates(),h=t.getStride();let c=0;for(let t=0,e=a.length;t<e;++t)c=this.drawFlatCoordinatess_(l,c,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]=Ui(e[i],t)}return super.finish()}setFillStrokeStyles_(){const t=this.state;t&&(this.updateFillStyle(t,this.createFill),this.updateStrokeStyle(t,this.applyStroke))}handleStrokeOffset_(t){const e=this.state,i=e.fillStyle,n=e.strokeStyle,s=e.strokeOffset??0;return Math.abs(s)>0&&void 0!==i&&void 0!==n&&(e.strokeStyle=void 0,e.strokeOffset=0,t(),e.fillStyle=void 0,e.strokeStyle=n,e.strokeOffset=s,t(),e.fillStyle=i,!0)}}let Po=0,Fo=1;function Lo(t,e,i,n,s,r,o,a){const l=o-s,h=a-r;let c=0,u=1;if(0===l){if(s<t||s>i)return!1}else{let e=(t-s)/l,n=(i-s)/l;if(e>n){const t=e;e=n,n=t}if(e>c&&(c=e),n<u&&(u=n),c>u)return!1}if(0===h){if(r<e||r>n)return!1}else{let t=(e-r)/h,i=(n-r)/h;if(t>i){const e=t;t=i,i=e}if(t>c&&(c=t),i<u&&(u=i),c>u)return!1}return Po=c,Fo=u,!0}function ko(t,e,i,n,s){const r=[];let o=i,a=0,l=e.slice(i,2);for(;a<t&&o+s<n;){const[i,n]=l.slice(-2),h=e[o+s],c=e[o+s+1],u=Math.sqrt((h-i)*(h-i)+(c-n)*(c-n));if(a+=u,a>=t){const e=(t-a+u)/u,d=jt(i,h,e),g=jt(n,c,e);l.push(d,g),r.push(l),l=[d,g],a==t&&(o+=s),a=0}else if(a<t)l.push(e[o+s],e[o+s+1]),o+=s;else{const t=u-a,e=jt(i,h,t/u),d=jt(n,c,t/u);l.push(e,d),r.push(l),l=[e,d],a=0,o+=s}}return a>0&&r.push(l),r}function Ao(t,e,i,n,s){let r,o,a,l,h,c,u,d,g,f,_=i,p=i,m=0,y=0,x=i;for(o=i;o<n;o+=s){const i=e[o],n=e[o+1];void 0!==h&&void 0!==c&&(g=i-h,f=n-c,l=Math.sqrt(g*g+f*f),void 0!==u&&void 0!==d&&void 0!==a&&(y+=a,r=Math.acos((u*g+d*f)/(a*l)),r>t&&(y>m&&(m=y,_=x,p=o),y=0,x=o-s)),a=l,u=g,d=f),h=i,c=n}return y+=l||0,y>m?[x,o]:[_,p]}const Oo={left:0,center:.5,right:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1};const Do={Circle:To,Default:Mo,Image:class extends Mo{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&&!et(this.maxExtent,t.getFlatCoordinates()))return;this.beginGeometry(t,e,i??0);const n=t.getFlatCoordinates(),s=t.getStride(),r=this.coordinates.length,o=this.appendFlatPointCoordinates(n,s),a=this.imagePixelRatio_??1,l=this.anchorX_??0,h=this.anchorY_??0,c=this.height_??0,u=this.originX_??0,d=this.originY_??0,g=this.scale_??[1,1],f=this.width_??0;this.instructions.push([mo,r,o,this.image_,l*a,h*a,Math.ceil(c*a),this.opacity_,u*a,d*a,this.rotateWithView_,this.rotation_,[g[0]*this.pixelRatio/a,g[1]*this.pixelRatio/a],Math.ceil(f*a),this.declutterMode_,this.declutterImageWithText_]),this.hitDetectionInstructions.push([mo,r,o,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,1,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(e)}drawMultiPoint(t,e,i){if(!this.image_)return;this.beginGeometry(t,e,i??0);const n=t.getFlatCoordinates(),s=[];for(let e=0,i=n.length;e<i;e+=t.getStride())this.maxExtent&&!et(this.maxExtent,n.slice(e,e+2))||s.push(n[e],n[e+1]);const r=this.coordinates.length,o=this.appendFlatPointCoordinates(s,2),a=this.imagePixelRatio_??1,l=this.anchorX_??0,h=this.anchorY_??0,c=this.height_??0,u=this.originX_??0,d=this.originY_??0,g=this.scale_??[1,1],f=this.width_??0;this.instructions.push([mo,r,o,this.image_,l*a,h*a,Math.ceil(c*a),this.opacity_,u*a,d*a,this.rotateWithView_,this.rotation_,[g[0]*this.pixelRatio/a,g[1]*this.pixelRatio/a],Math.ceil(f*a),this.declutterMode_,this.declutterImageWithText_]),this.hitDetectionInstructions.push([mo,r,o,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,1,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(e)}finish(){return this.reverseHitDetectionInstructions(),this.anchorX_=void 0,this.anchorY_=void 0,this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.height_=void 0,this.scale_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.width_=void 0,super.finish()}setImageStyle(t,e){const i=t.getAnchor(),n=t.getSize(),s=t.getOrigin();i&&n&&s&&(this.imagePixelRatio_=t.getPixelRatio(this.pixelRatio),this.anchorX_=i[0],this.anchorY_=i[1],this.hitDetectionImage_=t.getHitDetectionImage(),this.image_=t.getImage(this.pixelRatio),this.height_=n[1],this.opacity_=t.getOpacity(),this.originX_=s[0],this.originY_=s[1],this.rotateWithView_=t.getRotateWithView(),this.rotation_=t.getRotation(),this.scale_=t.getScaleArray(),this.width_=n[0],this.declutterMode_=t.getDeclutterMode(),this.declutterImageWithText_=e)}},LineString:class extends Mo{constructor(t,e,i,n){super(t,e,i,n)}drawFlatCoordinates_(t,e,i,n,s){const r=(s??0)*this.pixelRatio,o=this.coordinates.length,a=this.appendFlatLineCoordinates(t,e,i,n,!1,!1);return this.instructions.push([vo,o,a,r]),this.hitDetectionInstructions.push([vo,o,a,s??0]),i}drawLineString(t,e,i){const n=this.state;if(!n)return;const s=n.strokeStyle,r=n.lineWidth,o=n.strokeOffset;if(void 0===s||void 0===r)return;this.updateStrokeStyle(n,this.applyStroke),this.beginGeometry(t,e,i??0),this.hitDetectionInstructions.push([Co,zs,n.lineWidth,n.lineCap,n.lineJoin,n.miterLimit,Ds,0],Ro);const a=t.getFlatCoordinates(),l=t.getStride();this.drawFlatCoordinates_(a,0,a.length,l,o),this.hitDetectionInstructions.push(bo),this.endGeometry(e)}drawMultiLineString(t,e,i){const n=this.state;if(!n)return;const s=n.strokeStyle,r=n.lineWidth,o=n.strokeOffset;if(void 0===s||void 0===r)return;this.updateStrokeStyle(n,this.applyStroke),this.beginGeometry(t,e,i??0),this.hitDetectionInstructions.push([Co,zs,n.lineWidth,n.lineCap,n.lineJoin,n.miterLimit,Ds,0],Ro);const a=t.getEnds()??[],l=t.getFlatCoordinates(),h=t.getStride();let c=0;for(let t=0,e=a.length;t<e;++t)c=this.drawFlatCoordinates_(l,c,a[t],h,o);this.hitDetectionInstructions.push(bo),this.endGeometry(e)}finish(){const t=this.state;return t&&null!=t.lastStroke&&t.lastStroke!=this.coordinates.length&&this.instructions.push(bo),this.reverseHitDetectionInstructions(),this.state=null,super.finish()}applyStroke(t){null!=t.lastStroke&&t.lastStroke!=this.coordinates.length&&(this.instructions.push(bo),t.lastStroke=this.coordinates.length),t.lastStroke=0,super.applyStroke(t),this.instructions.push(Ro)}},Polygon:To,Text:class extends Mo{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[As]={fillStyle:As},this.textStrokeState_=null,this.strokeStates={},this.textState_={},this.textStates={},this.textKey_="",this.fillKey_="",this.strokeKey_="",this.declutterMode_=void 0,this.declutterImageWithText_=void 0}finish(){const t=super.finish();return t.textStates=this.textStates,t.fillStates=this.fillStates,t.strokeStates=this.strokeStates,t}drawText(t,e,i){const n=this.textFillState_,s=this.textStrokeState_,r=this.textState_;if(""===this.text_||!r||!n&&!s)return;const o=this.coordinates;let a=o.length;const l=t.getType();let h=null,c=t.getStride();if("line"!==r.placement||"LineString"!=l&&"MultiLineString"!=l&&"Polygon"!=l&&"MultiPolygon"!=l){let n=r.overflow?null:[];switch(l){case"Point":case"MultiPoint":h=t.getFlatCoordinates();break;case"LineString":h=t.getFlatMidpoint();break;case"Circle":h=t.getCenter();break;case"MultiLineString":h=t.getFlatMidpoints(),c=2;break;case"Polygon":h=t.getFlatInteriorPoint(),!r.overflow&&n&&n.push(h[2]/this.resolution),c=3;break;case"MultiPolygon":const e=t.getFlatInteriorPoints();h=[];for(let t=0,i=e.length;t<i;t+=3)!r.overflow&&n&&n.push(e[t+2]/this.resolution),h.push(e[t],e[t+1]);if(0===h.length)return;c=2;break;default:return}if(!h)return;const s=this.appendFlatPointCoordinates(h,c);if(s===a)return;if(n&&(s-a)/2!==h.length/c){const t=h;let e=a/2;n=n.filter((i,n)=>{const s=o[2*(e+n)]===t[n*c]&&o[2*(e+n)+1]===t[n*c+1];return s||--e,s})}this.saveTextStates_();const u=r.backgroundFill?this.createFill(this.fillStyleToState(r.backgroundFill)):null,d=r.backgroundStroke?this.createStroke(this.strokeStyleToState(r.backgroundStroke)):null;this.beginGeometry(t,e,i??0);const g=r.scale??[1,1];let f=r.padding??Xs;if(f!=Xs&&(g[0]<0||g[1]<0)){let t=f[0],e=f[1],i=f[2],n=f[3];g[0]<0&&(e=-e,n=-n),g[1]<0&&(t=-t,i=-i),f=[t,e,i,n]}const _=this.pixelRatio;this.instructions.push([mo,a,s,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[1,1],NaN,this.declutterMode_,this.declutterImageWithText_,f==Xs?Xs:f.map(function(t){return t*_}),u,d,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,n]);const p=1/_,m=u?u.slice(0):null;m&&(m[1]=As),this.hitDetectionInstructions.push([mo,a,s,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[p,p],NaN,this.declutterMode_,this.declutterImageWithText_,f,m,d,this.text_,this.textKey_,this.strokeKey_,this.fillKey_?As:this.fillKey_,this.textOffsetX_,this.textOffsetY_,n]),this.endGeometry(e)}else{const n=t.getExtent();if(!Tt(this.maxExtent,n))return;let s=[];if(h=t.getFlatCoordinates(),"LineString"==l)s=[h.length];else if("MultiLineString"==l)s=t.getEnds();else if("Polygon"==l)s=t.getEnds().slice(0,1);else if("MultiPolygon"==l){const e=t.getEndss();s=[];for(let t=0,i=e.length;t<i;++t)s.push(e[t][0])}if(void 0===r.textAlign&&("LineString"==l||"MultiLineString"==l)&&!it(this.getBufferedMaxExtent(),n)){const t=function(t,e,i,n){const s=n[0],r=n[1],o=n[2],a=n[3],l=[],h=[];let c,u,d=!1,g=0;for(let n=0,f=e.length;n<f;++n){const f=e[n];let _=t[g],p=t[g+1],m=!1;for(let e=g+i;e<f;e+=i){const i=t[e],n=t[e+1];if(Lo(s,r,o,a,_,p,i,n)){const t=i-_,e=n-p,s=_+Po*t,r=p+Po*e,o=_+Fo*t,a=p+Fo*e;d&&m&&s===c&&r===u?l.push(o,a):(d&&h.push(l.length),l.push(s,r,o,a),d=!0),c=o,u=a,m=!0}_=i,p=n}g=f}return d&&h.push(l.length),{flatCoordinates:l,ends:h}}(h,s,c,this.getBufferedMaxExtent());if(h=t.flatCoordinates,s=t.ends,c=2,0===s.length)return}this.beginGeometry(t,e,i??0);const u=r.repeat,d=u?void 0:r.textAlign;let g=0;for(let t=0,e=s.length;t<e;++t){let e;e=u?ko(u*this.resolution,h,g,s[t],c):[h.slice(g,s[t])];for(let i=0,n=e.length;i<n;++i){const n=e[i];let l=0,h=n.length;if(null==d){const t=Ao(r.maxAngle??Math.PI/4,n,0,n.length,2);l=t[0],h=t[1]}for(let t=l;t<h;t+=c)o.push(n[t],n[t+1]);const u=o.length;g=s[t],this.drawChars_(a,u),a=u}}this.endGeometry(e)}}saveTextStates_(){const t=this.textStrokeState_,e=this.textState_,i=this.textFillState_,n=this.strokeKey_;t&&(n in this.strokeStates||(this.strokeStates[n]={strokeStyle:t.strokeStyle,lineCap:t.lineCap,lineDashOffset:t.lineDashOffset,lineWidth:t.lineWidth,lineJoin:t.lineJoin,miterLimit:t.miterLimit,lineDash:t.lineDash}));const s=this.textKey_;s in this.textStates||(this.textStates[s]={font:e.font,textAlign:e.textAlign||Ns,justify:e.justify,textBaseline:e.textBaseline||js,scale:e.scale});const r=this.fillKey_;i&&(r in this.fillStates||(this.fillStates[r]={fillStyle:i.fillStyle}))}drawChars_(t,e){const i=this.textStrokeState_,n=this.textState_,s=this.strokeKey_,r=this.textKey_,o=this.fillKey_;this.saveTextStates_();const a=this.pixelRatio,l=Oo[n.textBaseline||js],h=this.textOffsetX_*a,c=this.textOffsetY_*a,u=this.text_,d=n.scale??[1,1],g=i?i.lineWidth*Math.abs(d[0])/2:0;this.instructions.push([po,t,e,l,n.overflow,o,n.maxAngle,a,c,s,g*a,u,r,1,this.declutterMode_,this.textKeepUpright_,h]),this.hitDetectionInstructions.push([po,t,e,l,n.overflow,o?As:o,n.maxAngle,a,c,s,g*a,u,r,1/a,this.declutterMode_,this.textKeepUpright_,h])}setTextStyle(t,e){let i,n,s;if(t){const e=t.getFill();e?(n=this.textFillState_,n||(n={},this.textFillState_=n),n.fillStyle=xs(e.getColor()||As)||As):(n=null,this.textFillState_=n);const r=t.getStroke();if(r){s=this.textStrokeState_,s||(s={},this.textStrokeState_=s);const t=r.getLineDash(),e=r.getLineDashOffset(),i=r.getWidth(),n=r.getMiterLimit();s.lineCap=r.getLineCap()||Os,s.lineDash=t?t.slice():Ds,s.lineDashOffset=void 0===e?0:e,s.lineJoin=r.getLineJoin()||Gs,s.lineWidth=void 0===i?1:i,s.miterLimit=void 0===n?10:n,s.strokeStyle=xs(r.getColor()||zs)||zs}else s=null,this.textStrokeState_=s;i=this.textState_;const o=t.getFont()||ks;Us(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()||js,i.backgroundFill=t.getBackgroundFill()??void 0,i.backgroundStroke=t.getBackgroundStroke()??void 0,i.padding=t.getPadding()||Xs,i.scale=void 0===a?[1,1]:a;const l=t.getOffsetX(),h=t.getOffsetY(),c=t.getRotateWithView(),u=t.getKeepUpright(),d=t.getRotation();this.text_=t.getText()||"",this.textOffsetX_=void 0===l?0:l,this.textOffsetY_=void 0===h?0:h,this.textRotateWithView_=void 0!==c&&c,this.textKeepUpright_=void 0===u||u,this.textRotation_=void 0===d?0:d,this.strokeKey_=s?("string"==typeof s.strokeStyle?s.strokeStyle:T(s.strokeStyle))+s.lineCap+s.lineDashOffset+"|"+s.lineWidth+s.lineJoin+s.miterLimit+"["+s.lineDash.join()+"]":"",this.textKey_=i.font+i.scale+(i.textAlign||"?")+(i.repeat||"?")+(i.justify||"?")+(i.textBaseline||"?"),this.fillKey_=n&&n.fillStyle?"string"==typeof n.fillStyle?n.fillStyle:"|"+T(n.fillStyle):""}else this.text_="";this.declutterMode_=t?t.getDeclutterMode():void 0,this.declutterImageWithText_=e}}};class Go{constructor(t,e,i,n){this.tolerance_=t,this.maxExtent_=e,this.pixelRatio_=n,this.resolution_=i,this.buildersByZIndex_={}}finish(){const t={};for(const e in this.buildersByZIndex_){t[e]=t[e]||{};const i=this.buildersByZIndex_[e];for(const n in i){const s=i[n].finish();t[e][n]=s}}return t}getBuilder(t,e){const i=void 0!==t?t.toString():"0";let n=this.buildersByZIndex_[i];void 0===n&&(n={},this.buildersByZIndex_[i]=n);let s=n[e];if(void 0===s){s=new(0,Do[e])(this.tolerance_,this.maxExtent_,this.resolution_,this.pixelRatio_),n[e]=s}return s}}let zo;const No=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 jo(t,e,i,n,s,r,o,a,l,h,c,u,d=!0){let g=t[e],f=t[e+1],_=0,p=0,m=0,y=0;function x(){_=g,p=f,g=t[e+=n],f=t[e+1],y+=m,m=Math.sqrt((g-_)*(g-_)+(f-p)*(f-p))}do{x()}while(e<i-n&&y+m<r);let v=0===m?0:(r-y)/m;const w=jt(_,g,v),C=jt(p,f,v),S=e-n,E=y,b=r+a*l(h,s,c);for(;e<i-n&&y+m<b;)x();v=0===m?0:(b-y)/m;const R=jt(_,g,v),I=jt(p,f,v);let M=!1;if(d)if(u){const t=[w,C,R,I];xi(t,0,4,2,u,t,t),M=t[0]>t[2]}else M=w>R;const T=Math.PI,P=[],F=S+n===e;let L;if(m=0,y=E,g=t[e=S],f=t[e+1],F){x(),L=Math.atan2(f-p,g-_),M&&(L+=L>0?-T:T);const t=(R+w)/2,e=(I+C)/2;return P[0]=[t,e,(b-r)/2,L,s],P}s=s.replace(/\n/g," ");const k=Array.from((zo||(zo=new Intl.Segmenter(void 0,{granularity:"grapheme"})),zo).segment(s),t=>t.segment),A=M!==No.test(s);for(let t=0,s=k.length;t<s;){x();let u=Math.atan2(f-p,g-_);if(M&&(u+=u>0?-T:T),void 0!==L){let t=u-L;if(t+=t>T?-2*T:t<-T?2*T:0,Math.abs(t)>o)return null}L=u;const d=t;let w=0;for(;t<s;++t){const o=a*l(h,k[A?s-t-1:t],c);if(e+n<i&&y+m<r+w+o/2)break;w+=o}if(t===d)continue;const C=(A?k.slice(s-t,s-d):k.slice(d,t)).join("");v=0===m?0:(r+w/2-y)/m;const S=jt(_,g,v),E=jt(p,f,v);P.push([S,E,w/2,u,C]),r+=w}return P}class Xo{constructor(){this.instructions_=[],this.zIndex=0,this.offset_=0,this.pendingMethod_,this.context_=new Proxy(An(),{get:(t,e)=>{if("function"==typeof t[e])return this.pendingMethod_=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_(this.pendingMethod_,t)};pushFunction(t){this.push_(t)}getContext(){return this.context_}draw(t){this.instructions_.forEach(e=>{for(let i=0,n=e.length;i<n;++i){const n=e[i];if("function"==typeof n){n(t);continue}const s=e[++i];"function"==typeof t[n]?t[n](...s):t[n]="function"==typeof s?s(t):s}})}clear(){this.instructions_.length=0,this.zIndex=0,this.offset_=0}offset(){this.offset_=this.instructions_.length,this.zIndex=0}}const Ko=[1/0,1/0,-1/0,-1/0],Wo=[],Yo=[],Zo=[],Bo=[];function Vo(t){return t[3].declutterBox}function Uo(t,e){return"start"===e?e=No.test(t)?"right":"left":"end"===e&&(e=No.test(t)?"left":"right"),Oo[e]}function qo(t,e,i){return i>0&&t.push("\n",""),t.push(e,""),t}function $o(t,e,i){return i%2==0&&(t+=e),t}class Ho{constructor(t,e,i,n,s){this.overlaps=i,this.pixelRatio=e,this.resolution=t,this.alignAndScaleFill_,this.instructions=n.instructions,this.coordinates=n.coordinates,this.coordinateCache_={},this.renderedTransform_=di(),this.hitDetectionInstructions=n.hitDetectionInstructions,this.pixelCoordinates_=null,this.viewRotation_=0,this.fillStates=n.fillStates||{},this.strokeStates=n.strokeStates||{},this.textStates=n.textStates||{},this.widths_={},this.labels_={},this.zIndexContext_=s?new Xo:null}getZIndexContext(){return this.zIndexContext_}createLabel(t,e,i,n){const s=t+e+i+n;if(this.labels_[s])return this.labels_[s];const r=n?this.strokeStates[n]:null,o=i?this.fillStates[i]:null,a=this.textStates[e],l=this.pixelRatio,h=[a.scale[0]*l,a.scale[1]*l],c=a.justify?Oo[a.justify]:Uo(Array.isArray(t)?t[0]:t,a.textAlign||Ns),u=n&&r.lineWidth?r.lineWidth:0,d=Array.isArray(t)?t:String(t).split("\n").reduce(qo,[]),{width:g,height:f,widths:_,heights:p,lineWidths:m}=function(t,e){const i=[],n=[],s=[];let r=0,o=0,a=0,l=0;for(let h=0,c=e.length;h<=c;h+=2){const u=e[h];if("\n"===u||h===c){r=Math.max(r,o),s.push(o),o=0,a+=l,l=0;continue}const d=e[h+1]||t.font,g=Hs(d,u);i.push(g),o+=g;const f=qs(d);n.push(f),l=Math.max(l,f)}return{width:r,height:a,widths:i,heights:n,lineWidths:s}}(a,d),y=g+u,x=[],v=(y+2)*h[0],w=(f+u)*h[1],C={width:v<0?Math.floor(v):Math.ceil(v),height:w<0?Math.floor(w):Math.ceil(w),contextInstructions:x};1==h[0]&&1==h[1]||x.push("scale",h),n&&r&&(x.push("strokeStyle",r.strokeStyle),x.push("lineWidth",u),x.push("lineCap",r.lineCap),x.push("lineJoin",r.lineJoin),x.push("miterLimit",r.miterLimit),x.push("setLineDash",[r.lineDash]),x.push("lineDashOffset",r.lineDashOffset)),i&&o&&x.push("fillStyle",o.fillStyle),x.push("textBaseline","middle"),x.push("textAlign","center");const S=.5-c;let E=c*y+S*u;const b=[],R=[];let I,M=0,T=0,P=0,F=0;for(let t=0,e=d.length;t<e;t+=2){const e=d[t];if("\n"===e){T+=M,M=0,E=c*y+S*u,++F;continue}const s=d[t+1]||a.font;s!==I&&(n&&b.push("font",s),i&&R.push("font",s),I=s),M=Math.max(M,p[P]);const r=[e,E+S*_[P]+c*(_[P]-m[F]),.5*(u+M)+T];E+=_[P],n&&b.push("strokeText",r),i&&R.push("fillText",r),++P}return Array.prototype.push.apply(x,b),Array.prototype.push.apply(x,R),this.labels_[s]=C,C}replayTextBackground_(t,e,i,n,s,r,o){t.beginPath(),t.moveTo.apply(t,e),t.lineTo.apply(t,i),t.lineTo.apply(t,n),t.lineTo.apply(t,s),t.lineTo.apply(t,e),r&&(this.alignAndScaleFill_=r[2],t.fillStyle=r[1],this.fill_(t)),o&&(this.setStrokeStyle_(t,o),t.stroke())}calculateImageOrLabelDimensions_(t,e,i,n,s,r,o,a,l,h,c,u,d,g,f,_){let p=i-(o*=u[0]),m=n-(a*=u[1]);const y=s+l>t?t-l:s,x=r+h>e?e-h:r,v=g[3]+y*u[0]+g[1],w=g[0]+x*u[1]+g[2],C=p-g[3],S=m-g[0];let E;return(f||0!==c)&&(Wo[0]=C,Bo[0]=C,Wo[1]=S,Yo[1]=S,Yo[0]=C+v,Zo[0]=Yo[0],Zo[1]=S+w,Bo[1]=Zo[1]),0!==c?(E=fi(di(),i,n,1,1,c,-i,-n),gi(E,Wo),gi(E,Yo),gi(E,Zo),gi(E,Bo),ot(Math.min(Wo[0],Yo[0],Zo[0],Bo[0]),Math.min(Wo[1],Yo[1],Zo[1],Bo[1]),Math.max(Wo[0],Yo[0],Zo[0],Bo[0]),Math.max(Wo[1],Yo[1],Zo[1],Bo[1]),Ko)):ot(Math.min(C,C+v),Math.min(S,S+w),Math.max(C,C+v),Math.max(S,S+w),Ko),d&&(p=Math.round(p),m=Math.round(m)),{drawImageX:p,drawImageY:m,drawImageW:y,drawImageH:x,originX:l,originY:h,declutterBox:{minX:Ko[0],minY:Ko[1],maxX:Ko[2],maxY:Ko[3],value:_},canvasTransform:E,scale:u}}replayImageOrLabelArgs_(t){return this.replayImageOrLabel_(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}replayImageOrLabel_(t,e,i,n,s,r,o){const a=!(!r&&!o),l=n.declutterBox,h=o?o[2]*n.scale[0]/2:0;return l.minX-h<=e[0]&&l.maxX+h>=0&&l.minY-h<=e[1]&&l.maxY+h>=0&&(a&&this.replayTextBackground_(t,Wo,Yo,Zo,Bo,r,o),Qs(t,n.canvasTransform,s,i,n.originX,n.originY,n.drawImageW,n.drawImageH,n.drawImageX,n.drawImageY,n.scale)),!0}fill_(t){const e=this.alignAndScaleFill_;if(e){const i=gi(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 s=this.textStates[e],r=this.createLabel(t,e,n,i),o=this.strokeStates[i],a=this.pixelRatio,l=Uo(Array.isArray(t)?t[0]:t,s.textAlign||Ns),h=Oo[s.textBaseline||js],c=o&&o.lineWidth?o.lineWidth:0;return{label:r,anchorX:l*(r.width/a-2*s.scale[0])+2*(.5-l)*c,anchorY:h*r.height/a+2*(.5-h)*c}}execute_(t,e,i,n,s,r,o,a){const l=this.zIndexContext_;let h;var c,u;this.pixelCoordinates_&&R(i,this.renderedTransform_)?h=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),h=yi(this.coordinates,0,this.coordinates.length,2,i,this.pixelCoordinates_),c=this.renderedTransform_,u=i,c[0]=u[0],c[1]=u[1],c[2]=u[2],c[3]=u[3],c[4]=u[4],c[5]=u[5]);let d=0;const g=n.length;let f,_=0;const p=[];let m,y,x,v,w,C,S,E,b,I,M,T,P,F=0,L=0;const k=this.coordinateCache_,A=this.viewRotation_,O=Math.round(1e12*Math.atan2(-i[1],i[0]))/1e12,D={context:t,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:A},G=this.instructions!=n||this.overlaps?0:200;let z,N,j,X;for(;d<g;){const i=n[d];switch(i[0]){case co:z=i[1],X=i[3],z.getGeometry()?void 0===o||Tt(o,X.getExtent())?++d:d=i[2]+1:d=i[2],l&&(l.zIndex=i[4]);break;case uo:F>G&&(this.fill_(t),F=0),L>G&&(t.stroke(),L=0),F||L||(t.beginPath(),w=NaN,C=NaN),++d;break;case go:_=i[1],x=i[2]??0;const n=h[_],c=h[_+1],u=h[_+2]-x-n,g=h[_+3]-x-c,R=Math.sqrt(u*u+g*g);t.moveTo(n+R,c),t.arc(n,c,R,0,2*Math.PI,!0),++d;break;case fo:t.closePath(),++d;break;case _o:_=i[1],f=i[2];const K=i[3],W=i[4],Y=i[5];D.geometry=K,D.feature=z,d in k||(k[d]=[]);const Z=k[d];Y?Y(h,_,f,2,Z):(Z[0]=h[_],Z[1]=h[_+1],Z.length=2),l&&(l.zIndex=i[6]),W(Z,D),++d;break;case mo:_=i[1],f=i[2],b=i[3],m=i[4],y=i[5];let B=i[6];const V=i[7],U=i[8],q=i[9],$=i[10];let H=i[11];const J=i[12];let Q=i[13];v=i[14]||"declutter";const tt=i[15];if(!b&&i.length>=20){I=i[19],M=i[20],T=i[21],P=i[22];const t=this.drawLabelWithPointPlacement_(I,M,T,P);b=t.label,i[3]=b;const e=i[23];m=(t.anchorX-e)*this.pixelRatio,i[4]=m;const n=i[24];y=(t.anchorY-n)*this.pixelRatio,i[5]=y,B=b.height,i[6]=B,Q=b.width,i[13]=Q}let et,it,nt,st;i.length>25&&(et=i[25]),i.length>17?(it=i[16],nt=i[17],st=i[18]):(it=Xs,nt=null,st=null),$&&O?H+=A:$||O||(H-=A);let rt=0;for(;_<f;_+=2){if(et&&et[rt++]<Q/this.pixelRatio)continue;const i=this.calculateImageOrLabelDimensions_(b.width,b.height,h[_],h[_+1],Q,B,m,y,U,q,H,J,s,it,!!nt||!!st,z),n=[t,e,b,i,V,nt,st];if(a){let t,e,s,r,o;if(tt){const i=f-_;if(!tt[i]){tt[i]={args:n,declutterMode:v};continue}const r=tt[i];t=r.args,e=r.declutterMode,delete tt[i],s=Vo(t)}if(!t||"declutter"===e&&a.collides(s)||(r=!0),"declutter"===v&&a.collides(i.declutterBox)||(o=!0),"declutter"===e&&"declutter"===v){const t=r&&o;r=t,o=t}r&&("none"!==e&&a.insert(s),this.replayImageOrLabelArgs_(t)),o&&("none"!==v&&a.insert(i.declutterBox),this.replayImageOrLabelArgs_(n))}else this.replayImageOrLabelArgs_(n)}++d;break;case po:const ot=i[1],at=i[2],lt=i[3],ht=i[4];P=i[5];const ct=i[6],ut=i[7],dt=i[8];T=i[9];const gt=i[10];I=i[11],Array.isArray(I)&&(I=I.reduce($o,"")),M=i[12];const ft=[i[13],i[13]];v=i[14]||"declutter";const _t=i[15],pt=i[16],mt=this.textStates[M],yt=mt.font,xt=[mt.scale[0]*ut,mt.scale[1]*ut];let vt;yt in this.widths_?vt=this.widths_[yt]:(vt={},this.widths_[yt]=vt);const wt=Bn(h,ot,at,2),Ct=Math.abs(xt[0])*Js(yt,I,vt);if(ht||Ct<=wt){const i=jo(h,ot,at,2,I,(wt-Ct)*Uo(I,this.textStates[M].textAlign),ct,Math.abs(xt[0]),Js,yt,vt,O?0:this.viewRotation_,_t);t:if(i){const n=[];let s,r,o,l,h;if(T)for(s=0,r=i.length;s<r;++s){h=i[s],o=h[4],l=this.createLabel(o,M,"",T),m=h[2]+(xt[0]<0?-gt:gt)-pt,y=lt*l.height+2*(.5-lt)*gt*xt[1]/xt[0]-dt;const r=this.calculateImageOrLabelDimensions_(l.width,l.height,h[0],h[1],l.width,l.height,m,y,0,0,h[3],ft,!1,Xs,!1,z);if(a&&"declutter"===v&&a.collides(r.declutterBox))break t;n.push([t,e,l,r,1,null,null])}if(P)for(s=0,r=i.length;s<r;++s){h=i[s],o=h[4],l=this.createLabel(o,M,P,""),m=h[2]-pt,y=lt*l.height-dt;const r=this.calculateImageOrLabelDimensions_(l.width,l.height,h[0],h[1],l.width,l.height,m,y,0,0,h[3],ft,!1,Xs,!1,z);if(a&&"declutter"===v&&a.collides(r.declutterBox))break t;n.push([t,e,l,r,1,null,null])}a&&"none"!==v&&a.load(n.map(Vo));for(let t=0,e=n.length;t<e;++t)this.replayImageOrLabelArgs_(n[t])}}++d;break;case yo:if(void 0!==r){z=i[1];const t=r(z,X,v);if(t)return t}++d;break;case xo:G?F++:this.fill_(t),++d;break;case vo:let St,Et,bt;if(_=i[1],f=i[2],x=i[3],x){const t=(i[4]??!1)||Math.abs(h[_]-h[f-2])<1e-6&&Math.abs(h[_+1]-h[f-1])<1e-6;vs(h,_,f,2,x,t,p),Cs(p,2,t),St=p,Et=0,bt=St.length}else St=h,Et=_,bt=f;N=St[Et],j=St[Et+1],t.moveTo(N,j),w=N+.5|0,C=j+.5|0;for(let e=Et+2;e<bt;e+=2)N=St[e],j=St[e+1],S=N+.5|0,E=j+.5|0,e!=bt-2&&S===w&&E===C||(t.lineTo(N,j),w=S,C=E);++d;break;case wo:this.alignAndScaleFill_=i[2],F?(this.fill_(t),F=0,L&&(t.stroke(),L=0)):L&&i[1]&&(t.stroke(),L=0),t.fillStyle=i[1],++d;break;case Co:F&&i[1]&&(this.fill_(t),F=0),L&&(t.stroke(),L=0),this.setStrokeStyle_(t,i),++d;break;case So:G?L++:t.stroke(),++d;break;default:++d}}F&&this.fill_(t),L&&t.stroke()}execute(t,e,i,n,s,r){this.viewRotation_=n,this.execute_(t,e,i,this.instructions,s,void 0,void 0,r)}executeHitDetection(t,e,i,n,s){return this.viewRotation_=i,this.execute_(t,[t.canvas.width,t.canvas.height],e,this.hitDetectionInstructions,!0,n,s)}}const Jo=["Polygon","Circle","LineString","Image","Text","Default"],Qo=["Image","Text"],ta=Jo.filter(t=>!Qo.includes(t));let ea=!1,ia=!1;class na{constructor(t,e,i,n,s,r,o){this.maxExtent_=t,this.overlaps_=n,this.pixelRatio_=i,this.resolution_=e,this.renderBuffer_=r,this.executorsByZIndex_={},this.hitDetectionContext_=null,this.hitDetectionTransform_=di(),this.renderedContext_=null,this.deferredZIndexContexts_={},this.createExecutors_(s,!!o)}clip(t,e){const i=this.getClipCoords(e);t.beginPath(),t.moveTo(i[0],i[1]),t.lineTo(i[2],i[3]),t.lineTo(i[4],i[5]),t.lineTo(i[6],i[7]),t.clip()}createExecutors_(t,e){for(const i in t){let n=this.executorsByZIndex_[i];void 0===n&&(n={},this.executorsByZIndex_[i]=n);const s=t[i];for(const t in s){const i=s[t];n[t]=new Ho(this.resolution_,this.pixelRatio_,this.overlaps_,i,e)}}}hasExecutors(t){for(const e in this.executorsByZIndex_){const i=this.executorsByZIndex_[e];for(let e=0,n=t.length;e<n;++e)if(t[e]in i)return!0}return!1}forEachFeatureAtCoordinate(t,e,i,n,s,r){!1===ia&&function(){let t=0;const e=e=>{const i=Ln(1,1,null,{willReadFrequently:e});let n=0;const s=performance.now();for(;performance.now()-s<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};ea=i[t],ia=!0}();const o=2*(n=Math.round(n))+1,a=fi(this.hitDetectionTransform_,n+.5,n+.5,1/e,-1/e,-i,-t[0],-t[1]),l=!this.hitDetectionContext_;l&&(this.hitDetectionContext_=Ln(o,o,null,{willReadFrequently:ea}));const h=this.hitDetectionContext_;let c;h.canvas.width!==o||h.canvas.height!==o?(h.canvas.width=o,h.canvas.height=o):l||h.clearRect(0,0,o,o),void 0!==this.renderBuffer_&&(c=[1/0,1/0,-1/0,-1/0],dt(c,t),J(c,e*(this.renderBuffer_+n),c));const u=function(t){if(void 0!==sa[t])return sa[t];const e=2*t+1,i=t*t,n=new Array(i+1);for(let s=0;s<=t;++s)for(let r=0;r<=t;++r){const o=s*s+r*r;if(o>i)break;let a=n[o];a||(a=[],n[o]=a),a.push(4*((t+s)*e+(t+r))+3),s>0&&a.push(4*((t-s)*e+(t+r))+3),r>0&&(a.push(4*((t+s)*e+(t-r))+3),s>0&&a.push(4*((t-s)*e+(t-r))+3))}const s=[];for(let t=0,e=n.length;t<e;++t)n[t]&&s.push(...n[t]);return sa[t]=s,s}(n);let d;const g=h;function f(t,e,i){const a=g.getImageData(0,0,o,o).data;for(let l=0,h=u.length;l<h;l++)if(a[u[l]]>0){if(!r||"none"===i||"Image"!==d&&"Text"!==d||r.includes(t)){const i=(u[l]-3)/4,r=n-i%o,a=n-(i/o|0),h=s(t,e,r*r+a*a);if(h)return h}g.clearRect(0,0,o,o);break}}const _=Object.keys(this.executorsByZIndex_).map(Number);let p,m,y,x,v;for(_.sort(w),p=_.length-1;p>=0;--p){const t=_[p].toString();for(y=this.executorsByZIndex_[t],m=Jo.length-1;m>=0;--m)if(d=Jo[m],x=y[d],void 0!==x&&(v=x.executeHitDetection(h,a,i,f,c),v))return v}}getClipCoords(t){const e=this.maxExtent_;if(!e)return null;const i=e[0],n=e[1],s=e[2],r=e[3],o=[i,n,i,r,s,r,s,n];return yi(o,0,8,2,t,o),o}isEmpty(){return r(this.executorsByZIndex_)}execute(t,e,i,n,s,r,o){const a=Object.keys(this.executorsByZIndex_).map(Number);a.sort(o?C:w),r=r||Jo;const l=Jo.length;for(let h=0,c=a.length;h<c;++h){const c=a[h].toString(),u=this.executorsByZIndex_[c];for(let c=0,d=r.length;c<d;++c){const d=r[c],g=u[d];if(void 0!==g){const r=null===o?void 0:g.getZIndexContext(),c=r?r.getContext():t,u=this.maxExtent_&&"Image"!==d&&"Text"!==d;if(u&&(c.save(),this.clip(c,i)),r&&"Text"!==d&&"Image"!==d?r.pushFunction(t=>g.execute(t,e,i,n,s,o)):g.execute(c,e,i,n,s,o),u&&c.restore(),r){r.offset();const t=a[h]*l+Jo.indexOf(d);this.deferredZIndexContexts_[t]||(this.deferredZIndexContexts_[t]=[]),this.deferredZIndexContexts_[t].push(r)}}}}this.renderedContext_=t}getDeferredZIndexContexts(){return this.deferredZIndexContexts_}getRenderedContext(){return this.renderedContext_}renderDeferred(){const t=this.deferredZIndexContexts_,e=Object.keys(t).map(Number).sort(w);for(let i=0,n=e.length;i<n;++i)t[e[i]].forEach(t=>{t.draw(this.renderedContext_),t.clear()}),t[e[i]].length=0}}const sa={};function ra(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 oa extends to{constructor(t){const e=void 0!==(t=t||{}).opacity?t.opacity:1,i=void 0!==t.rotation?t.rotation:0,n=void 0!==t.scale?t.scale:1,s=void 0!==t.rotateWithView&&t.rotateWithView;super({opacity:e,rotation:i,scale:n,displacement:void 0!==t.displacement?t.displacement:[0,0],rotateWithView:s,declutterMode:t.declutterMode}),this.anchor_=void 0!==t.anchor?t.anchor:[.5,.5],this.normalizedAnchor_=null,this.anchorOrigin_=void 0!==t.anchorOrigin?t.anchorOrigin:"top-left",this.anchorXUnits_=void 0!==t.anchorXUnits?t.anchorXUnits:"fraction",this.anchorYUnits_=void 0!==t.anchorYUnits?t.anchorYUnits:"fraction",this.crossOrigin_=void 0!==t.crossOrigin?t.crossOrigin:null,this.referrerPolicy_=t.referrerPolicy;const r=void 0!==t.img?t.img:null;let o,a=t.src;if(W(!(void 0!==a&&r),"`image` and `src` cannot be provided at the same time"),void 0!==a&&0!==a.length||!r||(a=r.src||T(r)),W(void 0!==a&&a.length>0,"A defined and non-empty `src` or `image` must be provided"),W(!((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=cn:void 0!==r&&(o="complete"in r?r.complete?r.src?dn:cn:un:dn),this.color_=void 0!==t.color?ds(t.color):null,this.iconImage_=ys(r,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();i&&this.setScale(ra(i[0],i[1],t.width,t.height))};return void this.listenImageChange(e)}}void 0!==e&&this.setScale(ra(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 oa({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?ds(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(),s=void 0!==i?cn:this.iconImage_.getImageState();this.iconImage_=ys(n,i,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},s,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_=ys(null,t,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},cn,this.color_)}getSize(){return this.size_?this.size_:this.iconImage_.getSize()}getWidth(){const t=this.getScaleArray();if(this.size_)return this.size_[0]*t[0];if(this.iconImage_.getImageState()==dn){const e=this.iconImage_.getSize();if(e)return e[0]*t[0]}}getHeight(){const t=this.getScaleArray();if(this.size_)return this.size_[1]*t[1];if(this.iconImage_.getImageState()==dn){const e=this.iconImage_.getSize();if(e)return e[1]*t[1]}}setScale(t){delete this.initialOptions_,super.setScale(t)}listenImageChange(t){this.iconImage_.addEventListener(h,t)}load(){this.iconImage_.load()}unlistenImageChange(t){this.iconImage_.removeEventListener(h,t)}ready(){return this.iconImage_.ready()}}const aa=.5;class la extends O{constructor(t,e,i,n){super(t),this.inversePixelTransform=e,this.frameState=i,this.context=n??void 0}}class ha extends G{constructor(t){super(),this.ready=!0,this.boundHandleImageChange_=this.handleImageChange_.bind(this),this.layer_=t,this.staleKeys_=new Array,this.maxStaleKeys=5,this.renderedSourceKey_}getStaleKeys(){return this.staleKeys_}prependStaleKey(t){this.staleKeys_.unshift(t),this.staleKeys_.length>this.maxStaleKeys&&(this.staleKeys_.length=this.maxStaleKeys)}updateStaleKeys(t){this.renderedSourceKey_?this.renderedSourceKey_!==t&&(this.prependStaleKey(this.renderedSourceKey_),this.renderedSourceKey_=t):this.renderedSourceKey_=t}getFeatures(t){return I()}getData(t){return null}prepareFrame(t){return I()}renderFrame(t,e){return I()}forEachFeatureAtCoordinate(t,e,i,n,s){}getLayer(){return this.layer_}handleFontsChanged(){}handleImageChange_(t){const e=t.target;e.getState()!==dn&&e.getState()!==gn||this.renderIfReadyAndVisible()}loadImage(t){let e=t.getState();return e!=dn&&e!=gn&&t.addEventListener(h,this.boundHandleImageChange_),e==cn&&(t.load(),e=t.getState()),e==dn}renderIfReadyAndVisible(){const t=this.getLayer();t&&t.getVisible()&&"ready"===t.getSourceState()&&t.changed()}renderDeferred(t){}disposeInternal(){this.layer_=void 0,super.disposeInternal()}}const ca=[];let ua=null;class da extends ha{constructor(t){super(t),this.wantRotation=!1,this.container=null,this.renderedResolution,this.tempTransform=di(),this.pixelTransform=di(),this.inversePixelTransform=di(),this.context=null,this.deferredContext_=null,this.containerReused=!1,this.frameState=null}getImageData(t,e,i){ua||(ua=Ln(1,1,void 0,{willReadFrequently:!0}));const n=ua;if(!n)return null;let s;n.clearRect(0,0,1,1);try{n.drawImage(t,e,i,1,1,0,0,1,1),s=n.getImageData(0,0,1,1).data}catch{return ua=null,null}return s}getBackground(t){let e=this.getLayer().getBackground();return"function"==typeof e&&(e=e(t.viewState.resolution)),e||void 0}useContainer(t,e,i,n,s){if(Xn(t)&&0===this.pixelTransform[1]&&0===this.pixelTransform[2]&&0===this.pixelTransform[4]&&0===this.pixelTransform[5]&&t.width===n&&t.height===s){const e=t,n=e.getContext("2d");if(n)return this.container=t,this.context=n,this.containerReused=!0,void(i&&(n.fillStyle=i,n.fillRect(0,0,e.width,e.height)))}const r=this.getLayer().getClassName();let o,a;if(t&&t.className===r&&(!i||t&&t.style.backgroundColor&&R(ds(t.style.backgroundColor),ds(i)))){const e=t.firstElementChild;Xn(e)&&(a=e.getContext("2d"))}if(a&&function(t,e){const i=mi(t),n=mi(e);for(let t=0;t<6;++t)if(0!==Math.round((i[t]-n[t])*pi[t]))return!1;return!0}(a.canvas.style.transform,e)?(this.container=t,this.context=a,this.containerReused=!0):this.containerReused?(this.container=null,this.context=null,this.containerReused=!1):this.container&&(this.container.style.backgroundColor=null),!this.container){o=yn?jn():document.createElement("div"),o.className=r;let t=o.style;t.position="absolute",t.width="100%",t.height="100%",a=Ln();const e=a.canvas;o.appendChild(e),t=e.style,t.position="absolute",t.left="0",t.transformOrigin="top left",this.container=o,this.context=a}this.containerReused||!i||this.container.style.backgroundColor||(this.container.style.backgroundColor=i)}clipUnrotated(t,e,i){const n=Rt(i),s=It(i),r=yt(i),o=mt(i);gi(e.coordinateToPixelTransform,n),gi(e.coordinateToPixelTransform,s),gi(e.coordinateToPixelTransform,r),gi(e.coordinateToPixelTransform,o);const a=this.inversePixelTransform;gi(a,n),gi(a,s),gi(a,r),gi(a,o),t.save(),t.beginPath(),t.moveTo(Math.round(n[0]),Math.round(n[1])),t.lineTo(Math.round(s[0]),Math.round(s[1])),t.lineTo(Math.round(r[0]),Math.round(r[1])),t.lineTo(Math.round(o[0]),Math.round(o[1])),t.clip()}prepareContainer(t,e){const i=t.extent,n=t.viewState.resolution,s=this.sourceRotates(),r=s?0:t.viewState.rotation,o=t.pixelRatio,a=s?Math.round(t.size[0]*o):Math.round(Mt(i)/n*o),l=s?Math.round(t.size[1]*o):Math.round(St(i)/n*o);fi(this.pixelTransform,t.size[0]/2,t.size[1]/2,1/o,1/o,r,-a/2,-l/2),_i(this.inversePixelTransform,this.pixelTransform);const h="matrix("+this.pixelTransform.join(", ")+")";const c=this.getBackground(t);if(this.useContainer(e,h,c,a,l),!this.containerReused){const t=this.context.canvas;t.width!=a||t.height!=l?(t.width=a,t.height=l):this.context.clearRect(0,0,a,l),h!==t.style.transform&&(t.style.transform=h)}}dispatchRenderEvent_(t,e,i){const n=this.getLayer();if(n.hasListener(t)){const s=new la(t,this.inversePixelTransform,i,e);n.dispatchEvent(s)}}preRender(t,e){this.frameState=e,e.declutter||this.dispatchRenderEvent_(ar,t,e)}postRender(t,e){e.declutter||this.dispatchRenderEvent_(lr,t,e)}renderDeferredInternal(t){}getRenderContext(t){return t.declutter&&!this.deferredContext_&&(this.deferredContext_=new Xo),t.declutter?this.deferredContext_.getContext():this.context}getCanvasContext(){const t=this.context;if(!t)throw new Error("Canvas context not initialized");return t}getContainerElement(){const t=this.container;if(!t)throw new Error("Canvas container not initialized");return t}renderDeferred(t){t.declutter&&(this.dispatchRenderEvent_(ar,this.context,t),t.declutter&&this.deferredContext_&&(this.deferredContext_.draw(this.context),this.deferredContext_.clear()),this.renderDeferredInternal(t),this.dispatchRenderEvent_(lr,this.context,t))}getRenderTransform(t,e,i,n,s,r,o){const a=s/2,l=r/2,h=n/e,c=-h,u=-t[0]+o,d=-t[1];return fi(this.tempTransform,a,l,h,c,-i,u,d)}sourceRotates(){return this.wantRotation&&!!this.getLayer().getSource()?.canRotate}disposeInternal(){delete this.frameState,super.disposeInternal()}}class ga extends da{constructor(t,e){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,void 0!==e?.wantRotation&&(this.wantRotation=e.wantRotation)}renderWorlds(t,e,i){const n=e.extent,s=e.viewState,r=s.center,o=s.resolution,a=s.projection,l=s.rotation,h=a.getExtent(),c=this.getLayer().getSource(),u=this.getLayer().getDeclutter(),d=e.pixelRatio,g=e.viewHints,f=!(g[lo]||g[ho]),_=this.context,p=_.canvas.width,m=_.canvas.height,y=c.getWrapX()&&a.canWrapX(),x=y?Mt(h):null,v=n,w=y?Math.ceil((v[2]-h[2])/x)+(this.extendX_?2:1):1;let C=y?Math.floor((v[0]-h[0])/x)-(this.extendX_?1:0):0;do{let n=this.getRenderTransform(r,o,this.sourceRotates()?l:0,d,p,m,C*x);e.declutter&&(n=n.slice(0)),t.execute(_,[_.canvas.width,_.canvas.height],n,l,f,void 0===i?Jo:i?Qo:ta,i?u&&e.declutter[u]:void 0)}while(++C<w)}setDrawContext_(){1!==this.opacity_&&(this.targetContext_=this.context,this.context=Ln(this.context.canvas.width,this.context.canvas.height,ca))}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,On(this.context),ca.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 s=this.context,r=this.replayGroup_;let o=r&&!r.isEmpty();if(!o){if(!(this.getLayer().hasListener(ar)||this.getLayer().hasListener(lr)))return this.container}this.setDrawContext_(),this.preRender(s,t),n.projection,this.clipExtent_=null;let a=!1;if(o&&i.extent&&this.clipping){const e=ai(i.extent);o=Tt(e,t.extent);o&&!it(e,t.extent)&&(t.declutter?this.clipExtent_=e:(this.clipUnrotated(s,t,e),a=!0))}return o&&this.renderWorlds(r,t,!this.getLayer().getDeclutter()&&void 0),a&&s.restore(),this.postRender(s,t),this.renderedRotation_!==n.rotation&&(this.renderedRotation_=n.rotation,this.hitDetectionImageData_=null),t.declutter||this.resetDrawContext_(),this.container}getFeatures(t){return new Promise(e=>{if(this.frameState&&!this.hitDetectionImageData_&&!this.animatingOrInteracting_){const t=this.frameState.size.slice(),e=this.renderedCenter_,i=this.renderedResolution_,n=this.renderedRotation_,s=this.renderedProjection_,r=this.wrappedRenderedExtent_,o=this.getLayer(),a=[],l=t[0]*aa,h=t[1]*aa;a.push(this.getRenderTransform(e,i,n,aa,l,h,0).slice());const c=o.getSource(),u=s.getExtent();if(c.getWrapX()&&s.canWrapX()&&!it(u,r)){let t=r[0];const s=Mt(u);let o,c=0;for(;t<u[0];)--c,o=s*c,a.push(this.getRenderTransform(e,i,n,aa,l,h,o).slice()),t+=s;for(c=0,t=r[2];t>u[2];)++c,o=s*c,a.push(this.getRenderTransform(e,i,n,aa,l,h,o).slice()),t-=s}const d=null;this.hitDetectionImageData_=function(t,e,i,n,s,r,o,a,l){const h=l?oi(s):s,c=Ln(t[0]*aa,t[1]*aa);c.imageSmoothingEnabled=!1;const u=c.canvas,d=new tr(c,aa,s,[1,0,0,1,0,0],o,a??0,l?ti(null,l)??void 0:void 0),g=i.length,f=Math.floor(16777215/g),_={};for(let t=1;t<=g;++t){const e=i[t-1],s=e.getStyleFunction()||n;if(!s)continue;let o=s(e,r);if(!o)continue;Array.isArray(o)||(o=[o]);const a=(t*f).toString(16).padStart(7,"#00000");for(let t=0,i=o.length;t<i;++t){const i=o[t],n=i.getGeometryFunction()(e);if(!n||!Tt(h,n.getExtent()))continue;const s=i.clone(),r=s.getFill();r&&r.setColor(a);const l=s.getStroke();l&&(l.setColor(a),l.setLineDash(null)),s.setText(null);const c=i.getImage();if(c){const t=c.getImageSize();if(!t)continue;const e=Ln(t[0],t[1],void 0,{alpha:!1}),i=e.canvas;e.fillStyle=a,e.fillRect(0,0,i.width,i.height),s.setImage(new oa({img:i,anchor:c.getAnchor()??void 0,anchorXUnits:"pixels",anchorYUnits:"pixels",offset:c.getOrigin()??void 0,opacity:1,size:c.getSize()??void 0,scale:c.getScale(),rotation:c.getRotation(),rotateWithView:c.getRotateWithView()}))}const u=s.getZIndex()||0;let d=_[u];d||(d={},_[u]=d,d.Polygon=[],d.Circle=[],d.LineString=[],d.Point=[]);const g=n.getType();if("GeometryCollection"===g){const t=n.getGeometriesArrayRecursive();for(let e=0,i=t.length;e<i;++e){const i=t[e];d[i.getType().replace("Multi","")].push(i,s)}}else d[g.replace("Multi","")].push(n,s)}}const p=Object.keys(_).map(Number).sort(w);for(let t=0,i=p.length;t<i;++t){const i=_[p[t]];for(const t in i){const n=i[t];for(let t=0,i=n.length;t<i;t+=2){d.setStyle(n[t+1]);for(let i=0,s=e.length;i<s;++i)d.setTransform(e[i]),d.drawGeometry(n[t])}}}return c.getImageData(0,0,u.width,u.height)}(t,a,this.renderedFeatures_,o.getStyleFunction(),r,i,n,nr(i,this.renderedPixelRatio_),d?s:null)}e(function(t,e,i){const n=[];if(i){const s=Math.floor(Math.round(t[0])*aa),r=Math.floor(Math.round(t[1])*aa),o=4*(At(s,0,i.width-1)+At(r,0,i.height-1)*i.width),a=i.data[o],l=i.data[o+1],h=i.data[o+2]+256*(l+256*a),c=Math.floor(16777215/e.length);h&&h%c===0&&n.push(e[h/c-1])}return n}(t,this.renderedFeatures_,this.hitDetectionImageData_))})}forEachFeatureAtCoordinate(t,e,i,n,s){if(!this.replayGroup_)return;const r=e.viewState.resolution,o=e.viewState.rotation,a=this.getLayer(),l={},h=this.getLayer().getDeclutter();return this.replayGroup_.forEachFeatureAtCoordinate(t,r,o,i,function(t,e,i){const r=T(t),o=l[r];if(o){if(!0!==o&&i<o.distanceSq){if(0===i)return l[r]=!0,s.splice(s.lastIndexOf(o),1),n(t,a,e);o.geometry=e,o.distanceSq=i}}else{if(0===i)return l[r]=!0,n(t,a,e);s.push(l[r]={feature:t,layer:a,geometry:e,distanceSq:i,callback:n})}},h?e.declutter?.[h]?.all().map(t=>t.value):null)}handleFontsChanged(){const t=this.getLayer();t.getVisible()&&this.replayGroup_&&t.changed()}handleStyleImageChange_(t){this.renderIfReadyAndVisible()}prepareFrame(t){const e=this.getLayer(),i=e.getSource();if(!i)return!1;const n=t.viewHints[lo],s=t.viewHints[ho],r=e.getUpdateWhileAnimating(),o=e.getUpdateWhileInteracting();if(this.ready&&!r&&n||!o&&s)return this.animatingOrInteracting_=!0,!0;this.animatingOrInteracting_=!1;const a=t.extent,l=t.viewState,h=l.projection,c=l.resolution,u=t.pixelRatio,d=e.getRevision(),g=e.getRenderBuffer();let f=e.getRenderOrder();void 0===f&&(f=ir);const _=l.center.slice(),p=J(a,g*c),m=p.slice(),y=[p.slice()],x=h.getExtent(),v=i.getWrapX()&&h.canWrapX();if(this.extendX_=!1,v){const t=i.getExtent();t&&!Pt(t)&&(this.extendX_=t[0]<x[0]||t[2]>x[2])}if(v&&(!it(x,t.extent)||this.extendX_)){const t=Mt(x),e=Math.max(Mt(p)/2,t);let i=x[0],n=x[2];this.extendX_&&(i-=t,n+=t),p[0]=i-e,p[2]=n+e,Ht(_,h);const s=Ft(y[0],h);s[0]<x[0]&&s[2]<x[2]?y.push([s[0]+t,s[1],s[2]+t,s[3]]):s[0]>x[0]&&s[2]>x[2]&&y.push([s[0]-t,s[1],s[2]-t,s[3]])}if(this.ready&&this.renderedResolution_==c&&this.renderedPixelRatio_===u&&this.renderedRevision_==d&&this.renderedRenderOrder_==f&&this.renderedFrameDeclutter_===!!t.declutter&&it(this.wrappedRenderedExtent_,p))return R(this.renderedExtent_,m)||(this.hitDetectionImageData_=null,this.renderedExtent_=m),this.renderedCenter_=_,this.replayGroupChanged=!1,!0;this.replayGroup_=null;const w=new Go(sr(c,u),p,c,u);let C;for(let t=0,e=y.length;t<e;++t)i.loadFeatures(y[t],c,h);const S=nr(c,u);let E=!0;const b=(t,i)=>{let n;const s=t.getStyleFunction()||e.getStyleFunction();if(s&&(n=s(t,c)),n){const e=this.renderFeature(t,S,n,w,C,this.getLayer().getDeclutter(),i);E=E&&!e}},I=oi(p),M=i.getFeaturesInExtent(I);f&&M.sort(f);for(let t=0,e=M.length;t<e;++t)b(M[t],t);this.renderedFeatures_=M,this.ready=E;const T=w.finish(),P=new na(p,c,u,i.getOverlaps(),T,e.getRenderBuffer(),!!t.declutter);return this.renderedResolution_=c,this.renderedRevision_=d,this.renderedRenderOrder_=f,this.renderedFrameDeclutter_=!!t.declutter,this.renderedExtent_=m,this.wrappedRenderedExtent_=p,this.renderedCenter_=_,this.renderedProjection_=h,this.renderedPixelRatio_=u,this.replayGroup_=P,this.hitDetectionImageData_=null,this.replayGroupChanged=!0,!0}renderFeature(t,e,i,n,s,r,o){if(!i)return!1;let a=!1;if(Array.isArray(i))for(let l=0,h=i.length;l<h;++l)a=rr(n,t,i[l],e,this.boundHandleStyleImageChange_,s,r,o)||a;else a=rr(n,t,i,e,this.boundHandleStyleImageChange_,s,r,o);return a}}let fa=0;const _a=1<<fa++,pa=1<<fa++,ma=1<<fa++,ya=1<<fa++,xa=1<<fa++,va=1<<fa++,wa=Math.pow(2,6)-1,Ca={[_a]:"boolean",[pa]:"number",[ma]:"string",[ya]:"color",[xa]:"number[]",[va]:"size"},Sa=Object.keys(Ca).map(Number).sort(w);function Ea(t){const e=[];for(const i of Sa)ba(t,i)&&e.push(Ca[i]);return 0===e.length?"untyped":e.length<3?e.join(" or "):e.slice(0,-1).join(", ")+", or "+e[e.length-1]}function ba(t,e){return(t&e)===e}function Ra(t,e){return!!(t&e)}function Ia(t,e){return t===e}function Ma(t){return t instanceof Error?t.message:String(t)}class Ta{constructor(t,e){if(!function(t){return t in Ca}(t))throw new Error(`literal expressions must have a specific type, got ${Ea(t)}`);this.type=t,this.value=e}}class Pa{constructor(t,e,...i){this.type=t,this.operator=e,this.args=i}}function Fa(t){return{variables:new Map,properties:new Map,featureId:!1,geometryType:!1,mCoordinate:!1,mapState:!1,inputVariables:t}}function La(t,e,i){switch(typeof t){case"boolean":if(Ia(e,ma))return new Ta(ma,t?"true":"false");if(!ba(e,_a))throw new Error(`got a boolean, but expected ${Ea(e)}`);return new Ta(_a,t);case"number":if(Ia(e,va))return new Ta(va,Qr(t));if(Ia(e,_a))return new Ta(_a,!!t);if(Ia(e,ma))return new Ta(ma,t.toString());if(!ba(e,pa))throw new Error(`got a number, but expected ${Ea(e)}`);return new Ta(pa,t);case"string":if(Ia(e,ya))return new Ta(ya,us(t));if(Ia(e,_a))return new Ta(_a,!!t);if(!ba(e,ma))throw new Error(`got a string, but expected ${Ea(e)}`);return new Ta(ma,t)}if(!Array.isArray(t))throw new Error("expression must be an array or a primitive value");if(0===t.length)throw new Error("empty expression");if("string"==typeof t[0])return function(t,e,i){const n=t[0],s=Il[n];if(!s)throw new Error(`unknown operator: ${n}`);return s(t,e,i)}(t,e,i);for(const e of t)if("number"!=typeof e)throw new Error("expected an array of numbers");if(Ia(e,va)){if(2!==t.length)throw new Error(`expected an array of two values for a size, got ${t.length}`);return new Ta(va,t)}if(Ia(e,ya)){if(3===t.length)return new Ta(ya,[...t,1]);if(4===t.length)return new Ta(ya,t);throw new Error(`expected an array of 3 or 4 values for a color, got ${t.length}`)}if(!ba(e,xa))throw new Error(`got an array of numbers, but expected ${Ea(e)}`);return new Ta(xa,t)}const ka="get",Aa="var",Oa="concat",Da="geometry-type",Ga="line-metric",za="any",Na="all",ja="!",Xa="resolution",Ka="zoom",Wa="time",Ya="==",Za="!=",Ba=">",Va=">=",Ua="<",qa="<=",$a="*",Ha="/",Ja="+",Qa="-",tl="clamp",el="%",il="^",nl="abs",sl="floor",rl="ceil",ol="round",al="sin",ll="cos",hl="atan",cl="sqrt",ul="match",dl="between",gl="interpolate",fl="interpolate-hcl",_l="coalesce",pl="case",ml="in",yl="number",xl="string",vl="array",wl="color",Cl="id",Sl="band",El="palette",bl="to-string",Rl="has",Il={[ka]:Gl(Fl(1,1/0),Ml),[Aa]:function(t,e,i){const n=t[1];if("string"!=typeof n)throw new Error("expected a string argument for var operation");let s=e;const r=i.inputVariables?.[n];if(void 0!==r){const t=La(r,wa,i);if(!(t instanceof Ta))throw new Error(`style variables should only be literal values (no expressions!), variable name: ${n}`);let o=t.type;if("string"==typeof r&&Ra(s,ya)&&!Ra(s,ma)?o=ya:Array.isArray(r)&&2===r.length&&Ra(s,va)&&!Ra(s,xa)&&(o=va),s&=o,0===s)throw new Error(`the type expected from the var operator (${Ea(e)}) did not have any overlap with the type of the corresponding style variables (${Ea(o)}), variable name: ${n}`)}if(i.variables.has(n)){const t=i.variables.get(n);if(s&=t,0===s)throw new Error(`a new type expected from the var operator (${Ea(e)}) did not have any overlap with the previous type expected for it (${Ea(t)}), variable name: ${n}`)}return i.variables.set(n,s),new Pa(s,"var",new Ta(ma,n))},[Rl]:Gl(Fl(1,1/0),Ml),[Cl]:Gl(function(t,e,i){i.featureId=!0},Pl),[Oa]:Gl(Fl(2,1/0),kl(ma)),[Da]:Gl(function(t,e,i){i.geometryType=!0},Pl),[Ga]:Gl(function(t,e,i){i.mCoordinate=!0},Pl),[Xa]:Gl(Tl,Pl),[Ka]:Gl(Tl,Pl),[Wa]:Gl(Tl,Pl),[za]:Gl(Fl(2,1/0),kl(_a)),[Na]:Gl(Fl(2,1/0),kl(_a)),[ja]:Gl(Fl(1,1),kl(_a)),[Ya]:Gl(Fl(2,2),Al()),[Za]:Gl(Fl(2,2),Al()),[Ba]:Gl(Fl(2,2),kl(pa)),[Va]:Gl(Fl(2,2),kl(pa)),[Ua]:Gl(Fl(2,2),kl(pa)),[qa]:Gl(Fl(2,2),kl(pa)),[$a]:Gl(Fl(2,1/0),Ll),[_l]:Gl(Fl(2,1/0),Ll),[Ha]:Gl(Fl(2,2),kl(pa)),[Ja]:Gl(Fl(2,1/0),kl(pa)),[Qa]:Gl(Fl(2,2),kl(pa)),[tl]:Gl(Fl(3,3),kl(pa)),[el]:Gl(Fl(2,2),kl(pa)),[il]:Gl(Fl(2,2),kl(pa)),[nl]:Gl(Fl(1,1),kl(pa)),[sl]:Gl(Fl(1,1),kl(pa)),[rl]:Gl(Fl(1,1),kl(pa)),[ol]:Gl(Fl(1,1),kl(pa)),[al]:Gl(Fl(1,1),kl(pa)),[ll]:Gl(Fl(1,1),kl(pa)),[hl]:Gl(Fl(1,2),kl(pa)),[cl]:Gl(Fl(1,1),kl(pa)),[ul]:Gl(Fl(4,1/0),Ol,function(t,e,i){const n=t.length-1,s=La(t[t.length-1],e,i);let r=ma|pa|_a;const o=new Array(n-2);for(let e=0;e<n-2;e+=2){try{r&=La(t[e+2],r,i).type}catch(t){const i=Ma(t);throw new Error(`failed to parse argument ${e+1} of match expression: ${i}`)}if(0===r)throw new Error("no common type was found among the arguments of match expression")}for(let e=0;e<n-2;e+=2){try{const n=La(t[e+2],r,i);o[e]=n}catch(t){const i=Ma(t);throw new Error(`failed to parse argument ${e+1} of match expression: ${i}`)}try{const n=La(t[e+3],s.type,i);o[e+1]=n}catch(t){throw new Error(`failed to parse argument ${e+2} of match expression: ${Ma(t)}`)}}return[La(t[1],r,i),...o,s]}),[dl]:Gl(Fl(3,3),kl(pa)),[gl]:Gl(Fl(6,1/0),Ol,Dl),[fl]:Gl(Fl(6,1/0),Ol,function(t,e,i){if(!ba(e,ya))throw new Error(`the ${t[0]} operator can only return a color, got ${Ea(e)}`)},Dl),[pl]:Gl(Fl(3,1/0),function(t,e,i){const n=t[0],s=t.length-1;if(s%2==0)throw new Error(`expected an odd number of arguments for ${n}, got ${s} instead`)},function(t,e,i){const n=La(t[t.length-1],e,i),s=new Array(t.length-1);for(let e=0;e<s.length-1;e+=2){try{const n=La(t[e+1],_a,i);s[e]=n}catch(t){throw new Error(`failed to parse argument ${e} of case expression: ${Ma(t)}`)}try{const r=La(t[e+2],n.type,i);s[e+1]=r}catch(t){throw new Error(`failed to parse argument ${e+1} of case expression: ${Ma(t)}`)}}return s[s.length-1]=n,s}),[ml]:Gl(Fl(2,2),function(t,e,i){let n,s=t[2];if(!Array.isArray(s))throw new Error('the second argument for the "in" operator must be an array');if("literal"===s[0]){if(s=s[1],!Array.isArray(s))throw new Error('failed to parse "in" expression: the literal operator must be followed by an array')}else if("string"==typeof s[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 s[0]?ma:pa;const r=new Array(s.length);for(let t=0;t<r.length;t++)try{const e=La(s[t],n,i);r[t]=e}catch(e){throw new Error(`failed to parse haystack item ${t} for "in" expression: ${Ma(e)}`)}return[La(t[1],n,i),...r]}),[yl]:Gl(Fl(1,1/0),kl(wa)),[xl]:Gl(Fl(1,1/0),kl(wa)),[vl]:Gl(Fl(1,1/0),kl(pa)),[wl]:Gl(Fl(1,4),kl(pa)),[Sl]:Gl(Fl(1,3),kl(pa)),[El]:Gl(Fl(2,2),function(t,e,i){let n;try{n=La(t[1],pa,i)}catch(t){throw new Error(`failed to parse first argument in palette expression: ${Ma(t)}`)}const s=t[2];if(!Array.isArray(s))throw new Error("the second argument of palette must be an array");const r=new Array(s.length);for(let t=0;t<r.length;t++){let e;try{e=La(s[t],ya,i)}catch(e){throw new Error(`failed to parse color at index ${t} in palette expression: ${Ma(e)}`)}if(!(e instanceof Ta))throw new Error(`the palette color at index ${t} must be a literal value`);r[t]=e}return[n,...r]}),[bl]:Gl(Fl(1,1),kl(_a|pa|ma|ya))};function Ml(t,e,i){const n=t.length-1,s=new Array(n);for(let r=0;r<n;++r){const n=t[r+1];switch(typeof n){case"number":s[r]=new Ta(pa,n);break;case"string":s[r]=new Ta(ma,n);break;default:throw new Error(`expected a string key or numeric array index for a get operation, got ${n}`)}0===r&&i.properties.set(String(n),e)}return s}function Tl(t,e,i){i.mapState=!0}function Pl(t,e,i){const n=t[0];if(1!==t.length)throw new Error(`expected no arguments for ${n} operation`);return[]}function Fl(t,e){return function(i,n,s){const r=i[0],o=i.length-1;if(t===e){if(o!==t){throw new Error(`expected ${t} argument${1===t?"":"s"} for ${r}, got ${o}`)}}else if(o<t||o>e){throw new Error(`expected ${e===1/0?`${t} or more`:`${t} to ${e}`} arguments for ${r}, got ${o}`)}}}function Ll(t,e,i){const n=t.length-1,s=new Array(n);for(let r=0;r<n;++r){const n=La(t[r+1],e,i);s[r]=n}return s}function kl(t){return function(e,i,n){const s=e.length-1,r=new Array(s);for(let i=0;i<s;++i){const s=La(e[i+1],t,n);r[i]=s}return r}}function Al(){return function(t,e,i){const n=t[0],s=t.length-1,r=new Array(s);let o=wa;for(let e=0;e<s;++e){o&=La(t[e+1],o,i).type}if(0===o)throw new Error(`no common type was found among the arguments of ${n}`);for(let e=0;e<s;++e){const n=La(t[e+1],o,i);r[e]=n}return r}}function Ol(t,e,i){const n=t[0],s=t.length-1;if(s%2==1)throw new Error(`expected an even number of arguments for operation ${n}, got ${s} instead`)}function Dl(t,e,i){const n=t[1];let s;switch(n[0]){case"linear":s=1;break;case"exponential":const t=n[1];if("number"!=typeof t||t<=0)throw new Error(`expected a number base for exponential interpolation, got ${JSON.stringify(t)} instead`);s=t;break;default:throw new Error(`invalid interpolation type: ${JSON.stringify(n)}`)}const r=new Ta(pa,s);let o;try{o=La(t[2],pa,i)}catch(t){throw new Error(`failed to parse argument 1 in interpolate expression: ${Ma(t)}`)}const a=new Array(t.length-3);for(let n=0;n<a.length;n+=2){try{const e=La(t[n+3],pa,i);a[n]=e}catch(t){throw new Error(`failed to parse argument ${n+2} for interpolate expression: ${Ma(t)}`)}try{const s=La(t[n+4],e,i);a[n+1]=s}catch(t){throw new Error(`failed to parse argument ${n+3} for interpolate expression: ${Ma(t)}`)}}return[r,o,...a]}function Gl(...t){return function(e,i,n){const s=e[0];let r=[];for(let s=0;s<t.length;s++){const o=t[s](e,i,n);if(s==t.length-1){if(!o)throw new Error("expected last argument validator to return the parsed args");r=o}}return new Pa(i,s,...r)}}function zl(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 zl(t.getGeometries()[0]);default:return""}}function Nl(t,e,i){return jl(La(t,e,i))}function jl(t,e){if(t instanceof Ta){if(t.type===ya&&"string"==typeof t.value){const e=us(t.value);return function(){return e}}return function(){return t.value}}const i=t.operator;switch(i){case yl:case xl:case _l:return function(t){const e=t.operator,i=t.args.length,n=new Array(i);for(let e=0;e<i;++e)n[e]=jl(t.args[e]);switch(e){case _l:return t=>{for(let e=0;e<i;++e){const i=n[e](t);if(null!=i)return i}throw new Error("Expected one of the values to be non-null")};case yl:case xl:return t=>{for(let s=0;s<i;++s){const i=n[s](t);if(typeof i===e)return i}throw new Error(`Expected one of the values to be a ${e}`)};default:throw new Error(`Unsupported assertion operator ${e}`)}}(t);case ka:case Aa:case Rl:return function(t){const e=t.args[0],i=e.value;switch(t.operator){case ka:return e=>{const n=t.args;let s=e.properties[i];for(let t=1,e=n.length;t<e;++t){s=s[n[t].value]}return s};case Aa:return t=>t.variables[i];case Rl:return e=>{const n=t.args;if(!(i in e.properties))return!1;let s=e.properties[i];for(let t=1,e=n.length;t<e;++t){const e=n[t].value;if(!s||!Object.hasOwn(s,e))return!1;s=s[e]}return!0};default:throw new Error(`Unsupported accessor operator ${t.operator}`)}}(t);case Cl:return t=>t.featureId??"";case Da:return t=>t.geometryType;case Oa:{const e=t.args.map(t=>jl(t));return t=>"".concat(...e.map(e=>(e(t)??"").toString()))}case Xa:return t=>t.resolution;case za:case Na:case dl:case ml:case ja:return function(t){const e=t.operator,i=t.args.length,n=new Array(i);for(let e=0;e<i;++e)n[e]=jl(t.args[e]);switch(e){case za:return t=>{for(let e=0;e<i;++e)if(n[e](t))return!0;return!1};case Na:return t=>{for(let e=0;e<i;++e)if(!n[e](t))return!1;return!0};case dl:return t=>{const e=n[0](t),i=n[1](t),s=n[2](t);return e>=i&&e<=s};case ml:return t=>{const e=n[0](t);for(let s=1;s<i;++s)if(e===n[s](t))return!0;return!1};case ja:return t=>!n[0](t);default:throw new Error(`Unsupported logical operator ${e}`)}}(t);case Ya:case Za:case Ua:case qa:case Ba:case Va:return function(t){const e=t.operator,i=jl(t.args[0]),n=jl(t.args[1]);switch(e){case Ya:return t=>i(t)===n(t);case Za:return t=>i(t)!==n(t);case Ua:return t=>i(t)<n(t);case qa:return t=>i(t)<=n(t);case Ba:return t=>i(t)>n(t);case Va:return t=>i(t)>=n(t);default:throw new Error(`Unsupported comparison operator ${e}`)}}(t);case $a:case Ha:case Ja:case Qa:case tl:case el:case il:case nl:case sl:case rl:case ol:case al:case ll:case hl:case cl:return function(t){const e=t.operator,i=t.args.length,n=new Array(i);for(let e=0;e<i;++e)n[e]=jl(t.args[e]);switch(e){case $a:return t=>{let e=1;for(let s=0;s<i;++s)e*=n[s](t);return e};case Ha:return t=>n[0](t)/n[1](t);case Ja:return t=>{let e=0;for(let s=0;s<i;++s)e+=n[s](t);return e};case Qa:return t=>n[0](t)-n[1](t);case tl:return t=>{const e=n[0](t),i=n[1](t);if(e<i)return i;const s=n[2](t);return e>s?s:e};case el:return t=>n[0](t)%n[1](t);case il:return t=>Math.pow(n[0](t),n[1](t));case nl:return t=>Math.abs(n[0](t));case sl:return t=>Math.floor(n[0](t));case rl:return t=>Math.ceil(n[0](t));case ol:return t=>Math.round(n[0](t));case al:return t=>Math.sin(n[0](t));case ll:return t=>Math.cos(n[0](t));case hl:return 2===i?t=>Math.atan2(n[0](t),n[1](t)):t=>Math.atan(n[0](t));case cl:return t=>Math.sqrt(n[0](t));default:throw new Error(`Unsupported numeric operator ${e}`)}}(t);case pl:return function(t){const e=t.args.length,i=new Array(e);for(let n=0;n<e;++n)i[n]=jl(t.args[n]);return t=>{for(let n=0;n<e-1;n+=2){if(i[n](t))return i[n+1](t)}return i[e-1](t)}}(t);case ul:return function(t){const e=t.args.length,i=new Array(e);for(let n=0;n<e;++n)i[n]=jl(t.args[n]);return t=>{const n=i[0](t);for(let s=1;s<e-1;s+=2)if(n===i[s](t))return i[s+1](t);return i[e-1](t)}}(t);case gl:case fl:return function(t){const e=t.args.length,i=new Array(e);for(let n=0;n<e;++n)i[n]=jl(t.args[n]);const n=t.operator===fl?Wl:Kl;return t=>{const s=i[0](t),r=i[1](t);let o,a;for(let l=2;l<e;l+=2){const e=i[l](t);let h=i[l+1](t);const c=Array.isArray(h);if(c&&(h=rs(h)),e>=r)return 2===l?h:c?n(s,r,o,a,e,h):Xl(s,r,o,a,e,h);o=e,a=h}return a}}(t);case bl:return function(t){const e=t.operator,i=t.args.length,n=new Array(i);for(let e=0;e<i;++e)n[e]=jl(t.args[e]);if(e===bl)return e=>{const i=n[0](e);return t.args[0].type===ya?gs(i):i.toString()};throw new Error(`Unsupported convert operator ${e}`)}(t);case vl:return function(t){const e=t.args.length,i=new Array(e);for(let n=0;n<e;++n)i[n]=jl(t.args[n]);if(t.type===ya&&(3===e||4===e)){const t=4===e?i[3]:null;return e=>[255*i[0](e),255*i[1](e),255*i[2](e),t?t(e):1]}return t=>{const n=new Array(e);for(let s=0;s<e;++s)n[s]=i[s](t);return n}}(t);case wl:return function(t){const e=t.args.length,i=new Array(e);for(let n=0;n<e;++n)i[n]=jl(t.args[n]);if(e<3){const t=2===e?i[1]:null;return e=>{const n=i[0](e);return[n,n,n,t?t(e):1]}}const n=4===e?i[3]:null;return t=>[i[0](t),i[1](t),i[2](t),n?n(t):1]}(t);default:throw new Error(`Unsupported operator ${i}`)}}function Xl(t,e,i,n,s,r){const o=s-i;if(0===o)return n;const a=e-i;return n+(1===t?a/o:(Math.pow(t,a)-1)/(Math.pow(t,o)-1))*(r-n)}function Kl(t,e,i,n,s,r){return 0===s-i?n:[Xl(t,e,i,n[0],s,r[0]),Xl(t,e,i,n[1],s,r[1]),Xl(t,e,i,n[2],s,r[2]),Xl(t,e,i,n[3],s,r[3])]}function Wl(t,e,i,n,s,r){if(0===s-i)return n;const o=cs(n),a=cs(r);let l=a[2]-o[2];l>180?l-=360:l<-180&&(l+=360);return function(t){const e=(t[0]+16)/116,i=t[1],n=t[2]*Math.PI/180,s=as(e),r=as(e+i/500*Math.cos(n)),o=as(e-i/200*Math.sin(n)),a=os(3.021973625*r-1.617392459*s-.404875592*o),l=os(-.943766287*r+1.916279586*s+.027607165*o),h=os(.069407491*r-.22898585*s+1.159737864*o);return[At(a+.5|0,0,255),At(l+.5|0,0,255),At(h+.5|0,0,255),t[3]]}([Xl(t,e,i,o[0],s,a[0]),Xl(t,e,i,o[1],s,a[1]),o[2]+Xl(t,e,i,0,s,l),Xl(t,e,i,n[3],s,r[3])])}function Yl(t){return!0}function Zl(t,e){const i=function(t,e){const i=t.length,n=new Array(i);for(let s=0;s<i;++s){const i=t[s],r="filter"in i&&void 0!==i.filter?Nl(i.filter,_a,e):Yl;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]=Vl(i.style[n],e)}else o=[Vl(i.style,e)];n[s]={filter:r,styles:o}}return function(e){const s=[];let r=!1;for(let o=0;o<i;++o){if((0,n[o].filter)(e)&&(!t[o].else||!r)){r=!0;for(const t of n[o].styles){const i=t(e);i&&s.push(i)}}}return s}}(t,e=e??Fa()),n={variables:{},properties:{},resolution:NaN,featureId:null,geometryType:""};return function(t,s){if(n.properties=t.getPropertiesInternal()??{},n.resolution=s,e.featureId){const e=t.getId();n.featureId=void 0!==e?e:null}if(e.geometryType){const e=t.getGeometry();e&&(n.geometryType=zl(e))}return i(n)}}function Bl(t,e){e=e??Fa();const i=t.length,n=new Array(i);for(let s=0;s<i;++s)n[s]=Vl(t[s],e);const s={variables:{},properties:{},resolution:NaN,featureId:null,geometryType:""},r=new Array(i);return function(t,o){if(s.properties=t.getPropertiesInternal()??{},s.resolution=o,e.featureId){const e=t.getId();s.featureId=void 0!==e?e:null}if(e.geometryType){const e=t.getGeometry();e&&(s.geometryType=zl(e))}let a=0;for(let t=0;t<i;++t){const e=n[t](s);e&&(r[a]=e,a+=1)}return r.length=a,r}}function Vl(t,e){const i=Ul(t,"",e),n=ql(t,"",e),s=function(t,e){const i="text-",n=Jl(t,i+"value",e);if(!n)return null;const s=Ul(t,i,e),r=Ul(t,i+"background-",e),o=ql(t,i,e),a=ql(t,i+"background-",e),l=Jl(t,i+"font",e),h=Hl(t,i+"max-angle",e),c=Hl(t,i+"offset-x",e),u=Hl(t,i+"offset-y",e),d=Ql(t,i+"overflow",e),g=Jl(t,i+"placement",e),f=Hl(t,i+"repeat",e),_=sh(t,i+"scale",e),p=Ql(t,i+"rotate-with-view",e),m=Hl(t,i+"rotation",e),y=Jl(t,i+"align",e),x=Jl(t,i+"justify",e),v=Jl(t,i+"baseline",e),w=Ql(t,i+"keep-upright",e),C=eh(t,i+"padding",e),S=lh(t,i+"declutter-mode"),E=new ao({declutterMode:S});return function(t){if(E.setText(n(t)),s&&E.setFill(s(t)),r&&E.setBackgroundFill(r(t)),o&&E.setStroke(o(t)),a&&E.setBackgroundStroke(a(t)),l&&E.setFont(l(t)),h&&E.setMaxAngle(h(t)),c&&E.setOffsetX(c(t)),u&&E.setOffsetY(u(t)),d&&E.setOverflow(d(t)),g){const e=g(t);if("point"!==e&&"line"!==e)throw new Error("Expected point or line for text-placement");E.setPlacement(e)}if(f&&E.setRepeat(f(t)),_&&E.setScale(_(t)),p&&E.setRotateWithView(p(t)),m&&E.setRotation(m(t)),y){const e=y(t);if("left"!==e&&"center"!==e&&"right"!==e&&"end"!==e&&"start"!==e)throw new Error("Expected left, right, center, start, or end for text-align");E.setTextAlign(e)}if(x){const e=x(t);if("left"!==e&&"right"!==e&&"center"!==e)throw new Error("Expected left, right, or center for text-justify");E.setJustify(e)}if(v){const e=v(t);if("bottom"!==e&&"top"!==e&&"middle"!==e&&"alphabetic"!==e&&"hanging"!==e)throw new Error("Expected bottom, top, middle, alphabetic, or hanging for text-baseline");E.setTextBaseline(e)}return C&&E.setPadding(C(t)),w&&E.setKeepUpright(w(t)),E}}(t,e),o=function(t,e){if("icon-src"in t)return function(t,e){const i="icon-",n=i+"src",s=ch($l(t,n),n),r=ih(t,i+"anchor",e),o=sh(t,i+"scale",e),a=Hl(t,i+"opacity",e),l=ih(t,i+"displacement",e),h=Hl(t,i+"rotation",e),c=Ql(t,i+"rotate-with-view",e),u=oh(t,i+"anchor-origin"),d=ah(t,i+"anchor-x-units"),g=ah(t,i+"anchor-y-units"),f=$l(t,i+"color");let _,p=null;if(void 0!==f){Array.isArray(f)&&f.length>0&&"string"==typeof f[0]?p=th(t,i+"color",e):_=dh(f,i+"color")}const m=function(t,e){const i=$l(t,e);if(void 0===i)return;if("string"!=typeof i)throw new Error(`Expected a string for ${e}`);return i}(t,i+"cross-origin"),y=function(t,e){const i=$l(t,e);if(void 0===i)return;return hh(i,e)}(t,i+"offset"),x=oh(t,i+"offset-origin"),v=rh(t,i+"width"),w=rh(t,i+"height"),C=function(t,e){const i=$l(t,e);if(void 0===i)return;if("number"==typeof i)return Qr(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=lh(t,i+"declutter-mode"),E={src:s,anchorOrigin:u,anchorXUnits:d,anchorYUnits:g,crossOrigin:m,offset:y,offsetOrigin:x,height:w,width:v,size:C,declutterMode:S};let b=null;return function(t){if(b)p&&b.setColor(p(t));else{const e=p?p(t):_;b=new oa(void 0!==e?Object.assign({},E,{color:e}):Object.assign({},E))}return a&&b.setOpacity(a(t)),l&&b.setDisplacement(l(t)),h&&b.setRotation(h(t)),c&&b.setRotateWithView(c(t)),o&&b.setScale(o(t)),r&&b.setAnchor(r(t)),b}}(t,e);if("shape-points"in t)return function(t,e){const i="shape-",n=i+"points",s=i+"radius",r=uh($l(t,n),n);if(!(s in t))throw new Error(`Expected a number for ${s}`);const o=Hl(t,s,e),a=$l(t,s),l="number"==typeof a?a:5,h=i+"radius2",c=Hl(t,h,e),u=$l(t,h),d="number"==typeof u?u:void 0,g=Ul(t,i,e),f=ql(t,i,e),_=sh(t,i+"scale",e),p=ih(t,i+"displacement",e),m=Hl(t,i+"rotation",e),y=Ql(t,i+"rotate-with-view",e),x=rh(t,i+"angle"),v=lh(t,i+"declutter-mode"),w=new eo({points:r,radius:l,radius2:d,angle:x,declutterMode:v});return function(t){return o&&w.setRadius(o(t)),c&&w.setRadius2(c(t)),g&&w.setFill(g(t)),f&&w.setStroke(f(t)),p&&w.setDisplacement(p(t)),m&&w.setRotation(m(t)),y&&w.setRotateWithView(y(t)),_&&w.setScale(_(t)),w}}(t,e);if("circle-radius"in t)return function(t,e){const i="circle-",n=Ul(t,i,e),s=ql(t,i,e),r=Hl(t,i+"radius",e),o=sh(t,i+"scale",e),a=ih(t,i+"displacement",e),l=Hl(t,i+"rotation",e),h=Ql(t,i+"rotate-with-view",e),c=lh(t,i+"declutter-mode"),u=new io({radius:5,declutterMode:c});return function(t){return r&&u.setRadius(r(t)),n&&u.setFill(n(t)),s&&u.setStroke(s(t)),a&&u.setDisplacement(a(t)),l&&u.setRotation(l(t)),h&&u.setRotateWithView(h(t)),o&&u.setScale(o(t)),u}}(t,e);return null}(t,e),a=Hl(t,"z-index",e);if(!(i||n||s||o||r(t)))throw new Error("No fill, stroke, point, or text symbolizer properties in style: "+JSON.stringify(t));const l=new no;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(s){const i=s(t);i&&(e=!1),l.setText(i)}if(o){const i=o(t);i&&(e=!1),l.setImage(i)}return a&&l.setZIndex(a(t)),e?null:l}}function Ul(t,e,i){let n;if(e+"fill-pattern-src"in t)n=function(t,e,i){const n=Jl(t,e+"pattern-src",i),s=nh(t,e+"pattern-offset",i),r=nh(t,e+"pattern-size",i),o=th(t,e+"color",i);return function(t){return n?{src:n(t),offset:s?s(t):null,size:r?r(t):null,color:o?o(t):null}:null}}(t,e+"fill-",i);else{if("none"===$l(t,e+"fill-color"))return t=>null;n=th(t,e+"fill-color",i)}if(!n)return null;const s=new $r;return function(t){const e=n(t);return e===Un?null:(s.setColor(e),s)}}function ql(t,e,i){const n=Hl(t,e+"stroke-width",i),s=th(t,e+"stroke-color",i);if(!n&&!s)return null;const r=Jl(t,e+"stroke-line-cap",i),o=Jl(t,e+"stroke-line-join",i),a=eh(t,e+"stroke-line-dash",i),l=Hl(t,e+"stroke-line-dash-offset",i),h=Hl(t,e+"stroke-miter-limit",i),c=Hl(t,e+"stroke-offset",i),u=new Hr;return function(t){if(s){const e=s(t);if(e===Un)return null;u.setColor(e)}if(n&&u.setWidth(n(t)),r){const e=r(t);if("butt"!==e&&"round"!==e&&"square"!==e)throw new Error("Expected butt, round, or square line cap");u.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");u.setLineJoin(e)}return a&&u.setLineDash(a(t)),l&&u.setLineDashOffset(l(t)),h&&u.setMiterLimit(h(t)),c&&u.setOffset(c(t)),u}}function $l(t,e){if(!(e in t))return;const i=t[e];return void 0===i?void 0:i}function Hl(t,e,i){const n=$l(t,e);if(void 0===n)return;const s=Nl(n,pa,i);return function(t){return uh(s(t),e)}}function Jl(t,e,i){const n=$l(t,e);if(void 0===n)return null;const s=Nl(n,ma,i);return function(t){return ch(s(t),e)}}function Ql(t,e,i){const n=$l(t,e);if(void 0===n)return null;const s=Nl(n,_a,i);return function(t){const i=s(t);if("boolean"!=typeof i)throw new Error(`Expected a boolean for ${e}`);return i}}function th(t,e,i){const n=$l(t,e);if(void 0===n)return null;const s=Nl(n,ya,i);return function(t){return dh(s(t),e)}}function eh(t,e,i){const n=$l(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 s=Nl(t,pa,i);return function(t){return uh(s(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 s=Nl(n,xa,i);return function(t){return hh(s(t),e)}}function ih(t,e,i){const n=$l(t,e);if(void 0===n)return null;const s=Nl(n,xa,i);return function(t){const i=hh(s(t),e);if(2!==i.length)throw new Error(`Expected two numbers for ${e}`);return i}}function nh(t,e,i){const n=$l(t,e);if(void 0===n)return null;const s=Nl(n,xa,i);return function(t){return gh(s(t),e)}}function sh(t,e,i){const n=$l(t,e);if(void 0===n)return null;const s=Nl(n,xa|pa,i);return function(t){return function(t,e){if("number"==typeof t)return t;return gh(t,e)}(s(t),e)}}function rh(t,e){const i=$l(t,e);if(void 0!==i){if("number"!=typeof i)throw new Error(`Expected a number for ${e}`);return i}}function oh(t,e){const i=$l(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 ah(t,e){const i=$l(t,e);if(void 0!==i){if("pixels"!==i&&"fraction"!==i)throw new Error(`Expected pixels or fraction for ${e}`);return i}}function lh(t,e){const i=$l(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 hh(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 ch(t,e){if("string"!=typeof t)throw new Error(`Expected a string for ${e}`);return t}function uh(t,e){if("number"!=typeof t)throw new Error(`Expected a number for ${e}`);return t}function dh(t,e){if("string"==typeof t)return t;const i=hh(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 gh(t,e){const i=hh(t,e);if(2!==i.length)throw new Error(`Expected an array of two numbers for ${e}`);return i}var fh={CENTER:"center",RESOLUTION:"resolution",ROTATION:"rotation"};function _h(t,e,i){return function(n,s,r,o,a){if(!n)return;if(!s&&!e)return n;const l=e?0:r[0]*(s??0),h=e?0:r[1]*(s??0),c=a?a[0]:0,u=a?a[1]:0;let d=t[0]+l/2+c,g=t[2]-l/2+c,f=t[1]+h/2+u,_=t[3]-h/2+u;d>g&&(d=(g+d)/2,g=d),f>_&&(f=(_+f)/2,_=f);let p=At(n[0],d,g),m=At(n[1],f,_);if(o&&i&&s){const t=30*s;p+=-t*Math.log(1+Math.max(0,d-n[0])/t)+t*Math.log(1+Math.max(0,n[0]-g)/t),m+=-t*Math.log(1+Math.max(0,f-n[1])/t)+t*Math.log(1+Math.max(0,n[1]-_)/t)}return[p,m]}}function ph(t){return t}function mh(t,e,i,n){const s=Mt(e)/i[0],r=St(e)/i[1];return n?Math.min(t,Math.max(s,r)):Math.min(t,Math.min(s,r))}function yh(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),At(n,i/2,2*e)}function xh(t,e,i,n,s){return i=void 0===i||i,function(r,o,a,l){if(void 0!==r){const o=n?mh(t,n,a,!!s):t;return i&&l?yh(r,o,e):At(r,e,o)}}}function vh(t){if(void 0!==t)return 0}function wh(t){if(void 0!==t)return t}const Ch=256;class Sh 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_=He(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&&Ze(),t.center&&(t.center=ri(t.center,this.projection_)),t.extent&&(t.extent=ai(t.extent,this.projection_)),this.applyOptions_(t)}applyOptions_(t){const e=Object.assign({},t);for(const t in fh)delete e[t];this.setProperties(e,!0);const i=function(t){let e,i,n;const s=28,r=2;let o=void 0!==t.minZoom?t.minZoom:0,a=void 0!==t.maxZoom?t.maxZoom:s;const l=void 0!==t.zoomFactor?t.zoomFactor:r,h=void 0!==t.multiWorld&&t.multiWorld,c=void 0===t.smoothResolutionConstraint||t.smoothResolutionConstraint,u=void 0!==t.showFullExtent&&t.showFullExtent,d=He(t.projection,"EPSG:3857"),g=d.getExtent();let f=t.constrainOnlyCenter,_=t.extent;h||_||!d.isGlobal()||(f=!1,_=g);if(void 0!==t.resolutions){const s=t.resolutions;i=s[o],n=void 0!==s[a]?s[a]:s[s.length-1],e=t.constrainResolution?function(t,e,i,n){return e=void 0===e||e,function(s,r,o,a){if(void 0!==s){const l=t[0],h=t[t.length-1],c=i?mh(l,i,o,!!n):l;if(a)return e?yh(s,c,h):At(s,h,c);const u=Math.min(c,s),d=Math.floor(S(t,u,r));return t[d]>c&&d<t.length-1?t[d+1]:t[d]}}}(s,c,!f&&_,u):xh(i,n,c,!f&&_,u)}else{const h=(g?Math.max(Mt(g),St(g)):360*Jt.degrees/d.getMetersPerUnit())/Ch/Math.pow(r,0),p=h/Math.pow(r,s-0);i=t.maxResolution,void 0!==i?o=0:i=h/Math.pow(l,o),n=t.minResolution,void 0===n&&(n=void 0!==t.maxZoom?void 0!==t.maxResolution?i/Math.pow(l,a):h/Math.pow(l,a):p),a=o+Math.floor(Math.log(i/n)/Math.log(l)),n=i/Math.pow(l,a-o),e=t.constrainResolution?function(t,e,i,n,s,r){return n=void 0===n||n,i=void 0!==i?i:0,function(o,a,l,h){if(void 0!==o){const c=s?mh(e,s,l,!!r):e;if(h)return n?yh(o,c,i):At(o,i,c);const u=1e-9,d=Math.ceil(Math.log(e/c)/Math.log(t)-u),g=-a*(.5-u)+.5,f=Math.min(c,o),_=Math.floor(Math.log(e/f)/Math.log(t)+g),p=Math.max(d,_);return At(e/Math.pow(t,p),i,c)}}}(l,i,n,c,!f&&_,u):xh(i,n,c,!f&&_,u)}return{constraint:e,maxResolution:i,minResolution:n,minZoom:o,zoomFactor:l}}(t);this.maxResolution_=i.maxResolution,this.minResolution_=i.minResolution,this.zoomFactor_=i.zoomFactor,this.resolutions_=t.resolutions,this.padding_=t.padding,this.minZoom_=i.minZoom;const n=function(t){if(void 0!==t.extent){const e=void 0===t.smoothExtentConstraint||t.smoothExtentConstraint;return _h(t.extent,t.constrainOnlyCenter,e)}const e=He(t.projection,"EPSG:3857");if(!0!==t.multiWorld&&e.isGlobal()){const t=e.getExtent().slice();return t[0]=-1/0,t[2]=1/0,_h(t,!1,!1)}return ph}(t),s=i.constraint,r=function(t){const e=void 0===t.enableRotation||t.enableRotation;if(e){const e=t.constrainRotation;return void 0===e||!0===e?function(){const t=zt(5);return function(e,i){return i||void 0===e?e:Math.abs(e)<=t?0:e}}():!1===e?wh:"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):wh}return vh}(t);this.constraints_={center:n,resolution:s,rotation:r},this.setRotation(void 0!==t.rotation?t.rotation:0),this.setCenterInternal(void 0!==t.center?t.center:null),void 0!==t.resolution?this.setResolution(t.resolution):void 0!==t.zoom&&this.setZoom(t.zoom)}get padding(){return this.padding_}set padding(t){let e=this.padding_;this.padding_=t;const i=this.getCenterInternal();if(i){const n=t||[0,0,0,0];e=e||[0,0,0,0];const s=this.getResolution(),r=s/2*(n[3]-e[3]+e[1]-n[1]),o=s/2*(n[0]-e[0]+e[2]-n[2]);this.setCenterInternal([i[0]+r,i[1]-o])}}getUpdatedOptions_(t){const e=this.getProperties();return void 0!==e.resolution?e.resolution=this.getResolution():e.zoom=this.getZoom(),e.center=this.getCenterInternal(),e.rotation=this.getRotation(),Object.assign({},e,t)}animate(t){this.isDef()&&!this.getAnimating()&&this.resolveConstraints(0);const e=new Array(arguments.length);for(let t=0;t<e.length;++t){let i=arguments[t];i.center&&(i=Object.assign({},i),i.center=ri(i.center,this.getProjection())),i.anchor&&(i=Object.assign({},i),i.anchor=ri(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&&Eh(e,!0));let s=Date.now(),r=this.targetCenter_.slice(),o=this.targetResolution_,a=this.targetRotation_;const l=[];for(;n<i;++n){const t=arguments[n],i={start:s,complete:!1,anchor:t.anchor,duration:void 0!==t.duration?t.duration:1e3,easing:t.easing||Tn,callback:e};if(t.center&&(i.sourceCenter=r,i.targetCenter=t.center.slice(),r=i.targetCenter),void 0!==t.zoom?(i.sourceResolution=o,i.targetResolution=this.getResolutionForZoom(t.zoom),o=i.targetResolution):t.resolution&&(i.sourceResolution=o,i.targetResolution=t.resolution,o=i.targetResolution),void 0!==t.rotation){i.sourceRotation=a;const e=Nt(t.rotation-a+Math.PI,2*Math.PI)-Math.PI;i.targetRotation=a+e,a=i.targetRotation}bh(i)?i.complete=!0:s+=i.duration,l.push(i)}this.animations_.push(l),this.setHint(lo,1),this.updateAnimations_()}getAnimating(){return this.hints_[lo]>0}getInteracting(){return this.hints_[ho]>0}cancelAnimations(){let t;this.setHint(lo,-this.hints_[lo]);for(let e=0,i=this.animations_.length;e<i;++e){const i=this.animations_[e];if(i[0].callback&&Eh(i[0].callback,!1),!t)for(let e=0,n=i.length;e<n;++e){const n=i[e];if(!n.complete){t=n.anchor;break}}}this.animations_.length=0,this.cancelAnchor_=t,this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN}updateAnimations_(){if(void 0!==this.updateAnimationKey_&&(cancelAnimationFrame(this.updateAnimationKey_),this.updateAnimationKey_=void 0),!this.getAnimating())return;const t=Date.now();let e=!1;for(let i=this.animations_.length-1;i>=0;--i){const n=this.animations_[i];let s=!0;for(let i=0,r=n.length;i<r;++i){const r=n[i];if(r.complete)continue;const o=t-r.start;let a=r.duration>0?o/r.duration:1;a>=1?(r.complete=!0,a=1):s=!1;const l=r.easing(a);if(r.sourceCenter){const t=r.sourceCenter[0],e=r.sourceCenter[1],i=r.targetCenter[0],n=r.targetCenter[1];this.nextCenter_=r.targetCenter;const s=t+l*(i-t),o=e+l*(n-e);this.targetCenter_=[s,o]}if(r.sourceResolution&&r.targetResolution){const t=1===l?r.targetResolution:r.sourceResolution+l*(r.targetResolution-r.sourceResolution);if(r.anchor){const e=this.getViewportSize_(this.getRotation()),i=this.constraints_.resolution(t,0,e,!0);this.targetCenter_=this.calculateCenterZoom(i,r.anchor)}this.nextResolution_=r.targetResolution,this.targetResolution_=t,this.applyTargetState_(!0)}if(void 0!==r.sourceRotation&&void 0!==r.targetRotation){const t=1===l?Nt(r.targetRotation+Math.PI,2*Math.PI)-Math.PI:r.sourceRotation+l*(r.targetRotation-r.sourceRotation);if(r.anchor){const e=this.constraints_.rotation(t,!0);this.targetCenter_=this.calculateCenterRotate(e,r.anchor)}this.nextRotation_=r.targetRotation,this.targetRotation_=t}if(this.applyTargetState_(!0),e=!0,!r.complete)break}if(s){this.animations_[i]=null,this.setHint(lo,-1),this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN;const t=n[0].callback;t&&Eh(t,!0)}}this.animations_=this.animations_.filter(Boolean),e&&void 0===this.updateAnimationKey_&&(this.updateAnimationKey_=requestAnimationFrame(this.updateAnimations_.bind(this)))}calculateCenterRotate(t,e){let i;const n=this.getCenterInternal();return void 0!==n&&(i=[n[0]-e[0],n[1]-e[1]],qt(i,t-this.getRotation()),Vt(i,e)),i}calculateCenterZoom(t,e){let i;const n=this.getCenterInternal(),s=this.getResolution();if(void 0!==n&&void 0!==s){i=[e[0]-t*(e[0]-n[0])/s,e[1]-t*(e[1]-n[1])/s]}return i}getViewportSize_(t){const e=this.viewportSize_;if(t){const i=e[0],n=e[1];return[Math.abs(i*Math.cos(t))+Math.abs(n*Math.sin(t)),Math.abs(i*Math.sin(t))+Math.abs(n*Math.cos(t))]}return e}setViewportSize(t){this.viewportSize_=Array.isArray(t)?t.slice():[100,100],this.getAnimating()||this.resolveConstraints(0)}getCenter(){const t=this.getCenterInternal();return t?si(t,this.getProjection()):t}getCenterInternal(){return this.get(fh.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 oi(this.calculateExtentInternal(t),this.getProjection())}calculateExtentInternal(t){t=t||this.getViewportSizeMinusPadding_();const e=this.getCenterInternal();W(e,"The view center is not defined");const i=this.getResolution();W(void 0!==i,"The view resolution is not defined");const n=this.getRotation();return W(void 0!==n,"The view rotation is not defined"),wt(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(fh.RESOLUTION)}getResolutions(){return this.resolutions_}getResolutionForExtent(t,e){return this.getResolutionForExtentInternal(ai(t,this.getProjection()),e)}getResolutionForExtentInternal(t,e){e=e||this.getViewportSizeMinusPadding_();const i=Mt(t)/e[0],n=St(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(fh.ROTATION)}getValueForResolutionFunction(t){const e=Math.log(t||2),i=this.getConstrainedResolution(this.maxResolution_),n=this.minResolution_,s=Math.log(i/n)/e;return function(t){return Math.log(i/t)/e/s}}getViewportSizeMinusPadding_(t){let e=this.getViewportSize_(t);const i=this.padding_;return i&&(e=[e[0]-i[1]-i[3],e[1]-i[0]-i[2]]),e}getState(){const t=this.getProjection(),e=this.getResolution(),i=this.getRotation();let n=this.getCenterInternal();const s=this.padding_;if(s){const t=this.getViewportSizeMinusPadding_();n=Rh(n,this.getViewportSize_(),[t[0]/2+s[3],t[1]/2+s[0]],e,i)}return{center:n.slice(0),projection:void 0!==t?t:null,resolution:e,nextCenter:this.nextCenter_,nextResolution:this.nextResolution_,nextRotation:this.nextRotation_,rotation:i,zoom:this.getZoom()}}getViewStateAndExtent(){return{viewState:this.getState(),extent:this.calculateExtent()}}getZoom(){let t;const e=this.getResolution();return void 0!==e&&(t=this.getZoomForResolution(e)),t}getZoomForResolution(t){let e,i,n=this.minZoom_||0;if(this.resolutions_){const s=S(this.resolutions_,t,1);n=s,e=this.resolutions_[s],i=s==this.resolutions_.length-1?2:e/this.resolutions_[s+1]}else e=this.maxResolution_,i=this.zoomFactor_;return n+Math.log(e/t)/Math.log(i)}getResolutionForZoom(t){if(this.resolutions_?.length){if(1===this.resolutions_.length)return this.resolutions_[0];const e=At(Math.floor(t),0,this.resolutions_.length-2),i=this.resolutions_[e]/this.resolutions_[e+1];return this.resolutions_[e]/Math.pow(i,At(t-e,0,1))}return this.maxResolution_/Math.pow(this.zoomFactor_,t-this.minZoom_)}fit(t,e){let i;if(W(Array.isArray(t)||"function"==typeof t.getSimplifiedGeometry,"Invalid extent or geometry provided as `geometry`"),Array.isArray(t)){W(!Pt(t),"Cannot fit empty extent provided as `geometry`");i=hn(ai(t,this.getProjection()))}else if("Circle"===t.getType()){const e=ai(t.getExtent(),this.getProjection());i=hn(e),i.rotate(this.getRotation(),xt(e))}else{const e=null;i=e?t.clone().transform(e,this.getProjection()):t}this.fitInternal(i,e)}rotatedExtentForGeometry(t){const e=this.getRotation(),i=Math.cos(e),n=Math.sin(-e),s=t.getFlatCoordinates(),r=t.getStride();let o=1/0,a=1/0,l=-1/0,h=-1/0;for(let t=0,e=s.length;t<e;t+=r){const e=s[t]*i-s[t+1]*n,r=s[t]*n+s[t+1]*i;o=Math.min(o,e),a=Math.min(a,r),l=Math.max(l,e),h=Math.max(h,r)}return[o,a,l,h]}fitInternal(t,e){let i=(e=e||{}).size;i||(i=this.getViewportSizeMinusPadding_());const n=void 0!==e.padding?e.padding:[0,0,0,0],s=void 0!==e.nearest&&e.nearest;let r;r=void 0!==e.minResolution?e.minResolution:void 0!==e.maxZoom?this.getResolutionForZoom(e.maxZoom):0;const o=this.rotatedExtentForGeometry(t);let a=this.getResolutionForExtentInternal(o,[i[0]-n[1]-n[3],i[1]-n[0]-n[2]]);a=isNaN(a)?r:Math.max(a,r),a=this.getConstrainedResolution(a,s?0:1);const l=this.getRotation(),h=Math.sin(l),c=Math.cos(l),u=xt(o);u[0]+=(n[1]-n[3])/2*a,u[1]+=(n[0]-n[2])/2*a;const d=u[0]*c-u[1]*h,g=u[1]*c+u[0]*h,f=this.getConstrainedCenter([d,g],a),_=e.callback?e.callback:k;void 0!==e.duration?this.animateInternal({resolution:a,center:f,duration:e.duration,easing:e.easing},_):(this.targetResolution_=a,this.targetCenter_=f,this.applyTargetState_(!1,!0),Eh(_,!0))}centerOn(t,e,i){this.centerOnInternal(ri(t,this.getProjection()),e,i)}centerOnInternal(t,e,i){this.setCenterInternal(Rh(t,e,i,this.getResolution(),this.getRotation()))}calculateCenterShift(t,e,i,n){let s;const r=this.padding_;if(r&&t){const o=this.getViewportSizeMinusPadding_(-i),a=Rh(t,n,[o[0]/2+r[3],o[1]/2+r[0]],e,i);s=[t[0]-a[0],t[1]-a[1]]}return s}isDef(){return!!this.getCenterInternal()&&void 0!==this.getResolution()}adjustCenter(t){const e=si(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&&ri(e,this.getProjection()),this.adjustResolutionInternal(t,e)}adjustResolutionInternal(t,e){const i=this.getAnimating()||this.getInteracting(),n=this.getViewportSize_(this.getRotation()),s=this.constraints_.resolution(this.targetResolution_*t,0,n,i);e&&(this.targetCenter_=this.calculateCenterZoom(s,e)),this.targetResolution_=this.targetResolution_*t,this.applyTargetState_()}adjustZoom(t,e){this.adjustResolution(Math.pow(this.zoomFactor_,-t),e)}adjustRotation(t,e){e&&(e=ri(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_=this.targetRotation_+t,this.applyTargetState_()}setCenter(t){this.setCenterInternal(t?ri(t,this.getProjection()):t)}setCenterInternal(t){this.targetCenter_=t,this.applyTargetState_()}setHint(t,e){return this.hints_[t]+=e,this.changed(),this.hints_[t]}setResolution(t){this.targetResolution_=t,this.applyTargetState_()}setRotation(t){this.targetRotation_=t,this.applyTargetState_()}setZoom(t){this.setResolution(this.getResolutionForZoom(t))}applyTargetState_(t,e){const i=this.getAnimating()||this.getInteracting()||e,n=this.constraints_.rotation(this.targetRotation_,i),s=this.getViewportSize_(n),r=this.constraints_.resolution(this.targetResolution_,0,s,i),o=this.constraints_.center(this.targetCenter_,r,s,i,this.calculateCenterShift(this.targetCenter_,r,n,s));this.get(fh.ROTATION)!==n&&this.set(fh.ROTATION,n),this.get(fh.RESOLUTION)!==r&&(this.set(fh.RESOLUTION,r),this.set("zoom",this.getZoom(),!0)),o&&this.get(fh.CENTER)&&Ut(this.get(fh.CENTER),o)||this.set(fh.CENTER,o),this.getAnimating()&&!t&&this.cancelAnimations(),this.cancelAnchor_=void 0}resolveConstraints(t,e,i){t=void 0!==t?t:200;const n=e||0,s=this.constraints_.rotation(this.targetRotation_),r=this.getViewportSize_(s),o=this.constraints_.resolution(this.targetResolution_,n,r),a=this.constraints_.center(this.targetCenter_,o,r,!1,this.calculateCenterShift(this.targetCenter_,o,s,r));if(0===t&&!this.cancelAnchor_)return this.targetResolution_=o,this.targetRotation_=s,this.targetCenter_=a,void this.applyTargetState_();i=i||(0===t?this.cancelAnchor_:void 0),this.cancelAnchor_=void 0,this.getResolution()===o&&this.getRotation()===s&&this.getCenterInternal()&&Ut(this.getCenterInternal(),a)||(this.getAnimating()&&this.cancelAnimations(),this.animateInternal({rotation:s,center:a,resolution:o,duration:t,easing:Mn,anchor:i}))}beginInteraction(){this.resolveConstraints(0),this.setHint(ho,1)}endInteraction(t,e,i){i=i&&ri(i,this.getProjection()),this.endInteractionInternal(t,e,i)}endInteractionInternal(t,e,i){this.getInteracting()&&(this.setHint(ho,-1),this.resolveConstraints(t,e,i))}getConstrainedCenter(t,e){const i=this.getViewportSize_(this.getRotation());return this.constraints_.center(t,e||this.getResolution(),i)}getConstrainedZoom(t,e){const i=this.getResolutionForZoom(t);return this.getZoomForResolution(this.getConstrainedResolution(i,e))}getConstrainedResolution(t,e){e=e||0;const i=this.getViewportSize_(this.getRotation());return this.constraints_.resolution(t,e,i)}}function Eh(t,e){setTimeout(function(){t(e)},0)}function bh(t){return!(t.sourceCenter&&t.targetCenter&&!Ut(t.sourceCenter,t.targetCenter))&&(t.sourceResolution===t.targetResolution&&t.sourceRotation===t.targetRotation)}function Rh(t,e,i,n,s){const r=Math.cos(-s);let o=Math.sin(-s),a=t[0]*r-t[1]*o,l=t[1]*r+t[0]*o;a+=(e[0]/2-i[0])*n,l+=(i[1]-e[1]/2)*n,o=-o;return[a*r-l*o,l*r+a*o]}var Ih="opacity",Mh="visible",Th="extent",Ph="zIndex",Fh="maxResolution",Lh="minResolution",kh="maxZoom",Ah="minZoom",Oh="source",Dh="map";class Gh 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[Ih]=void 0!==t.opacity?t.opacity:1,W("number"==typeof e[Ih],"Layer opacity must be a number"),e[Mh]=void 0===t.visible||t.visible,e[Ph]=t.zIndex,e[Fh]=void 0!==t.maxResolution?t.maxResolution:1/0,e[Lh]=void 0!==t.minResolution?t.minResolution:0,e[Ah]=void 0!==t.minZoom?t.minZoom:-1/0,e[kh]=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=At(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 I()}getLayerStatesArray(t){return I()}getExtent(){return this.get(Th)}getMaxResolution(){return this.get(Fh)}getMinResolution(){return this.get(Lh)}getMinZoom(){return this.get(Ah)}getMaxZoom(){return this.get(kh)}getOpacity(){return this.get(Ih)}getSourceState(){return I()}getVisible(){return this.get(Mh)}getZIndex(){return this.get(Ph)}setBackground(t){this.background_=t,this.changed()}setExtent(t){this.set(Th,t)}setMaxResolution(t){this.set(Fh,t)}setMinResolution(t){this.set(Lh,t)}setMaxZoom(t){this.set(kh,t)}setMinZoom(t){this.set(Ah,t)}setOpacity(t){W("number"==typeof t,"Layer opacity must be a number"),this.set(Ih,t)}setVisible(t){this.set(Mh,t)}setZIndex(t){this.set(Ph,t)}disposeInternal(){this.state_&&(this.state_.layer=null,this.state_=null),super.disposeInternal()}}class zh extends Gh{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(Oh,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(Oh)||null}getRenderSource(){return this.getSource()}getSourceState(){const t=this.getSource();return t?t.getState():"undefined"}handleSourceChange_(){this.changed();const t=this.getSource();t&&!this.sourceReady_&&"ready"===t.getState()&&(this.sourceReady_=!0,this.dispatchEvent("sourceready"))}handleSourcePropertyChange_(){this.sourceChangeKey_&&(l(this.sourceChangeKey_),this.sourceChangeKey_=null),this.sourceReady_=!1;const t=this.getSource();t&&(this.sourceChangeKey_=o(t,h,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();!t&&i&&(t=i.getView()),e=t instanceof Sh?{viewState:t.getState(),extent:t.calculateExtent()}:t;const n=e;let s;if(!n.layerStatesArray&&i&&(n.layerStatesArray=i.getLayerGroup().getLayerStatesArray()),n.layerStatesArray){if(s=n.layerStatesArray.find(t=>t.layer===this),!s)return!1}else s=this.getLayerState();const r=this.getExtent();return Nh(s,n.viewState)&&(!r||Tt(r,n.extent))}getAttributions(t){if(!this.isVisible(t))return[];const e=this.getSource()?.getAttributions();if(!e)return[];let i=e(t instanceof Sh?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(Dh,t)}getMapInternal(){return this.get(Dh)}setMap(t){this.mapPrecomposeKey_&&(l(this.mapPrecomposeKey_),this.mapPrecomposeKey_=null),t||this.changed(),this.mapRenderKey_&&(l(this.mapRenderKey_),this.mapRenderKey_=null),t&&(this.mapPrecomposeKey_=o(t,hr,this.handlePrecompose_,this),this.mapRenderKey_=o(this,h,t.render,t),this.changed())}handlePrecompose_(t){const e=t.frameState?.layerStatesArray;if(!e)return;const i=this.getLayerState(!1);W(!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(Oh,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 Nh(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 jh="renderOrder";class Xh extends zh{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(jh)}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}getUpdateWhileAnimating(){return this.updateWhileAnimating_}getUpdateWhileInteracting(){return this.updateWhileInteracting_}renderDeclutter(t,e){const i=this.getDeclutter();if(!i)return;t.declutter||(t.declutter={}),i in t.declutter==!1&&(t.declutter[i]=new Sr(9));const n=this.getRenderer();n&&n.renderDeclutter(t,e)}setRenderOrder(t){this.set(jh,t)}setStyle(t){this.style_=void 0===t?ro:t??null;const e=function(t){if(void 0===t)return ro;if(!t)return null;if("function"==typeof t)return t;if(t instanceof no)return t;if(Array.isArray(t)&&0===t.length)return[];if(Array.isArray(t)&&t[0]instanceof no){const e=t.length,i=new Array(e);for(let n=0;n<e;++n){const e=t[n];if(!(e instanceof no))throw new Error("Expected a list of style instances");i[n]=e}return i}const e=t;return function(t,e){if(e=e??Fa(),!Array.isArray(t))return Bl([t],e);const i=t.length;if("style"in t[0]){const n=new Array(i);for(let e=0;e<i;++e){const i=t[e];if(!("style"in i))throw new Error("Expected a list of rules with a style property");n[e]=i}return Zl(n,e)}return Bl(t,e)}(e)}(t);this.styleFunction_=null===t||null===e?void 0:function(t){let e;if("function"==typeof t)e=t;else{let i;Array.isArray(t)?i=t:(W("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()}}class Kh extends Xh{constructor(t){super(t)}createRenderer(){return new ga(this)}}class Wh extends O{constructor(t,e,i){super(t),this.map=e,this.frameState=void 0!==i?i:null}}class Yh extends Wh{constructor(t,e,i,n,s,r){super(t,e,s),this.originalEvent=i,this.pixel_=null,this.coordinate_=null,this.dragging=void 0!==n&&n,this.activePointers=r,this.ctrlKey=!1}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()}}var Zh={SINGLECLICK:"singleclick",CLICK:d,DBLCLICK:g,POINTERDRAG:"pointerdrag",POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"},Bh="pointermove",Vh="pointerdown";class Uh extends D{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();if(!i)throw new Error("Map viewport is required");this.activePointers_=[],this.trackedTouches_={},this.element_=i,this.pointerdownListenerKey_=o(i,Vh,this.handlePointerDown_,this),this.originalPointerMoveEvent_,this.relayedListenerKey_=o(i,Bh,this.relayMoveEvent_,this),this.boundHandleTouchMove_=this.handleTouchMove_.bind(this),this.element_.addEventListener(y,this.boundHandleTouchMove_,!!vn&&{passive:!1})}emulateClick_(t){let e=new Yh(Zh.CLICK,this.map_,t);this.dispatchEvent(e),void 0!==this.clickTimeoutId_?(clearTimeout(this.clickTimeoutId_),this.clickTimeoutId_=void 0,e=new Yh(Zh.DBLCLICK,this.map_,t),this.dispatchEvent(e)):this.clickTimeoutId_=setTimeout(()=>{this.clickTimeoutId_=void 0;const e=new Yh(Zh.SINGLECLICK,this.map_,t);this.dispatchEvent(e)},250)}updateActivePointers_(t){const e=t,i=e.pointerId;if(e.type==Zh.POINTERUP||e.type==Zh.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!=Zh.POINTERDOWN&&e.type!=Zh.POINTERMOVE||(this.trackedTouches_[i]=e);this.activePointers_=Object.values(this.trackedTouches_)}handlePointerUp_(t){this.updateActivePointers_(t);const e=new Yh(Zh.POINTERUP,this.map_,t,void 0,void 0,this.activePointers_);this.dispatchEvent(e),this.emulateClicks_&&!e.defaultPrevented&&!this.dragging_&&this.isMouseActionButton_(t)&&this.down_&&this.emulateClick_(this.down_),0===this.activePointers_.length&&(this.dragListenerKeys_.forEach(l),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 Yh(Zh.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(),e=this.element_;if(!e)return;if(this.dragListenerKeys_.push(o(t,Zh.POINTERMOVE,this.handlePointerMove_,this),o(t,Zh.POINTERUP,this.handlePointerUp_,this),o(e,Zh.POINTERCANCEL,this.handlePointerUp_,this)),e.getRootNode&&e.getRootNode()!==t){const t=e.getRootNode();this.dragListenerKeys_.push(o(t,Zh.POINTERUP,this.handlePointerUp_,this))}}}handlePointerMove_(t){if(this.isMoving_(t)){this.updateActivePointers_(t),this.dragging_=!0;const e=new Yh(Zh.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 Yh(Zh.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){const e=this.down_;return this.dragging_||null!==e&&(Math.abs(t.clientX-e.clientX)>this.moveTolerance_||Math.abs(t.clientY-e.clientY)>this.moveTolerance_)}disposeInternal(){const t=this.element_;this.relayedListenerKey_&&(l(this.relayedListenerKey_),this.relayedListenerKey_=void 0),t&&t.removeEventListener(y,this.boundHandleTouchMove_),this.pointerdownListenerKey_&&(l(this.pointerdownListenerKey_),this.pointerdownListenerKey_=void 0),this.dragListenerKeys_.forEach(l),this.dragListenerKeys_.length=0,this.element_=void 0,super.disposeInternal()}}var qh="postrender",$h="movestart",Hh="moveend",Jh="loadstart",Qh="loadend",tc="layergroup",ec="size",ic="target",nc="view";const sc=1/0;class rc{constructor(t,e){this.priorityFunction_=t,this.keyFunction_=e,this.elements_=[],this.priorities_=[],this.queuedElements_={}}clear(){this.elements_.length=0,this.priorities_.length=0,s(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){W(!(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!=sc&&(this.elements_.push(t),this.priorities_.push(e),this.queuedElements_[this.keyFunction_(t)]=!0,this.siftDown_(0,this.elements_.length-1),!0)}getCount(){return this.elements_.length}getLeftChildIndex_(t){return 2*t+1}getRightChildIndex_(t){return 2*t+2}getParentIndex_(t){return t-1>>1}heapify_(){let t;for(t=(this.elements_.length>>1)-1;t>=0;t--)this.siftUp_(t)}isEmpty(){return 0===this.elements_.length}isKeyQueued(t){return t in this.queuedElements_}isQueued(t){return this.isKeyQueued(this.keyFunction_(t))}siftUp_(t){const e=this.elements_,i=this.priorities_,n=e.length,s=e[t],r=i[t],o=t;for(;t<n>>1;){const s=this.getLeftChildIndex_(t),r=this.getRightChildIndex_(t),o=r<n&&i[r]<i[s]?r:s;e[t]=e[o],i[t]=i[o],t=o}e[t]=s,i[t]=r,this.siftDown_(o,t)}siftDown_(t,e){const i=this.elements_,n=this.priorities_,s=i[e],r=n[e];for(;e>t;){const t=this.getParentIndex_(e);if(!(n[t]>r))break;i[e]=i[t],n[e]=n[t],e=t}i[e]=s,n[e]=r}reprioritize(){const t=this.priorityFunction_,e=this.elements_,i=this.priorities_;let n=0;const s=e.length;let r,o,a;for(o=0;o<s;++o)r=e[o],a=t(r),a==sc?delete this.queuedElements_[this.keyFunction_(r)]:(i[n]=a,e[n++]=r);e.length=n,i.length=n,this.heapify_()}}class oc extends rc{constructor(t,e){super(e=>t.apply(null,e),t=>t[0].getKey()),this.boundHandleTileChange_=this.handleTileChange.bind(this),this.tileChangeCallback_=e,this.tilesLoading_=0,this.tilesLoadingKeys_={}}enqueue(t){const e=super.enqueue(t);if(e){t[0].addEventListener(h,this.boundHandleTileChange_)}return e}getTilesLoading(){return this.tilesLoading_}handleTileChange(t){const e=t.target,i=e.getState();if(i===En||i===bn||i===Rn){i!==bn&&e.removeEventListener(h,this.boundHandleTileChange_);const t=e.getKey();t in this.tilesLoadingKeys_&&(delete this.tilesLoadingKeys_[t],--this.tilesLoading_),this.tileChangeCallback_()}}loadMoreTiles(t,e){let i=0;for(;this.tilesLoading_<t&&i<e&&this.getCount()>0;){const t=this.dequeue()[0],e=t.getKey();t.getState()!==Cn||e in this.tilesLoadingKeys_||(this.tilesLoadingKeys_[e]=!0,++this.tilesLoading_,++i,t.load())}}}class ac 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)l(this.listenerKeys[t]);if(this.listenerKeys.length=0,this.map_=t,t){const e=this.target_??t.getOverlayContainerStopEvent();this.element&&e&&e.appendChild(this.element),this.render!==k&&this.listenerKeys.push(o(t,qh,this.render,this)),t.render()}}render(t){}setTarget(t){this.target_="string"==typeof t?document.getElementById(t):t}}class lc extends ac{constructor(t){t=t||{},super({element:document.createElement("div"),render:t.render,target:t.target}),this.ulElement_=document.createElement("ul"),this.collapsed_=void 0===t.collapsed||t.collapsed,this.userCollapsed_=this.collapsed_,this.overrideCollapsible_=void 0!==t.collapsible,this.collapsible_=void 0===t.collapsible||t.collapsible,this.collapsible_||(this.collapsed_=!1),this.attributions_=t.attributions;const e=void 0!==t.className?t.className:"ol-attribution",i=void 0!==t.tipLabel?t.tipLabel:"Attributions",n=void 0!==t.expandClassName?t.expandClassName:e+"-expand",s=void 0!==t.collapseLabel?t.collapseLabel:"›",r=void 0!==t.collapseClassName?t.collapseClassName:e+"-collapse";"string"==typeof s?(this.collapseLabel_=document.createElement("span"),this.collapseLabel_.textContent=s,this.collapseLabel_.className=r):this.collapseLabel_=s;const o=void 0!==t.label?t.label:"i";"string"==typeof o?(this.label_=document.createElement("span"),this.label_.textContent=o,this.label_.className=n):this.label_=o;const a=this.collapsible_&&!this.collapsed_?this.collapseLabel_:this.label_;this.toggleButton_=document.createElement("button"),this.toggleButton_.setAttribute("type","button"),this.toggleButton_.setAttribute("aria-expanded",String(!this.collapsed_)),this.toggleButton_.title=i,this.toggleButton_.appendChild(a),this.toggleButton_.addEventListener(d,this.handleClick_.bind(this),!1);const l=e+" "+bs+" "+Is+(this.collapsed_&&this.collapsible_?" "+Ms:"")+(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();if(!e)return[];const i=e.getAllLayers(),n=new Set(i.flatMap(e=>e.getAttributions(t)));if(void 0!==this.attributions_&&(Array.isArray(this.attributions_)?this.attributions_.forEach(t=>n.add(t)):n.add(this.attributions_)),!this.overrideCollapsible_){const t=!i.some(t=>!1===t.getSource()?.getAttributionsCollapsible());this.setCollapsible(t)}return Array.from(n)}async updateElement_(t){const e=this.element;if(!e)return;if(!t)return void(this.renderedVisible_&&(e.style.display="none",this.renderedVisible_=!1));const i=await Promise.all(this.collectSourceAttributions_(t).map(t=>{return e=()=>t,function(){let t;try{t=e()}catch(t){return Promise.reject(t)}return P(t)?t:Promise.resolve(t)}();var e})),n=i.length>0;if(this.renderedVisible_!=n&&(e.style.display=n?"":"none",this.renderedVisible_=n),!R(i,this.renderedAttributions_)){Nn(this.ulElement_);for(let t=0,e=i.length;t<e;++t){const e=document.createElement("li");e.innerHTML=i[t],this.ulElement_.appendChild(e)}this.renderedAttributions_=i}}handleClick_(t){t.preventDefault(),this.handleToggle_(),this.userCollapsed_=this.collapsed_}handleToggle_(){const t=this.element;t&&(t.classList.toggle(Ms),this.collapsed_?zn(this.collapseLabel_,this.label_):zn(this.label_,this.collapseLabel_),this.collapsed_=!this.collapsed_,this.toggleButton_.setAttribute("aria-expanded",String(!this.collapsed_)))}getCollapsible(){return this.collapsible_}setCollapsible(t){if(this.collapsible_===t)return;this.collapsible_=t;const e=this.element;e&&(e.classList.toggle("ol-uncollapsible"),this.userCollapsed_&&this.handleToggle_())}setCollapsed(t){this.userCollapsed_=t,this.collapsible_&&this.collapsed_!==t&&this.handleToggle_()}getCollapsed(){return this.collapsed_}render(t){this.updateElement_(t.frameState)}}class hc extends ac{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_,"string"==typeof i?(this.label_=document.createElement("span"),this.label_.className=n,this.label_.textContent=i):(this.label_=i,this.label_.classList.add(n));const s=t.tipLabel?t.tipLabel:"Reset rotation",r=document.createElement("button");r.className=e+"-reset",r.setAttribute("type","button"),r.title=s,r.appendChild(this.label_),r.addEventListener(d,this.handleClick_.bind(this),!1);const o=e+" "+bs+" "+Is,a=this.element;a.className=o,a.appendChild(r),this.callResetNorth_=t.resetNorth?t.resetNorth:void 0,this.duration_=void 0!==t.duration?t.duration:250,this.autoHide_=void 0===t.autoHide||t.autoHide,this.rotation_=void 0,this.autoHide_&&this.element.classList.add(Es)}handleClick_(t){t.preventDefault(),void 0!==this.callResetNorth_?this.callResetNorth_():this.resetNorth_()}resetNorth_(){const t=this.getMap();if(!t)return;const e=t.getView();if(!e)return;const i=e.getRotation();void 0!==i&&(this.duration_>0&&i%(2*Math.PI)!=0?e.animate({rotation:0,duration:this.duration_,easing:Mn}):e.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)",e=this.element;if(this.autoHide_&&e){const t=e.classList.contains(Es);t||0!==i?t&&0!==i&&e.classList.remove(Es):e.classList.add(Es)}this.label_.style.transform=t}this.rotation_=i}}class cc extends ac{constructor(t){t=t||{},super({element:document.createElement("div"),target:t.target});const e=void 0!==t.className?t.className:"ol-zoom",i=void 0!==t.delta?t.delta:1,n=void 0!==t.zoomInClassName?t.zoomInClassName:e+"-in",s=void 0!==t.zoomOutClassName?t.zoomOutClassName:e+"-out",r=void 0!==t.zoomInLabel?t.zoomInLabel:"+",o=void 0!==t.zoomOutLabel?t.zoomOutLabel:"–",a=void 0!==t.zoomInTipLabel?t.zoomInTipLabel:"Zoom in",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 r?document.createTextNode(r):r),h.addEventListener(d,this.handleClick_.bind(this,i),!1);const c=document.createElement("button");c.className=s,c.setAttribute("type","button"),c.title=l,c.appendChild("string"==typeof o?document.createTextNode(o):o),c.addEventListener(d,this.handleClick_.bind(this,-i),!1);const u=e+" "+bs+" "+Is,g=this.element;g.className=u,g.appendChild(h),g.appendChild(c),this.duration_=void 0!==t.duration?t.duration:250}handleClick_(t,e){e.preventDefault(),this.zoomByDelta_(t)}zoomByDelta_(t){const e=this.getMap();if(!e)return;const i=e.getView();if(!i)return;const n=i.getZoom();if(void 0!==n){const e=i.getConstrainedZoom(n+t);if(void 0===e)return;this.duration_>0?(i.getAnimating()&&i.cancelAnimations(),i.animate({zoom:e,duration:this.duration_,easing:Mn})):i.setZoom(e)}}}function uc(t){t=t||{};const e=new K;(void 0===t.zoom||t.zoom)&&e.push(new cc(t.zoomOptions));(void 0===t.rotate||t.rotate)&&e.push(new hc(t.rotateOptions));return(void 0===t.attribution||t.attribution)&&e.push(new lc(t.attributionOptions)),e}var dc="active";class gc 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(dc)}getMap(){return this.map_}handleEvent(t){return!0}setActive(t){this.set(dc,t)}setMap(t){this.map_=t}}function fc(t,e,i,n){const s=t.getZoom();if(void 0===s)return;const r=t.getConstrainedZoom(s+e);if(void 0===r)return;const o=t.getResolutionForZoom(r);void 0!==o&&(t.getAnimating()&&t.cancelAnimations(),t.animate({resolution:o,anchor:i,duration:void 0!==n?n:250,easing:Mn}))}class _c extends gc{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==Zh.DBLCLICK){const i=t.originalEvent,n=t.map,s=t.coordinate,r=i.shiftKey?-this.delta_:this.delta_;fc(n.getView(),r,s,this.duration_),i.preventDefault(),e=!0}return!e}}function pc(t){const e=arguments;return function(t){let i=!0;for(let n=0,s=e.length;n<s&&(i=i&&e[n](t),i);++n);return i}}const mc=function(t){const e=t.originalEvent;return e.altKey&&!(e.metaKey||e.ctrlKey)&&e.shiftKey},yc=function(t){const e=t.map.getTargetElement();if(!e)return!0;const i=e.getRootNode();return!(i instanceof ShadowRoot?i.host:e).hasAttribute("tabindex")||function(t){const e=t.map.getTargetElement();if(!e)return!1;const i=e.getRootNode(),n=t.map.getOwnerDocument().activeElement;return i instanceof ShadowRoot?i.host.contains(n):e.contains(n)}(t)},xc=F,vc=function(t){const e=t.originalEvent;return"pointerId"in e&&0==e.button&&!(_n&&pn&&e.ctrlKey)},wc=function(t){const e=t.originalEvent;return!e.altKey&&!(e.metaKey||e.ctrlKey)&&!e.shiftKey},Cc=function(t){const e=t.originalEvent;return!e.altKey&&!(e.metaKey||e.ctrlKey)&&e.shiftKey},Sc=function(t){const e=t.originalEvent,i=e.target.tagName;return"INPUT"!==i&&"SELECT"!==i&&"TEXTAREA"!==i&&!e.target.isContentEditable},Ec=function(t){const e=t.originalEvent;return"pointerId"in e&&"mouse"==e.pointerType},bc=function(t){const e=t.originalEvent;return"pointerId"in e&&e.isPrimary&&0===e.button};class Rc extends gc{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==Zh.POINTERDRAG)this.handleDragEvent(t),t.originalEvent.preventDefault();else if(t.type==Zh.POINTERUP){const e=this.handleUpEvent(t);this.handlingDownUpSequence=e&&this.targetPointers.length>0}}else if(t.type==Zh.POINTERDOWN){const i=this.handleDownEvent(t);this.handlingDownUpSequence=i,e=this.stopDown(i)}else t.type==Zh.POINTERMOVE&&this.handleMoveEvent(t);return!e}handleMoveEvent(t){}handleUpEvent(t){return!1}stopDown(t){return t}updateTrackedPointers_(t){t.activePointers&&(this.targetPointers=t.activePointers)}}function Ic(t){const e=t.length;let i=0,n=0;for(let s=0;s<e;s++)i+=t[s].clientX,n+=t[s].clientY;return{clientX:i/e,clientY:n/e}}class Mc extends Rc{constructor(t){super({stopDown:L}),t=t||{},this.kinetic_=t.kinetic,this.lastCentroid=null,this.lastPointersCount_,this.panning_=!1;const e=t.condition?t.condition:pc(wc,bc);this.condition_=t.onFocusOnly?pc(yc,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(Ic(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(),s=i.getResolution();void 0!==s&&($t(e,s),qt(e,i.getRotation()),i.adjustCenterInternal(e))}}else this.kinetic_&&this.kinetic_.begin();this.lastCentroid=n,this.lastPointersCount_=i.length,t.originalEvent.preventDefault()}handleUpEvent(t){const e=t.map,i=e.getView();if(0===this.targetPointers.length){if(!this.noKinetic_&&this.kinetic_&&this.kinetic_.end()){const t=this.kinetic_.getDistance(),n=this.kinetic_.getAngle(),s=i.getCenterInternal();if(s){const r=e.getPixelFromCoordinateInternal(s),o=e.getCoordinateFromPixelInternal([r[0]-t*Math.cos(n),r[1]-t*Math.sin(n)]);i.animateInternal({center:i.getConstrainedCenter(o),duration:500,easing:Mn})}}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}}class Tc extends Rc{constructor(t){t=t||{},super({stopDown:L}),this.condition_=t.condition?t.condition:mc,this.lastAngle_=void 0,this.duration_=void 0!==t.duration?t.duration:250}handleDragEvent(t){if(!Ec(t))return;const e=t.map,i=e.getView();if(i.getConstraints().rotation===vh)return;const n=e.getSize();if(!n)return;const s=t.pixel,r=Math.atan2(n[1]/2-s[1],s[0]-n[0]/2);if(void 0!==this.lastAngle_){const t=r-this.lastAngle_;i.adjustRotationInternal(-t)}this.lastAngle_=r}handleUpEvent(t){if(!Ec(t))return!0;return t.map.getView().endInteraction(this.duration_),!1}handleDownEvent(t){if(!Ec(t))return!1;if(vc(t)&&this.condition_(t)){return t.map.getView().beginInteraction(),this.lastAngle_=void 0,!0}return!1}}class Pc extends v{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_;if(!t||!e)return;const 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_){const t=this.map_.getOverlayContainer();t&&t.removeChild(this.element_);const e=this.element_.style;e.left="inherit",e.top="inherit",e.width="inherit",e.height="inherit"}if(this.map_=t,this.map_){const t=this.map_.getOverlayContainer();t&&t.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_;if(!t||!e)return;const i=[t,[t[0],e[1]],e,[e[0],t[1]]],n=this.map_,s=i.map(t=>n.getCoordinateFromPixelInternal(t)),r=s[0];if(!r)return;s[4]=r.slice();const o=s;this.geometry_?this.geometry_.setCoordinates([o]):this.geometry_=new ln([o])}getGeometry(){return this.geometry_}}const Fc="boxstart",Lc="boxdrag",kc="boxend",Ac="boxcancel";class Oc extends O{constructor(t,e,i){super(t),this.coordinate=e,this.mapBrowserEvent=i}}class Dc extends Rc{constructor(t){super(),this.on,this.once,this.un,t=t??{},this.box_=new Pc(t.className||"ol-dragbox"),this.minArea_=t.minArea??64,t.onBoxEnd&&(this.onBoxEnd=t.onBoxEnd),this.startPixel_=null,this.condition_=t.condition??vc,this.boxEndCondition_=t.boxEndCondition??this.defaultBoxEndCondition}defaultBoxEndCondition(t,e,i){const n=i[0]-e[0],s=i[1]-e[1];return n*n+s*s>=this.minArea_}getGeometry(){return this.box_.getGeometry()}handleDragEvent(t){this.startPixel_&&(this.box_.setPixels(this.startPixel_,t.pixel),this.dispatchEvent(new Oc(Lc,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 Oc(e?kc:Ac,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 Oc(Fc,t.coordinate,t)),!0)}onBoxEnd(t){}setActive(t){t||(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new Oc(Ac,this.startPixel_,null)),this.startPixel_=null)),super.setActive(t)}setMap(t){this.getMap()&&(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new Oc(Ac,this.startPixel_,null)),this.startPixel_=null)),super.setMap(t)}}class Gc extends Dc{constructor(t){super({condition:(t=t||{}).condition?t.condition:Cc,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();if(!e)return;const i=e.getView();let n=this.getGeometry();if(this.out_){const t=i.rotatedExtentForGeometry(n),e=i.getResolutionForExtentInternal(t),s=i.getResolution();if(void 0===e||void 0===s)return;const r=s/e;n=n.clone(),n.scale(r*r)}i.fitInternal(n,{duration:this.duration_,easing:Mn})}}var zc="ArrowLeft",Nc="ArrowUp",jc="ArrowRight",Xc="ArrowDown";class Kc extends gc{constructor(t){super(),t=t||{},this.defaultCondition_=function(t){return wc(t)&&Sc(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==f){const i=t.originalEvent,n=i.key;if(this.condition_(t)&&(n==Xc||n==zc||n==jc||n==Nc)){const s=t.map.getView(),r=s.getResolution();if(void 0===r)return!0;const o=r*this.pixelDelta_;let a=0,l=0;n==Xc?l=-o:n==zc?a=-o:n==jc?a=o:l=o;const h=[a,l];qt(h,s.getRotation()),function(t,e,i){const n=t.getCenterInternal();if(n){const s=[n[0]+e[0],n[1]+e[1]];t.animateInternal({duration:void 0!==i?i:250,easing:Pn,center:t.getConstrainedCenter(s)})}}(s,h,this.duration_),i.preventDefault(),e=!0}}return!e}}class Wc extends gc{constructor(t){super(),t=t||{},this.condition_=t.condition?t.condition:function(t){return!function(t){const e=t.originalEvent;return pn?e.metaKey:e.ctrlKey}(t)&&Sc(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==f||t.type==_){const i=t.originalEvent,n=i.key;if(this.condition_(t)&&("+"===n||"-"===n)){const s=t.map,r="+"===n?this.delta_:-this.delta_;fc(s.getView(),r,void 0,this.duration_),i.preventDefault(),e=!0}}return!e}}class Yc extends gc{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:xc;this.condition_=t.onFocusOnly?pc(yc,e):e,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_,this.mode_=void 0,this.trackpadEventGap_=400,this.trackpadTimeoutId_,this.deltaPerZoom_=300}endInteraction_(){this.trackpadTimeoutId_=void 0;const t=this.getMap();if(!t)return;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_):void 0)}handleEvent(t){if(!this.condition_(t))return!0;if(t.type!==x)return!0;const e=t.map,i=t.originalEvent;i.preventDefault();const n=i.ctrlKey&&!t.ctrlKey;this.useAnchor_&&(this.lastAnchor_=t.pixel);let s=i.deltaY;switch(i.deltaMode){case WheelEvent.DOM_DELTA_LINE:s*=40;break;case WheelEvent.DOM_DELTA_PAGE:s*=300}if(0===s)return!1;this.lastDelta_=s;const r=Date.now();void 0===this.startTime_&&(this.startTime_=r),(!this.mode_||r-this.startTime_>this.trackpadEventGap_)&&(this.mode_=Math.abs(s)<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&&(s*=3),o.adjustZoom(-s/this.deltaPerZoom_,this.lastAnchor_?e.getCoordinateFromPixel(this.lastAnchor_):void 0),this.startTime_=r,!1;this.totalDelta_+=s;const a=Math.max(this.timeout_-(r-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=-At(this.totalDelta_,-this.maxDelta_*this.deltaPerZoom_,this.maxDelta_*this.deltaPerZoom_)/this.deltaPerZoom_;(e.getConstrainResolution()||this.constrainResolution_)&&(i=i?i>0?1:-1:0),fc(e,i,this.lastAnchor_?t.getCoordinateFromPixel(this.lastAnchor_):void 0,this.duration_),this.mode_=void 0,this.totalDelta_=0,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_=void 0}setMouseAnchor(t){this.useAnchor_=t,t||(this.lastAnchor_=null)}}class Zc extends Rc{constructor(t){const e=t=t||{};e.stopDown||(e.stopDown=L),super(e),this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.threshold_=void 0!==t.threshold?t.threshold:.3,this.duration_=void 0!==t.duration?t.duration:250}handleDragEvent(t){let e=0;const i=this.targetPointers[0],n=this.targetPointers[1],s=Math.atan2(n.clientY-i.clientY,n.clientX-i.clientX);if(void 0!==this.lastAngle_){const t=s-this.lastAngle_;this.rotationDelta_+=t,!this.rotating_&&Math.abs(this.rotationDelta_)>this.threshold_&&(this.rotating_=!0),e=t}this.lastAngle_=s;const r=t.map,o=r.getView();o.getConstraints().rotation!==vh&&(this.anchor_=r.getCoordinateFromPixelInternal(r.getEventPixel(Ic(this.targetPointers)))??null,this.rotating_&&(r.render(),o.adjustRotationInternal(e,this.anchor_??void 0)))}handleUpEvent(t){if(this.targetPointers.length<2){return t.map.getView().endInteraction(this.duration_),!1}return!0}handleDownEvent(t){if(this.targetPointers.length>=2){const e=t.map;return this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.handlingDownUpSequence||e.getView().beginInteraction(),!0}return!1}}class Bc extends Rc{constructor(t){const e=t=t||{};e.stopDown||(e.stopDown=L),super(e),this.anchor_=null,this.duration_=void 0!==t.duration?t.duration:400,this.lastDistance_=void 0,this.lastScaleDelta_=1}handleDragEvent(t){let e=1;const i=this.targetPointers[0],n=this.targetPointers[1],s=i.clientX-n.clientX,r=i.clientY-n.clientY,o=Math.sqrt(s*s+r*r);void 0!==this.lastDistance_&&(e=this.lastDistance_/o),this.lastDistance_=o;const a=t.map,l=a.getView();1!=e&&(this.lastScaleDelta_=e),this.anchor_=a.getCoordinateFromPixelInternal(a.getEventPixel(Ic(this.targetPointers)))??null,a.render(),l.adjustResolutionInternal(e,this.anchor_??void 0)}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 Vc(t){t=t||{};const e=new K,i=new Wn(-.005,.05,100);(void 0===t.altShiftDragRotate||t.altShiftDragRotate)&&e.push(new Tc);(void 0===t.doubleClickZoom||t.doubleClickZoom)&&e.push(new _c({delta:t.zoomDelta,duration:t.zoomDuration}));(void 0===t.dragPan||t.dragPan)&&e.push(new Mc({onFocusOnly:t.onFocusOnly,kinetic:i}));(void 0===t.pinchRotate||t.pinchRotate)&&e.push(new Zc);(void 0===t.pinchZoom||t.pinchZoom)&&e.push(new Bc({duration:t.zoomDuration}));(void 0===t.keyboard||t.keyboard)&&(e.push(new Kc),e.push(new Wc({delta:t.zoomDelta,duration:t.zoomDuration})));(void 0===t.mouseWheelZoom||t.mouseWheelZoom)&&e.push(new Yc({onFocusOnly:t.onFocusOnly,duration:t.zoomDuration}));return(void 0===t.shiftDragZoom||t.shiftDragZoom)&&e.push(new Gc({duration:t.zoomDuration})),e}const Uc="addlayer",qc="removelayer";class $c extends O{constructor(t,e){super(t),this.layer=e}}const Hc="layers";class Jc extends Gh{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(Hc,this.handleLayersChanged_),i?Array.isArray(i)?i=new K(i.slice(),{unique:!0}):W("function"==typeof i.getArray,"Expected `layers` to be an array or a `Collection`"):i=new K(void 0,{unique:!0}),this.setLayers(i)}handleLayerChange_(){this.changed()}handleLayersChanged_(){this.layersListenerKeys_.forEach(l),this.layersListenerKeys_.length=0;const t=this.getLayers();this.layersListenerKeys_.push(o(t,e,this.handleLayersAdd_,this),o(t,i,this.handleLayersRemove_,this));for(const t in this.listenerKeys_)this.listenerKeys_[t].forEach(l);s(this.listenerKeys_);const n=t.getArray();for(let t=0,e=n.length;t<e;t++){const e=n[t];this.registerLayerListeners_(e),this.dispatchEvent(new $c(Uc,e))}this.changed()}registerLayerListeners_(t){const e=[o(t,n,this.handleLayerChange_,this),o(t,h,this.handleLayerChange_,this)];t instanceof Jc&&e.push(o(t,Uc,this.handleLayerGroupAdd_,this),o(t,qc,this.handleLayerGroupRemove_,this)),this.listenerKeys_[T(t)]=e}handleLayerGroupAdd_(t){this.dispatchEvent(new $c(Uc,t.layer))}handleLayerGroupRemove_(t){this.dispatchEvent(new $c(qc,t.layer))}handleLayersAdd_(t){const e=t.element;this.registerLayerListeners_(e),this.dispatchEvent(new $c(Uc,e)),this.changed()}handleLayersRemove_(t){const e=t.element,i=T(e);this.listenerKeys_[i].forEach(l),delete this.listenerKeys_[i],this.dispatchEvent(new $c(qc,e)),this.changed()}getLayers(){return this.get(Hc)}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 $c(qc,t[e]))}this.set(Hc,t)}getLayersArray(t){return t=void 0!==t?t:[],this.getLayers().forEach(function(e){e.getLayersArray(t)}),t}getLayerStatesArray(t){const e=void 0!==t?t:[],i=e.length;this.getLayers().forEach(function(t){t.getLayerStatesArray(e)});const n=this.getLayerState();let s=n.zIndex;t||void 0!==n.zIndex||(s=0);for(let t=i,r=e.length;t<r;t++){const i=e[t];i.opacity*=n.opacity,i.visible=i.visible&&n.visible,i.maxResolution=Math.min(i.maxResolution,n.maxResolution),i.minResolution=Math.max(i.minResolution,n.minResolution),i.minZoom=Math.max(i.minZoom,n.minZoom),i.maxZoom=Math.min(i.maxZoom,n.maxZoom),void 0!==n.extent&&(void 0!==i.extent?i.extent=Et(i.extent,n.extent):i.extent=n.extent),void 0===i.zIndex&&(i.zIndex=s)}return e}getSourceState(){return"ready"}}class Qc extends v{constructor(t){super(),this.map_=t}dispatchRenderEvent(t,e){I()}calculateMatrices2D(t){const e=t.viewState,i=t.coordinateToPixelTransform,n=t.pixelToCoordinateTransform;fi(i,t.size[0]/2,t.size[1]/2,1/e.resolution,-1/e.resolution,-e.rotation,-e.center[0],-e.center[1]),_i(n,i)}forEachFeatureAtCoordinate(t,e,i,n,s,r,o,a){let l;const h=e.viewState;function c(t,e,i,n){return s.call(r,e,t?i:null,n)}const u=h.projection,d=Ht(t.slice(),u),g=[[0,0]];if(u.canWrapX()&&n){const t=Mt(u.getExtent());g.push([-t,0],[t,0])}const f=e.layerStatesArray,_=f.length,p=[],m=[];for(let n=0;n<g.length;n++)for(let s=_-1;s>=0;--s){const r=f[s],u=r.layer;if(u.hasRenderer()&&Nh(r,h)&&o.call(a,u)){const s=u.getRenderer(),o=u.getSource();if(s&&o){const a=o.getWrapX()?d:t,h=c.bind(null,r.managed);m[0]=a[0]+g[n][0],m[1]=a[1]+g[n][1],l=s.forEachFeatureAtCoordinate(m,e,i,h,p)}if(l)return l}}if(0===p.length)return;const y=1/p.length;return p.forEach((t,e)=>t.distanceSq+=e*y),p.sort((t,e)=>t.distanceSq-e.distanceSq),p.some(t=>l=t.callback(t.feature,t.layer,t.geometry)),l}hasFeatureAtCoordinate(t,e,i,n,s,r){return void 0!==this.forEachFeatureAtCoordinate(t,e,i,n,F,this,s,r)}getMap(){return this.map_}renderFrame(t){I()}scheduleExpireIconCache(t){_s.canExpireCache()&&t.postRenderFunctions.push(tu)}}function tu(t,e){_s.expire()}class eu extends Qc{constructor(t){super(t),this.fontChangeListenerKey_=o(Ks,n,t.redrawText,t),this.element_=yn?jn():document.createElement("div");const e=this.element_.style;e.position="absolute",e.width="100%",e.height="100%",e.zIndex="0",this.element_.className=bs+" 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 la(t,void 0,e);i.dispatchEvent(n)}}disposeInternal(){l(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(hr,t);const e=t.layerStatesArray.sort((t,e)=>t.zIndex-e.zIndex);e.some(t=>t.layer instanceof Xh&&t.layer.getDeclutter())&&(t.declutter={});const i=t.viewState;this.children_.length=0;const n=this.getMap().getTargetElement();let s;Xn(n)&&(s=n.getContext("2d"),s.setTransform(1,0,0,1,0,0),s.clearRect(0,0,n.width,n.height));const r=[];let o=s?n:null;for(let n=0,s=e.length;n<s;++n){const s=e[n];t.layerIndex=n;const a=s.layer,l=a.getSourceState();if(!Nh(s,i)||"ready"!=l&&"undefined"!=l){a.unrender();continue}const h=a.render(t,o);h&&(h!==o&&(this.children_.push(h),o=h),r.push(s))}if(this.declutter(t,r),function(t,e){const i=t.childNodes;for(let n=0;;++n){const s=i[n],r=e[n];if(!s&&!r)break;s!==r&&(s?r?t.insertBefore(r,s):(t.removeChild(s),--n):t.appendChild(r))}}(this.element_,this.children_),s)for(const t of this.children_){const e=t.firstElementChild||t,i=t.style.backgroundColor;if(i&&(!Xn(e)||e.width>0)&&(s.fillStyle=i,s.fillRect(0,0,s.canvas.width,s.canvas.height)),!Xn(e)||0===e.width)continue;s.save();const n=t.style.opacity||e.style.opacity;s.globalAlpha=""===n?1:Number(n);const r=e.style.transform;if(r)s.transform(...mi(r));else{const t=parseFloat(e.style.width)/e.width,i=parseFloat(e.style.height)/e.height;s.transform(t,0,0,i,0,0)}s.drawImage(e,0,0),s.restore()}this.dispatchRenderEvent(cr,t),this.renderedVisible_||(this.element_.style.display="",this.renderedVisible_=!0),this.scheduleExpireIconCache(t)}declutter(t,e){if(t.declutter){for(let i=e.length-1;i>=0;--i){const n=e[i],s=n.layer;s.getDeclutter()&&s.renderDeclutter(t,n)}e.forEach(e=>e.layer?.renderDeferred(t))}}}function iu(t){t instanceof zh?t.setMapInternal(null):t instanceof Jc&&t.getLayers().forEach(iu)}function nu(t,e){if(t instanceof zh)t.setMapInternal(e);else if(t instanceof Jc){const i=t.getLayers().getArray();for(let t=0,n=i.length;t<n;++t)nu(i[t],e)}}let su=class extends N{constructor(t){super(),t=t||{},this.on,this.once,this.un;const n=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 Jc({layers:t.layers});let s,r,o;i[tc]=n,i[ic]=t.target,i[nc]=t.view instanceof Sh?t.view:new Sh,void 0!==t.controls&&(Array.isArray(t.controls)?s=new K(t.controls.slice()):(W("function"==typeof t.controls.getArray,"Expected `controls` to be an array or an `ol/Collection.js`"),s=t.controls));void 0!==t.interactions&&(Array.isArray(t.interactions)?r=new K(t.interactions.slice()):(W("function"==typeof t.interactions.getArray,"Expected `interactions` to be an array or an `ol/Collection.js`"),r=t.interactions));void 0!==t.overlays?Array.isArray(t.overlays)?o=new K(t.overlays.slice()):(W("function"==typeof t.overlays.getArray,"Expected `overlays` to be an array or an `ol/Collection.js`"),o=t.overlays):o=new K;return{controls:s,interactions:r,keyboardEventTarget:e,overlays:o,values:i}}(t);this.renderComplete_=!1,this.loaded_=!0,this.boundHandleBrowserEvent_=this.handleBrowserEvent.bind(this),this.ctrlKey_=!1,this.boundHandleCtrlKey_=this.handleCtrlKey_.bind(this),this.maxTilesLoading_=void 0!==t.maxTilesLoading?t.maxTilesLoading:16,this.pixelRatio_=void 0!==t.pixelRatio?t.pixelRatio:mn,this.postRenderTimeoutHandle_,this.animationDelayKey_,this.animationDelay_=this.animationDelay_.bind(this),this.coordinateToPixelTransform_=di(),this.pixelToCoordinateTransform_=di(),this.frameIndex_=0,this.frameState_=null,this.previousExtent_=null,this.viewPropertyListenerKey_=null,this.viewChangeListenerKey_=null,this.layerGroupPropertyListenerKeys_=null,this.viewport_,this.overlayContainer_,this.overlayContainerStopEvent_,yn||(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_=n.keyboardEventTarget,this.targetChangeHandlerKeys_=null,this.targetElement_=null,yn||(this.resizeObserver_=new ResizeObserver(()=>this.updateSize())),this.controls=n.controls||(yn?new K:uc()),this.interactions=n.interactions||(yn?new K:Vc({onFocusOnly:!0})),this.overlays_=n.overlays,this.overlayIdIndex_={},this.renderer_=null,this.postRenderFunctions_=[],this.tileQueue_=new oc(this.getTilePriority.bind(this),this.handleTileChange_.bind(this)),this.addChangeListener(tc,this.handleLayerGroupChanged_),this.addChangeListener(nc,this.handleViewChanged_),this.addChangeListener(ec,this.handleSizeChanged_),this.addChangeListener(ic,this.handleTargetChanged_),this.setProperties(n.values);const s=this;!t.view||t.view instanceof Sh||t.view.then(function(t){s.setView(new Sh(t))}),this.controls.addEventListener(e,t=>{t.element.setMap(this)}),this.controls.addEventListener(i,t=>{t.element.setMap(null)}),this.interactions.addEventListener(e,t=>{t.element.setMap(this)}),this.interactions.addEventListener(i,t=>{t.element.setMap(null)}),this.overlays_.addEventListener(e,t=>{this.addOverlayInternal_(t.element)}),this.overlays_.addEventListener(i,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){nu(t.layer,this)}addOverlay(t){this.getOverlays().push(t)}addOverlayInternal_(t){const e=t.getId();void 0!==e&&(this.overlayIdIndex_[e.toString()]=t),t.setMap(this)}disposeInternal(){this.controls.clear(),this.interactions.clear(),this.overlays_.clear(),this.resizeObserver_?.disconnect(),this.setTarget(null),super.disposeInternal()}forEachFeatureAtPixel(t,e,i){if(!this.frameState_||!this.renderer_)return;const n=this.getCoordinateFromPixelInternal(t),s=void 0!==(i=void 0!==i?i:{}).hitTolerance?i.hitTolerance:0,r=void 0!==i.layerFilter?i.layerFilter:F,o=!1!==i.checkWrapped;return this.renderer_.forEachFeatureAtCoordinate(n,this.frameState_,s,o,e,null,r,null)}getFeaturesAtPixel(t,e){const i=[];return this.forEachFeatureAtPixel(t,function(t){i.push(t)},e),i}getAllLayers(){const t=[];return function e(i){i.forEach(function(i){i instanceof Jc?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:F,s=void 0!==e.hitTolerance?e.hitTolerance:0,r=!1!==e.checkWrapped;return this.renderer_.hasFeatureAtCoordinate(i,this.frameState_,s,r,n,null)}getEventCoordinate(t){return this.getCoordinateFromPixel(this.getEventPixel(t))}getEventCoordinateInternal(t){return this.getCoordinateFromPixelInternal(this.getEventPixel(t))}getEventPixel(t){const e=this.viewport_.getBoundingClientRect(),i=this.getSize(),n=e.width/i[0],s=e.height/i[1],r="changedTouches"in t?t.changedTouches[0]:t;return[(r.clientX-e.left)/n,(r.clientY-e.top)/s]}getTarget(){return this.get(ic)}getTargetElement(){return this.targetElement_}getCoordinateFromPixel(t,e){const i=si(this.getCoordinateFromPixelInternal(t),this.getView().getProjection());if(e?.wrapX&&i){Ht(i,this.getView().getProjection())}return i}getCoordinateFromPixelInternal(t){const e=this.frameState_;return e?gi(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(tc)}setLayers(t){const e=this.getLayerGroup();if(t instanceof K)return void e.setLayers(t);const i=e.getLayers();i.clear(),i.extend(t)}getLayers(){return this.getLayerGroup().getLayers()}updateRenderComplete_(){this.renderComplete_=(this.hasListener(Jh)||this.hasListener(Qh)||this.hasListener(ur))&&!this.tileQueue_.getTilesLoading()&&!this.tileQueue_.getCount()&&!this.getLoadingOrNotReady()}getLoadingOrNotReady(){const t=this.getLayerGroup().getLayerStatesArray();for(let e=0,i=t.length;e<i;++e){const i=t[e];if(!i.visible)continue;const n=i.layer.getRenderer();if(n&&!n.ready)return!0;const s=i.layer.getSource();if(s&&s.loading)return!0}return!1}getPixelFromCoordinate(t,e){const i=this.getView().getProjection();let n=ri(t);return e?.wrapX&&this.frameState_&&(n=function(t,e,i){if(e.canWrapX()){const n=Mt(e.getExtent()),s=Math.round((i-t[0])/n);0!==s&&(t[0]+=s*n)}return t}(n.slice(),i,this.frameState_.viewState.center[0])),this.getPixelFromCoordinateInternal(n)}getPixelFromCoordinateInternal(t){const e=this.frameState_;return e?gi(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(ec)}getView(){return this.get(nc)}getViewport(){return this.viewport_}getOverlayContainer(){return this.overlayContainer_}getOverlayContainerStopEvent(){return this.overlayContainerStopEvent_}getOwnerDocument(){const t=this.getTargetElement();return t?t.ownerDocument:document}getTilePriority(t,e,i,n){return function(t,e,i,n,s){if(!t||!(i in t.wantedTiles))return sc;if(!t.wantedTiles[i][e.getKey()])return sc;const r=t.viewState.center,o=n[0]-r[0],a=n[1]-r[1];return 65536*Math.log(s)+Math.sqrt(o*o+a*a)/s}(this.frameState_,t,e,i,n)}handleBrowserEvent(t,e){e=e||t.type;const i=new Yh(e,this,t);this.handleMapBrowserEvent(i)}handleCtrlKey_(t){const e=t;this.ctrlKey_="Control"===e.key?e.type===f:e.ctrlKey}handleMapBrowserEvent(t){if(!1===t.originalEvent.ctrlKey&&(this.ctrlKey_=!1),t.ctrlKey=this.ctrlKey_,!this.frameState_)return;const e=t.originalEvent,i=e.type;if(i===Vh||i===x||i===f){const t=this.getOwnerDocument(),i=this.viewport_.getRootNode?this.viewport_.getRootNode():t,n=e.target,s=i instanceof ShadowRoot?i.host===n?i.host.ownerDocument:i:i===t?t.documentElement:i;if(this.overlayContainerStopEvent_.contains(n)||!s.contains(n))return}if(t.frameState=this.frameState_,!1!==this.dispatchEvent(t)){const e=this.getInteractions().getArray().slice();for(let i=e.length-1;i>=0;i--){const n=e[i];if(n.getMap()!==this||!n.getActive()||!this.getTargetElement())continue;if(!n.handleEvent(t)||t.propagationStopped)break}}}handlePostRender(){const t=this.frameState_,e=this.tileQueue_;if(!e.isEmpty()){let i=this.maxTilesLoading_,n=i;const s=t?t.viewHints:void 0;if(!!s&&(s[lo]||s[ho])){const e=Date.now()-t.time>8;i=e?0:8,n=e?0:2}if(e.getTilesLoading()<i){const t=e.getCount();e.reprioritize(),e.getCount()<t&&this.updateRenderComplete_(),e.loadMoreTiles(i,n)}}t&&this.renderer_&&!t.animate&&(this.renderComplete_?(this.hasListener(ur)&&this.renderer_.dispatchRenderEvent(ur,t),!1===this.loaded_&&(this.loaded_=!0,this.dispatchEvent(new Wh(Qh,this,t)))):!0===this.loaded_&&(this.loaded_=!1,this.dispatchEvent(new Wh(Jh,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_){const t=this.targetChangeHandlerKeys_;for(let e=0,i=t.length;e<i;++e)l(t[e]);this.targetChangeHandlerKeys_=null;const e=this.getOwnerDocument();e.removeEventListener(f,this.boundHandleCtrlKey_,!0),e.removeEventListener(p,this.boundHandleCtrlKey_,!0),this.ctrlKey_=!1,this.viewport_.removeEventListener(u,this.boundHandleBrowserEvent_),this.viewport_.removeEventListener(x,this.boundHandleBrowserEvent_),this.mapBrowserEventHandler_.dispose(),this.mapBrowserEventHandler_=null,this.viewport_.remove()}if(this.targetElement_&&!Xn(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(Xn(e)||e.appendChild(this.viewport_),this.renderer_||(this.renderer_=new eu(this)),!Xn(e)){this.mapBrowserEventHandler_=new Uh(this,this.moveTolerance_);for(const t in Zh)this.mapBrowserEventHandler_.addEventListener(Zh[t],this.handleMapBrowserEvent.bind(this));this.viewport_.addEventListener(u,this.boundHandleBrowserEvent_,!1),this.viewport_.addEventListener(x,this.boundHandleBrowserEvent_,!!vn&&{passive:!1});const t=this.getOwnerDocument();let i;if(t.addEventListener(f,this.boundHandleCtrlKey_,!0),t.addEventListener(p,this.boundHandleCtrlKey_,!0),this.keyboardEventTarget_)i=this.keyboardEventTarget_;else{const t=e.getRootNode();i=t instanceof ShadowRoot?t.host:e}if(this.targetChangeHandlerKeys_=[o(i,f,this.handleBrowserEvent,this),o(i,_,this.handleBrowserEvent,this)],!Xn(e)){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_&&(l(this.viewPropertyListenerKey_),this.viewPropertyListenerKey_=null),this.viewChangeListenerKey_&&(l(this.viewChangeListenerKey_),this.viewChangeListenerKey_=null);const t=this.getView();t&&(this.updateViewportSize_(this.getSize()),this.viewPropertyListenerKey_=o(t,n,this.handleViewPropertyChanged_,this),this.viewChangeListenerKey_=o(t,h,this.handleViewPropertyChanged_,this),t.resolveConstraints(0)),this.render()}handleLayerGroupChanged_(){this.layerGroupPropertyListenerKeys_&&(this.layerGroupPropertyListenerKeys_.forEach(l),this.layerGroupPropertyListenerKeys_=null);const t=this.getLayerGroup();t&&(this.handleLayerAdd_(new $c("addlayer",t)),this.layerGroupPropertyListenerKeys_=[o(t,n,this.render,this),o(t,h,this.render,this),o(t,"addlayer",this.handleLayerAdd_,this),o(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){iu(t.layer)}removeOverlay(t){return this.getOverlays().remove(t)}renderFrame_(t){const e=this.getSize(),i=this.getView(),n=this.frameState_;let s=null;if(void 0!==e&&Jr(e)&&i&&i.isDef()){const n=i.getHints(this.frameState_?this.frameState_.viewHints:void 0),r=i.getState();if(s={animate:!1,coordinateToPixelTransform:this.coordinateToPixelTransform_,declutter:null,extent:wt(r.center,r.resolution,r.rotation,e),index:this.frameIndex_++,layerIndex:0,layerStatesArray:this.getLayerGroup().getLayerStatesArray(),pixelRatio:this.pixelRatio_,pixelToCoordinateTransform:this.pixelToCoordinateTransform_,postRenderFunctions:[],size:e,tileQueue:this.tileQueue_,time:t,usedTiles:{},viewState:r,viewHints:n,wantedTiles:{},mapId:T(this),renderTargets:{}},r.nextCenter&&r.nextResolution){const t=isNaN(r.nextRotation)?r.rotation:r.nextRotation;s.nextExtent=wt(r.nextCenter,r.nextResolution,t,e)}}if(this.frameState_=s,this.renderer_.renderFrame(s),s){if(s.animate&&this.render(),Array.prototype.push.apply(this.postRenderFunctions_,s.postRenderFunctions),n){(!this.previousExtent_||!Pt(this.previousExtent_)&&!ct(s.extent,this.previousExtent_))&&(this.dispatchEvent(new Wh($h,this,n)),this.previousExtent_=at(this.previousExtent_))}this.previousExtent_&&!s.viewHints[lo]&&!s.viewHints[ho]&&!ct(s.extent,this.previousExtent_)&&(this.dispatchEvent(new Wh(Hh,this,s)),Q(s.extent,this.previousExtent_))}this.dispatchEvent(new Wh(qh,this,s)),this.updateRenderComplete_(),this.postRenderTimeoutHandle_||(this.postRenderTimeoutHandle_=setTimeout(()=>{this.postRenderTimeoutHandle_=void 0,this.handlePostRender()},0))}setLayerGroup(t){const e=this.getLayerGroup();e&&this.handleLayerRemove_(new $c("removelayer",e)),this.set(tc,t)}setSize(t){this.set(ec,t)}setTarget(t){this.set(ic,t)}setView(t){if(!t||t instanceof Sh)return void this.set(nc,t);this.set(nc,new Sh);const e=this;t.then(function(t){e.setView(new Sh(t))})}updateSize(){const t=this.getTargetElement();let e;if(t){let i,n;if(Xn(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)],!Jr(e)&&(t.offsetWidth||t.offsetHeight||t.getClientRects().length)&&Bt("No map visible because the map container's width or height are 0."))}const i=this.getSize();!e||i&&R(e,i)||(this.updateViewportSize_(e),this.setSize(e))}updateViewportSize_(t){const e=this.getView();e&&e.setViewportSize(t)}};const ru="element",ou="map",au="offset",lu="position",hu="positioning";class cu extends N{constructor(t){super(),this.on,this.once,this.un,this.options=t,this.id=t.id,this.insertFirst=void 0===t.insertFirst||t.insertFirst,this.stopEvent=void 0===t.stopEvent||t.stopEvent,this.element=document.createElement("div"),this.element.className=void 0!==t.className?t.className:"ol-overlay-container ol-selectable",this.element.style.position="absolute",this.element.style.pointerEvents="auto",this.autoPan=!0===t.autoPan?{}:t.autoPan||void 0,this.rendered={transform_:"",visible:!0},this.mapPostrenderListenerKey=null,this.addChangeListener(ru,this.handleElementChanged),this.addChangeListener(ou,this.handleMapChanged),this.addChangeListener(au,this.handleOffsetChanged),this.addChangeListener(lu,this.handlePositionChanged),this.addChangeListener(hu,this.handlePositioningChanged),void 0!==t.element&&this.setElement(t.element),this.setOffset(void 0!==t.offset?t.offset:[0,0]),this.setPositioning(t.positioning||"top-left"),void 0!==t.position&&this.setPosition(t.position)}getElement(){return this.get(ru)}getId(){return this.id}getMap(){return this.get(ou)||null}getOffset(){return this.get(au)}getPosition(){return this.get(lu)}getPositioning(){return this.get(hu)}handleElementChanged(){Nn(this.element);const t=this.getElement();t&&this.element.appendChild(t)}handleMapChanged(){this.mapPostrenderListenerKey&&(this.element?.remove(),l(this.mapPostrenderListenerKey),this.mapPostrenderListenerKey=null);const t=this.getMap();if(t){this.mapPostrenderListenerKey=o(t,qh,this.render,this),this.updatePixelPosition();const e=this.stopEvent?t.getOverlayContainerStopEvent():t.getOverlayContainer();e&&(this.insertFirst?e.insertBefore(this.element,e.childNodes[0]||null):e.appendChild(this.element)),this.performAutoPan()}}render(){this.updatePixelPosition()}handleOffsetChanged(){this.updatePixelPosition()}handlePositionChanged(){this.updatePixelPosition(),this.performAutoPan()}handlePositioningChanged(){this.updatePixelPosition()}setElement(t){this.set(ru,t)}setMap(t){this.set(ou,t)}setOffset(t){this.set(au,t)}setPosition(t){this.set(lu,t)}performAutoPan(){this.autoPan&&this.panIntoView(this.autoPan)}panIntoView(t){const e=this.getMap();if(!e||!e.getTargetElement()||!this.get(lu))return;const i=e.getSize(),n=this.getElement();if(!i||!n)return;const s=e.getTargetElement();if(!s)return;const r=this.getRect(s,i),o=this.getRect(n,[Dn(n),Gn(n)]),a=void 0===(t=t||{}).margin?20:t.margin;if(!it(r,o)){const i=o[0]-r[0],n=r[2]-o[2],s=o[1]-r[1],l=r[3]-o[3],h=[0,0];if(i<0?h[0]=i-a:n<0&&(h[0]=Math.abs(n)+a),s<0?h[1]=s-a:l<0&&(h[1]=Math.abs(l)+a),0!==h[0]||0!==h[1]){const i=e.getView().getCenterInternal(),n=e.getPixelFromCoordinateInternal(i);if(!n)return;const s=[n[0]+h[0],n[1]+h[1]],r=t.animation||{};e.getView().animateInternal({center:e.getCoordinateFromPixelInternal(s),duration:r.duration,easing:r.easing})}}}getRect(t,e){const i=t.getBoundingClientRect(),n=i.left+window.pageXOffset,s=i.top+window.pageYOffset;return[n,s,n+e[0],s+e[1]]}setPositioning(t){this.set(hu,t)}setVisible(t){this.rendered.visible!==t&&(this.element.style.display=t?"":"none",this.rendered.visible=t)}updatePixelPosition(){const t=this.getMap(),e=this.getPosition();if(!t||!t.isRendered()||!e)return void this.setVisible(!1);const i=t.getPixelFromCoordinate(e,{wrapX:!0}),n=t.getSize();this.updateRenderedPosition(i,n)}updateRenderedPosition(t,e){const i=this.element.style,n=this.getOffset(),s=this.getPositioning();this.setVisible(!0);let r="0%",o="0%";"bottom-right"==s||"center-right"==s||"top-right"==s?r="-100%":"bottom-center"!=s&&"center-center"!=s&&"top-center"!=s||(r="-50%"),"bottom-left"==s||"bottom-center"==s||"bottom-right"==s?o="-100%":"center-left"!=s&&"center-center"!=s&&"center-right"!=s||(o="-50%");const a=`translate(${r}, ${o}) translate(${`${t[0]+n[0]}px`}, ${`${t[1]+n[1]}px`})`;this.rendered.transform_!=a&&(this.rendered.transform_=a,i.transform=a)}getOptions(){return this.options}}class uu{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 du(t,e,i,n,s){return void 0!==s?(s.minX=t,s.maxX=e,s.minY=i,s.maxY=n,s):new uu(t,e,i,n)}class gu extends Ci{constructor(t){super(),this.geometries_=t,this.changeEventsKeys_=[],this.listenGeometriesChange_()}unlistenGeometriesChange_(){this.changeEventsKeys_.forEach(l),this.changeEventsKeys_.length=0}listenGeometriesChange_(){const t=this.geometries_;for(let e=0,i=t.length;e<i;++e)this.changeEventsKeys_.push(o(t[e],h,this.changed,this))}clone(){const t=new gu(fu(this.geometries_));return t.applyProperties(this),t}closestPointXY(t,e,i,n){if(n<tt(this.getExtent(),t,e))return n;const s=this.geometries_;for(let r=0,o=s.length;r<o;++r)n=s[r].closestPointXY(t,e,i,n);return n}containsXY(t,e){const i=this.geometries_;for(let n=0,s=i.length;n<s;++n)if(i[n].containsXY(t,e))return!0;return!1}computeExtent(t){at(t);const e=this.geometries_;for(let i=0,n=e.length;i<n;++i)ut(t,e[i].getExtent());return t}getGeometries(){return fu(this.geometries_)}getGeometriesArray(){return this.geometries_}getGeometriesArrayRecursive(){let t=[];const e=this.geometries_;for(let i=0,n=e.length;i<n;++i)e[i].getType()===this.getType()?t=t.concat(e[i].getGeometriesArrayRecursive()):t.push(e[i]);return t}getSimplifiedGeometry(t){if(this.simplifiedGeometryRevision!==this.getRevision()&&(this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=this.getRevision()),t<0||0!==this.simplifiedGeometryMaxMinSquaredTolerance&&t<this.simplifiedGeometryMaxMinSquaredTolerance)return this;const e=[],i=this.geometries_;let n=!1;for(let s=0,r=i.length;s<r;++s){const r=i[s],o=r.getSimplifiedGeometry(t);e.push(o),o!==r&&(n=!0)}if(n){return new gu(e)}return this.simplifiedGeometryMaxMinSquaredTolerance=t,this}getType(){return"GeometryCollection"}intersectsExtent(t){const e=this.geometries_;for(let i=0,n=e.length;i<n;++i)if(e[i].intersectsExtent(t))return!0;return!1}isEmpty(){return 0===this.geometries_.length}rotate(t,e){const i=this.geometries_;for(let n=0,s=i.length;n<s;++n)i[n].rotate(t,e);this.changed()}scale(t,e,i){i||(i=xt(this.getExtent()));const n=this.geometries_;for(let s=0,r=n.length;s<r;++s)n[s].scale(t,e,i);this.changed()}setGeometries(t){this.setGeometriesArray(fu(t))}setGeometriesArray(t){this.unlistenGeometriesChange_(),this.geometries_=t,this.listenGeometriesChange_(),this.changed()}applyTransform(t){const e=this.geometries_;for(let i=0,n=e.length;i<n;++i)e[i].applyTransform(t);this.changed()}translate(t,e){const i=this.geometries_;for(let n=0,s=i.length;n<s;++n)i[n].translate(t,e);this.changed()}disposeInternal(){this.unlistenGeometriesChange_(),super.disposeInternal()}}function fu(t){return t.map(t=>t.clone())}class _u{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 v&&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 W(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 W(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){W(!(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}}function pu(t,e,i,n){return void 0!==n?(n[0]=t,n[1]=e,n[2]=i,n):[t,e,i]}function mu(t,e,i,n,s){return`${T(t)},${e},${function(t,e,i){return t+"/"+e+"/"+i}(i,n,s)}`}const yu=/\{z\}/g,xu=/\{x\}/g,vu=/\{y\}/g,wu=/\{-y\}/g;let Cu;const Su=[];function Eu(t,e,i,n,s){t.beginPath(),t.moveTo(0,0),t.lineTo(e,i),t.lineTo(n,s),t.closePath(),t.save(),t.clip(),t.fillRect(0,0,Math.max(e,n)+1,Math.max(i,s)),t.restore()}function bu(t,e){return Math.abs(t[4*e]-210)>2||Math.abs(t[4*e+3]-191.25)>2}function Ru(t,e,i,n){const s=ni(i,e,t);let r=qe(e,n,i);const o=e.getMetersPerUnit();void 0!==o&&(r*=o);const a=t.getMetersPerUnit();void 0!==a&&(r/=a);const l=t.getExtent();if(!l||et(l,s)){const e=qe(t,r,s)/r;isFinite(e)&&e>0&&(r/=e)}return r}function Iu(t,e,i,n,s,r,o,a,l,h,c,u,d,g){const f=Ln(Math.round(i*t),Math.round(i*e),Su);if(u||(f.imageSmoothingEnabled=!1),0===l.length)return f.canvas;function _(t){return Math.round(t*i)/i}f.scale(i,i),f.globalCompositeOperation="lighter";const p=[1/0,1/0,-1/0,-1/0];let m;l.forEach(function(t,e,i){ut(p,t.extent)});const y=i/n,x=(u?1:1+Math.pow(2,-24))/y;{const t=Ln(Math.round(Mt(p)*y),Math.round(St(p)*y),Su);m=t,u||(t.imageSmoothingEnabled=!1),l.forEach(function(e,i,n){if(e.image.width>0&&e.image.height>0){if(e.clipExtent){t.save();const i=(e.clipExtent[0]-p[0])*y,n=-(e.clipExtent[3]-p[3])*y,s=Mt(e.clipExtent)*y,r=St(e.clipExtent)*y;t.rect(u?i:Math.round(i),u?n:Math.round(n),u?s:Math.round(i+s)-Math.round(i),u?r:Math.round(n+r)-Math.round(n)),t.clip()}const i=(e.extent[0]-p[0])*y,n=-(e.extent[3]-p[3])*y,s=Mt(e.extent)*y,r=St(e.extent)*y;t.drawImage(e.image,h,h,e.image.width-2*h,e.image.height-2*h,u?i:Math.round(i),u?n:Math.round(n),u?s:Math.round(i+s)-Math.round(i),u?r:Math.round(n+r)-Math.round(n)),e.clipExtent&&t.restore()}})}const v=Rt(o);return a.getTriangles().forEach(function(t,e,i){const n=t.source,s=t.target;let o=n[0][0],a=n[0][1],h=n[1][0],c=n[1][1],d=n[2][0],g=n[2][1];const y=_((s[0][0]-v[0])/r),w=_(-(s[0][1]-v[1])/r),C=_((s[1][0]-v[0])/r),S=_(-(s[1][1]-v[1])/r),E=_((s[2][0]-v[0])/r),b=_(-(s[2][1]-v[1])/r),R=o,I=a;o=0,a=0,h-=R,c-=I,d-=R,g-=I;const M=function(t){const e=t.length;for(let i=0;i<e;i++){let n=i,s=Math.abs(t[i][i]);for(let r=i+1;r<e;r++){const e=Math.abs(t[r][i]);e>s&&(s=e,n=r)}if(0===s)return null;const r=t[n];t[n]=t[i],t[i]=r;for(let n=i+1;n<e;n++){const s=-t[n][i]/t[i][i];for(let r=i;r<e+1;r++)i==r?t[n][r]=0:t[n][r]+=s*t[i][r]}}const i=new Array(e);for(let n=e-1;n>=0;n--){i[n]=t[n][e]/t[n][n];for(let s=n-1;s>=0;s--)t[s][e]-=t[s][n]*i[n]}return i}([[h,c,0,0,C-y],[d,g,0,0,E-y],[0,0,h,c,S-w],[0,0,d,g,b-w]]);if(!M)return;if(f.save(),f.beginPath(),function(){if(void 0===Cu){const t=Ln(6,6,Su);t.globalCompositeOperation="lighter",t.fillStyle="rgba(210, 0, 0, 0.75)",Eu(t,4,5,4,0),Eu(t,4,5,0,5);const e=t.getImageData(0,0,3,3).data;Cu=bu(e,0)||bu(e,4)||bu(e,8),On(t),Su.push(t.canvas)}return Cu}()||!u){f.moveTo(C,S);const t=4,e=y-C,i=w-S;for(let n=0;n<t;n++)f.lineTo(C+_((n+1)*e/t),S+_(n*i/(t-1))),n!=t-1&&f.lineTo(C+_((n+1)*e/t),S+_((n+1)*i/(t-1)));f.lineTo(E,b)}else f.moveTo(C,S),f.lineTo(y,w),f.lineTo(E,b);let T;if(f.clip(),f.transform(M[0],M[2],M[1],M[3],y,w),f.translate(p[0]-R,p[3]-I),m)T=m.canvas,f.scale(x,-x);else{const t=l[0],e=t.extent;T=t.image,f.scale(Mt(e)/T.width,-St(e)/T.height)}f.drawImage(T,0,0),f.restore()}),m&&(On(m),Su.push(m.canvas)),c&&(f.save(),f.globalCompositeOperation="source-over",f.strokeStyle="black",f.lineWidth=1,a.getTriangles().forEach(function(t,e,i){const n=t.target,s=(n[0][0]-v[0])/r,o=-(n[0][1]-v[1])/r,a=(n[1][0]-v[0])/r,l=-(n[1][1]-v[1])/r,h=(n[2][0]-v[0])/r,c=-(n[2][1]-v[1])/r;f.beginPath(),f.moveTo(a,l),f.lineTo(s,o),f.lineTo(h,c),f.closePath(),f.stroke()}),f.restore()),f.canvas}class Mu{constructor(t,e,i,n,s,r,o){this.sourceProj_=t,this.targetProj_=e;let a={};const l=o?(h=t=>gi(o,ni(t,this.targetProj_,this.sourceProj_)),function(t,e,i,n){const s=t.length;i=void 0!==i?i:2,n=n??i,e=void 0!==e?e:new Array(s);for(let r=0;r<s;r+=n){const s=h(t.slice(r,r+i)),o=s.length;for(let i=0,a=n;i<a;++i)e[r+i]=i>=o?t[r+i]:s[i]}return e}):ii(this.targetProj_,this.sourceProj_);var h;this.transformInv_=function(t){const e=t[0]+"/"+t[1];return a[e]||(a[e]=l(t)),a[e]},this.maxSourceExtent_=n,this.errorThresholdSquared_=s*s,this.triangles_=[],this.wrapsXInSource_=!1,this.canWrapXInSource_=this.sourceProj_.canWrapX()&&!!n&&!!this.sourceProj_.getExtent()&&Mt(n)>=Mt(this.sourceProj_.getExtent()),this.sourceWorldWidth_=this.sourceProj_.getExtent()?Mt(this.sourceProj_.getExtent()):void 0,this.targetWorldWidth_=this.targetProj_.getExtent()?Mt(this.targetProj_.getExtent()):void 0;const c=Rt(i),u=It(i),d=yt(i),g=mt(i),f=this.transformInv_(c),_=this.transformInv_(u),p=this.transformInv_(d),m=this.transformInv_(g),y=10+(r?Math.max(0,Math.ceil(Math.log2(pt(i)/(r*r*256*256)))):0);if(this.addQuad_(c,u,d,g,f,_,p,m,y),this.wrapsXInSource_){const t=this.sourceWorldWidth_;if(!t)return;let e=1/0;this.triangles_.forEach(function(t,i,n){e=Math.min(e,t.source[0][0],t.source[1][0],t.source[2][0])}),this.triangles_.forEach(i=>{if(Math.max(i.source[0][0],i.source[1][0],i.source[2][0])-e>t/2){const n=[[i.source[0][0],i.source[0][1]],[i.source[1][0],i.source[1][1]],[i.source[2][0],i.source[2][1]]];n[0][0]-e>t/2&&(n[0][0]-=t),n[1][0]-e>t/2&&(n[1][0]-=t),n[2][0]-e>t/2&&(n[2][0]-=t);const s=Math.min(n[0][0],n[1][0],n[2][0]);Math.max(n[0][0],n[1][0],n[2][0])-s<t/2&&(i.source=n)}})}a={}}addTriangle_(t,e,i,n,s,r){this.triangles_.push({source:[n,s,r],target:[t,e,i]})}addQuad_(t,e,i,n,s,r,o,a,l){const h=H([s,r,o,a]),c=this.sourceWorldWidth_,u=c?Mt(h)/c:void 0,d=this.sourceProj_.canWrapX()&&void 0!==u&&u>.5&&u<1;let g=!1;if(l>0){if(this.targetProj_.isGlobal()&&this.targetWorldWidth_){g=Mt(H([t,e,i,n]))/this.targetWorldWidth_>.25||g}!d&&this.sourceProj_.isGlobal()&&u&&(g=u>.25||g)}if(!g&&this.maxSourceExtent_&&isFinite(h[0])&&isFinite(h[1])&&isFinite(h[2])&&isFinite(h[3])&&!Tt(h,this.maxSourceExtent_))return;let f=0;if(!(g||isFinite(s[0])&&isFinite(s[1])&&isFinite(r[0])&&isFinite(r[1])&&isFinite(o[0])&&isFinite(o[1])&&isFinite(a[0])&&isFinite(a[1])))if(l>0)g=!0;else if(f=(isFinite(s[0])&&isFinite(s[1])?0:8)+(isFinite(r[0])&&isFinite(r[1])?0:4)+(isFinite(o[0])&&isFinite(o[1])?0:2)+(isFinite(a[0])&&isFinite(a[1])?0:1),1!=f&&2!=f&&4!=f&&8!=f)return;if(l>0){if(!g){const e=[(t[0]+i[0])/2,(t[1]+i[1])/2],n=this.transformInv_(e);let r;if(d){const t=c;r=(Nt(s[0],t)+Nt(o[0],t))/2-Nt(n[0],t)}else r=(s[0]+o[0])/2-n[0];const a=(s[1]+o[1])/2-n[1];g=r*r+a*a>this.errorThresholdSquared_}if(g){if(Math.abs(t[0]-i[0])<=Math.abs(t[1]-i[1])){const h=[(e[0]+i[0])/2,(e[1]+i[1])/2],c=this.transformInv_(h),u=[(n[0]+t[0])/2,(n[1]+t[1])/2],d=this.transformInv_(u);this.addQuad_(t,e,h,u,s,r,c,d,l-1),this.addQuad_(u,h,i,n,d,c,o,a,l-1)}else{const h=[(t[0]+e[0])/2,(t[1]+e[1])/2],c=this.transformInv_(h),u=[(i[0]+n[0])/2,(i[1]+n[1])/2],d=this.transformInv_(u);this.addQuad_(t,h,u,n,s,c,d,a,l-1),this.addQuad_(h,e,i,u,c,r,o,d,l-1)}return}}if(d){if(!this.canWrapXInSource_)return;this.wrapsXInSource_=!0}11&f||this.addTriangle_(t,i,n,s,o,a),14&f||this.addTriangle_(t,i,e,s,o,r),f&&(13&f||this.addTriangle_(e,n,t,r,a,s),7&f||this.addTriangle_(e,n,i,r,a,o))}calculateSourceExtent(){const t=[1/0,1/0,-1/0,-1/0];return this.triangles_.forEach(function(e,i,n){const s=e.source;dt(t,s[0]),dt(t,s[1]),dt(t,s[2])}),t}getTriangles(){return this.triangles_}}const Tu=[0,0,0];class Pu{constructor(t){let e=t.minZoom;const i=t.resolutions;let n;if(void 0===e&&i&&(e=i.findIndex(t=>void 0!==t)),this.minZoom=void 0!==e?e:0,this.resolutions_=i,W(function(t,e){const i=e||w;return t.every(function(e,n){if(0===n)return!0;const s=i(t[n-1],e);return!(s>0||0===s)})}(this.resolutions_,(t,e)=>e-t),"`resolutions` must be sorted in descending order"),!t.origins)for(let t=0,e=this.resolutions_.length-1;t<e;++t)if(n){if(this.resolutions_[t]/this.resolutions_[t+1]!==n){n=void 0;break}}else n=this.resolutions_[t]/this.resolutions_[t+1];this.zoomFactor_=n,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,W(this.origins_.length==this.resolutions_.length,"Number of `origins` and `resolutions` must be equal"));const s=t.extent;void 0===s||this.origin_||this.origins_||(this.origin_=Rt(s)),W(!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,W(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:Ch,W(!this.tileSize_&&this.tileSizes_||this.tileSize_&&!this.tileSizes_,"Either `tileSize` or `tileSizes` must be configured, never both"),this.extent_=void 0!==s?s:null,this.fullTileRanges_=null,this.tmpSize_=[0,0],this.tmpExtent_=[0,0,0,0],void 0!==t.tileRanges?this.fullTileRanges_=t.tileRanges:void 0!==t.sizes?this.fullTileRanges_=t.sizes.map((t,e)=>{const i=new uu(Math.min(0,t[0]),Math.max(t[0]-1,-1),Math.min(0,t[1]),Math.max(t[1]-1,-1));if(s){const t=this.getTileRangeForExtentAndZ(s,e);i.minX=Math.max(t.minX,i.minX),i.maxX=Math.min(t.maxX,i.maxX),i.minY=Math.max(t.minY,i.minY),i.maxY=Math.min(t.maxY,i.maxY)}return i}):s&&this.calculateTileRanges_(s)}forEachTileCoord(t,e,i){const n=this.getTileRangeForExtentAndZ(t,e);for(let t=n.minX,s=n.maxX;t<=s;++t)for(let s=n.minY,r=n.maxY;s<=r;++s)i([e,t,s])}forEachTileCoordParentTileRange(t,e,i,n){let s,r,o,a=null,l=t[0]-1;for(2===this.zoomFactor_?(r=t[1],o=t[2]):a=this.getTileCoordExtent(t,n);l>=this.minZoom;){if(void 0!==r&&void 0!==o?(r=Math.floor(r/2),o=Math.floor(o/2),s=du(r,r,o,o,i)):s=this.getTileRangeForExtentAndZ(a,l,i),e(l,s))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_?this.origins_[t]:[0,0]}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 du(i,i+1,n,n+1,e)}const n=this.getTileCoordExtent(t,i||this.tmpExtent_);return this.getTileRangeForExtentAndZ(n,t[0]+1,e)}return null}getTileRangeForTileCoordAndZ(t,e,i){if(e>this.maxZoom||e<this.minZoom)return null;const n=t[0],s=t[1],r=t[2];if(e===n)return du(s,s,r,r,i);if(this.zoomFactor_){const t=Math.pow(this.zoomFactor_,e-n),o=Math.floor(s*t),a=Math.floor(r*t);if(e<n)return du(o,o,a,a,i);return du(o,Math.floor(t*(s+1))-1,a,Math.floor(t*(r+1))-1,i)}const o=this.getTileCoordExtent(t,this.tmpExtent_);return this.getTileRangeForExtentAndZ(o,e,i)}getTileRangeForExtentAndZ(t,e,i){this.getTileCoordForXYAndZ_(t[0],t[3],e,!1,Tu);const n=Tu[1],s=Tu[2];this.getTileCoordForXYAndZ_(t[2],t[1],e,!0,Tu);return du(n,Tu[1],s,Tu[2],i)}getTileCoordCenter(t){const e=this.getOrigin(t[0]),i=this.getResolution(t[0]),n=Qr(this.getTileSize(t[0]),this.tmpSize_);return[e[0]+(t[1]+.5)*n[0]*i,e[1]-(t[2]+.5)*n[1]*i]}getTileCoordExtent(t,e){const i=this.getOrigin(t[0]),n=this.getResolution(t[0]),s=Qr(this.getTileSize(t[0]),this.tmpSize_),r=i[0]+t[1]*s[0]*n,o=i[1]-(t[2]+1)*s[1]*n;return ot(r,o,r+s[0]*n,o+s[1]*n,e)}getTileCoordForCoordAndResolution(t,e,i){return this.getTileCoordForXYAndResolution_(t[0],t[1],e,!1,i)}getTileCoordForXYAndResolution_(t,e,i,n,s){const r=this.getZForResolution(i),o=i/this.getResolution(r),a=this.getOrigin(r),l=Qr(this.getTileSize(r),this.tmpSize_);let h=o*(t-a[0])/i/l[0],c=o*(a[1]-e)/i/l[1];return n?(h=Wt(h,5)-1,c=Wt(c,5)-1):(h=Kt(h,5),c=Kt(c,5)),pu(r,h,c,s)}getTileCoordForXYAndZ_(t,e,i,n,s){const r=this.getOrigin(i),o=this.getResolution(i),a=Qr(this.getTileSize(i),this.tmpSize_);let l=(t-r[0])/o/a[0],h=(r[1]-e)/o/a[1];return n?(l=Wt(l,5)-1,h=Wt(h,5)-1):(l=Kt(l,5),h=Kt(h,5)),pu(i,l,h,s)}getTileCoordForCoordAndZ(t,e,i){return this.getTileCoordForXYAndZ_(t[0],t[1],e,!1,i)}getTileCoordResolution(t){return this.resolutions_[t[0]]}getTileSize(t){return this.tileSize_?this.tileSize_:this.tileSizes_?this.tileSizes_[t]:Ch}getFullTileRange(t){return this.fullTileRanges_?this.fullTileRanges_[t]:this.extent_?this.getTileRangeForExtentAndZ(this.extent_,t):null}getZForResolution(t,e){return At(S(this.resolutions_,t,e||0),this.minZoom,this.maxZoom)}tileCoordIntersectsViewport(t,e){return Yi(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 Fu(t){let e=t.getDefaultTileGrid();return e||(e=function(t,e,i,n){const s=ku(t);return function(t,e,i,n){n=void 0!==n?n:"top-left";const s=Lu(t,e,i);return new Pu({extent:t,origin:vt(t,n),resolutions:s,tileSize:i})}(s,e,i,n)}(t),t.setDefaultTileGrid(e)),e}function Lu(t,e,i,n){e=void 0!==e?e:42,i=Qr(void 0!==i?i:Ch);const s=St(t),r=Mt(t);n=void 0!==n&&n>0?n:Math.max(r/i[0],s/i[1]);const o=e+1,a=new Array(o);for(let t=0;t<o;++t)a[t]=n/Math.pow(2,t);return a}function ku(t){const e=Ue(t);if(!e)throw new Error("Unable to determine extent from unknown projection");let i=e.getExtent();if(!i){const t=e.getMetersPerUnit();if(void 0===t)throw new Error("Unable to determine extent from projection without units");const n=180*Jt.degrees/t;i=ot(-n,-n,n,n)}return i}function Au(t,e){return function(i,n,s){if(!i)return;let r;const o=i[0];if(e){const t=e.getFullTileRange(o);t&&(r=t.getHeight()-1)}return function(t,e,i,n,s){return t.replace(yu,e.toString()).replace(xu,i.toString()).replace(vu,n.toString()).replace(wu,function(){if(void 0===s)throw new Error("If the URL template has a {-y} placeholder, the grid extent must be known");return(s-n).toString()})}(t,o,i[1],i[2],r)}}function Ou(t,e){const i=t.length,n=new Array(i);for(let s=0;s<i;++s)n[s]=Au(t[s],e);return function(t){if(1===t.length)return t[0];return function(e,i,n){if(!e)return;const s=function(t){return e=t[0],i=t[1],n=t[2],(i<<e)+n;var e,i,n}(e),r=Nt(s,t.length);return t[r](e,i,n)}}(n)}class Du extends Fn{constructor(t,e,i,n,s,r,o,a,l,h,c,u){super(s,Cn,u),this.renderEdges_=void 0!==c&&c,this.pixelRatio_=o,this.gutter_=a,this.canvas_=null,this.sourceTileGrid_=e,this.targetTileGrid_=n,this.wrappedTileCoord_=r||s,this.sourceTiles_=[],this.sourcesListenerKeys_=null,this.sourceZ_=0,this.clipExtent_=t.canWrapX()&&t.getExtent()||void 0;const d=n.getTileCoordExtent(this.wrappedTileCoord_),g=this.targetTileGrid_.getExtent();let f=this.sourceTileGrid_.getExtent();const _=g?Et(d,g):d;if(0===pt(_))return void(this.state=Rn);const p=t.getExtent();p&&(f=f?Et(f,p):p);const m=n.getResolution(this.wrappedTileCoord_[0]),y=function(t,e,i,n){const s=xt(i);let r=Ru(t,e,s,n);return(!isFinite(r)||r<=0)&&_t(i,function(i){return r=Ru(t,e,i,n),isFinite(r)&&r>0}),r}(t,i,_,m);if(!isFinite(y)||y<=0)return void(this.state=Rn);const x=void 0!==h?h:.5;if(this.triangulation_=new Mu(t,i,_,f||void 0,y*x,m),0===this.triangulation_.getTriangles().length)return void(this.state=Rn);this.sourceZ_=e.getZForResolution(y);let v=this.triangulation_.calculateSourceExtent();if(f&&(t.canWrapX()?(v[1]=At(v[1],f[1],f[3]),v[3]=At(v[3],f[1],f[3])):v=Et(v,f)),pt(v)){let i=0,n=0;t.canWrapX()&&(i=Mt(p),n=Math.floor((v[0]-p[0])/i));Lt(v.slice(),t,!0).forEach(t=>{const s=e.getTileRangeForExtentAndZ(t,this.sourceZ_);for(let t=s.minX;t<=s.maxX;t++)for(let e=s.minY;e<=s.maxY;e++){const s=n*i;this.sourceTiles_.push({getTile:()=>l(this.sourceZ_,t,e,o),offset:s})}++n}),0===this.sourceTiles_.length&&(this.state=Rn)}else this.state=Rn}getImage(){return this.canvas_}reproject_(){const t=[];if(this.sourceTiles_.forEach(e=>{const i=e.tile;if(i&&i.getState()==En){const n=this.sourceTileGrid_.getTileCoordExtent(i.tileCoord);n[0]+=e.offset,n[2]+=e.offset;const s=this.clipExtent_?.slice();s&&(s[0]+=e.offset,s[2]+=e.offset);const r=i.getImage();if(!r)return;t.push({extent:n,clipExtent:s,image:r})}}),this.sourceTiles_.length=0,0===t.length)this.state=bn;else{const e=this.wrappedTileCoord_[0],i=this.targetTileGrid_.getTileSize(e),n="number"==typeof i?i:i[0],s="number"==typeof i?i:i[1],r=this.targetTileGrid_.getResolution(e),o=this.sourceTileGrid_.getResolution(this.sourceZ_),a=this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_);this.canvas_=Iu(n,s,this.pixelRatio_,o,this.sourceTileGrid_.getExtent(),r,a,this.triangulation_,t,this.gutter_,this.renderEdges_,this.interpolate),this.state=En}this.changed()}load(){for(const t of this.sourceTiles_)t.tile=t.getTile();if(this.state==Cn){this.state=Sn,this.changed();let t=0;this.sourcesListenerKeys_=[],this.sourceTiles_.forEach(e=>{const i=e.tile;if(!i)return;const n=i.getState();if(n==Cn||n==Sn){t++;const e=o(i,h,()=>{const n=i.getState();n!=En&&n!=bn&&n!=Rn||(l(e),t--,0===t&&(this.unlistenSources_(),this.reproject_()))});this.sourcesListenerKeys_.push(e)}}),0===t?setTimeout(this.reproject_.bind(this),0):this.sourceTiles_.forEach(function(t){const e=t.tile;if(!e)return;e.getState()==Cn&&e.load()})}}unlistenSources_(){this.sourcesListenerKeys_&&(this.sourcesListenerKeys_.forEach(l),this.sourcesListenerKeys_=null)}release(){this.canvas_&&(On(this.canvas_.getContext("2d")),Su.push(this.canvas_),this.canvas_=null),this.sourceTiles_.length=0,super.release()}}class Gu extends Nr{constructor(t){super({attributions:t.attributions,attributionsCollapsible:t.attributionsCollapsible,projection:t.projection,state:t.state,wrapX:t.wrapX,interpolate:t.interpolate}),this.on,this.once,this.un,this.tilePixelRatio_=void 0!==t.tilePixelRatio?t.tilePixelRatio:1,this.tileGrid=void 0!==t.tileGrid?t.tileGrid:null;const e=[256,256];this.tileGrid&&Qr(this.tileGrid.getTileSize(this.tileGrid.getMinZoom()),e),this.tmpSize=[0,0],this.key_=t.key||T(this),this.tileOptions={transition:t.transition,interpolate:t.interpolate},this.zDirection=t.zDirection?t.zDirection:0}getGutterForProjection(t){return 0}getKey(){return this.key_}setKey(t){this.key_!==t&&(this.key_=t,this.changed())}getResolutions(t){const e=t?this.getTileGridForProjection(t):this.tileGrid;return e?e.getResolutions():null}getTile(t,e,i,n,s,r){return I()}getTileGrid(){return this.tileGrid}getTileGridForProjection(t){return this.tileGrid?this.tileGrid:Fu(t)}getTilePixelRatio(t){return this.tilePixelRatio_}getTilePixelSize(t,e,i){const n=this.getTileGridForProjection(i),s=this.getTilePixelRatio(e),r=Qr(n.getTileSize(t),this.tmpSize);return 1==s?r:(o=r,a=s,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],s=t.getTileCoordCenter(e),r=ku(i);if(!et(r,s)){const e=Mt(r),i=Math.ceil((r[0]-s[0])/e);return s[0]+=e*i,t.getTileCoordForCoordAndZ(s,n)}return e}(n,t,i)),function(t,e){const i=t[0],n=t[1],s=t[2];if(e.getMinZoom()>i||i>e.getMaxZoom())return!1;const r=e.getFullTileRange(i);return!r||r.containsXY(n,s)}(t,n)?t:null}clear(){}refresh(){this.clear(),super.refresh()}}class zu extends O{constructor(t,e){super(t),this.tile=e}}var Nu="tileloadstart",ju="tileloadend",Xu="tileloaderror";class Ku extends Gu{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===Ku.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=T(e),n=e.getState();let s;n==Sn?(this.tileLoadingKeys_[i]=!0,s=Nu):i in this.tileLoadingKeys_&&(delete this.tileLoadingKeys_[i],s=n==bn?Xu:n==En?ju:void 0),null!=s&&this.dispatchEvent(new zu(s,e))}setTileLoadFunction(t){this.tileLoadFunction=t,this.changed()}setTileUrlFunction(t,e){this.tileUrlFunction=t,void 0!==e?this.setKey(e):this.changed()}setUrl(t){const e=function(t){const e=[];let i=/\{([a-z])-([a-z])\}/.exec(t);if(i){const n=i[1].charCodeAt(0),s=i[2].charCodeAt(0);let r;for(r=n;r<=s;++r)e.push(t.replace(i[0],String.fromCharCode(r)));return e}if(i=/\{(\d+)-(\d+)\}/.exec(t),i){const n=parseInt(i[2],10);for(let s=parseInt(i[1],10);s<=n;s++)e.push(t.replace(i[0],s.toString()));return e}return e.push(t),e}(t);this.urls=e,this.setUrls(e)}setUrls(t){this.urls=t;const e=t.join("\n");this.generateTileUrlFunction_?this.setTileUrlFunction(Ou(t,this.tileGrid),e):this.setKey(e)}tileUrlFunction(t,e,i){}}class Wu extends Ku{constructor(t){super({attributions:t.attributions,cacheSize:t.cacheSize,projection:t.projection,state:t.state,tileGrid:t.tileGrid,tileLoadFunction:t.tileLoadFunction?t.tileLoadFunction:Yu,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:Kn,this.tileGridForProjection={},this.reprojectionErrorThreshold_=t.reprojectionErrorThreshold,this.renderReprojectionEdges_=!1}getGutterForProjection(t){const e=this.getProjection();return e&&t&&!Qe(e,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||Qe(e,t)))return this.tileGrid;const i=T(t);return i in this.tileGridForProjection||(this.tileGridForProjection[i]=Fu(t)),this.tileGridForProjection[i]}createTile_(t,e,i,n,s,r){const o=[t,e,i],a=this.getTileCoordForTileUrlFunction(o,s),l=a?this.tileUrlFunction(a,n,s):void 0,c=new this.tileClass(o,void 0!==l?Cn:Rn,void 0!==l?l:"",{crossOrigin:this.crossOrigin,referrerPolicy:this.referrerPolicy},this.tileLoadFunction,this.tileOptions);return c.key=r,c.addEventListener(h,this.handleTileChange.bind(this)),c}getTile(t,e,i,n,s,r){const o=this.getProjection();if(!o||!s||Qe(o,s))return this.getTileInternal(t,e,i,n,o||s);const a=[t,e,i],l=this.getKey(),h=this.getTileGridForProjection(o),c=this.getTileGridForProjection(s),u=this.getTileCoordForTileUrlFunction(a,s)||a,d=new Du(o,h,s,c,a,u,this.getTilePixelRatio(n),this.getGutter(),(t,e,i,n)=>this.getTileInternal(t,e,i,n,o,r),this.reprojectionErrorThreshold_,this.renderReprojectionEdges_,this.tileOptions);return d.key=l,d}getTileInternal(t,e,i,n,s,r){const o=this.getKey(),a=mu(this,o,t,e,i);if(r&&r.containsKey(a)){return r.get(a)}const l=this.createTile_(t,e,i,n,s,o);return r?.set(a,l),l}setRenderReprojectionEdges(t){this.renderReprojectionEdges_!=t&&(this.renderReprojectionEdges_=t,this.changed())}setTileGridForProjection(t,e){const i=Ue(t);if(i){const t=T(i);t in this.tileGridForProjection||(this.tileGridForProjection[t]=e)}}}function Yu(t,e){if(yn){const i=t.getCrossOrigin();let n="same-origin",s="same-origin";"anonymous"===i||""===i?(n="cors",s="omit"):"use-credentials"===i&&(n="cors",s="include");const r={mode:n,credentials:s,referrerPolicy:t.getReferrerPolicy()};return void fetch(e,r).then(t=>{if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.blob()}).then(t=>createImageBitmap(t)).then(e=>{const i=t.getImage();if(!i)return;i.width=e.width,i.height=e.height;const n=i.getContext("2d");n&&(n.drawImage(e,0,0),e.close?.(),i.dispatchEvent(new Event("load")))}).catch(()=>{const e=t.getImage();e?.dispatchEvent(new Event("error"))})}t.getImage().src=e}class Zu extends Wu{constructor(t){const e=void 0!==(t=t||{}).projection?t.projection:"EPSG:3857",i=void 0!==t.tileGrid?t.tileGrid:function(t){const e=t||{},i=e.extent||Ue("EPSG:3857")?.getExtent();if(!i)throw new Error("Unable to determine extent for XYZ tile grid");const n={extent:i,minZoom:e.minZoom,tileSize:e.tileSize,resolutions:Lu(i,e.maxZoom,e.tileSize,e.maxResolution)};return new Pu(n)}({extent:ku(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_}}class Bu extends qr{constructor(t){super({attributions:(t=t||{}).attributions,wrapX:t.wrapX}),this.resolution=void 0,this.distance=void 0!==t.distance?t.distance:20,this.minDistance=t.minDistance||0,this.interpolationRatio=0,this.features=[],this.geometryFunction=t.geometryFunction||function(t){const e=t.getGeometry();return W(!e||"Point"===e.getType(),"The default `geometryFunction` can only handle `Point` or null geometries"),e},this.createCustomCluster_=t.createCluster,this.source=null,this.boundRefresh_=this.refresh.bind(this),this.updateDistance(this.distance,this.minDistance),this.setSource(t.source||null)}clear(t){this.features.length=0,super.clear(t)}getDistance(){return this.distance}getSource(){return this.source}loadFeatures(t,e,i){this.source?.loadFeatures(t,e,i),e!==this.resolution&&(this.resolution=e,this.refresh())}setDistance(t){this.updateDistance(t,this.minDistance)}setMinDistance(t){this.updateDistance(this.distance,t)}getMinDistance(){return this.minDistance}setSource(t){this.source&&this.source.removeEventListener(h,this.boundRefresh_),this.source=t,t&&t.addEventListener(h,this.boundRefresh_),this.refresh()}refresh(){this.clear(),this.cluster(),this.addFeatures(this.features)}updateDistance(t,e){const i=0===t?0:Math.min(e,t)/t,n=t!==this.distance||this.interpolationRatio!==i;this.distance=t,this.minDistance=e,this.interpolationRatio=i,n&&this.refresh()}cluster(){if(void 0===this.resolution||!this.source)return;const t=[1/0,1/0,-1/0,-1/0],e=this.distance*this.resolution,i=this.source.getFeatures(),n={};for(let s=0,r=i.length;s<r;s++){const r=i[s];if(!(T(r)in n)){const i=this.geometryFunction(r);if(i){lt(i.getCoordinates(),t),J(t,e,t);const s=this.source.getFeaturesInExtent(t).filter(function(t){const e=T(t);return!(e in n)&&(n[e]=!0,!0)});this.features.push(this.createCluster(s,t))}}}}createCluster(t,e){const i=[0,0];for(let e=t.length-1;e>=0;--e){const n=this.geometryFunction(t[e]);n?Vt(i,n.getCoordinates()):t.splice(e,1)}$t(i,1/t.length);const n=xt(e),s=this.interpolationRatio,r=new Ji([i[0]*(1-s)+n[0]*s,i[1]*(1-s)+n[1]*s]);return this.createCustomCluster_?this.createCustomCluster_(r,t):new Y({geometry:r,features:t})}}function Vu(t){return t instanceof Image||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageBitmap?t:null}function Uu(t){return t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Float32Array||t instanceof DataView?t:null}const qu=new Error("disposed"),$u=[256,256];class Hu extends Fn{constructor(t){const e=Cn;super(t.tileCoord,e,{transition:t.transition,interpolate:t.interpolate}),this.loader_=t.loader,this.data_=null,this.error_=null,this.size_=t.size||null,this.controller_=t.controller||null}getSize(){if(this.size_)return this.size_;const t=Vu(this.data_);return t?[t.width,t.height]:$u}getData(){return this.data_}getError(){return this.error_}load(){if(this.state!==Cn&&this.state!==bn)return;this.state=Sn,this.changed();const t=this;this.loader_().then(function(e){t.data_=e,t.state=En,t.changed()}).catch(function(e){t.error_=e,t.state=bn,t.changed()})}disposeInternal(){this.controller_&&(this.controller_.abort(qu),this.controller_=null),super.disposeInternal()}}class Ju extends Zu{constructor(t){let e;e=void 0!==(t=t||{}).attributions?t.attributions:['© <a href="https://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap</a> contributors.'];const i=void 0!==t.url?t.url:"https://tile.openstreetmap.org/{z}/{x}/{y}.png";super({attributions:e,attributionsCollapsible:!1,cacheSize:t.cacheSize,crossOrigin:void 0!==t.crossOrigin?t.crossOrigin:"anonymous",referrerPolicy:t.referrerPolicy||"origin-when-cross-origin",interpolate:t.interpolate,maxZoom:void 0!==t.maxZoom?t.maxZoom:19,reprojectionErrorThreshold:t.reprojectionErrorThreshold,tileLoadFunction:t.tileLoadFunction,transition:t.transition,url:i,wrapX:t.wrapX,zDirection:t.zDirection})}}function Qu(t,e,i){if(!(i in t))return t[i]=new Set([e]),!0;const n=t[i],s=n.has(e);return s||n.add(e),!s}function td(t,e,i){const n=t[i];return!!n&&n.delete(e)}function ed(t,e){const i=t.layerStatesArray[t.layerIndex];if(i.extent&&(e=Et(e,ai(i.extent,t.viewState.projection))),!i.layer)return e;const n=i.layer.getRenderSource();if(!n.getWrapX()){const i=n.getTileGridForProjection(t.viewState.projection).getExtent();i&&(e=Et(e,i))}return e}class id extends da{constructor(t,e){super(t),e=e||{},this.extentChanged=!0,this.renderComplete=!1,this.renderedExtent_=null,this.renderedPixelRatio,this.renderedProjection=null,this.renderedTiles=[],this.renderedSourceRevision_,this.tempExtent=[1/0,1/0,-1/0,-1/0],this.tempTileRange_=new uu(0,0,0,0),this.tempTileCoord_=pu(0,0,0);const i=void 0!==e.cacheSize?e.cacheSize:512;this.tileCache_=new _u(i),this.sourceTileCache_=null,this.layerExtent=null,this.maxStaleKeys=.5*i}getTileCache(){return this.tileCache_}getSourceTileCache(){return this.sourceTileCache_||(this.sourceTileCache_=new _u(512)),this.sourceTileCache_}getOrCreateTile(t,e,i,n){const s=this.tileCache_,r=this.getLayer().getSource();if(!r)return null;const o=mu(r,r.getKey(),t,e,i);let a;if(s.containsKey(o)){if(a=s.get(o),!a)return null}else{const l=n.viewState.projection,h=r.getProjection();if(a=r.getTile(t,e,i,n.pixelRatio,l,!h||Qe(h,l)?void 0:this.getSourceTileCache()),!a)return null;s.set(o,a)}return a}getTile(t,e,i,n){const s=this.getOrCreateTile(t,e,i,n);return s||null}getData(t){const e=this.frameState;if(!e)return null;const i=this.getLayer(),n=gi(e.pixelToCoordinateTransform,t.slice()),s=i.getExtent();if(s&&!et(s,n))return null;const r=e.viewState,o=i.getRenderSource();if(!o)return null;const a=o.getTileGridForProjection(r.projection),l=o.getTilePixelRatio(e.pixelRatio);for(let t=a.getZForResolution(r.resolution);t>=a.getMinZoom();--t){const i=a.getTileCoordForCoordAndZ(n,t),s=this.getTile(t,i[1],i[2],e);if(!s||s.getState()!==En)continue;const h=a.getOrigin(t),c=Qr(a.getTileSize(t)),u=a.getResolution(t);let d=null;if(s instanceof Kn||s instanceof Du)d=s.getImage();else if(s instanceof Hu){const t=s.getData();t&&(d=Vu(t))}if(!d)continue;const g=Math.floor(l*((n[0]-h[0])/u-i[1]*c[0])),f=Math.floor(l*((h[1]-n[1])/u-i[2]*c[1])),_=Math.round(l*o.getGutterForProjection(r.projection));return this.getImageData(d,g+_,f+_)}return null}readData(t){const e=this.getLayer().getRenderSource();if(!e)return null;const i=t.viewState,n=i.projection;if(e.getGutterForProjection(n))throw new Error("readData() does not support sources with a gutter");const s=e.getTileGridForProjection(n),r=i.resolution,o=t.extent,a=s.getZForResolution(r),l={};this.enqueueTiles(t,o,a,l,0);const h=l[a];if(!h)return null;const c=[];let u=!0;if(h.forEach(t=>{const e=t,i=e.getState();i===En?c.push(e):i!==bn&&i!==Rn&&(u=!1)}),!u||0===c.length)return null;const d=t.size[0],g=t.size[1],f=c[0],_=Uu(f.getData());if(!_||_ instanceof DataView)throw new Error("ol/renderer/canvas/TileLayer#readData only supports typed array tile data");const p=f.getSize(),m=Math.round(_.length/(p[0]*p[1])),y=new(0,_.constructor)(d*g*m);for(const t of c){const e=s.getTileCoordExtent(t.tileCoord,this.tempExtent),i=t.getSize(),n=Uu(t.getData()),a=(e[0]-o[0])/r-.5,l=(o[3]-e[3])/r-.5,h=Mt(e)/r,c=St(e)/r,u=i[0]/h,f=i[1]/c,_=Math.max(0,Math.ceil(a)),p=Math.min(d,Math.ceil(a+h)),x=Math.max(0,Math.ceil(l)),v=Math.min(g,Math.ceil(l+c));for(let t=x;t<v;++t){const e=Math.min(Math.floor((t-l)*f),i[1]-1);for(let s=_;s<p;++s){const r=Math.min(Math.floor((s-a)*u),i[0]-1),o=(e*i[0]+r)*m,l=(t*d+s)*m;for(let t=0;t<m;++t)y[l+t]=n[o+t]}}}return this.updateCacheSize(h.size),this.tileCache_.expireCache(),this.sourceTileCache_?.expireCache(),{data:y,width:d,height:g,bandCount:m}}prepareFrame(t){this.renderedProjection?t.viewState.projection!==this.renderedProjection&&(this.tileCache_.clear(),this.renderedProjection=t.viewState.projection):this.renderedProjection=t.viewState.projection;const e=this.getLayer().getSource();if(!e)return!1;const i=e.getRevision();return this.renderedSourceRevision_?this.renderedSourceRevision_!==i&&(this.renderedSourceRevision_=i,this.renderedSourceKey_===e.getKey()&&(this.tileCache_.clear(),this.sourceTileCache_?.clear())):this.renderedSourceRevision_=i,!0}enqueueTilesForNextExtent(){return!0}enqueueTiles(t,e,i,n,s){const r=t.viewState,o=this.getLayer(),a=o.getRenderSource();if(!a)return;const l=a.getTileGridForProjection(r.projection),h=T(a);h in t.wantedTiles||(t.wantedTiles[h]={});const c=t.wantedTiles[h],u=o.getMapInternal(),d=Math.max(i-s,l.getMinZoom(),l.getZForResolution(Math.min(o.getMaxResolution(),u?u.getView().getResolutionForZoom(Math.max(o.getMinZoom(),0)):l.getResolution(0)),a.zDirection)),g=r.rotation,f=g?Ct(r.center,r.resolution,g,t.size):void 0;for(let s=i;s>=d;--s){const i=l.getTileRangeForExtentAndZ(e,s,this.tempTileRange_),r=l.getResolution(s);for(let e=i.minX;e<=i.maxX;++e)for(let o=i.minY;o<=i.maxY;++o){if(g&&f&&!l.tileCoordIntersectsViewport([s,e,o],f))continue;const i=this.getTile(s,e,o,t);if(!i)continue;if(!Qu(n,i,s))continue;const a=i.getKey();if(c[a]=!0,i.getState()===Cn&&!t.tileQueue.isKeyQueued(a)){const n=pu(s,e,o,this.tempTileCoord_);t.tileQueue.enqueue([i,h,l.getTileCoordCenter(n),r])}}}}findStaleTile_(t,e){const i=this.tileCache_,n=t[0],s=t[1],r=t[2],o=this.getStaleKeys(),a=this.getLayer().getSource();if(!a)return!1;for(let t=0;t<o.length;++t){const l=mu(a,o[t],n,s,r);if(i.containsKey(l)){const t=i.peek(l);if(t&&t.getState()===En)return t.endTransition(T(this)),Qu(e,t,n),!0}}return!1}findAltTiles_(t,e,i,n){const s=t.getTileRangeForTileCoordAndZ(e,i,this.tempTileRange_);if(!s)return!1;let r=!0;const o=this.tileCache_,a=this.getLayer().getRenderSource();if(!a)return!1;const l=a.getKey();for(let t=s.minX;t<=s.maxX;++t)for(let e=s.minY;e<=s.maxY;++e){const s=mu(a,l,i,t,e);let h=!1;if(o.containsKey(s)){const t=o.peek(s);t&&t.getState()===En&&(Qu(n,t,i),h=!0)}h||(r=!1)}return r}renderFrame(t,e){this.renderComplete=!0;const i=t.layerStatesArray[t.layerIndex],n=t.viewState,s=n.projection,r=n.resolution,o=n.center,a=t.pixelRatio,l=this.getLayer(),h=l.getSource();if(!h)return this.getContainerElement();const c=h.getTileGridForProjection(s),u=c.getZForResolution(r,h.zDirection),d=c.getResolution(u);this.updateStaleKeys(h.getKey());let g=t.extent;const f=h.getTilePixelRatio(a);this.prepareContainer(t,e);const _=this.getCanvasContext().canvas.width,p=this.getCanvasContext().canvas.height;this.layerExtent=i.extent?ai(i.extent):null,this.layerExtent&&(g=Et(g,this.layerExtent));const m=d*_/2/f,y=d*p/2/f,x=[o[0]-m,o[1]-y,o[0]+m,o[1]+y],v={};this.renderedTiles.length=0;const C=l.getPreload();if(t.nextExtent&&this.enqueueTilesForNextExtent()){const e=c.getZForResolution(n.nextResolution??r,h.zDirection),i=ed(t,t.nextExtent);this.enqueueTiles(t,i,e,v,C)}const S=ed(t,g);if(this.enqueueTiles(t,S,u,v,0),C>0&&setTimeout(()=>{this.enqueueTiles(t,S,u-1,v,C-1)},0),!(u in v))return this.getContainerElement();const E=T(this),b=t.time;for(const e of v[u]){const i=e.getState();if(i===Rn)continue;const n=e.tileCoord;if(i===En){if(1===e.getAlpha(E,b)){e.endTransition(E);continue}}i!==bn&&(this.renderComplete=!1);if(this.findStaleTile_(n,v)){td(v,e,u),t.animate=!0;continue}if(this.findAltTiles_(c,n,u+1,v))continue;const s=c.getMinZoom();for(let t=u-1;t>=s;--t){if(this.findAltTiles_(c,n,t,v))break}}const R=d/r*a/f,I=this.getRenderContext(t);fi(this.tempTransform,_/2,p/2,R,R,0,-_/2,-p/2),this.layerExtent&&this.clipUnrotated(I,t,this.layerExtent),h.getInterpolate()||(I.imageSmoothingEnabled=!1),this.preRender(I,t);const M=Object.keys(v).map(Number);M.sort(w);const P=[],F=[],L=[];for(let e=M.length-1;e>=0;--e){const i=M[e],n=h.getTilePixelSize(i,a,s),r=c.getResolution(i)/d,o=n[0]*r*R,l=n[1]*r*R,g=c.getTileCoordForCoordAndZ(Rt(x),i),_=c.getTileCoordExtent(g),p=gi(this.tempTransform,[f*(_[0]-x[0])/d,f*(x[3]-_[3])/d]),m=f*h.getGutterForProjection(s);for(const e of v[i]){if(e.getState()!==En)continue;const n=e.tileCoord,s=g[1]-n[1],r=Math.round(p[0]-(s-1)*o),a=g[2]-n[2],c=Math.round(p[1]-(a-1)*l),d=Math.round(p[0]-s*o),f=Math.round(p[1]-a*l),_=r-d,y=c-f,x=i===u;if(x&&e.inTransition(E)){L.push({tile:e,x:d,y:f,w:_,h:y,gutter:m}),this.renderedTiles.unshift(e),this.updateUsedTiles(t.usedTiles,h,e);continue}const v=[d,f,d+_,f+y],w=[];for(let t=0,e=P.length;t<e;++t)i<F[t]&&Tt(v,P[t])&&w.push(P[t]);let C;w.length>0&&(C=kt(v,w)),P.push(v),F.push(i),this.drawTile(e,t,d,f,_,y,m,x,C),this.renderedTiles.unshift(e),this.updateUsedTiles(t.usedTiles,h,e)}}for(let e=0,i=L.length;e<i;++e){const{tile:i,x:n,y:s,w:r,h:o,gutter:a}=L[e];this.drawTile(i,t,n,s,r,o,a,!0,void 0)}if(this.renderedResolution=d,this.extentChanged=!this.renderedExtent_||!ct(this.renderedExtent_,x),this.renderedExtent_=x,this.renderedPixelRatio=a,this.postRender(this.getCanvasContext(),t),this.layerExtent&&I.restore(),I.imageSmoothingEnabled=!0,this.renderComplete){const e=(t,e)=>{const i=T(h),n=e.wantedTiles[i],s=n?Object.keys(n).length:0;this.updateCacheSize(s),this.tileCache_.expireCache(),this.sourceTileCache_?.expireCache()};t.postRenderFunctions.push(e)}return this.getContainerElement()}updateCacheSize(t){this.tileCache_.highWaterMark=Math.max(this.tileCache_.highWaterMark,2*t)}drawTile(t,e,i,n,s,r,o,a,l){let h;if(t instanceof Hu){const e=t.getData();if(!e)return;if(h=Vu(e),!h)throw new Error("Rendering array data is not yet supported")}else h=this.getTileImage(t);if(!h)return;const c=this.getRenderContext(e),u=T(this),d=e.layerStatesArray[e.layerIndex],g=d.opacity*(a?t.getAlpha(u,e.time):1),f=g!==c.globalAlpha;f&&(c.save(),c.globalAlpha=g);const _=h.width-2*o,p=h.height-2*o;if(l){const t=_/s,e=p/r;for(let s=0,r=l.length;s<r;++s){const r=l[s],a=r[0],u=r[1],d=r[2]-r[0],g=r[3]-r[1];c.drawImage(h,o+(a-i)*t,o+(u-n)*e,d*t,g*e,a,u,d,g)}}else c.drawImage(h,o,o,_,p,i,n,s,r);f&&c.restore(),g!==d.opacity?e.animate=!0:a&&t.endTransition(u)}getImage(){const t=this.getCanvasContext();return t?t.canvas:null}getTileImage(t){return t.getImage()??null}updateUsedTiles(t,e,i){const n=T(e);n in t||(t[n]={}),t[n][i.getKey()]=!0}}var nd="preload",sd="useInterimTilesOnError";class rd extends zh{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(nd)}setPreload(t){this.set(nd,t)}getUseInterimTilesOnError(){return this.get(sd)}setUseInterimTilesOnError(t){this.set(sd,t)}getData(t){return super.getData(t)}}class od extends rd{constructor(t){super(t)}createRenderer(){return new id(this,{cacheSize:this.getCacheSize()})}}const ad=["fullscreenchange","webkitfullscreenchange"],ld="enterfullscreen",hd="leavefullscreen";class cd extends ac{constructor(t){t=t||{},super({element:document.createElement("div"),target:t.target}),this.on,this.once,this.un,this.keys_=void 0!==t.keys&&t.keys,this.source_=t.source,this.isInFullscreen_=!1,this.boundHandleMapTargetChange_=this.handleMapTargetChange_.bind(this),this.cssClassName_=void 0!==t.className?t.className:"ol-full-screen",this.documentListeners_=[],this.activeClassName_=void 0!==t.activeClassName?t.activeClassName.split(" "):[this.cssClassName_+"-true"],this.inactiveClassName_=void 0!==t.inactiveClassName?t.inactiveClassName.split(" "):[this.cssClassName_+"-false"];const e=void 0!==t.label?t.label:"⛶";this.labelNode_="string"==typeof e?document.createTextNode(e):e;const i=void 0!==t.labelActive?t.labelActive:"×";this.labelActiveNode_="string"==typeof i?document.createTextNode(i):i;const n=t.tipLabel?t.tipLabel:"Toggle full-screen";this.button_=document.createElement("button"),this.button_.title=n,this.button_.setAttribute("type","button"),this.button_.appendChild(this.labelNode_),this.button_.addEventListener(d,this.handleClick_.bind(this),!1),this.setClassName_(this.button_,this.isInFullscreen_);const s=this.element;s.className=`${this.cssClassName_} ${bs} ${Is}`,s.appendChild(this.button_)}handleClick_(t){t.preventDefault(),this.handleFullScreen_()}handleFullScreen_(){const t=this.getMap();if(!t)return;const e=t.getOwnerDocument();if(ud(e))if(dd(e))!function(t){const e=t;t.exitFullscreen?t.exitFullscreen():e.webkitExitFullscreen&&e.webkitExitFullscreen()}(e);else{let i;if(i=this.source_?"string"==typeof this.source_?e.getElementById(this.source_):this.source_:t.getTargetElement(),!i)return;this.keys_?function(t){const e=t;e.webkitRequestFullscreen?e.webkitRequestFullscreen():gd(t)}(i):gd(i)}}handleFullScreenChange_(){const t=this.getMap();if(!t)return;const e=this.isInFullscreen_;this.isInFullscreen_=dd(t.getOwnerDocument()),e!==this.isInFullscreen_&&(this.setClassName_(this.button_,this.isInFullscreen_),this.isInFullscreen_?(zn(this.labelActiveNode_,this.labelNode_),this.dispatchEvent(ld)):(zn(this.labelNode_,this.labelActiveNode_),this.dispatchEvent(hd)),t.updateSize())}setClassName_(t,e){e?(t.classList.remove(...this.inactiveClassName_),t.classList.add(...this.activeClassName_)):(t.classList.remove(...this.activeClassName_),t.classList.add(...this.inactiveClassName_))}setMap(t){const e=this.getMap();e&&e.removeChangeListener(ic,this.boundHandleMapTargetChange_),super.setMap(t),this.handleMapTargetChange_(),t&&t.addChangeListener(ic,this.boundHandleMapTargetChange_)}handleMapTargetChange_(){const t=this.documentListeners_;for(let e=0,i=t.length;e<i;++e)l(t[e]);t.length=0;const e=this.getMap();if(e){const i=e.getOwnerDocument();ud(i)?this.element.classList.remove(Rs):this.element.classList.add(Rs);for(let e=0,n=ad.length;e<n;++e)t.push(o(i,ad[e],this.handleFullScreenChange_,this));this.handleFullScreenChange_()}}}function ud(t){const e=t.body;return!!(e.webkitRequestFullscreen||"requestFullscreen"in e&&t.fullscreenEnabled)}function dd(t){return!(!t.webkitIsFullScreen&&!t.fullscreenElement)}function gd(t){const e=t;t.requestFullscreen?t.requestFullscreen():e.webkitRequestFullscreen&&e.webkitRequestFullscreen()}class fd{constructor(){this.dataProjection=void 0,this.defaultFeatureProjection=void 0,this.featureClass=Y,this.supportedMediaTypes=void 0}getReadOptions(t,e){if(e){let i=e.dataProjection?Ue(e.dataProjection):this.readProjection(t);if(e.extent&&i&&"tile-pixels"===i.getUnits()){const t=Ue(i);t&&(t.setWorldExtent(e.extent),i=t)}e={dataProjection:i??void 0,featureProjection:e.featureProjection}}return this.adaptOptions(e)}adaptOptions(t){return Object.assign({dataProjection:this.dataProjection,featureProjection:this.defaultFeatureProjection,featureClass:this.featureClass},t)}getType(){return I()}readFeature(t,e){return I()}readFeatures(t,e){return I()}readGeometry(t,e){return I()}readProjection(t){return I()}writeFeature(t,e){return I()}writeFeatures(t,e){return I()}writeGeometry(t,e){return I()}}function _d(t,e,i){const n=i?Ue(i.featureProjection):null,s=i?Ue(i.dataProjection):null;let r=t;if(n&&s&&!Qe(n,s)){e&&(r=t.clone());const i=e?n:s,o=e?s:n;if("tile-pixels"===i.getUnits())r.transform(i,o);else{const t=ii(i,o);t&&r.applyTransform(t)}}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};r===t&&(r=t.clone()),r.applyTransform(n)}return r}function pd(t,e){const i=t.geometry;if(!i)return[];if(Array.isArray(i))return i.map(e=>pd({...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 s=(i.layout??"XY").length;return _d(new xr(n,"Polygon"===n?function(t,e,i){if(Array.isArray(e[0])){const n=e;return rn(t,0,n,i)||an(t=t.slice(),0,n,i),t}const n=e;return sn(t,0,n,i)||on(t=t.slice(),0,n,i),t}(i.flatCoordinates,i.ends,s):i.flatCoordinates,i.ends?.flat()??[],s,t.properties||{},t.id).enableSimplifyTransformed(),!1,e)}function md(t,e){if(!t)return null;if(Array.isArray(t)){const i=t.map(t=>md(t,e));return new gu(i)}const i=t.type,n=t.layout||"XY";let s;switch(i){case"Point":s=new Ji(t.flatCoordinates,n);break;case"LineString":s=new Vn(t.flatCoordinates,n);break;case"Polygon":s=new ln(t.flatCoordinates,n,t.ends);break;case"MultiPoint":s=new _r(t.flatCoordinates,n);break;case"MultiLineString":s=new fr(t.flatCoordinates,n,t.ends);break;case"MultiPolygon":s=new mr(t.flatCoordinates,n,t.ends);break;default:throw new Error("Unsupported geometry type: "+i)}return _d(s,!1,e)}class yd extends fd{constructor(){super()}getType(){return"json"}readFeature(t,e){const i=xd(t);return i?this.readFeatureFromObject(i,this.getReadOptions(t,e)):[]}readFeatures(t,e){const i=xd(t);return i?this.readFeaturesFromObject(i,this.getReadOptions(t,e)):[]}readFeatureFromObject(t,e){return I()}readFeaturesFromObject(t,e){return I()}readGeometry(t,e){const i=xd(t);if(!i)throw new Error("Expected a JSON object");return this.readGeometryFromObject(i,this.getReadOptions(t,e))}readGeometryFromObject(t,e){return I()}readProjection(t){const e=xd(t);if(!e)throw new Error("Expected a JSON object");return this.readProjectionFromObject(e)}readProjectionFromObject(t){return I()}writeFeature(t,e){return JSON.stringify(this.writeFeatureObject(t,e))}writeFeatureObject(t,e){return I()}writeFeatures(t,e){return JSON.stringify(this.writeFeaturesObject(t,e))}writeFeaturesObject(t,e){return I()}writeGeometry(t,e){return JSON.stringify(this.writeGeometryObject(t,e))}writeGeometryObject(t,e){return I()}}function xd(t){if("string"==typeof t){const e=JSON.parse(t);return e||null}return null!==t?t:null}class vd extends yd{constructor(t){t=t||{},super(),this.dataProjection=Ue(t.dataProjection?t.dataProjection:"EPSG:4326")??void 0,t.featureProjection&&(this.defaultFeatureProjection=Ue(t.featureProjection)??void 0),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){const i=t;let n;n="Feature"===i.type?i:{type:"Feature",geometry:t,properties:null};const s=wd(n.geometry);if(this.featureClass===xr)return pd({geometry:s??void 0,id:n.id,properties:n.properties??void 0},e);const r=new(0,this.featureClass);return this.geometryName_?r.setGeometryName(this.geometryName_):this.extractGeometryName_&&"geometry_name"in n&&n.geometry_name&&r.setGeometryName(n.geometry_name),r.setGeometry(md(s,e)),"id"in n&&r.setId(n.id),n.properties&&r.setProperties(n.properties,!0),r}readFeaturesFromObject(t,e){let i=null;if("FeatureCollection"===t.type){i=[];const n=t.features;for(let t=0,s=n.length;t<s;++t){const s=this.readFeatureFromObject(n[t],e);s&&i.push(s)}}else i=[this.readFeatureFromObject(t,e)];return i.flat()}readGeometryFromObject(t,e){return function(t,e){const i=wd(t);if(!i)return null;return md(i,e)}(t,e)}readProjectionFromObject(t){const e=t.crs;let i;if(e)if("name"==e.type)i=Ue(e.properties.name);else{if("EPSG"!==e.type)throw new Error("Unknown SRS type");i=Ue("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 s=t.getProperties(),o=t.getGeometry();return o&&(i.geometry=Cd(o,e),delete s[t.getGeometryName()]),r(s)||(i.properties=s),i}writeFeaturesObject(t,e){e=this.adaptOptions(e);const i=[];for(let n=0,s=t.length;n<s;++n)i.push(this.writeFeatureObject(t[n],e));return{type:"FeatureCollection",features:i}}writeGeometryObject(t,e){return Cd(t,this.adaptOptions(e))}}function wd(t,e){if(!t||"GeometryCollection"!==t.type&&Array.isArray(t.coordinates)&&!t.coordinates.length)return null;let i;switch(t.type){case"Point":i=function(t){const e=t.coordinates;return{type:"Point",flatCoordinates:e,layout:Ei(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:Ei(e[0]?.length||2)}}(t);break;case"Polygon":i=function(t){const e=t.coordinates,i=[],n=e[0]?.[0]?.length,s=Ai(i,0,e,n);return{type:"Polygon",flatCoordinates:i,ends:s,layout:Ei(n)}}(t);break;case"MultiPoint":i=function(t){const e=t.coordinates;return{type:"MultiPoint",flatCoordinates:e.flat(),layout:Ei(e[0]?.length||2)}}(t);break;case"MultiLineString":i=function(t){const e=t.coordinates,i=e[0]?.[0]?.length||2,n=[],s=Ai(n,0,e,i);return{type:"MultiLineString",flatCoordinates:n,ends:s,layout:Ei(i)}}(t);break;case"MultiPolygon":i=function(t){const e=t.coordinates,i=[],n=e[0]?.[0]?.[0].length||2,s=Oi(i,0,e,n);return{type:"MultiPolygon",flatCoordinates:i,ends:s,layout:Ei(n)}}(t);break;case"GeometryCollection":i=function(t){const e=t.geometries,i=[];for(const t of e){const e=wd(t);e&&i.push(e)}return i}(t);break;default:throw new Error("Unsupported GeoJSON type: "+t.type)}return i}function Cd(t,e){const i=(t=_d(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;e&&(i=e.rightHanded);return{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;e&&(i=e.rightHanded);return{type:"MultiPolygon",coordinates:t.getCoordinates(i)}}(t,e);break;case"GeometryCollection":n=function(t,e){e=Object.assign({},e),delete e.featureProjection;const i=t.getGeometriesArray().map(function(t){return Cd(t,e)});return{type:"GeometryCollection",geometries:i}}(t,e);break;case"Circle":n={type:"GeometryCollection",geometries:[]};break;default:throw new Error("Unsupported geometry type: "+i)}return n}!function(){if("undefined"==typeof window||window[t])return;if(!(/firefox/i.test(navigator.userAgent)||"undefined"!=typeof CSS&&CSS.supports("-moz-appearance","none"))||"undefined"==typeof HTMLCanvasElement)return;const e=HTMLCanvasElement.prototype.getContext;HTMLCanvasElement.prototype.getContext=function(t,i){return"2d"===t&&(i=Object.assign({},i,{willReadFrequently:!0})),e.call(this,t,i)},window[t]=!0}();const Sd={initVenoMaps(t){const e=JSON.parse(t.dataset.infomap),{mapid:i,lat:n,lon:s,zoom:r,cluster_color:o,cluster_bg:a,destination:l,routes:h,zoom_markers:c,disable_clusters:u}=e,d=decodeURIComponent(e.style_url),g=["#009CD7","#FF6347","#32CD32","#FFD700","#DA70D6","#1E90FF"];let f,_=null;const p=new qr,m=new qr,y=new qr,x=new Bu({distance:50,minDistance:20,source:p}),v=new Kh({source:m,zIndex:5}),w=new Kh({source:y,zIndex:6}),C=new Kh(u?{source:p,zIndex:10,style:t=>t.get("stile")||null}:{source:x,zIndex:10,style:t=>{const e=t.get("features").filter(t=>!1!==t.get("is_matching_search")),i=e.length;if(0===i)return null;if(i>1){const t=ds(a).slice();t[3]=.3;const e=Math.min(parseInt(Math.sqrt(i)+16),25);return[new no({image:new io({radius:7+e,fill:new $r({color:t})})}),new no({image:new io({radius:e,stroke:new Hr({color:o,width:2}),fill:new $r({color:a})}),text:new ao({text:i.toString(),fill:new $r({color:o}),font:"bold 12px sans-serif"})})]}return e[0].get("stile")}}),S=new no({stroke:new Hr({color:"#009CD7",width:7,lineCap:"round"})}),E=new no({stroke:new Hr({color:"#86B9D4",width:5,lineCap:"round"})}),b=async()=>{if(!("geolocation"in navigator))return;const t=document.getElementById("get-directions-"+i);t.disabled=!0,t.textContent="Trovo la posizione...",navigator.geolocation.getCurrentPosition(async e=>{y.clear();const i=e.coords.longitude,n=e.coords.latitude,s=new Y({geometry:new Ji(Je([i,n]))});s.setStyle(new no({image:new io({radius:8,fill:new $r({color:"#2a6fdb"}),stroke:new Hr({color:"#ffffff",width:2})})})),y.addFeature(s),t.textContent="Calcolo il percorso...";const r=`https://router.project-osrm.org/route/v1/driving/${i},${n};${l.lon},${l.lat}?overview=full&geometries=geojson&alternatives=true&steps=true`;try{const t=await fetch(r),e=await t.json();if("Ok"!==e.code||!e.routes||0===e.routes.length)throw new Error("No routes");e.routes.forEach((t,e)=>{const i=new Vn(t.geometry.coordinates).transform("EPSG:4326","EPSG:3857"),n=new Y({geometry:i});n.set("route_data",t),n.set("is_geolocation_route",!0),n.setStyle(0===e?S:E),y.addFeature(n)}),((t,e="Indicazioni")=>{if(!t||!t.legs)return;console.clear();const i=Math.round(t.duration/60),n=(t.distance/1e3).toFixed(2);console.log(`%c--- ${e} (Durata: ${i} min, Distanza: ${n} km) ---`,"color: #009CD7; font-weight: bold; font-size: 14px;"),t.legs[0].steps.forEach((t,e)=>{const i=(t.distance/1e3).toFixed(2),n=t.name?`su ${t.name}`:"",s=(t=>{let e="";const i=t.type,n=t.modifier;switch(i){case"depart":e="Parti";break;case"arrive":e="Sei arrivato a destinazione";break;case"merge":e="Immettiti";break;case"turn":case"fork":case"end of road":switch(n){case"right":e="Gira a destra";break;case"left":e="Gira a sinistra";break;case"slight right":e="Svolta leggermente a destra";break;case"slight left":e="Svolta leggermente a sinistra";break;case"sharp right":e="Svolta a gomito a destra";break;case"sharp left":e="Svolta a gomito a sinistra";break;case"straight":e="Continua dritto";break;case"uturn":e="Fai un'inversione a U"}"fork"===i&&(e=e.replace("Gira","Tieni"));break;case"new name":e="Continua dritto";break;case"continue":e=`Continua su ${n}`;break;case"roundabout":e=`Alla rotonda, prendi la ${t.exit}ª uscita`;break;case"rotary":e=`Entra nella rotatoria e prendi la ${t.exit}ª uscita`;break;default:e=`${i} ${n||""}`}return e.charAt(0).toUpperCase()+e.slice(1)})(t.maneuver);console.log(`${e+1}. ${s} ${n} (per ${i} km)`)})})(e.routes[0],"Indicazioni dalla tua posizione"),f.getView().fit(y.getExtent(),{padding:[50,50,50,50],duration:1e3})}catch(t){alert("Impossibile calcolare il percorso.")}finally{t.disabled=!1,t.textContent="Get Directions"}},()=>{alert("Posizione non disponibile."),t.disabled=!1,t.textContent="Get Directions"})},R=(()=>{const e=t.querySelector("#wrap-overlay-"+i);if(!e)return[];const n=e.querySelectorAll(".wpol-infomarker"),s=[],r=[];return n.forEach((t,e)=>{const n=JSON.parse(t.dataset.marker);if(!n.lon||!n.lat)return;const o=[parseFloat(n.lon),parseFloat(n.lat)],a=new Y(new Ji(Je(o))),l=parseFloat(n.size);a.set("stile",new no({image:new oa({src:t.querySelector("img").src,height:l,anchor:[.5,1],anchorXUnits:"fraction",anchorYUnits:"fraction",crossOrigin:"anonymous"})}));const h=document.getElementById("infopanel_"+i+"_"+e);if(h){const t=h.querySelector(".wpol-infopanel-close");t&&t.addEventListener("click",t=>{t.stopPropagation(),h.classList.add("infobox-closed"),h.classList.remove("was-open")}),r.push(new cu({position:Je(o),positioning:"bottom-center",offset:[0,-(l+12)],element:h})),a.set("panel",h)}s.push(a)}),p.addFeatures(s),r})();(()=>{if(!h||0===h.length)return;const t=new vd({dataProjection:"EPSG:4326",featureProjection:"EPSG:3857"});h.forEach((e,i)=>{if(e.geometry)try{const n=t.readFeature(e.geometry);n&&n.getGeometry()&&(n.set("route_data",e),n.set("route_title",e.title),n.setStyle(new no({stroke:new Hr({color:g[i%g.length],width:6,lineCap:"round",lineJoin:"round"})})),m.addFeature(n))}catch(t){console.error("Errore parsing GeoJSON",t)}})})();const I=Je([parseFloat(s),parseFloat(n)]);let M={url:d,attributions:t.querySelector(".venomaps-get-attribution")?.innerHTML||""};"default"===d&&(M={}),M.referrerPolicy=document.referrerPolicy||"strict-origin-when-cross-origin",f=new su({target:"venomaps_"+i,view:new Sh({center:I,zoom:r,maxZoom:18,minZoom:2}),layers:[new od({source:new Ju(M)}),v,w,C],controls:uc({attributionOptions:{collapsible:!0}}).extend([new cd]),interactions:Vc({mouseWheelZoom:Boolean(e.zoom_scroll)})}),R.forEach(t=>f.addOverlay(t));const T=t.querySelector(".venomaps-search");T&&T.addEventListener("input",t=>(t=>{const e=t.toLowerCase().replace(/\s+/g," ").trim();let i=[];if(p.forEachFeature(t=>{const n=t.get("panel");let s=!0;e.length>2&&(s=(n?.querySelector(".wpol-infolabel")?.innerText||"").toLowerCase().replace(/\s+/g," ").trim().includes(e),s&&i.push(t)),t.set("is_matching_search",s)}),C.getSource().refresh(),e.length>2&&i.length>0){const t=new qr({features:i});f.getView().fit(t.getExtent(),{duration:500,padding:[100,100,100,100],maxZoom:15})}})(t.target.value));const P=document.getElementById("get-directions-"+i);P&&l&&P.addEventListener("click",b),f.on("click",t=>{_&&(f.removeOverlay(_),_=null);let e=!1;C.getFeatures(t.pixel).then(i=>{if(i.length>0){const t=i[0].get("features")||[i[0]],n=f.getView();if(t.length>1){const i=[1/0,1/0,-1/0,-1/0];t.forEach(t=>ut(i,t.getGeometry().getExtent())),n.fit(i,{duration:500,padding:[50,50,50,50]}),e=!0}else if(1===t.length){const i=t[0].get("panel");i&&(i.classList.remove("infobox-closed"),n.animate({center:t[0].getGeometry().getCoordinates(),duration:500}),e=!0)}}if(!e){const e=f.forEachFeatureAtPixel(t.pixel,(t,e)=>{if(e===v)return t});if(e&&e.get("route_title")){const i=e.get("route_title"),n=document.createElement("div");n.className="wpol-infopanel",n.innerHTML=`<div class="wpol-infolabel"><strong>${i}</strong></div><div class="wpol-arrow"></div>`,_=new cu({position:t.coordinate,positioning:"bottom-center",element:n,offset:[0,-15],stopEvent:!1}),f.addOverlay(_)}}})}),f.on("pointermove",t=>{const e=f.hasFeatureAtPixel(t.pixel,{layerFilter:t=>t===C});f.getTargetElement().style.cursor=e?"pointer":""}),c&&setTimeout(()=>{const t=[1/0,1/0,-1/0,-1/0];let e=!1;p.getFeatures().length>0&&(ut(t,p.getExtent()),e=!0),m.getFeatures().length>0&&(ut(t,m.getExtent()),e=!0),e&&t[0]<1/0&&f.getView().fit(t,{padding:[50,50,50,50],duration:1e3,maxZoom:16})},100)},init(){document.querySelectorAll(".wrap-venomaps:not([data-venomap-init])").forEach(t=>{t.setAttribute("data-venomap-init","1"),this.initVenoMaps(t)})}};return"undefined"!=typeof document&&("loading"===document.readyState?document.addEventListener("DOMContentLoaded",()=>Sd.init()):Sd.init()),Sd}(); -
venomaps/trunk/readme.txt
r3778346 r3778457 3 3 Author: Nicola Franchini 4 4 Contributors: nicolafranchini 5 Version: 2. 1.96 Stable tag: 2. 1.95 Version: 2.2.0 6 Stable tag: 2.2.0 7 7 Tested up to: 7.1 8 8 Requires at least: 4.0 … … 101 101 102 102 == Changelog == 103 104 = 2.2.0 = 105 * Update: Normalize infobox content to match search input 103 106 104 107 = 2.1.9 = -
venomaps/trunk/venomaps.php
r3778346 r3778457 8 8 * Plugin URI: https://veno.es/venomaps 9 9 * Description: The fast, privacy-friendly Google Maps alternative. Create custom Geo Maps and markers using OpenStreetMap and OpenLayers, requiring no API keys for default styles. 10 * Version: 2. 1.910 * Version: 2.2.0 11 11 * Author: Nicola Franchini 12 12 * Author URI: https://veno.es … … 18 18 exit; 19 19 } 20 define( 'VENOMAPS_VERSION', '2. 1.9' );20 define( 'VENOMAPS_VERSION', '2.2.0' ); 21 21 22 22 if ( ! class_exists( 'Venomaps_Plugin', false ) ) {
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)