pareto-anywhere
Version:
Open source IoT middleware suite that makes the data from just about anything usable. We believe in an open Internet of Things.
1 lines • 858 kB
JavaScript
var ol=function(){"use strict";class t{constructor(t){this.propagationStopped,this.defaultPrevented,this.type=t,this.target=null}preventDefault(){this.defaultPrevented=!0}stopPropagation(){this.propagationStopped=!0}}function e(t){t.stopPropagation()}var i="propertychange";class n{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}}function r(t,e,i){let n,r;i=i||s;let o=0,a=t.length,l=!1;for(;o<a;)n=o+(a-o>>1),r=+i(t[n],e),r<0?o=n+1:(a=n,l=!r);return l?o:~o}function s(t,e){return t>e?1:t<e?-1:0}function o(t,e){return t<e?1:t>e?-1:0}function a(t,e,i){if(t[0]<=e)return 0;const n=t.length;if(e<=t[n-1])return n-1;if("function"==typeof i){for(let r=1;r<n;++r){const n=t[r];if(n===e)return r;if(n<e)return i(e,t[r-1],n)>0?r-1:r}return n-1}if(i>0){for(let i=1;i<n;++i)if(t[i]<e)return i-1;return n-1}if(i<0){for(let i=1;i<n;++i)if(t[i]<=e)return i;return n-1}for(let i=1;i<n;++i){if(t[i]==e)return i;if(t[i]<e)return t[i-1]-e<e-t[i]?i-1:i}return n-1}function l(t,e,i){for(;e<i;){const n=t[e];t[e]=t[i],t[i]=n,++e,--i}}function h(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 c(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 u(t,e,i){const n=e||s;return t.every((function(e,r){if(0===r)return!0;const s=n(t[r-1],e);return!(s>0||i&&0===s)}))}function d(){return!0}function g(){return!1}function f(){}function p(t){let e,i,n;return function(){const r=Array.prototype.slice.call(arguments);return i&&this===n&&c(r,i)||(n=this,i=r,e=t.apply(this,arguments)),e}}function m(t){return function(){let e;try{e=t()}catch(t){return Promise.reject(t)}return e instanceof Promise?e:Promise.resolve(e)}()}function _(t){for(const e in t)delete t[e]}function y(t){let e;for(e in t)return!1;return!e}class x extends n{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(e){const i="string"==typeof e,n=i?e:e.type,r=this.listeners_&&this.listeners_[n];if(!r)return;const s=i?new t(e):e;s.target||(s.target=this.eventTarget_||this);const o=this.dispatching_||(this.dispatching_={}),a=this.pendingRemovals_||(this.pendingRemovals_={});let l;n in o||(o[n]=0,a[n]=0),++o[n];for(let t=0,e=r.length;t<e;++t)if(l="handleEvent"in r[t]?r[t].handleEvent(s):r[t].call(this,s),!1===l||s.propagationStopped){l=!1;break}if(0==--o[n]){let t=a[n];for(delete a[n];t--;)this.removeEventListener(n,f);delete o[n]}return l}disposeInternal(){this.listeners_&&_(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]=f,++this.pendingRemovals_[t]):(i.splice(n,1),0===i.length&&delete this.listeners_[t]))}}var v="change",E="error",S="contextmenu",w="click",T="dblclick",C="dragenter",R="dragover",b="drop",P="keydown",I="keypress",L="load",F="touchmove",M="wheel";function A(t,e,i,n,r){if(r){const r=i;i=function(){t.removeEventListener(e,i),r.apply(n??this,arguments)}}else n&&n!==t&&(i=i.bind(n));const s={target:t,type:e,listener:i};return t.addEventListener(e,i),s}function O(t,e,i,n){return A(t,e,i,n,!0)}function D(t){t&&t.target&&(t.target.removeEventListener(t.type,t.listener),_(t))}class N extends x{constructor(){super(),this.on=this.onInternal,this.once=this.onceInternal,this.un=this.unInternal,this.revision_=0}changed(){++this.revision_,this.dispatchEvent(v)}getRevision(){return this.revision_}onInternal(t,e){if(Array.isArray(t)){const i=t.length,n=new Array(i);for(let r=0;r<i;++r)n[r]=A(this,t[r],e);return n}return A(this,t,e)}onceInternal(t,e){let i;if(Array.isArray(t)){const n=t.length;i=new Array(n);for(let r=0;r<n;++r)i[r]=O(this,t[r],e)}else i=O(this,t,e);return e.ol_key=i,i}unInternal(t,e){const i=e.ol_key;if(i)k(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)}}function k(t){if(Array.isArray(t))for(let e=0,i=t.length;e<i;++e)D(t[e]);else D(t)}function G(){throw new Error("Unimplemented abstract method.")}N.prototype.on,N.prototype.once,N.prototype.un;let j=0;function U(t){return t.ol_uid||(t.ol_uid=String(++j))}class B extends t{constructor(t,e,i){super(t),this.key=e,this.oldValue=i}}class z extends N{constructor(t){super(),this.on,this.once,this.un,U(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 n;n=`change:${t}`,this.hasListener(n)&&this.dispatchEvent(new B(n,t,e)),n=i,this.hasListener(n)&&this.dispatchEvent(new B(n,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],y(this.values_)&&(this.values_=null),e||this.notify(t,i)}}}var X="add",V="remove";const $="length";class W extends t{constructor(t,e,i){super(t),this.element=e,this.index=i}}class Z extends z{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=0,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($)}insertAt(t,e){if(t<0||t>this.getLength())throw new Error("Index out of bounds: "+t);this.unique_&&this.assertUnique_(e),this.array_.splice(t,0,e),this.updateLength_(),this.dispatchEvent(new W(X,e,t))}pop(){return this.removeAt(this.getLength()-1)}push(t){this.unique_&&this.assertUnique_(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 W(V,e,t)),e}setAt(t,e){if(t>=this.getLength())return void this.insertAt(t,e);if(t<0)throw new Error("Index out of bounds: "+t);this.unique_&&this.assertUnique_(e,t);const i=this.array_[t];this.array_[t]=e,this.dispatchEvent(new W(V,i,t)),this.dispatchEvent(new W(X,e,t))}updateLength_(){this.set($,this.array_.length)}assertUnique_(t,e){for(let i=0,n=this.array_.length;i<n;++i)if(this.array_[i]===t&&i!==e)throw new Error("Duplicate item added to a unique collection")}}var Y=0,H=1,K=2,q=3,J=4;function Q(t){return Math.pow(t,3)}function tt(t){return 1-Q(1-t)}function et(t){return 3*t*t-2*t*t*t}function it(t){return t}class nt extends x{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(v)}release(){this.state===q&&this.setState(J)}getKey(){return this.key+"/"+this.tileCoord}getTileCoord(){return this.tileCoord}getState(){return this.state}setState(t){if(this.state!==q&&this.state>t)throw new Error("Tile load sequence violation");this.state=t,this.changed()}load(){G()}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:Q(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()}}const rt="undefined"!=typeof navigator&&void 0!==navigator.userAgent?navigator.userAgent.toLowerCase():"",st=rt.includes("firefox"),ot=rt.includes("safari")&&!rt.includes("chrom"),at=ot&&(rt.includes("version/15.4")||/cpu (os|iphone os) 15_4 like mac os x/.test(rt)),lt=rt.includes("webkit")&&!rt.includes("edge"),ht=rt.includes("macintosh"),ct="undefined"!=typeof devicePixelRatio?devicePixelRatio:1,ut="undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof OffscreenCanvas&&self instanceof WorkerGlobalScope,dt="undefined"!=typeof Image&&Image.prototype.decode,gt="function"==typeof createImageBitmap,ft=function(){let t=!1;try{const e=Object.defineProperty({},"passive",{get:function(){t=!0}});window.addEventListener("_",null,e),window.removeEventListener("_",null,e)}catch(t){}return t}();function pt(t,e,i,n){let r;return r=i&&i.length?i.shift():ut?new OffscreenCanvas(t||300,e||300):document.createElement("canvas"),t&&(r.width=t),e&&(r.height=e),r.getContext("2d",n)}let mt;function _t(){return mt||(mt=pt(1,1)),mt}function yt(t){const e=t.canvas;e.width=1,e.height=1,t.clearRect(0,0,1,1)}function xt(t){let e=t.offsetWidth;const i=getComputedStyle(t);return e+=parseInt(i.marginLeft,10)+parseInt(i.marginRight,10),e}function vt(t){let e=t.offsetHeight;const i=getComputedStyle(t);return e+=parseInt(i.marginTop,10)+parseInt(i.marginBottom,10),e}function Et(t,e){const i=e.parentNode;i&&i.replaceChild(t,e)}function St(t){for(;t.lastChild;)t.lastChild.remove()}function wt(t,e){const i=t.childNodes;for(let n=0;;++n){const r=i[n],s=e[n];if(!r&&!s)break;r!==s&&(r?s?t.insertBefore(s,r):(t.removeChild(r),--n):t.appendChild(s))}}function Tt(t){return t instanceof Image||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageBitmap?t:null}function Ct(t){return t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Float32Array||t instanceof DataView?t:null}const Rt=new Error("disposed");let bt=null;function Pt(t){bt||(bt=pt(t.width,t.height,void 0,{willReadFrequently:!0}));const e=bt.canvas,i=t.width;e.width!==i&&(e.width=i);const n=t.height;return e.height!==n&&(e.height=n),bt.clearRect(0,0,i,n),bt.drawImage(t,0,0),bt.getImageData(0,0,i,n).data}const It=[256,256];class Lt extends nt{constructor(t){const e=Y;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=Tt(this.data_);return t?[t.width,t.height]:It}getData(){return this.data_}getError(){return this.error_}load(){if(this.state!==Y&&this.state!==q)return;this.state=H,this.changed();const t=this;this.loader_().then((function(e){t.data_=e,t.state=K,t.changed()})).catch((function(e){t.error_=e,t.state=q,t.changed()}))}disposeInternal(){this.controller_&&(this.controller_.abort(Rt),this.controller_=null),super.disposeInternal()}}function Ft(t,e){if(!t)throw new Error(e)}class Mt extends z{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 Mt(this.hasProperties()?this.getProperties():null);t.setGeometryName(this.getGeometryName());const e=this.getGeometry();e&&t.setGeometry(e.clone());const i=this.getStyle();return i&&t.setStyle(i),t}getGeometry(){return this.get(this.geometryName_)}getId(){return this.id_}getGeometryName(){return this.geometryName_}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}handleGeometryChange_(){this.changed()}handleGeometryChanged_(){this.geometryChangeKey_&&(D(this.geometryChangeKey_),this.geometryChangeKey_=null);const t=this.getGeometry();t&&(this.geometryChangeKey_=A(t,v,this.handleGeometryChange_,this)),this.changed()}setGeometry(t){this.set(this.geometryName_,t)}setStyle(t){this.style_=t,this.styleFunction_=t?At(t):void 0,this.changed()}setId(t){this.id_=t,this.changed()}setGeometryName(t){this.removeChangeListener(this.geometryName_,this.handleGeometryChanged_),this.geometryName_=t,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),this.handleGeometryChanged_()}}function At(t){if("function"==typeof t)return t;let e;if(Array.isArray(t))e=t;else{Ft("function"==typeof t.getZIndex,"Expected an `ol/style/Style` or an array of `ol/style/Style.js`");e=[t]}return function(){return e}}const Ot=new Array(6);function Dt(){return[1,0,0,1,0,0]}function Nt(t){return Gt(t,1,0,0,1,0,0)}function kt(t,e){const i=t[0],n=t[1],r=t[2],s=t[3],o=t[4],a=t[5],l=e[0],h=e[1],c=e[2],u=e[3],d=e[4],g=e[5];return t[0]=i*l+r*h,t[1]=n*l+s*h,t[2]=i*c+r*u,t[3]=n*c+s*u,t[4]=i*d+r*g+o,t[5]=n*d+s*g+a,t}function Gt(t,e,i,n,r,s,o){return t[0]=e,t[1]=i,t[2]=n,t[3]=r,t[4]=s,t[5]=o,t}function jt(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t}function Ut(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 Bt(t,e){const i=Math.cos(e),n=Math.sin(e);return kt(t,Gt(Ot,i,n,-n,i,0,0))}function zt(t,e,i){return kt(t,Gt(Ot,e,0,0,i,0,0))}function Xt(t,e,i){return kt(t,Gt(Ot,1,0,0,1,e,i))}function Vt(t,e,i,n,r,s,o,a){const l=Math.sin(s),h=Math.cos(s);return t[0]=n*h,t[1]=r*l,t[2]=-n*l,t[3]=r*h,t[4]=o*n*h-a*n*l+e,t[5]=o*r*l+a*r*h+i,t}function $t(t,e){const i=Wt(e);Ft(0!==i,"Transformation matrix cannot be inverted");const n=e[0],r=e[1],s=e[2],o=e[3],a=e[4],l=e[5];return t[0]=o/i,t[1]=-r/i,t[2]=-s/i,t[3]=n/i,t[4]=(s*l-o*a)/i,t[5]=-(n*l-r*a)/i,t}function Wt(t){return t[0]*t[3]-t[1]*t[2]}const Zt=[1e6,1e6,1e6,1e6,2,2];function Yt(t){return"matrix("+t.map(((t,e)=>Math.round(t*Zt[e])/Zt[e])).join(", ")+")"}var Ht={UNKNOWN:0,INTERSECTING:1,ABOVE:2,RIGHT:4,BELOW:8,LEFT:16};function Kt(t){const e=re();for(let i=0,n=t.length;i<n;++i)de(e,t[i]);return e}function qt(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 Jt(t,e){return e?(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e):t.slice()}function Qt(t,e,i){let n,r;return n=e<t[0]?t[0]-e:t[2]<e?e-t[2]:0,r=i<t[1]?t[1]-i:t[3]<i?i-t[3]:0,n*n+r*r}function te(t,e){return ie(t,e[0],e[1])}function ee(t,e){return t[0]<=e[0]&&e[2]<=t[2]&&t[1]<=e[1]&&e[3]<=t[3]}function ie(t,e,i){return t[0]<=e&&e<=t[2]&&t[1]<=i&&i<=t[3]}function ne(t,e){const i=t[0],n=t[1],r=t[2],s=t[3],o=e[0],a=e[1];let l=Ht.UNKNOWN;return o<i?l|=Ht.LEFT:o>r&&(l|=Ht.RIGHT),a<n?l|=Ht.BELOW:a>s&&(l|=Ht.ABOVE),l===Ht.UNKNOWN&&(l=Ht.INTERSECTING),l}function re(){return[1/0,1/0,-1/0,-1/0]}function se(t,e,i,n,r){return r?(r[0]=t,r[1]=e,r[2]=i,r[3]=n,r):[t,e,i,n]}function oe(t){return se(1/0,1/0,-1/0,-1/0,t)}function ae(t,e){const i=t[0],n=t[1];return se(i,n,i,n,e)}function le(t,e,i,n,r){return fe(oe(r),t,e,i,n)}function he(t,e){return t[0]==e[0]&&t[2]==e[2]&&t[1]==e[1]&&t[3]==e[3]}function ce(t,e,i){return Math.abs(t[0]-e[0])<i&&Math.abs(t[2]-e[2])<i&&Math.abs(t[1]-e[1])<i&&Math.abs(t[3]-e[3])<i}function ue(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 de(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 ge(t,e){for(let i=0,n=e.length;i<n;++i)de(t,e[i]);return t}function fe(t,e,i,n,r){for(;i<n;i+=r)me(t,e[i],e[i+1]);return t}function pe(t,e){for(let i=0,n=e.length;i<n;++i)ge(t,e[i]);return t}function me(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 _e(t,e){let i;return i=e(xe(t)),i||(i=e(ve(t)),i||(i=e(Pe(t)),i||(i=e(be(t)),i||!1)))}function ye(t){let e=0;return Fe(t)||(e=Ie(t)*Ce(t)),e}function xe(t){return[t[0],t[1]]}function ve(t){return[t[2],t[1]]}function Ee(t){return[(t[0]+t[2])/2,(t[1]+t[3])/2]}function Se(t,e){let i;if("bottom-left"===e)i=xe(t);else if("bottom-right"===e)i=ve(t);else if("top-left"===e)i=be(t);else{if("top-right"!==e)throw new Error("Invalid corner");i=Pe(t)}return i}function we(t,e,i,n,r){const[s,o,a,l,h,c,u,d]=Te(t,e,i,n);return se(Math.min(s,a,h,u),Math.min(o,l,c,d),Math.max(s,a,h,u),Math.max(o,l,c,d),r)}function Te(t,e,i,n){const r=e*n[0]/2,s=e*n[1]/2,o=Math.cos(i),a=Math.sin(i),l=r*o,h=r*a,c=s*o,u=s*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 Ce(t){return t[3]-t[1]}function Re(t,e,i){const n=i||[1/0,1/0,-1/0,-1/0];return Le(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]):oe(n),n}function be(t){return[t[0],t[3]]}function Pe(t){return[t[2],t[3]]}function Ie(t){return t[2]-t[0]}function Le(t,e){return t[0]<=e[2]&&t[2]>=e[0]&&t[1]<=e[3]&&t[3]>=e[1]}function Fe(t){return t[2]<t[0]||t[3]<t[1]}function Me(t,e){return e?(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e):t}function Ae(t,e){const i=(t[2]-t[0])/2*(e-1),n=(t[3]-t[1])/2*(e-1);t[0]-=i,t[2]+=i,t[1]-=n,t[3]+=n}function Oe(t,e,i){let n=!1;const r=ne(t,e),s=ne(t,i);if(r===Ht.INTERSECTING||s===Ht.INTERSECTING)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,m;s&Ht.ABOVE&&!(r&Ht.ABOVE)&&(p=d-(g-h)/f,n=p>=o&&p<=l),n||!(s&Ht.RIGHT)||r&Ht.RIGHT||(m=g-(d-l)*f,n=m>=a&&m<=h),n||!(s&Ht.BELOW)||r&Ht.BELOW||(p=d-(g-a)/f,n=p>=o&&p<=l),n||!(s&Ht.LEFT)||r&Ht.LEFT||(m=g-(d-o)*f,n=m>=a&&m<=h)}return n}function De(t,e,i,n){if(Fe(t))return oe(i);let r=[];if(n>1){const e=t[2]-t[0],i=t[3]-t[1];for(let s=0;s<n;++s)r.push(t[0]+e*s/n,t[1],t[2],t[1]+i*s/n,t[2]-e*s/n,t[3],t[0],t[3]-i*s/n)}else r=[t[0],t[1],t[2],t[1],t[2],t[3],t[0],t[3]];e(r,r,2);const s=[],o=[];for(let t=0,e=r.length;t<e;t+=2)s.push(r[t]),o.push(r[t+1]);return function(t,e,i){return se(Math.min.apply(null,t),Math.min.apply(null,e),Math.max.apply(null,t),Math.max.apply(null,e),i)}(s,o,i)}function Ne(t,e){const i=e.getExtent(),n=Ee(t);if(e.canWrapX()&&(n[0]<i[0]||n[0]>=i[2])){const e=Ie(i),r=Math.floor((n[0]-i[0])/e)*e;t[0]-=r,t[2]-=r}return t}function ke(t,e,i){if(e.canWrapX()){const n=e.getExtent();if(!isFinite(t[0])||!isFinite(t[2]))return[[n[0],t[1],n[2],t[3]]];Ne(t,e);const r=Ie(n);if(Ie(t)>r&&!i)return[[n[0],t[1],n[2],t[3]]];if(t[0]<n[0])return[[t[0]+r,t[1],n[2],t[3]],[n[0],t[1],t[2],t[3]]];if(t[2]>n[2])return[[t[0],t[1],n[2],t[3]],[n[0],t[1],t[2]-r,t[3]]]}return[t]}const Ge={9001:"m",9002:"ft",9003:"us-ft",9101:"radians",9102:"degrees"};function je(t){return Ge[t]}const Ue={radians:6370997/(2*Math.PI),degrees:2*Math.PI*6370997/360,ft:.3048,m:1,"us-ft":1200/3937};class Be{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_||Ue[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 ze=6378137,Xe=Math.PI*ze,Ve=[-Xe,-Xe,Xe,Xe],$e=[-180,-85,180,85],We=ze*Math.log(Math.tan(Math.PI/2));class Ze extends Be{constructor(t){super({code:t,units:"m",extent:Ve,global:!0,worldExtent:$e,getPointResolution:function(t,e){return t/Math.cosh(e[1]/ze)}})}}const Ye=[new Ze("EPSG:3857"),new Ze("EPSG:102100"),new Ze("EPSG:102113"),new Ze("EPSG:900913"),new Ze("http://www.opengis.net/def/crs/EPSG/0/3857"),new Ze("http://www.opengis.net/gml/srs/epsg.xml#3857")];function He(t,e,i,n){const r=t.length;i=i>1?i:2,n=n??i,void 0===e&&(e=i>2?t.slice():new Array(r));for(let i=0;i<r;i+=n){e[i]=Xe*t[i]/180;let n=ze*Math.log(Math.tan(Math.PI*(+t[i+1]+90)/360));n>We?n=We:n<-We&&(n=-We),e[i+1]=n}return e}function Ke(t,e,i,n){const r=t.length;i=i>1?i:2,n=n??i,void 0===e&&(e=i>2?t.slice():new Array(r));for(let i=0;i<r;i+=n)e[i]=180*t[i]/Xe,e[i+1]=360*Math.atan(Math.exp(t[i+1]/ze))/Math.PI-90;return e}const qe=6378137,Je=[-180,-90,180,90],Qe=Math.PI*qe/180;class ti extends Be{constructor(t,e){super({code:t,units:"degrees",extent:Je,axisOrientation:e,global:!0,metersPerUnit:Qe,worldExtent:Je})}}const ei=[new ti("CRS:84"),new ti("EPSG:4326","neu"),new ti("urn:ogc:def:crs:OGC:1.3:CRS84"),new ti("urn:ogc:def:crs:OGC:2:84"),new ti("http://www.opengis.net/def/crs/OGC/1.3/CRS84"),new ti("http://www.opengis.net/gml/srs/epsg.xml#4326","neu"),new ti("http://www.opengis.net/def/crs/EPSG/0/4326","neu")];let ii={};function ni(){ii={}}function ri(t){return ii[t]||ii[t.replace(/urn:(x-)?ogc:def:crs:EPSG:(.*:)?(\w+)$/,"EPSG:$3")]||null}function si(t,e){ii[t]=e}let oi={};function ai(){oi={}}function li(t,e,i){const n=t.getCode(),r=e.getCode();n in oi||(oi[n]={}),oi[n][r]=i}function hi(t,e){return t in oi&&e in oi[t]?oi[t][e]:null}function ci(t,e,i){return Math.min(Math.max(t,e),i)}function ui(t,e,i,n,r,s){const o=r-i,a=s-n;if(0!==o||0!==a){const l=((t-i)*o+(e-n)*a)/(o*o+a*a);l>1?(i=r,n=s):l>0&&(i+=o*l,n+=a*l)}return di(t,e,i,n)}function di(t,e,i,n){const r=i-t,s=n-e;return r*r+s*s}function gi(t){const e=t.length;for(let i=0;i<e;i++){let n=i,r=Math.abs(t[i][i]);for(let s=i+1;s<e;s++){const e=Math.abs(t[s][i]);e>r&&(r=e,n=s)}if(0===r)return null;const s=t[n];t[n]=t[i],t[i]=s;for(let n=i+1;n<e;n++){const r=-t[n][i]/t[i][i];for(let s=i;s<e+1;s++)i==s?t[n][s]=0:t[n][s]+=r*t[i][s]}}const i=new Array(e);for(let n=e-1;n>=0;n--){i[n]=t[n][e]/t[n][n];for(let r=n-1;r>=0;r--)t[r][e]-=t[r][n]*i[n]}return i}function fi(t){return 180*t/Math.PI}function pi(t){return t*Math.PI/180}function mi(t,e){const i=t%e;return i*e<0?i+e:i}function _i(t,e,i){return t+i*(e-t)}function yi(t,e){const i=Math.pow(10,e);return Math.round(t*i)/i}function xi(t,e){return Math.round(yi(t,e))}function vi(t,e){return Math.floor(yi(t,e))}function Ei(t,e){return Math.ceil(yi(t,e))}function Si(t,e,i){if(t>=e&&t<i)return t;const n=i-e;return((t-e)%n+n)%n+e}function wi(t,e,i){const n=void 0!==i?t.toFixed(i):""+t;let r=n.indexOf(".");return r=-1===r?n.length:r,r>e?n:new Array(1+e-r).join("0")+n}function Ti(t,e){const i=(""+t).split("."),n=(""+e).split(".");for(let t=0;t<Math.max(i.length,n.length);t++){const e=parseInt(i[t]||"0",10),r=parseInt(n[t]||"0",10);if(e>r)return 1;if(r>e)return-1}return 0}function Ci(t,e){return t[0]+=+e[0],t[1]+=+e[1],t}function Ri(t,e){const i=e.getRadius(),n=e.getCenter(),r=n[0],s=n[1];let o=t[0]-r;const a=t[1]-s;0===o&&0===a&&(o=1);const l=Math.sqrt(o*o+a*a);return[r+i*o/l,s+i*a/l]}function bi(t,e){const i=t[0],n=t[1],r=e[0],s=e[1],o=r[0],a=r[1],l=s[0],h=s[1],c=l-o,u=h-a,d=0===c&&0===u?0:(c*(i-o)+u*(n-a))/(c*c+u*u||0);let g,f;return d<=0?(g=o,f=a):d>=1?(g=l,f=h):(g=o+d*c,f=a+d*u),[g,f]}function Pi(t,e,i){const n=mi(e+180,360)-180,r=Math.abs(3600*n),s=i||0;let o=Math.floor(r/3600),a=Math.floor((r-3600*o)/60),l=yi(r-3600*o-60*a,s);l>=60&&(l=0,a+=1),a>=60&&(a=0,o+=1);let h=o+"°";return 0===a&&0===l||(h+=" "+wi(a,2)+"′"),0!==l&&(h+=" "+wi(l,2,s)+"″"),0!==n&&(h+=" "+t.charAt(n<0?1:0)),h}function Ii(t,e,i){return t?e.replace("{x}",t[0].toFixed(i)).replace("{y}",t[1].toFixed(i)):""}function Li(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 Fi(t,e){const i=Math.cos(e),n=Math.sin(e),r=t[0]*i-t[1]*n,s=t[1]*i+t[0]*n;return t[0]=r,t[1]=s,t}function Mi(t,e){return t[0]*=e,t[1]*=e,t}function Ai(t,e){const i=t[0]-e[0],n=t[1]-e[1];return i*i+n*n}function Oi(t,e){return Math.sqrt(Ai(t,e))}function Di(t,e){return Ai(t,bi(t,e))}function Ni(t,e){return Ii(t,"{x}, {y}",e)}function ki(t,e){if(e.canWrapX()){const i=Ie(e.getExtent()),n=Gi(t,e,i);n&&(t[0]-=n*i)}return t}function Gi(t,e,i){const n=e.getExtent();let r=0;return e.canWrapX()&&(t[0]<n[0]||t[0]>n[2])&&(i=i||Ie(n),r=Math.floor((t[0]-n[0])/i)),r}const ji=6371008.8;function Ui(t,e,i){i=i||ji;const n=pi(t[1]),r=pi(e[1]),s=(r-n)/2,o=pi(e[0]-t[0])/2,a=Math.sin(s)*Math.sin(s)+Math.sin(o)*Math.sin(o)*Math.cos(n)*Math.cos(r);return 2*i*Math.atan2(Math.sqrt(a),Math.sqrt(1-a))}function Bi(t,e){let i=0;for(let n=0,r=t.length;n<r-1;++n)i+=Ui(t[n],t[n+1],e);return i}function zi(t,e){let i=0;const n=t.length;let r=t[n-1][0],s=t[n-1][1];for(let e=0;e<n;e++){const n=t[e][0],o=t[e][1];i+=pi(n-r)*(2+Math.sin(pi(s))+Math.sin(pi(o))),r=n,s=o}return i*e*e/2}function Xi(t,e,i,n){n=n||ji;const r=pi(t[1]),s=pi(t[0]),o=e/n,a=Math.asin(Math.sin(r)*Math.cos(o)+Math.cos(r)*Math.sin(o)*Math.cos(i));return[fi(s+Math.atan2(Math.sin(i)*Math.sin(o)*Math.cos(r),Math.cos(o)-Math.sin(r)*Math.sin(a))),fi(a)]}const Vi=.9996,$i=.00669438,Wi=$i*$i,Zi=Wi*$i,Yi=$i/(1-$i),Hi=Math.sqrt(1-$i),Ki=(1-Hi)/(1+Hi),qi=Ki*Ki,Ji=qi*Ki,Qi=Ji*Ki,tn=Qi*Ki,en=1-$i/4-3*Wi/64-5*Zi/256,nn=3*$i/8+3*Wi/32+45*Zi/1024,rn=15*Wi/256+45*Zi/1024,sn=35*Zi/3072,on=1.5*Ki-27/32*Ji+269/512*tn,an=21/16*qi-55/32*Qi,ln=151/96*Ji-417/128*tn,hn=1097/512*Qi,cn=6378137;function un(t,e,i){const n=t-5e5,r=(i.north?e:e-1e7)/Vi/(cn*en),s=r+on*Math.sin(2*r)+an*Math.sin(4*r)+ln*Math.sin(6*r)+hn*Math.sin(8*r),o=Math.sin(s),a=o*o,l=Math.cos(s),h=o/l,c=h*h,u=c*c,d=1-$i*a,g=Math.sqrt(1-$i*a),f=Yi*l**2,p=f*f,m=n/(cn/g*Vi),_=m*m,y=_*m,x=y*m,v=x*m,E=s-h/((1-$i)/d)*(_/2-x/24*(5+3*c+10*f-4*p-9*Yi))+v*m/720*(61+90*c+298*f+45*u-252*Yi-3*p);let S=(m-y/6*(1+2*c+f)+v/120*(5-2*f+28*c-3*p+8*Yi+24*u))/l;return S=Si(S+pi(_n(i.number)),-Math.PI,Math.PI),[fi(S),fi(E)]}const dn=-80,gn=84,fn=-180,pn=180;function mn(t,e,i){t=Si(t,fn,pn),e<dn?e=dn:e>gn&&(e=gn);const n=pi(e),r=Math.sin(n),s=Math.cos(n),o=r/s,a=o*o,l=a*a,h=pi(t),c=pi(_n(i.number)),u=cn/Math.sqrt(1-$i*r**2),d=Yi*s**2,g=s*Si(h-c,-Math.PI,Math.PI),f=g*g,p=f*g,m=p*g,_=m*g,y=_*g,x=cn*(en*n-nn*Math.sin(2*n)+rn*Math.sin(4*n)-sn*Math.sin(6*n)),v=Vi*u*(g+p/6*(1-a+d)+_/120*(5-18*a+l+72*d-58*Yi))+5e5;let E=Vi*(x+u*o*(f/2+m/24*(5-a+9*d+4*d**2)+y/720*(61-58*a+l+600*d-330*Yi)));return i.north||(E+=1e7),[v,E]}function _n(t){return 6*(t-1)-180+3}const yn=[/^EPSG:(\d+)$/,/^urn:ogc:def:crs:EPSG::(\d+)$/,/^http:\/\/www\.opengis\.net\/def\/crs\/EPSG\/0\/(\d+)$/];function xn(t){let e=0;for(const i of yn){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 vn(t,e){return function(i,n,r,s){const o=i.length;r=r>1?r:2,s=s??r,n||(n=r>2?i.slice():new Array(o));for(let r=0;r<o;r+=s){const s=i[r],o=i[r+1],a=t(s,o,e);n[r]=a[0],n[r+1]=a[1]}return n}}function En(t){return xn(t)?new Be({code:t,units:"m"}):null}function Sn(t){const e=xn(t.getCode());return e?{forward:vn(mn,e),inverse:vn(un,e)}:null}const wn={info:1,warn:2,error:3,none:4};let Tn=wn.info;function Cn(...t){Tn>wn.warn||console.warn(...t)}function Rn(...t){Tn>wn.error||console.error(...t)}const bn=[Sn],Pn=[En];let In=!0;function Ln(t){In=!(void 0===t||t)}function Fn(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 Mn(t,e){if(void 0!==e&&t!==e){for(let i=0,n=t.length;i<n;++i)e[i]=t[i];t=e}return t}function An(t){si(t.getCode(),t),li(t,t,Fn)}function On(t){t.forEach(An)}function Dn(t){if("string"!=typeof t)return t;const e=ri(t);if(e)return e;for(const e of Pn){const i=e(t);if(i)return i}return null}function Nn(t,e,i,n){let r;const s=(t=Dn(t)).getPointResolutionFunc();if(s){if(r=s(e,i),n&&n!==t.getUnits()){const e=t.getMetersPerUnit();e&&(r=r*e/Ue[n])}}else{const s=t.getUnits();if("degrees"==s&&!n||"degrees"==n)r=e;else{const o=Vn(t,Dn("EPSG:4326"));if(o||"degrees"===s){let t=[i[0]-e/2,i[1],i[0]+e/2,i[1],i[0],i[1]-e/2,i[0],i[1]+e/2];t=o(t,t,2);r=(Ui(t.slice(0,2),t.slice(2,4))+Ui(t.slice(4,6),t.slice(6,8)))/2}else r=e*t.getMetersPerUnit();const a=n?Ue[n]:t.getMetersPerUnit();void 0!==a&&(r/=a)}}return r}function kn(t){On(t),t.forEach((function(e){t.forEach((function(t){e!==t&&li(e,t,Fn)}))}))}function Gn(t,e,i,n){t.forEach((function(t){e.forEach((function(e){li(t,e,i),li(e,t,n)}))}))}function jn(t,e){return t?"string"==typeof t?Dn(t):t:Dn(e)}function Un(t){return function(e,i,n,r){const s=e.length;n=void 0!==n?n:2,r=r??n,i=void 0!==i?i:new Array(s);for(let o=0;o<s;o+=r){const s=t(e.slice(o,o+n)),a=s.length;for(let t=0,n=r;t<n;++t)i[o+t]=t>=a?e[o+t]:s[t]}return i}}function Bn(t,e,i,n){const r=Dn(t),s=Dn(e);li(r,s,Un(i)),li(s,r,Un(n))}function zn(t,e){const i=Zn(t,void 0!==e?e:"EPSG:3857","EPSG:4326"),n=i[0];return(n<-180||n>180)&&(i[0]=mi(n+180,360)-180),i}function Xn(t,e){if(t===e)return!0;const i=t.getUnits()===e.getUnits();if(t.getCode()===e.getCode())return i;return Vn(t,e)===Fn&&i}function Vn(t,e){const i=t.getCode(),n=e.getCode();let r=hi(i,n);if(r)return r;let s=null,o=null;for(const i of bn)s||(s=i(t)),o||(o=i(e));if(!s&&!o)return null;const a="EPSG:4326";if(o)if(s)r=$n(s.inverse,o.forward);else{const t=hi(i,a);t&&(r=$n(t,o.forward))}else{const t=hi(a,n);t&&(r=$n(s.inverse,t))}return r&&(An(t),An(e),li(t,e,r)),r}function $n(t,e){return function(i,n,r,s){return n=t(i,n,r,s),e(n,n,r,s)}}function Wn(t,e){return Vn(Dn(t),Dn(e))}function Zn(t,e,i){const n=Wn(e,i);if(!n){const t=Dn(e).getCode(),n=Dn(i).getCode();throw new Error(`No transform available between ${t} and ${n}`)}return n(t,void 0,t.length)}function Yn(t,e,i,n){return De(t,Wn(e,i),void 0,n)}let Hn=null;function Kn(t){Hn=Dn(t)}function qn(){return Hn}function Jn(t,e){return Hn?Zn(t,e,Hn):t}function Qn(t,e){return Hn?Zn(t,Hn,e):(In&&!Li(t,[0,0])&&t[0]>=-180&&t[0]<=180&&t[1]>=-90&&t[1]<=90&&(In=!1,Cn("Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.")),t)}function tr(t,e){return Hn?Yn(t,e,Hn):t}function er(t,e){return Hn?Yn(t,Hn,e):t}function ir(t,e){if(!Hn)return t;const i=Dn(e).getMetersPerUnit(),n=Hn.getMetersPerUnit();return i&&n?t*i/n:t}function nr(t,e){if(!Hn)return t;const i=Dn(e).getMetersPerUnit(),n=Hn.getMetersPerUnit();return i&&n?t*n/i:t}function rr(t,e,i){return function(n){let r,s;if(t.canWrapX()){const e=t.getExtent(),o=Ie(e);s=Gi(n=n.slice(0),t,o),s&&(n[0]=n[0]-s*o),n[0]=ci(n[0],e[0],e[2]),n[1]=ci(n[1],e[1],e[3]),r=i(n)}else r=i(n);return s&&e.canWrapX()&&(r[0]+=s*Ie(e.getExtent())),r}}function sr(){kn(Ye),kn(ei),Gn(ei,Ye,He,Ke)}function or(t,e,i,n,r,s,o){s=s||[],o=o||2;let a=0;for(let l=e;l<i;l+=n){const e=t[l],i=t[l+1];s[a++]=r[0]*e+r[2]*i+r[4],s[a++]=r[1]*e+r[3]*i+r[5];for(let e=2;e<o;e++)s[a++]=t[l+e]}return s&&s.length!=a&&(s.length=a),s}function ar(t,e,i,n,r,s,o){o=o||[];const a=Math.cos(r),l=Math.sin(r),h=s[0],c=s[1];let u=0;for(let r=e;r<i;r+=n){const e=t[r]-h,i=t[r+1]-c;o[u++]=h+e*a-i*l,o[u++]=c+e*l+i*a;for(let e=r+2;e<r+n;++e)o[u++]=t[e]}return o&&o.length!=u&&(o.length=u),o}function lr(t,e,i,n,r,s,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+r*e,a[c++]=h+s*i;for(let e=o+2;e<o+n;++e)a[c++]=t[e]}return a&&a.length!=c&&(a.length=c),a}function hr(t,e,i,n,r,s,o){o=o||[];let a=0;for(let l=e;l<i;l+=n){o[a++]=t[l]+r,o[a++]=t[l+1]+s;for(let e=l+2;e<l+n;++e)o[a++]=t[e]}return o&&o.length!=a&&(o.length=a),o}sr();const cr=[1,0,0,1,0,0];class ur extends z{constructor(){super(),this.extent_=[1/0,1/0,-1/0,-1/0],this.extentRevision_=-1,this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=0,this.simplifyTransformedInternal=p(((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 G()}closestPointXY(t,e,i,n){return G()}containsXY(t,e){const i=this.getClosestPoint([t,e]);return i[0]===t&&i[1]===e}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 G()}getExtent(t){if(this.extentRevision_!=this.getRevision()){const t=this.computeExtent(this.extent_);(isNaN(t[0])||isNaN(t[1]))&&oe(t),this.extentRevision_=this.getRevision()}return Me(this.extent_,t)}rotate(t,e){G()}scale(t,e,i){G()}simplify(t){return this.getSimplifiedGeometry(t*t)}getSimplifiedGeometry(t){return G()}getType(){return G()}applyTransform(t){G()}intersectsExtent(t){return G()}translate(t,e){G()}transform(t,e){const i=Dn(t),n="tile-pixels"==i.getUnits()?function(t,n,r){const s=i.getExtent(),o=i.getWorldExtent(),a=Ce(o)/Ce(s);Vt(cr,o[0],o[3],a,-a,0,0,0);const l=or(t,0,t.length,r,cr,n),h=Wn(i,e);return h?h(l,l,r):l}:Wn(i,e);return this.applyTransform(n),this}}class dr extends ur{constructor(){super(),this.layout="XY",this.stride=2,this.flatCoordinates}computeExtent(t){return le(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t)}getCoordinates(){return G()}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=fr(t),this.layout=t,this.flatCoordinates=e}setCoordinates(t,e){G()}setLayout(t,e,i){let n;if(t)n=fr(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=gr(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();ar(i,0,i.length,n,t,e,i),this.changed()}}scale(t,e,i){void 0===e&&(e=t),i||(i=Ee(this.getExtent()));const n=this.getFlatCoordinates();if(n){const r=this.getStride();lr(n,0,n.length,r,t,e,i,n),this.changed()}}translate(t,e){const i=this.getFlatCoordinates();if(i){const n=this.getStride();hr(i,0,i.length,n,t,e,i),this.changed()}}}function gr(t){let e;return 2==t?e="XY":3==t?e="XYZ":4==t&&(e="XYZM"),e}function fr(t){let e;return"XY"==t?e=2:"XYZ"==t||"XYM"==t?e=3:"XYZM"==t&&(e=4),e}function pr(t,e,i){const n=t.getFlatCoordinates();if(!n)return null;const r=t.getStride();return or(n,0,n.length,r,e,i)}function mr(t,e,i,n,r,s,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=((r-a)*h+(s-l)*c)/(h*h+c*c);if(d>1)u=i;else{if(d>0){for(let r=0;r<n;++r)o[r]=_i(t[e+r],t[i+r],d);return void(o.length=n)}u=e}}for(let e=0;e<n;++e)o[e]=t[u+e];o.length=n}function _r(t,e,i,n,r){let s=t[e],o=t[e+1];for(e+=n;e<i;e+=n){const i=t[e],n=t[e+1],a=di(s,o,i,n);a>r&&(r=a),s=i,o=n}return r}function yr(t,e,i,n,r){for(let s=0,o=i.length;s<o;++s){const o=i[s];r=_r(t,e,o,n,r),e=o}return r}function xr(t,e,i,n,r){for(let s=0,o=i.length;s<o;++s){const o=i[s];r=yr(t,e,o,n,r),e=o[o.length-1]}return r}function vr(t,e,i,n,r,s,o,a,l,h,c){if(e==i)return h;let u,d;if(0===r){if(d=di(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(mr(t,g-n,g,n,o,a,c),d=di(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))/r|0,1);if(s&&(mr(t,i-n,e,n,o,a,c),d=di(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 Er(t,e,i,n,r,s,o,a,l,h,c){c=c||[NaN,NaN];for(let u=0,d=i.length;u<d;++u){const d=i[u];h=vr(t,e,d,n,r,s,o,a,l,h,c),e=d}return h}function Sr(t,e,i,n,r,s,o,a,l,h,c){c=c||[NaN,NaN];for(let u=0,d=i.length;u<d;++u){const d=i[u];h=Er(t,e,d,n,r,s,o,a,l,h,c),e=d[d.length-1]}return h}function wr(t,e,i,n){for(let n=0,r=i.length;n<r;++n)t[e++]=i[n];return e}function Tr(t,e,i,n){for(let r=0,s=i.length;r<s;++r){const s=i[r];for(let i=0;i<n;++i)t[e++]=s[i]}return e}function Cr(t,e,i,n,r){r=r||[];let s=0;for(let o=0,a=i.length;o<a;++o){const a=Tr(t,e,i[o],n);r[s++]=a,e=a}return r.length=s,r}function Rr(t,e,i,n,r){r=r||[];let s=0;for(let o=0,a=i.length;o<a;++o){const a=Cr(t,e,i[o],n,r[s]);0===a.length&&(a[0]=e),r[s++]=a,e=a[a.length-1]}return r.length=s,r}function br(t,e,i,n,r,s,o){const a=(i-e)/n;if(a<3){for(;e<i;e+=n)s[o++]=t[e],s[o++]=t[e+1];return o}const l=new Array(a);l[0]=1,l[a-1]=1;const h=[e,i-n];let c=0;for(;h.length>0;){const i=h.pop(),s=h.pop();let o=0;const a=t[s],u=t[s+1],d=t[i],g=t[i+1];for(let e=s+n;e<i;e+=n){const i=ui(t[e],t[e+1],a,u,d,g);i>o&&(c=e,o=i)}o>r&&(l[(c-e)/n]=1,s+n<c&&h.push(s,c),c+n<i&&h.push(c,i))}for(let i=0;i<a;++i)l[i]&&(s[o++]=t[e+i*n],s[o++]=t[e+i*n+1]);return o}function Pr(t,e,i,n,r,s,o,a){for(let l=0,h=i.length;l<h;++l){const h=i[l];o=br(t,e,h,n,r,s,o),a.push(o),e=h}return o}function Ir(t,e,i,n,r,s,o){if(i<=e+n){for(;e<i;e+=n)s[o++]=t[e],s[o++]=t[e+1];return o}let a=t[e],l=t[e+1];s[o++]=a,s[o++]=l;let h=a,c=l;for(e+=n;e<i;e+=n)h=t[e],c=t[e+1],di(a,l,h,c)>r&&(s[o++]=h,s[o++]=c,a=h,l=c);return h==a&&c==l||(s[o++]=h,s[o++]=c),o}function Lr(t,e){return e*Math.round(t/e)}function Fr(t,e,i,n,r,s,o){if(e==i)return o;let a,l,h=Lr(t[e],r),c=Lr(t[e+1],r);e+=n,s[o++]=h,s[o++]=c;do{if(a=Lr(t[e],r),l=Lr(t[e+1],r),(e+=n)==i)return s[o++]=a,s[o++]=l,o}while(a==h&&l==c);for(;e<i;){const i=Lr(t[e],r),u=Lr(t[e+1],r);if(e+=n,i==a&&u==l)continue;const d=a-h,g=l-c,f=i-h,p=u-c;d*p==g*f&&(d<0&&f<d||d==f||d>0&&f>d)&&(g<0&&p<g||g==p||g>0&&p>g)?(a=i,l=u):(s[o++]=a,s[o++]=l,h=a,c=l,a=i,l=u)}return s[o++]=a,s[o++]=l,o}function Mr(t,e,i,n,r,s,o,a){for(let l=0,h=i.length;l<h;++l){const h=i[l];o=Fr(t,e,h,n,r,s,o),a.push(o),e=h}return o}function Ar(t,e,i,n,r,s,o,a){for(let l=0,h=i.length;l<h;++l){const h=i[l],c=[];o=Mr(t,e,h,n,r,s,o,c),a.push(c),e=h[h.length-1]}return o}function Or(t,e,i,n,r){r=void 0!==r?r:[];let s=0;for(let o=e;o<i;o+=n)r[s++]=t.slice(o,o+n);return r.length=s,r}function Dr(t,e,i,n,r){r=void 0!==r?r:[];let s=0;for(let o=0,a=i.length;o<a;++o){const a=i[o];r[s++]=Or(t,e,a,n,r[s]),e=a}return r.length=s,r}function Nr(t,e,i,n,r){r=void 0!==r?r:[];let s=0;for(let o=0,a=i.length;o<a;++o){const a=i[o];r[s++]=1===a.length&&a[0]===e?[]:Dr(t,e,a,n,r[s]),e=a[a.length-1]}return r.length=s,r}function kr(t,e,i,n){let r=0;const s=t[i-n],o=t[i-n+1];let a=0,l=0;for(;e<i;e+=n){const i=t[e]-s,n=t[e+1]-o;r+=l*i-a*n,a=i,l=n}return r/2}function Gr(t,e,i,n){let r=0;for(let s=0,o=i.length;s<o;++s){const o=i[s];r+=kr(t,e,o,n),e=o}return r}function jr(t,e,i,n){let r=0;for(let s=0,o=i.length;s<o;++s){const o=i[s];r+=Gr(t,e,o,n),e=o[o.length-1]}return r}class Ur extends dr{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 Ur(this.flatCoordinates.slice(),this.layout)}closestPointXY(t,e,i,n){return n<Qt(this.getExtent(),t,e)?n:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(_r(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),vr(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!0,t,e,i,n))}getArea(){return kr(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinates(){return Or(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getSimplifiedGeometryInternal(t){const e=[];return e.length=br(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e,0),new Ur(e,"XY")}getType(){return"LinearRing"}intersectsExtent(t){return!1}setCoordinates(t,e){this.setLayout(e,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Tr(this.flatCoordinates,0,t,this.stride),this.changed()}}class Br extends dr{constructor(t,e){super(),this.setCoordinates(t,e)}clone(){const t=new Br(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(t,e,i,n){const r=this.flatCoordinates,s=di(t,e,r[0],r[1]);if(s<n){const t=this.stride;for(let e=0;e<t;++e)i[e]=r[e];return i.length=t,s}return n}getCoordinates(){return this.flatCoordinates.slice()}computeExtent(t){return ae(this.flatCoordinates,t)}getType(){return"Point"}intersectsExtent(t){return ie(t,this.flatCoordinates[0],this.flatCoordinates[1])}setCoordinates(t,e){this.setLayout(e,t,0),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=wr(this.flatCoordinates,0,t,this.stride),this.changed()}}function zr(t,e,i,n,r){return!_e(r,(function(r){return!Xr(t,e,i,n,r[0],r[1])}))}function Xr(t,e,i,n,r,s){let o=0,a=t[i-n],l=t[i-n+1];for(;e<i;e+=n){const i=t[e],n=t[e+1];l<=s?n>s&&(i-a)*(s-l)-(r-a)*(n-l)>0&&o++:n<=s&&(i-a)*(s-l)-(r-a)*(n-l)<0&&o--,a=i,l=n}return 0!==o}function Vr(t,e,i,n,r,s){if(0===i.length)return!1;if(!Xr(t,e,i[0],n,r,s))return!1;for(let e=1,o=i.length;e<o;++e)if(Xr(t,i[e-1],i[e],n,r,s))return!1;return!0}function $r(t,e,i,n,r,s){if(0===i.length)return!1;for(let o=0,a=i.length;o<a;++o){const a=i[o];if(Vr(t,e,a,n,r,s))return!0;e=a[a.length-1]}return!1}function Wr(t,e,i,n,r,o,a){let l,h,c,u,d,g,f;const p=r[o+1],m=[];for(let r=0,s=i.length;r<s;++r){const s=i[r];for(u=t[s-n],g=t[s-n+1],l=e;l<s;l+=n)d=t[l],f=t[l+1],(p<=g&&f<=p||g<=p&&p<=f)&&(c=(p-g)/(f-g)*(d-u)+u,m.push(c)),u=d,g=f}let _=NaN,y=-1/0;for(m.sort(s),u=m[0],l=1,h=m.length;l<h;++l){d=m[l];const r=Math.abs(d-u);r>y&&(c=(u+d)/2,Vr(t,e,i,n,c,p)&&(_=c,y=r)),u=d}return isNaN(_)&&(_=r[o]),a?(a.push(_,p,y),a):[_,p,y]}function Zr(t,e,i,n,r){let s=[];for(let o=0,a=i.length;o<a;++o){const a=i[o];s=Wr(t,e,a,n,r,2*o,s),e=a[a.length-1]}return s}function Yr(t,e,i,n,r){let s;for(e+=n;e<i;e+=n)if(s=r(t.slice(e-n,e),t.slice(e,e+n)),s)return s;return!1}function Hr(t,e,i,n,r){const s=fe([1/0,1/0,-1/0,-1/0],t,e,i,n);return!!Le(r,s)&&(!!ee(r,s)||(s[0]>=r[0]&&s[2]<=r[2]||(s[1]>=r[1]&&s[3]<=r[3]||Yr(t,e,i,n,(function(t,e){return Oe(r,t,e)})))))}function Kr(t,e,i,n,r){for(let s=0,o=i.length;s<o;++s){if(Hr(t,e,i[s],n,r))return!0;e=i[s]}return!1}function qr(t,e,i,n,r){return!!Hr(t,e,i,n,r)||(!!Xr(t,e,i,n,r[0],r[1])||(!!Xr(t,e,i,n,r[0],r[3])||(!!Xr(t,e,i,n,r[2],r[1])||!!Xr(t,e,i,n,r[2],r[3]))))}function Jr(t,e,i,n,r){if(!qr(t,e,i[0],n,r))return!1;if(1===i.length)return!0;for(let e=1,s=i.length;e<s;++e)if(zr(t,i[e-1],i[e],n,r)&&!Hr(t,i[e-1],i[e],n,r))return!1;return!0}function Qr(t,e,i,n,r){for(let s=0,o=i.length;s<o;++s){const o=i[s];if(Jr(t,e,o,n,r))return!0;e=o[o.length-1]}return!1}function ts(t,e,i,n){for(;e<i-n;){for(let r=0;r<n;++r){const s=t[e+r];t[e+r]=t[i-n+r],t[i-n+r]=s}e+=n,i-=n}}function es(t,e,i,n){let r=0,s=t[i-n],o=t[i-n+1];for(;e<i;e+=n){const i=t[e],n=t[e+1];r+=(i-s)*(n+o),s=i,o=n}return 0===r?void 0:r>0}function is(t,e,i,n,r){r=void 0!==r&&r;for(let s=0,o=i.length;s<o;++s){const o=i[s],a=es(t,e,o,n);if(0===s){if(r&&a||!r&&!a)return!1}else if(r&&!a||!r&&a)return!1;e=o}return!0}function ns(t,e,i,n,r){for(let s=0,o=i.length;s<o;++s){const o=i[s];if(!is(t,e,o,n,r))return!1;o.length&&(e=o[o.length-1])}return!0}function rs(t,e,i,n,r){r=void 0!==r&&r;for(let s=0,o=i.length;s<o;++s){const o=i[s],a=es(t,e,o,n);(0===s?r&&a||!r&&!a:r&&!a||!r&&a)&&ts(t,e,o,n),e=o}return e}function ss(t,e,i,n,r){for(let s=0,o=i.length;s<o;++s)e=rs(t,e,i[s],n,r);return e}function os(t,e){const i=[];let n,r=0,s=0;for(let o=0,a=e.length;o<a;++o){const a=e[o],l=es(t,r,a,2);if(void 0===n&&(n=l),l===n)i.push(e.slice(s,o+1));else{if(0===i.length)continue;i[i.length-1].push(e[s])}s=o+1,r=a}return i}class as extends dr{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?h(this.flatCoordinates,t.getFlatCoordinates()):this.flatCoordinates=t.getFlatCoordinates().slice(),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){const t=new as(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return t.applyProperties(this),t}closestPointXY(t,e,i,n){return n<Qt(this.getExtent(),t,e)?n:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(yr(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Er(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!0,t,e,i,n))}containsXY(t,e){return Vr(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,e)}getArea(){return Gr(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride)}getCoordinates(t){let e;return void 0!==t?(e=this.getOrientedFlatCoordinates().slice(),rs(e,0,this.ends_,this.stride,t)):e=this.flatCoordinates,Dr(e,0,this.ends_,this.stride)}getEnds(){return this.ends_}getFlatInteriorPoint(){if(this.flatInteriorPointRevision_!=this.getRevision()){const t=Ee(this.getExtent());this.flatInteriorPoint_=Wr(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,0),this.flatInteriorPointRevision_=this.getRevision()}return this.flatInteriorPoint_}getInteriorPoint(){return new Br(this.getFlatInteriorPoint(),"XYM")}getLinearRingCount(){return this.ends_.length}getLinearRing(t){return t<0||this.ends_.length<=t?null:new Ur(this.flatCoordinates.slice(0===t?0:this.ends_[t-1],this.ends_[t]),this.layout)}getLinearRings(){const t=this.layout,e=this.flatCoordinates,i=this.ends_,n=[];let r=0;for(let s=0,o=i.length;s<o;++s){const o=i[s],a=new Ur(e.slice(r,o),t);n.push(a),r=o}return n}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){const t=this.flatCoordinates;is(t,0,this.ends_,this.stride)?this.orientedFlatCoordinates_=t:(this.orientedFlatCoordinates_=t.slice(),this.orientedFlatCoordinates_.length=rs(this.orientedFlatCoordinates_,0,this.ends_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(t){const e=[],i=[];return e.length=Mr(this.flatCoordinates,0,this.ends_,this.stride,Math.sqrt(t),e,0,i),new as(e,"XY",i)}getType(){return"Polygon"}intersectsExtent(t){return Jr(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,2),this.flatCoordinates||(this.flatCoordinates=[]);const i=Cr(this.flatCoordinates,0,t,this.stride,this.ends_);this.flatCoordinates.length=0===i.length?0:i[i.length-1],this.changed()}}function ls(t,e,i,n){i=i||32;const r=[];for(let s=0;s<i;++s)h(r,Xi(t,e,2*Math.PI*s/i,n));return r.push(r[0],r[1]),new as(r,"XY",[r.length])}function hs(t){if(Fe(t))throw new Error("Cannot create polygon from empty extent");const e=t[0],i=t[1],n=t[2],r=t[3],s=[e,i,e,r,n,r,n,i,e,i];return new as(s,"XY",[s.length])}function cs(t,e,i){e=e||32;const n=t.getStride(),r=t.getLayout(),s=t.getCenter(),o=n*(e+1),a=new Array(o);for(let t=0;t<o;t+=n){a[t]=0,a[t+1]=0;for(let e=2;e<n;e++)a[t+e]=s[e]}const l=[a.length],h=new as(a,r,l);return us(h,s,t.getRadius(),i),h}function us(t,e,i,n){const r=t.getFlatCoordinates(),s=t.getStride(),o=r.length/s-1,a=n||0;for(let t=0;t<=o;++t){const n=t*s,l=a+2*mi(t,o)*Math.PI/o;r[n]=e[0]+i*Math.cos(l),r[n+1]=e[1]+i*Math.sin(l)}t.changed()}const ds="accuracy",gs="accuracyGeometry",fs="altitude",ps="altitudeAccuracy",ms="heading",_s="position",ys="projection",xs="speed",vs="tracking",Es="trackingOptions",Ss="error";class ws extends t{constructor(t){super(Ss),this.code=t.code,this.message=t.message}}var Ts={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};class Cs extends x{constructor(t,e,i,n){super(),this.extent=t,this.pixelRatio_=i,this.resolution=e,this.state="function"==typeof n?Ts.IDLE:n,this.image_=null,this.loader="function"==typeof n?n:null}changed(){this.dispatchEvent(v)}getExtent(){return this.extent}getImage(){return this.image_}getPixelRatio(){return this.pixelRatio_}getResolution(){return this.resolution}getState(){return this.state}load(){if(this.state==Ts.IDLE&&this.loader){this.state=Ts.LOADING,this.changed();const t=this.getResolution(),e=Array.isArray(t)?t[0]:t;m((()=>this.loader(this.getExtent(),e,this.getPixelRatio()))).then((t=>{"image"in t&&(this.image_=t.image),"extent"in t&&(this.extent=t.extent),"resolution"in t&&(this.resolution=t.resolution),"pixelRatio"in t&&(this.pixelRatio_=t.pixelRatio),(t instanceof HTMLImageElement||t instanceof ImageBitmap||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement)&&(this.image_=t),this.state=Ts.LOADED})).catch((t=>{this.state=Ts.ERROR,console.error(t)})).finally((()=>this.changed()))}}setImage(t){this.image_=t}setResolution(t){this.resolution=t}}function Rs(t,e,i){const n=t;let r=!0,s=!1,o=!1;const a=[O(n,L,(function(){o=!0,s||e()}))];return n.src&&dt?(s=!0,n.decode().then((function(){r&&e()})).catch((function(t){r&&(o?e():i())}))):a.push(O(n,E,i)),function(){r=!1,a.forEach(D)}}function bs(t,e){return new Promise(((i,n)=>{function r(){o(),i(t)}functi