Colota - Android GPS Location tracker
Restructure project as npm workspaces monorepo
Max Dietrich29af92a4e4f1
diff --git a/.github/labeler.yml b/.github/labeler.ymlindex c682f544..8e755e03 100644--- a/.github/labeler.yml+++ b/.github/labeler.yml@@ -8,15 +8,15 @@ ci:# Android / Native Kotlin# ============================android:- - 'android/**'+ - 'apps/mobile/android/**'# ============================# React Native / TypeScript# ============================frontend:- - 'src/**'- - '*.ts'- - '*.tsx'+ - 'apps/mobile/src/**'+ - 'apps/mobile/*.ts'+ - 'apps/mobile/*.tsx'# ============================# Testsdiff --git a/.github/workflows/build-latest-release.yml b/.github/workflows/build-latest-release.ymlindex 86d7fd04..2a9e039b 100644--- a/.github/workflows/build-latest-release.yml+++ b/.github/workflows/build-latest-release.yml@@ -25,9 +25,9 @@ jobs:node-version: '20'cache: 'npm'- run: npm ci- - run: npm run lint- - run: npx tsc --noEmit- - run: npm test+ - run: npm run lint -w @colota/mobile+ - run: npx -w @colota/mobile tsc --noEmit+ - run: npm test -w @colota/mobilebuild-and-release:name: Build & Update Latest@@ -35,7 +35,7 @@ jobs:runs-on: ubuntu-latestpermissions:contents: write-+steps:- name: Checkout codeuses: actions/checkout@v4@@ -58,7 +58,7 @@ jobs:- name: Create gradle.propertiesrun: |- cat <<EOF >> android/gradle.properties+ cat <<EOF >> apps/mobile/android/gradle.propertiesorg.gradle.jvmargs=-Xmx4096m -XX:MaxMetaspaceSize=512mandroid.useAndroidX=trueandroid.enableJetifier=true@@ -75,28 +75,24 @@ jobs:- name: Decode keystoreenv:KEYSTORE_BASE64: ${{ secrets.KEYSTORE_BASE64 }}- run: echo $KEYSTORE_BASE64 | base64 -d > android/app/release.keystore-+ run: echo $KEYSTORE_BASE64 | base64 -d > apps/mobile/android/app/release.keystore- name: Validate signing inputsrun: |- test -f android/app/release.keystore || (echo "Keystore missing" && exit 1)+ test -f apps/mobile/android/app/release.keystore || (echo "Keystore missing" && exit 1)test -n "${{ secrets.KEYSTORE_PASSWORD }}" || exit 1test -n "${{ secrets.KEY_ALIAS }}" || exit 1test -n "${{ secrets.KEY_PASSWORD }}" || exit 1-- name: Build Release APKrun: |- cd android+ cd apps/mobile/androidchmod +x gradlew- # Gradle heap explicitly set here to avoid OOM./gradlew assembleRelease --no-daemon \-PhermesEnabled=true \-Pandroid.useAndroidX=true \-Dorg.gradle.jvmargs="-Xmx4096m -XX:MaxMetaspaceSize=512m"-- name: Update Latest Tagrun: |git config --global user.name "github-actions[bot]"@@ -115,7 +111,7 @@ jobs:draft: falseprerelease: truefiles: |- android/app/build/outputs/apk/release/app-release.apk+ apps/mobile/android/app/build/outputs/apk/release/app-release.apkenv:GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}@@ -123,6 +119,5 @@ jobs:if: always()run: |echo "Cleaning up sensitive files..."- rm -f android/app/release.keystore- rm -f android/gradle.properties-+ rm -f apps/mobile/android/app/release.keystore+ rm -f apps/mobile/android/gradle.propertiesdiff --git a/.github/workflows/build-release.yml b/.github/workflows/build-release.ymlindex 427c4a9e..6936a9de 100644--- a/.github/workflows/build-release.yml+++ b/.github/workflows/build-release.yml@@ -23,9 +23,9 @@ jobs:node-version: '20'cache: 'npm'- run: npm ci- - run: npm run lint- - run: npx tsc --noEmit- - run: npm test+ - run: npm run lint -w @colota/mobile+ - run: npx -w @colota/mobile tsc --noEmit+ - run: npm test -w @colota/mobilebuild-and-release:name: Build & Publish Release@@ -56,7 +56,7 @@ jobs:- name: Create gradle.propertiesrun: |- cat <<EOF >> android/gradle.properties+ cat <<EOF >> apps/mobile/android/gradle.propertiesorg.gradle.jvmargs=-Xmx4096m -XX:MaxMetaspaceSize=512mandroid.useAndroidX=trueandroid.enableJetifier=true@@ -73,18 +73,18 @@ jobs:- name: Decode keystoreenv:KEYSTORE_BASE64: ${{ secrets.KEYSTORE_BASE64 }}- run: echo $KEYSTORE_BASE64 | base64 -d > android/app/release.keystore+ run: echo $KEYSTORE_BASE64 | base64 -d > apps/mobile/android/app/release.keystore- name: Validate signing inputsrun: |- test -f android/app/release.keystore || (echo "Keystore missing" && exit 1)+ test -f apps/mobile/android/app/release.keystore || (echo "Keystore missing" && exit 1)test -n "${{ secrets.KEYSTORE_PASSWORD }}" || exit 1test -n "${{ secrets.KEY_ALIAS }}" || exit 1test -n "${{ secrets.KEY_PASSWORD }}" || exit 1- name: Build Release APKrun: |- cd android+ cd apps/mobile/androidchmod +x gradlew./gradlew assembleRelease --no-daemon \-PhermesEnabled=true \@@ -95,5 +95,5 @@ jobs:if: always()run: |echo "Cleaning up sensitive files..."- rm -f android/app/release.keystore- rm -f android/gradle.properties+ rm -f apps/mobile/android/app/release.keystore+ rm -f apps/mobile/android/gradle.propertiesdiff --git a/.github/workflows/lint-test.yml b/.github/workflows/lint-test.ymlindex 9863f46d..79465958 100644--- a/.github/workflows/lint-test.yml+++ b/.github/workflows/lint-test.yml@@ -15,7 +15,7 @@ jobs:lint-and-test:name: Lint & Testruns-on: ubuntu-latest-+steps:- name: Checkout codeuses: actions/checkout@v4@@ -30,17 +30,17 @@ jobs:run: npm ci- name: Run ESLint- run: npm run lint+ run: npm run lint -w @colota/mobile- name: Run TypeScript check- run: npx tsc --noEmit+ run: npx -w @colota/mobile tsc --noEmit- name: Run tests- run: npm test -- --coverage+ run: npm test -w @colota/mobile -- --coverage- name: Upload coverageuses: codecov/codecov-action@v3with:- files: ./coverage/lcov.info+ files: ./apps/mobile/coverage/lcov.infoflags: unittests- name: codecov-umbrella\ No newline at end of file+ name: codecov-umbrelladiff --git a/.gitignore b/.gitignoreindex 999ac420..cf52f155 100644--- a/.gitignore+++ b/.gitignore@@ -1,6 +1,3 @@-# iOS (not used - Android only)-ios/-# OSX.DS_Store@@ -12,8 +9,8 @@ local.properties*.iml*.hprof.cxx/-android/gradle.properties-android/local.properties+**/gradle.properties+**/local.properties.kotlin/# Android Keystores@@ -22,16 +19,13 @@ android/local.propertieskeystore.propertieskey.properties!debug.keystore-/android/app/release.keystore-/android/keystores/# Node.jsnode_modules/npm-debug.logyarn-error.log-# Ruby / CocoaPods (not used)-Gemfile+# Ruby / CocoaPods.bundle/**/Pods//vendor/bundle/@@ -43,7 +37,7 @@ Gemfile*.jsbundle# Testing-/coverage+coverage/# Yarn.yarn/*@@ -54,4 +48,4 @@ Gemfile!.yarn/versions# Misc-testers\ No newline at end of file+testersdiff --git a/README.md b/README.mdindex 5c8f1f34..b0271294 100644--- a/README.md+++ b/README.md@@ -120,11 +120,11 @@ Colota sends your location to your own server over HTTP(S). It works offline, sugit clone https://github.com/dietrichmax/colota.gitcd colotanpm install-cd android+cd apps/mobile/android./gradlew assembleRelease```-APK will be in `android/app/build/outputs/apk/release/`+APK will be in `apps/mobile/android/app/build/outputs/apk/release/`---diff --git a/android/app/src/main/assets/openlayers/ol.js b/android/app/src/main/assets/openlayers/ol.jsdeleted file mode 100644index 2cfb704e..00000000--- a/android/app/src/main/assets/openlayers/ol.js+++ /dev/null@@ -1,2 +0,0 @@-var ol=function(){"use strict";var t="add",e="remove",i="propertychange",n="change",r="error",s="contextmenu",o="click",a="dblclick",l="dragenter",h="dragover",c="drop",u="keydown",d="keypress",g="load",f="touchmove",p="wheel";class _{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}}function m(t,e,i){let n,r;i=i||y;let s=0,o=t.length,a=!1;for(;s<o;)n=s+(o-s>>1),r=+i(t[n],e),r<0?s=n+1:(o=n,a=!r);return a?s:~s}function y(t,e){return t>e?1:t<e?-1:0}function x(t,e){return t<e?1:t>e?-1:0}function v(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 S(t,e,i){for(;e<i;){const n=t[e];t[e]=t[i],t[i]=n,++e,--i}}function E(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 w(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 T(t,e,i){const n=e||y;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 C(){return!0}function b(){return!1}function R(){}function P(t){let e,i,n;return function(){const r=Array.prototype.slice.call(arguments);return i&&this===n&&w(r,i)||(n=this,i=r,e=t.apply(this,arguments)),e}}function I(t){return function(){let e;try{e=t()}catch(t){return Promise.reject(t)}return e instanceof Promise?e:Promise.resolve(e)}()}function F(t){for(const e in t)delete t[e]}function L(t){let e;for(e in t)return!1;return!e}class M{constructor(t){this.propagationStopped,this.defaultPrevented,this.type=t,this.target=null}preventDefault(){this.defaultPrevented=!0}stopPropagation(){this.propagationStopped=!0}}function A(t){t.stopPropagation()}class O extends _{constructor(t){super(),this.eventTarget_=t,this.pendingRemovals_=null,this.dispatching_=null,this.listeners_=null}addEventListener(t,e){if(!t||!e)return;const i=this.listeners_||(this.listeners_={}),n=i[t]||(i[t]=[]);n.includes(e)||n.push(e)}dispatchEvent(t){const e="string"==typeof t,i=e?t:t.type,n=this.listeners_&&this.listeners_[i];if(!n)return;const r=e?new M(t):t;r.target||(r.target=this.eventTarget_||this);const s=this.dispatching_||(this.dispatching_={}),o=this.pendingRemovals_||(this.pendingRemovals_={});let a;i in s||(s[i]=0,o[i]=0),++s[i];for(let t=0,e=n.length;t<e;++t)if(a="handleEvent"in n[t]?n[t].handleEvent(r):n[t].call(this,r),!1===a||r.propagationStopped){a=!1;break}if(0==--s[i]){let t=o[i];for(delete o[i];t--;)this.removeEventListener(i,R);delete s[i]}return a}disposeInternal(){this.listeners_&&F(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]=R,++this.pendingRemovals_[t]):(i.splice(n,1),0===i.length&&delete this.listeners_[t]))}}function D(t,e,i,n,r){if(r){const r=i;i=function(s){return t.removeEventListener(e,i),r.call(n??this,s)}}else n&&n!==t&&(i=i.bind(n));const s={target:t,type:e,listener:i};return t.addEventListener(e,i),s}function N(t,e,i,n){return D(t,e,i,n,!0)}function k(t){t&&t.target&&(t.target.removeEventListener(t.type,t.listener),F(t))}class G extends O{constructor(){super(),this.on=this.onInternal,this.once=this.onceInternal,this.un=this.unInternal,this.revision_=0}changed(){++this.revision_,this.dispatchEvent(n)}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]=D(this,t[r],e);return n}return D(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]=N(this,t[r],e)}else i=N(this,t,e);return e.ol_key=i,i}unInternal(t,e){const i=e.ol_key;if(i)j(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 j(t){if(Array.isArray(t))for(let e=0,i=t.length;e<i;++e)k(t[e]);else k(t)}function U(){throw new Error("Unimplemented abstract method.")}G.prototype.on,G.prototype.once,G.prototype.un;let B=0;function z(t){return t.ol_uid||(t.ol_uid=String(++B))}class X extends M{constructor(t,e,i){super(t),this.key=e,this.oldValue=i}}class V extends G{constructor(t){super(),this.on,this.once,this.un,z(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 X(n,t,e)),n=i,this.hasListener(n)&&this.dispatchEvent(new X(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],L(this.values_)&&(this.values_=null),e||this.notify(t,i)}}}const $="length";class W extends M{constructor(t,e,i){super(t),this.element=e,this.index=i}}class Z extends V{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($)}insertAt(e,i){if(e<0||e>this.getLength())throw new Error("Index out of bounds: "+e);this.unique_&&this.assertUnique_(i),this.array_.splice(e,0,i),this.updateLength_(),this.dispatchEvent(new W(t,i,e))}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 i=this.array_[t];return this.array_.splice(t,1),this.updateLength_(),this.dispatchEvent(new W(e,i,t)),i}setAt(i,n){if(i>=this.getLength())return void this.insertAt(i,n);if(i<0)throw new Error("Index out of bounds: "+i);this.unique_&&this.assertUnique_(n,i);const r=this.array_[i];this.array_[i]=n,this.dispatchEvent(new W(e,r,i)),this.dispatchEvent(new W(t,n,i))}updateLength_(){this.set($,this.array_.length)}assertUnique_(t,e){const i=this.array_;for(let n=0,r=i.length;n<r;++n)if(i[n]===t&&n!==e)throw new Error("Duplicate item added to a unique collection")}}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 O{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(n)}release(){this.setState(J)}getKey(){return this.key+"/"+this.tileCoord}getTileCoord(){return this.tileCoord}getState(){return this.state}setState(t){if(this.state!==J){if(this.state!==q&&this.state>t)throw new Error("Tile load sequence violation");this.state=t,this.changed()}}load(){U()}getAlpha(t,e){if(!this.transition_)return 1;let i=this.transitionStarts_[t];if(i){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("safari")&&!rt.includes("chrom"),ot=st&&(rt.includes("version/15.4")||/cpu (os|iphone os) 15_4 like mac os x/.test(rt)),at=rt.includes("webkit")&&!rt.includes("edge"),lt=rt.includes("macintosh"),ht="undefined"!=typeof devicePixelRatio?devicePixelRatio:1,ct="undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof OffscreenCanvas&&self instanceof WorkerGlobalScope,ut="undefined"!=typeof Image&&Image.prototype.decode,dt="function"==typeof createImageBitmap,gt=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 ft(t,e,i,n){let r;return r=i&&i.length?i.shift():ct?new class extends OffscreenCanvas{style={}}(t??300,e??150):document.createElement("canvas"),t&&(r.width=t),e&&(r.height=e),r.getContext("2d",n)}let pt;function _t(){return pt||(pt=ft(1,1)),pt}function mt(t){const e=t.canvas;e.width=1,e.height=1,t.clearRect(0,0,1,1)}function yt(t){let e=t.offsetWidth;const i=getComputedStyle(t);return e+=parseInt(i.marginLeft,10)+parseInt(i.marginRight,10),e}function xt(t){let e=t.offsetHeight;const i=getComputedStyle(t);return e+=parseInt(i.marginTop,10)+parseInt(i.marginBottom,10),e}function vt(t,e){const i=e.parentNode;i&&i.replaceChild(t,e)}function St(t){for(;t.lastChild;)t.lastChild.remove()}function Et(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 wt(){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 Tt(t){return"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof OffscreenCanvas&&t instanceof OffscreenCanvas}function Ct(t){return t instanceof Image||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageBitmap?t:null}function bt(t){return t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Float32Array||t instanceof DataView?t:null}const Rt=new Error("disposed");let Pt=null;function It(t){Pt||(Pt=ft(t.width,t.height,void 0,{willReadFrequently:!0}));const e=Pt.canvas,i=t.width;e.width!==i&&(e.width=i);const n=t.height;return e.height!==n&&(e.height=n),Pt.clearRect(0,0,i,n),Pt.drawImage(t,0,0),Pt.getImageData(0,0,i,n).data}const Ft=[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=Ct(this.data_);return t?[t.width,t.height]:Ft}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 Mt(t,e){if(!t)throw new Error(e)}class At extends V{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 At(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_&&(k(this.geometryChangeKey_),this.geometryChangeKey_=null);const t=this.getGeometry();t&&(this.geometryChangeKey_=D(t,n,this.handleGeometryChange_,this)),this.changed()}setGeometry(t){this.set(this.geometryName_,t)}setStyle(t){this.style_=t,this.styleFunction_=t?Ot(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 Ot(t){if("function"==typeof t)return t;let e;if(Array.isArray(t))e=t;else{Mt("function"==typeof t.getZIndex,"Expected an `ol/style/Style` or an array of `ol/style/Style.js`");e=[t]}return function(){return e}}var Dt=0,Nt=1,kt=2,Gt=4,jt=8,Ut=16;function Bt(t){const e=Ht();for(let i=0,n=t.length;i<n;++i)ne(e,t[i]);return e}function zt(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 Xt(t,e){return e?(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e):t.slice()}function Vt(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 $t(t,e){return Zt(t,e[0],e[1])}function Wt(t,e){return t[0]<=e[0]&&e[2]<=t[2]&&t[1]<=e[1]&&e[3]<=t[3]}function Zt(t,e,i){return t[0]<=e&&e<=t[2]&&t[1]<=i&&i<=t[3]}function Yt(t,e){const i=t[0],n=t[1],r=t[2],s=t[3],o=e[0],a=e[1];let l=Dt;return o<i?l|=Ut:o>r&&(l|=Gt),a<n?l|=jt:a>s&&(l|=kt),l===Dt&&(l=Nt),l}function Ht(){return[1/0,1/0,-1/0,-1/0]}function Kt(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 qt(t){return Kt(1/0,1/0,-1/0,-1/0,t)}function Jt(t,e){const i=t[0],n=t[1];return Kt(i,n,i,n,e)}function Qt(t,e,i,n,r){return se(qt(r),t,e,i,n)}function te(t,e){return t[0]==e[0]&&t[2]==e[2]&&t[1]==e[1]&&t[3]==e[3]}function ee(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 ie(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 ne(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 re(t,e){for(let i=0,n=e.length;i<n;++i)ne(t,e[i]);return t}function se(t,e,i,n,r){for(;i<n;i+=r)ae(t,e[i],e[i+1]);return t}function oe(t,e){for(let i=0,n=e.length;i<n;++i)re(t,e[i]);return t}function ae(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 le(t,e){let i;return i=e(ce(t)),i||(i=e(ue(t)),i||(i=e(xe(t)),i||(i=e(ye(t)),i||!1)))}function he(t){let e=0;return Ee(t)||(e=ve(t)*_e(t)),e}function ce(t){return[t[0],t[1]]}function ue(t){return[t[2],t[1]]}function de(t){return[(t[0]+t[2])/2,(t[1]+t[3])/2]}function ge(t,e){let i;if("bottom-left"===e)i=ce(t);else if("bottom-right"===e)i=ue(t);else if("top-left"===e)i=ye(t);else{if("top-right"!==e)throw new Error("Invalid corner");i=xe(t)}return i}function fe(t,e,i,n,r){const[s,o,a,l,h,c,u,d]=pe(t,e,i,n);return Kt(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 pe(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 _e(t){return t[3]-t[1]}function me(t,e,i){const n=i||[1/0,1/0,-1/0,-1/0];return Se(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]):qt(n),n}function ye(t){return[t[0],t[3]]}function xe(t){return[t[2],t[3]]}function ve(t){return t[2]-t[0]}function Se(t,e){return t[0]<=e[2]&&t[2]>=e[0]&&t[1]<=e[3]&&t[3]>=e[1]}function Ee(t){return t[2]<t[0]||t[3]<t[1]}function we(t,e){return e?(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e):t}function Te(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 Ce(t,e,i){let n=!1;const r=Yt(t,e),s=Yt(t,i);if(r===Nt||s===Nt)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,_;s&kt&&!(r&kt)&&(p=d-(g-h)/f,n=p>=o&&p<=l),n||!(s&Gt)||r&Gt||(_=g-(d-l)*f,n=_>=a&&_<=h),n||!(s&jt)||r&jt||(p=d-(g-a)/f,n=p>=o&&p<=l),n||!(s&Ut)||r&Ut||(_=g-(d-o)*f,n=_>=a&&_<=h)}return n}function be(t,e,i,n){if(Ee(t))return qt(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 Kt(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 Re(t,e){const i=e.getExtent(),n=de(t);if(e.canWrapX()&&(n[0]<i[0]||n[0]>=i[2])){const e=ve(i),r=Math.floor((n[0]-i[0])/e)*e;t[0]-=r,t[2]-=r}return t}function Pe(t,e,i){if(e.canWrapX()){const n=e.getExtent();if(!isFinite(t[0])||!isFinite(t[2]))return[[n[0],t[1],n[2],t[3]]];Re(t,e);const r=ve(n);if(ve(t)>r&&!i)return[[n[0],t[1],n[2],t[3]]];if(t[0]<n[0])return[[t[0]+r,t[1],n[2],t[3]],[n[0],t[1],t[2],t[3]]];if(t[2]>n[2])return[[t[0],t[1],n[2],t[3]],[n[0],t[1],t[2]-r,t[3]]]}return[t]}function Ie(t,e,i){return Math.min(Math.max(t,e),i)}function Fe(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 Le(t,e,i,n)}function Le(t,e,i,n){const r=i-t,s=n-e;return r*r+s*s}function Me(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 Ae(t){return 180*t/Math.PI}function Oe(t){return t*Math.PI/180}function De(t,e){const i=t%e;return i*e<0?i+e:i}function Ne(t,e,i){return t+i*(e-t)}function ke(t,e){const i=Math.pow(10,e);return Math.round(t*i)/i}function Ge(t,e){return Math.round(ke(t,e))}function je(t,e){return Math.floor(ke(t,e))}function Ue(t,e){return Math.ceil(ke(t,e))}function Be(t,e,i){if(t>=e&&t<i)return t;const n=i-e;return((t-e)%n+n)%n+e}const ze=6371008.8;function Xe(t,e,i){i=i||ze;const n=Oe(t[1]),r=Oe(e[1]),s=(r-n)/2,o=Oe(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 Ve(t,e){let i=0;for(let n=0,r=t.length;n<r-1;++n)i+=Xe(t[n],t[n+1],e);return i}function $e(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+=Oe(n-r)*(2+Math.sin(Oe(s))+Math.sin(Oe(o))),r=n,s=o}return i*e*e/2}function We(t,e,i,n){n=n||ze;const r=Oe(t[1]),s=Oe(t[0]),o=e/n,a=Math.asin(Math.sin(r)*Math.cos(o)+Math.cos(r)*Math.sin(o)*Math.cos(i));return[Ae(s+Math.atan2(Math.sin(i)*Math.sin(o)*Math.cos(r),Math.cos(o)-Math.sin(r)*Math.sin(a))),Ae(a)]}const Ze={info:1,warn:2,error:3,none:4};let Ye=Ze.info;function He(...t){Ye>Ze.warn||console.warn(...t)}function Ke(...t){Ye>Ze.error||console.error(...t)}function qe(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 Je(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 Qe(t,e){return t[0]+=+e[0],t[1]+=+e[1],t}function ti(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 ei(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 ii(t,e,i){const n=De(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=ke(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+=" "+qe(a,2)+"′"),0!==l&&(h+=" "+qe(l,2,s)+"″"),0!==n&&(h+=" "+t.charAt(n<0?1:0)),h}function ni(t,e,i){return t?e.replace("{x}",t[0].toFixed(i)).replace("{y}",t[1].toFixed(i)):""}function ri(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 si(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 oi(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 li(t,e){return Math.sqrt(ai(t,e))}function hi(t,e){return ai(t,ei(t,e))}function ci(t,e){return ni(t,"{x}, {y}",e)}function ui(t,e){if(e.canWrapX()){const i=ve(e.getExtent()),n=di(t,e,i);n&&(t[0]-=n*i)}return t}function di(t,e,i){const n=e.getExtent();let r=0;return e.canWrapX()&&(t[0]<n[0]||t[0]>n[2])&&(i=i||ve(n),r=Math.floor((t[0]-n[0])/i)),r}function gi(t,e,i){const n=Math.sqrt((e[0]-t[0])*(e[0]-t[0])+(e[1]-t[1])*(e[1]-t[1])),r=[(e[0]-t[0])/n,(e[1]-t[1])/n],s=[-r[1],r[0]],o=Math.sqrt((i[0]-t[0])*(i[0]-t[0])+(i[1]-t[1])*(i[1]-t[1])),a=[(i[0]-t[0])/o,(i[1]-t[1])/o];let l=0===n||0===o?0:Math.acos(Ie(a[0]*r[0]+a[1]*r[1],-1,1));l=Math.max(l,1e-5);return a[0]*s[0]+a[1]*s[1]>0?l:2*Math.PI-l}const fi={9001:"m",9002:"ft",9003:"us-ft",9101:"radians",9102:"degrees"};function pi(t){return fi[t]}const _i={radians:6370997/(2*Math.PI),degrees:2*Math.PI*6370997/360,ft:.3048,m:1,"us-ft":1200/3937};class mi{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_||_i[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 yi=6378137,xi=Math.PI*yi,vi=[-xi,-xi,xi,xi],Si=[-180,-85,180,85],Ei=yi*Math.log(Math.tan(Math.PI/2));class wi extends mi{constructor(t){super({code:t,units:"m",extent:vi,global:!0,worldExtent:Si,getPointResolution:function(t,e){return t/Math.cosh(e[1]/yi)}})}}const Ti=[new wi("EPSG:3857"),new wi("EPSG:102100"),new wi("EPSG:102113"),new wi("EPSG:900913"),new wi("http://www.opengis.net/def/crs/EPSG/0/3857"),new wi("http://www.opengis.net/gml/srs/epsg.xml#3857")];function Ci(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]=xi*t[i]/180;let n=yi*Math.log(Math.tan(Math.PI*(+t[i+1]+90)/360));n>Ei?n=Ei:n<-Ei&&(n=-Ei),e[i+1]=n}return e}function bi(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]/xi,e[i+1]=360*Math.atan(Math.exp(t[i+1]/yi))/Math.PI-90;return e}const Ri=6378137,Pi=[-180,-90,180,90],Ii=Math.PI*Ri/180;class Fi extends mi{constructor(t,e){super({code:t,units:"degrees",extent:Pi,axisOrientation:e,global:!0,metersPerUnit:Ii,worldExtent:Pi})}}const Li=[new Fi("CRS:84"),new Fi("EPSG:4326","neu"),new Fi("urn:ogc:def:crs:OGC:1.3:CRS84"),new Fi("urn:ogc:def:crs:OGC:2:84"),new Fi("http://www.opengis.net/def/crs/OGC/1.3/CRS84"),new Fi("http://www.opengis.net/gml/srs/epsg.xml#4326","neu"),new Fi("http://www.opengis.net/def/crs/EPSG/0/4326","neu")];let Mi={};function Ai(){Mi={}}function Oi(t){return Mi[t]||Mi[t.replace(/urn:(x-)?ogc:def:crs:EPSG:(.*:)?(\w+)$/,"EPSG:$3")]||null}function Di(t,e){Mi[t]=e}let Ni={};function ki(){Ni={}}function Gi(t,e,i){const n=t.getCode(),r=e.getCode();n in Ni||(Ni[n]={}),Ni[n][r]=i}function ji(t,e){return t in Ni&&e in Ni[t]?Ni[t][e]:null}const Ui=.9996,Bi=.00669438,zi=Bi*Bi,Xi=zi*Bi,Vi=Bi/(1-Bi),$i=Math.sqrt(1-Bi),Wi=(1-$i)/(1+$i),Zi=Wi*Wi,Yi=Zi*Wi,Hi=Yi*Wi,Ki=Hi*Wi,qi=.9983242984503243,Ji=15*zi/256+45*Xi/1024,Qi=35*Xi/3072,tn=1.5*Wi-27/32*Yi+269/512*Ki,en=21/16*Zi-55/32*Hi,nn=151/96*Yi-417/128*Ki,rn=1097/512*Hi,sn=6378137;function on(t,e,i){const n=t-5e5,r=(i.north?e:e-1e7)/Ui/(sn*qi),s=r+tn*Math.sin(2*r)+en*Math.sin(4*r)+nn*Math.sin(6*r)+rn*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-Bi*a,g=Math.sqrt(1-Bi*a),f=Vi*l**2,p=f*f,_=n/(sn/g*Ui),m=_*_,y=m*_,x=y*_,v=x*_,S=s-h/((1-Bi)/d)*(m/2-x/24*(5+3*c+10*f-4*p-9*Vi))+v*_/720*(61+90*c+298*f+45*u-252*Vi-3*p);let E=(_-y/6*(1+2*c+f)+v/120*(5-2*f+28*c-3*p+8*Vi+24*u))/l;return E=Be(E+Oe(ln(i.number)),-Math.PI,Math.PI),[Ae(E),Ae(S)]}function an(t,e,i){t=Be(t,-180,180),e<-80?e=-80:e>84&&(e=84);const n=Oe(e),r=Math.sin(n),s=Math.cos(n),o=r/s,a=o*o,l=a*a,h=Oe(t),c=Oe(ln(i.number)),u=sn/Math.sqrt(1-Bi*r**2),d=Vi*s**2,g=s*Be(h-c,-Math.PI,Math.PI),f=g*g,p=f*g,_=p*g,m=_*g,y=m*g,x=sn*(qi*n-.002514607064228144*Math.sin(2*n)+Ji*Math.sin(4*n)-Qi*Math.sin(6*n)),v=Ui*u*(g+p/6*(1-a+d)+m/120*(5-18*a+l+72*d-58*Vi))+5e5;let S=Ui*(x+u*o*(f/2+_/24*(5-a+9*d+4*d**2)+y/720*(61-58*a+l+600*d-330*Vi)));return i.north||(S+=1e7),[v,S]}function ln(t){return 6*(t-1)-180+3}const hn=[/^EPSG:(\d+)$/,/^urn:ogc:def:crs:EPSG::(\d+)$/,/^http:\/\/www\.opengis\.net\/def\/crs\/EPSG\/0\/(\d+)$/];function cn(t){let e=0;for(const i of hn){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 un(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 dn(t){return cn(t)?new mi({code:t,units:"m"}):null}function gn(t){const e=cn(t.getCode());return e?{forward:un(an,e),inverse:un(on,e)}:null}const fn=[gn],pn=[dn];let _n=!0;function mn(t){_n=!(void 0===t||t)}function yn(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 xn(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 vn(t){Di(t.getCode(),t),Gi(t,t,yn)}function Sn(t){t.forEach(vn)}function En(t){if("string"!=typeof t)return t;const e=Oi(t);if(e)return e;for(const e of pn){const i=e(t);if(i)return i}return null}function wn(t,e,i,n){let r;const s=(t=En(t)).getPointResolutionFunc();if(s){if(r=s(e,i),n&&n!==t.getUnits()){const e=t.getMetersPerUnit();e&&(r=r*e/_i[n])}}else{const s=t.getUnits();if("degrees"==s&&!n||"degrees"==n)r=e;else{const o=Ln(t,En("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=(Xe(t.slice(0,2),t.slice(2,4))+Xe(t.slice(4,6),t.slice(6,8)))/2}else r=e*t.getMetersPerUnit();const a=n?_i[n]:t.getMetersPerUnit();void 0!==a&&(r/=a)}}return r}function Tn(t){Sn(t),t.forEach((function(e){t.forEach((function(t){e!==t&&Gi(e,t,yn)}))}))}function Cn(t,e,i,n){t.forEach((function(t){e.forEach((function(e){Gi(t,e,i),Gi(e,t,n)}))}))}function bn(t,e){return t?"string"==typeof t?En(t):t:En(e)}function Rn(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 Pn(t,e,i,n){const r=En(t),s=En(e);Gi(r,s,Rn(i)),Gi(s,r,Rn(n))}function In(t,e){const i=On(t,void 0!==e?e:"EPSG:3857","EPSG:4326"),n=i[0];return(n<-180||n>180)&&(i[0]=De(n+180,360)-180),i}function Fn(t,e){if(t===e)return!0;const i=t.getUnits()===e.getUnits();if(t.getCode()===e.getCode())return i;return Ln(t,e)===yn&&i}function Ln(t,e){const i=t.getCode(),n=e.getCode();let r=ji(i,n);if(r)return r;let s=null,o=null;for(const i of fn)s||(s=i(t)),o||(o=i(e));if(!s&&!o)return null;const a="EPSG:4326";if(o)if(s)r=Mn(s.inverse,o.forward);else{const t=ji(i,a);t&&(r=Mn(t,o.forward))}else{const t=ji(a,n);t&&(r=Mn(s.inverse,t))}return r&&(vn(t),vn(e),Gi(t,e,r)),r}function Mn(t,e){return function(i,n,r,s){return n=t(i,n,r,s),e(n,n,r,s)}}function An(t,e){return Ln(En(t),En(e))}function On(t,e,i){const n=An(e,i);if(!n){const t=En(e).getCode(),n=En(i).getCode();throw new Error(`No transform available between ${t} and ${n}`)}return n(t,void 0,t.length)}function Dn(t,e,i,n){return be(t,An(e,i),void 0,n)}let Nn=null;function kn(t){Nn=En(t)}function Gn(){return Nn}function jn(t,e){return Nn?On(t,e,Nn):t}function Un(t,e){return Nn?On(t,Nn,e):(_n&&!ri(t,[0,0])&&t[0]>=-180&&t[0]<=180&&t[1]>=-90&&t[1]<=90&&(_n=!1,He("Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.")),t)}function Bn(t,e){return Nn?Dn(t,e,Nn):t}function zn(t,e){return Nn?Dn(t,Nn,e):t}function Xn(t,e){if(!Nn)return t;const i=En(e).getMetersPerUnit(),n=Nn.getMetersPerUnit();return i&&n?t*i/n:t}function Vn(t,e){if(!Nn)return t;const i=En(e).getMetersPerUnit(),n=Nn.getMetersPerUnit();return i&&n?t*n/i:t}function $n(t,e,i){return function(n){let r,s;if(t.canWrapX()){const e=t.getExtent(),o=ve(e);s=di(n=n.slice(0),t,o),s&&(n[0]=n[0]-s*o),n[0]=Ie(n[0],e[0],e[2]),n[1]=Ie(n[1],e[1],e[3]),r=i(n)}else r=i(n);return s&&e.canWrapX()&&(r[0]+=s*ve(e.getExtent())),r}}function Wn(){Tn(Ti),Tn(Li),Cn(Li,Ti,Ci,bi)}Wn();const Zn=new Array(6);function Yn(){return[1,0,0,1,0,0]}function Hn(t){return qn(t,1,0,0,1,0,0)}function Kn(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 qn(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 Jn(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 Qn(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 tr(t,e){const i=Math.cos(e),n=Math.sin(e);return Kn(t,qn(Zn,i,n,-n,i,0,0))}function er(t,e,i){return Kn(t,qn(Zn,e,0,0,i,0,0))}function ir(t,e,i){return Kn(t,qn(Zn,1,0,0,1,e,i))}function nr(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 rr(t,e){const i=sr(e);Mt(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 sr(t){return t[0]*t[3]-t[1]*t[2]}const or=[1e5,1e5,1e5,1e5,2,2];function ar(t){return"matrix("+t.join(", ")+")"}function lr(t){return t.substring(7,t.length-1).split(",").map(parseFloat)}function hr(t,e){const i=lr(t),n=lr(e);for(let t=0;t<6;++t)if(0!==Math.round((i[t]-n[t])*or[t]))return!1;return!0}function cr(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 ur(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 dr(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 gr(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}const fr=[1,0,0,1,0,0],pr=[NaN,NaN];class _r extends V{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 U()}closestPointXY(t,e,i,n){return U()}containsXY(t,e){return 0===this.closestPointXY(t,e,pr,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 U()}getExtent(t){if(this.extentRevision_!=this.getRevision()){const t=this.computeExtent(this.extent_);(isNaN(t[0])||isNaN(t[1]))&&qt(t),this.extentRevision_=this.getRevision()}return we(this.extent_,t)}rotate(t,e){U()}scale(t,e,i){U()}simplify(t){return this.getSimplifiedGeometry(t*t)}getSimplifiedGeometry(t){return U()}getType(){return U()}applyTransform(t){U()}intersectsExtent(t){return U()}translate(t,e){U()}transform(t,e){const i=En(t),n="tile-pixels"==i.getUnits()?function(t,n,r){const s=i.getExtent(),o=i.getWorldExtent(),a=_e(o)/_e(s);nr(fr,o[0],o[3],a,-a,0,0,0);const l=cr(t,0,t.length,r,fr,n),h=An(i,e);return h?h(l,l,r):l}:An(i,e);return this.applyTransform(n),this}}class mr extends _r{constructor(){super(),this.layout="XY",this.stride=2,this.flatCoordinates}computeExtent(t){return Qt(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t)}getCoordinates(){return U()}getFirstCoordinate(){return this.flatCoordinates.slice(0,this.stride)}getFlatCoordinates(){return this.flatCoordinates}getLastCoordinate(){return this.flatCoordinates.slice(this.flatCoordinates.length-this.stride)}getLayout(){return this.layout}getSimplifiedGeometry(t){if(this.simplifiedGeometryRevision!==this.getRevision()&&(this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=this.getRevision()),t<0||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=xr(t),this.layout=t,this.flatCoordinates=e}setCoordinates(t,e){U()}setLayout(t,e,i){let n;if(t)n=xr(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=yr(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();ur(i,0,i.length,n,t,e,i),this.changed()}}scale(t,e,i){void 0===e&&(e=t),i||(i=de(this.getExtent()));const n=this.getFlatCoordinates();if(n){const r=this.getStride();dr(n,0,n.length,r,t,e,i,n),this.changed()}}translate(t,e){const i=this.getFlatCoordinates();if(i){const n=this.getStride();gr(i,0,i.length,n,t,e,i),this.changed()}}}function yr(t){let e;return 2==t?e="XY":3==t?e="XYZ":4==t&&(e="XYZM"),e}function xr(t){let e;return"XY"==t?e=2:"XYZ"==t||"XYM"==t?e=3:"XYZM"==t&&(e=4),e}function vr(t,e,i){const n=t.getFlatCoordinates();if(!n)return null;const r=t.getStride();return cr(n,0,n.length,r,e,i)}function Sr(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 Er(t,e,i,n){let r=0;for(let s=0,o=i.length;s<o;++s){const o=i[s];r+=Sr(t,e,o,n),e=o}return r}function wr(t,e,i,n){let r=0;for(let s=0,o=i.length;s<o;++s){const o=i[s];r+=Er(t,e,o,n),e=o[o.length-1]}return r}function Tr(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]=Ne(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 Cr(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=Le(s,o,i,n);a>r&&(r=a),s=i,o=n}return r}function br(t,e,i,n,r){for(let s=0,o=i.length;s<o;++s){const o=i[s];r=Cr(t,e,o,n,r),e=o}return r}function Rr(t,e,i,n,r){for(let s=0,o=i.length;s<o;++s){const o=i[s];r=br(t,e,o,n,r),e=o[o.length-1]}return r}function Pr(t,e,i,n,r,s,o,a,l,h,c){if(e==i)return h;let u,d;if(0===r){if(d=Le(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(Tr(t,g-n,g,n,o,a,c),d=Le(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&&(Tr(t,i-n,e,n,o,a,c),d=Le(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 Ir(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=Pr(t,e,d,n,r,s,o,a,l,h,c),e=d}return h}function Fr(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=Ir(t,e,d,n,r,s,o,a,l,h,c),e=d[d.length-1]}return h}function Lr(t,e,i,n){for(let n=0,r=i.length;n<r;++n)t[e++]=i[n];return e}function Mr(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 Ar(t,e,i,n,r){r=r||[];let s=0;for(let o=0,a=i.length;o<a;++o){const a=Mr(t,e,i[o],n);r[s++]=a,e=a}return r.length=s,r}function Or(t,e,i,n,r){r=r||[];let s=0;for(let o=0,a=i.length;o<a;++o){const a=Ar(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 Dr(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 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++]=Dr(t,e,a,n,r[s]),e=a}return r.length=s,r}function kr(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?[]:Nr(t,e,a,n,r[s]),e=a[a.length-1]}return r.length=s,r}function Gr(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=Fe(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 jr(t,e,i,n,r,s,o,a){for(let l=0,h=i.length;l<h;++l){const h=i[l];o=Gr(t,e,h,n,r,s,o),a.push(o),e=h}return o}function Ur(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],Le(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 Br(t,e){return e*Math.round(t/e)}function zr(t,e,i,n,r,s,o){if(e==i)return o;let a,l,h=Br(t[e],r),c=Br(t[e+1],r);e+=n,s[o++]=h,s[o++]=c;do{if(a=Br(t[e],r),l=Br(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=Br(t[e],r),u=Br(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 Xr(t,e,i,n,r,s,o,a){for(let l=0,h=i.length;l<h;++l){const h=i[l];o=zr(t,e,h,n,r,s,o),a.push(o),e=h}return o}function Vr(t,e,i,n,r,s,o,a){for(let l=0,h=i.length;l<h;++l){const h=i[l],c=[];o=Xr(t,e,h,n,r,s,o,c),a.push(c),e=h[h.length-1]}return o}class $r extends mr{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 $r(this.flatCoordinates.slice(),this.layout)}closestPointXY(t,e,i,n){return n<Vt(this.getExtent(),t,e)?n:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Cr(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Pr(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!0,t,e,i,n))}getArea(){return Sr(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinates(){return Dr(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getSimplifiedGeometryInternal(t){const e=[];return e.length=Gr(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e,0),new $r(e,"XY")}getType(){return"LinearRing"}intersectsExtent(t){return!1}setCoordinates(t,e){this.setLayout(e,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Mr(this.flatCoordinates,0,t,this.stride),this.changed()}}class Wr extends mr{constructor(t,e){super(),this.setCoordinates(t,e)}clone(){const t=new Wr(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(t,e,i,n){const r=this.flatCoordinates,s=Le(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 Jt(this.flatCoordinates,t)}getType(){return"Point"}intersectsExtent(t){return Zt(t,this.flatCoordinates[0],this.flatCoordinates[1])}setCoordinates(t,e){this.setLayout(e,t,0),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Lr(this.flatCoordinates,0,t,this.stride),this.changed()}}function Zr(t,e,i,n,r){return!le(r,(function(r){return!Yr(t,e,i,n,r[0],r[1])}))}function Yr(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 Hr(t,e,i,n,r,s){if(0===i.length)return!1;if(!Yr(t,e,i[0],n,r,s))return!1;for(let e=1,o=i.length;e<o;++e)if(Yr(t,i[e-1],i[e],n,r,s))return!1;return!0}function Kr(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(Hr(t,e,a,n,r,s))return!0;e=a[a.length-1]}return!1}function qr(t,e,i,n,r,s,o){let a,l,h,c,u,d,g;const f=r[s+1],p=[];for(let r=0,s=i.length;r<s;++r){const s=i[r];for(c=t[s-n],d=t[s-n+1],a=e;a<s;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,p.push(h)),c=u,d=g}let _=NaN,m=-1/0;for(p.sort(y),c=p[0],a=1,l=p.length;a<l;++a){u=p[a];const r=Math.abs(u-c);r>m&&(h=(c+u)/2,Hr(t,e,i,n,h,f)&&(_=h,m=r)),c=u}return isNaN(_)&&(_=r[s]),o?(o.push(_,f,m),o):[_,f,m]}function Jr(t,e,i,n,r){let s=[];for(let o=0,a=i.length;o<a;++o){const a=i[o];s=qr(t,e,a,n,r,2*o,s),e=a[a.length-1]}return s}function Qr(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 ts(t,e){const[i,n]=t,[r,s]=e,o=((i[0]-r[0])*(r[1]-s[1])-(i[1]-r[1])*(r[0]-s[0]))/((i[0]-n[0])*(r[1]-s[1])-(i[1]-n[1])*(r[0]-s[0])),a=((i[0]-r[0])*(i[1]-n[1])-(i[1]-r[1])*(i[0]-n[0]))/((i[0]-n[0])*(r[1]-s[1])-(i[1]-n[1])*(r[0]-s[0]));if(0<=o&&o<=1&&0<=a&&a<=1)return[i[0]+o*(n[0]-i[0]),i[1]+o*(n[1]-i[1])]}function es(t,e,i,n,r,s){return s=s??se([1/0,1/0,-1/0,-1/0],t,e,i,n),!!Se(r,s)&&(s[0]>=r[0]&&s[2]<=r[2]||s[1]>=r[1]&&s[3]<=r[3]||Qr(t,e,i,n,(function(t,e){return Ce(r,t,e)})))}function is(t,e,i,n,r){for(let s=0,o=i.length;s<o;++s){if(es(t,e,i[s],n,r))return!0;e=i[s]}return!1}function ns(t,e,i,n,r){return!!es(t,e,i,n,r)||(!!Yr(t,e,i,n,r[0],r[1])||(!!Yr(t,e,i,n,r[0],r[3])||(!!Yr(t,e,i,n,r[2],r[1])||!!Yr(t,e,i,n,r[2],r[3]))))}function rs(t,e,i,n,r){if(!ns(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)&&!es(t,i[e-1],i[e],n,r))return!1;return!0}function ss(t,e,i,n,r){for(let s=0,o=i.length;s<o;++s){const o=i[s];if(rs(t,e,o,n,r))return!0;e=o[o.length-1]}return!1}function os(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 as(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 ls(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=as(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 hs(t,e,i,n,r){for(let s=0,o=i.length;s<o;++s){const o=i[s];if(!ls(t,e,o,n,r))return!1;o.length&&(e=o[o.length-1])}return!0}function cs(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=as(t,e,o,n);(0===s?r&&a||!r&&!a:r&&!a||!r&&a)&&os(t,e,o,n),e=o}return e}function us(t,e,i,n,r){for(let s=0,o=i.length;s<o;++s)e=cs(t,e,i[s],n,r);return e}function ds(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=as(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 gs extends mr{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?E(this.flatCoordinates,t.getFlatCoordinates()):this.flatCoordinates=t.getFlatCoordinates().slice(),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){const t=new gs(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return t.applyProperties(this),t}closestPointXY(t,e,i,n){return n<Vt(this.getExtent(),t,e)?n:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(br(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Ir(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!0,t,e,i,n))}containsXY(t,e){return Hr(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,e)}getArea(){return Er(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride)}getCoordinates(t){let e;return void 0!==t?(e=this.getOrientedFlatCoordinates().slice(),cs(e,0,this.ends_,this.stride,t)):e=this.flatCoordinates,Nr(e,0,this.ends_,this.stride)}getEnds(){return this.ends_}getFlatInteriorPoint(){if(this.flatInteriorPointRevision_!=this.getRevision()){const t=de(this.getExtent());this.flatInteriorPoint_=qr(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,0),this.flatInteriorPointRevision_=this.getRevision()}return this.flatInteriorPoint_}getInteriorPoint(){return new Wr(this.getFlatInteriorPoint(),"XYM")}getLinearRingCount(){return this.ends_.length}getLinearRing(t){return t<0||this.ends_.length<=t?null:new $r(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 $r(e.slice(r,o),t);n.push(a),r=o}return n}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){const t=this.flatCoordinates;ls(t,0,this.ends_,this.stride)?this.orientedFlatCoordinates_=t:(this.orientedFlatCoordinates_=t.slice(),this.orientedFlatCoordinates_.length=cs(this.orientedFlatCoordinates_,0,this.ends_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(t){const e=[],i=[];return e.length=Xr(this.flatCoordinates,0,this.ends_,this.stride,Math.sqrt(t),e,0,i),new gs(e,"XY",i)}getType(){return"Polygon"}intersectsExtent(t){return rs(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,2),this.flatCoordinates||(this.flatCoordinates=[]);const i=Ar(this.flatCoordinates,0,t,this.stride,this.ends_);this.flatCoordinates.length=0===i.length?0:i[i.length-1],this.changed()}}function fs(t,e,i,n){i=i||32;const r=[];for(let s=0;s<i;++s)E(r,We(t,e,2*Math.PI*s/i,n));return r.push(r[0],r[1]),new gs(r,"XY",[r.length])}function ps(t){if(Ee(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 gs(s,"XY",[s.length])}function _s(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 gs(a,r,l);return ms(h,s,t.getRadius(),i),h}function ms(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*De(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 ys="accuracy",xs="accuracyGeometry",vs="altitude",Ss="altitudeAccuracy",Es="heading",ws="position",Ts="projection",Cs="speed",bs="tracking",Rs="trackingOptions",Ps="error";class Is extends M{constructor(t){super(Ps),this.code=t.code,this.message=t.message}}var Fs=0,Ls=1,Ms=2,As=3,Os=4;class Ds extends O{constructor(t,e,i,n){super(),this.extent=t,this.pixelRatio_=i,this.resolution=e,this.state="function"==typeof n?Fs:n,this.image_=null,this.loader="function"==typeof n?n:null}changed(){this.dispatchEvent(n)}getExtent(){return this.extent}getImage(){return this.image_}getPixelRatio(){return this.pixelRatio_}getResolution(){return this.resolution}getState(){return this.state}load(){if(this.state==Fs&&this.loader){this.state=Ls,this.changed();const t=this.getResolution(),e=Array.isArray(t)?t[0]:t;I((()=>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||dt&&t instanceof ImageBitmap||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement)&&(this.image_=t),this.state=Ms})).catch((t=>{this.state=As,console.error(t)})).finally((()=>this.changed()))}}setImage(t){this.image_=t}setResolution(t){this.resolution=t}}function Ns(t,e,i){const n=t;let s=!0,o=!1,a=!1;const l=[N(n,g,(function(){a=!0,o||e()}))];return n.src&&ut?(o=!0,n.decode().then((function(){s&&e()})).catch((function(t){s&&(a?e():i())}))):l.push(N(n,r,i)),function(){s=!1,l.forEach(k)}}function ks(t,e){return new Promise(((i,n)=>{function r(){o(),i(t)}function s(){o(),n(new Error("Image load error"))}function o(){t.removeEventListener("load",r),t.removeEventListener("error",s)}t.addEventListener("load",r),t.addEventListener("error",s),e&&(t.src=e)}))}function Gs(t,e){return e&&(t.src=e),t.src&&ut?new Promise(((e,i)=>t.decode().then((()=>e(t))).catch((n=>t.complete&&t.width?e(t):i(n))))):ks(t)}function js(t,e){return e&&(t.src=e),t.src&&ut&&dt?t.decode().then((()=>createImageBitmap(t))).catch((e=>{if(t.complete&&t.width)return t;throw e})):Gs(t)}class Us extends Ds{constructor(t,e,i,n,r){super(t,e,i,void 0!==r?Fs:Ms),this.loader_=void 0!==r?r:null,this.canvas_=n,this.error_=null}getError(){return this.error_}handleLoad_(t){t?(this.error_=t,this.state=As):this.state=Ms,this.changed()}load(){this.state==Fs&&(this.state=Ls,this.changed(),this.loader_(this.handleLoad_.bind(this)))}getImage(){return this.canvas_}}class Bs extends nt{constructor(t,e,i,n,r,s){super(t,e,s),this.crossOrigin_=n?.crossOrigin,this.referrerPolicy_=n?.referrerPolicy,this.src_=i,this.key=i,this.image_,ct?this.image_=new OffscreenCanvas(1,1):(this.image_=new Image,null!==this.crossOrigin_&&(this.image_.crossOrigin=this.crossOrigin_),void 0!==this.referrerPolicy_&&(this.image_.referrerPolicy=this.referrerPolicy_)),this.unlisten_=null,this.tileLoadFunction_=r}getImage(){return this.image_}setImage(t){this.image_=t,this.state=K,this.unlistenImage_(),this.changed()}getCrossOrigin(){return this.crossOrigin_}getReferrerPolicy(){return this.referrerPolicy_}handleImageError_(){this.state=q,this.unlistenImage_(),this.image_=function(){const t=ft(1,1);return t.fillStyle="rgba(0,0,0,0)",t.fillRect(0,0,1,1),t.canvas}(),this.changed()}handleImageLoad_(){if(ct)this.state=K;else{const t=this.image_;t.naturalWidth&&t.naturalHeight?this.state=K:this.state=J}this.unlistenImage_(),this.changed()}load(){this.state==q&&(this.state=Y,this.image_=new Image,null!==this.crossOrigin_&&(this.image_.crossOrigin=this.crossOrigin_),void 0!==this.referrerPolicy_&&(this.image_.referrerPolicy=this.referrerPolicy_)),this.state==Y&&(this.state=H,this.changed(),this.tileLoadFunction_(this,this.src_),this.unlisten_=Ns(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this)))}unlistenImage_(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)}disposeInternal(){this.unlistenImage_(),this.image_=null,super.disposeInternal()}}class zs{constructor(t,e,i){this.decay_=t,this.minVelocity_=e,this.delay_=i,this.points_=[],this.angle_=0,this.initialVelocity_=0}begin(){this.points_.length=0,this.angle_=0,this.initialVelocity_=0}update(t,e){this.points_.push(t,e,Date.now())}end(){if(this.points_.length<6)return!1;const t=Date.now()-this.delay_,e=this.points_.length-3;if(this.points_[e+2]<t)return!1;let i=e-3;for(;i>0&&this.points_[i+2]>t;)i-=3;const n=this.points_[e+2]-this.points_[i+2];if(n<1e3/60)return!1;const r=this.points_[e]-this.points_[i],s=this.points_[e+1]-this.points_[i+1];return this.angle_=Math.atan2(s,r),this.initialVelocity_=Math.sqrt(r*r+s*s)/n,this.initialVelocity_>this.minVelocity_}getDistance(){return(this.minVelocity_-this.initialVelocity_)/this.decay_}getAngle(){return this.angle_}}class Xs extends M{constructor(t,e,i){super(t),this.map=e,this.frameState=void 0!==i?i:null}}class Vs extends Xs{constructor(t,e,i,n,r,s){super(t,e,r),this.originalEvent=i,this.pixel_=null,this.coordinate_=null,this.dragging=void 0!==n&&n,this.activePointers=s}get pixel(){return this.pixel_||(this.pixel_=this.map.getEventPixel(this.originalEvent)),this.pixel_}set pixel(t){this.pixel_=t}get coordinate(){return this.coordinate_||(this.coordinate_=this.map.getCoordinateFromPixel(this.pixel)),this.coordinate_}set coordinate(t){this.coordinate_=t}preventDefault(){super.preventDefault(),"preventDefault"in this.originalEvent&&this.originalEvent.preventDefault()}stopPropagation(){super.stopPropagation(),"stopPropagation"in this.originalEvent&&this.originalEvent.stopPropagation()}}var $s={SINGLECLICK:"singleclick",CLICK:o,DBLCLICK:a,POINTERDRAG:"pointerdrag",POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"},Ws="pointermove",Zs="pointerdown",Ys="pointerup",Hs="pointerout";class Ks extends O{constructor(t,e){super(t),this.map_=t,this.clickTimeoutId_,this.emulateClicks_=!1,this.dragging_=!1,this.dragListenerKeys_=[],this.moveTolerance_=void 0===e?1:e,this.down_=null;const i=this.map_.getViewport();this.activePointers_=[],this.trackedTouches_={},this.element_=i,this.pointerdownListenerKey_=D(i,Zs,this.handlePointerDown_,this),this.originalPointerMoveEvent_,this.relayedListenerKey_=D(i,Ws,this.relayMoveEvent_,this),this.boundHandleTouchMove_=this.handleTouchMove_.bind(this),this.element_.addEventListener(f,this.boundHandleTouchMove_,!!gt&&{passive:!1})}emulateClick_(t){let e=new Vs($s.CLICK,this.map_,t);this.dispatchEvent(e),void 0!==this.clickTimeoutId_?(clearTimeout(this.clickTimeoutId_),this.clickTimeoutId_=void 0,e=new Vs($s.DBLCLICK,this.map_,t),this.dispatchEvent(e)):this.clickTimeoutId_=setTimeout((()=>{this.clickTimeoutId_=void 0;const e=new Vs($s.SINGLECLICK,this.map_,t);this.dispatchEvent(e)}),250)}updateActivePointers_(t){const e=t,i=e.pointerId;if(e.type==$s.POINTERUP||e.type==$s.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!=$s.POINTERDOWN&&e.type!=$s.POINTERMOVE||(this.trackedTouches_[i]=e);this.activePointers_=Object.values(this.trackedTouches_)}handlePointerUp_(t){this.updateActivePointers_(t);const e=new Vs($s.POINTERUP,this.map_,t,void 0,void 0,this.activePointers_);this.dispatchEvent(e),this.emulateClicks_&&!e.defaultPrevented&&!this.dragging_&&this.isMouseActionButton_(t)&&this.emulateClick_(this.down_),0===this.activePointers_.length&&(this.dragListenerKeys_.forEach(k),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 Vs($s.POINTERDOWN,this.map_,t,void 0,void 0,this.activePointers_);if(this.dispatchEvent(e),this.down_=new PointerEvent(t.type,t),Object.defineProperty(this.down_,"target",{writable:!1,value:t.target}),0===this.dragListenerKeys_.length){const t=this.map_.getOwnerDocument();this.dragListenerKeys_.push(D(t,$s.POINTERMOVE,this.handlePointerMove_,this),D(t,$s.POINTERUP,this.handlePointerUp_,this),D(this.element_,$s.POINTERCANCEL,this.handlePointerUp_,this)),this.element_.getRootNode&&this.element_.getRootNode()!==t&&this.dragListenerKeys_.push(D(this.element_.getRootNode(),$s.POINTERUP,this.handlePointerUp_,this))}}handlePointerMove_(t){if(this.isMoving_(t)){this.updateActivePointers_(t),this.dragging_=!0;const e=new Vs($s.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 Vs($s.POINTERMOVE,this.map_,t,e))}handleTouchMove_(t){const e=this.originalPointerMoveEvent_;e&&!e.defaultPrevented||"boolean"==typeof t.cancelable&&!0!==t.cancelable||t.preventDefault()}isMoving_(t){return this.dragging_||Math.abs(t.clientX-this.down_.clientX)>this.moveTolerance_||Math.abs(t.clientY-this.down_.clientY)>this.moveTolerance_}disposeInternal(){this.relayedListenerKey_&&(k(this.relayedListenerKey_),this.relayedListenerKey_=null),this.element_.removeEventListener(f,this.boundHandleTouchMove_),this.pointerdownListenerKey_&&(k(this.pointerdownListenerKey_),this.pointerdownListenerKey_=null),this.dragListenerKeys_.forEach(k),this.dragListenerKeys_.length=0,this.element_=null,super.disposeInternal()}}var qs="postrender",Js="movestart",Qs="moveend",to="loadstart",eo="loadend",io="layergroup",no="size",ro="target",so="view";const oo=1/0;class ao{constructor(t,e){this.priorityFunction_=t,this.keyFunction_=e,this.elements_=[],this.priorities_=[],this.queuedElements_={}}clear(){this.elements_.length=0,this.priorities_.length=0,F(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){Mt(!(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!=oo&&(this.elements_.push(t),this.priorities_.push(e),this.queuedElements_[this.keyFunction_(t)]=!0,this.siftDown_(0,this.elements_.length-1),!0)}getCount(){return this.elements_.length}getLeftChildIndex_(t){return 2*t+1}getRightChildIndex_(t){return 2*t+2}getParentIndex_(t){return t-1>>1}heapify_(){let t;for(t=(this.elements_.length>>1)-1;t>=0;t--)this.siftUp_(t)}isEmpty(){return 0===this.elements_.length}isKeyQueued(t){return t in this.queuedElements_}isQueued(t){return this.isKeyQueued(this.keyFunction_(t))}siftUp_(t){const e=this.elements_,i=this.priorities_,n=e.length,r=e[t],s=i[t],o=t;for(;t<n>>1;){const r=this.getLeftChildIndex_(t),s=this.getRightChildIndex_(t),o=s<n&&i[s]<i[r]?s:r;e[t]=e[o],i[t]=i[o],t=o}e[t]=r,i[t]=s,this.siftDown_(o,t)}siftDown_(t,e){const i=this.elements_,n=this.priorities_,r=i[e],s=n[e];for(;e>t;){const t=this.getParentIndex_(e);if(!(n[t]>s))break;i[e]=i[t],n[e]=n[t],e=t}i[e]=r,n[e]=s}reprioritize(){const t=this.priorityFunction_,e=this.elements_,i=this.priorities_;let n=0;const r=e.length;let s,o,a;for(o=0;o<r;++o)s=e[o],a=t(s),a==oo?delete this.queuedElements_[this.keyFunction_(s)]:(i[n]=a,e[n++]=s);e.length=n,i.length=n,this.heapify_()}}class lo extends ao{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(n,this.boundHandleTileChange_)}return e}getTilesLoading(){return this.tilesLoading_}handleTileChange(t){const e=t.target,i=e.getState();if(i===K||i===q||i===J){i!==q&&e.removeEventListener(n,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()!==Y||e in this.tilesLoadingKeys_||(this.tilesLoadingKeys_[e]=!0,++this.tilesLoading_,++i,t.load())}}}function ho(t,e,i,n,r){if(!t||!(i in t.wantedTiles))return oo;if(!t.wantedTiles[i][e.getKey()])return oo;const s=t.viewState.center,o=n[0]-s[0],a=n[1]-s[1];return 65536*Math.log(r)+Math.sqrt(o*o+a*a)/r}var co=0,uo=1,go={CENTER:"center",RESOLUTION:"resolution",ROTATION:"rotation"};function fo(t,e,i){return function(n,r,s,o,a){if(!n)return;if(!r&&!e)return n;const l=e?0:s[0]*r,h=e?0:s[1]*r,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,p=t[3]-h/2+u;d>g&&(d=(g+d)/2,g=d),f>p&&(f=(p+f)/2,p=f);let _=Ie(n[0],d,g),m=Ie(n[1],f,p);if(o&&i&&r){const t=30*r;_+=-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]-p)/t)}return[_,m]}}function po(t){return t}function _o(t,e,i,n){const r=ve(e)/i[0],s=_e(e)/i[1];return n?Math.min(t,Math.max(r,s)):Math.min(t,Math.min(r,s))}function mo(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),Ie(n,i/2,2*e)}function yo(t,e,i,n){return e=void 0===e||e,function(r,s,o,a){if(void 0!==r){const l=t[0],h=t[t.length-1],c=i?_o(l,i,o,n):l;if(a)return e?mo(r,c,h):Ie(r,h,c);const u=Math.min(c,r),d=Math.floor(v(t,u,s));return t[d]>c&&d<t.length-1?t[d+1]:t[d]}}}function xo(t,e,i,n,r,s){return n=void 0===n||n,i=void 0!==i?i:0,function(o,a,l,h){if(void 0!==o){const c=r?_o(e,r,l,s):e;if(h)return n?mo(o,c,i):Ie(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),p=Math.floor(Math.log(e/f)/Math.log(t)+g),_=Math.max(d,p);return Ie(e/Math.pow(t,_),i,c)}}}function vo(t,e,i,n,r){return i=void 0===i||i,function(s,o,a,l){if(void 0!==s){const o=n?_o(t,n,a,r):t;return i&&l?mo(s,o,e):Ie(s,e,o)}}}function So(t){if(void 0!==t)return 0}function Eo(t){if(void 0!==t)return t}function wo(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}}function To(t){const e=void 0===t?Oe(5):t;return function(t,i){return i||void 0===t?t:Math.abs(t)<=e?0:t}}const Co=256;class bo extends V{constructor(t){super(),this.on,this.once,this.un,t=Object.assign({},t),this.hints_=[0,0],this.animations_=[],this.updateAnimationKey_,this.projection_=bn(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&&mn(),t.center&&(t.center=Un(t.center,this.projection_)),t.extent&&(t.extent=zn(t.extent,this.projection_)),this.applyOptions_(t)}applyOptions_(t){const e=Object.assign({},t);for(const t in go)delete e[t];this.setProperties(e,!0);const i=Io(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=Po(t),r=i.constraint,s=Fo(t);this.constraints_={center:n,resolution:r,rotation:s},this.setRotation(void 0!==t.rotation?t.rotation:0),this.setCenterInternal(void 0!==t.center?t.center:null),void 0!==t.resolution?this.setResolution(t.resolution):void 0!==t.zoom&&this.setZoom(t.zoom)}get padding(){return this.padding_}set padding(t){let e=this.padding_;this.padding_=t;const i=this.getCenterInternal();if(i){const n=t||[0,0,0,0];e=e||[0,0,0,0];const r=this.getResolution(),s=r/2*(n[3]-e[3]+e[1]-n[1]),o=r/2*(n[0]-e[0]+e[2]-n[2]);this.setCenterInternal([i[0]+s,i[1]-o])}}getUpdatedOptions_(t){const e=this.getProperties();return void 0!==e.resolution?e.resolution=this.getResolution():e.zoom=this.getZoom(),e.center=this.getCenterInternal(),e.rotation=this.getRotation(),Object.assign({},e,t)}animate(t){this.isDef()&&!this.getAnimating()&&this.resolveConstraints(0);const e=new Array(arguments.length);for(let t=0;t<e.length;++t){let i=arguments[t];i.center&&(i=Object.assign({},i),i.center=Un(i.center,this.getProjection())),i.anchor&&(i=Object.assign({},i),i.anchor=Un(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&&Ro(e,!0));let r=Date.now(),s=this.targetCenter_.slice(),o=this.targetResolution_,a=this.targetRotation_;const l=[];for(;n<i;++n){const t=arguments[n],i={start:r,complete:!1,anchor:t.anchor,duration:void 0!==t.duration?t.duration:1e3,easing:t.easing||et,callback:e};if(t.center&&(i.sourceCenter=s,i.targetCenter=t.center.slice(),s=i.targetCenter),void 0!==t.zoom?(i.sourceResolution=o,i.targetResolution=this.getResolutionForZoom(t.zoom),o=i.targetResolution):t.resolution&&(i.sourceResolution=o,i.targetResolution=t.resolution,o=i.targetResolution),void 0!==t.rotation){i.sourceRotation=a;const e=De(t.rotation-a+Math.PI,2*Math.PI)-Math.PI;i.targetRotation=a+e,a=i.targetRotation}Lo(i)?i.complete=!0:r+=i.duration,l.push(i)}this.animations_.push(l),this.setHint(co,1),this.updateAnimations_()}getAnimating(){return this.hints_[co]>0}getInteracting(){return this.hints_[uo]>0}cancelAnimations(){let t;this.setHint(co,-this.hints_[co]);for(let e=0,i=this.animations_.length;e<i;++e){const i=this.animations_[e];if(i[0].callback&&Ro(i[0].callback,!1),!t)for(let e=0,n=i.length;e<n;++e){const n=i[e];if(!n.complete){t=n.anchor;break}}}this.animations_.length=0,this.cancelAnchor_=t,this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN}updateAnimations_(){if(void 0!==this.updateAnimationKey_&&(cancelAnimationFrame(this.updateAnimationKey_),this.updateAnimationKey_=void 0),!this.getAnimating())return;const t=Date.now();let e=!1;for(let i=this.animations_.length-1;i>=0;--i){const n=this.animations_[i];let r=!0;for(let i=0,s=n.length;i<s;++i){const s=n[i];if(s.complete)continue;const o=t-s.start;let a=s.duration>0?o/s.duration:1;a>=1?(s.complete=!0,a=1):r=!1;const l=s.easing(a);if(s.sourceCenter){const t=s.sourceCenter[0],e=s.sourceCenter[1],i=s.targetCenter[0],n=s.targetCenter[1];this.nextCenter_=s.targetCenter;const r=t+l*(i-t),o=e+l*(n-e);this.targetCenter_=[r,o]}if(s.sourceResolution&&s.targetResolution){const t=1===l?s.targetResolution:s.sourceResolution+l*(s.targetResolution-s.sourceResolution);if(s.anchor){const e=this.getViewportSize_(this.getRotation()),i=this.constraints_.resolution(t,0,e,!0);this.targetCenter_=this.calculateCenterZoom(i,s.anchor)}this.nextResolution_=s.targetResolution,this.targetResolution_=t,this.applyTargetState_(!0)}if(void 0!==s.sourceRotation&&void 0!==s.targetRotation){const t=1===l?De(s.targetRotation+Math.PI,2*Math.PI)-Math.PI:s.sourceRotation+l*(s.targetRotation-s.sourceRotation);if(s.anchor){const e=this.constraints_.rotation(t,!0);this.targetCenter_=this.calculateCenterRotate(e,s.anchor)}this.nextRotation_=s.targetRotation,this.targetRotation_=t}if(this.applyTargetState_(!0),e=!0,!s.complete)break}if(r){this.animations_[i]=null,this.setHint(co,-1),this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN;const t=n[0].callback;t&&Ro(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]],si(i,t-this.getRotation()),Qe(i,e)),i}calculateCenterZoom(t,e){let i;const n=this.getCenterInternal(),r=this.getResolution();if(void 0!==n&&void 0!==r){i=[e[0]-t*(e[0]-n[0])/r,e[1]-t*(e[1]-n[1])/r]}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?jn(t,this.getProjection()):t}getCenterInternal(){return this.get(go.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 Bn(this.calculateExtentInternal(t),this.getProjection())}calculateExtentInternal(t){t=t||this.getViewportSizeMinusPadding_();const e=this.getCenterInternal();Mt(e,"The view center is not defined");const i=this.getResolution();Mt(void 0!==i,"The view resolution is not defined");const n=this.getRotation();return Mt(void 0!==n,"The view rotation is not defined"),fe(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(go.RESOLUTION)}getResolutions(){return this.resolutions_}getResolutionForExtent(t,e){return this.getResolutionForExtentInternal(zn(t,this.getProjection()),e)}getResolutionForExtentInternal(t,e){e=e||this.getViewportSizeMinusPadding_();const i=ve(t)/e[0],n=_e(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(go.ROTATION)}getValueForResolutionFunction(t){const e=Math.log(t||2),i=this.getConstrainedResolution(this.maxResolution_),n=this.minResolution_,r=Math.log(i/n)/e;return function(t){return Math.log(i/t)/e/r}}getViewportSizeMinusPadding_(t){let e=this.getViewportSize_(t);const i=this.padding_;return i&&(e=[e[0]-i[1]-i[3],e[1]-i[0]-i[2]]),e}getState(){const t=this.getProjection(),e=this.getResolution(),i=this.getRotation();let n=this.getCenterInternal();const r=this.padding_;if(r){const t=this.getViewportSizeMinusPadding_();n=Mo(n,this.getViewportSize_(),[t[0]/2+r[3],t[1]/2+r[0]],e,i)}return{center:n.slice(0),projection:void 0!==t?t:null,resolution:e,nextCenter:this.nextCenter_,nextResolution:this.nextResolution_,nextRotation:this.nextRotation_,rotation:i,zoom:this.getZoom()}}getViewStateAndExtent(){return{viewState:this.getState(),extent:this.calculateExtent()}}getZoom(){let t;const e=this.getResolution();return void 0!==e&&(t=this.getZoomForResolution(e)),t}getZoomForResolution(t){let e,i,n=this.minZoom_||0;if(this.resolutions_){const r=v(this.resolutions_,t,1);n=r,e=this.resolutions_[r],i=r==this.resolutions_.length-1?2:e/this.resolutions_[r+1]}else e=this.maxResolution_,i=this.zoomFactor_;return n+Math.log(e/t)/Math.log(i)}getResolutionForZoom(t){if(this.resolutions_?.length){if(1===this.resolutions_.length)return this.resolutions_[0];const e=Ie(Math.floor(t),0,this.resolutions_.length-2),i=this.resolutions_[e]/this.resolutions_[e+1];return this.resolutions_[e]/Math.pow(i,Ie(t-e,0,1))}return this.maxResolution_/Math.pow(this.zoomFactor_,t-this.minZoom_)}fit(t,e){let i;if(Mt(Array.isArray(t)||"function"==typeof t.getSimplifiedGeometry,"Invalid extent or geometry provided as `geometry`"),Array.isArray(t)){Mt(!Ee(t),"Cannot fit empty extent provided as `geometry`");i=ps(zn(t,this.getProjection()))}else if("Circle"===t.getType()){const e=zn(t.getExtent(),this.getProjection());i=ps(e),i.rotate(this.getRotation(),de(e))}else{const e=Gn();i=e?t.clone().transform(e,this.getProjection()):t}this.fitInternal(i,e)}rotatedExtentForGeometry(t){const e=this.getRotation(),i=Math.cos(e),n=Math.sin(-e),r=t.getFlatCoordinates(),s=t.getStride();let o=1/0,a=1/0,l=-1/0,h=-1/0;for(let t=0,e=r.length;t<e;t+=s){const e=r[t]*i-r[t+1]*n,s=r[t]*n+r[t+1]*i;o=Math.min(o,e),a=Math.min(a,s),l=Math.max(l,e),h=Math.max(h,s)}return[o,a,l,h]}fitInternal(t,e){let i=(e=e||{}).size;i||(i=this.getViewportSizeMinusPadding_());const n=void 0!==e.padding?e.padding:[0,0,0,0],r=void 0!==e.nearest&&e.nearest;let s;s=void 0!==e.minResolution?e.minResolution:void 0!==e.maxZoom?this.getResolutionForZoom(e.maxZoom):0;const o=this.rotatedExtentForGeometry(t);let a=this.getResolutionForExtentInternal(o,[i[0]-n[1]-n[3],i[1]-n[0]-n[2]]);a=isNaN(a)?s:Math.max(a,s),a=this.getConstrainedResolution(a,r?0:1);const l=this.getRotation(),h=Math.sin(l),c=Math.cos(l),u=de(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),p=e.callback?e.callback:R;void 0!==e.duration?this.animateInternal({resolution:a,center:f,duration:e.duration,easing:e.easing},p):(this.targetResolution_=a,this.targetCenter_=f,this.applyTargetState_(!1,!0),Ro(p,!0))}centerOn(t,e,i){this.centerOnInternal(Un(t,this.getProjection()),e,i)}centerOnInternal(t,e,i){this.setCenterInternal(Mo(t,e,i,this.getResolution(),this.getRotation()))}calculateCenterShift(t,e,i,n){let r;const s=this.padding_;if(s&&t){const o=this.getViewportSizeMinusPadding_(-i),a=Mo(t,n,[o[0]/2+s[3],o[1]/2+s[0]],e,i);r=[t[0]-a[0],t[1]-a[1]]}return r}isDef(){return!!this.getCenterInternal()&&void 0!==this.getResolution()}adjustCenter(t){const e=jn(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&&Un(e,this.getProjection()),this.adjustResolutionInternal(t,e)}adjustResolutionInternal(t,e){const i=this.getAnimating()||this.getInteracting(),n=this.getViewportSize_(this.getRotation()),r=this.constraints_.resolution(this.targetResolution_*t,0,n,i);e&&(this.targetCenter_=this.calculateCenterZoom(r,e)),this.targetResolution_*=t,this.applyTargetState_()}adjustZoom(t,e){this.adjustResolution(Math.pow(this.zoomFactor_,-t),e)}adjustRotation(t,e){e&&(e=Un(e,this.getProjection())),this.adjustRotationInternal(t,e)}adjustRotationInternal(t,e){const i=this.getAnimating()||this.getInteracting(),n=this.constraints_.rotation(this.targetRotation_+t,i);e&&(this.targetCenter_=this.calculateCenterRotate(n,e)),this.targetRotation_+=t,this.applyTargetState_()}setCenter(t){this.setCenterInternal(t?Un(t,this.getProjection()):t)}setCenterInternal(t){this.targetCenter_=t,this.applyTargetState_()}setHint(t,e){return this.hints_[t]+=e,this.changed(),this.hints_[t]}setResolution(t){this.targetResolution_=t,this.applyTargetState_()}setRotation(t){this.targetRotation_=t,this.applyTargetState_()}setZoom(t){this.setResolution(this.getResolutionForZoom(t))}applyTargetState_(t,e){const i=this.getAnimating()||this.getInteracting()||e,n=this.constraints_.rotation(this.targetRotation_,i),r=this.getViewportSize_(n),s=this.constraints_.resolution(this.targetResolution_,0,r,i),o=this.constraints_.center(this.targetCenter_,s,r,i,this.calculateCenterShift(this.targetCenter_,s,n,r));this.get(go.ROTATION)!==n&&this.set(go.ROTATION,n),this.get(go.RESOLUTION)!==s&&(this.set(go.RESOLUTION,s),this.set("zoom",this.getZoom(),!0)),o&&this.get(go.CENTER)&&ri(this.get(go.CENTER),o)||this.set(go.CENTER,o),this.getAnimating()&&!t&&this.cancelAnimations(),this.cancelAnchor_=void 0}resolveConstraints(t,e,i){t=void 0!==t?t:200;const n=e||0,r=this.constraints_.rotation(this.targetRotation_),s=this.getViewportSize_(r),o=this.constraints_.resolution(this.targetResolution_,n,s),a=this.constraints_.center(this.targetCenter_,o,s,!1,this.calculateCenterShift(this.targetCenter_,o,r,s));if(0===t&&!this.cancelAnchor_)return this.targetResolution_=o,this.targetRotation_=r,this.targetCenter_=a,void this.applyTargetState_();i=i||(0===t?this.cancelAnchor_:void 0),this.cancelAnchor_=void 0,this.getResolution()===o&&this.getRotation()===r&&this.getCenterInternal()&&ri(this.getCenterInternal(),a)||(this.getAnimating()&&this.cancelAnimations(),this.animateInternal({rotation:r,center:a,resolution:o,duration:t,easing:tt,anchor:i}))}beginInteraction(){this.resolveConstraints(0),this.setHint(uo,1)}endInteraction(t,e,i){i=i&&Un(i,this.getProjection()),this.endInteractionInternal(t,e,i)}endInteractionInternal(t,e,i){this.getInteracting()&&(this.setHint(uo,-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 Ro(t,e){setTimeout((function(){t(e)}),0)}function Po(t){if(void 0!==t.extent){const e=void 0===t.smoothExtentConstraint||t.smoothExtentConstraint;return fo(t.extent,t.constrainOnlyCenter,e)}const e=bn(t.projection,"EPSG:3857");if(!0!==t.multiWorld&&e.isGlobal()){const t=e.getExtent().slice();return t[0]=-1/0,t[2]=1/0,fo(t,!1,!1)}return po}function Io(t){let e,i,n;let r=void 0!==t.minZoom?t.minZoom:0,s=void 0!==t.maxZoom?t.maxZoom:28;const o=void 0!==t.zoomFactor?t.zoomFactor:2,a=void 0!==t.multiWorld&&t.multiWorld,l=void 0===t.smoothResolutionConstraint||t.smoothResolutionConstraint,h=void 0!==t.showFullExtent&&t.showFullExtent,c=bn(t.projection,"EPSG:3857"),u=c.getExtent();let d=t.constrainOnlyCenter,g=t.extent;if(a||g||!c.isGlobal()||(d=!1,g=u),void 0!==t.resolutions){const o=t.resolutions;i=o[r],n=void 0!==o[s]?o[s]:o[o.length-1],e=t.constrainResolution?yo(o,l,!d&&g,h):vo(i,n,l,!d&&g,h)}else{const a=(u?Math.max(ve(u),_e(u)):360*_i.degrees/c.getMetersPerUnit())/Co/Math.pow(2,0),f=a/Math.pow(2,28);i=t.maxResolution,void 0!==i?r=0:i=a/Math.pow(o,r),n=t.minResolution,void 0===n&&(n=void 0!==t.maxZoom?void 0!==t.maxResolution?i/Math.pow(o,s):a/Math.pow(o,s):f),s=r+Math.floor(Math.log(i/n)/Math.log(o)),n=i/Math.pow(o,s-r),e=t.constrainResolution?xo(o,i,n,l,!d&&g,h):vo(i,n,l,!d&&g,h)}return{constraint:e,maxResolution:i,minResolution:n,minZoom:r,zoomFactor:o}}function Fo(t){if(void 0===t.enableRotation||t.enableRotation){const e=t.constrainRotation;return void 0===e||!0===e?To():!1===e?Eo:"number"==typeof e?wo(e):Eo}return So}function Lo(t){return!(t.sourceCenter&&t.targetCenter&&!ri(t.sourceCenter,t.targetCenter))&&(t.sourceResolution===t.targetResolution&&t.sourceRotation===t.targetRotation)}function Mo(t,e,i,n,r){const s=Math.cos(-r);let o=Math.sin(-r),a=t[0]*s-t[1]*o,l=t[1]*s+t[0]*o;a+=(e[0]/2-i[0])*n,l+=(i[1]-e[1]/2)*n,o=-o;return[a*s-l*o,l*s+a*o]}const Ao="ol-hidden",Oo="ol-selectable",Do="ol-unselectable",No="ol-unsupported",ko="ol-control",Go="ol-collapsed",jo=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"),Uo=["style","variant","weight","size","lineHeight","family"],Bo={normal:400,bold:700},zo=function(t){const e=t.match(jo);if(!e)return null;const i={lineHeight:"normal",size:"1.2em",style:"normal",weight:"400",variant:"normal"};for(let t=0,n=Uo.length;t<n;++t){const n=e[t+1];void 0!==n&&(i[Uo[t]]="string"==typeof n?n.trim():n)}return isNaN(Number(i.weight))&&i.weight in Bo&&(i.weight=Bo[i.weight]),i.families=i.family.split(/,\s?/).map((t=>t.trim().replace(/^['"]|['"]$/g,""))),i};class Xo extends V{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)k(this.listenerKeys[t]);if(this.listenerKeys.length=0,this.map_=t,t){const e=this.target_??t.getOverlayContainerStopEvent();this.element&&e.appendChild(this.element),this.render!==R&&this.listenerKeys.push(D(t,qs,this.render,this)),t.render()}}render(t){}setTarget(t){this.target_="string"==typeof t?document.getElementById(t):t}}class Vo extends Xo{constructor(t){t=t||{},super({element:document.createElement("div"),render:t.render,target:t.target}),this.ulElement_=document.createElement("ul"),this.collapsed_=void 0===t.collapsed||t.collapsed,this.userCollapsed_=this.collapsed_,this.overrideCollapsible_=void 0!==t.collapsible,this.collapsible_=void 0===t.collapsible||t.collapsible,this.collapsible_||(this.collapsed_=!1),this.attributions_=t.attributions;const e=void 0!==t.className?t.className:"ol-attribution",i=void 0!==t.tipLabel?t.tipLabel:"Attributions",n=void 0!==t.expandClassName?t.expandClassName:e+"-expand",r=void 0!==t.collapseLabel?t.collapseLabel:"›",s=void 0!==t.collapseClassName?t.collapseClassName:e+"-collapse";"string"==typeof r?(this.collapseLabel_=document.createElement("span"),this.collapseLabel_.textContent=r,this.collapseLabel_.className=s):this.collapseLabel_=r;const a=void 0!==t.label?t.label:"i";"string"==typeof a?(this.label_=document.createElement("span"),this.label_.textContent=a,this.label_.className=n):this.label_=a;const l=this.collapsible_&&!this.collapsed_?this.collapseLabel_:this.label_;this.toggleButton_=document.createElement("button"),this.toggleButton_.setAttribute("type","button"),this.toggleButton_.setAttribute("aria-expanded",String(!this.collapsed_)),this.toggleButton_.title=i,this.toggleButton_.appendChild(l),this.toggleButton_.addEventListener(o,this.handleClick_.bind(this),!1);const h=e+" "+Do+" "+ko+(this.collapsed_&&this.collapsible_?" "+Go:"")+(this.collapsible_?"":" ol-uncollapsible"),c=this.element;c.className=h,c.appendChild(this.toggleButton_),c.appendChild(this.ulElement_),this.renderedAttributions_=[],this.renderedVisible_=!0}collectSourceAttributions_(t){const e=this.getMap().getAllLayers(),i=new Set(e.flatMap((e=>e.getAttributions(t))));if(void 0!==this.attributions_&&(Array.isArray(this.attributions_)?this.attributions_.forEach((t=>i.add(t))):i.add(this.attributions_)),!this.overrideCollapsible_){const t=!e.some((t=>!1===t.getSource()?.getAttributionsCollapsible()));this.setCollapsible(t)}return Array.from(i)}async updateElement_(t){if(!t)return void(this.renderedVisible_&&(this.element.style.display="none",this.renderedVisible_=!1));const e=await Promise.all(this.collectSourceAttributions_(t).map((t=>I((()=>t))))),i=e.length>0;if(this.renderedVisible_!=i&&(this.element.style.display=i?"":"none",this.renderedVisible_=i),!w(e,this.renderedAttributions_)){St(this.ulElement_);for(let t=0,i=e.length;t<i;++t){const i=document.createElement("li");i.innerHTML=e[t],this.ulElement_.appendChild(i)}this.renderedAttributions_=e}}handleClick_(t){t.preventDefault(),this.handleToggle_(),this.userCollapsed_=this.collapsed_}handleToggle_(){this.element.classList.toggle(Go),this.collapsed_?vt(this.collapseLabel_,this.label_):vt(this.label_,this.collapseLabel_),this.collapsed_=!this.collapsed_,this.toggleButton_.setAttribute("aria-expanded",String(!this.collapsed_))}getCollapsible(){return this.collapsible_}setCollapsible(t){this.collapsible_!==t&&(this.collapsible_=t,this.element.classList.toggle("ol-uncollapsible"),this.userCollapsed_&&this.handleToggle_())}setCollapsed(t){this.userCollapsed_=t,this.collapsible_&&this.collapsed_!==t&&this.handleToggle_()}getCollapsed(){return this.collapsed_}render(t){this.updateElement_(t.frameState)}}class $o extends Xo{constructor(t){t=t||{},super({element:document.createElement("div"),render:t.render,target:t.target});const e=void 0!==t.className?t.className:"ol-rotate",i=void 0!==t.label?t.label:"⇧",n=void 0!==t.compassClassName?t.compassClassName:"ol-compass";this.label_=null,"string"==typeof i?(this.label_=document.createElement("span"),this.label_.className=n,this.label_.textContent=i):(this.label_=i,this.label_.classList.add(n));const r=t.tipLabel?t.tipLabel:"Reset rotation",s=document.createElement("button");s.className=e+"-reset",s.setAttribute("type","button"),s.title=r,s.appendChild(this.label_),s.addEventListener(o,this.handleClick_.bind(this),!1);const a=e+" "+Do+" "+ko,l=this.element;l.className=a,l.appendChild(s),this.callResetNorth_=t.resetNorth?t.resetNorth:void 0,this.duration_=void 0!==t.duration?t.duration:250,this.autoHide_=void 0===t.autoHide||t.autoHide,this.rotation_=void 0,this.autoHide_&&this.element.classList.add(Ao)}handleClick_(t){t.preventDefault(),void 0!==this.callResetNorth_?this.callResetNorth_():this.resetNorth_()}resetNorth_(){const t=this.getMap().getView();if(!t)return;const e=t.getRotation();void 0!==e&&(this.duration_>0&&e%(2*Math.PI)!=0?t.animate({rotation:0,duration:this.duration_,easing:tt}):t.setRotation(0))}render(t){const e=t.frameState;if(!e)return;const i=e.viewState.rotation;if(i!=this.rotation_){const t="rotate("+i+"rad)";if(this.autoHide_){const t=this.element.classList.contains(Ao);t||0!==i?t&&0!==i&&this.element.classList.remove(Ao):this.element.classList.add(Ao)}this.label_.style.transform=t}this.rotation_=i}}class Wo extends Xo{constructor(t){t=t||{},super({element:document.createElement("div"),target:t.target});const e=void 0!==t.className?t.className:"ol-zoom",i=void 0!==t.delta?t.delta:1,n=void 0!==t.zoomInClassName?t.zoomInClassName:e+"-in",r=void 0!==t.zoomOutClassName?t.zoomOutClassName:e+"-out",s=void 0!==t.zoomInLabel?t.zoomInLabel:"+",a=void 0!==t.zoomOutLabel?t.zoomOutLabel:"–",l=void 0!==t.zoomInTipLabel?t.zoomInTipLabel:"Zoom in",h=void 0!==t.zoomOutTipLabel?t.zoomOutTipLabel:"Zoom out",c=document.createElement("button");c.className=n,c.setAttribute("type","button"),c.title=l,c.appendChild("string"==typeof s?document.createTextNode(s):s),c.addEventListener(o,this.handleClick_.bind(this,i),!1);const u=document.createElement("button");u.className=r,u.setAttribute("type","button"),u.title=h,u.appendChild("string"==typeof a?document.createTextNode(a):a),u.addEventListener(o,this.handleClick_.bind(this,-i),!1);const d=e+" "+Do+" "+ko,g=this.element;g.className=d,g.appendChild(c),g.appendChild(u),this.duration_=void 0!==t.duration?t.duration:250}handleClick_(t,e){e.preventDefault(),this.zoomByDelta_(t)}zoomByDelta_(t){const e=this.getMap().getView();if(!e)return;const i=e.getZoom();if(void 0!==i){const n=e.getConstrainedZoom(i+t);this.duration_>0?(e.getAnimating()&&e.cancelAnimations(),e.animate({zoom:n,duration:this.duration_,easing:tt})):e.setZoom(n)}}}function Zo(t){t=t||{};const e=new Z;(void 0===t.zoom||t.zoom)&&e.push(new Wo(t.zoomOptions));(void 0===t.rotate||t.rotate)&&e.push(new $o(t.rotateOptions));return(void 0===t.attribution||t.attribution)&&e.push(new Vo(t.attributionOptions)),e}var Yo="active";class Ho extends V{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(Yo)}getMap(){return this.map_}handleEvent(t){return!0}setActive(t){this.set(Yo,t)}setMap(t){this.map_=t}}function Ko(t,e,i){const n=t.getCenterInternal();if(n){const r=[n[0]+e[0],n[1]+e[1]];t.animateInternal({duration:void 0!==i?i:250,easing:it,center:t.getConstrainedCenter(r)})}}function qo(t,e,i,n){const r=t.getZoom();if(void 0===r)return;const s=t.getConstrainedZoom(r+e),o=t.getResolutionForZoom(s);t.getAnimating()&&t.cancelAnimations(),t.animate({resolution:o,anchor:i,duration:void 0!==n?n:250,easing:tt})}class Jo extends Ho{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==$s.DBLCLICK){const i=t.originalEvent,n=t.map,r=t.coordinate,s=i.shiftKey?-this.delta_:this.delta_;qo(n.getView(),s,r,this.duration_),i.preventDefault(),e=!0}return!e}}function Qo(t){const e=arguments;return function(t){let i=!0;for(let n=0,r=e.length;n<r&&(i=i&&e[n](t),i);++n);return i}}const ta=function(t){const e=t.originalEvent;return e.altKey&&!(e.metaKey||e.ctrlKey)&&!e.shiftKey},ea=function(t){const e=t.originalEvent;return e.altKey&&!(e.metaKey||e.ctrlKey)&&e.shiftKey},ia=function(t){const e=t.map.getTargetElement(),i=e.getRootNode(),n=t.map.getOwnerDocument().activeElement;return i instanceof ShadowRoot?i.host.contains(n):e.contains(n)},na=function(t){const e=t.map.getTargetElement(),i=e.getRootNode();return!(i instanceof ShadowRoot?i.host:e).hasAttribute("tabindex")||ia(t)},ra=C,sa=function(t){const e=t.originalEvent;return"pointerId"in e&&0==e.button&&!(at&<&&e.ctrlKey)},oa=b,aa=function(t){return t.type==$s.SINGLECLICK},la=function(t){const e=t.originalEvent;return!e.altKey&&!(e.metaKey||e.ctrlKey)&&!e.shiftKey},ha=function(t){const e=t.originalEvent;return lt?e.metaKey:e.ctrlKey},ca=function(t){const e=t.originalEvent;return!e.altKey&&!(e.metaKey||e.ctrlKey)&&e.shiftKey},ua=function(t){const e=t.originalEvent,i=e.target.tagName;return"INPUT"!==i&&"SELECT"!==i&&"TEXTAREA"!==i&&!e.target.isContentEditable},da=function(t){const e=t.originalEvent;return"pointerId"in e&&"mouse"==e.pointerType},ga=function(t){const e=t.originalEvent;return"pointerId"in e&&e.isPrimary&&0===e.button};class fa extends Ho{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==$s.POINTERDRAG)this.handleDragEvent(t),t.originalEvent.preventDefault();else if(t.type==$s.POINTERUP){const e=this.handleUpEvent(t);this.handlingDownUpSequence=e&&this.targetPointers.length>0}}else if(t.type==$s.POINTERDOWN){const i=this.handleDownEvent(t);this.handlingDownUpSequence=i,e=this.stopDown(i)}else t.type==$s.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 pa(t){const e=t.length;let i=0,n=0;for(let r=0;r<e;r++)i+=t[r].clientX,n+=t[r].clientY;return{clientX:i/e,clientY:n/e}}class _a extends fa{constructor(t){super({stopDown:b}),t=t||{},this.kinetic_=t.kinetic,this.lastCentroid=null,this.lastPointersCount_,this.panning_=!1;const e=t.condition?t.condition:Qo(la,ga);this.condition_=t.onFocusOnly?Qo(na,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(pa(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();oi(e,i.getResolution()),si(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(),r=i.getCenterInternal(),s=e.getPixelFromCoordinateInternal(r),o=e.getCoordinateFromPixelInternal([s[0]-t*Math.cos(n),s[1]-t*Math.sin(n)]);i.animateInternal({center:i.getConstrainedCenter(o),duration:500,easing:tt})}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 ma extends fa{constructor(t){t=t||{},super({stopDown:b}),this.condition_=t.condition?t.condition:ea,this.lastAngle_=void 0,this.duration_=void 0!==t.duration?t.duration:250}handleDragEvent(t){if(!da(t))return;const e=t.map,i=e.getView();if(i.getConstraints().rotation===So)return;const n=e.getSize(),r=t.pixel,s=Math.atan2(n[1]/2-r[1],r[0]-n[0]/2);if(void 0!==this.lastAngle_){const t=s-this.lastAngle_;i.adjustRotationInternal(-t)}this.lastAngle_=s}handleUpEvent(t){if(!da(t))return!0;return t.map.getView().endInteraction(this.duration_),!1}handleDownEvent(t){if(!da(t))return!1;if(sa(t)&&this.condition_(t)){return t.map.getView().beginInteraction(),this.lastAngle_=void 0,!0}return!1}}class ya extends _{constructor(t){super(),this.geometry_=null,this.element_=document.createElement("div"),this.element_.style.position="absolute",this.element_.style.pointerEvents="auto",this.element_.className="ol-box "+t,this.map_=null,this.startPixel_=null,this.endPixel_=null}disposeInternal(){this.setMap(null)}render_(){const t=this.startPixel_,e=this.endPixel_,i="px",n=this.element_.style;n.left=Math.min(t[0],e[0])+i,n.top=Math.min(t[1],e[1])+i,n.width=Math.abs(e[0]-t[0])+i,n.height=Math.abs(e[1]-t[1])+i}setMap(t){if(this.map_){this.map_.getOverlayContainer().removeChild(this.element_);const t=this.element_.style;t.left="inherit",t.top="inherit",t.width="inherit",t.height="inherit"}this.map_=t,this.map_&&this.map_.getOverlayContainer().appendChild(this.element_)}setPixels(t,e){this.startPixel_=t,this.endPixel_=e,this.createOrUpdateGeometry(),this.render_()}createOrUpdateGeometry(){if(!this.map_)return;const t=this.startPixel_,e=this.endPixel_,i=[t,[t[0],e[1]],e,[e[0],t[1]]].map(this.map_.getCoordinateFromPixelInternal,this.map_);i[4]=i[0].slice(),this.geometry_?this.geometry_.setCoordinates([i]):this.geometry_=new gs([i])}getGeometry(){return this.geometry_}}const xa="boxstart",va="boxdrag",Sa="boxend",Ea="boxcancel";class wa extends M{constructor(t,e,i){super(t),this.coordinate=e,this.mapBrowserEvent=i}}class Ta extends fa{constructor(t){super(),this.on,this.once,this.un,t=t??{},this.box_=new ya(t.className||"ol-dragbox"),this.minArea_=t.minArea??64,t.onBoxEnd&&(this.onBoxEnd=t.onBoxEnd),this.startPixel_=null,this.condition_=t.condition??sa,this.boxEndCondition_=t.boxEndCondition??this.defaultBoxEndCondition}defaultBoxEndCondition(t,e,i){const n=i[0]-e[0],r=i[1]-e[1];return n*n+r*r>=this.minArea_}getGeometry(){return this.box_.getGeometry()}handleDragEvent(t){this.startPixel_&&(this.box_.setPixels(this.startPixel_,t.pixel),this.dispatchEvent(new wa(va,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 wa(e?Sa:Ea,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 wa(xa,t.coordinate,t)),!0)}onBoxEnd(t){}setActive(t){t||(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new wa(Ea,this.startPixel_,null)),this.startPixel_=null)),super.setActive(t)}setMap(t){this.getMap()&&(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new wa(Ea,this.startPixel_,null)),this.startPixel_=null)),super.setMap(t)}}class Ca extends Ta{constructor(t){super({condition:(t=t||{}).condition?t.condition:ca,className:t.className||"ol-dragzoom",minArea:t.minArea}),this.duration_=void 0!==t.duration?t.duration:200,this.out_=void 0!==t.out&&t.out}onBoxEnd(t){const e=this.getMap().getView();let i=this.getGeometry();if(this.out_){const t=e.rotatedExtentForGeometry(i),n=e.getResolutionForExtentInternal(t),r=e.getResolution()/n;i=i.clone(),i.scale(r*r)}e.fitInternal(i,{duration:this.duration_,easing:tt})}}var ba="ArrowLeft",Ra="ArrowUp",Pa="ArrowRight",Ia="ArrowDown";class Fa extends Ho{constructor(t){super(),t=t||{},this.defaultCondition_=function(t){return la(t)&&ua(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==u){const i=t.originalEvent,n=i.key;if(this.condition_(t)&&(n==Ia||n==ba||n==Pa||n==Ra)){const r=t.map.getView(),s=r.getResolution()*this.pixelDelta_;let o=0,a=0;n==Ia?a=-s:n==ba?o=-s:n==Pa?o=s:a=s;const l=[o,a];si(l,r.getRotation()),Ko(r,l,this.duration_),i.preventDefault(),e=!0}}return!e}}class La extends Ho{constructor(t){super(),t=t||{},this.condition_=t.condition?t.condition:function(t){return!ha(t)&&ua(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==u||t.type==d){const i=t.originalEvent,n=i.key;if(this.condition_(t)&&("+"===n||"-"===n)){const r=t.map,s="+"===n?this.delta_:-this.delta_;qo(r.getView(),s,void 0,this.duration_),i.preventDefault(),e=!0}}return!e}}class Ma extends Ho{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:ra;this.condition_=t.onFocusOnly?Qo(na,e):e,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_,this.mode_=void 0,this.trackpadEventGap_=400,this.trackpadTimeoutId_,this.deltaPerZoom_=300}endInteraction_(){this.trackpadTimeoutId_=void 0;const t=this.getMap();if(!t)return;t.getView().endInteraction(void 0,this.lastDelta_?this.lastDelta_>0?1:-1:0,this.lastAnchor_?t.getCoordinateFromPixel(this.lastAnchor_):null)}handleEvent(t){if(!this.condition_(t))return!0;if(t.type!==p)return!0;const e=t.map,i=t.originalEvent;i.preventDefault(),this.useAnchor_&&(this.lastAnchor_=t.pixel);let n=i.deltaY;switch(i.deltaMode){case WheelEvent.DOM_DELTA_LINE:n*=40;break;case WheelEvent.DOM_DELTA_PAGE:n*=300}if(0===n)return!1;this.lastDelta_=n;const r=Date.now();void 0===this.startTime_&&(this.startTime_=r),(!this.mode_||r-this.startTime_>this.trackpadEventGap_)&&(this.mode_=Math.abs(n)<4?"trackpad":"wheel");const s=e.getView();if("trackpad"===this.mode_&&!s.getConstrainResolution()&&!this.constrainResolution_)return this.trackpadTimeoutId_?clearTimeout(this.trackpadTimeoutId_):(s.getAnimating()&&s.cancelAnimations(),s.beginInteraction()),this.trackpadTimeoutId_=setTimeout(this.endInteraction_.bind(this),this.timeout_),s.adjustZoom(-n/this.deltaPerZoom_,this.lastAnchor_?e.getCoordinateFromPixel(this.lastAnchor_):null),this.startTime_=r,!1;this.totalDelta_+=n;const o=Math.max(this.timeout_-(r-this.startTime_),0);return clearTimeout(this.timeoutId_),this.timeoutId_=setTimeout(this.handleWheelZoom_.bind(this,e),o),!1}handleWheelZoom_(t){const e=t.getView();e.getAnimating()&&e.cancelAnimations();let i=-Ie(this.totalDelta_,-this.maxDelta_*this.deltaPerZoom_,this.maxDelta_*this.deltaPerZoom_)/this.deltaPerZoom_;(e.getConstrainResolution()||this.constrainResolution_)&&(i=i?i>0?1:-1:0),qo(e,i,this.lastAnchor_?t.getCoordinateFromPixel(this.lastAnchor_):null,this.duration_),this.mode_=void 0,this.totalDelta_=0,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_=void 0}setMouseAnchor(t){this.useAnchor_=t,t||(this.lastAnchor_=null)}}class Aa extends fa{constructor(t){const e=t=t||{};e.stopDown||(e.stopDown=b),super(e),this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.threshold_=void 0!==t.threshold?t.threshold:.3,this.duration_=void 0!==t.duration?t.duration:250}handleDragEvent(t){let e=0;const i=this.targetPointers[0],n=this.targetPointers[1],r=Math.atan2(n.clientY-i.clientY,n.clientX-i.clientX);if(void 0!==this.lastAngle_){const t=r-this.lastAngle_;this.rotationDelta_+=t,!this.rotating_&&Math.abs(this.rotationDelta_)>this.threshold_&&(this.rotating_=!0),e=t}this.lastAngle_=r;const s=t.map,o=s.getView();o.getConstraints().rotation!==So&&(this.anchor_=s.getCoordinateFromPixelInternal(s.getEventPixel(pa(this.targetPointers))),this.rotating_&&(s.render(),o.adjustRotationInternal(e,this.anchor_)))}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 Oa extends fa{constructor(t){const e=t=t||{};e.stopDown||(e.stopDown=b),super(e),this.anchor_=null,this.duration_=void 0!==t.duration?t.duration:400,this.lastDistance_=void 0,this.lastScaleDelta_=1}handleDragEvent(t){let e=1;const i=this.targetPointers[0],n=this.targetPointers[1],r=i.clientX-n.clientX,s=i.clientY-n.clientY,o=Math.sqrt(r*r+s*s);void 0!==this.lastDistance_&&(e=this.lastDistance_/o),this.lastDistance_=o;const a=t.map,l=a.getView();1!=e&&(this.lastScaleDelta_=e),this.anchor_=a.getCoordinateFromPixelInternal(a.getEventPixel(pa(this.targetPointers))),a.render(),l.adjustResolutionInternal(e,this.anchor_)}handleUpEvent(t){if(this.targetPointers.length<2){const e=t.map.getView(),i=this.lastScaleDelta_>1?1:-1;return e.endInteraction(this.duration_,i),!1}return!0}handleDownEvent(t){if(this.targetPointers.length>=2){const e=t.map;return this.anchor_=null,this.lastDistance_=void 0,this.lastScaleDelta_=1,this.handlingDownUpSequence||e.getView().beginInteraction(),!0}return!1}}function Da(t){t=t||{};const e=new Z,i=new zs(-.005,.05,100);(void 0===t.altShiftDragRotate||t.altShiftDragRotate)&&e.push(new ma);(void 0===t.doubleClickZoom||t.doubleClickZoom)&&e.push(new Jo({delta:t.zoomDelta,duration:t.zoomDuration}));(void 0===t.dragPan||t.dragPan)&&e.push(new _a({onFocusOnly:t.onFocusOnly,kinetic:i}));(void 0===t.pinchRotate||t.pinchRotate)&&e.push(new Aa);(void 0===t.pinchZoom||t.pinchZoom)&&e.push(new Oa({duration:t.zoomDuration}));(void 0===t.keyboard||t.keyboard)&&(e.push(new Fa),e.push(new La({delta:t.zoomDelta,duration:t.zoomDuration})));(void 0===t.mouseWheelZoom||t.mouseWheelZoom)&&e.push(new Ma({onFocusOnly:t.onFocusOnly,duration:t.zoomDuration}));return(void 0===t.shiftDragZoom||t.shiftDragZoom)&&e.push(new Ca({duration:t.zoomDuration})),e}var Na="opacity",ka="visible",Ga="extent",ja="zIndex",Ua="maxResolution",Ba="minResolution",za="maxZoom",Xa="minZoom",Va="source",$a="map";class Wa extends V{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[Na]=void 0!==t.opacity?t.opacity:1,Mt("number"==typeof e[Na],"Layer opacity must be a number"),e[ka]=void 0===t.visible||t.visible,e[ja]=t.zIndex,e[Ua]=void 0!==t.maxResolution?t.maxResolution:1/0,e[Ba]=void 0!==t.minResolution?t.minResolution:0,e[Xa]=void 0!==t.minZoom?t.minZoom:-1/0,e[za]=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=Ie(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 U()}getLayerStatesArray(t){return U()}getExtent(){return this.get(Ga)}getMaxResolution(){return this.get(Ua)}getMinResolution(){return this.get(Ba)}getMinZoom(){return this.get(Xa)}getMaxZoom(){return this.get(za)}getOpacity(){return this.get(Na)}getSourceState(){return U()}getVisible(){return this.get(ka)}getZIndex(){return this.get(ja)}setBackground(t){this.background_=t,this.changed()}setExtent(t){this.set(Ga,t)}setMaxResolution(t){this.set(Ua,t)}setMinResolution(t){this.set(Ba,t)}setMaxZoom(t){this.set(za,t)}setMinZoom(t){this.set(Xa,t)}setOpacity(t){Mt("number"==typeof t,"Layer opacity must be a number"),this.set(Na,t)}setVisible(t){this.set(ka,t)}setZIndex(t){this.set(ja,t)}disposeInternal(){this.state_&&(this.state_.layer=null,this.state_=null),super.disposeInternal()}}const Za="addlayer",Ya="removelayer";class Ha extends M{constructor(t,e){super(t),this.layer=e}}const Ka="layers";class qa extends Wa{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(Ka,this.handleLayersChanged_),i?Array.isArray(i)?i=new Z(i.slice(),{unique:!0}):Mt("function"==typeof i.getArray,"Expected `layers` to be an array or a `Collection`"):i=new Z(void 0,{unique:!0}),this.setLayers(i)}handleLayerChange_(){this.changed()}handleLayersChanged_(){this.layersListenerKeys_.forEach(k),this.layersListenerKeys_.length=0;const i=this.getLayers();this.layersListenerKeys_.push(D(i,t,this.handleLayersAdd_,this),D(i,e,this.handleLayersRemove_,this));for(const t in this.listenerKeys_)this.listenerKeys_[t].forEach(k);F(this.listenerKeys_);const n=i.getArray();for(let t=0,e=n.length;t<e;t++){const e=n[t];this.registerLayerListeners_(e),this.dispatchEvent(new Ha(Za,e))}this.changed()}registerLayerListeners_(t){const e=[D(t,i,this.handleLayerChange_,this),D(t,n,this.handleLayerChange_,this)];t instanceof qa&&e.push(D(t,Za,this.handleLayerGroupAdd_,this),D(t,Ya,this.handleLayerGroupRemove_,this)),this.listenerKeys_[z(t)]=e}handleLayerGroupAdd_(t){this.dispatchEvent(new Ha(Za,t.layer))}handleLayerGroupRemove_(t){this.dispatchEvent(new Ha(Ya,t.layer))}handleLayersAdd_(t){const e=t.element;this.registerLayerListeners_(e),this.dispatchEvent(new Ha(Za,e)),this.changed()}handleLayersRemove_(t){const e=t.element,i=z(e);this.listenerKeys_[i].forEach(k),delete this.listenerKeys_[i],this.dispatchEvent(new Ha(Ya,e)),this.changed()}getLayers(){return this.get(Ka)}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 Ha(Ya,t[e]))}this.set(Ka,t)}getLayersArray(t){return t=void 0!==t?t:[],this.getLayers().forEach((function(e){e.getLayersArray(t)})),t}getLayerStatesArray(t){const e=void 0!==t?t:[],i=e.length;this.getLayers().forEach((function(t){t.getLayerStatesArray(e)}));const n=this.getLayerState();let r=n.zIndex;t||void 0!==n.zIndex||(r=0);for(let t=i,s=e.length;t<s;t++){const i=e[t];i.opacity*=n.opacity,i.visible=i.visible&&n.visible,i.maxResolution=Math.min(i.maxResolution,n.maxResolution),i.minResolution=Math.max(i.minResolution,n.minResolution),i.minZoom=Math.max(i.minZoom,n.minZoom),i.maxZoom=Math.min(i.maxZoom,n.maxZoom),void 0!==n.extent&&(void 0!==i.extent?i.extent=me(i.extent,n.extent):i.extent=n.extent),void 0===i.zIndex&&(i.zIndex=r)}return e}getSourceState(){return"ready"}}var Ja="prerender",Qa="postrender",tl="precompose",el="postcompose",il="rendercomplete";class nl extends Wa{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(Va,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(Va)||null}getRenderSource(){return this.getSource()}getSourceState(){const t=this.getSource();return t?t.getState():"undefined"}handleSourceChange_(){this.changed(),this.sourceReady_||"ready"!==this.getSource().getState()||(this.sourceReady_=!0,this.dispatchEvent("sourceready"))}handleSourcePropertyChange_(){this.sourceChangeKey_&&(k(this.sourceChangeKey_),this.sourceChangeKey_=null),this.sourceReady_=!1;const t=this.getSource();t&&(this.sourceChangeKey_=D(t,n,this.handleSourceChange_,this),"ready"===t.getState()&&(this.sourceReady_=!0,setTimeout((()=>{this.dispatchEvent("sourceready")}),0))),this.changed()}getFeatures(t){return this.renderer_?this.renderer_.getFeatures(t):Promise.resolve([])}getData(t){return this.renderer_&&this.rendered?this.renderer_.getData(t):null}isVisible(t){let e;const i=this.getMapInternal();let n;if(!t&&i&&(t=i.getView()),e=t instanceof bo?{viewState:t.getState(),extent:t.calculateExtent()}:t,!e.layerStatesArray&&i&&(e.layerStatesArray=i.getLayerGroup().getLayerStatesArray()),e.layerStatesArray){if(n=e.layerStatesArray.find((t=>t.layer===this)),!n)return!1}else n=this.getLayerState();const r=this.getExtent();return rl(n,e.viewState)&&(!r||Se(r,e.extent))}getAttributions(t){if(!this.isVisible(t))return[];const e=this.getSource()?.getAttributions();if(!e)return[];let i=e(t instanceof bo?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($a,t)}getMapInternal(){return this.get($a)}setMap(t){this.mapPrecomposeKey_&&(k(this.mapPrecomposeKey_),this.mapPrecomposeKey_=null),t||this.changed(),this.mapRenderKey_&&(k(this.mapRenderKey_),this.mapRenderKey_=null),t&&(this.mapPrecomposeKey_=D(t,tl,this.handlePrecompose_,this),this.mapRenderKey_=D(this,n,t.render,t),this.changed())}handlePrecompose_(t){const e=t.frameState.layerStatesArray,i=this.getLayerState(!1);Mt(!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(Va,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 rl(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}function sl(t,e,i=0,n=t.length-1,r=al){for(;n>i;){if(n-i>600){const s=n-i+1,o=e-i+1,a=Math.log(s),l=.5*Math.exp(2*a/3),h=.5*Math.sqrt(a*l*(s-l)/s)*(o-s/2<0?-1:1);sl(t,e,Math.max(i,Math.floor(e-o*l/s+h)),Math.min(n,Math.floor(e+(s-o)*l/s+h)),r)}const s=t[e];let o=i,a=n;for(ol(t,i,e),r(t[n],s)>0&&ol(t,i,n);o<a;){for(ol(t,o,a),o++,a--;r(t[o],s)<0;)o++;for(;r(t[a],s)>0;)a--}0===r(t[i],s)?ol(t,i,a):(a++,ol(t,a,n)),a<=e&&(i=a+1),e<=a&&(n=a-1)}}function ol(t,e,i){const n=t[e];t[e]=t[i],t[i]=n}function al(t,e){return t<e?-1:t>e?1:0}let ll=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(!xl(t,e))return i;const n=this.toBBox,r=[];for(;e;){for(let s=0;s<e.children.length;s++){const o=e.children[s],a=e.leaf?n(o):o;xl(t,a)&&(e.leaf?i.push(o):yl(t,a)?this._all(o,i):r.push(o))}e=r.pop()}return i}collides(t){let e=this.data;if(!xl(t,e))return!1;const i=[];for(;e;){for(let n=0;n<e.children.length;n++){const r=e.children[n],s=e.leaf?this.toBBox(r):r;if(xl(t,s)){if(e.leaf||yl(t,s))return!0;i.push(r)}}e=i.pop()}return!1}load(t){if(!t||!t.length)return this;if(t.length<this._minEntries){for(let e=0;e<t.length;e++)this.insert(t[e]);return this}let e=this._build(t.slice(),0,t.length-1,0);if(this.data.children.length)if(this.data.height===e.height)this._splitRoot(this.data,e);else{if(this.data.height<e.height){const t=this.data;this.data=e,e=t}this._insert(e,this.data.height-e.height-1,!0)}else this.data=e;return this}insert(t){return t&&this._insert(t,this.data.height-1),this}clear(){return this.data=vl([]),this}remove(t,e){if(!t)return this;let i=this.data;const n=this.toBBox(t),r=[],s=[];let o,a,l;for(;i||r.length;){if(i||(i=r.pop(),a=r[r.length-1],o=s.pop(),l=!0),i.leaf){const n=hl(t,i.children,e);if(-1!==n)return i.children.splice(n,1),r.push(i),this._condense(r),this}l||i.leaf||!yl(i,n)?a?(o++,i=a.children[o],l=!1):i=null:(r.push(i),s.push(o),o=0,a=i,i=i.children[0])}return this}toBBox(t){return t}compareMinX(t,e){return t.minX-e.minX}compareMinY(t,e){return t.minY-e.minY}toJSON(){return this.data}fromJSON(t){return this.data=t,this}_all(t,e){const i=[];for(;t;)t.leaf?e.push(...t.children):i.push(...t.children),t=i.pop();return e}_build(t,e,i,n){const r=i-e+1;let s,o=this._maxEntries;if(r<=o)return s=vl(t.slice(e,i+1)),cl(s,this.toBBox),s;n||(n=Math.ceil(Math.log(r)/Math.log(o)),o=Math.ceil(r/Math.pow(o,n-1))),s=vl([]),s.leaf=!1,s.height=n;const a=Math.ceil(r/o),l=a*Math.ceil(Math.sqrt(o));Sl(t,e,i,l,this.compareMinX);for(let r=e;r<=i;r+=l){const e=Math.min(r+l-1,i);Sl(t,r,e,a,this.compareMinY);for(let i=r;i<=e;i+=a){const r=Math.min(i+a-1,e);s.children.push(this._build(t,i,r,n-1))}}return cl(s,this.toBBox),s}_chooseSubtree(t,e,i,n){for(;n.push(e),!e.leaf&&n.length-1!==i;){let i,n=1/0,o=1/0;for(let a=0;a<e.children.length;a++){const l=e.children[a],h=pl(l),c=(r=t,s=l,(Math.max(s.maxX,r.maxX)-Math.min(s.minX,r.minX))*(Math.max(s.maxY,r.maxY)-Math.min(s.minY,r.minY))-h);c<o?(o=c,n=h<n?h:n,i=l):c===o&&h<n&&(n=h,i=l)}e=i||e.children[0]}var r,s;return e}_insert(t,e,i){const n=i?t:this.toBBox(t),r=[],s=this._chooseSubtree(n,this.data,e,r);for(s.children.push(t),dl(s,n);e>=0&&r[e].children.length>this._maxEntries;)this._split(r,e),e--;this._adjustParentBBoxes(n,r,e)}_split(t,e){const i=t[e],n=i.children.length,r=this._minEntries;this._chooseSplitAxis(i,r,n);const s=this._chooseSplitIndex(i,r,n),o=vl(i.children.splice(s,i.children.length-s));o.height=i.height,o.leaf=i.leaf,cl(i,this.toBBox),cl(o,this.toBBox),e?t[e-1].children.push(o):this._splitRoot(i,o)}_splitRoot(t,e){this.data=vl([t,e]),this.data.height=t.height+1,this.data.leaf=!1,cl(this.data,this.toBBox)}_chooseSplitIndex(t,e,i){let n,r=1/0,s=1/0;for(let o=e;o<=i-e;o++){const e=ul(t,0,o,this.toBBox),a=ul(t,o,i,this.toBBox),l=ml(e,a),h=pl(e)+pl(a);l<r?(r=l,n=o,s=h<s?h:s):l===r&&h<s&&(s=h,n=o)}return n||i-e}_chooseSplitAxis(t,e,i){const n=t.leaf?this.compareMinX:gl,r=t.leaf?this.compareMinY:fl;this._allDistMargin(t,e,i,n)<this._allDistMargin(t,e,i,r)&&t.children.sort(n)}_allDistMargin(t,e,i,n){t.children.sort(n);const r=this.toBBox,s=ul(t,0,e,r),o=ul(t,i-e,i,r);let a=_l(s)+_l(o);for(let n=e;n<i-e;n++){const e=t.children[n];dl(s,t.leaf?r(e):e),a+=_l(s)}for(let n=i-e-1;n>=e;n--){const e=t.children[n];dl(o,t.leaf?r(e):e),a+=_l(o)}return a}_adjustParentBBoxes(t,e,i){for(let n=i;n>=0;n--)dl(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():cl(t[i],this.toBBox)}};function hl(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 cl(t,e){ul(t,0,t.children.length,e,t)}function ul(t,e,i,n,r){r||(r=vl(null)),r.minX=1/0,r.minY=1/0,r.maxX=-1/0,r.maxY=-1/0;for(let s=e;s<i;s++){const e=t.children[s];dl(r,t.leaf?n(e):e)}return r}function dl(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 gl(t,e){return t.minX-e.minX}function fl(t,e){return t.minY-e.minY}function pl(t){return(t.maxX-t.minX)*(t.maxY-t.minY)}function _l(t){return t.maxX-t.minX+(t.maxY-t.minY)}function ml(t,e){const i=Math.max(t.minX,e.minX),n=Math.max(t.minY,e.minY),r=Math.min(t.maxX,e.maxX),s=Math.min(t.maxY,e.maxY);return Math.max(0,r-i)*Math.max(0,s-n)}function yl(t,e){return t.minX<=e.minX&&t.minY<=e.minY&&e.maxX<=t.maxX&&e.maxY<=t.maxY}function xl(t,e){return e.minX<=t.maxX&&e.minY<=t.maxY&&e.maxX>=t.minX&&e.maxY>=t.minY}function vl(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function Sl(t,e,i,n,r){const s=[e,i];for(;s.length;){if((i=s.pop())-(e=s.pop())<=n)continue;const o=e+Math.ceil((i-e)/n/2)*n;sl(t,o,e,i,r),s.push(e,o,o,i)}}const El=[NaN,NaN,NaN,0];let wl;const Tl=/^rgba?\(\s*(\d+%?)\s+(\d+%?)\s+(\d+%?)(?:\s*\/\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,Cl=/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,bl=/^rgba?\(\s*(\d+%)\s*,\s*(\d+%)\s*,\s*(\d+%)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,Rl=/^#([\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$/i;function Pl(t,e){return t.endsWith("%")?Number(t.substring(0,t.length-1))/e:Number(t)}function Il(t){throw new Error('failed to parse "'+t+'" as color')}function Fl(t){if(t.toLowerCase().startsWith("rgb")){const e=t.match(Cl)||t.match(Tl)||t.match(bl);if(e){const t=e[4],i=100/255;return[Ie(Pl(e[1],i)+.5|0,0,255),Ie(Pl(e[2],i)+.5|0,0,255),Ie(Pl(e[3],i)+.5|0,0,255),void 0!==t?Ie(Pl(t,100),0,1):1]}Il(t)}if(t.startsWith("#")){if(Rl.test(t)){const e=t.substring(1),i=e.length<=4?1:2,n=[0,0,0,255];for(let t=0,r=e.length;t<r;t+=i){let r=parseInt(e.substring(t,t+i),16);1===i&&(r+=r<<4),n[t/i]=r}return n[3]=n[3]/255,n}Il(t)}const e=(wl||(wl=ft(1,1,void 0,{willReadFrequently:!0,desynchronized:!0})),wl);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&&Il(t));const n=e.fillStyle;if(n.startsWith("#")||n.startsWith("rgba"))return Fl(n);e.clearRect(0,0,1,1),e.fillRect(0,0,1,1);const r=Array.from(e.getImageData(0,0,1,1).data);return r[3]=ke(r[3]/255,3),r}function Ll(t){return"string"==typeof t?t:Xl(t)}const Ml={};let Al=0;function Ol(t){if(4===t.length)return t;const e=t.slice();return e[3]=1,e}function Dl(t){return t>.0031308?269.025*Math.pow(t,1/2.4)-14.025:3294.6*t}function Nl(t){return t>.2068965?Math.pow(t,3):108/841*(t-4/29)}function kl(t){return t>10.314724?Math.pow((t+14.025)/269.025,2.4):t/3294.6}function Gl(t){return t>.0088564?Math.pow(t,1/3):t/(108/841)+4/29}function jl(t){const e=kl(t[0]),i=kl(t[1]),n=kl(t[2]),r=Gl(.222488403*e+.716873169*i+.06060791*n),s=500*(Gl(.452247074*e+.399439023*i+.148375274*n)-r),o=200*(r-Gl(.016863605*e+.117638439*i+.865350722*n)),a=Math.atan2(o,s)*(180/Math.PI);return[116*r-16,Math.sqrt(s*s+o*o),a<0?a+360:a,t[3]]}function Ul(t){const e=(t[0]+16)/116,i=t[1],n=t[2]*Math.PI/180,r=Nl(e),s=Nl(e+i/500*Math.cos(n)),o=Nl(e-i/200*Math.sin(n)),a=Dl(3.021973625*s-1.617392459*r-.404875592*o),l=Dl(-.943766287*s+1.916279586*r+.027607165*o),h=Dl(.069407491*s-.22898585*r+1.159737864*o);return[Ie(a+.5|0,0,255),Ie(l+.5|0,0,255),Ie(h+.5|0,0,255),t[3]]}function Bl(t){if("none"===t)return El;if(Ml.hasOwnProperty(t))return Ml[t];if(Al>=1024){let t=0;for(const e in Ml)3&t++||(delete Ml[e],--Al)}const e=Fl(t);4!==e.length&&Il(t);for(const i of e)isNaN(i)&&Il(t);return Ml[t]=e,++Al,e}function zl(t){return Array.isArray(t)?t:Bl(t)}function Xl(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 Vl(t){return t[0]>0&&t[1]>0}function $l(t,e,i){return void 0===i&&(i=[0,0]),i[0]=t[0]*e+.5|0,i[1]=t[1]*e+.5|0,i}function Wl(t,e){return Array.isArray(t)?t:(void 0===e?e=[t,t]:(e[0]=t,e[1]=t),e)}let Zl=0;const Yl=1<<Zl++,Hl=1<<Zl++,Kl=1<<Zl++,ql=1<<Zl++,Jl=1<<Zl++,Ql=1<<Zl++,th=Math.pow(2,6)-1,eh={[Yl]:"boolean",[Hl]:"number",[Kl]:"string",[ql]:"color",[Jl]:"number[]",[Ql]:"size"},ih=Object.keys(eh).map(Number).sort(y);function nh(t){const e=[];for(const i of ih)rh(t,i)&&e.push(eh[i]);return 0===e.length?"untyped":e.length<3?e.join(" or "):e.slice(0,-1).join(", ")+", or "+e[e.length-1]}function rh(t,e){return(t&e)===e}function sh(t,e){return t===e}class oh{constructor(t,e){if(!function(t){return t in eh}(t))throw new Error(`literal expressions must have a specific type, got ${nh(t)}`);this.type=t,this.value=e}}class ah{constructor(t,e,...i){this.type=t,this.operator=e,this.args=i}}function lh(){return{variables:new Set,properties:new Set,featureId:!1,geometryType:!1,mapState:!1}}function hh(t,e,i){switch(typeof t){case"boolean":if(sh(e,Kl))return new oh(Kl,t?"true":"false");if(!rh(e,Yl))throw new Error(`got a boolean, but expected ${nh(e)}`);return new oh(Yl,t);case"number":if(sh(e,Ql))return new oh(Ql,Wl(t));if(sh(e,Yl))return new oh(Yl,!!t);if(sh(e,Kl))return new oh(Kl,t.toString());if(!rh(e,Hl))throw new Error(`got a number, but expected ${nh(e)}`);return new oh(Hl,t);case"string":if(sh(e,ql))return new oh(ql,Bl(t));if(sh(e,Yl))return new oh(Yl,!!t);if(!rh(e,Kl))throw new Error(`got a string, but expected ${nh(e)}`);return new oh(Kl,t)}if(!Array.isArray(t))throw new Error("expression must be an array or a primitive value");if(0===t.length)throw new Error("empty expression");if("string"==typeof t[0])return function(t,e,i){const n=t[0],r=uh[n];if(!r)throw new Error(`unknown operator: ${n}`);return r(t,e,i)}(t,e,i);for(const e of t)if("number"!=typeof e)throw new Error("expected an array of numbers");if(sh(e,Ql)){if(2!==t.length)throw new Error(`expected an array of two values for a size, got ${t.length}`);return new oh(Ql,t)}if(sh(e,ql)){if(3===t.length)return new oh(ql,[...t,1]);if(4===t.length)return new oh(ql,t);throw new Error(`expected an array of 3 or 4 values for a color, got ${t.length}`)}if(!rh(e,Jl))throw new Error(`got an array of numbers, but expected ${nh(e)}`);return new oh(Jl,t)}const ch={Get:"get",Var:"var",Concat:"concat",GeometryType:"geometry-type",LineMetric:"line-metric",Any:"any",All:"all",Not:"!",Resolution:"resolution",Zoom:"zoom",Time:"time",Equal:"==",NotEqual:"!=",GreaterThan:">",GreaterThanOrEqualTo:">=",LessThan:"<",LessThanOrEqualTo:"<=",Multiply:"*",Divide:"/",Add:"+",Subtract:"-",Clamp:"clamp",Mod:"%",Pow:"^",Abs:"abs",Floor:"floor",Ceil:"ceil",Round:"round",Sin:"sin",Cos:"cos",Atan:"atan",Sqrt:"sqrt",Match:"match",Between:"between",Interpolate:"interpolate",Coalesce:"coalesce",Case:"case",In:"in",Number:"number",String:"string",Array:"array",Color:"color",Id:"id",Band:"band",Palette:"palette",ToString:"to-string",Has:"has"},uh={[ch.Get]:xh(ph(1,1/0),dh),[ch.Var]:xh(ph(1,1),(function(t,e,i){const n=t[1];if("string"!=typeof n)throw new Error("expected a string argument for var operation");return i.variables.add(n),[new oh(Kl,n)]})),[ch.Has]:xh(ph(1,1/0),dh),[ch.Id]:xh((function(t,e,i){i.featureId=!0}),fh),[ch.Concat]:xh(ph(2,1/0),mh(Kl)),[ch.GeometryType]:xh((function(t,e,i){i.geometryType=!0}),fh),[ch.LineMetric]:xh(fh),[ch.Resolution]:xh(gh,fh),[ch.Zoom]:xh(gh,fh),[ch.Time]:xh(gh,fh),[ch.Any]:xh(ph(2,1/0),mh(Yl)),[ch.All]:xh(ph(2,1/0),mh(Yl)),[ch.Not]:xh(ph(1,1),mh(Yl)),[ch.Equal]:xh(ph(2,2),mh(th)),[ch.NotEqual]:xh(ph(2,2),mh(th)),[ch.GreaterThan]:xh(ph(2,2),mh(Hl)),[ch.GreaterThanOrEqualTo]:xh(ph(2,2),mh(Hl)),[ch.LessThan]:xh(ph(2,2),mh(Hl)),[ch.LessThanOrEqualTo]:xh(ph(2,2),mh(Hl)),[ch.Multiply]:xh(ph(2,1/0),_h),[ch.Coalesce]:xh(ph(2,1/0),_h),[ch.Divide]:xh(ph(2,2),mh(Hl)),[ch.Add]:xh(ph(2,1/0),mh(Hl)),[ch.Subtract]:xh(ph(2,2),mh(Hl)),[ch.Clamp]:xh(ph(3,3),mh(Hl)),[ch.Mod]:xh(ph(2,2),mh(Hl)),[ch.Pow]:xh(ph(2,2),mh(Hl)),[ch.Abs]:xh(ph(1,1),mh(Hl)),[ch.Floor]:xh(ph(1,1),mh(Hl)),[ch.Ceil]:xh(ph(1,1),mh(Hl)),[ch.Round]:xh(ph(1,1),mh(Hl)),[ch.Sin]:xh(ph(1,1),mh(Hl)),[ch.Cos]:xh(ph(1,1),mh(Hl)),[ch.Atan]:xh(ph(1,2),mh(Hl)),[ch.Sqrt]:xh(ph(1,1),mh(Hl)),[ch.Match]:xh(ph(4,1/0),yh,(function(t,e,i){const n=t.length-1,r=Kl|Hl|Yl,s=hh(t[1],r,i),o=hh(t[t.length-1],e,i),a=new Array(n-2);for(let e=0;e<n-2;e+=2){try{const n=hh(t[e+2],s.type,i);a[e]=n}catch(t){throw new Error(`failed to parse argument ${e+1} of match expression: ${t.message}`)}try{const n=hh(t[e+3],o.type,i);a[e+1]=n}catch(t){throw new Error(`failed to parse argument ${e+2} of match expression: ${t.message}`)}}return[s,...a,o]})),[ch.Between]:xh(ph(3,3),mh(Hl)),[ch.Interpolate]:xh(ph(6,1/0),yh,(function(t,e,i){const n=t[1];let r;switch(n[0]){case"linear":r=1;break;case"exponential":const t=n[1];if("number"!=typeof t||t<=0)throw new Error(`expected a number base for exponential interpolation, got ${JSON.stringify(t)} instead`);r=t;break;default:throw new Error(`invalid interpolation type: ${JSON.stringify(n)}`)}const s=new oh(Hl,r);let o;try{o=hh(t[2],Hl,i)}catch(t){throw new Error(`failed to parse argument 1 in interpolate expression: ${t.message}`)}const a=new Array(t.length-3);for(let n=0;n<a.length;n+=2){try{const e=hh(t[n+3],Hl,i);a[n]=e}catch(t){throw new Error(`failed to parse argument ${n+2} for interpolate expression: ${t.message}`)}try{const r=hh(t[n+4],e,i);a[n+1]=r}catch(t){throw new Error(`failed to parse argument ${n+3} for interpolate expression: ${t.message}`)}}return[s,o,...a]})),[ch.Case]:xh(ph(3,1/0),(function(t,e,i){const n=t[0],r=t.length-1;if(r%2==0)throw new Error(`expected an odd number of arguments for ${n}, got ${r} instead`)}),(function(t,e,i){const n=hh(t[t.length-1],e,i),r=new Array(t.length-1);for(let e=0;e<r.length-1;e+=2){try{const n=hh(t[e+1],Yl,i);r[e]=n}catch(t){throw new Error(`failed to parse argument ${e} of case expression: ${t.message}`)}try{const s=hh(t[e+2],n.type,i);r[e+1]=s}catch(t){throw new Error(`failed to parse argument ${e+1} of case expression: ${t.message}`)}}return r[r.length-1]=n,r})),[ch.In]:xh(ph(2,2),(function(t,e,i){let n,r=t[2];if(!Array.isArray(r))throw new Error('the second argument for the "in" operator must be an array');if("string"==typeof r[0]){if("literal"!==r[0])throw new Error('for the "in" operator, a string array should be wrapped in a "literal" operator to disambiguate from expressions');if(!Array.isArray(r[1]))throw new Error('failed to parse "in" expression: the literal operator must be followed by an array');r=r[1],n=Kl}else n=Hl;const s=new Array(r.length);for(let t=0;t<s.length;t++)try{const e=hh(r[t],n,i);s[t]=e}catch(e){throw new Error(`failed to parse haystack item ${t} for "in" expression: ${e.message}`)}return[hh(t[1],n,i),...s]})),[ch.Number]:xh(ph(1,1/0),mh(th)),[ch.String]:xh(ph(1,1/0),mh(th)),[ch.Array]:xh(ph(1,1/0),mh(Hl)),[ch.Color]:xh(ph(1,4),mh(Hl)),[ch.Band]:xh(ph(1,3),mh(Hl)),[ch.Palette]:xh(ph(2,2),(function(t,e,i){let n;try{n=hh(t[1],Hl,i)}catch(t){throw new Error(`failed to parse first argument in palette expression: ${t.message}`)}const r=t[2];if(!Array.isArray(r))throw new Error("the second argument of palette must be an array");const s=new Array(r.length);for(let t=0;t<s.length;t++){let e;try{e=hh(r[t],ql,i)}catch(e){throw new Error(`failed to parse color at index ${t} in palette expression: ${e.message}`)}if(!(e instanceof oh))throw new Error(`the palette color at index ${t} must be a literal value`);s[t]=e}return[n,...s]})),[ch.ToString]:xh(ph(1,1),mh(Yl|Hl|Kl|ql))};function dh(t,e,i){const n=t.length-1,r=new Array(n);for(let e=0;e<n;++e){const n=t[e+1];switch(typeof n){case"number":r[e]=new oh(Hl,n);break;case"string":r[e]=new oh(Kl,n);break;default:throw new Error(`expected a string key or numeric array index for a get operation, got ${n}`)}0===e&&i.properties.add(String(n))}return r}function gh(t,e,i){i.mapState=!0}function fh(t,e,i){const n=t[0];if(1!==t.length)throw new Error(`expected no arguments for ${n} operation`);return[]}function ph(t,e){return function(i,n,r){const s=i[0],o=i.length-1;if(t===e){if(o!==t){throw new Error(`expected ${t} argument${1===t?"":"s"} for ${s}, got ${o}`)}}else if(o<t||o>e){throw new Error(`expected ${e===1/0?`${t} or more`:`${t} to ${e}`} arguments for ${s}, got ${o}`)}}}function _h(t,e,i){const n=t.length-1,r=new Array(n);for(let s=0;s<n;++s){const n=hh(t[s+1],e,i);r[s]=n}return r}function mh(t){return function(e,i,n){const r=e.length-1,s=new Array(r);for(let i=0;i<r;++i){const r=hh(e[i+1],t,n);s[i]=r}return s}}function yh(t,e,i){const n=t[0],r=t.length-1;if(r%2==1)throw new Error(`expected an even number of arguments for operation ${n}, got ${r} instead`)}function xh(...t){return function(e,i,n){const r=e[0];let s;for(let r=0;r<t.length;r++){const o=t[r](e,i,n);if(r==t.length-1){if(!o)throw new Error("expected last argument validator to return the parsed args");s=o}}return new ah(i,r,...s)}}function vh(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 vh(t.getGeometries()[0]);default:return""}}function Sh(){return{variables:{},properties:{},resolution:NaN,featureId:null,geometryType:""}}function Eh(t,e,i){return wh(hh(t,e,i))}function wh(t,e){if(t instanceof oh){if(t.type===ql&&"string"==typeof t.value){const e=Bl(t.value);return function(){return e}}return function(){return t.value}}const i=t.operator;switch(i){case ch.Number:case ch.String:case ch.Coalesce:return function(t){const e=t.operator,i=t.args.length,n=new Array(i);for(let e=0;e<i;++e)n[e]=wh(t.args[e]);switch(e){case ch.Coalesce: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 ch.Number:case ch.String:return t=>{for(let r=0;r<i;++r){const i=n[r](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 ch.Get:case ch.Var:case ch.Has:return function(t){const e=t.args[0],i=e.value;switch(t.operator){case ch.Get:return e=>{const n=t.args;let r=e.properties[i];for(let t=1,e=n.length;t<e;++t){r=r[n[t].value]}return r};case ch.Var:return t=>t.variables[i];case ch.Has:return e=>{const n=t.args;if(!(i in e.properties))return!1;let r=e.properties[i];for(let t=1,e=n.length;t<e;++t){const e=n[t].value;if(!r||!Object.hasOwn(r,e))return!1;r=r[e]}return!0};default:throw new Error(`Unsupported accessor operator ${t.operator}`)}}(t);case ch.Id:return t=>t.featureId;case ch.GeometryType:return t=>t.geometryType;case ch.Concat:{const e=t.args.map((t=>wh(t)));return t=>"".concat(...e.map((e=>e(t).toString())))}case ch.Resolution:return t=>t.resolution;case ch.Any:case ch.All:case ch.Between:case ch.In:case ch.Not:return function(t){const e=t.operator,i=t.args.length,n=new Array(i);for(let e=0;e<i;++e)n[e]=wh(t.args[e]);switch(e){case ch.Any:return t=>{for(let e=0;e<i;++e)if(n[e](t))return!0;return!1};case ch.All:return t=>{for(let e=0;e<i;++e)if(!n[e](t))return!1;return!0};case ch.Between:return t=>{const e=n[0](t),i=n[1](t),r=n[2](t);return e>=i&&e<=r};case ch.In:return t=>{const e=n[0](t);for(let r=1;r<i;++r)if(e===n[r](t))return!0;return!1};case ch.Not:return t=>!n[0](t);default:throw new Error(`Unsupported logical operator ${e}`)}}(t);case ch.Equal:case ch.NotEqual:case ch.LessThan:case ch.LessThanOrEqualTo:case ch.GreaterThan:case ch.GreaterThanOrEqualTo:return function(t){const e=t.operator,i=wh(t.args[0]),n=wh(t.args[1]);switch(e){case ch.Equal:return t=>i(t)===n(t);case ch.NotEqual:return t=>i(t)!==n(t);case ch.LessThan:return t=>i(t)<n(t);case ch.LessThanOrEqualTo:return t=>i(t)<=n(t);case ch.GreaterThan:return t=>i(t)>n(t);case ch.GreaterThanOrEqualTo:return t=>i(t)>=n(t);default:throw new Error(`Unsupported comparison operator ${e}`)}}(t);case ch.Multiply:case ch.Divide:case ch.Add:case ch.Subtract:case ch.Clamp:case ch.Mod:case ch.Pow:case ch.Abs:case ch.Floor:case ch.Ceil:case ch.Round:case ch.Sin:case ch.Cos:case ch.Atan:case ch.Sqrt:return function(t){const e=t.operator,i=t.args.length,n=new Array(i);for(let e=0;e<i;++e)n[e]=wh(t.args[e]);switch(e){case ch.Multiply:return t=>{let e=1;for(let r=0;r<i;++r)e*=n[r](t);return e};case ch.Divide:return t=>n[0](t)/n[1](t);case ch.Add:return t=>{let e=0;for(let r=0;r<i;++r)e+=n[r](t);return e};case ch.Subtract:return t=>n[0](t)-n[1](t);case ch.Clamp:return t=>{const e=n[0](t),i=n[1](t);if(e<i)return i;const r=n[2](t);return e>r?r:e};case ch.Mod:return t=>n[0](t)%n[1](t);case ch.Pow:return t=>Math.pow(n[0](t),n[1](t));case ch.Abs:return t=>Math.abs(n[0](t));case ch.Floor:return t=>Math.floor(n[0](t));case ch.Ceil:return t=>Math.ceil(n[0](t));case ch.Round:return t=>Math.round(n[0](t));case ch.Sin:return t=>Math.sin(n[0](t));case ch.Cos:return t=>Math.cos(n[0](t));case ch.Atan:return 2===i?t=>Math.atan2(n[0](t),n[1](t)):t=>Math.atan(n[0](t));case ch.Sqrt:return t=>Math.sqrt(n[0](t));default:throw new Error(`Unsupported numeric operator ${e}`)}}(t);case ch.Case:return function(t){const e=t.args.length,i=new Array(e);for(let n=0;n<e;++n)i[n]=wh(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 ch.Match:return function(t){const e=t.args.length,i=new Array(e);for(let n=0;n<e;++n)i[n]=wh(t.args[n]);return t=>{const n=i[0](t);for(let r=1;r<e-1;r+=2)if(n===i[r](t))return i[r+1](t);return i[e-1](t)}}(t);case ch.Interpolate:return function(t){const e=t.args.length,i=new Array(e);for(let n=0;n<e;++n)i[n]=wh(t.args[n]);return t=>{const n=i[0](t),r=i[1](t);let s,o;for(let a=2;a<e;a+=2){const e=i[a](t);let l=i[a+1](t);const h=Array.isArray(l);if(h&&(l=Ol(l)),e>=r)return 2===a?l:h?Ch(n,r,s,o,e,l):Th(n,r,s,o,e,l);s=e,o=l}return o}}(t);case ch.ToString:return function(t){const e=t.operator,i=t.args.length,n=new Array(i);for(let e=0;e<i;++e)n[e]=wh(t.args[e]);if(e===ch.ToString)return e=>{const i=n[0](e);return t.args[0].type===ql?Xl(i):i.toString()};throw new Error(`Unsupported convert operator ${e}`)}(t);default:throw new Error(`Unsupported operator ${i}`)}}function Th(t,e,i,n,r,s){const o=r-i;if(0===o)return n;const a=e-i;return n+(1===t?a/o:(Math.pow(t,a)-1)/(Math.pow(t,o)-1))*(s-n)}function Ch(t,e,i,n,r,s){if(0===r-i)return n;const o=jl(n),a=jl(s);let l=a[2]-o[2];l>180?l-=360:l<-180&&(l+=360);return Ul([Th(t,e,i,o[0],r,a[0]),Th(t,e,i,o[1],r,a[1]),o[2]+Th(t,e,i,0,r,l),Th(t,e,i,n[3],r,s[3])])}class bh{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=Rh(t,e);return i in this.cache_?this.cache_[i]:null}getPattern(t,e){const i=Rh(t,e);return i in this.patternCache_?this.patternCache_[i]:null}set(t,e,i,n){const r=Rh(t,e),s=r in this.cache_;this.cache_[r]=i,n&&(i.getImageState()===Fs&&i.load(),i.getImageState()===Ls?i.ready().then((()=>{this.patternCache_[r]=_t().createPattern(i.getImage(1),"repeat")})):this.patternCache_[r]=_t().createPattern(i.getImage(1),"repeat")),s||++this.cacheSize_}setSize(t){this.maxCacheSize_=t,this.expire()}}function Rh(t,e){return t+":"+(e?zl(e):"null")}const Ph=new bh;let Ih=null;class Fh extends O{constructor(t,e,i,n,r){super(),this.hitDetectionImage_=null,this.image_=t,this.crossOrigin_=i?.crossOrigin,this.referrerPolicy_=i?.referrerPolicy,this.canvas_={},this.color_=r,this.imageState_=void 0===n?Fs: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_===Ms){Ih||(Ih=ft(1,1,void 0,{willReadFrequently:!0})),Ih.drawImage(this.image_,0,0);try{Ih.getImageData(0,0,1,1),this.tainted_=!1}catch{Ih=null,this.tainted_=!0}}return!0===this.tainted_}dispatchChangeEvent_(){this.dispatchEvent(n)}handleImageError_(){this.imageState_=As,this.dispatchChangeEvent_()}handleImageLoad_(){this.imageState_=Ms,this.size_=[this.image_.width,this.image_.height],this.dispatchChangeEvent_()}getImage(t){return this.image_||this.initializeImage_(),this.replaceColor_(t),this.canvas_[t]?this.canvas_[t]:this.image_}setImage(t){this.image_=t}getPixelRatio(t){return this.replaceColor_(t),this.canvas_[t]?t:1}getImageState(){return this.imageState_}getHitDetectionImage(){if(this.image_||this.initializeImage_(),!this.hitDetectionImage_)if(this.isTainted_()){const t=this.size_[0],e=this.size_[1],i=ft(t,e);i.fillRect(0,0,t,e),this.hitDetectionImage_=i.canvas}else this.hitDetectionImage_=this.image_;return this.hitDetectionImage_}getSize(){return this.size_}getSrc(){return this.src_}load(){if(this.imageState_===Fs){this.image_||this.initializeImage_(),this.imageState_=Ls;try{void 0!==this.src_&&(this.image_.src=this.src_)}catch{this.handleImageError_()}this.image_ instanceof HTMLImageElement&&Gs(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_!==Ms)return;const e=this.image_,i=ft(Math.ceil(e.width*t),Math.ceil(e.height*t)),n=i.canvas;i.scale(t,t),i.drawImage(e,0,0),i.globalCompositeOperation="multiply",i.fillStyle=Ll(this.color_),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_===Ms||this.imageState_===As)t();else{const e=()=>{this.imageState_!==Ms&&this.imageState_!==As||(this.removeEventListener(n,e),t())};this.addEventListener(n,e)}}))),this.ready_}}function Lh(t,e,i,n,r,s){let o=void 0===e?void 0:Ph.get(e,r);return o||(o=new Fh(t,t&&"src"in t?t.src||void 0:e,i,n,r),Ph.set(e,r,o,s)),s&&o&&!Ph.getPattern(e,r)&&Ph.set(e,r,o,s),o}function Mh(t){return t?Array.isArray(t)?Xl(t):"object"==typeof t&&"src"in t?function(t){if(!t.offset||!t.size)return Ph.getPattern(t.src,t.color);const e=t.src+":"+t.offset,i=Ph.getPattern(e,t.color);if(i)return i;const n=Ph.get(t.src,null);if(n.getImageState()!==Ms)return null;const r=ft(t.size[0],t.size[1]);return r.drawImage(n.getImage(1),t.offset[0],t.offset[1],t.size[0],t.size[1],0,0,t.size[0],t.size[1]),Lh(r.canvas,e,void 0,Ms,t.color,!0),Ph.getPattern(e,t.color)}(t):t:null}const Ah="10px sans-serif",Oh="#000",Dh="round",Nh=[],kh="round",Gh=10,jh="#000",Uh="center",Bh="middle",zh=[0,0,0,0],Xh=new V;let Vh,$h=null;const Wh={},Zh=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace","ui-rounded","emoji","math","fangsong"]);function Yh(t,e,i){return`${t} ${e} 16px "${i}"`}const Hh=function(){const t=100;let e,i;async function n(t){await i.ready;const e=await i.load(t);if(0===e.length)return!1;const n=zo(t),r=n.families[0].toLowerCase(),s=n.weight;return e.some((t=>{const e=t.family.replace(/^['"]|['"]$/g,"").toLowerCase(),i=Bo[t.weight]||t.weight;return e===r&&t.style===n.style&&i==s}))}async function r(){await i.ready;let s=!0;const o=Xh.getProperties(),a=Object.keys(o).filter((e=>o[e]<t));for(let e=a.length-1;e>=0;--e){const i=a[e];let r=o[i];r<t&&(await n(i)?(F(Wh),Xh.set(i,t)):(r+=10,Xh.set(i,r,!0),r<t&&(s=!1)))}e=void 0,s||(e=setTimeout(r,100))}return async function(t){i||(i=ct?self.fonts:document.fonts);const n=zo(t);if(!n)return;const s=n.families;let o=!1;for(const t of s){if(Zh.has(t))continue;const e=Yh(n.style,n.weight,t);void 0===Xh.get(e)&&(Xh.set(e,0,!0),o=!0)}o&&(clearTimeout(e),e=setTimeout(r,100))}}(),Kh=function(){let t;return function(e){let i=Wh[e];if(null==i){if(ct){const t=zo(e),n=qh(e,"Žg");i=(isNaN(Number(t.lineHeight))?1.2:Number(t.lineHeight))*(n.actualBoundingBoxAscent+n.actualBoundingBoxDescent)}else t||(t=document.createElement("div"),t.innerHTML="M",t.style.minHeight="0",t.style.maxHeight="none",t.style.height="auto",t.style.padding="0",t.style.border="none",t.style.position="absolute",t.style.display="block",t.style.left="-99999px"),t.style.font=e,document.body.appendChild(t),i=t.offsetHeight,document.body.removeChild(t);Wh[e]=i}return i}}();function qh(t,e){return $h||($h=ft(1,1)),t!=Vh&&($h.font=t,Vh=$h.font),$h.measureText(e)}function Jh(t,e){return qh(t,e).width}function Qh(t,e,i){if(e in i)return i[e];const n=e.split("\n").reduce(((e,i)=>Math.max(e,Jh(t,i))),0);return i[e]=n,n}function tc(t,e){const i=[],n=[],r=[];let s=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){s=Math.max(s,o),r.push(o),o=0,a+=l,l=0;continue}const d=e[h+1]||t.font,g=Jh(d,u);i.push(g),o+=g;const f=Kh(d);n.push(f),l=Math.max(l,f)}return{width:s,height:a,widths:i,heights:n,lineWidths:r}}function ec(t,e,i,n,r,s,o,a,l,h,c){t.save(),1!==i&&(void 0===t.globalAlpha?t.globalAlpha=t=>t.globalAlpha*=i:t.globalAlpha*=i),e&&t.transform.apply(t,e),n.contextInstructions?(t.translate(l,h),t.scale(c[0],c[1]),function(t,e){const i=t.contextInstructions;for(let t=0,n=i.length;t<n;t+=2)Array.isArray(i[t+1])?e[i[t]].apply(e,i[t+1]):e[i[t]]=i[t+1]}(n,t)):c[0]<0||c[1]<0?(t.translate(l,h),t.scale(c[0],c[1]),t.drawImage(n,r,s,o,a,0,0,o,a)):t.drawImage(n,r,s,o,a,l,h,o*c[0],a*c[1]),t.restore()}class ic{constructor(t){this.opacity_=t.opacity,this.rotateWithView_=t.rotateWithView,this.rotation_=t.rotation,this.scale_=t.scale,this.scaleArray_=Wl(t.scale),this.displacement_=t.displacement,this.declutterMode_=t.declutterMode}clone(){const t=this.getScale();return new ic({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 U()}getImage(t){return U()}getHitDetectionImage(){return U()}getPixelRatio(t){return 1}getImageState(){return U()}getImageSize(){return U()}getOrigin(){return U()}getSize(){return U()}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_=Wl(t)}listenImageChange(t){U()}load(){U()}unlistenImageChange(t){U()}ready(){return Promise.resolve()}}class nc extends ic{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()?Ls:Ms,this.imageState_===Ls&&this.ready().then((()=>this.imageState_=Ms)),this.render()}clone(){const t=this.getScale(),e=new nc({fill:this.getFill()?this.getFill().clone():void 0,points:this.getPoints(),radius:this.getRadius(),radius2:this.getRadius2(),angle:this.getAngle(),stroke:this.getStroke()?this.getStroke().clone():void 0,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),scale:Array.isArray(t)?t.slice():t,displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()});return e.setOpacity(this.getOpacity()),e}getAnchor(){const t=this.size_,e=this.getDisplacement(),i=this.getScaleArray();return[t[0]/2-e[0]/i[0],t[1]/2+e[1]/i[1]]}getAngle(){return this.angle_}getFill(){return this.fill_}setFill(t){this.fill_=t,this.render()}getHitDetectionImage(){return this.hitDetectionCanvas_||(this.hitDetectionCanvas_=this.createHitDetectionCanvas_(this.renderOptions_)),this.hitDetectionCanvas_}getImage(t){const e=this.fill_?.getKey(),i=`${t},${this.angle_},${this.radius},${this.radius2_},${this.points_},${e}`+Object.values(this.renderOptions_).join(",");let n=Ph.get(i,null)?.getImage(1);if(!n){const e=this.renderOptions_,r=Math.ceil(e.size*t),s=ft(r,r);this.draw_(e,s,t),n=s.canvas;const o=new Fh(n,void 0,null,Ms,null);Ph.set(i,null,o),createImageBitmap(n).then((t=>{o.setImage(t)}))}return n}getPixelRatio(t){return t}getImageSize(){return this.size_}getImageState(){return this.imageState_}getOrigin(){return this.origin_}getPoints(){return this.points_}getRadius(){return this.radius}setRadius(t){this.radius!==t&&(this.radius=t,this.render())}getRadius2(){return this.radius2_}setRadius2(t){this.radius2_!==t&&(this.radius2_=t,this.render())}getSize(){return this.size_}getStroke(){return this.stroke_}setStroke(t){this.stroke_=t,this.render()}listenImageChange(t){}load(){}unlistenImageChange(t){}calculateLineJoinSize_(t,e,i){if(0===e||this.points_===1/0||"bevel"!==t&&"miter"!==t)return e;let n=this.radius,r=void 0===this.radius2_?n:this.radius2_;if(n<r){const t=n;n=r,r=t}const s=void 0===this.radius2_?this.points_:2*this.points_,o=2*Math.PI/s,a=r*Math.sin(o),l=n-Math.sqrt(r*r-a*a),h=Math.sqrt(a*a+l*l),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),p=r-Math.sqrt(n*n-f*f),_=Math.sqrt(f*f+p*p)/f;if(_<=i){const t=_*e/2-r-n;return 2*Math.max(g,t)}return 2*g}createRenderOptions(){let t,e=Dh,i=kh,n=0,r=null,s=0,o=0;this.stroke_&&(t=Mh(this.stroke_.getColor()??jh),o=this.stroke_.getWidth()??1,r=this.stroke_.getLineDash(),s=this.stroke_.getLineDashOffset()??0,i=this.stroke_.getLineJoin()??kh,e=this.stroke_.getLineCap()??Dh,n=this.stroke_.getMiterLimit()??Gh);const a=this.calculateLineJoinSize_(i,o,n),l=Math.max(this.radius,this.radius2_||0);return{strokeStyle:t,strokeWidth:o,size:Math.ceil(2*l+a),lineCap:e,lineDash:r,lineDashOffset:s,lineJoin:i,miterLimit:n}}render(){this.renderOptions_=this.createRenderOptions();const t=this.renderOptions_.size;this.hitDetectionCanvas_=null,this.size_=[t,t]}draw_(t,e,i){if(e.scale(i,i),e.translate(t.size/2,t.size/2),this.createPath_(e),this.fill_){let t=this.fill_.getColor();null===t&&(t=Oh),e.fillStyle=Mh(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=zl(i)),null===i?n=1:Array.isArray(i)&&(n=4===i.length?i[3]:1),0===n&&(e=ft(t.size,t.size),this.drawHitDetectionCanvas_(t,e))}return e?e.canvas:this.getImage(1)}createPath_(t){let e=this.points_;const i=this.radius;if(e===1/0)t.arc(0,0,i,0,2*Math.PI);else{const n=void 0===this.radius2_?i:this.radius2_;void 0!==this.radius2_&&(e*=2);const r=this.angle_-Math.PI/2,s=2*Math.PI/e;for(let o=0;o<e;o++){const e=r+o*s,a=o%2==0?i:n;t.lineTo(a*Math.cos(e),a*Math.sin(e))}t.closePath()}}drawHitDetectionCanvas_(t,e){e.translate(t.size/2,t.size/2),this.createPath_(e),e.fillStyle=Oh,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 rc extends nc{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 rc({fill:this.getFill()?this.getFill().clone():void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,radius:this.getRadius(),scale:Array.isArray(t)?t.slice():t,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()});return e.setOpacity(this.getOpacity()),e}}class sc{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 sc({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=Lh(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()===Fs&&e.load(),e.getImageState()===Ls&&(this.patternImage_=e)}this.color_=t}getKey(){const t=this.getColor();return t?t instanceof CanvasPattern||t instanceof CanvasGradient?z(t):"object"==typeof t&&"src"in t?t.src+":"+t.offset:zl(t).toString():""}loading(){return!!this.patternImage_}ready(){return this.patternImage_?this.patternImage_.ready():Promise.resolve()}}function oc(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 ac extends ic{constructor(t){const e=void 0!==(t=t||{}).opacity?t.opacity:1,i=void 0!==t.rotation?t.rotation:0,n=void 0!==t.scale?t.scale:1,r=void 0!==t.rotateWithView&&t.rotateWithView;super({opacity:e,rotation:i,scale:n,displacement:void 0!==t.displacement?t.displacement:[0,0],rotateWithView:r,declutterMode:t.declutterMode}),this.anchor_=void 0!==t.anchor?t.anchor:[.5,.5],this.normalizedAnchor_=null,this.anchorOrigin_=void 0!==t.anchorOrigin?t.anchorOrigin:"top-left",this.anchorXUnits_=void 0!==t.anchorXUnits?t.anchorXUnits:"fraction",this.anchorYUnits_=void 0!==t.anchorYUnits?t.anchorYUnits:"fraction",this.crossOrigin_=void 0!==t.crossOrigin?t.crossOrigin:null,this.referrerPolicy_=t.referrerPolicy;const s=void 0!==t.img?t.img:null;let o,a=t.src;if(Mt(!(void 0!==a&&s),"`image` and `src` cannot be provided at the same time"),void 0!==a&&0!==a.length||!s||(a=s.src||z(s)),Mt(void 0!==a&&a.length>0,"A defined and non-empty `src` or `image` must be provided"),Mt(!((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=Fs:void 0!==s&&(o="complete"in s?s.complete?s.src?Ms:Fs:Ls:Ms),this.color_=void 0!==t.color?zl(t.color):null,this.iconImage_=Lh(s,a,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},o,this.color_),this.offset_=void 0!==t.offset?t.offset:[0,0],this.offsetOrigin_=void 0!==t.offsetOrigin?t.offsetOrigin:"top-left",this.origin_=null,this.size_=void 0!==t.size?t.size:null,this.initialOptions_,void 0!==t.width||void 0!==t.height){let e,i;if(t.size)[e,i]=t.size;else{const n=this.getImage(1);if(n.width&&n.height)e=n.width,i=n.height;else if(n instanceof HTMLImageElement){this.initialOptions_=t;const e=()=>{if(this.unlistenImageChange(e),!this.initialOptions_)return;const i=this.iconImage_.getSize();this.setScale(oc(i[0],i[1],t.width,t.height))};return void this.listenImageChange(e)}}void 0!==e&&this.setScale(oc(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 ac({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?zl(t):null;if(this.color_===e||this.color_&&e&&this.color_.length===e.length&&this.color_.every(((t,i)=>t===e[i])))return;this.color_=e;const i=this.getSrc(),n=void 0!==i?null:this.getHitDetectionImage(),r=void 0!==i?Fs:this.iconImage_.getImageState();this.iconImage_=Lh(n,i,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},r,this.color_)}getImage(t){return this.iconImage_.getImage(t)}getPixelRatio(t){return this.iconImage_.getPixelRatio(t)}getImageSize(){return this.iconImage_.getSize()}getImageState(){return this.iconImage_.getImageState()}getHitDetectionImage(){return this.iconImage_.getHitDetectionImage()}getOrigin(){if(this.origin_)return this.origin_;let t=this.offset_;if("top-left"!=this.offsetOrigin_){const e=this.getSize(),i=this.iconImage_.getSize();if(!e||!i)return null;t=t.slice(),"top-right"!=this.offsetOrigin_&&"bottom-right"!=this.offsetOrigin_||(t[0]=i[0]-e[0]-t[0]),"bottom-left"!=this.offsetOrigin_&&"bottom-right"!=this.offsetOrigin_||(t[1]=i[1]-e[1]-t[1])}return this.origin_=t,this.origin_}getSrc(){return this.iconImage_.getSrc()}setSrc(t){this.iconImage_=Lh(null,t,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},Fs,this.color_)}getSize(){return this.size_?this.size_:this.iconImage_.getSize()}getWidth(){const t=this.getScaleArray();return this.size_?this.size_[0]*t[0]:this.iconImage_.getImageState()==Ms?this.iconImage_.getSize()[0]*t[0]:void 0}getHeight(){const t=this.getScaleArray();return this.size_?this.size_[1]*t[1]:this.iconImage_.getImageState()==Ms?this.iconImage_.getSize()[1]*t[1]:void 0}setScale(t){delete this.initialOptions_,super.setScale(t)}listenImageChange(t){this.iconImage_.addEventListener(n,t)}load(){this.iconImage_.load()}unlistenImageChange(t){this.iconImage_.removeEventListener(n,t)}ready(){return this.iconImage_.ready()}}class lc{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 lc({color:Array.isArray(t)?t.slice():t||void 0,lineCap:this.getLineCap(),lineDash:this.getLineDash()?this.getLineDash().slice():void 0,lineDashOffset:this.getLineDashOffset(),lineJoin:this.getLineJoin(),miterLimit:this.getMiterLimit(),offset:this.getOffset(),width:this.getWidth()})}getColor(){return this.color_}getLineCap(){return this.lineCap_}getLineDash(){return this.lineDash_}getLineDashOffset(){return this.lineDashOffset_}getLineJoin(){return this.lineJoin_}getMiterLimit(){return this.miterLimit_}getOffset(){return this.offset_}getWidth(){return this.width_}setColor(t){this.color_=t}setLineCap(t){this.lineCap_=t}setLineDash(t){this.lineDash_=t}setLineDashOffset(t){this.lineDashOffset_=t}setLineJoin(t){this.lineJoin_=t}setMiterLimit(t){this.miterLimit_=t}setOffset(t){this.offset_=t}setWidth(t){this.width_=t}}class hc{constructor(t){t=t||{},this.geometry_=null,this.geometryFunction_=fc,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 hc({geometry:t??void 0,fill:this.getFill()?this.getFill().clone():void 0,image:this.getImage()?this.getImage().clone():void 0,renderer:this.getRenderer()??void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,text:this.getText()?this.getText().clone():void 0,zIndex:this.getZIndex()})}getRenderer(){return this.renderer_}setRenderer(t){this.renderer_=t}setHitDetectionRenderer(t){this.hitDetectionRenderer_=t}getHitDetectionRenderer(){return this.hitDetectionRenderer_}getGeometry(){return this.geometry_}getGeometryFunction(){return this.geometryFunction_}getFill(){return this.fill_}setFill(t){this.fill_=t}getImage(){return this.image_}setImage(t){this.image_=t}getStroke(){return this.stroke_}setStroke(t){this.stroke_=t}getText(){return this.text_}setText(t){this.text_=t}getZIndex(){return this.zIndex_}setGeometry(t){"function"==typeof t?this.geometryFunction_=t:"string"==typeof t?this.geometryFunction_=function(e){return e.get(t)}:t?void 0!==t&&(this.geometryFunction_=function(){return t}):this.geometryFunction_=fc,this.geometry_=t}setZIndex(t){this.zIndex_=t}}function cc(t){let e;if("function"==typeof t)e=t;else{let i;if(Array.isArray(t))i=t;else{Mt("function"==typeof t.getZIndex,"Expected an `Style` or an array of `Style`");i=[t]}e=function(){return i}}return e}let uc=null;function dc(t,e){if(!uc){const t=new sc({color:"rgba(255,255,255,0.4)"}),e=new lc({color:"#3399CC",width:1.25});uc=[new hc({image:new rc({fill:t,stroke:e,radius:5}),fill:t,stroke:e})]}return uc}function gc(){const t={},e=[255,255,255,1],i=[0,153,255,1];return t.Polygon=[new hc({fill:new sc({color:[255,255,255,.5]})})],t.MultiPolygon=t.Polygon,t.LineString=[new hc({stroke:new lc({color:e,width:5})}),new hc({stroke:new lc({color:i,width:3})})],t.MultiLineString=t.LineString,t.Circle=t.Polygon.concat(t.LineString),t.Point=[new hc({image:new rc({radius:6,fill:new sc({color:i}),stroke:new lc({color:e,width:1.5})}),zIndex:1/0})],t.MultiPoint=t.Point,t.GeometryCollection=t.Polygon.concat(t.LineString,t.Point),t}function fc(t){return t.getGeometry()}class pc{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_=Wl(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 sc({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 pc({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 sc?this.getFill().clone():this.getFill(),stroke:this.getStroke()?this.getStroke().clone():void 0,offsetX:this.getOffsetX(),offsetY:this.getOffsetY(),backgroundFill:this.getBackgroundFill()?this.getBackgroundFill().clone():void 0,backgroundStroke:this.getBackgroundStroke()?this.getBackgroundStroke().clone():void 0,padding:this.getPadding()||void 0,declutterMode:this.getDeclutterMode()})}getOverflow(){return this.overflow_}getFont(){return this.font_}getMaxAngle(){return this.maxAngle_}getPlacement(){return this.placement_}getRepeat(){return this.repeat_}getOffsetX(){return this.offsetX_}getOffsetY(){return this.offsetY_}getFill(){return this.fill_}getRotateWithView(){return this.rotateWithView_}getKeepUpright(){return this.keepUpright_}getRotation(){return this.rotation_}getScale(){return this.scale_}getScaleArray(){return this.scaleArray_}getStroke(){return this.stroke_}getText(){return this.text_}getTextAlign(){return this.textAlign_}getJustify(){return this.justify_}getTextBaseline(){return this.textBaseline_}getBackgroundFill(){return this.backgroundFill_}getBackgroundStroke(){return this.backgroundStroke_}getPadding(){return this.padding_}getDeclutterMode(){return this.declutterMode_}setOverflow(t){this.overflow_=t}setFont(t){this.font_=t}setMaxAngle(t){this.maxAngle_=t}setOffsetX(t){this.offsetX_=t}setOffsetY(t){this.offsetY_=t}setPlacement(t){this.placement_=t}setRepeat(t){this.repeat_=t}setRotateWithView(t){this.rotateWithView_=t}setKeepUpright(t){this.keepUpright_=t}setFill(t){this.fill_=t}setRotation(t){this.rotation_=t}setScale(t){this.scale_=t,this.scaleArray_=Wl(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}}function _c(t){return!0}function mc(t){const e=lh(),i=xc(t,e),n={variables:{},properties:{},resolution:NaN,featureId:null,geometryType:""};return function(t,r){if(n.properties=t.getPropertiesInternal(),n.resolution=r,e.featureId){const e=t.getId();n.featureId=void 0!==e?e:null}return e.geometryType&&(n.geometryType=vh(t.getGeometry())),i(n)}}function yc(t){const e=lh(),i=t.length,n=new Array(i);for(let r=0;r<i;++r)n[r]=vc(t[r],e);const r={variables:{},properties:{},resolution:NaN,featureId:null,geometryType:""},s=new Array(i);return function(t,o){if(r.properties=t.getPropertiesInternal(),r.resolution=o,e.featureId){const e=t.getId();r.featureId=void 0!==e?e:null}let a=0;for(let t=0;t<i;++t){const e=n[t](r);e&&(s[a]=e,a+=1)}return s.length=a,s}}function xc(t,e){const i=t.length,n=new Array(i);for(let r=0;r<i;++r){const i=t[r],s="filter"in i?Eh(i.filter,Yl,e):_c;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]=vc(i.style[n],e)}else o=[vc(i.style,e)];n[r]={filter:s,styles:o}}return function(e){const r=[];let s=!1;for(let o=0;o<i;++o){if((0,n[o].filter)(e)&&(!t[o].else||!s)){s=!0;for(const t of n[o].styles){const i=t(e);i&&r.push(i)}}}return r}}function vc(t,e){const i=Sc(t,"",e),n=Ec(t,"",e),r=function(t,e){const i="text-",n=Cc(t,i+"value",e);if(!n)return null;const r=Sc(t,i,e),s=Sc(t,i+"background-",e),o=Ec(t,i,e),a=Ec(t,i+"background-",e),l=Cc(t,i+"font",e),h=Tc(t,i+"max-angle",e),c=Tc(t,i+"offset-x",e),u=Tc(t,i+"offset-y",e),d=bc(t,i+"overflow",e),g=Cc(t,i+"placement",e),f=Tc(t,i+"repeat",e),p=Lc(t,i+"scale",e),_=bc(t,i+"rotate-with-view",e),m=Tc(t,i+"rotation",e),y=Cc(t,i+"align",e),x=Cc(t,i+"justify",e),v=Cc(t,i+"baseline",e),S=bc(t,i+"keep-upright",e),E=Pc(t,i+"padding",e),w=Dc(t,i+"declutter-mode"),T=new pc({declutterMode:w});return function(t){if(T.setText(n(t)),r&&T.setFill(r(t)),s&&T.setBackgroundFill(s(t)),o&&T.setStroke(o(t)),a&&T.setBackgroundStroke(a(t)),l&&T.setFont(l(t)),h&&T.setMaxAngle(h(t)),c&&T.setOffsetX(c(t)),u&&T.setOffsetY(u(t)),d&&T.setOverflow(d(t)),g){const e=g(t);if("point"!==e&&"line"!==e)throw new Error("Expected point or line for text-placement");T.setPlacement(e)}if(f&&T.setRepeat(f(t)),p&&T.setScale(p(t)),_&&T.setRotateWithView(_(t)),m&&T.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");T.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");T.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");T.setTextBaseline(e)}return E&&T.setPadding(E(t)),S&&T.setKeepUpright(S(t)),T}}(t,e),s=function(t,e){if("icon-src"in t)return function(t,e){const i="icon-",n=i+"src",r=kc(t[n],n),s=Ic(t,i+"anchor",e),o=Lc(t,i+"scale",e),a=Tc(t,i+"opacity",e),l=Ic(t,i+"displacement",e),h=Tc(t,i+"rotation",e),c=bc(t,i+"rotate-with-view",e),u=Ac(t,i+"anchor-origin"),d=Oc(t,i+"anchor-x-units"),g=Oc(t,i+"anchor-y-units"),f=wc(t,i+"color");let p,_=null;if(void 0!==f){Array.isArray(f)&&f.length>0&&"string"==typeof f[0]?_=Rc(t,i+"color",e):p=jc(f,i+"color")}const m=function(t,e){const i=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=t[e];if(void 0===i)return;return Nc(i,e)}(t,i+"offset"),x=Ac(t,i+"offset-origin"),v=Mc(t,i+"width"),S=Mc(t,i+"height"),E=function(t,e){const i=t[e];if(void 0===i)return;if("number"==typeof i)return Wl(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"),w=Dc(t,i+"declutter-mode"),T={src:r,anchorOrigin:u,anchorXUnits:d,anchorYUnits:g,crossOrigin:m,offset:y,offsetOrigin:x,height:S,width:v,size:E,declutterMode:w};let C=null;return function(t){if(C)_&&C.setColor(_(t));else{const e=_?_(t):p;C=new ac(void 0!==e?Object.assign({},T,{color:e}):Object.assign({},T))}return a&&C.setOpacity(a(t)),l&&C.setDisplacement(l(t)),h&&C.setRotation(h(t)),c&&C.setRotateWithView(c(t)),o&&C.setScale(o(t)),s&&C.setAnchor(s(t)),C}}(t,e);if("shape-points"in t)return function(t,e){const i="shape-",n=i+"points",r=i+"radius",s=Gc(t[n],n);if(!(r in t))throw new Error(`Expected a number for ${r}`);const o=Tc(t,r,e),a="number"==typeof t[r]?t[r]:5,l=i+"radius2",h=Tc(t,l,e),c="number"==typeof t[l]?t[l]:void 0,u=Sc(t,i,e),d=Ec(t,i,e),g=Lc(t,i+"scale",e),f=Ic(t,i+"displacement",e),p=Tc(t,i+"rotation",e),_=bc(t,i+"rotate-with-view",e),m=Mc(t,i+"angle"),y=Dc(t,i+"declutter-mode"),x=new nc({points:s,radius:a,radius2:c,angle:m,declutterMode:y});return function(t){return o&&x.setRadius(o(t)),h&&x.setRadius2(h(t)),u&&x.setFill(u(t)),d&&x.setStroke(d(t)),f&&x.setDisplacement(f(t)),p&&x.setRotation(p(t)),_&&x.setRotateWithView(_(t)),g&&x.setScale(g(t)),x}}(t,e);if("circle-radius"in t)return function(t,e){const i="circle-",n=Sc(t,i,e),r=Ec(t,i,e),s=Tc(t,i+"radius",e),o=Lc(t,i+"scale",e),a=Ic(t,i+"displacement",e),l=Tc(t,i+"rotation",e),h=bc(t,i+"rotate-with-view",e),c=Dc(t,i+"declutter-mode"),u=new rc({radius:5,declutterMode:c});return function(t){return s&&u.setRadius(s(t)),n&&u.setFill(n(t)),r&&u.setStroke(r(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),o=Tc(t,"z-index",e);if(!(i||n||r||s||L(t)))throw new Error("No fill, stroke, point, or text symbolizer properties in style: "+JSON.stringify(t));const a=new hc;return function(t){let e=!0;if(i){const n=i(t);n&&(e=!1),a.setFill(n)}if(n){const i=n(t);i&&(e=!1),a.setStroke(i)}if(r){const i=r(t);i&&(e=!1),a.setText(i)}if(s){const i=s(t);i&&(e=!1),a.setImage(i)}return o&&a.setZIndex(o(t)),e?null:a}}function Sc(t,e,i){let n;if(e+"fill-pattern-src"in t)n=function(t,e,i){const n=Cc(t,e+"pattern-src",i),r=Fc(t,e+"pattern-offset",i),s=Fc(t,e+"pattern-size",i),o=Rc(t,e+"color",i);return function(t){return{src:n(t),offset:r&&r(t),size:s&&s(t),color:o&&o(t)}}}(t,e+"fill-",i);else{if("none"===t[e+"fill-color"])return t=>null;n=Rc(t,e+"fill-color",i)}if(!n)return null;const r=new sc;return function(t){const e=n(t);return e===El?null:(r.setColor(e),r)}}function Ec(t,e,i){const n=Tc(t,e+"stroke-width",i),r=Rc(t,e+"stroke-color",i);if(!n&&!r)return null;const s=Cc(t,e+"stroke-line-cap",i),o=Cc(t,e+"stroke-line-join",i),a=Pc(t,e+"stroke-line-dash",i),l=Tc(t,e+"stroke-line-dash-offset",i),h=Tc(t,e+"stroke-miter-limit",i),c=Tc(t,e+"stroke-offset",i),u=new lc;return function(t){if(r){const e=r(t);if(e===El)return null;u.setColor(e)}if(n&&u.setWidth(n(t)),s){const e=s(t);if("butt"!==e&&"round"!==e&&"square"!==e)throw new Error("Expected butt, round, or square line cap");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 wc(t,e){if(!(e in t))return;const i=t[e];return void 0===i?void 0:i}function Tc(t,e,i){const n=wc(t,e);if(void 0===n)return;const r=Eh(n,Hl,i);return function(t){return Gc(r(t),e)}}function Cc(t,e,i){const n=wc(t,e);if(void 0===n)return null;const r=Eh(n,Kl,i);return function(t){return kc(r(t),e)}}function bc(t,e,i){const n=wc(t,e);if(void 0===n)return null;const r=Eh(n,Yl,i);return function(t){const i=r(t);if("boolean"!=typeof i)throw new Error(`Expected a boolean for ${e}`);return i}}function Rc(t,e,i){const n=wc(t,e);if(void 0===n)return null;const r=Eh(n,ql,i);return function(t){return jc(r(t),e)}}function Pc(t,e,i){const n=wc(t,e);if(void 0===n)return null;if(Array.isArray(n)&&(0===n.length||"string"!=typeof n[0])){const t=n.map(((t,n)=>{if("number"==typeof t)return()=>t;const r=Eh(t,Hl,i);return function(t){return Gc(r(t),`${e}[${n}]`)}}));return function(e){const i=new Array(t.length);for(let n=0;n<t.length;++n)i[n]=t[n](e);return i}}const r=Eh(n,Jl,i);return function(t){return Nc(r(t),e)}}function Ic(t,e,i){const n=wc(t,e);if(void 0===n)return null;const r=Eh(n,Jl,i);return function(t){const i=Nc(r(t),e);if(2!==i.length)throw new Error(`Expected two numbers for ${e}`);return i}}function Fc(t,e,i){const n=wc(t,e);if(void 0===n)return null;const r=Eh(n,Jl,i);return function(t){return Uc(r(t),e)}}function Lc(t,e,i){const n=wc(t,e);if(void 0===n)return null;const r=Eh(n,Jl|Hl,i);return function(t){return function(t,e){if("number"==typeof t)return t;return Uc(t,e)}(r(t),e)}}function Mc(t,e){const i=t[e];if(void 0!==i){if("number"!=typeof i)throw new Error(`Expected a number for ${e}`);return i}}function Ac(t,e){const i=t[e];if(void 0!==i){if("bottom-left"!==i&&"bottom-right"!==i&&"top-left"!==i&&"top-right"!==i)throw new Error(`Expected bottom-left, bottom-right, top-left, or top-right for ${e}`);return i}}function Oc(t,e){const i=t[e];if(void 0!==i){if("pixels"!==i&&"fraction"!==i)throw new Error(`Expected pixels or fraction for ${e}`);return i}}function Dc(t,e){const i=t[e];if(void 0!==i){if("string"!=typeof i)throw new Error(`Expected a string for ${e}`);if("declutter"!==i&&"obstacle"!==i&&"none"!==i)throw new Error(`Expected declutter, obstacle, or none for ${e}`);return i}}function Nc(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 kc(t,e){if("string"!=typeof t)throw new Error(`Expected a string for ${e}`);return t}function Gc(t,e){if("number"!=typeof t)throw new Error(`Expected a number for ${e}`);return t}function jc(t,e){if("string"==typeof t)return t;const i=Nc(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 Uc(t,e){const i=Nc(t,e);if(2!==i.length)throw new Error(`Expected an array of two numbers for ${e}`);return i}const Bc="renderOrder";class zc extends nl{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(Bc)}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}getUpdateWhileAnimating(){return this.updateWhileAnimating_}getUpdateWhileInteracting(){return this.updateWhileInteracting_}renderDeclutter(t,e){const i=this.getDeclutter();i in t.declutter==!1&&(t.declutter[i]=new ll(9)),this.getRenderer().renderDeclutter(t,e)}setRenderOrder(t){this.set(Bc,t)}setStyle(t){this.style_=void 0===t?dc:t;const e=function(t){if(void 0===t)return dc;if(!t)return null;if("function"==typeof t)return t;if(t instanceof hc)return t;if(!Array.isArray(t))return yc([t]);if(0===t.length)return[];const e=t.length,i=t[0];if(i instanceof hc){const i=new Array(e);for(let n=0;n<e;++n){const e=t[n];if(!(e instanceof hc))throw new Error("Expected a list of style instances");i[n]=e}return i}if("style"in i){const i=new Array(e);for(let n=0;n<e;++n){const e=t[n];if(!("style"in e))throw new Error("Expected a list of rules with a style property");i[n]=e}return mc(i)}const n=t;return yc(n)}(t);this.styleFunction_=null===t?void 0:cc(e),this.changed()}setDeclutter(t){this.declutter_=t?String(t):void 0,this.changed()}}class Xc extends M{constructor(t,e,i,n){super(t),this.inversePixelTransform=e,this.frameState=i,this.context=n}}class Vc extends _{constructor(t){super(),this.map_=t}dispatchRenderEvent(t,e){U()}calculateMatrices2D(t){const e=t.viewState,i=t.coordinateToPixelTransform,n=t.pixelToCoordinateTransform;nr(i,t.size[0]/2,t.size[1]/2,1/e.resolution,-1/e.resolution,-e.rotation,-e.center[0],-e.center[1]),rr(n,i)}forEachFeatureAtCoordinate(t,e,i,n,r,s,o,a){let l;const h=e.viewState;function c(t,e,i,n){return r.call(s,e,t?i:null,n)}const u=h.projection,d=ui(t.slice(),u),g=[[0,0]];if(u.canWrapX()&&n){const t=ve(u.getExtent());g.push([-t,0],[t,0])}const f=e.layerStatesArray,p=f.length,_=[],m=[];for(let n=0;n<g.length;n++)for(let r=p-1;r>=0;--r){const s=f[r],u=s.layer;if(u.hasRenderer()&&rl(s,h)&&o.call(a,u)){const r=u.getRenderer(),o=u.getSource();if(r&&o){const a=o.getWrapX()?d:t,h=c.bind(null,s.managed);m[0]=a[0]+g[n][0],m[1]=a[1]+g[n][1],l=r.forEachFeatureAtCoordinate(m,e,i,h,_)}if(l)return l}}if(0===_.length)return;const y=1/_.length;return _.forEach(((t,e)=>t.distanceSq+=e*y)),_.sort(((t,e)=>t.distanceSq-e.distanceSq)),_.some((t=>l=t.callback(t.feature,t.layer,t.geometry))),l}hasFeatureAtCoordinate(t,e,i,n,r,s){return void 0!==this.forEachFeatureAtCoordinate(t,e,i,n,C,this,r,s)}getMap(){return this.map_}renderFrame(t){U()}scheduleExpireIconCache(t){Ph.canExpireCache()&&t.postRenderFunctions.push($c)}}function $c(t,e){Ph.expire()}class Wc extends Vc{constructor(t){super(t),this.fontChangeListenerKey_=D(Xh,i,t.redrawText,t),this.element_=ct?wt():document.createElement("div");const e=this.element_.style;e.position="absolute",e.width="100%",e.height="100%",e.zIndex="0",this.element_.className=Do+" ol-layers";const n=t.getViewport();n&&n.insertBefore(this.element_,n.firstChild||null),this.children_=[],this.renderedVisible_=!0}dispatchRenderEvent(t,e){const i=this.getMap();if(i.hasListener(t)){const n=new Xc(t,void 0,e);i.dispatchEvent(n)}}disposeInternal(){k(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(tl,t);const e=t.layerStatesArray.sort(((t,e)=>t.zIndex-e.zIndex));e.some((t=>t.layer instanceof zc&&t.layer.getDeclutter()))&&(t.declutter={});const i=t.viewState;this.children_.length=0;const n=[];let r=null;for(let s=0,o=e.length;s<o;++s){const o=e[s];t.layerIndex=s;const a=o.layer,l=a.getSourceState();if(!rl(o,i)||"ready"!=l&&"undefined"!=l){a.unrender();continue}const h=a.render(t,r);h&&(h!==r&&(this.children_.push(h),r=h),n.push(o))}this.declutter(t,n),Et(this.element_,this.children_);const s=this.getMap().getTargetElement();if(Tt(s)){const t=s.getContext("2d");for(const e of this.children_){const i=e.firstElementChild||e,n=e.style.backgroundColor;if(n&&(!Tt(i)||i.width>0)&&(t.fillStyle=n,t.fillRect(0,0,s.width,s.height)),Tt(i)&&i.width>0){t.save();const n=e.style.opacity||i.style.opacity;t.globalAlpha=""===n?1:Number(n);const r=i.style.transform;if(r)t.transform(...lr(r));else{const e=parseFloat(i.style.width)/i.width,n=parseFloat(i.style.height)/i.height;t.transform(e,0,0,n,0,0)}t.drawImage(i,0,0),t.restore()}}}this.dispatchRenderEvent(el,t),this.renderedVisible_||(this.element_.style.display="",this.renderedVisible_=!0),this.scheduleExpireIconCache(t)}declutter(t,e){if(t.declutter){for(let i=e.length-1;i>=0;--i){const n=e[i],r=n.layer;r.getDeclutter()&&r.renderDeclutter(t,n)}e.forEach((e=>e.layer.renderDeferred(t)))}}}function Zc(t){t instanceof nl?t.setMapInternal(null):t instanceof qa&&t.getLayers().forEach(Zc)}function Yc(t,e){if(t instanceof nl)t.setMapInternal(e);else if(t instanceof qa){const i=t.getLayers().getArray();for(let t=0,n=i.length;t<n;++t)Yc(i[t],e)}}let Hc=class extends V{constructor(i){super(),i=i||{},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 qa({layers:t.layers});let r,s,o;i[io]=n,i[ro]=t.target,i[so]=t.view instanceof bo?t.view:new bo,void 0!==t.controls&&(Array.isArray(t.controls)?r=new Z(t.controls.slice()):(Mt("function"==typeof t.controls.getArray,"Expected `controls` to be an array or an `ol/Collection.js`"),r=t.controls));void 0!==t.interactions&&(Array.isArray(t.interactions)?s=new Z(t.interactions.slice()):(Mt("function"==typeof t.interactions.getArray,"Expected `interactions` to be an array or an `ol/Collection.js`"),s=t.interactions));void 0!==t.overlays?Array.isArray(t.overlays)?o=new Z(t.overlays.slice()):(Mt("function"==typeof t.overlays.getArray,"Expected `overlays` to be an array or an `ol/Collection.js`"),o=t.overlays):o=new Z;return{controls:r,interactions:s,keyboardEventTarget:e,overlays:o,values:i}}(i);this.renderComplete_=!1,this.loaded_=!0,this.boundHandleBrowserEvent_=this.handleBrowserEvent.bind(this),this.maxTilesLoading_=void 0!==i.maxTilesLoading?i.maxTilesLoading:16,this.pixelRatio_=void 0!==i.pixelRatio?i.pixelRatio:ht,this.postRenderTimeoutHandle_,this.animationDelayKey_,this.animationDelay_=this.animationDelay_.bind(this),this.coordinateToPixelTransform_=[1,0,0,1,0,0],this.pixelToCoordinateTransform_=[1,0,0,1,0,0],this.frameIndex_=0,this.frameState_=null,this.previousExtent_=null,this.viewPropertyListenerKey_=null,this.viewChangeListenerKey_=null,this.layerGroupPropertyListenerKeys_=null,ct||(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_=i.moveTolerance,this.keyboardEventTarget_=n.keyboardEventTarget,this.targetChangeHandlerKeys_=null,this.targetElement_=null,ct||(this.resizeObserver_=new ResizeObserver((()=>this.updateSize()))),this.controls=n.controls||(ct?new Z:Zo()),this.interactions=n.interactions||(ct?new Z:Da({onFocusOnly:!0})),this.overlays_=n.overlays,this.overlayIdIndex_={},this.renderer_=null,this.postRenderFunctions_=[],this.tileQueue_=new lo(this.getTilePriority.bind(this),this.handleTileChange_.bind(this)),this.addChangeListener(io,this.handleLayerGroupChanged_),this.addChangeListener(so,this.handleViewChanged_),this.addChangeListener(no,this.handleSizeChanged_),this.addChangeListener(ro,this.handleTargetChanged_),this.setProperties(n.values);const r=this;!i.view||i.view instanceof bo||i.view.then((function(t){r.setView(new bo(t))})),this.controls.addEventListener(t,(t=>{t.element.setMap(this)})),this.controls.addEventListener(e,(t=>{t.element.setMap(null)})),this.interactions.addEventListener(t,(t=>{t.element.setMap(this)})),this.interactions.addEventListener(e,(t=>{t.element.setMap(null)})),this.overlays_.addEventListener(t,(t=>{this.addOverlayInternal_(t.element)})),this.overlays_.addEventListener(e,(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){Yc(t.layer,this)}addOverlay(t){this.getOverlays().push(t)}addOverlayInternal_(t){const e=t.getId();void 0!==e&&(this.overlayIdIndex_[e.toString()]=t),t.setMap(this)}disposeInternal(){this.controls.clear(),this.interactions.clear(),this.overlays_.clear(),this.resizeObserver_?.disconnect(),this.setTarget(null),super.disposeInternal()}forEachFeatureAtPixel(t,e,i){if(!this.frameState_||!this.renderer_)return;const n=this.getCoordinateFromPixelInternal(t),r=void 0!==(i=void 0!==i?i:{}).hitTolerance?i.hitTolerance:0,s=void 0!==i.layerFilter?i.layerFilter:C,o=!1!==i.checkWrapped;return this.renderer_.forEachFeatureAtCoordinate(n,this.frameState_,r,o,e,null,s,null)}getFeaturesAtPixel(t,e){const i=[];return this.forEachFeatureAtPixel(t,(function(t){i.push(t)}),e),i}getAllLayers(){const t=[];return function e(i){i.forEach((function(i){i instanceof qa?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:C,r=void 0!==e.hitTolerance?e.hitTolerance:0,s=!1!==e.checkWrapped;return this.renderer_.hasFeatureAtCoordinate(i,this.frameState_,r,s,n,null)}getEventCoordinate(t){return this.getCoordinateFromPixel(this.getEventPixel(t))}getEventCoordinateInternal(t){return this.getCoordinateFromPixelInternal(this.getEventPixel(t))}getEventPixel(t){const e=this.viewport_.getBoundingClientRect(),i=this.getSize(),n=e.width/i[0],r=e.height/i[1],s="changedTouches"in t?t.changedTouches[0]:t;return[(s.clientX-e.left)/n,(s.clientY-e.top)/r]}getTarget(){return this.get(ro)}getTargetElement(){return this.targetElement_}getCoordinateFromPixel(t){return jn(this.getCoordinateFromPixelInternal(t),this.getView().getProjection())}getCoordinateFromPixelInternal(t){const e=this.frameState_;return e?Qn(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(io)}setLayers(t){const e=this.getLayerGroup();if(t instanceof Z)return void e.setLayers(t);const i=e.getLayers();i.clear(),i.extend(t)}getLayers(){return this.getLayerGroup().getLayers()}getLoadingOrNotReady(){const t=this.getLayerGroup().getLayerStatesArray();for(let e=0,i=t.length;e<i;++e){const i=t[e];if(!i.visible)continue;const n=i.layer.getRenderer();if(n&&!n.ready)return!0;const r=i.layer.getSource();if(r&&r.loading)return!0}return!1}getPixelFromCoordinate(t){const e=Un(t,this.getView().getProjection());return this.getPixelFromCoordinateInternal(e)}getPixelFromCoordinateInternal(t){const e=this.frameState_;return e?Qn(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(no)}getView(){return this.get(so)}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 ho(this.frameState_,t,e,i,n)}handleBrowserEvent(t,e){e=e||t.type;const i=new Vs(e,this,t);this.handleMapBrowserEvent(i)}handleMapBrowserEvent(t){if(!this.frameState_)return;const e=t.originalEvent,i=e.type;if(i===Zs||i===p||i===u){const t=this.getOwnerDocument(),i=this.viewport_.getRootNode?this.viewport_.getRootNode():t,n=e.target,r=i instanceof ShadowRoot?i.host===n?i.host.ownerDocument:i:i===t?t.documentElement:i;if(this.overlayContainerStopEvent_.contains(n)||!r.contains(n))return}if(t.frameState=this.frameState_,!1!==this.dispatchEvent(t)){const e=this.getInteractions().getArray().slice();for(let i=e.length-1;i>=0;i--){const n=e[i];if(n.getMap()!==this||!n.getActive()||!this.getTargetElement())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;if(t){const e=t.viewHints;if(e[co]||e[uo]){const e=Date.now()-t.time>8;i=e?0:8,n=e?0:2}}e.getTilesLoading()<i&&(e.reprioritize(),e.loadMoreTiles(i,n))}t&&this.renderer_&&!t.animate&&(this.renderComplete_?(this.hasListener(il)&&this.renderer_.dispatchRenderEvent(il,t),!1===this.loaded_&&(this.loaded_=!0,this.dispatchEvent(new Xs(eo,this,t)))):!0===this.loaded_&&(this.loaded_=!1,this.dispatchEvent(new Xs(to,this,t))));const i=this.postRenderFunctions_;if(t)for(let e=0,n=i.length;e<n;++e)i[e](this,t);i.length=0}handleSizeChanged_(){this.getView()&&!this.getView().getAnimating()&&this.getView().resolveConstraints(0),this.render()}handleTargetChanged_(){if(this.mapBrowserEventHandler_){for(let t=0,e=this.targetChangeHandlerKeys_.length;t<e;++t)k(this.targetChangeHandlerKeys_[t]);this.targetChangeHandlerKeys_=null,this.viewport_.removeEventListener(s,this.boundHandleBrowserEvent_),this.viewport_.removeEventListener(p,this.boundHandleBrowserEvent_),this.mapBrowserEventHandler_.dispose(),this.mapBrowserEventHandler_=null,this.viewport_.remove()}if(this.targetElement_&&!Tt(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(Tt(e)||e.appendChild(this.viewport_),this.renderer_||(this.renderer_=new Wc(this)),!Tt(e)){this.mapBrowserEventHandler_=new Ks(this,this.moveTolerance_);for(const t in $s)this.mapBrowserEventHandler_.addEventListener($s[t],this.handleMapBrowserEvent.bind(this));let t;if(this.viewport_.addEventListener(s,this.boundHandleBrowserEvent_,!1),this.viewport_.addEventListener(p,this.boundHandleBrowserEvent_,!!gt&&{passive:!1}),this.keyboardEventTarget_)t=this.keyboardEventTarget_;else{const i=e.getRootNode();t=i instanceof ShadowRoot?i.host:e}if(this.targetChangeHandlerKeys_=[D(t,u,this.handleBrowserEvent,this),D(t,d,this.handleBrowserEvent,this)],e instanceof HTMLElement){const t=e.getRootNode();t instanceof ShadowRoot&&this.resizeObserver_.observe(t.host),this.resizeObserver_?.observe(e)}}this.updateSize()}else this.renderer_&&(clearTimeout(this.postRenderTimeoutHandle_),this.postRenderTimeoutHandle_=void 0,this.postRenderFunctions_.length=0,this.renderer_.dispose(),this.renderer_=null),this.animationDelayKey_&&(cancelAnimationFrame(this.animationDelayKey_),this.animationDelayKey_=void 0)}handleTileChange_(){this.render()}handleViewPropertyChanged_(){this.render()}handleViewChanged_(){this.viewPropertyListenerKey_&&(k(this.viewPropertyListenerKey_),this.viewPropertyListenerKey_=null),this.viewChangeListenerKey_&&(k(this.viewChangeListenerKey_),this.viewChangeListenerKey_=null);const t=this.getView();t&&(this.updateViewportSize_(this.getSize()),this.viewPropertyListenerKey_=D(t,i,this.handleViewPropertyChanged_,this),this.viewChangeListenerKey_=D(t,n,this.handleViewPropertyChanged_,this),t.resolveConstraints(0)),this.render()}handleLayerGroupChanged_(){this.layerGroupPropertyListenerKeys_&&(this.layerGroupPropertyListenerKeys_.forEach(k),this.layerGroupPropertyListenerKeys_=null);const t=this.getLayerGroup();t&&(this.handleLayerAdd_(new Ha("addlayer",t)),this.layerGroupPropertyListenerKeys_=[D(t,i,this.render,this),D(t,n,this.render,this),D(t,"addlayer",this.handleLayerAdd_,this),D(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){Zc(t.layer)}removeOverlay(t){return this.getOverlays().remove(t)}renderFrame_(t){const e=this.getSize(),i=this.getView(),n=this.frameState_;let r=null;if(void 0!==e&&Vl(e)&&i&&i.isDef()){const n=i.getHints(this.frameState_?this.frameState_.viewHints:void 0),s=i.getState();if(r={animate:!1,coordinateToPixelTransform:this.coordinateToPixelTransform_,declutter:null,extent:fe(s.center,s.resolution,s.rotation,e),index:this.frameIndex_++,layerIndex:0,layerStatesArray:this.getLayerGroup().getLayerStatesArray(),pixelRatio:this.pixelRatio_,pixelToCoordinateTransform:this.pixelToCoordinateTransform_,postRenderFunctions:[],size:e,tileQueue:this.tileQueue_,time:t,usedTiles:{},viewState:s,viewHints:n,wantedTiles:{},mapId:z(this),renderTargets:{}},s.nextCenter&&s.nextResolution){const t=isNaN(s.nextRotation)?s.rotation:s.nextRotation;r.nextExtent=fe(s.nextCenter,s.nextResolution,t,e)}}if(this.frameState_=r,this.renderer_.renderFrame(r),r){if(r.animate&&this.render(),Array.prototype.push.apply(this.postRenderFunctions_,r.postRenderFunctions),n){(!this.previousExtent_||!Ee(this.previousExtent_)&&!te(r.extent,this.previousExtent_))&&(this.dispatchEvent(new Xs(Js,this,n)),this.previousExtent_=qt(this.previousExtent_))}this.previousExtent_&&!r.viewHints[co]&&!r.viewHints[uo]&&!te(r.extent,this.previousExtent_)&&(this.dispatchEvent(new Xs(Qs,this,r)),Xt(r.extent,this.previousExtent_))}this.dispatchEvent(new Xs(qs,this,r)),this.renderComplete_=(this.hasListener(to)||this.hasListener(eo)||this.hasListener(il))&&!this.tileQueue_.getTilesLoading()&&!this.tileQueue_.getCount()&&!this.getLoadingOrNotReady(),this.postRenderTimeoutHandle_||(this.postRenderTimeoutHandle_=setTimeout((()=>{this.postRenderTimeoutHandle_=void 0,this.handlePostRender()}),0))}setLayerGroup(t){const e=this.getLayerGroup();e&&this.handleLayerRemove_(new Ha("removelayer",e)),this.set(io,t)}setSize(t){this.set(no,t)}setTarget(t){this.set(ro,t)}setView(t){if(!t||t instanceof bo)return void this.set(so,t);this.set(so,new bo);const e=this;t.then((function(t){e.setView(new bo(t))}))}updateSize(){const t=this.getTargetElement();let e;if(t){let i,n;if(Tt(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)],!Vl(e)&&(t.offsetWidth||t.offsetHeight||t.getClientRects().length)&&He("No map visible because the map container's width or height are 0."))}const i=this.getSize();!e||i&&w(e,i)||(this.setSize(e),this.updateViewportSize_(e))}updateViewportSize_(t){const e=this.getView();e&&e.setViewportSize(t)}};const Kc="element",qc="map",Jc="offset",Qc="position",tu="positioning";class eu extends V{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 "+Oo,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(Kc,this.handleElementChanged),this.addChangeListener(qc,this.handleMapChanged),this.addChangeListener(Jc,this.handleOffsetChanged),this.addChangeListener(Qc,this.handlePositionChanged),this.addChangeListener(tu,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(Kc)}getId(){return this.id}getMap(){return this.get(qc)||null}getOffset(){return this.get(Jc)}getPosition(){return this.get(Qc)}getPositioning(){return this.get(tu)}handleElementChanged(){St(this.element);const t=this.getElement();t&&this.element.appendChild(t)}handleMapChanged(){this.mapPostrenderListenerKey&&(this.element?.remove(),k(this.mapPostrenderListenerKey),this.mapPostrenderListenerKey=null);const t=this.getMap();if(t){this.mapPostrenderListenerKey=D(t,qs,this.render,this),this.updatePixelPosition();const e=this.stopEvent?t.getOverlayContainerStopEvent():t.getOverlayContainer();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(Kc,t)}setMap(t){this.set(qc,t)}setOffset(t){this.set(Jc,t)}setPosition(t){this.set(Qc,t)}performAutoPan(){this.autoPan&&this.panIntoView(this.autoPan)}panIntoView(t){const e=this.getMap();if(!e||!e.getTargetElement()||!this.get(Qc))return;const i=this.getRect(e.getTargetElement(),e.getSize()),n=this.getElement(),r=this.getRect(n,[yt(n),xt(n)]),s=void 0===(t=t||{}).margin?20:t.margin;if(!Wt(i,r)){const n=r[0]-i[0],o=i[2]-r[2],a=r[1]-i[1],l=i[3]-r[3],h=[0,0];if(n<0?h[0]=n-s:o<0&&(h[0]=Math.abs(o)+s),a<0?h[1]=a-s:l<0&&(h[1]=Math.abs(l)+s),0!==h[0]||0!==h[1]){const i=e.getView().getCenterInternal(),n=e.getPixelFromCoordinateInternal(i);if(!n)return;const r=[n[0]+h[0],n[1]+h[1]],s=t.animation||{};e.getView().animateInternal({center:e.getCoordinateFromPixelInternal(r),duration:s.duration,easing:s.easing})}}}getRect(t,e){const i=t.getBoundingClientRect(),n=i.left+window.pageXOffset,r=i.top+window.pageYOffset;return[n,r,n+e[0],r+e[1]]}setPositioning(t){this.set(tu,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),n=t.getSize();this.updateRenderedPosition(i,n)}updateRenderedPosition(t,e){const i=this.element.style,n=this.getOffset(),r=this.getPositioning();this.setVisible(!0);let s="0%",o="0%";"bottom-right"==r||"center-right"==r||"top-right"==r?s="-100%":"bottom-center"!=r&&"center-center"!=r&&"top-center"!=r||(s="-50%"),"bottom-left"==r||"bottom-center"==r||"bottom-right"==r?o="-100%":"center-left"!=r&&"center-center"!=r&&"center-right"!=r||(o="-50%");const a=`translate(${s}, ${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 iu{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 nu(t,e,i,n,r){return void 0!==r?(r.minX=t,r.maxX=e,r.minY=i,r.maxY=n,r):new iu(t,e,i,n)}const ru=[];class su extends nt{constructor(t,e,i,n,r){super(t,e,{transition:0}),this.context_=null,this.executorGroups={},this.loadingSourceTiles=0,this.hitDetectionImageData={},this.replayState_={},this.sourceTiles=[],this.errorTileKeys={},this.wantedResolution,this.getSourceTiles=n.bind(void 0,this),this.removeSourceTiles_=r,this.wrappedTileCoord=i}getContext(){return this.context_||(this.context_=ft(1,1,ru)),this.context_}hasContext(){return!!this.context_}getImage(){return this.hasContext()?this.getContext().canvas:null}getReplayState(t){const e=z(t);return e in this.replayState_||(this.replayState_[e]={dirty:!1,renderedRenderOrder:null,renderedResolution:NaN,renderedPixelRatio:NaN,renderedRevision:-1,renderedTileResolution:NaN,renderedTileRevision:-1,renderedTileZ:-1}),this.replayState_[e]}load(){this.getSourceTiles()}release(){this.context_&&(mt(this.context_),ru.push(this.context_.canvas),this.context_=null),this.removeSourceTiles_(this),this.sourceTiles.length=0,super.release()}}let ou,au=class extends nt{constructor(t,e,i,n,r,s){super(t,e,s),this.extent=null,this.format_=n,this.features_=null,this.loader_,this.projection=null,this.resolution,this.tileLoadFunction_=r,this.url_=i,this.key=i}getTileUrl(){return this.url_}getFormat(){return this.format_}getFeatures(){return this.features_}load(){this.state==Y&&(this.setState(H),this.tileLoadFunction_(this,this.url_),this.loader_&&this.loader_(this.extent,this.resolution,this.projection))}onLoad(t,e){this.setFeatures(t)}onError(){this.setState(q)}setFeatures(t){this.features_=t,this.setState(K)}setLoader(t){this.loader_=t}},lu=!1;function hu(t,e,i,n,r,s,o){const a=new XMLHttpRequest;a.open("GET","function"==typeof t?t(i,n,r):t,!0),"arraybuffer"==e.getType()&&(a.responseType="arraybuffer"),a.withCredentials=lu,a.onload=function(t){if(!a.status||a.status>=200&&a.status<300){const t=e.getType();try{let n;"text"==t||"json"==t?n=a.responseText:"xml"==t?n=a.responseXML||a.responseText:"arraybuffer"==t&&(n=a.response),n?s(e.readFeatures(n,{extent:i,featureProjection:r}),e.readProjection(n)):o()}catch{o()}}else o()},a.onerror=o,a.send()}function cu(t,e){return function(i,n,r,s,o){hu(t,e,i,n,r,((t,e)=>{this.addFeatures(t),void 0!==s&&s(t)}),(()=>{this.changed(),void 0!==o&&o()}))}}function uu(t,e){return[[-1/0,-1/0,1/0,1/0]]}function du(t,e,i,n){const r=document.createElement("script"),s="olc_"+z(e);function o(){delete window[s],r.parentNode.removeChild(r)}r.async=!0,r.src=t+(t.includes("?")?"&":"?")+(n||"callback")+"="+s;const a=setTimeout((function(){o(),i&&i()}),1e4);window[s]=function(t){clearTimeout(a),o(),e(t)},document.head.appendChild(r)}class gu extends Error{constructor(t){super("Unexpected response status: "+t.status),this.name="ResponseError",this.response=t}}class fu extends Error{constructor(t){super("Failed to issue request"),this.name="ClientError",this.client=t}}function pu(t){return new Promise((function(e,i){const n=new XMLHttpRequest;n.addEventListener("load",(function(t){const n=t.target;if(!n.status||n.status>=200&&n.status<300){let t;try{t=JSON.parse(n.responseText)}catch(t){const e="Error parsing response text as JSON: "+t.message;return void i(new Error(e))}e(t)}else i(new gu(n))})),n.addEventListener("error",(function(t){i(new fu(t.target))})),n.open("GET",t),n.setRequestHeader("Accept","application/json"),n.send()}))}function _u(t,e){return e.includes("://")?e:new URL(e,t).href}function mu(t,e,i,n,r,s,o){let a,l;void 0!==i&&void 0!==n?(a=t-i,l=e-n):void 0!==r&&void 0!==s?(a=r-t,l=s-e):(a=1,l=0);const h=Math.hypot(a,l),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===r||void 0===s)return[t+a*o,e+l*o];const d=gi([t,e],[i,n],[r,s]);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]}class yu{drawCustom(t,e,i,n,r){}drawGeometry(t){}setStyle(t){}drawCircle(t,e,i){}drawFeature(t,e,i){}drawGeometryCollection(t,e,i){}drawLineString(t,e,i){}drawMultiLineString(t,e,i){}drawMultiPoint(t,e,i){}drawMultiPolygon(t,e,i){}drawPoint(t,e,i){}drawPolygon(t,e,i){}drawText(t,e,i){}setFillStrokeStyle(t,e){}setImageStyle(t,e){}setTextStyle(t,e){}}class xu extends yu{constructor(t,e,i,n,r,s,o){super(),this.context_=t,this.pixelRatio_=e,this.extent_=i,this.transform_=n,this.transformRotation_=n?ke(Math.atan2(n[1],n[0]),10):0,this.viewRotation_=r,this.squaredTolerance_=s,this.userTransform_=o,this.contextFillState_=null,this.contextStrokeState_=null,this.contextTextState_=null,this.fillState_=null,this.strokeState_=null,this.image_=null,this.imageAnchorX_=0,this.imageAnchorY_=0,this.imageHeight_=0,this.imageOpacity_=0,this.imageOriginX_=0,this.imageOriginY_=0,this.imageRotateWithView_=!1,this.imageRotation_=0,this.imageScale_=[0,0],this.imageWidth_=0,this.text_="",this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=!1,this.textRotation_=0,this.textScale_=[0,0],this.textFillState_=null,this.textStrokeState_=null,this.textState_=null,this.pixelCoordinates_=[],this.tmpLocalTransform_=[1,0,0,1,0,0]}drawImages_(t,e,i,n){if(!this.image_)return;const r=cr(t,e,i,n,this.transform_,this.pixelCoordinates_),s=this.context_,o=this.tmpLocalTransform_,a=s.globalAlpha;1!=this.imageOpacity_&&(s.globalAlpha=a*this.imageOpacity_);let l=this.imageRotation_;0===this.transformRotation_&&(l-=this.viewRotation_),this.imageRotateWithView_&&(l+=this.viewRotation_);for(let t=0,e=r.length;t<e;t+=2){const e=r[t]-this.imageAnchorX_,i=r[t+1]-this.imageAnchorY_;if(0!==l||1!=this.imageScale_[0]||1!=this.imageScale_[1]){const t=e+this.imageAnchorX_,n=i+this.imageAnchorY_;nr(o,t,n,1,1,l,-t,-n),s.save(),s.transform.apply(s,o),s.translate(t,n),s.scale(this.imageScale_[0],this.imageScale_[1]),s.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,-this.imageAnchorX_,-this.imageAnchorY_,this.imageWidth_,this.imageHeight_),s.restore()}else s.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,e,i,this.imageWidth_,this.imageHeight_)}1!=this.imageOpacity_&&(s.globalAlpha=a)}drawText_(t,e,i,n){if(!this.textState_||""===this.text_)return;this.textFillState_&&this.setContextFillState_(this.textFillState_),this.textStrokeState_&&this.setContextStrokeState_(this.textStrokeState_),this.setContextTextState_(this.textState_);const r=cr(t,e,i,n,this.transform_,this.pixelCoordinates_),s=this.context_;let o=this.textRotation_;for(0===this.transformRotation_&&(o-=this.viewRotation_),this.textRotateWithView_&&(o+=this.viewRotation_);e<i;e+=n){const t=r[e]+this.textOffsetX_,i=r[e+1]+this.textOffsetY_;0!==o||1!=this.textScale_[0]||1!=this.textScale_[1]?(s.save(),s.translate(t-this.textOffsetX_,i-this.textOffsetY_),s.rotate(o),s.translate(this.textOffsetX_,this.textOffsetY_),s.scale(this.textScale_[0],this.textScale_[1]),this.textStrokeState_&&s.strokeText(this.text_,0,0),this.textFillState_&&s.fillText(this.text_,0,0),s.restore()):(this.textStrokeState_&&s.strokeText(this.text_,t,i),this.textFillState_&&s.fillText(this.text_,t,i))}}moveToLineTo_(t,e,i,n,r,s){const o=this.context_;let a=cr(t,e,i,n,this.transform_,this.pixelCoordinates_);Math.abs(s)>0&&(a=function(t,e,i,n,r,s){r=r??[],s=s??e;const o=t[0],a=t[1],l=t[t.length-4],h=t[t.length-3];let c,u,d,g,f,p,_,m,y=0;for(let x=0;x<t.length;x+=e){d=c,g=u,f=void 0,p=void 0,x+e<t.length&&(f=t[x+e],p=t[x+e+1]),n&&0===x&&(d=l,g=h),n&&x===t.length-2&&(f=o,p=a),c=t[x],u=t[x+1],[_,m]=mu(c,u,d,g,f,p,i),r[y++]=_,r[y++]=m;for(let e=2;e<s;e++)r[y++]=t[x+e]}return r.length!=y&&(r.length=y),r}(a,n,s,r,a)),o.moveTo(a[0],a[1]);let l=a.length;r&&(l-=2);for(let t=2;t<l;t+=2)o.lineTo(a[t],a[t+1]);return r&&o.closePath(),i}drawRings_(t,e,i,n,r){for(let s=0,o=i.length;s<o;++s)e=this.moveToLineTo_(t,e,i[s],n,!0,r);return e}drawCircle(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),Se(this.extent_,t.getExtent())){if(this.fillState_||this.strokeState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const e=vr(t,this.transform_,this.pixelCoordinates_),i=e[2]-e[0],n=e[3]-e[1],r=Math.sqrt(i*i+n*n),s=this.context_;s.beginPath(),s.arc(e[0],e[1],r,0,2*Math.PI),this.fillState_&&s.fill(),this.strokeState_&&s.stroke()}""!==this.text_&&this.drawText_(t.getCenter(),0,2,2)}}setStyle(t){this.setFillStrokeStyle(t.getFill(),t.getStroke()),this.setImageStyle(t.getImage()),this.setTextStyle(t.getText())}setTransform(t){this.transform_=t}drawGeometry(t){switch(t.getType()){case"Point":this.drawPoint(t);break;case"LineString":this.drawLineString(t);break;case"Polygon":this.drawPolygon(t);break;case"MultiPoint":this.drawMultiPoint(t);break;case"MultiLineString":this.drawMultiLineString(t);break;case"MultiPolygon":this.drawMultiPolygon(t);break;case"GeometryCollection":this.drawGeometryCollection(t);break;case"Circle":this.drawCircle(t)}}drawFeature(t,e){const i=e.getGeometryFunction()(t);i&&(this.setStyle(e),this.drawGeometry(i))}drawGeometryCollection(t){const e=t.getGeometriesArray();for(let t=0,i=e.length;t<i;++t)this.drawGeometry(e[t])}drawPoint(t){this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_));const e=t.getFlatCoordinates(),i=t.getStride();this.image_&&this.drawImages_(e,0,e.length,i),""!==this.text_&&this.drawText_(e,0,e.length,i)}drawMultiPoint(t){this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_));const e=t.getFlatCoordinates(),i=t.getStride();this.image_&&this.drawImages_(e,0,e.length,i),""!==this.text_&&this.drawText_(e,0,e.length,i)}drawLineString(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),Se(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(Se(this.extent_,e)){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);const e=this.context_,i=t.getFlatCoordinates();let n=0;const r=t.getEnds(),s=t.getStride();e.beginPath();for(let t=0,e=r.length;t<e;++t)n=this.moveToLineTo_(i,n,r[t],s,!1,this.strokeState_.strokeOffset);e.stroke()}if(""!==this.text_){const e=t.getFlatMidpoints();this.drawText_(e,0,e.length,2)}}}drawPolygon(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),Se(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_)),Se(this.extent_,t.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const e=this.context_,i=t.getOrientedFlatCoordinates();let n=0;const r=t.getEndss(),s=t.getStride();e.beginPath();for(let t=0,e=r.length;t<e;++t){const e=r[t];n=this.drawRings_(i,n,e,s,this.strokeState_?.strokeOffset)}this.fillState_&&e.fill(),this.strokeState_&&e.stroke()}if(""!==this.text_){const e=t.getFlatInteriorPoints();this.drawText_(e,0,e.length,2)}}}setContextFillState_(t){const e=this.context_,i=this.contextFillState_;i?i.fillStyle!=t.fillStyle&&(i.fillStyle=t.fillStyle,e.fillStyle=t.fillStyle):(e.fillStyle=t.fillStyle,this.contextFillState_={fillStyle:t.fillStyle})}setContextStrokeState_(t){const e=this.context_,i=this.contextStrokeState_;i?(i.lineCap!=t.lineCap&&(i.lineCap=t.lineCap,e.lineCap=t.lineCap),w(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:Uh;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:Mh(e||Oh)}}else this.fillState_=null;if(e){const t=e.getColor(),i=e.getLineCap(),n=e.getLineDash(),r=e.getLineDashOffset(),s=e.getLineJoin(),o=e.getWidth(),a=e.getMiterLimit(),l=n||Nh,h=e.getOffset();this.strokeState_={lineCap:void 0!==i?i:Dh,lineDash:1===this.pixelRatio_?l:l.map((t=>t*this.pixelRatio_)),lineDashOffset:(r||0)*this.pixelRatio_,lineJoin:void 0!==s?s:kh,lineWidth:(void 0!==o?o:1)*this.pixelRatio_,miterLimit:void 0!==a?a:Gh,strokeStyle:Mh(t||jh),strokeOffset:(h??0)*this.pixelRatio_}}else this.strokeState_=null}setImageStyle(t){let e;if(!t||!(e=t.getSize()))return void(this.image_=null);const i=t.getPixelRatio(this.pixelRatio_),n=t.getAnchor(),r=t.getOrigin();this.image_=t.getImage(this.pixelRatio_),this.imageAnchorX_=n[0]*i,this.imageAnchorY_=n[1]*i,this.imageHeight_=e[1]*i,this.imageOpacity_=t.getOpacity(),this.imageOriginX_=r[0],this.imageOriginY_=r[1],this.imageRotateWithView_=t.getRotateWithView(),this.imageRotation_=t.getRotation();const s=t.getScaleArray();this.imageScale_=[s[0]*this.pixelRatio_/i,s[1]*this.pixelRatio_/i],this.imageWidth_=e[0]*i}setTextStyle(t){if(t){const e=t.getFill();if(e){const t=e.getColor();this.textFillState_={fillStyle:Mh(t||Oh)}}else this.textFillState_=null;const i=t.getStroke();if(i){const t=i.getColor(),e=i.getLineCap(),n=i.getLineDash(),r=i.getLineDashOffset(),s=i.getLineJoin(),o=i.getWidth(),a=i.getMiterLimit();this.textStrokeState_={lineCap:void 0!==e?e:Dh,lineDash:n||Nh,lineDashOffset:r||0,lineJoin:void 0!==s?s:kh,lineWidth:void 0!==o?o:1,miterLimit:void 0!==a?a:Gh,strokeStyle:Mh(t||jh)}}else this.textStrokeState_=null;const n=t.getFont(),r=t.getOffsetX(),s=t.getOffsetY(),o=t.getRotateWithView(),a=t.getRotation(),l=t.getScaleArray(),h=t.getText(),c=t.getTextAlign(),u=t.getTextBaseline();this.textState_={font:void 0!==n?n:Ah,textAlign:void 0!==c?c:Uh,textBaseline:void 0!==u?u:Bh},this.text_=void 0!==h?Array.isArray(h)?h.reduce(((t,e,i)=>t+(i%2?" ":e)),""):h:"",this.textOffsetX_=void 0!==r?this.pixelRatio_*r:0,this.textOffsetY_=void 0!==s?this.pixelRatio_*s:0,this.textRotateWithView_=void 0!==o&&o,this.textRotation_=void 0!==a?a:0,this.textScale_=[this.pixelRatio_*l[0],this.pixelRatio_*l[1]]}else this.text_=""}}const vu={Point:function(t,e,i,n,r,s){const o=i.getImage(),a=i.getText(),l=a&&a.getText(),h=s&&o&&l?{}:void 0;if(o){if(o.getImageState()!=Ms)return;const s=t.getBuilder(i.getZIndex(),"Image");s.setImageStyle(o,h),s.drawPoint(e,n,r)}if(l){const s=t.getBuilder(i.getZIndex(),"Text");s.setTextStyle(a,h),s.drawText(e,n,r)}},LineString:function(t,e,i,n,r){const s=i.getStroke();if(s){const o=t.getBuilder(i.getZIndex(),"LineString");o.setFillStrokeStyle(null,s),o.drawLineString(e,n,r)}const o=i.getText();if(o&&o.getText()){const s=t.getBuilder(i.getZIndex(),"Text");s.setTextStyle(o),s.drawText(e,n,r)}},Polygon:function(t,e,i,n,r){const s=i.getFill(),o=i.getStroke();if(s||o){const a=t.getBuilder(i.getZIndex(),"Polygon");a.setFillStrokeStyle(s,o),a.drawPolygon(e,n,r)}const a=i.getText();if(a&&a.getText()){const s=t.getBuilder(i.getZIndex(),"Text");s.setTextStyle(a),s.drawText(e,n,r)}},MultiPoint:function(t,e,i,n,r,s){const o=i.getImage(),a=o&&0!==o.getOpacity(),l=i.getText(),h=l&&l.getText(),c=s&&a&&h?{}:void 0;if(a){if(o.getImageState()!=Ms)return;const s=t.getBuilder(i.getZIndex(),"Image");s.setImageStyle(o,c),s.drawMultiPoint(e,n,r)}if(h){const s=t.getBuilder(i.getZIndex(),"Text");s.setTextStyle(l,c),s.drawText(e,n,r)}},MultiLineString:function(t,e,i,n,r){const s=i.getStroke();if(s){const o=t.getBuilder(i.getZIndex(),"LineString");o.setFillStrokeStyle(null,s),o.drawMultiLineString(e,n,r)}const o=i.getText();if(o&&o.getText()){const s=t.getBuilder(i.getZIndex(),"Text");s.setTextStyle(o),s.drawText(e,n,r)}},MultiPolygon:function(t,e,i,n,r){const s=i.getFill(),o=i.getStroke();if(o||s){const a=t.getBuilder(i.getZIndex(),"Polygon");a.setFillStrokeStyle(s,o),a.drawMultiPolygon(e,n,r)}const a=i.getText();if(a&&a.getText()){const s=t.getBuilder(i.getZIndex(),"Text");s.setTextStyle(a),s.drawText(e,n,r)}},GeometryCollection:function(t,e,i,n,r,s){const o=e.getGeometriesArray();let a,l;for(a=0,l=o.length;a<l;++a){(0,vu[o[a].getType()])(t,o[a],i,n,r,s)}},Circle:function(t,e,i,n,r){const s=i.getFill(),o=i.getStroke();if(s||o){const a=t.getBuilder(i.getZIndex(),"Circle");a.setFillStrokeStyle(s,o),a.drawCircle(e,n,r)}const a=i.getText();if(a&&a.getText()){const r=t.getBuilder(i.getZIndex(),"Text");r.setTextStyle(a),r.drawText(e,n)}}};function Su(t,e){return parseInt(z(t),10)-parseInt(z(e),10)}function Eu(t,e){const i=wu(t,e);return i*i}function wu(t,e){return.5*t/e}function Tu(t,e,i,n,r,s,o,a){const l=[],h=i.getImage();if(h){let t=!0;const e=h.getImageState();e==Ms||e==As?t=!1:e==Fs&&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((()=>r(null))),function(t,e,i,n,r,s,o){const a=i.getGeometryFunction()(e);if(!a)return;const l=a.simplifyTransformed(n,r),h=i.getRenderer();if(h)Cu(t,l,i,e,o);else{(0,vu[l.getType()])(t,l,i,e,o,s)}}(t,e,i,n,s,o,a),u}function Cu(t,e,i,n,r){if("GeometryCollection"==e.getType()){const s=e.getGeometries();for(let e=0,o=s.length;e<o;++e)Cu(t,s[e],i,n,r);return}t.getBuilder(i.getZIndex(),"Default").drawCustom(e,n,i.getRenderer(),i.getHitDetectionRenderer(),r)}function bu(t){if(!(t.context instanceof CanvasRenderingContext2D))throw new Error("Only works for render events from Canvas 2D layers");const e=t.inversePixelTransform[0],i=t.inversePixelTransform[1],n=Math.sqrt(e*e+i*i),r=t.frameState,s=Kn(t.inversePixelTransform.slice(),r.coordinateToPixelTransform),o=Eu(r.viewState.resolution,n);let a;const l=Gn();return l&&(a=Ln(l,r.viewState.projection)),new xu(t.context,n,r.extent,s,r.viewState.rotation,o,a)}let Ru;const Pu=[];function Iu(t,e,i,n,r){t.beginPath(),t.moveTo(0,0),t.lineTo(e,i),t.lineTo(n,r),t.closePath(),t.save(),t.clip(),t.fillRect(0,0,Math.max(e,n)+1,Math.max(i,r)),t.restore()}function Fu(t,e){return Math.abs(t[4*e]-210)>2||Math.abs(t[4*e+3]-191.25)>2}function Lu(t,e,i,n){const r=On(i,e,t);let s=wn(e,n,i);const o=e.getMetersPerUnit();void 0!==o&&(s*=o);const a=t.getMetersPerUnit();void 0!==a&&(s/=a);const l=t.getExtent();if(!l||$t(l,r)){const e=wn(t,s,r)/s;isFinite(e)&&e>0&&(s/=e)}return s}function Mu(t,e,i,n){const r=de(i);let s=Lu(t,e,r,n);return(!isFinite(s)||s<=0)&&le(i,(function(i){return s=Lu(t,e,i,n),isFinite(s)&&s>0})),s}function Au(t,e,i,n,r,s,o,a,l,h,c,u,d,g){const f=ft(Math.round(i*t),Math.round(i*e),Pu);if(u||(f.imageSmoothingEnabled=!1),0===l.length)return f.canvas;function p(t){return Math.round(t*i)/i}f.scale(i,i),f.globalCompositeOperation="lighter";const _=[1/0,1/0,-1/0,-1/0];let m;l.forEach((function(t,e,i){ie(_,t.extent)}));const y=i/n,x=(u?1:1+Math.pow(2,-24))/y;if(!d||1!==l.length||0!==h){if(m=ft(Math.round(ve(_)*y),Math.round(_e(_)*y),Pu),u||(m.imageSmoothingEnabled=!1),r&&g){const t=(r[0]-_[0])*y,e=-(r[3]-_[3])*y,i=ve(r)*y,n=_e(r)*y;m.rect(t,e,i,n),m.clip()}l.forEach((function(t,e,i){if(t.image.width>0&&t.image.height>0){if(t.clipExtent){m.save();const e=(t.clipExtent[0]-_[0])*y,i=-(t.clipExtent[3]-_[3])*y,n=ve(t.clipExtent)*y,r=_e(t.clipExtent)*y;m.rect(u?e:Math.round(e),u?i:Math.round(i),u?n:Math.round(e+n)-Math.round(e),u?r:Math.round(i+r)-Math.round(i)),m.clip()}const e=(t.extent[0]-_[0])*y,i=-(t.extent[3]-_[3])*y,n=ve(t.extent)*y,r=_e(t.extent)*y;m.drawImage(t.image,h,h,t.image.width-2*h,t.image.height-2*h,u?e:Math.round(e),u?i:Math.round(i),u?n:Math.round(e+n)-Math.round(e),u?r:Math.round(i+r)-Math.round(i)),t.clipExtent&&m.restore()}}))}const v=ye(o);return a.getTriangles().forEach((function(t,e,i){const n=t.source,r=t.target;let o=n[0][0],a=n[0][1],h=n[1][0],c=n[1][1],d=n[2][0],g=n[2][1];const y=p((r[0][0]-v[0])/s),S=p(-(r[0][1]-v[1])/s),E=p((r[1][0]-v[0])/s),w=p(-(r[1][1]-v[1])/s),T=p((r[2][0]-v[0])/s),C=p(-(r[2][1]-v[1])/s),b=o,R=a;o=0,a=0,h-=b,c-=R,d-=b,g-=R;const P=Me([[h,c,0,0,E-y],[d,g,0,0,T-y],[0,0,h,c,w-S],[0,0,d,g,C-S]]);if(!P)return;if(f.save(),f.beginPath(),function(){if(void 0===Ru){const t=ft(6,6,Pu);t.globalCompositeOperation="lighter",t.fillStyle="rgba(210, 0, 0, 0.75)",Iu(t,4,5,4,0),Iu(t,4,5,0,5);const e=t.getImageData(0,0,3,3).data;Ru=Fu(e,0)||Fu(e,4)||Fu(e,8),mt(t),Pu.push(t.canvas)}return Ru}()||!u){f.moveTo(E,w);const t=4,e=y-E,i=S-w;for(let n=0;n<t;n++)f.lineTo(E+p((n+1)*e/t),w+p(n*i/(t-1))),n!=t-1&&f.lineTo(E+p((n+1)*e/t),w+p((n+1)*i/(t-1)));f.lineTo(T,C)}else f.moveTo(E,w),f.lineTo(y,S),f.lineTo(T,C);let I;if(f.clip(),f.transform(P[0],P[2],P[1],P[3],y,S),f.translate(_[0]-b,_[3]-R),m)I=m.canvas,f.scale(x,-x);else{const t=l[0],e=t.extent;I=t.image,f.scale(ve(e)/I.width,-_e(e)/I.height)}f.drawImage(I,0,0),f.restore()})),m&&(mt(m),Pu.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,r=(n[0][0]-v[0])/s,o=-(n[0][1]-v[1])/s,a=(n[1][0]-v[0])/s,l=-(n[1][1]-v[1])/s,h=(n[2][0]-v[0])/s,c=-(n[2][1]-v[1])/s;f.beginPath(),f.moveTo(a,l),f.lineTo(r,o),f.lineTo(h,c),f.closePath(),f.stroke()})),f.restore()),f.canvas}function Ou(t){return Array.isArray(t)?Math.min(...t):t}class Du{constructor(t){this.highWaterMark=void 0!==t?t:2048,this.count_=0,this.entries_={},this.oldest_=null,this.newest_=null}deleteOldest(){const t=this.pop();t instanceof _&&t.dispose()}canExpireCache(){return this.highWaterMark>0&&this.getCount()>this.highWaterMark}expireCache(t){for(;this.canExpireCache();)this.deleteOldest()}clear(){for(;this.oldest_;)this.deleteOldest()}containsKey(t){return this.entries_.hasOwnProperty(t)}forEach(t){let e=this.oldest_;for(;e;)t(e.value_,e.key_,this),e=e.newer}get(t,e){const i=this.entries_[t];return Mt(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 Mt(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){Mt(!(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 Nu(t,e,i,n){return void 0!==n?(n[0]=t,n[1]=e,n[2]=i,n):[t,e,i]}function ku(t,e,i){return t+"/"+e+"/"+i}function Gu(t){return ku(t[0],t[1],t[2])}function ju(t,e,i,n,r){return`${z(t)},${e},${ku(i,n,r)}`}function Uu(t){return Bu(t[0],t[1],t[2])}function Bu(t,e,i){return(e<<t)+i}function zu(t,e){const i=t[0],n=t[1],r=t[2];if(e.getMinZoom()>i||i>e.getMaxZoom())return!1;const s=e.getFullTileRange(i);return!s||s.containsXY(n,r)}const Xu=[0,0,0];class Vu{constructor(t){let e;if(this.minZoom=void 0!==t.minZoom?t.minZoom:0,this.resolutions_=t.resolutions,Mt(T(this.resolutions_,((t,e)=>e-t),!0),"`resolutions` must be sorted in descending order"),!t.origins)for(let t=0,i=this.resolutions_.length-1;t<i;++t)if(e){if(this.resolutions_[t]/this.resolutions_[t+1]!==e){e=void 0;break}}else e=this.resolutions_[t]/this.resolutions_[t+1];this.zoomFactor_=e,this.maxZoom=this.resolutions_.length-1,this.origin_=void 0!==t.origin?t.origin:null,this.origins_=null,void 0!==t.origins&&(this.origins_=t.origins,Mt(this.origins_.length==this.resolutions_.length,"Number of `origins` and `resolutions` must be equal"));const i=t.extent;void 0===i||this.origin_||this.origins_||(this.origin_=ye(i)),Mt(!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,Mt(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:Co,Mt(!this.tileSize_&&this.tileSizes_||this.tileSize_&&!this.tileSizes_,"Either `tileSize` or `tileSizes` must be configured, never both"),this.extent_=void 0!==i?i:null,this.fullTileRanges_=null,this.tmpSize_=[0,0],this.tmpExtent_=[0,0,0,0],void 0!==t.sizes?this.fullTileRanges_=t.sizes.map(((t,e)=>{const n=new iu(Math.min(0,t[0]),Math.max(t[0]-1,-1),Math.min(0,t[1]),Math.max(t[1]-1,-1));if(i){const t=this.getTileRangeForExtentAndZ(i,e);n.minX=Math.max(t.minX,n.minX),n.maxX=Math.min(t.maxX,n.maxX),n.minY=Math.max(t.minY,n.minY),n.maxY=Math.min(t.maxY,n.maxY)}return n})):i&&this.calculateTileRanges_(i)}forEachTileCoord(t,e,i){const n=this.getTileRangeForExtentAndZ(t,e);for(let t=n.minX,r=n.maxX;t<=r;++t)for(let r=n.minY,s=n.maxY;r<=s;++r)i([e,t,r])}forEachTileCoordParentTileRange(t,e,i,n){let r,s,o,a=null,l=t[0]-1;for(2===this.zoomFactor_?(s=t[1],o=t[2]):a=this.getTileCoordExtent(t,n);l>=this.minZoom;){if(void 0!==s&&void 0!==o?(s=Math.floor(s/2),o=Math.floor(o/2),r=nu(s,s,o,o,i)):r=this.getTileRangeForExtentAndZ(a,l,i),e(l,r))return!0;--l}return!1}getExtent(){return this.extent_}getMaxZoom(){return this.maxZoom}getMinZoom(){return this.minZoom}getOrigin(t){return this.origin_?this.origin_:this.origins_[t]}getOrigins(){return this.origins_}getResolution(t){return this.resolutions_[t]}getResolutions(){return this.resolutions_}getTileCoordChildTileRange(t,e,i){if(t[0]<this.maxZoom){if(2===this.zoomFactor_){const i=2*t[1],n=2*t[2];return nu(i,i+1,n,n+1,e)}const n=this.getTileCoordExtent(t,i||this.tmpExtent_);return this.getTileRangeForExtentAndZ(n,t[0]+1,e)}return null}getTileRangeForTileCoordAndZ(t,e,i){if(e>this.maxZoom||e<this.minZoom)return null;const n=t[0],r=t[1],s=t[2];if(e===n)return nu(r,s,r,s,i);if(this.zoomFactor_){const t=Math.pow(this.zoomFactor_,e-n),o=Math.floor(r*t),a=Math.floor(s*t);if(e<n)return nu(o,o,a,a,i);return nu(o,Math.floor(t*(r+1))-1,a,Math.floor(t*(s+1))-1,i)}const o=this.getTileCoordExtent(t,this.tmpExtent_);return this.getTileRangeForExtentAndZ(o,e,i)}getTileRangeForExtentAndZ(t,e,i){this.getTileCoordForXYAndZ_(t[0],t[3],e,!1,Xu);const n=Xu[1],r=Xu[2];this.getTileCoordForXYAndZ_(t[2],t[1],e,!0,Xu);return nu(n,Xu[1],r,Xu[2],i)}getTileCoordCenter(t){const e=this.getOrigin(t[0]),i=this.getResolution(t[0]),n=Wl(this.getTileSize(t[0]),this.tmpSize_);return[e[0]+(t[1]+.5)*n[0]*i,e[1]-(t[2]+.5)*n[1]*i]}getTileCoordExtent(t,e){const i=this.getOrigin(t[0]),n=this.getResolution(t[0]),r=Wl(this.getTileSize(t[0]),this.tmpSize_),s=i[0]+t[1]*r[0]*n,o=i[1]-(t[2]+1)*r[1]*n;return Kt(s,o,s+r[0]*n,o+r[1]*n,e)}getTileCoordForCoordAndResolution(t,e,i){return this.getTileCoordForXYAndResolution_(t[0],t[1],e,!1,i)}getTileCoordForXYAndResolution_(t,e,i,n,r){const s=this.getZForResolution(i),o=i/this.getResolution(s),a=this.getOrigin(s),l=Wl(this.getTileSize(s),this.tmpSize_);let h=o*(t-a[0])/i/l[0],c=o*(a[1]-e)/i/l[1];return n?(h=Ue(h,5)-1,c=Ue(c,5)-1):(h=je(h,5),c=je(c,5)),Nu(s,h,c,r)}getTileCoordForXYAndZ_(t,e,i,n,r){const s=this.getOrigin(i),o=this.getResolution(i),a=Wl(this.getTileSize(i),this.tmpSize_);let l=(t-s[0])/o/a[0],h=(s[1]-e)/o/a[1];return n?(l=Ue(l,5)-1,h=Ue(h,5)-1):(l=je(l,5),h=je(h,5)),Nu(i,l,h,r)}getTileCoordForCoordAndZ(t,e,i){return this.getTileCoordForXYAndZ_(t[0],t[1],e,!1,i)}getTileCoordResolution(t){return this.resolutions_[t[0]]}getTileSize(t){return this.tileSize_?this.tileSize_:this.tileSizes_[t]}getFullTileRange(t){return this.fullTileRanges_?this.fullTileRanges_[t]:this.extent_?this.getTileRangeForExtentAndZ(this.extent_,t):null}getZForResolution(t,e){return Ie(v(this.resolutions_,t,e||0),this.minZoom,this.maxZoom)}tileCoordIntersectsViewport(t,e){return ns(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}}class $u extends Vu{constructor(t){super({extent:t.extent,origin:t.origin,origins:t.origins,resolutions:t.resolutions,tileSize:t.tileSize,tileSizes:t.tileSizes,sizes:t.sizes}),this.matrixIds_=t.matrixIds}getMatrixId(t){return this.matrixIds_[t]}getMatrixIds(){return this.matrixIds_}}function Wu(t,e,i){const n=[],r=[],s=[],o=[],a=[];i=void 0!==i?i:[];const l="TileMatrix",h="Identifier",c="ScaleDenominator",u="TopLeftCorner",d=En(t.SupportedCRS),g=d.getMetersPerUnit(),f=d.getAxisOrientation().startsWith("ne");return t[l].sort((function(t,e){return e[c]-t[c]})),t[l].forEach((function(e){let d;if(d=!(i.length>0)||i.find((function(i){return e[h]==i[l]||!e[h].includes(":")&&t[h]+":"+e[h]===i[l]})),d){r.push(e[h]);const t=28e-5*e[c]/g,i=e.TileWidth,l=e.TileHeight;f?s.push([e[u][1],e[u][0]]):s.push(e[u]),n.push(t),o.push(i==l?i:[i,l]),a.push([e.MatrixWidth,e.MatrixHeight])}})),new $u({extent:e,origins:s,resolutions:n,matrixIds:r,tileSizes:o,sizes:a})}function Zu(t){let e=t.getDefaultTileGrid();return e||(e=Ju(t),t.setDefaultTileGrid(e)),e}function Yu(t,e,i){const n=e[0],r=t.getTileCoordCenter(e),s=Qu(i);if(!$t(s,r)){const e=ve(s),i=Math.ceil((s[0]-r[0])/e);return r[0]+=e*i,t.getTileCoordForCoordAndZ(r,n)}return e}function Hu(t,e,i,n){n=void 0!==n?n:"top-left";const r=qu(t,e,i);return new Vu({extent:t,origin:ge(t,n),resolutions:r,tileSize:i})}function Ku(t){const e=t||{},i=e.extent||En("EPSG:3857").getExtent(),n={extent:i,minZoom:e.minZoom,tileSize:e.tileSize,resolutions:qu(i,e.maxZoom,e.tileSize,e.maxResolution)};return new Vu(n)}function qu(t,e,i,n){e=void 0!==e?e:42,i=Wl(void 0!==i?i:Co);const r=_e(t),s=ve(t);n=n>0?n:Math.max(s/i[0],r/i[1]);const o=e+1,a=new Array(o);for(let t=0;t<o;++t)a[t]=n/Math.pow(2,t);return a}function Ju(t,e,i,n){return Hu(Qu(t),e,i,n)}function Qu(t){let e=(t=En(t)).getExtent();if(!e){const i=180*_i.degrees/t.getMetersPerUnit();e=Kt(-i,-i,i,i)}return e}function td(t,e){const i=[];Object.keys(e).forEach((function(t){null!==e[t]&&void 0!==e[t]&&i.push(t+"="+encodeURIComponent(e[t]))}));const n=i.join("&");return t=t.replace(/[?&]$/,""),(t+=t.includes("?")?"&":"?")+n}const ed=/\{z\}/g,id=/\{x\}/g,nd=/\{y\}/g,rd=/\{-y\}/g;function sd(t,e,i,n,r){return t.replace(ed,e.toString()).replace(id,i.toString()).replace(nd,n.toString()).replace(rd,(function(){if(void 0===r)throw new Error("If the URL template has a {-y} placeholder, the grid extent must be known");return(r-n).toString()}))}function od(t,e,i,n){return t[De(Bu(e,i,n),t.length)]}function ad(t){const e=[];let i=/\{([a-z])-([a-z])\}/.exec(t);if(i){const n=i[1].charCodeAt(0),r=i[2].charCodeAt(0);let s;for(s=n;s<=r;++s)e.push(t.replace(i[0],String.fromCharCode(s)));return e}if(i=/\{(\d+)-(\d+)\}/.exec(t),i){const n=parseInt(i[2],10);for(let r=parseInt(i[1],10);r<=n;r++)e.push(t.replace(i[0],r.toString()));return e}return e.push(t),e}function ld(t,e){return function(i,n,r){if(!i)return;let s;const o=i[0];if(e){const t=e.getFullTileRange(o);t&&(s=t.getHeight()-1)}return sd(t,o,i[1],i[2],s)}}function hd(t,e){const i=t.length,n=new Array(i);for(let r=0;r<i;++r)n[r]=ld(t[r],e);return cd(n)}function cd(t){return 1===t.length?t[0]:function(e,i,n){if(!e)return;const r=De(Uu(e),t.length);return t[r](e,i,n)}}function ud(t,e,i){}class dd{constructor(t,e,i,n,r,s,o){this.sourceProj_=t,this.targetProj_=e;let a={};const l=o?Rn((t=>Qn(o,On(t,this.targetProj_,this.sourceProj_)))):An(this.targetProj_,this.sourceProj_);this.transformInv_=function(t){const e=t[0]+"/"+t[1];return a[e]||(a[e]=l(t)),a[e]},this.maxSourceExtent_=n,this.errorThresholdSquared_=r*r,this.triangles_=[],this.wrapsXInSource_=!1,this.canWrapXInSource_=this.sourceProj_.canWrapX()&&!!n&&!!this.sourceProj_.getExtent()&&ve(n)>=ve(this.sourceProj_.getExtent()),this.sourceWorldWidth_=this.sourceProj_.getExtent()?ve(this.sourceProj_.getExtent()):null,this.targetWorldWidth_=this.targetProj_.getExtent()?ve(this.targetProj_.getExtent()):null;const h=ye(i),c=xe(i),u=ue(i),d=ce(i),g=this.transformInv_(h),f=this.transformInv_(c),p=this.transformInv_(u),_=this.transformInv_(d),m=10+(s?Math.max(0,Math.ceil(Math.log2(he(i)/(s*s*256*256)))):0);if(this.addQuad_(h,c,u,d,g,f,p,_,m),this.wrapsXInSource_){let t=1/0;this.triangles_.forEach((function(e,i,n){t=Math.min(t,e.source[0][0],e.source[1][0],e.source[2][0])})),this.triangles_.forEach((e=>{if(Math.max(e.source[0][0],e.source[1][0],e.source[2][0])-t>this.sourceWorldWidth_/2){const i=[[e.source[0][0],e.source[0][1]],[e.source[1][0],e.source[1][1]],[e.source[2][0],e.source[2][1]]];i[0][0]-t>this.sourceWorldWidth_/2&&(i[0][0]-=this.sourceWorldWidth_),i[1][0]-t>this.sourceWorldWidth_/2&&(i[1][0]-=this.sourceWorldWidth_),i[2][0]-t>this.sourceWorldWidth_/2&&(i[2][0]-=this.sourceWorldWidth_);const n=Math.min(i[0][0],i[1][0],i[2][0]);Math.max(i[0][0],i[1][0],i[2][0])-n<this.sourceWorldWidth_/2&&(e.source=i)}}))}a={}}addTriangle_(t,e,i,n,r,s){this.triangles_.push({source:[n,r,s],target:[t,e,i]})}addQuad_(t,e,i,n,r,s,o,a,l){const h=Bt([r,s,o,a]),c=this.sourceWorldWidth_?ve(h)/this.sourceWorldWidth_:null,u=this.sourceWorldWidth_,d=this.sourceProj_.canWrapX()&&c>.5&&c<1;let g=!1;if(l>0){if(this.targetProj_.isGlobal()&&this.targetWorldWidth_){g=ve(Bt([t,e,i,n]))/this.targetWorldWidth_>.25||g}!d&&this.sourceProj_.isGlobal()&&c&&(g=c>.25||g)}if(!g&&this.maxSourceExtent_&&isFinite(h[0])&&isFinite(h[1])&&isFinite(h[2])&&isFinite(h[3])&&!Se(h,this.maxSourceExtent_))return;let f=0;if(!(g||isFinite(r[0])&&isFinite(r[1])&&isFinite(s[0])&&isFinite(s[1])&&isFinite(o[0])&&isFinite(o[1])&&isFinite(a[0])&&isFinite(a[1])))if(l>0)g=!0;else if(f=(isFinite(r[0])&&isFinite(r[1])?0:8)+(isFinite(s[0])&&isFinite(s[1])?0:4)+(isFinite(o[0])&&isFinite(o[1])?0:2)+(isFinite(a[0])&&isFinite(a[1])?0:1),1!=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 s;if(d){s=(De(r[0],u)+De(o[0],u))/2-De(n[0],u)}else s=(r[0]+o[0])/2-n[0];const a=(r[1]+o[1])/2-n[1];g=s*s+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,r,s,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,r,c,d,a,l-1),this.addQuad_(h,e,i,u,c,s,o,d,l-1)}return}}if(d){if(!this.canWrapXInSource_)return;this.wrapsXInSource_=!0}11&f||this.addTriangle_(t,i,n,r,o,a),14&f||this.addTriangle_(t,i,e,r,o,s),f&&(13&f||this.addTriangle_(e,n,t,s,a,r),7&f||this.addTriangle_(e,n,i,s,a,o))}calculateSourceExtent(){const t=[1/0,1/0,-1/0,-1/0];return this.triangles_.forEach((function(e,i,n){const r=e.source;ne(t,r[0]),ne(t,r[1]),ne(t,r[2])})),t}getTriangles(){return this.triangles_}}const gd=.5;class fd extends nt{constructor(t,e,i,n,r,s,o,a,l,h,c,u){super(r,Y,u),this.renderEdges_=void 0!==c&&c,this.pixelRatio_=o,this.gutter_=a,this.canvas_=null,this.sourceTileGrid_=e,this.targetTileGrid_=n,this.wrappedTileCoord_=s||r,this.sourceTiles_=[],this.sourcesListenerKeys_=null,this.sourceZ_=0,this.clipExtent_=t.canWrapX()?t.getExtent():void 0;const d=n.getTileCoordExtent(this.wrappedTileCoord_),g=this.targetTileGrid_.getExtent();let f=this.sourceTileGrid_.getExtent();const p=g?me(d,g):d;if(0===he(p))return void(this.state=J);const _=t.getExtent();_&&(f=f?me(f,_):_);const m=n.getResolution(this.wrappedTileCoord_[0]),y=Mu(t,i,p,m);if(!isFinite(y)||y<=0)return void(this.state=J);const x=void 0!==h?h:gd;if(this.triangulation_=new dd(t,i,p,f,y*x,m),0===this.triangulation_.getTriangles().length)return void(this.state=J);this.sourceZ_=e.getZForResolution(y);let v=this.triangulation_.calculateSourceExtent();if(f&&(t.canWrapX()?(v[1]=Ie(v[1],f[1],f[3]),v[3]=Ie(v[3],f[1],f[3])):v=me(v,f)),he(v)){let i=0,n=0;t.canWrapX()&&(i=ve(_),n=Math.floor((v[0]-_[0])/i));Pe(v.slice(),t,!0).forEach((t=>{const r=e.getTileRangeForExtentAndZ(t,this.sourceZ_);for(let t=r.minX;t<=r.maxX;t++)for(let e=r.minY;e<=r.maxY;e++){const r=n*i;this.sourceTiles_.push({getTile:()=>l(this.sourceZ_,t,e,o),offset:r})}++n})),0===this.sourceTiles_.length&&(this.state=J)}else this.state=J}getImage(){return this.canvas_}reproject_(){const t=[];if(this.sourceTiles_.forEach((e=>{const i=e.tile;if(i&&i.getState()==K){const n=this.sourceTileGrid_.getTileCoordExtent(i.tileCoord);n[0]+=e.offset,n[2]+=e.offset;const r=this.clipExtent_?.slice();r&&(r[0]+=e.offset,r[2]+=e.offset),t.push({extent:n,clipExtent:r,image:i.getImage()})}})),this.sourceTiles_.length=0,0===t.length)this.state=q;else{const e=this.wrappedTileCoord_[0],i=this.targetTileGrid_.getTileSize(e),n="number"==typeof i?i:i[0],r="number"==typeof i?i:i[1],s=this.targetTileGrid_.getResolution(e),o=this.sourceTileGrid_.getResolution(this.sourceZ_),a=this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_);this.canvas_=Au(n,r,this.pixelRatio_,o,this.sourceTileGrid_.getExtent(),s,a,this.triangulation_,t,this.gutter_,this.renderEdges_,this.interpolate),this.state=K}this.changed()}load(){for(const t of this.sourceTiles_)t.tile=t.getTile();if(this.state==Y){this.state=H,this.changed();let t=0;this.sourcesListenerKeys_=[],this.sourceTiles_.forEach((({tile:e})=>{const i=e.getState();if(i==Y||i==H){t++;const i=D(e,n,(n=>{const r=e.getState();r!=K&&r!=q&&r!=J||(k(i),t--,0===t&&(this.unlistenSources_(),this.reproject_()))}));this.sourcesListenerKeys_.push(i)}})),0===t?setTimeout(this.reproject_.bind(this),0):this.sourceTiles_.forEach((function({tile:t},e,i){t.getState()==Y&&t.load()}))}}unlistenSources_(){this.sourcesListenerKeys_.forEach(k),this.sourcesListenerKeys_=null}release(){this.canvas_&&(mt(this.canvas_.getContext("2d")),Pu.push(this.canvas_),this.canvas_=null),this.sourceTiles_.length=0,super.release()}}class pd extends V{constructor(t){super(),this.projection=En(t.projection),this.attributions_=_d(t.attributions),this.attributionsCollapsible_=t.attributionsCollapsible??!0,this.loading=!1,this.state_=void 0!==t.state?t.state:"ready",this.wrapX_=void 0!==t.wrapX&&t.wrapX,this.interpolate_=!!t.interpolate,this.viewResolver=null,this.viewRejector=null;const e=this;this.viewPromise_=new Promise((function(t,i){e.viewResolver=t,e.viewRejector=i}))}getAttributions(){return this.attributions_}getAttributionsCollapsible(){return this.attributionsCollapsible_}getProjection(){return this.projection}getResolutions(t){return null}getView(){return this.viewPromise_}getState(){return this.state_}getWrapX(){return this.wrapX_}getInterpolate(){return this.interpolate_}refresh(){this.changed()}setAttributions(t){this.attributions_=_d(t),this.changed()}setState(t){this.state_=t,this.changed()}}function _d(t){return t?"function"==typeof t?t:(Array.isArray(t)||(t=[t]),e=>t):null}class md extends pd{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&&Wl(this.tileGrid.getTileSize(this.tileGrid.getMinZoom()),e),this.tmpSize=[0,0],this.key_=t.key||z(this),this.tileOptions={transition:t.transition,interpolate:t.interpolate},this.zDirection=t.zDirection?t.zDirection:0}getGutterForProjection(t){return 0}getKey(){return this.key_}setKey(t){this.key_!==t&&(this.key_=t,this.changed())}getResolutions(t){const e=t?this.getTileGridForProjection(t):this.tileGrid;return e?e.getResolutions():null}getTile(t,e,i,n,r,s){return U()}getTileGrid(){return this.tileGrid}getTileGridForProjection(t){return this.tileGrid?this.tileGrid:Zu(t)}getTilePixelRatio(t){return this.tilePixelRatio_}getTilePixelSize(t,e,i){const n=this.getTileGridForProjection(i),r=this.getTilePixelRatio(e),s=Wl(n.getTileSize(t),this.tmpSize);return 1==r?s:$l(s,r,this.tmpSize)}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=Yu(n,t,i)),zu(t,n)?t:null}clear(){}refresh(){this.clear(),super.refresh()}}class yd extends M{constructor(t,e){super(t),this.tile=e}}var xd="tileloadstart",vd="tileloadend",Sd="tileloaderror";class Ed extends md{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===Ed.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=z(e),n=e.getState();let r;n==H?(this.tileLoadingKeys_[i]=!0,r=xd):i in this.tileLoadingKeys_&&(delete this.tileLoadingKeys_[i],r=n==q?Sd:n==K?vd:void 0),null!=r&&this.dispatchEvent(new yd(r,e))}setTileLoadFunction(t){this.tileLoadFunction=t,this.changed()}setTileUrlFunction(t,e){this.tileUrlFunction=t,void 0!==e?this.setKey(e):this.changed()}setUrl(t){const e=ad(t);this.urls=e,this.setUrls(e)}setUrls(t){this.urls=t;const e=t.join("\n");this.generateTileUrlFunction_?this.setTileUrlFunction(hd(t,this.tileGrid),e):this.setKey(e)}tileUrlFunction(t,e,i){}}class wd extends Ed{constructor(t){super({attributions:t.attributions,cacheSize:t.cacheSize,projection:t.projection,state:t.state,tileGrid:t.tileGrid,tileLoadFunction:t.tileLoadFunction?t.tileLoadFunction:Td,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:Bs,this.tileGridForProjection={},this.reprojectionErrorThreshold_=t.reprojectionErrorThreshold,this.renderReprojectionEdges_=!1}getGutterForProjection(t){return this.getProjection()&&t&&!Fn(this.getProjection(),t)?0:this.getGutter()}getGutter(){return 0}getKey(){let t=super.getKey();return this.getInterpolate()||(t+=":disable-interpolation"),t}getTileGridForProjection(t){const e=this.getProjection();if(this.tileGrid&&(!e||Fn(e,t)))return this.tileGrid;const i=z(t);return i in this.tileGridForProjection||(this.tileGridForProjection[i]=Zu(t)),this.tileGridForProjection[i]}createTile_(t,e,i,r,s,o){const a=[t,e,i],l=this.getTileCoordForTileUrlFunction(a,s),h=l?this.tileUrlFunction(l,r,s):void 0,c=new this.tileClass(a,void 0!==h?Y:J,void 0!==h?h:"",{crossOrigin:this.crossOrigin,referrerPolicy:this.referrerPolicy},this.tileLoadFunction,this.tileOptions);return c.key=o,c.addEventListener(n,this.handleTileChange.bind(this)),c}getTile(t,e,i,n,r,s){const o=this.getProjection();if(!o||!r||Fn(o,r))return this.getTileInternal(t,e,i,n,o||r);const a=[t,e,i],l=this.getKey(),h=this.getTileGridForProjection(o),c=this.getTileGridForProjection(r),u=this.getTileCoordForTileUrlFunction(a,r),d=new fd(o,h,r,c,a,u,this.getTilePixelRatio(n),this.getGutter(),((t,e,i,n)=>this.getTileInternal(t,e,i,n,o,s)),this.reprojectionErrorThreshold_,this.renderReprojectionEdges_,this.tileOptions);return d.key=l,d}getTileInternal(t,e,i,n,r,s){const o=this.getKey(),a=ju(this,o,t,e,i);if(s&&s.containsKey(a)){return s.get(a)}const l=this.createTile_(t,e,i,n,r,o);return s?.set(a,l),l}setRenderReprojectionEdges(t){this.renderReprojectionEdges_!=t&&(this.renderReprojectionEdges_=t,this.changed())}setTileGridForProjection(t,e){const i=En(t);if(i){const t=z(i);t in this.tileGridForProjection||(this.tileGridForProjection[t]=e)}}}function Td(t,e){if(ct){const i=t.getCrossOrigin();let n="same-origin",r="same-origin";"anonymous"===i||""===i?(n="cors",r="omit"):"use-credentials"===i&&(n="cors",r="include");const s={mode:n,credentials:r,referrerPolicy:t.getReferrerPolicy()};fetch(e,s).then((t=>{if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.blob()})).then((t=>createImageBitmap(t))).then((e=>{const i=t.getImage();i.width=e.width,i.height=e.height;i.getContext("2d").drawImage(e,0,0),e.close?.(),i.dispatchEvent(new Event("load"))})).catch((()=>{t.getImage().dispatchEvent(new Event("error"))}))}else t.getImage().src=e}function Cd(t){const e=t[0],i=new Array(e);let n,r,s=1<<e-1;for(n=0;n<e;++n)r=48,t[1]&s&&(r+=1),t[2]&s&&(r+=2),i[n]=String.fromCharCode(r),s>>=1;return i.join("")}class bd extends wd{constructor(t){const e=void 0!==(t=t||{}).projection?t.projection:"EPSG:3857",i=void 0!==t.tileGrid?t.tileGrid:Ku({extent:Qu(e),maxResolution:t.maxResolution,maxZoom:t.maxZoom,minZoom:t.minZoom,tileSize:t.tileSize});super({attributions:t.attributions,cacheSize:t.cacheSize,crossOrigin:t.crossOrigin,referrerPolicy:t.referrerPolicy,interpolate:t.interpolate,projection:e,reprojectionErrorThreshold:t.reprojectionErrorThreshold,tileGrid:i,tileLoadFunction:t.tileLoadFunction,tilePixelRatio:t.tilePixelRatio,tileUrlFunction:t.tileUrlFunction,url:t.url,urls:t.urls,wrapX:void 0===t.wrapX||t.wrapX,transition:t.transition,attributionsCollapsible:t.attributionsCollapsible,zDirection:t.zDirection}),this.gutter_=void 0!==t.gutter?t.gutter:0}getGutter(){return this.gutter_}}function Rd(t,e,i,n){const r=[];let s=[1/0,1/0,-1/0,-1/0];for(let o=0,a=i.length;o<a;++o){const a=i[o];s=Qt(t,e,a[0],n),r.push((s[0]+s[2])/2,(s[1]+s[3])/2),e=a[a.length-1]}return r}function Pd(t,e,i,n,r,s,o){let a,l;const h=(i-e)/n;if(1===h)a=e;else if(2===h)a=e,l=r;else if(0!==h){let s=t[e],o=t[e+1],h=0;const c=[0];for(let r=e+n;r<i;r+=n){const e=t[r],i=t[r+1];h+=Math.sqrt((e-s)*(e-s)+(i-o)*(i-o)),c.push(h),s=e,o=i}const u=r*h,d=m(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=o>1?o:2,s=s||new Array(o);for(let e=0;e<o;++e)s[e]=void 0===a?NaN:void 0===l?t[a+e]:Ne(t[a+e],t[a+n+e],l);return s}function Id(t,e,i,n,r,s){if(i==e)return null;let o;if(r<t[e+n-1])return s?(o=t.slice(e,e+n),o[n-1]=r,o):null;if(t[i-1]<r)return s?(o=t.slice(i-n,i),o[n-1]=r,o):null;if(r==t[e+n-1])return t.slice(e,e+n);let a=e/n,l=i/n;for(;a<l;){const e=a+l>>1;r<t[(e+1)*n-1]?l=e:a=e+1}const h=t[a*n-1];if(r==h)return t.slice((a-1)*n,(a-1)*n+n);const c=(r-h)/(t[(a+1)*n-1]-h);o=[];for(let e=0;e<n-1;++e)o.push(Ne(t[(a-1)*n+e],t[a*n+e],c));return o.push(r),o}function Fd(t,e,i,n,r,s,o){if(o)return Id(t,e,i[i.length-1],n,r,s);let a;if(r<t[n-1])return s?(a=t.slice(0,n),a[n-1]=r,a):null;if(t[t.length-1]<r)return s?(a=t.slice(t.length-n),a[n-1]=r,a):null;for(let s=0,o=i.length;s<o;++s){const o=i[s];if(e!=o){if(r<t[e+n-1])return null;if(r<=t[o-1])return Id(t,e,o,n,r,!1);e=o}}return null}class Ld extends mr{constructor(t,e,i){super(),void 0!==i&&void 0===e?this.setFlatCoordinates(i,t):(e=e||0,this.setCenterAndRadius(t,e,i))}clone(){const t=new Ld(this.flatCoordinates.slice(),void 0,this.layout);return t.applyProperties(this),t}closestPointXY(t,e,i,n){const r=this.flatCoordinates,s=t-r[0],o=e-r[1],a=s*s+o*o;if(a<n){if(0===a)for(let t=0;t<this.stride;++t)i[t]=r[t];else{const t=this.getRadius()/Math.sqrt(a);i[0]=r[0]+t*s,i[1]=r[1]+t*o;for(let t=2;t<this.stride;++t)i[t]=r[t]}return i.length=this.stride,a}return n}containsXY(t,e){const i=this.flatCoordinates,n=t-i[0],r=e-i[1];return n*n+r*r<=this.getRadiusSquared_()}getCenter(){return this.flatCoordinates.slice(0,this.stride)}computeExtent(t){const e=this.flatCoordinates,i=e[this.stride]-e[0];return Kt(e[0]-i,e[1]-i,e[0]+i,e[1]+i,t)}getRadius(){return Math.sqrt(this.getRadiusSquared_())}getRadiusSquared_(){const t=this.flatCoordinates[this.stride]-this.flatCoordinates[0],e=this.flatCoordinates[this.stride+1]-this.flatCoordinates[1];return t*t+e*e}getType(){return"Circle"}intersectsExtent(t){if(Se(t,this.getExtent())){const e=this.getCenter();return t[0]<=e[0]&&t[2]>=e[0]||(t[1]<=e[1]&&t[3]>=e[1]||le(t,this.intersectsCoordinate.bind(this)))}return!1}setCenter(t){const e=this.stride,i=this.flatCoordinates[e]-this.flatCoordinates[0],n=t.slice();n[e]=n[0]+i;for(let i=1;i<e;++i)n[e+i]=t[i];this.setFlatCoordinates(this.layout,n),this.changed()}setCenterAndRadius(t,e,i){this.setLayout(i,t,0),this.flatCoordinates||(this.flatCoordinates=[]);const n=this.flatCoordinates;let r=Lr(n,0,t,this.stride);n[r++]=n[0]+e;for(let t=1,e=this.stride;t<e;++t)n[r++]=n[t];n.length=r,this.changed()}getCoordinates(){return null}setCoordinates(t,e){}setRadius(t){this.flatCoordinates[this.stride]=this.flatCoordinates[0]+t,this.changed()}rotate(t,e){const i=this.getCenter(),n=this.getStride();this.setCenter(ur(i,0,i.length,n,t,e,i)),this.changed()}}Ld.prototype.transform;class Md extends _r{constructor(t){super(),this.geometries_=t,this.changeEventsKeys_=[],this.listenGeometriesChange_()}unlistenGeometriesChange_(){this.changeEventsKeys_.forEach(k),this.changeEventsKeys_.length=0}listenGeometriesChange_(){const t=this.geometries_;for(let e=0,i=t.length;e<i;++e)this.changeEventsKeys_.push(D(t[e],n,this.changed,this))}clone(){const t=new Md(Ad(this.geometries_));return t.applyProperties(this),t}closestPointXY(t,e,i,n){if(n<Vt(this.getExtent(),t,e))return n;const r=this.geometries_;for(let s=0,o=r.length;s<o;++s)n=r[s].closestPointXY(t,e,i,n);return n}containsXY(t,e){const i=this.geometries_;for(let n=0,r=i.length;n<r;++n)if(i[n].containsXY(t,e))return!0;return!1}computeExtent(t){qt(t);const e=this.geometries_;for(let i=0,n=e.length;i<n;++i)ie(t,e[i].getExtent());return t}getGeometries(){return Ad(this.geometries_)}getGeometriesArray(){return this.geometries_}getGeometriesArrayRecursive(){let t=[];const e=this.geometries_;for(let i=0,n=e.length;i<n;++i)e[i].getType()===this.getType()?t=t.concat(e[i].getGeometriesArrayRecursive()):t.push(e[i]);return t}getSimplifiedGeometry(t){if(this.simplifiedGeometryRevision!==this.getRevision()&&(this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=this.getRevision()),t<0||0!==this.simplifiedGeometryMaxMinSquaredTolerance&&t<this.simplifiedGeometryMaxMinSquaredTolerance)return this;const e=[],i=this.geometries_;let n=!1;for(let r=0,s=i.length;r<s;++r){const s=i[r],o=s.getSimplifiedGeometry(t);e.push(o),o!==s&&(n=!0)}if(n){return new Md(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,r=i.length;n<r;++n)i[n].rotate(t,e);this.changed()}scale(t,e,i){i||(i=de(this.getExtent()));const n=this.geometries_;for(let r=0,s=n.length;r<s;++r)n[r].scale(t,e,i);this.changed()}setGeometries(t){this.setGeometriesArray(Ad(t))}setGeometriesArray(t){this.unlistenGeometriesChange_(),this.geometries_=t,this.listenGeometriesChange_(),this.changed()}applyTransform(t){const e=this.geometries_;for(let i=0,n=e.length;i<n;++i)e[i].applyTransform(t);this.changed()}translate(t,e){const i=this.geometries_;for(let n=0,r=i.length;n<r;++n)i[n].translate(t,e);this.changed()}disposeInternal(){this.unlistenGeometriesChange_(),super.disposeInternal()}}function Ad(t){return t.map((t=>t.clone()))}function Od(t,e,i,n){let r=t[e],s=t[e+1],o=0;for(let a=e+n;a<i;a+=n){const e=t[a],i=t[a+1];o+=Math.sqrt((e-r)*(e-r)+(i-s)*(i-s)),r=e,s=i}return o}class Dd extends mr{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){E(this.flatCoordinates,t),this.changed()}clone(){const t=new Dd(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(t,e,i,n){return n<Vt(this.getExtent(),t,e)?n:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Cr(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Pr(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!1,t,e,i,n))}forEachSegment(t){return Qr(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,Id(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e))}getCoordinates(){return Dr(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinateAt(t,e){return Pd(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e,this.stride)}getLength(){return Od(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=Gr(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e,0),new Dd(e,"XY")}getType(){return"LineString"}intersectsExtent(t){return es(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=Mr(this.flatCoordinates,0,t,this.stride),this.changed()}}class Nd extends mr{constructor(t,e,i){if(super(),this.ends_=[],this.maxDelta_=-1,this.maxDeltaRevision_=-1,Array.isArray(t[0]))this.setCoordinates(t,e);else if(void 0!==e&&i)this.setFlatCoordinates(e,t),this.ends_=i;else{const e=t,i=[],n=[];for(let t=0,r=e.length;t<r;++t){E(i,e[t].getFlatCoordinates()),n.push(i.length)}const r=0===e.length?this.getLayout():e[0].getLayout();this.setFlatCoordinates(r,i),this.ends_=n}}appendLineString(t){E(this.flatCoordinates,t.getFlatCoordinates().slice()),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){const t=new Nd(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return t.applyProperties(this),t}closestPointXY(t,e,i,n){return n<Vt(this.getExtent(),t,e)?n:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(br(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Ir(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,Fd(this.flatCoordinates,0,this.ends_,this.stride,t,e,i))}getCoordinates(){return Nr(this.flatCoordinates,0,this.ends_,this.stride)}getEnds(){return this.ends_}getLineString(t){return t<0||this.ends_.length<=t?null:new Dd(this.flatCoordinates.slice(0===t?0:this.ends_[t-1],this.ends_[t]),this.layout)}getLineStrings(){const t=this.flatCoordinates,e=this.ends_,i=this.layout,n=[];let r=0;for(let s=0,o=e.length;s<o;++s){const o=e[s],a=new Dd(t.slice(r,o),i);n.push(a),r=o}return n}getLength(){const t=this.ends_;let e=0,i=0;for(let n=0,r=t.length;n<r;++n)i+=Od(this.flatCoordinates,e,t[n],this.stride),e=t[n];return i}getFlatMidpoints(){const t=[],e=this.flatCoordinates;let i=0;const n=this.ends_,r=this.stride;for(let s=0,o=n.length;s<o;++s){const o=n[s];E(t,Pd(e,i,o,r,.5)),i=o}return t}getSimplifiedGeometryInternal(t){const e=[],i=[];return e.length=jr(this.flatCoordinates,0,this.ends_,this.stride,t,e,0,i),new Nd(e,"XY",i)}getType(){return"MultiLineString"}intersectsExtent(t){return is(this.flatCoordinates,0,this.ends_,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,2),this.flatCoordinates||(this.flatCoordinates=[]);const i=Ar(this.flatCoordinates,0,t,this.stride,this.ends_);this.flatCoordinates.length=0===i.length?0:i[i.length-1],this.changed()}}class kd extends mr{constructor(t,e){super(),e&&!Array.isArray(t[0])?this.setFlatCoordinates(e,t):this.setCoordinates(t,e)}appendPoint(t){E(this.flatCoordinates,t.getFlatCoordinates()),this.changed()}clone(){const t=new kd(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(t,e,i,n){if(n<Vt(this.getExtent(),t,e))return n;const r=this.flatCoordinates,s=this.stride;for(let o=0,a=r.length;o<a;o+=s){const a=Le(t,e,r[o],r[o+1]);if(a<n){n=a;for(let t=0;t<s;++t)i[t]=r[o+t];i.length=s}}return n}getCoordinates(){return Dr(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getPoint(t){const e=this.flatCoordinates.length/this.stride;return t<0||e<=t?null:new Wr(this.flatCoordinates.slice(t*this.stride,(t+1)*this.stride),this.layout)}getPoints(){const t=this.flatCoordinates,e=this.layout,i=this.stride,n=[];for(let r=0,s=t.length;r<s;r+=i){const s=new Wr(t.slice(r,r+i),e);n.push(s)}return n}getType(){return"MultiPoint"}intersectsExtent(t){const e=this.flatCoordinates,i=this.stride;for(let n=0,r=e.length;n<r;n+=i){if(Zt(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=Mr(this.flatCoordinates,0,t,this.stride),this.changed()}}class Gd extends mr{constructor(t,e,i){if(super(),this.endss_=[],this.flatInteriorPointsRevision_=-1,this.flatInteriorPoints_=null,this.maxDelta_=-1,this.maxDeltaRevision_=-1,this.orientedRevision_=-1,this.orientedFlatCoordinates_=null,!i&&!Array.isArray(t[0])){const n=t,r=[],s=[];for(let t=0,e=n.length;t<e;++t){const e=n[t],i=r.length,o=e.getEnds();for(let t=0,e=o.length;t<e;++t)o[t]+=i;E(r,e.getFlatCoordinates()),s.push(o)}e=0===n.length?this.getLayout():n[0].getLayout(),t=r,i=s}void 0!==e&&i?(this.setFlatCoordinates(e,t),this.endss_=i):this.setCoordinates(t,e)}appendPolygon(t){let e;if(this.flatCoordinates){const i=this.flatCoordinates.length;E(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 Gd(this.flatCoordinates.slice(),this.layout,e);return i.applyProperties(this),i}closestPointXY(t,e,i,n){return n<Vt(this.getExtent(),t,e)?n:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Rr(this.flatCoordinates,0,this.endss_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Fr(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,this.maxDelta_,!0,t,e,i,n))}containsXY(t,e){return Kr(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,t,e)}getArea(){return wr(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride)}getCoordinates(t){let e;return void 0!==t?(e=this.getOrientedFlatCoordinates().slice(),us(e,0,this.endss_,this.stride,t)):e=this.flatCoordinates,kr(e,0,this.endss_,this.stride)}getEndss(){return this.endss_}getFlatInteriorPoints(){if(this.flatInteriorPointsRevision_!=this.getRevision()){const t=Rd(this.flatCoordinates,0,this.endss_,this.stride);this.flatInteriorPoints_=Jr(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,t),this.flatInteriorPointsRevision_=this.getRevision()}return this.flatInteriorPoints_}getInteriorPoints(){return new kd(this.getFlatInteriorPoints().slice(),"XYM")}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){const t=this.flatCoordinates;hs(t,0,this.endss_,this.stride)?this.orientedFlatCoordinates_=t:(this.orientedFlatCoordinates_=t.slice(),this.orientedFlatCoordinates_.length=us(this.orientedFlatCoordinates_,0,this.endss_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(t){const e=[],i=[];return e.length=Vr(this.flatCoordinates,0,this.endss_,this.stride,Math.sqrt(t),e,0,i),new Gd(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 gs(this.flatCoordinates.slice(e,n),this.layout,i)}getPolygons(){const t=this.layout,e=this.flatCoordinates,i=this.endss_,n=[];let r=0;for(let s=0,o=i.length;s<o;++s){const o=i[s].slice(),a=o[o.length-1];if(0!==r)for(let t=0,e=o.length;t<e;++t)o[t]-=r;const l=new gs(e.slice(r,a),t,o);n.push(l),r=a}return n}getType(){return"MultiPolygon"}intersectsExtent(t){return ss(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,3),this.flatCoordinates||(this.flatCoordinates=[]);const i=Or(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 jd=[1,0,0,1,0,0];class Ud{constructor(t,e,i,n,r,s){this.styleFunction,this.extent_,this.id_=s,this.type_=t,this.flatCoordinates_=e,this.flatInteriorPoints_=null,this.flatMidpoints_=null,this.ends_=i||null,this.properties_=r,this.squaredTolerance_,this.stride_=n,this.simplifiedGeometry_}get(t){return this.properties_[t]}getExtent(){return this.extent_||(this.extent_="Point"===this.type_?Jt(this.flatCoordinates_):Qt(this.flatCoordinates_,0,this.flatCoordinates_.length,2)),this.extent_}getFlatInteriorPoint(){if(!this.flatInteriorPoints_){const t=de(this.getExtent());this.flatInteriorPoints_=qr(this.flatCoordinates_,0,this.ends_,2,t,0)}return this.flatInteriorPoints_}getFlatInteriorPoints(){if(!this.flatInteriorPoints_){const t=ds(this.flatCoordinates_,this.ends_),e=Rd(this.flatCoordinates_,0,t,2);this.flatInteriorPoints_=Jr(this.flatCoordinates_,0,t,2,e)}return this.flatInteriorPoints_}getFlatMidpoint(){return this.flatMidpoints_||(this.flatMidpoints_=Pd(this.flatCoordinates_,0,this.flatCoordinates_.length,2,.5)),this.flatMidpoints_}getFlatMidpoints(){if(!this.flatMidpoints_){this.flatMidpoints_=[];const t=this.flatCoordinates_;let e=0;const i=this.ends_;for(let n=0,r=i.length;n<r;++n){const r=i[n],s=Pd(t,e,r,2,.5);E(this.flatMidpoints_,s),e=r}}return this.flatMidpoints_}getId(){return this.id_}getOrientedFlatCoordinates(){return this.flatCoordinates_}getGeometry(){return this}getSimplifiedGeometry(t){return this}simplifyTransformed(t,e){return this}getProperties(){return this.properties_}getPropertiesInternal(){return this.properties_}getStride(){return this.stride_}getStyleFunction(){return this.styleFunction}getType(){return this.type_}transform(t){const e=(t=En(t)).getExtent(),i=t.getWorldExtent();if(e&&i){const t=_e(i)/_e(e);nr(jd,i[0],i[3],t,-t,0,0,0),cr(this.flatCoordinates_,0,this.flatCoordinates_.length,2,jd,this.flatCoordinates_)}}applyTransform(t){t(this.flatCoordinates_,this.flatCoordinates_,this.stride_)}clone(){return new Ud(this.type_,this.flatCoordinates_.slice(),this.ends_?.slice(),this.stride_,Object.assign({},this.properties_),this.id_)}getEnds(){return this.ends_}enableSimplifyTransformed(){return this.simplifyTransformed=P(((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=Gr(i,0,this.simplifiedGeometry_.flatCoordinates_.length,this.simplifiedGeometry_.stride_,t,i,0),n=[i.length];break;case"MultiLineString":n=[],i.length=jr(i,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,t,i,0,n);break;case"Polygon":n=[],i.length=Xr(i,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,Math.sqrt(t),i,0,n)}return n&&(this.simplifiedGeometry_=new Ud(this.type_,i,n,2,this.properties_,this.id_)),this.squaredTolerance_=t,this.simplifiedGeometry_})),this}}function Bd(t){const e=t.getType();switch(e){case"Point":return new Wr(t.getFlatCoordinates());case"MultiPoint":return new kd(t.getFlatCoordinates(),"XY");case"LineString":return new Dd(t.getFlatCoordinates(),"XY");case"MultiLineString":return new Nd(t.getFlatCoordinates(),"XY",t.getEnds());case"Polygon":const i=t.getFlatCoordinates(),n=t.getEnds(),r=ds(i,n);return r.length>1?new Gd(i,"XY",r):new gs(i,"XY",n);default:throw new Error("Invalid geometry type:"+e)}}Ud.prototype.getFlatCoordinates=Ud.prototype.getOrientedFlatCoordinates;class zd{constructor(t){this.rbush_=new ll(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_[z(e)]=i}load(t,e){const i=new Array(e.length);for(let n=0,r=e.length;n<r;n++){const r=t[n],s=e[n],o={minX:r[0],minY:r[1],maxX:r[2],maxY:r[3],value:s};i[n]=o,this.items_[z(s)]=o}this.rbush_.load(i)}remove(t){const e=z(t),i=this.items_[e];return delete this.items_[e],null!==this.rbush_.remove(i)}update(t,e){const i=this.items_[z(e)];te([i.minX,i.minY,i.maxX,i.maxY],t)||(this.remove(e),this.insert(t,e))}getAll(){return this.rbush_.all().map((function(t){return t.value}))}getInExtent(t){const e={minX:t[0],minY:t[1],maxX:t[2],maxY:t[3]};return this.rbush_.search(e).map((function(t){return t.value}))}forEach(t){return this.forEach_(this.getAll(),t)}forEachInExtent(t,e){return this.forEach_(this.getInExtent(t),e)}forEach_(t,e){let i;for(let n=0,r=t.length;n<r;n++)if(i=e(t[n]),i)return i;return i}isEmpty(){return L(this.items_)}clear(){this.rbush_.clear(),this.items_={}}getExtent(t){const e=this.rbush_.toJSON();return Kt(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]}}var Xd="addfeature",Vd="changefeature",$d="clear",Wd="removefeature",Zd="featuresloadstart",Yd="featuresloadend",Hd="featuresloaderror";class Kd extends M{constructor(t,e,i){super(t),this.feature=e,this.features=i}}class qd extends pd{constructor(t){super({attributions:(t=t||{}).attributions,interpolate:!0,projection:void 0,state:"ready",wrapX:void 0===t.wrapX||t.wrapX}),this.on,this.once,this.un,this.loader_=R,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_&&(Mt(this.format_,"`format` must be set when `url` is set"),this.loader_=cu(this.url_,this.format_)),this.strategy_=void 0!==t.strategy?t.strategy:uu;const e=void 0===t.useSpatialIndex||t.useSpatialIndex;let i,n;this.featuresRtree_=e?new zd:null,this.loadedExtentsRtree_=new zd,this.loadingExtentsCount_=0,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 Z(n)),void 0!==n&&this.addFeaturesInternal(n),void 0!==i&&this.bindFeaturesCollection_(i)}addFeature(t){this.addFeatureInternal(t),this.changed()}addFeatureInternal(t){const e=z(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 Kd(Xd,t))}setupChangeEvents_(t,e){e instanceof Ud||(this.featureChangeKeys_[t]=[D(e,n,this.handleFeatureChange_,this),D(e,i,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 Ud){const n=this.idIndex_[t];n instanceof Ud?Array.isArray(n)?n.push(e):this.idIndex_[t]=[n,e]:i=!1}else i=!1;else this.idIndex_[t]=e}return i&&(Mt(!(t in this.uidIndex_),"The passed `feature` was already added to the source"),this.uidIndex_[t]=e),i}addFeatures(t){this.addFeaturesInternal(t),this.changed()}addFeaturesInternal(t){const e=[],i=[],n=[];for(let e=0,n=t.length;e<n;e++){const n=t[e],r=z(n);this.addToIndex_(r,n)&&i.push(n)}for(let t=0,r=i.length;t<r;t++){const r=i[t],s=z(r);this.setupChangeEvents_(s,r);const o=r.getGeometry();if(o){const t=o.getExtent();e.push(t),n.push(r)}else this.nullGeometryFeatures_[s]=r}if(this.featuresRtree_&&this.featuresRtree_.load(e,n),this.hasListener(Xd))for(let t=0,e=i.length;t<e;t++)this.dispatchEvent(new Kd(Xd,i[t]))}bindFeaturesCollection_(i){let n=!1;this.addEventListener(Xd,(function(t){n||(n=!0,i.push(t.feature),n=!1)})),this.addEventListener(Wd,(function(t){n||(n=!0,i.remove(t.feature),n=!1)})),i.addEventListener(t,(t=>{n||(n=!0,this.addFeature(t.element),n=!1)})),i.addEventListener(e,(t=>{n||(n=!0,this.removeFeature(t.element),n=!1)})),this.featuresCollection_=i}clear(t){if(t){for(const t in this.featureChangeKeys_){this.featureChangeKeys_[t].forEach(k)}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 Kd($d);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 Ud||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 Ud||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(),L(this.nullGeometryFeatures_)||E(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=Pe(t,e);return[].concat(...i.map((t=>this.featuresRtree_.getInExtent(t))))}return this.featuresCollection_?this.featuresCollection_.getArray().slice(0):[]}getClosestFeatureToCoordinate(t,e){const i=t[0],n=t[1];let r=null;const s=[NaN,NaN];let o=1/0;const a=[-1/0,-1/0,1/0,1/0];return e=e||C,this.featuresRtree_.forEachInExtent(a,(function(t){if(e(t)){const e=t.getGeometry(),l=o;if(o=e instanceof Ud?0:e.closestPointXY(i,n,s,o),o<l){r=t;const e=Math.sqrt(o);a[0]=i-e,a[1]=n-e,a[2]=i+e,a[3]=n+e}}})),r}getExtent(t){return this.featuresRtree_?.getExtent(t)??null}getFeatureById(t){const e=this.idIndex_[t.toString()];return void 0!==e?e:null}getFeatureByUid(t){const e=this.uidIndex_[t];return void 0!==e?e:null}getFormat(){return this.format_}getOverlaps(){return this.overlaps_}getUrl(){return this.url_}handleFeatureChange_(t){const e=t.target,i=z(e),n=e.getGeometry();if(n){const t=n.getExtent();i in this.nullGeometryFeatures_?(delete this.nullGeometryFeatures_[i],this.featuresRtree_&&this.featuresRtree_.insert(t,e)):this.featuresRtree_&&this.featuresRtree_.update(t,e)}else i in this.nullGeometryFeatures_||(this.featuresRtree_&&this.featuresRtree_.remove(e),this.nullGeometryFeatures_[i]=e);const r=e.getId();if(void 0!==r){const t=r.toString();this.idIndex_[t]!==e&&(this.removeFromIdIndex_(e),this.idIndex_[t]=e)}else this.removeFromIdIndex_(e),this.uidIndex_[i]=e;this.changed(),this.dispatchEvent(new Kd(Vd,e))}hasFeature(t){const e=t.getId();return void 0!==e?e in this.idIndex_:z(t)in this.uidIndex_}isEmpty(){return this.featuresRtree_?this.featuresRtree_.isEmpty()&&L(this.nullGeometryFeatures_):!this.featuresCollection_||0===this.featuresCollection_.getLength()}loadFeatures(t,e,i){const n=this.loadedExtentsRtree_,r=this.strategy_(t,e,i);for(let t=0,s=r.length;t<s;++t){const s=r[t];n.forEachInExtent(s,(function(t){return Wt(t.extent,s)}))||(++this.loadingExtentsCount_,this.dispatchEvent(new Kd(Zd)),this.loader_.call(this,s,e,i,(t=>{--this.loadingExtentsCount_,this.dispatchEvent(new Kd(Yd,void 0,t))}),(()=>{--this.loadingExtentsCount_,this.dispatchEvent(new Kd(Hd))})),n.insert(s,{extent:s.slice()}))}this.loading=!(this.loader_.length<4)&&this.loadingExtentsCount_>0}refresh(){this.clear(!0),this.loadedExtentsRtree_.clear(),super.refresh()}removeLoadedExtent(t){const e=this.loadedExtentsRtree_,i=e.forEachInExtent(t,(function(e){if(te(e.extent,t))return e}));i&&e.remove(i)}removeFeatures(t){let e=!1;for(let i=0,n=t.length;i<n;++i)e=this.removeFeatureInternal(t[i])||e;e&&this.changed()}removeFeature(t){if(!t)return;this.removeFeatureInternal(t)&&this.changed()}removeFeatureInternal(t){const e=z(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(k),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(Wd)&&this.dispatchEvent(new Kd(Wd,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){Mt(this.format_,"`format` must be set when `url` is set"),this.url_=t,this.setLoader(cu(t,this.format_))}setOverlaps(t){this.overlaps_=t,this.changed()}}function Jd(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function Qd(t,e){return t[0]=e[0],t[1]=e[1],t[4]=e[2],t[5]=e[3],t[12]=e[4],t[13]=e[5],t}function tg(t,e,i,n,r,s,o){const a=1/(t-e),l=1/(i-n),h=1/(r-s);return(o=o??[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])[0]=-2*a,o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=-2*l,o[6]=0,o[7]=0,o[8]=0,o[9]=0,o[10]=2*h,o[11]=0,o[12]=(t+e)*a,o[13]=(n+i)*l,o[14]=(s+r)*h,o[15]=1,o}function eg(t,e,i,n,r){return(r=r??[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])[0]=t[0]*e,r[1]=t[1]*e,r[2]=t[2]*e,r[3]=t[3]*e,r[4]=t[4]*i,r[5]=t[5]*i,r[6]=t[6]*i,r[7]=t[7]*i,r[8]=t[8]*n,r[9]=t[9]*n,r[10]=t[10]*n,r[11]=t[11]*n,r[12]=t[12],r[13]=t[13],r[14]=t[14],r[15]=t[15],r}function ig(t,e,i,n,r){let s,o,a,l,h,c,u,d,g,f,p,_;return t===(r=r??[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])?(r[12]=t[0]*e+t[4]*i+t[8]*n+t[12],r[13]=t[1]*e+t[5]*i+t[9]*n+t[13],r[14]=t[2]*e+t[6]*i+t[10]*n+t[14],r[15]=t[3]*e+t[7]*i+t[11]*n+t[15]):(s=t[0],o=t[1],a=t[2],l=t[3],h=t[4],c=t[5],u=t[6],d=t[7],g=t[8],f=t[9],p=t[10],_=t[11],r[0]=s,r[1]=o,r[2]=a,r[3]=l,r[4]=h,r[5]=c,r[6]=u,r[7]=d,r[8]=g,r[9]=f,r[10]=p,r[11]=_,r[12]=s*e+h*i+g*n+t[12],r[13]=o*e+c*i+f*n+t[13],r[14]=a*e+u*i+p*n+t[14],r[15]=l*e+d*i+_*n+t[15]),r}function ng(t,e,i,n){return(n=n??[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])[0]=1,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=1,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[10]=1,n[11]=0,n[12]=t,n[13]=e,n[14]=i,n[15]=1,n}class rg{constructor(t){this.gl_=t,this.program_=og(t,"\n precision mediump float;\n\n varying vec2 v_texcoord;\n\n uniform sampler2D u_texture;\n\n void main() {\n if (\n v_texcoord.x < 0.0 ||\n v_texcoord.y < 0.0 ||\n v_texcoord.x > 1.0 ||\n v_texcoord.y > 1.0\n ) {\n discard;\n }\n gl_FragColor = texture2D(u_texture, v_texcoord);\n }\n","\n attribute vec4 a_position;\n attribute vec4 a_texcoord;\n\n uniform mat4 u_matrix;\n uniform mat4 u_textureMatrix;\n\n varying vec2 v_texcoord;\n\n void main() {\n gl_Position = u_matrix * a_position;\n vec2 texcoord = (u_textureMatrix * a_texcoord).xy;\n v_texcoord = texcoord;\n }\n"),this.positionLocation=t.getAttribLocation(this.program_,"a_position"),this.texcoordLocation=t.getAttribLocation(this.program_,"a_texcoord"),this.matrixLocation=t.getUniformLocation(this.program_,"u_matrix"),this.textureMatrixLocation=t.getUniformLocation(this.program_,"u_textureMatrix"),this.textureLocation=t.getUniformLocation(this.program_,"u_texture"),this.positionBuffer=t.createBuffer(),t.bindBuffer(t.ARRAY_BUFFER,this.positionBuffer),this.positions=[0,0,0,1,1,0,1,0,0,1,1,1],t.bufferData(t.ARRAY_BUFFER,new Float32Array(this.positions),t.STATIC_DRAW),this.texcoordBuffer=t.createBuffer(),t.bindBuffer(t.ARRAY_BUFFER,this.texcoordBuffer),this.texcoords=[0,0,0,1,1,0,1,0,0,1,1,1],t.bufferData(t.ARRAY_BUFFER,new Float32Array(this.texcoords),t.STATIC_DRAW)}drawImage(t,e,i,n,r,s,o,a,l,h,c,u,d){const g=this.gl_;void 0===a&&(a=n),void 0===l&&(l=r),void 0===s&&(s=e),void 0===o&&(o=i),void 0===h&&(h=s),void 0===c&&(c=o),void 0===u&&(u=g.canvas.width),void 0===d&&(d=g.canvas.height),g.bindTexture(g.TEXTURE_2D,t),g.useProgram(this.program_),g.bindBuffer(g.ARRAY_BUFFER,this.positionBuffer),g.enableVertexAttribArray(this.positionLocation),g.vertexAttribPointer(this.positionLocation,2,g.FLOAT,!1,0,0),g.bindBuffer(g.ARRAY_BUFFER,this.texcoordBuffer),g.enableVertexAttribArray(this.texcoordLocation),g.vertexAttribPointer(this.texcoordLocation,2,g.FLOAT,!1,0,0);let f=tg(0,u,0,d,-1,1);f=ig(f,a,l,0),f=eg(f,h,c,1),g.uniformMatrix4fv(this.matrixLocation,!1,f);let p=ng(n/e,r/i,0);p=eg(p,s/e,o/i,1),g.uniformMatrix4fv(this.textureMatrixLocation,!1,p),g.uniform1i(this.textureLocation,0),g.drawArrays(g.TRIANGLES,0,this.positions.length/2)}}function sg(t,e,i){const n=t.createShader(e);if(null===n)throw new Error("Shader compilation failed");if(t.shaderSource(n,i),t.compileShader(n),!t.getShaderParameter(n,t.COMPILE_STATUS)){const e=t.getShaderInfoLog(n);if(null===e)throw new Error("Shader info log creation failed");throw new Error(e)}return n}function og(t,e,i){const n=t.createProgram(),r=sg(t,t.VERTEX_SHADER,i),s=sg(t,t.FRAGMENT_SHADER,e);if(null===n)throw new Error("Program creation failed");if(t.attachShader(n,r),t.attachShader(n,s),t.linkProgram(n),!t.getProgramParameter(n,t.LINK_STATUS)){if(null===t.getProgramInfoLog(n))throw new Error("Program info log creation failed");throw new Error}return n}function ag(t,e,i,n){let r;return r=i&&i.length?i.shift():ct?new OffscreenCanvas(t||300,e||300):document.createElement("canvas"),t&&(r.width=t),e&&(r.height=e),r.getContext("webgl",n)}function lg(t){const e=t.canvas;e.width=1,e.height=1,t.clear(t.COLOR_BUFFER_BIT|t.DEPTH_BUFFER_BIT|t.STENCIL_BUFFER_BIT)}const hg=[];function cg(t,e,i,n,r,s,o,a,l,h,c,u,d,g){const f=Math.round(n*e),p=Math.round(n*i);let _,m;if(t.canvas.width=f,t.canvas.height=p,m=t.createTexture(),t.bindTexture(t.TEXTURE_2D,m),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),d?(t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR)):(t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST)),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,f,p,0,t.RGBA,c,null),_=t.createFramebuffer(),t.bindFramebuffer(t.FRAMEBUFFER,_),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,m,0),null===_)throw new Error("Could not create framebuffer");if(null===m)throw new Error("Could not create texture");if(0===l.length)return{width:f,height:p,framebuffer:_,texture:m};const y=[1/0,1/0,-1/0,-1/0];let x,v,S;l.forEach((function(t,e,i){ie(y,t.extent)}));const E=1/r;if(g&&1===l.length&&0===h)x=l[0].texture,v=l[0].width,S=l[0].width;else{if(x=t.createTexture(),null===m)throw new Error("Could not create texture");v=Math.round(ve(y)*E),S=Math.round(_e(y)*E);const e=t.getParameter(t.MAX_TEXTURE_SIZE),i=Math.max(v,S),n=i>e?e/i:1,r=Math.round(v*n),s=Math.round(S*n);t.bindTexture(t.TEXTURE_2D,x),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),d?(t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR)):(t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST)),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,r,s,0,t.RGBA,c,null);const o=t.createFramebuffer();t.bindFramebuffer(t.FRAMEBUFFER,o),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,x,0);const a=new rg(t);l.forEach((function(e,i,l){const c=(e.extent[0]-y[0])*E*n,u=-(e.extent[3]-y[3])*E*n,g=ve(e.extent)*E*n,f=_e(e.extent)*E*n;if(t.bindFramebuffer(t.FRAMEBUFFER,o),t.viewport(0,0,r,s),e.clipExtent){const i=(e.clipExtent[0]-y[0])*E*n,r=-(e.clipExtent[3]-y[3])*E*n,s=ve(e.clipExtent)*E*n,o=_e(e.clipExtent)*E*n;t.enable(t.SCISSOR_TEST),t.scissor(d?i:Math.round(i),d?r:Math.round(r),d?s:Math.round(i+s)-Math.round(i),d?o:Math.round(r+o)-Math.round(r))}a.drawImage(e.texture,e.width,e.height,h,h,e.width-2*h,e.height-2*h,d?c:Math.round(c),d?u:Math.round(u),d?g:Math.round(c+g)-Math.round(c),d?f:Math.round(u+f)-Math.round(u),r,s),t.disable(t.SCISSOR_TEST)})),t.deleteFramebuffer(o)}const w=ye(o),T=ye(y),C=t=>{const e=(t[0][0]-w[0])/s*n,i=-(t[0][1]-w[1])/s*n;return{u1:(t[1][0]-w[0])/s*n,v1:-(t[1][1]-w[1])/s*n,u0:e,v0:i,u2:(t[2][0]-w[0])/s*n,v2:-(t[2][1]-w[1])/s*n}};t.bindFramebuffer(t.FRAMEBUFFER,_),t.viewport(0,0,f,p);{const e=[],i=[],n=og(t,"\n precision mediump float;\n\n varying vec2 v_texcoord;\n\n uniform sampler2D u_texture;\n\n void main() {\n if (v_texcoord.x < 0.0 || v_texcoord.x > 1.0 || v_texcoord.y < 0.0 || v_texcoord.y > 1.0) {\n discard;\n }\n gl_FragColor = texture2D(u_texture, v_texcoord);\n }\n","\n attribute vec4 a_position;\n attribute vec2 a_texcoord;\n\n varying vec2 v_texcoord;\n\n uniform mat4 u_matrix;\n\n void main() {\n gl_Position = u_matrix * a_position;\n v_texcoord = a_texcoord;\n }\n");t.useProgram(n);const s=t.getUniformLocation(n,"u_texture");t.bindTexture(t.TEXTURE_2D,x),t.uniform1i(s,0),a.getTriangles().forEach((function(t,n,s){const o=t.source,a=t.target,{u1:l,v1:h,u0:c,v0:u,u2:d,v2:g}=C(a),f=(o[0][0]-T[0])/r/v,p=-(o[0][1]-T[1])/r/S,_=(o[1][0]-T[0])/r/v,m=-(o[1][1]-T[1])/r/S,y=(o[2][0]-T[0])/r/v,x=-(o[2][1]-T[1])/r/S;e.push(l,h,c,u,d,g),i.push(_,m,f,p,y,x)}));const o=tg(0,f,p,0,-1,1),l=t.getUniformLocation(n,"u_matrix");t.uniformMatrix4fv(l,!1,o);const h=t.getAttribLocation(n,"a_position"),c=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,c),t.bufferData(t.ARRAY_BUFFER,new Float32Array(e),t.STATIC_DRAW),t.vertexAttribPointer(h,2,t.FLOAT,!1,0,0),t.enableVertexAttribArray(h);const u=t.getAttribLocation(n,"a_texcoord"),d=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,d),t.bufferData(t.ARRAY_BUFFER,new Float32Array(i),t.STATIC_DRAW),t.vertexAttribPointer(u,2,t.FLOAT,!1,0,0),t.enableVertexAttribArray(u),t.drawArrays(t.TRIANGLES,0,e.length/2)}if(u){const e=og(t,"\n precision mediump float;\n\n uniform vec4 u_val;\n void main() {\n gl_FragColor = u_val;\n }\n","\n attribute vec4 a_position;\n\n uniform mat4 u_matrix;\n\n void main() {\n gl_Position = u_matrix * a_position;\n }\n");t.useProgram(e);const i=tg(0,f,p,0,-1,1),n=t.getUniformLocation(e,"u_matrix");t.uniformMatrix4fv(n,!1,i);const r=Array.isArray(u)?u:[0,0,0,255],s=t.getUniformLocation(e,"u_val");t.uniform4fv(s,r);const o=t.getAttribLocation(e,"a_position"),l=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,l),t.vertexAttribPointer(o,2,t.FLOAT,!1,0,0),t.enableVertexAttribArray(o);const h=a.getTriangles().reduce((function(t,e){const i=e.target,{u1:n,v1:r,u0:s,v0:o,u2:a,v2:l}=C(i);return t.concat([n,r,s,o,s,o,a,l,a,l,n,r])}),[]);t.bufferData(t.ARRAY_BUFFER,new Float32Array(h),t.STATIC_DRAW),t.drawArrays(t.LINES,0,h.length/2)}return{width:f,height:p,framebuffer:_,texture:m}}class ug extends Lt{constructor(t){super({tileCoord:t.tileCoord,loader:()=>Promise.resolve(new Uint8ClampedArray(4)),interpolate:t.interpolate,transition:t.transition}),this.renderEdges_=void 0!==t.renderEdges&&t.renderEdges,this.pixelRatio_=t.pixelRatio,this.gutter_=t.gutter,this.reprojData_=null,this.reprojError_=null,this.reprojSize_=void 0,this.sourceTileGrid_=t.sourceTileGrid,this.targetTileGrid_=t.targetTileGrid,this.wrappedTileCoord_=t.wrappedTileCoord||t.tileCoord,this.sourceTiles_=[],this.sourcesListenerKeys_=null,this.sourceZ_=0;const e=t.sourceProj,i=e.getExtent(),n=t.sourceTileGrid.getExtent();this.clipExtent_=e.canWrapX()?n?me(i,n):i:n;const r=this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_),s=this.targetTileGrid_.getExtent();let o=this.sourceTileGrid_.getExtent();const a=s?me(r,s):r;if(0===he(a))return void(this.state=J);i&&(o=o?me(o,i):i);const l=this.targetTileGrid_.getResolution(this.wrappedTileCoord_[0]),h=t.targetProj,c=Mu(e,h,a,l);if(!isFinite(c)||c<=0)return void(this.state=J);const u=void 0!==t.errorThreshold?t.errorThreshold:gd;if(this.triangulation_=new dd(e,h,a,o,c*u,l,t.transformMatrix),0===this.triangulation_.getTriangles().length)return void(this.state=J);this.sourceZ_=this.sourceTileGrid_.getZForResolution(c);let d=this.triangulation_.calculateSourceExtent();if(o&&(e.canWrapX()?(d[1]=Ie(d[1],o[1],o[3]),d[3]=Ie(d[3],o[1],o[3])):d=me(d,o)),he(d)){let n=0,r=0;e.canWrapX()&&(n=ve(i),r=Math.floor((d[0]-i[0])/n));Pe(d.slice(),e,!0).forEach((e=>{const i=this.sourceTileGrid_.getTileRangeForExtentAndZ(e,this.sourceZ_),s=t.getTileFunction;for(let t=i.minX;t<=i.maxX;t++)for(let e=i.minY;e<=i.maxY;e++){const i=s(this.sourceZ_,t,e,this.pixelRatio_);if(i){const t=r*n;this.sourceTiles_.push({tile:i,offset:t})}}++r})),0===this.sourceTiles_.length&&(this.state=J)}else this.state=J}getSize(){return this.reprojSize_}getData(){return this.reprojData_}getError(){return this.reprojError_}reproject_(){const t=[];let e=!1;if(this.sourceTiles_.forEach((i=>{const n=i.tile;if(!n||n.getState()!==K)return;const r=n.getSize(),s=this.gutter_;let o;const a=bt(n.getData());a?o=a:(e=!0,o=It(Ct(n.getData())));const l=[r[0]+2*s,r[1]+2*s],h=o instanceof Float32Array,c=l[0]*l[1],u=h?Float32Array:Uint8ClampedArray,d=new u(o.buffer),g=u.BYTES_PER_ELEMENT,f=g*d.length/c,p=d.byteLength/l[1],_=Math.floor(p/g/l[0]),m=this.sourceTileGrid_.getTileCoordExtent(n.tileCoord);m[0]+=i.offset,m[2]+=i.offset;const y=this.clipExtent_?.slice();y&&(y[0]+=i.offset,y[2]+=i.offset),t.push({extent:m,clipExtent:y,data:d,dataType:u,bytesPerPixel:f,pixelSize:l,bandCount:_})})),this.sourceTiles_.length=0,0===t.length)return this.state=q,void this.changed();const i=this.wrappedTileCoord_[0],n=this.targetTileGrid_.getTileSize(i),r="number"==typeof n?n:n[0],s="number"==typeof n?n:n[1],o=Math.round(r*this.pixelRatio_),a=Math.round(s*this.pixelRatio_),l=this.targetTileGrid_.getResolution(i),h=this.sourceTileGrid_.getResolution(this.sourceZ_),c=this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_),u=t[0].bandCount,d=new t[0].dataType(u*o*a),g=ag(o,a,hg,{premultipliedAlpha:!1,antialias:!1});let f;const p=g.RGBA;let _;if(t[0].dataType==Float32Array){_=g.FLOAT,g.getExtension("WEBGL_color_buffer_float"),g.getExtension("OES_texture_float"),g.getExtension("EXT_float_blend");f=null!==g.getExtension("OES_texture_float_linear")&&this.interpolate}else _=g.UNSIGNED_BYTE,f=this.interpolate;for(let e=Math.ceil(u/4)-1;e>=0;--e){const i=[];for(let n=0,r=t.length;n<r;++n){const r=t[n],s=r.pixelSize,o=s[0],a=s[1],l=new r.dataType(4*o*a),h=r.data;let c=4*e;for(let t=0,e=l.length;t<e;t+=4)l[t]=h[c],l[t+1]=h[c+1],l[t+2]=h[c+2],l[t+3]=h[c+3],c+=u;const d=g.createTexture();g.bindTexture(g.TEXTURE_2D,d),f?(g.texParameteri(g.TEXTURE_2D,g.TEXTURE_MIN_FILTER,g.LINEAR),g.texParameteri(g.TEXTURE_2D,g.TEXTURE_MAG_FILTER,g.LINEAR)):(g.texParameteri(g.TEXTURE_2D,g.TEXTURE_MIN_FILTER,g.NEAREST),g.texParameteri(g.TEXTURE_2D,g.TEXTURE_MAG_FILTER,g.NEAREST)),g.texParameteri(g.TEXTURE_2D,g.TEXTURE_WRAP_S,g.CLAMP_TO_EDGE),g.texParameteri(g.TEXTURE_2D,g.TEXTURE_WRAP_T,g.CLAMP_TO_EDGE),g.texImage2D(g.TEXTURE_2D,0,p,o,a,0,p,_,l),i.push({extent:r.extent,clipExtent:r.clipExtent,texture:d,width:o,height:a})}const{framebuffer:n,width:o,height:a}=cg(g,r,s,this.pixelRatio_,h,l,c,this.triangulation_,i,this.gutter_,_,this.renderEdges_,f),m=o,y=4*a,x=new t[0].dataType(m*y);g.bindFramebuffer(g.FRAMEBUFFER,n),g.readPixels(0,0,o,a,g.RGBA,_,x);let v=4*e;for(let t=0,e=x.length;t<e;t+=4){const e=(m-1-(t/y|0))*y+t%y;d[v]=x[e],d[v+1]=x[e+1],d[v+2]=x[e+2],d[v+3]=x[e+3],v+=u}}if(lg(g),hg.push(g.canvas),e){const t=ft(r,s),e=new ImageData(d,r);t.putImageData(e,0,0),this.reprojData_=t.canvas}else this.reprojData_=d;this.reprojSize_=[o,a],this.state=K,this.changed()}load(){if(this.state!==Y&&this.state!==q)return;this.state=H,this.changed();let t=0;this.sourcesListenerKeys_=[],this.sourceTiles_.forEach((({tile:e})=>{const i=e.getState();if(i!==Y&&i!==H)return;t++;const r=D(e,n,(()=>{const i=e.getState();i!=K&&i!=q&&i!=J||(k(r),t--,0===t&&(this.unlistenSources_(),this.reproject_()))}));this.sourcesListenerKeys_.push(r)})),0===t?setTimeout(this.reproject_.bind(this),0):this.sourceTiles_.forEach((function({tile:t}){t.getState()==Y&&t.load()}))}unlistenSources_(){this.sourcesListenerKeys_.forEach(k),this.sourcesListenerKeys_=null}}class dg extends md{constructor(t){const e=void 0===t.projection?"EPSG:3857":t.projection;let i=t.tileGrid;void 0===i&&e&&(i=Ku({extent:Qu(e),maxResolution:t.maxResolution,maxZoom:t.maxZoom,minZoom:t.minZoom,tileSize:t.tileSize})),super({cacheSize:.1,attributions:t.attributions,attributionsCollapsible:t.attributionsCollapsible,projection:e,tileGrid:i,state:t.state,wrapX:t.wrapX,transition:t.transition,interpolate:t.interpolate,key:t.key,zDirection:t.zDirection}),this.gutter_=void 0!==t.gutter?t.gutter:0,this.tileSize_=t.tileSize?Wl(t.tileSize):null,this.tileSizes_=null,this.tileLoadingKeys_={},this.loader_=t.loader,this.handleTileChange_=this.handleTileChange_.bind(this),this.bandCount=void 0===t.bandCount?4:t.bandCount,this.tileGridForProjection_={},this.crossOrigin_=t.crossOrigin||"anonymous",this.referrerPolicy_=t.referrerPolicy,this.transformMatrix=null}setTileSizes(t){this.tileSizes_=t}getTileSize(t){if(this.tileSizes_)return this.tileSizes_[t];if(this.tileSize_)return this.tileSize_;const e=this.getTileGrid();return e?Wl(e.getTileSize(t)):[256,256]}getGutterForProjection(t){const e=this.getProjection();return e&&!Fn(e,t)||this.transformMatrix?0:this.gutter_}setLoader(t){this.loader_=t}getReprojTile_(t,e,i,n,r,s){const o=this.tileGrid||this.getTileGridForProjection(r||n),a=Math.max.apply(null,o.getResolutions().map(((t,e)=>{const i=Wl(o.getTileSize(e)),n=this.getTileSize(e);return Math.max(n[0]/i[0],n[1]/i[1])}))),l=this.getTileGridForProjection(n),h=[t,e,i],c=this.getTileCoordForTileUrlFunction(h,n),u=Object.assign({sourceProj:r||n,sourceTileGrid:o,targetProj:n,targetTileGrid:l,tileCoord:h,wrappedTileCoord:c,pixelRatio:a,gutter:this.gutter_,getTileFunction:(t,e,i,n)=>this.getTile(t,e,i,n,void 0,s),transformMatrix:this.transformMatrix},this.tileOptions),d=new ug(u);return d.key=this.getKey(),d}getTile(t,e,i,r,s,o){const a=this.getProjection();if(s&&(a&&!Fn(a,s)||this.transformMatrix))return this.getReprojTile_(t,e,i,s,a,o);const l=this.getTileSize(t),h=this.loader_,c=new AbortController,u={signal:c.signal,crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},d=this.getTileCoordForTileUrlFunction([t,e,i]);if(!d)return null;const g=ju(this,this.getKey(),t,e,i);if(o&&o.containsKey(g))return o.get(g);const f=d[0],p=d[1],_=d[2],m=this.getTileGrid()?.getFullTileRange(f);m&&(u.maxY=m.getHeight()-1);const y=Object.assign({tileCoord:[t,e,i],loader:function(){return I((function(){return h(f,p,_,u)}))},size:l,controller:c},this.tileOptions),x=new Lt(y);return x.key=this.getKey(),x.addEventListener(n,this.handleTileChange_),o?.set(g,x),x}handleTileChange_(t){const e=t.target,i=z(e),n=e.getState();let r;n==H?(this.tileLoadingKeys_[i]=!0,r=xd):i in this.tileLoadingKeys_&&(delete this.tileLoadingKeys_[i],r=n==q?Sd:n==K?vd:void 0),r&&this.dispatchEvent(new yd(r,e))}getTileGridForProjection(t){const e=this.getProjection();if(this.tileGrid&&(!e||Fn(e,t))&&!this.transformMatrix)return this.tileGrid;const i=z(t);return i in this.tileGridForProjection_||(this.tileGridForProjection_[i]=Zu(t)),this.tileGridForProjection_[i]}setTileGridForProjection(t,e){const i=En(t);if(i){const t=z(i);t in this.tileGridForProjection_||(this.tileGridForProjection_[t]=e)}}}function gg(t,e){if(!t)return!1;if(!0===t)return!0;if(3!==e.getSamplesPerPixel())return!1;const i=e.fileDirectory.getValue("PhotometricInterpretation"),n=GeoTIFF.globals.photometricInterpretations;return i===n.CMYK||i===n.YCbCr||i===n.CIELab||i===n.ICCLab}const fg="STATISTICS_MAXIMUM",pg="STATISTICS_MINIMUM";let _g;function mg(t){try{return t.getBoundingBox(!0)}catch{return[0,0,t.getWidth(),t.getHeight()]}}function yg(t){try{return t.getOrigin().slice(0,2)}catch{return[0,t.getHeight()]}}function xg(t,e){try{return t.getResolution(e)}catch{return[e.getWidth()/t.getWidth(),e.getHeight()/t.getHeight()]}}function vg(t){const e=t.getGeoKeys();if(!e)return null;if(e.ProjectedCSTypeGeoKey&&32767!==e.ProjectedCSTypeGeoKey){const t="EPSG:"+e.ProjectedCSTypeGeoKey;let i=En(t);if(!i){const n=pi(e.ProjLinearUnitsGeoKey);n&&(i=new mi({code:t,units:n}))}return i}if(e.GeographicTypeGeoKey&&32767!==e.GeographicTypeGeoKey){const t="EPSG:"+e.GeographicTypeGeoKey;let i=En(t);if(!i){const n=pi(e.GeogAngularUnitsGeoKey);n&&(i=new mi({code:t,units:n}))}return i}return null}function Sg(t){return t.getImageCount().then((function(e){const i=new Array(e);for(let n=0;n<e;++n)i[n]=t.getImage(n);return Promise.all(i)}))}function Eg(t,e){let i;return i=t.blob?GeoTIFF.fromBlob(t.blob):t.overviews?GeoTIFF.fromUrls(t.url,t.overviews,e):GeoTIFF.fromUrl(t.url,e),i.then(Sg)}function wg(t,e,i,n,r){if(Array.isArray(t)){const s=t.length;if(!Array.isArray(e)||s!=e.length){const t=new Error(n);throw r(t),t}for(let o=0;o<s;++o)wg(t[o],e[o],i,n,r)}else if(Math.abs(t-e)>i*t)throw new Error(n)}function Tg(t){return t instanceof Int8Array?127:t instanceof Uint8Array||t instanceof Uint8ClampedArray?255:t instanceof Int16Array?32767:t instanceof Uint16Array?65535:t instanceof Int32Array?2147483647:t instanceof Uint32Array?4294967295:t instanceof Float32Array?34e37:255}class Cg extends dg{constructor(t){super({attributions:t.attributions,state:"loading",tileGrid:null,projection:t.projection||null,transition:t.transition,interpolate:!1!==t.interpolate,wrapX:t.wrapX}),this.sourceInfo_=t.sources;const e=this.sourceInfo_.length;this.sourceOptions_=t.sourceOptions,this.sourceImagery_=new Array(e),this.sourceMasks_=new Array(e),this.resolutionFactors_=new Array(e),this.samplesPerPixel_,this.nodataValues_,this.metadata_,this.normalize_=!1!==t.normalize,this.addAlpha_=!1,this.error_=null,this.convertToRGB_=t.convertToRGB||!1,this.setKey(this.sourceInfo_.map((t=>t.url)).join(","));const i=this,n=new Array(e);for(let t=0;t<e;++t)n[t]=Eg(this.sourceInfo_[t],this.sourceOptions_);Promise.all(n).then((function(t){i.configure_(t)})).catch((function(t){Ke(t),i.error_=t,i.setState("error")}))}getError(){return this.error_}determineProjection(t){const e=t[0];for(let t=e.length-1;t>=0;--t){const i=vg(e[t]);if(i){this.projection=i;break}}}determineTransformMatrix(t){const e=t[0];for(let t=e.length-1;t>=0;--t){const i=e[t].fileDirectory.getValue("ModelTransformation");if(i){const[t,e,n,r,s,o,a,l]=i,h=Kn(Kn([1/Math.sqrt(t*t+s*s),0,0,-1/Math.sqrt(e*e+o*o),r,l],[t,s,e,o,0,0]),[1,0,0,1,-r,-l]);this.transformMatrix=h,this.addAlpha_=!0;break}}}configure_(t){let e,i,n,r,s;const o=new Array(t.length),a=new Array(t.length),l=new Array(t.length);let h=0;const c=t.length;for(let u=0;u<c;++u){const c=[],d=[];t[u].forEach((t=>{4&~(t.fileDirectory.getValue("NewSubfileType")||0)?c.push(t):d.push(t)}));const g=c.length;if(d.length>0&&d.length!==g)throw new Error(`Expected one mask per image found ${d.length} masks and ${g} images`);let f,p;const _=new Array(g),m=new Array(g),y=new Array(g);a[u]=new Array(g),l[u]=new Array(g);for(let t=0;t<g;++t){const e=c[t],i=e.getGDALNoData();l[u][t]=e.getGDALMetadata(0),a[u][t]=i;const n=this.sourceInfo_[u].bands;o[u]=n?n.length:e.getSamplesPerPixel();const r=g-(t+1);f||(f=mg(e)),p||(p=yg(e));const s=xg(e,c[0]);y[r]=s[0];const h=[e.getTileWidth(),e.getTileHeight()];h[0]!==h[1]&&h[1]<256&&(h[0]=256,h[1]=256),_[r]=h;const d=s[0]/Math.abs(s[1]);m[r]=[h[0],h[1]/d]}if(e?me(e,f,e):e=f,i){wg(i,p,0,`Origin mismatch for source ${u}, got [${p}] but expected [${i}]`,this.viewRejector)}else i=p;if(s){s.length-h>y.length&&(h=s.length-y.length);const t=s[s.length-1]/y[y.length-1];this.resolutionFactors_[u]=t;const e=y.map((e=>e*t)),i=`Resolution mismatch for source ${u}, got [${e}] but expected [${s}]`;wg(s.slice(h,s.length),e,.02,i,this.viewRejector)}else s=y,this.resolutionFactors_[u]=1;n?wg(n.slice(h,n.length),m,.01,`Tile size mismatch for source ${u}`,this.viewRejector):n=m,r?wg(r.slice(h,r.length),_,0,`Tile size mismatch for source ${u}`,this.viewRejector):r=_,this.sourceImagery_[u]=c.reverse(),this.sourceMasks_[u]=d.reverse()}for(let t=0,e=this.sourceImagery_.length;t<e;++t){const e=this.sourceImagery_[t];for(;e.length<s.length;)e.unshift(void 0)}this.getProjection()||this.determineProjection(t),this.determineTransformMatrix(t),this.samplesPerPixel_=o,this.nodataValues_=a,this.metadata_=l;t:for(let t=0;t<c;++t){if(void 0!==this.sourceInfo_[t].nodata){this.addAlpha_=!0;break}if(this.sourceMasks_[t].length){this.addAlpha_=!0;break}const e=a[t],i=this.sourceInfo_[t].bands;if(i){for(let t=0;t<i.length;++t)if(null!==e[i[t]-1]){this.addAlpha_=!0;break t}}else for(let t=0;t<e.length;++t)if(null!==e[t]){this.addAlpha_=!0;break t}}let u=this.addAlpha_?1:0;for(let t=0;t<c;++t)u+=o[t];this.bandCount=u;const d=new Vu({extent:e,minZoom:h,origin:i,resolutions:s,tileSizes:n});this.tileGrid=d,this.setTileSizes(r),this.setLoader(this.loadTile_.bind(this)),this.setState("ready");2===s.length?s=[s[0],s[1],s[1]/2]:1===s.length&&(s=[2*s[0],s[0],s[0]/2]);let g=e;if(this.transformMatrix){const t=rr([1,0,0,1,0,0],this.transformMatrix.slice());g=be(e,Rn((e=>Qn(t,e))))}this.viewResolver({showFullExtent:!0,projection:this.projection,resolutions:s,center:jn(de(g),this.projection),extent:Bn(g,this.projection),zoom:1})}loadTile_(t,e,i,n){const r=this.getTileSize(t),s=this.sourceImagery_.length,o=new Array(2*s),a=this.nodataValues_,l=this.sourceInfo_,h=(_g||(_g=new GeoTIFF.Pool),_g);for(let c=0;c<s;++c){const u=l[c],d=this.resolutionFactors_[c],g=[Math.round(e*(r[0]*d)),Math.round(i*(r[1]*d)),Math.round((e+1)*(r[0]*d)),Math.round((i+1)*(r[1]*d))],f=this.sourceImagery_[c][t];let p,_;u.bands&&(p=u.bands.map((function(t){return t-1}))),_="nodata"in u&&null!==u.nodata?u.nodata:p?p.map((function(t){return a[c][t]})):a[c];const m={window:g,width:r[0],height:r[1],samples:p,fillValue:_,pool:h,interleave:!1,signal:n.signal};gg(this.convertToRGB_,f)?o[c]=f.readRGB(m):o[c]=f.readRasters(m);const y=s+c,x=this.sourceMasks_[c][t];x?o[y]=x.readRasters({window:g,width:r[0],height:r[1],samples:[0],pool:h,interleave:!1}):o[y]=Promise.resolve(null)}return Promise.all(o).then(this.composeTile_.bind(this,r)).catch((function(t){throw Ke(t),t}))}async composeTile_(t,e){const i=this.metadata_,n=this.sourceInfo_,r=this.sourceImagery_.length,s=this.bandCount,o=this.samplesPerPixel_,a=this.nodataValues_,l=this.normalize_,h=this.addAlpha_,c=t[0]*t[1],u=c*s;let d;d=l?new Uint8Array(u):new Float32Array(u);let g=0;for(let t=0;t<c;++t){let s=h;for(let c=0;c<r;++c){const u=n[c];let p,_,m=u.min,y=u.max;if(l){const t=await i[c][0];void 0===m&&(m=t&&pg in t?parseFloat(t[pg]):(f=e[c][0])instanceof Int8Array?-128:f instanceof Int16Array?-32768:f instanceof Int32Array?-2147483648:f instanceof Float32Array?12e-39:0),void 0===y&&(y=t&&fg in t?parseFloat(t[fg]):Tg(e[c][0])),p=255/(y-m),_=-m*p}for(let i=0;i<o[c];++i){const n=e[c][i][t];let r;if(r=l?Ie(p*n+_,0,255):n,h){let t=u.nodata;if(void 0===t){let e;e=u.bands?u.bands[i]-1:i,t=a[c][e]}const e=isNaN(t);(!e&&n!==t||e&&!isNaN(n))&&(s=!1,d[g]=r)}else d[g]=r;g++}if(!s){const i=e[r+c];i&&!i[0][t]&&(s=!0)}}h&&(s||(d[g]=255),g++)}var f;return d}}Cg.prototype.getView;const bg="version1",Rg="version2",Pg="version3",Ig={};Ig[bg]={level0:{supports:[],formats:[],qualities:["native"]},level1:{supports:["regionByPx","sizeByW","sizeByH","sizeByPct"],formats:["jpg"],qualities:["native"]},level2:{supports:["regionByPx","regionByPct","sizeByW","sizeByH","sizeByPct","sizeByConfinedWh","sizeByWh"],formats:["jpg","png"],qualities:["native","color","grey","bitonal"]}},Ig[Rg]={level0:{supports:[],formats:["jpg"],qualities:["default"]},level1:{supports:["regionByPx","sizeByW","sizeByH","sizeByPct"],formats:["jpg"],qualities:["default"]},level2:{supports:["regionByPx","regionByPct","sizeByW","sizeByH","sizeByPct","sizeByConfinedWh","sizeByDistortedWh","sizeByWh"],formats:["jpg","png"],qualities:["default","bitonal"]}},Ig[Pg]={level0:{supports:[],formats:["jpg"],qualities:["default"]},level1:{supports:["regionByPx","regionSquare","sizeByW","sizeByH","sizeByWh"],formats:["jpg"],qualities:["default"]},level2:{supports:["regionByPx","regionSquare","regionByPct","sizeByW","sizeByH","sizeByPct","sizeByConfinedWh","sizeByWh"],formats:["jpg","png"],qualities:["default"]}},Ig.none={none:{supports:[],formats:[],qualities:[]}};const Fg=/^https?:\/\/library\.stanford\.edu\/iiif\/image-api\/(?:1\.1\/)?compliance\.html#level[0-2]$/,Lg=/^https?:\/\/iiif\.io\/api\/image\/2\/level[0-2](?:\.json)?$/,Mg=/(^https?:\/\/iiif\.io\/api\/image\/3\/level[0-2](?:\.json)?$)|(^level[0-2]$)/;const Ag={};Ag[bg]=function(t){let e=t.getComplianceLevelSupportedFeatures();return void 0===e&&(e=Ig[bg].level0),{url:void 0===t.imageInfo["@id"]?void 0:t.imageInfo["@id"].replace(/\/?(?:info\.json)?$/g,""),supports:e.supports,formats:[...e.formats,void 0===t.imageInfo.formats?[]:t.imageInfo.formats],qualities:[...e.qualities,void 0===t.imageInfo.qualities?[]:t.imageInfo.qualities],resolutions:t.imageInfo.scale_factors,tileSize:void 0!==t.imageInfo.tile_width?void 0!==t.imageInfo.tile_height?[t.imageInfo.tile_width,t.imageInfo.tile_height]:[t.imageInfo.tile_width,t.imageInfo.tile_width]:null!=t.imageInfo.tile_height?[t.imageInfo.tile_height,t.imageInfo.tile_height]:void 0}},Ag[Rg]=function(t){const e=t.getComplianceLevelSupportedFeatures(),i=Array.isArray(t.imageInfo.profile)&&t.imageInfo.profile.length>1,n=i&&t.imageInfo.profile[1].supports?t.imageInfo.profile[1].supports:[],r=i&&t.imageInfo.profile[1].formats?t.imageInfo.profile[1].formats:[],s=i&&t.imageInfo.profile[1].qualities?t.imageInfo.profile[1].qualities:[];return{url:t.imageInfo["@id"].replace(/\/?(?:info\.json)?$/g,""),sizes:void 0===t.imageInfo.sizes?void 0:t.imageInfo.sizes.map((function(t){return[t.width,t.height]})),tileSize:void 0===t.imageInfo.tiles?void 0:[t.imageInfo.tiles.map((function(t){return t.width}))[0],t.imageInfo.tiles.map((function(t){return void 0===t.height?t.width:t.height}))[0]],resolutions:void 0===t.imageInfo.tiles?void 0:t.imageInfo.tiles.map((function(t){return t.scaleFactors}))[0],supports:[...e.supports,...n],formats:[...e.formats,...r],qualities:[...e.qualities,...s]}},Ag[Pg]=function(t){const e=t.getComplianceLevelSupportedFeatures(),i=void 0===t.imageInfo.extraFormats?e.formats:[...e.formats,...t.imageInfo.extraFormats],n=void 0!==t.imageInfo.preferredFormats&&Array.isArray(t.imageInfo.preferredFormats)&&t.imageInfo.preferredFormats.length>0?t.imageInfo.preferredFormats.filter((function(t){return["jpg","png","gif"].includes(t)})).reduce((function(t,e){return void 0===t&&i.includes(e)?e:t}),void 0):void 0;return{url:t.imageInfo.id,sizes:void 0===t.imageInfo.sizes?void 0:t.imageInfo.sizes.map((function(t){return[t.width,t.height]})),tileSize:void 0===t.imageInfo.tiles?void 0:[t.imageInfo.tiles.map((function(t){return t.width}))[0],t.imageInfo.tiles.map((function(t){return t.height}))[0]],resolutions:void 0===t.imageInfo.tiles?void 0:t.imageInfo.tiles.map((function(t){return t.scaleFactors}))[0],supports:void 0===t.imageInfo.extraFeatures?e.supports:[...e.supports,...t.imageInfo.extraFeatures],formats:i,qualities:void 0===t.imageInfo.extraQualities?e.qualities:[...e.qualities,...t.imageInfo.extraQualities],preferredFormat:n}};let Og=class extends Bs{constructor(t,e,i,n,r,s,o){super(e,i,n,r,s,o),this.zoomifyImage_=null,this.tileSize_=t}getImage(){if(this.zoomifyImage_)return this.zoomifyImage_;const t=super.getImage();if(this.state==K){const e=this.tileSize_;if(t.width==e[0]&&t.height==e[1])return this.zoomifyImage_=t,t;const i=ft(e[0],e[1]);return i.drawImage(t,0,0),this.zoomifyImage_=i.canvas,i.canvas}return t}};function Dg(t){return t.toLocaleString("en",{maximumFractionDigits:10})}class Ng extends Ds{constructor(t,e,i,n,r,s,o){let a=t.getExtent();a&&t.canWrapX()&&(a=a.slice(),a[0]=-1/0,a[2]=1/0);let l=e.getExtent();l&&e.canWrapX()&&(l=l.slice(),l[0]=-1/0,l[2]=1/0);const h=l?me(i,l):i,c=Lu(t,e,de(h),n),u=new dd(t,e,h,a,.5*c,n),d=u.calculateSourceExtent(),g=Ee(d)?null:s(d,c,r),f=g?Fs:Os,p=g?g.getPixelRatio():1;super(i,n,p,f),this.targetProj_=e,this.maxSourceExtent_=a,this.triangulation_=u,this.targetResolution_=n,this.targetExtent_=i,this.sourceImage_=g,this.sourcePixelRatio_=p,this.interpolate_=o,this.canvas_=null,this.sourceListenerKey_=null}disposeInternal(){this.state==Ls&&this.unlistenSource_(),super.disposeInternal()}getImage(){return this.canvas_}getProjection(){return this.targetProj_}reproject_(){const t=this.sourceImage_.getState();if(t==Ms){const t=ve(this.targetExtent_)/this.targetResolution_,e=_e(this.targetExtent_)/this.targetResolution_;this.canvas_=Au(t,e,this.sourcePixelRatio_,Ou(this.sourceImage_.getResolution()),this.maxSourceExtent_,this.targetResolution_,this.targetExtent_,this.triangulation_,[{extent:this.sourceImage_.getExtent(),image:this.sourceImage_.getImage()}],0,void 0,this.interpolate_,!0)}this.state=t,this.changed()}load(){if(this.state==Fs){this.state=Ls,this.changed();const t=this.sourceImage_.getState();t==Ms||t==As?this.reproject_():(this.sourceListenerKey_=D(this.sourceImage_,n,(t=>{const e=this.sourceImage_.getState();e!=Ms&&e!=As||(this.unlistenSource_(),this.reproject_())})),this.sourceImage_.load())}}unlistenSource_(){k(this.sourceListenerKey_),this.sourceListenerKey_=null}}const kg="imageloadstart",Gg="imageloadend",jg="imageloaderror";class Ug extends M{constructor(t,e){super(t),this.image=e}}class Bg extends pd{constructor(t){super({attributions:t.attributions,projection:t.projection,state:t.state,interpolate:void 0===t.interpolate||t.interpolate}),this.on,this.once,this.un,this.loader=t.loader||null,this.resolutions_=void 0!==t.resolutions?t.resolutions:null,this.reprojectedImage_=null,this.reprojectedRevision_=0,this.image=null,this.wantedExtent_,this.wantedResolution_,this.static_=!!t.loader&&0===t.loader.length,this.wantedProjection_=null}getResolutions(){return this.resolutions_}setResolutions(t){this.resolutions_=t}findNearestResolution(t){const e=this.getResolutions();if(e){t=e[v(e,t,0)]}return t}getImage(t,e,i,n){const r=this.getProjection();if(!r||!n||Fn(r,n))return r&&(n=r),this.getImageInternal(t,e,i,n);if(this.reprojectedImage_){if(this.reprojectedRevision_==this.getRevision()&&Fn(this.reprojectedImage_.getProjection(),n)&&this.reprojectedImage_.getResolution()==e&&te(this.reprojectedImage_.getExtent(),t))return this.reprojectedImage_;this.reprojectedImage_.dispose(),this.reprojectedImage_=null}return this.reprojectedImage_=new Ng(r,n,t,e,i,((t,e,i)=>this.getImageInternal(t,e,i,r)),this.getInterpolate()),this.reprojectedRevision_=this.getRevision(),this.reprojectedImage_}getImageInternal(t,e,i,r){if(this.loader){const s=Xg(t,e,i,1),o=this.findNearestResolution(e);if(this.image&&(this.static_||this.wantedProjection_===r&&(this.wantedExtent_&&Wt(this.wantedExtent_,s)||Wt(this.image.getExtent(),s))&&(this.wantedResolution_&&Ou(this.wantedResolution_)===o||Ou(this.image.getResolution())===o)))return this.image;this.wantedProjection_=r,this.wantedExtent_=s,this.wantedResolution_=o,this.image=new Ds(s,o,i,this.loader),this.image.addEventListener(n,this.handleImageChange.bind(this))}return this.image}handleImageChange(t){const e=t.target;let i;switch(e.getState()){case Ls:this.loading=!0,i=kg;break;case Ms:this.loading=!1,i=Gg;break;case As:this.loading=!1,i=jg;break;default:return}this.hasListener(i)&&this.dispatchEvent(new Ug(i,e))}}function zg(t,e){t.getImage().src=e}function Xg(t,e,i,n){const r=e/i,s=de(t),o=Ue(ve(t)/r,4),a=Ue(_e(t)/r,4);return fe(s,r,0,[o+2*Ue((n-1)*o/2,4),a+2*Ue((n-1)*a/2,4)])}function Vg(t,e,i,n,r,s){const o=r.getCode().split(/:(?=\d+$)/).pop(),a=i/n,l=[Ge(ve(e)/a,4),Ge(_e(e)/a,4)];s.SIZE=l[0]+","+l[1],s.BBOX=e.join(","),s.BBOXSR=o,s.IMAGESR=o,s.DPI=Math.round(s.DPI?s.DPI*n:90*n);return td(t.replace(/MapServer\/?$/,"MapServer/export").replace(/ImageServer\/?$/,"ImageServer/exportImage"),s)}function $g(t){const e=t.load?t.load:js,i=En(t.projection||"EPSG:3857"),n=t.ratio??1.5,r=t.crossOrigin??null,s=t.referrerPolicy;return function(o,a,l){l=t.hidpi?l:1;const h={F:"image",FORMAT:"PNG32",TRANSPARENT:!0};Object.assign(h,t.params),o=Xg(o,a,l,n);const c=Vg(t.url,o,a,l,i,h),u=new Image;return u.crossOrigin=r,void 0!==s&&(u.referrerPolicy=s),e(u,c).then((t=>{const e=ve(o)/t.width*l;return{image:t,extent:o,resolution:e,pixelRatio:l}}))}}function Wg(t,e,i,n,r,s,o){const a=function(t,e,i,n){const r=ve(t),s=_e(t),o=e[0],a=e[1],l=.0254/n;return a*r>o*s?r*i/(o*l):s*i/(a*l)}(i,n,s,o),l=de(i),h={OPERATION:r?"GETDYNAMICMAPOVERLAYIMAGE":"GETMAPIMAGE",VERSION:"2.0.0",LOCALE:"en",CLIENTAGENT:"ol/source/ImageMapGuide source",CLIP:"1",SETDISPLAYDPI:o,SETDISPLAYWIDTH:Math.round(n[0]),SETDISPLAYHEIGHT:Math.round(n[1]),SETVIEWSCALE:a,SETVIEWCENTERX:l[0],SETVIEWCENTERY:l[1]};return Object.assign(h,e),td(t,h)}function Zg(t){const e=t.load||js,i=t.useOverlay??!1,n=t.metersPerUnit||1,r=t.displayDpi||96,s=t.ratio??1,o=t.crossOrigin??null,a=t.referrerPolicy;return function(l,h,c){const u=new Image;u.crossOrigin=o,void 0!==a&&(u.referrerPolicy=a);const d=ve(l=Xg(l,h,c,s))/h,g=_e(l)/h,f=[d*c,g*c],p=Wg(t.url,t.params,l,f,i,n,r);return e(u,p).then((t=>({image:t,extent:l,pixelRatio:c})))}}function Yg(t){const e=t.load||js,i=t.imageExtent,n=t.crossOrigin??null;return()=>{const r=new Image;return r.crossOrigin=n,void 0!==t.referrerPolicy&&(r.referrerPolicy=t.referrerPolicy),e(r,t.url).then((t=>{const e=ve(i)/t.width,n=_e(i)/t.height;return{image:t,extent:i,resolution:e!==n?[e,n]:n,pixelRatio:1}}))}}const Hg=new Error("Image failed to load");function Kg(t,e,i,n,r){return new Promise(((s,o)=>{const a=new Image;a.crossOrigin=r.crossOrigin??null,void 0!==r.referrerPolicy&&(a.referrerPolicy=r.referrerPolicy),a.addEventListener("load",(()=>s(a))),a.addEventListener("error",(()=>o(Hg))),a.src=sd(t,e,i,n,r.maxY)}))}function qg(t){return function(e,i,n,r){return Kg(od(t,e,i,n),e,i,n,r)}}function Jg(t){let e;if(Array.isArray(t))e=qg(t);else if("string"==typeof t){e=qg(ad(t))}else{if("function"!=typeof t)throw new Error("The url option must be a single template, an array of templates, or a function for getting a URL");i=t,e=function(t,e,n,r){return Kg(i(t,e,n,r),t,e,n,r)}}var i;return e}let Qg=0;function tf(t){return Array.isArray(t)?t.join("\n"):"string"==typeof t?t:(++Qg,"url-function-key-"+Qg)}class ef extends dg{constructor(t){let e,i=(t=t||{}).loader;t.url&&(i=Jg(t.url),e=tf(t.url));const n=i?t.state:"loading",r=void 0===t.wrapX||t.wrapX;super({loader:i,key:e,attributions:t.attributions,attributionsCollapsible:t.attributionsCollapsible,maxZoom:t.maxZoom,minZoom:t.minZoom,tileSize:t.tileSize,gutter:t.gutter,maxResolution:t.maxResolution,projection:t.projection,tileGrid:t.tileGrid,state:n,wrapX:r,transition:t.transition,interpolate:!1!==t.interpolate,crossOrigin:t.crossOrigin,referrerPolicy:t.referrerPolicy,zDirection:t.zDirection})}setUrl(t){const e=Jg(t);this.setLoader(e),this.setKey(tf(t)),"ready"!==this.getState()&&this.setState("ready")}}const nf="1.3.0",rf=[101,101];function sf(t,e,i,n,r){r.WIDTH=i[0],r.HEIGHT=i[1];const s=n.getAxisOrientation(),o=Je(r.VERSION,"1.3")>=0;r[o?"CRS":"SRS"]=n.getCode();const a=o&&s.startsWith("ne")?[e[1],e[0],e[3],e[2]]:e;return r.BBOX=a.join(","),td(t,r)}function of(t,e,i,n,r,s,o){s=Object.assign({REQUEST:"GetMap"},s);const a=e/i,l=[Ge(ve(t)/a,4),Ge(_e(t)/a,4)];if(1!=i)switch(o){case"geoserver":const t=90*i+.5|0;"FORMAT_OPTIONS"in s?s.FORMAT_OPTIONS+=";dpi:"+t:s.FORMAT_OPTIONS="dpi:"+t;break;case"mapserver":s.MAP_RESOLUTION=90*i;break;case"carmentaserver":case"qgis":s.DPI=90*i;break;default:throw new Error("Unknown `serverType` configured")}return sf(r,t,l,n,s)}function af(t,e){return Object.assign({REQUEST:e,SERVICE:"WMS",VERSION:nf,FORMAT:"image/png",STYLES:"",TRANSPARENT:"TRUE"},t)}function lf(t){const e=void 0===t.hidpi||t.hidpi,i=En(t.projection||"EPSG:3857"),n=t.ratio||1.5,r=t.load||js,s=t.crossOrigin??null,o=t.referrerPolicy;return(a,l,h)=>{a=Xg(a,l,h,n),1==h||e&&void 0!==t.serverType||(h=1);const c=of(a,l,h,i,t.url,af(t.params,"GetMap"),t.serverType),u=new Image;return u.crossOrigin=s,void 0!==o&&(u.referrerPolicy=o),r(u,c).then((t=>({image:t,extent:a,pixelRatio:h})))}}function hf(t,e,i){if(void 0===t.url)return;const n=En(t.projection||"EPSG:3857"),r=fe(e,i,0,rf),s={QUERY_LAYERS:t.params.LAYERS,INFO_FORMAT:"application/json"};Object.assign(s,af(t.params,"GetFeatureInfo"),t.params);const o=je((e[0]-r[0])/i,4),a=je((r[3]-e[1])/i,4),l=Je(s.VERSION,"1.3")>=0;return s[l?"I":"X"]=o,s[l?"J":"Y"]=a,sf(t.url,r,rf,n,s)}function cf(t,e){if(void 0===t.url)return;const i={SERVICE:"WMS",VERSION:nf,REQUEST:"GetLegendGraphic",FORMAT:"image/png"};if(void 0!==e){const n=En(t.projection||"EPSG:3857").getMetersPerUnit()||1,r=28e-5;i.SCALE=e*n/r}if(Object.assign(i,t.params),void 0!==t.params&&void 0===i.LAYER){const t=i.LAYERS;if(!(!Array.isArray(t)||1!==t.length))return;i.LAYER=t}return td(t.url,i)}const uf={"image/png":!0,"image/jpeg":!0,"image/gif":!0,"image/webp":!0},df={"application/vnd.mapbox-vector-tile":!0,"application/geo+json":!0};function gf(t,e){if(!e.length)return t;const i=new URL(t,"file:/");if(i.pathname.split("/").includes("collections"))return Ke('The "collections" query parameter cannot be added to collection endpoints'),t;const n=e.map((t=>encodeURIComponent(t))).join(",");i.searchParams.append("collections",n);return`${t.split("?")[0]}?${decodeURIComponent(i.searchParams.toString())}`}function ff(t,e,i){let n,r;for(let i=0;i<t.length;++i){const s=t[i];if("item"===s.rel){if(s.type===e){n=s.href;break}(uf[s.type]||!r&&s.type.startsWith("image/"))&&(r=s.href)}}if(!n){if(!r)throw new Error('Could not find "item" link');n=r}return i&&(n=gf(n,i)),n}function pf(t,e,i,n){let r,s;const o={};for(let i=0;i<t.length;++i){const n=t[i];if(o[n.type]=n.href,"item"===n.rel){if(n.type===e){r=n.href;break}df[n.type]&&(s=n.href)}}if(!r&&i)for(let t=0;t<i.length;++t){const e=i[t];if(o[e]){r=o[e];break}}if(!r){if(!s)throw new Error('Could not find "item" link');r=s}return n&&(r=gf(r,n)),r}function _f(t,e,i,n){let r=t.projection;if(!r&&("string"==typeof e.crs?r=En(e.crs):"uri"in e.crs&&(r=En(e.crs.uri)),!r))throw new Error(`Unsupported CRS: ${JSON.stringify(e.crs)}`);const s=e.orderedAxes,o=!(s?s.slice(0,2).map((t=>t.replace(/E|X|Lon/i,"e").replace(/N|Y|Lat/i,"n"))).join(""):r.getAxisOrientation()).startsWith("en"),a=e.tileMatrices.sort((function(t,e){return e.cellSize-t.cellSize})),l={};for(let t=0;t<a.length;++t){const e=a[t];l[e.id]=e}const h={},c=[];if(n)for(let t=0;t<n.length;++t){const e=n[t],i=e.tileMatrix,r=l[i],s=a.indexOf(r);c[s]=i,h[i]=e}else for(let t=0;t<a.length;++t){const e=a[t].id;c.push(e)}const u=c.length,d=new Array(u),g=new Array(u),f=new Array(u),p=new Array(u),_=[-1/0,-1/0,1/0,1/0];for(let t=0;t<u;++t){const e=c[t],i=l[e],n=i.pointOfOrigin;d[t]=o?[n[1],n[0]]:n,g[t]=i.cellSize,f[t]=[i.matrixWidth,i.matrixHeight],p[t]=[i.tileWidth,i.tileHeight];const r=h[e];if(r){const e=i.cellSize*i.tileWidth,n=d[t][0]+r.minTileCol*e,s=d[t][0]+(r.maxTileCol+1)*e,o=i.cellSize*i.tileHeight;let a,l;"bottomLeft"===i.cornerOfOrigin?(a=d[t][1]+r.minTileRow*o,l=d[t][1]+(r.maxTileRow+1)*o):(a=d[t][1]-(r.maxTileRow+1)*o,l=d[t][1]-r.minTileRow*o),me(_,[n,a,s,l],_)}}const m=new $u({origins:d,resolutions:g,sizes:f,tileSizes:p,extent:n?_:void 0,matrixIds:c});if(!i)return{grid:m,projection:r};const y=t.context,x=t.url;return{grid:m,projection:r,urlTemplate:i,urlFunction:function(t,e,r){if(!t)return;const s=c[t[0]],o=l[s],a="bottomLeft"===o.cornerOfOrigin,u={tileMatrix:s,tileCol:t[1],tileRow:a?-t[2]-1:t[2]};if(n){const t=h[o.id];if(u.tileCol<t.minTileCol||u.tileCol>t.maxTileCol||u.tileRow<t.minTileRow||u.tileRow>t.maxTileRow)return}Object.assign(u,{z:u.tileMatrix,x:u.tileCol,y:u.tileRow},y);const d=i.replace(/\{(\w+?)\}/g,(function(t,e){return u[e]}));return _u(x,d)}}}function mf(t){return pu(t.url).then((function(e){return function(t,e){const i=e.tileMatrixSetLimits;let n;if("map"===e.dataType)n=ff(e.links,t.mediaType,t.collections);else{if("vector"!==e.dataType)throw new Error('Expected tileset data type to be "map" or "vector"');n=pf(e.links,t.mediaType,t.supportedMediaTypes,t.collections)}if(e.tileMatrixSet)return _f(t,e.tileMatrixSet,n,i);const r=e.links.find((t=>"http://www.opengis.net/def/rel/ogc/1.0/tiling-scheme"===t.rel));if(!r)throw new Error("Expected http://www.opengis.net/def/rel/ogc/1.0/tiling-scheme link or tileMatrixSet");const s=r.href;return pu(_u(t.url,s)).then((function(e){return _f(t,e,n,i)}))}(t,e)}))}class yf extends Ed{constructor(t){const e=t.projection||"EPSG:3857",i=t.extent||Qu(e),n=t.tileGrid||Ku({extent:i,maxResolution:t.maxResolution,maxZoom:void 0!==t.maxZoom?t.maxZoom:22,minZoom:t.minZoom,tileSize:t.tileSize||512});super({attributions:t.attributions,attributionsCollapsible:t.attributionsCollapsible,cacheSize:t.cacheSize,interpolate:!0,projection:e,state:t.state,tileGrid:n,tileLoadFunction:t.tileLoadFunction?t.tileLoadFunction:xf,tileUrlFunction:t.tileUrlFunction,url:t.url,urls:t.urls,wrapX:void 0===t.wrapX||t.wrapX,transition:t.transition,zDirection:void 0===t.zDirection?1:t.zDirection}),this.format_=t.format?t.format:null,this.tileKeysBySourceTileUrl_={},this.sourceTiles_={},this.overlaps_=null==t.overlaps||t.overlaps,this.tileClass=t.tileClass?t.tileClass:au,this.tileGrids_={}}getOverlaps(){return this.overlaps_}getSourceTiles(t,e,i){if(i.getState()===Y){i.setState(H);const r=i.wrappedTileCoord,s=this.getTileGridForProjection(e);let o=s.getTileCoordExtent(r);const a=r[0],l=s.getResolution(a);zt(o,-l,o);const h=this.projection;e&&this.projection&&!Fn(e,h)&&(o=Dn(o,e,h));const c=this.tileGrid,u=c.getExtent();u&&me(o,u,o);let d=l;e&&h&&!Fn(e,h)&&(d=l/h.getMetersPerUnit()/e.getMetersPerUnit());const g=c.getZForResolution(d,this.zDirection);c.forEachTileCoord(o,g,(r=>{const s=this.tileUrlFunction(r,t,e);this.sourceTiles_[s]||(this.sourceTiles_[s]=new this.tileClass(r,s?Y:J,s,this.format_,this.tileLoadFunction));const o=this.sourceTiles_[s];i.sourceTiles.push(o),this.tileKeysBySourceTileUrl_[s]||(this.tileKeysBySourceTileUrl_[s]=[]),this.tileKeysBySourceTileUrl_[s].push(i.getKey());const a=o.getState();if(a<K){const t=e=>{this.handleTileChange(e);const r=o.getState();if(r===K||r===q){const e=o.getKey();e in i.errorTileKeys?o.getState()===K&&delete i.errorTileKeys[e]:i.loadingSourceTiles--,r===q?i.errorTileKeys[e]=!0:o.removeEventListener(n,t),0===i.loadingSourceTiles&&i.setState(L(i.errorTileKeys)?K:q)}};o.addEventListener(n,t),i.loadingSourceTiles++}a===Y&&(o.extent=c.getTileCoordExtent(r),o.projection=this.projection,o.resolution=c.getResolution(r[0]),o.load())})),i.loadingSourceTiles||i.setState(i.sourceTiles.some((t=>t.getState()===q))?q:K)}return i.sourceTiles}removeSourceTiles(t){const e=t.getKey(),i=t.sourceTiles;for(let t=0,n=i.length;t<n;++t){const n=i[t].getTileUrl();if(!this.tileKeysBySourceTileUrl_[n])return;const r=this.tileKeysBySourceTileUrl_[n].indexOf(e);-1!==r&&(this.tileKeysBySourceTileUrl_[n].splice(r,1),0===this.tileKeysBySourceTileUrl_[n].length&&(delete this.tileKeysBySourceTileUrl_[n],delete this.sourceTiles_[n]))}}getTile(t,e,i,n,r){const s=[t,e,i];let o=this.getTileCoordForTileUrlFunction(s,r);const a=this.getTileGrid().getExtent(),l=this.projection,h=this.getTileGridForProjection(r);if(o&&a){const e=h.getTileCoordExtent(o);zt(e,-h.getResolution(t),e),Se(a,r&&l&&!Fn(r,l)?Dn(e,r,l):e)||(o=null)}let c=!0;if(null!==o){const e=this.tileGrid,i=h.getResolution(t);let s=i;r&&l&&!Fn(r,l)&&(s=i/l.getMetersPerUnit()/r.getMetersPerUnit());const a=e.getZForResolution(s,1),u=h.getTileCoordExtent(o);zt(u,-i,u),e.forEachTileCoord(r&&l&&!Fn(r,l)?Dn(u,r,l):u,a,(t=>{c=c&&!this.tileUrlFunction(t,n,l)}))}const u=new su(s,c?J:Y,o,this.getSourceTiles.bind(this,n,r),this.removeSourceTiles.bind(this));return u.key=this.getKey(),u}getTileGridForProjection(t){const e=t.getCode();let i=this.tileGrids_[e];if(!i){const n=this.projection;if(null!==n&&!Fn(n,t))return Zu(t);const r=this.tileGrid,s=r.getResolutions().slice(),o=s.map((function(t,e){return r.getOrigin(e)})),a=s.map((function(t,e){return r.getTileSize(e)})),l=43;for(let t=s.length;t<l;++t)s.push(s[t-1]/2),o.push(o[t-1]),a.push(a[t-1]);i=new Vu({extent:r.getExtent(),origins:o,resolutions:s,tileSizes:a}),this.tileGrids_[e]=i}return i}getTilePixelRatio(t){return t}getTilePixelSize(t,e,i){const n=Wl(this.getTileGridForProjection(i).getTileSize(t),this.tmpSize);return[Math.round(n[0]*e),Math.round(n[1]*e)]}setOverlaps(t){this.overlaps_=t,this.changed()}}function xf(t,e){t.setLoader((function(i,n,r){hu(e,t.getFormat(),i,n,r,t.onLoad.bind(t),t.onError.bind(t))}))}const vf='© <a href="https://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap</a> contributors.';class Sf{constructor(){this.instructions_=[],this.zIndex=0,this.offset_=0,this.context_=new Proxy(_t(),{get:(t,e)=>{if("function"==typeof _t()[e])return this.push_(e),this.pushMethodArgs_},set:(t,e,i)=>(this.push_(e,i),!0)})}push_(...t){const e=this.instructions_,i=this.zIndex+this.offset_;e[i]||(e[i]=[]),e[i].push(...t)}pushMethodArgs_=(...t)=>(this.push_(t),this);pushFunction(t){this.push_(t)}getContext(){return this.context_}draw(t){this.instructions_.forEach((e=>{for(let i=0,n=e.length;i<n;++i){const n=e[i];if("function"==typeof n){n(t);continue}const r=e[++i];if("function"==typeof t[n])t[n](...r);else{if("function"==typeof r){t[n]=r(t);continue}t[n]=r}}}))}clear(){this.instructions_.length=0,this.zIndex=0,this.offset_=0}offset(){this.offset_=this.instructions_.length,this.zIndex=0}}class Ef extends G{constructor(t){super(),this.ready=!0,this.boundHandleImageChange_=this.handleImageChange_.bind(this),this.layer_=t,this.staleKeys_=new Array,this.maxStaleKeys=5}getStaleKeys(){return this.staleKeys_}prependStaleKey(t){this.staleKeys_.unshift(t),this.staleKeys_.length>this.maxStaleKeys&&(this.staleKeys_.length=this.maxStaleKeys)}getFeatures(t){return U()}getData(t){return null}prepareFrame(t){return U()}renderFrame(t,e){return U()}forEachFeatureAtCoordinate(t,e,i,n,r){}getLayer(){return this.layer_}handleFontsChanged(){}handleImageChange_(t){const e=t.target;e.getState()!==Ms&&e.getState()!==As||this.renderIfReadyAndVisible()}loadImage(t){let e=t.getState();return e!=Ms&&e!=As&&t.addEventListener(n,this.boundHandleImageChange_),e==Fs&&(t.load(),e=t.getState()),e==Ms}renderIfReadyAndVisible(){const t=this.getLayer();t&&t.getVisible()&&"ready"===t.getSourceState()&&t.changed()}renderDeferred(t){}disposeInternal(){delete this.layer_,super.disposeInternal()}}const wf=[];let Tf=null;class Cf extends Ef{constructor(t){super(t),this.container=null,this.renderedResolution,this.tempTransform=[1,0,0,1,0,0],this.pixelTransform=[1,0,0,1,0,0],this.inversePixelTransform=[1,0,0,1,0,0],this.context=null,this.deferredContext_=null,this.containerReused=!1,this.frameState=null}getImageData(t,e,i){let n;Tf||(Tf=ft(1,1,void 0,{willReadFrequently:!0})),Tf.clearRect(0,0,1,1);try{Tf.drawImage(t,e,i,1,1,0,0,1,1),n=Tf.getImageData(0,0,1,1).data}catch{return Tf=null,null}return n}getBackground(t){let e=this.getLayer().getBackground();return"function"==typeof e&&(e=e(t.viewState.resolution)),e||void 0}useContainer(t,e,i){const n=this.getLayer().getClassName();let r,s;if(t&&t.className===n&&(!i||t&&t.style.backgroundColor&&w(zl(t.style.backgroundColor),zl(i)))){const e=t.firstElementChild;Tt(e)&&(s=e.getContext("2d"))}if(s&&hr(s.canvas.style.transform,e)?(this.container=t,this.context=s,this.containerReused=!0):this.containerReused?(this.container=null,this.context=null,this.containerReused=!1):this.container&&(this.container.style.backgroundColor=null),!this.container){r=ct?wt():document.createElement("div"),r.className=n;let t=r.style;t.position="absolute",t.width="100%",t.height="100%",s=ft();const e=s.canvas;r.appendChild(e),t=e.style,t.position="absolute",t.left="0",t.transformOrigin="top left",this.container=r,this.context=s}this.containerReused||!i||this.container.style.backgroundColor||(this.container.style.backgroundColor=i)}clipUnrotated(t,e,i){const n=ye(i),r=xe(i),s=ue(i),o=ce(i);Qn(e.coordinateToPixelTransform,n),Qn(e.coordinateToPixelTransform,r),Qn(e.coordinateToPixelTransform,s),Qn(e.coordinateToPixelTransform,o);const a=this.inversePixelTransform;Qn(a,n),Qn(a,r),Qn(a,s),Qn(a,o),t.save(),t.beginPath(),t.moveTo(Math.round(n[0]),Math.round(n[1])),t.lineTo(Math.round(r[0]),Math.round(r[1])),t.lineTo(Math.round(s[0]),Math.round(s[1])),t.lineTo(Math.round(o[0]),Math.round(o[1])),t.clip()}prepareContainer(t,e){const i=t.extent,n=t.viewState.resolution,r=t.viewState.rotation,s=t.pixelRatio,o=Math.round(ve(i)/n*s),a=Math.round(_e(i)/n*s);nr(this.pixelTransform,t.size[0]/2,t.size[1]/2,1/s,1/s,r,-o/2,-a/2),rr(this.inversePixelTransform,this.pixelTransform);const l=ar(this.pixelTransform);if(this.useContainer(e,l,this.getBackground(t)),!this.containerReused){const t=this.context.canvas;t.width!=o||t.height!=a?(t.width=o,t.height=a):this.context.clearRect(0,0,o,a),l!==t.style.transform&&(t.style.transform=l)}}dispatchRenderEvent_(t,e,i){const n=this.getLayer();if(n.hasListener(t)){const r=new Xc(t,this.inversePixelTransform,i,e);n.dispatchEvent(r)}}preRender(t,e){this.frameState=e,e.declutter||this.dispatchRenderEvent_(Ja,t,e)}postRender(t,e){e.declutter||this.dispatchRenderEvent_(Qa,t,e)}renderDeferredInternal(t){}getRenderContext(t){return t.declutter&&!this.deferredContext_&&(this.deferredContext_=new Sf),t.declutter?this.deferredContext_.getContext():this.context}renderDeferred(t){t.declutter&&(this.dispatchRenderEvent_(Ja,this.context,t),t.declutter&&this.deferredContext_&&(this.deferredContext_.draw(this.context),this.deferredContext_.clear()),this.renderDeferredInternal(t),this.dispatchRenderEvent_(Qa,this.context,t))}getRenderTransform(t,e,i,n,r,s,o){const a=r/2,l=s/2,h=n/e,c=-h,u=-t[0]+o,d=-t[1];return nr(this.tempTransform,a,l,h,c,-i,u,d)}disposeInternal(){delete this.frameState,super.disposeInternal()}}class bf extends Cf{constructor(t){super(t),this.image=null,this.renderedSourceRevision_=0}getImage(){return this.image?this.image.getImage():null}prepareFrame(t){const e=t.layerStatesArray[t.layerIndex],i=t.pixelRatio,n=t.viewState,r=n.resolution,s=this.getLayer().getSource(),o=t.viewHints;let a=t.extent;if(void 0!==e.extent&&(a=me(a,zn(e.extent,n.projection))),!o[co]&&!o[uo]&&!Ee(a))if(s){this.getLayer().rendered||this.renderedSourceRevision_===s.getRevision()||(this.image=null),this.renderedSourceRevision_=s.getRevision();const t=n.projection,e=s.getImage(a,r,i,t);e&&(this.loadImage(e)?this.image=e:e.getState()===Os&&(this.image=null))}else this.image=null;return!!this.image}getData(t){const e=this.frameState;if(!e)return null;const i=this.getLayer(),n=Qn(e.pixelToCoordinateTransform,t.slice()),r=i.getExtent();if(r&&!$t(r,n))return null;const s=this.image.getExtent(),o=this.image.getImage(),a=ve(s),l=Math.floor(o.width*((n[0]-s[0])/a));if(l<0||l>=o.width)return null;const h=_e(s),c=Math.floor(o.height*((s[3]-n[1])/h));return c<0||c>=o.height?null:this.getImageData(o,l,c)}renderFrame(t,e){const i=this.image,n=i.getExtent(),r=i.getResolution(),[s,o]=Array.isArray(r)?r:[r,r],a=i.getPixelRatio(),l=t.layerStatesArray[t.layerIndex],h=t.pixelRatio,c=t.viewState,u=c.center,d=c.resolution,g=h*s/(d*a),f=h*o/(d*a);this.prepareContainer(t,e);const p=this.context.canvas.width,_=this.context.canvas.height,m=this.getRenderContext(t);let y=!1,x=!0;if(l.extent){const e=zn(l.extent,c.projection);x=Se(e,t.extent),y=x&&!Wt(e,t.extent),y&&this.clipUnrotated(m,t,e)}const v=i.getImage(),S=nr(this.tempTransform,p/2,_/2,g,f,0,a*(n[0]-u[0])/s,a*(u[1]-n[3])/o);this.renderedResolution=o*h/a;const E=v.width*S[0],w=v.height*S[3];if(this.getLayer().getSource().getInterpolate()||(m.imageSmoothingEnabled=!1),this.preRender(m,t),x&&E>=.5&&w>=.5){const t=S[4],e=S[5],i=l.opacity;1!==i&&(m.save(),m.globalAlpha=i),m.drawImage(v,0,0,+v.width,+v.height,t,e,E,w),1!==i&&m.restore()}return this.postRender(this.context,t),y&&m.restore(),m.imageSmoothingEnabled=!0,this.container}}class Rf extends nl{constructor(t){super(t=t||{})}}class Pf extends Rf{constructor(t){super(t)}createRenderer(){return new bf(this)}getData(t){return super.getData(t)}}function If(t,e,i){if(!(i in t))return t[i]=new Set([e]),!0;const n=t[i],r=n.has(e);return r||n.add(e),!r}function Ff(t,e,i){const n=t[i];return!!n&&n.delete(e)}function Lf(t,e){const i=t.layerStatesArray[t.layerIndex];i.extent&&(e=me(e,zn(i.extent,t.viewState.projection)));const n=i.layer.getRenderSource();if(!n.getWrapX()){const i=n.getTileGridForProjection(t.viewState.projection).getExtent();i&&(e=me(e,i))}return e}class Mf extends Cf{constructor(t,e){super(t),e=e||{},this.extentChanged=!0,this.renderComplete=!1,this.renderedExtent_=null,this.renderedPixelRatio,this.renderedProjection=null,this.renderedTiles=[],this.renderedSourceKey_,this.renderedSourceRevision_,this.tempExtent=[1/0,1/0,-1/0,-1/0],this.tempTileRange_=new iu(0,0,0,0),this.tempTileCoord_=Nu(0,0,0);const i=void 0!==e.cacheSize?e.cacheSize:512;this.tileCache_=new Du(i),this.sourceTileCache_=null,this.maxStaleKeys=.5*i}getTileCache(){return this.tileCache_}getSourceTileCache(){return this.sourceTileCache_||(this.sourceTileCache_=new Du(512)),this.sourceTileCache_}getOrCreateTile(t,e,i,n){const r=this.tileCache_,s=this.getLayer().getSource(),o=ju(s,s.getKey(),t,e,i);let a;if(r.containsKey(o))a=r.get(o);else{const l=n.viewState.projection,h=s.getProjection();if(a=s.getTile(t,e,i,n.pixelRatio,l,!h||Fn(h,l)?void 0:this.getSourceTileCache()),!a)return null;r.set(o,a)}return a}getTile(t,e,i,n){const r=this.getOrCreateTile(t,e,i,n);return r||null}getData(t){const e=this.frameState;if(!e)return null;const i=this.getLayer(),n=Qn(e.pixelToCoordinateTransform,t.slice()),r=i.getExtent();if(r&&!$t(r,n))return null;const s=e.viewState,o=i.getRenderSource(),a=o.getTileGridForProjection(s.projection),l=o.getTilePixelRatio(e.pixelRatio);for(let t=a.getZForResolution(s.resolution);t>=a.getMinZoom();--t){const i=a.getTileCoordForCoordAndZ(n,t),r=this.getTile(t,i[1],i[2],e);if(!r||r.getState()!==K)continue;const h=a.getOrigin(t),c=Wl(a.getTileSize(t)),u=a.getResolution(t);let d;if(r instanceof Bs||r instanceof fd)d=r.getImage();else{if(!(r instanceof Lt))continue;if(d=Ct(r.getData()),!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])),p=Math.round(l*o.getGutterForProjection(s.projection));return this.getImageData(d,g+p,f+p)}return null}prepareFrame(t){this.renderedProjection?t.viewState.projection!==this.renderedProjection&&(this.tileCache_.clear(),this.renderedProjection=t.viewState.projection):this.renderedProjection=t.viewState.projection;const e=this.getLayer().getSource();if(!e)return!1;const i=e.getRevision();return this.renderedSourceRevision_?this.renderedSourceRevision_!==i&&(this.renderedSourceRevision_=i,this.renderedSourceKey_===e.getKey()&&(this.tileCache_.clear(),this.sourceTileCache_?.clear())):this.renderedSourceRevision_=i,!0}enqueueTilesForNextExtent(){return!0}enqueueTiles(t,e,i,n,r){const s=t.viewState,o=this.getLayer(),a=o.getRenderSource(),l=a.getTileGridForProjection(s.projection),h=z(a);h in t.wantedTiles||(t.wantedTiles[h]={});const c=t.wantedTiles[h],u=o.getMapInternal(),d=Math.max(i-r,l.getMinZoom(),l.getZForResolution(Math.min(o.getMaxResolution(),u?u.getView().getResolutionForZoom(Math.max(o.getMinZoom(),0)):l.getResolution(0)),a.zDirection)),g=s.rotation,f=g?pe(s.center,s.resolution,g,t.size):void 0;for(let r=i;r>=d;--r){const i=l.getTileRangeForExtentAndZ(e,r,this.tempTileRange_),s=l.getResolution(r);for(let e=i.minX;e<=i.maxX;++e)for(let o=i.minY;o<=i.maxY;++o){if(g&&!l.tileCoordIntersectsViewport([r,e,o],f))continue;const i=this.getTile(r,e,o,t);if(!i)continue;if(!If(n,i,r))continue;const a=i.getKey();if(c[a]=!0,i.getState()===Y&&!t.tileQueue.isKeyQueued(a)){const n=Nu(r,e,o,this.tempTileCoord_);t.tileQueue.enqueue([i,h,l.getTileCoordCenter(n),s])}}}}findStaleTile_(t,e){const i=this.tileCache_,n=t[0],r=t[1],s=t[2],o=this.getStaleKeys();for(let t=0;t<o.length;++t){const a=ju(this.getLayer().getSource(),o[t],n,r,s);if(i.containsKey(a)){const t=i.peek(a);if(t.getState()===K)return t.endTransition(z(this)),If(e,t,n),!0}}return!1}findAltTiles_(t,e,i,n){const r=t.getTileRangeForTileCoordAndZ(e,i,this.tempTileRange_);if(!r)return!1;let s=!0;const o=this.tileCache_,a=this.getLayer().getRenderSource(),l=a.getKey();for(let t=r.minX;t<=r.maxX;++t)for(let e=r.minY;e<=r.maxY;++e){const r=ju(a,l,i,t,e);let h=!1;if(o.containsKey(r)){const t=o.peek(r);t.getState()===K&&(If(n,t,i),h=!0)}h||(s=!1)}return s}renderFrame(t,e){this.renderComplete=!0;const i=t.layerStatesArray[t.layerIndex],n=t.viewState,r=n.projection,s=n.resolution,o=n.center,a=t.pixelRatio,l=this.getLayer(),h=l.getSource(),c=h.getTileGridForProjection(r),u=c.getZForResolution(s,h.zDirection),d=c.getResolution(u),g=h.getKey();this.renderedSourceKey_?this.renderedSourceKey_!==g&&(this.prependStaleKey(this.renderedSourceKey_),this.renderedSourceKey_=g):this.renderedSourceKey_=g;let f=t.extent;const p=h.getTilePixelRatio(a);this.prepareContainer(t,e);const _=this.context.canvas.width,m=this.context.canvas.height,x=i.extent&&zn(i.extent,r);x&&(f=me(f,zn(i.extent,r)));const v=d*_/2/p,S=d*m/2/p,E=[o[0]-v,o[1]-S,o[0]+v,o[1]+S],w={};this.renderedTiles.length=0;const T=l.getPreload();if(t.nextExtent&&this.enqueueTilesForNextExtent()){const e=c.getZForResolution(n.nextResolution,h.zDirection),i=Lf(t,t.nextExtent);this.enqueueTiles(t,i,e,w,T)}const C=Lf(t,f);if(this.enqueueTiles(t,C,u,w,0),T>0&&setTimeout((()=>{this.enqueueTiles(t,C,u-1,w,T-1)}),0),!(u in w))return this.container;const b=z(this),R=t.time;for(const e of w[u]){const i=e.getState();if(i===J)continue;const n=e.tileCoord;if(i===K){if(1===e.getAlpha(b,R)){e.endTransition(b);continue}}i!==q&&(this.renderComplete=!1);if(this.findStaleTile_(n,w)){Ff(w,e,u),t.animate=!0;continue}if(this.findAltTiles_(c,n,u+1,w))continue;const r=c.getMinZoom();for(let t=u-1;t>=r;--t){if(this.findAltTiles_(c,n,t,w))break}}const P=d/s*a/p,I=this.getRenderContext(t);nr(this.tempTransform,_/2,m/2,P,P,0,-_/2,-m/2),i.extent&&this.clipUnrotated(I,t,x),h.getInterpolate()||(I.imageSmoothingEnabled=!1),this.preRender(I,t);const F=Object.keys(w).map(Number);let L;F.sort(y);const M=[],A=[];for(let e=F.length-1;e>=0;--e){const i=F[e],n=h.getTilePixelSize(i,a,r),s=c.getResolution(i)/d,o=n[0]*s*P,l=n[1]*s*P,u=c.getTileCoordForCoordAndZ(ye(E),i),g=c.getTileCoordExtent(u),f=Qn(this.tempTransform,[p*(g[0]-E[0])/d,p*(E[3]-g[3])/d]),_=p*h.getGutterForProjection(r);for(const e of w[i]){if(e.getState()!==K)continue;const n=e.tileCoord,r=u[1]-n[1],s=Math.round(f[0]-(r-1)*o),a=u[2]-n[2],c=Math.round(f[1]-(a-1)*l),d=Math.round(f[0]-r*o),g=Math.round(f[1]-a*l),p=s-d,m=c-g,y=1===F.length;let x=!1;L=[d,g,d+p,g,d+p,g+m,d,g+m];for(let t=0,e=M.length;t<e;++t)if(!y&&i<A[t]){const e=M[t];Se([d,g,d+p,g+m],[e[0],e[3],e[4],e[7]])&&(x||(I.save(),x=!0),I.beginPath(),I.moveTo(L[0],L[1]),I.lineTo(L[2],L[3]),I.lineTo(L[4],L[5]),I.lineTo(L[6],L[7]),I.moveTo(e[6],e[7]),I.lineTo(e[4],e[5]),I.lineTo(e[2],e[3]),I.lineTo(e[0],e[1]),I.clip())}M.push(L),A.push(i),this.drawTile(e,t,d,g,p,m,_,y),x&&I.restore(),this.renderedTiles.unshift(e),this.updateUsedTiles(t.usedTiles,h,e)}}if(this.renderedResolution=d,this.extentChanged=!this.renderedExtent_||!te(this.renderedExtent_,E),this.renderedExtent_=E,this.renderedPixelRatio=a,this.postRender(this.context,t),i.extent&&I.restore(),I.imageSmoothingEnabled=!0,this.renderComplete){const e=(t,e)=>{const i=z(h),n=e.wantedTiles[i],r=n?Object.keys(n).length:0;this.updateCacheSize(r),this.tileCache_.expireCache(),this.sourceTileCache_?.expireCache()};t.postRenderFunctions.push(e)}return this.container}updateCacheSize(t){this.tileCache_.highWaterMark=Math.max(this.tileCache_.highWaterMark,2*t)}drawTile(t,e,i,n,r,s,o,a){let l;if(t instanceof Lt){if(l=Ct(t.getData()),!l)throw new Error("Rendering array data is not yet supported")}else l=this.getTileImage(t);if(!l)return;const h=this.getRenderContext(e),c=z(this),u=e.layerStatesArray[e.layerIndex],d=u.opacity*(a?t.getAlpha(c,e.time):1),g=d!==h.globalAlpha;g&&(h.save(),h.globalAlpha=d),h.drawImage(l,o,o,l.width-2*o,l.height-2*o,i,n,r,s),g&&h.restore(),d!==u.opacity?e.animate=!0:a&&t.endTransition(c)}getImage(){const t=this.context;return t?t.canvas:null}getTileImage(t){return t.getImage()}updateUsedTiles(t,e,i){const n=z(e);n in t||(t[n]={}),t[n][i.getKey()]=!0}}var Af="preload",Of="useInterimTilesOnError";class Df extends nl{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(Af)}setPreload(t){this.set(Af,t)}getUseInterimTilesOnError(){return this.get(Of)}setUseInterimTilesOnError(t){this.set(Of,t)}getData(t){return super.getData(t)}}class Nf extends Df{constructor(t){super(t)}createRenderer(){return new Mf(this,{cacheSize:this.getCacheSize()})}}function kf(t){return function(e){const i=e.buffers,n=e.meta,r=e.imageOps,s=e.width,o=e.height,a=i.length,l=i[0].byteLength;if(r){const e=new Array(a);for(let t=0;t<a;++t)e[t]=new ImageData(new Uint8ClampedArray(i[t]),s,o);return t(e,n).data.buffer}const h=new Uint8ClampedArray(l),c=new Array(a),u=new Array(a);for(let t=0;t<a;++t)c[t]=new Uint8ClampedArray(i[t]),u[t]=[0,0,0,0];for(let e=0;e<l;e+=4){for(let t=0;t<a;++t){const i=c[t];u[t][0]=i[e],u[t][1]=i[e+1],u[t][2]=i[e+2],u[t][3]=i[e+3]}const i=t(u,n);h[e]=i[0],h[e+1]=i[1],h[e+2]=i[2],h[e+3]=i[3]}return h.buffer}}function Gf(t,e){const i=Object.keys(t.lib||{}).map((function(e){return"const "+e+" = "+t.lib[e].toString()+";"})).concat(["const __minion__ = ("+kf.toString()+")(",t.operation.toString(),");",'self.addEventListener("message", function(event) {'," const buffer = __minion__(event.data);"," self.postMessage({buffer: buffer, meta: event.data.meta}, [buffer]);","});"]),n=new Worker("undefined"==typeof Blob?"data:text/javascript;base64,"+Buffer.from(i.join("\n"),"binary").toString("base64"):URL.createObjectURL(new Blob(i,{type:"text/javascript"})));return n.addEventListener("message",e),n}class jf extends _{constructor(t){let e;super(),this.imageOps_=!!t.imageOps,e=0===t.threads?0:this.imageOps_?1:t.threads||1;const i=new Array(e);if(e)for(let n=0;n<e;++n)i[n]=Gf(t,this.onWorkerMessage_.bind(this,n));else i[0]=function(t,e){const i=kf(t.operation);let n=!1;return{postMessage:function(t){setTimeout((function(){n||e({data:{buffer:i(t),meta:t.meta}})}),0)},terminate:function(){n=!0}}}(t,this.onWorkerMessage_.bind(this,0));this.workers_=i,this.queue_=[],this.maxQueueLength_=t.queue||1/0,this.running_=0,this.dataLookup_={},this.job_=null}process(t,e,i){this.enqueue_({inputs:t,meta:e,callback:i}),this.dispatch_()}enqueue_(t){for(this.queue_.push(t);this.queue_.length>this.maxQueueLength_;)this.queue_.shift().callback(null,null)}dispatch_(){if(this.running_||0===this.queue_.length)return;const t=this.queue_.shift();this.job_=t;const e=t.inputs[0].width,i=t.inputs[0].height,n=t.inputs.map((function(t){return t.data.buffer})),r=this.workers_.length;if(this.running_=r,1===r)return void this.workers_[0].postMessage({buffers:n,meta:t.meta,imageOps:this.imageOps_,width:e,height:i},n);const s=t.inputs[0].data.length,o=4*Math.ceil(s/4/r);for(let s=0;s<r;++s){const r=s*o,a=[];for(let t=0,e=n.length;t<e;++t)a.push(n[t].slice(r,r+o));this.workers_[s].postMessage({buffers:a,meta:t.meta,imageOps:this.imageOps_,width:e,height:i},a)}}onWorkerMessage_(t,e){this.disposed||(this.dataLookup_[t]=e.data,--this.running_,0===this.running_&&this.resolveJob_())}resolveJob_(){const t=this.job_,e=this.workers_.length;let i,n;if(1===e)i=new Uint8ClampedArray(this.dataLookup_[0].buffer),n=this.dataLookup_[0].meta;else{const r=t.inputs[0].data.length;i=new Uint8ClampedArray(r),n=new Array(e);const s=4*Math.ceil(r/4/e);for(let t=0;t<e;++t){const e=this.dataLookup_[t].buffer,r=t*s;i.set(new Uint8ClampedArray(e),r),n[t]=this.dataLookup_[t].meta}}this.job_=null,this.dataLookup_={},t.callback(null,new ImageData(i,t.inputs[0].width,t.inputs[0].height),n),this.dispatch_()}disposeInternal(){for(let t=0;t<this.workers_.length;++t)this.workers_[t].terminate();this.workers_.length=0}}const Uf="beforeoperations",Bf="afteroperations";class zf extends M{constructor(t,e,i){super(t),this.extent=e.extent,this.resolution=e.viewState.resolution/e.pixelRatio,this.data=i}}class Xf extends Bg{constructor(t){super({projection:null}),this.on,this.once,this.un,this.processor_=null,this.operationType_=void 0!==t.operationType?t.operationType:"pixel",this.threads_=void 0!==t.threads?t.threads:1,this.layers_=function(t){const e=t.length,i=new Array(e);for(let n=0;n<e;++n)i[n]=Wf(t[n]);return i}(t.sources);const e=this.changed.bind(this);for(let t=0,i=this.layers_.length;t<i;++t)this.layers_[t].addEventListener(n,e);var i;this.useResolutions_=null!==t.resolutions,this.tileQueue_=new lo((function(){return 1}),this.processSources_.bind(this)),this.requestedFrameState_,this.renderedImageCanvas_=null,this.renderedRevision_,this.frameState_={animate:!1,coordinateToPixelTransform:[1,0,0,1,0,0],declutter:null,extent:null,index:0,layerIndex:0,layerStatesArray:(i=this.layers_,i.map((function(t){return t.getLayerState()}))),pixelRatio:1,pixelToCoordinateTransform:[1,0,0,1,0,0],postRenderFunctions:[],size:[0,0],tileQueue:this.tileQueue_,time:Date.now(),usedTiles:{},viewState:{rotation:0},viewHints:[],wantedTiles:{},mapId:z(this),renderTargets:{}},this.setAttributions((function(e){const i=[];for(let n=0,r=t.sources.length;n<r;++n){const r=t.sources[n],s=r instanceof pd?r:r.getSource();if(!s)continue;const o=s.getAttributions()?.(e);"string"==typeof o?i.push(o):void 0!==o&&i.push(...o)}return i})),void 0!==t.operation&&this.setOperation(t.operation,t.lib)}setOperation(t,e){this.processor_&&this.processor_.dispose(),this.processor_=new jf({operation:t,imageOps:"image"===this.operationType_,queue:1,lib:e,threads:this.threads_}),this.changed()}updateFrameState_(t,e,i){const n=Object.assign({},this.frameState_);n.viewState=Object.assign({},n.viewState);const r=de(t);n.size[0]=Math.ceil(ve(t)/e),n.size[1]=Math.ceil(_e(t)/e),n.extent=[r[0]-n.size[0]*e/2,r[1]-n.size[1]*e/2,r[0]+n.size[0]*e/2,r[1]+n.size[1]*e/2],n.time=Date.now();const s=n.viewState;return s.center=r,s.projection=i,s.resolution=e,n}allSourcesReady_(){let t,e=!0;for(let i=0,n=this.layers_.length;i<n;++i)if(t=this.layers_[i].getSource(),!t||"ready"!==t.getState()){e=!1;break}return e}getImage(t,e,i,n){if(!this.allSourcesReady_())return null;this.tileQueue_.loadMoreTiles(16,16),e=this.findNearestResolution(e);const r=this.updateFrameState_(t,e,n);if(this.requestedFrameState_=r,this.renderedImageCanvas_){const t=this.renderedImageCanvas_.getResolution(),i=this.renderedImageCanvas_.getExtent();e===t&&te(r.extent,i)||(this.renderedImageCanvas_=null)}return this.renderedImageCanvas_&&this.getRevision()===this.renderedRevision_||this.processSources_(),r.animate&&requestAnimationFrame(this.changed.bind(this)),this.renderedImageCanvas_}processSources_(){const t=this.requestedFrameState_,e=this.layers_.length,i=new Array(e);for(let n=0;n<e;++n){t.layerIndex=n,t.renderTargets={};const e=$f(this.layers_[n],t);if(!e)return;i[n]=e}const n={};this.dispatchEvent(new zf(Uf,t,n)),this.processor_.process(i,n,this.onWorkerComplete_.bind(this,t))}onWorkerComplete_(t,e,i,n){if(e||!i)return;const r=t.extent,s=t.viewState.resolution;if(s!==this.requestedFrameState_.viewState.resolution||!te(r,this.requestedFrameState_.extent))return;let o;if(this.renderedImageCanvas_)o=this.renderedImageCanvas_.getImage().getContext("2d");else{o=ft(Math.round(ve(r)/s),Math.round(_e(r)/s)),this.renderedImageCanvas_=new Us(r,s,1,o.canvas)}o.putImageData(i,0,0),t.animate?requestAnimationFrame(this.changed.bind(this)):this.changed(),this.renderedRevision_=this.getRevision(),this.dispatchEvent(new zf(Bf,t,n))}getResolutions(t){if(!this.useResolutions_)return null;let e=super.getResolutions();if(!e)for(let i=0,n=this.layers_.length;i<n;++i){if(e=this.layers_[i].getSource().getResolutions(t),e)break}return e}disposeInternal(){this.processor_&&this.processor_.dispose(),super.disposeInternal()}}Xf.prototype.dispose;let Vf=null;function $f(t,e){const i=t.getRenderer();if(!i)throw new Error("Unsupported layer type: "+t);if(!i.prepareFrame(e))return null;const n=e.size[0],r=e.size[1];if(0===n||0===r)return null;const s=i.renderFrame(e,null);let o;if(s instanceof HTMLCanvasElement)o=s;else{if(s&&(o=s.firstElementChild),!(o instanceof HTMLCanvasElement))throw new Error("Unsupported rendered element: "+o);if(o.width===n&&o.height===r){return o.getContext("2d").getImageData(0,0,n,r)}}if(Vf){const t=Vf.canvas;t.width!==n||t.height!==r?Vf=ft(n,r,void 0,{willReadFrequently:!0}):Vf.clearRect(0,0,n,r)}else Vf=ft(n,r,void 0,{willReadFrequently:!0});return Vf.drawImage(o,0,0,n,r),Vf.getImageData(0,0,n,r)}function Wf(t){let e;return t instanceof pd?t instanceof md?e=new Nf({source:t}):t instanceof Bg&&(e=new Pf({source:t})):e=t,e}const Zf={stamen_terrain:{extension:"png"},stamen_terrain_background:{extension:"png"},stamen_terrain_labels:{extension:"png"},stamen_terrain_lines:{extension:"png"},stamen_toner_background:{extension:"png"},stamen_toner:{extension:"png"},stamen_toner_labels:{extension:"png"},stamen_toner_lines:{extension:"png"},stamen_toner_lite:{extension:"png"},stamen_toner_dark:{extension:"png"},stamen_toner_blacklite:{extension:"png"},stamen_watercolor:{extension:"jpg"},alidade_smooth:{extension:"png"},alidade_smooth_dark:{extension:"png"},alidade_satellite:{extension:"png"},outdoors:{extension:"png"},osm_bright:{extension:"png"}},Yf={stamen_terrain:{minZoom:0,maxZoom:18,retina:!0},stamen_toner:{minZoom:0,maxZoom:20,retina:!0},stamen_toner_dark:{minZoom:0,maxZoom:20,retina:!0},stamen_toner_blacklite:{minZoom:0,maxZoom:20,retina:!0},stamen_watercolor:{minZoom:1,maxZoom:18,retina:!1}};class Hf extends nt{constructor(t,e,i,n,r,s){super(t,e),this.src_=i,this.extent_=n,this.preemptive_=r,this.grid_=null,this.keys_=null,this.data_=null,this.jsonp_=s}getImage(){return null}getData(t){if(!this.grid_||!this.keys_)return null;const e=(t[0]-this.extent_[0])/(this.extent_[2]-this.extent_[0]),i=(t[1]-this.extent_[1])/(this.extent_[3]-this.extent_[1]),n=this.grid_[Math.floor((1-i)*this.grid_.length)];if("string"!=typeof n)return null;let r=n.charCodeAt(Math.floor(e*n.length));r>=93&&r--,r>=35&&r--,r-=32;let s=null;if(r in this.keys_){const t=this.keys_[r];s=this.data_&&t in this.data_?this.data_[t]:t}return s}forDataAtCoordinate(t,e,i){this.state==J&&!0===i?(this.state=Y,N(this,n,(i=>{e(this.getData(t))})),this.loadInternal_()):!0===i?setTimeout((()=>{e(this.getData(t))}),0):e(this.getData(t))}getKey(){return this.src_}handleError_(){this.state=q,this.changed()}handleLoad_(t){this.grid_=t.grid,this.keys_=t.keys,this.data_=t.data,this.state=K,this.changed()}loadInternal_(){if(this.state==Y)if(this.state=H,this.jsonp_)du(this.src_,this.handleLoad_.bind(this),this.handleError_.bind(this));else{const t=new XMLHttpRequest;t.addEventListener("load",this.onXHRLoad_.bind(this)),t.addEventListener("error",this.onXHRError_.bind(this)),t.open("GET",this.src_),t.send()}}onXHRLoad_(t){const e=t.target;if(!e.status||e.status>=200&&e.status<300){let t;try{t=JSON.parse(e.responseText)}catch{return void this.handleError_()}this.handleLoad_(t)}else this.handleError_()}onXHRError_(t){this.handleError_()}load(){this.preemptive_?this.loadInternal_():this.setState(J)}}const Kf=34962,qf=34963,Jf=35044,Qf=35048,tp=5126,ep=["experimental-webgl","webgl","webkit-3d","moz-webgl"];function ip(t,e){e=Object.assign({preserveDrawingBuffer:!0,antialias:!ot},e);const i=ep.length;for(let n=0;n<i;++n)try{const i=t.getContext(ep[n],e);if(i)return i}catch{}return null}let np=null;const rp="http://www.w3.org/2001/XMLSchema-instance";function sp(t,e){return Ip().createElementNS(t,e)}function op(t,e){return ap(t,e,[]).join("")}function ap(t,e,i){if(t.nodeType==Node.CDATA_SECTION_NODE||t.nodeType==Node.TEXT_NODE)e?i.push(String(t.nodeValue).replace(/(\r\n|\r|\n)/g,"")):i.push(t.nodeValue);else{let n;for(n=t.firstChild;n;n=n.nextSibling)ap(n,e,i)}return i}function lp(t){return"documentElement"in t}function hp(t,e,i){return t.getAttributeNS(e,i)||""}function cp(t){return(new DOMParser).parseFromString(t,"application/xml")}function up(t,e){return function(i,n){const r=t.call(e??this,i,n);if(void 0!==r){E(n[n.length-1],r)}}}function dp(t,e){return function(i,n){const r=t.call(e??this,i,n);if(void 0!==r){n[n.length-1].push(r)}}}function gp(t,e){return function(i,n){const r=t.call(e??this,i,n);void 0!==r&&(n[n.length-1]=r)}}function fp(t,e,i){return function(n,r){const s=t.call(i??this,n,r);if(void 0!==s){const t=r[r.length-1],i=void 0!==e?e:n.localName;let o;i in t?o=t[i]:(o=[],t[i]=o),o.push(s)}}}function pp(t,e,i){return function(n,r){const s=t.call(i??this,n,r);if(void 0!==s){r[r.length-1][void 0!==e?e:n.localName]=s}}}function _p(t,e){return function(i,n,r){t.call(e??this,i,n,r);r[r.length-1].node.appendChild(i)}}function mp(t,e){let i,n;return function(e,r,s){if(void 0===i){i={};const r={};r[e.localName]=t,i[e.namespaceURI]=r,n=yp(e.localName)}Tp(i,n,r,s)}}function yp(t,e){return function(i,n,r){const s=n[n.length-1].node;let o=t;void 0===o&&(o=r);return sp(void 0!==e?e:s.namespaceURI,o)}}const xp=yp();function vp(t,e){const i=e.length,n=new Array(i);for(let r=0;r<i;++r)n[r]=t[e[r]];return n}function Sp(t,e,i){let n,r;for(i=void 0!==i?i:{},n=0,r=t.length;n<r;++n)i[t[n]]=e;return i}function Ep(t,e,i,n){let r;for(r=e.firstElementChild;r;r=r.nextElementSibling){const e=t[r.namespaceURI];if(void 0!==e){const t=e[r.localName];void 0!==t&&t.call(n,r,i)}}}function wp(t,e,i,n,r){return n.push(t),Ep(e,i,n,r),n.pop()}function Tp(t,e,i,n,r,s){const o=(void 0!==r?r:i).length;let a,l;for(let h=0;h<o;++h)a=i[h],void 0!==a&&(l=e.call(s,a,n,void 0!==r?r[h]:void 0),void 0!==l&&t[l.namespaceURI][l.localName].call(s,l,a,n))}function Cp(t,e,i,n,r,s,o){return r.push(t),Tp(e,i,n,r,s,o),r.pop()}let bp,Rp;function Pp(){return void 0===bp&&"undefined"!=typeof XMLSerializer&&(bp=new XMLSerializer),bp}function Ip(){return void 0===Rp&&"undefined"!=typeof document&&(Rp=document.implementation.createDocument("","",null)),Rp}class Fp extends O{constructor(t){super(),this.tile,this.handleTileChange_=this.handleTileChange_.bind(this),this.gutter=t.gutter||0,this.helper=t.helper,this.loaded=!1,this.ready=!1}setTile(t){if(t!==this.tile)if(this.tile&&this.tile.removeEventListener(n,this.handleTileChange_),this.tile=t,this.loaded=t.getState()===K,this.loaded)this.uploadTile();else{if(t instanceof Bs){const e=t.getImage();e instanceof Image&&!e.crossOrigin&&(e.crossOrigin="anonymous")}t.addEventListener(n,this.handleTileChange_)}}uploadTile(){U()}setReady(){this.ready=!0,this.dispatchEvent(n)}handleTileChange_(){this.tile.getState()===K&&(this.loaded=!0,this.uploadTile())}setHelper(t){this.helper=t,this.helper&&this.loaded&&this.uploadTile()}disposeInternal(){this.setHelper(null),this.tile.removeEventListener(n,this.handleTileChange_)}}const Lp=Jf;class Mp{constructor(t,e){this.array_=null,this.type_=t,Mt(t===Kf||t===qf,"A `WebGLArrayBuffer` must either be of type `ELEMENT_ARRAY_BUFFER` or `ARRAY_BUFFER`"),this.usage_=void 0!==e?e:Lp}ofSize(t){return this.array_=new(Ap(this.type_))(t),this}fromArray(t){return this.array_=Ap(this.type_).from(t),this}fromArrayBuffer(t){return this.array_=new(Ap(this.type_))(t),this}getType(){return this.type_}getArray(){return this.array_}setArray(t){const e=Ap(this.type_);if(!(t instanceof e))throw new Error(`Expected ${e}`);this.array_=t}getUsage(){return this.usage_}getSize(){return this.array_?this.array_.length:0}}function Ap(t){switch(t){case Kf:return Float32Array;case qf:return Uint32Array;default:return Float32Array}}var Op="webglcontextlost",Dp="webglcontextrestored";class Np{constructor(t){this.gl_=t.webGlContext;const e=this.gl_;this.scaleRatio_=t.scaleRatio||1,this.renderTargetTexture_=e.createTexture(),this.renderTargetTextureSize_=null,this.frameBuffer_=e.createFramebuffer(),this.depthBuffer_=e.createRenderbuffer();const i=e.createShader(e.VERTEX_SHADER);e.shaderSource(i,t.vertexShader||"\n precision mediump float;\n\n attribute vec2 a_position;\n varying vec2 v_texCoord;\n varying vec2 v_screenCoord;\n\n uniform vec2 u_screenSize;\n\n void main() {\n v_texCoord = a_position * 0.5 + 0.5;\n v_screenCoord = v_texCoord * u_screenSize;\n gl_Position = vec4(a_position, 0.0, 1.0);\n }\n"),e.compileShader(i);const n=e.createShader(e.FRAGMENT_SHADER);e.shaderSource(n,t.fragmentShader||"\n precision mediump float;\n\n uniform sampler2D u_image;\n uniform float u_opacity;\n\n varying vec2 v_texCoord;\n\n void main() {\n gl_FragColor = texture2D(u_image, v_texCoord) * u_opacity;\n }\n"),e.compileShader(n),this.renderTargetProgram_=e.createProgram(),e.attachShader(this.renderTargetProgram_,i),e.attachShader(this.renderTargetProgram_,n),e.linkProgram(this.renderTargetProgram_),this.renderTargetVerticesBuffer_=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,this.renderTargetVerticesBuffer_),e.bufferData(e.ARRAY_BUFFER,new Float32Array([-1,-1,1,-1,-1,1,1,-1,1,1,-1,1]),e.STATIC_DRAW),this.renderTargetAttribLocation_=e.getAttribLocation(this.renderTargetProgram_,"a_position"),this.renderTargetUniformLocation_=e.getUniformLocation(this.renderTargetProgram_,"u_screenSize"),this.renderTargetOpacityLocation_=e.getUniformLocation(this.renderTargetProgram_,"u_opacity"),this.renderTargetTextureLocation_=e.getUniformLocation(this.renderTargetProgram_,"u_image"),this.uniforms_=[],t.uniforms&&Object.keys(t.uniforms).forEach((i=>{this.uniforms_.push({value:t.uniforms[i],location:e.getUniformLocation(this.renderTargetProgram_,i)})}))}getRenderTargetTexture(){return this.renderTargetTexture_}getGL(){return this.gl_}init(t){const e=this.getGL(),i=[e.drawingBufferWidth*this.scaleRatio_,e.drawingBufferHeight*this.scaleRatio_];if(e.bindFramebuffer(e.FRAMEBUFFER,this.getFrameBuffer()),e.bindRenderbuffer(e.RENDERBUFFER,this.getDepthBuffer()),e.viewport(0,0,i[0],i[1]),!this.renderTargetTextureSize_||this.renderTargetTextureSize_[0]!==i[0]||this.renderTargetTextureSize_[1]!==i[1]){this.renderTargetTextureSize_=i;const t=0,n=e.RGBA,r=0,s=e.RGBA,o=e.UNSIGNED_BYTE,a=null;e.bindTexture(e.TEXTURE_2D,this.renderTargetTexture_),e.texImage2D(e.TEXTURE_2D,t,n,i[0],i[1],r,s,o,a),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,this.renderTargetTexture_,0),e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_COMPONENT16,i[0],i[1]),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,this.depthBuffer_)}}apply(t,e,i,n){const r=this.getGL(),s=t.size;if(r.bindFramebuffer(r.FRAMEBUFFER,e?e.getFrameBuffer():null),r.activeTexture(r.TEXTURE0),r.bindTexture(r.TEXTURE_2D,this.renderTargetTexture_),!e){const e=z(r.canvas);if(!t.renderTargets[e]){const i=r.getContextAttributes();i&&i.preserveDrawingBuffer&&(r.clearColor(0,0,0,0),r.clearDepth(1),r.clear(r.COLOR_BUFFER_BIT|r.DEPTH_BUFFER_BIT)),t.renderTargets[e]=!0}}r.disable(r.DEPTH_TEST),r.enable(r.BLEND),r.blendFunc(r.ONE,r.ONE_MINUS_SRC_ALPHA),r.viewport(0,0,r.drawingBufferWidth,r.drawingBufferHeight),r.bindBuffer(r.ARRAY_BUFFER,this.renderTargetVerticesBuffer_),r.useProgram(this.renderTargetProgram_),r.enableVertexAttribArray(this.renderTargetAttribLocation_),r.vertexAttribPointer(this.renderTargetAttribLocation_,2,r.FLOAT,!1,0,0),r.uniform2f(this.renderTargetUniformLocation_,s[0],s[1]),r.uniform1i(this.renderTargetTextureLocation_,0);const o=t.layerStatesArray[t.layerIndex].opacity;r.uniform1f(this.renderTargetOpacityLocation_,o),this.applyUniforms(t),i&&i(r,t),r.drawArrays(r.TRIANGLES,0,6),n&&n(r,t)}getFrameBuffer(){return this.frameBuffer_}getDepthBuffer(){return this.depthBuffer_}applyUniforms(t){const e=this.getGL();let i,n=1;this.uniforms_.forEach((function(r){if(i="function"==typeof r.value?r.value(t):r.value,i instanceof HTMLCanvasElement||i instanceof ImageData)r.texture||(r.texture=e.createTexture()),e.activeTexture(e[`TEXTURE${n}`]),e.bindTexture(e.TEXTURE_2D,r.texture),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),i instanceof ImageData?e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,i.width,i.height,0,e.UNSIGNED_BYTE,new Uint8Array(i.data)):e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,i),e.uniform1i(r.location,n++);else if(Array.isArray(i))switch(i.length){case 2:return void e.uniform2f(r.location,i[0],i[1]);case 3:return void e.uniform3f(r.location,i[0],i[1],i[2]);case 4:return void e.uniform4f(r.location,i[0],i[1],i[2],i[3]);default:return}else"number"==typeof i&&e.uniform1f(r.location,i)}))}}const kp={PROJECTION_MATRIX:"u_projectionMatrix",SCREEN_TO_WORLD_MATRIX:"u_screenToWorldMatrix",TIME:"u_time",ZOOM:"u_zoom",RESOLUTION:"u_resolution",ROTATION:"u_rotation",VIEWPORT_SIZE_PX:"u_viewportSizePx",PIXEL_RATIO:"u_pixelRatio",HIT_DETECTION:"u_hitDetection"},Gp=5121,jp=5123,Up=5125,Bp=tp,zp={};function Xp(t){return"shared/"+t}let Vp=0;class $p extends _{constructor(t){super(),t=t||{},this.boundHandleWebGLContextLost_=this.handleWebGLContextLost.bind(this),this.boundHandleWebGLContextRestored_=this.handleWebGLContextRestored.bind(this),this.canvasCacheKey_=t.canvasCacheKey?Xp(t.canvasCacheKey):function(){const t="unique/"+Vp;return Vp+=1,t}(),this.gl_=function(t){let e=zp[t];if(!e){const i=document.createElement("canvas");i.width=1,i.height=1,i.style.position="absolute",i.style.left="0",e={users:0,context:ip(i)},zp[t]=e}return e.users+=1,e.context}(this.canvasCacheKey_),this.bufferCache_={},this.extensionCache_={},this.currentProgram_=null,this.needsToBeRecreated_=!1;const e=this.gl_.canvas;e.addEventListener(Op,this.boundHandleWebGLContextLost_),e.addEventListener(Dp,this.boundHandleWebGLContextRestored_),this.offsetRotateMatrix_=[1,0,0,1,0,0],this.offsetScaleMatrix_=[1,0,0,1,0,0],this.tmpMat4_=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],this.uniformLocationsByProgram_={},this.attribLocationsByProgram_={},this.uniforms_=[],t.uniforms&&this.setUniforms(t.uniforms),this.postProcessPasses_=t.postProcesses?t.postProcesses.map((t=>new Np({webGlContext:this.gl_,scaleRatio:t.scaleRatio,vertexShader:t.vertexShader,fragmentShader:t.fragmentShader,uniforms:t.uniforms}))):[new Np({webGlContext:this.gl_})],this.shaderCompileErrors_=null,this.startTime_=Date.now(),this.maxAttributeCount_=this.gl_.getParameter(this.gl_.MAX_VERTEX_ATTRIBS)}setUniforms(t){this.uniforms_=[],this.addUniforms(t)}addUniforms(t){for(const e in t)this.uniforms_.push({name:e,value:t[e]})}canvasCacheKeyMatches(t){return this.canvasCacheKey_===Xp(t)}getExtension(t){if(t in this.extensionCache_)return this.extensionCache_[t];const e=this.gl_.getExtension(t);return this.extensionCache_[t]=e,e}getInstancedRenderingExtension_(){const t=this.getExtension("ANGLE_instanced_arrays");return Mt(!!t,"WebGL extension 'ANGLE_instanced_arrays' is required for vector rendering"),t}bindBuffer(t){const e=this.gl_,i=z(t);let n=this.bufferCache_[i];if(!n){n={buffer:t,webGlBuffer:e.createBuffer()},this.bufferCache_[i]=n}e.bindBuffer(t.getType(),n.webGlBuffer)}flushBufferData(t){const e=this.gl_;this.bindBuffer(t),e.bufferData(t.getType(),t.getArray(),t.getUsage())}deleteBuffer(t){const e=z(t);delete this.bufferCache_[e]}disposeInternal(){const t=this.gl_.canvas;t.removeEventListener(Op,this.boundHandleWebGLContextLost_),t.removeEventListener(Dp,this.boundHandleWebGLContextRestored_),function(t){const e=zp[t];if(!e)return;if(e.users-=1,e.users>0)return;const i=e.context,n=i.getExtension("WEBGL_lose_context");n&&n.loseContext();const r=i.canvas;r.width=1,r.height=1,delete zp[t]}(this.canvasCacheKey_),delete this.gl_}prepareDraw(t,e,i){const n=this.gl_,r=this.getCanvas(),s=t.size,o=t.pixelRatio;r.width===s[0]*o&&r.height===s[1]*o||(r.width=s[0]*o,r.height=s[1]*o,r.style.width=s[0]+"px",r.style.height=s[1]+"px");for(let e=this.postProcessPasses_.length-1;e>=0;e--)this.postProcessPasses_[e].init(t);n.bindTexture(n.TEXTURE_2D,null),n.clearColor(0,0,0,0),n.depthRange(0,1),n.clearDepth(1),n.clear(n.COLOR_BUFFER_BIT|n.DEPTH_BUFFER_BIT),n.enable(n.BLEND),n.blendFunc(n.ONE,e?n.ZERO:n.ONE_MINUS_SRC_ALPHA),i?(n.enable(n.DEPTH_TEST),n.depthFunc(n.LEQUAL)):n.disable(n.DEPTH_TEST)}bindFrameBuffer(t,e){const i=this.getGL();i.bindFramebuffer(i.FRAMEBUFFER,t),e&&i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,e,0)}bindInitialFrameBuffer(){const t=this.getGL(),e=this.postProcessPasses_[0].getFrameBuffer();t.bindFramebuffer(t.FRAMEBUFFER,e);const i=this.postProcessPasses_[0].getRenderTargetTexture();t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,i,0)}bindTexture(t,e,i){const n=this.gl_;n.activeTexture(n.TEXTURE0+e),n.bindTexture(n.TEXTURE_2D,t),n.uniform1i(this.getUniformLocation(i),e)}bindAttribute(t,e,i){const n=this.getGL();this.bindBuffer(t);const r=this.getAttributeLocation(e);n.enableVertexAttribArray(r),n.vertexAttribPointer(r,i,n.FLOAT,!1,0,0)}prepareDrawToRenderTarget(t,e,i,n){const r=this.gl_,s=e.getSize();r.bindFramebuffer(r.FRAMEBUFFER,e.getFramebuffer()),r.bindRenderbuffer(r.RENDERBUFFER,e.getDepthbuffer()),r.viewport(0,0,s[0],s[1]),r.bindTexture(r.TEXTURE_2D,e.getTexture()),r.clearColor(0,0,0,0),r.depthRange(0,1),r.clearDepth(1),r.clear(r.COLOR_BUFFER_BIT|r.DEPTH_BUFFER_BIT),r.enable(r.BLEND),r.blendFunc(r.ONE,i?r.ZERO:r.ONE_MINUS_SRC_ALPHA),n?(r.enable(r.DEPTH_TEST),r.depthFunc(r.LEQUAL)):r.disable(r.DEPTH_TEST)}drawElements(t,e){const i=this.gl_;this.getExtension("OES_element_index_uint");const n=i.UNSIGNED_INT,r=e-t,s=4*t;i.drawElements(i.TRIANGLES,r,n,s)}drawElementsInstanced(t,e,i){const n=this.gl_;this.getExtension("OES_element_index_uint");const r=this.getInstancedRenderingExtension_(),s=n.UNSIGNED_INT,o=e-t,a=4*t;r.drawElementsInstancedANGLE(n.TRIANGLES,o,s,a,i);for(let t=0;t<this.maxAttributeCount_;t++)r.vertexAttribDivisorANGLE(t,0)}finalizeDraw(t,e,i){for(let n=0,r=this.postProcessPasses_.length;n<r;n++)n===r-1?this.postProcessPasses_[n].apply(t,null,e,i):this.postProcessPasses_[n].apply(t,this.postProcessPasses_[n+1])}getCanvas(){return this.gl_.canvas}getGL(){return this.gl_}applyFrameState(t){const e=t.size,i=t.viewState.rotation,n=t.pixelRatio;this.setUniformFloatValue(kp.TIME,.001*(Date.now()-this.startTime_)),this.setUniformFloatValue(kp.ZOOM,t.viewState.zoom),this.setUniformFloatValue(kp.RESOLUTION,t.viewState.resolution),this.setUniformFloatValue(kp.PIXEL_RATIO,n),this.setUniformFloatVec2(kp.VIEWPORT_SIZE_PX,[e[0],e[1]]),this.setUniformFloatValue(kp.ROTATION,i)}applyHitDetectionUniform(t){const e=this.getUniformLocation(kp.HIT_DETECTION);this.getGL().uniform1i(e,t?1:0),t&&this.setUniformFloatValue(kp.PIXEL_RATIO,.5)}applyUniforms(t){const e=this.gl_;let i,n=0;this.uniforms_.forEach((r=>{if(i="function"==typeof r.value?r.value(t):r.value,i instanceof HTMLCanvasElement||i instanceof HTMLImageElement||i instanceof ImageData||i instanceof WebGLTexture){i instanceof WebGLTexture&&!r.texture?(r.prevValue=void 0,r.texture=i):r.texture||(r.prevValue=void 0,r.texture=e.createTexture()),this.bindTexture(r.texture,n,r.name),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE);const t=!(i instanceof HTMLImageElement)||i.complete;i instanceof WebGLTexture||!t||r.prevValue===i||(r.prevValue=i,e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,i)),n++}else if(Array.isArray(i)&&6===i.length)this.setUniformMatrixValue(r.name,Qd(this.tmpMat4_,i));else if(Array.isArray(i)&&i.length<=4)switch(i.length){case 2:return void e.uniform2f(this.getUniformLocation(r.name),i[0],i[1]);case 3:return void e.uniform3f(this.getUniformLocation(r.name),i[0],i[1],i[2]);case 4:return void e.uniform4f(this.getUniformLocation(r.name),i[0],i[1],i[2],i[3]);default:return}else"number"==typeof i&&e.uniform1f(this.getUniformLocation(r.name),i)}))}useProgram(t,e){this.disableAllAttributes_();this.gl_.useProgram(t),this.currentProgram_=t,e&&(this.applyFrameState(e),this.applyUniforms(e))}compileShader(t,e){const i=this.gl_,n=i.createShader(e);return i.shaderSource(n,t),i.compileShader(n),n}getProgram(t,e){const i=this.gl_,n=this.compileShader(t,i.FRAGMENT_SHADER),r=this.compileShader(e,i.VERTEX_SHADER),s=i.createProgram();if(i.attachShader(s,n),i.attachShader(s,r),i.linkProgram(s),!i.getShaderParameter(n,i.COMPILE_STATUS)){const t=`Fragment shader compilation failed: ${i.getShaderInfoLog(n)}`;throw new Error(t)}if(i.deleteShader(n),!i.getShaderParameter(r,i.COMPILE_STATUS)){const t=`Vertex shader compilation failed: ${i.getShaderInfoLog(r)}`;throw new Error(t)}if(i.deleteShader(r),!i.getProgramParameter(s,i.LINK_STATUS)){const t=`GL program linking failed: ${i.getProgramInfoLog(s)}`;throw new Error(t)}return s}getUniformLocation(t){const e=z(this.currentProgram_);return void 0===this.uniformLocationsByProgram_[e]&&(this.uniformLocationsByProgram_[e]={}),void 0===this.uniformLocationsByProgram_[e][t]&&(this.uniformLocationsByProgram_[e][t]=this.gl_.getUniformLocation(this.currentProgram_,t)),this.uniformLocationsByProgram_[e][t]}getAttributeLocation(t){const e=z(this.currentProgram_);return void 0===this.attribLocationsByProgram_[e]&&(this.attribLocationsByProgram_[e]={}),void 0===this.attribLocationsByProgram_[e][t]&&(this.attribLocationsByProgram_[e][t]=this.gl_.getAttribLocation(this.currentProgram_,t)),this.attribLocationsByProgram_[e][t]}makeProjectionTransform(t,e){const i=t.size,n=t.viewState.rotation,r=t.viewState.resolution,s=t.viewState.center;return nr(e,0,0,2/(r*i[0]),2/(r*i[1]),-n,-s[0],-s[1]),e}setUniformFloatValue(t,e){this.gl_.uniform1f(this.getUniformLocation(t),e)}setUniformFloatVec2(t,e){this.gl_.uniform2fv(this.getUniformLocation(t),e)}setUniformFloatVec4(t,e){this.gl_.uniform4fv(this.getUniformLocation(t),e)}setUniformMatrixValue(t,e){this.gl_.uniformMatrix4fv(this.getUniformLocation(t),!1,e)}disableAllAttributes_(){for(let t=0;t<this.maxAttributeCount_;t++)this.gl_.disableVertexAttribArray(t)}enableAttributeArray_(t,e,i,n,r,s){const o=this.getAttributeLocation(t);o<0||(this.gl_.enableVertexAttribArray(o),this.gl_.vertexAttribPointer(o,e,i,!1,n,r),s&&this.getInstancedRenderingExtension_().vertexAttribDivisorANGLE(o,1))}enableAttributes_(t,e){const i=Wp(t);let n=0;for(let r=0;r<t.length;r++){const s=t[r];s.name&&this.enableAttributeArray_(s.name,s.size,s.type||tp,i,n,e),n+=s.size*Zp(s.type)}}enableAttributes(t){this.enableAttributes_(t,!1)}enableAttributesInstanced(t){this.enableAttributes_(t,!0)}handleWebGLContextLost(t){F(this.bufferCache_),this.currentProgram_=null,t.preventDefault()}handleWebGLContextRestored(){this.needsToBeRecreated_=!0}needsToBeRecreated(){return this.needsToBeRecreated_}createTexture(t,e,i,n){const r=this.gl_;i=i||r.createTexture();const s=n?r.NEAREST:r.LINEAR;r.bindTexture(r.TEXTURE_2D,i),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,s),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,s),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE);const o=r.RGBA,a=r.RGBA,l=r.UNSIGNED_BYTE;return e instanceof Uint8Array?r.texImage2D(r.TEXTURE_2D,0,o,t[0],t[1],0,a,l,e):e?r.texImage2D(r.TEXTURE_2D,0,o,a,l,e):r.texImage2D(r.TEXTURE_2D,0,o,t[0],t[1],0,a,l,null),i}}function Wp(t){let e=0;for(let i=0;i<t.length;i++){const n=t[i];e+=n.size*Zp(n.type)}return e}function Zp(t){switch(t){case Gp:return Uint8Array.BYTES_PER_ELEMENT;case jp:return Uint16Array.BYTES_PER_ELEMENT;case Up:return Uint32Array.BYTES_PER_ELEMENT;default:return Float32Array.BYTES_PER_ELEMENT}}class Yp{constructor(t,e){this.name=t,this.data=e,this.texture_=null}getTexture(t){if(!this.texture_){const e=t.createTexture();t.bindTexture(t.TEXTURE_2D,e),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,this.data.length/4,1,0,t.RGBA,t.UNSIGNED_BYTE,this.data),this.texture_=e}return this.texture_}delete(t){this.texture_&&t.deleteTexture(this.texture_),this.texture_=null}}const Hp=new Uint8Array(4);class Kp{constructor(t,e){this.helper_=t;const i=t.getGL();this.texture_=i.createTexture(),this.framebuffer_=i.createFramebuffer(),this.depthbuffer_=i.createRenderbuffer(),this.size_=e||[1,1],this.data_=new Uint8Array(0),this.dataCacheDirty_=!0,this.updateSize_()}setSize(t){w(t,this.size_)||(this.size_[0]=t[0],this.size_[1]=t[1],this.updateSize_())}getSize(){return this.size_}clearCachedData(){this.dataCacheDirty_=!0}readAll(){if(this.dataCacheDirty_){const t=this.size_,e=this.helper_.getGL();e.bindFramebuffer(e.FRAMEBUFFER,this.framebuffer_),e.readPixels(0,0,t[0],t[1],e.RGBA,e.UNSIGNED_BYTE,this.data_),this.dataCacheDirty_=!1}return this.data_}readPixel(t,e){if(t<0||e<0||t>this.size_[0]||e>=this.size_[1])return Hp[0]=0,Hp[1]=0,Hp[2]=0,Hp[3]=0,Hp;this.readAll();const i=Math.floor(t)+(this.size_[1]-Math.floor(e)-1)*this.size_[0];return Hp[0]=this.data_[4*i],Hp[1]=this.data_[4*i+1],Hp[2]=this.data_[4*i+2],Hp[3]=this.data_[4*i+3],Hp}getTexture(){return this.texture_}getFramebuffer(){return this.framebuffer_}getDepthbuffer(){return this.depthbuffer_}updateSize_(){const t=this.size_,e=this.helper_.getGL();this.texture_=this.helper_.createTexture(t,null,this.texture_),e.bindFramebuffer(e.FRAMEBUFFER,this.framebuffer_),e.viewport(0,0,t[0],t[1]),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,this.texture_,0),e.bindRenderbuffer(e.RENDERBUFFER,this.depthbuffer_),e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_COMPONENT16,t[0],t[1]),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,this.depthbuffer_),this.data_=new Uint8Array(t[0]*t[1]*4)}}class qp{constructor(){this.globalCounter_=0,this.refToFeature_=new Map,this.uidToRef_=new Map,this.freeGlobalRef_=[],this.polygonBatch={entries:{},geometriesCount:0,verticesCount:0,ringsCount:0},this.pointBatch={entries:{},geometriesCount:0},this.lineStringBatch={entries:{},geometriesCount:0,verticesCount:0}}addFeatures(t,e){for(let i=0;i<t.length;i++)this.addFeature(t[i],e)}addFeature(t,e){let i=t.getGeometry();i&&(e&&(i=i.clone(),i.applyTransform(e)),this.addGeometry_(i,t))}clearFeatureEntryInPointBatch_(t){const e=z(t),i=this.pointBatch.entries[e];if(i)return this.pointBatch.geometriesCount-=i.flatCoordss.length,delete this.pointBatch.entries[e],i}clearFeatureEntryInLineStringBatch_(t){const e=z(t),i=this.lineStringBatch.entries[e];if(i)return this.lineStringBatch.verticesCount-=i.verticesCount,this.lineStringBatch.geometriesCount-=i.flatCoordss.length,delete this.lineStringBatch.entries[e],i}clearFeatureEntryInPolygonBatch_(t){const e=z(t),i=this.polygonBatch.entries[e];if(i)return this.polygonBatch.verticesCount-=i.verticesCount,this.polygonBatch.ringsCount-=i.ringsCount,this.polygonBatch.geometriesCount-=i.flatCoordss.length,delete this.polygonBatch.entries[e],i}addGeometry_(t,e){const i=t.getType();switch(i){case"GeometryCollection":{const i=t.getGeometriesArray();for(const t of i)this.addGeometry_(t,e);break}case"MultiPolygon":{const n=t;this.addCoordinates_(i,n.getFlatCoordinates(),n.getEndss(),e,z(e),n.getStride());break}case"MultiLineString":{const n=t;this.addCoordinates_(i,n.getFlatCoordinates(),n.getEnds(),e,z(e),n.getStride());break}case"MultiPoint":{const n=t;this.addCoordinates_(i,n.getFlatCoordinates(),null,e,z(e),n.getStride());break}case"Polygon":{const n=t;this.addCoordinates_(i,n.getFlatCoordinates(),n.getEnds(),e,z(e),n.getStride());break}case"Point":{const n=t;this.addCoordinates_(i,n.getFlatCoordinates(),null,e,z(e),n.getStride());break}case"LineString":case"LinearRing":{const n=t,r=n.getStride();this.addCoordinates_(i,n.getFlatCoordinates(),null,e,z(e),r,n.getLayout?.());break}}}addCoordinates_(t,e,i,n,r,s,o){let a;switch(t){case"MultiPolygon":{const t=i;for(let i=0,a=t.length;i<a;i++){let a=t[i];const l=i>0?t[i-1]:null,h=l?l[l.length-1]:0,c=a[a.length-1];a=h>0?a.map((t=>t-h)):a,this.addCoordinates_("Polygon",e.slice(h,c),a,n,r,s,o)}break}case"MultiLineString":{const t=i;for(let i=0,a=t.length;i<a;i++){const a=i>0?t[i-1]:0;this.addCoordinates_("LineString",e.slice(a,t[i]),null,n,r,s,o)}break}case"MultiPoint":for(let t=0,i=e.length;t<i;t+=s)this.addCoordinates_("Point",e.slice(t,t+2),null,n,r,null,null);break;case"Polygon":{const t=i;if(n instanceof Ud){const i=ds(e,t);if(i.length>1)return void this.addCoordinates_("MultiPolygon",e,i,n,r,s,o)}this.polygonBatch.entries[r]||(this.polygonBatch.entries[r]=this.addRefToEntry_(r,{feature:n,flatCoordss:[],verticesCount:0,ringsCount:0,ringsVerticesCounts:[]})),a=e.length/s;const l=i.length,h=i.map(((t,e,i)=>e>0?(t-i[e-1])/s:t/s));this.polygonBatch.verticesCount+=a,this.polygonBatch.ringsCount+=l,this.polygonBatch.geometriesCount++,this.polygonBatch.entries[r].flatCoordss.push(function(t,e){if(2===e)return t;return t.filter(((t,i)=>i%e<2))}(e,s)),this.polygonBatch.entries[r].ringsVerticesCounts.push(h),this.polygonBatch.entries[r].verticesCount+=a,this.polygonBatch.entries[r].ringsCount+=l;for(let i=0,a=t.length;i<a;i++){const a=i>0?t[i-1]:0;this.addCoordinates_("LinearRing",e.slice(a,t[i]),null,n,r,s,o)}break}case"Point":this.pointBatch.entries[r]||(this.pointBatch.entries[r]=this.addRefToEntry_(r,{feature:n,flatCoordss:[]})),this.pointBatch.geometriesCount++,this.pointBatch.entries[r].flatCoordss.push(e);break;case"LineString":case"LinearRing":this.lineStringBatch.entries[r]||(this.lineStringBatch.entries[r]=this.addRefToEntry_(r,{feature:n,flatCoordss:[],verticesCount:0})),a=e.length/s,this.lineStringBatch.verticesCount+=a,this.lineStringBatch.geometriesCount++,this.lineStringBatch.entries[r].flatCoordss.push(function(t,e,i){if(3===e&&"XYM"===i)return t;if(4===e)return t.filter(((t,i)=>i%e!=2));if(3===e)return t.map(((t,i)=>i%e!=2?t:0));return new Array(1.5*t.length).fill(0).map(((e,i)=>i%3==2?0:t[Math.round(i/1.5)]))}(e,s,o)),this.lineStringBatch.entries[r].verticesCount+=a}}addRefToEntry_(t,e){const i=this.uidToRef_.get(t),n=i||this.freeGlobalRef_.pop()||++this.globalCounter_;return e.ref=n,i||(this.refToFeature_.set(n,e.feature),this.uidToRef_.set(t,n)),e}removeRef_(t,e){if(!t)throw new Error("This feature has no ref: "+e);this.refToFeature_.delete(t),this.uidToRef_.delete(e),this.freeGlobalRef_.push(t)}changeFeature(t,e){if(!this.uidToRef_.get(z(t)))return;this.removeFeature(t);let i=t.getGeometry();i&&(e&&(i=i.clone(),i.applyTransform(e)),this.addGeometry_(i,t))}removeFeature(t){let e=this.clearFeatureEntryInPointBatch_(t);e=this.clearFeatureEntryInPolygonBatch_(t)||e,e=this.clearFeatureEntryInLineStringBatch_(t)||e,e&&this.removeRef_(e.ref,z(e.feature))}clear(){this.polygonBatch.entries={},this.polygonBatch.geometriesCount=0,this.polygonBatch.verticesCount=0,this.polygonBatch.ringsCount=0,this.lineStringBatch.entries={},this.lineStringBatch.geometriesCount=0,this.lineStringBatch.verticesCount=0,this.pointBatch.entries={},this.pointBatch.geometriesCount=0,this.globalCounter_=0,this.freeGlobalRef_=[],this.refToFeature_.clear(),this.uidToRef_.clear()}getFeatureFromRef(t){return this.refToFeature_.get(t)}isEmpty(){return 0===this.globalCounter_}filter(t){const e=new qp;e.globalCounter_=this.globalCounter_,e.uidToRef_=this.uidToRef_,e.refToFeature_=this.refToFeature_;let i=!0;for(const n of this.refToFeature_.values())t(n)&&(e.addFeature(n),i=!1);return i?new qp:e}}class Jp extends Fp{constructor(t,e){super(t),this.batch_=new qp,this.styleRenderer_=e,this.buffers=null,this.maskVertices=new Mp(Kf,Jf),this.setTile(t.tile)}generateMaskBuffer_(){const t=this.tile.getSourceTiles()[0].extent;this.maskVertices.fromArray([t[0],t[1],t[2],t[1],t[2],t[3],t[0],t[3]]),this.helper.flushBufferData(this.maskVertices)}uploadTile(){this.generateMaskBuffer_(),this.batch_.clear();const t=this.tile.getSourceTiles(),e=t.reduce(((t,e)=>t.concat(e.getFeatures())),[]);this.batch_.addFeatures(e);const i=ir([1,0,0,1,0,0],-t[0].extent[0],-t[0].extent[1]);this.styleRenderer_.generateBuffers(this.batch_,i).then((t=>{this.buffers=t,this.setReady()}))}disposeInternal(){if(this.buffers){const t=t=>{for(const e of t)e&&this.helper.deleteBuffer(e)};this.buffers.pointBuffers&&t(this.buffers.pointBuffers),this.buffers.lineStringBuffers&&t(this.buffers.lineStringBuffers),this.buffers.polygonBuffers&&t(this.buffers.polygonBuffers)}super.disposeInternal()}}function Qp(t,e,i){const n=i?t.LINEAR:t.NEAREST;t.bindTexture(t.TEXTURE_2D,e),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,n),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,n)}function t_(t,e,i,n,r,s){const o=t.getGL();let a,l;if(i instanceof Float32Array){a=o.FLOAT,t.getExtension("OES_texture_float");l=null!==t.getExtension("OES_texture_float_linear")}else a=o.UNSIGNED_BYTE,l=!0;Qp(o,e,s&&l);const h=i.byteLength/n[1];let c,u=1;switch(h%8==0?u=8:h%4==0?u=4:h%2==0&&(u=2),r){case 1:c=o.LUMINANCE;break;case 2:c=o.LUMINANCE_ALPHA;break;case 3:c=o.RGB;break;case 4:c=o.RGBA;break;default:throw new Error(`Unsupported number of bands: ${r}`)}const d=o.getParameter(o.UNPACK_ALIGNMENT);o.pixelStorei(o.UNPACK_ALIGNMENT,u),o.texImage2D(o.TEXTURE_2D,0,c,n[0],n[1],0,c,a,i),o.pixelStorei(o.UNPACK_ALIGNMENT,d)}let e_=null;class i_ extends Fp{constructor(t){super(t),this.textures=[],this.renderSize_=Wl(t.grid.getTileSize(t.tile.tileCoord[0])),this.bandCount=NaN;const e=new Mp(Kf,Jf);e.fromArray([0,1,1,1,1,0,0,0]),this.helper.flushBufferData(e),this.coords=e,this.setTile(t.tile)}setHelper(t){const e=this.helper?.getGL();if(e){this.helper.deleteBuffer(this.coords);for(let t=0;t<this.textures.length;++t)e.deleteTexture(this.textures[t])}super.setHelper(t),t&&t.flushBufferData(this.coords)}uploadTile(){const t=this.helper,e=t.getGL(),i=this.tile;let n;this.textures.length=0,n=i instanceof Bs||i instanceof fd?i.getImage():i.getData();const r=Ct(n);if(r){const t=e.createTexture();return this.textures.push(t),this.bandCount=4,function(t,e,i,n){Qp(t,e,n),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,i)}(e,t,r,i.interpolate),void this.setReady()}n=bt(n);const s=i.getSize(),o=[s[0]+2*this.gutter,s[1]+2*this.gutter],a=n instanceof Float32Array,l=o[0]*o[1],h=a?Float32Array:Uint8Array,c=h.BYTES_PER_ELEMENT,u=n.byteLength/o[1];this.bandCount=Math.floor(u/c/o[0]);const d=Math.ceil(this.bandCount/4);if(1===d){const r=e.createTexture();return this.textures.push(r),t_(t,r,n,o,this.bandCount,i.interpolate),void this.setReady()}const g=new Array(d);for(let t=0;t<d;++t){const i=e.createTexture();this.textures.push(i);const n=t<d-1?4:(this.bandCount-1)%4+1;g[t]=new h(l*n)}let f=0,p=0;const _=o[0]*this.bandCount;for(let t=0;t<o[1];++t){for(let t=0;t<_;++t){const e=n[p+t],i=Math.floor(f/this.bandCount),r=t%this.bandCount,s=g[Math.floor(r/4)];s[i*(s.length/l)+r%4]=e,++f}p+=u/c}for(let e=0;e<d;++e){const n=this.textures[e],r=g[e];t_(t,n,r,o,r.length/l,i.interpolate)}this.setReady()}getImagePixelData_(t,e,i){const n=this.gutter,r=this.renderSize_[0],s=this.renderSize_[1];e_||(e_=ft(1,1,void 0,{willReadFrequently:!0})),e_.clearRect(0,0,1,1);const o=t.width-2*n,a=t.height-2*n,l=n+Math.floor(o*(e/r)),h=n+Math.floor(a*(i/s));let c;try{e_.drawImage(t,l,h,1,1,0,0,1,1),c=e_.getImageData(0,0,1,1).data}catch{return e_=null,null}return c}getArrayPixelData_(t,e,i,n){const r=this.gutter,s=this.renderSize_[0],o=this.renderSize_[1],a=e[0],l=e[1],h=a+2*r,c=l+2*r,u=r+Math.floor(a*(i/s)),d=r+Math.floor(l*(n/o));if(t instanceof DataView){const e=t.byteLength/(h*c),i=e*(d*h+u),n=t.buffer.slice(i,i+e);return new DataView(n)}const g=this.bandCount*(d*h+u);return t.slice(g,g+this.bandCount)}getPixelData(t,e){if(!this.loaded)return null;if(this.tile instanceof Lt){const i=this.tile.getData(),n=bt(i);if(n){const i=this.tile.getSize();return this.getArrayPixelData_(n,i,t,e)}return this.getImagePixelData_(Ct(i),t,e)}return this.getImagePixelData_(this.tile.getImage(),t,e)}}function n_(){return{"fill-color":"rgba(255,255,255,0.4)","stroke-color":"#3399CC","stroke-width":1.25,"circle-radius":5,"circle-fill-color":"rgba(255,255,255,0.4)","circle-stroke-width":1.25,"circle-stroke-color":"#3399CC"}}const r_=["d35379db-88df-4056-af3a-620245f8e347","f17cb550-5864-4468-aeb7-f3180cfb622f","689b58e2-cf7b-45e0-9fff-9cfc0883d6b4"];function s_(t,e,i,n,r){r.width=i[0],r.height=i[1];const s=n.getAxisOrientation();r.crs=n.getCode(),r["bbox-crs"]=n.getCode();const o=s.startsWith("ne")?[e[1],e[0],e[3],e[2]]:e;return r.bbox=o.join(","),td(t,r)}function o_(t,e,i,n,r,s){s=Object.assign({},s);const o=e/i,a=[Ge(ve(t)/o,4),Ge(_e(t)/o,4)];return 1!==i&&(s["mm-per-pixel"]=.28/i),s_(r,t,a,n,s)}function a_(t){const e=void 0===t.hidpi||t.hidpi,i=En(t.projection||"EPSG:3857"),n=t.ratio||1.5,r=t.load||js,s=t.crossOrigin??null;return(o,a,l)=>{o=Xg(o,a,l,n),1===l||e||(l=1);const h=o_(o,a,l,i,t.url,t.params),c=new Image;return c.crossOrigin=s,void 0!==t.referrerPolicy&&(c.referrerPolicy=t.referrerPolicy),r(c,h).then((t=>({image:t,extent:o,pixelRatio:l})))}}const l_=[512,512];function h_(t){const e=t.split(".")[1].replace(/-/g,"+").replace(/_/g,"/"),i=atob(e).split(""),n=i.length,r=new Array(n);for(let t=0;t<n;++t){const e=i[t];r[t]="%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)}return JSON.parse(decodeURIComponent(r.join("")))}function c_(t){const e="http://www.opengis.net/def/crs/",i=t.getCode();return i.startsWith(e)?i:i.startsWith("EPSG:")?`${e}EPSG/0/${i.slice(5)}`:Fn(t,En("EPSG:4326"))?`${e}EPSG/0/4326`:i}function u_(t,e){if(!e)return"";let i=e.toString();return e.name&&"function"!==e.name&&i.match(new RegExp("^"+e.name.replace("$","\\$")+"\\b"))&&(i="function "+i),`var ${t} = ${i};`}class d_ extends Ef{constructor(t,e){super(t),e=e||{},this.inversePixelTransform_=[1,0,0,1,0,0],this.postProcesses_=e.postProcesses,this.uniforms_=e.uniforms,this.helper,this.onMapChanged_=()=>{this.clearCache(),this.removeHelper()},t.addChangeListener($a,this.onMapChanged_),this.dispatchPreComposeEvent=this.dispatchPreComposeEvent.bind(this),this.dispatchPostComposeEvent=this.dispatchPostComposeEvent.bind(this)}dispatchPreComposeEvent(t,e){const i=this.getLayer();if(i.hasListener(tl)){const n=new Xc(tl,void 0,e,t);i.dispatchEvent(n)}}dispatchPostComposeEvent(t,e){const i=this.getLayer();if(i.hasListener(el)){const n=new Xc(el,void 0,e,t);i.dispatchEvent(n)}}reset(t){this.uniforms_=t.uniforms,this.helper&&this.helper.setUniforms(this.uniforms_)}removeHelper(){this.helper&&(this.helper.dispose(),delete this.helper)}prepareFrame(t){if(this.getLayer().getRenderSource()){let e,i=!0,n=-1;for(let r=0,s=t.layerStatesArray.length;r<s;r++){const s=t.layerStatesArray[r].layer,o=s.getRenderer();if(!(o instanceof d_)){i=!0;continue}const a=s.getClassName();if((i||a!==e)&&(n+=1,i=!1),e=a,o===this)break}const r="map/"+t.mapId+"/group/"+n;this.helper&&this.helper.canvasCacheKeyMatches(r)&&!this.helper.needsToBeRecreated()||(this.removeHelper(),this.helper=new $p({postProcesses:this.postProcesses_,uniforms:this.uniforms_,canvasCacheKey:r}),e&&(this.helper.getCanvas().className=e),this.afterHelperCreated())}return this.prepareFrameInternal(t)}afterHelperCreated(){}prepareFrameInternal(t){return!0}clearCache(){}disposeInternal(){this.clearCache(),this.removeHelper(),this.getLayer()?.removeChangeListener($a,this.onMapChanged_),super.disposeInternal()}dispatchRenderEvent_(t,e,i){const n=this.getLayer();if(n.hasListener(t)){nr(this.inversePixelTransform_,0,0,i.pixelRatio,-i.pixelRatio,0,0,-i.size[1]);const r=new Xc(t,this.inversePixelTransform_,i,e);n.dispatchEvent(r)}}preRender(t,e){this.dispatchRenderEvent_(Ja,t,e)}postRender(t,e){this.dispatchRenderEvent_(Qa,t,e)}}const g_={TILE_TRANSFORM:"u_tileTransform",TRANSITION_ALPHA:"u_transitionAlpha",DEPTH:"u_depth",RENDER_EXTENT:"u_renderExtent",PATTERN_ORIGIN:"u_patternOrigin",RESOLUTION:"u_resolution",ZOOM:"u_zoom",GLOBAL_ALPHA:"u_globalAlpha",PROJECTION_MATRIX:"u_projectionMatrix",SCREEN_TO_WORLD_MATRIX:"u_screenToWorldMatrix"};function f_(t){return 1/(t+2)}function p_(){return{tileIds:new Set,representationsByZ:{}}}function __(t,e){return t.tileIds.has(z(e))}function m_(t,e,i){const n=t.representationsByZ;i in n||(n[i]=new Set),n[i].add(e),t.tileIds.add(z(e.tile))}function y_(t,e){const i=t.layerStatesArray[t.layerIndex];i.extent&&(e=me(e,zn(i.extent,t.viewState.projection)));const n=i.layer.getRenderSource();if(!n.getWrapX()){const i=n.getTileGridForProjection(t.viewState.projection).getExtent();i&&(e=me(e,i))}return e}function x_(t,e){return`${z(t)},${t.getKey()},${Gu(e)}`}class v_ extends d_{constructor(t,e){super(t,{uniforms:e.uniforms,postProcesses:e.postProcesses}),this.renderComplete=!1,this.tileTransform_=[1,0,0,1,0,0],this.tempMat4=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],this.tempTileRange_=new iu(0,0,0,0),this.tempTileCoord_=Nu(0,0,0),this.tempSize_=[0,0];const i=void 0!==e.cacheSize?e.cacheSize:512;this.tileRepresentationCache=new Du(i),this.frameState=null,this.renderedProjection_=void 0}reset(t){super.reset({uniforms:t.uniforms})}prepareFrameInternal(t){this.renderedProjection_?t.viewState.projection!==this.renderedProjection_&&(this.clearCache(),this.renderedProjection_=t.viewState.projection):this.renderedProjection_=t.viewState.projection;const e=this.getLayer().getRenderSource();return!!e&&(!Ee(y_(t,t.extent))&&"ready"===e.getState())}createTileRepresentation(t){return U()}enqueueTiles(t,e,i,n,r){const s=t.viewState,o=this.getLayer(),a=o.getRenderSource(),l=a.getTileGridForProjection(s.projection),h=a.getGutterForProjection(s.projection),c=z(a);c in t.wantedTiles||(t.wantedTiles[c]={});const u=t.wantedTiles[c],d=this.tileRepresentationCache,g=o.getMapInternal(),f=Math.max(i-r,l.getMinZoom(),l.getZForResolution(Math.min(o.getMaxResolution(),g?g.getView().getResolutionForZoom(Math.max(o.getMinZoom(),0)):l.getResolution(0)),a.zDirection)),p=s.rotation,_=p?pe(s.center,s.resolution,p,t.size):void 0;for(let r=i;r>=f;--r){const i=l.getTileRangeForExtentAndZ(e,r,this.tempTileRange_),o=l.getResolution(r);for(let e=i.minX;e<=i.maxX;++e)for(let g=i.minY;g<=i.maxY;++g){if(p&&!l.tileCoordIntersectsViewport([r,e,g],_))continue;const i=Nu(r,e,g,this.tempTileCoord_),f=x_(a,i);let m,y;if(d.containsKey(f)&&(m=d.get(f),y=m.tile),!(m&&m.tile.key===a.getKey()||(y=a.getTile(r,e,g,t.pixelRatio,s.projection),y)))continue;if(__(n,y))continue;m?m.setTile(y):(m=this.createTileRepresentation({tile:y,grid:l,helper:this.helper,gutter:h}),d.set(f,m)),m_(n,m,r);const x=y.getKey();u[x]=!0,y.getState()===Y&&(t.tileQueue.isKeyQueued(x)||t.tileQueue.enqueue([y,c,l.getTileCoordCenter(i),o]))}}}beforeTilesRender(t,e){this.helper.prepareDraw(this.frameState,!e,!0)}beforeTilesMaskRender(t){return!1}renderTile(t,e,i,n,r,s,o,a,l,h,c){}renderTileMask(t,e,i,n){}drawTile_(t,e,i,n,r,s,o){if(!e.ready)return;const a=e.tile.tileCoord,l=Gu(a),h=l in s?s[l]:1,c=o.getResolution(i),u=Wl(o.getTileSize(i),this.tempSize_),d=o.getOrigin(i),g=o.getTileCoordExtent(a),f=h<1?-1:f_(i);h<1&&(t.animate=!0);const p=t.viewState,_=p.center[0],m=p.center[1],y=u[0]+2*n,x=u[1]+2*n,v=y/x,S=(_-d[0])/(u[0]*c),E=(d[1]-m)/(u[1]*c),w=p.resolution/c,T=a[1],C=a[2];Hn(this.tileTransform_),er(this.tileTransform_,2/(t.size[0]*w/y),-2/(t.size[1]*w/y)),tr(this.tileTransform_,p.rotation),er(this.tileTransform_,1,1/v),ir(this.tileTransform_,(u[0]*(T-S)-n)/y,(u[1]*(C-E)-n)/x),this.renderTile(e,this.tileTransform_,t,r,c,u,d,g,f,n,h)}renderFrame(t){this.frameState=t,this.renderComplete=!0;const e=this.helper.getGL();this.preRender(e,t);const i=t.viewState,n=this.getLayer(),r=n.getRenderSource(),s=r.getTileGridForProjection(i.projection),o=r.getGutterForProjection(i.projection),a=y_(t,t.extent),l=s.getZForResolution(i.resolution,r.zDirection),h=p_(),c=n.getPreload();if(t.nextExtent){const e=s.getZForResolution(i.nextResolution,r.zDirection),n=y_(t,t.nextExtent);this.enqueueTiles(t,n,e,h,c)}this.enqueueTiles(t,a,l,h,0),c>0&&setTimeout((()=>{this.enqueueTiles(t,a,l-1,h,c-1)}),0);const u={};let d=!1;const g=h.representationsByZ;if(l in g){const e=z(this),i=t.time;for(const t of g[l]){const n=t.tile;if(n.getState()===J)continue;const r=n.tileCoord;if(t.ready){const t=n.getAlpha(e,i);if(1===t){n.endTransition(e);continue}d=!0;u[Gu(r)]=t}this.renderComplete=!1;if(this.findAltTiles_(s,r,l+1,h))continue;const o=s.getMinZoom();for(let t=l-1;t>=o;--t){if(this.findAltTiles_(s,r,t,h))break}}}const f=Object.keys(g).map(Number).sort(x);if(this.beforeTilesMaskRender(t))for(let t=0,e=f.length;t<e;++t){const e=f[t];for(const t of g[e]){const i=t.tile.tileCoord;if(Gu(i)in u)continue;const n=s.getTileCoordExtent(i);this.renderTileMask(t,e,n,f_(e))}}this.beforeTilesRender(t,d);for(let e=0,i=f.length;e<i;++e){const i=f[e];for(const e of g[i]){Gu(e.tile.tileCoord)in u||this.drawTile_(t,e,i,o,a,u,s)}}if(l in g)for(const e of g[l]){Gu(e.tile.tileCoord)in u&&this.drawTile_(t,e,l,o,a,u,s)}this.beforeFinalize(t),this.helper.finalizeDraw(t,this.dispatchPreComposeEvent,this.dispatchPostComposeEvent);const p=this.helper.getCanvas();return this.tileRepresentationCache.expireCache(),this.postRender(e,t),p}beforeFinalize(t){}findAltTiles_(t,e,i,n){const r=t.getTileRangeForTileCoordAndZ(e,i,this.tempTileRange_);if(!r)return!1;let s=!0;const o=this.tileRepresentationCache,a=this.getLayer().getRenderSource();for(let t=r.minX;t<=r.maxX;++t)for(let e=r.minY;e<=r.maxY;++e){const r=x_(a,[i,t,e]);let l=!1;if(o.containsKey(r)){const t=o.get(r);t.ready&&!__(n,t.tile)&&(m_(n,t,i),l=!0)}l||(s=!1)}return s}clearCache(){super.clearCache();const t=this.tileRepresentationCache;t.forEach((t=>t.dispose())),t.clear()}afterHelperCreated(){super.afterHelperCreated(),this.tileRepresentationCache.forEach((t=>t.setHelper(this.helper)))}disposeInternal(){super.disposeInternal(),delete this.frameState}}const S_={...g_,TILE_TEXTURE_ARRAY:"u_tileTextures",TEXTURE_PIXEL_WIDTH:"u_texturePixelWidth",TEXTURE_PIXEL_HEIGHT:"u_texturePixelHeight",TEXTURE_RESOLUTION:"u_textureResolution",TEXTURE_ORIGIN_X:"u_textureOriginX",TEXTURE_ORIGIN_Y:"u_textureOriginY"},E_={TEXTURE_COORD:"a_textureCoord"},w_=[{name:E_.TEXTURE_COORD,size:2,type:Bp}];class T_ extends v_{constructor(t,e){super(t,e),this.program_,this.vertexShader_=e.vertexShader,this.fragmentShader_=e.fragmentShader,this.indices_=new Mp(qf,Jf),this.indices_.fromArray([0,1,3,1,2,3]),this.paletteTextures_=e.paletteTextures||[]}reset(t){if(super.reset(t),this.helper){const t=this.helper.getGL();for(const e of this.paletteTextures_)e.delete(t)}if(this.vertexShader_=t.vertexShader,this.fragmentShader_=t.fragmentShader,this.paletteTextures_=t.paletteTextures||[],this.helper){this.program_=this.helper.getProgram(this.fragmentShader_,this.vertexShader_);const t=this.helper.getGL();for(const e of this.paletteTextures_)e.getTexture(t)}}afterHelperCreated(){super.afterHelperCreated();const t=this.helper.getGL();for(const e of this.paletteTextures_)e.getTexture(t);this.program_=this.helper.getProgram(this.fragmentShader_,this.vertexShader_),this.helper.flushBufferData(this.indices_)}removeHelper(){if(this.helper){const t=this.helper.getGL();for(const e of this.paletteTextures_)e.delete(t)}super.removeHelper()}createTileRepresentation(t){return new i_(t)}beforeTilesRender(t,e){super.beforeTilesRender(t,e),this.helper.useProgram(this.program_,t)}renderTile(t,e,i,n,r,s,o,a,l,h,c){const u=this.helper.getGL();this.helper.bindBuffer(t.coords),this.helper.bindBuffer(this.indices_),this.helper.enableAttributes(w_);let d=0;for(;d<t.textures.length;){const e=`${S_.TILE_TEXTURE_ARRAY}[${d}]`;this.helper.bindTexture(t.textures[d],d,e),++d}for(let t=0;t<this.paletteTextures_.length;++t){const e=this.paletteTextures_[t],i=e.getTexture(u);this.helper.bindTexture(i,d,e.name),++d}const g=i.viewState,f=s[0]+2*h,p=s[1]+2*h,_=t.tile.tileCoord,m=_[1],y=_[2];this.helper.setUniformMatrixValue(S_.TILE_TRANSFORM,Qd(this.tempMat4,e)),this.helper.setUniformFloatValue(S_.TRANSITION_ALPHA,c),this.helper.setUniformFloatValue(S_.DEPTH,l);let x=n;h>0&&(x=a,me(x,n,x)),this.helper.setUniformFloatVec4(S_.RENDER_EXTENT,x),this.helper.setUniformFloatValue(S_.RESOLUTION,g.resolution),this.helper.setUniformFloatValue(S_.ZOOM,g.zoom),this.helper.setUniformFloatValue(S_.TEXTURE_PIXEL_WIDTH,f),this.helper.setUniformFloatValue(S_.TEXTURE_PIXEL_HEIGHT,p),this.helper.setUniformFloatValue(S_.TEXTURE_RESOLUTION,r),this.helper.setUniformFloatValue(S_.TEXTURE_ORIGIN_X,o[0]+m*s[0]*r-h*r),this.helper.setUniformFloatValue(S_.TEXTURE_ORIGIN_Y,o[1]-y*s[1]*r+h*r),this.helper.drawElements(0,this.indices_.getSize())}getData(t){if(!this.helper.getGL())return null;const e=this.frameState;if(!e)return null;const i=this.getLayer(),n=Qn(e.pixelToCoordinateTransform,t.slice()),r=e.viewState,s=i.getExtent();if(s&&!$t(zn(s,r.projection),n))return null;const o=i.getSources(Bt([n]),r.resolution);let a,l,h;for(a=o.length-1;a>=0;--a)if(l=o[a],"ready"===l.getState()){if(h=l.getTileGridForProjection(r.projection),l.getWrapX())break;const t=h.getExtent();if(!t||$t(t,n))break}if(a<0)return null;const c=this.tileRepresentationCache;for(let t=h.getZForResolution(r.resolution);t>=h.getMinZoom();--t){const e=h.getTileCoordForCoordAndZ(n,t),i=x_(l,e);if(!c.containsKey(i))continue;const r=c.get(i);if(r.tile.getState()===J)return null;if(!r.loaded)continue;const s=h.getOrigin(t),o=Wl(h.getTileSize(t)),a=h.getResolution(t),u=(n[0]-s[0])/a-e[1]*o[0],d=(s[1]-n[1])/a-e[2]*o[1];return r.getPixelData(u,d)}return null}disposeInternal(){const t=this.helper;if(t){const e=t.getGL();for(const t of this.paletteTextures_)t.delete(e);this.paletteTextures_.length=0,e.deleteProgram(this.program_),delete this.program_,t.deleteBuffer(this.indices_)}super.disposeInternal(),delete this.indices_}}const C_={TEXTURE:"u_texture",VELOCITY_TEXTURE:"u_velocityTexture",POSITION_TEXTURE:"u_positionTexture",PARTICLE_COUNT_SQRT:"u_particleCountSqrt",MAX_SPEED:"u_maxSpeed",RANDOM_SEED:"u_randomSeed",SPEED_FACTOR:"u_speedFactor",DROP_RATE:"u_dropRate",DROP_RATE_BUMP:"u_dropRateBump",OPACITY:"u_opacity",ROTATION:kp.ROTATION,VIEWPORT_SIZE_PX:kp.VIEWPORT_SIZE_PX},b_="a_position",R_="a_index",P_="v_position";class I_ extends T_{constructor(t,e){super(t,{vertexShader:e.tileVertexShader,fragmentShader:e.tileFragmentShader,cacheSize:e.cacheSize,postProcesses:[{}],uniforms:{[C_.MAX_SPEED]:e.maxSpeed}}),this.particleColorFragmentShader_=e.particleColorFragmentShader,this.velocityTexture_=null,this.particleCountSqrt_=e.particles?Math.ceil(Math.sqrt(e.particles)):256,this.particleIndexBuffer_,this.quadBuffer_,this.particlePositionProgram_,this.particlePositionVertexShader_=e.particlePositionVertexShader,this.particlePositionFragmentShader_=e.particlePositionFragmentShader,this.previousPositionTexture_,this.nextPositionTexture_,this.particleColorProgram_,this.particleColorVertexShader_=e.particleColorVertexShader,this.particleColorFragmentShader_=e.particleColorFragmentShader,this.textureProgram_,this.textureVertexShader_=e.textureVertexShader,this.textureFragmentShader_=e.textureFragmentShader,this.previousTrailsTexture_,this.nextTrailsTexture_,this.fadeOpacity_=.996,this.maxSpeed_=e.maxSpeed,this.speedFactor_=e.speedFactor||.001,this.dropRate_=.003,this.dropRateBump_=.01,this.tempVec2_=[0,0],this.renderedWidth_=0,this.renderedHeight_=0}afterHelperCreated(){super.afterHelperCreated();const t=this.helper,e=t.getGL();this.framebuffer_=e.createFramebuffer();const i=this.particleCountSqrt_*this.particleCountSqrt_,n=new Float32Array(i);for(let t=0;t<i;++t)n[t]=t;const r=new Mp(Kf,Jf);r.setArray(n),t.flushBufferData(r),this.particleIndexBuffer_=r;const s=new Float32Array([0,0,1,0,0,1,0,1,1,0,1,1]),o=new Mp(Kf,Jf);o.setArray(s),t.flushBufferData(o),this.quadBuffer_=o;const a=new Uint8Array(4*i);for(let t=0;t<a.length;++t)a[t]=Math.floor(256*Math.random());this.previousPositionTexture_=t.createTexture([this.particleCountSqrt_,this.particleCountSqrt_],a,null,!0),this.nextPositionTexture_=t.createTexture([this.particleCountSqrt_,this.particleCountSqrt_],a,null,!0),this.particlePositionProgram_=t.getProgram(this.particlePositionFragmentShader_,this.particlePositionVertexShader_),this.particleColorProgram_=t.getProgram(this.particleColorFragmentShader_,this.particleColorVertexShader_),this.textureProgram_=t.getProgram(this.textureFragmentShader_,this.textureVertexShader_)}createSizeDependentTextures_(){const t=this.helper,e=t.getGL(),i=t.getCanvas(),n=i.width,r=i.height,s=new Uint8Array(n*r*4);this.nextTrailsTexture_&&e.deleteTexture(this.nextTrailsTexture_),this.nextTrailsTexture_=t.createTexture([n,r],s,null,!0),this.previousTrailsTexture_&&e.deleteTexture(this.previousTrailsTexture_),this.previousTrailsTexture_=t.createTexture([n,r],s,null,!0)}beforeFinalize(t){const e=this.helper,i=e.getGL(),n=e.getCanvas(),r=n.width,s=n.height;this.renderedWidth_==r&&this.renderedHeight_==s||this.createSizeDependentTextures_();const o=[r,s];this.velocityTexture_=e.createTexture(o,null,this.velocityTexture_),i.copyTexImage2D(i.TEXTURE_2D,0,i.RGBA,0,0,r,s,0),this.drawParticleTrails_(t),this.updateParticlePositions_(t),t.animate=!0,this.renderedWidth_=r,this.renderedHeight_=s}drawParticleTrails_(t){const e=this.helper,i=e.getGL();e.bindFrameBuffer(this.framebuffer_,this.nextTrailsTexture_),this.drawTexture_(this.previousTrailsTexture_,this.fadeOpacity_),this.drawParticleColor_(t),e.bindInitialFrameBuffer(),i.clearColor(0,0,0,0),i.clear(i.COLOR_BUFFER_BIT),i.enable(i.BLEND),i.blendFunc(i.SRC_ALPHA,i.ONE_MINUS_SRC_ALPHA),this.drawTexture_(this.nextTrailsTexture_,1),i.disable(i.BLEND);const n=this.nextTrailsTexture_;this.nextTrailsTexture_=this.previousTrailsTexture_,this.previousTrailsTexture_=n}drawTexture_(t,e){const i=this.helper,n=i.getGL();i.useProgram(this.textureProgram_),i.bindTexture(t,0,C_.TEXTURE),i.bindAttribute(this.quadBuffer_,b_,2),this.helper.setUniformFloatValue(C_.OPACITY,e),n.drawArrays(n.TRIANGLES,0,6)}drawParticleColor_(t){const e=this.helper,i=e.getGL();e.useProgram(this.particleColorProgram_);const n=this.particleCountSqrt_*this.particleCountSqrt_;e.bindAttribute(this.particleIndexBuffer_,R_,1),e.bindTexture(this.previousPositionTexture_,0,C_.POSITION_TEXTURE),e.bindTexture(this.velocityTexture_,1,C_.VELOCITY_TEXTURE),this.helper.setUniformFloatValue(C_.PARTICLE_COUNT_SQRT,this.particleCountSqrt_);const r=this.tempVec2_;r[0]=Math.cos(-t.viewState.rotation),r[1]=Math.sin(-t.viewState.rotation),this.helper.setUniformFloatVec2(C_.ROTATION,r),this.helper.setUniformFloatValue(C_.MAX_SPEED,this.maxSpeed_),i.drawArrays(i.POINTS,0,n)}updateParticlePositions_(t){const e=this.helper,i=e.getGL();e.useProgram(this.particlePositionProgram_),i.viewport(0,0,this.particleCountSqrt_,this.particleCountSqrt_),e.bindFrameBuffer(this.framebuffer_,this.nextPositionTexture_),e.bindTexture(this.previousPositionTexture_,0,C_.POSITION_TEXTURE),e.bindTexture(this.velocityTexture_,1,C_.VELOCITY_TEXTURE),e.bindAttribute(this.quadBuffer_,b_,2),e.setUniformFloatValue(C_.RANDOM_SEED,Math.random()),e.setUniformFloatValue(C_.SPEED_FACTOR,this.speedFactor_),e.setUniformFloatValue(C_.DROP_RATE,this.dropRate_),e.setUniformFloatValue(C_.DROP_RATE_BUMP,this.dropRateBump_);const n=this.tempVec2_;n[0]=Math.cos(-t.viewState.rotation),n[1]=Math.sin(-t.viewState.rotation),this.helper.setUniformFloatVec2(C_.ROTATION,n);const r=t.size;this.helper.setUniformFloatVec2(C_.VIEWPORT_SIZE_PX,[r[0],r[1]]),i.drawArrays(i.TRIANGLES,0,6);const s=this.nextPositionTexture_;this.nextPositionTexture_=this.previousPositionTexture_,this.previousPositionTexture_=s}}const F_="GENERATE_POLYGON_BUFFERS",L_="GENERATE_POINT_BUFFERS",M_="GENERATE_LINE_STRING_BUFFERS";function A_(t,e){e=e||[];const i=256,n=255,r=Math.floor(t/i/i/i)/n,s=Math.floor(t/i/i)%i/n,o=Math.floor(t/i)%i/n,a=t%i/n;return e[0]=256*r*255+255*s,e[1]=256*o*255+255*a,e}function O_(t){let e=0;const i=256,n=255;return e+=Math.round(t[0]*i*i*i*n),e+=Math.round(t[1]*i*i*n),e+=Math.round(t[2]*i*n),e+=Math.round(t[3]*n),e}function D_(){const t='function t(t,n,x=2){const o=n&&n.length,i=o?n[0]*x:t.length;let f=e(t,0,i,x,!0);const l=[];if(!f||f.next===f.prev)return l;let c,y,h;if(o&&(f=function(t,n,r,x){const o=[];for(let r=0,i=n.length;r<i;r++){const f=e(t,n[r]*x,r<i-1?n[r+1]*x:t.length,x,!1);f===f.next&&(f.steiner=!0),o.push(a(f))}o.sort(u);for(let t=0;t<o.length;t++)r=s(o[t],r);return r}(t,n,f,x)),t.length>80*x){c=t[0],y=t[1];let e=c,n=y;for(let r=x;r<i;r+=x){const x=t[r],o=t[r+1];x<c&&(c=x),o<y&&(y=o),x>e&&(e=x),o>n&&(n=o)}h=Math.max(e-c,n-y),h=0!==h?32767/h:0}return r(f,l,x,c,y,h,0),l}function e(t,e,n,r,x){let o;if(x===function(t,e,n,r){let x=0;for(let o=e,i=n-r;o<n;o+=r)x+=(t[i]-t[o])*(t[o+1]+t[i+1]),i=o;return x}(t,e,n,r)>0)for(let x=e;x<n;x+=r)o=d(x/r|0,t[x],t[x+1],o);else for(let x=n-r;x>=e;x-=r)o=d(x/r|0,t[x],t[x+1],o);return o&&b(o,o.next)&&(w(o),o=o.next),o}function n(t,e){if(!t)return t;e||(e=t);let n,r=t;do{if(n=!1,r.steiner||!b(r,r.next)&&0!==v(r.prev,r,r.next))r=r.next;else{if(w(r),r=e=r.prev,r===r.next)break;n=!0}}while(n||r!==e);return e}function r(t,e,u,s,l,a,y){if(!t)return;!y&&a&&function(t,e,n,r){let x=t;do{0===x.z&&(x.z=c(x.x,x.y,e,n,r)),x.prevZ=x.prev,x.nextZ=x.next,x=x.next}while(x!==t);x.prevZ.nextZ=null,x.prevZ=null,function(t){let e,n=1;do{let r,x=t;t=null;let o=null;for(e=0;x;){e++;let i=x,f=0;for(let t=0;t<n&&(f++,i=i.nextZ,i);t++);let u=n;for(;f>0||u>0&&i;)0!==f&&(0===u||!i||x.z<=i.z)?(r=x,x=x.nextZ,f--):(r=i,i=i.nextZ,u--),o?o.nextZ=r:t=r,r.prevZ=o,o=r;x=i}o.nextZ=null,n*=2}while(e>1)}(x)}(t,s,l,a);let h=t;for(;t.prev!==t.next;){const c=t.prev,p=t.next;if(a?o(t,s,l,a):x(t))e.push(c.i,t.i,p.i),w(t),t=p.next,h=p.next;else if((t=p)===h){y?1===y?r(t=i(n(t),e),e,u,s,l,a,2):2===y&&f(t,e,u,s,l,a):r(n(t),e,u,s,l,a,1);break}}}function x(t){const e=t.prev,n=t,r=t.next;if(v(e,n,r)>=0)return!1;const x=e.x,o=n.x,i=r.x,f=e.y,u=n.y,s=r.y,l=Math.min(x,o,i),c=Math.min(f,u,s),a=Math.max(x,o,i),y=Math.max(f,u,s);let p=r.next;for(;p!==e;){if(p.x>=l&&p.x<=a&&p.y>=c&&p.y<=y&&h(x,f,o,u,i,s,p.x,p.y)&&v(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function o(t,e,n,r){const x=t.prev,o=t,i=t.next;if(v(x,o,i)>=0)return!1;const f=x.x,u=o.x,s=i.x,l=x.y,a=o.y,y=i.y,p=Math.min(f,u,s),b=Math.min(l,a,y),M=Math.max(f,u,s),m=Math.max(l,a,y),A=c(p,b,e,n,r),g=c(M,m,e,n,r);let Z=t.prevZ,d=t.nextZ;for(;Z&&Z.z>=A&&d&&d.z<=g;){if(Z.x>=p&&Z.x<=M&&Z.y>=b&&Z.y<=m&&Z!==x&&Z!==i&&h(f,l,u,a,s,y,Z.x,Z.y)&&v(Z.prev,Z,Z.next)>=0)return!1;if(Z=Z.prevZ,d.x>=p&&d.x<=M&&d.y>=b&&d.y<=m&&d!==x&&d!==i&&h(f,l,u,a,s,y,d.x,d.y)&&v(d.prev,d,d.next)>=0)return!1;d=d.nextZ}for(;Z&&Z.z>=A;){if(Z.x>=p&&Z.x<=M&&Z.y>=b&&Z.y<=m&&Z!==x&&Z!==i&&h(f,l,u,a,s,y,Z.x,Z.y)&&v(Z.prev,Z,Z.next)>=0)return!1;Z=Z.prevZ}for(;d&&d.z<=g;){if(d.x>=p&&d.x<=M&&d.y>=b&&d.y<=m&&d!==x&&d!==i&&h(f,l,u,a,s,y,d.x,d.y)&&v(d.prev,d,d.next)>=0)return!1;d=d.nextZ}return!0}function i(t,e){let r=t;do{const n=r.prev,x=r.next.next;!b(n,x)&&M(n,r,r.next,x)&&g(n,x)&&g(x,n)&&(e.push(n.i,r.i,x.i),w(r),w(r.next),r=t=x),r=r.next}while(r!==t);return n(r)}function f(t,e,x,o,i,f){let u=t;do{let t=u.next.next;for(;t!==u.prev;){if(u.i!==t.i&&p(u,t)){let s=Z(u,t);return u=n(u,u.next),s=n(s,s.next),r(u,e,x,o,i,f,0),void r(s,e,x,o,i,f,0)}t=t.next}u=u.next}while(u!==t)}function u(t,e){let n=t.x-e.x;if(0===n&&(n=t.y-e.y,0===n)){n=(t.next.y-t.y)/(t.next.x-t.x)-(e.next.y-e.y)/(e.next.x-e.x)}return n}function s(t,e){const r=function(t,e){let n=e;const r=t.x,x=t.y;let o,i=-1/0;if(b(t,n))return n;do{if(b(t,n.next))return n.next;if(x<=n.y&&x>=n.next.y&&n.next.y!==n.y){const t=n.x+(x-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(t<=r&&t>i&&(i=t,o=n.x<n.next.x?n:n.next,t===r))return o}n=n.next}while(n!==e);if(!o)return null;const f=o,u=o.x,s=o.y;let c=1/0;n=o;do{if(r>=n.x&&n.x>=u&&r!==n.x&&y(x<s?r:i,x,u,s,x<s?i:r,x,n.x,n.y)){const e=Math.abs(x-n.y)/(r-n.x);g(n,t)&&(e<c||e===c&&(n.x>o.x||n.x===o.x&&l(o,n)))&&(o=n,c=e)}n=n.next}while(n!==f);return o}(t,e);if(!r)return e;const x=Z(r,t);return n(x,x.next),n(r,r.next)}function l(t,e){return v(t.prev,t,e.prev)<0&&v(e.next,t,t.next)<0}function c(t,e,n,r,x){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-n)*x|0)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-r)*x|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function a(t){let e=t,n=t;do{(e.x<n.x||e.x===n.x&&e.y<n.y)&&(n=e),e=e.next}while(e!==t);return n}function y(t,e,n,r,x,o,i,f){return(x-i)*(e-f)>=(t-i)*(o-f)&&(t-i)*(r-f)>=(n-i)*(e-f)&&(n-i)*(o-f)>=(x-i)*(r-f)}function h(t,e,n,r,x,o,i,f){return!(t===i&&e===f)&&y(t,e,n,r,x,o,i,f)}function p(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){let n=t;do{if(n.i!==t.i&&n.next.i!==t.i&&n.i!==e.i&&n.next.i!==e.i&&M(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}(t,e)&&(g(t,e)&&g(e,t)&&function(t,e){let n=t,r=!1;const x=(t.x+e.x)/2,o=(t.y+e.y)/2;do{n.y>o!=n.next.y>o&&n.next.y!==n.y&&x<(n.next.x-n.x)*(o-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next}while(n!==t);return r}(t,e)&&(v(t.prev,t,e.prev)||v(t,e.prev,e))||b(t,e)&&v(t.prev,t,t.next)>0&&v(e.prev,e,e.next)>0)}function v(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function b(t,e){return t.x===e.x&&t.y===e.y}function M(t,e,n,r){const x=A(v(t,e,n)),o=A(v(t,e,r)),i=A(v(n,r,t)),f=A(v(n,r,e));return x!==o&&i!==f||(!(0!==x||!m(t,n,e))||(!(0!==o||!m(t,r,e))||(!(0!==i||!m(n,t,r))||!(0!==f||!m(n,e,r)))))}function m(t,e,n){return e.x<=Math.max(t.x,n.x)&&e.x>=Math.min(t.x,n.x)&&e.y<=Math.max(t.y,n.y)&&e.y>=Math.min(t.y,n.y)}function A(t){return t>0?1:t<0?-1:0}function g(t,e){return v(t.prev,t,t.next)<0?v(t,e,t.next)>=0&&v(t,t.prev,e)>=0:v(t,e,t.prev)<0||v(t,t.next,e)<0}function Z(t,e){const n=F(t.i,t.x,t.y),r=F(e.i,e.x,e.y),x=t.next,o=e.prev;return t.next=e,e.prev=t,n.next=x,x.prev=n,r.next=n,n.prev=r,o.next=r,r.prev=o,r}function d(t,e,n,r){const x=F(t,e,n);return r?(x.next=r.next,x.prev=r,r.next.prev=x,r.next=x):(x.prev=x,x.next=x),x}function w(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function F(t,e,n){return{i:t,x:e,y:n,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function E(t,e,n){const r=Math.sqrt((e[0]-t[0])*(e[0]-t[0])+(e[1]-t[1])*(e[1]-t[1])),x=[(e[0]-t[0])/r,(e[1]-t[1])/r],o=[-x[1],x[0]],i=Math.sqrt((n[0]-t[0])*(n[0]-t[0])+(n[1]-t[1])*(n[1]-t[1])),f=[(n[0]-t[0])/i,(n[1]-t[1])/i];let u=0===r||0===i?0:Math.acos((s=f[0]*x[0]+f[1]*x[1],l=-1,c=1,Math.min(Math.max(s,l),c)));var s,l,c;u=Math.max(u,1e-5);return f[0]*o[0]+f[1]*o[1]>0?u:2*Math.PI-u}function I(t,e){const n=e[0],r=e[1];return e[0]=t[0]*n+t[2]*r+t[4],e[1]=t[1]*n+t[3]*r+t[5],e}function z(t,e){const n=(r=e)[0]*r[3]-r[1]*r[2];var r;!function(t,e){if(!t)throw new Error(e)}(0!==n,"Transformation matrix cannot be inverted");const x=e[0],o=e[1],i=e[2],f=e[3],u=e[4],s=e[5];return t[0]=f/n,t[1]=-o/n,t[2]=-i/n,t[3]=x/n,t[4]=(i*s-f*u)/n,t[5]=-(x*s-o*u)/n,t}new Array(6);const B=[],P={vertexAttributesPosition:0,instanceAttributesPosition:0,indicesPosition:0};function N(t,e,n,r,x){const o=t[e++],i=t[e++],f=B;f.length=r;for(let n=0;n<f.length;n++)f[n]=t[e+n];let u=x?x.instanceAttributesPosition:0;return n[u++]=o,n[u++]=i,f.length&&(n.set(f,u),u+=f.length),P.instanceAttributesPosition=u,P}function R(t,e,n,r,x,o,i,f,u,s){const l=[t[e],t[e+1]],c=[t[n],t[n+1]],a=t[e+2],y=t[n+2],h=I(f,[...l]),p=I(f,[...c]);let v=-1,b=-1,M=s;const m=null!==x;if(null!==r){v=E(h,p,I(f,[...[t[r],t[r+1]]])),Math.cos(v)<=.985&&(M+=Math.tan((v-Math.PI)/2))}if(m){b=E(p,h,I(f,[...[t[x],t[x+1]]])),Math.cos(b)<=.985&&(M+=Math.tan((Math.PI-b)/2))}const A=Math.pow(2,24),g=u%A,Z=Math.floor(u/A)*A;return o.push(l[0],l[1],a,c[0],c[1],y,v,b,g,Z,s),o.push(...i),{length:u+Math.sqrt((p[0]-h[0])*(p[0]-h[0])+(p[1]-h[1])*(p[1]-h[1])),angle:M}}function S(e,n,r,x,o){const i=2+o;let f=n;const u=e.slice(f,f+o);f+=o;const s=e[f++];let l=0;const c=new Array(s-1);for(let t=0;t<s;t++)l+=e[f++],t<s-1&&(c[t]=l);const a=e.slice(f,f+2*l),y=t(a,c,2);for(let t=0;t<y.length;t++)x.push(y[t]+r.length/i);for(let t=0;t<a.length;t+=2)r.push(a[t],a[t+1],...u);return f+2*l}const T="GENERATE_POLYGON_BUFFERS",_="GENERATE_POINT_BUFFERS",O="GENERATE_LINE_STRING_BUFFERS",U=self;U.onmessage=t=>{const e=t.data;switch(e.type){case _:{const t=2,n=2,r=e.customAttributesSize,x=n+r,o=new Float32Array(e.renderInstructions),i=o.length/x*(t+r),f=Uint32Array.from([0,1,3,1,2,3]),u=Float32Array.from([-1,-1,1,-1,1,1,-1,1]),s=new Float32Array(i);let l;for(let t=0;t<o.length;t+=x)l=N(o,t,s,r,l);const c=Object.assign({indicesBuffer:f.buffer,vertexAttributesBuffer:u.buffer,instanceAttributesBuffer:s.buffer,renderInstructions:o.buffer},e);U.postMessage(c,[u.buffer,s.buffer,f.buffer,o.buffer]);break}case O:{const t=[],n=e.customAttributesSize,r=3,x=new Float32Array(e.renderInstructions);let o=0;const i=[1,0,0,1,0,0];let f,u;for(z(i,e.renderInstructionsTransform);o<x.length;){u=Array.from(x.slice(o,o+n)),o+=n,f=x[o++];const e=o,s=o+(f-1)*r,l=x[e]===x[s]&&x[e+1]===x[s+1];let c=0,a=0;for(let n=0;n<f-1;n++){let y=null;n>0?y=o+(n-1)*r:l&&(y=s-r);let h=null;n<f-2?h=o+(n+2)*r:l&&(h=e+r);const p=R(x,o+n*r,o+(n+1)*r,y,h,t,u,i,c,a);c=p.length,a=p.angle}o+=f*r}const s=Uint32Array.from([0,1,3,1,2,3]),l=Float32Array.from([-1,-1,1,-1,1,1,-1,1]),c=Float32Array.from(t),a=Object.assign({indicesBuffer:s.buffer,vertexAttributesBuffer:l.buffer,instanceAttributesBuffer:c.buffer,renderInstructions:x.buffer},e);U.postMessage(a,[l.buffer,c.buffer,s.buffer,x.buffer]);break}case T:{const t=[],n=[],r=e.customAttributesSize,x=new Float32Array(e.renderInstructions);let o=0;for(;o<x.length;)o=S(x,o,t,n,r);const i=Uint32Array.from(n),f=Float32Array.from(t),u=Float32Array.from([]),s=Object.assign({indicesBuffer:i.buffer,vertexAttributesBuffer:f.buffer,instanceAttributesBuffer:u.buffer,renderInstructions:x.buffer},e);U.postMessage(s,[f.buffer,u.buffer,i.buffer,x.buffer]);break}}};';return new Worker("undefined"==typeof Blob?"data:application/javascript;base64,"+Buffer.from(t,"binary").toString("base64"):URL.createObjectURL(new Blob([t],{type:"application/javascript"})))}function N_(t,e){const i=t.viewState.projection,n=e.getSource().getWrapX()&&i.canWrapX(),r=i.getExtent(),s=t.extent,o=n?ve(r):null,a=n?Math.ceil((s[2]-r[2])/o)+1:1;return[n?Math.floor((s[0]-r[0])/o):0,a,o]}class k_ extends d_{constructor(t,e){const i=e.uniforms||{},n=[1,0,0,1,0,0];i[kp.PROJECTION_MATRIX]=n,super(t,{uniforms:i,postProcesses:e.postProcesses}),this.sourceRevision_=-1,this.verticesBuffer_=new Mp(Kf,Qf),this.instanceAttributesBuffer_=new Mp(Kf,Qf),this.indicesBuffer_=new Mp(qf,Qf),this.vertexShader_=e.vertexShader,this.fragmentShader_=e.fragmentShader,this.program_,this.hitDetectionEnabled_=e.hitDetectionEnabled??!0;const r=e.attributes?e.attributes.map((function(t){return{name:"a_"+t.name,size:1,type:Bp}})):[];this.attributes=[{name:"a_localPosition",size:2,type:Bp}],this.instanceAttributes=[{name:"a_position",size:2,type:Bp}],this.hitDetectionEnabled_&&(this.instanceAttributes.push({name:"a_hitColor",size:2,type:Bp}),this.instanceAttributes.push({name:"a_featureUid",size:1,type:Bp})),this.instanceAttributes.push(...r),this.customAttributes=e.attributes?e.attributes:[],this.previousExtent_=[1/0,1/0,-1/0,-1/0],this.currentTransform_=n,this.renderTransform_=[1,0,0,1,0,0],this.invertRenderTransform_=[1,0,0,1,0,0],this.renderInstructions_=new Float32Array(0),this.hitRenderTarget_,this.lastSentId=0,this.worker_=D_(),this.worker_.addEventListener("message",(t=>{const e=t.data;if(e.type===L_){const i=e.projectionTransform;this.verticesBuffer_.fromArrayBuffer(e.vertexAttributesBuffer),this.instanceAttributesBuffer_.fromArrayBuffer(e.instanceAttributesBuffer),this.helper.flushBufferData(this.verticesBuffer_),this.helper.flushBufferData(this.instanceAttributesBuffer_),this.indicesBuffer_.fromArrayBuffer(e.indicesBuffer),this.helper.flushBufferData(this.indicesBuffer_),this.renderTransform_=i,rr(this.invertRenderTransform_,this.renderTransform_),this.renderInstructions_=new Float32Array(t.data.renderInstructions),e.id===this.lastSentId&&(this.ready=!0),this.getLayer().changed()}})),this.featureCache_={},this.featureCount_=0;const s=this.getLayer().getSource();this.sourceListenKeys_=[D(s,Xd,this.handleSourceFeatureAdded_,this),D(s,Vd,this.handleSourceFeatureChanged_,this),D(s,Wd,this.handleSourceFeatureDelete_,this),D(s,$d,this.handleSourceFeatureClear_,this)],s.forEachFeature((t=>{const e=t.getGeometry();e&&"Point"===e.getType()&&(this.featureCache_[z(t)]={feature:t,properties:t.getProperties(),flatCoordinates:e.getFlatCoordinates()},this.featureCount_++)}))}afterHelperCreated(){this.program_=this.helper.getProgram(this.fragmentShader_,this.vertexShader_),this.hitDetectionEnabled_&&(this.hitRenderTarget_=new Kp(this.helper)),this.verticesBuffer_.getArray()&&this.helper.flushBufferData(this.verticesBuffer_),this.indicesBuffer_.getArray()&&this.helper.flushBufferData(this.indicesBuffer_)}handleSourceFeatureAdded_(t){const e=t.feature,i=e.getGeometry();i&&"Point"===i.getType()&&(this.featureCache_[z(e)]={feature:e,properties:e.getProperties(),flatCoordinates:i.getFlatCoordinates()},this.featureCount_++)}handleSourceFeatureChanged_(t){const e=t.feature,i=z(e),n=this.featureCache_[i],r=e.getGeometry();n?r&&"Point"===r.getType()?(n.properties=e.getProperties(),n.flatCoordinates=r.getFlatCoordinates()):(delete this.featureCache_[i],this.featureCount_--):r&&"Point"===r.getType()&&(this.featureCache_[i]={feature:e,properties:e.getProperties(),flatCoordinates:r.getFlatCoordinates()},this.featureCount_++)}handleSourceFeatureDelete_(t){const e=z(t.feature);e in this.featureCache_&&(delete this.featureCache_[e],this.featureCount_--)}handleSourceFeatureClear_(){this.featureCache_={},this.featureCount_=0}renderFrame(t){const e=this.helper.getGL();this.preRender(e,t);const[i,n,r]=N_(t,this.getLayer());this.renderWorlds(t,!1,i,n,r),this.helper.finalizeDraw(t,this.dispatchPreComposeEvent,this.dispatchPostComposeEvent),this.hitDetectionEnabled_&&(this.renderWorlds(t,!0,i,n,r),this.hitRenderTarget_.clearCachedData()),this.postRender(e,t);return this.helper.getCanvas()}prepareFrameInternal(t){const e=this.getLayer(),i=e.getSource(),n=t.viewState,r=!t.viewHints[co]&&!t.viewHints[uo],s=!te(this.previousExtent_,t.extent),o=this.sourceRevision_<i.getRevision();if(o&&(this.sourceRevision_=i.getRevision()),r&&(s||o)){const r=n.projection,s=n.resolution,o=e instanceof zc?e.getRenderBuffer():0,a=zt(t.extent,o*s);i.loadFeatures(a,s,r),this.rebuildBuffers_(t),this.previousExtent_=t.extent.slice()}return this.helper.useProgram(this.program_,t),this.helper.prepareDraw(t),!0}rebuildBuffers_(t){const e=[1,0,0,1,0,0];this.helper.makeProjectionTransform(t,e);const i=Gn(),n=(this.hitDetectionEnabled_?5:2)+this.customAttributes.length,r=n*this.featureCount_,s=this.renderInstructions_&&this.renderInstructions_.length===r?this.renderInstructions_:new Float32Array(r);this.renderInstructions_=null;let o=[];const a=[];let l=-1;const h=t.viewState.projection;for(const t in this.featureCache_){const n=this.featureCache_[t];if(i?o=Un(n.flatCoordinates,h):(o[0]=n.flatCoordinates[0],o[1]=n.flatCoordinates[1]),Qn(e,o),s[++l]=o[0],s[++l]=o[1],this.hitDetectionEnabled_){const e=A_(l+3,a);s[++l]=e[0],s[++l]=e[1],s[++l]=Number(t)}for(let t=0;t<this.customAttributes.length;t++){const e=this.customAttributes[t].callback(n.feature,n.properties);s[++l]=e}}const c={id:++this.lastSentId,type:L_,renderInstructions:s.buffer,customAttributesSize:n-2};c.projectionTransform=e,this.ready=!1,this.worker_.postMessage(c,[s.buffer])}forEachFeatureAtCoordinate(t,e,i,n,r){if(Mt(this.hitDetectionEnabled_,"`forEachFeatureAtCoordinate` cannot be used on a WebGL layer if the hit detection logic has been disabled using the `disableHitDetection: true` option."),!this.renderInstructions_||!this.hitDetectionEnabled_)return;const s=Qn(e.coordinateToPixelTransform,t.slice()),o=this.hitRenderTarget_.readPixel(s[0]/2,s[1]/2),a=O_([o[0]/255,o[1]/255,o[2]/255,o[3]/255]),l=this.renderInstructions_[a],h=Math.floor(l).toString(),c=this.getLayer().getSource().getFeatureByUid(h);return c?n(c,this.getLayer(),null):void 0}renderWorlds(t,e,i,n,r){let s=i;this.helper.useProgram(this.program_,t),e&&(this.hitRenderTarget_.setSize([Math.floor(t.size[0]/2),Math.floor(t.size[1]/2)]),this.helper.prepareDrawToRenderTarget(t,this.hitRenderTarget_,!0));const o=this.instanceAttributes.reduce(((t,e)=>t+(e.size||1)),0),a=this.instanceAttributesBuffer_.getSize()/o;do{this.helper.bindBuffer(this.indicesBuffer_),this.helper.bindBuffer(this.verticesBuffer_),this.helper.enableAttributes(this.attributes),this.helper.bindBuffer(this.instanceAttributesBuffer_),this.helper.enableAttributesInstanced(this.instanceAttributes),this.helper.makeProjectionTransform(t,this.currentTransform_),ir(this.currentTransform_,s*r,0),Kn(this.currentTransform_,this.invertRenderTransform_),this.helper.applyUniforms(t),this.helper.applyHitDetectionUniform(e);const i=this.indicesBuffer_.getSize();this.helper.drawElementsInstanced(0,i,a)}while(++s<n)}disposeInternal(){this.worker_.terminate(),this.sourceListenKeys_.forEach((function(t){k(t)})),this.sourceListenKeys_=null,super.disposeInternal()}renderDeclutter(){}}function G_(t){const e=t.toString();return e.includes(".")?e:e+".0"}function j_(t){if(t.length<2||t.length>4)throw new Error("`formatArray` can only output `vec2`, `vec3` or `vec4` arrays.");return`vec${t.length}(${t.map(G_).join(", ")})`}function U_(t){const e=zl(t),i=e.length>3?e[3]:1;return j_([e[0]/255,e[1]/255,e[2]/255,i])}function B_(t){return j_(Wl(t))}const z_={};let X_=0;function V_(t){return t in z_||(z_[t]=X_++),z_[t]}function $_(t){return G_(V_(t))}function W_(t){return"u_var_"+t}function Z_(){return{variables:{},properties:{},functions:{},bandCount:0,featureId:!1,geometryType:!1}}const Y_="getBandValue",H_="u_paletteTextures",K_="featureId",q_="geometryType",J_=-9999999;function Q_(t,e,i,n){return im(hh(t,e,i),e,n)}function tm(t){return(e,i,n)=>{const r=i.args.length,s=new Array(r);for(let t=0;t<r;++t)s[t]=im(i.args[t],n,e);return t(s,e)}}const em={[ch.Get]:(t,e)=>{const i=e.args[0].value;i in t.properties||(t.properties[i]={name:i,type:e.type});let n="a_prop_"+i;return sh(e.type,Yl)&&(n=`(${n} > 0.0)`),n},[ch.Id]:t=>(t.featureId=!0,"a_"+K_),[ch.GeometryType]:t=>(t.geometryType=!0,"a_"+q_),[ch.LineMetric]:()=>"currentLineMetric",[ch.Var]:(t,e)=>{const i=e.args[0].value;i in t.variables||(t.variables[i]={name:i,type:e.type});let n=W_(i);return sh(e.type,Yl)&&(n=`(${n} > 0.0)`),n},[ch.Has]:(t,e)=>{const i=e.args[0].value;return i in t.properties||(t.properties[i]={name:i,type:e.type}),`(a_prop_${i} != ${G_(J_)})`},[ch.Resolution]:()=>"u_resolution",[ch.Zoom]:()=>"u_zoom",[ch.Time]:()=>"u_time",[ch.Any]:tm((t=>`(${t.join(" || ")})`)),[ch.All]:tm((t=>`(${t.join(" && ")})`)),[ch.Not]:tm((([t])=>`(!${t})`)),[ch.Equal]:tm((([t,e])=>`(${t} == ${e})`)),[ch.NotEqual]:tm((([t,e])=>`(${t} != ${e})`)),[ch.GreaterThan]:tm((([t,e])=>`(${t} > ${e})`)),[ch.GreaterThanOrEqualTo]:tm((([t,e])=>`(${t} >= ${e})`)),[ch.LessThan]:tm((([t,e])=>`(${t} < ${e})`)),[ch.LessThanOrEqualTo]:tm((([t,e])=>`(${t} <= ${e})`)),[ch.Multiply]:tm((t=>`(${t.join(" * ")})`)),[ch.Divide]:tm((([t,e])=>`(${t} / ${e})`)),[ch.Add]:tm((t=>`(${t.join(" + ")})`)),[ch.Subtract]:tm((([t,e])=>`(${t} - ${e})`)),[ch.Clamp]:tm((([t,e,i])=>`clamp(${t}, ${e}, ${i})`)),[ch.Mod]:tm((([t,e])=>`mod(${t}, ${e})`)),[ch.Pow]:tm((([t,e])=>`pow(${t}, ${e})`)),[ch.Abs]:tm((([t])=>`abs(${t})`)),[ch.Floor]:tm((([t])=>`floor(${t})`)),[ch.Ceil]:tm((([t])=>`ceil(${t})`)),[ch.Round]:tm((([t])=>`floor(${t} + 0.5)`)),[ch.Sin]:tm((([t])=>`sin(${t})`)),[ch.Cos]:tm((([t])=>`cos(${t})`)),[ch.Atan]:tm((([t,e])=>void 0!==e?`atan(${t}, ${e})`:`atan(${t})`)),[ch.Sqrt]:tm((([t])=>`sqrt(${t})`)),[ch.Match]:tm((t=>{const e=t[0],i=t[t.length-1];let n=null;for(let r=t.length-3;r>=1;r-=2){n=`(${e} == ${t[r]} ? ${t[r+1]} : ${n||i})`}return n})),[ch.Between]:tm((([t,e,i])=>`(${t} >= ${e} && ${t} <= ${i})`)),[ch.Interpolate]:tm((([t,e,...i])=>{let n="";for(let r=0;r<i.length-2;r+=2){const s=i[r],o=n||i[r+1],a=i[r+2],l=i[r+3];let h;h=t===G_(1)?`(${e} - ${s}) / (${a} - ${s})`:`(pow(${t}, (${e} - ${s})) - 1.0) / (pow(${t}, (${a} - ${s})) - 1.0)`,n=`mix(${o}, ${l}, clamp(${h}, 0.0, 1.0))`}return n})),[ch.Case]:tm((t=>{const e=t[t.length-1];let i=null;for(let n=t.length-3;n>=0;n-=2){i=`(${t[n]} ? ${t[n+1]} : ${i||e})`}return i})),[ch.In]:tm((([t,...e],i)=>{const n=function(t,e){return`operator_${t}_${Object.keys(e.functions).length}`}("in",i),r=[];for(let t=0;t<e.length;t+=1)r.push(` if (inputValue == ${e[t]}) { return true; }`);return i.functions[n]=`bool ${n}(float inputValue) {\n${r.join("\n")}\n return false;\n}`,`${n}(${t})`})),[ch.Array]:tm((t=>`vec${t.length}(${t.join(", ")})`)),[ch.Color]:tm((t=>{if(1===t.length)return`vec4(vec3(${t[0]} / 255.0), 1.0)`;if(2===t.length)return`vec4(vec3(${t[0]} / 255.0), ${t[1]})`;const e=t.slice(0,3).map((t=>`${t} / 255.0`));if(3===t.length)return`vec4(${e.join(", ")}, 1.0)`;const i=t[3];return`vec4(${e.join(", ")}, ${i})`})),[ch.Band]:tm((([t,e,i],n)=>{if(!(Y_ in n.functions)){let t="";const e=n.bandCount||1;for(let i=0;i<e;i++){const n=Math.floor(i/4);let r=i%4;i===e-1&&1===r&&(r=3);t+=` if (band == ${i+1}.0) {\n return texture2D(${`${S_.TILE_TEXTURE_ARRAY}[${n}]`}, v_textureCoord + vec2(dx, dy))[${r}];\n }\n`}n.functions[Y_]=`float getBandValue(float band, float xOffset, float yOffset) {\n float dx = xOffset / ${S_.TEXTURE_PIXEL_WIDTH};\n float dy = yOffset / ${S_.TEXTURE_PIXEL_HEIGHT};\n${t}\n}`}return`${Y_}(${t}, ${e??"0.0"}, ${i??"0.0"})`})),[ch.Palette]:(t,e)=>{const[i,...n]=e.args,r=n.length,s=new Uint8Array(4*r);for(let t=0;t<n.length;t++){const e=zl(n[t].value),i=4*t;s[i]=e[0],s[i+1]=e[1],s[i+2]=e[2],s[i+3]=255*e[3]}t.paletteTextures||(t.paletteTextures=[]);const o=`${H_}[${t.paletteTextures.length}]`,a=new Yp(o,s);t.paletteTextures.push(a);return`texture2D(${o}, vec2((${im(i,Hl,t)} + 0.5) / ${r}.0, 0.5))`}};function im(t,e,i){if(t instanceof ah){const n=em[t.operator];if(void 0===n)throw new Error(`No compiler defined for this operator: ${JSON.stringify(t.operator)}`);return n(i,t,e)}if((t.type&Hl)>0)return G_(t.value);if((t.type&Yl)>0)return t.value.toString();if((t.type&Kl)>0)return $_(t.value.toString());if((t.type&ql)>0)return U_(t.value);if((t.type&Jl)>0)return j_(t.value);if((t.type&Ql)>0)return B_(t.value);throw new Error(`Unexpected expression ${t.value} (expected type ${nh(e)})`)}function nm(t,e,i,n){let r=0;for(const s in e){const o=e[s],a=o.callback.call(i,i.feature);let l=a?.[0]??a;l===J_&&console.warn('The "has" operator might return false positives.'),void 0===l?l=J_:null===l&&(l=0),t[n+r++]=l,o.size&&1!==o.size&&(t[n+r++]=a[1],o.size<3||(t[n+r++]=a[2],o.size<4||(t[n+r++]=a[3])))}return r}function rm(t){return Object.keys(t).reduce(((e,i)=>e+(t[i].size||1)),0)}function sm(t,e,i,n){const r=(2+rm(i))*t.geometriesCount;e&&e.length===r||(e=new Float32Array(r));const s=[];let o=0;for(const r in t.entries){const a=t.entries[r];for(let t=0,r=a.flatCoordss.length;t<r;t++)s[0]=a.flatCoordss[t][0],s[1]=a.flatCoordss[t][1],Qn(n,s),e[o++]=s[0],e[o++]=s[1],o+=nm(e,i,a,o)}return e}function om(t,e,i,n){const r=3*t.verticesCount+(1+rm(i))*t.geometriesCount;e&&e.length===r||(e=new Float32Array(r));const s=[];let o=0;for(const r in t.entries){const a=t.entries[r];for(let t=0,r=a.flatCoordss.length;t<r;t++){s.length=a.flatCoordss[t].length,cr(a.flatCoordss[t],0,s.length,3,n,s,3),o+=nm(e,i,a,o),e[o++]=s.length/3;for(let t=0,i=s.length;t<i;t+=3)e[o++]=s[t],e[o++]=s[t+1],e[o++]=s[t+2]}}return e}function am(t,e,i,n){const r=2*t.verticesCount+(1+rm(i))*t.geometriesCount+t.ringsCount;e&&e.length===r||(e=new Float32Array(r));const s=[];let o=0;for(const r in t.entries){const a=t.entries[r];for(let t=0,r=a.flatCoordss.length;t<r;t++){s.length=a.flatCoordss[t].length,cr(a.flatCoordss[t],0,s.length,2,n,s),o+=nm(e,i,a,o),e[o++]=a.ringsVerticesCounts[t].length;for(let i=0,n=a.ringsVerticesCounts[t].length;i<n;i++)e[o++]=a.ringsVerticesCounts[t][i];for(let t=0,i=s.length;t<i;t+=2)e[o++]=s[t],e[o++]=s[t+1]}}return e}function lm(t,e,i=2){const n=e&&e.length,r=n?e[0]*i:t.length;let s=hm(t,0,r,i,!0);const o=[];if(!s||s.next===s.prev)return o;let a,l,h;if(n&&(s=function(t,e,i,n){const r=[];for(let i=0,s=e.length;i<s;i++){const o=hm(t,e[i]*n,i<s-1?e[i+1]*n:t.length,n,!1);o===o.next&&(o.steiner=!0),r.push(vm(o))}r.sort(_m);for(let t=0;t<r.length;t++)i=mm(r[t],i);return i}(t,e,s,i)),t.length>80*i){a=t[0],l=t[1];let e=a,n=l;for(let s=i;s<r;s+=i){const i=t[s],r=t[s+1];i<a&&(a=i),r<l&&(l=r),i>e&&(e=i),r>n&&(n=r)}h=Math.max(e-a,n-l),h=0!==h?32767/h:0}return um(s,o,i,a,l,h,0),o}function hm(t,e,i,n,r){let s;if(r===function(t,e,i,n){let r=0;for(let s=e,o=i-n;s<i;s+=n)r+=(t[o]-t[s])*(t[s+1]+t[o+1]),o=s;return r}(t,e,i,n)>0)for(let r=e;r<i;r+=n)s=Lm(r/n|0,t[r],t[r+1],s);else for(let r=i-n;r>=e;r-=n)s=Lm(r/n|0,t[r],t[r+1],s);return s&&Cm(s,s.next)&&(Mm(s),s=s.next),s}function cm(t,e){if(!t)return t;e||(e=t);let i,n=t;do{if(i=!1,n.steiner||!Cm(n,n.next)&&0!==Tm(n.prev,n,n.next))n=n.next;else{if(Mm(n),n=e=n.prev,n===n.next)break;i=!0}}while(i||n!==e);return e}function um(t,e,i,n,r,s,o){if(!t)return;!o&&s&&function(t,e,i,n){let r=t;do{0===r.z&&(r.z=xm(r.x,r.y,e,i,n)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==t);r.prevZ.nextZ=null,r.prevZ=null,function(t){let e,i=1;do{let n,r=t;t=null;let s=null;for(e=0;r;){e++;let o=r,a=0;for(let t=0;t<i&&(a++,o=o.nextZ,o);t++);let l=i;for(;a>0||l>0&&o;)0!==a&&(0===l||!o||r.z<=o.z)?(n=r,r=r.nextZ,a--):(n=o,o=o.nextZ,l--),s?s.nextZ=n:t=n,n.prevZ=s,s=n;r=o}s.nextZ=null,i*=2}while(e>1)}(r)}(t,n,r,s);let a=t;for(;t.prev!==t.next;){const l=t.prev,h=t.next;if(s?gm(t,n,r,s):dm(t))e.push(l.i,t.i,h.i),Mm(t),t=h.next,a=h.next;else if((t=h)===a){o?1===o?um(t=fm(cm(t),e),e,i,n,r,s,2):2===o&&pm(t,e,i,n,r,s):um(cm(t),e,i,n,r,s,1);break}}}function dm(t){const e=t.prev,i=t,n=t.next;if(Tm(e,i,n)>=0)return!1;const r=e.x,s=i.x,o=n.x,a=e.y,l=i.y,h=n.y,c=Math.min(r,s,o),u=Math.min(a,l,h),d=Math.max(r,s,o),g=Math.max(a,l,h);let f=n.next;for(;f!==e;){if(f.x>=c&&f.x<=d&&f.y>=u&&f.y<=g&&Em(r,a,s,l,o,h,f.x,f.y)&&Tm(f.prev,f,f.next)>=0)return!1;f=f.next}return!0}function gm(t,e,i,n){const r=t.prev,s=t,o=t.next;if(Tm(r,s,o)>=0)return!1;const a=r.x,l=s.x,h=o.x,c=r.y,u=s.y,d=o.y,g=Math.min(a,l,h),f=Math.min(c,u,d),p=Math.max(a,l,h),_=Math.max(c,u,d),m=xm(g,f,e,i,n),y=xm(p,_,e,i,n);let x=t.prevZ,v=t.nextZ;for(;x&&x.z>=m&&v&&v.z<=y;){if(x.x>=g&&x.x<=p&&x.y>=f&&x.y<=_&&x!==r&&x!==o&&Em(a,c,l,u,h,d,x.x,x.y)&&Tm(x.prev,x,x.next)>=0)return!1;if(x=x.prevZ,v.x>=g&&v.x<=p&&v.y>=f&&v.y<=_&&v!==r&&v!==o&&Em(a,c,l,u,h,d,v.x,v.y)&&Tm(v.prev,v,v.next)>=0)return!1;v=v.nextZ}for(;x&&x.z>=m;){if(x.x>=g&&x.x<=p&&x.y>=f&&x.y<=_&&x!==r&&x!==o&&Em(a,c,l,u,h,d,x.x,x.y)&&Tm(x.prev,x,x.next)>=0)return!1;x=x.prevZ}for(;v&&v.z<=y;){if(v.x>=g&&v.x<=p&&v.y>=f&&v.y<=_&&v!==r&&v!==o&&Em(a,c,l,u,h,d,v.x,v.y)&&Tm(v.prev,v,v.next)>=0)return!1;v=v.nextZ}return!0}function fm(t,e){let i=t;do{const n=i.prev,r=i.next.next;!Cm(n,r)&&bm(n,i,i.next,r)&&Im(n,r)&&Im(r,n)&&(e.push(n.i,i.i,r.i),Mm(i),Mm(i.next),i=t=r),i=i.next}while(i!==t);return cm(i)}function pm(t,e,i,n,r,s){let o=t;do{let t=o.next.next;for(;t!==o.prev;){if(o.i!==t.i&&wm(o,t)){let a=Fm(o,t);return o=cm(o,o.next),a=cm(a,a.next),um(o,e,i,n,r,s,0),void um(a,e,i,n,r,s,0)}t=t.next}o=o.next}while(o!==t)}function _m(t,e){let i=t.x-e.x;if(0===i&&(i=t.y-e.y,0===i)){i=(t.next.y-t.y)/(t.next.x-t.x)-(e.next.y-e.y)/(e.next.x-e.x)}return i}function mm(t,e){const i=function(t,e){let i=e;const n=t.x,r=t.y;let s,o=-1/0;if(Cm(t,i))return i;do{if(Cm(t,i.next))return i.next;if(r<=i.y&&r>=i.next.y&&i.next.y!==i.y){const t=i.x+(r-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(t<=n&&t>o&&(o=t,s=i.x<i.next.x?i:i.next,t===n))return s}i=i.next}while(i!==e);if(!s)return null;const a=s,l=s.x,h=s.y;let c=1/0;i=s;do{if(n>=i.x&&i.x>=l&&n!==i.x&&Sm(r<h?n:o,r,l,h,r<h?o:n,r,i.x,i.y)){const e=Math.abs(r-i.y)/(n-i.x);Im(i,t)&&(e<c||e===c&&(i.x>s.x||i.x===s.x&&ym(s,i)))&&(s=i,c=e)}i=i.next}while(i!==a);return s}(t,e);if(!i)return e;const n=Fm(i,t);return cm(n,n.next),cm(i,i.next)}function ym(t,e){return Tm(t.prev,t,e.prev)<0&&Tm(e.next,t,t.next)<0}function xm(t,e,i,n,r){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-i)*r|0)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-n)*r|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function vm(t){let e=t,i=t;do{(e.x<i.x||e.x===i.x&&e.y<i.y)&&(i=e),e=e.next}while(e!==t);return i}function Sm(t,e,i,n,r,s,o,a){return(r-o)*(e-a)>=(t-o)*(s-a)&&(t-o)*(n-a)>=(i-o)*(e-a)&&(i-o)*(s-a)>=(r-o)*(n-a)}function Em(t,e,i,n,r,s,o,a){return!(t===o&&e===a)&&Sm(t,e,i,n,r,s,o,a)}function wm(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){let i=t;do{if(i.i!==t.i&&i.next.i!==t.i&&i.i!==e.i&&i.next.i!==e.i&&bm(i,i.next,t,e))return!0;i=i.next}while(i!==t);return!1}(t,e)&&(Im(t,e)&&Im(e,t)&&function(t,e){let i=t,n=!1;const r=(t.x+e.x)/2,s=(t.y+e.y)/2;do{i.y>s!=i.next.y>s&&i.next.y!==i.y&&r<(i.next.x-i.x)*(s-i.y)/(i.next.y-i.y)+i.x&&(n=!n),i=i.next}while(i!==t);return n}(t,e)&&(Tm(t.prev,t,e.prev)||Tm(t,e.prev,e))||Cm(t,e)&&Tm(t.prev,t,t.next)>0&&Tm(e.prev,e,e.next)>0)}function Tm(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function Cm(t,e){return t.x===e.x&&t.y===e.y}function bm(t,e,i,n){const r=Pm(Tm(t,e,i)),s=Pm(Tm(t,e,n)),o=Pm(Tm(i,n,t)),a=Pm(Tm(i,n,e));return r!==s&&o!==a||(!(0!==r||!Rm(t,i,e))||(!(0!==s||!Rm(t,n,e))||(!(0!==o||!Rm(i,t,n))||!(0!==a||!Rm(i,e,n)))))}function Rm(t,e,i){return e.x<=Math.max(t.x,i.x)&&e.x>=Math.min(t.x,i.x)&&e.y<=Math.max(t.y,i.y)&&e.y>=Math.min(t.y,i.y)}function Pm(t){return t>0?1:t<0?-1:0}function Im(t,e){return Tm(t.prev,t,t.next)<0?Tm(t,e,t.next)>=0&&Tm(t,t.prev,e)>=0:Tm(t,e,t.prev)<0||Tm(t,t.next,e)<0}function Fm(t,e){const i=Am(t.i,t.x,t.y),n=Am(e.i,e.x,e.y),r=t.next,s=e.prev;return t.next=e,e.prev=t,i.next=r,r.prev=i,n.next=i,i.prev=n,s.next=n,n.prev=s,n}function Lm(t,e,i,n){const r=Am(t,e,i);return n?(r.next=n.next,r.prev=n,n.next.prev=r,n.next=r):(r.prev=r,r.next=r),r}function Mm(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function Am(t,e,i){return{i:t,x:e,y:i,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}const Om=.985,Dm=[],Nm={vertexAttributesPosition:0,instanceAttributesPosition:0,indicesPosition:0};function km(t,e,i){return Q_(e,i,lh(),t)}function Gm(t){const e=zl(t);return[256*e[0]+e[1],256*e[2]+Math.round(255*e[3])]}const jm="vec4 unpackColor(vec2 packedColor) {\n return vec4(\n min(floor(packedColor[0] / 256.0) / 255.0, 1.0),\n min(mod(packedColor[0], 256.0) / 255.0, 1.0),\n min(floor(packedColor[1] / 256.0) / 255.0, 1.0),\n min(mod(packedColor[1], 256.0) / 255.0, 1.0)\n );\n}";function Um(t){return t===ql||t===Ql?2:t===Jl?4:1}function Bm(t){const e=Um(t);return e>1?`vec${e}`:"float"}function zm(t,e){for(const i in e.variables){const n=e.variables[i],r=W_(n.name);let s=Bm(n.type);n.type===ql&&(s="vec4"),t.addUniform(r,s)}for(const i in e.properties){const n=e.properties[i],r=Bm(n.type),s=`a_prop_${n.name}`;n.type===ql?t.addAttribute(s,r,`unpackColor(${s})`,"vec4"):t.addAttribute(s,r)}for(const i in e.functions)t.addVertexShaderFunction(e.functions[i]),t.addFragmentShaderFunction(e.functions[i])}function Xm(t,e){const i={};for(const n in t.variables){const r=t.variables[n];i[W_(r.name)]=()=>{const t=e[r.name];if("number"==typeof t)return t;if("boolean"==typeof t)return t?1:0;if(r.type===ql){const e=[...zl(t||"#eee")];return e[0]/=255,e[1]/=255,e[2]/=255,e[3]??=1,e}return"string"==typeof t?V_(t):t}}return i}function Vm(t){const e={};for(const i in t.properties){const n=t.properties[i],r=t=>{const e=t.get(n.name);return n.type===ql?Gm([...zl(e||"#eee")]):"string"==typeof e?V_(e):"boolean"==typeof e?e?1:0:e};e[`prop_${n.name}`]={size:Um(n.type),callback:r}}return e}const $m=`#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\nuniform mat4 u_projectionMatrix;\nuniform mat4 u_screenToWorldMatrix;\nuniform vec2 u_viewportSizePx;\nuniform float u_pixelRatio;\nuniform float u_globalAlpha;\nuniform float u_time;\nuniform float u_zoom;\nuniform float u_resolution;\nuniform float u_rotation;\nuniform vec4 u_renderExtent;\nuniform vec2 u_patternOrigin;\nuniform float u_depth;\nuniform mediump int u_hitDetection;\n\nconst float PI = 3.141592653589793238;\nconst float TWO_PI = 2.0 * PI;\nfloat currentLineMetric = 0.; // an actual value will be used in the stroke shaders\n\n${jm}\n`,Wm={"fill-color":"rgba(255,255,255,0.4)","stroke-color":"#3399CC","stroke-width":1.25,"circle-radius":5,"circle-fill-color":"rgba(255,255,255,0.4)","circle-stroke-width":1.25,"circle-stroke-color":"#3399CC"};class Zm{constructor(){this.uniforms_=[],this.attributes_=[],this.hasSymbol_=!1,this.symbolSizeExpression_=`vec2(${G_(Wm["circle-radius"])} + ${G_(.5*Wm["circle-stroke-width"])})`,this.symbolRotationExpression_="0.0",this.symbolOffsetExpression_="vec2(0.0)",this.symbolColorExpression_=U_(Wm["circle-fill-color"]),this.texCoordExpression_="vec4(0.0, 0.0, 1.0, 1.0)",this.discardExpression_="false",this.symbolRotateWithView_=!1,this.hasStroke_=!1,this.strokeWidthExpression_=G_(Wm["stroke-width"]),this.strokeColorExpression_=U_(Wm["stroke-color"]),this.strokeOffsetExpression_="0.",this.strokeCapExpression_=$_("round"),this.strokeJoinExpression_=$_("round"),this.strokeMiterLimitExpression_="10.",this.strokeDistanceFieldExpression_="-1000.",this.strokePatternLengthExpression_=null,this.hasFill_=!1,this.fillColorExpression_=U_(Wm["fill-color"]),this.vertexShaderFunctions_=[],this.fragmentShaderFunctions_=[]}addUniform(t,e){return this.uniforms_.push({name:t,type:e}),this}addAttribute(t,e,i,n){return this.attributes_.push({name:t,type:e,varyingName:t.replace(/^a_/,"v_"),varyingType:n??e,varyingExpression:i??t}),this}setSymbolSizeExpression(t){return this.hasSymbol_=!0,this.symbolSizeExpression_=t,this}getSymbolSizeExpression(){return this.symbolSizeExpression_}setSymbolRotationExpression(t){return this.symbolRotationExpression_=t,this}setSymbolOffsetExpression(t){return this.symbolOffsetExpression_=t,this}getSymbolOffsetExpression(){return this.symbolOffsetExpression_}setSymbolColorExpression(t){return this.hasSymbol_=!0,this.symbolColorExpression_=t,this}getSymbolColorExpression(){return this.symbolColorExpression_}setTextureCoordinateExpression(t){return this.texCoordExpression_=t,this}setFragmentDiscardExpression(t){return this.discardExpression_=t,this}getFragmentDiscardExpression(){return this.discardExpression_}setSymbolRotateWithView(t){return this.symbolRotateWithView_=t,this}setStrokeWidthExpression(t){return this.hasStroke_=!0,this.strokeWidthExpression_=t,this}setStrokeColorExpression(t){return this.hasStroke_=!0,this.strokeColorExpression_=t,this}getStrokeColorExpression(){return this.strokeColorExpression_}setStrokeOffsetExpression(t){return this.strokeOffsetExpression_=t,this}setStrokeCapExpression(t){return this.strokeCapExpression_=t,this}setStrokeJoinExpression(t){return this.strokeJoinExpression_=t,this}setStrokeMiterLimitExpression(t){return this.strokeMiterLimitExpression_=t,this}setStrokeDistanceFieldExpression(t){return this.strokeDistanceFieldExpression_=t,this}setStrokePatternLengthExpression(t){return this.strokePatternLengthExpression_=t,this}getStrokePatternLengthExpression(){return this.strokePatternLengthExpression_}setFillColorExpression(t){return this.hasFill_=!0,this.fillColorExpression_=t,this}getFillColorExpression(){return this.fillColorExpression_}addVertexShaderFunction(t){return this.vertexShaderFunctions_.includes(t)||this.vertexShaderFunctions_.push(t),this}addFragmentShaderFunction(t){return this.fragmentShaderFunctions_.includes(t)||this.fragmentShaderFunctions_.push(t),this}getSymbolVertexShader(){return this.hasSymbol_?`${$m}\n${this.uniforms_.map((t=>`uniform ${t.type} ${t.name};`)).join("\n")}\nattribute vec2 a_position;\nattribute vec2 a_localPosition;\nattribute vec2 a_hitColor;\n\nvarying vec2 v_texCoord;\nvarying vec2 v_quadCoord;\nvarying vec4 v_hitColor;\nvarying vec2 v_centerPx;\nvarying float v_angle;\nvarying vec2 v_quadSizePx;\n\n${this.attributes_.map((t=>`attribute ${t.type} ${t.name};\nvarying ${t.varyingType} ${t.varyingName};`)).join("\n")}\n${this.vertexShaderFunctions_.join("\n")}\nvec2 pxToScreen(vec2 coordPx) {\n vec2 scaled = coordPx / u_viewportSizePx / 0.5;\n return scaled;\n}\n\nvec2 screenToPx(vec2 coordScreen) {\n return (coordScreen * 0.5 + 0.5) * u_viewportSizePx;\n}\n\nvoid main(void) {\n v_quadSizePx = ${this.symbolSizeExpression_};\n vec2 halfSizePx = v_quadSizePx * 0.5;\n vec2 centerOffsetPx = ${this.symbolOffsetExpression_};\n vec2 offsetPx = centerOffsetPx + a_localPosition * halfSizePx * vec2(1., -1.);\n float angle = ${this.symbolRotationExpression_}${this.symbolRotateWithView_?" + u_rotation":""};\n float c = cos(-angle);\n float s = sin(-angle);\n offsetPx = vec2(c * offsetPx.x - s * offsetPx.y, s * offsetPx.x + c * offsetPx.y);\n vec4 center = u_projectionMatrix * vec4(a_position, 0.0, 1.0);\n gl_Position = center + vec4(pxToScreen(offsetPx), u_depth, 0.);\n vec4 texCoord = ${this.texCoordExpression_};\n float u = mix(texCoord.s, texCoord.p, a_localPosition.x * 0.5 + 0.5);\n float v = mix(texCoord.t, texCoord.q, a_localPosition.y * 0.5 + 0.5);\n v_texCoord = vec2(u, v);\n v_hitColor = unpackColor(a_hitColor);\n v_angle = angle;\n c = cos(-v_angle);\n s = sin(-v_angle);\n centerOffsetPx = vec2(c * centerOffsetPx.x - s * centerOffsetPx.y, s * centerOffsetPx.x + c * centerOffsetPx.y);\n v_centerPx = screenToPx(center.xy) + centerOffsetPx;\n${this.attributes_.map((t=>` ${t.varyingName} = ${t.varyingExpression};`)).join("\n")}\n}`:null}getSymbolFragmentShader(){return this.hasSymbol_?`${$m}\n${this.uniforms_.map((t=>`uniform ${t.type} ${t.name};`)).join("\n")}\nvarying vec2 v_texCoord;\nvarying vec4 v_hitColor;\nvarying vec2 v_centerPx;\nvarying float v_angle;\nvarying vec2 v_quadSizePx;\n${this.attributes_.map((t=>`varying ${t.varyingType} ${t.varyingName};`)).join("\n")}\n${this.fragmentShaderFunctions_.join("\n")}\n\nvoid main(void) {\n${this.attributes_.map((t=>` ${t.varyingType} ${t.name} = ${t.varyingName}; // assign to original attribute name`)).join("\n")}\n if (${this.discardExpression_}) { discard; }\n vec2 coordsPx = gl_FragCoord.xy / u_pixelRatio - v_centerPx; // relative to center\n float c = cos(v_angle);\n float s = sin(v_angle);\n coordsPx = vec2(c * coordsPx.x - s * coordsPx.y, s * coordsPx.x + c * coordsPx.y);\n gl_FragColor = ${this.symbolColorExpression_};\n gl_FragColor.rgb *= gl_FragColor.a;\n if (u_hitDetection > 0) {\n if (gl_FragColor.a < 0.05) { discard; };\n gl_FragColor = v_hitColor;\n }\n}`:null}getStrokeVertexShader(){return this.hasStroke_?`${$m}\n${this.uniforms_.map((t=>`uniform ${t.type} ${t.name};`)).join("\n")}\nattribute vec2 a_segmentStart;\nattribute vec2 a_segmentEnd;\nattribute vec2 a_localPosition;\nattribute float a_measureStart;\nattribute float a_measureEnd;\nattribute float a_angleTangentSum;\nattribute float a_distanceLow;\nattribute float a_distanceHigh;\nattribute vec2 a_joinAngles;\nattribute vec2 a_hitColor;\n\nvarying vec2 v_segmentStartPx;\nvarying vec2 v_segmentEndPx;\nvarying float v_angleStart;\nvarying float v_angleEnd;\nvarying float v_width;\nvarying vec4 v_hitColor;\nvarying float v_distancePx;\nvarying float v_measureStart;\nvarying float v_measureEnd;\n\n${this.attributes_.map((t=>`attribute ${t.type} ${t.name};\nvarying ${t.varyingType} ${t.varyingName};`)).join("\n")}\n${this.vertexShaderFunctions_.join("\n")}\nvec2 worldToPx(vec2 worldPos) {\n vec4 screenPos = u_projectionMatrix * vec4(worldPos, 0.0, 1.0);\n return (0.5 * screenPos.xy + 0.5) * u_viewportSizePx;\n}\n\nvec4 pxToScreen(vec2 pxPos) {\n vec2 screenPos = 2.0 * pxPos / u_viewportSizePx - 1.0;\n return vec4(screenPos, u_depth, 1.0);\n}\n\nbool isCap(float joinAngle) {\n return joinAngle < -0.1;\n}\n\nvec2 getJoinOffsetDirection(vec2 normalPx, float joinAngle) {\n float halfAngle = joinAngle / 2.0;\n float c = cos(halfAngle);\n float s = sin(halfAngle);\n vec2 angleBisectorNormal = vec2(s * normalPx.x + c * normalPx.y, -c * normalPx.x + s * normalPx.y);\n float length = 1.0 / s;\n return angleBisectorNormal * length;\n}\n\nvec2 getOffsetPoint(vec2 point, vec2 normal, float joinAngle, float offsetPx) {\n // if on a cap or the join angle is too high, offset the line along the segment normal\n if (cos(joinAngle) > 0.998 || isCap(joinAngle)) {\n return point - normal * offsetPx;\n }\n // offset is applied along the inverted normal (positive offset goes "right" relative to line direction)\n return point - getJoinOffsetDirection(normal, joinAngle) * offsetPx;\n}\n\nvoid main(void) {\n v_angleStart = a_joinAngles.x;\n v_angleEnd = a_joinAngles.y;\n float startEndRatio = a_localPosition.x * 0.5 + 0.5;\n currentLineMetric = mix(a_measureStart, a_measureEnd, startEndRatio);\n // we're reading the fractional part while keeping the sign (so -4.12 gives -0.12, 3.45 gives 0.45)\n\n float lineWidth = ${this.strokeWidthExpression_};\n float lineOffsetPx = ${this.strokeOffsetExpression_};\n\n // compute segment start/end in px with offset\n vec2 segmentStartPx = worldToPx(a_segmentStart);\n vec2 segmentEndPx = worldToPx(a_segmentEnd);\n vec2 tangentPx = normalize(segmentEndPx - segmentStartPx);\n vec2 normalPx = vec2(-tangentPx.y, tangentPx.x);\n segmentStartPx = getOffsetPoint(segmentStartPx, normalPx, v_angleStart, lineOffsetPx),\n segmentEndPx = getOffsetPoint(segmentEndPx, normalPx, v_angleEnd, lineOffsetPx);\n\n // compute current vertex position\n float normalDir = -1. * a_localPosition.y;\n float tangentDir = -1. * a_localPosition.x;\n float angle = mix(v_angleStart, v_angleEnd, startEndRatio);\n vec2 joinDirection;\n vec2 positionPx = mix(segmentStartPx, segmentEndPx, startEndRatio);\n // if angle is too high, do not make a proper join\n if (cos(angle) > 0.985 || isCap(angle)) {\n joinDirection = normalPx * normalDir - tangentPx * tangentDir;\n } else {\n joinDirection = getJoinOffsetDirection(normalPx * normalDir, angle);\n }\n positionPx = positionPx + joinDirection * (lineWidth * 0.5 + 1.); // adding 1 pixel for antialiasing\n gl_Position = pxToScreen(positionPx);\n\n v_segmentStartPx = segmentStartPx;\n v_segmentEndPx = segmentEndPx;\n v_width = lineWidth;\n v_hitColor = unpackColor(a_hitColor);\n\n v_distancePx = a_distanceLow / u_resolution - (lineOffsetPx * a_angleTangentSum);\n float distanceHighPx = a_distanceHigh / u_resolution;\n ${null!==this.strokePatternLengthExpression_?`v_distancePx = mod(v_distancePx, ${this.strokePatternLengthExpression_});\n distanceHighPx = mod(distanceHighPx, ${this.strokePatternLengthExpression_});\n `:""}v_distancePx += distanceHighPx;\n\n v_measureStart = a_measureStart;\n v_measureEnd = a_measureEnd;\n${this.attributes_.map((t=>` ${t.varyingName} = ${t.varyingExpression};`)).join("\n")}\n}`:null}getStrokeFragmentShader(){return this.hasStroke_?`${$m}\n${this.uniforms_.map((t=>`uniform ${t.type} ${t.name};`)).join("\n")}\nvarying vec2 v_segmentStartPx;\nvarying vec2 v_segmentEndPx;\nvarying float v_angleStart;\nvarying float v_angleEnd;\nvarying float v_width;\nvarying vec4 v_hitColor;\nvarying float v_distancePx;\nvarying float v_measureStart;\nvarying float v_measureEnd;\n${this.attributes_.map((t=>`varying ${t.varyingType} ${t.varyingName};`)).join("\n")}\n${this.fragmentShaderFunctions_.join("\n")}\n\nvec2 pxToWorld(vec2 pxPos) {\n vec2 screenPos = 2.0 * pxPos / u_viewportSizePx - 1.0;\n return (u_screenToWorldMatrix * vec4(screenPos, 0.0, 1.0)).xy;\n}\n\nbool isCap(float joinAngle) {\n return joinAngle < -0.1;\n}\n\nfloat segmentDistanceField(vec2 point, vec2 start, vec2 end, float width) {\n vec2 tangent = normalize(end - start);\n vec2 normal = vec2(-tangent.y, tangent.x);\n vec2 startToPoint = point - start;\n return abs(dot(startToPoint, normal)) - width * 0.5;\n}\n\nfloat buttCapDistanceField(vec2 point, vec2 start, vec2 end) {\n vec2 startToPoint = point - start;\n vec2 tangent = normalize(end - start);\n return dot(startToPoint, -tangent);\n}\n\nfloat squareCapDistanceField(vec2 point, vec2 start, vec2 end, float width) {\n return buttCapDistanceField(point, start, end) - width * 0.5;\n}\n\nfloat roundCapDistanceField(vec2 point, vec2 start, vec2 end, float width) {\n float onSegment = max(0., 1000. * dot(point - start, end - start)); // this is very high when inside the segment\n return length(point - start) - width * 0.5 - onSegment;\n}\n\nfloat roundJoinDistanceField(vec2 point, vec2 start, vec2 end, float width) {\n return roundCapDistanceField(point, start, end, width);\n}\n\nfloat bevelJoinField(vec2 point, vec2 start, vec2 end, float width, float joinAngle) {\n vec2 startToPoint = point - start;\n vec2 tangent = normalize(end - start);\n float c = cos(joinAngle * 0.5);\n float s = sin(joinAngle * 0.5);\n float direction = -sign(sin(joinAngle));\n vec2 bisector = vec2(c * tangent.x - s * tangent.y, s * tangent.x + c * tangent.y);\n float radius = width * 0.5 * s;\n return dot(startToPoint, bisector * direction) - radius;\n}\n\nfloat miterJoinDistanceField(vec2 point, vec2 start, vec2 end, float width, float joinAngle) {\n if (cos(joinAngle) > 0.985) { // avoid risking a division by zero\n return bevelJoinField(point, start, end, width, joinAngle);\n }\n float miterLength = 1. / sin(joinAngle * 0.5);\n float miterLimit = ${this.strokeMiterLimitExpression_};\n if (miterLength > miterLimit) {\n return bevelJoinField(point, start, end, width, joinAngle);\n }\n return -1000.;\n}\n\nfloat capDistanceField(vec2 point, vec2 start, vec2 end, float width, float capType) {\n if (capType == ${$_("butt")}) {\n return buttCapDistanceField(point, start, end);\n } else if (capType == ${$_("square")}) {\n return squareCapDistanceField(point, start, end, width);\n }\n return roundCapDistanceField(point, start, end, width);\n}\n\nfloat joinDistanceField(vec2 point, vec2 start, vec2 end, float width, float joinAngle, float joinType) {\n if (joinType == ${$_("bevel")}) {\n return bevelJoinField(point, start, end, width, joinAngle);\n } else if (joinType == ${$_("miter")}) {\n return miterJoinDistanceField(point, start, end, width, joinAngle);\n }\n return roundJoinDistanceField(point, start, end, width);\n}\n\nfloat computeSegmentPointDistance(vec2 point, vec2 start, vec2 end, float width, float joinAngle, float capType, float joinType) {\n if (isCap(joinAngle)) {\n return capDistanceField(point, start, end, width, capType);\n }\n return joinDistanceField(point, start, end, width, joinAngle, joinType);\n}\n\nfloat distanceFromSegment(vec2 point, vec2 start, vec2 end) {\n vec2 tangent = end - start;\n vec2 startToPoint = point - start;\n // inspire by capsule fn in https://iquilezles.org/articles/distfunctions/\n float h = clamp(dot(startToPoint, tangent) / dot(tangent, tangent), 0.0, 1.0);\n return length(startToPoint - tangent * h);\n}\n\nvoid main(void) {\n${this.attributes_.map((t=>` ${t.varyingType} ${t.name} = ${t.varyingName}; // assign to original attribute name`)).join("\n")}\n\n vec2 currentPointPx = gl_FragCoord.xy / u_pixelRatio;\n #ifdef GL_FRAGMENT_PRECISION_HIGH\n vec2 worldPos = pxToWorld(currentPointPx);\n if (\n abs(u_renderExtent[0] - u_renderExtent[2]) > 0.0 && (\n worldPos[0] < u_renderExtent[0] ||\n worldPos[1] < u_renderExtent[1] ||\n worldPos[0] > u_renderExtent[2] ||\n worldPos[1] > u_renderExtent[3]\n )\n ) {\n discard;\n }\n #endif\n\n float segmentLengthPx = length(v_segmentEndPx - v_segmentStartPx);\n segmentLengthPx = max(segmentLengthPx, 1.17549429e-38); // avoid divide by zero\n vec2 segmentTangent = (v_segmentEndPx - v_segmentStartPx) / segmentLengthPx;\n vec2 segmentNormal = vec2(-segmentTangent.y, segmentTangent.x);\n vec2 startToPointPx = currentPointPx - v_segmentStartPx;\n float lengthToPointPx = max(0., min(dot(segmentTangent, startToPointPx), segmentLengthPx));\n float currentLengthPx = lengthToPointPx + v_distancePx;\n float currentRadiusPx = distanceFromSegment(currentPointPx, v_segmentStartPx, v_segmentEndPx);\n float currentRadiusRatio = dot(segmentNormal, startToPointPx) * 2. / v_width;\n currentLineMetric = mix(v_measureStart, v_measureEnd, lengthToPointPx / segmentLengthPx);\n\n if (${this.discardExpression_}) { discard; }\n\n float capType = ${this.strokeCapExpression_};\n float joinType = ${this.strokeJoinExpression_};\n float segmentStartDistance = computeSegmentPointDistance(currentPointPx, v_segmentStartPx, v_segmentEndPx, v_width, v_angleStart, capType, joinType);\n float segmentEndDistance = computeSegmentPointDistance(currentPointPx, v_segmentEndPx, v_segmentStartPx, v_width, v_angleEnd, capType, joinType);\n float distanceField = max(\n segmentDistanceField(currentPointPx, v_segmentStartPx, v_segmentEndPx, v_width),\n max(segmentStartDistance, segmentEndDistance)\n );\n distanceField = max(distanceField, ${this.strokeDistanceFieldExpression_});\n\n vec4 color = ${this.strokeColorExpression_};\n color.a *= smoothstep(0.5, -0.5, distanceField);\n gl_FragColor = color;\n gl_FragColor.a *= u_globalAlpha;\n gl_FragColor.rgb *= gl_FragColor.a;\n if (u_hitDetection > 0) {\n if (gl_FragColor.a < 0.1) { discard; };\n gl_FragColor = v_hitColor;\n }\n}`:null}getFillVertexShader(){return this.hasFill_?`${$m}\n${this.uniforms_.map((t=>`uniform ${t.type} ${t.name};`)).join("\n")}\nattribute vec2 a_position;\nattribute vec2 a_hitColor;\n\nvarying vec4 v_hitColor;\n\n${this.attributes_.map((t=>`attribute ${t.type} ${t.name};\nvarying ${t.varyingType} ${t.varyingName};`)).join("\n")}\n${this.vertexShaderFunctions_.join("\n")}\nvoid main(void) {\n gl_Position = u_projectionMatrix * vec4(a_position, u_depth, 1.0);\n v_hitColor = unpackColor(a_hitColor);\n${this.attributes_.map((t=>` ${t.varyingName} = ${t.varyingExpression};`)).join("\n")}\n}`:null}getFillFragmentShader(){return this.hasFill_?`${$m}\n${this.uniforms_.map((t=>`uniform ${t.type} ${t.name};`)).join("\n")}\nvarying vec4 v_hitColor;\n${this.attributes_.map((t=>`varying ${t.varyingType} ${t.varyingName};`)).join("\n")}\n${this.fragmentShaderFunctions_.join("\n")}\nvec2 pxToWorld(vec2 pxPos) {\n vec2 screenPos = 2.0 * pxPos / u_viewportSizePx - 1.0;\n return (u_screenToWorldMatrix * vec4(screenPos, 0.0, 1.0)).xy;\n}\n\nvec2 worldToPx(vec2 worldPos) {\n vec4 screenPos = u_projectionMatrix * vec4(worldPos, 0.0, 1.0);\n return (0.5 * screenPos.xy + 0.5) * u_viewportSizePx;\n}\n\nvoid main(void) {\n${this.attributes_.map((t=>` ${t.varyingType} ${t.name} = ${t.varyingName}; // assign to original attribute name`)).join("\n")}\n vec2 pxPos = gl_FragCoord.xy / u_pixelRatio;\n vec2 pxOrigin = worldToPx(u_patternOrigin);\n #ifdef GL_FRAGMENT_PRECISION_HIGH\n vec2 worldPos = pxToWorld(pxPos);\n if (\n abs(u_renderExtent[0] - u_renderExtent[2]) > 0.0 && (\n worldPos[0] < u_renderExtent[0] ||\n worldPos[1] < u_renderExtent[1] ||\n worldPos[0] > u_renderExtent[2] ||\n worldPos[1] > u_renderExtent[3]\n )\n ) {\n discard;\n }\n #endif\n if (${this.discardExpression_}) { discard; }\n gl_FragColor = ${this.fillColorExpression_};\n gl_FragColor.a *= u_globalAlpha;\n gl_FragColor.rgb *= gl_FragColor.a;\n if (u_hitDetection > 0) {\n if (gl_FragColor.a < 0.1) { discard; };\n gl_FragColor = v_hitColor;\n }\n}`:null}}function Ym(t){return(JSON.stringify(t).split("").reduce(((t,e)=>(t<<5)-t+e.charCodeAt(0)),0)>>>0).toString()}function Hm(t,e,i,n){if(`${n}radius`in t&&"icon-"!==n){let r=km(i,t[`${n}radius`],Hl);if(`${n}radius2`in t){r=`max(${r}, ${km(i,t[`${n}radius2`],Hl)})`}`${n}stroke-width`in t&&(r=`(${r} + ${km(i,t[`${n}stroke-width`],Hl)} * 0.5)`),e.setSymbolSizeExpression(`vec2(${r} * 2. + 0.5)`)}if(`${n}scale`in t){const r=km(i,t[`${n}scale`],Ql);e.setSymbolSizeExpression(`${e.getSymbolSizeExpression()} * ${r}`)}`${n}displacement`in t&&e.setSymbolOffsetExpression(km(i,t[`${n}displacement`],Jl)),`${n}rotation`in t&&e.setSymbolRotationExpression(km(i,t[`${n}rotation`],Hl)),`${n}rotate-with-view`in t&&e.setSymbolRotateWithView(!!t[`${n}rotate-with-view`])}function Km(t,e,i,n,r){let s="vec4(0.)";if(null!==e&&(s=e),null!==i&&null!==n){s=`mix(${i}, ${s}, ${`smoothstep(-${n} + 0.63, -${n} - 0.58, ${t})`})`}let o=`${s} * vec4(1.0, 1.0, 1.0, ${`(1.0 - smoothstep(-0.63, 0.58, ${t}))`})`;return null!==r&&(o=`${o} * vec4(1.0, 1.0, 1.0, ${r})`),o}function qm(t,e,i,n,r){const s=new Image;s.crossOrigin=void 0===t[`${n}cross-origin`]?"anonymous":t[`${n}cross-origin`],Mt("string"==typeof t[`${n}src`],`WebGL layers do not support expressions for the ${n}src style property`),s.src=t[`${n}src`],i[`u_texture${r}_size`]=()=>s.complete?[s.width,s.height]:[0,0],e.addUniform(`u_texture${r}_size`,"vec2");const o=`u_texture${r}_size`;return i[`u_texture${r}`]=s,e.addUniform(`u_texture${r}`,"sampler2D"),o}function Jm(t,e,i,n,r){let s=km(i,t[`${e}offset`],Ql);if(`${e}offset-origin`in t)switch(t[`${e}offset-origin`]){case"top-right":s=`vec2(${n}.x, 0.) + ${r} * vec2(-1., 0.) + ${s} * vec2(-1., 1.)`;break;case"bottom-left":s=`vec2(0., ${n}.y) + ${r} * vec2(0., -1.) + ${s} * vec2(1., -1.)`;break;case"bottom-right":s=`${n} - ${r} - ${s}`}return s}function Qm(t,e,i){const n={variables:{},properties:{},functions:{},bandCount:0,featureId:!1,geometryType:!1},r=new Zm,s={};if("icon-src"in t?function(t,e,i,n){let r="vec4(1.0)";"icon-color"in t&&(r=km(n,t["icon-color"],ql)),"icon-opacity"in t&&(r=`${r} * vec4(1.0, 1.0, 1.0, ${km(n,t["icon-opacity"],Hl)})`);const s=Ym(t["icon-src"]),o=qm(t,e,i,"icon-",s);if(e.setSymbolColorExpression(`${r} * texture2D(u_texture${s}, v_texCoord)`).setSymbolSizeExpression(o),"icon-width"in t&&"icon-height"in t&&e.setSymbolSizeExpression(`vec2(${km(n,t["icon-width"],Hl)}, ${km(n,t["icon-height"],Hl)})`),"icon-offset"in t&&"icon-size"in t){const i=km(n,t["icon-size"],Jl),r=e.getSymbolSizeExpression();e.setSymbolSizeExpression(i);const s=Jm(t,"icon-",n,"v_quadSizePx",i);e.setTextureCoordinateExpression(`(vec4((${s}).xyxy) + vec4(0., 0., ${i})) / (${r}).xyxy`)}if(Hm(t,e,n,"icon-"),"icon-anchor"in t){const i=km(n,t["icon-anchor"],Jl);let r,s="1.0";"icon-scale"in t&&(s=km(n,t["icon-scale"],Ql)),r="pixels"===t["icon-anchor-x-units"]&&"pixels"===t["icon-anchor-y-units"]?`${i} * ${s}`:"pixels"===t["icon-anchor-x-units"]?`${i} * vec2(vec2(${s}).x, v_quadSizePx.y)`:"pixels"===t["icon-anchor-y-units"]?`${i} * vec2(v_quadSizePx.x, vec2(${s}).x)`:`${i} * v_quadSizePx`;let o=`v_quadSizePx * vec2(0.5, -0.5) + ${r} * vec2(-1., 1.)`;if("icon-anchor-origin"in t)switch(t["icon-anchor-origin"]){case"top-right":o=`v_quadSizePx * -0.5 + ${r}`;break;case"bottom-left":o=`v_quadSizePx * 0.5 - ${r}`;break;case"bottom-right":o=`v_quadSizePx * vec2(-0.5, 0.5) + ${r} * vec2(1., -1.)`}e.setSymbolOffsetExpression(`${e.getSymbolOffsetExpression()} + ${o}`)}}(t,r,s,n):"shape-points"in t?function(t,e,i,n){n.functions.round="float round(float v) {\n return sign(v) * floor(abs(v) + 0.5);\n}",n.functions.starDistanceField="float starDistanceField(vec2 point, float numPoints, float radius, float radius2, float angle) {\n float startAngle = -PI * 0.5 + angle; // tip starts upwards and rotates clockwise with angle\n float c = cos(startAngle);\n float s = sin(startAngle);\n vec2 pointRotated = vec2(c * point.x - s * point.y, s * point.x + c * point.y);\n float alpha = TWO_PI / numPoints; // the angle of one sector\n float beta = atan(pointRotated.y, pointRotated.x);\n float gamma = round(beta / alpha) * alpha; // angle in sector\n c = cos(-gamma);\n s = sin(-gamma);\n vec2 inSector = vec2(c * pointRotated.x - s * pointRotated.y, abs(s * pointRotated.x + c * pointRotated.y));\n vec2 tipToPoint = inSector + vec2(-radius, 0.);\n vec2 edgeNormal = vec2(radius2 * sin(alpha * 0.5), -radius2 * cos(alpha * 0.5) + radius);\n return dot(normalize(edgeNormal), tipToPoint);\n}",n.functions.regularDistanceField="float regularDistanceField(vec2 point, float numPoints, float radius, float angle) {\n float startAngle = -PI * 0.5 + angle; // tip starts upwards and rotates clockwise with angle\n float c = cos(startAngle);\n float s = sin(startAngle);\n vec2 pointRotated = vec2(c * point.x - s * point.y, s * point.x + c * point.y);\n float alpha = TWO_PI / numPoints; // the angle of one sector\n float radiusIn = radius * cos(PI / numPoints);\n float beta = atan(pointRotated.y, pointRotated.x);\n float gamma = round((beta - alpha * 0.5) / alpha) * alpha + alpha * 0.5; // angle in sector from mid\n c = cos(-gamma);\n s = sin(-gamma);\n vec2 inSector = vec2(c * pointRotated.x - s * pointRotated.y, abs(s * pointRotated.x + c * pointRotated.y));\n return inSector.x - radiusIn;\n}",Hm(t,e,n,"shape-");let r=null;"shape-opacity"in t&&(r=km(n,t["shape-opacity"],Hl));let s="coordsPx";"shape-scale"in t&&(s=`coordsPx / ${km(n,t["shape-scale"],Ql)}`);let o=null;"shape-fill-color"in t&&(o=km(n,t["shape-fill-color"],ql));let a=null;"shape-stroke-color"in t&&(a=km(n,t["shape-stroke-color"],ql));let l=null;"shape-stroke-width"in t&&(l=km(n,t["shape-stroke-width"],Hl));const h=km(n,t["shape-points"],Hl);let c,u="0.";"shape-angle"in t&&(u=km(n,t["shape-angle"],Hl));let d=km(n,t["shape-radius"],Hl);if(null!==l&&(d=`${d} + ${l} * 0.5`),"shape-radius2"in t){let e=km(n,t["shape-radius2"],Hl);null!==l&&(e=`${e} + ${l} * 0.5`),c=`starDistanceField(${s}, ${h}, ${d}, ${e}, ${u})`}else c=`regularDistanceField(${s}, ${h}, ${d}, ${u})`;const g=Km(c,o,a,l,r);e.setSymbolColorExpression(g)}(t,r,0,n):"circle-radius"in t&&function(t,e,i,n){n.functions.circleDistanceField="float circleDistanceField(vec2 point, float radius) {\n return length(point) - radius;\n}",Hm(t,e,n,"circle-");let r=null;"circle-opacity"in t&&(r=km(n,t["circle-opacity"],Hl));let s="coordsPx";"circle-scale"in t&&(s=`coordsPx / ${km(n,t["circle-scale"],Ql)}`);let o=null;"circle-fill-color"in t&&(o=km(n,t["circle-fill-color"],ql));let a=null;"circle-stroke-color"in t&&(a=km(n,t["circle-stroke-color"],ql));let l=km(n,t["circle-radius"],Hl),h=null;"circle-stroke-width"in t&&(h=km(n,t["circle-stroke-width"],Hl),l=`(${l} + ${h} * 0.5)`);const c=Km(`circleDistanceField(${s}, ${l})`,o,a,h,r);e.setSymbolColorExpression(c)}(t,r,0,n),function(t,e,i,n){if("stroke-color"in t&&e.setStrokeColorExpression(km(n,t["stroke-color"],ql)),"stroke-pattern-src"in t){const r=Ym(t["stroke-pattern-src"]),s=qm(t,e,i,"stroke-pattern-",r);let o=s,a="vec2(0.)";"stroke-pattern-offset"in t&&"stroke-pattern-size"in t&&(o=km(n,t["stroke-pattern-size"],Jl),a=Jm(t,"stroke-pattern-",n,s,o));let l="0.";"stroke-pattern-spacing"in t&&(l=km(n,t["stroke-pattern-spacing"],Hl));let h="0.";"stroke-pattern-start-offset"in t&&(h=km(n,t["stroke-pattern-start-offset"],Hl)),n.functions.sampleStrokePattern="vec4 sampleStrokePattern(sampler2D texture, vec2 textureSize, vec2 textureOffset, vec2 sampleSize, float spacingPx, float startOffsetPx, float currentLengthPx, float currentRadiusRatio, float lineWidth) {\n float currentLengthScaled = (currentLengthPx - startOffsetPx) * sampleSize.y / lineWidth;\n float spacingScaled = spacingPx * sampleSize.y / lineWidth;\n float uCoordPx = mod(currentLengthScaled, (sampleSize.x + spacingScaled));\n float isInsideOfPattern = step(uCoordPx, sampleSize.x);\n float vCoordPx = (-currentRadiusRatio * 0.5 + 0.5) * sampleSize.y;\n // make sure that we're not sampling too close to the borders to avoid interpolation with outside pixels\n uCoordPx = clamp(uCoordPx, 0.5, sampleSize.x - 0.5);\n vCoordPx = clamp(vCoordPx, 0.5, sampleSize.y - 0.5);\n vec2 texCoord = (vec2(uCoordPx, vCoordPx) + textureOffset) / textureSize;\n return texture2D(texture, texCoord) * vec4(1.0, 1.0, 1.0, isInsideOfPattern);\n}";const c=`u_texture${r}`;let u="1.";"stroke-color"in t&&(u=e.getStrokeColorExpression()),e.setStrokeColorExpression(`${u} * sampleStrokePattern(${c}, ${s}, ${a}, ${o}, ${l}, ${h}, currentLengthPx, currentRadiusRatio, v_width)`),n.functions.computeStrokePatternLength="float computeStrokePatternLength(vec2 sampleSize, float spacingPx, float lineWidth) {\n float patternLengthPx = sampleSize.x / sampleSize.y * lineWidth;\n return patternLengthPx + spacingPx;\n}",e.setStrokePatternLengthExpression(`computeStrokePatternLength(${o}, ${l}, v_width)`)}if("stroke-width"in t&&e.setStrokeWidthExpression(km(n,t["stroke-width"],Hl)),"stroke-offset"in t&&e.setStrokeOffsetExpression(km(n,t["stroke-offset"],Hl)),"stroke-line-cap"in t&&e.setStrokeCapExpression(km(n,t["stroke-line-cap"],Kl)),"stroke-line-join"in t&&e.setStrokeJoinExpression(km(n,t["stroke-line-join"],Kl)),"stroke-miter-limit"in t&&e.setStrokeMiterLimitExpression(km(n,t["stroke-miter-limit"],Hl)),"stroke-line-dash"in t){n.functions.getSingleDashDistance=`float getSingleDashDistance(float distance, float radius, float dashOffset, float dashLength, float dashLengthTotal, float capType, float lineWidth) {\n float localDistance = mod(distance, dashLengthTotal);\n float distanceSegment = abs(localDistance - dashOffset - dashLength * 0.5) - dashLength * 0.5;\n distanceSegment = min(distanceSegment, dashLengthTotal - localDistance);\n if (capType == ${$_("square")}) {\n distanceSegment -= lineWidth * 0.5;\n } else if (capType == ${$_("round")}) {\n distanceSegment = min(distanceSegment, sqrt(distanceSegment * distanceSegment + radius * radius) - lineWidth * 0.5);\n }\n return distanceSegment;\n}`;let i=t["stroke-line-dash"].map((t=>km(n,t,Hl)));i.length%2==1&&(i=[...i,...i]);let r="0.";"stroke-line-dash-offset"in t&&(r=km(n,t["stroke-line-dash-offset"],Hl));const s=`dashDistanceField_${Ym(t["stroke-line-dash"])}`,o=i.map(((t,e)=>`float dashLength${e}`)).join(", "),a=i.map(((t,e)=>`dashLength${e}`)).join(" + ");let l="0.",h=`getSingleDashDistance(distance, radius, ${l}, dashLength0, totalDashLength, capType, lineWidth)`;for(let t=2;t<i.length;t+=2)l=`${l} + dashLength${t-2} + dashLength${t-1}`,h=`min(${h}, getSingleDashDistance(distance, radius, ${l}, dashLength${t}, totalDashLength, capType, lineWidth))`;n.functions[s]=`float ${s}(float distance, float radius, float capType, float lineWidth, ${o}) {\n float totalDashLength = ${a};\n return ${h};\n}`;const c=i.map(((t,e)=>`${t}`)).join(", ");e.setStrokeDistanceFieldExpression(`${s}(currentLengthPx + ${r}, currentRadiusPx, capType, v_width, ${c})`);let u=i.join(" + ");e.getStrokePatternLengthExpression()&&(n.functions.combinePatternLengths="float combinePatternLengths(float patternLength1, float patternLength2) {\n return patternLength1 * patternLength2;\n}",u=`combinePatternLengths(${e.getStrokePatternLengthExpression()}, ${u})`),e.setStrokePatternLengthExpression(u)}}(t,r,s,n),function(t,e,i,n){if("fill-color"in t&&e.setFillColorExpression(km(n,t["fill-color"],ql)),"fill-pattern-src"in t){const r=Ym(t["fill-pattern-src"]),s=qm(t,e,i,"fill-pattern-",r);let o=s,a="vec2(0.)";"fill-pattern-offset"in t&&"fill-pattern-size"in t&&(o=km(n,t["fill-pattern-size"],Jl),a=Jm(t,"fill-pattern-",n,s,o)),n.functions.sampleFillPattern="vec4 sampleFillPattern(sampler2D texture, vec2 textureSize, vec2 textureOffset, vec2 sampleSize, vec2 pxOrigin, vec2 pxPosition) {\n float scaleRatio = pow(2., mod(u_zoom + 0.5, 1.) - 0.5);\n vec2 pxRelativePos = pxPosition - pxOrigin;\n // rotate the relative position from origin by the current view rotation\n pxRelativePos = vec2(pxRelativePos.x * cos(u_rotation) - pxRelativePos.y * sin(u_rotation), pxRelativePos.x * sin(u_rotation) + pxRelativePos.y * cos(u_rotation));\n // sample position is computed according to the sample offset & size\n vec2 samplePos = mod(pxRelativePos / scaleRatio, sampleSize);\n // also make sure that we're not sampling too close to the borders to avoid interpolation with outside pixels\n samplePos = clamp(samplePos, vec2(0.5), sampleSize - vec2(0.5));\n samplePos.y = sampleSize.y - samplePos.y; // invert y axis so that images appear upright\n return texture2D(texture, (samplePos + textureOffset) / textureSize);\n}";const l=`u_texture${r}`;let h="1.";"fill-color"in t&&(h=e.getFillColorExpression()),e.setFillColorExpression(`${h} * sampleFillPattern(${l}, ${s}, ${a}, ${o}, pxOrigin, pxPos)`)}}(t,r,s,n),i){const t=km(n,i,Yl);r.setFragmentDiscardExpression(`!${t}`)}const o={};function a(t,e,i,s){if(!n[t])return;const a=Bm(i),l=Um(i);r.addAttribute(`a_${e}`,a),o[e]={size:l,callback:s}}return a("geometryType",q_,Kl,(t=>V_(vh(t.getGeometry())))),a("featureId",K_,Kl|Hl,(t=>{const e=t.getId()??null;return"string"==typeof e?V_(e):e})),zm(r,n),{builder:r,attributes:{...o,...Vm(n)},uniforms:{...s,...Xm(n,e)}}}const ty=[];let ey;function iy(){return ey||(ey=D_()),ey}let ny=0;const ry="a_position",sy="a_localPosition",oy="a_segmentStart",ay="a_segmentEnd",ly="a_measureStart",hy="a_measureEnd",cy="a_angleTangentSum",uy="a_joinAngles",dy="a_distanceLow",gy="a_distanceHigh";class fy{constructor(t,e,i,n){this.helper_,this.hitDetectionEnabled_=!!n,this.styleShaders=py(t,e),this.customAttributes_={},this.uniforms_={},this.hitDetectionEnabled_&&(this.customAttributes_.hitColor={callback(){return A_(this.ref,ty)},size:2});for(const t of this.styleShaders){for(const e in t.attributes)e in this.customAttributes_||(this.customAttributes_[e]=t.attributes[e]);for(const e in t.uniforms)e in this.uniforms_||(this.uniforms_[e]=t.uniforms[e])}this.renderPasses_=this.styleShaders.map((t=>{const e={},i=Object.entries(this.customAttributes_).map((([e,i])=>({name:e in t.attributes||"hitColor"===e?`a_${e}`:null,size:i.size||1,type:Bp})));return t.builder.getFillVertexShader()&&(e.fillRenderPass={vertexShader:t.builder.getFillVertexShader(),fragmentShader:t.builder.getFillFragmentShader(),attributesDesc:[{name:ry,size:2,type:Bp},...i],instancedAttributesDesc:[],instancePrimitiveVertexCount:3}),t.builder.getStrokeVertexShader()&&(e.strokeRenderPass={vertexShader:t.builder.getStrokeVertexShader(),fragmentShader:t.builder.getStrokeFragmentShader(),attributesDesc:[{name:sy,size:2,type:Bp}],instancedAttributesDesc:[{name:oy,size:2,type:Bp},{name:ly,size:1,type:Bp},{name:ay,size:2,type:Bp},{name:hy,size:1,type:Bp},{name:uy,size:2,type:Bp},{name:dy,size:1,type:Bp},{name:gy,size:1,type:Bp},{name:cy,size:1,type:Bp},...i],instancePrimitiveVertexCount:6}),t.builder.getSymbolVertexShader()&&(e.symbolRenderPass={vertexShader:t.builder.getSymbolVertexShader(),fragmentShader:t.builder.getSymbolFragmentShader(),attributesDesc:[{name:sy,size:2,type:Bp}],instancedAttributesDesc:[{name:ry,size:2,type:Bp},...i],instancePrimitiveVertexCount:6}),e})),this.hasFill_=this.renderPasses_.some((t=>t.fillRenderPass)),this.hasStroke_=this.renderPasses_.some((t=>t.strokeRenderPass)),this.hasSymbol_=this.renderPasses_.some((t=>t.symbolRenderPass)),this.setHelper(i)}async generateBuffers(t,e){if(t.isEmpty())return null;const i=this.generateRenderInstructions_(t,e),[n,r,s]=await Promise.all([this.generateBuffersForType_(i.polygonInstructions,"Polygon",e),this.generateBuffersForType_(i.lineStringInstructions,"LineString",e),this.generateBuffersForType_(i.pointInstructions,"Point",e)]);return{polygonBuffers:n,lineStringBuffers:r,pointBuffers:s,invertVerticesTransform:rr([1,0,0,1,0,0],e)}}generateRenderInstructions_(t,e){return{polygonInstructions:this.hasFill_?am(t.polygonBatch,new Float32Array(0),this.customAttributes_,e):null,lineStringInstructions:this.hasStroke_?om(t.lineStringBatch,new Float32Array(0),this.customAttributes_,e):null,pointInstructions:this.hasSymbol_?sm(t.pointBatch,new Float32Array(0),this.customAttributes_,e):null}}generateBuffersForType_(t,e,i){if(null===t)return null;const n=ny++;let r;switch(e){case"Polygon":r=F_;break;case"LineString":r=M_;break;case"Point":r=L_}const s={id:n,type:r,renderInstructions:t.buffer,renderInstructionsTransform:i,customAttributesSize:rm(this.customAttributes_)},o=iy();return o.postMessage(s,[t.buffer]),t=null,new Promise((t=>{const e=i=>{const r=i.data;if(r.id!==n)return;if(o.removeEventListener("message",e),!this.helper_.getGL())return;const s=new Mp(qf,Qf).fromArrayBuffer(r.indicesBuffer),a=new Mp(Kf,Qf).fromArrayBuffer(r.vertexAttributesBuffer),l=new Mp(Kf,Qf).fromArrayBuffer(r.instanceAttributesBuffer);this.helper_.flushBufferData(s),this.helper_.flushBufferData(a),this.helper_.flushBufferData(l),t([s,a,l])};o.addEventListener("message",e)}))}render(t,e,i){for(const n of this.renderPasses_)n.fillRenderPass&&this.renderInternal_(t.polygonBuffers[0],t.polygonBuffers[1],t.polygonBuffers[2],n.fillRenderPass,e,i),n.strokeRenderPass&&this.renderInternal_(t.lineStringBuffers[0],t.lineStringBuffers[1],t.lineStringBuffers[2],n.strokeRenderPass,e,i),n.symbolRenderPass&&this.renderInternal_(t.pointBuffers[0],t.pointBuffers[1],t.pointBuffers[2],n.symbolRenderPass,e,i)}renderInternal_(t,e,i,n,r,s){const o=t.getSize();if(0===o)return;const a=n.instancedAttributesDesc.length;if(this.helper_.useProgram(n.program,r),this.helper_.bindBuffer(e),this.helper_.bindBuffer(t),this.helper_.enableAttributes(n.attributesDesc),this.helper_.bindBuffer(i),this.helper_.enableAttributesInstanced(n.instancedAttributesDesc),s(),a){const t=n.instancedAttributesDesc.reduce(((t,e)=>t+(e.size||1)),0),e=i.getSize()/t;this.helper_.drawElementsInstanced(0,o,e)}else this.helper_.drawElements(0,o)}setHelper(t,e=null){this.helper_=t;for(const t of this.renderPasses_)t.fillRenderPass&&(t.fillRenderPass.program=this.helper_.getProgram(t.fillRenderPass.fragmentShader,t.fillRenderPass.vertexShader)),t.strokeRenderPass&&(t.strokeRenderPass.program=this.helper_.getProgram(t.strokeRenderPass.fragmentShader,t.strokeRenderPass.vertexShader)),t.symbolRenderPass&&(t.symbolRenderPass.program=this.helper_.getProgram(t.symbolRenderPass.fragmentShader,t.symbolRenderPass.vertexShader));this.helper_.addUniforms(this.uniforms_),e&&(e.polygonBuffers&&(this.helper_.flushBufferData(e.polygonBuffers[0]),this.helper_.flushBufferData(e.polygonBuffers[1]),this.helper_.flushBufferData(e.polygonBuffers[2])),e.lineStringBuffers&&(this.helper_.flushBufferData(e.lineStringBuffers[0]),this.helper_.flushBufferData(e.lineStringBuffers[1]),this.helper_.flushBufferData(e.lineStringBuffers[2])),e.pointBuffers&&(this.helper_.flushBufferData(e.pointBuffers[0]),this.helper_.flushBufferData(e.pointBuffers[1]),this.helper_.flushBufferData(e.pointBuffers[2])))}}function py(t,e){const i=Array.isArray(t)?t:[t];if("style"in i[0]){const t=[],n=i,r=[];for(const i of n){const n=Array.isArray(i.style)?i.style:[i.style];let s=i.filter;i.else&&r.length&&(s=["all",...r.map((t=>["!",t]))],i.filter&&s.push(i.filter),s.length<3&&(s=s[1])),i.filter&&r.push(i.filter);const o=n.map((t=>Qm(t,e,s)));t.push(...o)}return t}return"builder"in i[0]?i:i.map((t=>Qm(t,e,null)))}const _y={...kp,RENDER_EXTENT:"u_renderExtent",PATTERN_ORIGIN:"u_patternOrigin",GLOBAL_ALPHA:"u_globalAlpha"};class my extends d_{constructor(t,e){super(t,{uniforms:{[_y.RENDER_EXTENT]:[0,0,0,0],[_y.PATTERN_ORIGIN]:[0,0],[_y.GLOBAL_ALPHA]:1},postProcesses:e.postProcesses}),this.hitDetectionEnabled_=!e.disableHitDetection,this.hitRenderTarget_,this.sourceRevision_=-1,this.previousExtent_=[1/0,1/0,-1/0,-1/0],this.currentTransform_=[1,0,0,1,0,0],this.tmpCoords_=[0,0],this.tmpTransform_=[1,0,0,1,0,0],this.tmpMat4_=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],this.currentFrameStateTransform_=[1,0,0,1,0,0],this.styleVariables_={},this.style_=[],this.styleRenderer_=null,this.buffers_=null,this.applyOptions_(e),this.batch_=new qp,this.initialFeaturesAdded_=!1,this.sourceListenKeys_=null}addInitialFeatures_(t){const e=this.getLayer().getSource(),i=Gn();let n;i&&(n=Ln(i,t.viewState.projection)),this.batch_.addFeatures(e.getFeatures(),n),this.sourceListenKeys_=[D(e,Xd,this.handleSourceFeatureAdded_.bind(this,n)),D(e,Vd,this.handleSourceFeatureChanged_.bind(this,n),this),D(e,Wd,this.handleSourceFeatureDelete_,this),D(e,$d,this.handleSourceFeatureClear_,this)]}applyOptions_(t){this.styleVariables_=t.variables,this.style_=t.style}createRenderers_(){this.buffers_=null,this.styleRenderer_=new fy(this.style_,this.styleVariables_,this.helper,this.hitDetectionEnabled_)}reset(t){this.applyOptions_(t),this.helper&&this.createRenderers_(),super.reset(t)}afterHelperCreated(){this.styleRenderer_?this.styleRenderer_.setHelper(this.helper,this.buffers_):this.createRenderers_(),this.hitDetectionEnabled_&&(this.hitRenderTarget_=new Kp(this.helper))}handleSourceFeatureAdded_(t,e){const i=e.feature;this.batch_.addFeature(i,t)}handleSourceFeatureChanged_(t,e){const i=e.feature;this.batch_.changeFeature(i,t)}handleSourceFeatureDelete_(t){const e=t.feature;this.batch_.removeFeature(e)}handleSourceFeatureClear_(){this.batch_.clear()}applyUniforms_(t){Jn(this.tmpTransform_,this.currentFrameStateTransform_),Kn(this.tmpTransform_,t),this.helper.setUniformMatrixValue(_y.PROJECTION_MATRIX,Qd(this.tmpMat4_,this.tmpTransform_)),rr(this.tmpTransform_,this.tmpTransform_),this.helper.setUniformMatrixValue(_y.SCREEN_TO_WORLD_MATRIX,Qd(this.tmpMat4_,this.tmpTransform_)),this.tmpCoords_[0]=0,this.tmpCoords_[1]=0,rr(this.tmpTransform_,t),Qn(this.tmpTransform_,this.tmpCoords_),this.helper.setUniformFloatVec2(_y.PATTERN_ORIGIN,this.tmpCoords_)}renderFrame(t){const e=this.helper.getGL();this.preRender(e,t);const[i,n,r]=N_(t,this.getLayer());this.helper.prepareDraw(t),this.renderWorlds(t,!1,i,n,r),this.helper.finalizeDraw(t,this.dispatchPreComposeEvent,this.dispatchPostComposeEvent);const s=this.helper.getCanvas();return this.hitDetectionEnabled_&&(this.renderWorlds(t,!0,i,n,r),this.hitRenderTarget_.clearCachedData()),this.postRender(e,t),s}prepareFrameInternal(t){this.initialFeaturesAdded_||(this.addInitialFeatures_(t),this.initialFeaturesAdded_=!0);const e=this.getLayer(),i=e.getSource(),n=t.viewState,r=!t.viewHints[co]&&!t.viewHints[uo],s=!te(this.previousExtent_,t.extent),o=this.sourceRevision_<i.getRevision();if(o&&(this.sourceRevision_=i.getRevision()),r&&(s||o)){const r=n.projection,s=n.resolution,o=e instanceof zc?e.getRenderBuffer():0,a=zt(t.extent,o*s),l=Gn();l?i.loadFeatures(Bn(a,l),Xn(s,r),l):i.loadFeatures(a,s,r),this.ready=!1;const h=this.helper.makeProjectionTransform(t,[1,0,0,1,0,0]);this.styleRenderer_.generateBuffers(this.batch_,h).then((t=>{this.buffers_&&this.disposeBuffers(this.buffers_),this.buffers_=t,this.ready=!0,this.getLayer().changed()})),this.previousExtent_=t.extent.slice()}return!0}renderWorlds(t,e,i,n,r){let s=i;e&&(this.hitRenderTarget_.setSize([Math.floor(t.size[0]/2),Math.floor(t.size[1]/2)]),this.helper.prepareDrawToRenderTarget(t,this.hitRenderTarget_,!0));do{this.helper.makeProjectionTransform(t,this.currentFrameStateTransform_),ir(this.currentFrameStateTransform_,s*r,0),this.buffers_&&this.styleRenderer_.render(this.buffers_,t,(()=>{this.applyUniforms_(this.buffers_.invertVerticesTransform),this.helper.applyHitDetectionUniform(e)}))}while(++s<n)}forEachFeatureAtCoordinate(t,e,i,n,r){if(Mt(this.hitDetectionEnabled_,"`forEachFeatureAtCoordinate` cannot be used on a WebGL layer if the hit detection logic has been disabled using the `disableHitDetection: true` option."),!this.styleRenderer_||!this.hitDetectionEnabled_)return;const s=Qn(e.coordinateToPixelTransform,t.slice()),o=this.hitRenderTarget_.readPixel(s[0]/2,s[1]/2),a=O_([o[0]/255,o[1]/255,o[2]/255,o[3]/255]),l=this.batch_.getFeatureFromRef(a);return l?n(l,this.getLayer(),null):void 0}disposeBuffers(t){const e=t=>{for(const e of t)e&&this.helper.deleteBuffer(e)};t.pointBuffers&&e(t.pointBuffers),t.lineStringBuffers&&e(t.lineStringBuffers),t.polygonBuffers&&e(t.polygonBuffers)}disposeInternal(){this.buffers_&&this.disposeBuffers(this.buffers_),this.sourceListenKeys_&&(this.sourceListenKeys_.forEach((function(t){k(t)})),this.sourceListenKeys_=null),super.disposeInternal()}renderDeclutter(){}}const yy={...g_,TILE_MASK_TEXTURE:"u_depthMask",TILE_ZOOM_LEVEL:"u_tileZoomLevel"},xy={POSITION:"a_position"};class vy extends v_{constructor(t,e){super(t,{cacheSize:e.cacheSize,uniforms:{[yy.PATTERN_ORIGIN]:[0,0],[yy.TILE_MASK_TEXTURE]:()=>this.tileMaskTarget_.getTexture()}}),this.hitDetectionEnabled_=!e.disableHitDetection,this.style_=null,this.styleVariables_=e.variables||{},this.styleRenderer_=null,this.currentFrameStateTransform_=[1,0,0,1,0,0],this.tmpTransform_=[1,0,0,1,0,0],this.tmpMat4_=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],this.tileMaskTarget_=null,this.tileMaskIndices_=new Mp(qf,Jf),this.tileMaskIndices_.fromArray([0,1,3,1,2,3]),this.tileMaskAttributes_=[{name:xy.POSITION,size:2,type:Bp}],this.tileMaskProgram_,this.applyOptions_(e)}reset(t){super.reset(t),this.applyOptions_(t),this.helper&&(this.createRenderers_(),this.initTileMask_())}applyOptions_(t){this.style_=t.style}createRenderers_(){function t(t){const e=t.getFragmentDiscardExpression(),i=`texture2D(${yy.TILE_MASK_TEXTURE}, gl_FragCoord.xy / u_pixelRatio / u_viewportSizePx).r * 50. > ${yy.TILE_ZOOM_LEVEL} + 0.5`;t.setFragmentDiscardExpression("false"!==e?`(${e}) || (${i})`:i),t.addUniform(yy.TILE_MASK_TEXTURE,"sampler2D"),t.addUniform(yy.TILE_ZOOM_LEVEL,"float")}const e=py(this.style_,this.styleVariables_);for(const i of e)t(i.builder);this.styleRenderer_=new fy(e,this.styleVariables_,this.helper,this.hitDetectionEnabled_)}initTileMask_(){this.tileMaskTarget_=new Kp(this.helper);const t=(new Zm).setFillColorExpression(`vec4(${yy.TILE_ZOOM_LEVEL} / 50., 0., 0., 1.)`).addUniform(yy.TILE_ZOOM_LEVEL,"float");this.tileMaskProgram_=this.helper.getProgram(t.getFillFragmentShader(),t.getFillVertexShader()),this.helper.flushBufferData(this.tileMaskIndices_)}afterHelperCreated(){this.createRenderers_(),this.initTileMask_()}createTileRepresentation(t){const e=new Jp(t,this.styleRenderer_),i=()=>{e.ready&&(this.getLayer().changed(),e.removeEventListener(n,i))};return e.addEventListener(n,i),e}beforeTilesRender(t,e){super.beforeTilesRender(t,!0),this.helper.makeProjectionTransform(t,this.currentFrameStateTransform_)}beforeTilesMaskRender(t){this.helper.makeProjectionTransform(t,this.currentFrameStateTransform_);const e=t.pixelRatio,i=t.size;return this.tileMaskTarget_.setSize([i[0]*e,i[1]*e]),this.helper.prepareDrawToRenderTarget(t,this.tileMaskTarget_,!0,!0),this.helper.useProgram(this.tileMaskProgram_,t),Jn(this.tmpTransform_,this.currentFrameStateTransform_),this.helper.setUniformMatrixValue(yy.PROJECTION_MATRIX,Qd(this.tmpMat4_,this.tmpTransform_)),rr(this.tmpTransform_,this.currentFrameStateTransform_),this.helper.setUniformMatrixValue(yy.SCREEN_TO_WORLD_MATRIX,Qd(this.tmpMat4_,this.tmpTransform_)),!0}renderTileMask(t,e,i,n){if(!t.ready)return;this.helper.setUniformFloatValue(yy.DEPTH,n),this.helper.setUniformFloatValue(yy.TILE_ZOOM_LEVEL,e),this.helper.setUniformFloatVec4(yy.RENDER_EXTENT,i),this.helper.setUniformFloatValue(yy.GLOBAL_ALPHA,1),this.helper.bindBuffer(t.maskVertices),this.helper.bindBuffer(this.tileMaskIndices_),this.helper.enableAttributes(this.tileMaskAttributes_);const r=this.tileMaskIndices_.getSize();this.helper.drawElements(0,r)}applyUniforms_(t,e,i,n,r){Jn(this.tmpTransform_,this.currentFrameStateTransform_),Kn(this.tmpTransform_,i),this.helper.setUniformMatrixValue(yy.PROJECTION_MATRIX,Qd(this.tmpMat4_,this.tmpTransform_)),rr(this.tmpTransform_,this.currentFrameStateTransform_),this.helper.setUniformMatrixValue(yy.SCREEN_TO_WORLD_MATRIX,Qd(this.tmpMat4_,this.tmpTransform_)),this.helper.setUniformFloatValue(yy.GLOBAL_ALPHA,t),this.helper.setUniformFloatValue(yy.DEPTH,r),this.helper.setUniformFloatValue(yy.TILE_ZOOM_LEVEL,n),this.helper.setUniformFloatVec4(yy.RENDER_EXTENT,e)}renderTile(t,e,i,n,r,s,o,a,l,h,c){const u=me(a,n,a),d=t.tile.getTileCoord()[0],g=t.buffers;g&&this.styleRenderer_.render(g,i,(()=>{this.applyUniforms_(c,u,g.invertVerticesTransform,d,l)}))}renderDeclutter(t){}disposeInternal(){super.disposeInternal()}}const Sy=0,Ey=1,wy=2,Ty=3,Cy=4,by=5,Ry=6,Py=7,Iy=8,Fy=9,Ly=10,My=11,Ay=12,Oy=[Iy],Dy=[Ay],Ny=[Ey],ky=[Ty];class Gy extends yu{constructor(t,e,i,n){super(),this.tolerance=t,this.maxExtent=e,this.pixelRatio=n,this.maxLineWidth=0,this.resolution=i,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_=null,this.bufferedMaxExtent_=null,this.instructions=[],this.coordinates=[],this.tmpCoordinate_=[],this.hitDetectionInstructions=[],this.state={}}applyPixelRatio(t){const e=this.pixelRatio;return 1==e?t:t.map((function(t){return t*e}))}appendFlatPointCoordinates(t,e){const i=this.getBufferedMaxExtent(),n=this.tmpCoordinate_,r=this.coordinates;let s=r.length;for(let o=0,a=t.length;o<a;o+=e)n[0]=t[o],n[1]=t[o+1],$t(i,n)&&(r[s++]=n[0],r[s++]=n[1]);return s}appendFlatLineCoordinates(t,e,i,n,r,s){const o=this.coordinates;let a=o.length;const l=this.getBufferedMaxExtent();s&&(e+=n);let h=t[e],c=t[e+1];const u=this.tmpCoordinate_;let d,g,f,p=!0;for(d=e+n;d<i;d+=n)u[0]=t[d],u[1]=t[d+1],f=Yt(l,u),f!==g?(p&&(o[a++]=h,o[a++]=c,p=!1),o[a++]=u[0],o[a++]=u[1]):f===Nt?(o[a++]=u[0],o[a++]=u[1],p=!1):p=!0,h=u[0],c=u[1],g=f;return(r&&p||d===e+n)&&(o[a++]=h,o[a++]=c),a}drawCustomCoordinates_(t,e,i,n,r){for(let s=0,o=i.length;s<o;++s){const o=i[s],a=this.appendFlatLineCoordinates(t,e,o,n,!1,!1);r.push(a),e=o}return e}drawCustom(t,e,i,n,r){this.beginGeometry(t,e,r);const s=t.getType(),o=t.getStride(),a=this.coordinates.length;let l,h,c,u,d;switch(s){case"MultiPolygon":l=t.getOrientedFlatCoordinates(),u=[];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),u.push(i)}this.instructions.push([Cy,a,u,t,i,kr,r]),this.hitDetectionInstructions.push([Cy,a,u,t,n||i,kr,r]);break;case"Polygon":case"MultiLineString":c=[],l="Polygon"==s?t.getOrientedFlatCoordinates():t.getFlatCoordinates(),d=this.drawCustomCoordinates_(l,0,t.getEnds(),o,c),this.instructions.push([Cy,a,c,t,i,Nr,r]),this.hitDetectionInstructions.push([Cy,a,c,t,n||i,Nr,r]);break;case"LineString":case"Circle":l=t.getFlatCoordinates(),h=this.appendFlatLineCoordinates(l,0,l.length,o,!1,!1),this.instructions.push([Cy,a,h,t,i,Dr,r]),this.hitDetectionInstructions.push([Cy,a,h,t,n||i,Dr,r]);break;case"MultiPoint":l=t.getFlatCoordinates(),h=this.appendFlatPointCoordinates(l,o),h>a&&(this.instructions.push([Cy,a,h,t,i,Dr,r]),this.hitDetectionInstructions.push([Cy,a,h,t,n||i,Dr,r]));break;case"Point":l=t.getFlatCoordinates(),this.coordinates.push(l[0],l[1]),h=this.coordinates.length,this.instructions.push([Cy,a,h,t,i,void 0,r]),this.hitDetectionInstructions.push([Cy,a,h,t,n||i,void 0,r])}this.endGeometry(e)}beginGeometry(t,e,i){this.beginGeometryInstruction1_=[Sy,e,0,t,i],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[Sy,e,0,t,i],this.hitDetectionInstructions.push(this.beginGeometryInstruction2_)}finish(){return{instructions:this.instructions,hitDetectionInstructions:this.hitDetectionInstructions,coordinates:this.coordinates}}reverseHitDetectionInstructions(){const t=this.hitDetectionInstructions;let e;t.reverse();const i=t.length;let n,r,s=-1;for(e=0;e<i;++e)n=t[e],r=n[0],r==Py?s=e:r==Sy&&(n[2]=e,S(this.hitDetectionInstructions,s,e),s=-1)}fillStyleToState(t,e={}){if(t){const i=t.getColor();e.fillPatternScale=i&&"object"==typeof i&&"src"in i?this.pixelRatio:1,e.fillStyle=Mh(i||Oh)}else e.fillStyle=void 0;return e}strokeStyleToState(t,e={}){if(t){const i=t.getColor();e.strokeStyle=Mh(i||jh);const n=t.getLineCap();e.lineCap=void 0!==n?n:Dh;const r=t.getLineDash();e.lineDash=r?r.slice():Nh;const s=t.getLineDashOffset();e.lineDashOffset=s||0;const o=t.getLineJoin();e.lineJoin=void 0!==o?o:kh;const a=t.getWidth();e.lineWidth=void 0!==a?a:1;const l=t.getMiterLimit();e.miterLimit=void 0!==l?l:Gh;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=[Ly,e];return"string"!=typeof e&&i.push(t.fillPatternScale),i}applyStroke(t){this.instructions.push(this.createStroke(t))}createStroke(t){return[My,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;"string"==typeof i&&t.currentFillStyle==i||(this.instructions.push(e.call(this,t)),t.currentFillStyle=i)}updateStrokeStyle(t,e){const i=t.strokeStyle,n=t.lineCap,r=t.lineDash,s=t.lineDashOffset,o=t.lineJoin,a=t.lineWidth,l=t.miterLimit,h=t.strokeOffset;(t.currentStrokeStyle!=i||t.currentLineCap!=n||r!=t.currentLineDash&&!w(t.currentLineDash,r)||t.currentLineDashOffset!=s||t.currentLineJoin!=o||t.currentLineWidth!=a||t.currentMiterLimit!=l||t.currentStrokeOffset!=h)&&(e.call(this,t),t.currentStrokeStyle=i,t.currentLineCap=n,t.currentLineDash=r,t.currentLineDashOffset=s,t.currentLineJoin=o,t.currentLineWidth=a,t.currentMiterLimit=l,t.currentStrokeOffset=h)}endGeometry(t){this.beginGeometryInstruction1_[2]=this.instructions.length,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_[2]=this.hitDetectionInstructions.length,this.beginGeometryInstruction2_=null;const e=[Py,t];this.instructions.push(e),this.hitDetectionInstructions.push(e)}getBufferedMaxExtent(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=Xt(this.maxExtent),this.maxLineWidth>0)){const t=this.resolution*(this.maxLineWidth+1)/2;zt(this.bufferedMaxExtent_,t,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_}}class jy extends Gy{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&&!$t(this.maxExtent,t.getFlatCoordinates()))return;this.beginGeometry(t,e,i);const n=t.getFlatCoordinates(),r=t.getStride(),s=this.coordinates.length,o=this.appendFlatPointCoordinates(n,r);this.instructions.push([Ry,s,o,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_*this.imagePixelRatio_,this.originY_*this.imagePixelRatio_,this.rotateWithView_,this.rotation_,[this.scale_[0]*this.pixelRatio/this.imagePixelRatio_,this.scale_[1]*this.pixelRatio/this.imagePixelRatio_],Math.ceil(this.width_*this.imagePixelRatio_),this.declutterMode_,this.declutterImageWithText_]),this.hitDetectionInstructions.push([Ry,s,o,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,1,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(e)}drawMultiPoint(t,e,i){if(!this.image_)return;this.beginGeometry(t,e,i);const n=t.getFlatCoordinates(),r=[];for(let e=0,i=n.length;e<i;e+=t.getStride())this.maxExtent&&!$t(this.maxExtent,n.slice(e,e+2))||r.push(n[e],n[e+1]);const s=this.coordinates.length,o=this.appendFlatPointCoordinates(r,2);this.instructions.push([Ry,s,o,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_*this.imagePixelRatio_,this.originY_*this.imagePixelRatio_,this.rotateWithView_,this.rotation_,[this.scale_[0]*this.pixelRatio/this.imagePixelRatio_,this.scale_[1]*this.pixelRatio/this.imagePixelRatio_],Math.ceil(this.width_*this.imagePixelRatio_),this.declutterMode_,this.declutterImageWithText_]),this.hitDetectionInstructions.push([Ry,s,o,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,1,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(e)}finish(){return this.reverseHitDetectionInstructions(),this.anchorX_=void 0,this.anchorY_=void 0,this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.height_=void 0,this.scale_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.width_=void 0,super.finish()}setImageStyle(t,e){const i=t.getAnchor(),n=t.getSize(),r=t.getOrigin();this.imagePixelRatio_=t.getPixelRatio(this.pixelRatio),this.anchorX_=i[0],this.anchorY_=i[1],this.hitDetectionImage_=t.getHitDetectionImage(),this.image_=t.getImage(this.pixelRatio),this.height_=n[1],this.opacity_=t.getOpacity(),this.originX_=r[0],this.originY_=r[1],this.rotateWithView_=t.getRotateWithView(),this.rotation_=t.getRotation(),this.scale_=t.getScaleArray(),this.width_=n[0],this.declutterMode_=t.getDeclutterMode(),this.declutterImageWithText_=e}}class Uy extends Gy{constructor(t,e,i,n){super(t,e,i,n)}drawFlatCoordinates_(t,e,i,n,r){const s=this.coordinates.length,o=this.appendFlatLineCoordinates(t,e,i,n,!1,!1);return this.instructions.push([Fy,s,o,r*this.pixelRatio]),this.hitDetectionInstructions.push([Fy,s,o,r]),i}drawLineString(t,e,i){const n=this.state,r=n.strokeStyle,s=n.lineWidth,o=n.strokeOffset;if(void 0===r||void 0===s)return;this.updateStrokeStyle(n,this.applyStroke),this.beginGeometry(t,e,i),this.hitDetectionInstructions.push([My,n.strokeStyle,n.lineWidth,n.lineCap,n.lineJoin,n.miterLimit,Nh,0],Ny);const a=t.getFlatCoordinates(),l=t.getStride();this.drawFlatCoordinates_(a,0,a.length,l,o),this.hitDetectionInstructions.push(Dy),this.endGeometry(e)}drawMultiLineString(t,e,i){const n=this.state,r=n.strokeStyle,s=n.lineWidth,o=n.strokeOffset;if(void 0===r||void 0===s)return;this.updateStrokeStyle(n,this.applyStroke),this.beginGeometry(t,e,i),this.hitDetectionInstructions.push([My,n.strokeStyle,n.lineWidth,n.lineCap,n.lineJoin,n.miterLimit,Nh,0],Ny);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(Dy),this.endGeometry(e)}finish(){const t=this.state;return null!=t.lastStroke&&t.lastStroke!=this.coordinates.length&&this.instructions.push(Dy),this.reverseHitDetectionInstructions(),this.state=null,super.finish()}applyStroke(t){null!=t.lastStroke&&t.lastStroke!=this.coordinates.length&&(this.instructions.push(Dy),t.lastStroke=this.coordinates.length),t.lastStroke=0,super.applyStroke(t),this.instructions.push(Ny)}}class By extends Gy{constructor(t,e,i,n){super(t,e,i,n)}drawFlatCoordinatess_(t,e,i,n,r){const s=this.state,o=void 0!==s.fillStyle,a=void 0!==s.strokeStyle,l=i.length;this.instructions.push(Ny),this.hitDetectionInstructions.push(Ny);for(let s=0;s<l;++s){const o=i[s],l=this.coordinates.length,h=this.appendFlatLineCoordinates(t,e,o,n,!0,!a);this.instructions.push([Fy,l,h,r*this.pixelRatio,!0]),this.hitDetectionInstructions.push([Fy,l,h,r,!0]),a&&(this.instructions.push(ky),this.hitDetectionInstructions.push(ky)),e=o}return o&&(this.instructions.push(Oy),this.hitDetectionInstructions.push(Oy)),a&&(this.instructions.push(Dy),this.hitDetectionInstructions.push(Dy)),e}drawCircle(t,e,i){const n=this.state,r=n.fillStyle,s=n.strokeStyle,o=n.strokeOffset;if(void 0===r&&void 0===s)return;if(this.handleStrokeOffset_((()=>this.drawCircle(t,e,i))))return;this.setFillStrokeStyles_(),this.beginGeometry(t,e,i),void 0!==n.fillStyle&&this.hitDetectionInstructions.push([Ly,Oh]),void 0!==n.strokeStyle&&this.hitDetectionInstructions.push([My,n.strokeStyle,n.lineWidth,n.lineCap,n.lineJoin,n.miterLimit,Nh,0]);const a=t.getFlatCoordinates(),l=t.getStride(),h=this.coordinates.length;this.appendFlatLineCoordinates(a,0,a.length,l,!1,!1);const c=[wy,h,o];this.instructions.push(Ny,c),this.hitDetectionInstructions.push(Ny,c),void 0!==n.fillStyle&&(this.instructions.push(Oy),this.hitDetectionInstructions.push(Oy)),void 0!==n.strokeStyle&&(this.instructions.push(Dy),this.hitDetectionInstructions.push(Dy)),this.endGeometry(e)}drawPolygon(t,e,i){const n=this.state,r=n.fillStyle,s=n.strokeStyle,o=n.strokeOffset;if(void 0===r&&void 0===s)return;if(this.handleStrokeOffset_((()=>this.drawPolygon(t,e,i))))return;this.setFillStrokeStyles_(),this.beginGeometry(t,e,i),void 0!==n.fillStyle&&this.hitDetectionInstructions.push([Ly,Oh]),void 0!==n.strokeStyle&&this.hitDetectionInstructions.push([My,n.strokeStyle,n.lineWidth,n.lineCap,n.lineJoin,n.miterLimit,Nh,0]);const a=t.getEnds(),l=t.getOrientedFlatCoordinates(),h=t.getStride();this.drawFlatCoordinatess_(l,0,a,h,o),this.endGeometry(e)}drawMultiPolygon(t,e,i){const n=this.state,r=n.fillStyle,s=n.strokeStyle,o=n.strokeOffset;if(void 0===r&&void 0===s)return;if(this.handleStrokeOffset_((()=>this.drawMultiPolygon(t,e,i))))return;this.setFillStrokeStyles_(),this.beginGeometry(t,e,i),void 0!==n.fillStyle&&this.hitDetectionInstructions.push([Ly,Oh]),void 0!==n.strokeStyle&&this.hitDetectionInstructions.push([My,n.strokeStyle,n.lineWidth,n.lineCap,n.lineJoin,n.miterLimit,Nh,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]=Br(e[i],t)}return super.finish()}setFillStrokeStyles_(){const t=this.state;this.updateFillStyle(t,this.createFill),this.updateStrokeStyle(t,this.applyStroke)}handleStrokeOffset_(t){const e=this.state,i=e.fillStyle,n=e.strokeStyle,r=e.strokeOffset;return Math.abs(r)>0&&void 0!==i&&void 0!==n&&(e.strokeStyle=void 0,e.strokeOffset=0,t(),e.fillStyle=void 0,e.strokeStyle=n,e.strokeOffset=r,t(),e.fillStyle=i,!0)}}function zy(t,e,i,n,r){const s=[];let o=i,a=0,l=e.slice(i,2);for(;a<t&&o+r<n;){const[i,n]=l.slice(-2),h=e[o+r],c=e[o+r+1],u=Math.sqrt((h-i)*(h-i)+(c-n)*(c-n));if(a+=u,a>=t){const e=(t-a+u)/u,d=Ne(i,h,e),g=Ne(n,c,e);l.push(d,g),s.push(l),l=[d,g],a==t&&(o+=r),a=0}else if(a<t)l.push(e[o+r],e[o+r+1]),o+=r;else{const t=u-a,e=Ne(i,h,t/u),d=Ne(n,c,t/u);l.push(e,d),s.push(l),l=[e,d],a=0,o+=r}}return a>0&&s.push(l),s}function Xy(t,e,i,n,r){let s,o,a,l,h,c,u,d,g,f,p=i,_=i,m=0,y=0,x=i;for(o=i;o<n;o+=r){const i=e[o],n=e[o+1];void 0!==h&&(g=i-h,f=n-c,l=Math.sqrt(g*g+f*f),void 0!==u&&(y+=a,s=Math.acos((u*g+d*f)/(a*l)),s>t&&(y>m&&(m=y,p=x,_=o),y=0,x=o-r)),a=l,u=g,d=f),h=i,c=n}return y+=l,y>m?[x,o]:[p,_]}const Vy={left:0,center:.5,right:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1};class $y extends Gy{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[Oh]={fillStyle:Oh},this.textStrokeState_=null,this.strokeStates={},this.textState_={},this.textStates={},this.textKey_="",this.fillKey_="",this.strokeKey_="",this.declutterMode_=void 0,this.declutterImageWithText_=void 0}finish(){const t=super.finish();return t.textStates=this.textStates,t.fillStates=this.fillStates,t.strokeStates=this.strokeStates,t}drawText(t,e,i){const n=this.textFillState_,r=this.textStrokeState_,s=this.textState_;if(""===this.text_||!s||!n&&!r)return;const o=this.coordinates;let a=o.length;const l=t.getType();let h=null,c=t.getStride();if("line"!==s.placement||"LineString"!=l&&"MultiLineString"!=l&&"Polygon"!=l&&"MultiPolygon"!=l){let n=s.overflow?null:[];switch(l){case"Point":case"MultiPoint":h=t.getFlatCoordinates();break;case"LineString":h=t.getFlatMidpoint();break;case"Circle":h=t.getCenter();break;case"MultiLineString":h=t.getFlatMidpoints(),c=2;break;case"Polygon":h=t.getFlatInteriorPoint(),s.overflow||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)s.overflow||n.push(e[t+2]/this.resolution),h.push(e[t],e[t+1]);if(0===h.length)return;c=2}const r=this.appendFlatPointCoordinates(h,c);if(r===a)return;if(n&&(r-a)/2!=h.length/c){let t=a/2;n=n.filter(((e,i)=>{const n=o[2*(t+i)]===h[i*c]&&o[2*(t+i)+1]===h[i*c+1];return n||--t,n}))}this.saveTextStates_();const u=s.backgroundFill?this.createFill(this.fillStyleToState(s.backgroundFill)):null,d=s.backgroundStroke?this.createStroke(this.strokeStyleToState(s.backgroundStroke)):null;this.beginGeometry(t,e,i);let g=s.padding;if(g!=zh&&(s.scale[0]<0||s.scale[1]<0)){let t=s.padding[0],e=s.padding[1],i=s.padding[2],n=s.padding[3];s.scale[0]<0&&(e=-e,n=-n),s.scale[1]<0&&(t=-t,i=-i),g=[t,e,i,n]}const f=this.pixelRatio;this.instructions.push([Ry,a,r,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[1,1],NaN,this.declutterMode_,this.declutterImageWithText_,g==zh?zh:g.map((function(t){return t*f})),u,d,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,n]);const p=1/f,_=u?u.slice(0):null;_&&(_[1]=Oh),this.hitDetectionInstructions.push([Ry,a,r,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[p,p],NaN,this.declutterMode_,this.declutterImageWithText_,g,_,d,this.text_,this.textKey_,this.strokeKey_,this.fillKey_?Oh:this.fillKey_,this.textOffsetX_,this.textOffsetY_,n]),this.endGeometry(e)}else{if(!Se(this.maxExtent,t.getExtent()))return;let n;if(h=t.getFlatCoordinates(),"LineString"==l)n=[h.length];else if("MultiLineString"==l)n=t.getEnds();else if("Polygon"==l)n=t.getEnds().slice(0,1);else if("MultiPolygon"==l){const e=t.getEndss();n=[];for(let t=0,i=e.length;t<i;++t)n.push(e[t][0])}this.beginGeometry(t,e,i);const r=s.repeat,u=r?void 0:s.textAlign;let d=0;for(let t=0,e=n.length;t<e;++t){let e;e=r?zy(r*this.resolution,h,d,n[t],c):[h.slice(d,n[t])];for(let i=0,r=e.length;i<r;++i){const r=e[i];let l=0,h=r.length;if(null==u){const t=Xy(s.maxAngle,r,0,r.length,2);l=t[0],h=t[1]}for(let t=l;t<h;t+=c)o.push(r[t],r[t+1]);const g=o.length;d=n[t],this.drawChars_(a,g),a=g}}this.endGeometry(e)}}saveTextStates_(){const t=this.textStrokeState_,e=this.textState_,i=this.textFillState_,n=this.strokeKey_;t&&(n in this.strokeStates||(this.strokeStates[n]={strokeStyle:t.strokeStyle,lineCap:t.lineCap,lineDashOffset:t.lineDashOffset,lineWidth:t.lineWidth,lineJoin:t.lineJoin,miterLimit:t.miterLimit,lineDash:t.lineDash}));const r=this.textKey_;r in this.textStates||(this.textStates[r]={font:e.font,textAlign:e.textAlign||Uh,justify:e.justify,textBaseline:e.textBaseline||Bh,scale:e.scale});const s=this.fillKey_;i&&(s in this.fillStates||(this.fillStates[s]={fillStyle:i.fillStyle}))}drawChars_(t,e){const i=this.textStrokeState_,n=this.textState_,r=this.strokeKey_,s=this.textKey_,o=this.fillKey_;this.saveTextStates_();const a=this.pixelRatio,l=Vy[n.textBaseline],h=this.textOffsetY_*a,c=this.text_,u=i?i.lineWidth*Math.abs(n.scale[0])/2:0;this.instructions.push([by,t,e,l,n.overflow,o,n.maxAngle,a,h,r,u*a,c,s,1,this.declutterMode_,this.textKeepUpright_]),this.hitDetectionInstructions.push([by,t,e,l,n.overflow,o?Oh:o,n.maxAngle,a,h,r,u*a,c,s,1/a,this.declutterMode_,this.textKeepUpright_])}setTextStyle(t,e){let i,n,r;if(t){const e=t.getFill();e?(n=this.textFillState_,n||(n={},this.textFillState_=n),n.fillStyle=Mh(e.getColor()||Oh)):(n=null,this.textFillState_=n);const s=t.getStroke();if(s){r=this.textStrokeState_,r||(r={},this.textStrokeState_=r);const t=s.getLineDash(),e=s.getLineDashOffset(),i=s.getWidth(),n=s.getMiterLimit();r.lineCap=s.getLineCap()||Dh,r.lineDash=t?t.slice():Nh,r.lineDashOffset=void 0===e?0:e,r.lineJoin=s.getLineJoin()||kh,r.lineWidth=void 0===i?1:i,r.miterLimit=void 0===n?Gh:n,r.strokeStyle=Mh(s.getColor()||jh)}else r=null,this.textStrokeState_=r;i=this.textState_;const o=t.getFont()||Ah;Hh(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()||Bh,i.backgroundFill=t.getBackgroundFill(),i.backgroundStroke=t.getBackgroundStroke(),i.padding=t.getPadding()||zh,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_=r?("string"==typeof r.strokeStyle?r.strokeStyle:z(r.strokeStyle))+r.lineCap+r.lineDashOffset+"|"+r.lineWidth+r.lineJoin+r.miterLimit+"["+r.lineDash.join()+"]":"",this.textKey_=i.font+i.scale+(i.textAlign||"?")+(i.repeat||"?")+(i.justify||"?")+(i.textBaseline||"?"),this.fillKey_=n&&n.fillStyle?"string"==typeof n.fillStyle?n.fillStyle:"|"+z(n.fillStyle):""}else this.text_="";this.declutterMode_=t.getDeclutterMode(),this.declutterImageWithText_=e}}const Wy={Circle:By,Default:Gy,Image:jy,LineString:Uy,Polygon:By,Text:$y};class Zy{constructor(t,e,i,n){this.tolerance_=t,this.maxExtent_=e,this.pixelRatio_=n,this.resolution_=i,this.buildersByZIndex_={}}finish(){const t={};for(const e in this.buildersByZIndex_){t[e]=t[e]||{};const i=this.buildersByZIndex_[e];for(const n in i){const r=i[n].finish();t[e][n]=r}}return t}getBuilder(t,e){const i=void 0!==t?t.toString():"0";let n=this.buildersByZIndex_[i];void 0===n&&(n={},this.buildersByZIndex_[i]=n);let r=n[e];if(void 0===r){r=new(0,Wy[e])(this.tolerance_,this.maxExtent_,this.resolution_,this.pixelRatio_),n[e]=r}return r}}function Yy(t,e,i,n,r,s,o,a,l,h,c,u,d=!0){let g=t[e],f=t[e+1],p=0,_=0,m=0,y=0;function x(){p=g,_=f,g=t[e+=n],f=t[e+1],y+=m,m=Math.sqrt((g-p)*(g-p)+(f-_)*(f-_))}do{x()}while(e<i-n&&y+m<s);let v=0===m?0:(s-y)/m;const S=Ne(p,g,v),E=Ne(_,f,v),w=e-n,T=y,C=s+a*l(h,r,c);for(;e<i-n&&y+m<C;)x();v=0===m?0:(C-y)/m;const b=Ne(p,g,v),R=Ne(_,f,v);let P=!1;if(d)if(u){const t=[S,E,b,R];ur(t,0,4,2,u,t,t),P=t[0]>t[2]}else P=S>b;const I=Math.PI,F=[],L=w+n===e;let M;if(m=0,y=T,g=t[e=w],f=t[e+1],L){x(),M=Math.atan2(f-_,g-p),P&&(M+=M>0?-I:I);const t=(b+S)/2,e=(R+E)/2;return F[0]=[t,e,(C-s)/2,M,r],F}for(let t=0,u=(r=r.replace(/\n/g," ")).length;t<u;){x();let d=Math.atan2(f-_,g-p);if(P&&(d+=d>0?-I:I),void 0!==M){let t=d-M;if(t+=t>I?-2*I:t<-I?2*I:0,Math.abs(t)>o)return null}M=d;const S=t;let E=0;for(;t<u;++t){const o=a*l(h,r[P?u-t-1:t],c);if(e+n<i&&y+m<s+E+o/2)break;E+=o}if(t===S)continue;const w=P?r.substring(u-S,u-t):r.substring(S,t);v=0===m?0:(s+E/2-y)/m;const T=Ne(p,g,v),C=Ne(_,f,v);F.push([T,C,E/2,d,w]),s+=E}return F}const Hy=[1/0,1/0,-1/0,-1/0],Ky=[],qy=[],Jy=[],Qy=[];function tx(t){return t[3].declutterBox}const ex=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 ix(t,e){return"start"===e?e=ex.test(t)?"right":"left":"end"===e&&(e=ex.test(t)?"left":"right"),Vy[e]}function nx(t,e,i){return i>0&&t.push("\n",""),t.push(e,""),t}function rx(t,e,i){return i%2==0&&(t+=e),t}class sx{constructor(t,e,i,n,r){this.overlaps=i,this.pixelRatio=e,this.resolution=t,this.alignAndScaleFill_,this.instructions=n.instructions,this.coordinates=n.coordinates,this.coordinateCache_={},this.renderedTransform_=[1,0,0,1,0,0],this.hitDetectionInstructions=n.hitDetectionInstructions,this.pixelCoordinates_=null,this.viewRotation_=0,this.fillStates=n.fillStates||{},this.strokeStates=n.strokeStates||{},this.textStates=n.textStates||{},this.widths_={},this.labels_={},this.zIndexContext_=r?new Sf:null}getZIndexContext(){return this.zIndexContext_}createLabel(t,e,i,n){const r=t+e+i+n;if(this.labels_[r])return this.labels_[r];const s=n?this.strokeStates[n]:null,o=i?this.fillStates[i]:null,a=this.textStates[e],l=this.pixelRatio,h=[a.scale[0]*l,a.scale[1]*l],c=a.justify?Vy[a.justify]:ix(Array.isArray(t)?t[0]:t,a.textAlign||Uh),u=n&&s.lineWidth?s.lineWidth:0,d=Array.isArray(t)?t:String(t).split("\n").reduce(nx,[]),{width:g,height:f,widths:p,heights:_,lineWidths:m}=tc(a,d),y=g+u,x=[],v=(y+2)*h[0],S=(f+u)*h[1],E={width:v<0?Math.floor(v):Math.ceil(v),height:S<0?Math.floor(S):Math.ceil(S),contextInstructions:x};1==h[0]&&1==h[1]||x.push("scale",h),n&&(x.push("strokeStyle",s.strokeStyle),x.push("lineWidth",u),x.push("lineCap",s.lineCap),x.push("lineJoin",s.lineJoin),x.push("miterLimit",s.miterLimit),x.push("setLineDash",[s.lineDash]),x.push("lineDashOffset",s.lineDashOffset)),i&&x.push("fillStyle",o.fillStyle),x.push("textBaseline","middle"),x.push("textAlign","center");const w=.5-c;let T=c*y+w*u;const C=[],b=[];let R,P=0,I=0,F=0,L=0;for(let t=0,e=d.length;t<e;t+=2){const e=d[t];if("\n"===e){I+=P,P=0,T=c*y+w*u,++L;continue}const r=d[t+1]||a.font;r!==R&&(n&&C.push("font",r),i&&b.push("font",r),R=r),P=Math.max(P,_[F]);const s=[e,T+w*p[F]+c*(p[F]-m[L]),.5*(u+P)+I];T+=p[F],n&&C.push("strokeText",s),i&&b.push("fillText",s),++F}return Array.prototype.push.apply(x,C),Array.prototype.push.apply(x,b),this.labels_[r]=E,E}replayTextBackground_(t,e,i,n,r,s,o){t.beginPath(),t.moveTo.apply(t,e),t.lineTo.apply(t,i),t.lineTo.apply(t,n),t.lineTo.apply(t,r),t.lineTo.apply(t,e),s&&(this.alignAndScaleFill_=s[2],t.fillStyle=s[1],this.fill_(t)),o&&(this.setStrokeStyle_(t,o),t.stroke())}calculateImageOrLabelDimensions_(t,e,i,n,r,s,o,a,l,h,c,u,d,g,f,p){let _=i-(o*=u[0]),m=n-(a*=u[1]);const y=r+l>t?t-l:r,x=s+h>e?e-h:s,v=g[3]+y*u[0]+g[1],S=g[0]+x*u[1]+g[2],E=_-g[3],w=m-g[0];let T;return(f||0!==c)&&(Ky[0]=E,Qy[0]=E,Ky[1]=w,qy[1]=w,qy[0]=E+v,Jy[0]=qy[0],Jy[1]=w+S,Qy[1]=Jy[1]),0!==c?(T=nr([1,0,0,1,0,0],i,n,1,1,c,-i,-n),Qn(T,Ky),Qn(T,qy),Qn(T,Jy),Qn(T,Qy),Kt(Math.min(Ky[0],qy[0],Jy[0],Qy[0]),Math.min(Ky[1],qy[1],Jy[1],Qy[1]),Math.max(Ky[0],qy[0],Jy[0],Qy[0]),Math.max(Ky[1],qy[1],Jy[1],Qy[1]),Hy)):Kt(Math.min(E,E+v),Math.min(w,w+S),Math.max(E,E+v),Math.max(w,w+S),Hy),d&&(_=Math.round(_),m=Math.round(m)),{drawImageX:_,drawImageY:m,drawImageW:y,drawImageH:x,originX:l,originY:h,declutterBox:{minX:Hy[0],minY:Hy[1],maxX:Hy[2],maxY:Hy[3],value:p},canvasTransform:T,scale:u}}replayImageOrLabel_(t,e,i,n,r,s,o){const a=!(!s&&!o),l=n.declutterBox,h=o?o[2]*n.scale[0]/2:0;return l.minX-h<=e[0]&&l.maxX+h>=0&&l.minY-h<=e[1]&&l.maxY+h>=0&&(a&&this.replayTextBackground_(t,Ky,qy,Jy,Qy,s,o),ec(t,n.canvasTransform,r,i,n.originX,n.originY,n.drawImageW,n.drawImageH,n.drawImageX,n.drawImageY,n.scale)),!0}fill_(t){const e=this.alignAndScaleFill_;if(e){const i=Qn(this.renderedTransform_,[0,0]),n=512*this.pixelRatio;t.save(),t.translate(i[0]%n,i[1]%n),1!==e&&t.scale(e,e)}t.fill(),e&&t.restore()}setStrokeStyle_(t,e){t.strokeStyle=e[1],e[1]&&(t.lineWidth=e[2],t.lineCap=e[3],t.lineJoin=e[4],t.miterLimit=e[5],t.lineDashOffset=e[7],t.setLineDash(e[6]))}drawLabelWithPointPlacement_(t,e,i,n){const r=this.textStates[e],s=this.createLabel(t,e,n,i),o=this.strokeStates[i],a=this.pixelRatio,l=ix(Array.isArray(t)?t[0]:t,r.textAlign||Uh),h=Vy[r.textBaseline||Bh],c=o&&o.lineWidth?o.lineWidth:0;return{label:s,anchorX:l*(s.width/a-2*r.scale[0])+2*(.5-l)*c,anchorY:h*s.height/a+2*(.5-h)*c}}execute_(t,e,i,n,r,s,o,a){const l=this.zIndexContext_;let h;this.pixelCoordinates_&&w(i,this.renderedTransform_)?h=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),h=cr(this.coordinates,0,this.coordinates.length,2,i,this.pixelCoordinates_),Jn(this.renderedTransform_,i));let c=0;const u=n.length;let d,g,f,p,_,m,y,x,v,S,E,T,C,b,R,P,I=0,F=0,L=0;const M=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},N=this.instructions!=n||this.overlaps?0:200;let k,G,j,U;for(;c<u;){const i=n[c];switch(i[0]){case Sy:k=i[1],U=i[3],k.getGeometry()?void 0===o||Se(o,U.getExtent())?++c:c=i[2]+1:c=i[2],l&&(l.zIndex=i[4]);break;case Ey:F>N&&(this.fill_(t),F=0),L>N&&(t.stroke(),L=0),F||L||(t.beginPath(),x=NaN,v=NaN),++c;break;case wy:I=i[1],p=i[2]??0;const n=h[I],u=h[I+1],w=h[I+2]-p-n,B=h[I+3]-p-u,z=Math.sqrt(w*w+B*B);t.moveTo(n+z,u),t.arc(n,u,z,0,2*Math.PI,!0),++c;break;case Ty:t.closePath(),++c;break;case Cy:I=i[1],d=i[2];const X=i[3],V=i[4],$=i[5];D.geometry=X,D.feature=k,c in M||(M[c]=[]);const W=M[c];$?$(h,I,d,2,W):(W[0]=h[I],W[1]=h[I+1],W.length=2),l&&(l.zIndex=i[6]),V(W,D),++c;break;case Ry:I=i[1],d=i[2],T=i[3],g=i[4],f=i[5];let Z=i[6];const Y=i[7],H=i[8],K=i[9],q=i[10];let J=i[11];const Q=i[12];let tt=i[13];y=i[14]||"declutter";const et=i[15];if(!T&&i.length>=20){C=i[19],b=i[20],R=i[21],P=i[22];const t=this.drawLabelWithPointPlacement_(C,b,R,P);T=t.label,i[3]=T;const e=i[23];g=(t.anchorX-e)*this.pixelRatio,i[4]=g;const n=i[24];f=(t.anchorY-n)*this.pixelRatio,i[5]=f,Z=T.height,i[6]=Z,tt=T.width,i[13]=tt}let it,nt,rt,st;i.length>25&&(it=i[25]),i.length>17?(nt=i[16],rt=i[17],st=i[18]):(nt=zh,rt=null,st=null),q&&O?J+=A:q||O||(J-=A);let ot=0;for(;I<d;I+=2){if(it&&it[ot++]<tt/this.pixelRatio)continue;const i=this.calculateImageOrLabelDimensions_(T.width,T.height,h[I],h[I+1],tt,Z,g,f,H,K,J,Q,r,nt,!!rt||!!st,k),n=[t,e,T,i,Y,rt,st];if(a){let t,e,r,s,o;if(et){const i=d-I;if(!et[i]){et[i]={args:n,declutterMode:y};continue}const s=et[i];t=s.args,e=s.declutterMode,delete et[i],r=tx(t)}if(!t||"declutter"===e&&a.collides(r)||(s=!0),"declutter"===y&&a.collides(i.declutterBox)||(o=!0),"declutter"===e&&"declutter"===y){const t=s&&o;s=t,o=t}s&&("none"!==e&&a.insert(r),this.replayImageOrLabel_.apply(this,t)),o&&("none"!==y&&a.insert(i.declutterBox),this.replayImageOrLabel_.apply(this,n))}else this.replayImageOrLabel_.apply(this,n)}++c;break;case by:const at=i[1],lt=i[2],ht=i[3],ct=i[4];P=i[5];const ut=i[6],dt=i[7],gt=i[8];R=i[9];const ft=i[10];C=i[11],Array.isArray(C)&&(C=C.reduce(rx,"")),b=i[12];const pt=[i[13],i[13]];y=i[14]||"declutter";const _t=i[15],mt=this.textStates[b],yt=mt.font,xt=[mt.scale[0]*dt,mt.scale[1]*dt];let vt;yt in this.widths_?vt=this.widths_[yt]:(vt={},this.widths_[yt]=vt);const St=Od(h,at,lt,2),Et=Math.abs(xt[0])*Qh(yt,C,vt);if(ct||Et<=St){const i=Yy(h,at,lt,2,C,(St-Et)*ix(C,this.textStates[b].textAlign),ut,Math.abs(xt[0]),Qh,yt,vt,O?0:this.viewRotation_,_t);t:if(i){const n=[];let r,s,o,l,h;if(R)for(r=0,s=i.length;r<s;++r){h=i[r],o=h[4],l=this.createLabel(o,b,"",R),g=h[2]+(xt[0]<0?-ft:ft),f=ht*l.height+2*(.5-ht)*ft*xt[1]/xt[0]-gt;const s=this.calculateImageOrLabelDimensions_(l.width,l.height,h[0],h[1],l.width,l.height,g,f,0,0,h[3],pt,!1,zh,!1,k);if(a&&"declutter"===y&&a.collides(s.declutterBox))break t;n.push([t,e,l,s,1,null,null])}if(P)for(r=0,s=i.length;r<s;++r){h=i[r],o=h[4],l=this.createLabel(o,b,P,""),g=h[2],f=ht*l.height-gt;const s=this.calculateImageOrLabelDimensions_(l.width,l.height,h[0],h[1],l.width,l.height,g,f,0,0,h[3],pt,!1,zh,!1,k);if(a&&"declutter"===y&&a.collides(s.declutterBox))break t;n.push([t,e,l,s,1,null,null])}a&&"none"!==y&&a.load(n.map(tx));for(let t=0,e=n.length;t<e;++t)this.replayImageOrLabel_.apply(this,n[t])}}++c;break;case Py:if(void 0!==s){k=i[1];const t=s(k,U,y);if(t)return t}++c;break;case Iy:N?F++:this.fill_(t),++c;break;case Fy:for(I=i[1],d=i[2],p=i[3],_=i[4]??!1,G=h[I],j=h[I+1],p&&(m=I,[G,j]=mu(G,j,_?h[d-4]:void 0,_?h[d-3]:void 0,h[I+2],h[I+3],p)),t.moveTo(G,j),x=G+.5|0,v=j+.5|0,I+=2;I<d;I+=2)G=h[I],j=h[I+1],S=G+.5|0,E=j+.5|0,I!=d-2&&S===x&&E===v||(p&&([G,j]=I==d-2?mu(G,j,h[I-2],h[I-1],_?h[m+2]:void 0,_?h[m+3]:void 0,p):mu(G,j,h[I-2],h[I-1],h[I+2],h[I+3],p)),t.lineTo(G,j),x=S,v=E);++c;break;case Ly:this.alignAndScaleFill_=i[2],F&&(this.fill_(t),F=0,L&&(t.stroke(),L=0)),t.fillStyle=i[1],++c;break;case My:L&&(t.stroke(),L=0),this.setStrokeStyle_(t,i),++c;break;case Ay:N?L++:t.stroke(),++c;break;default:++c}}F&&this.fill_(t),L&&t.stroke()}execute(t,e,i,n,r,s){this.viewRotation_=n,this.execute_(t,e,i,this.instructions,r,void 0,void 0,s)}executeHitDetection(t,e,i,n,r){return this.viewRotation_=i,this.execute_(t,[t.canvas.width,t.canvas.height],e,this.hitDetectionInstructions,!0,n,r)}}const ox=["Polygon","Circle","LineString","Image","Text","Default"],ax=["Image","Text"],lx=ox.filter((t=>!ax.includes(t)));let hx=!1,cx=!1;class ux{constructor(t,e,i,n,r,s,o){this.maxExtent_=t,this.overlaps_=n,this.pixelRatio_=i,this.resolution_=e,this.renderBuffer_=s,this.executorsByZIndex_={},this.hitDetectionContext_=null,this.hitDetectionTransform_=[1,0,0,1,0,0],this.renderedContext_=null,this.deferredZIndexContexts_={},this.createExecutors_(r,o)}clip(t,e){const i=this.getClipCoords(e);t.beginPath(),t.moveTo(i[0],i[1]),t.lineTo(i[2],i[3]),t.lineTo(i[4],i[5]),t.lineTo(i[6],i[7]),t.clip()}createExecutors_(t,e){for(const i in t){let n=this.executorsByZIndex_[i];void 0===n&&(n={},this.executorsByZIndex_[i]=n);const r=t[i];for(const t in r){const i=r[t];n[t]=new sx(this.resolution_,this.pixelRatio_,this.overlaps_,i,e)}}}hasExecutors(t){for(const e in this.executorsByZIndex_){const i=this.executorsByZIndex_[e];for(let e=0,n=t.length;e<n;++e)if(t[e]in i)return!0}return!1}forEachFeatureAtCoordinate(t,e,i,n,r,s){!1===cx&&function(){let t=0;const e=e=>{const i=ft(1,1,null,{willReadFrequently:e});let n=0;const r=performance.now();for(;performance.now()-r<50;++n)i.fillStyle=`rgba(255,0,${n%256},1)`,i.fillRect(0,0,1,1),i.getImageData(0,0,1,1);return t=n>t?n:t,n},i={[e(!0)]:!0,[e(!1)]:!1,[e(void 0)]:void 0};hx=i[t],cx=!0}();const o=2*(n=Math.round(n))+1,a=nr(this.hitDetectionTransform_,n+.5,n+.5,1/e,-1/e,-i,-t[0],-t[1]),l=!this.hitDetectionContext_;l&&(this.hitDetectionContext_=ft(o,o,null,{willReadFrequently:hx}));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],ne(c,t),zt(c,e*(this.renderBuffer_+n),c));const u=gx(n);let d;function g(t,e,i){const a=h.getImageData(0,0,o,o).data;for(let l=0,c=u.length;l<c;l++)if(a[u[l]]>0){if(!s||"none"===i||"Image"!==d&&"Text"!==d||s.includes(t)){const i=(u[l]-3)/4,s=n-i%o,a=n-(i/o|0),h=r(t,e,s*s+a*a);if(h)return h}h.clearRect(0,0,o,o);break}}const f=Object.keys(this.executorsByZIndex_).map(Number);let p,_,m,x,v;for(f.sort(y),p=f.length-1;p>=0;--p){const t=f[p].toString();for(m=this.executorsByZIndex_[t],_=ox.length-1;_>=0;--_)if(d=ox[_],x=m[d],void 0!==x&&(v=x.executeHitDetection(h,a,i,g,c),v))return v}}getClipCoords(t){const e=this.maxExtent_;if(!e)return null;const i=e[0],n=e[1],r=e[2],s=e[3],o=[i,n,i,s,r,s,r,n];return cr(o,0,8,2,t,o),o}isEmpty(){return L(this.executorsByZIndex_)}execute(t,e,i,n,r,s,o){const a=Object.keys(this.executorsByZIndex_).map(Number);a.sort(o?x:y),s=s||ox;const l=ox.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=s.length;c<d;++c){const d=s[c],g=u[d];if(void 0!==g){const s=null===o?void 0:g.getZIndexContext(),c=s?s.getContext():t,u=this.maxExtent_&&"Image"!==d&&"Text"!==d;if(u&&(c.save(),this.clip(c,i)),s&&"Text"!==d&&"Image"!==d?s.pushFunction((t=>g.execute(t,e,i,n,r,o))):g.execute(c,e,i,n,r,o),u&&c.restore(),s){s.offset();const t=a[h]*l+ox.indexOf(d);this.deferredZIndexContexts_[t]||(this.deferredZIndexContexts_[t]=[]),this.deferredZIndexContexts_[t].push(s)}}}}this.renderedContext_=t}getDeferredZIndexContexts(){return this.deferredZIndexContexts_}getRenderedContext(){return this.renderedContext_}renderDeferred(){const t=this.deferredZIndexContexts_,e=Object.keys(t).map(Number).sort(y);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 dx={};function gx(t){if(void 0!==dx[t])return dx[t];const e=2*t+1,i=t*t,n=new Array(i+1);for(let r=0;r<=t;++r)for(let s=0;s<=t;++s){const o=r*r+s*s;if(o>i)break;let a=n[o];a||(a=[],n[o]=a),a.push(4*((t+r)*e+(t+s))+3),r>0&&a.push(4*((t-r)*e+(t+s))+3),s>0&&(a.push(4*((t+r)*e+(t-s))+3),r>0&&a.push(4*((t-r)*e+(t-s))+3))}const r=[];for(let t=0,e=n.length;t<e;++t)n[t]&&r.push(...n[t]);return dx[t]=r,r}const fx=.5;function px(t,e,i,n,r,s,o,a,l){const h=l?Bn(r,l):r,c=ft(t[0]*fx,t[1]*fx);c.imageSmoothingEnabled=!1;const u=c.canvas,d=new xu(c,fx,r,null,o,a,l?Ln(Gn(),l):null),g=i.length,f=Math.floor(16777215/g),p={};for(let t=1;t<=g;++t){const e=i[t-1],r=e.getStyleFunction()||n;if(!r)continue;let o=r(e,s);if(!o)continue;Array.isArray(o)||(o=[o]);const a=(t*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||!Se(h,n.getExtent()))continue;const r=i.clone(),s=r.getFill();s&&s.setColor(a);const l=r.getStroke();l&&(l.setColor(a),l.setLineDash(null)),r.setText(void 0);const c=i.getImage();if(c){const t=c.getImageSize();if(!t)continue;const e=ft(t[0],t[1],void 0,{alpha:!1}),i=e.canvas;e.fillStyle=a,e.fillRect(0,0,i.width,i.height),r.setImage(new ac({img:i,anchor:c.getAnchor(),anchorXUnits:"pixels",anchorYUnits:"pixels",offset:c.getOrigin(),opacity:1,size:c.getSize(),scale:c.getScale(),rotation:c.getRotation(),rotateWithView:c.getRotateWithView()}))}const u=r.getZIndex()||0;let d=p[u];d||(d={},p[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,r)}}else d[g.replace("Multi","")].push(n,r)}}const _=Object.keys(p).map(Number).sort(y);for(let t=0,i=_.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,r=e.length;i<r;++i)d.setTransform(e[i]),d.drawGeometry(n[t])}}}return c.getImageData(0,0,u.width,u.height)}function _x(t,e,i){const n=[];if(i){const r=Math.floor(Math.round(t[0])*fx),s=Math.floor(Math.round(t[1])*fx),o=4*(Ie(r,0,i.width-1)+Ie(s,0,i.height-1)*i.width),a=i.data[o],l=i.data[o+1],h=i.data[o+2]+256*(l+256*a),c=Math.floor(16777215/e.length);h&&h%c==0&&n.push(e[h/c-1])}return n}class mx extends Cf{constructor(t){super(t),this.boundHandleStyleImageChange_=this.handleStyleImageChange_.bind(this),this.animatingOrInteracting_,this.hitDetectionImageData_=null,this.clipExtent_=null,this.extendX_=!1,this.renderedFeatures_=null,this.renderedRevision_=-1,this.renderedResolution_=NaN,this.renderedExtent_=[1/0,1/0,-1/0,-1/0],this.wrappedRenderedExtent_=[1/0,1/0,-1/0,-1/0],this.renderedRotation_,this.renderedCenter_=null,this.renderedProjection_=null,this.renderedPixelRatio_=1,this.renderedRenderOrder_=null,this.renderedFrameDeclutter_,this.replayGroup_=null,this.replayGroupChanged=!0,this.clipping=!0,this.targetContext_=null,this.opacity_=1}renderWorlds(t,e,i){const n=e.extent,r=e.viewState,s=r.center,o=r.resolution,a=r.projection,l=r.rotation,h=a.getExtent(),c=this.getLayer().getSource(),u=this.getLayer().getDeclutter(),d=e.pixelRatio,g=e.viewHints,f=!(g[co]||g[uo]),p=this.context,_=Math.round(ve(n)/o*d),m=Math.round(_e(n)/o*d),y=c.getWrapX()&&a.canWrapX(),x=y?ve(h):null,v=y?Math.ceil((n[2]-h[2])/x)+(this.extendX_?2:1):1;let S=y?Math.floor((n[0]-h[0])/x)-(this.extendX_?1:0):0;do{let n=this.getRenderTransform(s,o,0,d,_,m,S*x);e.declutter&&(n=n.slice(0)),t.execute(p,[p.canvas.width,p.canvas.height],n,l,f,void 0===i?ox:i?ax:lx,i?u&&e.declutter[u]:void 0)}while(++S<v)}setDrawContext_(){1!==this.opacity_&&(this.targetContext_=this.context,this.context=ft(this.context.canvas.width,this.context.canvas.height,wf))}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,mt(this.context),wf.push(this.context.canvas),this.context=this.targetContext_,this.targetContext_=null}}renderDeclutter(t){this.replayGroup_&&this.getLayer().getDeclutter()&&this.renderWorlds(this.replayGroup_,t,!0)}renderDeferredInternal(t){this.replayGroup_&&(this.clipExtent_&&this.clipUnrotated(this.context,t,this.clipExtent_),this.replayGroup_.renderDeferred(),this.clipExtent_&&(this.context.restore(),this.clipExtent_=null),this.resetDrawContext_())}renderFrame(t,e){const i=t.layerStatesArray[t.layerIndex];this.opacity_=i.opacity;const n=t.viewState;this.prepareContainer(t,e);const r=this.context,s=this.replayGroup_;let o=s&&!s.isEmpty();if(!o){if(!(this.getLayer().hasListener(Ja)||this.getLayer().hasListener(Qa)))return this.container}this.setDrawContext_(),this.preRender(r,t);const a=n.projection;this.clipExtent_=null;let l=!1;if(o&&i.extent&&this.clipping){const e=zn(i.extent,a);o=Se(e,t.extent);o&&!Wt(e,t.extent)&&(t.declutter?this.clipExtent_=e:(this.clipUnrotated(r,t,e),l=!0))}return o&&this.renderWorlds(s,t,!this.getLayer().getDeclutter()&&void 0),l&&r.restore(),this.postRender(r,t),this.renderedRotation_!==n.rotation&&(this.renderedRotation_=n.rotation,this.hitDetectionImageData_=null),t.declutter||this.resetDrawContext_(),this.container}getFeatures(t){return new Promise((e=>{if(this.frameState&&!this.hitDetectionImageData_&&!this.animatingOrInteracting_){const t=this.frameState.size.slice(),e=this.renderedCenter_,i=this.renderedResolution_,n=this.renderedRotation_,r=this.renderedProjection_,s=this.wrappedRenderedExtent_,o=this.getLayer(),a=[],l=t[0]*fx,h=t[1]*fx;a.push(this.getRenderTransform(e,i,n,fx,l,h,0).slice());const c=o.getSource(),u=r.getExtent();if(c.getWrapX()&&r.canWrapX()&&!Wt(u,s)){let t=s[0];const r=ve(u);let o,c=0;for(;t<u[0];)--c,o=r*c,a.push(this.getRenderTransform(e,i,n,fx,l,h,o).slice()),t+=r;for(c=0,t=s[2];t>u[2];)++c,o=r*c,a.push(this.getRenderTransform(e,i,n,fx,l,h,o).slice()),t-=r}const d=Gn();this.hitDetectionImageData_=px(t,a,this.renderedFeatures_,o.getStyleFunction(),s,i,n,Eu(i,this.renderedPixelRatio_),d?r:null)}e(_x(t,this.renderedFeatures_,this.hitDetectionImageData_))}))}forEachFeatureAtCoordinate(t,e,i,n,r){if(!this.replayGroup_)return;const s=e.viewState.resolution,o=e.viewState.rotation,a=this.getLayer(),l={},h=this.getLayer().getDeclutter();return this.replayGroup_.forEachFeatureAtCoordinate(t,s,o,i,(function(t,e,i){const s=z(t),o=l[s];if(o){if(!0!==o&&i<o.distanceSq){if(0===i)return l[s]=!0,r.splice(r.lastIndexOf(o),1),n(t,a,e);o.geometry=e,o.distanceSq=i}}else{if(0===i)return l[s]=!0,n(t,a,e);r.push(l[s]={feature:t,layer:a,geometry:e,distanceSq:i,callback:n})}}),h?e.declutter?.[h]?.all().map((t=>t.value)):null)}handleFontsChanged(){const t=this.getLayer();t.getVisible()&&this.replayGroup_&&t.changed()}handleStyleImageChange_(t){this.renderIfReadyAndVisible()}prepareFrame(t){const e=this.getLayer(),i=e.getSource();if(!i)return!1;const n=t.viewHints[co],r=t.viewHints[uo],s=e.getUpdateWhileAnimating(),o=e.getUpdateWhileInteracting();if(this.ready&&!s&&n||!o&&r)return this.animatingOrInteracting_=!0,!0;this.animatingOrInteracting_=!1;const a=t.extent,l=t.viewState,h=l.projection,c=l.resolution,u=t.pixelRatio,d=e.getRevision(),g=e.getRenderBuffer();let f=e.getRenderOrder();void 0===f&&(f=Su);const p=l.center.slice(),_=zt(a,g*c),m=_.slice(),y=[_.slice()],x=h.getExtent(),v=i.getWrapX()&&h.canWrapX();if(this.extendX_=!1,v){const t=i.getExtent();t&&!Ee(t)&&(this.extendX_=t[0]<x[0]||t[2]>x[2])}if(v&&(!Wt(x,t.extent)||this.extendX_)){const t=ve(x),e=Math.max(ve(_)/2,t);let i=x[0],n=x[2];this.extendX_&&(i-=t,n+=t),_[0]=i-e,_[2]=n+e,ui(p,h);const r=Re(y[0],h);r[0]<x[0]&&r[2]<x[2]?y.push([r[0]+t,r[1],r[2]+t,r[3]]):r[0]>x[0]&&r[2]>x[2]&&y.push([r[0]-t,r[1],r[2]-t,r[3]])}if(this.ready&&this.renderedResolution_==c&&this.renderedPixelRatio_===u&&this.renderedRevision_==d&&this.renderedRenderOrder_==f&&this.renderedFrameDeclutter_===!!t.declutter&&Wt(this.wrappedRenderedExtent_,_))return w(this.renderedExtent_,m)||(this.hitDetectionImageData_=null,this.renderedExtent_=m),this.renderedCenter_=p,this.replayGroupChanged=!1,!0;this.replayGroup_=null;const S=new Zy(wu(c,u),_,c,u),E=Gn();let T;if(E){for(let t=0,e=y.length;t<e;++t){const e=Bn(y[t],h);i.loadFeatures(e,Xn(c,h),E)}T=Ln(E,h)}else for(let t=0,e=y.length;t<e;++t)i.loadFeatures(y[t],c,h);const C=Eu(c,u);let b=!0;const R=(t,i)=>{let n;const r=t.getStyleFunction()||e.getStyleFunction();if(r&&(n=r(t,c)),n){const e=this.renderFeature(t,C,n,S,T,this.getLayer().getDeclutter(),i);b=b&&!e}},P=Bn(_,h),I=i.getFeaturesInExtent(P);f&&I.sort(f);for(let t=0,e=I.length;t<e;++t)R(I[t],t);this.renderedFeatures_=I,this.ready=b;const F=S.finish(),L=new ux(_,c,u,i.getOverlaps(),F,e.getRenderBuffer(),!!t.declutter);return this.renderedResolution_=c,this.renderedRevision_=d,this.renderedRenderOrder_=f,this.renderedFrameDeclutter_=!!t.declutter,this.renderedExtent_=m,this.wrappedRenderedExtent_=_,this.renderedCenter_=p,this.renderedProjection_=h,this.renderedPixelRatio_=u,this.replayGroup_=L,this.hitDetectionImageData_=null,this.replayGroupChanged=!0,!0}renderFeature(t,e,i,n,r,s,o){if(!i)return!1;let a=!1;if(Array.isArray(i))for(let l=0,h=i.length;l<h;++l)a=Tu(n,t,i[l],e,this.boundHandleStyleImageChange_,r,s,o)||a;else a=Tu(n,t,i,e,this.boundHandleStyleImageChange_,r,s,o);return a}}class yx extends bf{constructor(t){super(t),this.vectorRenderer_=new mx(t),this.layerImageRatio_=t.getImageRatio(),this.coordinateToVectorPixelTransform_=[1,0,0,1,0,0],this.renderedPixelToCoordinateTransform_=null}disposeInternal(){this.vectorRenderer_.dispose(),super.disposeInternal()}getFeatures(t){if(!this.vectorRenderer_)return Promise.resolve([]);const e=Qn(this.coordinateToVectorPixelTransform_,Qn(this.renderedPixelToCoordinateTransform_,t.slice()));return this.vectorRenderer_.getFeatures(e)}handleFontsChanged(){this.vectorRenderer_.handleFontsChanged()}prepareFrame(t){const e=t.pixelRatio,i=t.viewState,r=i.resolution,s=t.viewHints,o=this.vectorRenderer_;let a=t.extent;1!==this.layerImageRatio_&&(a=a.slice(0),Te(a,this.layerImageRatio_));const l=ve(a)/r,h=_e(a)/r;if(!s[co]&&!s[uo]&&!Ee(a)){o.useContainer(null,null);const s=o.context,c=t.layerStatesArray[t.layerIndex],u=Object.assign({},c,{opacity:1}),d=Object.assign({},t,{extent:a,size:[l,h],viewState:Object.assign({},t.viewState,{rotation:0}),layerStatesArray:[u],layerIndex:0,declutter:null}),g=this.getLayer().getDeclutter();g&&(d.declutter={[g]:new ll(9)});const f=new Us(a,r,e,s.canvas,(function(t){o.prepareFrame(d)&&o.replayGroupChanged&&(o.clipping=!1,o.renderFrame(d,null),o.renderDeclutter(d),o.renderDeferred(d),t())}));f.addEventListener(n,(()=>{if(f.getState()!==Ms)return;this.image=f;const t=f.getPixelRatio(),n=Ou(f.getResolution())*e/t;this.renderedResolution=n,this.coordinateToVectorPixelTransform_=nr(this.coordinateToVectorPixelTransform_,l/2,h/2,1/n,-1/n,0,-i.center[0],-i.center[1])})),f.load()}return this.image&&(this.renderedPixelToCoordinateTransform_=t.pixelToCoordinateTransform.slice()),!this.getLayer().getSource()?.loading&&!!this.image}preRender(){}postRender(){}renderDeclutter(){}forEachFeatureAtCoordinate(t,e,i,n,r){return this.vectorRenderer_?this.vectorRenderer_.forEachFeatureAtCoordinate(t,e,i,n,r):super.forEachFeatureAtCoordinate(t,e,i,n,r)}}const xx={image:["Polygon","Circle","LineString","Image","Text"],hybrid:["Polygon","LineString"],vector:[]},vx={hybrid:["Image","Text","Default"],vector:["Polygon","Circle","LineString","Image","Text","Default"]};class Sx extends Mf{constructor(t,e){super(t,e),this.boundHandleStyleImageChange_=this.handleStyleImageChange_.bind(this),this.renderedLayerRevision_,this.renderedPixelToCoordinateTransform_=null,this.renderedRotation_,this.renderedOpacity_=1,this.tmpTransform_=[1,0,0,1,0,0],this.tileClipContexts_=null}enqueueTilesForNextExtent(){return"vector"!==this.getLayer().getRenderMode()}drawTile(t,e,i,n,r,s,o,a){this.updateExecutorGroup_(t,e.pixelRatio,e.viewState.projection),this.tileImageNeedsRender_(t)&&this.renderTileImage_(t,e),super.drawTile(t,e,i,n,r,s,o,a)}getTile(t,e,i,n){const r=this.getOrCreateTile(t,e,i,n);if(!r)return null;const s=n.viewState,o=s.resolution,a=n.viewHints,l=this.getLayer().getSource(),h=l.getTileGridForProjection(s.projection),c=!(a[co]||a[uo]),u=h.getZForResolution(o,l.zDirection)===t;return c&&u?r.wantedResolution=o:r.wantedResolution||(r.wantedResolution=h.getResolution(t)),r}prepareFrame(t){const e=this.getLayer().getRevision();return this.renderedLayerRevision_!==e&&(this.renderedLayerRevision_=e,this.renderedTiles.length=0),super.prepareFrame(t)}updateExecutorGroup_(t,e,i){const n=this.getLayer(),r=n.getRevision(),s=n.getRenderOrder()||null,o=t.wantedResolution,a=t.getReplayState(n);if(!a.dirty&&a.renderedResolution===o&&a.renderedRevision==r&&a.renderedPixelRatio===e&&a.renderedRenderOrder==s)return;const l=n.getSource(),h=!!n.getDeclutter(),c=l.getTileGrid(),u=l.getTileGridForProjection(i).getTileCoordExtent(t.wrappedTileCoord),d=l.getSourceTiles(e,i,t),g=z(n);delete t.hitDetectionImageData[g],t.executorGroups[g]=[],a.dirty=!1;for(let r=0,f=d.length;r<f;++r){const f=d[r];if(f.getState()!=K)continue;const p=l.getProjection(),_=f.tileCoord;let m=c.getTileCoordExtent(_);i&&p&&!Fn(i,p)&&(m=Dn(m,p,i,32));const y=me(u,m),x=zt(y,n.getRenderBuffer()*o,this.tempExtent),v=te(m,y)?null:x,S=new Zy(0,y,o,e),E=Eu(o,e),w=function(t,e){let i;const r=t.getStyleFunction()||n.getStyleFunction();if(r&&(i=r(t,o)),i){const n=this.renderFeature(t,E,i,S,h,e);a.dirty=a.dirty||n}},T=f.getFeatures();s&&s!==a.renderedRenderOrder&&T.sort(s);for(let t=0,e=T.length;t<e;++t){let e=T[t];i&&f.projection&&!Fn(i,f.projection)&&(e=e.clone(),e.getGeometry().applyTransform(An(f.projection,i))),v&&!Se(v,e.getGeometry().getExtent())||w.call(this,e,t)}const C=S.finish(),b="vector"!==n.getRenderMode()&&h&&1===d.length?null:y,R=new ux(b,o,e,l.getOverlaps(),C,n.getRenderBuffer(),!0);t.executorGroups[g].push(R)}a.renderedRevision=r,a.renderedPixelRatio=e,a.renderedRenderOrder=s,a.renderedResolution=o}forEachFeatureAtCoordinate(t,e,i,n,r){const s=e.viewState.resolution,o=e.viewState.rotation;i=null==i?0:i;const a=this.getLayer(),l=a.getSource().getTileGridForProjection(e.viewState.projection),h=Bt([t]);zt(h,s*i,h);const c={},u=function(t,e,i){let s=t.getId();void 0===s&&(s=z(t));const o=c[s];if(o){if(!0!==o&&i<o.distanceSq){if(0===i)return c[s]=!0,r.splice(r.lastIndexOf(o),1),n(t,a,e);o.geometry=e,o.distanceSq=i}}else{if(0===i)return c[s]=!0,n(t,a,e);r.push(c[s]={feature:t,layer:a,geometry:e,distanceSq:i,callback:n})}},d=this.renderedTiles,g=z(a),f=a.getDeclutter(),p=f?e.declutter?.[f]?.all().map((t=>t.value)):null;let _;t:for(let e=0,n=d.length;e<n;++e){const n=d[e];if(!Se(l.getTileCoordExtent(n.wrappedTileCoord),h))continue;const r=n.executorGroups[g];for(let e=0,n=r.length;e<n;++e)if(_=r[e].forEachFeatureAtCoordinate(t,s,o,i,u,p),_)break t}return _}getFeatures(t){return 0===this.renderedTiles.length?Promise.resolve([]):new Promise(((e,i)=>{const n=this.getLayer(),r=n.getSource(),s=this.renderedProjection,o=s.getExtent(),a=this.renderedResolution,l=r.getTileGridForProjection(s),h=Qn(this.renderedPixelToCoordinateTransform_,t.slice()),c=l.getTileCoordForCoordAndResolution(h,a).toString(),u=this.renderedTiles.find((t=>t.tileCoord.toString()===c&&t.getState()===K));if(!u||u.loadingSourceTiles>0)return void e([]);r.getWrapX()&&s.canWrapX()&&!Wt(o,l.getTileCoordExtent(u.tileCoord))&&ui(h,s);const d=z(n),g=ye(l.getTileCoordExtent(u.wrappedTileCoord)),f=[(h[0]-g[0])/a,(g[1]-h[1])/a],p=u.getSourceTiles().reduce(((t,e)=>t.concat(e.getFeatures())),[]);let _=u.hitDetectionImageData[d];if(!_){const t=Wl(l.getTileSize(l.getZForResolution(a,r.zDirection))),e=this.renderedRotation_;_=px(t,[this.getRenderTransform(l.getTileCoordCenter(u.wrappedTileCoord),a,0,fx,t[0]*fx,t[1]*fx,0)],p,n.getStyleFunction(),l.getTileCoordExtent(u.wrappedTileCoord),u.getReplayState(n).renderedResolution,e),u.hitDetectionImageData[d]=_}e(_x(f,p,_))}))}getFeaturesInExtent(t){const e=[],i=this.getTileCache();if(0===i.getCount())return e;const n=this.getLayer().getSource().getTileGridForProjection(this.frameState.viewState.projection),r=n.getZForResolution(this.renderedResolution),s={};return i.forEach((i=>{if(i.tileCoord[0]!==r||i.getState()!==K)return;const o=i.getSourceTiles();for(let i=0,r=o.length;i<r;++i){const r=o[i],a=r.getKey();if(a in s)continue;s[a]=!0;const l=r.tileCoord;if(Se(t,n.getTileCoordExtent(l))){const i=r.getFeatures();if(i)for(let n=0,r=i.length;n<r;++n){const r=i[n],s=r.getGeometry();Se(t,s.getExtent())&&e.push(r)}}}})),e}handleFontsChanged(){const t=this.getLayer();t.getVisible()&&void 0!==this.renderedLayerRevision_&&t.changed()}handleStyleImageChange_(t){this.renderIfReadyAndVisible()}renderDeclutter(t,e){const i=this.context,n=i.globalAlpha;i.globalAlpha=e.opacity;const r=t.viewHints,s=!(r[co]||r[uo]),o=[this.context.canvas.width,this.context.canvas.height],a=this.getLayer().getDeclutter(),l=a?t.declutter?.[a]:void 0,h=z(this.getLayer()),c=this.renderedTiles;for(let e=0,i=c.length;e<i;++e){const i=c[e],n=i.executorGroups[h];if(n)for(let e=n.length-1;e>=0;--e)n[e].execute(this.context,o,this.getTileRenderTransform(i,t),t.viewState.rotation,s,ax,l)}i.globalAlpha=n}renderDeferredInternal(t){const e=this.renderedTiles,i=z(this.getLayer()),n=e.reduce(((t,e,n)=>(e.executorGroups[i].forEach((e=>t.push({executorGroup:e,index:n}))),t)),[]),r=n.map((({executorGroup:t})=>t.getDeferredZIndexContexts())),s={};for(let t=0,e=n.length;t<e;++t){const e=n[t].executorGroup.getDeferredZIndexContexts();for(const t in e)s[t]=!0}Object.keys(s).map(Number).sort(y).forEach((t=>{r.forEach(((e,i)=>{e[t]&&(e[t].forEach((t=>{const{executorGroup:e,index:r}=n[i],s=e.getRenderedContext(),o=s.globalAlpha;s.globalAlpha=this.renderedOpacity_;const a=this.tileClipContexts_[r];a&&a.draw(s),t.draw(s),a&&s.restore(),s.globalAlpha=o,t.clear()})),e[t].length=0)}))}))}getTileRenderTransform(t,e){const i=e.pixelRatio,n=e.viewState,r=n.center,s=n.resolution,o=n.rotation,a=e.size,l=Math.round(a[0]*i),h=Math.round(a[1]*i),c=this.getLayer().getSource().getTileGridForProjection(e.viewState.projection),u=t.tileCoord,d=c.getTileCoordExtent(t.wrappedTileCoord),g=c.getTileCoordExtent(u,this.tempExtent)[0]-d[0];return Kn(er(this.inversePixelTransform.slice(),1/i,1/i),this.getRenderTransform(r,s,o,i,l,h,g))}postRender(t,e){const i=e.viewHints,n=!(i[co]||i[uo]);this.renderedPixelToCoordinateTransform_=e.pixelToCoordinateTransform.slice(),this.renderedRotation_=e.viewState.rotation,this.renderedOpacity_=e.layerStatesArray[e.layerIndex].opacity;const r=this.getLayer(),s=r.getRenderMode(),o=t.globalAlpha;t.globalAlpha=this.renderedOpacity_;const a=r.getDeclutter(),l=a?vx[s].filter((t=>!ax.includes(t))):vx[s],h=e.viewState,c=h.rotation,u=r.getSource(),d=u.getTileGridForProjection(h.projection).getZForResolution(h.resolution,u.zDirection),g=this.renderedTiles,f=[],p=[],_=[],m=z(r);let y=!0;for(let i=g.length-1;i>=0;--i){const s=g[i];y=y&&!s.getReplayState(r).dirty;const o=s.executorGroups[m].filter((t=>t.hasExecutors(l)));if(0===o.length)continue;const h=this.getTileRenderTransform(s,e),u=s.tileCoord[0];let x=!1;const v=o[0].getClipCoords(h);let S,E=t;if(v){S=new Sf,E=S.getContext();for(let t=0,e=f.length;t<e;++t)if(d!==u&&u<p[t]){const e=f[t];Se([v[0],v[3],v[4],v[7]],[e[0],e[3],e[4],e[7]])&&(x||(E.save(),x=!0),E.beginPath(),E.moveTo(v[0],v[1]),E.lineTo(v[2],v[3]),E.lineTo(v[4],v[5]),E.lineTo(v[6],v[7]),E.moveTo(e[6],e[7]),E.lineTo(e[4],e[5]),E.lineTo(e[2],e[3]),E.lineTo(e[0],e[1]),E.clip())}f.push(v),p.push(u)}for(let i=0,r=o.length;i<r;++i){o[i].execute(t,[t.canvas.width,t.canvas.height],h,c,n,l,e.declutter?.[a])}x&&(E===t?E.restore():_[i]=S)}t.globalAlpha=o,this.ready=y,this.tileClipContexts_=_,e.declutter||this.renderDeferredInternal(e),super.postRender(t,e)}renderFeature(t,e,i,n,r,s){if(!i)return!1;let o=!1;if(Array.isArray(i))for(let a=0,l=i.length;a<l;++a)o=Tu(n,t,i[a],e,this.boundHandleStyleImageChange_,void 0,r,s)||o;else o=Tu(n,t,i,e,this.boundHandleStyleImageChange_,void 0,r,s);return o}tileImageNeedsRender_(t){const e=this.getLayer();if("vector"===e.getRenderMode())return!1;const i=t.getReplayState(e),n=e.getRevision(),r=t.wantedResolution;return i.renderedTileResolution!==r||i.renderedTileRevision!==n}renderTileImage_(t,e){const i=this.getLayer(),n=t.getReplayState(i),r=i.getRevision(),s=t.executorGroups[z(i)];n.renderedTileRevision=r;const o=t.wrappedTileCoord,a=o[0],l=i.getSource();let h=e.pixelRatio;const c=e.viewState.projection,u=l.getTileGridForProjection(c),d=u.getResolution(t.tileCoord[0]),g=e.pixelRatio/t.wantedResolution*d,f=u.getResolution(a),p=t.getContext();h=Math.round(Math.max(h,g/h));const _=l.getTilePixelSize(a,h,c);p.canvas.width=_[0],p.canvas.height=_[1];const m=h/g;if(1!==m){const t=Hn(this.tmpTransform_);er(t,m,m),p.setTransform.apply(p,t)}const y=u.getTileCoordExtent(o,this.tempExtent),x=g/f,v=Hn(this.tmpTransform_);er(v,x,-x),ir(v,-y[0],-y[3]);for(let t=0,e=s.length;t<e;++t){s[t].execute(p,[p.canvas.width*m,p.canvas.height*m],v,0,!0,xx[i.getRenderMode()],null)}n.renderedTileResolution=t.wantedResolution}}let Ex=null;function wx(t){Ex=t;const e=Object.keys(t.defs),i=e.length;let n,r;for(n=0;n<i;++n){const i=e[n];if(!Oi(i)){const e=t.defs(i);let n=e.units;n||"longlat"!==e.projName||(n="degrees"),vn(new mi({code:i,axisOrientation:e.axis,metersPerUnit:e.to_meter,units:n}))}}for(n=0;n<i;++n){const s=e[n],o=Oi(s);for(r=0;r<i;++r){const i=e[r],n=Oi(i);if(!ji(s,i))if(t.defs[s]===t.defs[i])Tn([o,n]);else{const e=t(s,i);Pn(o,n,$n(o,n,e.forward),$n(n,o,e.inverse))}}}}let Tx=async function(t){if("string"!=typeof t||!t.includes(":"))throw new Error("Invalid code");const[e,i]=t.toLowerCase().split(":",2),n=await fetch(`https://spatialreference.org/ref/${e}/${i}/ogcwkt/`);if(!n.ok)throw new Error(`Unexpected response from spatialreference.org: ${n.status}`);return n.text()};async function Cx(t){const e=Ex;if(!e)throw new Error("Proj4 must be registered first with register(proj4)");return e.defs(t)||(e.defs(t,await Tx(t)),wx(e)),Oi(t)}let bx=async function(t){return await Tx("EPSG:"+t)};const Rx=`\n attribute vec2 ${E_.TEXTURE_COORD};\n uniform mat4 ${S_.TILE_TRANSFORM};\n uniform float ${S_.TEXTURE_PIXEL_WIDTH};\n uniform float ${S_.TEXTURE_PIXEL_HEIGHT};\n uniform float ${S_.TEXTURE_RESOLUTION};\n uniform float ${S_.TEXTURE_ORIGIN_X};\n uniform float ${S_.TEXTURE_ORIGIN_Y};\n uniform float ${S_.DEPTH};\n\n varying vec2 v_textureCoord;\n varying vec2 v_mapCoord;\n\n void main() {\n v_textureCoord = ${E_.TEXTURE_COORD};\n v_mapCoord = vec2(\n ${S_.TEXTURE_ORIGIN_X} + ${S_.TEXTURE_RESOLUTION} * ${S_.TEXTURE_PIXEL_WIDTH} * v_textureCoord[0],\n ${S_.TEXTURE_ORIGIN_Y} - ${S_.TEXTURE_RESOLUTION} * ${S_.TEXTURE_PIXEL_HEIGHT} * v_textureCoord[1]\n );\n gl_Position = ${S_.TILE_TRANSFORM} * vec4(${E_.TEXTURE_COORD}, ${S_.DEPTH}, 1.0);\n }\n`,Px=`\n #ifdef GL_FRAGMENT_PRECISION_HIGH\n precision highp float;\n #else\n precision mediump float;\n #endif\n\n uniform vec4 ${S_.RENDER_EXTENT};\n uniform float ${C_.MAX_SPEED};\n uniform sampler2D ${S_.TILE_TEXTURE_ARRAY}[1];\n\n varying vec2 v_textureCoord;\n varying vec2 v_mapCoord;\n\n void main() {\n if (\n v_mapCoord[0] < ${S_.RENDER_EXTENT}[0] ||\n v_mapCoord[1] < ${S_.RENDER_EXTENT}[1] ||\n v_mapCoord[0] > ${S_.RENDER_EXTENT}[2] ||\n v_mapCoord[1] > ${S_.RENDER_EXTENT}[3]\n ) {\n discard;\n }\n\n vec4 velocity = texture2D(${S_.TILE_TEXTURE_ARRAY}[0], v_textureCoord);\n gl_FragColor = vec4((velocity.xy + ${C_.MAX_SPEED}) / (2.0 * ${C_.MAX_SPEED}), 0, 1);\n }\n`,Ix=`\n #ifdef GL_FRAGMENT_PRECISION_HIGH\n precision highp float;\n #else\n precision mediump float;\n #endif\n\n attribute vec2 ${b_};\n\n varying vec2 ${P_};\n\n void main() {\n ${P_} = ${b_};\n gl_Position = vec4(1.0 - 2.0 * ${b_}, 0, 1);\n }\n`,Fx=`\n #ifdef GL_FRAGMENT_PRECISION_HIGH\n precision highp float;\n #else\n precision mediump float;\n #endif\n\n uniform sampler2D ${C_.TEXTURE};\n uniform float ${C_.OPACITY};\n\n varying vec2 ${P_};\n\n void main() {\n vec4 color = texture2D(${C_.TEXTURE}, 1.0 - ${P_});\n gl_FragColor = vec4(floor(255.0 * color * ${C_.OPACITY}) / 255.0);\n }\n`,Lx=`\n #ifdef GL_FRAGMENT_PRECISION_HIGH\n precision highp float;\n #else\n precision mediump float;\n #endif\n\n uniform sampler2D ${C_.POSITION_TEXTURE};\n uniform sampler2D ${C_.VELOCITY_TEXTURE};\n uniform float ${C_.RANDOM_SEED};\n uniform float ${C_.SPEED_FACTOR};\n uniform float ${C_.DROP_RATE};\n uniform float ${C_.DROP_RATE_BUMP};\n uniform vec2 ${C_.ROTATION};\n uniform vec2 ${C_.VIEWPORT_SIZE_PX};\n\n varying vec2 ${P_};\n\n // pseudo-random generator\n const vec3 randConstants = vec3(12.9898, 78.233, 4375.85453);\n\n float rand(const vec2 co) {\n float t = dot(randConstants.xy, co);\n return fract(sin(t) * (randConstants.z + t));\n }\n\n void main() {\n vec4 positionColor = texture2D(${C_.POSITION_TEXTURE}, ${P_});\n\n // decode particle position from pixel RGBA\n vec2 particlePosition = vec2(\n positionColor.r / 255.0 + positionColor.b,\n positionColor.g / 255.0 + positionColor.a\n );\n\n vec4 velocityColor = texture2D(${C_.VELOCITY_TEXTURE}, particlePosition);\n if (velocityColor.a == 0.0) {\n discard;\n }\n\n float vx = 2.0 * velocityColor.r - 1.0;\n float vy = 2.0 * velocityColor.g - 1.0;\n\n // normalized veloicty (magnitude 0 - 1)\n vec2 velocity = vec2(\n vx * ${C_.ROTATION}.x - vy * ${C_.ROTATION}.y,\n vx * ${C_.ROTATION}.y + vy * ${C_.ROTATION}.x\n );\n\n // account for aspect ratio (square particle position texture, non-square map)\n float aspectRatio = ${C_.VIEWPORT_SIZE_PX}.x / ${C_.VIEWPORT_SIZE_PX}.y;\n vec2 offset = vec2(velocity.x / aspectRatio, velocity.y) * ${C_.SPEED_FACTOR};\n\n // update particle position, wrapping around the edge\n particlePosition = fract(1.0 + particlePosition + offset);\n\n // a random seed to use for the particle drop\n vec2 seed = (particlePosition + ${P_}) * ${C_.RANDOM_SEED};\n\n // drop rate is a chance a particle will restart at random position, to avoid degeneration\n float dropRate = ${C_.DROP_RATE} + length(velocity) * ${C_.DROP_RATE_BUMP};\n float drop = step(1.0 - dropRate, rand(seed));\n\n vec2 randomPosition = vec2(rand(seed + 1.3), rand(seed + 2.1));\n particlePosition = mix(particlePosition, randomPosition, drop);\n\n // encode the new particle position back into RGBA\n gl_FragColor = vec4(\n fract(particlePosition * 255.0),\n floor(particlePosition * 255.0) / 255.0\n );\n }\n`,Mx=`\n #ifdef GL_FRAGMENT_PRECISION_HIGH\n precision highp float;\n #else\n precision mediump float;\n #endif\n\n attribute float ${R_};\n\n uniform sampler2D ${C_.POSITION_TEXTURE};\n uniform float ${C_.PARTICLE_COUNT_SQRT};\n\n varying vec2 ${P_};\n\n void main() {\n vec4 color = texture2D(\n ${C_.POSITION_TEXTURE},\n vec2(\n fract(${R_} / ${C_.PARTICLE_COUNT_SQRT}),\n floor(${R_} / ${C_.PARTICLE_COUNT_SQRT}) / ${C_.PARTICLE_COUNT_SQRT}\n )\n );\n\n ${P_} = vec2(\n color.r / 255.0 + color.b,\n color.g / 255.0 + color.a\n );\n\n gl_PointSize = 1.0;\n gl_Position = vec4(\n 2.0 * ${P_}.x - 1.0,\n 2.0 * ${P_}.y - 1.0,\n 0,\n 1\n );\n }\n`;const Ax=[];class Ox extends Df{constructor(t){const e=Object.assign({},t);if(delete e.maxSpeed,delete e.speedFactor,delete e.particles,super(e),this.style_=t.style||{},!(t.maxSpeed>0))throw new Error("maxSpeed is required");this.maxSpeed_=t.maxSpeed,this.speedFactor_=t.speedFactor,this.particles_=t.particles,this.styleVariables_=this.style_.variables||{},this.addChangeListener(Va,this.handleSourceUpdate_)}handleSourceUpdate_(){this.hasRenderer()&&this.getRenderer().clearCache()}updateStyleVariables(t){Object.assign(this.styleVariables_,t),this.changed()}getSources(t,e){const i=this.getSource();return Ax[0]=i,Ax}createRenderer(){const t=function(t){const e={variables:{},properties:{},functions:{},bandCount:0,featureId:!1,geometryType:!1},i=[];if(void 0!==t.color){const n=km(e,t.color,ql);i.push(`color = ${n};`)}const n=Object.keys(e.variables);if(n.length>1&&!t.variables)throw new Error(`Missing variables in style (expected ${e.variables})`);const r={};for(const e of n){if(!(e in t.variables))throw new Error(`Missing '${e}' in style variables`);r[W_(e)]=function(){let i=t.variables[e];return"string"==typeof i&&(i=V_(i)),void 0!==i?i:-9999999}}const s=Object.keys(r).map((function(t){return`uniform float ${t};`})),o=Object.keys(e.functions).map((function(t){return e.functions[t]})),a=`\n #ifdef GL_FRAGMENT_PRECISION_HIGH\n precision highp float;\n #else\n precision mediump float;\n #endif\n\n uniform sampler2D ${C_.VELOCITY_TEXTURE};\n uniform float ${C_.MAX_SPEED};\n uniform vec2 ${C_.ROTATION};\n\n ${s.join("\n")}\n\n varying vec2 ${P_};\n \n ${o.join("\n")}\n\n void main() {\n vec4 velocityColor = texture2D(${C_.VELOCITY_TEXTURE}, ${P_});\n\n float vx = mix(-${C_.MAX_SPEED}, ${C_.MAX_SPEED}, velocityColor.r);\n float vy = mix(-${C_.MAX_SPEED}, ${C_.MAX_SPEED}, velocityColor.g);\n\n vec2 velocity = vec2(\n vx * ${C_.ROTATION}.x - vy * ${C_.ROTATION}.y,\n vx * ${C_.ROTATION}.y + vy * ${C_.ROTATION}.x\n );\n\n float a_prop_speed = length(velocity);\n\n vec4 color;\n\n ${i.join("\n")}\n\n if (color.a == 0.0) {\n discard;\n }\n\n gl_FragColor = color;\n }\n `;return{tileVertexShader:Rx,tileFragmentShader:Px,particleColorVertexShader:Mx,particleColorFragmentShader:a,particlePositionVertexShader:Ix,particlePositionFragmentShader:Lx,textureVertexShader:Ix,textureFragmentShader:Fx}}(this.style_);return new I_(this,{...t,cacheSize:this.getCacheSize(),maxSpeed:this.maxSpeed_,speedFactor:this.speedFactor_,particles:this.particles_})}}function Dx(t,e,i){const n=[];let r=t(0),s=t(1),o=e(r),a=e(s);const l=[s,r],h=[a,o],c=[1,0],u={};let d,g,f,p,_,m,y=1e5;for(;--y>0&&c.length>0;)f=c.pop(),r=l.pop(),o=h.pop(),m=f.toString(),m in u||(n.push(o[0],o[1]),u[m]=!0),p=c.pop(),s=l.pop(),a=h.pop(),_=(f+p)/2,d=t(_),g=e(d),Fe(g[0],g[1],o[0],o[1],a[0],a[1])<i?(n.push(a[0],a[1]),m=p.toString(),u[m]=!0):(c.push(p,_,_,f),h.push(a,g,g,o),l.push(s,d,d,r));return n}function Nx(t,e,i,n,r){return Dx((function(n){return[t,e+(i-e)*n]}),An(En("EPSG:4326"),n),r)}function kx(t,e,i,n,r){return Dx((function(n){return[e+(i-e)*n,t]}),An(En("EPSG:4326"),n),r)}Ox.prototype.dispose;class Gx extends zc{constructor(t){super(t)}createRenderer(){return new mx(this)}}const jx=new lc({color:"rgba(0,0,0,0.2)"}),Ux=[90,45,30,20,10,5,2,1,.5,20/60,10/60,5/60,2/60,1/60,30/3600,20/3600,10/3600,5/3600,2/3600,1/3600];const Bx="blur",zx="gradient",Xx="radius",Vx=["#00f","#0ff","#0f0","#ff0","#f00"];function $x(t,e){const i=`\n attribute vec2 ${E_.TEXTURE_COORD};\n uniform mat4 ${S_.TILE_TRANSFORM};\n uniform float ${S_.TEXTURE_PIXEL_WIDTH};\n uniform float ${S_.TEXTURE_PIXEL_HEIGHT};\n uniform float ${S_.TEXTURE_RESOLUTION};\n uniform float ${S_.TEXTURE_ORIGIN_X};\n uniform float ${S_.TEXTURE_ORIGIN_Y};\n uniform float ${S_.DEPTH};\n\n varying vec2 v_textureCoord;\n varying vec2 v_mapCoord;\n\n void main() {\n v_textureCoord = ${E_.TEXTURE_COORD};\n v_mapCoord = vec2(\n ${S_.TEXTURE_ORIGIN_X} + ${S_.TEXTURE_RESOLUTION} * ${S_.TEXTURE_PIXEL_WIDTH} * v_textureCoord[0],\n ${S_.TEXTURE_ORIGIN_Y} - ${S_.TEXTURE_RESOLUTION} * ${S_.TEXTURE_PIXEL_HEIGHT} * v_textureCoord[1]\n );\n gl_Position = ${S_.TILE_TRANSFORM} * vec4(${E_.TEXTURE_COORD}, ${S_.DEPTH}, 1.0);\n }\n `,n={variables:{},properties:{},functions:{},bandCount:0,featureId:!1,geometryType:!1,bandCount:e},r=[];if(void 0!==t.color){const e=km(n,t.color,ql);r.push(`color = ${e};`)}if(void 0!==t.contrast){const e=km(n,t.contrast,Hl);r.push(`color.rgb = clamp((${e} + 1.0) * color.rgb - (${e} / 2.0), vec3(0.0, 0.0, 0.0), vec3(1.0, 1.0, 1.0));`)}if(void 0!==t.exposure){const e=km(n,t.exposure,Hl);r.push(`color.rgb = clamp((${e} + 1.0) * color.rgb, vec3(0.0, 0.0, 0.0), vec3(1.0, 1.0, 1.0));`)}if(void 0!==t.saturation){const e=km(n,t.saturation,Hl);r.push(`\n float saturation = ${e} + 1.0;\n float sr = (1.0 - saturation) * 0.2126;\n float sg = (1.0 - saturation) * 0.7152;\n float sb = (1.0 - saturation) * 0.0722;\n mat3 saturationMatrix = mat3(\n sr + saturation, sr, sr,\n sg, sg + saturation, sg,\n sb, sb, sb + saturation\n );\n color.rgb = clamp(saturationMatrix * color.rgb, vec3(0.0, 0.0, 0.0), vec3(1.0, 1.0, 1.0));\n `)}if(void 0!==t.gamma){const e=km(n,t.gamma,Hl);r.push(`color.rgb = pow(color.rgb, vec3(1.0 / ${e}));`)}if(void 0!==t.brightness){const e=km(n,t.brightness,Hl);r.push(`color.rgb = clamp(color.rgb + ${e}, vec3(0.0, 0.0, 0.0), vec3(1.0, 1.0, 1.0));`)}const s={},o=Object.keys(n.variables).length;if(o>1&&!t.variables)throw new Error(`Missing variables in style (expected ${n.variables})`);for(let e=0;e<o;++e){const i=n.variables[Object.keys(n.variables)[e]];if(!(i.name in t.variables))throw new Error(`Missing '${i.name}' in style variables`);s[W_(i.name)]=function(){let e=t.variables[i.name];return"string"==typeof e&&(e=V_(e)),void 0!==e?e:-9999999}}const a=Object.keys(s).map((function(t){return`uniform float ${t};`})),l=Math.ceil(e/4);a.push(`uniform sampler2D ${S_.TILE_TEXTURE_ARRAY}[${l}];`),n.paletteTextures&&a.push(`uniform sampler2D ${H_}[${n.paletteTextures.length}];`);const h=Object.keys(n.functions).map((function(t){return n.functions[t]}));return{vertexShader:i,fragmentShader:`\n #ifdef GL_FRAGMENT_PRECISION_HIGH\n precision highp float;\n #else\n precision mediump float;\n #endif\n\n varying vec2 v_textureCoord;\n varying vec2 v_mapCoord;\n uniform vec4 ${S_.RENDER_EXTENT};\n uniform float ${S_.TRANSITION_ALPHA};\n uniform float ${S_.TEXTURE_PIXEL_WIDTH};\n uniform float ${S_.TEXTURE_PIXEL_HEIGHT};\n uniform float ${S_.RESOLUTION};\n uniform float ${S_.ZOOM};\n\n ${a.join("\n")}\n\n ${h.join("\n")}\n\n void main() {\n if (\n v_mapCoord[0] < ${S_.RENDER_EXTENT}[0] ||\n v_mapCoord[1] < ${S_.RENDER_EXTENT}[1] ||\n v_mapCoord[0] > ${S_.RENDER_EXTENT}[2] ||\n v_mapCoord[1] > ${S_.RENDER_EXTENT}[3]\n ) {\n discard;\n }\n\n vec4 color = texture2D(${S_.TILE_TEXTURE_ARRAY}[0], v_textureCoord);\n\n ${r.join("\n")}\n\n gl_FragColor = color;\n gl_FragColor.rgb *= gl_FragColor.a;\n gl_FragColor *= ${S_.TRANSITION_ALPHA};\n }`,uniforms:s,paletteTextures:n.paletteTextures}}class Wx extends Df{constructor(t){const e=(t=t?Object.assign({},t):{}).style||{};delete t.style,super(t),this.sources_=t.sources,this.renderedSource_=null,this.renderedResolution_=NaN,this.style_=e,this.styleVariables_=this.style_.variables||{},this.handleSourceUpdate_(),this.addChangeListener(Va,this.handleSourceUpdate_)}getSources(t,e){const i=this.getSource();return this.sources_?"function"==typeof this.sources_?this.sources_(t,e):this.sources_:i?[i]:[]}getRenderSource(){return this.renderedSource_||this.getSource()}getSourceState(){const t=this.getRenderSource();return t?t.getState():"undefined"}handleSourceUpdate_(){this.hasRenderer()&&this.getRenderer().clearCache();const t=this.getSource();if(t)if("loading"===t.getState()){const e=()=>{"ready"===t.getState()&&(t.removeEventListener("change",e),this.setStyle(this.style_))};t.addEventListener("change",e)}else this.setStyle(this.style_)}getSourceBandCount_(){const t=Number.MAX_SAFE_INTEGER,e=this.getSources([-t,-t,t,t],t);return e&&e.length&&"bandCount"in e[0]?e[0].bandCount:4}createRenderer(){const t=$x(this.style_,this.getSourceBandCount_());return new T_(this,{vertexShader:t.vertexShader,fragmentShader:t.fragmentShader,uniforms:t.uniforms,cacheSize:this.getCacheSize(),paletteTextures:t.paletteTextures})}renderSources(t,e){const i=this.getRenderer();let n;for(let r=0,s=e.length;r<s;++r)this.renderedSource_=e[r],i.prepareFrame(t)&&(n=i.renderFrame(t));return n}render(t,e){this.rendered=!0;const i=t.viewState,n=this.getSources(t.extent,i.resolution);let r=!0;for(let t=0,e=n.length;t<e;++t){const e=n[t],i=e.getState();if("loading"==i){const t=()=>{"ready"==e.getState()&&(e.removeEventListener("change",t),this.changed())};e.addEventListener("change",t)}r=r&&"ready"==i}const s=this.renderSources(t,n);if(this.getRenderer().renderComplete&&r)return this.renderedResolution_=i.resolution,s;if(this.renderedResolution_>.5*i.resolution){const e=this.getSources(t.extent,this.renderedResolution_).filter((t=>!n.includes(t)));if(e.length>0)return this.renderSources(t,e)}return s}setStyle(t){if(this.styleVariables_=t.variables||{},this.style_=t,this.hasRenderer()){const t=$x(this.style_,this.getSourceBandCount_());this.getRenderer().reset({vertexShader:t.vertexShader,fragmentShader:t.fragmentShader,uniforms:t.uniforms,paletteTextures:t.paletteTextures}),this.changed()}}updateStyleVariables(t){Object.assign(this.styleVariables_,t),this.changed()}}Wx.prototype.dispose;const Zx="addfeatures";class Yx extends M{constructor(t,e,i,n){super(t),this.features=i,this.file=e,this.projection=n}}function Hx(t,e){const i=t.length;return e<0?t[e+i]:e>=i?t[e-i]:t[e]}function Kx(t,e){const i=t.length;let n=Math.floor(e);const r=e-n;n>=i?n-=i:n<0&&(n+=i);let s=n+1;s>=i&&(s-=i);const o=t[n],a=o[0],l=o[1],h=t[s];return[a+(h[0]-a)*r,l+(h[1]-l)*r]}const qx={index:-1,endIndex:NaN,closestTargetDistance:1/0};function Jx(t,e,i,n){const r=t[0],s=t[1];let o=1/0,a=-1,l=NaN;for(let t=0;t<e.targets.length;++t){const i=e.targets[t],n=i.coordinates;let h,c=1/0;for(let t=0;t<n.length-1;++t){const e=sv(r,s,n[t],n[t+1]);e.squaredDistance<c&&(c=e.squaredDistance,h=t+e.along)}c<o&&(o=c,i.ring&&e.targetIndex===t&&(i.endIndex>i.startIndex?h<i.startIndex&&(h+=n.length):i.endIndex<i.startIndex&&h>i.startIndex&&(h-=n.length)),l=h,a=t)}const h=e.targets[a];let c=h.ring;if(e.targetIndex===a&&c){const t=Kx(h.coordinates,l);li(i.getPixelFromCoordinate(t),i.getPixelFromCoordinate(e.startCoord))>n&&(c=!1)}if(c){const t=h.coordinates,e=t.length,i=h.startIndex,n=l;if(i<n){const r=nv(t,i,n);nv(t,i,n-e)<r&&(l-=e)}else{const r=nv(t,i,n);nv(t,i,n+e)<r&&(l+=e)}}return qx.index=a,qx.endIndex=l,qx.closestTargetDistance=o,qx}function Qx(t,e){const i=[];for(let n=0;n<e.length;++n){tv(t,e[n].getGeometry(),i)}return i}function tv(t,e,i){if(e instanceof Dd)ev(t,e.getCoordinates(),!1,i);else if(e instanceof Nd){const n=e.getCoordinates();for(let e=0,r=n.length;e<r;++e)ev(t,n[e],!1,i)}else if(e instanceof gs){const n=e.getCoordinates();for(let e=0,r=n.length;e<r;++e)ev(t,n[e],!0,i)}else if(e instanceof Gd){const n=e.getCoordinates();for(let e=0,r=n.length;e<r;++e){const r=n[e];for(let e=0,n=r.length;e<n;++e)ev(t,r[e],!0,i)}}else if(e instanceof Md){const n=e.getGeometries();for(let e=0;e<n.length;++e)tv(t,n[e],i)}else;}function ev(t,e,i,n){const r=t[0],s=t[1];for(let t=0,o=e.length-1;t<o;++t){const o=sv(r,s,e[t],e[t+1]);if(0===o.squaredDistance){const r=t+o.along;return void n.push({coordinates:e,ring:i,startIndex:r,endIndex:r})}}}function iv(t,e){return Le(t[0],t[1],e[0],e[1])}function nv(t,e,i){let n,r;e<i?(n=e,r=i):(n=i,r=e);const s=Math.ceil(n),o=Math.floor(r);if(s>o){return iv(Kx(t,n),Kx(t,r))}let a=0;if(n<s){a+=iv(Kx(t,n),Hx(t,s))}if(o<r){a+=iv(Hx(t,o),Kx(t,r))}for(let e=s;e<o-1;++e){a+=iv(Hx(t,e),Hx(t,e+1))}return a}const rv={along:0,squaredDistance:0};function sv(t,e,i,n){const r=i[0],s=i[1],o=n[0]-r,a=n[1]-s;let l=0,h=r,c=s;return 0===o&&0===a||(l=Ie(((t-r)*o+(e-s)*a)/(o*o+a*a),0,1),h+=o*l,c+=a*l),rv.along=l,rv.squaredDistance=ke(Le(t,e,h,c),10),rv}const ov="drawstart",av="drawend",lv="drawabort";class hv extends M{constructor(t,e){super(t),this.feature=e}}function cv(){const t=gc();return function(e,i){return t[e.getGeometry().getType()]}}const uv="extentchanged";class dv extends M{constructor(t){super(uv),this.extent=t}}function gv(){const t=gc();return function(e,i){return t.Polygon}}function fv(){const t=gc();return function(e,i){return t.Point}}function pv(t){return function(e){return Bt([t,e])}}function _v(t,e){return t[0]==e[0]?function(i){return Bt([t,[i[0],e[1]]])}:t[1]==e[1]?function(i){return Bt([t,[e[0],i[1]]])}:null}function mv(t){return parseFloat(t)}function yv(t){return function(t){return ke(t,5)}(t).toString()}function xv(t,e){return!isNaN(t)&&t!==mv(yv(e))}const vv=[0,0,0,0],Sv=[],Ev="modifystart",wv="modifyend";function Tv(t,e,i){let n;switch(e){case"LineString":n=t;break;case"MultiLineString":case"Polygon":n=t[i[0]];break;case"MultiPolygon":n=t[i[1]][i[0]]}return n}class Cv extends M{constructor(t,e,i){super(t),this.features=e,this.mapBrowserEvent=i}}function bv(t,e){return t.index-e.index}function Rv(t,e,i){const n=e.geometry;if("Circle"===n.getType()){let r=n;if(1===e.index){const e=Gn();e&&(r=r.clone().transform(e,i));const n=ai(r.getCenter(),Un(t,i)),s=Math.sqrt(n)-r.getRadius();return s*s}}const r=Un(t,i);return Sv[0]=Un(e.segment[0],i),Sv[1]=Un(e.segment[1],i),hi(r,Sv)}function Pv(t,e,i){const n=e.geometry;if("Circle"===n.getType()&&1===e.index){let e=n;const r=Gn();return r&&(e=e.clone().transform(r,i)),jn(e.getClosestPoint(Un(t,i)),i)}const r=Un(t,i);return Sv[0]=Un(e.segment[0],i),Sv[1]=Un(e.segment[1],i),jn(ei(r,Sv),i)}function Iv(){const t=gc();return function(e,i){return t.Point}}const Fv="select";class Lv extends M{constructor(t,e,i,n){super(t),this.selected=e,this.deselected=i,this.mapBrowserEvent=n}}const Mv={};class Av extends Ho{constructor(t){let e;if(super(),this.on,this.once,this.un,t=t||{},this.boundAddFeature_=this.addFeature_.bind(this),this.boundRemoveFeature_=this.removeFeature_.bind(this),this.condition_=t.condition?t.condition:aa,this.addCondition_=t.addCondition?t.addCondition:oa,this.removeCondition_=t.removeCondition?t.removeCondition:oa,this.toggleCondition_=t.toggleCondition?t.toggleCondition:ca,this.multi_=!!t.multi&&t.multi,this.filter_=t.filter?t.filter:C,this.hitTolerance_=t.hitTolerance?t.hitTolerance:0,this.style_=void 0!==t.style?t.style:function(){const t=gc();return E(t.Polygon,t.LineString),E(t.GeometryCollection,t.LineString),function(e){return e.getGeometry()?t[e.getGeometry().getType()]:null}}(),this.features_=t.features||new Z,t.layers)if("function"==typeof t.layers)e=t.layers;else{const i=t.layers;e=function(t){return i.includes(t)}}else e=C;this.layerFilter_=e,this.featureLayerAssociation_={}}addFeatureLayerAssociation_(t,e){this.featureLayerAssociation_[z(t)]=e}getFeatures(){return this.features_}getHitTolerance(){return this.hitTolerance_}getLayer(t){return this.featureLayerAssociation_[z(t)]}setHitTolerance(t){this.hitTolerance_=t}setMap(i){this.getMap()&&this.style_&&this.features_.forEach(this.restorePreviousStyle_.bind(this)),super.setMap(i),i?(this.features_.addEventListener(t,this.boundAddFeature_),this.features_.addEventListener(e,this.boundRemoveFeature_),this.style_&&this.features_.forEach(this.applySelectedStyle_.bind(this))):(this.features_.removeEventListener(t,this.boundAddFeature_),this.features_.removeEventListener(e,this.boundRemoveFeature_))}addFeature_(t){const e=t.element;if(this.style_&&this.applySelectedStyle_(e),!this.getLayer(e)){const t=this.findLayerOfFeature_(e);t&&this.addFeatureLayerAssociation_(e,t)}}removeFeature_(t){this.style_&&this.restorePreviousStyle_(t.element),this.removeFeatureLayerAssociation_(t.element)}findLayerOfFeature_(t){return this.getMap().getAllLayers().find((function(e){if(e instanceof Gx&&e.getSource()&&e.getSource().hasFeature(t))return e}))}getStyle(){return this.style_}applySelectedStyle_(t){const e=z(t);e in Mv||(Mv[e]=t.getStyle()),t.setStyle(this.style_)}restorePreviousStyle_(t){const e=this.getMap().getInteractions().getArray();for(let i=e.length-1;i>=0;--i){const n=e[i];if(n!==this&&n instanceof Av&&n.getStyle()&&-1!==n.getFeatures().getArray().lastIndexOf(t))return void t.setStyle(n.getStyle())}const i=z(t);t.setStyle(Mv[i]),delete Mv[i]}removeFeatureLayerAssociation_(t){delete this.featureLayerAssociation_[z(t)]}selectFeature(t){const e=this.findLayerOfFeature_(t);if(!this.layerFilter_(e)||!this.filter_(t,e))return!1;const i=this.getFeatures();return!i.getArray().includes(t)&&(this.addFeatureLayerAssociation_(t,e),i.push(t),this.dispatchEvent(new Lv(Fv,[t],[],void 0)),!0)}deselectFeature(t){const e=this.getFeatures(),i=e.getArray().indexOf(t);return-1!==i&&(e.removeAt(i),this.dispatchEvent(new Lv(Fv,[],[t],void 0)),!0)}toggleFeature(t){this.deselectFeature(t)||this.selectFeature(t)}clearSelection(){const t=this.getFeatures();if(0!==t.getLength()){const e=t.getArray().slice();t.clear(),this.dispatchEvent(new Lv(Fv,[],e,void 0))}}handleEvent(t){if(!this.condition_(t))return!0;const e=this.addCondition_(t),i=this.removeCondition_(t),n=this.toggleCondition_(t),r=!e&&!i&&!n,s=t.map,o=this.getFeatures(),a=[],l=[];if(r){s.forEachFeatureAtPixel(t.pixel,((t,e)=>{if(t instanceof At&&this.filter_(t,e))return this.addFeatureLayerAssociation_(t,e),l.push(t),!this.multi_}),{layerFilter:this.layerFilter_,hitTolerance:this.hitTolerance_});for(let t=o.getLength()-1;t>=0;--t){const e=o.item(t),i=l.indexOf(e);-1===i?(o.removeAt(t),a.push(e)):l.splice(i,1)}0!==l.length&&o.extend(l)}else{s.forEachFeatureAtPixel(t.pixel,((t,r)=>{if(!(t instanceof At&&this.filter_(t,r)))return;const s=o.getArray().includes(t);return s&&(i||n)?a.push(t):s||!e&&!n||(this.addFeatureLayerAssociation_(t,r),l.push(t)),!this.multi_}),{layerFilter:this.layerFilter_,hitTolerance:this.hitTolerance_});for(let t=a.length-1;t>=0;--t)o.remove(a[t]);o.extend(l)}return(l.length>0||a.length>0)&&this.dispatchEvent(new Lv(Fv,l,a,t)),!0}}const Ov="snap",Dv="unsnap";class Nv extends M{constructor(t,e){super(t),this.vertex=e.vertex,this.vertexPixel=e.vertexPixel,this.feature=e.feature,this.segment=e.segment}}const kv={Circle(t,e){let i=t;const n=Gn();n&&(i=i.clone().transform(n,e));const r=_s(i);return n&&r.transform(e,n),kv.Polygon(r)},GeometryCollection(t,e){const i=[],n=t.getGeometriesArray();for(let t=0;t<n.length;++t){const r=this[n[t].getType()];r&&i.push(r(n[t],e))}return i.flat()},LineString(t){const e=[],i=t.getFlatCoordinates(),n=t.getStride();for(let t=0,r=i.length-n;t<r;t+=n)e.push([i.slice(t,t+2),i.slice(t+n,t+n+2)]);return e},MultiLineString(t){const e=[],i=t.getFlatCoordinates(),n=t.getStride(),r=t.getEnds();let s=0;for(let t=0,o=r.length;t<o;++t){const o=r[t];for(let t=s,r=o-n;t<r;t+=n)e.push([i.slice(t,t+2),i.slice(t+n,t+n+2)]);s=o}return e},MultiPoint(t){const e=[],i=t.getFlatCoordinates(),n=t.getStride();for(let t=0,r=i.length;t<r;t+=n)e.push([i.slice(t,t+2)]);return e},MultiPolygon(t){const e=[],i=t.getFlatCoordinates(),n=t.getStride(),r=t.getEndss();let s=0;for(let t=0,o=r.length;t<o;++t){const o=r[t];for(let t=0,r=o.length;t<r;++t){const r=o[t];for(let t=s,o=r-n;t<o;t+=n)e.push([i.slice(t,t+2),i.slice(t+n,t+n+2)]);s=r}}return e},Point:t=>[[t.getFlatCoordinates().slice(0,2)]],Polygon(t){const e=[],i=t.getFlatCoordinates(),n=t.getStride(),r=t.getEnds();let s=0;for(let t=0,o=r.length;t<o;++t){const o=r[t];for(let t=s,r=o-n;t<r;t+=n)e.push([i.slice(t,t+2),i.slice(t+n,t+n+2)]);s=o}return e}};function Gv(t){return t.feature?t.feature:t.element?t.element:null}const jv=[],Uv=[],Bv=[];const zv="translatestart",Xv="translating",Vv="translateend";class $v extends M{constructor(t,e,i,n,r){super(t),this.features=e,this.coordinate=i,this.startCoordinate=n,this.mapBrowserEvent=r}}function Wv(t,e,i,n,r,s){void 0!==r?s=void 0!==s?s:0:(r=[],s=0);let o=e;for(;o<i;){const e=t[o++];r[s++]=t[o++],r[s++]=e;for(let e=2;e<n;++e)r[s++]=t[o++]}return r.length=s,r}class Zv{constructor(){this.dataProjection=void 0,this.defaultFeatureProjection=void 0,this.featureClass=At,this.supportedMediaTypes=null}getReadOptions(t,e){if(e){let i=e.dataProjection?En(e.dataProjection):this.readProjection(t);e.extent&&i&&"tile-pixels"===i.getUnits()&&(i=En(i),i.setWorldExtent(e.extent)),e={dataProjection:i,featureProjection:e.featureProjection}}return this.adaptOptions(e)}adaptOptions(t){return Object.assign({dataProjection:this.dataProjection,featureProjection:this.defaultFeatureProjection,featureClass:this.featureClass},t)}getType(){return U()}readFeature(t,e){return U()}readFeatures(t,e){return U()}readGeometry(t,e){return U()}readProjection(t){return U()}writeFeature(t,e){return U()}writeFeatures(t,e){return U()}writeGeometry(t,e){return U()}}function Yv(t,e,i){const n=i?En(i.featureProjection):null,r=i?En(i.dataProjection):null;let s=t;if(n&&r&&!Fn(n,r)){e&&(s=t.clone());const i=e?n:r,o=e?r:n;"tile-pixels"===i.getUnits()?s.transform(i,o):s.applyTransform(An(i,o))}if(e&&i&&void 0!==i.decimals){const e=Math.pow(10,i.decimals),n=function(t){for(let i=0,n=t.length;i<n;++i)t[i]=Math.round(t[i]*e)/e;return t};s===t&&(s=t.clone()),s.applyTransform(n)}return s}function Hv(t,e){const i=e?En(e.featureProjection):null,n=e?En(e.dataProjection):null;return i&&n&&!Fn(i,n)?Dn(t,n,i):t}const Kv={Point:Wr,LineString:Dd,Polygon:gs,MultiPoint:kd,MultiLineString:Nd,MultiPolygon:Gd};function qv(t,e){const i=t.geometry;if(!i)return[];if(Array.isArray(i))return i.map((e=>qv({...t,geometry:e}))).flat();const n="MultiPolygon"===i.type?"Polygon":i.type;if("GeometryCollection"===n||"Circle"===n)throw new Error("Unsupported geometry type: "+n);const r=i.layout.length;return Yv(new Ud(n,"Polygon"===n?function(t,e,i){return Array.isArray(e[0])?(hs(t,0,e,i)||us(t=t.slice(),0,e,i),t):(ls(t,0,e,i)||cs(t=t.slice(),0,e,i),t)}(i.flatCoordinates,i.ends,r):i.flatCoordinates,i.ends?.flat(),r,t.properties||{},t.id).enableSimplifyTransformed(),!1,e)}function Jv(t,e){if(!t)return null;if(Array.isArray(t)){const i=t.map((t=>Jv(t,e)));return new Md(i)}return Yv(new(0,Kv[t.type])(t.flatCoordinates,t.layout||"XY",t.ends),!1,e)}class Qv extends Zv{constructor(){super()}getType(){return"json"}readFeature(t,e){return this.readFeatureFromObject(tS(t),this.getReadOptions(t,e))}readFeatures(t,e){return this.readFeaturesFromObject(tS(t),this.getReadOptions(t,e))}readFeatureFromObject(t,e){return U()}readFeaturesFromObject(t,e){return U()}readGeometry(t,e){return this.readGeometryFromObject(tS(t),this.getReadOptions(t,e))}readGeometryFromObject(t,e){return U()}readProjection(t){return this.readProjectionFromObject(tS(t))}readProjectionFromObject(t){return U()}writeFeature(t,e){return JSON.stringify(this.writeFeatureObject(t,e))}writeFeatureObject(t,e){return U()}writeFeatures(t,e){return JSON.stringify(this.writeFeaturesObject(t,e))}writeFeaturesObject(t,e){return U()}writeGeometry(t,e){return JSON.stringify(this.writeGeometryObject(t,e))}writeGeometryObject(t,e){return U()}}function tS(t){if("string"==typeof t){const e=JSON.parse(t);return e||null}return null!==t?t:null}const eS={Point:function(t){let e;e=void 0!==t.m&&void 0!==t.z?new Wr([t.x,t.y,t.z,t.m],"XYZM"):void 0!==t.z?new Wr([t.x,t.y,t.z],"XYZ"):void 0!==t.m?new Wr([t.x,t.y,t.m],"XYM"):new Wr([t.x,t.y]);return e},LineString:function(t){const e=rS(t);return new Dd(t.paths[0],e)},Polygon:function(t){const e=rS(t);return new gs(t.rings,e)},MultiPoint:function(t){const e=rS(t);return new kd(t.points,e)},MultiLineString:function(t){const e=rS(t);return new Nd(t.paths,e)},MultiPolygon:function(t){const e=rS(t);return new Gd(t.rings,e)}},iS={Point:function(t,e){const i=t.getCoordinates();let n;const r=t.getLayout();if("XYZ"===r)n={x:i[0],y:i[1],z:i[2]};else if("XYM"===r)n={x:i[0],y:i[1],m:i[2]};else if("XYZM"===r)n={x:i[0],y:i[1],z:i[2],m:i[3]};else{if("XY"!==r)throw new Error("Invalid geometry layout");n={x:i[0],y:i[1]}}return n},LineString:function(t,e){const i=sS(t);return{hasZ:i.hasZ,hasM:i.hasM,paths:[t.getCoordinates()]}},Polygon:function(t,e){const i=sS(t);return{hasZ:i.hasZ,hasM:i.hasM,rings:t.getCoordinates(!1)}},MultiPoint:function(t,e){const i=sS(t);return{hasZ:i.hasZ,hasM:i.hasM,points:t.getCoordinates()}},MultiLineString:function(t,e){const i=sS(t);return{hasZ:i.hasZ,hasM:i.hasM,paths:t.getCoordinates()}},MultiPolygon:function(t,e){const i=sS(t),n=t.getCoordinates(!1),r=[];for(let t=0;t<n.length;t++)for(let e=n[t].length-1;e>=0;e--)r.push(n[t][e]);return{hasZ:i.hasZ,hasM:i.hasM,rings:r}}};function nS(t,e){if(!t)return null;let i;if("number"==typeof t.x&&"number"==typeof t.y)i="Point";else if(t.points)i="MultiPoint";else if(t.paths){i=1===t.paths.length?"LineString":"MultiLineString"}else if(t.rings){const e=t,n=rS(e),r=function(t,e){const i=[],n=[],r=[];let s,o;for(s=0,o=t.length;s<o;++s){i.length=0,Mr(i,0,t[s],e.length);as(i,0,i.length,e.length)?n.push([t[s]]):r.push(t[s])}for(;r.length;){const t=r.shift();let e=!1;for(s=n.length-1;s>=0;s--){const i=n[s][0];if(Wt(new $r(i).getExtent(),new $r(t).getExtent())){n[s].push(t),e=!0;break}}e||n.push([t.reverse()])}return n}(e.rings,n);1===r.length?(i="Polygon",t=Object.assign({},t,{rings:r[0]})):(i="MultiPolygon",t=Object.assign({},t,{rings:r}))}return Yv((0,eS[i])(t),!1,e)}function rS(t){let e="XY";return!0===t.hasZ&&!0===t.hasM?e="XYZM":!0===t.hasZ?e="XYZ":!0===t.hasM&&(e="XYM"),e}function sS(t){const e=t.getLayout();return{hasZ:"XYZ"===e||"XYZM"===e,hasM:"XYM"===e||"XYZM"===e}}function oS(t,e){return(0,iS[t.getType()])(Yv(t,!0,e),e)}class aS extends Zv{constructor(){super(),this.xmlSerializer_=Pp()}getType(){return"xml"}readFeature(t,e){if(!t)return null;if("string"==typeof t){const i=cp(t);return this.readFeatureFromDocument(i,e)}return lp(t)?this.readFeatureFromDocument(t,e):this.readFeatureFromNode(t,e)}readFeatureFromDocument(t,e){const i=this.readFeaturesFromDocument(t,e);return i.length>0?i[0]:null}readFeatureFromNode(t,e){return null}readFeatures(t,e){if(!t)return[];if("string"==typeof t){const i=cp(t);return this.readFeaturesFromDocument(i,e)}return lp(t)?this.readFeaturesFromDocument(t,e):this.readFeaturesFromNode(t,e)}readFeaturesFromDocument(t,e){const i=[];for(let n=t.firstChild;n;n=n.nextSibling)n.nodeType==Node.ELEMENT_NODE&&E(i,this.readFeaturesFromNode(n,e));return i}readFeaturesFromNode(t,e){return U()}readGeometry(t,e){if(!t)return null;if("string"==typeof t){const i=cp(t);return this.readGeometryFromDocument(i,e)}return lp(t)?this.readGeometryFromDocument(t,e):this.readGeometryFromNode(t,e)}readGeometryFromDocument(t,e){return null}readGeometryFromNode(t,e){return null}readProjection(t){if(!t)return null;if("string"==typeof t){const e=cp(t);return this.readProjectionFromDocument(e)}return lp(t)?this.readProjectionFromDocument(t):this.readProjectionFromNode(t)}readProjectionFromDocument(t){return this.dataProjection}readProjectionFromNode(t){return this.dataProjection}writeFeature(t,e){const i=this.writeFeatureNode(t,e);return this.xmlSerializer_.serializeToString(i)}writeFeatureNode(t,e){return null}writeFeatures(t,e){const i=this.writeFeaturesNode(t,e);return this.xmlSerializer_.serializeToString(i)}writeFeaturesNode(t,e){return null}writeGeometry(t,e){const i=this.writeGeometryNode(t,e);return this.xmlSerializer_.serializeToString(i)}writeGeometryNode(t,e){return null}}const lS="http://www.opengis.net/gml",hS=/^\s*$/;class cS extends aS{constructor(t){super(),t=t||{},this.featureType=t.featureType,this.featureNS=t.featureNS,this.srsName=t.srsName,this.schemaLocation="",this.FEATURE_COLLECTION_PARSERS={},this.FEATURE_COLLECTION_PARSERS[this.namespace]={featureMember:dp(this.readFeaturesInternal),featureMembers:gp(this.readFeaturesInternal)},this.supportedMediaTypes=["application/gml+xml"]}readFeaturesInternal(t,e){const i=t.localName;let n=null;if("FeatureCollection"==i)n=wp([],this.FEATURE_COLLECTION_PARSERS,t,e,this);else if("featureMembers"==i||"featureMember"==i||"member"==i){const r=e[0];let s=r.featureType,o=r.featureNS;const a="p",l="p0";if(!s&&t.childNodes){s=[],o={};for(let e=0,i=t.childNodes.length;e<i;++e){const i=t.childNodes[e];if(1===i.nodeType){const t=i.nodeName.split(":").pop();if(!s.includes(t)){let e="",n=0;const r=i.namespaceURI;for(const t in o){if(o[t]===r){e=t;break}++n}e||(e=a+n,o[e]=r),s.push(e+":"+t)}}}"featureMember"!=i&&(r.featureType=s,r.featureNS=o)}if("string"==typeof o){const t=o;o={},o[l]=t}const h={},c=Array.isArray(s)?s:[s];for(const t in o){const e={};for(let n=0,r=c.length;n<r;++n){(c[n].includes(":")?c[n].split(":")[0]:l)===t&&(e[c[n].split(":").pop()]="featureMembers"==i?dp(this.readFeatureElement,this):gp(this.readFeatureElement,this))}h[o[t]]=e}n=wp("featureMember"==i||"member"==i?void 0:[],h,t,e)}return null===n&&(n=[]),n}readGeometryOrExtent(t,e){const i=e[0];return i.srsName=t.firstElementChild.getAttribute("srsName"),i.srsDimension=t.firstElementChild.getAttribute("srsDimension"),wp(null,this.GEOMETRY_PARSERS,t,e,this)}readExtentElement(t,e){const i=e[0],n=this.readGeometryOrExtent(t,e);return n?Hv(n,i):void 0}readGeometryElement(t,e){const i=e[0],n=this.readGeometryOrExtent(t,e);return n?Yv(n,!1,i):void 0}readFeatureElementInternal(t,e,i){let n;const r={};for(let s=t.firstElementChild;s;s=s.nextElementSibling){let t;const o=s.localName;0===s.childNodes.length||1===s.childNodes.length&&(3===s.firstChild.nodeType||4===s.firstChild.nodeType)?(t=op(s,!1),hS.test(t)&&(t=void 0)):(i&&(t="boundedBy"===o?this.readExtentElement(s,e):this.readGeometryElement(s,e)),t?"boundedBy"!==o&&(n=o):t=this.readFeatureElementInternal(s,e,!1));const a=s.attributes.length;if(a>0&&!(t instanceof _r)){t={_content_:t};for(let e=0;e<a;e++){t[s.attributes[e].name]=s.attributes[e].value}}r[o]?(r[o]instanceof Array||(r[o]=[r[o]]),r[o].push(t)):r[o]=t}if(!i)return r;const s=new At(r);n&&s.setGeometryName(n);const o=t.getAttribute("fid")||hp(t,this.namespace,"id");return o&&s.setId(o),s}readFeatureElement(t,e){return this.readFeatureElementInternal(t,e,!0)}readPoint(t,e){const i=this.readFlatCoordinatesFromNode(t,e);if(i)return new Wr(i,"XYZ")}readMultiPoint(t,e){const i=wp([],this.MULTIPOINT_PARSERS,t,e,this);if(i)return new kd(i)}readMultiLineString(t,e){const i=wp([],this.MULTILINESTRING_PARSERS,t,e,this);if(i)return new Nd(i)}readMultiPolygon(t,e){const i=wp([],this.MULTIPOLYGON_PARSERS,t,e,this);if(i)return new Gd(i)}pointMemberParser(t,e){Ep(this.POINTMEMBER_PARSERS,t,e,this)}lineStringMemberParser(t,e){Ep(this.LINESTRINGMEMBER_PARSERS,t,e,this)}polygonMemberParser(t,e){Ep(this.POLYGONMEMBER_PARSERS,t,e,this)}readLineString(t,e){const i=this.readFlatCoordinatesFromNode(t,e);if(i){return new Dd(i,"XYZ")}}readFlatLinearRing(t,e){const i=wp(null,this.GEOMETRY_FLAT_COORDINATES_PARSERS,t,e,this);if(i)return i}readLinearRing(t,e){const i=this.readFlatCoordinatesFromNode(t,e);if(i)return new $r(i,"XYZ")}readPolygon(t,e){const i=wp([null],this.FLAT_LINEAR_RINGS_PARSERS,t,e,this);if(i&&i[0]){const t=i[0],e=[t.length];let n,r;for(n=1,r=i.length;n<r;++n)E(t,i[n]),e.push(t.length);return new gs(t,"XYZ",e)}}readFlatCoordinatesFromNode(t,e){return wp(null,this.GEOMETRY_FLAT_COORDINATES_PARSERS,t,e,this)}readGeometryFromNode(t,e){const i=this.readGeometryElement(t,[this.getReadOptions(t,e||{})]);return i||null}readFeaturesFromNode(t,e){const i={featureType:this.featureType,featureNS:this.featureNS};i&&Object.assign(i,this.getReadOptions(t,e));return this.readFeaturesInternal(t,[i])||[]}readProjectionFromNode(t){return En(this.srsName?this.srsName:t.firstElementChild.getAttribute("srsName"))}}function uS(t){return dS(op(t,!1))}function dS(t){const e=/^\s*(true|1)|(false|0)\s*$/.exec(t);if(e)return void 0!==e[1]||!1}function gS(t){const e=op(t,!1),i=Date.parse(e);return isNaN(i)?void 0:i/1e3}function fS(t){return pS(op(t,!1))}function pS(t){const e=/^\s*([+\-]?\d*\.?\d+(?:e[+\-]?\d+)?)\s*$/i.exec(t);if(e)return parseFloat(e[1])}function _S(t){return mS(op(t,!1))}function mS(t){const e=/^\s*(\d+)\s*$/.exec(t);if(e)return parseInt(e[1],10)}function yS(t){return op(t,!1).trim()}function xS(t,e){RS(t,e?"1":"0")}function vS(t,e){t.appendChild(Ip().createCDATASection(e))}function SS(t,e){const i=new Date(1e3*e),n=i.getUTCFullYear()+"-"+qe(i.getUTCMonth()+1,2)+"-"+qe(i.getUTCDate(),2)+"T"+qe(i.getUTCHours(),2)+":"+qe(i.getUTCMinutes(),2)+":"+qe(i.getUTCSeconds(),2)+"Z";t.appendChild(Ip().createTextNode(n))}function ES(t,e){const i=e.toPrecision();t.appendChild(Ip().createTextNode(i))}function wS(t,e){const i=e.toString();t.appendChild(Ip().createTextNode(i))}cS.prototype.namespace=lS,cS.prototype.FLAT_LINEAR_RINGS_PARSERS={"http://www.opengis.net/gml":{}},cS.prototype.GEOMETRY_FLAT_COORDINATES_PARSERS={"http://www.opengis.net/gml":{}},cS.prototype.GEOMETRY_PARSERS={"http://www.opengis.net/gml":{}},cS.prototype.MULTIPOINT_PARSERS={"http://www.opengis.net/gml":{pointMember:dp(cS.prototype.pointMemberParser),pointMembers:dp(cS.prototype.pointMemberParser)}},cS.prototype.MULTILINESTRING_PARSERS={"http://www.opengis.net/gml":{lineStringMember:dp(cS.prototype.lineStringMemberParser),lineStringMembers:dp(cS.prototype.lineStringMemberParser)}},cS.prototype.MULTIPOLYGON_PARSERS={"http://www.opengis.net/gml":{polygonMember:dp(cS.prototype.polygonMemberParser),polygonMembers:dp(cS.prototype.polygonMemberParser)}},cS.prototype.POINTMEMBER_PARSERS={"http://www.opengis.net/gml":{Point:dp(cS.prototype.readFlatCoordinatesFromNode)}},cS.prototype.LINESTRINGMEMBER_PARSERS={"http://www.opengis.net/gml":{LineString:dp(cS.prototype.readLineString)}},cS.prototype.POLYGONMEMBER_PARSERS={"http://www.opengis.net/gml":{Polygon:dp(cS.prototype.readPolygon)}},cS.prototype.RING_PARSERS={"http://www.opengis.net/gml":{LinearRing:gp(cS.prototype.readFlatLinearRing)}};const TS=/^\s/,CS=/\s$/,bS=/(\n|\t|\r|<|&| {2})/;function RS(t,e){"string"==typeof e&&(TS.test(e)||CS.test(e)||bS.test(e))?e.split("]]>").forEach(((e,i,n)=>{i<n.length-1&&(e+="]]"),i>0&&(e=">"+e),vS(t,e)})):t.appendChild(Ip().createTextNode(e))}const PS=lS+" http://schemas.opengis.net/gml/2.1.2/feature.xsd",IS={MultiLineString:"lineStringMember",MultiCurve:"curveMember",MultiPolygon:"polygonMember",MultiSurface:"surfaceMember"};class FS extends cS{constructor(t){super(t=t||{}),this.FEATURE_COLLECTION_PARSERS[lS].featureMember=dp(this.readFeaturesInternal),this.schemaLocation=t.schemaLocation?t.schemaLocation:PS}readFlatCoordinates(t,e){const i=op(t,!1).replace(/^\s*|\s*$/g,""),n=e[0].srsName;let r="enu";if(n){const t=En(n);t&&(r=t.getAxisOrientation())}const s=i.trim().split(/\s+/),o=[];for(let t=0,e=s.length;t<e;t++){const e=s[t].split(/,+/),i=parseFloat(e[0]),n=parseFloat(e[1]),a=3===e.length?parseFloat(e[2]):0;r.startsWith("en")?o.push(i,n,a):o.push(n,i,a)}return o}readBox(t,e){const i=wp([null],this.BOX_PARSERS_,t,e,this);return Kt(i[1][0],i[1][1],i[1][3],i[1][4])}innerBoundaryIsParser(t,e){const i=wp(void 0,this.RING_PARSERS,t,e,this);if(i){e[e.length-1].push(i)}}outerBoundaryIsParser(t,e){const i=wp(void 0,this.RING_PARSERS,t,e,this);if(i){e[e.length-1][0]=i}}GEOMETRY_NODE_FACTORY_(t,e,i){const n=e[e.length-1],r=n.multiSurface,s=n.surface,o=n.multiCurve;return Array.isArray(t)?i="Envelope":"MultiPolygon"===(i=t.getType())&&!0===r?i="MultiSurface":"Polygon"===i&&!0===s?i="Surface":"MultiLineString"===i&&!0===o&&(i="MultiCurve"),sp("http://www.opengis.net/gml",i)}writeFeatureElement(t,e,i){const n=e.getId();n&&t.setAttribute("fid",n);const r=i[i.length-1],s=r.featureNS,o=e.getGeometryName();r.serializers||(r.serializers={},r.serializers[s]={});const a=[],l=[];if(e.hasProperties()){const t=e.getProperties();for(const e in t){const i=t[e];null!=i&&(a.push(e),l.push(i),e==o||"function"==typeof i.getSimplifiedGeometry?e in r.serializers[s]||(r.serializers[s][e]=_p(this.writeGeometryElement,this)):e in r.serializers[s]||(r.serializers[s][e]=_p(RS)))}}const h=Object.assign({},r);h.node=t,Cp(h,r.serializers,yp(void 0,s),l,i,a)}writeCurveOrLineString(t,e,i){const n=i[i.length-1].srsName;if("LineStringSegment"!==t.nodeName&&n&&t.setAttribute("srsName",n),"LineString"===t.nodeName||"LineStringSegment"===t.nodeName){const n=this.createCoordinatesNode_(t.namespaceURI);t.appendChild(n),this.writeCoordinates_(n,e,i)}else if("Curve"===t.nodeName){const n=sp(t.namespaceURI,"segments");t.appendChild(n),this.writeCurveSegments_(n,e,i)}}writeLineStringOrCurveMember(t,e,i){const n=this.GEOMETRY_NODE_FACTORY_(e,i);n&&(t.appendChild(n),this.writeCurveOrLineString(n,e,i))}writeMultiCurveOrLineString(t,e,i){const n=i[i.length-1],r=n.hasZ,s=n.srsName,o=n.curve;s&&t.setAttribute("srsName",s);const a=e.getLineStrings();Cp({node:t,hasZ:r,srsName:s,curve:o},this.LINESTRINGORCURVEMEMBER_SERIALIZERS,this.MULTIGEOMETRY_MEMBER_NODE_FACTORY_,a,i,void 0,this)}writeGeometryElement(t,e,i){const n=i[i.length-1],r=Object.assign({},n);let s;r.node=t,s=Array.isArray(e)?Hv(e,n):Yv(e,!0,n),Cp(r,this.GEOMETRY_SERIALIZERS,this.GEOMETRY_NODE_FACTORY_,[s],i,void 0,this)}createCoordinatesNode_(t){const e=sp(t,"coordinates");return e.setAttribute("decimal","."),e.setAttribute("cs",","),e.setAttribute("ts"," "),e}writeCoordinates_(t,e,i){const n=i[i.length-1],r=n.hasZ,s=n.srsName,o=e.getCoordinates(),a=o.length,l=new Array(a);for(let t=0;t<a;++t){const e=o[t];l[t]=this.getCoords_(e,s,r)}RS(t,l.join(" "))}writeCurveSegments_(t,e,i){const n=sp(t.namespaceURI,"LineStringSegment");t.appendChild(n),this.writeCurveOrLineString(n,e,i)}writeSurfaceOrPolygon(t,e,i){const n=i[i.length-1],r=n.hasZ,s=n.srsName;if("PolygonPatch"!==t.nodeName&&s&&t.setAttribute("srsName",s),"Polygon"===t.nodeName||"PolygonPatch"===t.nodeName){const n=e.getLinearRings();Cp({node:t,hasZ:r,srsName:s},this.RING_SERIALIZERS,this.RING_NODE_FACTORY_,n,i,void 0,this)}else if("Surface"===t.nodeName){const n=sp(t.namespaceURI,"patches");t.appendChild(n),this.writeSurfacePatches_(n,e,i)}}RING_NODE_FACTORY_(t,e,i){const n=e[e.length-1],r=n.node,s=n.exteriorWritten;return void 0===s&&(n.exteriorWritten=!0),sp(r.namespaceURI,void 0!==s?"innerBoundaryIs":"outerBoundaryIs")}writeSurfacePatches_(t,e,i){const n=sp(t.namespaceURI,"PolygonPatch");t.appendChild(n),this.writeSurfaceOrPolygon(n,e,i)}writeRing(t,e,i){const n=sp(t.namespaceURI,"LinearRing");t.appendChild(n),this.writeLinearRing(n,e,i)}getCoords_(t,e,i){let n=(e?En(e).getAxisOrientation():"enu").startsWith("en")?t[0]+","+t[1]:t[1]+","+t[0];if(i){n+=","+(t[2]||0)}return n}writePoint(t,e,i){const n=i[i.length-1],r=n.hasZ,s=n.srsName;s&&t.setAttribute("srsName",s);const o=this.createCoordinatesNode_(t.namespaceURI);t.appendChild(o);const a=e.getCoordinates();RS(o,this.getCoords_(a,s,r))}writeMultiPoint(t,e,i){const n=i[i.length-1],r=n.hasZ,s=n.srsName;s&&t.setAttribute("srsName",s);const o=e.getPoints();Cp({node:t,hasZ:r,srsName:s},this.POINTMEMBER_SERIALIZERS,yp("pointMember"),o,i,void 0,this)}writePointMember(t,e,i){const n=sp(t.namespaceURI,"Point");t.appendChild(n),this.writePoint(n,e,i)}writeLinearRing(t,e,i){const n=i[i.length-1].srsName;n&&t.setAttribute("srsName",n);const r=this.createCoordinatesNode_(t.namespaceURI);t.appendChild(r),this.writeCoordinates_(r,e,i)}writeMultiSurfaceOrPolygon(t,e,i){const n=i[i.length-1],r=n.hasZ,s=n.srsName,o=n.surface;s&&t.setAttribute("srsName",s);const a=e.getPolygons();Cp({node:t,hasZ:r,srsName:s,surface:o},this.SURFACEORPOLYGONMEMBER_SERIALIZERS,this.MULTIGEOMETRY_MEMBER_NODE_FACTORY_,a,i,void 0,this)}writeSurfaceOrPolygonMember(t,e,i){const n=this.GEOMETRY_NODE_FACTORY_(e,i);n&&(t.appendChild(n),this.writeSurfaceOrPolygon(n,e,i))}writeEnvelope(t,e,i){const n=i[i.length-1].srsName;n&&t.setAttribute("srsName",n);const r=[e[0]+" "+e[1],e[2]+" "+e[3]];Cp({node:t},this.ENVELOPE_SERIALIZERS,xp,r,i,["lowerCorner","upperCorner"],this)}MULTIGEOMETRY_MEMBER_NODE_FACTORY_(t,e,i){const n=e[e.length-1].node;return sp("http://www.opengis.net/gml",IS[n.nodeName])}}FS.prototype.GEOMETRY_FLAT_COORDINATES_PARSERS={"http://www.opengis.net/gml":{coordinates:gp(FS.prototype.readFlatCoordinates)}},FS.prototype.FLAT_LINEAR_RINGS_PARSERS={"http://www.opengis.net/gml":{innerBoundaryIs:FS.prototype.innerBoundaryIsParser,outerBoundaryIs:FS.prototype.outerBoundaryIsParser}},FS.prototype.BOX_PARSERS_={"http://www.opengis.net/gml":{coordinates:dp(FS.prototype.readFlatCoordinates)}},FS.prototype.GEOMETRY_PARSERS={"http://www.opengis.net/gml":{Point:gp(cS.prototype.readPoint),MultiPoint:gp(cS.prototype.readMultiPoint),LineString:gp(cS.prototype.readLineString),MultiLineString:gp(cS.prototype.readMultiLineString),LinearRing:gp(cS.prototype.readLinearRing),Polygon:gp(cS.prototype.readPolygon),MultiPolygon:gp(cS.prototype.readMultiPolygon),Box:gp(FS.prototype.readBox)}},FS.prototype.GEOMETRY_SERIALIZERS={"http://www.opengis.net/gml":{Curve:_p(FS.prototype.writeCurveOrLineString),MultiCurve:_p(FS.prototype.writeMultiCurveOrLineString),Point:_p(FS.prototype.writePoint),MultiPoint:_p(FS.prototype.writeMultiPoint),LineString:_p(FS.prototype.writeCurveOrLineString),MultiLineString:_p(FS.prototype.writeMultiCurveOrLineString),LinearRing:_p(FS.prototype.writeLinearRing),Polygon:_p(FS.prototype.writeSurfaceOrPolygon),MultiPolygon:_p(FS.prototype.writeMultiSurfaceOrPolygon),Surface:_p(FS.prototype.writeSurfaceOrPolygon),MultiSurface:_p(FS.prototype.writeMultiSurfaceOrPolygon),Envelope:_p(FS.prototype.writeEnvelope)}},FS.prototype.LINESTRINGORCURVEMEMBER_SERIALIZERS={"http://www.opengis.net/gml":{lineStringMember:_p(FS.prototype.writeLineStringOrCurveMember),curveMember:_p(FS.prototype.writeLineStringOrCurveMember)}},FS.prototype.RING_SERIALIZERS={"http://www.opengis.net/gml":{outerBoundaryIs:_p(FS.prototype.writeRing),innerBoundaryIs:_p(FS.prototype.writeRing)}},FS.prototype.POINTMEMBER_SERIALIZERS={"http://www.opengis.net/gml":{pointMember:_p(FS.prototype.writePointMember)}},FS.prototype.SURFACEORPOLYGONMEMBER_SERIALIZERS={"http://www.opengis.net/gml":{surfaceMember:_p(FS.prototype.writeSurfaceOrPolygonMember),polygonMember:_p(FS.prototype.writeSurfaceOrPolygonMember)}},FS.prototype.ENVELOPE_SERIALIZERS={"http://www.opengis.net/gml":{lowerCorner:_p(RS),upperCorner:_p(RS)}};const LS=lS+" http://schemas.opengis.net/gml/3.1.1/profiles/gmlsfProfile/1.0.0/gmlsf.xsd",MS={MultiLineString:"lineStringMember",MultiCurve:"curveMember",MultiPolygon:"polygonMember",MultiSurface:"surfaceMember"};class AS extends cS{constructor(t){super(t=t||{}),this.surface_=void 0!==t.surface&&t.surface,this.curve_=void 0!==t.curve&&t.curve,this.multiCurve_=void 0===t.multiCurve||t.multiCurve,this.multiSurface_=void 0===t.multiSurface||t.multiSurface,this.schemaLocation=t.schemaLocation?t.schemaLocation:LS,this.hasZ=void 0!==t.hasZ&&t.hasZ}readMultiCurve(t,e){const i=wp([],this.MULTICURVE_PARSERS,t,e,this);if(i){return new Nd(i)}}readFlatCurveRing(t,e){const i=wp([],this.MULTICURVE_PARSERS,t,e,this),n=[];for(let t=0,e=i.length;t<e;++t)E(n,i[t].getFlatCoordinates());return n}readMultiSurface(t,e){const i=wp([],this.MULTISURFACE_PARSERS,t,e,this);if(i)return new Gd(i)}curveMemberParser(t,e){Ep(this.CURVEMEMBER_PARSERS,t,e,this)}surfaceMemberParser(t,e){Ep(this.SURFACEMEMBER_PARSERS,t,e,this)}readPatch(t,e){return wp([null],this.PATCHES_PARSERS,t,e,this)}readSegment(t,e){return wp([],this.SEGMENTS_PARSERS,t,e,this)}readPolygonPatch(t,e){return wp([null],this.FLAT_LINEAR_RINGS_PARSERS,t,e,this)}readLineStringSegment(t,e){return wp([null],this.GEOMETRY_FLAT_COORDINATES_PARSERS,t,e,this)}interiorParser(t,e){const i=wp(void 0,this.RING_PARSERS,t,e,this);if(i){e[e.length-1].push(i)}}exteriorParser(t,e){const i=wp(void 0,this.RING_PARSERS,t,e,this);if(i){e[e.length-1][0]=i}}readSurface(t,e){const i=wp([null],this.SURFACE_PARSERS,t,e,this);if(i&&i[0]){const t=i[0],e=[t.length];let n,r;for(n=1,r=i.length;n<r;++n)E(t,i[n]),e.push(t.length);return new gs(t,"XYZ",e)}}readCurve(t,e){const i=wp([null],this.CURVE_PARSERS,t,e,this);if(i){return new Dd(i,"XYZ")}}readEnvelope(t,e){const i=wp([null],this.ENVELOPE_PARSERS,t,e,this);return Kt(i[1][0],i[1][1],i[2][0],i[2][1])}readFlatPos(t,e){let i=op(t,!1);const n=/^\s*([+\-]?\d*\.?\d+(?:[eE][+\-]?\d+)?)\s*/,r=[];let s;for(;s=n.exec(i);)r.push(parseFloat(s[1])),i=i.substr(s[0].length);if(""!==i)return;const o=e[0].srsName;if("neu"===(o?En(o).getAxisOrientation():"enu"))for(let t=0,e=r.length;t<e;t+=3){const e=r[t],i=r[t+1];r[t]=i,r[t+1]=e}const a=r.length;return 2==a&&r.push(0),0!==a?r:void 0}readFlatPosList(t,e){const i=op(t,!1).replace(/^\s*|\s*$/g,""),n=e[0],r=n.srsName,s=n.srsDimension,o=r?En(r).getAxisOrientation():"enu",a=i.split(/\s+/);let l=2;t.getAttribute("srsDimension")?l=mS(t.getAttribute("srsDimension")):t.getAttribute("dimension")?l=mS(t.getAttribute("dimension")):t.parentNode.getAttribute("srsDimension")?l=mS(t.parentNode.getAttribute("srsDimension")):s&&(l=mS(s));const h=o.startsWith("en");let c,u,d;const g=[];for(let t=0,e=a.length;t<e;t+=l)c=parseFloat(a[t]),u=parseFloat(a[t+1]),d=3===l?parseFloat(a[t+2]):0,h?g.push(c,u,d):g.push(u,c,d);return g}writePos_(t,e,i){const n=i[i.length-1],r=n.hasZ,s=r?"3":"2";t.setAttribute("srsDimension",s);const o=n.srsName,a=o?En(o).getAxisOrientation():"enu",l=e.getCoordinates();let h=a.startsWith("en")?l[0]+" "+l[1]:l[1]+" "+l[0];if(r){h+=" "+(l[2]||0)}RS(t,h)}getCoords_(t,e,i){let n=(e?En(e).getAxisOrientation():"enu").startsWith("en")?t[0]+" "+t[1]:t[1]+" "+t[0];if(i){n+=" "+(t[2]||0)}return n}writePosList_(t,e,i){const n=i[i.length-1],r=n.hasZ,s=r?"3":"2";t.setAttribute("srsDimension",s);const o=n.srsName,a=e.getCoordinates(),l=a.length,h=new Array(l);let c;for(let t=0;t<l;++t)c=a[t],h[t]=this.getCoords_(c,o,r);RS(t,h.join(" "))}writePoint(t,e,i){const n=i[i.length-1].srsName;n&&t.setAttribute("srsName",n);const r=sp(t.namespaceURI,"pos");t.appendChild(r),this.writePos_(r,e,i)}writeEnvelope(t,e,i){const n=i[i.length-1].srsName;n&&t.setAttribute("srsName",n);const r=[e[0]+" "+e[1],e[2]+" "+e[3]];Cp({node:t},this.ENVELOPE_SERIALIZERS,xp,r,i,["lowerCorner","upperCorner"],this)}writeLinearRing(t,e,i){const n=i[i.length-1].srsName;n&&t.setAttribute("srsName",n);const r=sp(t.namespaceURI,"posList");t.appendChild(r),this.writePosList_(r,e,i)}RING_NODE_FACTORY_(t,e,i){const n=e[e.length-1],r=n.node,s=n.exteriorWritten;return void 0===s&&(n.exteriorWritten=!0),sp(r.namespaceURI,void 0!==s?"interior":"exterior")}writeSurfaceOrPolygon(t,e,i){const n=i[i.length-1],r=n.hasZ,s=n.srsName;if("PolygonPatch"!==t.nodeName&&s&&t.setAttribute("srsName",s),"Polygon"===t.nodeName||"PolygonPatch"===t.nodeName){const n=e.getLinearRings();Cp({node:t,hasZ:r,srsName:s},this.RING_SERIALIZERS,this.RING_NODE_FACTORY_,n,i,void 0,this)}else if("Surface"===t.nodeName){const n=sp(t.namespaceURI,"patches");t.appendChild(n),this.writeSurfacePatches_(n,e,i)}}writeCurveOrLineString(t,e,i){const n=i[i.length-1].srsName;if("LineStringSegment"!==t.nodeName&&n&&t.setAttribute("srsName",n),"LineString"===t.nodeName||"LineStringSegment"===t.nodeName){const n=sp(t.namespaceURI,"posList");t.appendChild(n),this.writePosList_(n,e,i)}else if("Curve"===t.nodeName){const n=sp(t.namespaceURI,"segments");t.appendChild(n),this.writeCurveSegments_(n,e,i)}}writeMultiSurfaceOrPolygon(t,e,i){const n=i[i.length-1],r=n.hasZ,s=n.srsName,o=n.surface;s&&t.setAttribute("srsName",s);const a=e.getPolygons();Cp({node:t,hasZ:r,srsName:s,surface:o},this.SURFACEORPOLYGONMEMBER_SERIALIZERS,this.MULTIGEOMETRY_MEMBER_NODE_FACTORY_,a,i,void 0,this)}writeMultiPoint(t,e,i){const n=i[i.length-1],r=n.srsName,s=n.hasZ;r&&t.setAttribute("srsName",r);const o=e.getPoints();Cp({node:t,hasZ:s,srsName:r},this.POINTMEMBER_SERIALIZERS,yp("pointMember"),o,i,void 0,this)}writeMultiCurveOrLineString(t,e,i){const n=i[i.length-1],r=n.hasZ,s=n.srsName,o=n.curve;s&&t.setAttribute("srsName",s);const a=e.getLineStrings();Cp({node:t,hasZ:r,srsName:s,curve:o},this.LINESTRINGORCURVEMEMBER_SERIALIZERS,this.MULTIGEOMETRY_MEMBER_NODE_FACTORY_,a,i,void 0,this)}writeRing(t,e,i){const n=sp(t.namespaceURI,"LinearRing");t.appendChild(n),this.writeLinearRing(n,e,i)}writeSurfaceOrPolygonMember(t,e,i){const n=this.GEOMETRY_NODE_FACTORY_(e,i);n&&(t.appendChild(n),this.writeSurfaceOrPolygon(n,e,i))}writePointMember(t,e,i){const n=sp(t.namespaceURI,"Point");t.appendChild(n),this.writePoint(n,e,i)}writeLineStringOrCurveMember(t,e,i){const n=this.GEOMETRY_NODE_FACTORY_(e,i);n&&(t.appendChild(n),this.writeCurveOrLineString(n,e,i))}writeSurfacePatches_(t,e,i){const n=sp(t.namespaceURI,"PolygonPatch");t.appendChild(n),this.writeSurfaceOrPolygon(n,e,i)}writeCurveSegments_(t,e,i){const n=sp(t.namespaceURI,"LineStringSegment");t.appendChild(n),this.writeCurveOrLineString(n,e,i)}writeGeometryElement(t,e,i){const n=i[i.length-1],r=Object.assign({},n);let s;r.node=t,s=Array.isArray(e)?Hv(e,n):Yv(e,!0,n),Cp(r,this.GEOMETRY_SERIALIZERS,this.GEOMETRY_NODE_FACTORY_,[s],i,void 0,this)}writeFeatureElement(t,e,i){const n=e.getId();n&&t.setAttribute("fid",n);const r=i[i.length-1],s=r.featureNS,o=e.getGeometryName();r.serializers||(r.serializers={},r.serializers[s]={});const a=[],l=[];if(e.hasProperties()){const t=e.getProperties();for(const e in t){const i=t[e];null!=i&&(a.push(e),l.push(i),e==o||"function"==typeof i.getSimplifiedGeometry?e in r.serializers[s]||(r.serializers[s][e]=_p(this.writeGeometryElement,this)):e in r.serializers[s]||(r.serializers[s][e]=_p(RS)))}}const h=Object.assign({},r);h.node=t,Cp(h,r.serializers,yp(void 0,s),l,i,a)}writeFeatureMembers_(t,e,i){const n=i[i.length-1],r=n.featureType,s=n.featureNS,o={};o[s]={},o[s][r]=_p(this.writeFeatureElement,this);const a=Object.assign({},n);a.node=t,Cp(a,o,yp(r,s),e,i)}MULTIGEOMETRY_MEMBER_NODE_FACTORY_(t,e,i){const n=e[e.length-1].node;return sp(this.namespace,MS[n.nodeName])}GEOMETRY_NODE_FACTORY_(t,e,i){const n=e[e.length-1],r=n.multiSurface,s=n.surface,o=n.curve,a=n.multiCurve;return Array.isArray(t)?i="Envelope":"MultiPolygon"===(i=t.getType())&&!0===r?i="MultiSurface":"Polygon"===i&&!0===s?i="Surface":"LineString"===i&&!0===o?i="Curve":"MultiLineString"===i&&!0===a&&(i="MultiCurve"),sp(this.namespace,i)}writeGeometryNode(t,e){e=this.adaptOptions(e);const i=sp(this.namespace,"geom"),n={node:i,hasZ:this.hasZ,srsName:this.srsName,curve:this.curve_,surface:this.surface_,multiSurface:this.multiSurface_,multiCurve:this.multiCurve_};return e&&Object.assign(n,e),this.writeGeometryElement(i,t,[n]),i}writeFeaturesNode(t,e){e=this.adaptOptions(e);const i=sp(this.namespace,"featureMembers");i.setAttributeNS(rp,"xsi:schemaLocation",this.schemaLocation);const n={srsName:this.srsName,hasZ:this.hasZ,curve:this.curve_,surface:this.surface_,multiSurface:this.multiSurface_,multiCurve:this.multiCurve_,featureNS:this.featureNS,featureType:this.featureType};return e&&Object.assign(n,e),this.writeFeatureMembers_(i,t,[n]),i}}AS.prototype.GEOMETRY_FLAT_COORDINATES_PARSERS={"http://www.opengis.net/gml":{pos:gp(AS.prototype.readFlatPos),posList:gp(AS.prototype.readFlatPosList),coordinates:gp(FS.prototype.readFlatCoordinates)}},AS.prototype.FLAT_LINEAR_RINGS_PARSERS={"http://www.opengis.net/gml":{interior:AS.prototype.interiorParser,exterior:AS.prototype.exteriorParser}},AS.prototype.GEOMETRY_PARSERS={"http://www.opengis.net/gml":{Point:gp(cS.prototype.readPoint),MultiPoint:gp(cS.prototype.readMultiPoint),LineString:gp(cS.prototype.readLineString),MultiLineString:gp(cS.prototype.readMultiLineString),LinearRing:gp(cS.prototype.readLinearRing),Polygon:gp(cS.prototype.readPolygon),MultiPolygon:gp(cS.prototype.readMultiPolygon),Surface:gp(AS.prototype.readSurface),MultiSurface:gp(AS.prototype.readMultiSurface),Curve:gp(AS.prototype.readCurve),MultiCurve:gp(AS.prototype.readMultiCurve),Envelope:gp(AS.prototype.readEnvelope)}},AS.prototype.MULTICURVE_PARSERS={"http://www.opengis.net/gml":{curveMember:dp(AS.prototype.curveMemberParser),curveMembers:dp(AS.prototype.curveMemberParser)}},AS.prototype.MULTISURFACE_PARSERS={"http://www.opengis.net/gml":{surfaceMember:dp(AS.prototype.surfaceMemberParser),surfaceMembers:dp(AS.prototype.surfaceMemberParser)}},AS.prototype.CURVEMEMBER_PARSERS={"http://www.opengis.net/gml":{LineString:dp(cS.prototype.readLineString),Curve:dp(AS.prototype.readCurve)}},AS.prototype.SURFACEMEMBER_PARSERS={"http://www.opengis.net/gml":{Polygon:dp(cS.prototype.readPolygon),Surface:dp(AS.prototype.readSurface)}},AS.prototype.SURFACE_PARSERS={"http://www.opengis.net/gml":{patches:gp(AS.prototype.readPatch)}},AS.prototype.CURVE_PARSERS={"http://www.opengis.net/gml":{segments:gp(AS.prototype.readSegment)}},AS.prototype.ENVELOPE_PARSERS={"http://www.opengis.net/gml":{lowerCorner:dp(AS.prototype.readFlatPosList),upperCorner:dp(AS.prototype.readFlatPosList)}},AS.prototype.PATCHES_PARSERS={"http://www.opengis.net/gml":{PolygonPatch:gp(AS.prototype.readPolygonPatch)}},AS.prototype.SEGMENTS_PARSERS={"http://www.opengis.net/gml":{LineStringSegment:up(AS.prototype.readLineStringSegment)}},cS.prototype.RING_PARSERS={"http://www.opengis.net/gml":{LinearRing:gp(cS.prototype.readFlatLinearRing),Ring:gp(AS.prototype.readFlatCurveRing)}},AS.prototype.writeFeatures,AS.prototype.RING_SERIALIZERS={"http://www.opengis.net/gml":{exterior:_p(AS.prototype.writeRing),interior:_p(AS.prototype.writeRing)}},AS.prototype.ENVELOPE_SERIALIZERS={"http://www.opengis.net/gml":{lowerCorner:_p(RS),upperCorner:_p(RS)}},AS.prototype.SURFACEORPOLYGONMEMBER_SERIALIZERS={"http://www.opengis.net/gml":{surfaceMember:_p(AS.prototype.writeSurfaceOrPolygonMember),polygonMember:_p(AS.prototype.writeSurfaceOrPolygonMember)}},AS.prototype.POINTMEMBER_SERIALIZERS={"http://www.opengis.net/gml":{pointMember:_p(AS.prototype.writePointMember)}},AS.prototype.LINESTRINGORCURVEMEMBER_SERIALIZERS={"http://www.opengis.net/gml":{lineStringMember:_p(AS.prototype.writeLineStringOrCurveMember),curveMember:_p(AS.prototype.writeLineStringOrCurveMember)}},AS.prototype.GEOMETRY_SERIALIZERS={"http://www.opengis.net/gml":{Curve:_p(AS.prototype.writeCurveOrLineString),MultiCurve:_p(AS.prototype.writeMultiCurveOrLineString),Point:_p(AS.prototype.writePoint),MultiPoint:_p(AS.prototype.writeMultiPoint),LineString:_p(AS.prototype.writeCurveOrLineString),MultiLineString:_p(AS.prototype.writeMultiCurveOrLineString),LinearRing:_p(AS.prototype.writeLinearRing),Polygon:_p(AS.prototype.writeSurfaceOrPolygon),MultiPolygon:_p(AS.prototype.writeMultiSurfaceOrPolygon),Surface:_p(AS.prototype.writeSurfaceOrPolygon),MultiSurface:_p(AS.prototype.writeMultiSurfaceOrPolygon),Envelope:_p(AS.prototype.writeEnvelope)}};const OS=AS;OS.prototype.writeFeatures,OS.prototype.writeFeaturesNode;class DS extends AS{constructor(t){super(t=t||{}),this.schemaLocation=t.schemaLocation?t.schemaLocation:this.namespace+" http://schemas.opengis.net/gml/3.2.1/gml.xsd"}writeGeometryElement(t,e,i){const n=i[i.length-1];i[i.length-1]=Object.assign({multiCurve:!0,multiSurface:!0},n),super.writeGeometryElement(t,e,i)}}DS.prototype.namespace="http://www.opengis.net/gml/3.2",DS.prototype.GEOMETRY_FLAT_COORDINATES_PARSERS={"http://www.opengis.net/gml/3.2":{pos:gp(AS.prototype.readFlatPos),posList:gp(AS.prototype.readFlatPosList),coordinates:gp(FS.prototype.readFlatCoordinates)}},DS.prototype.FLAT_LINEAR_RINGS_PARSERS={"http://www.opengis.net/gml/3.2":{interior:AS.prototype.interiorParser,exterior:AS.prototype.exteriorParser}},DS.prototype.GEOMETRY_PARSERS={"http://www.opengis.net/gml/3.2":{Point:gp(cS.prototype.readPoint),MultiPoint:gp(cS.prototype.readMultiPoint),LineString:gp(cS.prototype.readLineString),MultiLineString:gp(cS.prototype.readMultiLineString),LinearRing:gp(cS.prototype.readLinearRing),Polygon:gp(cS.prototype.readPolygon),MultiPolygon:gp(cS.prototype.readMultiPolygon),Surface:gp(DS.prototype.readSurface),MultiSurface:gp(AS.prototype.readMultiSurface),Curve:gp(DS.prototype.readCurve),MultiCurve:gp(AS.prototype.readMultiCurve),Envelope:gp(DS.prototype.readEnvelope)}},DS.prototype.MULTICURVE_PARSERS={"http://www.opengis.net/gml/3.2":{curveMember:dp(AS.prototype.curveMemberParser),curveMembers:dp(AS.prototype.curveMemberParser)}},DS.prototype.MULTISURFACE_PARSERS={"http://www.opengis.net/gml/3.2":{surfaceMember:dp(AS.prototype.surfaceMemberParser),surfaceMembers:dp(AS.prototype.surfaceMemberParser)}},DS.prototype.CURVEMEMBER_PARSERS={"http://www.opengis.net/gml/3.2":{LineString:dp(cS.prototype.readLineString),Curve:dp(AS.prototype.readCurve)}},DS.prototype.SURFACEMEMBER_PARSERS={"http://www.opengis.net/gml/3.2":{Polygon:dp(cS.prototype.readPolygon),Surface:dp(AS.prototype.readSurface)}},DS.prototype.SURFACE_PARSERS={"http://www.opengis.net/gml/3.2":{patches:gp(AS.prototype.readPatch)}},DS.prototype.CURVE_PARSERS={"http://www.opengis.net/gml/3.2":{segments:gp(AS.prototype.readSegment)}},DS.prototype.ENVELOPE_PARSERS={"http://www.opengis.net/gml/3.2":{lowerCorner:dp(AS.prototype.readFlatPosList),upperCorner:dp(AS.prototype.readFlatPosList)}},DS.prototype.PATCHES_PARSERS={"http://www.opengis.net/gml/3.2":{PolygonPatch:gp(AS.prototype.readPolygonPatch)}},DS.prototype.SEGMENTS_PARSERS={"http://www.opengis.net/gml/3.2":{LineStringSegment:up(AS.prototype.readLineStringSegment)}},DS.prototype.MULTIPOINT_PARSERS={"http://www.opengis.net/gml/3.2":{pointMember:dp(cS.prototype.pointMemberParser),pointMembers:dp(cS.prototype.pointMemberParser)}},DS.prototype.MULTILINESTRING_PARSERS={"http://www.opengis.net/gml/3.2":{lineStringMember:dp(cS.prototype.lineStringMemberParser),lineStringMembers:dp(cS.prototype.lineStringMemberParser)}},DS.prototype.MULTIPOLYGON_PARSERS={"http://www.opengis.net/gml/3.2":{polygonMember:dp(cS.prototype.polygonMemberParser),polygonMembers:dp(cS.prototype.polygonMemberParser)}},DS.prototype.POINTMEMBER_PARSERS={"http://www.opengis.net/gml/3.2":{Point:dp(cS.prototype.readFlatCoordinatesFromNode)}},DS.prototype.LINESTRINGMEMBER_PARSERS={"http://www.opengis.net/gml/3.2":{LineString:dp(cS.prototype.readLineString)}},DS.prototype.POLYGONMEMBER_PARSERS={"http://www.opengis.net/gml/3.2":{Polygon:dp(cS.prototype.readPolygon)}},DS.prototype.RING_PARSERS={"http://www.opengis.net/gml/3.2":{LinearRing:gp(cS.prototype.readFlatLinearRing),Ring:gp(DS.prototype.readFlatCurveRing)}},DS.prototype.RING_SERIALIZERS={"http://www.opengis.net/gml/3.2":{exterior:_p(AS.prototype.writeRing),interior:_p(AS.prototype.writeRing)}},DS.prototype.ENVELOPE_SERIALIZERS={"http://www.opengis.net/gml/3.2":{lowerCorner:_p(RS),upperCorner:_p(RS)}},DS.prototype.SURFACEORPOLYGONMEMBER_SERIALIZERS={"http://www.opengis.net/gml/3.2":{surfaceMember:_p(AS.prototype.writeSurfaceOrPolygonMember),polygonMember:_p(AS.prototype.writeSurfaceOrPolygonMember)}},DS.prototype.POINTMEMBER_SERIALIZERS={"http://www.opengis.net/gml/3.2":{pointMember:_p(AS.prototype.writePointMember)}},DS.prototype.LINESTRINGORCURVEMEMBER_SERIALIZERS={"http://www.opengis.net/gml/3.2":{lineStringMember:_p(AS.prototype.writeLineStringOrCurveMember),curveMember:_p(AS.prototype.writeLineStringOrCurveMember)}},DS.prototype.GEOMETRY_SERIALIZERS={"http://www.opengis.net/gml/3.2":{Curve:_p(AS.prototype.writeCurveOrLineString),MultiCurve:_p(AS.prototype.writeMultiCurveOrLineString),Point:_p(DS.prototype.writePoint),MultiPoint:_p(AS.prototype.writeMultiPoint),LineString:_p(AS.prototype.writeCurveOrLineString),MultiLineString:_p(AS.prototype.writeMultiCurveOrLineString),LinearRing:_p(AS.prototype.writeLinearRing),Polygon:_p(AS.prototype.writeSurfaceOrPolygon),MultiPolygon:_p(AS.prototype.writeMultiSurfaceOrPolygon),Surface:_p(AS.prototype.writeSurfaceOrPolygon),MultiSurface:_p(AS.prototype.writeMultiSurfaceOrPolygon),Envelope:_p(AS.prototype.writeEnvelope)}};const NS=[null,"http://www.topografix.com/GPX/1/0","http://www.topografix.com/GPX/1/1"],kS={rte:gE,trk:fE,wpt:pE},GS=Sp(NS,{rte:dp(gE),trk:dp(fE),wpt:dp(pE)}),jS=Sp(NS,{text:pp(yS,"linkText"),type:pp(yS,"linkType")}),US=Sp(NS,{name:pp(yS),email:function(t,e){const i=e[e.length-1],n=t.getAttribute("id"),r=t.getAttribute("domain");null!==n&&null!==r&&(i.email=`${n}@${r}`)},link:uE}),BS=Sp(NS,{name:pp(yS),desc:pp(yS),author:pp((function(t,e){const i=wp({},US,t,e);if(i)return i;return})),copyright:pp((function(t,e){const i=wp({},zS,t,e);if(i){const e=t.getAttribute("author");return null!==e&&(i.author=e),i}return})),link:uE,time:pp(gS),keywords:pp(yS),bounds:function(t,e){const i=e[e.length-1],n=t.getAttribute("minlat"),r=t.getAttribute("minlon"),s=t.getAttribute("maxlat"),o=t.getAttribute("maxlon");null!==r&&null!==n&&null!==o&&null!==s&&(i.bounds=[[parseFloat(r),parseFloat(n)],[parseFloat(o),parseFloat(s)]])},extensions:dE}),zS=Sp(NS,{year:pp(_S),license:pp(yS)}),XS=Sp(NS,{rte:_p((function(t,e,i){const n=i[0],r=e.getProperties(),s={node:t};s.properties=r;const o=e.getGeometry();if("LineString"==o.getType()){const t=Yv(o,!0,n);s.geometryLayout=t.getLayout(),r.rtept=t.getCoordinates()}const a=i[i.length-1].node,l=JS[a.namespaceURI],h=vp(r,l);Cp(s,QS,xp,h,i,l)})),trk:_p((function(t,e,i){const n=i[0],r=e.getProperties(),s={node:t};s.properties=r;const o=e.getGeometry();if("MultiLineString"==o.getType()){const t=Yv(o,!0,n);r.trkseg=t.getLineStrings()}const a=i[i.length-1].node,l=eE[a.namespaceURI],h=vp(r,l);Cp(s,iE,xp,h,i,l)})),wpt:_p((function(t,e,i){const n=i[0],r=i[i.length-1];r.properties=e.getProperties();const s=e.getGeometry();if("Point"==s.getType()){const e=Yv(s,!0,n);r.geometryLayout=e.getLayout(),mE(t,e.getCoordinates(),i)}}))});const VS=Sp(NS,{name:pp(yS),cmt:pp(yS),desc:pp(yS),src:pp(yS),link:uE,number:pp(_S),extensions:dE,type:pp(yS),rtept:function(t,e){const i=wp({},$S,t,e);if(i){const n=e[e.length-1];hE(n.flatCoordinates,n.layoutOptions,t,i)}}}),$S=Sp(NS,{ele:pp(fS),time:pp(gS)}),WS=Sp(NS,{name:pp(yS),cmt:pp(yS),desc:pp(yS),src:pp(yS),link:uE,number:pp(_S),type:pp(yS),extensions:dE,trkseg:function(t,e){const i=e[e.length-1];Ep(ZS,t,e);const n=i.flatCoordinates;i.ends.push(n.length)}}),ZS=Sp(NS,{trkpt:function(t,e){const i=wp({},YS,t,e);if(i){const n=e[e.length-1];hE(n.flatCoordinates,n.layoutOptions,t,i)}}}),YS=Sp(NS,{ele:pp(fS),time:pp(gS)}),HS=Sp(NS,{ele:pp(fS),time:pp(gS),magvar:pp(fS),geoidheight:pp(fS),name:pp(yS),cmt:pp(yS),desc:pp(yS),src:pp(yS),link:uE,sym:pp(yS),type:pp(yS),fix:pp(yS),sat:pp(_S),hdop:pp(fS),vdop:pp(fS),pdop:pp(fS),ageofdgpsdata:pp(fS),dgpsid:pp(_S),extensions:dE}),KS=["text","type"],qS=Sp(NS,{text:_p(RS),type:_p(RS)}),JS=Sp(NS,["name","cmt","desc","src","link","number","type","rtept"]),QS=Sp(NS,{name:_p(RS),cmt:_p(RS),desc:_p(RS),src:_p(RS),link:_p(_E),number:_p(wS),type:_p(RS),rtept:mp(_p(mE))}),tE=Sp(NS,["ele","time"]),eE=Sp(NS,["name","cmt","desc","src","link","number","type","trkseg"]),iE=Sp(NS,{name:_p(RS),cmt:_p(RS),desc:_p(RS),src:_p(RS),link:_p(_E),number:_p(wS),type:_p(RS),trkseg:mp(_p((function(t,e,i){const n={node:t};n.geometryLayout=e.getLayout(),n.properties={},Cp(n,rE,nE,e.getCoordinates(),i)})))}),nE=yp("trkpt"),rE=Sp(NS,{trkpt:_p(mE)}),sE=Sp(NS,["ele","time","magvar","geoidheight","name","cmt","desc","src","link","sym","type","fix","sat","hdop","vdop","pdop","ageofdgpsdata","dgpsid"]),oE=Sp(NS,{ele:_p(ES),time:_p(SS),magvar:_p(ES),geoidheight:_p(ES),name:_p(RS),cmt:_p(RS),desc:_p(RS),src:_p(RS),link:_p(_E),sym:_p(RS),type:_p(RS),fix:_p(RS),sat:_p(wS),hdop:_p(ES),vdop:_p(ES),pdop:_p(ES),ageofdgpsdata:_p(ES),dgpsid:_p(wS)}),aE={Point:"wpt",LineString:"rte",MultiLineString:"trk"};function lE(t,e,i){const n=t.getGeometry();if(n){const t=aE[n.getType()];if(t){return sp(e[e.length-1].node.namespaceURI,t)}}}function hE(t,e,i,n){return t.push(parseFloat(i.getAttribute("lon")),parseFloat(i.getAttribute("lat"))),"ele"in n?(t.push(n.ele),delete n.ele,e.hasZ=!0):t.push(0),"time"in n?(t.push(n.time),delete n.time,e.hasM=!0):t.push(0),t}function cE(t,e,i){let n="XY",r=2;if(t.hasZ&&t.hasM?(n="XYZM",r=4):t.hasZ?(n="XYZ",r=3):t.hasM&&(n="XYM",r=3),4!==r){for(let i=0,n=e.length/4;i<n;i++)e[i*r]=e[4*i],e[i*r+1]=e[4*i+1],t.hasZ&&(e[i*r+2]=e[4*i+2]),t.hasM&&(e[i*r+2]=e[4*i+3]);if(e.length=e.length/4*r,i)for(let t=0,e=i.length;t<e;t++)i[t]=i[t]/4*r}return n}function uE(t,e){const i=e[e.length-1],n=t.getAttribute("href");null!==n&&(i.link=n),Ep(jS,t,e)}function dE(t,e){e[e.length-1].extensionsNode_=t}function gE(t,e){const i=e[0],n=wp({flatCoordinates:[],layoutOptions:{}},VS,t,e);if(!n)return;const r=n.flatCoordinates;delete n.flatCoordinates;const s=n.layoutOptions;delete n.layoutOptions;const o=cE(s,r),a=new Dd(r,o);Yv(a,!1,i);const l=new At(a);return l.setProperties(n,!0),l}function fE(t,e){const i=e[0],n=wp({flatCoordinates:[],ends:[],layoutOptions:{}},WS,t,e);if(!n)return;const r=n.flatCoordinates;delete n.flatCoordinates;const s=n.ends;delete n.ends;const o=n.layoutOptions;delete n.layoutOptions;const a=cE(o,r,s),l=new Nd(r,a,s);Yv(l,!1,i);const h=new At(l);return h.setProperties(n,!0),h}function pE(t,e){const i=e[0],n=wp({},HS,t,e);if(!n)return;const r={},s=hE([],r,t,n),o=cE(r,s),a=new Wr(s,o);Yv(a,!1,i);const l=new At(a);return l.setProperties(n,!0),l}function _E(t,e,i){t.setAttribute("href",e);const n=i[i.length-1].properties,r=[n.linkText,n.linkType];Cp({node:t},qS,xp,r,i,KS)}function mE(t,e,i){const n=i[i.length-1],r=n.node.namespaceURI,s=n.properties;t.setAttributeNS(null,"lat",String(e[1])),t.setAttributeNS(null,"lon",String(e[0]));switch(n.geometryLayout){case"XYZM":0!==e[3]&&(s.time=e[3]);case"XYZ":0!==e[2]&&(s.ele=e[2]);break;case"XYM":0!==e[2]&&(s.time=e[2])}const o="rtept"==t.nodeName?tE[r]:sE[r],a=vp(s,o);Cp({node:t,properties:s},oE,xp,a,i,o)}function yE(t,e){if(!t)return null;let i;switch(t.type){case"Point":i=function(t){const e=t.coordinates;return{type:"Point",flatCoordinates:e,layout:yr(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:yr(e[0]?.length||2)}}(t);break;case"Polygon":i=function(t){const e=t.coordinates,i=[],n=e[0]?.[0]?.length,r=Ar(i,0,e,n);return{type:"Polygon",flatCoordinates:i,ends:r,layout:yr(n)}}(t);break;case"MultiPoint":i=function(t){const e=t.coordinates;return{type:"MultiPoint",flatCoordinates:e.flat(),layout:yr(e[0]?.length||2)}}(t);break;case"MultiLineString":i=function(t){const e=t.coordinates,i=e[0]?.[0]?.length||2,n=[],r=Ar(n,0,e,i);return{type:"MultiLineString",flatCoordinates:n,ends:r,layout:yr(i)}}(t);break;case"MultiPolygon":i=function(t){const e=t.coordinates,i=[],n=e[0]?.[0]?.[0].length||2,r=Or(i,0,e,n);return{type:"MultiPolygon",flatCoordinates:i,ends:r,layout:yr(n)}}(t);break;case"GeometryCollection":i=function(t){const e=t.geometries.map((function(t){return yE(t)}));return e}(t);break;default:throw new Error("Unsupported GeoJSON type: "+t.type)}return i}function xE(t,e){const i=(t=Yv(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 xE(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}class vE extends Zv{constructor(){super()}getType(){return"text"}readFeature(t,e){return this.readFeatureFromText(SE(t),this.adaptOptions(e))}readFeatureFromText(t,e){return U()}readFeatures(t,e){return this.readFeaturesFromText(SE(t),this.adaptOptions(e))}readFeaturesFromText(t,e){return U()}readGeometry(t,e){return this.readGeometryFromText(SE(t),this.adaptOptions(e))}readGeometryFromText(t,e){return U()}readProjection(t){return this.readProjectionFromText(SE(t))}readProjectionFromText(t){return this.dataProjection}writeFeature(t,e){return this.writeFeatureText(t,this.adaptOptions(e))}writeFeatureText(t,e){return U()}writeFeatures(t,e){return this.writeFeaturesText(t,this.adaptOptions(e))}writeFeaturesText(t,e){return U()}writeGeometry(t,e){return this.writeGeometryText(t,this.adaptOptions(e))}writeGeometryText(t,e){return U()}}function SE(t){return"string"==typeof t?t:""}const EE=/^B(\d{2})(\d{2})(\d{2})(\d{2})(\d{5})([NS])(\d{3})(\d{5})([EW])([AV])(\d{5})(\d{5})/,wE=/^H.([A-Z]{3}).*?:(.*)/,TE=/^HFDTE(\d{2})(\d{2})(\d{2})/,CE=/^HFDTEDATE:(\d{2})(\d{2})(\d{2}),(\d{2})/,bE=/\r\n|\r|\n/;const RE=["http://www.google.com/kml/ext/2.2"],PE=[null,"http://earth.google.com/kml/2.0","http://earth.google.com/kml/2.1","http://earth.google.com/kml/2.2","http://www.opengis.net/kml/2.2"],IE={fraction:"fraction",pixels:"pixels",insetPixels:"pixels"},FE=Sp(PE,{ExtendedData:Aw,Region:Ow,MultiGeometry:pp(Tw,"geometry"),LineString:pp(Sw,"geometry"),LinearRing:pp(Ew,"geometry"),Point:pp(Cw,"geometry"),Polygon:pp(Rw,"geometry"),Style:pp(Iw),StyleMap:function(t,e){const i=aw.call(this,t,e);if(!i)return;const n=e[e.length-1];if(Array.isArray(i))n.Style=i;else{if("string"!=typeof i)throw new Error("`styleMapValue` has an unknown type");n.styleUrl=i}},address:pp(yS),description:pp(yS),name:pp(yS),open:pp(uS),phoneNumber:pp(yS),styleUrl:pp(rw),visibility:pp(uS)},Sp(RE,{MultiTrack:pp((function(t,e){const i=wp([],fw,t,e);if(!i)return;return new Nd(i)}),"geometry"),Track:pp(_w,"geometry")})),LE=Sp(PE,{ExtendedData:Aw,Region:Ow,Link:function(t,e){Ep(ME,t,e)},address:pp(yS),description:pp(yS),name:pp(yS),open:pp(uS),phoneNumber:pp(yS),visibility:pp(uS)}),ME=Sp(PE,{href:pp(nw)}),AE=Sp(PE,{Altitude:pp(fS),Longitude:pp(fS),Latitude:pp(fS),Tilt:pp(fS),AltitudeMode:pp(yS),Heading:pp(fS),Roll:pp(fS)}),OE=Sp(PE,{LatLonAltBox:function(t,e){const i=wp({},kw,t,e);if(!i)return;const n=e[e.length-1],r=[parseFloat(i.west),parseFloat(i.south),parseFloat(i.east),parseFloat(i.north)];n.extent=r,n.altitudeMode=i.altitudeMode,n.minAltitude=parseFloat(i.minAltitude),n.maxAltitude=parseFloat(i.maxAltitude)},Lod:function(t,e){const i=wp({},Gw,t,e);if(!i)return;const n=e[e.length-1];n.minLodPixels=parseFloat(i.minLodPixels),n.maxLodPixels=parseFloat(i.maxLodPixels),n.minFadeExtent=parseFloat(i.minFadeExtent),n.maxFadeExtent=parseFloat(i.maxFadeExtent)}}),DE=Sp(PE,["Document","Placemark"]),NE=Sp(PE,{Document:_p((function(t,e,i){Cp({node:t},Xw,Vw,e,i,void 0,this)})),Placemark:_p(fT)});let kE,GE,jE,UE,BE,zE,XE=null;let VE,$E=null;let WE,ZE=null;let YE=null;let HE=null;let KE,qE=null;function JE(t){return 32/Math.min(t[0],t[1])}function QE(t){return t}function tw(t,e,i){return Array.isArray(t)?t:"string"==typeof t?tw(i[t],e,i):e}function ew(t){const e=op(t,!1),i=/^\s*#?\s*([0-9A-Fa-f]{8})\s*$/.exec(e);if(i){const t=i[1];return[parseInt(t.substr(6,2),16),parseInt(t.substr(4,2),16),parseInt(t.substr(2,2),16),parseInt(t.substr(0,2),16)/255]}}function iw(t){let e=op(t,!1);const i=[];e=e.replace(/\s*,\s*/g,",");const n=/^\s*([+\-]?\d*\.?\d+(?:e[+\-]?\d+)?),([+\-]?\d*\.?\d+(?:e[+\-]?\d+)?)(?:\s+|,|$)(?:([+\-]?\d*\.?\d+(?:e[+\-]?\d+)?)(?:\s+|$))?\s*/i;let r;for(;r=n.exec(e);){const t=parseFloat(r[1]),n=parseFloat(r[2]),s=r[3]?parseFloat(r[3]):0;i.push(t,n,s),e=e.substr(r[0].length)}if(""===e)return i}function nw(t){const e=op(t,!1).trim();let i=t.baseURI;if(i&&"about:blank"!=i||(i=window.location.href),i){return new URL(e,i).href}return e}function rw(t){const e=op(t,!1).trim().replace(/^(?!.*#)/,"#");let i=t.baseURI;if(i&&"about:blank"!=i||(i=window.location.href),i){return new URL(e,i).href}return e}function sw(t){return fS(t)}const ow=Sp(PE,{Pair:function(t,e){const i=wp({},Dw,t,e,this);if(!i)return;const n=i.key;if(n&&"normal"==n){const t=i.styleUrl;t&&(e[e.length-1]=t);const n=i.Style;n&&(e[e.length-1]=n)}}});function aw(t,e){return wp(void 0,ow,t,e,this)}const lw=Sp(PE,{Icon:pp((function(t,e){const i=wp({},mw,t,e);if(i)return i;return null})),color:pp(ew),heading:pp(fS),hotSpot:pp((function(t){const e=t.getAttribute("xunits"),i=t.getAttribute("yunits");let n;return n="insetPixels"!==e?"insetPixels"!==i?"bottom-left":"top-left":"insetPixels"!==i?"bottom-right":"top-right",{x:parseFloat(t.getAttribute("x")),xunits:IE[e],y:parseFloat(t.getAttribute("y")),yunits:IE[i],origin:n}})),scale:pp(sw)});const hw=Sp(PE,{color:pp(ew),scale:pp(sw)});const cw=Sp(PE,{color:pp(ew),width:pp(fS)});const uw=Sp(PE,{color:pp(ew),fill:pp(uS),outline:pp(uS)});const dw=Sp(PE,{coordinates:gp(iw)});function gw(t,e){return wp(null,dw,t,e)}const fw=Sp(RE,{Track:dp(_w)});const pw=Sp(PE,{when:function(t,e){const i=e[e.length-1].whens,n=op(t,!1),r=Date.parse(n);i.push(isNaN(r)?0:r)}},Sp(RE,{coord:function(t,e){const i=e[e.length-1].coordinates,n=op(t,!1),r=/^\s*([+\-]?\d+(?:\.\d*)?(?:e[+\-]?\d*)?)\s+([+\-]?\d+(?:\.\d*)?(?:e[+\-]?\d*)?)\s+([+\-]?\d+(?:\.\d*)?(?:e[+\-]?\d*)?)\s*$/i.exec(n);if(r){const t=parseFloat(r[1]),e=parseFloat(r[2]),n=parseFloat(r[3]);i.push([t,e,n])}else i.push([])}}));function _w(t,e){const i=wp({coordinates:[],whens:[]},pw,t,e);if(!i)return;const n=[],r=i.coordinates,s=i.whens;for(let t=0,e=Math.min(r.length,s.length);t<e;++t)3==r[t].length&&n.push(r[t][0],r[t][1],r[t][2],s[t]);return new Dd(n,"XYZM")}const mw=Sp(PE,{href:pp(nw)},Sp(RE,{x:pp(fS),y:pp(fS),w:pp(fS),h:pp(fS)}));const yw=Sp(PE,{coordinates:gp(iw)});function xw(t,e){return wp(null,yw,t,e)}const vw=Sp(PE,{extrude:pp(uS),tessellate:pp(uS),altitudeMode:pp(yS)});function Sw(t,e){const i=wp({},vw,t,e),n=xw(t,e);if(n){const t=new Dd(n,"XYZ");return t.setProperties(i,!0),t}}function Ew(t,e){const i=wp({},vw,t,e),n=xw(t,e);if(n){const t=new gs(n,"XYZ",[n.length]);return t.setProperties(i,!0),t}}const ww=Sp(PE,{LineString:dp(Sw),LinearRing:dp(Ew),MultiGeometry:dp(Tw),Point:dp(Cw),Polygon:dp(Rw)});function Tw(t,e){const i=wp([],ww,t,e);if(!i)return null;if(0===i.length)return new Md(i);let n,r=!0;const s=i[0].getType();let o;for(let t=1,e=i.length;t<e;++t)if(o=i[t],o.getType()!=s){r=!1;break}if(r){let t,e;if("Point"==s){const r=i[0];t=r.getLayout(),e=r.getFlatCoordinates();for(let t=1,n=i.length;t<n;++t)o=i[t],E(e,o.getFlatCoordinates());n=new kd(e,t),Fw(n,i)}else if("LineString"==s)n=new Nd(i),Fw(n,i);else if("Polygon"==s)n=new Gd(i),Fw(n,i);else{if("GeometryCollection"!=s&&!s.startsWith("Multi"))throw new Error("Unknown geometry type found");n=new Md(i)}}else n=new Md(i);return n}function Cw(t,e){const i=wp({},vw,t,e),n=xw(t,e);if(n){const t=new Wr(n,"XYZ");return t.setProperties(i,!0),t}}const bw=Sp(PE,{innerBoundaryIs:function(t,e){const i=wp([],jw,t,e);if(i.length>0){e[e.length-1].push(...i)}},outerBoundaryIs:function(t,e){const i=wp(void 0,Uw,t,e);if(i){e[e.length-1][0]=i}}});function Rw(t,e){const i=wp({},vw,t,e),n=wp([null],bw,t,e);if(n&&n[0]){const t=n[0],e=[t.length];for(let i=1,r=n.length;i<r;++i)E(t,n[i]),e.push(t.length);const r=new gs(t,"XYZ",e);return r.setProperties(i,!0),r}}const Pw=Sp(PE,{IconStyle:function(t,e){const i=wp({},lw,t,e);if(!i)return;const n=e[e.length-1],r="Icon"in i?i.Icon:{},s=!("Icon"in i)||Object.keys(r).length>0;let o;const a=r.href;let l,h,c;a?o=a:s&&(o=zE);let u="bottom-left";const d=i.hotSpot;let g;d?(l=[d.x,d.y],h=d.xunits,c=d.yunits,u=d.origin):/^https?:\/\/maps\.(?:google|gstatic)\.com\//.test(o)&&(o.includes("pushpin")?(l=GE,h=jE,c=UE):o.includes("arrow-reverse")?(l=[54,42],h=jE,c=UE):o.includes("paddle")&&(l=[32,1],h=jE,c=UE));const f=r.x,p=r.y;let _;void 0!==f&&void 0!==p&&(g=[f,p]);const m=r.w,y=r.h;let x;void 0!==m&&void 0!==y&&(_=[m,y]);const v=i.heading;void 0!==v&&(x=Oe(v));const S=i.scale,E=i.color;if(s){o==zE&&(_=BE);const t=new ac({anchor:l,anchorOrigin:u,anchorXUnits:h,anchorYUnits:c,crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_,offset:g,offsetOrigin:"bottom-left",rotation:x,scale:S,size:_,src:this.iconUrlFunction_(o),color:E}),e=t.getScaleArray()[0],i=t.getSize();if(null===i){const i=t.getImageState();if(i===Fs||i===Ls){const n=function(){const i=t.getImageState();if(i!==Fs&&i!==Ls){const i=t.getSize();if(i&&2==i.length){const n=JE(i);t.setScale(e*n)}t.unlistenImageChange(n)}};t.listenImageChange(n),i===Fs&&t.load()}}else if(2==i.length){const n=JE(i);t.setScale(e*n)}n.imageStyle=t}else n.imageStyle=VE},LabelStyle:function(t,e){const i=wp({},hw,t,e);if(!i)return;const n=e[e.length-1],r=new pc({fill:new sc({color:"color"in i?i.color:kE}),scale:i.scale});n.textStyle=r},LineStyle:function(t,e){const i=wp({},cw,t,e);if(!i)return;const n=e[e.length-1],r=new lc({color:"color"in i?i.color:kE,width:"width"in i?i.width:1});n.strokeStyle=r},PolyStyle:function(t,e){const i=wp({},uw,t,e);if(!i)return;const n=e[e.length-1],r=new sc({color:"color"in i?i.color:kE});n.fillStyle=r;const s=i.fill;void 0!==s&&(n.fill=s);const o=i.outline;void 0!==o&&(n.outline=o)}});function Iw(t,e){const i=wp({},Pw,t,e,this);if(!i)return null;let n="fillStyle"in i?i.fillStyle:XE;const r=i.fill;let s;void 0===r||r||(n=null),"imageStyle"in i?i.imageStyle!=VE&&(s=i.imageStyle):s=$E;const o="textStyle"in i?i.textStyle:YE,a="strokeStyle"in i?i.strokeStyle:ZE,l=i.outline;return void 0===l||l?[new hc({fill:n,image:s,stroke:a,text:o,zIndex:void 0})]:[new hc({geometry:function(t){const e=t.getGeometry(),i=e.getType();if("GeometryCollection"===i){return new Md(e.getGeometriesArrayRecursive().filter((function(t){const e=t.getType();return"Polygon"!==e&&"MultiPolygon"!==e})))}if("Polygon"!==i&&"MultiPolygon"!==i)return e},fill:n,image:s,stroke:a,text:o,zIndex:void 0}),new hc({geometry:function(t){const e=t.getGeometry(),i=e.getType();if("GeometryCollection"===i){return new Md(e.getGeometriesArrayRecursive().filter((function(t){const e=t.getType();return"Polygon"===e||"MultiPolygon"===e})))}if("Polygon"===i||"MultiPolygon"===i)return e},fill:n,stroke:null,zIndex:void 0})]}function Fw(t,e){const i=e.length,n=new Array(e.length),r=new Array(e.length),s=new Array(e.length);let o,a,l;o=!1,a=!1,l=!1;for(let t=0;t<i;++t){const i=e[t];n[t]=i.get("extrude"),r[t]=i.get("tessellate"),s[t]=i.get("altitudeMode"),o=o||void 0!==n[t],a=a||void 0!==r[t],l=l||s[t]}o&&t.set("extrude",n),a&&t.set("tessellate",r),l&&t.set("altitudeMode",s)}const Lw=Sp(PE,{displayName:pp(yS),value:pp(yS)});const Mw=Sp(PE,{Data:function(t,e){const i=t.getAttribute("name");Ep(Lw,t,e);const n=e[e.length-1];i&&n.displayName?n[i]={value:n.value,displayName:n.displayName,toString:function(){return n.value}}:null!==i?n[i]=n.value:null!==n.displayName&&(n[n.displayName]=n.value),delete n.value},SchemaData:function(t,e){Ep(Nw,t,e)}});function Aw(t,e){Ep(Mw,t,e)}function Ow(t,e){Ep(OE,t,e)}const Dw=Sp(PE,{Style:pp(Iw),key:pp(yS),styleUrl:pp(rw)});const Nw=Sp(PE,{SimpleData:function(t,e){const i=t.getAttribute("name");if(null!==i){const n=yS(t);e[e.length-1][i]=n}}});const kw=Sp(PE,{altitudeMode:pp(yS),minAltitude:pp(fS),maxAltitude:pp(fS),north:pp(fS),south:pp(fS),east:pp(fS),west:pp(fS)});const Gw=Sp(PE,{minLodPixels:pp(fS),maxLodPixels:pp(fS),minFadeExtent:pp(fS),maxFadeExtent:pp(fS)});const jw=Sp(PE,{LinearRing:dp(gw)});const Uw=Sp(PE,{LinearRing:gp(gw)});function Bw(t,e){const i=zl(e),n=[255*(4==i.length?i[3]:1),i[2],i[1],i[0]];for(let t=0;t<4;++t){const e=Math.floor(n[t]).toString(16);n[t]=1==e.length?"0"+e:e}RS(t,n.join(""))}const zw=Sp(PE,{Data:_p((function(t,e,i){t.setAttribute("name",e.name);const n={node:t},r=e.value;"object"==typeof r?(null!==r&&r.displayName&&Cp(n,zw,xp,[r.displayName],i,["displayName"]),null!==r&&r.value&&Cp(n,zw,xp,[r.value],i,["value"])):Cp(n,zw,xp,[r],i,["value"])})),value:_p((function(t,e){RS(t,e)})),displayName:_p((function(t,e){RS(t,e)}))});const Xw=Sp(PE,{Placemark:_p(fT)}),Vw=function(t,e,i){return sp(e[e.length-1].node.namespaceURI,"Placemark")};const $w=yp("Data");const Ww=Sp(PE,["href"],Sp(RE,["x","y","w","h"])),Zw=Sp(PE,{href:_p(RS)},Sp(RE,{x:_p(ES),y:_p(ES),w:_p(ES),h:_p(ES)})),Yw=function(t,e,i){return sp(RE[0],"gx:"+i)};const Hw=Sp(PE,["scale","heading","Icon","color","hotSpot"]),Kw=Sp(PE,{Icon:_p((function(t,e,i){const n={node:t},r=i[i.length-1].node;let s=Ww[r.namespaceURI],o=vp(e,s);Cp(n,Zw,xp,o,i,s),s=Ww[RE[0]],o=vp(e,s),Cp(n,Zw,Yw,o,i,s)})),color:_p(Bw),heading:_p(ES),hotSpot:_p((function(t,e){t.setAttribute("x",String(e.x)),t.setAttribute("y",String(e.y)),t.setAttribute("xunits",e.xunits),t.setAttribute("yunits",e.yunits)})),scale:_p(TT)});const qw=Sp(PE,["color","scale"]),Jw=Sp(PE,{color:_p(Bw),scale:_p(TT)});const Qw=Sp(PE,["color","width"]),tT=Sp(PE,{color:_p(Bw),width:_p(ES)});const eT={Point:"Point",LineString:"LineString",LinearRing:"LinearRing",Polygon:"Polygon",MultiPoint:"MultiGeometry",MultiLineString:"MultiGeometry",MultiPolygon:"MultiGeometry",GeometryCollection:"MultiGeometry"},iT=function(t,e,i){if(t){return sp(e[e.length-1].node.namespaceURI,eT[t.getType()])}},nT=yp("Point"),rT=yp("LineString"),sT=yp("LinearRing"),oT=yp("Polygon"),aT=Sp(PE,{LineString:_p(mT),Point:_p(mT),Polygon:_p(ET),GeometryCollection:_p(lT)});function lT(t,e,i){const n={node:t},r=e.getType();let s,o=[];if("GeometryCollection"===r)e.getGeometriesArrayRecursive().forEach((function(t){const e=t.getType();if("MultiPoint"===e)o=o.concat(t.getPoints());else if("MultiLineString"===e)o=o.concat(t.getLineStrings());else if("MultiPolygon"===e)o=o.concat(t.getPolygons());else{if("Point"!==e&&"LineString"!==e&&"Polygon"!==e)throw new Error("Unknown geometry type");o.push(t)}})),s=iT;else if("MultiPoint"===r)o=e.getPoints(),s=nT;else if("MultiLineString"===r)o=e.getLineStrings(),s=rT;else{if("MultiPolygon"!==r)throw new Error("Unknown geometry type");o=e.getPolygons(),s=oT}Cp(n,aT,s,o,i)}const hT=Sp(PE,{LinearRing:_p(mT)});function cT(t,e,i){Cp({node:t},hT,sT,[e],i)}const uT=Sp(PE,{ExtendedData:_p((function(t,e,i){const n={node:t},r=e.names,s=e.values,o=r.length;for(let t=0;t<o;t++)Cp(n,zw,$w,[{name:r[t],value:s[t]}],i)})),MultiGeometry:_p(lT),LineString:_p(mT),LinearRing:_p(mT),Point:_p(mT),Polygon:_p(ET),Style:_p((function(t,e,i){const n={node:t},r={};if(e.pointStyles.length){const t=e.pointStyles[0].getText();t&&(r.LabelStyle=t);const i=e.pointStyles[0].getImage();i&&"function"==typeof i.getSrc&&(r.IconStyle=i)}if(e.lineStyles.length){const t=e.lineStyles[0].getStroke();t&&(r.LineStyle=t)}if(e.polyStyles.length){const t=e.polyStyles[0].getStroke();t&&!r.LineStyle&&(r.LineStyle=t),r.PolyStyle=e.polyStyles[0]}const s=i[i.length-1].node,o=CT[s.namespaceURI],a=vp(r,o);Cp(n,bT,xp,a,i,o)})),address:_p(RS),description:_p(RS),name:_p(RS),open:_p(xS),phoneNumber:_p(RS),styleUrl:_p(RS),visibility:_p(xS)}),dT=Sp(PE,["name","open","visibility","address","phoneNumber","description","styleUrl","Style"]),gT=yp("ExtendedData");function fT(t,e,i){const n={node:t};e.getId()&&t.setAttribute("id",e.getId());const r=e.getProperties(),s={address:1,description:1,name:1,open:1,phoneNumber:1,styleUrl:1,visibility:1};s[e.getGeometryName()]=1;const o=Object.keys(r||{}).sort().filter((function(t){return!s[t]})),a=e.getStyleFunction();if(a){const t=a(e,0);if(t){const i=Array.isArray(t)?t:[t];let n=i;if(e.getGeometry()&&(n=i.filter((function(t){const i=t.getGeometryFunction()(e);if(i){const t=i.getType();return"GeometryCollection"===t?i.getGeometriesArrayRecursive().filter((function(t){const e=t.getType();return"Point"===e||"MultiPoint"===e})).length:"Point"===t||"MultiPoint"===t}}))),this.writeStyles_){let t=i,s=i;e.getGeometry()&&(t=i.filter((function(t){const i=t.getGeometryFunction()(e);if(i){const t=i.getType();return"GeometryCollection"===t?i.getGeometriesArrayRecursive().filter((function(t){const e=t.getType();return"LineString"===e||"MultiLineString"===e})).length:"LineString"===t||"MultiLineString"===t}})),s=i.filter((function(t){const i=t.getGeometryFunction()(e);if(i){const t=i.getType();return"GeometryCollection"===t?i.getGeometriesArrayRecursive().filter((function(t){const e=t.getType();return"Polygon"===e||"MultiPolygon"===e})).length:"Polygon"===t||"MultiPolygon"===t}}))),r.Style={pointStyles:n,lineStyles:t,polyStyles:s}}if(n.length&&void 0===r.name){const t=n[0].getText();t&&(r.name=t.getText())}}}const l=i[i.length-1].node,h=dT[l.namespaceURI],c=vp(r,h);if(Cp(n,uT,xp,c,i,h),o.length>0){const t=vp(r,o);Cp(n,uT,gT,[{names:o,values:t}],i)}const u=i[0];let d=e.getGeometry();d&&(d=Yv(d,!0,u)),Cp(n,uT,iT,[d],i)}const pT=Sp(PE,["extrude","tessellate","altitudeMode","coordinates"]),_T=Sp(PE,{extrude:_p(xS),tessellate:_p(xS),altitudeMode:_p(RS),coordinates:_p((function(t,e,i){const n=i[i.length-1],r=n.layout,s=n.stride;let o;if("XY"==r||"XYM"==r)o=2;else{if("XYZ"!=r&&"XYZM"!=r)throw new Error("Invalid geometry layout");o=3}const a=e.length;let l="";if(a>0){l+=e[0];for(let t=1;t<o;++t)l+=","+e[t];for(let t=s;t<a;t+=s){l+=" "+e[t];for(let i=1;i<o;++i)l+=","+e[t+i]}}RS(t,l)}))});function mT(t,e,i){const n=e.getFlatCoordinates(),r={node:t};r.layout=e.getLayout(),r.stride=e.getStride();const s=e.getProperties();s.coordinates=n;const o=i[i.length-1].node,a=pT[o.namespaceURI],l=vp(s,a);Cp(r,_T,xp,l,i,a)}const yT=Sp(PE,["color","fill","outline"]),xT=Sp(PE,{outerBoundaryIs:_p(cT),innerBoundaryIs:_p(cT)}),vT=yp("innerBoundaryIs"),ST=yp("outerBoundaryIs");function ET(t,e,i){const n=e.getLinearRings(),r=n.shift(),s={node:t};Cp(s,xT,vT,n,i),Cp(s,xT,ST,[r],i)}const wT=Sp(PE,{color:_p(Bw),fill:_p(xS),outline:_p(xS)});function TT(t,e){ES(t,Math.round(1e6*e)/1e6)}const CT=Sp(PE,["IconStyle","LabelStyle","LineStyle","PolyStyle"]),bT=Sp(PE,{IconStyle:_p((function(t,e,i){const n={node:t},r={},s=e.getSrc(),o=e.getSize(),a=e.getImageSize(),l={href:s};if(o){l.w=o[0],l.h=o[1];const t=e.getAnchor(),i=e.getOrigin();if(i&&a&&0!==i[0]&&i[1]!==o[1]&&(l.x=i[0],l.y=a[1]-(i[1]+o[1])),t&&(t[0]!==o[0]/2||t[1]!==o[1]/2)){const e={x:t[0],xunits:"pixels",y:o[1]-t[1],yunits:"pixels"};r.hotSpot=e}}r.Icon=l;let h=e.getScaleArray()[0],c=o;if(null===c&&(c=BE),2==c.length){h/=JE(c)}1!==h&&(r.scale=h);const u=e.getRotation();0!==u&&(r.heading=u);const d=e.getColor();d&&(r.color=d);const g=i[i.length-1].node,f=Hw[g.namespaceURI],p=vp(r,f);Cp(n,Kw,xp,p,i,f)})),LabelStyle:_p((function(t,e,i){const n={node:t},r={},s=e.getFill();s&&(r.color=s.getColor());const o=e.getScale();o&&1!==o&&(r.scale=o);const a=i[i.length-1].node,l=qw[a.namespaceURI],h=vp(r,l);Cp(n,Jw,xp,h,i,l)})),LineStyle:_p((function(t,e,i){const n={node:t},r={color:e.getColor(),width:Number(e.getWidth())||1},s=i[i.length-1].node,o=Qw[s.namespaceURI],a=vp(r,o);Cp(n,tT,xp,a,i,o)})),PolyStyle:_p((function(t,e,i){const n={node:t},r=e.getFill(),s=e.getStroke(),o={color:r?r.getColor():void 0,fill:!!r&&void 0,outline:!!s&&void 0},a=i[i.length-1].node,l=yT[a.namespaceURI],h=vp(o,l);Cp(n,wT,xp,h,i,l)}))});const RT=4294967296,PT=1/RT,IT="undefined"==typeof TextDecoder?null:new TextDecoder("utf-8");class FT{constructor(t=new Uint8Array(16)){this.buf=ArrayBuffer.isView(t)?t:new Uint8Array(t),this.dataView=new DataView(this.buf.buffer),this.pos=0,this.type=0,this.length=this.buf.length}readFields(t,e,i=this.length){for(;this.pos<i;){const i=this.readVarint(),n=i>>3,r=this.pos;this.type=7&i,t(n,e,this),this.pos===r&&this.skip(i)}return e}readMessage(t,e){return this.readFields(t,e,this.readVarint()+this.pos)}readFixed32(){const t=this.dataView.getUint32(this.pos,!0);return this.pos+=4,t}readSFixed32(){const t=this.dataView.getInt32(this.pos,!0);return this.pos+=4,t}readFixed64(){const t=this.dataView.getUint32(this.pos,!0)+this.dataView.getUint32(this.pos+4,!0)*RT;return this.pos+=8,t}readSFixed64(){const t=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*RT;return this.pos+=8,t}readFloat(){const t=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,t}readDouble(){const t=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,t}readVarint(t){const e=this.buf;let i,n;return n=e[this.pos++],i=127&n,n<128?i:(n=e[this.pos++],i|=(127&n)<<7,n<128?i:(n=e[this.pos++],i|=(127&n)<<14,n<128?i:(n=e[this.pos++],i|=(127&n)<<21,n<128?i:(n=e[this.pos],i|=(15&n)<<28,function(t,e,i){const n=i.buf;let r,s;if(s=n[i.pos++],r=(112&s)>>4,s<128)return LT(t,r,e);if(s=n[i.pos++],r|=(127&s)<<3,s<128)return LT(t,r,e);if(s=n[i.pos++],r|=(127&s)<<10,s<128)return LT(t,r,e);if(s=n[i.pos++],r|=(127&s)<<17,s<128)return LT(t,r,e);if(s=n[i.pos++],r|=(127&s)<<24,s<128)return LT(t,r,e);if(s=n[i.pos++],r|=(1&s)<<31,s<128)return LT(t,r,e);throw new Error("Expected varint not more than 10 bytes")}(i,t,this)))))}readVarint64(){return this.readVarint(!0)}readSVarint(){const t=this.readVarint();return t%2==1?(t+1)/-2:t/2}readBoolean(){return Boolean(this.readVarint())}readString(){const t=this.readVarint()+this.pos,e=this.pos;return this.pos=t,t-e>=12&&IT?IT.decode(this.buf.subarray(e,t)):function(t,e,i){let n="",r=e;for(;r<i;){const e=t[r];let s,o,a,l=null,h=e>239?4:e>223?3:e>191?2:1;if(r+h>i)break;1===h?e<128&&(l=e):2===h?(s=t[r+1],128==(192&s)&&(l=(31&e)<<6|63&s,l<=127&&(l=null))):3===h?(s=t[r+1],o=t[r+2],128==(192&s)&&128==(192&o)&&(l=(15&e)<<12|(63&s)<<6|63&o,(l<=2047||l>=55296&&l<=57343)&&(l=null))):4===h&&(s=t[r+1],o=t[r+2],a=t[r+3],128==(192&s)&&128==(192&o)&&128==(192&a)&&(l=(15&e)<<18|(63&s)<<12|(63&o)<<6|63&a,(l<=65535||l>=1114112)&&(l=null))),null===l?(l=65533,h=1):l>65535&&(l-=65536,n+=String.fromCharCode(l>>>10&1023|55296),l=56320|1023&l),n+=String.fromCharCode(l),r+=h}return n}(this.buf,e,t)}readBytes(){const t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e}readPackedVarint(t=[],e){const i=this.readPackedEnd();for(;this.pos<i;)t.push(this.readVarint(e));return t}readPackedSVarint(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readSVarint());return t}readPackedBoolean(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readBoolean());return t}readPackedFloat(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readFloat());return t}readPackedDouble(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readDouble());return t}readPackedFixed32(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readFixed32());return t}readPackedSFixed32(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readSFixed32());return t}readPackedFixed64(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readFixed64());return t}readPackedSFixed64(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readSFixed64());return t}readPackedEnd(){return 2===this.type?this.readVarint()+this.pos:this.pos+1}skip(t){const e=7&t;if(0===e)for(;this.buf[this.pos++]>127;);else if(2===e)this.pos=this.readVarint()+this.pos;else if(5===e)this.pos+=4;else{if(1!==e)throw new Error(`Unimplemented type: ${e}`);this.pos+=8}}writeTag(t,e){this.writeVarint(t<<3|e)}realloc(t){let e=this.length||16;for(;e<this.pos+t;)e*=2;if(e!==this.length){const t=new Uint8Array(e);t.set(this.buf),this.buf=t,this.dataView=new DataView(t.buffer),this.length=e}}finish(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)}writeFixed32(t){this.realloc(4),this.dataView.setInt32(this.pos,t,!0),this.pos+=4}writeSFixed32(t){this.realloc(4),this.dataView.setInt32(this.pos,t,!0),this.pos+=4}writeFixed64(t){this.realloc(8),this.dataView.setInt32(this.pos,-1&t,!0),this.dataView.setInt32(this.pos+4,Math.floor(t*PT),!0),this.pos+=8}writeSFixed64(t){this.realloc(8),this.dataView.setInt32(this.pos,-1&t,!0),this.dataView.setInt32(this.pos+4,Math.floor(t*PT),!0),this.pos+=8}writeVarint(t){(t=+t||0)>268435455||t<0?function(t,e){let i,n;t>=0?(i=t%4294967296|0,n=t/4294967296|0):(i=~(-t%4294967296),n=~(-t/4294967296),4294967295^i?i=i+1|0:(i=0,n=n+1|0));if(t>=0x10000000000000000||t<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");e.realloc(10),function(t,e,i){i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos]=127&t}(i,0,e),function(t,e){const i=(7&t)<<4;if(e.buf[e.pos++]|=i|((t>>>=3)?128:0),!t)return;if(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),!t)return;if(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),!t)return;if(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),!t)return;if(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),!t)return;e.buf[e.pos++]=127&t}(n,e)}(t,this):(this.realloc(4),this.buf[this.pos++]=127&t|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=t>>>7&127))))}writeSVarint(t){this.writeVarint(t<0?2*-t-1:2*t)}writeBoolean(t){this.writeVarint(+t)}writeString(t){t=String(t),this.realloc(4*t.length),this.pos++;const e=this.pos;this.pos=function(t,e,i){for(let n,r,s=0;s<e.length;s++){if(n=e.charCodeAt(s),n>55295&&n<57344){if(!r){n>56319||s+1===e.length?(t[i++]=239,t[i++]=191,t[i++]=189):r=n;continue}if(n<56320){t[i++]=239,t[i++]=191,t[i++]=189,r=n;continue}n=r-55296<<10|n-56320|65536,r=null}else r&&(t[i++]=239,t[i++]=191,t[i++]=189,r=null);n<128?t[i++]=n:(n<2048?t[i++]=n>>6|192:(n<65536?t[i++]=n>>12|224:(t[i++]=n>>18|240,t[i++]=n>>12&63|128),t[i++]=n>>6&63|128),t[i++]=63&n|128)}return i}(this.buf,t,this.pos);const i=this.pos-e;i>=128&&MT(e,i,this),this.pos=e-1,this.writeVarint(i),this.pos+=i}writeFloat(t){this.realloc(4),this.dataView.setFloat32(this.pos,t,!0),this.pos+=4}writeDouble(t){this.realloc(8),this.dataView.setFloat64(this.pos,t,!0),this.pos+=8}writeBytes(t){const e=t.length;this.writeVarint(e),this.realloc(e);for(let i=0;i<e;i++)this.buf[this.pos++]=t[i]}writeRawMessage(t,e){this.pos++;const i=this.pos;t(e,this);const n=this.pos-i;n>=128&&MT(i,n,this),this.pos=i-1,this.writeVarint(n),this.pos+=n}writeMessage(t,e,i){this.writeTag(t,2),this.writeRawMessage(e,i)}writePackedVarint(t,e){e.length&&this.writeMessage(t,AT,e)}writePackedSVarint(t,e){e.length&&this.writeMessage(t,OT,e)}writePackedBoolean(t,e){e.length&&this.writeMessage(t,kT,e)}writePackedFloat(t,e){e.length&&this.writeMessage(t,DT,e)}writePackedDouble(t,e){e.length&&this.writeMessage(t,NT,e)}writePackedFixed32(t,e){e.length&&this.writeMessage(t,GT,e)}writePackedSFixed32(t,e){e.length&&this.writeMessage(t,jT,e)}writePackedFixed64(t,e){e.length&&this.writeMessage(t,UT,e)}writePackedSFixed64(t,e){e.length&&this.writeMessage(t,BT,e)}writeBytesField(t,e){this.writeTag(t,2),this.writeBytes(e)}writeFixed32Field(t,e){this.writeTag(t,5),this.writeFixed32(e)}writeSFixed32Field(t,e){this.writeTag(t,5),this.writeSFixed32(e)}writeFixed64Field(t,e){this.writeTag(t,1),this.writeFixed64(e)}writeSFixed64Field(t,e){this.writeTag(t,1),this.writeSFixed64(e)}writeVarintField(t,e){this.writeTag(t,0),this.writeVarint(e)}writeSVarintField(t,e){this.writeTag(t,0),this.writeSVarint(e)}writeStringField(t,e){this.writeTag(t,2),this.writeString(e)}writeFloatField(t,e){this.writeTag(t,5),this.writeFloat(e)}writeDoubleField(t,e){this.writeTag(t,1),this.writeDouble(e)}writeBooleanField(t,e){this.writeVarintField(t,+e)}}function LT(t,e,i){return i?4294967296*e+(t>>>0):4294967296*(e>>>0)+(t>>>0)}function MT(t,e,i){const n=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));i.realloc(n);for(let e=i.pos-1;e>=t;e--)i.buf[e+n]=i.buf[e]}function AT(t,e){for(let i=0;i<t.length;i++)e.writeVarint(t[i])}function OT(t,e){for(let i=0;i<t.length;i++)e.writeSVarint(t[i])}function DT(t,e){for(let i=0;i<t.length;i++)e.writeFloat(t[i])}function NT(t,e){for(let i=0;i<t.length;i++)e.writeDouble(t[i])}function kT(t,e){for(let i=0;i<t.length;i++)e.writeBoolean(t[i])}function GT(t,e){for(let i=0;i<t.length;i++)e.writeFixed32(t[i])}function jT(t,e){for(let i=0;i<t.length;i++)e.writeSFixed32(t[i])}function UT(t,e){for(let i=0;i<t.length;i++)e.writeFixed64(t[i])}function BT(t,e){for(let i=0;i<t.length;i++)e.writeSFixed64(t[i])}function zT(t,e,i){if(3===t){const t={keys:[],values:[],features:[]},n=i.readVarint()+i.pos;i.readFields(XT,t,n),t.length=t.features.length,t.length&&(e[t.name]=t)}}function XT(t,e,i){if(15===t)e.version=i.readVarint();else if(1===t)e.name=i.readString();else if(5===t)e.extent=i.readVarint();else if(2===t)e.features.push(i.pos);else if(3===t)e.keys.push(i.readString());else if(4===t){let n=null;const r=i.readVarint()+i.pos;for(;i.pos<r;)n=1===(t=i.readVarint()>>3)?i.readString():2===t?i.readFloat():3===t?i.readDouble():4===t?i.readVarint64():5===t?i.readVarint():6===t?i.readSVarint():7===t?i.readBoolean():null;e.values.push(n)}}function VT(t,e,i){if(1==t)e.id=i.readVarint();else if(2==t){const t=i.readVarint()+i.pos;for(;i.pos<t;){const t=e.layer.keys[i.readVarint()],n=e.layer.values[i.readVarint()];e.properties[t]=n}}else 3==t?e.type=i.readVarint():4==t&&(e.geometry=i.pos)}function $T(t,e,i){t.pos=e.features[i];const n=t.readVarint()+t.pos,r={layer:e,type:0,properties:{}};return t.readFields(VT,r,n),r}const WT=[null],ZT=Sp(WT,{nd:function(t,e){const i=e[e.length-1];i.ndrefs.push(t.getAttribute("ref")),t.hasAttribute("lon")&&t.hasAttribute("lat")&&(i.flatCoordinates.push(parseFloat(t.getAttribute("lon"))),i.flatCoordinates.push(parseFloat(t.getAttribute("lat"))))},tag:KT}),YT=Sp(WT,{node:function(t,e){const i=e[0],n=e[e.length-1],r=t.getAttribute("id"),s=[parseFloat(t.getAttribute("lon")),parseFloat(t.getAttribute("lat"))];n.nodes[r]=s;const o=wp({tags:{}},HT,t,e);if(!L(o.tags)){const t=new Wr(s);Yv(t,!1,i);const e=new At(t);void 0!==r&&e.setId(r),e.setProperties(o.tags,!0),n.features.push(e)}},way:function(t,e){const i=wp({id:t.getAttribute("id"),ndrefs:[],flatCoordinates:[],tags:{}},ZT,t,e);e[e.length-1].ways.push(i)}});const HT=Sp(WT,{tag:KT});function KT(t,e){e[e.length-1].tags[t.getAttribute("k")]=t.getAttribute("v")}class qT{read(t){if(!t)return null;if("string"==typeof t){const e=cp(t);return this.readFromDocument(e)}return lp(t)?this.readFromDocument(t):this.readFromNode(t)}readFromDocument(t){for(let e=t.firstChild;e;e=e.nextSibling)if(e.nodeType==Node.ELEMENT_NODE)return this.readFromNode(e);return null}readFromNode(t){U()}}function JT(t){return t.getAttributeNS("http://www.w3.org/1999/xlink","href")}const QT=[null,"http://www.opengis.net/ows/1.1"],tC=Sp(QT,{ServiceIdentification:pp((function(t,e){return wp({},gC,t,e)})),ServiceProvider:pp((function(t,e){return wp({},fC,t,e)})),OperationsMetadata:pp((function(t,e){return wp({},hC,t,e)}))});class eC extends qT{constructor(){super()}readFromNode(t){const e=wp({},tC,t,[]);return e||null}}const iC=Sp(QT,{DeliveryPoint:pp(yS),City:pp(yS),AdministrativeArea:pp(yS),PostalCode:pp(yS),Country:pp(yS),ElectronicMailAddress:pp(yS)}),nC=Sp(QT,{Value:fp((function(t,e){return yS(t)}))}),rC=Sp(QT,{AllowedValues:pp((function(t,e){return wp({},nC,t,e)}))}),sC=Sp(QT,{Phone:pp((function(t,e){return wp({},cC,t,e)})),Address:pp((function(t,e){return wp({},iC,t,e)}))}),oC=Sp(QT,{HTTP:pp((function(t,e){return wp({},aC,t,e)}))}),aC=Sp(QT,{Get:fp((function(t,e){const i=JT(t);if(!i)return;return wp({href:i},uC,t,e)})),Post:void 0}),lC=Sp(QT,{DCP:pp((function(t,e){return wp({},oC,t,e)}))}),hC=Sp(QT,{Operation:function(t,e){const i=t.getAttribute("name"),n=wp({},lC,t,e);if(!n)return;e[e.length-1][i]=n}}),cC=Sp(QT,{Voice:pp(yS),Facsimile:pp(yS)}),uC=Sp(QT,{Constraint:fp((function(t,e){const i=t.getAttribute("name");if(!i)return;return wp({name:i},rC,t,e)}))}),dC=Sp(QT,{IndividualName:pp(yS),PositionName:pp(yS),ContactInfo:pp((function(t,e){return wp({},sC,t,e)}))}),gC=Sp(QT,{Abstract:pp(yS),AccessConstraints:pp(yS),Fees:pp(yS),Title:pp(yS),ServiceTypeVersion:pp(yS),ServiceType:pp(yS)}),fC=Sp(QT,{ProviderName:pp(yS),ProviderSite:pp(JT),ServiceContact:pp((function(t,e){return wp({},dC,t,e)}))});function pC(t,e,i){i=i||1e5;const n=new Array(e).fill(0);for(let r=0,s=t.length;r<s;)for(let s=0;s<e;++s,++r){const e=t[r]*i,o=e<0?Math.ceil(e-.5):Math.round(e),a=o-n[s];n[s]=o,t[r]=a}return mC(t)}function _C(t,e,i){i=i||1e5;const n=new Array(e).fill(0),r=yC(t);for(let t=0,s=r.length;t<s;)for(let s=0;s<e;++s,++t)n[s]+=r[t],r[t]=n[s]/i;return r}function mC(t){for(let e=0,i=t.length;e<i;++e){const i=t[e];t[e]=i<0?~(i<<1):i<<1}return xC(t)}function yC(t){const e=vC(t);for(let t=0,i=e.length;t<i;++t){const i=e[t];e[t]=1&i?~(i>>1):i>>1}return e}function xC(t){let e="";for(let i=0,n=t.length;i<n;++i)e+=SC(t[i]);return e}function vC(t){const e=[];let i=0,n=0;for(let r=0,s=t.length;r<s;++r){const s=t.charCodeAt(r)-63;i|=(31&s)<<n,s<32?(e.push(i),i=0,n=0):n+=5}return e}function SC(t){let e,i="";for(;t>=32;)e=63+(32|31&t),i+=String.fromCharCode(e),t>>=5;return e=t+63,i+=String.fromCharCode(e),i}const EC={Point:function(t,e,i){const n=t.coordinates;e&&i&&RC(n,e,i);return new Wr(n)},LineString:function(t,e){const i=wC(t.arcs,e);return new Dd(i)},Polygon:function(t,e){const i=[];for(let n=0,r=t.arcs.length;n<r;++n)i[n]=wC(t.arcs[n],e);return new gs(i)},MultiPoint:function(t,e,i){const n=t.coordinates;if(e&&i)for(let t=0,r=n.length;t<r;++t)RC(n[t],e,i);return new kd(n)},MultiLineString:function(t,e){const i=[];for(let n=0,r=t.arcs.length;n<r;++n)i[n]=wC(t.arcs[n],e);return new Nd(i)},MultiPolygon:function(t,e){const i=[];for(let n=0,r=t.arcs.length;n<r;++n){const r=t.arcs[n],s=[];for(let t=0,i=r.length;t<i;++t)s[t]=wC(r[t],e);i[n]=s}return new Gd(i)}};function wC(t,e){const i=[];let n;for(let r=0,s=t.length;r<s;++r)if(n=t[r],r>0&&i.pop(),n>=0){const t=e[n];for(let e=0,n=t.length;e<n;++e)i.push(t[e].slice(0))}else{const t=e[~n];for(let e=t.length-1;e>=0;--e)i.push(t[e].slice(0))}return i}function TC(t,e,i,n,r,s,o){const a=t.geometries,l=[];for(let t=0,h=a.length;t<h;++t)l[t]=CC(a[t],e,i,n,r,s,o);return l}function CC(t,e,i,n,r,s,o){let a=null;const l=t.type;if(l){const r=EC[l];a="Point"===l||"MultiPoint"===l?r(t,i,n):r(t,e),a=Yv(a,!1,o)}const h=new At({geometry:a});void 0!==t.id&&h.setId(t.id);let c=t.properties;return r&&(c||(c={}),c[r]=s),c&&h.setProperties(c,!0),h}function bC(t,e,i){let n=0,r=0;for(let s=0,o=t.length;s<o;++s){const o=t[s];n+=o[0],r+=o[1],o[0]=n,o[1]=r,RC(o,e,i)}}function RC(t,e,i){t[0]=t[0]*e[0]+i[0],t[1]=t[1]*e[1]+i[1]}class PC{constructor(t){this.tagName_=t}getTagName(){return this.tagName_}}class IC extends PC{constructor(t,e){super(t),this.conditions=e,Mt(this.conditions.length>=2,"At least 2 conditions are required")}}class FC extends IC{constructor(t){super("And",Array.prototype.slice.call(arguments))}}class LC extends PC{constructor(t,e,i){if(super("BBOX"),this.geometryName=t,this.extent=e,4!==e.length)throw new Error("Expected an extent with four values ([minX, minY, maxX, maxY])");this.srsName=i}}class MC extends PC{constructor(t,e,i,n){super(t),this.geometryName=e||"the_geom",this.geometry=i,this.srsName=n}}class AC extends MC{constructor(t,e,i){super("Contains",t,e,i)}}class OC extends MC{constructor(t,e,i,n,r){super("DWithin",t,e,r),this.distance=i,this.unit=n}}class DC extends MC{constructor(t,e,i){super("Disjoint",t,e,i)}}class NC extends PC{constructor(t,e){super(t),this.propertyName=e}}class kC extends NC{constructor(t,e,i){super("During",t),this.begin=e,this.end=i}}class GC extends NC{constructor(t,e,i,n){super(t,e),this.expression=i,this.matchCase=n}}class jC extends GC{constructor(t,e,i){super("PropertyIsEqualTo",t,e,i)}}class UC extends GC{constructor(t,e){super("PropertyIsGreaterThan",t,e)}}class BC extends GC{constructor(t,e){super("PropertyIsGreaterThanOrEqualTo",t,e)}}class zC extends MC{constructor(t,e,i){super("Intersects",t,e,i)}}class XC extends NC{constructor(t,e,i){super("PropertyIsBetween",t),this.lowerBoundary=e,this.upperBoundary=i}}class VC extends NC{constructor(t,e,i,n,r,s){super("PropertyIsLike",t),this.pattern=e,this.wildCard=void 0!==i?i:"*",this.singleChar=void 0!==n?n:".",this.escapeChar=void 0!==r?r:"!",this.matchCase=s}}class $C extends NC{constructor(t){super("PropertyIsNull",t)}}class WC extends GC{constructor(t,e){super("PropertyIsLessThan",t,e)}}class ZC extends GC{constructor(t,e){super("PropertyIsLessThanOrEqualTo",t,e)}}class YC extends PC{constructor(t){super("Not"),this.condition=t}}class HC extends GC{constructor(t,e,i){super("PropertyIsNotEqualTo",t,e,i)}}class KC extends IC{constructor(t){super("Or",Array.prototype.slice.call(arguments))}}class qC extends PC{constructor(t){super("ResourceId"),this.rid=t}}class JC extends MC{constructor(t,e,i){super("Within",t,e,i)}}function QC(t){const e=[null].concat(Array.prototype.slice.call(arguments));return new(Function.prototype.bind.apply(FC,e))}function tb(t,e,i){return new LC(t,e,i)}const eb={"http://www.opengis.net/gml":{boundedBy:pp(cS.prototype.readExtentElement,"bounds")},"http://www.opengis.net/wfs/2.0":{member:dp(cS.prototype.readFeaturesInternal)}},ib={"http://www.opengis.net/wfs":{totalInserted:pp(_S),totalUpdated:pp(_S),totalDeleted:pp(_S)},"http://www.opengis.net/wfs/2.0":{totalInserted:pp(_S),totalUpdated:pp(_S),totalDeleted:pp(_S)}},nb={"http://www.opengis.net/wfs":{TransactionSummary:pp(fb,"transactionSummary"),InsertResults:pp(yb,"insertIds")},"http://www.opengis.net/wfs/2.0":{TransactionSummary:pp(fb,"transactionSummary"),InsertResults:pp(yb,"insertIds")}},rb={"http://www.opengis.net/wfs":{PropertyName:_p(RS)},"http://www.opengis.net/wfs/2.0":{PropertyName:_p(RS)}},sb={"http://www.opengis.net/wfs":{Insert:_p(xb),Update:_p(wb),Delete:_p(Eb),Property:_p(Tb),Native:_p(Cb)},"http://www.opengis.net/wfs/2.0":{Insert:_p(xb),Update:_p(wb),Delete:_p(Eb),Property:_p(Tb),Native:_p(Cb)}},ob="feature",ab="http://www.w3.org/2000/xmlns/",lb={"2.0.0":"http://www.opengis.net/ogc/1.1","1.1.0":"http://www.opengis.net/ogc","1.0.0":"http://www.opengis.net/ogc"},hb={"2.0.0":"http://www.opengis.net/wfs/2.0","1.1.0":"http://www.opengis.net/wfs","1.0.0":"http://www.opengis.net/wfs"},cb={"2.0.0":"http://www.opengis.net/fes/2.0","1.1.0":"http://www.opengis.net/fes","1.0.0":"http://www.opengis.net/fes"},ub={"2.0.0":"http://www.opengis.net/wfs/2.0 http://schemas.opengis.net/wfs/2.0/wfs.xsd","1.1.0":"http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsd","1.0.0":"http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.0.0/wfs.xsd"},db={"2.0.0":DS,"1.1.0":AS,"1.0.0":FS};function gb(t,e,i,n){Cp(n,sb,yp(t),e,i)}function fb(t,e){return wp({},ib,t,e)}const pb={"http://www.opengis.net/ogc":{FeatureId:dp((function(t,e){return t.getAttribute("fid")}))},"http://www.opengis.net/ogc/1.1":{FeatureId:dp((function(t,e){return t.getAttribute("fid")}))}};function _b(t,e){Ep(pb,t,e)}const mb={"http://www.opengis.net/wfs":{Feature:_b},"http://www.opengis.net/wfs/2.0":{Feature:_b}};function yb(t,e){return wp([],mb,t,e)}function xb(t,e,i){const n=i[i.length-1],r=n.featureType,s=n.featureNS,o=n.gmlVersion,a=sp(s,r);t.appendChild(a),2===o?FS.prototype.writeFeatureElement(a,e,i):3===o?AS.prototype.writeFeatureElement(a,e,i):DS.prototype.writeFeatureElement(a,e,i)}function vb(t,e,i){const n=i[i.length-1].version,r=lb[n],s=sp(r,"Filter"),o=sp(r,"FeatureId");s.appendChild(o),o.setAttribute("fid",e),t.appendChild(s)}function Sb(t,e){const i=(t=t||ob)+":";return e.startsWith(i)?e:i+e}function Eb(t,e,i){const n=i[i.length-1];Mt(void 0!==e.getId(),"Features must have an id set");const r=n.featureType,s=n.featurePrefix,o=n.featureNS,a=Sb(s,r);t.setAttribute("typeName",a),t.setAttributeNS(ab,"xmlns:"+s,o);const l=e.getId();void 0!==l&&vb(t,l,i)}function wb(t,e,i){const n=i[i.length-1];Mt(void 0!==e.getId(),"Features must have an id set");const r=n.version,s=n.featureType,o=n.featurePrefix,a=n.featureNS,l=Sb(o,s),h=e.getGeometryName();t.setAttribute("typeName",l),t.setAttributeNS(ab,"xmlns:"+o,a);const c=e.getId();if(void 0!==c){const s=e.getKeys(),o=[];for(let t=0,i=s.length;t<i;t++){const i=e.get(s[t]);if(void 0!==i){let e=s[t];i&&"function"==typeof i.getSimplifiedGeometry&&(e=h),o.push({name:e,value:i})}}Cp({version:r,gmlVersion:n.gmlVersion,node:t,hasZ:n.hasZ,srsName:n.srsName},sb,yp("Property"),o,i),vb(t,c,i)}}function Tb(t,e,i){const n=i[i.length-1],r=n.version,s=hb[r],o=sp(s,"2.0.0"===r?"ValueReference":"Name"),a=n.gmlVersion;if(t.appendChild(o),RS(o,e.name),void 0!==e.value&&null!==e.value){const n=sp(s,"Value");t.appendChild(n),e.value&&"function"==typeof e.value.getSimplifiedGeometry?2===a?FS.prototype.writeGeometryElement(n,e.value,i):3===a?AS.prototype.writeGeometryElement(n,e.value,i):DS.prototype.writeGeometryElement(n,e.value,i):RS(n,e.value)}}function Cb(t,e,i){e.vendorId&&t.setAttribute("vendorId",e.vendorId),void 0!==e.safeToIgnore&&t.setAttribute("safeToIgnore",String(e.safeToIgnore)),void 0!==e.value&&RS(t,e.value)}const bb={"http://www.opengis.net/wfs":{Query:_p(Rb)},"http://www.opengis.net/wfs/2.0":{Query:_p(Rb)},"http://www.opengis.net/ogc":{During:_p(Mb),And:_p(Ab),Or:_p(Ab),Not:_p(Ob),BBOX:_p(Ib),Contains:_p(Fb),Intersects:_p(Fb),Within:_p(Fb),DWithin:_p(Lb),PropertyIsEqualTo:_p(Db),PropertyIsNotEqualTo:_p(Db),PropertyIsLessThan:_p(Db),PropertyIsLessThanOrEqualTo:_p(Db),PropertyIsGreaterThan:_p(Db),PropertyIsGreaterThanOrEqualTo:_p(Db),PropertyIsNull:_p(Nb),PropertyIsBetween:_p(kb),PropertyIsLike:_p(Gb)},"http://www.opengis.net/fes/2.0":{During:_p(Mb),And:_p(Ab),Or:_p(Ab),Not:_p(Ob),BBOX:_p(Ib),Contains:_p(Fb),Disjoint:_p(Fb),Intersects:_p(Fb),ResourceId:_p((function(t,e,i){t.setAttribute("rid",e.rid)})),Within:_p(Fb),DWithin:_p(Lb),PropertyIsEqualTo:_p(Db),PropertyIsNotEqualTo:_p(Db),PropertyIsLessThan:_p(Db),PropertyIsLessThanOrEqualTo:_p(Db),PropertyIsGreaterThan:_p(Db),PropertyIsGreaterThanOrEqualTo:_p(Db),PropertyIsNull:_p(Nb),PropertyIsBetween:_p(kb),PropertyIsLike:_p(Gb)}};function Rb(t,e,i){const n=i[i.length-1],r=n.version,s=n.featurePrefix,o=n.featureNS,a=n.propertyNames,l=n.srsName;let h,c;h=s?Sb(s,e):e,c="2.0.0"===r?"typeNames":"typeName",t.setAttribute(c,h),l&&t.setAttribute("srsName",l),o&&t.setAttributeNS(ab,"xmlns:"+s,o);const u=Object.assign({},n);u.node=t,Cp(u,rb,yp("PropertyName"),a,i);const d=n.filter;if(d){const e=sp(Vb(r),"Filter");t.appendChild(e),Pb(e,d,i)}}function Pb(t,e,i){const n=i[i.length-1],r={node:t};Object.assign(r,{context:n}),Cp(r,bb,yp(e.getTagName()),[e],i)}function Ib(t,e,i){const n=i[i.length-1],r=n.context.version;n.srsName=e.srsName;const s=db[r];Bb(r,t,e.geometryName),s.prototype.writeGeometryElement(t,e.extent,i)}function Fb(t,e,i){const n=i[i.length-1],r=n.context.version;n.srsName=e.srsName;const s=db[r];Bb(r,t,e.geometryName),s.prototype.writeGeometryElement(t,e.geometry,i)}function Lb(t,e,i){const n=i[i.length-1].context.version;Fb(t,e,i);const r=sp(Vb(n),"Distance");RS(r,e.distance.toString()),"2.0.0"===n?r.setAttribute("uom",e.unit):r.setAttribute("units",e.unit),t.appendChild(r)}function Mb(t,e,i){const n=i[i.length-1].context.version;jb(cb[n],"ValueReference",t,e.propertyName);const r=sp(lS,"TimePeriod");t.appendChild(r);const s=sp(lS,"begin");r.appendChild(s),zb(s,e.begin);const o=sp(lS,"end");r.appendChild(o),zb(o,e.end)}function Ab(t,e,i){const n=i[i.length-1].context,r={node:t};Object.assign(r,{context:n});const s=e.conditions;for(let t=0,e=s.length;t<e;++t){const e=s[t];Cp(r,bb,yp(e.getTagName()),[e],i)}}function Ob(t,e,i){const n=i[i.length-1].context,r={node:t};Object.assign(r,{context:n});const s=e.condition;Cp(r,bb,yp(s.getTagName()),[s],i)}function Db(t,e,i){const n=i[i.length-1].context.version;void 0!==e.matchCase&&t.setAttribute("matchCase",e.matchCase.toString()),Bb(n,t,e.propertyName),Ub(n,t,""+e.expression)}function Nb(t,e,i){Bb(i[i.length-1].context.version,t,e.propertyName)}function kb(t,e,i){const n=i[i.length-1].context.version,r=Vb(n);Bb(n,t,e.propertyName);const s=sp(r,"LowerBoundary");t.appendChild(s),Ub(n,s,""+e.lowerBoundary);const o=sp(r,"UpperBoundary");t.appendChild(o),Ub(n,o,""+e.upperBoundary)}function Gb(t,e,i){const n=i[i.length-1].context.version;t.setAttribute("wildCard",e.wildCard),t.setAttribute("singleChar",e.singleChar),t.setAttribute("escapeChar",e.escapeChar),void 0!==e.matchCase&&t.setAttribute("matchCase",e.matchCase.toString()),Bb(n,t,e.propertyName),Ub(n,t,""+e.pattern)}function jb(t,e,i,n){const r=sp(t,e);RS(r,n),i.appendChild(r)}function Ub(t,e,i){jb(Vb(t),"Literal",e,i)}function Bb(t,e,i){"2.0.0"===t?jb(cb[t],"ValueReference",e,i):jb(lb[t],"PropertyName",e,i)}function zb(t,e){const i=sp(lS,"TimeInstant");t.appendChild(i);const n=sp(lS,"timePosition");i.appendChild(n),RS(n,e)}function Xb(t,e,i){const n=i[i.length-1],r=Object.assign({},n);r.node=t,Cp(r,bb,yp("Query"),e,i)}function Vb(t){let e;return e="2.0.0"===t?cb[t]:lb[t],e}const $b=1,Wb=2,Zb=3,Yb=4,Hb=5,Kb=6,qb=7,Jb=15,Qb=16,tR=17;class eR{constructor(t){this.view_=t,this.pos_=0,this.initialized_=!1,this.isLittleEndian_=!1,this.hasZ_=!1,this.hasM_=!1,this.srid_=null,this.layout_="XY"}readUint8(){return this.view_.getUint8(this.pos_++)}readUint32(t){return this.view_.getUint32((this.pos_+=4)-4,void 0!==t?t:this.isLittleEndian_)}readDouble(t){return this.view_.getFloat64((this.pos_+=8)-8,void 0!==t?t:this.isLittleEndian_)}readPoint(){const t=[];return t.push(this.readDouble()),t.push(this.readDouble()),this.hasZ_&&t.push(this.readDouble()),this.hasM_&&t.push(this.readDouble()),t}readLineString(){const t=this.readUint32(),e=[];for(let i=0;i<t;i++)e.push(this.readPoint());return e}readPolygon(){const t=this.readUint32(),e=[];for(let i=0;i<t;i++)e.push(this.readLineString());return e}readWkbHeader(t){const e=this.readUint8()>0,i=this.readUint32(e),n=Math.floor((268435455&i)/1e3),r=Boolean(2147483648&i)||1===n||3===n,s=Boolean(1073741824&i)||2===n||3===n,o=Boolean(536870912&i),a=(268435455&i)%1e3,l=["XY",r?"Z":"",s?"M":""].join(""),h=o?this.readUint32(e):null;if(void 0!==t&&t!==a)throw new Error("Unexpected WKB geometry type "+a);if(this.initialized_){if(this.isLittleEndian_!==e)throw new Error("Inconsistent endian");if(this.layout_!==l)throw new Error("Inconsistent geometry layout");if(h&&this.srid_!==h)throw new Error("Inconsistent coordinate system (SRID)")}else this.isLittleEndian_=e,this.hasZ_=r,this.hasM_=s,this.layout_=l,this.srid_=h,this.initialized_=!0;return a}readWkbPayload(t){switch(t){case $b:return this.readPoint();case Wb:return this.readLineString();case Zb:case tR:return this.readPolygon();case Yb:return this.readMultiPoint();case Hb:return this.readMultiLineString();case Kb:case Jb:case Qb:return this.readMultiPolygon();case qb:return this.readGeometryCollection();default:throw new Error("Unsupported WKB geometry type "+t+" is found")}}readWkbBlock(t){return this.readWkbPayload(this.readWkbHeader(t))}readWkbCollection(t,e){const i=this.readUint32(),n=[];for(let r=0;r<i;r++){const i=t.call(this,e);i&&n.push(i)}return n}readMultiPoint(){return this.readWkbCollection(this.readWkbBlock,$b)}readMultiLineString(){return this.readWkbCollection(this.readWkbBlock,Wb)}readMultiPolygon(){return this.readWkbCollection(this.readWkbBlock,Zb)}readGeometryCollection(){return this.readWkbCollection(this.readGeometry)}readGeometry(){const t=this.readWkbHeader(),e=this.readWkbPayload(t);switch(t){case $b:return new Wr(e,this.layout_);case Wb:return new Dd(e,this.layout_);case Zb:case tR:return new gs(e,this.layout_);case Yb:return new kd(e,this.layout_);case Hb:return new Nd(e,this.layout_);case Kb:case Jb:case Qb:return new Gd(e,this.layout_);case qb:return new Md(e);default:return null}}getSrid(){return this.srid_}}class iR{constructor(t){t=t||{},this.layout_=t.layout,this.isLittleEndian_=!1!==t.littleEndian,this.isEWKB_=!1!==t.ewkb,this.writeQueue_=[],this.nodata_=Object.assign({X:0,Y:0,Z:0,M:0},t.nodata)}writeUint8(t){this.writeQueue_.push([1,t])}writeUint32(t){this.writeQueue_.push([4,t])}writeDouble(t){this.writeQueue_.push([8,t])}writePoint(t,e){const i=Object.assign.apply(null,e.split("").map(((e,i)=>({[e]:t[i]}))));for(const t of this.layout_)this.writeDouble(t in i?i[t]:this.nodata_[t])}writeLineString(t,e){this.writeUint32(t.length);for(let i=0;i<t.length;i++)this.writePoint(t[i],e)}writePolygon(t,e){this.writeUint32(t.length);for(let i=0;i<t.length;i++)this.writeLineString(t[i],e)}writeWkbHeader(t,e){t%=1e3,this.layout_.includes("Z")&&(t+=this.isEWKB_?2147483648:1e3),this.layout_.includes("M")&&(t+=this.isEWKB_?1073741824:2e3),this.isEWKB_&&Number.isInteger(e)&&(t|=536870912),this.writeUint8(this.isLittleEndian_?1:0),this.writeUint32(t),this.isEWKB_&&Number.isInteger(e)&&this.writeUint32(e)}writeMultiPoint(t,e){this.writeUint32(t.length);for(let i=0;i<t.length;i++)this.writeWkbHeader(1),this.writePoint(t[i],e)}writeMultiLineString(t,e){this.writeUint32(t.length);for(let i=0;i<t.length;i++)this.writeWkbHeader(2),this.writeLineString(t[i],e)}writeMultiPolygon(t,e){this.writeUint32(t.length);for(let i=0;i<t.length;i++)this.writeWkbHeader(3),this.writePolygon(t[i],e)}writeGeometryCollection(t){this.writeUint32(t.length);for(let e=0;e<t.length;e++)this.writeGeometry(t[e])}findMinimumLayout(t,e="XYZM"){if(t instanceof mr)return(i=t.getLayout())===(n=e)?i:"XYZM"===i?n:"XYZM"===n?i:"XY";var i,n;if(t instanceof Md){const i=t.getGeometriesArray();for(let t=0;t<i.length&&"XY"!==e;t++)e=this.findMinimumLayout(i[t],e)}return e}writeGeometry(t,e){const i={Point:$b,LineString:Wb,Polygon:Zb,MultiPoint:Yb,MultiLineString:Hb,MultiPolygon:Kb,GeometryCollection:qb},n=t.getType(),r=i[n];if(!r)throw new Error("GeometryType "+n+" is not supported");if(this.layout_||(this.layout_=this.findMinimumLayout(t)),this.writeWkbHeader(r,e),t instanceof mr){({Point:this.writePoint,LineString:this.writeLineString,Polygon:this.writePolygon,MultiPoint:this.writeMultiPoint,MultiLineString:this.writeMultiLineString,MultiPolygon:this.writeMultiPolygon})[n].call(this,t.getCoordinates(),t.getLayout())}else t instanceof Md&&this.writeGeometryCollection(t.getGeometriesArray())}getBuffer(){const t=this.writeQueue_.reduce(((t,e)=>t+e[0]),0),e=new ArrayBuffer(t),i=new DataView(e);let n=0;return this.writeQueue_.forEach((t=>{switch(t[0]){case 1:i.setUint8(n,t[1]);break;case 4:i.setUint32(n,t[1],this.isLittleEndian_);break;case 8:i.setFloat64(n,t[1],this.isLittleEndian_)}n+=t[0]})),e}}function nR(t){return"string"==typeof t?function(t){const e=new Uint8Array(t.length/2);for(let i=0;i<t.length/2;i++)e[i]=parseInt(t.substr(2*i,2),16);return new DataView(e.buffer)}(t):ArrayBuffer.isView(t)?t instanceof DataView?t:new DataView(t.buffer,t.byteOffset,t.byteLength):t instanceof ArrayBuffer?new DataView(t):null}const rR={POINT:Wr,LINESTRING:Dd,POLYGON:gs,MULTIPOINT:kd,MULTILINESTRING:Nd,MULTIPOLYGON:Gd},sR="EMPTY",oR=0,aR=1,lR=2,hR=3,cR=4,uR=5,dR=6,gR={Point:"POINT",LineString:"LINESTRING",Polygon:"POLYGON",MultiPoint:"MULTIPOINT",MultiLineString:"MULTILINESTRING",MultiPolygon:"MULTIPOLYGON",GeometryCollection:"GEOMETRYCOLLECTION",Circle:"CIRCLE"};class fR{constructor(t){this.wkt=t,this.index_=-1}isAlpha_(t){return t>="a"&&t<="z"||t>="A"&&t<="Z"}isNumeric_(t,e){return e=void 0!==e&&e,t>="0"&&t<="9"||"."==t&&!e}isWhiteSpace_(t){return" "==t||"\t"==t||"\r"==t||"\n"==t}nextChar_(){return this.wkt.charAt(++this.index_)}nextToken(){const t=this.nextChar_(),e=this.index_;let i,n=t;if("("==t)i=lR;else if(","==t)i=uR;else if(")"==t)i=hR;else if(this.isNumeric_(t)||"-"==t)i=cR,n=this.readNumber_();else if(this.isAlpha_(t))i=aR,n=this.readText_();else{if(this.isWhiteSpace_(t))return this.nextToken();if(""!==t)throw new Error("Unexpected character: "+t);i=dR}return{position:e,value:n,type:i}}readNumber_(){let t;const e=this.index_;let i=!1,n=!1;do{"."==t?i=!0:"e"!=t&&"E"!=t||(n=!0),t=this.nextChar_()}while(this.isNumeric_(t,i)||!n&&("e"==t||"E"==t)||n&&("-"==t||"+"==t));return parseFloat(this.wkt.substring(e,this.index_--))}readText_(){let t;const e=this.index_;do{t=this.nextChar_()}while(this.isAlpha_(t));return this.wkt.substring(e,this.index_--).toUpperCase()}}class pR{constructor(t){this.lexer_=t,this.token_={position:0,type:oR},this.layout_="XY"}consume_(){this.token_=this.lexer_.nextToken()}isTokenType(t){return this.token_.type==t}match(t){const e=this.isTokenType(t);return e&&this.consume_(),e}parse(){return this.consume_(),this.parseGeometry_()}parseGeometryLayout_(){let t="XY";const e=this.token_;if(this.isTokenType(aR)){const i=e.value;"Z"===i?t="XYZ":"M"===i?t="XYM":"ZM"===i&&(t="XYZM"),"XY"!==t&&this.consume_()}return t}parseGeometryCollectionText_(){if(this.match(lR)){const t=[];do{t.push(this.parseGeometry_())}while(this.match(uR));if(this.match(hR))return t}throw new Error(this.formatErrorMessage_())}parsePointText_(){if(this.match(lR)){const t=this.parsePoint_();if(this.match(hR))return t}throw new Error(this.formatErrorMessage_())}parseLineStringText_(){if(this.match(lR)){const t=this.parsePointList_();if(this.match(hR))return t}throw new Error(this.formatErrorMessage_())}parsePolygonText_(){if(this.match(lR)){const t=this.parseLineStringTextList_();if(this.match(hR))return t}throw new Error(this.formatErrorMessage_())}parseMultiPointText_(){if(this.match(lR)){let t;if(t=this.token_.type==lR?this.parsePointTextList_():this.parsePointList_(),this.match(hR))return t}throw new Error(this.formatErrorMessage_())}parseMultiLineStringText_(){if(this.match(lR)){const t=this.parseLineStringTextList_();if(this.match(hR))return t}throw new Error(this.formatErrorMessage_())}parseMultiPolygonText_(){if(this.match(lR)){const t=this.parsePolygonTextList_();if(this.match(hR))return t}throw new Error(this.formatErrorMessage_())}parsePoint_(){const t=[],e=this.layout_.length;for(let i=0;i<e;++i){const e=this.token_;if(!this.match(cR))break;t.push(e.value)}if(t.length==e)return t;throw new Error(this.formatErrorMessage_())}parsePointList_(){const t=[this.parsePoint_()];for(;this.match(uR);)t.push(this.parsePoint_());return t}parsePointTextList_(){const t=[this.parsePointText_()];for(;this.match(uR);)t.push(this.parsePointText_());return t}parseLineStringTextList_(){const t=[this.parseLineStringText_()];for(;this.match(uR);)t.push(this.parseLineStringText_());return t}parsePolygonTextList_(){const t=[this.parsePolygonText_()];for(;this.match(uR);)t.push(this.parsePolygonText_());return t}isEmptyGeometry_(){const t=this.isTokenType(aR)&&this.token_.value==sR;return t&&this.consume_(),t}formatErrorMessage_(){return"Unexpected `"+this.token_.value+"` at position "+this.token_.position+" in `"+this.lexer_.wkt+"`"}parseGeometry_(){const t=this.token_;if(this.match(aR)){const e=t.value;this.layout_=this.parseGeometryLayout_();const i=this.isEmptyGeometry_();if("GEOMETRYCOLLECTION"==e){if(i)return new Md([]);const t=this.parseGeometryCollectionText_();return new Md(t)}const n=rR[e];if(!n)throw new Error("Invalid geometry type: "+e);let r;if(i)r="POINT"==e?[NaN,NaN]:[];else switch(e){case"POINT":r=this.parsePointText_();break;case"LINESTRING":r=this.parseLineStringText_();break;case"POLYGON":r=this.parsePolygonText_();break;case"MULTIPOINT":r=this.parseMultiPointText_();break;case"MULTILINESTRING":r=this.parseMultiLineStringText_();break;case"MULTIPOLYGON":r=this.parseMultiPolygonText_()}return new n(r,this.layout_)}throw new Error(this.formatErrorMessage_())}}function _R(t){const e=t.getCoordinates();return 0===e.length?"":e.join(" ")}function mR(t){const e=t.getCoordinates(),i=[];for(let t=0,n=e.length;t<n;++t)i.push(e[t].join(" "));return i.join(",")}function yR(t){const e=[],i=t.getLinearRings();for(let t=0,n=i.length;t<n;++t)e.push("("+mR(i[t])+")");return e.join(",")}const xR={Point:_R,LineString:mR,Polygon:yR,MultiPoint:function(t){const e=[],i=t.getPoints();for(let t=0,n=i.length;t<n;++t)e.push("("+_R(i[t])+")");return e.join(",")},MultiLineString:function(t){const e=[],i=t.getLineStrings();for(let t=0,n=i.length;t<n;++t)e.push("("+mR(i[t])+")");return e.join(",")},MultiPolygon:function(t){const e=[],i=t.getPolygons();for(let t=0,n=i.length;t<n;++t)e.push("("+yR(i[t])+")");return e.join(",")},GeometryCollection:function(t){const e=[],i=t.getGeometries();for(let t=0,n=i.length;t<n;++t)e.push(vR(i[t]));return e.join(",")}};function vR(t){const e=t.getType(),i=(0,xR[e])(t);let n=gR[e];if("function"==typeof t.getFlatCoordinates){const e=function(t){const e=t.getLayout();let i="";return"XYZ"!==e&&"XYZM"!==e||(i+="Z"),"XYM"!==e&&"XYZM"!==e||(i+="M"),i}(t);e.length>0&&(n+=" "+e)}return 0===i.length?n+" "+sR:n+"("+i+")"}const SR=[null,"http://www.opengis.net/wms","http://www.opengis.net/sld"];function ER(t){return Je(t[0].version,"1.3")>=0}const wR=Sp(SR,{Service:pp((function(t,e){return wp({},ER(e)?RR:bR,t,e)})),Capability:pp((function(t,e){return wp({},TR,t,e)}))}),TR=Sp(SR,{Request:pp((function(t,e){return wp({},kR,t,e)})),Exception:pp((function(t,e){return wp([],LR,t,e)})),Layer:pp((function(t,e){const i=wp({},ER(e)?OR:AR,t,e);if(void 0===i.Layer)return Object.assign(i,$R(t,e));return i})),UserDefinedSymbolization:pp((function(t,e){return{SupportSLD:!!dS(t.getAttribute("SupportSLD")),UserLayer:!!dS(t.getAttribute("UserLayer")),UserStyle:!!dS(t.getAttribute("UserStyle")),RemoteWFS:!!dS(t.getAttribute("RemoteWFS")),InlineFeatureData:!!dS(t.getAttribute("InlineFeatureData")),RemoteWCS:!!dS(t.getAttribute("RemoteWCS"))}}))});const CR={Name:pp(yS),Title:pp(yS),Abstract:pp(yS),KeywordList:pp(HR),OnlineResource:pp(JT),ContactInformation:pp((function(t,e){return wp({},PR,t,e)})),Fees:pp(yS),AccessConstraints:pp(yS)},bR=Sp(SR,CR),RR=Sp(SR,{...CR,LayerLimit:pp(_S),MaxWidth:pp(_S),MaxHeight:pp(_S)}),PR=Sp(SR,{ContactPersonPrimary:pp((function(t,e){return wp({},IR,t,e)})),ContactPosition:pp(yS),ContactAddress:pp((function(t,e){return wp({},FR,t,e)})),ContactVoiceTelephone:pp(yS),ContactFacsimileTelephone:pp(yS),ContactElectronicMailAddress:pp(yS)}),IR=Sp(SR,{ContactPerson:pp(yS),ContactOrganization:pp(yS)}),FR=Sp(SR,{AddressType:pp(yS),Address:pp(yS),City:pp(yS),StateOrProvince:pp(yS),PostCode:pp(yS),Country:pp(yS)}),LR=Sp(SR,{Format:dp(yS)}),MR={Name:pp(yS),Title:pp(yS),Abstract:pp(yS),KeywordList:pp(HR),BoundingBox:fp(VR),Dimension:fp((function(t,e){const i={name:t.getAttribute("name"),units:t.getAttribute("units"),unitSymbol:t.getAttribute("unitSymbol")};ER(e)&&Object.assign(i,{default:t.getAttribute("default"),multipleValues:dS(t.getAttribute("multipleValues")),nearestValue:dS(t.getAttribute("nearestValue")),current:dS(t.getAttribute("current")),values:yS(t)});return i})),Attribution:pp((function(t,e){return wp({},DR,t,e)})),AuthorityURL:fp((function(t,e){const i=WR(t,e);if(i)return i.name=t.getAttribute("name"),i;return})),Identifier:fp(yS),MetadataURL:fp((function(t,e){const i=WR(t,e);if(i)return i.type=t.getAttribute("type"),i;return})),DataURL:fp(WR),FeatureListURL:fp(WR),Style:fp((function(t,e){return wp({},BR,t,e)})),Layer:fp($R)},AR=Sp(SR,{...MR,SRS:fp(yS),Extent:pp((function(t,e){return{name:t.getAttribute("name"),default:t.getAttribute("default"),nearestValue:dS(t.getAttribute("nearestValue"))}})),ScaleHint:fp((function(t,e){return{min:pS(t.getAttribute("min")),max:pS(t.getAttribute("max"))}})),LatLonBoundingBox:pp(((t,e)=>VR(t,e,!1))),Layer:fp($R)}),OR=Sp(SR,{...MR,CRS:fp(yS),EX_GeographicBoundingBox:pp((function(t,e){const i=wp({},NR,t,e);if(!i)return;const n=i.westBoundLongitude,r=i.southBoundLatitude,s=i.eastBoundLongitude,o=i.northBoundLatitude;if(void 0===n||void 0===r||void 0===s||void 0===o)return;return[n,r,s,o]})),MinScaleDenominator:pp(fS),MaxScaleDenominator:pp(fS),Layer:fp($R)}),DR=Sp(SR,{Title:pp(yS),OnlineResource:pp(JT),LogoURL:pp(YR)}),NR=Sp(SR,{westBoundLongitude:pp(fS),eastBoundLongitude:pp(fS),southBoundLatitude:pp(fS),northBoundLatitude:pp(fS)}),kR=Sp(SR,{GetCapabilities:pp(ZR),GetMap:pp(ZR),GetFeatureInfo:pp(ZR),DescribeLayer:pp(ZR),GetLegendGraphic:pp(ZR)}),GR=Sp(SR,{Format:fp(yS),DCPType:fp((function(t,e){return wp({},jR,t,e)}))}),jR=Sp(SR,{HTTP:pp((function(t,e){return wp({},UR,t,e)}))}),UR=Sp(SR,{Get:pp(WR),Post:pp(WR)}),BR=Sp(SR,{Name:pp(yS),Title:pp(yS),Abstract:pp(yS),LegendURL:fp(YR),StyleSheetURL:pp(WR),StyleURL:pp(WR)}),zR=Sp(SR,{Format:pp(yS),OnlineResource:pp(JT)}),XR=Sp(SR,{Keyword:dp(yS)});function VR(t,e,i=!0){const n={extent:[pS(t.getAttribute("minx")),pS(t.getAttribute("miny")),pS(t.getAttribute("maxx")),pS(t.getAttribute("maxy"))],res:[pS(t.getAttribute("resx")),pS(t.getAttribute("resy"))]};return i?(ER(e)?n.crs=t.getAttribute("CRS"):n.srs=t.getAttribute("SRS"),n):n}function $R(t,e){const i=ER(e),n=e[e.length-1],r=wp({},i?OR:AR,t,e);if(!r)return;let s=dS(t.getAttribute("queryable"));void 0===s&&(s=n.queryable),r.queryable=void 0!==s&&s;let o=mS(t.getAttribute("cascaded"));void 0===o&&(o=n.cascaded),r.cascaded=o;let a=dS(t.getAttribute("opaque"));void 0===a&&(a=n.opaque),r.opaque=void 0!==a&&a;let l=dS(t.getAttribute("noSubsets"));void 0===l&&(l=n.noSubsets),r.noSubsets=void 0!==l&&l;let h=pS(t.getAttribute("fixedWidth"));h||(h=n.fixedWidth),r.fixedWidth=h;let c=pS(t.getAttribute("fixedHeight"));c||(c=n.fixedHeight),r.fixedHeight=c;const u=["Style","AuthorityURL"];i?u.push("CRS"):u.push("SRS","Dimension"),u.forEach((function(t){if(t in n){const e=r[t]||[];r[t]=e.concat(n[t])}}));const d=["BoundingBox","Attribution"];return i?d.push("Dimension","EX_GeographicBoundingBox","MinScaleDenominator","MaxScaleDenominator"):d.push("LatLonBoundingBox","ScaleHint","Extent"),d.forEach((function(t){if(!(t in r)){const e=n[t];r[t]=e}})),r}function WR(t,e){return wp({},zR,t,e)}function ZR(t,e){return wp({},GR,t,e)}function YR(t,e){const i=WR(t,e);if(i){const e=[mS(t.getAttribute("width")),mS(t.getAttribute("height"))];return i.size=e,i}}function HR(t,e){return wp([],XR,t,e)}const KR=[null,"http://www.opengis.net/wmts/1.0"],qR=[null,"http://www.opengis.net/ows/1.1"],JR=Sp(KR,{Contents:pp((function(t,e){return wp({},QR,t,e)}))});const QR=Sp(KR,{Layer:fp((function(t,e){return wp({},tP,t,e)})),TileMatrixSet:fp((function(t,e){return wp({},aP,t,e)}))}),tP=Sp(KR,{Style:fp((function(t,e){const i=wp({},eP,t,e);if(!i)return;const n="true"===t.getAttribute("isDefault");return i.isDefault=n,i})),Format:fp(yS),TileMatrixSetLink:fp((function(t,e){return wp({},iP,t,e)})),Dimension:fp((function(t,e){return wp({},sP,t,e)})),ResourceURL:fp((function(t,e){const i=t.getAttribute("format"),n=t.getAttribute("template"),r=t.getAttribute("resourceType"),s={};i&&(s.format=i);n&&(s.template=n);r&&(s.resourceType=r);return s}))},Sp(qR,{Title:pp(yS),Abstract:pp(yS),WGS84BoundingBox:pp(hP),BoundingBox:fp((function(t,e){const i=t.getAttribute("crs"),n=wp([],oP,t,e);if(2!=n.length)return;return{extent:Bt(n),crs:i}})),Identifier:pp(yS)})),eP=Sp(KR,{LegendURL:fp((function(t,e){const i={};return i.format=t.getAttribute("format"),i.href=JT(t),i}))},Sp(qR,{Title:pp(yS),Identifier:pp(yS)})),iP=Sp(KR,{TileMatrixSet:pp(yS),TileMatrixSetLimits:pp((function(t,e){return wp([],nP,t,e)}))}),nP=Sp(KR,{TileMatrixLimits:dp((function(t,e){return wp({},rP,t,e)}))}),rP=Sp(KR,{TileMatrix:pp(yS),MinTileRow:pp(_S),MaxTileRow:pp(_S),MinTileCol:pp(_S),MaxTileCol:pp(_S)}),sP=Sp(KR,{Default:pp(yS),Value:fp(yS)},Sp(qR,{Identifier:pp(yS)})),oP=Sp(qR,{LowerCorner:dp(cP),UpperCorner:dp(cP)}),aP=Sp(KR,{WellKnownScaleSet:pp(yS),TileMatrix:fp((function(t,e){return wp({},lP,t,e)}))},Sp(qR,{SupportedCRS:pp(yS),Identifier:pp(yS),BoundingBox:pp(hP)})),lP=Sp(KR,{TopLeftCorner:pp(cP),ScaleDenominator:pp(fS),TileWidth:pp(_S),TileHeight:pp(_S),MatrixWidth:pp(_S),MatrixHeight:pp(_S)},Sp(qR,{Identifier:pp(yS)}));function hP(t,e){const i=wp([],oP,t,e);if(2==i.length)return Bt(i)}function cP(t,e){const i=yS(t).split(/\s+/);if(!i||2!=i.length)return;const n=+i[0],r=+i[1];return isNaN(n)||isNaN(r)?void 0:[n,r]}const uP=["fullscreenchange","webkitfullscreenchange"],dP="enterfullscreen",gP="leavefullscreen";function fP(t){const e=t.body;return!!(e.webkitRequestFullscreen||e.requestFullscreen&&t.fullscreenEnabled)}function pP(t){return!(!t.webkitIsFullScreen&&!t.fullscreenElement)}function _P(t){t.requestFullscreen?t.requestFullscreen():t.webkitRequestFullscreen&&t.webkitRequestFullscreen()}const mP="projection",yP="coordinateFormat";const xP=.75,vP=.1;const SP="units",EP=[1,2,5],wP=25.4/.28;const TP=0,CP=1;var bP={};return bP.Collection=Z,bP.Collection.CollectionEvent=W,bP.DataTile=Lt,bP.DataTile.asArrayLike=bt,bP.DataTile.asImageLike=Ct,bP.DataTile.disposedError=Rt,bP.DataTile.toArray=It,bP.Disposable=_,bP.Feature=At,bP.Feature.createStyleFunction=Ot,bP.Geolocation=class extends V{constructor(t){super(),this.on,this.once,this.un,t=t||{},this.position_=null,this.transform_=xn,this.watchId_=void 0,this.addChangeListener(Ts,this.handleProjectionChanged_),this.addChangeListener(bs,this.handleTrackingChanged_),void 0!==t.projection&&this.setProjection(t.projection),void 0!==t.trackingOptions&&this.setTrackingOptions(t.trackingOptions),this.setTracking(void 0!==t.tracking&&t.tracking)}disposeInternal(){this.setTracking(!1),super.disposeInternal()}handleProjectionChanged_(){const t=this.getProjection();t&&(this.transform_=Ln(En("EPSG:4326"),t),this.position_&&this.set(ws,this.transform_(this.position_)))}handleTrackingChanged_(){if("geolocation"in navigator){const t=this.getTracking();t&&void 0===this.watchId_?this.watchId_=navigator.geolocation.watchPosition(this.positionChange_.bind(this),this.positionError_.bind(this),this.getTrackingOptions()):t||void 0===this.watchId_||(navigator.geolocation.clearWatch(this.watchId_),this.watchId_=void 0)}}positionChange_(t){const e=t.coords;this.set(ys,e.accuracy),this.set(vs,null===e.altitude?void 0:e.altitude),this.set(Ss,null===e.altitudeAccuracy?void 0:e.altitudeAccuracy),this.set(Es,null===e.heading?void 0:Oe(e.heading)),this.position_?(this.position_[0]=e.longitude,this.position_[1]=e.latitude):this.position_=[e.longitude,e.latitude];const i=this.transform_(this.position_);this.set(ws,i.slice()),this.set(Cs,null===e.speed?void 0:e.speed);const n=fs(this.position_,e.accuracy);n.applyTransform(this.transform_),this.set(xs,n),this.changed()}positionError_(t){this.dispatchEvent(new Is(t))}getAccuracy(){return this.get(ys)}getAccuracyGeometry(){return this.get(xs)||null}getAltitude(){return this.get(vs)}getAltitudeAccuracy(){return this.get(Ss)}getHeading(){return this.get(Es)}getPosition(){return this.get(ws)}getProjection(){return this.get(Ts)}getSpeed(){return this.get(Cs)}getTracking(){return this.get(bs)}getTrackingOptions(){return this.get(Rs)}setProjection(t){this.set(Ts,En(t))}setTracking(t){this.set(bs,t)}setTrackingOptions(t){this.set(Rs,t)}},bP.Geolocation.GeolocationError=Is,bP.Image=Ds,bP.Image.decode=js,bP.Image.decodeFallback=Gs,bP.Image.listenImage=Ns,bP.Image.load=ks,bP.ImageCanvas=Us,bP.ImageTile=Bs,bP.Kinetic=zs,bP.Map=Hc,bP.MapBrowserEvent=Vs,bP.MapBrowserEventHandler=Ks,bP.MapEvent=Xs,bP.Object=V,bP.Object.ObjectEvent=X,bP.Observable=G,bP.Observable.unByKey=j,bP.Overlay=eu,bP.Tile=nt,bP.TileQueue=lo,bP.TileQueue.getTilePriority=ho,bP.TileRange=iu,bP.TileRange.createOrUpdate=nu,bP.VectorRenderTile=su,bP.VectorTile=au,bP.View=bo,bP.View.createCenterConstraint=Po,bP.View.createResolutionConstraint=Io,bP.View.createRotationConstraint=Fo,bP.View.getView=async function(t,...e){let i=await t.getView();for(const t of e)i=t(i);return i},bP.View.isNoopAnimation=Lo,bP.View.withExtentCenter=function(){return function(t){if(!t.extent)return t;const e=de(t.extent),i={...t,center:e};return delete i.extent,i}},bP.View.withHigherResolutions=function(t){return function(e){if(!e.resolutions)return e;const i=[...e.resolutions],n=i[i.length-1];for(let e=0;e<t;++e)i.push(n/Math.pow(2,e+1));return{...e,resolutions:i}}},bP.View.withLowerResolutions=function(t){return function(e){if(!e.resolutions)return e;const i=[...e.resolutions],n=i[0];for(let e=0;e<t;++e)i.unshift(n*Math.pow(2,e+1));return{...e,resolutions:i}}},bP.View.withZoom=function(t){return function(e){return{...e,zoom:t}}},bP.array={},bP.array.ascending=y,bP.array.binarySearch=m,bP.array.descending=x,bP.array.equals=w,bP.array.extend=E,bP.array.isSorted=T,bP.array.linearFindNearest=v,bP.array.remove=function(t,e){const i=t.indexOf(e),n=i>-1;return n&&t.splice(i,1),n},bP.array.reverseSubArray=S,bP.array.stableSort=function(t,e){const i=t.length,n=Array(t.length);let r;for(r=0;r<i;r++)n[r]={index:r,value:t[r]};for(n.sort((function(t,i){return e(t.value,i.value)||t.index-i.index})),r=0;r<t.length;r++)t[r]=n[r].value},bP.asserts={},bP.asserts.assert=Mt,bP.centerconstraint={},bP.centerconstraint.createExtent=fo,bP.centerconstraint.none=po,bP.color={},bP.color.NO_COLOR=El,bP.color.asArray=zl,bP.color.asString=Ll,bP.color.fromString=Bl,bP.color.isStringColor=function(t){try{return Bl(t),!0}catch{return!1}},bP.color.lchaToRgba=Ul,bP.color.rgbaToLcha=jl,bP.color.toString=Xl,bP.color.withAlpha=Ol,bP.colorlike={},bP.colorlike.asColorLike=Mh,bP.console={},bP.console.error=Ke,bP.console.log=function(...t){Ye>Ze.info||console.log(...t)},bP.console.setLevel=function(t){Ye=Ze[t]},bP.console.warn=He,bP.control={},bP.control.Attribution=Vo,bP.control.Control=Xo,bP.control.FullScreen=class extends Xo{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(o,this.handleClick_.bind(this),!1),this.setClassName_(this.button_,this.isInFullscreen_),this.element.className=`${this.cssClassName_} ${Do} ${ko}`,this.element.appendChild(this.button_)}handleClick_(t){t.preventDefault(),this.handleFullScreen_()}handleFullScreen_(){const t=this.getMap();if(!t)return;const e=t.getOwnerDocument();if(fP(e))if(pP(e))!function(t){t.exitFullscreen?t.exitFullscreen():t.webkitExitFullscreen&&t.webkitExitFullscreen()}(e);else{let i;i=this.source_?"string"==typeof this.source_?e.getElementById(this.source_):this.source_:t.getTargetElement(),this.keys_?function(t){t.webkitRequestFullscreen?t.webkitRequestFullscreen():_P(t)}(i):_P(i)}}handleFullScreenChange_(){const t=this.getMap();if(!t)return;const e=this.isInFullscreen_;this.isInFullscreen_=pP(t.getOwnerDocument()),e!==this.isInFullscreen_&&(this.setClassName_(this.button_,this.isInFullscreen_),this.isInFullscreen_?(vt(this.labelActiveNode_,this.labelNode_),this.dispatchEvent(dP)):(vt(this.labelNode_,this.labelActiveNode_),this.dispatchEvent(gP)),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(ro,this.boundHandleMapTargetChange_),super.setMap(t),this.handleMapTargetChange_(),t&&t.addChangeListener(ro,this.boundHandleMapTargetChange_)}handleMapTargetChange_(){const t=this.documentListeners_;for(let e=0,i=t.length;e<i;++e)k(t[e]);t.length=0;const e=this.getMap();if(e){const i=e.getOwnerDocument();fP(i)?this.element.classList.remove(No):this.element.classList.add(No);for(let e=0,n=uP.length;e<n;++e)t.push(D(i,uP[e],this.handleFullScreenChange_,this));this.handleFullScreenChange_()}}},bP.control.MousePosition=class extends Xo{constructor(t){t=t||{};const e=document.createElement("div");e.className=void 0!==t.className?t.className:"ol-mouse-position",super({element:e,render:t.render,target:t.target}),this.on,this.once,this.un,this.addChangeListener(mP,this.handleProjectionChanged_),t.coordinateFormat&&this.setCoordinateFormat(t.coordinateFormat),t.projection&&this.setProjection(t.projection),this.renderOnMouseOut_=void 0!==t.placeholder,this.placeholder_=this.renderOnMouseOut_?t.placeholder:" ",this.renderedHTML_=e.innerHTML,this.mapProjection_=null,this.transform_=null,this.wrapX_=!1!==t.wrapX}handleProjectionChanged_(){this.transform_=null}getCoordinateFormat(){return this.get(yP)}getProjection(){return this.get(mP)}handleMouseMove(t){const e=this.getMap();this.updateHTML_(e.getEventPixel(t))}handleMouseOut(t){this.updateHTML_(null)}setMap(t){if(super.setMap(t),t){const e=t.getViewport();this.listenerKeys.push(D(e,Ws,this.handleMouseMove,this)),this.renderOnMouseOut_&&this.listenerKeys.push(D(e,Hs,this.handleMouseOut,this)),this.updateHTML_(null)}}setCoordinateFormat(t){this.set(yP,t)}setProjection(t){this.set(mP,En(t))}updateHTML_(t){let e=this.placeholder_;if(t&&this.mapProjection_){if(!this.transform_){const t=this.getProjection();this.transform_=t?Ln(this.mapProjection_,t):xn}const i=this.getMap().getCoordinateFromPixelInternal(t);if(i){const t=Gn();if(t&&(this.transform_=Ln(this.mapProjection_,t)),this.transform_(i,i),this.wrapX_){ui(i,t||this.getProjection()||this.mapProjection_)}const n=this.getCoordinateFormat();e=n?n(i):i.toString()}}this.renderedHTML_&&e===this.renderedHTML_||(this.element.innerHTML=e,this.renderedHTML_=e)}render(t){const e=t.frameState;e?this.mapProjection_!=e.viewState.projection&&(this.mapProjection_=e.viewState.projection,this.transform_=null):this.mapProjection_=null}},bP.control.OverviewMap=class extends Xo{constructor(t){t=t||{},super({element:document.createElement("div"),render:t.render,target:t.target}),this.boundHandleRotationChanged_=this.handleRotationChanged_.bind(this),this.collapsed_=void 0===t.collapsed||t.collapsed,this.collapsible_=void 0===t.collapsible||t.collapsible,this.collapsible_||(this.collapsed_=!1),this.rotateWithView_=void 0!==t.rotateWithView&&t.rotateWithView,this.viewExtent_=void 0;const e=void 0!==t.className?t.className:"ol-overviewmap",i=void 0!==t.tipLabel?t.tipLabel:"Overview map",n=void 0!==t.collapseLabel?t.collapseLabel:"‹";"string"==typeof n?(this.collapseLabel_=document.createElement("span"),this.collapseLabel_.textContent=n):this.collapseLabel_=n;const r=void 0!==t.label?t.label:"›";"string"==typeof r?(this.label_=document.createElement("span"),this.label_.textContent=r):this.label_=r;const s=this.collapsible_&&!this.collapsed_?this.collapseLabel_:this.label_,a=document.createElement("button");a.setAttribute("type","button"),a.title=i,a.appendChild(s),a.addEventListener(o,this.handleClick_.bind(this),!1),this.ovmapDiv_=document.createElement("div"),this.ovmapDiv_.className="ol-overviewmap-map",this.view_=t.view;const l=new Hc({view:t.view,controls:new Z,interactions:new Z});this.ovmap_=l,t.layers&&t.layers.forEach((function(t){l.addLayer(t)}));const h=document.createElement("div");h.className="ol-overviewmap-box",h.style.boxSizing="border-box",this.boxOverlay_=new eu({position:[0,0],positioning:"center-center",element:h}),this.ovmap_.addOverlay(this.boxOverlay_);const c=e+" "+Do+" "+ko+(this.collapsed_&&this.collapsible_?" "+Go:"")+(this.collapsible_?"":" ol-uncollapsible"),u=this.element;u.className=c,u.appendChild(this.ovmapDiv_),u.appendChild(a);const d=this.boxOverlay_,g=this.boxOverlay_.getElement(),f=function(t){const e={clientX:(i=t).clientX,clientY:i.clientY};var i;const n=l.getEventCoordinate(e);d.setPosition(n)},p=t=>{const e=l.getEventCoordinateInternal(t),i=this.getMap();i.getView().setCenterInternal(e);const n=i.getOwnerDocument();n.removeEventListener("pointermove",f),n.removeEventListener("pointerup",p)};this.ovmapDiv_.addEventListener("pointerdown",(t=>{const e=this.getMap().getOwnerDocument();t.target===g&&e.addEventListener("pointermove",f),e.addEventListener("pointerup",p)}))}setMap(t){const e=this.getMap();if(t!==e){if(e){const t=e.getView();t&&this.unbindView_(t),this.ovmap_.setTarget(null)}if(super.setMap(t),t){this.ovmap_.setTarget(this.ovmapDiv_),this.listenerKeys.push(D(t,i,this.handleMapPropertyChange_,this));const e=t.getView();e&&this.bindView_(e),this.ovmap_.isRendered()||this.updateBoxAfterOvmapIsRendered_()}}}handleMapPropertyChange_(t){if(t.key===so){const e=t.oldValue;e&&this.unbindView_(e);const i=this.getMap().getView();this.bindView_(i)}else this.ovmap_.isRendered()||t.key!==ro&&t.key!==no||this.ovmap_.updateSize()}bindView_(t){if(!this.view_){const e=new bo({projection:t.getProjection()});this.ovmap_.setView(e)}t.addChangeListener(go.ROTATION,this.boundHandleRotationChanged_),this.handleRotationChanged_(),t.isDef()&&(this.ovmap_.updateSize(),this.resetExtent_())}unbindView_(t){t.removeChangeListener(go.ROTATION,this.boundHandleRotationChanged_)}handleRotationChanged_(){this.rotateWithView_&&this.ovmap_.getView().setRotation(this.getMap().getView().getRotation())}validateExtent_(){const t=this.getMap(),e=this.ovmap_;if(!t.isRendered()||!e.isRendered())return;const i=t.getSize(),n=t.getView().calculateExtentInternal(i);if(this.viewExtent_&&te(n,this.viewExtent_))return;this.viewExtent_=n;const r=e.getSize(),s=e.getView().calculateExtentInternal(r),o=e.getPixelFromCoordinateInternal(ye(n)),a=e.getPixelFromCoordinateInternal(ue(n)),l=Math.abs(o[0]-a[0]),h=Math.abs(o[1]-a[1]),c=r[0],u=r[1];l<c*vP||h<u*vP||l>c*xP||h>u*xP?this.resetExtent_():Wt(s,n)||this.recenter_()}resetExtent_(){const t=this.getMap(),e=this.ovmap_,i=t.getSize(),n=t.getView().calculateExtentInternal(i),r=e.getView(),s=Math.log(7.5)/Math.LN2;Te(n,1/(Math.pow(2,s/2)*vP)),r.fitInternal(ps(n))}recenter_(){const t=this.getMap(),e=this.ovmap_,i=t.getView();e.getView().setCenterInternal(i.getCenterInternal())}updateBox_(){const t=this.getMap(),e=this.ovmap_;if(!t.isRendered()||!e.isRendered())return;const i=t.getSize(),n=t.getView(),r=e.getView(),s=this.rotateWithView_?0:-n.getRotation(),o=this.boxOverlay_,a=this.boxOverlay_.getElement(),l=n.getCenter(),h=n.getResolution(),c=r.getResolution(),u=i[0]*h/c,d=i[1]*h/c;if(o.setPosition(l),a){a.style.width=u+"px",a.style.height=d+"px";const t="rotate("+s+"rad)";a.style.transform=t}}updateBoxAfterOvmapIsRendered_(){this.ovmapPostrenderKey_||(this.ovmapPostrenderKey_=N(this.ovmap_,qs,(t=>{delete this.ovmapPostrenderKey_,this.updateBox_()})))}handleClick_(t){t.preventDefault(),this.handleToggle_()}handleToggle_(){this.element.classList.toggle(Go),this.collapsed_?vt(this.collapseLabel_,this.label_):vt(this.label_,this.collapseLabel_),this.collapsed_=!this.collapsed_;const t=this.ovmap_;if(!this.collapsed_){if(t.isRendered())return this.viewExtent_=void 0,void t.render();t.updateSize(),this.resetExtent_(),this.updateBoxAfterOvmapIsRendered_()}}getCollapsible(){return this.collapsible_}setCollapsible(t){this.collapsible_!==t&&(this.collapsible_=t,this.element.classList.toggle("ol-uncollapsible"),!t&&this.collapsed_&&this.handleToggle_())}setCollapsed(t){this.collapsible_&&this.collapsed_!==t&&this.handleToggle_()}getCollapsed(){return this.collapsed_}getRotateWithView(){return this.rotateWithView_}setRotateWithView(t){this.rotateWithView_!==t&&(this.rotateWithView_=t,0!==this.getMap().getView().getRotation()&&(this.rotateWithView_?this.handleRotationChanged_():this.ovmap_.getView().setRotation(0),this.viewExtent_=void 0,this.validateExtent_(),this.updateBox_()))}getOverviewMap(){return this.ovmap_}render(t){this.validateExtent_(),this.updateBox_()}},bP.control.Rotate=$o,bP.control.ScaleLine=class extends Xo{constructor(t){t=t||{};const e=document.createElement("div");e.style.pointerEvents="none",super({element:e,render:t.render,target:t.target}),this.on,this.once,this.un;const i=void 0!==t.className?t.className:t.bar?"ol-scale-bar":"ol-scale-line";this.innerElement_=document.createElement("div"),this.innerElement_.className=i+"-inner",this.element.className=i+" "+Do,this.element.appendChild(this.innerElement_),this.viewState_=null,this.minWidth_=void 0!==t.minWidth?t.minWidth:64,this.maxWidth_=t.maxWidth,this.renderedVisible_=!1,this.renderedWidth_=void 0,this.renderedHTML_="",this.addChangeListener(SP,this.handleUnitsChanged_),this.setUnits(t.units||"metric"),this.scaleBar_=t.bar||!1,this.scaleBarSteps_=t.steps||4,this.scaleBarText_=t.text||!1,this.dpi_=t.dpi||void 0}getUnits(){return this.get(SP)}handleUnitsChanged_(){this.updateElement_()}setUnits(t){this.set(SP,t)}setDpi(t){this.dpi_=t}updateElement_(){const t=this.viewState_;if(!t)return void(this.renderedVisible_&&(this.element.style.display="none",this.renderedVisible_=!1));const e=t.center,i=t.projection,n=this.getUnits(),r="degrees"==n?"degrees":"m";let s=wn(i,t.resolution,e,r);const o=this.minWidth_*(this.dpi_||wP)/wP,a=void 0!==this.maxWidth_?this.maxWidth_*(this.dpi_||wP)/wP:void 0;let l=o*s,h="";if("degrees"==n){const t=_i.degrees;l*=t,l<t/60?(h="″",s*=3600):l<t?(h="′",s*=60):h="°"}else if("imperial"==n)l<.9144?(h="in",s/=.0254):l<1609.344?(h="ft",s/=.3048):(h="mi",s/=1609.344);else if("nautical"==n)s/=1852,h="NM";else if("metric"==n)l<1e-6?(h="nm",s*=1e9):l<.001?(h="μm",s*=1e6):l<1?(h="mm",s*=1e3):l<1e3?h="m":(h="km",s/=1e3);else{if("us"!=n)throw new Error("Invalid units");l<.9144?(h="in",s*=39.37):l<1609.344?(h="ft",s/=.30480061):(h="mi",s/=1609.3472)}let c,u,d,g,f,p=3*Math.floor(Math.log(o*s)/Math.log(10)),_=0;for(;;){d=Math.floor(p/3);const t=Math.pow(10,d);if(c=EP[(p%3+3)%3]*t,u=Math.round(c/s),isNaN(u))return this.element.style.display="none",void(this.renderedVisible_=!1);if(void 0!==a&&u>=a){c=_,u=g,d=f;break}if(u>=o)break;_=c,g=u,f=d,++p}const m=this.scaleBar_?this.createScaleBar(u,c,h):c.toFixed(d<0?-d:0)+" "+h;this.renderedHTML_!=m&&(this.innerElement_.innerHTML=m,this.renderedHTML_=m),this.renderedWidth_!=u&&(this.innerElement_.style.width=u+"px",this.renderedWidth_=u),this.renderedVisible_||(this.element.style.display="",this.renderedVisible_=!0)}createScaleBar(t,e,i){const n=this.getScaleForResolution(),r=n<1?Math.round(1/n).toLocaleString()+" : 1":"1 : "+Math.round(n).toLocaleString(),s=this.scaleBarSteps_,o=t/s,a=[this.createMarker("absolute")];for(let n=0;n<s;++n){const r=n%2==0?"ol-scale-singlebar-odd":"ol-scale-singlebar-even";a.push(`<div><div class="ol-scale-singlebar ${r}" style="width: ${o}px;"></div>`+this.createMarker("relative")+(n%2==0||2===s?this.createStepText(n,t,!1,e,i):"")+"</div>")}a.push(this.createStepText(s,t,!0,e,i));return(this.scaleBarText_?`<div class="ol-scale-text" style="width: ${t}px;">`+r+"</div>":"")+a.join("")}createMarker(t){return`<div class="ol-scale-step-marker" style="position: ${t}; top: ${"absolute"===t?3:-10}px;"></div>`}createStepText(t,e,i,n,r){const s=(0===t?0:Math.round(n/this.scaleBarSteps_*t*100)/100)+(0===t?"":" "+r);return`<div class="ol-scale-step-text" style="margin-left: ${0===t?-3:e/this.scaleBarSteps_*-1}px;text-align: ${0===t?"left":"center"};min-width: ${0===t?0:e/this.scaleBarSteps_*2}px;left: ${i?e+"px":"unset"};">`+s+"</div>"}getScaleForResolution(){return wn(this.viewState_.projection,this.viewState_.resolution,this.viewState_.center,"m")*(1e3/25.4)*(this.dpi_||wP)}render(t){const e=t.frameState;this.viewState_=e?e.viewState:null,this.updateElement_()}},bP.control.Zoom=Wo,bP.control.ZoomSlider=class extends Xo{constructor(t){super({target:(t=t||{}).target,element:document.createElement("div"),render:t.render}),this.dragListenerKeys_=[],this.currentResolution_=void 0,this.direction_=TP,this.dragging_,this.heightLimit_=0,this.widthLimit_=0,this.startX_,this.startY_,this.thumbSize_=null,this.sliderInitialized_=!1,this.duration_=void 0!==t.duration?t.duration:200;const e=void 0!==t.className?t.className:"ol-zoomslider",i=document.createElement("button");i.setAttribute("type","button"),i.className=e+"-thumb "+Do;const n=this.element;n.className=e+" "+Do+" "+ko,n.appendChild(i),n.addEventListener(Zs,this.handleDraggerStart_.bind(this),!1),n.addEventListener(Ws,this.handleDraggerDrag_.bind(this),!1),n.addEventListener(Ys,this.handleDraggerEnd_.bind(this),!1),n.addEventListener(o,this.handleContainerClick_.bind(this),!1),i.addEventListener(o,A,!1)}setMap(t){super.setMap(t),t&&t.render()}initSlider_(){const t=this.element;let e=t.offsetWidth,i=t.offsetHeight;if(0===e&&0===i)return this.sliderInitialized_=!1;const n=getComputedStyle(t);e-=parseFloat(n.paddingRight)+parseFloat(n.paddingLeft),i-=parseFloat(n.paddingTop)+parseFloat(n.paddingBottom);const r=t.firstElementChild,s=getComputedStyle(r),o=r.offsetWidth+parseFloat(s.marginRight)+parseFloat(s.marginLeft),a=r.offsetHeight+parseFloat(s.marginTop)+parseFloat(s.marginBottom);return this.thumbSize_=[o,a],e>i?(this.direction_=CP,this.widthLimit_=e-o):(this.direction_=TP,this.heightLimit_=i-a),this.sliderInitialized_=!0}handleContainerClick_(t){const e=this.getMap().getView(),i=this.getRelativePosition_(t.offsetX-this.thumbSize_[0]/2,t.offsetY-this.thumbSize_[1]/2),n=this.getResolutionForPosition_(i),r=e.getConstrainedZoom(e.getZoomForResolution(n));e.animateInternal({zoom:r,duration:this.duration_,easing:tt})}handleDraggerStart_(t){if(!this.dragging_&&t.target===this.element.firstElementChild){const e=this.element.firstElementChild;if(this.getMap().getView().beginInteraction(),this.startX_=t.clientX-parseFloat(e.style.left),this.startY_=t.clientY-parseFloat(e.style.top),this.dragging_=!0,0===this.dragListenerKeys_.length){const t=this.handleDraggerDrag_,e=this.handleDraggerEnd_,i=this.getMap().getOwnerDocument();this.dragListenerKeys_.push(D(i,Ws,t,this),D(i,Ys,e,this))}}}handleDraggerDrag_(t){if(this.dragging_){const e=t.clientX-this.startX_,i=t.clientY-this.startY_,n=this.getRelativePosition_(e,i);this.currentResolution_=this.getResolutionForPosition_(n),this.getMap().getView().setResolution(this.currentResolution_)}}handleDraggerEnd_(t){if(this.dragging_){this.getMap().getView().endInteraction(),this.dragging_=!1,this.startX_=void 0,this.startY_=void 0,this.dragListenerKeys_.forEach(k),this.dragListenerKeys_.length=0}}setThumbPosition_(t){const e=this.getPositionForResolution_(t),i=this.element.firstElementChild;this.direction_==CP?i.style.left=this.widthLimit_*e+"px":i.style.top=this.heightLimit_*e+"px"}getRelativePosition_(t,e){let i;return i=this.direction_===CP?t/this.widthLimit_:e/this.heightLimit_,Ie(i,0,1)}getResolutionForPosition_(t){return this.getMap().getView().getResolutionForValueFunction()(1-t)}getPositionForResolution_(t){return Ie(1-this.getMap().getView().getValueForResolutionFunction()(t),0,1)}render(t){if(!t.frameState)return;if(!this.sliderInitialized_&&!this.initSlider_())return;const e=t.frameState.viewState.resolution;this.currentResolution_=e,this.setThumbPosition_(e)}},bP.control.ZoomToExtent=class extends Xo{constructor(t){t=t||{},super({element:document.createElement("div"),target:t.target}),this.extent=t.extent?t.extent:null,this.fitOptions=t.fitOptions||{};const e=void 0!==t.className?t.className:"ol-zoom-extent",i=void 0!==t.label?t.label:"E",n=void 0!==t.tipLabel?t.tipLabel:"Fit to extent",r=document.createElement("button");r.setAttribute("type","button"),r.title=n,r.appendChild("string"==typeof i?document.createTextNode(i):i),r.addEventListener(o,this.handleClick_.bind(this),!1);const s=e+" "+Do+" "+ko,a=this.element;a.className=s,a.appendChild(r)}handleClick_(t){t.preventDefault(),this.handleZoomToExtent()}handleZoomToExtent(){const t=this.getMap().getView(),e=this.extent?zn(this.extent,t.getProjection()):t.getProjection().getExtent();t.fitInternal(ps(e),this.fitOptions)}},bP.control.defaults={},bP.control.defaults.defaults=Zo,bP.coordinate={},bP.coordinate.add=Qe,bP.coordinate.angleBetween=gi,bP.coordinate.closestOnCircle=ti,bP.coordinate.closestOnSegment=ei,bP.coordinate.createStringXY=function(t){return function(e){return ci(e,t)}},bP.coordinate.degreesToStringHDMS=ii,bP.coordinate.distance=li,bP.coordinate.equals=ri,bP.coordinate.format=ni,bP.coordinate.getWorldsAway=di,bP.coordinate.rotate=si,bP.coordinate.scale=oi,bP.coordinate.squaredDistance=ai,bP.coordinate.squaredDistanceToSegment=hi,bP.coordinate.toStringHDMS=function(t,e){return t?ii("NS",t[1],e)+" "+ii("EW",t[0],e):""},bP.coordinate.toStringXY=ci,bP.coordinate.wrapX=ui,bP.css={},bP.css.CLASS_COLLAPSED=Go,bP.css.CLASS_CONTROL=ko,bP.css.CLASS_HIDDEN=Ao,bP.css.CLASS_SELECTABLE=Oo,bP.css.CLASS_UNSELECTABLE=Do,bP.css.CLASS_UNSUPPORTED=No,bP.css.fontWeights=Bo,bP.css.getFontParameters=zo,bP.dom={},bP.dom.createCanvasContext2D=ft,bP.dom.createMockDiv=wt,bP.dom.getSharedCanvasContext2D=_t,bP.dom.isCanvas=Tt,bP.dom.outerHeight=xt,bP.dom.outerWidth=yt,bP.dom.releaseCanvas=mt,bP.dom.removeChildren=St,bP.dom.replaceChildren=Et,bP.dom.replaceNode=vt,bP.easing={},bP.easing.easeIn=Q,bP.easing.easeOut=tt,bP.easing.inAndOut=et,bP.easing.linear=it,bP.easing.upAndDown=function(t){return t<.5?et(2*t):1-et(2*(t-.5))},bP.events={},bP.events.Event=M,bP.events.Event.preventDefault=function(t){t.preventDefault()},bP.events.Event.stopPropagation=A,bP.events.SnapEvent={},bP.events.SnapEvent.SnapEvent=Nv,bP.events.Target=O,bP.events.condition={},bP.events.condition.all=Qo,bP.events.condition.altKeyOnly=ta,bP.events.condition.altShiftKeysOnly=ea,bP.events.condition.always=ra,bP.events.condition.click=function(t){return t.type==$s.CLICK},bP.events.condition.doubleClick=function(t){return t.type==$s.DBLCLICK},bP.events.condition.focus=ia,bP.events.condition.focusWithTabindex=na,bP.events.condition.mouseActionButton=sa,bP.events.condition.mouseOnly=da,bP.events.condition.never=oa,bP.events.condition.noModifierKeys=la,bP.events.condition.penOnly=function(t){const e=t.originalEvent;return"pointerId"in e&&"pen"===e.pointerType},bP.events.condition.platformModifierKey=ha,bP.events.condition.platformModifierKeyOnly=function(t){const e=t.originalEvent;return!e.altKey&&(lt?e.metaKey:e.ctrlKey)&&!e.shiftKey},bP.events.condition.pointerMove=function(t){return"pointermove"==t.type},bP.events.condition.primaryAction=ga,bP.events.condition.shiftKeyOnly=ca,bP.events.condition.singleClick=aa,bP.events.condition.targetNotEditable=ua,bP.events.condition.touchOnly=function(t){const e=t.originalEvent;return"pointerId"in e&&"touch"===e.pointerType},bP.events.listen=D,bP.events.listenOnce=N,bP.events.unlistenByKey=k,bP.expr={},bP.expr.cpu={},bP.expr.cpu.buildExpression=Eh,bP.expr.cpu.newEvaluationContext=Sh,bP.expr.expression={},bP.expr.expression.AnyType=th,bP.expr.expression.BooleanType=Yl,bP.expr.expression.CallExpression=ah,bP.expr.expression.ColorType=ql,bP.expr.expression.LiteralExpression=oh,bP.expr.expression.NoneType=0,bP.expr.expression.NumberArrayType=Jl,bP.expr.expression.NumberType=Hl,bP.expr.expression.Ops=ch,bP.expr.expression.SizeType=Ql,bP.expr.expression.StringType=Kl,bP.expr.expression.computeGeometryType=vh,bP.expr.expression.includesType=rh,bP.expr.expression.isType=sh,bP.expr.expression.newParsingContext=lh,bP.expr.expression.overlapsType=function(t,e){return!!(t&e)},bP.expr.expression.parse=hh,bP.expr.expression.typeName=nh,bP.expr.gpu={},bP.expr.gpu.FEATURE_ID_PROPERTY_NAME=K_,bP.expr.gpu.GEOMETRY_TYPE_PROPERTY_NAME=q_,bP.expr.gpu.PALETTE_TEXTURE_ARRAY=H_,bP.expr.gpu.UNDEFINED_PROP_VALUE=J_,bP.expr.gpu.arrayToGlsl=j_,bP.expr.gpu.buildExpression=Q_,bP.expr.gpu.colorToGlsl=U_,bP.expr.gpu.getStringNumberEquivalent=V_,bP.expr.gpu.newCompilationContext=Z_,bP.expr.gpu.numberToGlsl=G_,bP.expr.gpu.sizeToGlsl=B_,bP.expr.gpu.stringToGlsl=$_,bP.expr.gpu.uniformNameForVariable=W_,bP.extent={},bP.extent.applyTransform=be,bP.extent.approximatelyEquals=ee,bP.extent.boundingExtent=Bt,bP.extent.buffer=zt,bP.extent.clone=Xt,bP.extent.closestSquaredDistanceXY=Vt,bP.extent.containsCoordinate=$t,bP.extent.containsExtent=Wt,bP.extent.containsXY=Zt,bP.extent.coordinateRelationship=Yt,bP.extent.createEmpty=Ht,bP.extent.createOrUpdate=Kt,bP.extent.createOrUpdateEmpty=qt,bP.extent.createOrUpdateFromCoordinate=Jt,bP.extent.createOrUpdateFromCoordinates=function(t,e){return re(qt(e),t)},bP.extent.createOrUpdateFromFlatCoordinates=Qt,bP.extent.createOrUpdateFromRings=function(t,e){return oe(qt(e),t)},bP.extent.equals=te,bP.extent.extend=ie,bP.extent.extendCoordinate=ne,bP.extent.extendCoordinates=re,bP.extent.extendFlatCoordinates=se,bP.extent.extendRings=oe,bP.extent.extendXY=ae,bP.extent.forEachCorner=le,bP.extent.getArea=he,bP.extent.getBottomLeft=ce,bP.extent.getBottomRight=ue,bP.extent.getCenter=de,bP.extent.getCorner=ge,bP.extent.getEnlargedArea=function(t,e){const i=Math.min(t[0],e[0]),n=Math.min(t[1],e[1]);return(Math.max(t[2],e[2])-i)*(Math.max(t[3],e[3])-n)},bP.extent.getForViewAndSize=fe,bP.extent.getHeight=_e,bP.extent.getIntersection=me,bP.extent.getIntersectionArea=function(t,e){return he(me(t,e))},bP.extent.getMargin=function(t){return ve(t)+_e(t)},bP.extent.getRotatedViewport=pe,bP.extent.getSize=function(t){return[t[2]-t[0],t[3]-t[1]]},bP.extent.getTopLeft=ye,bP.extent.getTopRight=xe,bP.extent.getWidth=ve,bP.extent.intersects=Se,bP.extent.intersectsSegment=Ce,bP.extent.isEmpty=Ee,bP.extent.returnOrUpdate=we,bP.extent.scaleFromCenter=Te,bP.extent.wrapAndSliceX=Pe,bP.extent.wrapX=Re,bP.featureloader={},bP.featureloader.loadFeaturesXhr=hu,bP.featureloader.setWithCredentials=function(t){lu=t},bP.featureloader.xhr=cu,bP.format={},bP.format.EsriJSON=class extends Qv{constructor(t){t=t||{},super(),this.geometryName_=t.geometryName}readFeatureFromObject(t,e,i){const n=t,r=nS(n.geometry,e),s=new At;if(this.geometryName_&&s.setGeometryName(this.geometryName_),s.setGeometry(r),n.attributes){s.setProperties(n.attributes,!0);const t=n.attributes[i];void 0!==t&&s.setId(t)}return s}readFeaturesFromObject(t,e){if(e=e||{},t.features){const i=[],n=t.features;for(let r=0,s=n.length;r<s;++r)i.push(this.readFeatureFromObject(n[r],e,t.objectIdFieldName));return i}return[this.readFeatureFromObject(t,e)]}readGeometryFromObject(t,e){return nS(t,e)}readProjectionFromObject(t){if(t.spatialReference&&void 0!==t.spatialReference.wkid){return En("EPSG:"+t.spatialReference.wkid)}return null}writeGeometryObject(t,e){return oS(t,this.adaptOptions(e))}writeFeatureObject(t,e){e=this.adaptOptions(e);const i={};if(!t.hasProperties())return i.attributes={},i;const n=t.getProperties(),r=t.getGeometry();if(r){i.geometry=oS(r,e);const s=e&&(e.dataProjection||e.featureProjection);s&&(i.geometry.spatialReference={wkid:Number(En(s).getCode().split(":").pop())}),delete n[t.getGeometryName()]}return L(n)?i.attributes={}:i.attributes=n,i}writeFeaturesObject(t,e){e=this.adaptOptions(e);const i=[];for(let n=0,r=t.length;n<r;++n)i.push(this.writeFeatureObject(t[n],e));return{features:i}}},bP.format.Feature=Zv,bP.format.Feature.createGeometry=Jv,bP.format.Feature.createRenderFeature=qv,bP.format.Feature.transformExtentWithOptions=Hv,bP.format.Feature.transformGeometryWithOptions=Yv,bP.format.GML=OS,bP.format.GML2=FS,bP.format.GML3=AS,bP.format.GML32=DS,bP.format.GMLBase=cS,bP.format.GMLBase.GMLNS=lS,bP.format.GPX=class extends aS{constructor(t){super(),t=t||{},this.dataProjection=En("EPSG:4326"),this.readExtensions_=t.readExtensions}handleReadExtensions_(t){t||(t=[]);for(let e=0,i=t.length;e<i;++e){const i=t[e];if(this.readExtensions_){const t=i.get("extensionsNode_")||null;this.readExtensions_(i,t)}i.set("extensionsNode_",void 0)}}readMetadata(t){return t?"string"==typeof t?this.readMetadataFromDocument(cp(t)):lp(t)?this.readMetadataFromDocument(t):this.readMetadataFromNode(t):null}readMetadataFromDocument(t){for(let e=t.firstChild;e;e=e.nextSibling)if(e.nodeType===Node.ELEMENT_NODE){const t=this.readMetadataFromNode(e);if(t)return t}return null}readMetadataFromNode(t){if(!NS.includes(t.namespaceURI))return null;for(let e=t.firstElementChild;e;e=e.nextElementSibling)if(NS.includes(e.namespaceURI)&&"metadata"===e.localName)return wp({},BS,e,[]);return null}readFeatureFromNode(t,e){if(!NS.includes(t.namespaceURI))return null;const i=kS[t.localName];if(!i)return null;const n=i(t,[this.getReadOptions(t,e)]);return n?(this.handleReadExtensions_([n]),n):null}readFeaturesFromNode(t,e){if(!NS.includes(t.namespaceURI))return[];if("gpx"==t.localName){const i=wp([],GS,t,[this.getReadOptions(t,e)]);return i?(this.handleReadExtensions_(i),i):[]}return[]}writeFeaturesNode(t,e){e=this.adaptOptions(e);const i=sp("http://www.topografix.com/GPX/1/1","gpx");return i.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns:xsi",rp),i.setAttributeNS(rp,"xsi:schemaLocation","http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd"),i.setAttribute("version","1.1"),i.setAttribute("creator","OpenLayers"),Cp({node:i},XS,lE,t,[e]),i}},bP.format.GeoJSON=class extends Qv{constructor(t){t=t||{},super(),this.dataProjection=En(t.dataProjection?t.dataProjection:"EPSG:4326"),t.featureProjection&&(this.defaultFeatureProjection=En(t.featureProjection)),t.featureClass&&(this.featureClass=t.featureClass),this.geometryName_=t.geometryName,this.extractGeometryName_=t.extractGeometryName,this.supportedMediaTypes=["application/geo+json","application/vnd.geo+json"]}readFeatureFromObject(t,e){let i=null;i="Feature"===t.type?t:{type:"Feature",geometry:t,properties:null};const n=yE(i.geometry);if(this.featureClass===Ud)return qv({geometry:n,id:i.id,properties:i.properties},e);const r=new At;return this.geometryName_?r.setGeometryName(this.geometryName_):this.extractGeometryName_&&i.geometry_name&&r.setGeometryName(i.geometry_name),r.setGeometry(Jv(n,e)),"id"in i&&r.setId(i.id),i.properties&&r.setProperties(i.properties,!0),r}readFeaturesFromObject(t,e){let i=null;if("FeatureCollection"===t.type){i=[];const n=t.features;for(let t=0,r=n.length;t<r;++t){const r=this.readFeatureFromObject(n[t],e);r&&i.push(r)}}else i=[this.readFeatureFromObject(t,e)];return i.flat()}readGeometryFromObject(t,e){return function(t,e){const i=yE(t);return Jv(i,e)}(t,e)}readProjectionFromObject(t){const e=t.crs;let i;if(e)if("name"==e.type)i=En(e.properties.name);else{if("EPSG"!==e.type)throw new Error("Unknown SRS type");i=En("EPSG:"+e.properties.code)}else i=this.dataProjection;return i}writeFeatureObject(t,e){e=this.adaptOptions(e);const i={type:"Feature",geometry:null,properties:null},n=t.getId();if(void 0!==n&&(i.id=n),!t.hasProperties())return i;const r=t.getProperties(),s=t.getGeometry();return s&&(i.geometry=xE(s,e),delete r[t.getGeometryName()]),L(r)||(i.properties=r),i}writeFeaturesObject(t,e){e=this.adaptOptions(e);const i=[];for(let n=0,r=t.length;n<r;++n)i.push(this.writeFeatureObject(t[n],e));return{type:"FeatureCollection",features:i}}writeGeometryObject(t,e){return xE(t,this.adaptOptions(e))}},bP.format.IGC=class extends vE{constructor(t){super(),t=t||{},this.dataProjection=En("EPSG:4326"),this.altitudeMode_=t.altitudeMode?t.altitudeMode:"none",this.lad_=!1,this.lod_=!1,this.ladStart_=0,this.ladStop_=0,this.lodStart_=0,this.lodStop_=0}readFeatureFromText(t,e){const i=this.altitudeMode_,n=t.split(bE),r={},s=[];let o,a,l=2e3,h=0,c=1,u=-1;for(o=0,a=n.length;o<a;++o){const t=n[o];let e;if("B"==t.charAt(0)){if(e=EE.exec(t),e){const n=parseInt(e[1],10),r=parseInt(e[2],10),o=parseInt(e[3],10);let a=parseInt(e[4],10)+parseInt(e[5],10)/6e4;this.lad_&&(a+=parseInt(t.slice(this.ladStart_,this.ladStop_),10)/6e4/10**(this.ladStop_-this.ladStart_)),"S"==e[6]&&(a=-a);let d=parseInt(e[7],10)+parseInt(e[8],10)/6e4;if(this.lod_&&(d+=parseInt(t.slice(this.lodStart_,this.lodStop_),10)/6e4/10**(this.lodStop_-this.lodStart_)),"W"==e[9]&&(d=-d),s.push(d,a),"none"!=i){let t;t="gps"==i?parseInt(e[11],10):"barometric"==i?parseInt(e[12],10):0,s.push(t)}let g=Date.UTC(l,h,c,n,r,o);g<u&&(g=Date.UTC(l,h,c+1,n,r,o)),s.push(g/1e3),u=g}}else if("H"==t.charAt(0))e=CE.exec(t),e?(c=parseInt(e[1],10),h=parseInt(e[2],10)-1,l=2e3+parseInt(e[3],10)):(e=TE.exec(t),e?(c=parseInt(e[1],10),h=parseInt(e[2],10)-1,l=2e3+parseInt(e[3],10)):(e=wE.exec(t),e&&(r[e[1]]=e[2].trim())));else if("I"==t.charAt(0)){const e=parseInt(t.slice(1,3),10);for(let i=0;i<e;i++){const e=t.slice(7+7*i,10+7*i);if("LAD"===e||"LOD"===e){const n=parseInt(t.slice(3+7*i,5+7*i),10)-1,r=parseInt(t.slice(5+7*i,7+7*i),10);"LAD"===e?(this.lad_=!0,this.ladStart_=n,this.ladStop_=r):"LOD"===e&&(this.lod_=!0,this.lodStart_=n,this.lodStop_=r)}}}}if(0===s.length)return null;const d=new Dd(s,"none"==i?"XYM":"XYZM"),g=new At(Yv(d,!1,e));return g.setProperties(r,!0),g}readFeaturesFromText(t,e){const i=this.readFeatureFromText(t,e);return i?[i]:[]}},bP.format.IIIFInfo=class{constructor(t){this.setImageInfo(t)}setImageInfo(t){this.imageInfo="string"==typeof t?JSON.parse(t):t}getImageApiVersion(){if(void 0===this.imageInfo)return;let t=this.imageInfo["@context"]||"ol-no-context";"string"==typeof t&&(t=[t]);for(let e=0;e<t.length;e++)switch(t[e]){case"http://library.stanford.edu/iiif/image-api/1.1/context.json":case"http://iiif.io/api/image/1/context.json":return bg;case"http://iiif.io/api/image/2/context.json":return Rg;case"http://iiif.io/api/image/3/context.json":return Pg;case"ol-no-context":if(this.getComplianceLevelEntryFromProfile(bg)&&this.imageInfo.identifier)return bg}Mt(!1,"Cannot determine IIIF Image API version from provided image information JSON")}getComplianceLevelEntryFromProfile(t){if(void 0!==this.imageInfo&&void 0!==this.imageInfo.profile)switch(void 0===t&&(t=this.getImageApiVersion()),t){case bg:if(Fg.test(this.imageInfo.profile))return this.imageInfo.profile;break;case Pg:if(Mg.test(this.imageInfo.profile))return this.imageInfo.profile;break;case Rg:if("string"==typeof this.imageInfo.profile&&Lg.test(this.imageInfo.profile))return this.imageInfo.profile;if(Array.isArray(this.imageInfo.profile)&&this.imageInfo.profile.length>0&&"string"==typeof this.imageInfo.profile[0]&&Lg.test(this.imageInfo.profile[0]))return this.imageInfo.profile[0]}}getComplianceLevelFromProfile(t){const e=this.getComplianceLevelEntryFromProfile(t);if(void 0===e)return;const i=e.match(/level[0-2](?:\.json)?$/g);return Array.isArray(i)?i[0].replace(".json",""):void 0}getComplianceLevelSupportedFeatures(){if(void 0===this.imageInfo)return;const t=this.getImageApiVersion(),e=this.getComplianceLevelFromProfile(t);return void 0===e?Ig.none.none:Ig[t][e]}getTileSourceOptions(t){const e=t||{},i=this.getImageApiVersion();if(void 0===i)return;const n=void 0===i?void 0:Ag[i](this);return void 0!==n?{url:n.url,version:i,size:[this.imageInfo.width,this.imageInfo.height],sizes:n.sizes,format:void 0!==e.format&&n.formats.includes(e.format)?e.format:void 0!==n.preferredFormat?n.preferredFormat:"jpg",supports:n.supports,quality:e.quality&&n.qualities.includes(e.quality)?e.quality:n.qualities.includes("native")?"native":"default",resolutions:Array.isArray(n.resolutions)?n.resolutions.sort((function(t,e){return e-t})):void 0,tileSize:n.tileSize}:void 0}},bP.format.JSONFeature=Qv,bP.format.KML=class extends aS{constructor(t){super(),t=t||{},qE||(kE=[255,255,255,1],XE=new sc({color:kE}),GE=[20,2],jE="pixels",UE="pixels",BE=[64,64],zE="https://maps.google.com/mapfiles/kml/pushpin/ylw-pushpin.png",$E=new ac({anchor:GE,anchorOrigin:"bottom-left",anchorXUnits:jE,anchorYUnits:UE,crossOrigin:"anonymous",rotation:0,scale:JE(BE),size:BE,src:zE}),VE="NO_IMAGE",ZE=new lc({color:kE,width:1}),WE=new lc({color:[51,51,51,1],width:2}),YE=new pc({font:"bold 16px Helvetica",fill:XE,stroke:WE,scale:.8}),HE=new hc({fill:XE,image:$E,text:YE,stroke:ZE,zIndex:0}),qE=[HE]),this.dataProjection=En("EPSG:4326"),this.defaultStyle_=t.defaultStyle?t.defaultStyle:qE,this.extractStyles_=void 0===t.extractStyles||t.extractStyles,this.writeStyles_=void 0===t.writeStyles||t.writeStyles,this.sharedStyles_={},this.showPointNames_=void 0===t.showPointNames||t.showPointNames,this.crossOrigin_=void 0!==t.crossOrigin?t.crossOrigin:"anonymous",this.referrerPolicy_=t.referrerPolicy,this.iconUrlFunction_=t.iconUrlFunction?t.iconUrlFunction:QE,this.supportedMediaTypes=["application/vnd.google-earth.kml+xml"]}readDocumentOrFolder_(t,e){const i=wp([],Sp(PE,{Document:up(this.readDocumentOrFolder_,this),Folder:up(this.readDocumentOrFolder_,this),Placemark:dp(this.readPlacemark_,this),Style:this.readSharedStyle_.bind(this),StyleMap:this.readSharedStyleMap_.bind(this)}),t,e,this);if(i)return i}readPlacemark_(t,e){const i=wp({geometry:null},FE,t,e,this);if(!i)return;const n=new At,r=t.getAttribute("id");null!==r&&n.setId(r);const s=e[0],o=i.geometry;if(o&&Yv(o,!1,s),n.setGeometry(o),delete i.geometry,this.extractStyles_){const t=function(t,e,i,n,r){return function(s,o){let a=r,l="",h=[];if(a){const t=s.getGeometry();if(t)if(t instanceof Md)h=t.getGeometriesArrayRecursive().filter((function(t){const e=t.getType();return"Point"===e||"MultiPoint"===e})),a=h.length>0;else{const e=t.getType();a="Point"===e||"MultiPoint"===e}}a&&(l=s.get("name"),a=a&&!!l,a&&/&[^&]+;/.test(l)&&(KE||(KE=document.createElement("textarea")),KE.innerHTML=l,l=KE.value));let c=i;if(t?c=t:e&&(c=tw(e,i,n)),a){const t=function(t,e){const i=[0,0];let n="start";const r=t.getImage();if(r){const t=r.getSize();if(t&&2==t.length){const e=r.getScaleArray(),s=r.getAnchor();i[0]=e[0]*(t[0]-s[0]),i[1]=e[1]*(t[1]/2-s[1]),n="left"}}let s=t.getText();s?(s=s.clone(),s.setFont(s.getFont()||YE.getFont()),s.setScale(s.getScale()||YE.getScale()),s.setFill(s.getFill()||YE.getFill()),s.setStroke(s.getStroke()||WE)):s=YE.clone();s.setText(e),s.setOffsetX(i[0]),s.setOffsetY(i[1]),s.setTextAlign(n);const o=new hc({image:r,text:s});return o}(c[0],l);if(h.length>0){t.setGeometry(new Md(h));return[t,new hc({geometry:c[0].getGeometry(),image:null,fill:c[0].getFill(),stroke:c[0].getStroke(),text:null})].concat(c.slice(1))}return t}return c}}(i.Style,i.styleUrl,this.defaultStyle_,this.sharedStyles_,this.showPointNames_);n.setStyle(t)}return delete i.Style,n.setProperties(i,!0),n}readSharedStyle_(t,e){const i=t.getAttribute("id");if(null!==i){const n=Iw.call(this,t,e);if(n){let e,r=t.baseURI;if(r&&"about:blank"!=r||(r=window.location.href),r){e=new URL("#"+i,r).href}else e="#"+i;this.sharedStyles_[e]=n}}}readSharedStyleMap_(t,e){const i=t.getAttribute("id");if(null===i)return;const n=aw.call(this,t,e);if(!n)return;let r,s=t.baseURI;if(s&&"about:blank"!=s||(s=window.location.href),s){r=new URL("#"+i,s).href}else r="#"+i;this.sharedStyles_[r]=n}readFeatureFromNode(t,e){if(!PE.includes(t.namespaceURI))return null;const i=this.readPlacemark_(t,[this.getReadOptions(t,e)]);return i||null}readFeaturesFromNode(t,e){if(!PE.includes(t.namespaceURI))return[];let i;const n=t.localName;if("Document"==n||"Folder"==n)return i=this.readDocumentOrFolder_(t,[this.getReadOptions(t,e)]),i||[];if("Placemark"==n){const i=this.readPlacemark_(t,[this.getReadOptions(t,e)]);return i?[i]:[]}if("kml"==n){i=[];for(let n=t.firstElementChild;n;n=n.nextElementSibling){const t=this.readFeaturesFromNode(n,e);t&&E(i,t)}return i}return[]}readName(t){if(t){if("string"==typeof t){const e=cp(t);return this.readNameFromDocument(e)}return lp(t)?this.readNameFromDocument(t):this.readNameFromNode(t)}}readNameFromDocument(t){for(let e=t.firstChild;e;e=e.nextSibling)if(e.nodeType==Node.ELEMENT_NODE){const t=this.readNameFromNode(e);if(t)return t}}readNameFromNode(t){for(let e=t.firstElementChild;e;e=e.nextElementSibling)if(PE.includes(e.namespaceURI)&&"name"==e.localName)return yS(e);for(let e=t.firstElementChild;e;e=e.nextElementSibling){const t=e.localName;if(PE.includes(e.namespaceURI)&&("Document"==t||"Folder"==t||"Placemark"==t||"kml"==t)){const t=this.readNameFromNode(e);if(t)return t}}}readNetworkLinks(t){const e=[];if("string"==typeof t){const i=cp(t);E(e,this.readNetworkLinksFromDocument(i))}else lp(t)?E(e,this.readNetworkLinksFromDocument(t)):E(e,this.readNetworkLinksFromNode(t));return e}readNetworkLinksFromDocument(t){const e=[];for(let i=t.firstChild;i;i=i.nextSibling)i.nodeType==Node.ELEMENT_NODE&&E(e,this.readNetworkLinksFromNode(i));return e}readNetworkLinksFromNode(t){const e=[];for(let i=t.firstElementChild;i;i=i.nextElementSibling)if(PE.includes(i.namespaceURI)&&"NetworkLink"==i.localName){const t=wp({},LE,i,[]);e.push(t)}for(let i=t.firstElementChild;i;i=i.nextElementSibling){const t=i.localName;!PE.includes(i.namespaceURI)||"Document"!=t&&"Folder"!=t&&"kml"!=t||E(e,this.readNetworkLinksFromNode(i))}return e}readRegion(t){const e=[];if("string"==typeof t){const i=cp(t);E(e,this.readRegionFromDocument(i))}else lp(t)?E(e,this.readRegionFromDocument(t)):E(e,this.readRegionFromNode(t));return e}readRegionFromDocument(t){const e=[];for(let i=t.firstChild;i;i=i.nextSibling)i.nodeType==Node.ELEMENT_NODE&&E(e,this.readRegionFromNode(i));return e}readRegionFromNode(t){const e=[];for(let i=t.firstElementChild;i;i=i.nextElementSibling)if(PE.includes(i.namespaceURI)&&"Region"==i.localName){const t=wp({},OE,i,[]);e.push(t)}for(let i=t.firstElementChild;i;i=i.nextElementSibling){const t=i.localName;!PE.includes(i.namespaceURI)||"Document"!=t&&"Folder"!=t&&"kml"!=t||E(e,this.readRegionFromNode(i))}return e}readCamera(t){const e=[];if("string"==typeof t){const i=cp(t);E(e,this.readCameraFromDocument(i))}else lp(t)?E(e,this.readCameraFromDocument(t)):E(e,this.readCameraFromNode(t));return e}readCameraFromDocument(t){const e=[];for(let i=t.firstChild;i;i=i.nextSibling)i.nodeType===Node.ELEMENT_NODE&&E(e,this.readCameraFromNode(i));return e}readCameraFromNode(t){const e=[];for(let i=t.firstElementChild;i;i=i.nextElementSibling)if(PE.includes(i.namespaceURI)&&"Camera"===i.localName){const t=wp({},AE,i,[]);e.push(t)}for(let i=t.firstElementChild;i;i=i.nextElementSibling){const t=i.localName;!PE.includes(i.namespaceURI)||"Document"!==t&&"Folder"!==t&&"Placemark"!==t&&"kml"!==t||E(e,this.readCameraFromNode(i))}return e}writeFeaturesNode(t,e){e=this.adaptOptions(e);const i=sp(PE[4],"kml"),n="http://www.w3.org/2000/xmlns/";i.setAttributeNS(n,"xmlns:gx",RE[0]),i.setAttributeNS(n,"xmlns:xsi",rp),i.setAttributeNS(rp,"xsi:schemaLocation","http://www.opengis.net/kml/2.2 https://developers.google.com/kml/schema/kml22gx.xsd");const r={node:i},s={};t.length>1?s.Document=t:1==t.length&&(s.Placemark=t[0]);const o=DE[i.namespaceURI],a=vp(s,o);return Cp(r,NE,xp,a,[e],o,this),i}},bP.format.KML.getDefaultFillStyle=function(){return XE},bP.format.KML.getDefaultImageStyle=function(){return $E},bP.format.KML.getDefaultStrokeStyle=function(){return ZE},bP.format.KML.getDefaultStyle=function(){return HE},bP.format.KML.getDefaultStyleArray=function(){return qE},bP.format.KML.getDefaultTextStyle=function(){return YE},bP.format.KML.readFlatCoordinates=iw,bP.format.MVT=class extends Zv{constructor(t){super(),t=t||{},this.dataProjection=new mi({code:"",units:"tile-pixels"}),this.featureClass=t.featureClass?t.featureClass:Ud,this.geometryName_=t.geometryName,this.layerName_=t.layerName?t.layerName:"layer",this.layers_=t.layers?t.layers:null,this.idProperty_=t.idProperty,this.supportedMediaTypes=["application/vnd.mapbox-vector-tile","application/x-protobuf"]}readRawGeometry_(t,e,i,n){t.pos=e.geometry;const r=t.readVarint()+t.pos;let s=1,o=0,a=0,l=0,h=0,c=0;for(;t.pos<r;){if(!o){const e=t.readVarint();s=7&e,o=e>>3}if(o--,1===s||2===s)a+=t.readSVarint(),l+=t.readSVarint(),1===s&&h>c&&(n.push(h),c=h),i.push(a,l),h+=2;else{if(7!==s)throw new Error("Invalid command found in the PBF");h>c&&(i.push(i[c],i[c+1]),h+=2)}}h>c&&(n.push(h),c=h)}createFeature_(t,e,i){const n=e.type;if(0===n)return null;let r;const s=e.properties;let o;this.idProperty_?(o=s[this.idProperty_],delete s[this.idProperty_]):o=e.id,s[this.layerName_]=e.layer.name;const a=[],l=[];this.readRawGeometry_(t,e,a,l);const h=function(t,e){let i;1===t?i=1===e?"Point":"MultiPoint":2===t?i=1===e?"LineString":"MultiLineString":3===t&&(i="Polygon");return i}(n,l.length);if(this.featureClass===Ud)r=new this.featureClass(h,a,l,2,s,o),r.transform(i.dataProjection);else{let t;if("Polygon"==h){const e=ds(a,l);t=e.length>1?new Gd(a,"XY",e):new gs(a,"XY",l)}else t="Point"===h?new Wr(a,"XY"):"LineString"===h?new Dd(a,"XY"):"MultiPoint"===h?new kd(a,"XY"):"MultiLineString"===h?new Nd(a,"XY",l):null;r=new(0,this.featureClass),this.geometryName_&&r.setGeometryName(this.geometryName_);const e=Yv(t,!1,i);r.setGeometry(e),void 0!==o&&r.setId(o),r.setProperties(s,!0)}return r}getType(){return"arraybuffer"}readFeatures(t,e){const i=this.layers_,n=En((e=this.adaptOptions(e)).dataProjection);n.setWorldExtent(e.extent),e.dataProjection=n;const r=new FT(t),s=r.readFields(zT,{}),o=[];for(const t in s){if(i&&!i.includes(t))continue;const a=s[t],l=a?[0,0,a.extent,a.extent]:null;n.setExtent(l);for(let t=0,i=a.length;t<i;++t){const i=$T(r,a,t),n=this.createFeature_(r,i,e);null!==n&&o.push(n)}}return o}readProjection(t){return this.dataProjection}setLayers(t){this.layers_=t}},bP.format.OSMXML=class extends aS{constructor(){super(),this.dataProjection=En("EPSG:4326")}readFeaturesFromNode(t,e){if(e=this.getReadOptions(t,e),"osm"==t.localName){const i=wp({nodes:{},ways:[],features:[]},YT,t,[e]);for(let t=0;t<i.ways.length;t++){const n=i.ways[t],r=n.flatCoordinates;if(!r.length)for(let t=0,e=n.ndrefs.length;t<e;t++){E(r,i.nodes[n.ndrefs[t]])}let s;s=n.ndrefs[0]==n.ndrefs[n.ndrefs.length-1]?new gs(r,"XY",[r.length]):new Dd(r,"XY"),Yv(s,!1,e);const o=new At(s);void 0!==n.id&&o.setId(n.id),o.setProperties(n.tags,!0),i.features.push(o)}if(i.features)return i.features}return[]}},bP.format.OWS=eC,bP.format.Polyline=class extends vE{constructor(t){super(),t=t||{},this.dataProjection=En("EPSG:4326"),this.factor_=t.factor?t.factor:1e5,this.geometryLayout_=t.geometryLayout?t.geometryLayout:"XY"}readFeatureFromText(t,e){const i=this.readGeometryFromText(t,e);return new At(i)}readFeaturesFromText(t,e){return[this.readFeatureFromText(t,e)]}readGeometryFromText(t,e){const i=xr(this.geometryLayout_),n=_C(t,i,this.factor_);Wv(n,0,n.length,i,n);return Yv(new Dd(n,this.geometryLayout_),!1,this.adaptOptions(e))}writeFeatureText(t,e){const i=t.getGeometry();if(i)return this.writeGeometryText(i,e);throw new Error("Expected `feature` to have a geometry")}writeFeaturesText(t,e){return this.writeFeatureText(t[0],e)}writeGeometryText(t,e){const i=(t=Yv(t,!0,this.adaptOptions(e))).getFlatCoordinates(),n=t.getStride();return Wv(i,0,i.length,n,i),pC(i,n,this.factor_)}},bP.format.Polyline.decodeDeltas=_C,bP.format.Polyline.decodeFloats=function(t,e){e=e||1e5;const i=yC(t);for(let t=0,n=i.length;t<n;++t)i[t]/=e;return i},bP.format.Polyline.decodeSignedIntegers=yC,bP.format.Polyline.decodeUnsignedIntegers=vC,bP.format.Polyline.encodeDeltas=pC,bP.format.Polyline.encodeFloats=function(t,e){e=e||1e5;for(let i=0,n=t.length;i<n;++i)t[i]=Math.round(t[i]*e);return mC(t)},bP.format.Polyline.encodeSignedIntegers=mC,bP.format.Polyline.encodeUnsignedInteger=SC,bP.format.Polyline.encodeUnsignedIntegers=xC,bP.format.TextFeature=vE,bP.format.TopoJSON=class extends Qv{constructor(t){super(),t=t||{},this.layerName_=t.layerName,this.layers_=t.layers?t.layers:null,this.dataProjection=En(t.dataProjection?t.dataProjection:"EPSG:4326")}readFeaturesFromObject(t,e){if("Topology"==t.type){const i=t;let n,r=null,s=null;i.transform&&(n=i.transform,r=n.scale,s=n.translate);const o=i.arcs;n&&function(t,e,i){for(let n=0,r=t.length;n<r;++n)bC(t[n],e,i)}(o,r,s);const a=[],l=i.objects,h=this.layerName_;let c;for(const t in l)this.layers_&&!this.layers_.includes(t)||("GeometryCollection"===l[t].type?(c=l[t],a.push.apply(a,TC(c,o,r,s,h,t,e))):(c=l[t],a.push(CC(c,o,r,s,h,t,e))));return a}return[]}readProjectionFromObject(t){return this.dataProjection}},bP.format.WFS=class extends aS{constructor(t){super(),t=t||{},this.version_=t.version?t.version:"1.1.0",this.featureType_=t.featureType,this.featureNS_=t.featureNS,this.gmlFormat_=t.gmlFormat?t.gmlFormat:new db[this.version_],this.schemaLocation_=t.schemaLocation?t.schemaLocation:ub[this.version_]}getFeatureType(){return this.featureType_}setFeatureType(t){this.featureType_=t}readFeaturesFromNode(t,e){const i={node:t};Object.assign(i,{featureType:this.featureType_,featureNS:this.featureNS_}),Object.assign(i,this.getReadOptions(t,e||{}));const n=[i];let r;r="2.0.0"===this.version_?eb:this.gmlFormat_.FEATURE_COLLECTION_PARSERS;let s=wp([],r,t,n,this.gmlFormat_);return s||(s=[]),s}readTransactionResponse(t){if(t){if("string"==typeof t){const e=cp(t);return this.readTransactionResponseFromDocument(e)}return lp(t)?this.readTransactionResponseFromDocument(t):this.readTransactionResponseFromNode(t)}}readFeatureCollectionMetadata(t){if(t){if("string"==typeof t){const e=cp(t);return this.readFeatureCollectionMetadataFromDocument(e)}return lp(t)?this.readFeatureCollectionMetadataFromDocument(t):this.readFeatureCollectionMetadataFromNode(t)}}readFeatureCollectionMetadataFromDocument(t){for(let e=t.firstChild;e;e=e.nextSibling)if(e.nodeType==Node.ELEMENT_NODE)return this.readFeatureCollectionMetadataFromNode(e)}readFeatureCollectionMetadataFromNode(t){const e={},i=mS(t.getAttribute("numberOfFeatures"));return e.numberOfFeatures=i,wp(e,eb,t,[],this.gmlFormat_)}readTransactionResponseFromDocument(t){for(let e=t.firstChild;e;e=e.nextSibling)if(e.nodeType==Node.ELEMENT_NODE)return this.readTransactionResponseFromNode(e)}readTransactionResponseFromNode(t){return wp({},nb,t,[])}writeGetFeature(t){const e=sp(hb[this.version_],"GetFeature");e.setAttribute("service","WFS"),e.setAttribute("version",this.version_),t.handle&&e.setAttribute("handle",t.handle),t.outputFormat&&e.setAttribute("outputFormat",t.outputFormat),void 0!==t.maxFeatures&&e.setAttribute("maxFeatures",String(t.maxFeatures)),t.resultType&&e.setAttribute("resultType",t.resultType),void 0!==t.startIndex&&e.setAttribute("startIndex",String(t.startIndex)),void 0!==t.count&&e.setAttribute("count",String(t.count)),void 0!==t.viewParams&&e.setAttribute("viewParams",t.viewParams),e.setAttributeNS(rp,"xsi:schemaLocation",this.schemaLocation_);const i={node:e};if(Object.assign(i,{version:this.version_,srsName:t.srsName,featureNS:t.featureNS?t.featureNS:this.featureNS_,featurePrefix:t.featurePrefix,propertyNames:t.propertyNames?t.propertyNames:[]}),Mt(Array.isArray(t.featureTypes),"`options.featureTypes` must be an Array"),"string"==typeof t.featureTypes[0]){let n=t.filter;t.bbox&&(Mt(t.geometryName,"`options.geometryName` must also be provided when `options.bbox` is set"),n=this.combineBboxAndFilter(t.geometryName,t.bbox,t.srsName,n)),Object.assign(i,{geometryName:t.geometryName,filter:n}),Xb(e,t.featureTypes,[i])}else t.featureTypes.forEach((n=>{const r=this.combineBboxAndFilter(n.geometryName,n.bbox,t.srsName,t.filter);Object.assign(i,{geometryName:n.geometryName,filter:r}),Xb(e,[n.name],[i])}));return e}combineBboxAndFilter(t,e,i,n){const r=tb(t,e,i);return n?QC(n,r):r}writeTransaction(t,e,i,n){const r=[],s=n.version?n.version:this.version_,o=sp(hb[s],"Transaction");let a;o.setAttribute("service","WFS"),o.setAttribute("version",s),n&&(a=n.gmlOptions?n.gmlOptions:{},n.handle&&o.setAttribute("handle",n.handle)),o.setAttributeNS(rp,"xsi:schemaLocation",ub[s]);const l=function(t,e,i,n){const r=n.featurePrefix?n.featurePrefix:ob;let s;"1.0.0"===i?s=2:"1.1.0"===i?s=3:"2.0.0"===i&&(s=3.2);const o=Object.assign({node:t},{version:i,featureNS:n.featureNS,featureType:n.featureType,featurePrefix:r,gmlVersion:s,hasZ:n.hasZ,srsName:n.srsName},e);return o}(o,a,s,n);return t&&gb("Insert",t,r,l),e&&gb("Update",e,r,l),i&&gb("Delete",i,r,l),n.nativeElements&&gb("Native",n.nativeElements,r,l),o}readProjectionFromDocument(t){for(let e=t.firstChild;e;e=e.nextSibling)if(e.nodeType==Node.ELEMENT_NODE)return this.readProjectionFromNode(e);return null}readProjectionFromNode(t){if(t.firstElementChild&&t.firstElementChild.firstElementChild)for(let e=(t=t.firstElementChild.firstElementChild).firstElementChild;e;e=e.nextElementSibling)if(0!==e.childNodes.length&&(1!==e.childNodes.length||3!==e.firstChild.nodeType)){const t=[{}];return this.gmlFormat_.readGeometryElement(e,t),En(t.pop().srsName)}return null}},bP.format.WFS.writeFilter=function(t,e){const i=sp(Vb(e=e||"1.1.0"),"Filter"),n={node:i};return Object.assign(n,{version:e,filter:t}),Pb(i,t,[n]),i},bP.format.WKB=class extends Zv{constructor(t){super(),t=t||{},this.splitCollection=Boolean(t.splitCollection),this.viewCache_=null,this.hex_=!1!==t.hex,this.littleEndian_=!1!==t.littleEndian,this.ewkb_=!1!==t.ewkb,this.layout_=t.geometryLayout,this.nodataZ_=t.nodataZ||0,this.nodataM_=t.nodataM||0,this.srid_=t.srid}getType(){return this.hex_?"text":"arraybuffer"}readFeature(t,e){return new At({geometry:this.readGeometry(t,e)})}readFeatures(t,e){let i=[];const n=this.readGeometry(t,e);return i=this.splitCollection&&n instanceof Md?n.getGeometriesArray():[n],i.map((t=>new At({geometry:t})))}readGeometry(t,e){const i=nR(t);if(!i)return null;const n=new eR(i).readGeometry();return this.viewCache_=i,e=this.getReadOptions(t,e),this.viewCache_=null,Yv(n,!1,e)}readProjection(t){const e=this.viewCache_||nR(t);if(!e)return;const i=new eR(e);return i.readWkbHeader(),i.getSrid()&&En("EPSG:"+i.getSrid())||void 0}writeFeature(t,e){return this.writeGeometry(t.getGeometry(),e)}writeFeatures(t,e){return this.writeGeometry(new Md(t.map((t=>t.getGeometry()))),e)}writeGeometry(t,e){e=this.adaptOptions(e);const i=new iR({layout:this.layout_,littleEndian:this.littleEndian_,ewkb:this.ewkb_,nodata:{Z:this.nodataZ_,M:this.nodataM_}});let n=Number.isInteger(this.srid_)?Number(this.srid_):null;if(!1!==this.srid_&&!Number.isInteger(this.srid_)){const t=e.dataProjection&&En(e.dataProjection);if(t){const e=t.getCode();e.startsWith("EPSG:")&&(n=Number(e.substring(5)))}}i.writeGeometry(Yv(t,!0,e),n);const r=i.getBuffer();return this.hex_?function(t){const e=new Uint8Array(t);return Array.from(e.values()).map((t=>(t<16?"0":"")+Number(t).toString(16).toUpperCase())).join("")}(r):r}},bP.format.WKT=class extends vE{constructor(t){super(),t=t||{},this.splitCollection_=void 0!==t.splitCollection&&t.splitCollection}parse_(t){const e=new fR(t);return new pR(e).parse()}readFeatureFromText(t,e){const i=this.readGeometryFromText(t,e),n=new At;return n.setGeometry(i),n}readFeaturesFromText(t,e){let i=[];const n=this.readGeometryFromText(t,e);i=this.splitCollection_&&"GeometryCollection"==n.getType()?n.getGeometriesArray():[n];const r=[];for(let t=0,e=i.length;t<e;++t){const e=new At;e.setGeometry(i[t]),r.push(e)}return r}readGeometryFromText(t,e){return Yv(this.parse_(t),!1,e)}writeFeatureText(t,e){const i=t.getGeometry();return i?this.writeGeometryText(i,e):""}writeFeaturesText(t,e){if(1==t.length)return this.writeFeatureText(t[0],e);const i=[];for(let e=0,n=t.length;e<n;++e)i.push(t[e].getGeometry());const n=new Md(i);return this.writeGeometryText(n,e)}writeGeometryText(t,e){return vR(Yv(t,!0,e))}},bP.format.WMSCapabilities=class extends qT{constructor(){super(),this.version=void 0}readFromNode(t){this.version=t.getAttribute("version").trim();const e=wp({version:this.version},wR,t,[]);return e||null}},bP.format.WMSGetFeatureInfo=class extends aS{constructor(t){super(),t=t||{},this.featureNS_="http://mapserver.gis.umn.edu/mapserver",this.gmlFormat_=new FS,this.layers_=t.layers?t.layers:null}getLayers(){return this.layers_}setLayers(t){this.layers_=t}readFeatures_(t,e){t.setAttribute("namespaceURI",this.featureNS_);const i=t.localName;let n=[];if(0===t.childNodes.length)return n;if("msGMLOutput"==i)for(let i=0,r=t.childNodes.length;i<r;i++){const r=t.childNodes[i];if(r.nodeType!==Node.ELEMENT_NODE)continue;const s=r,o=e[0],a="_layer",l=s.localName.replace(a,"");if(this.layers_&&!this.layers_.includes(l))continue;const h=l+"_feature";o.featureType=h,o.featureNS=this.featureNS_;const c={};c[h]=dp(this.gmlFormat_.readFeatureElement,this.gmlFormat_);const u=Sp([o.featureNS,null],c);s.setAttribute("namespaceURI",this.featureNS_);const d=wp([],u,s,e,this.gmlFormat_);d&&E(n,d)}if("FeatureCollection"==i){const e=wp([],this.gmlFormat_.FEATURE_COLLECTION_PARSERS,t,[{}],this.gmlFormat_);e&&(n=e)}return n}readFeaturesFromNode(t,e){const i={};return e&&Object.assign(i,this.getReadOptions(t,e)),this.readFeatures_(t,[i])}},bP.format.WMTSCapabilities=class extends qT{constructor(){super(),this.owsParser_=new eC}readFromNode(t){let e=t.getAttribute("version");e&&(e=e.trim());let i=this.owsParser_.readFromNode(t);return i?(i.version=e,i=wp(i,JR,t,[]),i||null):null}},bP.format.XML=qT,bP.format.XMLFeature=aS,bP.format.filter={},bP.format.filter.And=FC,bP.format.filter.Bbox=LC,bP.format.filter.Comparison=NC,bP.format.filter.ComparisonBinary=GC,bP.format.filter.Contains=AC,bP.format.filter.DWithin=OC,bP.format.filter.Disjoint=DC,bP.format.filter.During=kC,bP.format.filter.EqualTo=jC,bP.format.filter.Filter=PC,bP.format.filter.GreaterThan=UC,bP.format.filter.GreaterThanOrEqualTo=BC,bP.format.filter.Intersects=zC,bP.format.filter.IsBetween=XC,bP.format.filter.IsLike=VC,bP.format.filter.IsNull=$C,bP.format.filter.LessThan=WC,bP.format.filter.LessThanOrEqualTo=ZC,bP.format.filter.LogicalNary=IC,bP.format.filter.Not=YC,bP.format.filter.NotEqualTo=HC,bP.format.filter.Or=KC,bP.format.filter.ResourceId=qC,bP.format.filter.Spatial=MC,bP.format.filter.Within=JC,bP.format.filter.and=QC,bP.format.filter.bbox=tb,bP.format.filter.between=function(t,e,i){return new XC(t,e,i)},bP.format.filter.contains=function(t,e,i){return new AC(t,e,i)},bP.format.filter.disjoint=function(t,e,i){return new DC(t,e,i)},bP.format.filter.during=function(t,e,i){return new kC(t,e,i)},bP.format.filter.dwithin=function(t,e,i,n,r){return new OC(t,e,i,n,r)},bP.format.filter.equalTo=function(t,e,i){return new jC(t,e,i)},bP.format.filter.greaterThan=function(t,e){return new UC(t,e)},bP.format.filter.greaterThanOrEqualTo=function(t,e){return new BC(t,e)},bP.format.filter.intersects=function(t,e,i){return new zC(t,e,i)},bP.format.filter.isNull=function(t){return new $C(t)},bP.format.filter.lessThan=function(t,e){return new WC(t,e)},bP.format.filter.lessThanOrEqualTo=function(t,e){return new ZC(t,e)},bP.format.filter.like=function(t,e,i,n,r,s){return new VC(t,e,i,n,r,s)},bP.format.filter.not=function(t){return new YC(t)},bP.format.filter.notEqualTo=function(t,e,i){return new HC(t,e,i)},bP.format.filter.or=function(t){const e=[null].concat(Array.prototype.slice.call(arguments));return new(Function.prototype.bind.apply(KC,e))},bP.format.filter.resourceId=function(t){return new qC(t)},bP.format.filter.within=function(t,e,i){return new JC(t,e,i)},bP.format.xlink={},bP.format.xlink.readHref=JT,bP.format.xsd={},bP.format.xsd.readBoolean=uS,bP.format.xsd.readBooleanString=dS,bP.format.xsd.readDateTime=gS,bP.format.xsd.readDecimal=fS,bP.format.xsd.readDecimalString=pS,bP.format.xsd.readNonNegativeIntegerString=mS,bP.format.xsd.readPositiveInteger=_S,bP.format.xsd.readString=yS,bP.format.xsd.writeBooleanTextNode=xS,bP.format.xsd.writeCDATASection=vS,bP.format.xsd.writeDateTimeTextNode=SS,bP.format.xsd.writeDecimalTextNode=ES,bP.format.xsd.writeNonNegativeIntegerTextNode=wS,bP.format.xsd.writeStringTextNode=RS,bP.functions={},bP.functions.FALSE=b,bP.functions.TRUE=C,bP.functions.VOID=R,bP.functions.memoizeOne=P,bP.functions.toPromise=I,bP.geom={},bP.geom.Circle=Ld,bP.geom.Geometry=_r,bP.geom.GeometryCollection=Md,bP.geom.LineString=Dd,bP.geom.LinearRing=$r,bP.geom.MultiLineString=Nd,bP.geom.MultiPoint=kd,bP.geom.MultiPolygon=Gd,bP.geom.Point=Wr,bP.geom.Polygon=gs,bP.geom.Polygon.circular=fs,bP.geom.Polygon.fromCircle=_s,bP.geom.Polygon.fromExtent=ps,bP.geom.Polygon.makeRegular=ms,bP.geom.SimpleGeometry=mr,bP.geom.SimpleGeometry.getLayoutForStride=yr,bP.geom.SimpleGeometry.getStrideForLayout=xr,bP.geom.SimpleGeometry.transformGeom2D=vr,bP.geom.flat={},bP.geom.flat.area={},bP.geom.flat.area.linearRing=Sr,bP.geom.flat.area.linearRings=Er,bP.geom.flat.area.linearRingss=wr,bP.geom.flat.center={},bP.geom.flat.center.linearRingss=Rd,bP.geom.flat.closest={},bP.geom.flat.closest.arrayMaxSquaredDelta=br,bP.geom.flat.closest.assignClosestArrayPoint=Ir,bP.geom.flat.closest.assignClosestMultiArrayPoint=Fr,bP.geom.flat.closest.assignClosestPoint=Pr,bP.geom.flat.closest.maxSquaredDelta=Cr,bP.geom.flat.closest.multiArrayMaxSquaredDelta=Rr,bP.geom.flat.contains={},bP.geom.flat.contains.linearRingContainsExtent=Zr,bP.geom.flat.contains.linearRingContainsXY=Yr,bP.geom.flat.contains.linearRingsContainsXY=Hr,bP.geom.flat.contains.linearRingssContainsXY=Kr,bP.geom.flat.deflate={},bP.geom.flat.deflate.deflateCoordinate=Lr,bP.geom.flat.deflate.deflateCoordinates=Mr,bP.geom.flat.deflate.deflateCoordinatesArray=Ar,bP.geom.flat.deflate.deflateMultiCoordinatesArray=Or,bP.geom.flat.flip={},bP.geom.flat.flip.flipXY=Wv,bP.geom.flat.geodesic={},bP.geom.flat.geodesic.greatCircleArc=function(t,e,i,n,r,s){const o=En("EPSG:4326"),a=Math.cos(Oe(e)),l=Math.sin(Oe(e)),h=Math.cos(Oe(n)),c=Math.sin(Oe(n)),u=Math.cos(Oe(i-t)),d=Math.sin(Oe(i-t)),g=l*c+a*h*u;return Dx((function(e){if(1<=g)return[i,n];const r=e*Math.acos(g),s=Math.cos(r),o=Math.sin(r),f=d*h,p=a*c-l*h*u,_=Math.atan2(f,p),m=Math.asin(l*s+a*o*Math.cos(_));return[Ae(Oe(t)+Math.atan2(Math.sin(_)*o*a,s-l*Math.sin(m))),Ae(m)]}),An(o,r),s)},bP.geom.flat.geodesic.meridian=Nx,bP.geom.flat.geodesic.parallel=kx,bP.geom.flat.inflate={},bP.geom.flat.inflate.inflateCoordinates=Dr,bP.geom.flat.inflate.inflateCoordinatesArray=Nr,bP.geom.flat.inflate.inflateMultiCoordinatesArray=kr,bP.geom.flat.interiorpoint={},bP.geom.flat.interiorpoint.getInteriorPointOfArray=qr,bP.geom.flat.interiorpoint.getInteriorPointsOfMultiArray=Jr,bP.geom.flat.interpolate={},bP.geom.flat.interpolate.interpolatePoint=Pd,bP.geom.flat.interpolate.lineStringCoordinateAtM=Id,bP.geom.flat.interpolate.lineStringsCoordinateAtM=Fd,bP.geom.flat.intersectsextent={},bP.geom.flat.intersectsextent.intersectsLineString=es,bP.geom.flat.intersectsextent.intersectsLineStringArray=is,bP.geom.flat.intersectsextent.intersectsLinearRing=ns,bP.geom.flat.intersectsextent.intersectsLinearRingArray=rs,bP.geom.flat.intersectsextent.intersectsLinearRingMultiArray=ss,bP.geom.flat.length={},bP.geom.flat.length.lineStringLength=Od,bP.geom.flat.length.linearRingLength=function(t,e,i,n){let r=Od(t,e,i,n);const s=t[i-n]-t[e],o=t[i-n+1]-t[e+1];return r+=Math.sqrt(s*s+o*o),r},bP.geom.flat.orient={},bP.geom.flat.orient.inflateEnds=ds,bP.geom.flat.orient.linearRingIsClockwise=as,bP.geom.flat.orient.linearRingsAreOriented=ls,bP.geom.flat.orient.linearRingssAreOriented=hs,bP.geom.flat.orient.orientLinearRings=cs,bP.geom.flat.orient.orientLinearRingsArray=us,bP.geom.flat.reverse={},bP.geom.flat.reverse.coordinates=os,bP.geom.flat.segments={},bP.geom.flat.segments.forEach=Qr,bP.geom.flat.segments.getIntersectionPoint=ts,bP.geom.flat.simplify={},bP.geom.flat.simplify.douglasPeucker=Gr,bP.geom.flat.simplify.douglasPeuckerArray=jr,bP.geom.flat.simplify.douglasPeuckerMultiArray=function(t,e,i,n,r,s,o,a){for(let l=0,h=i.length;l<h;++l){const h=i[l],c=[];o=jr(t,e,h,n,r,s,o,c),a.push(c),e=h[h.length-1]}return o},bP.geom.flat.simplify.quantize=zr,bP.geom.flat.simplify.quantizeArray=Xr,bP.geom.flat.simplify.quantizeMultiArray=Vr,bP.geom.flat.simplify.radialDistance=Ur,bP.geom.flat.simplify.simplifyLineString=function(t,e,i,n,r,s,o){return o=void 0!==o?o:[],s||(i=Ur(t,e,i,n,r,o,0),t=o,e=0,n=2),o.length=Gr(t,e,i,n,r,o,0),o},bP.geom.flat.simplify.snap=Br,bP.geom.flat.straightchunk={},bP.geom.flat.straightchunk.matchingChunk=Xy,bP.geom.flat.textpath={},bP.geom.flat.textpath.drawTextOnPath=Yy,bP.geom.flat.topology={},bP.geom.flat.topology.lineStringIsClosed=function(t,e,i,n){const r=i-n;return t[e]===t[r]&&t[e+1]===t[r+1]&&(i-e)/n>3&&!!Sr(t,e,i,n)},bP.geom.flat.transform={},bP.geom.flat.transform.rotate=ur,bP.geom.flat.transform.scale=dr,bP.geom.flat.transform.transform2D=cr,bP.geom.flat.transform.translate=gr,bP.has={},bP.has.CREATE_IMAGE_BITMAP=dt,bP.has.DEVICE_PIXEL_RATIO=ht,bP.has.IMAGE_DECODE=ut,bP.has.MAC=lt,bP.has.PASSIVE_EVENT_LISTENERS=gt,bP.has.SAFARI=st,bP.has.SAFARI_BUG_237906=ot,bP.has.WEBKIT=at,bP.has.WORKER_OFFSCREEN_CANVAS=ct,bP.interaction={},bP.interaction.DblClickDragZoom=class extends Ho{constructor(t){const e=t||{};super(e),e.stopDown&&(this.stopDown=e.stopDown),this.scaleDeltaByPixel_=e.delta?e.delta:.01,this.duration_=void 0!==e.duration?e.duration:250,this.handlingDownUpSequence_=!1,this.handlingDoubleDownSequence_=!1,this.doubleTapTimeoutId_=void 0,this.trackedPointers_={},this.down_=null,this.targetPointers=[]}handleEvent(t){if(!t.originalEvent)return!0;let e=!1;if(this.updateTrackedPointers_(t),this.handlingDownUpSequence_){if(t.type==$s.POINTERDRAG)this.handleDragEvent(t),t.originalEvent.preventDefault();else if(t.type==$s.POINTERUP){const e=this.handleUpEvent(t);this.handlingDownUpSequence_=e}}else if(t.type==$s.POINTERDOWN)if(this.handlingDoubleDownSequence_){this.handlingDoubleDownSequence_=!1;const i=this.handleDownEvent(t);this.handlingDownUpSequence_=i,e=this.stopDown(i)}else e=this.stopDown(!1),this.waitForDblTap_();return!e}handleDragEvent(t){let e=1;const i=this.targetPointers[0],n=this.down_,r=i.clientY-n.clientY;void 0!==this.lastDistance_&&(e=1-(this.lastDistance_-r)*this.scaleDeltaByPixel_),this.lastDistance_=r,1!=e&&(this.lastScaleDelta_=e);const s=t.map,o=s.getView();s.render(),o.adjustResolutionInternal(e)}handleDownEvent(t){if(1==this.targetPointers.length){const e=t.map;return this.anchor_=null,this.lastDistance_=void 0,this.lastScaleDelta_=1,this.down_=t.originalEvent,this.handlingDownUpSequence_||e.getView().beginInteraction(),!0}return!1}handleUpEvent(t){if(0==this.targetPointers.length){const e=t.map.getView(),i=this.lastScaleDelta_>1?1:-1;return e.endInteraction(this.duration_,i),this.handlingDownUpSequence_=!1,this.handlingDoubleDownSequence_=!1,!1}return!0}stopDown(t){return t}updateTrackedPointers_(t){if(function(t){const e=t.type;return e===$s.POINTERDOWN||e===$s.POINTERDRAG||e===$s.POINTERUP}(t)){const e=t.originalEvent,i=e.pointerId.toString();t.type==$s.POINTERUP?delete this.trackedPointers_[i]:(t.type==$s.POINTERDOWN||i in this.trackedPointers_)&&(this.trackedPointers_[i]=e),this.targetPointers=Object.values(this.trackedPointers_)}}waitForDblTap_(){void 0!==this.doubleTapTimeoutId_?(clearTimeout(this.doubleTapTimeoutId_),this.doubleTapTimeoutId_=void 0):(this.handlingDoubleDownSequence_=!0,this.doubleTapTimeoutId_=setTimeout(this.endInteraction_.bind(this),250))}endInteraction_(){this.handlingDoubleDownSequence_=!1,this.doubleTapTimeoutId_=void 0}},bP.interaction.DoubleClickZoom=Jo,bP.interaction.DragAndDrop=class extends Ho{constructor(t){t=t||{},super({handleEvent:C}),this.on,this.once,this.un,this.readAsBuffer_=!1,this.formats_=[];const e=t.formatConstructors?t.formatConstructors:[];for(let t=0,i=e.length;t<i;++t){let i=e[t];"function"==typeof i&&(i=new i),this.formats_.push(i),this.readAsBuffer_=this.readAsBuffer_||"arraybuffer"===i.getType()}this.projection_=t.projection?En(t.projection):null,this.dropListenKeys_=null,this.source_=t.source||null,this.target=t.target?t.target:null}handleResult_(t,e){const i=e.target.result,n=this.getMap();let r,s=this.projection_;if(!s&&(s=Gn(),!s)){s=n.getView().getProjection()}const o=this.formats_;for(let e=0,n=o.length;e<n;++e){const n=o[e];let a=i;this.readAsBuffer_&&"arraybuffer"!==n.getType()&&(void 0===r&&(r=(new TextDecoder).decode(i)),a=r);const l=this.tryReadFeatures_(n,a,{featureProjection:s});if(l&&l.length>0){this.source_&&(this.source_.clear(),this.source_.addFeatures(l)),this.dispatchEvent(new Yx(Zx,t,l,s));break}}}registerListeners_(){const t=this.getMap();if(t){const e=this.target?this.target:t.getViewport();this.dropListenKeys_=[D(e,c,this.handleDrop,this),D(e,l,this.handleStop,this),D(e,h,this.handleStop,this),D(e,c,this.handleStop,this)]}}setActive(t){!this.getActive()&&t&&this.registerListeners_(),this.getActive()&&!t&&this.unregisterListeners_(),super.setActive(t)}setMap(t){this.unregisterListeners_(),super.setMap(t),this.getActive()&&this.registerListeners_()}tryReadFeatures_(t,e,i){try{return t.readFeatures(e,i)}catch{return null}}unregisterListeners_(){this.dropListenKeys_&&(this.dropListenKeys_.forEach(k),this.dropListenKeys_=null)}handleDrop(t){const e=t.dataTransfer.files;for(let t=0,i=e.length;t<i;++t){const i=e.item(t),n=new FileReader;n.addEventListener(g,this.handleResult_.bind(this,i)),this.readAsBuffer_?n.readAsArrayBuffer(i):n.readAsText(i)}}handleStop(t){t.stopPropagation(),t.preventDefault(),t.dataTransfer.dropEffect="copy"}},bP.interaction.DragAndDrop.DragAndDropEvent=Yx,bP.interaction.DragBox=Ta,bP.interaction.DragBox.DragBoxEvent=wa,bP.interaction.DragPan=_a,bP.interaction.DragRotate=ma,bP.interaction.DragRotateAndZoom=class extends fa{constructor(t){super(t=t||{}),this.condition_=t.condition?t.condition:ca,this.lastAngle_=void 0,this.lastMagnitude_=void 0,this.lastScaleDelta_=0,this.duration_=void 0!==t.duration?t.duration:400}handleDragEvent(t){if(!da(t))return;const e=t.map,i=e.getSize(),n=t.pixel,r=n[0]-i[0]/2,s=i[1]/2-n[1],o=Math.atan2(s,r),a=Math.sqrt(r*r+s*s),l=e.getView();if(void 0!==this.lastAngle_){const t=this.lastAngle_-o;l.adjustRotationInternal(t)}this.lastAngle_=o,void 0!==this.lastMagnitude_&&l.adjustResolutionInternal(this.lastMagnitude_/a),void 0!==this.lastMagnitude_&&(this.lastScaleDelta_=this.lastMagnitude_/a),this.lastMagnitude_=a}handleUpEvent(t){if(!da(t))return!0;const e=t.map.getView(),i=this.lastScaleDelta_>1?1:-1;return e.endInteraction(this.duration_,i),this.lastScaleDelta_=0,!1}handleDownEvent(t){return!!da(t)&&(!!this.condition_(t)&&(t.map.getView().beginInteraction(),this.lastAngle_=void 0,this.lastMagnitude_=void 0,!0))}},bP.interaction.DragZoom=Ca,bP.interaction.Draw=class extends fa{constructor(t){const e=t;e.stopDown||(e.stopDown=b),super(e),this.on,this.once,this.un,this.options_=t,this.shouldHandle_=!1,this.downPx_=null,this.downTimeout_,this.lastDragTime_,this.pointerType_,this.freehand_=!1,this.source_=t.source?t.source:null,this.features_=t.features?t.features:null,this.snapTolerance_=t.snapTolerance?t.snapTolerance:12,this.type_=t.type,this.mode_=function(t){switch(t){case"Point":case"MultiPoint":return"Point";case"LineString":case"MultiLineString":return"LineString";case"Polygon":case"MultiPolygon":return"Polygon";case"Circle":return"Circle";default:throw new Error("Invalid type: "+t)}}(this.type_),this.stopClick_=!!t.stopClick,this.ignoreNextUpEvent_=!1,this.minPoints_=t.minPoints?t.minPoints:"Polygon"===this.mode_?3:2,this.maxPoints_="Circle"===this.mode_?2:t.maxPoints?t.maxPoints:1/0,this.finishCondition_=t.finishCondition?t.finishCondition:C,this.geometryLayout_=t.geometryLayout?t.geometryLayout:"XY";let i=t.geometryFunction;if(!i){const t=this.mode_;if("Circle"===t)i=(t,e,i)=>{const n=e||new Ld([NaN,NaN]),r=Un(t[0],i),s=ai(r,Un(t[t.length-1],i));n.setCenterAndRadius(r,Math.sqrt(s),this.geometryLayout_);const o=Gn();return o&&n.transform(i,o),n};else{let e;"Point"===t?e=Wr:"LineString"===t?e=Dd:"Polygon"===t&&(e=gs),i=(i,n,r)=>(n?"Polygon"===t?i[0].length?n.setCoordinates([i[0].concat([i[0][0]])],this.geometryLayout_):n.setCoordinates([],this.geometryLayout_):n.setCoordinates(i,this.geometryLayout_):n=new e(i,this.geometryLayout_),n)}}this.geometryFunction_=i,this.dragVertexDelay_=void 0!==t.dragVertexDelay?t.dragVertexDelay:500,this.finishCoordinate_=null,this.sketchFeature_=null,this.sketchPoint_=null,this.sketchCoords_=null,this.sketchLine_=null,this.sketchLineCoords_=null,this.squaredClickTolerance_=t.clickTolerance?t.clickTolerance*t.clickTolerance:36,this.overlay_=new Gx({source:new qd({useSpatialIndex:!1,wrapX:!!t.wrapX&&t.wrapX}),style:t.style?t.style:cv(),updateWhileInteracting:!0}),this.geometryName_=t.geometryName,this.condition_=t.condition?t.condition:la,this.freehandCondition_,t.freehand?this.freehandCondition_=ra:this.freehandCondition_=t.freehandCondition?t.freehandCondition:ca,this.traceCondition_,this.setTrace(t.trace||!1),this.traceState_={active:!1},this.traceSource_=t.traceSource||t.source||null,this.addChangeListener(Yo,this.updateState_)}setTrace(t){let e;e=t?!0===t?ra:t:oa,this.traceCondition_=e}setMap(t){super.setMap(t),this.updateState_()}setFreehand(t){this.freehand_=t,this.freehand_?this.freehandCondition_=ra:this.freehandCondition_=this.options_&&this.options_.freehandCondition?this.options_.freehandCondition:ca}getOverlay(){return this.overlay_}getFreehand(){return this.freehand_}handleEvent(t){t.originalEvent.type===s&&t.originalEvent.preventDefault(),this.freehand_="Point"!==this.mode_&&this.freehandCondition_(t);let e=t.type===$s.POINTERMOVE,i=!0;if(!this.freehand_&&this.lastDragTime_&&t.type===$s.POINTERDRAG){Date.now()-this.lastDragTime_>=this.dragVertexDelay_?(this.downPx_=t.pixel,this.shouldHandle_=!this.freehand_,e=!0):this.lastDragTime_=void 0,this.shouldHandle_&&void 0!==this.downTimeout_&&(clearTimeout(this.downTimeout_),this.downTimeout_=void 0)}return this.freehand_&&t.type===$s.POINTERDRAG&&null!==this.sketchFeature_?(this.addToDrawing_(t.coordinate),i=!1):this.freehand_&&t.type===$s.POINTERDOWN?i=!1:e&&this.getPointerCount()<2?(i=t.type===$s.POINTERMOVE,i&&this.freehand_?(this.handlePointerMove_(t),this.shouldHandle_&&t.originalEvent.preventDefault()):("mouse"===t.originalEvent.pointerType||t.type===$s.POINTERDRAG&&void 0===this.downTimeout_)&&this.handlePointerMove_(t)):t.type===$s.DBLCLICK&&(i=!1),super.handleEvent(t)&&i}handleDownEvent(t){return this.shouldHandle_=!this.freehand_,this.freehand_?(this.downPx_=t.pixel,this.finishCoordinate_||this.startDrawing_(t.coordinate),!0):this.condition_(t)?(this.lastDragTime_=Date.now(),this.downTimeout_=setTimeout((()=>{this.handlePointerMove_(new Vs($s.POINTERMOVE,t.map,t.originalEvent,!1,t.frameState))}),this.dragVertexDelay_),this.downPx_=t.pixel,!0):(this.lastDragTime_=void 0,!1)}deactivateTrace_(){this.traceState_={active:!1}}toggleTraceState_(t){if(!this.traceSource_||!this.traceCondition_(t))return;if(this.traceState_.active)return void this.deactivateTrace_();const e=this.getMap(),i=Bt([e.getCoordinateFromPixel([t.pixel[0]-this.snapTolerance_,t.pixel[1]+this.snapTolerance_]),e.getCoordinateFromPixel([t.pixel[0]+this.snapTolerance_,t.pixel[1]-this.snapTolerance_])]),n=this.traceSource_.getFeaturesInExtent(i);if(0===n.length)return;const r=Qx(t.coordinate,n);r.length&&(this.traceState_={active:!0,startCoord:t.coordinate.slice(),targets:r,targetIndex:-1})}addOrRemoveTracedCoordinates_(t,e){const i=t.startIndex<=t.endIndex;i===t.startIndex<=e?i&&e>t.endIndex||!i&&e<t.endIndex?this.addTracedCoordinates_(t,t.endIndex,e):(i&&e<t.endIndex||!i&&e>t.endIndex)&&this.removeTracedCoordinates_(e,t.endIndex):(this.removeTracedCoordinates_(t.startIndex,t.endIndex),this.addTracedCoordinates_(t,t.startIndex,e))}removeTracedCoordinates_(t,e){if(t===e)return;let i=0;if(t<e){const n=Math.ceil(t);let r=Math.floor(e);r===e&&(r-=1),i=r-n+1}else{const n=Math.floor(t);let r=Math.ceil(e);r===e&&(r+=1),i=n-r+1}i>0&&this.removeLastPoints_(i)}addTracedCoordinates_(t,e,i){if(e===i)return;const n=[];if(e<i){const r=Math.ceil(e);let s=Math.floor(i);s===i&&(s-=1);for(let e=r;e<=s;++e)n.push(Hx(t.coordinates,e))}else{const r=Math.floor(e);let s=Math.ceil(i);s===i&&(s+=1);for(let e=r;e>=s;--e)n.push(Hx(t.coordinates,e))}n.length&&this.appendCoordinates(n)}updateTrace_(t){const e=this.traceState_;if(!e.active)return;if(-1===e.targetIndex){if(li(t.map.getPixelFromCoordinate(e.startCoord),t.pixel)<this.snapTolerance_)return}const i=Jx(t.coordinate,e,this.getMap(),this.snapTolerance_);if(e.targetIndex!==i.index){if(-1!==e.targetIndex){const t=e.targets[e.targetIndex];this.removeTracedCoordinates_(t.startIndex,t.endIndex)}const t=e.targets[i.index];this.addTracedCoordinates_(t,t.startIndex,i.endIndex)}else{const t=e.targets[e.targetIndex];this.addOrRemoveTracedCoordinates_(t,i.endIndex)}e.targetIndex=i.index;const n=e.targets[e.targetIndex];n.endIndex=i.endIndex;const r=Kx(n.coordinates,n.endIndex),s=this.getMap().getPixelFromCoordinate(r);t.coordinate=r,t.pixel=[Math.round(s[0]),Math.round(s[1])]}handleDragEvent(t){this.ignoreNextUpEvent_=!0,super.handleDragEvent(t)}handleUpEvent(t){let e=!0;if(0===this.getPointerCount()){this.downTimeout_&&(clearTimeout(this.downTimeout_),this.downTimeout_=void 0),this.handlePointerMove_(t);const i=this.traceState_.active;if(this.ignoreNextUpEvent_||this.toggleTraceState_(t),this.shouldHandle_){const n=!this.finishCoordinate_;n&&this.startDrawing_(t.coordinate),!n&&this.freehand_?this.finishDrawing():this.freehand_||n&&"Point"!==this.mode_||(this.atFinish_(t.pixel,i)?this.finishCondition_(t)&&this.finishDrawing():this.addToDrawing_(t.coordinate)),e=!1}else this.freehand_&&this.abortDrawing()}return this.ignoreNextUpEvent_=!1,!e&&this.stopClick_&&t.preventDefault(),e}handlePointerMove_(t){if(this.pointerType_=t.originalEvent.pointerType,this.downPx_&&(!this.freehand_&&this.shouldHandle_||this.freehand_&&!this.shouldHandle_)){const e=this.downPx_,i=t.pixel,n=e[0]-i[0],r=e[1]-i[1],s=n*n+r*r;if(this.shouldHandle_=this.freehand_?s>this.squaredClickTolerance_:s<=this.squaredClickTolerance_,!this.shouldHandle_)return}this.finishCoordinate_?(this.updateTrace_(t),this.modifyDrawing_(t.coordinate)):this.createOrUpdateSketchPoint_(t.coordinate.slice())}atFinish_(t,e){let i=!1;if(this.sketchFeature_){let n=!1,r=[this.finishCoordinate_];const s=this.mode_;if("Point"===s)i=!0;else if("Circle"===s)i=2===this.sketchCoords_.length;else if("LineString"===s)n=!e&&this.sketchCoords_.length>this.minPoints_;else if("Polygon"===s){const t=this.sketchCoords_;n=t[0].length>this.minPoints_,r=[t[0][0],t[0][t[0].length-2]],r=e?[t[0][0]]:[t[0][0],t[0][t[0].length-2]]}if(n){const e=this.getMap();for(let n=0,s=r.length;n<s;n++){const s=r[n],o=e.getPixelFromCoordinate(s),a=t[0]-o[0],l=t[1]-o[1],h=this.freehand_?1:this.snapTolerance_;if(i=Math.sqrt(a*a+l*l)<=h,i){this.finishCoordinate_=s;break}}}}return i}createOrUpdateSketchPoint_(t){if(this.sketchPoint_){this.sketchPoint_.getGeometry().setCoordinates(t)}else this.sketchPoint_=new At(new Wr(t)),this.updateSketchFeatures_()}createOrUpdateCustomSketchLine_(t){this.sketchLine_||(this.sketchLine_=new At);const e=t.getLinearRing(0);let i=this.sketchLine_.getGeometry();i?(i.setFlatCoordinates(e.getLayout(),e.getFlatCoordinates()),i.changed()):(i=new Dd(e.getFlatCoordinates(),e.getLayout()),this.sketchLine_.setGeometry(i))}startDrawing_(t){const e=this.getMap().getView().getProjection(),i=xr(this.geometryLayout_);for(;t.length<i;)t.push(0);this.finishCoordinate_=t,"Point"===this.mode_?this.sketchCoords_=t.slice():"Polygon"===this.mode_?(this.sketchCoords_=[[t.slice(),t.slice()]],this.sketchLineCoords_=this.sketchCoords_[0]):this.sketchCoords_=[t.slice(),t.slice()],this.sketchLineCoords_&&(this.sketchLine_=new At(new Dd(this.sketchLineCoords_)));const n=this.geometryFunction_(this.sketchCoords_,void 0,e);this.sketchFeature_=new At,this.geometryName_&&this.sketchFeature_.setGeometryName(this.geometryName_),this.sketchFeature_.setGeometry(n),this.updateSketchFeatures_(),this.dispatchEvent(new hv(ov,this.sketchFeature_))}modifyDrawing_(t){const e=this.getMap(),i=this.sketchFeature_.getGeometry(),n=e.getView().getProjection(),r=xr(this.geometryLayout_);let s,o;for(;t.length<r;)t.push(0);if("Point"===this.mode_?o=this.sketchCoords_:"Polygon"===this.mode_?(s=this.sketchCoords_[0],o=s[s.length-1],this.atFinish_(e.getPixelFromCoordinate(t))&&(t=this.finishCoordinate_.slice())):(s=this.sketchCoords_,o=s[s.length-1]),o[0]=t[0],o[1]=t[1],this.geometryFunction_(this.sketchCoords_,i,n),this.sketchPoint_){this.sketchPoint_.getGeometry().setCoordinates(t)}if("Polygon"===i.getType()&&"Polygon"!==this.mode_)this.createOrUpdateCustomSketchLine_(i);else if(this.sketchLineCoords_){this.sketchLine_.getGeometry().setCoordinates(this.sketchLineCoords_)}this.updateSketchFeatures_()}addToDrawing_(t){const e=this.sketchFeature_.getGeometry(),i=this.getMap().getView().getProjection();let n,r;const s=this.mode_;return"LineString"===s||"Circle"===s?(this.finishCoordinate_=t.slice(),r=this.sketchCoords_,r.length>=this.maxPoints_&&(this.freehand_?r.pop():n=!0),r.push(t.slice()),this.geometryFunction_(r,e,i)):"Polygon"===s&&(r=this.sketchCoords_[0],r.length>=this.maxPoints_&&(this.freehand_?r.pop():n=!0),r.push(t.slice()),n&&(this.finishCoordinate_=r[0]),this.geometryFunction_(this.sketchCoords_,e,i)),this.createOrUpdateSketchPoint_(t.slice()),this.updateSketchFeatures_(),n?this.finishDrawing():this.sketchFeature_}removeLastPoints_(t){if(!this.sketchFeature_)return;const e=this.sketchFeature_.getGeometry(),i=this.getMap().getView().getProjection(),n=this.mode_;for(let r=0;r<t;++r){let t;if("LineString"===n||"Circle"===n){if(t=this.sketchCoords_,t.splice(-2,1),t.length>=2){this.finishCoordinate_=t[t.length-2].slice();const e=this.finishCoordinate_.slice();t[t.length-1]=e,this.createOrUpdateSketchPoint_(e)}this.geometryFunction_(t,e,i),"Polygon"===e.getType()&&this.sketchLine_&&this.createOrUpdateCustomSketchLine_(e)}else if("Polygon"===n){t=this.sketchCoords_[0],t.splice(-2,1);const n=this.sketchLine_.getGeometry();if(t.length>=2){const e=t[t.length-2].slice();t[t.length-1]=e,this.createOrUpdateSketchPoint_(e)}n.setCoordinates(t),this.geometryFunction_(this.sketchCoords_,e,i)}if(1===t.length){this.abortDrawing();break}}this.updateSketchFeatures_()}removeLastPoint(){this.removeLastPoints_(1)}finishDrawing(){const t=this.abortDrawing_();if(!t)return null;let e=this.sketchCoords_;const i=t.getGeometry(),n=this.getMap().getView().getProjection();return"LineString"===this.mode_?(e.pop(),this.geometryFunction_(e,i,n)):"Polygon"===this.mode_&&(e[0].pop(),this.geometryFunction_(e,i,n),e=i.getCoordinates()),"MultiPoint"===this.type_?t.setGeometry(new kd([e])):"MultiLineString"===this.type_?t.setGeometry(new Nd([e])):"MultiPolygon"===this.type_&&t.setGeometry(new Gd([e])),this.dispatchEvent(new hv(av,t)),this.features_&&this.features_.push(t),this.source_&&this.source_.addFeature(t),t}abortDrawing_(){this.finishCoordinate_=null;const t=this.sketchFeature_;return this.sketchFeature_=null,this.sketchPoint_=null,this.sketchLine_=null,this.overlay_.getSource().clear(!0),this.deactivateTrace_(),t}abortDrawing(){const t=this.abortDrawing_();t&&this.dispatchEvent(new hv(lv,t))}appendCoordinates(t){const e=this.mode_,i=!this.sketchFeature_;let n;if(i&&this.startDrawing_(t[0]),"LineString"===e||"Circle"===e)n=this.sketchCoords_;else{if("Polygon"!==e)return;n=this.sketchCoords_&&this.sketchCoords_.length?this.sketchCoords_[0]:[]}i&&n.shift(),n.pop();for(let e=0;e<t.length;e++)this.addToDrawing_(t[e]);const r=t[t.length-1];this.sketchFeature_=this.addToDrawing_(r),this.modifyDrawing_(r)}extend(t){const e=t.getGeometry();this.sketchFeature_=t,this.sketchCoords_=e.getCoordinates();const i=this.sketchCoords_[this.sketchCoords_.length-1];this.finishCoordinate_=i.slice(),this.sketchCoords_.push(i.slice()),this.sketchPoint_=new At(new Wr(i)),this.updateSketchFeatures_(),this.dispatchEvent(new hv(ov,this.sketchFeature_))}updateSketchFeatures_(){const t=[];this.sketchFeature_&&t.push(this.sketchFeature_),this.sketchLine_&&t.push(this.sketchLine_),this.sketchPoint_&&t.push(this.sketchPoint_);const e=this.overlay_.getSource();e.clear(!0),e.addFeatures(t)}updateState_(){const t=this.getMap(),e=this.getActive();t&&e||this.abortDrawing(),this.overlay_.setMap(e?t:null)}},bP.interaction.Draw.DrawEvent=hv,bP.interaction.Draw.createBox=function(){return function(t,e,i){const n=Bt([t[0],t[t.length-1]].map((function(t){return Un(t,i)}))),r=[[ce(n),ue(n),xe(n),ye(n),ce(n)]];e?e.setCoordinates(r):e=new gs(r);const s=Gn();return s&&e.transform(i,s),e}},bP.interaction.Draw.createRegularPolygon=function(t,e){return function(i,n,r){const s=Un(i[0],r),o=Un(i[i.length-1],r),a=Math.sqrt(ai(s,o));n=n||_s(new Ld(s),t);let l=e;if(!e&&0!==e){const t=o[0]-s[0],e=o[1]-s[1];l=Math.atan2(e,t)}ms(n,s,a,l);const h=Gn();return h&&n.transform(r,h),n}},bP.interaction.Extent=class extends fa{constructor(t){super(t=t||{}),this.on,this.once,this.un,this.condition_=t.condition?t.condition:ra,this.createCondition_=t.createCondition||this.condition_,this.drag_=t.drag||!1,this.extent_=null,this.pointerHandler_=null,this.pixelTolerance_=void 0!==t.pixelTolerance?t.pixelTolerance:10,this.snappedToVertex_=!1,this.extentFeature_=null,this.vertexFeature_=null,t||(t={}),this.extentOverlay_=new Gx({source:new qd({useSpatialIndex:!1,wrapX:!!t.wrapX}),style:t.boxStyle?t.boxStyle:gv(),updateWhileAnimating:!0,updateWhileInteracting:!0}),this.vertexOverlay_=new Gx({source:new qd({useSpatialIndex:!1,wrapX:!!t.wrapX}),style:t.pointerStyle?t.pointerStyle:fv(),updateWhileAnimating:!0,updateWhileInteracting:!0}),t.extent&&this.setExtent(t.extent)}snapToVertex_(t,e){const i=e.getCoordinateFromPixelInternal(t),n=function(t,e){return hi(i,t)-hi(i,e)},r=this.getExtentInternal();if(r){const s=function(t){return[[[t[0],t[1]],[t[0],t[3]]],[[t[0],t[3]],[t[2],t[3]]],[[t[2],t[3]],[t[2],t[1]]],[[t[2],t[1]],[t[0],t[1]]]]}(r);s.sort(n);const o=s[0];let a=ei(i,o);const l=e.getPixelFromCoordinateInternal(a);if(li(t,l)<=this.pixelTolerance_){const t=e.getPixelFromCoordinateInternal(o[0]),i=e.getPixelFromCoordinateInternal(o[1]),n=ai(l,t),r=ai(l,i),s=Math.sqrt(Math.min(n,r));return this.snappedToVertex_=s<=this.pixelTolerance_,this.snappedToVertex_&&(a=n>r?o[1]:o[0]),a}}return null}handlePointerMove_(t){const e=t.pixel,i=t.map,n=this.drag_&&$t(this.extent_,t.coordinate);let r=this.snapToVertex_(e,i);return r||!this.createCondition_(t)||n||(r=i.getCoordinateFromPixelInternal(e)),n&&!r?this.getMap().getViewport().classList.add("ol-grab"):this.getMap().getViewport().classList.remove("ol-grab"),r?(this.updatePointerFeature_(r),!0):(this.noVertexFeature_(),!1)}createOrUpdateExtentFeature_(t){let e=this.extentFeature_;return e?t?e.setGeometry(ps(t)):e.setGeometry(void 0):(e=new At(t?ps(t):{}),this.extentFeature_=e,this.extentOverlay_.getSource().addFeature(e)),e}updatePointerFeature_(t,e=!0){let i=this.vertexFeature_;if(e&&!i&&(i=new At(new Wr(t)),this.vertexFeature_=i,this.vertexOverlay_.getSource().addFeature(i)),i){i.getGeometry().setCoordinates(t)}return i}noVertexFeature_(){this.vertexFeature_&&(this.vertexOverlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null)}handleEvent(t){if(!t.originalEvent||!this.condition_(t))return this.noVertexFeature_(),!0;let e=this.handlingDownUpSequence;return t.type!=$s.POINTERMOVE||this.handlingDownUpSequence||(e=this.handlePointerMove_(t)),super.handleEvent(t),!e}handleDownEvent(t){const e=t.pixel,i=t.map,n=this.getExtentInternal();let r=this.snapToVertex_(e,i);const s=function(t){let e=null,i=null;return t[0]==n[0]?e=n[2]:t[0]==n[2]&&(e=n[0]),t[1]==n[1]?i=n[3]:t[1]==n[3]&&(i=n[1]),null!==e&&null!==i?[e,i]:null};if(r&&n){const t=r[0]==n[0]||r[0]==n[2]?r[0]:null,e=r[1]==n[1]||r[1]==n[3]?r[1]:null;null!==t&&null!==e?this.pointerHandler_=pv(s(r)):null!==t?this.pointerHandler_=_v(s([t,n[1]]),s([t,n[3]])):null!==e&&(this.pointerHandler_=_v(s([n[0],e]),s([n[2],e])))}else{r=i.getCoordinateFromPixelInternal(e);let s=!1;this.drag_&&$t(n,r)&&(this.pointerHandler_=function(t,e){return function(i){const n=i[0]-e[0],r=i[1]-e[1];return[t[0]+n,t[1]+r,t[2]+n,t[3]+r]}}(n,r),s=!0),!s&&this.createCondition_(t)&&(this.setExtent([r[0],r[1],r[0],r[1]]),this.pointerHandler_=pv(r))}return!!this.pointerHandler_}handleDragEvent(t){if(this.pointerHandler_){const e=t.coordinate;this.setExtent(this.pointerHandler_(e)),this.updatePointerFeature_(e,!1)}}handleUpEvent(t){this.pointerHandler_=null;const e=this.getExtentInternal();return e&&0!==he(e)||this.setExtent(null),!1}setMap(t){this.extentOverlay_.setMap(t),this.vertexOverlay_.setMap(t),super.setMap(t)}getExtent(){return Bn(this.getExtentInternal(),this.getMap().getView().getProjection())}getExtentInternal(){return this.extent_}setExtent(t){this.extent_=t||null,this.createOrUpdateExtentFeature_(t),this.dispatchEvent(new dv(this.extent_))}},bP.interaction.Extent.ExtentEvent=dv,bP.interaction.Interaction=Ho,bP.interaction.Interaction.pan=Ko,bP.interaction.Interaction.zoomByDelta=qo,bP.interaction.KeyboardPan=Fa,bP.interaction.KeyboardZoom=La,bP.interaction.Link=class extends Ho{constructor(t){let e;super(),e=!0===(t=Object.assign({animate:!0,params:["x","y","z","r","l"],replace:!1,prefix:""},t||{})).animate?{duration:250}:t.animate?t.animate:null,this.animationOptions_=e,this.params_=t.params.reduce(((t,e)=>(t[e]=!0,t)),{}),this.replace_=t.replace,this.prefix_=t.prefix,this.listenerKeys_=[],this.initial_=!0,this.updateState_=this.updateState_.bind(this),this.trackedCallbacks_={},this.trackedValues_={}}getParamName_(t){return this.prefix_?this.prefix_+t:t}get_(t,e){return t.get(this.getParamName_(e))}set_(t,e,i){e in this.params_&&t.set(this.getParamName_(e),i)}delete_(t,e){e in this.params_&&t.delete(this.getParamName_(e))}setMap(t){const e=this.getMap();super.setMap(t),t!==e&&(e&&this.unregisterListeners_(e),t&&(this.initial_=!0,this.updateState_(),this.registerListeners_(t)))}registerListeners_(t){this.listenerKeys_.push(D(t,Qs,this.updateUrl_,this),D(t.getLayerGroup(),n,this.updateUrl_,this),D(t,"change:layergroup",this.handleChangeLayerGroup_,this)),this.replace_||addEventListener("popstate",this.updateState_)}unregisterListeners_(t){for(let t=0,e=this.listenerKeys_.length;t<e;++t)k(this.listenerKeys_[t]);this.listenerKeys_.length=0,this.replace_||removeEventListener("popstate",this.updateState_);const e=new URL(window.location.href),i=e.searchParams;this.delete_(i,"x"),this.delete_(i,"y"),this.delete_(i,"z"),this.delete_(i,"r"),this.delete_(i,"l"),window.history.replaceState(null,"",e)}handleChangeLayerGroup_(){const t=this.getMap();t&&(this.unregisterListeners_(t),this.registerListeners_(t),this.initial_=!0,this.updateUrl_())}updateState_(){const t=new URL(window.location.href).searchParams;for(const e in this.trackedCallbacks_){const i=t.get(e);e in this.trackedCallbacks_&&i!==this.trackedValues_[e]&&(this.trackedValues_[e]=i,this.trackedCallbacks_[e](i))}const e=this.getMap();if(!e)return;const i=e.getView();if(!i||!i.isDef())return;let n=!1;const r={},s=mv(this.get_(t,"z"));"z"in this.params_&&xv(s,i.getZoom())&&(n=!0,r.zoom=s);const o=mv(this.get_(t,"r"));"r"in this.params_&&xv(o,i.getRotation())&&(n=!0,r.rotation=o);const a=[mv(this.get_(t,"x")),mv(this.get_(t,"y"))];var l,h;("x"in this.params_||"y"in this.params_)&&(l=a,h=i.getCenter(),xv(l[0],h[0])||xv(l[1],h[1]))&&(n=!0,r.center=a),n&&(!this.initial_&&this.animationOptions_?i.animate(Object.assign(r,this.animationOptions_)):(r.center&&i.setCenter(r.center),"zoom"in r&&i.setZoom(r.zoom),"rotation"in r&&i.setRotation(r.rotation)));const c=e.getAllLayers(),u=this.get_(t,"l");if("l"in this.params_&&u&&u.length===c.length)for(let t=0,e=c.length;t<e;++t){const e=parseInt(u[t]);if(!isNaN(e)){const i=Boolean(e),n=c[t];n.getVisible()!==i&&n.setVisible(i)}}}track(t,e){this.trackedCallbacks_[t]=e;const i=new URL(window.location.href).searchParams.get(t);return this.trackedValues_[t]=i,i}update(t,e){const i=new URL(window.location.href),n=i.searchParams;null===e?n.delete(t):n.set(t,e),t in this.trackedValues_&&(this.trackedValues_[t]=e),this.updateHistory_(i)}updateUrl_(){const t=this.getMap();if(!t)return;const e=t.getView();if(!e||!e.isDef())return;const i=e.getCenter(),n=e.getZoom(),r=e.getRotation(),s=t.getAllLayers(),o=new Array(s.length);for(let t=0,e=s.length;t<e;++t)o[t]=s[t].getVisible()?"1":"0";const a=new URL(window.location.href),l=a.searchParams;this.set_(l,"x",yv(i[0])),this.set_(l,"y",yv(i[1])),this.set_(l,"z",yv(n)),this.set_(l,"r",yv(r)),this.set_(l,"l",o.join("")),this.updateHistory_(a),this.initial_=!1}updateHistory_(t){t.href!==window.location.href&&(this.initial_||this.replace_?window.history.replaceState(history.state,"",t):window.history.pushState(null,"",t))}},bP.interaction.Modify=class extends fa{constructor(r){if(super(r),this.handleSourceAdd_=this.handleSourceAdd_.bind(this),this.handleSourceRemove_=this.handleSourceRemove_.bind(this),this.handleExternalCollectionAdd_=this.handleExternalCollectionAdd_.bind(this),this.handleExternalCollectionRemove_=this.handleExternalCollectionRemove_.bind(this),this.handleFeatureChange_=this.handleFeatureChange_.bind(this),this.on,this.once,this.un,this.condition_=r.condition?r.condition:ga,this.defaultDeleteCondition_=function(t){return ta(t)&&aa(t)},this.deleteCondition_=r.deleteCondition?r.deleteCondition:this.defaultDeleteCondition_,this.insertVertexCondition_=r.insertVertexCondition?r.insertVertexCondition:ra,this.vertexFeature_=null,this.vertexSegments_=null,this.lastCoordinate_=[0,0],this.ignoreNextSingleClick_=!1,this.featuresBeingModified_=null,this.rBush_=new zd,this.pixelTolerance_=void 0!==r.pixelTolerance?r.pixelTolerance:10,this.snappedToVertex_=!1,this.changingFeature_=!1,this.dragSegments_=[],this.overlay_=new Gx({source:new qd({useSpatialIndex:!1,wrapX:!!r.wrapX}),style:r.style?r.style:Iv(),updateWhileAnimating:!0,updateWhileInteracting:!0}),this.SEGMENT_WRITERS_={Point:this.writePointGeometry_.bind(this),LineString:this.writeLineStringGeometry_.bind(this),LinearRing:this.writeLineStringGeometry_.bind(this),Polygon:this.writePolygonGeometry_.bind(this),MultiPoint:this.writeMultiPointGeometry_.bind(this),MultiLineString:this.writeMultiLineStringGeometry_.bind(this),MultiPolygon:this.writeMultiPolygonGeometry_.bind(this),Circle:this.writeCircleGeometry_.bind(this),GeometryCollection:this.writeGeometryCollectionGeometry_.bind(this)},this.source_=null,this.traceSource_=r.traceSource||r.source||null,this.traceCondition_,this.setTrace(r.trace||!1),this.traceState_={active:!1},this.traceSegments_=null,this.hitDetection_=null,this.filterFunctionWasSupplied_=null!=r.filter,this.filter_=r.filter?r.filter:()=>!0,!r.features&&!r.source)throw new Error("The modify interaction requires features collection or a source");let s;r.features?(s=r.features.getArray(),r.features.addEventListener(t,this.handleExternalCollectionAdd_),r.features.addEventListener(e,this.handleExternalCollectionRemove_),this.featuresCollection_=r.features):r.source&&(s=r.source.getFeatures(),r.source.addEventListener(Xd,this.handleSourceAdd_),r.source.addEventListener(Wd,this.handleSourceRemove_),this.source_=r.source),s.forEach((t=>{t.addEventListener(n,this.handleFeatureChange_),this.filterFunctionWasSupplied_&&t.addEventListener(i,this.handleFeatureChange_)})),r.hitDetection&&(this.hitDetection_=r.hitDetection),this.features_=[],s.filter(this.filter_).forEach((t=>this.addFeature_(t))),this.lastPointerEvent_=null,this.delta_=[0,0],this.snapToPointer_=void 0===r.snapToPointer?!this.hitDetection_:r.snapToPointer}setTrace(t){let e;e=t?!0===t?ra:t:oa,this.traceCondition_=e}addFeature_(t){this.features_.push(t);const e=t.getGeometry();if(e){const i=this.SEGMENT_WRITERS_[e.getType()];i&&i(t,e)}const i=this.getMap();i&&i.isRendered()&&this.getActive()&&this.handlePointerAtPixel_(this.lastCoordinate_)}willModifyFeatures_(t,e){if(!this.featuresBeingModified_){this.featuresBeingModified_=new Z;const i=this.featuresBeingModified_.getArray();for(let t=0,n=e.length;t<n;++t){const n=e[t].feature;n&&!i.includes(n)&&this.featuresBeingModified_.push(n)}0===this.featuresBeingModified_.getLength()?this.featuresBeingModified_=null:this.dispatchEvent(new Cv(Ev,this.featuresBeingModified_,t))}}removeFeature_(t){const e=this.features_.indexOf(t);this.features_.splice(e,1),this.removeFeatureSegmentData_(t),this.vertexFeature_&&0===this.features_.length&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null)}removeFeatureSegmentData_(t){const e=this.rBush_,i=[];e.forEach((function(e){t===e.feature&&i.push(e)}));for(let t=i.length-1;t>=0;--t){const n=i[t];for(let t=this.dragSegments_.length-1;t>=0;--t)this.dragSegments_[t][0]===n&&this.dragSegments_.splice(t,1);e.remove(n)}}setActive(t){this.vertexFeature_&&!t&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),super.setActive(t)}setMap(t){this.overlay_.setMap(t),super.setMap(t)}getOverlay(){return this.overlay_}handleSourceAdd_(t){const e=t.feature;e&&this.externalAddFeatureHandler_(e)}handleSourceRemove_(t){const e=t.feature;e&&this.externalRemoveFeatureHandler_(e)}handleExternalCollectionAdd_(t){const e=t.element;e&&this.externalAddFeatureHandler_(e)}handleExternalCollectionRemove_(t){const e=t.element;e&&this.externalRemoveFeatureHandler_(e)}externalAddFeatureHandler_(t){t.addEventListener(n,this.handleFeatureChange_),this.filterFunctionWasSupplied_&&t.addEventListener(i,this.handleFeatureChange_),this.filter_(t)&&this.addFeature_(t)}externalRemoveFeatureHandler_(t){t.removeEventListener(n,this.handleFeatureChange_),this.filterFunctionWasSupplied_&&t.removeEventListener(i,this.handleFeatureChange_),this.removeFeature_(t)}handleFeatureChange_(t){if(!this.changingFeature_){const e=t.target;this.removeFeature_(e),this.filter_(e)&&this.addFeature_(e)}}writePointGeometry_(t,e){const i=e.getCoordinates(),n={feature:t,geometry:e,segment:[i,i]};this.rBush_.insert(e.getExtent(),n)}writeMultiPointGeometry_(t,e){const i=e.getCoordinates();for(let n=0,r=i.length;n<r;++n){const r=i[n],s={feature:t,geometry:e,depth:[n],index:n,segment:[r,r]};this.rBush_.insert(e.getExtent(),s)}}writeLineStringGeometry_(t,e){const i=e.getCoordinates();for(let n=0,r=i.length-1;n<r;++n){const r=i.slice(n,n+2),s={feature:t,geometry:e,index:n,segment:r};this.rBush_.insert(Bt(r),s)}}writeMultiLineStringGeometry_(t,e){const i=e.getCoordinates();for(let n=0,r=i.length;n<r;++n){const r=i[n];for(let i=0,s=r.length-1;i<s;++i){const s=r.slice(i,i+2),o={feature:t,geometry:e,depth:[n],index:i,segment:s};this.rBush_.insert(Bt(s),o)}}}writePolygonGeometry_(t,e){const i=e.getCoordinates();for(let n=0,r=i.length;n<r;++n){const r=i[n];for(let i=0,s=r.length-1;i<s;++i){const s=r.slice(i,i+2),o={feature:t,geometry:e,depth:[n],index:i,segment:s};this.rBush_.insert(Bt(s),o)}}}writeMultiPolygonGeometry_(t,e){const i=e.getCoordinates();for(let n=0,r=i.length;n<r;++n){const r=i[n];for(let i=0,s=r.length;i<s;++i){const s=r[i];for(let r=0,o=s.length-1;r<o;++r){const o=s.slice(r,r+2),a={feature:t,geometry:e,depth:[i,n],index:r,segment:o};this.rBush_.insert(Bt(o),a)}}}}writeCircleGeometry_(t,e){const i=e.getCenter(),n={feature:t,geometry:e,index:0,segment:[i,i]},r={feature:t,geometry:e,index:1,segment:[i,i]},s=[n,r];n.featureSegments=s,r.featureSegments=s,this.rBush_.insert(Jt(i),n);let o=e;const a=Gn();if(a&&this.getMap()){const t=this.getMap().getView().getProjection();o=o.clone().transform(a,t),o=_s(o).transform(t,a)}this.rBush_.insert(o.getExtent(),r)}writeGeometryCollectionGeometry_(t,e){const i=e.getGeometriesArray();for(let e=0;e<i.length;++e){const n=i[e];(0,this.SEGMENT_WRITERS_[n.getType()])(t,n)}}createOrUpdateVertexFeature_(t,e,i,n){let r=this.vertexFeature_;if(r){r.getGeometry().setCoordinates(t)}else r=new At(new Wr(t)),this.vertexFeature_=r,this.overlay_.getSource().addFeature(r);return r.set("features",e),r.set("geometries",i),r.set("existing",n),r}handleEvent(t){if(!t.originalEvent)return!0;let e;return this.lastPointerEvent_=t,t.map.getView().getInteracting()||t.type!=$s.POINTERMOVE||this.handlingDownUpSequence||this.handlePointerMove_(t),this.vertexFeature_&&this.deleteCondition_(t)&&(e=!(t.type!=$s.SINGLECLICK||!this.ignoreNextSingleClick_)||this.removePoint()),t.type==$s.SINGLECLICK&&(this.ignoreNextSingleClick_=!1),super.handleEvent(t)&&!e}findInsertVerticesAndUpdateDragSegments_(t){this.handlePointerAtPixel_(t),this.dragSegments_.length=0,this.featuresBeingModified_=null;if(!this.vertexFeature_)return;const e=this.getMap().getView().getProjection(),i=[],n=this.vertexFeature_.getGeometry().getCoordinates(),r=Bt([n]),s=this.rBush_.getInExtent(r),o={};s.sort(bv);for(let r=0,a=s.length;r<a;++r){const a=s[r],l=a.segment;let h=z(a.geometry);const c=a.depth;if(c&&(h+="-"+c.join("-")),o[h]||(o[h]=new Array(2)),"Circle"!==a.geometry.getType()||1!==a.index)if(!ri(l[0],n)||o[h][0])if(!ri(l[1],n)||o[h][1])!(z(l)in this.vertexSegments_)||o[h][0]||o[h][1]||i.push(a);else{if(o[h][0]&&0===o[h][0].index){let t=a.geometry.getCoordinates();switch(a.geometry.getType()){case"LineString":case"MultiLineString":continue;case"MultiPolygon":t=t[c[1]];case"Polygon":if(a.index!==t[c[0]].length-2)continue}}this.dragSegments_.push([a,1]),o[h][1]=a}else this.dragSegments_.push([a,0]),o[h][0]=a;else{ri(Pv(t,a,e),n)&&!o[h][0]&&(this.dragSegments_.push([a,0]),o[h][0]=a)}}return i}deactivateTrace_(){this.traceState_={active:!1}}updateTrace_(t){const e=this.traceState_;if(!e.active)return;if(-1===e.targetIndex){if(li(t.map.getPixelFromCoordinate(e.startCoord),t.pixel)<this.pixelTolerance_)return}const i=Jx(t.coordinate,e,t.map,this.pixelTolerance_);if(-1===e.targetIndex&&Math.sqrt(i.closestTargetDistance)/t.map.getView().getResolution()>this.pixelTolerance_)return;if(e.targetIndex!==i.index){if(-1!==e.targetIndex){const t=e.targets[e.targetIndex];this.removeTracedCoordinates_(t.startIndex,t.endIndex)}else for(const t of this.traceSegments_){const e=t[0],i=e.geometry,n=t[1],r=i.getCoordinates();Tv(r,i.getType(),e.depth).splice(e.index+n,1),i.setCoordinates(r),0===n&&(e.index-=1)}const t=e.targets[i.index];this.addTracedCoordinates_(t,t.startIndex,i.endIndex)}else{const t=e.targets[e.targetIndex];this.addOrRemoveTracedCoordinates_(t,i.endIndex)}e.targetIndex=i.index;e.targets[e.targetIndex].endIndex=i.endIndex}getTraceCandidates_(t){const e=this.getMap(),i=this.pixelTolerance_,n=Bt([e.getCoordinateFromPixel([t.pixel[0]-i,t.pixel[1]+i]),e.getCoordinateFromPixel([t.pixel[0]+i,t.pixel[1]-i])]);return this.traceSource_.getFeaturesInExtent(n)}toggleTraceState_(t){if(!this.traceSource_||!this.traceCondition_(t))return;if(this.traceState_.active)return this.deactivateTrace_(),void(this.traceSegments_=null);const e=this.getTraceCandidates_(t);if(0===e.length)return;const i=Qx(t.coordinate,e);i.length&&(this.traceState_={active:!0,startCoord:t.coordinate.slice(),targets:i,targetIndex:-1})}addOrRemoveTracedCoordinates_(t,e){const i=t.startIndex<=t.endIndex;i===t.startIndex<=e?i&&e>t.endIndex||!i&&e<t.endIndex?this.addTracedCoordinates_(t,t.endIndex,e):(i&&e<t.endIndex||!i&&e>t.endIndex)&&this.removeTracedCoordinates_(e,t.endIndex):(this.removeTracedCoordinates_(t.startIndex,t.endIndex),this.addTracedCoordinates_(t,t.startIndex,e))}removeTracedCoordinates_(t,e){if(t===e)return;let i=0;if(t<e){const n=Math.ceil(t);let r=Math.floor(e);r===e&&(r-=1),i=r-n+1}else{const n=Math.floor(t);let r=Math.ceil(e);r===e&&(r+=1),i=n-r+1}if(i>0)for(const t of this.traceSegments_){const e=t[0],n=e.geometry,r=t[1];let s=t[0].index+1;1===r&&(s-=i);const o=n.getCoordinates();Tv(o,n.getType(),e.depth).splice(s,i),n.setCoordinates(o),1===r&&(e.index-=i)}}addTracedCoordinates_(t,e,i){if(e===i)return;const n=[];if(e<i){const r=Math.ceil(e);let s=Math.floor(i);s===i&&(s-=1);for(let e=r;e<=s;++e)n.push(Hx(t.coordinates,e))}else{const r=Math.floor(e);let s=Math.ceil(i);s===i&&(s+=1);for(let e=r;e>=s;--e)n.push(Hx(t.coordinates,e))}if(n.length)for(const t of this.traceSegments_){const e=t[0],i=e.geometry,r=t[1],s=e.index+1;0===r&&n.reverse();const o=i.getCoordinates();Tv(o,i.getType(),e.depth).splice(s,0,...n),i.setCoordinates(o),1===r&&(e.index+=n.length)}}updateGeometry_(t,e){const i=e[0],n=i.depth;let r;const s=i.segment,o=i.geometry,a=e[1];for(;t.length<o.getStride();)t.push(s[a][t.length]);switch(o.getType()){case"Point":r=t,s[0]=t,s[1]=t;break;case"MultiPoint":r=o.getCoordinates(),r[i.index]=t,s[0]=t,s[1]=t;break;case"LineString":r=o.getCoordinates(),r[i.index+a]=t,s[a]=t;break;case"MultiLineString":r=o.getCoordinates(),r[n[0]][i.index+a]=t,s[a]=t;break;case"Polygon":{r=o.getCoordinates();const e=r[n[0]],l=i.index+a;e[l][0]===t[0]&&e[l][1]===t[1]?r=null:(e[l]=t,0===l?e[e.length-1]=t:l===e.length-1&&(e[0]=t)),s[a]=t;break}case"MultiPolygon":{r=o.getCoordinates();const e=r[n[1]][n[0]],l=i.index+a;e[l][0]===t[0]&&e[l][1]===t[1]?r=null:(e[l]=t,0===l?e[e.length-1]=t:l===e.length-1&&(e[0]=t)),s[a]=t;break}case"Circle":const e=o;if(s[0]=t,s[1]=t,0===i.index)this.changingFeature_=!0,e.setCenter(t),this.changingFeature_=!1;else{this.changingFeature_=!0;const i=this.getMap().getView().getProjection();let n=li(Un(e.getCenter(),i),Un(t,i));const r=Gn();if(r){const t=e.clone().transform(r,i);t.setRadius(n),n=t.transform(i,r).getRadius()}e.setRadius(n),this.changingFeature_=!1}}r&&this.setGeometryCoordinates_(o,r)}handleDragEvent(t){this.ignoreNextSingleClick_=!1,this.willModifyFeatures_(t,this.dragSegments_.map((([t])=>t)));const e=[t.coordinate[0]+this.delta_[0],t.coordinate[1]+this.delta_[1]],i=[],n=[],r=this.traceState_.active&&!this.traceSegments_?this.traceState_.startCoord:null;if(r){this.traceSegments_=[];for(const e of this.dragSegments_){li(ei(r,e[0].segment),r)/t.map.getView().getResolution()<1&&this.traceSegments_.push(e)}}for(let t=0,r=this.dragSegments_.length;t<r;++t){const r=this.dragSegments_[t],s=r[0],o=s.feature;i.includes(o)||i.push(o);const a=s.geometry;n.includes(a)||n.push(a),this.updateGeometry_(e,r)}this.updateTrace_(t),this.createOrUpdateVertexFeature_(e,i,n,!0)}handleDownEvent(t){if(!this.condition_(t))return!1;const e=t.coordinate,i=this.findInsertVerticesAndUpdateDragSegments_(e);if(i?.length&&this.insertVertexCondition_(t)&&(this.willModifyFeatures_(t,i),this.vertexFeature_)){const t=this.vertexFeature_.getGeometry().getCoordinates();for(let e=i.length-1;e>=0;--e)this.insertVertex_(i[e],t);this.ignoreNextSingleClick_=!0}return!!this.vertexFeature_}handleUpEvent(t){for(let e=this.dragSegments_.length-1;e>=0;--e){const i=this.dragSegments_[e][0],n=i.geometry;if("Circle"===n.getType()){const e=n,r=e.getCenter(),s=i.featureSegments[0],o=i.featureSegments[1];s.segment[0]=r,s.segment[1]=r,o.segment[0]=r,o.segment[1]=r,this.rBush_.update(Jt(r),s);let a=e;const l=Gn();if(l){const e=t.map.getView().getProjection();a=a.clone().transform(l,e),a=_s(a).transform(e,l)}this.rBush_.update(a.getExtent(),o)}else this.rBush_.update(Bt(i.segment),i)}return this.featuresBeingModified_&&(this.toggleTraceState_(t),this.dispatchEvent(new Cv(wv,this.featuresBeingModified_,t)),this.featuresBeingModified_=null),!1}handlePointerMove_(t){this.lastCoordinate_=t.coordinate,this.handlePointerAtPixel_(this.lastCoordinate_)}handlePointerAtPixel_(t){const e=this.getMap(),i=e.getPixelFromCoordinate(t),n=e.getView().getProjection(),r=function(e,i){return Rv(t,e,n)-Rv(t,i,n)};let s,o;if(this.hitDetection_){const t="object"==typeof this.hitDetection_?t=>t===this.hitDetection_:void 0;e.forEachFeatureAtPixel(i,((t,e,i)=>{i&&"Point"===i.getType()&&(i=new Wr(jn(i.getCoordinates(),n)));const r=i||t.getGeometry();if(r&&"Point"===r.getType()&&t instanceof At&&this.features_.includes(t)){o=r;const e=t.getGeometry().getFlatCoordinates().slice(0,2);s=[{feature:t,geometry:o,segment:[e,e]}]}return!0}),{layerFilter:t})}if(!s){const i=Bn(zt(zn(Jt(t,vv),n),e.getView().getResolution()*this.pixelTolerance_,vv),n);s=this.rBush_.getInExtent(i)}if(s&&s.length>0){const a=s.sort(r)[0],l=a.segment;let h=Pv(t,a,n);const c=e.getPixelFromCoordinate(h);let u=li(i,c);if(o||u<=this.pixelTolerance_){const i={};if(i[z(l)]=!0,this.snapToPointer_||(this.delta_[0]=h[0]-t[0],this.delta_[1]=h[1]-t[1]),"Circle"===a.geometry.getType()&&1===a.index)this.snappedToVertex_=!0,this.createOrUpdateVertexFeature_(h,[a.feature],[a.geometry],this.snappedToVertex_);else{const t=e.getPixelFromCoordinate(l[0]),n=e.getPixelFromCoordinate(l[1]),r=ai(c,t),o=ai(c,n);if(u=Math.sqrt(Math.min(r,o)),this.snappedToVertex_=u<=this.pixelTolerance_,!this.snappedToVertex_&&!this.insertVertexCondition_(this.lastPointerEvent_))return void(this.vertexFeature_&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null));this.snappedToVertex_&&(h=r>o?l[1]:l[0]),this.createOrUpdateVertexFeature_(h,[a.feature],[a.geometry],this.snappedToVertex_);const d={};d[z(a.geometry)]=!0;for(let t=1,e=s.length;t<e;++t){const e=s[t].segment;if(!(ri(l[0],e[0])&&ri(l[1],e[1])||ri(l[0],e[1])&&ri(l[1],e[0])))break;{const n=z(s[t].geometry);n in d||(d[n]=!0,i[z(e)]=!0)}}}return void(this.vertexSegments_=i)}}this.vertexFeature_&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null)}insertVertex_(t,e){const i=t.segment,n=t.feature,r=t.geometry,s=t.depth,o=t.index;let a;for(;e.length<r.getStride();)e.push(0);switch(r.getType()){case"MultiLineString":case"Polygon":a=r.getCoordinates(),a[s[0]].splice(o+1,0,e);break;case"MultiPolygon":a=r.getCoordinates(),a[s[1]][s[0]].splice(o+1,0,e);break;case"LineString":a=r.getCoordinates(),a.splice(o+1,0,e);break;default:return!1}this.setGeometryCoordinates_(r,a);const l=this.rBush_;l.remove(t),this.updateSegmentIndices_(r,o,s,1);const h={segment:[i[0],e],feature:n,geometry:r,depth:s,index:o};l.insert(Bt(h.segment),h),this.dragSegments_.push([h,1]);const c={segment:[e,i[1]],feature:n,geometry:r,depth:s,index:o+1};return l.insert(Bt(c.segment),c),this.dragSegments_.push([c,0]),!0}updatePointer_(t){return t&&this.findInsertVerticesAndUpdateDragSegments_(t),this.vertexFeature_?.getGeometry().getCoordinates()}getPoint(){const t=this.vertexFeature_?.getGeometry().getCoordinates();return t?jn(t,this.getMap().getView().getProjection()):null}canRemovePoint(){if(!this.vertexFeature_)return!1;if(this.vertexFeature_.get("geometries").every((t=>"Circle"===t.getType()||t.getType().endsWith("Point"))))return!1;const t=this.vertexFeature_.getGeometry().getCoordinates();return this.rBush_.getInExtent(Bt([t])).some((({segment:e})=>ri(e[0],t)||ri(e[1],t)))}removePoint(t){if(t&&(t=Un(t,this.getMap().getView().getProjection()),this.updatePointer_(t)),!this.lastPointerEvent_||this.lastPointerEvent_&&this.lastPointerEvent_.type!=$s.POINTERDRAG){const t=this.lastPointerEvent_;this.willModifyFeatures_(t,this.dragSegments_.map((([t])=>t)));const e=this.removeVertex_();return this.featuresBeingModified_&&this.dispatchEvent(new Cv(wv,this.featuresBeingModified_,t)),this.featuresBeingModified_=null,e}return!1}removeVertex_(){const t=this.dragSegments_,e={};let i,n,r,s,o,a,l,h,c,u,d,g=!1;for(o=t.length-1;o>=0;--o)r=t[o],u=r[0],d=z(u.feature),u.depth&&(d+="-"+u.depth.join("-")),d in e||(e[d]={}),0===r[1]?(e[d].right=u,e[d].index=u.index):1==r[1]&&(e[d].left=u,e[d].index=u.index+1);for(d in e){switch(c=e[d].right,l=e[d].left,a=e[d].index,h=a-1,u=void 0!==l?l:c,h<0&&(h=0),s=u.geometry,n=s.getCoordinates(),i=n,g=!1,s.getType()){case"MultiLineString":n[u.depth[0]].length>2&&(n[u.depth[0]].splice(a,1),g=!0);break;case"LineString":n.length>2&&(n.splice(a,1),g=!0);break;case"MultiPolygon":i=i[u.depth[1]];case"Polygon":i=i[u.depth[0]],i.length>4&&(a==i.length-1&&(a=0),i.splice(a,1),g=!0,0===a&&(i.pop(),i.push(i[0]),h=i.length-1))}if(g){this.setGeometryCoordinates_(s,n);const e=[];if(void 0!==l&&(this.rBush_.remove(l),e.push(l.segment[0])),void 0!==c&&(this.rBush_.remove(c),e.push(c.segment[1])),void 0!==l&&void 0!==c){const t={depth:u.depth,feature:u.feature,geometry:u.geometry,index:h,segment:e};this.rBush_.insert(Bt(t.segment),t)}this.updateSegmentIndices_(s,a,u.depth,-1),this.vertexFeature_&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),t.length=0}}return g}canInsertPoint(){if(!this.vertexFeature_)return!1;if(this.vertexFeature_.get("geometries").every((t=>"Circle"===t.getType()||t.getType().endsWith("Point"))))return!1;const t=this.vertexFeature_.getGeometry().getCoordinates();return this.rBush_.getInExtent(Bt([t])).some((({segment:e})=>!(ri(e[0],t)||ri(e[1],t))))}insertPoint(t){const e=t?Un(t,this.getMap().getView().getProjection()):this.vertexFeature_?.getGeometry().getCoordinates();if(!e)return!1;return this.findInsertVerticesAndUpdateDragSegments_(e).reduce(((t,i)=>t||this.insertVertex_(i,e)),!1)}setGeometryCoordinates_(t,e){this.changingFeature_=!0,t.setCoordinates(e),this.changingFeature_=!1}updateSegmentIndices_(t,e,i,n){this.rBush_.forEachInExtent(t.getExtent(),(function(r){r.geometry===t&&(void 0===i||void 0===r.depth||w(r.depth,i))&&r.index>e&&(r.index+=n)}))}disposeInternal(){if(super.disposeInternal(),this.featuresCollection_){this.featuresCollection_.removeEventListener(t,this.handleExternalCollectionAdd_),this.featuresCollection_.removeEventListener(e,this.handleExternalCollectionRemove_);for(const t of this.featuresCollection_.getArray())t.removeEventListener(n,this.handleFeatureChange_),this.filterFunctionWasSupplied_&&t.removeEventListener(i,this.handleFeatureChange_)}else if(this.source_){this.source_.removeEventListener(Xd,this.handleSourceAdd_),this.source_.removeEventListener(Wd,this.handleSourceRemove_);for(const t of this.source_.getFeatures())t.removeEventListener(n,this.handleFeatureChange_),this.filterFunctionWasSupplied_&&t.removeEventListener(i,this.handleFeatureChange_)}}},bP.interaction.Modify.ModifyEvent=Cv,bP.interaction.MouseWheelZoom=Ma,bP.interaction.PinchRotate=Aa,bP.interaction.PinchZoom=Oa,bP.interaction.Pointer=fa,bP.interaction.Pointer.centroid=pa,bP.interaction.Select=Av,bP.interaction.Select.SelectEvent=Lv,bP.interaction.Snap=class extends fa{constructor(t){t=t||{},super({handleDownEvent:C,stopDown:b}),this.on,this.once,this.un,this.source_=t.source?t.source:null,this.vertex_=void 0===t.vertex||t.vertex,this.edge_=void 0===t.edge||t.edge,this.intersection_=void 0!==t.intersection&&t.intersection,this.features_=t.features?t.features:null,this.featuresListenerKeys_=[],this.featureChangeListenerKeys_={},this.indexedFeaturesExtents_={},this.pendingFeatures_={},this.pixelTolerance_=void 0!==t.pixelTolerance?t.pixelTolerance:10,this.rBush_=new zd,this.snapped_=null,this.segmenters_=Object.assign({},kv,t.segmenters)}addFeature(t,e){e=void 0===e||e;const i=z(t),r=t.getGeometry();if(r){const e=this.segmenters_[r.getType()];if(e){this.indexedFeaturesExtents_[i]=r.getExtent([1/0,1/0,-1/0,-1/0]);const n=e.call(this.segmenters_,r,this.getMap().getView().getProjection());let s=n.length;for(let e=0;e<s;++e){const i=n[e];Uv[e]=Bt(i),Bv[e]={feature:t,segment:i}}if(this.intersection_)for(let e=0,i=n.length;e<i;++e){const i=n[e];if(1===i.length)continue;const r=Uv[e];for(let o=0,a=e-1;o<a;++o){const e=n[o];if(!Se(r,Uv[o]))continue;const a=ts(i,e);if(!a)continue;const l=[a];Uv[s]=Bt(l),Bv[s++]={feature:t,intersectionFeature:t,segment:l}}const o=this.rBush_.getInExtent(Uv[e]);for(let e=0,n=o.length;e<n;++e){const n=o[e].segment;if(1===n.length)continue;const r=ts(i,n);if(!r)continue;const a=[r];Uv[s]=Bt(a),Bv[s++]={feature:t,intersectionFeature:o[e].feature,segment:a}}}1===s?this.rBush_.insert(Uv[0],Bv[0]):(Uv.length=s,Bv.length=s,this.rBush_.load(Uv,Bv))}}e&&(this.featureChangeListenerKeys_[i]&&k(this.featureChangeListenerKeys_[i]),this.featureChangeListenerKeys_[i]=D(t,n,this.handleFeatureChange_,this))}getFeatures_(){let t;return this.features_?t=this.features_:this.source_&&(t=this.source_.getFeatures()),t}areSnapDataEqual_(t,e){return t.segment===e.segment&&t.feature===e.feature}handleEvent(t){const e=this.snapTo(t.pixel,t.coordinate,t.map);return e?(t.coordinate=e.vertex.slice(0,2),t.pixel=e.vertexPixel,this.snapped_&&!this.areSnapDataEqual_(this.snapped_,e)&&this.dispatchEvent(new Nv(Dv,this.snapped_)),this.snapped_={vertex:t.coordinate,vertexPixel:t.pixel,feature:e.feature,segment:e.segment},this.dispatchEvent(new Nv(Ov,this.snapped_))):this.snapped_&&(this.dispatchEvent(new Nv(Dv,this.snapped_)),this.snapped_=null),super.handleEvent(t)}handleFeatureAdd_(t){const e=Gv(t);e&&this.addFeature(e)}handleFeatureRemove_(t){const e=Gv(t);e&&(this.removeFeature(e),delete this.pendingFeatures_[z(e)])}handleFeatureChange_(t){const e=t.target;this.handlingDownUpSequence?this.pendingFeatures_[z(e)]=e:this.updateFeature_(e)}handleUpEvent(t){const e=Object.values(this.pendingFeatures_);if(e.length){for(const t of e)this.updateFeature_(t);F(this.pendingFeatures_)}return!1}removeFeature(t,e){const i=void 0===e||e,n=z(t),r=this.indexedFeaturesExtents_[n];if(r){const e=this.rBush_;e.getInExtent(r).forEach((i=>{t!==i.feature&&t!==i.intersectionFeature||e.remove(i)}))}i&&(k(this.featureChangeListenerKeys_[n]),delete this.featureChangeListenerKeys_[n])}setMap(i){const n=this.getMap(),r=this.featuresListenerKeys_;let s=this.getFeatures_();if(Array.isArray(s)||(s=s.getArray()),n&&(r.forEach(k),r.length=0,this.rBush_.clear(),Object.values(this.featureChangeListenerKeys_).forEach(k),this.featureChangeListenerKeys_={}),super.setMap(i),i){this.features_?r.push(D(this.features_,t,this.handleFeatureAdd_,this),D(this.features_,e,this.handleFeatureRemove_,this)):this.source_&&r.push(D(this.source_,Xd,this.handleFeatureAdd_,this),D(this.source_,Wd,this.handleFeatureRemove_,this));for(const t of s)this.addFeature(t)}}snapTo(t,e,i){const n=i.getView().getProjection(),r=Un(e,n),s=Bn(zt(Bt([r]),i.getView().getResolution()*this.pixelTolerance_),n),o=this.rBush_.getInExtent(s),a=o.length;if(0===a)return null;let l,h,c=1/0,u=null;const d=this.pixelTolerance_*this.pixelTolerance_,g=()=>{if(!l)return null;const e=i.getPixelFromCoordinate(l);return ai(t,e)>d?null:{vertex:l,vertexPixel:[Math.round(e[0]),Math.round(e[1])],feature:h,segment:u}};if(this.vertex_||this.intersection_){for(let t=0;t<a;++t){const e=o[t];if("Circle"!==e.feature.getGeometry().getType())for(const t of e.segment){const i=ai(r,Un(t,n));i<c&&(this.intersection_&&e.intersectionFeature||this.vertex_&&!e.intersectionFeature)&&(l=t,c=i,h=e.feature)}}const t=g();if(t)return t}if(this.edge_){for(let t=0;t<a;++t){let e=null;const i=o[t];if("Circle"===i.feature.getGeometry().getType()){let t=i.feature.getGeometry();const s=Gn();s&&(t=t.clone().transform(s,n)),e=ti(r,t)}else{const[t,s]=i.segment;s&&(jv[0]=Un(t,n),jv[1]=Un(s,n),e=ei(r,jv))}if(e){const t=ai(r,e);t<c&&(l=jn(e,n),u="Circle"===i.feature.getGeometry().getType()?null:i.segment,c=t,h=i.feature)}}const t=g();if(t)return t}return null}updateFeature_(t){this.removeFeature(t,!1),this.addFeature(t,!1)}},bP.interaction.Translate=class extends fa{constructor(t){let e;if(super(t=t||{}),this.on,this.once,this.un,this.lastCoordinate_=null,this.startCoordinate_=null,this.features_=void 0!==t.features?t.features:null,t.layers&&!this.features_)if("function"==typeof t.layers)e=t.layers;else{const i=t.layers;e=function(t){return i.includes(t)}}else e=C;this.layerFilter_=e,this.filter_=t.filter&&!this.features_?t.filter:C,this.hitTolerance_=t.hitTolerance?t.hitTolerance:0,this.condition_=t.condition?t.condition:ra,this.lastFeature_=null,this.addChangeListener(Yo,this.handleActiveChanged_)}handleDownEvent(t){if(!t.originalEvent||!this.condition_(t))return!1;if(this.lastFeature_=this.featuresAtPixel_(t.pixel,t.map),!this.lastCoordinate_&&this.lastFeature_){this.startCoordinate_=t.coordinate,this.lastCoordinate_=t.coordinate,this.handleMoveEvent(t);const e=this.features_||new Z([this.lastFeature_]);return this.dispatchEvent(new $v(zv,e,t.coordinate,this.startCoordinate_,t)),!0}return!1}handleUpEvent(t){if(this.lastCoordinate_){this.lastCoordinate_=null,this.handleMoveEvent(t);const e=this.features_||new Z([this.lastFeature_]);return this.dispatchEvent(new $v(Vv,e,t.coordinate,this.startCoordinate_,t)),this.startCoordinate_=null,!0}return!1}handleDragEvent(t){if(this.lastCoordinate_){const e=t.coordinate,i=t.map.getView().getProjection(),n=Un(e,i),r=Un(this.lastCoordinate_,i),s=n[0]-r[0],o=n[1]-r[1],a=this.features_||new Z([this.lastFeature_]),l=Gn();a.forEach((function(t){const e=t.getGeometry();l?(e.transform(l,i),e.translate(s,o),e.transform(i,l)):e.translate(s,o),t.setGeometry(e)})),this.lastCoordinate_=e,this.dispatchEvent(new $v(Xv,a,e,this.startCoordinate_,t))}}handleMoveEvent(t){const e=t.map.getViewport();this.featuresAtPixel_(t.pixel,t.map)?(e.classList.remove(this.lastCoordinate_?"ol-grab":"ol-grabbing"),e.classList.add(this.lastCoordinate_?"ol-grabbing":"ol-grab")):e.classList.remove("ol-grab","ol-grabbing")}featuresAtPixel_(t,e){return e.forEachFeatureAtPixel(t,((t,e)=>{if(t instanceof At&&this.filter_(t,e)&&(!this.features_||this.features_.getArray().includes(t)))return t}),{layerFilter:this.layerFilter_,hitTolerance:this.hitTolerance_})}getHitTolerance(){return this.hitTolerance_}setHitTolerance(t){this.hitTolerance_=t}setMap(t){const e=this.getMap();super.setMap(t),this.updateState_(e)}handleActiveChanged_(){this.updateState_(null)}updateState_(t){let e=this.getMap();const i=this.getActive();if((!e||!i)&&(e=e||t,e)){e.getViewport().classList.remove("ol-grab","ol-grabbing")}}},bP.interaction.Translate.TranslateEvent=$v,bP.interaction.defaults={},bP.interaction.defaults.defaults=Da,bP.layer={},bP.layer.Base=Wa,bP.layer.BaseImage=Rf,bP.layer.BaseTile=Df,bP.layer.BaseVector=zc,bP.layer.Flow=Ox,bP.layer.Graticule=class extends Gx{constructor(t){t=t||{};const e=Object.assign({updateWhileAnimating:!0,updateWhileInteracting:!0,renderBuffer:0},t);delete e.maxLines,delete e.strokeStyle,delete e.targetSize,delete e.showLabels,delete e.lonLabelFormatter,delete e.latLabelFormatter,delete e.lonLabelPosition,delete e.latLabelPosition,delete e.lonLabelStyle,delete e.latLabelStyle,delete e.intervals,super(e),this.projection_=null,this.maxLat_=1/0,this.maxLon_=1/0,this.minLat_=-1/0,this.minLon_=-1/0,this.maxX_=1/0,this.maxY_=1/0,this.minX_=-1/0,this.minY_=-1/0,this.targetSize_=void 0!==t.targetSize?t.targetSize:100,this.maxLines_=void 0!==t.maxLines?t.maxLines:100,this.meridians_=[],this.parallels_=[],this.strokeStyle_=void 0!==t.strokeStyle?t.strokeStyle:jx,this.fromLonLatTransform_=void 0,this.toLonLatTransform_=void 0,this.projectionCenterLonLat_=null,this.bottomLeft_=null,this.bottomRight_=null,this.topLeft_=null,this.topRight_=null,this.meridiansLabels_=null,this.parallelsLabels_=null,t.showLabels&&(this.lonLabelFormatter_=null==t.lonLabelFormatter?ii.bind(this,"EW"):t.lonLabelFormatter,this.latLabelFormatter_=null==t.latLabelFormatter?ii.bind(this,"NS"):t.latLabelFormatter,this.lonLabelPosition_=null==t.lonLabelPosition?0:t.lonLabelPosition,this.latLabelPosition_=null==t.latLabelPosition?1:t.latLabelPosition,this.lonLabelStyleBase_=new hc({text:void 0!==t.lonLabelStyle?t.lonLabelStyle.clone():new pc({font:"12px Calibri,sans-serif",textBaseline:"bottom",fill:new sc({color:"rgba(0,0,0,1)"}),stroke:new lc({color:"rgba(255,255,255,1)",width:3})})}),this.lonLabelStyle_=t=>{const e=t.get("graticule_label");return this.lonLabelStyleBase_.getText().setText(e),this.lonLabelStyleBase_},this.latLabelStyleBase_=new hc({text:void 0!==t.latLabelStyle?t.latLabelStyle.clone():new pc({font:"12px Calibri,sans-serif",textAlign:"right",fill:new sc({color:"rgba(0,0,0,1)"}),stroke:new lc({color:"rgba(255,255,255,1)",width:3})})}),this.latLabelStyle_=t=>{const e=t.get("graticule_label");return this.latLabelStyleBase_.getText().setText(e),this.latLabelStyleBase_},this.meridiansLabels_=[],this.parallelsLabels_=[],this.addEventListener(Qa,this.drawLabels_.bind(this))),this.intervals_=void 0!==t.intervals?t.intervals:Ux,this.setSource(new qd({loader:this.loaderFunction.bind(this),strategy:this.strategyFunction.bind(this),features:new Z,overlaps:!1,useSpatialIndex:!1,wrapX:t.wrapX})),this.featurePool_=[],this.lineStyle_=new hc({stroke:this.strokeStyle_}),this.loadedExtent_=null,this.renderedExtent_=null,this.renderedResolution_=null,this.setRenderOrder(null)}strategyFunction(t,e){let i=t.slice();return this.projection_&&this.getSource().getWrapX()&&Re(i,this.projection_),this.loadedExtent_&&(ee(this.loadedExtent_,i,e)?i=this.loadedExtent_.slice():this.getSource().removeLoadedExtent(this.loadedExtent_)),[i]}loaderFunction(t,e,i){this.loadedExtent_=t;const n=this.getSource(),r=me(this.getExtent()||[-1/0,-1/0,1/0,1/0],t);if(this.renderedExtent_&&te(this.renderedExtent_,r)&&this.renderedResolution_===e)return;if(this.renderedExtent_=r,this.renderedResolution_=e,Ee(r))return;const s=de(r),o=e*e/4;(!this.projection_||!Fn(this.projection_,i))&&this.updateProjectionInfo_(i),this.createGraticule_(r,s,e,o);let a,l=this.meridians_.length+this.parallels_.length;for(this.meridiansLabels_&&(l+=this.meridians_.length),this.parallelsLabels_&&(l+=this.parallels_.length);l>this.featurePool_.length;)a=new At,this.featurePool_.push(a);const h=n.getFeaturesCollection();h.clear();let c,u,d=0;for(c=0,u=this.meridians_.length;c<u;++c)a=this.featurePool_[d++],a.setGeometry(this.meridians_[c]),a.setStyle(this.lineStyle_),h.push(a);for(c=0,u=this.parallels_.length;c<u;++c)a=this.featurePool_[d++],a.setGeometry(this.parallels_[c]),a.setStyle(this.lineStyle_),h.push(a)}addMeridian_(t,e,i,n,r,s){const o=this.getMeridian_(t,e,i,n,s);if(Se(o.getExtent(),r)){if(this.meridiansLabels_){const e=this.lonLabelFormatter_(t);s in this.meridiansLabels_?this.meridiansLabels_[s].text=e:this.meridiansLabels_[s]={geom:new Wr([]),text:e}}this.meridians_[s++]=o}return s}addParallel_(t,e,i,n,r,s){const o=this.getParallel_(t,e,i,n,s);if(Se(o.getExtent(),r)){if(this.parallelsLabels_){const e=this.latLabelFormatter_(t);s in this.parallelsLabels_?this.parallelsLabels_[s].text=e:this.parallelsLabels_[s]={geom:new Wr([]),text:e}}this.parallels_[s++]=o}return s}drawLabels_(t){const e=t.frameState.viewState.rotation,i=t.frameState.viewState.resolution,n=t.frameState.size,r=t.frameState.extent,s=de(r);let o=r;if(e){const t=n[0]*i,e=n[1]*i;o=[s[0]-t/2,s[1]-e/2,s[0]+t/2,s[1]+e/2]}let a=0,l=0,h=this.latLabelPosition_<.5;const c=this.projection_.getExtent(),u=ve(c);if(this.getSource().getWrapX()&&this.projection_.canWrapX()&&!Wt(c,r)){a=Math.floor((r[0]-c[0])/u),l=Math.ceil((r[2]-c[2])/u);h=h!==Math.abs(e)>Math.PI/2}const d=bu(t);for(let t=a;t<=l;++t){let i,n,c,g,f=this.meridians_.length+this.parallels_.length;if(this.meridiansLabels_)for(n=0,c=this.meridiansLabels_.length;n<c;++n){const a=this.meridians_[n];if(e||0!==t){const i=a.clone();i.translate(t*u,0),i.rotate(-e,s),g=this.getMeridianPoint_(i,o,n),g.rotate(e,s)}else g=this.getMeridianPoint_(a,r,n);i=this.featurePool_[f++],i.setGeometry(g),i.set("graticule_label",this.meridiansLabels_[n].text),d.drawFeature(i,this.lonLabelStyle_(i))}if(this.parallelsLabels_&&(t===a&&h||t===l&&!h))for(n=0,c=this.parallels_.length;n<c;++n){const a=this.parallels_[n];if(e||0!==t){const i=a.clone();i.translate(t*u,0),i.rotate(-e,s),g=this.getParallelPoint_(i,o,n),g.rotate(e,s)}else g=this.getParallelPoint_(a,r,n);i=this.featurePool_[f++],i.setGeometry(g),i.set("graticule_label",this.parallelsLabels_[n].text),d.drawFeature(i,this.latLabelStyle_(i))}}}createGraticule_(t,e,i,n){const r=this.getInterval_(i);if(-1==r)return this.meridians_.length=0,this.parallels_.length=0,this.meridiansLabels_&&(this.meridiansLabels_.length=0),void(this.parallelsLabels_&&(this.parallelsLabels_.length=0));let s=!1;const o=this.projection_.getExtent(),a=ve(o);this.getSource().getWrapX()&&this.projection_.canWrapX()&&!Wt(o,t)&&(ve(t)>=a?(t[0]=o[0],t[2]=o[2]):s=!0);const l=[Ie(e[0],this.minX_,this.maxX_),Ie(e[1],this.minY_,this.maxY_)],h=this.toLonLatTransform_(l);isNaN(h[1])&&(h[1]=Math.abs(this.maxLat_)>=Math.abs(this.minLat_)?this.maxLat_:this.minLat_);let c=Ie(h[0],this.minLon_,this.maxLon_),u=Ie(h[1],this.minLat_,this.maxLat_);const d=this.maxLines_;let g,f,p,_,m=t;s||(m=[Ie(t[0],this.minX_,this.maxX_),Ie(t[1],this.minY_,this.maxY_),Ie(t[2],this.minX_,this.maxX_),Ie(t[3],this.minY_,this.maxY_)]);const y=be(m,this.toLonLatTransform_,void 0,8);let x=y[3],v=y[2],S=y[1],E=y[0];if(s||($t(m,this.bottomLeft_)&&(E=this.minLon_,S=this.minLat_),$t(m,this.bottomRight_)&&(v=this.maxLon_,S=this.minLat_),$t(m,this.topLeft_)&&(E=this.minLon_,x=this.maxLat_),$t(m,this.topRight_)&&(v=this.maxLon_,x=this.maxLat_),x=Ie(x,u,this.maxLat_),v=Ie(v,c,this.maxLon_),S=Ie(S,this.minLat_,u),E=Ie(E,this.minLon_,c)),c=Math.floor(c/r)*r,_=Ie(c,this.minLon_,this.maxLon_),f=this.addMeridian_(_,S,x,n,t,0),g=0,s)for(;(_-=r)>=E&&g++<d;)f=this.addMeridian_(_,S,x,n,t,f);else for(;_!=this.minLon_&&g++<d;)_=Math.max(_-r,this.minLon_),f=this.addMeridian_(_,S,x,n,t,f);if(_=Ie(c,this.minLon_,this.maxLon_),g=0,s)for(;(_+=r)<=v&&g++<d;)f=this.addMeridian_(_,S,x,n,t,f);else for(;_!=this.maxLon_&&g++<d;)_=Math.min(_+r,this.maxLon_),f=this.addMeridian_(_,S,x,n,t,f);for(this.meridians_.length=f,this.meridiansLabels_&&(this.meridiansLabels_.length=f),u=Math.floor(u/r)*r,p=Ie(u,this.minLat_,this.maxLat_),f=this.addParallel_(p,E,v,n,t,0),g=0;p!=this.minLat_&&g++<d;)p=Math.max(p-r,this.minLat_),f=this.addParallel_(p,E,v,n,t,f);for(p=Ie(u,this.minLat_,this.maxLat_),g=0;p!=this.maxLat_&&g++<d;)p=Math.min(p+r,this.maxLat_),f=this.addParallel_(p,E,v,n,t,f);this.parallels_.length=f,this.parallelsLabels_&&(this.parallelsLabels_.length=f)}getInterval_(t){const e=this.projectionCenterLonLat_[0],i=this.projectionCenterLonLat_[1];let n=-1;const r=Math.pow(this.targetSize_*t,2),s=[],o=[];for(let t=0,a=this.intervals_.length;t<a;++t){const a=Ie(this.intervals_[t]/2,0,90),l=Ie(i,-90+a,90-a);s[0]=e-a,s[1]=l-a,o[0]=e+a,o[1]=l+a,this.fromLonLatTransform_(s,s),this.fromLonLatTransform_(o,o);if(Math.pow(o[0]-s[0],2)+Math.pow(o[1]-s[1],2)<=r)break;n=this.intervals_[t]}return n}getMeridian_(t,e,i,n,r){const s=Nx(t,e,i,this.projection_,n);let o=this.meridians_[r];return o?(o.setFlatCoordinates("XY",s),o.changed()):(o=new Dd(s,"XY"),this.meridians_[r]=o),o}getMeridianPoint_(t,e,i){const n=t.getFlatCoordinates();let r=1,s=n.length-1;n[r]>n[s]&&(r=s,s=1);const o=Math.max(e[1],n[r]),a=Math.min(e[3],n[s]),l=Ie(e[1]+Math.abs(e[1]-e[3])*this.lonLabelPosition_,o,a),h=[n[r-1]+(n[s-1]-n[r-1])*(l-n[r])/(n[s]-n[r]),l],c=this.meridiansLabels_[i].geom;return c.setCoordinates(h),c}getMeridians(){return this.meridians_}getParallel_(t,e,i,n,r){const s=kx(t,e,i,this.projection_,n);let o=this.parallels_[r];return o?(o.setFlatCoordinates("XY",s),o.changed()):o=new Dd(s,"XY"),o}getParallelPoint_(t,e,i){const n=t.getFlatCoordinates();let r=0,s=n.length-2;n[r]>n[s]&&(r=s,s=0);const o=Math.max(e[0],n[r]),a=Math.min(e[2],n[s]),l=Ie(e[0]+Math.abs(e[0]-e[2])*this.latLabelPosition_,o,a),h=[l,n[r+1]+(n[s+1]-n[r+1])*(l-n[r])/(n[s]-n[r])],c=this.parallelsLabels_[i].geom;return c.setCoordinates(h),c}getParallels(){return this.parallels_}updateProjectionInfo_(t){const e=En("EPSG:4326"),i=t.getWorldExtent();this.maxLat_=i[3],this.maxLon_=i[2],this.minLat_=i[1],this.minLon_=i[0];const n=An(t,e);if(this.minLon_<this.maxLon_)this.toLonLatTransform_=n;else{const t=this.minLon_+this.maxLon_/2;this.maxLon_+=360,this.toLonLatTransform_=function(e,i,r){const s=n(e,i,r=r||2);for(let e=0,i=s.length;e<i;e+=r)s[e]<t&&(s[e]+=360);return s}}this.fromLonLatTransform_=An(e,t);const r=be([this.minLon_,this.minLat_,this.maxLon_,this.maxLat_],this.fromLonLatTransform_,void 0,8);this.minX_=r[0],this.maxX_=r[2],this.minY_=r[1],this.maxY_=r[3],this.bottomLeft_=this.fromLonLatTransform_([this.minLon_,this.minLat_]),this.bottomRight_=this.fromLonLatTransform_([this.maxLon_,this.minLat_]),this.topLeft_=this.fromLonLatTransform_([this.minLon_,this.maxLat_]),this.topRight_=this.fromLonLatTransform_([this.maxLon_,this.maxLat_]),this.projectionCenterLonLat_=this.toLonLatTransform_(de(t.getExtent())),isNaN(this.projectionCenterLonLat_[1])&&(this.projectionCenterLonLat_[1]=Math.abs(this.maxLat_)>=Math.abs(this.minLat_)?this.maxLat_:this.minLat_),this.projection_=t}},bP.layer.Group=qa,bP.layer.Group.GroupEvent=Ha,bP.layer.Heatmap=class extends zc{constructor(t){t=t||{};const e=Object.assign({},t);delete e.gradient,delete e.radius,delete e.blur,delete e.weight,super(e),this.on,this.once,this.un,this.filter_=t.filter??!0,this.styleVariables_=t.variables||{},this.gradient_=null,this.addChangeListener(zx,this.handleGradientChanged_),this.setGradient(t.gradient?t.gradient:Vx),this.setBlur(void 0!==t.blur?t.blur:15),this.setRadius(void 0!==t.radius?t.radius:8);const i=t.weight?t.weight:"weight";this.weight_=i,this.setRenderOrder(null)}getBlur(){return this.get(Bx)}getGradient(){return this.get(zx)}getRadius(){return this.get(Xx)}handleGradientChanged_(){this.gradient_=function(t){const e=1,i=256,n=ft(e,i),r=n.createLinearGradient(0,0,e,i),s=1/(t.length-1);for(let e=0,i=t.length;e<i;++e)r.addColorStop(e*s,t[e]);return n.fillStyle=r,n.fillRect(0,0,e,i),n.canvas}(this.getGradient())}setBlur(t){const e=this.get(Bx);this.set(Bx,t),"number"!=typeof t||"number"!=typeof e?this.clearRenderer():this.changed()}setGradient(t){this.set(zx,t)}setRadius(t){const e=this.get(Xx);this.set(Xx,t),"number"!=typeof t||"number"!=typeof e?this.clearRenderer():this.changed()}setFilter(t){this.filter_=t,this.changed(),this.clearRenderer()}setWeight(t){this.weight_=t,this.changed(),this.clearRenderer()}createRenderer(){const t=new Zm,e={variables:{},properties:{},functions:{},bandCount:0,featureId:!1,geometryType:!1},i=km(e,this.filter_,Yl);let n=km(e,this.getRadius(),Hl),r=km(e,this.getBlur(),Hl);const s={};"number"==typeof this.getBlur()&&(r="a_blur",s.a_blur=()=>this.getBlur(),t.addUniform("a_blur","float")),"number"==typeof this.getRadius()&&(n="a_radius",s.a_radius=()=>this.getRadius(),t.addUniform("a_radius","float"));const o={};let a=null;if("string"==typeof this.weight_||"function"==typeof this.weight_){const e="string"==typeof this.weight_?t=>t.get(this.weight_):this.weight_;o.prop_weight={size:1,callback:t=>{const i=e(t);return void 0!==i?Ie(i,0,1):1}},a="a_prop_weight",t.addAttribute("a_prop_weight","float")}else{a=km(e,["clamp",this.weight_,0,1],Hl)}t.addFragmentShaderFunction(`float getBlurSlope() {\n float blur = max(1., ${r});\n float radius = ${n};\n return radius / blur;\n}`).setSymbolSizeExpression(`vec2(${n} + ${r}) * 2.`).setSymbolColorExpression(`vec4(smoothstep(0., 1., (1. - length(coordsPx * 2. / v_quadSizePx)) * getBlurSlope()) * ${a})`).setStrokeColorExpression(`vec4(smoothstep(0., 1., (1. - length(currentRadiusPx * 2. / v_width)) * getBlurSlope()) * ${a})`).setStrokeWidthExpression(`(${n} + ${r}) * 2.`).setFillColorExpression(`vec4(${a})`).setFragmentDiscardExpression(`!${i}`),zm(t,e);const l=Vm(e),h=Xm(e,this.styleVariables_);return new my(this,{className:this.getClassName(),variables:this.styleVariables_,style:{builder:t,attributes:{...l,...o},uniforms:{...h,...s}},disableHitDetection:!1,postProcesses:[{fragmentShader:"\n precision mediump float;\n\n uniform sampler2D u_image;\n uniform sampler2D u_gradientTexture;\n uniform float u_opacity;\n\n varying vec2 v_texCoord;\n\n void main() {\n vec4 color = texture2D(u_image, v_texCoord);\n gl_FragColor.a = color.a * u_opacity;\n gl_FragColor.rgb = texture2D(u_gradientTexture, vec2(0.5, color.a)).rgb;\n gl_FragColor.rgb *= gl_FragColor.a;\n }",uniforms:{u_gradientTexture:()=>this.gradient_,u_opacity:()=>this.getOpacity()}}]})}updateStyleVariables(t){Object.assign(this.styleVariables_,t),this.changed()}renderDeclutter(){}},bP.layer.Image=Pf,bP.layer.Layer=nl,bP.layer.Layer.inView=rl,bP.layer.Tile=Nf,bP.layer.Vector=Gx,bP.layer.VectorImage=class extends zc{constructor(t){t=t||{};const e=Object.assign({},t);delete e.imageRatio,super(e),this.imageRatio_=void 0!==t.imageRatio?t.imageRatio:1}getImageRatio(){return this.imageRatio_}createRenderer(){return new yx(this)}},bP.layer.VectorTile=class extends zc{constructor(t){t=t||{};const e=Object.assign({},t);delete e.preload;const i=void 0===t.cacheSize?0:t.cacheSize;delete t.cacheSize,delete e.useInterimTilesOnError,super(e),this.on,this.once,this.un,this.cacheSize_=i;const n=t.renderMode||"hybrid";Mt("hybrid"==n||"vector"==n,"`renderMode` must be `'hybrid'` or `'vector'`"),this.renderMode_=n,this.setPreload(t.preload?t.preload:0),this.setUseInterimTilesOnError(void 0===t.useInterimTilesOnError||t.useInterimTilesOnError),this.getBackground,this.setBackground}createRenderer(){return new Sx(this,{cacheSize:this.cacheSize_})}getFeatures(t){return super.getFeatures(t)}getFeaturesInExtent(t){return this.getRenderer().getFeaturesInExtent(t)}getRenderMode(){return this.renderMode_}getPreload(){return this.get(Af)}getUseInterimTilesOnError(){return this.get(Of)}setPreload(t){this.set(Af,t)}setUseInterimTilesOnError(t){this.set(Of,t)}},bP.layer.WebGLPoints=class extends nl{constructor(t){super(Object.assign({},t)),this.styleVariables_=t.variables||{},this.parseResult_=Qm(t.style,this.styleVariables_,t.filter),this.hitDetectionDisabled_=!!t.disableHitDetection}createRenderer(){const t=Object.keys(this.parseResult_.attributes).map((t=>({name:t,...this.parseResult_.attributes[t]})));return new k_(this,{vertexShader:this.parseResult_.builder.getSymbolVertexShader(),fragmentShader:this.parseResult_.builder.getSymbolFragmentShader(),hitDetectionEnabled:!this.hitDetectionDisabled_,uniforms:this.parseResult_.uniforms,attributes:t})}updateStyleVariables(t){Object.assign(this.styleVariables_,t),this.changed()}},bP.layer.WebGLTile=Wx,bP.layer.WebGLVector=class extends nl{constructor(t){super(Object.assign({},t)),this.styleVariables_=t.variables||{},this.style_=t.style,this.hitDetectionDisabled_=!!t.disableHitDetection}createRenderer(){return new my(this,{style:this.style_,variables:this.styleVariables_,disableHitDetection:this.hitDetectionDisabled_})}updateStyleVariables(t){Object.assign(this.styleVariables_,t),this.changed()}setStyle(t){this.style_=t,this.clearRenderer(),this.changed()}},bP.layer.WebGLVectorTile=class extends Df{constructor(t){super(Object.assign({},t)),this.styleVariables_=t.variables||{},this.style_=t.style,this.hitDetectionDisabled_=!!t.disableHitDetection}createRenderer(){return new vy(this,{style:this.style_,variables:this.styleVariables_,disableHitDetection:this.hitDetectionDisabled_,cacheSize:this.getCacheSize()})}updateStyleVariables(t){Object.assign(this.styleVariables_,t),this.changed()}setStyle(t){this.style_=t,this.clearRenderer(),this.changed()}},bP.loadingstrategy={},bP.loadingstrategy.all=uu,bP.loadingstrategy.bbox=function(t,e){return[t]},bP.loadingstrategy.tile=function(t){return function(e,i,n){const r=t.getZForResolution(Vn(i,n)),s=t.getTileRangeForExtentAndZ(zn(e,n),r),o=[],a=[r,0,0];for(a[1]=s.minX;a[1]<=s.maxX;++a[1])for(a[2]=s.minY;a[2]<=s.maxY;++a[2])o.push(Bn(t.getTileCoordExtent(a),n));return o}},bP.math={},bP.math.ceil=Ue,bP.math.clamp=Ie,bP.math.floor=je,bP.math.lerp=Ne,bP.math.modulo=De,bP.math.round=Ge,bP.math.solveLinearSystem=Me,bP.math.squaredDistance=Le,bP.math.squaredSegmentDistance=Fe,bP.math.toDegrees=Ae,bP.math.toFixed=ke,bP.math.toRadians=Oe,bP.math.wrap=Be,bP.net={},bP.net.ClientError=fu,bP.net.ResponseError=gu,bP.net.getJSON=pu,bP.net.jsonp=du,bP.net.overrideXHR=function(t){"undefined"!=typeof XMLHttpRequest&&(ou=XMLHttpRequest),global.XMLHttpRequest=t},bP.net.resolveUrl=_u,bP.net.restoreXHR=function(){global.XMLHttpRequest=ou},bP.obj={},bP.obj.clear=F,bP.obj.isEmpty=L,bP.proj={},bP.proj.Projection=mi,bP.proj.Units={},bP.proj.Units.METERS_PER_UNIT=_i,bP.proj.Units.fromCode=pi,bP.proj.addCommon=Wn,bP.proj.addCoordinateTransforms=Pn,bP.proj.addEquivalentProjections=Tn,bP.proj.addEquivalentTransforms=Cn,bP.proj.addProjection=vn,bP.proj.addProjections=Sn,bP.proj.clearAllProjections=function(){Ai(),ki()},bP.proj.clearUserProjection=function(){Nn=null},bP.proj.cloneTransform=yn,bP.proj.createProjection=bn,bP.proj.createSafeCoordinateTransform=$n,bP.proj.createTransformFromCoordinateTransform=Rn,bP.proj.disableCoordinateWarning=mn,bP.proj.epsg3857={},bP.proj.epsg3857.EXTENT=vi,bP.proj.epsg3857.HALF_SIZE=xi,bP.proj.epsg3857.MAX_SAFE_Y=Ei,bP.proj.epsg3857.PROJECTIONS=Ti,bP.proj.epsg3857.RADIUS=yi,bP.proj.epsg3857.WORLD_EXTENT=Si,bP.proj.epsg3857.fromEPSG4326=Ci,bP.proj.epsg3857.toEPSG4326=bi,bP.proj.epsg4326={},bP.proj.epsg4326.EXTENT=Pi,bP.proj.epsg4326.METERS_PER_UNIT=Ii,bP.proj.epsg4326.PROJECTIONS=Li,bP.proj.epsg4326.RADIUS=Ri,bP.proj.equivalent=Fn,bP.proj.fromLonLat=function(t,e){return mn(),On(t,"EPSG:4326",void 0!==e?e:"EPSG:3857")},bP.proj.fromUserCoordinate=Un,bP.proj.fromUserExtent=zn,bP.proj.fromUserResolution=Vn,bP.proj.get=En,bP.proj.getPointResolution=wn,bP.proj.getTransform=An,bP.proj.getTransformFromProjections=Ln,bP.proj.getUserProjection=Gn,bP.proj.identityTransform=xn,bP.proj.proj4={},bP.proj.proj4.epsgLookupMapTiler=function(t){return async function(e){const i=await fetch(`https://api.maptiler.com/coordinates/search/code:${e}.json?transformations=true&exports=true&key=${t}`);if(!i.ok)throw new Error(`Unexpected response from maptiler.com: ${i.status}`);return i.json().then((t=>{const i=t.results;if(i?.length>0){const t=i.filter((t=>"EPSG"===t.id?.authority&&t.id?.code===e))[0];if(t){const e=t.transformations;if(e?.length>0){const i=t.default_transformation;if(e.filter((t=>t.id?.authority===i?.authority&&t.id?.code===i?.code&&0===t.grids?.length)).length>0)return t.exports?.proj4;const n=e.filter((t=>0===t.grids?.length&&"EPSG"===t.target_crs?.authority&&4326===t.target_crs?.code&&!1===t.deprecated&&!0===t.usable)).sort(((t,e)=>t.accuracy-e.accuracy))[0]?.exports?.proj4;if(n)return n}return t.exports?.proj4}}}))}},bP.proj.proj4.fromEPSGCode=async function(t){return"number"==typeof t&&(t="EPSG:"+t),await Cx(t)},bP.proj.proj4.fromProjectionCode=Cx,bP.proj.proj4.getEPSGLookup=function(){return bx},bP.proj.proj4.getProjectionCodeLookup=function(){return Tx},bP.proj.proj4.isRegistered=function(){return!!Ex},bP.proj.proj4.register=wx,bP.proj.proj4.setEPSGLookup=function(t){bx=t},bP.proj.proj4.setProjectionCodeLookup=function(t){Tx=t},bP.proj.proj4.unregister=function(){Ex=null},bP.proj.projections={},bP.proj.projections.add=Di,bP.proj.projections.clear=Ai,bP.proj.projections.get=Oi,bP.proj.setUserProjection=kn,bP.proj.toLonLat=In,bP.proj.toUserCoordinate=jn,bP.proj.toUserExtent=Bn,bP.proj.toUserResolution=Xn,bP.proj.transform=On,bP.proj.transformExtent=Dn,bP.proj.transformWithProjections=function(t,e,i){return Ln(e,i)(t)},bP.proj.transforms={},bP.proj.transforms.add=Gi,bP.proj.transforms.clear=ki,bP.proj.transforms.get=ji,bP.proj.transforms.remove=function(t,e){const i=t.getCode(),n=e.getCode(),r=Ni[i][n];return delete Ni[i][n],L(Ni[i])&&delete Ni[i],r},bP.proj.useGeographic=function(){kn("EPSG:4326")},bP.proj.utm={},bP.proj.utm.makeProjection=dn,bP.proj.utm.makeTransforms=gn,bP.proj.utm.zoneFromCode=cn,bP.render={},bP.render.Box=ya,bP.render.Event=Xc,bP.render.Feature=Ud,bP.render.Feature.toFeature=function(t,e){const i=t.getId(),n=Bd(t),r=t.getProperties(),s=new At;return void 0!==e&&s.setGeometryName(e),s.setGeometry(n),void 0!==i&&s.setId(i),s.setProperties(r,!0),s},bP.render.Feature.toGeometry=Bd,bP.render.VectorContext=yu,bP.render.canvas={},bP.render.canvas.Builder=Gy,bP.render.canvas.BuilderGroup=Zy,bP.render.canvas.Executor=sx,bP.render.canvas.ExecutorGroup=ux,bP.render.canvas.ExecutorGroup.ALL=ox,bP.render.canvas.ExecutorGroup.DECLUTTER=ax,bP.render.canvas.ExecutorGroup.NON_DECLUTTER=lx,bP.render.canvas.ExecutorGroup.getPixelIndexArray=gx,bP.render.canvas.ImageBuilder=jy,bP.render.canvas.Immediate=xu,bP.render.canvas.Instruction={},bP.render.canvas.Instruction.beginPathInstruction=Ny,bP.render.canvas.Instruction.closePathInstruction=ky,bP.render.canvas.Instruction.fillInstruction=Oy,bP.render.canvas.Instruction.strokeInstruction=Dy,bP.render.canvas.LineStringBuilder=Uy,bP.render.canvas.PolygonBuilder=By,bP.render.canvas.TextBuilder=$y,bP.render.canvas.TextBuilder.TEXT_ALIGN=Vy,bP.render.canvas.ZIndexContext=Sf,bP.render.canvas.checkedFonts=Xh,bP.render.canvas.defaultFillStyle=Oh,bP.render.canvas.defaultFont=Ah,bP.render.canvas.defaultLineCap=Dh,bP.render.canvas.defaultLineDash=Nh,bP.render.canvas.defaultLineDashOffset=0,bP.render.canvas.defaultLineJoin=kh,bP.render.canvas.defaultLineWidth=1,bP.render.canvas.defaultMiterLimit=Gh,bP.render.canvas.defaultPadding=zh,bP.render.canvas.defaultStrokeOffset=0,bP.render.canvas.defaultStrokeStyle=jh,bP.render.canvas.defaultTextAlign=Uh,bP.render.canvas.defaultTextBaseline=Bh,bP.render.canvas.drawImageOrLabel=ec,bP.render.canvas.getTextDimensions=tc,bP.render.canvas.hitdetect={},bP.render.canvas.hitdetect.HIT_DETECT_RESOLUTION=fx,bP.render.canvas.hitdetect.createHitDetectionImageData=px,bP.render.canvas.hitdetect.hitDetect=_x,bP.render.canvas.measureAndCacheTextWidth=Qh,bP.render.canvas.measureTextHeight=Kh,bP.render.canvas.measureTextWidth=Jh,bP.render.canvas.registerFont=Hh,bP.render.canvas.rotateAtOffset=function(t,e,i,n){0!==e&&(t.translate(i,n),t.rotate(e),t.translate(-i,-n))},bP.render.canvas.style={},bP.render.canvas.style.buildRuleSet=xc,bP.render.canvas.style.buildStyle=vc,bP.render.canvas.style.flatStylesToStyleFunction=yc,bP.render.canvas.style.rulesToStyleFunction=mc,bP.render.canvas.textHeights=Wh,bP.render.getRenderPixel=function(t,e){return Qn(t.inversePixelTransform,e.slice(0))},bP.render.getVectorContext=bu,bP.render.toContext=function(t,e){const i=t.canvas,n=(e=e||{}).pixelRatio||ht,r=e.size;r&&(i.width=r[0]*n,i.height=r[1]*n,i.style.width=r[0]+"px",i.style.height=r[1]+"px");const s=[0,0,i.width,i.height],o=er([1,0,0,1,0,0],n,n);return new xu(t,n,s,o,0)},bP.render.webgl={},bP.render.webgl.MixedGeometryBatch=qp,bP.render.webgl.ShaderBuilder={},bP.render.webgl.ShaderBuilder.COMMON_HEADER=$m,bP.render.webgl.ShaderBuilder.ShaderBuilder=Zm,bP.render.webgl.VectorStyleRenderer=fy,bP.render.webgl.VectorStyleRenderer.convertStyleToShaders=py,bP.render.webgl.bufferUtil={},bP.render.webgl.bufferUtil.LINESTRING_ANGLE_COSINE_CUTOFF=Om,bP.render.webgl.bufferUtil.writeLineSegmentToBuffers=function(t,e,i,n,r,s,o,a,l,h){const c=[t[e],t[e+1]],u=[t[i],t[i+1]],d=t[e+2],g=t[i+2],f=Qn(a,[...c]),p=Qn(a,[...u]);let _=-1,m=-1,y=h;const x=null!==r;if(null!==n){_=gi(f,p,Qn(a,[...[t[n],t[n+1]]])),Math.cos(_)<=Om&&(y+=Math.tan((_-Math.PI)/2))}if(x){m=gi(p,f,Qn(a,[...[t[r],t[r+1]]])),Math.cos(m)<=Om&&(y+=Math.tan((Math.PI-m)/2))}const v=Math.pow(2,24),S=l%v,E=Math.floor(l/v)*v;return s.push(c[0],c[1],d,u[0],u[1],g,_,m,S,E,h),s.push(...o),{length:l+Math.sqrt((p[0]-f[0])*(p[0]-f[0])+(p[1]-f[1])*(p[1]-f[1])),angle:y}},bP.render.webgl.bufferUtil.writePointFeatureToBuffers=function(t,e,i,n,r){const s=t[e++],o=t[e++],a=Dm;a.length=n;for(let i=0;i<a.length;i++)a[i]=t[e+i];let l=r?r.instanceAttributesPosition:0;return i[l++]=s,i[l++]=o,a.length&&(i.set(a,l),l+=a.length),Nm.instanceAttributesPosition=l,Nm},bP.render.webgl.bufferUtil.writePolygonTrianglesToBuffers=function(t,e,i,n,r){const s=2+r;let o=e;const a=t.slice(o,o+r);o+=r;const l=t[o++];let h=0;const c=new Array(l-1);for(let e=0;e<l;e++)h+=t[o++],e<l-1&&(c[e]=h);const u=t.slice(o,o+2*h),d=lm(u,c,2);for(let t=0;t<d.length;t++)n.push(d[t]+i.length/s);for(let t=0;t<u.length;t+=2)i.push(u[t],u[t+1],...a);return o+2*h},bP.render.webgl.compileUtil={},bP.render.webgl.compileUtil.UNPACK_COLOR_FN=jm,bP.render.webgl.compileUtil.applyContextToBuilder=zm,bP.render.webgl.compileUtil.expressionToGlsl=km,bP.render.webgl.compileUtil.generateAttributesFromContext=Vm,bP.render.webgl.compileUtil.generateUniformsFromContext=Xm,bP.render.webgl.compileUtil.getGlslSizeFromType=Um,bP.render.webgl.compileUtil.getGlslTypeFromType=Bm,bP.render.webgl.compileUtil.packColor=Gm,bP.render.webgl.compileUtil.unpackColor=function(t){return[Math.min(Math.floor(t[0]/256)/255,1),Math.min(t[0]%256/255,1),Math.min(Math.floor(t[1]/256)/255,1),Math.min(t[1]%256/255,1)]},bP.render.webgl.encodeUtil={},bP.render.webgl.encodeUtil.colorDecodeId=O_,bP.render.webgl.encodeUtil.colorEncodeIdAndPack=A_,bP.render.webgl.renderinstructions={},bP.render.webgl.renderinstructions.generateLineStringRenderInstructions=om,bP.render.webgl.renderinstructions.generatePointRenderInstructions=sm,bP.render.webgl.renderinstructions.generatePolygonRenderInstructions=am,bP.render.webgl.renderinstructions.getCustomAttributesSize=rm,bP.render.webgl.style={},bP.render.webgl.style.computeHash=Ym,bP.render.webgl.style.parseLiteralStyle=Qm,bP.renderer={},bP.renderer.Composite=Wc,bP.renderer.Layer=Ef,bP.renderer.Map=Vc,bP.renderer.canvas={},bP.renderer.canvas.ImageLayer=bf,bP.renderer.canvas.Layer=Cf,bP.renderer.canvas.Layer.canvasPool=wf,bP.renderer.canvas.TileLayer=Mf,bP.renderer.canvas.VectorImageLayer=yx,bP.renderer.canvas.VectorLayer=mx,bP.renderer.canvas.VectorTileLayer=Sx,bP.renderer.vector={},bP.renderer.vector.defaultOrder=Su,bP.renderer.vector.getSquaredTolerance=Eu,bP.renderer.vector.getTolerance=wu,bP.renderer.vector.renderFeature=Tu,bP.renderer.webgl={},bP.renderer.webgl.FlowLayer=I_,bP.renderer.webgl.Layer=d_,bP.renderer.webgl.PointsLayer=k_,bP.renderer.webgl.TileLayer=T_,bP.renderer.webgl.TileLayer.Attributes=E_,bP.renderer.webgl.TileLayer.Uniforms=S_,bP.renderer.webgl.TileLayerBase=v_,bP.renderer.webgl.TileLayerBase.Uniforms=g_,bP.renderer.webgl.TileLayerBase.getCacheKey=x_,bP.renderer.webgl.TileLayerBase.newTileRepresentationLookup=p_,bP.renderer.webgl.VectorLayer=my,bP.renderer.webgl.VectorLayer.Uniforms=_y,bP.renderer.webgl.VectorTileLayer=vy,bP.renderer.webgl.VectorTileLayer.Attributes=xy,bP.renderer.webgl.VectorTileLayer.Uniforms=yy,bP.reproj={},bP.reproj.DataTile=ug,bP.reproj.Image=Ng,bP.reproj.Tile=fd,bP.reproj.Triangulation=dd,bP.reproj.calculateSourceExtentResolution=Mu,bP.reproj.calculateSourceResolution=Lu,bP.reproj.canvasPool=Pu,bP.reproj.common={},bP.reproj.common.ERROR_THRESHOLD=gd,bP.reproj.glreproj={},bP.reproj.glreproj.canvasGLPool=hg,bP.reproj.glreproj.createCanvasContextWebGL=ag,bP.reproj.glreproj.releaseGLCanvas=lg,bP.reproj.glreproj.render=cg,bP.reproj.render=Au,bP.resolution={},bP.resolution.fromResolutionLike=Ou,bP.resolutionconstraint={},bP.resolutionconstraint.createMinMaxResolution=vo,bP.resolutionconstraint.createSnapToPower=xo,bP.resolutionconstraint.createSnapToResolutions=yo,bP.rotationconstraint={},bP.rotationconstraint.createSnapToN=wo,bP.rotationconstraint.createSnapToZero=To,bP.rotationconstraint.disable=So,bP.rotationconstraint.none=Eo,bP.size={},bP.size.buffer=function(t,e,i){return void 0===i&&(i=[0,0]),i[0]=t[0]+2*e,i[1]=t[1]+2*e,i},bP.size.hasArea=Vl,bP.size.scale=$l,bP.size.toSize=Wl,bP.source={},bP.source.BingMaps=class extends wd{constructor(t){const e=void 0!==t.hidpi&&t.hidpi;super({cacheSize:t.cacheSize,crossOrigin:"anonymous",interpolate:t.interpolate,projection:En("EPSG:3857"),reprojectionErrorThreshold:t.reprojectionErrorThreshold,state:"loading",tileLoadFunction:t.tileLoadFunction,tilePixelRatio:e?2:1,wrapX:void 0===t.wrapX||t.wrapX,transition:t.transition,zDirection:t.zDirection}),this.hidpi_=e,this.culture_=void 0!==t.culture?t.culture:"en-us",this.maxZoom_=void 0!==t.maxZoom?t.maxZoom:-1,this.apiKey_=t.key,this.imagerySet_=t.imagerySet,this.placeholderTiles_=t.placeholderTiles;const i=(t.url||"https://dev.virtualearth.net/REST/v1/Imagery/Metadata/")+this.imagerySet_+"?uriScheme=https&include=ImageryProviders&key="+this.apiKey_+"&c="+this.culture_;fetch(i).then((t=>t.json())).then((t=>this.handleImageryMetadataResponse(t)))}getApiKey(){return this.apiKey_}getImagerySet(){return this.imagerySet_}handleImageryMetadataResponse(t){if(200!=t.statusCode||"OK"!=t.statusDescription||"ValidCredentials"!=t.authenticationResultCode||1!=t.resourceSets.length||1!=t.resourceSets[0].resources.length)return void this.setState("error");const e=t.resourceSets[0].resources[0],i=-1==this.maxZoom_?e.zoomMax:this.maxZoom_,n=Qu(this.getProjection()),r=this.hidpi_?2:1,s=e.imageWidth==e.imageHeight?e.imageWidth/r:[e.imageWidth/r,e.imageHeight/r],o=Ku({extent:n,minZoom:e.zoomMin,maxZoom:i,tileSize:s});this.tileGrid=o;const a=this.culture_,l=this.hidpi_,h=this.placeholderTiles_;if(this.tileUrlFunction=cd(e.imageUrlSubdomains.map((function(t){const i=[0,0,0],n=e.imageUrl.replace("{subdomain}",t).replace("{culture}",a);return function(t,e,r){if(!t)return;Nu(t[0],t[1],t[2],i);const s=new URL(n.replace("{quadkey}",Cd(i))),o=s.searchParams;return l&&(o.set("dpi","d1"),o.set("device","mobile")),!0===h?o.delete("n"):!1===h&&o.set("n","z"),s.toString()}}))),e.imageryProviders){const t=Ln(En("EPSG:4326"),this.getProjection());this.setAttributions((i=>{const n=[],r=i.viewState,s=this.getTileGrid(),o=s.getZForResolution(r.resolution,this.zDirection),a=s.getTileCoordForCoordAndZ(r.center,o)[0];return e.imageryProviders.map((function(e){let r=!1;const s=e.coverageAreas;for(let e=0,n=s.length;e<n;++e){const n=s[e];if(a>=n.zoomMin&&a<=n.zoomMax){const e=n.bbox;if(Se(be([e[1],e[0],e[3],e[2]],t),i.extent)){r=!0;break}}}r&&n.push(e.attribution)})),n.push('<a class="ol-attribution-bing-tos" href="https://www.microsoft.com/maps/product/terms.html" target="_blank">Terms of Use</a>'),n}))}this.setState("ready")}},bP.source.BingMaps.quadKey=Cd,bP.source.CartoDB=class extends bd{constructor(t){super({attributions:t.attributions,cacheSize:t.cacheSize,crossOrigin:t.crossOrigin,maxZoom:void 0!==t.maxZoom?t.maxZoom:18,minZoom:t.minZoom,projection:t.projection,transition:t.transition,wrapX:t.wrapX,zDirection:t.zDirection}),this.account_=t.account,this.mapId_=t.map||"",this.config_=t.config||{},this.templateCache_={},this.initializeMap_()}getConfig(){return this.config_}updateConfig(t){Object.assign(this.config_,t),this.initializeMap_()}setConfig(t){this.config_=t||{},this.initializeMap_()}initializeMap_(){const t=JSON.stringify(this.config_);if(this.templateCache_[t])return void this.applyTemplate_(this.templateCache_[t]);let e="https://"+this.account_+".carto.com/api/v1/map";this.mapId_&&(e+="/named/"+this.mapId_);const i=new XMLHttpRequest;i.addEventListener("load",this.handleInitResponse_.bind(this,t)),i.addEventListener("error",this.handleInitError_.bind(this)),i.open("POST",e),i.setRequestHeader("Content-type","application/json"),i.send(JSON.stringify(this.config_))}handleInitResponse_(t,e){const i=e.target;if(!i.status||i.status>=200&&i.status<300){let e;try{e=JSON.parse(i.responseText)}catch{return void this.setState("error")}this.applyTemplate_(e),this.templateCache_[t]=e,this.setState("ready")}else this.setState("error")}handleInitError_(t){this.setState("error")}applyTemplate_(t){const e="https://"+t.cdn_url.https+"/"+this.account_+"/api/v1/map/"+t.layergroupid+"/{z}/{x}/{y}.png";this.setUrl(e)}},bP.source.Cluster=class extends qd{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 Mt(!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(n,this.boundRefresh_),this.source=t,t&&t.addEventListener(n,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 r=0,s=i.length;r<s;r++){const s=i[r];if(!(z(s)in n)){const i=this.geometryFunction(s);if(i){Jt(i.getCoordinates(),t),zt(t,e,t);const r=this.source.getFeaturesInExtent(t).filter((function(t){const e=z(t);return!(e in n)&&(n[e]=!0,!0)}));this.features.push(this.createCluster(r,t))}}}}createCluster(t,e){const i=[0,0];for(let e=t.length-1;e>=0;--e){const n=this.geometryFunction(t[e]);n?Qe(i,n.getCoordinates()):t.splice(e,1)}oi(i,1/t.length);const n=de(e),r=this.interpolationRatio,s=new Wr([i[0]*(1-r)+n[0]*r,i[1]*(1-r)+n[1]*r]);return this.createCustomCluster_?this.createCustomCluster_(s,t):new At({geometry:s,features:t})}},bP.source.DataTile=dg,bP.source.GeoTIFF=Cg,bP.source.GeoZarr=class extends dg{constructor(t){super({state:"loading",tileGrid:null,projection:t.projection||null,transition:t.transition,wrapX:t.wrapX}),this.url_=t.url,this.group_=t.group,this.error_=null,this.root_=null,this.consolidatedMetadata_=null,this.bands_=t.bands,this.bandsByLevel_=null,this.fillValue_,this.resampleMethod_=t.resample||"linear",this.bandCount=this.bands_.length,this.setLoader(this.loadTile_.bind(this)),this.tileGrid,this.configure_().then((()=>{this.setState("ready")})).catch((t=>{this.error_=t,this.setState("error")}))}async configure_(){const t=new zarr.FetchStore(this.url_);this.root_=await zarr.open(t,{kind:"group"});try{this.consolidatedMetadata_=JSON.parse((new TextDecoder).decode(await t.get(this.root_.resolve("zarr.json").path))).consolidated_metadata.metadata}catch{}const e=(await zarr.open(this.root_.resolve(this.group_),{kind:"group"})).attrs;if("zarr_conventions"in e&&Array.isArray(e.zarr_conventions)&&r_.every((t=>e.zarr_conventions.find((e=>e.uuid===t))))&&"layout"in e.multiscales){const{tileGrid:t,projection:i,bandsByLevel:n,fillValue:r}=function(t,e,i,n){const r=t.multiscales,s=t["spatial:bbox"],o=En(t["proj:code"]),a=[],l=e?{}:null;let h;for(const t of r.layout){const r=t["spatial:transform"],s=r[0],o=[r[2],r[5]],c=t.asset;if(a.push({matrixId:c,resolution:s,origin:o}),e){const t=[];for(const r of n){const n=e[`${i}/${c}/${r}`];n&&(t.push(r),void 0===h&&(h=n.fill_value))}l[c]=t}}a.sort(((t,e)=>e.resolution-t.resolution));const c=new $u({extent:s,origins:a.map((t=>t.origin)),resolutions:a.map((t=>t.resolution)),matrixIds:a.map((t=>t.matrixId))});return{tileGrid:c,projection:o,bandsByLevel:l,fillValue:h}}(e,this.consolidatedMetadata_,this.group_,this.bands_);this.bandsByLevel_=n,this.tileGrid=t,this.projection=i,this.fillValue_=r}if("tile_matrix_set"in e.multiscales){const{tileGrid:t,projection:i}=function(t){const e=t.multiscales,i=e.tile_matrix_set,n=e.tile_matrix_limits,r=i.tileMatrices.length,s=new Array(r);let o=!1;for(let t=0;t<r;t+=1){const e=i.tileMatrices[t],r=e.id;(e.tileWidth>512||e.tileHeight>512)&&(o=!0),s[t]=n[r]}const a=_f({},i,void 0,s);let l=a.grid;o&&(l=new $u({tileSize:512,extent:l.getExtent(),origins:l.getOrigins(),resolutions:l.getResolutions(),matrixIds:l.getMatrixIds()}));return{tileGrid:l,projection:a.projection}}(e);this.tileGrid=t,this.projection||(this.projection=i)}if(!this.tileGrid)throw new Error("Could not determine tile grid");const i=this.tileGrid.getExtent();setTimeout((()=>{this.viewResolver({showFullExtent:!0,projection:this.projection,resolutions:this.tileGrid.getResolutions(),center:jn(de(i),this.projection),extent:Bn(i,this.projection),zoom:1})}))}async loadTile_(t,e,i,n){const r=this.tileGrid.getResolutions(),s=this.tileGrid.getResolution(t),o=this.tileGrid.getTileCoordExtent([t,e,i]),a=[],l=[];for(const e of this.bands_){let i,n,h=0;if(this.bandsByLevel_)for(let t=0;t<r.length;t+=1){const o=r[t];if(i&&o<s)break;const a=this.tileGrid.getMatrixId(t);this.bandsByLevel_[a].includes(e)&&(i=a,n=this.tileGrid.getResolution(t),h=t)}else i=this.tileGrid.getMatrixId(t),n=s,h=t;if(!i||!n)throw new Error(`Could not find available resolution for band ${e}`);const c=this.tileGrid.getOrigin(h),u=Math.round((o[0]-c[0])/n),d=Math.round((o[2]-c[0])/n),g=Math.round((c[1]-o[3])/n),f=Math.round((c[1]-o[1])/n),p=`${this.group_}/${i}/${e}`,_=await zarr.open(this.root_.resolve(p),{kind:"array"});a.push(zarr.get(_,[zarr.slice(g,f),zarr.slice(u,d)])),l.push(n)}const h=await Promise.all(a),[c,u]=Wl(this.tileGrid.getTileSize(t));return function(t,e,i,n,r,s,o){const a=t.length,l=new Float32Array(i*n*a);for(let h=0;h<n;h++)for(let n=0;n<i;n++)for(let c=0;c<a;++c){const u=t[c],d=u.shape[0],g=u.shape[1],f=r/e[c];let p=o;if(1===f)h<d&&n<g&&(p=u.data[h*g+n]);else{const t=h*f,e=n*f;switch(s){case"nearest":{const i=Math.round(t),n=Math.round(e);i<d&&n<g&&(p=u.data[i*g+n]);break}case"linear":{const i=Math.floor(t),n=Math.floor(e);if(i<d&&n<g){const r=Math.min(i+1,d-1),s=Math.min(n+1,g-1),o=e-n,a=t-i;p=(1-a)*((1-o)*u.data[i*g+n]+o*u.data[i*g+s])+a*((1-o)*u.data[r*g+n]+o*u.data[r*g+s])}break}default:throw new Error(`Unsupported resample method: ${s}`)}}isNaN(p)&&(p=o),l[a*(h*i+n)+c]=p}return l}(h,l,c,u,s,this.resampleMethod_,this.fillValue_||0)}},bP.source.Google=class extends wd{constructor(t){const e=!!t.highDpi;super({attributionsCollapsible:t.attributionsCollapsible,cacheSize:t.cacheSize,crossOrigin:"anonymous",interpolate:t.interpolate,projection:"EPSG:3857",reprojectionErrorThreshold:t.reprojectionErrorThreshold,state:"loading",tileLoadFunction:t.tileLoadFunction,tilePixelRatio:e?2:1,wrapX:void 0===t.wrapX||t.wrapX,transition:t.transition,zDirection:t.zDirection}),this.apiKey_=t.key,this.error_=null;const i={mapType:t.mapType||"roadmap",language:t.language||"en-US",region:t.region||"US"};t.imageFormat&&(i.imageFormat=t.imageFormat),t.scale&&(i.scale=t.scale),e&&(i.highDpi=!0),t.layerTypes&&(i.layerTypes=t.layerTypes),t.styles&&(i.styles=t.styles),!0===t.overlay&&(i.overlay=!0),t.apiOptions&&(i.apiOptions=t.apiOptions),this.sessionTokenRequest_=i,this.sessionTokenValue_,this.sessionRefreshId_,this.previousViewportAttribution_,this.previousViewportExtent_;const n=t.url||"https://tile.googleapis.com/";this.createSessionUrl_=n+"v1/createSession",this.tileUrl_=n+"v1/2dtiles",this.attributionUrl_=n+"tile/v1/viewport",this.createSession_()}getError(){return this.error_}fetchSessionToken(t,e){return fetch(t,e)}async createSession_(){const t=this.createSessionUrl_+"?key="+this.apiKey_,e={method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(this.sessionTokenRequest_)},i=await this.fetchSessionToken(t,e);if(!i.ok){try{const t=await i.json();this.error_=new Error(t.error.message)}catch{this.error_=new Error("Error fetching session token")}return void this.setState("error")}const n=await i.json(),r=this.getTilePixelRatio(1),s=[n.tileWidth/r,n.tileHeight/r];this.tileGrid=Ku({extent:Qu(this.getProjection()),maxZoom:22,tileSize:s});const o=n.session;this.sessionTokenValue_=o;const a=this.apiKey_,l=this.tileUrl_;this.tileUrlFunction=function(t,e,i){const n=t[0],r=t[1],s=t[2];return`${l}/${n}/${r}/${s}?session=${o}&key=${a}`};const h=1e3*parseInt(n.expiry,10),c=Math.max(h-Date.now()-6e4,1);this.sessionRefreshId_=setTimeout((()=>this.createSession_()),c),this.setAttributions(this.fetchAttributions_.bind(this)),this.setState("ready")}async fetchAttributions_(t){if(t.viewHints[co]||t.viewHints[uo]||t.animate)return this.previousViewportAttribution_;const[e,i]=In(ce(t.extent),t.viewState.projection),[n,r]=In(xe(t.extent),t.viewState.projection),s=`zoom=${this.getTileGrid().getZForResolution(t.viewState.resolution,this.zDirection)}&north=${r}&south=${i}&east=${n}&west=${e}`;if(this.previousViewportExtent_==s)return this.previousViewportAttribution_;this.previousViewportExtent_=s;const o=this.sessionTokenValue_,a=this.apiKey_,l=`${this.attributionUrl_}?session=${o}&key=${a}&${s}`;return this.previousViewportAttribution_=await fetch(l).then((t=>t.json())).then((t=>t.copyright)),this.previousViewportAttribution_}disposeInternal(){clearTimeout(this.sessionRefreshId_),super.disposeInternal()}},bP.source.IIIF=class extends wd{constructor(t){const e=t||{};let i=e.url||"";i+=i.lastIndexOf("/")===i.length-1||""===i?"":"/";const n=e.version||Rg,r=e.sizes||[],s=e.size;Mt(null!=s&&Array.isArray(s)&&2==s.length&&!isNaN(s[0])&&s[0]>0&&!isNaN(s[1])&&s[1]>0,"Missing or invalid `size`");const o=s[0],a=s[1],l=e.tileSize,h=e.tilePixelRatio||1,c=e.format||"jpg",u=e.quality||(e.version==bg?"native":"default");let d=e.resolutions||[];const g=e.supports||[],f=e.extent||[0,-a,o,0],p=null!=r&&Array.isArray(r)&&r.length>0,_=void 0!==l&&("number"==typeof l&&Number.isInteger(l)&&l>0||Array.isArray(l)&&l.length>0),m=null!=g&&Array.isArray(g)&&(g.includes("regionByPx")||g.includes("regionByPct"))&&(g.includes("sizeByWh")||g.includes("sizeByH")||g.includes("sizeByW")||g.includes("sizeByPct"));let y,x,v;if(d.sort((function(t,e){return e-t})),_||m)if(null!=l&&("number"==typeof l&&Number.isInteger(l)&&l>0?(y=l,x=l):Array.isArray(l)&&l.length>0&&((1==l.length||null==l[1]&&Number.isInteger(l[0]))&&(y=l[0],x=l[0]),2==l.length&&(Number.isInteger(l[0])&&Number.isInteger(l[1])?(y=l[0],x=l[1]):null==l[0]&&Number.isInteger(l[1])&&(y=l[1],x=l[1])))),void 0!==y&&void 0!==x||(y=Co,x=Co),0==d.length){v=Math.max(Math.ceil(Math.log(o/y)/Math.LN2),Math.ceil(Math.log(a/x)/Math.LN2));for(let t=v;t>=0;t--)d.push(Math.pow(2,t))}else{const t=Math.max(...d);v=Math.round(Math.log(t)/Math.LN2)}else if(y=o,x=a,d=[],p){r.sort((function(t,e){return t[0]-e[0]})),v=-1;const t=[];for(let e=0;e<r.length;e++){const i=o/r[e][0];d.length>0&&d[d.length-1]==i?t.push(e):(d.push(i),v++)}if(t.length>0)for(let e=0;e<t.length;e++)r.splice(t[e]-e,1)}else d.push(1),r.push([o,a]),v=0;const S=new Vu({tileSize:[y,x],extent:f,origin:ye(f),resolutions:d}),E=Og.bind(null,Wl(l||256).map((function(t){return t*h})));super({attributions:e.attributions,attributionsCollapsible:e.attributionsCollapsible,cacheSize:e.cacheSize,crossOrigin:e.crossOrigin,interpolate:e.interpolate,projection:e.projection,reprojectionErrorThreshold:e.reprojectionErrorThreshold,state:e.state,tileClass:E,tileGrid:S,tilePixelRatio:e.tilePixelRatio,tileUrlFunction:function(t,e,s){let l,h;const f=t[0];if(f>v)return;const S=t[1],E=t[2],w=d[f];if(!(void 0===S||void 0===E||void 0===w||S<0||Math.ceil(o/w/y)<=S||E<0||Math.ceil(a/w/x)<=E)){if(m||_){const t=S*y*w,e=E*x*w;let i=y*w,r=x*w,s=y,c=x;if(t+i>o&&(i=o-t),e+r>a&&(r=a-e),t+y*w>o&&(s=Math.floor((o-t+w-1)/w)),e+x*w>a&&(c=Math.floor((a-e+w-1)/w)),0==t&&i==o&&0==e&&r==a)l="full";else if(!m||g.includes("regionByPx"))l=t+","+e+","+i+","+r;else if(g.includes("regionByPct")){l="pct:"+Dg(t/o*100)+","+Dg(e/a*100)+","+Dg(i/o*100)+","+Dg(r/a*100)}n!=Pg||m&&!g.includes("sizeByWh")?!m||g.includes("sizeByW")?h=s+",":g.includes("sizeByH")?h=","+c:g.includes("sizeByWh")?h=s+","+c:g.includes("sizeByPct")&&(h="pct:"+Dg(100/w)):h=s+","+c}else if(l="full",p){const t=r[f][0],e=r[f][1];h=n==Pg?t==o&&e==a?"max":t+","+e:t==o?"full":t+","}else h=n==Pg?"max":"full";return i+l+"/"+h+"/0/"+u+"."+c}},transition:e.transition}),this.zDirection=e.zDirection}},bP.source.Image=Bg,bP.source.Image.ImageSourceEvent=Ug,bP.source.Image.defaultImageLoadFunction=zg,bP.source.Image.getRequestExtent=Xg,bP.source.ImageArcGISRest=class extends Bg{constructor(t){super({attributions:(t=t||{}).attributions,interpolate:t.interpolate,projection:t.projection,resolutions:t.resolutions}),this.crossOrigin_=void 0!==t.crossOrigin?t.crossOrigin:null,this.referrerPolicy_=t.referrerPolicy,this.hidpi_=void 0===t.hidpi||t.hidpi,this.url_=t.url,this.imageLoadFunction_=void 0!==t.imageLoadFunction?t.imageLoadFunction:zg,this.params_=Object.assign({},t.params),this.imageSize_=[0,0],this.renderedRevision_=0,this.ratio_=void 0!==t.ratio?t.ratio:1.5,this.loaderProjection_=null}getParams(){return this.params_}getImageInternal(t,e,i,n){return void 0===this.url_?null:(this.loader&&this.loaderProjection_===n||(this.loaderProjection_=n,this.loader=$g({crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_,params:this.params_,projection:n,hidpi:this.hidpi_,url:this.url_,ratio:this.ratio_,load:(t,e)=>(this.image.setImage(t),this.imageLoadFunction_(this.image,e),js(t))})),super.getImageInternal(t,e,i,n))}getImageLoadFunction(){return this.imageLoadFunction_}getUrl(){return this.url_}setImageLoadFunction(t){this.imageLoadFunction_=t,this.changed()}setUrl(t){t!=this.url_&&(this.url_=t,this.loader=null,this.changed())}setParams(t){this.params_=Object.assign({},t),this.changed()}updateParams(t){Object.assign(this.params_,t),this.changed()}changed(){this.image=null,super.changed()}},bP.source.ImageCanvas=class extends Bg{constructor(t){super({attributions:(t=t||{}).attributions,interpolate:t.interpolate,projection:t.projection,resolutions:t.resolutions,state:t.state}),this.canvasFunction_=t.canvasFunction,this.canvas_=null,this.renderedRevision_=0,this.ratio_=void 0!==t.ratio?t.ratio:1.5}getImageInternal(t,e,i,n){e=this.findNearestResolution(e);let r=this.canvas_;if(r&&this.renderedRevision_==this.getRevision()&&r.getResolution()==e&&r.getPixelRatio()==i&&Wt(r.getExtent(),t))return r;Te(t=t.slice(),this.ratio_);const s=[ve(t)/e*i,_e(t)/e*i],o=this.canvasFunction_.call(this,t,e,i,s,n);return o&&(r=new Us(t,e,i,o)),this.canvas_=r,this.renderedRevision_=this.getRevision(),r}},bP.source.ImageMapGuide=class extends Bg{constructor(t){super({interpolate:t.interpolate,projection:t.projection,resolutions:t.resolutions}),this.crossOrigin_=void 0!==t.crossOrigin?t.crossOrigin:null,this.referrerPolicy_=t.referrerPolicy,this.displayDpi_=void 0!==t.displayDpi?t.displayDpi:96,this.params_=Object.assign({},t.params),this.url_=t.url,this.imageLoadFunction_=void 0!==t.imageLoadFunction?t.imageLoadFunction:zg,this.hidpi_=void 0===t.hidpi||t.hidpi,this.metersPerUnit_=void 0!==t.metersPerUnit?t.metersPerUnit:1,this.ratio_=void 0!==t.ratio?t.ratio:1,this.useOverlay_=void 0!==t.useOverlay&&t.useOverlay,this.renderedRevision_=0,this.loaderProjection_=null}getParams(){return this.params_}getImageInternal(t,e,i,n){return void 0===this.url_?null:(this.loader&&this.loaderProjection_===n||(this.loaderProjection_=n,this.loader=Zg({crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_,params:this.params_,hidpi:this.hidpi_,metersPerUnit:this.metersPerUnit_,url:this.url_,useOverlay:this.useOverlay_,ratio:this.ratio_,load:(t,e)=>(this.image.setImage(t),this.imageLoadFunction_(this.image,e),js(t))})),super.getImageInternal(t,e,i,n))}getImageLoadFunction(){return this.imageLoadFunction_}setParams(t){this.params_=Object.assign({},t),this.changed()}updateParams(t){Object.assign(this.params_,t),this.changed()}setImageLoadFunction(t){this.imageLoadFunction_=t,this.changed()}changed(){this.image=null,super.changed()}},bP.source.ImageStatic=class extends Bg{constructor(t){const e=void 0!==t.crossOrigin?t.crossOrigin:null,i=void 0!==t.imageLoadFunction?t.imageLoadFunction:zg;super({attributions:t.attributions,interpolate:t.interpolate,projection:En(t.projection)}),this.url_=t.url,this.imageExtent_=t.imageExtent,this.image=null,this.image=new Ds(this.imageExtent_,void 0,1,Yg({url:t.url,imageExtent:t.imageExtent,crossOrigin:e,referrerPolicy:t.referrerPolicy,load:(t,e)=>(this.image.setImage(t),i(this.image,e),js(t))})),this.image.addEventListener(n,this.handleImageChange.bind(this))}getImageExtent(){return this.imageExtent_}getImageInternal(t,e,i,n){return Se(t,this.image.getExtent())?this.image:null}getUrl(){return this.url_}},bP.source.ImageTile=ef,bP.source.ImageWMS=class extends Bg{constructor(t){super({attributions:(t=t||{}).attributions,interpolate:t.interpolate,projection:t.projection,resolutions:t.resolutions}),this.crossOrigin_=void 0!==t.crossOrigin?t.crossOrigin:null,this.referrerPolicy_=t.referrerPolicy,this.url_=t.url,this.imageLoadFunction_=void 0!==t.imageLoadFunction?t.imageLoadFunction:zg,this.params_=Object.assign({},t.params),this.serverType_=t.serverType,this.hidpi_=void 0===t.hidpi||t.hidpi,this.renderedRevision_=0,this.ratio_=void 0!==t.ratio?t.ratio:1.5,this.loaderProjection_=null}getFeatureInfoUrl(t,e,i,n){const r=En(i),s=this.getProjection();s&&s!==r&&(e=Lu(s,r,t,e),t=On(t,r,s));return hf({url:this.url_,params:{...this.params_,...n},projection:s||r},t,e)}getLegendUrl(t,e){return cf({url:this.url_,params:{...this.params_,...e}},t)}getParams(){return this.params_}getImageInternal(t,e,i,n){return void 0===this.url_?null:(this.loader&&this.loaderProjection_===n||(this.loaderProjection_=n,this.loader=lf({crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_,params:this.params_,projection:n,serverType:this.serverType_,hidpi:this.hidpi_,url:this.url_,ratio:this.ratio_,load:(t,e)=>(this.image.setImage(t),this.imageLoadFunction_(this.image,e),js(t))})),super.getImageInternal(t,e,i,n))}getImageLoadFunction(){return this.imageLoadFunction_}getUrl(){return this.url_}setImageLoadFunction(t){this.imageLoadFunction_=t,this.changed()}setUrl(t){t!=this.url_&&(this.url_=t,this.loader=null,this.changed())}setParams(t){this.params_=Object.assign({},t),this.loader=null,this.changed()}updateParams(t){Object.assign(this.params_,t),this.changed()}changed(){this.image=null,super.changed()}},bP.source.OGCMap=class extends Bg{constructor(t){super({attributions:(t=t||{}).attributions,interpolate:t.interpolate,projection:t.projection,resolutions:t.resolutions}),this.crossOrigin_=void 0!==t.crossOrigin?t.crossOrigin:null,this.referrerPolicy_=t.referrerPolicy,this.url_=t.url,this.imageLoadFunction_=void 0!==t.imageLoadFunction?t.imageLoadFunction:zg,this.params_=Object.assign({},t.params),this.hidpi_=void 0===t.hidpi||t.hidpi,this.renderedRevision_=0,this.ratio_=void 0!==t.ratio?t.ratio:1.5,this.loaderProjection_=null}getParams(){return this.params_}getImageInternal(t,e,i,n){return void 0===this.url_?null:(this.loader&&this.loaderProjection_===n||(this.loaderProjection_=n,this.loader=a_({crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_,params:this.params_,projection:n,hidpi:this.hidpi_,url:this.url_,ratio:this.ratio_,load:(t,e)=>(this.image.setImage(t),this.imageLoadFunction_(this.image,e),js(t))})),super.getImageInternal(t,e,i,n))}getImageLoadFunction(){return this.imageLoadFunction_}getUrl(){return this.url_}setImageLoadFunction(t){this.imageLoadFunction_=t,this.changed()}setUrl(t){t!=this.url_&&(this.url_=t,this.loader=null,this.changed())}setParams(t){this.params_=Object.assign({},t),this.loader=null,this.changed()}updateParams(t){Object.assign(this.params_,t),this.changed()}changed(){this.image=null,super.changed()}},bP.source.OGCMapTile=class extends wd{constructor(t){super({attributions:t.attributions,cacheSize:t.cacheSize,crossOrigin:t.crossOrigin,referrerPolicy:t.referrerPolicy,interpolate:t.interpolate,projection:t.projection,reprojectionErrorThreshold:t.reprojectionErrorThreshold,state:"loading",tileLoadFunction:t.tileLoadFunction,wrapX:void 0===t.wrapX||t.wrapX,transition:t.transition});mf({url:t.url,projection:this.getProjection(),mediaType:t.mediaType,context:t.context||null,collections:t.collections}).then(this.handleTileSetInfo_.bind(this)).catch(this.handleError_.bind(this))}handleTileSetInfo_(t){this.tileGrid=t.grid,this.projection=t.projection,this.setTileUrlFunction(t.urlFunction,t.urlTemplate),this.setState("ready")}handleError_(t){Ke(t),this.setState("error")}},bP.source.OGCVectorTile=class extends yf{constructor(t){super({attributions:t.attributions,attributionsCollapsible:t.attributionsCollapsible,cacheSize:t.cacheSize,format:t.format,overlaps:t.overlaps,projection:t.projection,tileClass:t.tileClass,transition:t.transition,wrapX:t.wrapX,zDirection:t.zDirection,state:"loading"});mf({url:t.url,projection:this.getProjection(),mediaType:t.mediaType,supportedMediaTypes:t.format.supportedMediaTypes,context:t.context||null,collections:t.collections}).then(this.handleTileSetInfo_.bind(this)).catch(this.handleError_.bind(this))}handleTileSetInfo_(t){this.tileGrid=t.grid,this.projection=t.projection,this.setTileUrlFunction(t.urlFunction,t.urlTemplate),this.setState("ready")}handleError_(t){Ke(t),this.setState("error")}},bP.source.OSM=class extends bd{constructor(t){let e;e=void 0!==(t=t||{}).attributions?t.attributions:[vf];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})}},bP.source.OSM.ATTRIBUTION=vf,bP.source.Raster=Xf,bP.source.Raster.Processor=jf,bP.source.Raster.RasterSourceEvent=zf,bP.source.SentinelHub=class extends dg{constructor(t){const e=t||{};super({state:"loading",projection:e.projection,attributionsCollapsible:e.attributionsCollapsible,interpolate:e.interpolate,tileSize:e.tileSize||l_,wrapX:void 0===e.wrapX||e.wrapX,transition:e.transition}),this.setLoader(((t,e,i)=>this.loadTile_(t,e,i,1))),this.error_=null,this.evalscript_="",this.inputData_=null,this.processUrl_=e.url||"https://services.sentinel-hub.com/api/v1/process",this.token_="",this.tokenRenewalId_,e.auth&&this.setAuth(e.auth),e.data&&this.setData(e.data),e.evalscript&&this.setEvalscript(e.evalscript)}async setAuth(t){if(clearTimeout(this.tokenRenewalId_),"string"==typeof t)return this.token_=t,void this.fireWhenReady_();let e,i;try{e=await async function(t){const e=t.tokenUrl||"https://services.sentinel-hub.com/auth/realms/main/protocol/openid-connect/token",i=new URLSearchParams;i.append("grant_type","client_credentials"),i.append("client_id",t.clientId),i.append("client_secret",t.clientSecret);const n={method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:i},r=await fetch(e,n);if(!r.ok){if(401===r.status)throw new Error("Bad client id or secret");throw new Error("Failed to get token")}return(await r.json()).access_token}(t),i=h_(e)}catch(t){return this.error_=t,void this.setState("error")}this.token_=e;const n=1e3*i.exp,r=Math.max(n-Date.now()-6e4,1);this.tokenRenewalId_=setTimeout((()=>this.setAuth(t)),r),this.fireWhenReady_()}setData(t){this.inputData_=t,this.fireWhenReady_()}setEvalscript(t){let e;if("string"==typeof t)e=t;else try{e=function(t){return`//VERSION=${t.version||"3"}\n ${u_("setup",t.setup)}\n ${u_("evaluatePixel",t.evaluatePixel)}\n ${u_("updateOutput",t.updateOutput)}\n `}(t)}catch(t){return this.error_=t,void this.setState("error")}this.evalscript_=e,this.fireWhenReady_()}fireWhenReady_(){if(!this.token_||!this.evalscript_||!this.inputData_)return;this.setKey(this.getKeyForConfig_());"ready"!==this.getState()?this.setState("ready"):this.changed()}getKeyForConfig_(){return this.token_+this.evalscript_+JSON.stringify(this.inputData_)}async loadTile_(t,e,i,n){const r=this.getTileGrid().getTileCoordExtent([t,e,i]),s=this.getTileSize(t),o={input:{bounds:{bbox:r,properties:{crs:c_(this.getProjection())}},data:this.inputData_},output:{width:s[0],height:s[1]},evalscript:this.evalscript_},a={method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.token_}`,"Access-Control-Request-Headers":"Retry-After"},body:JSON.stringify(o),credentials:"include"},l=await fetch(this.processUrl_,a);if(!l.ok){if(429===l.status&&n<9){const r=500*2**n;return await(h=r,new Promise((t=>setTimeout(t,h)))),this.loadTile_(e,i,t,n+1)}throw new Error(`Failed to get tile: ${l.statusText}`)}var h;return async function(t){const e=await t.blob();return new Promise(((t,i)=>{const n=new Image,r=URL.createObjectURL(e);n.onload=()=>{URL.revokeObjectURL(r),t(n)},n.onerror=()=>{URL.revokeObjectURL(r),i(new Error("Failed to load image"))},n.src=r}))}(l)}getError(){return this.error_}disposeInternal(){clearTimeout(this.tokenRenewalId_),super.disposeInternal()}},bP.source.SentinelHub.getProjectionIdentifier=c_,bP.source.SentinelHub.parseTokenClaims=h_,bP.source.SentinelHub.serializeFunction=u_,bP.source.Source=pd,bP.source.StadiaMaps=class extends bd{constructor(t){const e=t.layer.indexOf("-"),i=-1==e?t.layer:t.layer.slice(0,e),n=Yf[i]||{minZoom:0,maxZoom:20,retina:!0},r=Zf[t.layer],s=t.apiKey?"?api_key="+t.apiKey:"",o=n.retina&&t.retina?"@2x":"",a=void 0!==t.url?t.url:"https://tiles.stadiamaps.com/tiles/"+t.layer+"/{z}/{x}/{y}"+o+"."+r.extension+s,l=['© <a href="https://www.stadiamaps.com/" target="_blank">Stadia Maps</a>','© <a href="https://openmaptiles.org/" target="_blank">OpenMapTiles</a>',vf];t.layer.startsWith("stamen_")&&l.splice(1,0,'© <a href="https://stamen.com/" target="_blank">Stamen Design</a>'),super({attributions:l,cacheSize:t.cacheSize,crossOrigin:"anonymous",interpolate:t.interpolate,maxZoom:void 0!==t.maxZoom?t.maxZoom:n.maxZoom,minZoom:void 0!==t.minZoom?t.minZoom:n.minZoom,reprojectionErrorThreshold:t.reprojectionErrorThreshold,tileLoadFunction:t.tileLoadFunction,transition:t.transition,url:a,tilePixelRatio:o?2:1,wrapX:t.wrapX,zDirection:t.zDirection})}},bP.source.Tile=md,bP.source.Tile.TileSourceEvent=yd,bP.source.TileArcGISRest=class extends wd{constructor(t){super({attributions:(t=t||{}).attributions,cacheSize:t.cacheSize,crossOrigin:t.crossOrigin,referrerPolicy:t.referrerPolicy,interpolate:t.interpolate,projection:t.projection,reprojectionErrorThreshold:t.reprojectionErrorThreshold,tileGrid:t.tileGrid,tileLoadFunction:t.tileLoadFunction,url:t.url,urls:t.urls,wrapX:void 0===t.wrapX||t.wrapX,transition:t.transition,zDirection:t.zDirection}),this.params_=Object.assign({},t.params),this.hidpi_=void 0===t.hidpi||t.hidpi,this.tmpExtent_=[1/0,1/0,-1/0,-1/0],this.setKey(this.getKeyForParams_())}getKeyForParams_(){let t=0;const e=[];for(const i in this.params_)e[t++]=i+"-"+this.params_[i];return e.join("/")}getParams(){return this.params_}getRequestUrl_(t,e,i,n,r,s){const o=this.urls;if(!o)return;let a;if(1==o.length)a=o[0];else{a=o[De(Uu(t),o.length)]}return Vg(a,i,(this.tileGrid||this.getTileGridForProjection(r)).getResolution(t[0]),n,r,s)}getTilePixelRatio(t){return this.hidpi_?t:1}setParams(t){this.params_=Object.assign({},t),this.setKey(this.getKeyForParams_())}updateParams(t){Object.assign(this.params_,t),this.setKey(this.getKeyForParams_())}tileUrlFunction(t,e,i){let n=this.getTileGrid();if(n||(n=this.getTileGridForProjection(i)),n.getResolutions().length<=t[0])return;1==e||this.hidpi_||(e=1);const r=n.getTileCoordExtent(t,this.tmpExtent_);let s=Wl(n.getTileSize(t[0]),this.tmpSize);1!=e&&(s=$l(s,e,this.tmpSize));const o={F:"image",FORMAT:"PNG32",TRANSPARENT:!0};return Object.assign(o,this.params_),this.getRequestUrl_(t,s,r,e,i,o)}},bP.source.TileDebug=class extends ef{constructor(t){const e=(t=t||{}).template||"z:{z} x:{x} y:{y}",i=t.source,r=t.color||"grey";super({transition:0,wrapX:void 0!==t.wrapX?t.wrapX:void 0!==i?i.getWrapX():void 0});const s=()=>{this.projection=void 0!==t.projection?En(t.projection):void 0!==i?i.getProjection():this.projection,this.tileGrid=void 0!==t.tileGrid?t.tileGrid:void 0!==i?i.getTileGrid():this.tileGrid,this.zDirection=void 0!==t.zDirection?t.zDirection:void 0!==i?i.zDirection:this.zDirection,i instanceof dg&&(this.transformMatrix=i.transformMatrix?.slice()||null);const n=this.tileGrid;n&&this.setTileSizes(n.getResolutions().map(((t,e)=>Wl(n.getTileSize(e)).map((t=>Math.max(Math.floor(t),1)))))),this.setLoader(((t,i,n,s)=>{const o=sd(e,t,i,n,s.maxY),[a,l]=this.getTileSize(t),h=ft(a,l);return h.strokeStyle=r,h.strokeRect(.5,.5,a+.5,l+.5),h.fillStyle=r,h.strokeStyle="white",h.textAlign="center",h.textBaseline="middle",h.font="24px sans-serif",h.lineWidth=4,h.strokeText(o,a/2,l/2,a),h.fillText(o,a/2,l/2,a),Promise.resolve(h.canvas)})),this.setState("ready")};if(void 0===i||"ready"===i.getState())s();else{const t=()=>{"ready"===i.getState()&&(i.removeEventListener(n,t),s())};i.addEventListener(n,t)}}},bP.source.TileImage=wd,bP.source.TileImage.defaultTileLoadFunction=Td,bP.source.TileJSON=class extends wd{constructor(t){if(super({attributions:t.attributions,cacheSize:t.cacheSize,crossOrigin:t.crossOrigin,interpolate:t.interpolate,projection:En("EPSG:3857"),reprojectionErrorThreshold:t.reprojectionErrorThreshold,state:"loading",tileLoadFunction:t.tileLoadFunction,wrapX:void 0===t.wrapX||t.wrapX,transition:t.transition,zDirection:t.zDirection}),this.tileJSON_=null,this.tileSize_=t.tileSize,t.url)if(t.jsonp)du(t.url,this.handleTileJSONResponse.bind(this),this.handleTileJSONError.bind(this));else{const e=new XMLHttpRequest;e.addEventListener("load",this.onXHRLoad_.bind(this)),e.addEventListener("error",this.onXHRError_.bind(this)),e.open("GET",t.url),e.send()}else{if(!t.tileJSON)throw new Error("Either `url` or `tileJSON` options must be provided");this.handleTileJSONResponse(t.tileJSON)}}onXHRLoad_(t){const e=t.target;if(!e.status||e.status>=200&&e.status<300){let t;try{t=JSON.parse(e.responseText)}catch{return void this.handleTileJSONError()}this.handleTileJSONResponse(t)}else this.handleTileJSONError()}onXHRError_(t){this.handleTileJSONError()}getTileJSON(){return this.tileJSON_}handleTileJSONResponse(t){const e=En("EPSG:4326"),i=this.getProjection();let n;if(void 0!==t.bounds){const r=Ln(e,i);n=be(t.bounds,r)}const r=Qu(i),s=t.minzoom||0,o=Ku({extent:r,maxZoom:t.maxzoom||22,minZoom:s,tileSize:this.tileSize_});if(this.tileGrid=o,this.tileUrlFunction=hd(t.tiles,o),t.attribution&&!this.getAttributions()){const e=void 0!==n?n:r;this.setAttributions((function(i){return Se(e,i.extent)?[t.attribution]:null}))}this.tileJSON_=t,this.setState("ready")}handleTileJSONError(){this.setState("error")}},bP.source.TileWMS=class extends wd{constructor(t){t=t||{};const e=Object.assign({},t.params);super({attributions:t.attributions,attributionsCollapsible:t.attributionsCollapsible,cacheSize:t.cacheSize,crossOrigin:t.crossOrigin,interpolate:t.interpolate,projection:t.projection,reprojectionErrorThreshold:t.reprojectionErrorThreshold,tileClass:t.tileClass,tileGrid:t.tileGrid,tileLoadFunction:t.tileLoadFunction,url:t.url,urls:t.urls,wrapX:void 0===t.wrapX||t.wrapX,transition:t.transition,zDirection:t.zDirection}),this.gutter_=void 0!==t.gutter?t.gutter:0,this.params_=e,this.v13_=!0,this.serverType_=t.serverType,this.hidpi_=void 0===t.hidpi||t.hidpi,this.tmpExtent_=[1/0,1/0,-1/0,-1/0],this.updateV13_(),this.setKey(this.getKeyForParams_())}getFeatureInfoUrl(t,e,i,n){const r=En(i),s=this.getProjection()||r;let o=this.getTileGrid();o||(o=this.getTileGridForProjection(s));const a=On(t,r,s),l=Lu(s,r,t,e),h=o.getZForResolution(l,this.zDirection),c=o.getResolution(h),u=o.getTileCoordForCoordAndZ(a,h);if(o.getResolutions().length<=u[0])return;let d=o.getTileCoordExtent(u,this.tmpExtent_);const g=this.gutter_;0!==g&&(d=zt(d,c*g,d));const f={QUERY_LAYERS:this.params_.LAYERS};Object.assign(f,af(this.params_,"GetFeatureInfo"),n);const p=Math.floor((a[0]-d[0])/c),_=Math.floor((d[3]-a[1])/c);return f[this.v13_?"I":"X"]=p,f[this.v13_?"J":"Y"]=_,this.getRequestUrl_(u,d,1,s||r,f)}getLegendUrl(t,e){if(void 0===this.urls[0])return;const i={SERVICE:"WMS",VERSION:nf,REQUEST:"GetLegendGraphic",FORMAT:"image/png"};if(void 0===e||void 0===e.LAYER){const t=this.params_.LAYERS;if(!(!Array.isArray(t)||1===t.length))return;i.LAYER=t}if(void 0!==t){const e=this.getProjection()?this.getProjection().getMetersPerUnit():1,n=28e-5;i.SCALE=t*e/n}return Object.assign(i,e),td(this.urls[0],i)}getGutter(){return this.gutter_}getParams(){return this.params_}getRequestUrl_(t,e,i,n,r){const s=this.urls;if(!s)return;let o;if(1==s.length)o=s[0];else{o=s[De(Uu(t),s.length)]}return of(e,(this.tileGrid||this.getTileGridForProjection(n)).getResolution(t[0]),i,n,o,r,this.serverType_)}getTilePixelRatio(t){return this.hidpi_&&void 0!==this.serverType_?t:1}getKeyForParams_(){let t=0;const e=[];for(const i in this.params_)e[t++]=i+"-"+this.params_[i];return e.join("/")}setParams_(t){this.params_=t,this.updateV13_(),this.setKey(this.getKeyForParams_())}setParams(t){this.setParams_(Object.assign({},t))}updateParams(t){this.setParams_(Object.assign(this.params_,t))}updateV13_(){const t=this.params_.VERSION||nf;this.v13_=Je(t,"1.3")>=0}tileUrlFunction(t,e,i){let n=this.getTileGrid();if(n||(n=this.getTileGridForProjection(i)),n.getResolutions().length<=t[0])return;1==e||this.hidpi_&&void 0!==this.serverType_||(e=1);const r=n.getResolution(t[0]);let s=n.getTileCoordExtent(t,this.tmpExtent_);const o=this.gutter_;0!==o&&(s=zt(s,r*o,s));const a=Object.assign({},af(this.params_,"GetMap"));return this.getRequestUrl_(t,s,e,i,a)}},bP.source.UTFGrid=class extends md{constructor(t){if(super({projection:En("EPSG:3857"),state:"loading",wrapX:void 0===t.wrapX||t.wrapX,zDirection:t.zDirection}),this.preemptive_=void 0===t.preemptive||t.preemptive,this.tileUrlFunction_=ud,this.template_=void 0,this.jsonp_=t.jsonp||!1,this.tileCache_=new Du(512),t.url)if(this.jsonp_)du(t.url,this.handleTileJSONResponse.bind(this),this.handleTileJSONError.bind(this));else{const e=new XMLHttpRequest;e.addEventListener("load",this.onXHRLoad_.bind(this)),e.addEventListener("error",this.onXHRError_.bind(this)),e.open("GET",t.url),e.send()}else{if(!t.tileJSON)throw new Error("Either `url` or `tileJSON` options must be provided");this.handleTileJSONResponse(t.tileJSON)}}onXHRLoad_(t){const e=t.target;if(!e.status||e.status>=200&&e.status<300){let t;try{t=JSON.parse(e.responseText)}catch{return void this.handleTileJSONError()}this.handleTileJSONResponse(t)}else this.handleTileJSONError()}onXHRError_(t){this.handleTileJSONError()}getTemplate(){return this.template_}forDataAtCoordinateAndResolution(t,e,i,n){if(this.tileGrid){const r=this.tileGrid.getZForResolution(e,this.zDirection),s=this.tileGrid.getTileCoordForCoordAndZ(t,r),o=this.getTile(s[0],s[1],s[2],1,this.getProjection());o.getState()==Y&&o.load(),o.forDataAtCoordinate(t,i,n)}else!0===n?setTimeout((function(){i(null)}),0):i(null)}handleTileJSONError(){this.setState("error")}handleTileJSONResponse(t){const e=En("EPSG:4326"),i=this.getProjection();let n;if(void 0!==t.bounds){const r=Ln(e,i);n=be(t.bounds,r)}const r=Qu(i),s=t.minzoom||0,o=Ku({extent:r,maxZoom:t.maxzoom||22,minZoom:s});this.tileGrid=o,this.template_=t.template;const a=t.grids;if(a){if(this.tileUrlFunction_=hd(a,o),t.attribution){const e=void 0!==n?n:r;this.setAttributions((function(i){return Se(e,i.extent)?[t.attribution]:null}))}this.setState("ready")}else this.setState("error")}getTile(t,e,i,n,r){const s=[t,e,i],o=this.getTileCoordForTileUrlFunction(s,r),a=this.tileUrlFunction_(o,n,r),l=`${this.getKey()},${ku(t,e,i)}`;if(this.tileCache_.containsKey(l))return this.tileCache_.get(l);this.tileCache_.expireCache();const h=new Hf(s,void 0!==a?Y:J,void 0!==a?a:"",this.tileGrid.getTileCoordExtent(s),this.preemptive_,this.jsonp_);return this.tileCache_.set(l,h),h}},bP.source.UTFGrid.CustomTile=Hf,bP.source.UrlTile=Ed,bP.source.Vector=qd,bP.source.Vector.VectorSourceEvent=Kd,bP.source.VectorTile=yf,bP.source.VectorTile.defaultLoadFunction=xf,bP.source.WMTS=class extends wd{constructor(t){const e=void 0!==t.requestEncoding?t.requestEncoding:"KVP",i=t.tileGrid;let n=t.urls;void 0===n&&void 0!==t.url&&(n=ad(t.url)),super({attributions:t.attributions,attributionsCollapsible:t.attributionsCollapsible,cacheSize:t.cacheSize,crossOrigin:t.crossOrigin,referrerPolicy:t.referrerPolicy,interpolate:t.interpolate,projection:t.projection,reprojectionErrorThreshold:t.reprojectionErrorThreshold,tileClass:t.tileClass,tileGrid:i,tileLoadFunction:t.tileLoadFunction,tilePixelRatio:t.tilePixelRatio,urls:n,wrapX:void 0!==t.wrapX&&t.wrapX,transition:t.transition,zDirection:t.zDirection}),this.version_=void 0!==t.version?t.version:"1.0.0",this.format_=void 0!==t.format?t.format:"image/jpeg",this.dimensions_=void 0!==t.dimensions?t.dimensions:{},this.layer_=t.layer,this.matrixSet_=t.matrixSet,this.style_=t.style,this.requestEncoding_=e,this.setKey(this.getKeyForDimensions_()),n&&n.length>0&&(this.tileUrlFunction=cd(n.map(this.createFromWMTSTemplate.bind(this))))}setUrls(t){this.urls=t;const e=t.join("\n");this.setTileUrlFunction(cd(t.map(this.createFromWMTSTemplate.bind(this))),e)}getDimensions(){return this.dimensions_}getFormat(){return this.format_}getLayer(){return this.layer_}getMatrixSet(){return this.matrixSet_}getRequestEncoding(){return this.requestEncoding_}getStyle(){return this.style_}getVersion(){return this.version_}getKeyForDimensions_(){const t=this.urls?this.urls.slice(0):[];for(const e in this.dimensions_)t.push(e+"-"+this.dimensions_[e]);return t.join("/")}updateDimensions(t){Object.assign(this.dimensions_,t),this.setKey(this.getKeyForDimensions_())}createFromWMTSTemplate(t){const e=this.requestEncoding_,i={layer:this.layer_,style:this.style_,tilematrixset:this.matrixSet_};"KVP"==e&&Object.assign(i,{Service:"WMTS",Request:"GetTile",Version:this.version_,Format:this.format_}),t="KVP"==e?td(t,i):t.replace(/\{(\w+?)\}/g,(function(t,e){return e.toLowerCase()in i?i[e.toLowerCase()]:t}));const n=this.tileGrid,r=this.dimensions_;return function(i,s,o){if(!i)return;const a={TileMatrix:n.getMatrixId(i[0]),TileCol:i[1],TileRow:i[2]};Object.assign(a,r);let l=t;return l="KVP"==e?td(l,a):l.replace(/\{(\w+?)\}/g,(function(t,e){return encodeURIComponent(a[e])})),l}}},bP.source.WMTS.optionsFromCapabilities=function(t,e){const i=t.Contents.Layer,n=i?.find((function(t){return t.Identifier==e.layer}));if(!n)return null;const r=t.Contents.TileMatrixSet;let s;s=n.TileMatrixSetLink.length>1?"projection"in e?n.TileMatrixSetLink.findIndex((function(t){const i=r.find((function(e){return e.Identifier==t.TileMatrixSet})).SupportedCRS,n=En(i),s=En(e.projection);return n&&s?Fn(n,s):i==e.projection})):n.TileMatrixSetLink.findIndex((function(t){return t.TileMatrixSet==e.matrixSet})):0,s<0&&(s=0);const o=n.TileMatrixSetLink[s].TileMatrixSet,a=n.TileMatrixSetLink[s].TileMatrixSetLimits;let l=n.Format[0];"format"in e&&(l=e.format),s=n.Style.findIndex((function(t){return"style"in e?t.Title==e.style:t.isDefault})),s<0&&(s=0);const h=n.Style[s].Identifier,c={};"Dimension"in n&&n.Dimension.forEach((function(t,e,i){const n=t.Identifier;let r=t.Default;void 0===r&&(r=t.Value[0]),c[n]=r}));const u=t.Contents.TileMatrixSet.find((function(t){return t.Identifier==o}));let d;const g=u.SupportedCRS;if(g&&(d=En(g)),"projection"in e){const t=En(e.projection);t&&(d&&!Fn(t,d)||(d=t))}let f=!1;const p=d.getAxisOrientation().startsWith("ne");let _=u.TileMatrix[0],m={MinTileCol:0,MinTileRow:0,MaxTileCol:_.MatrixWidth-1,MaxTileRow:_.MatrixHeight-1};if(a){m=a[a.length-1];const t=u.TileMatrix.find((t=>t.Identifier===m.TileMatrix||u.Identifier+":"+t.Identifier===m.TileMatrix));t&&(_=t)}const y=n.BoundingBox?.find((t=>En(t.crs)&&Fn(En(t.crs),d))),x=28e-5*_.ScaleDenominator/d.getMetersPerUnit(),v=p?[_.TopLeftCorner[1],_.TopLeftCorner[0]]:_.TopLeftCorner,S=_.TileWidth*x,E=_.TileHeight*x;let w=y?.extent??u.BoundingBox;w&&p&&(w=[w[1],w[0],w[3],w[2]]);let T=[v[0]+S*m.MinTileCol,v[1]-E*(1+m.MaxTileRow),v[0]+S*(1+m.MaxTileCol),v[1]-E*m.MinTileRow];if(void 0!==w&&!Wt(w,T)){const t=n.WGS84BoundingBox,e=En("EPSG:4326").getExtent();if(T=w,t)f=t[0]===e[0]&&t[2]===e[2];else{const t=Dn(w,u.SupportedCRS,"EPSG:4326");f=t[0]-1e-10<=e[0]&&t[2]+1e-10>=e[2]}}const C=Wu(u,T,a),b=[];let R=e.requestEncoding;if(R=void 0!==R?R:"","OperationsMetadata"in t&&"GetTile"in t.OperationsMetadata){const e=t.OperationsMetadata.GetTile.DCP.HTTP.Get;for(let t=0,i=e.length;t<i;++t)if(e[t].Constraint){const i=e[t].Constraint.find((function(t){return"GetEncoding"==t.name})).AllowedValues.Value;if(""===R&&(R=i[0]),"KVP"!==R)break;i.includes("KVP")&&b.push(e[t].href)}else e[t].href&&(R="KVP",b.push(e[t].href))}return 0===b.length&&(R="REST",n.ResourceURL.forEach((function(t){"tile"===t.resourceType&&(l=t.format,b.push(t.template))}))),{urls:b,layer:e.layer,matrixSet:o,format:l,projection:d,requestEncoding:R,tileGrid:C,style:h,dimensions:c,wrapX:f,crossOrigin:e.crossOrigin}},bP.source.XYZ=bd,bP.source.Zoomify=class extends wd{constructor(t){const e=t.size,i=void 0!==t.tierSizeCalculation?t.tierSizeCalculation:"default",n=t.tilePixelRatio||1,r=e[0],s=e[1],o=[],a=t.tileSize||Co;let l=a*n;switch(i){case"default":for(;r>l||s>l;)o.push([Math.ceil(r/l),Math.ceil(s/l)]),l+=l;break;case"truncated":let t=r,e=s;for(;t>l||e>l;)o.push([Math.ceil(t/l),Math.ceil(e/l)]),t>>=1,e>>=1;break;default:throw new Error("Unknown `tierSizeCalculation` configured")}o.push([1,1]),o.reverse();const h=[n],c=[0];for(let t=1,e=o.length;t<e;t++)h.push(n<<t),c.push(o[t-1][0]*o[t-1][1]+c[t-1]);h.reverse();const u=new Vu({tileSize:a,extent:t.extent||[0,-s,r,0],resolutions:h});let d=t.url;!d||d.includes("{TileGroup}")||d.includes("{tileIndex}")||(d+="{TileGroup}/{z}-{x}-{y}.jpg");const g=ad(d);let f=a*n;const p=cd(g.map((function(t){return function(e,i,n){if(!e)return;const r=e[0],s=e[1],a=e[2],l=s+a*o[r][0],h={z:r,x:s,y:a,tileIndex:l,TileGroup:"TileGroup"+((l+c[r])/f|0)};return t.replace(/\{(\w+?)\}/g,(function(t,e){return h[e]}))}}))),_=Og.bind(null,Wl(a*n));super({attributions:t.attributions,cacheSize:t.cacheSize,crossOrigin:t.crossOrigin,referrerPolicy:t.referrerPolicy,interpolate:t.interpolate,projection:t.projection,tilePixelRatio:n,reprojectionErrorThreshold:t.reprojectionErrorThreshold,tileClass:_,tileGrid:u,tileUrlFunction:p,transition:t.transition}),this.zDirection=t.zDirection;const m=p(u.getTileCoordForCoordAndResolution(de(u.getExtent()),h[h.length-1]),1,null),y=new Image;y.addEventListener("error",(()=>{f=a,this.changed()})),y.src=m}},bP.source.Zoomify.CustomTile=Og,bP.source.arcgisRest={},bP.source.arcgisRest.createLoader=$g,bP.source.arcgisRest.getRequestUrl=Vg,bP.source.common={},bP.source.common.DECIMALS=4,bP.source.common.DEFAULT_WMS_VERSION="1.3.0",bP.source.mapguide={},bP.source.mapguide.createLoader=Zg,bP.source.mapserver={},bP.source.mapserver.createLoader=function(t){const e=t.load||js,i=t.ratio??1,n=t.crossOrigin??null;return function(r,s,o){const a=new Image;a.crossOrigin=n,void 0!==t.referrerPolicy&&(a.referrerPolicy=t.referrerPolicy);const l=ve(r=Xg(r,s,o,i))/s,h=_e(r)/s,c=[l*o,h*o],u=function(t,e,i,n){const r=Math.round(n[0]),s=Math.round(n[1]),o=`${r} ${s}`,a=`${i[0]} ${i[1]} ${i[2]} ${i[3]}`,l={mode:"map",map_imagetype:"png",mapext:a,imgext:a,map_size:o,imgx:r/2,imgy:s/2,imgxy:o};return Object.assign(l,e),td(t,l)}(t.url,t.params,r,c);return e(a,u).then((t=>({image:t,extent:r,pixelRatio:o})))}},bP.source.ogcMapUtil={},bP.source.ogcMapUtil.createLoader=a_,bP.source.ogcMapUtil.getImageSrc=o_,bP.source.ogcMapUtil.getRequestUrl=s_,bP.source.ogcTileUtil={},bP.source.ogcTileUtil.appendCollectionsQueryParam=gf,bP.source.ogcTileUtil.getMapTileUrlTemplate=ff,bP.source.ogcTileUtil.getTileSetInfo=mf,bP.source.ogcTileUtil.getVectorTileUrlTemplate=pf,bP.source.ogcTileUtil.parseTileMatrixSet=_f,bP.source.sourcesFromTileGrid=function(t,e){const i=new Du(32),n=t.getExtent();return function(r,s){i.expireCache(),n&&(r=me(n,r));const o=t.getZForResolution(s),a=[];return t.forEachTileCoord(r,o,(t=>{const n=t.toString();if(!i.containsKey(n)){const r=e(t);i.set(n,r)}a.push(i.get(n))})),a}},bP.source.static={},bP.source.static.createLoader=Yg,bP.source.wms={},bP.source.wms.DEFAULT_VERSION=nf,bP.source.wms.createLoader=lf,bP.source.wms.getFeatureInfoUrl=hf,bP.source.wms.getImageSrc=of,bP.source.wms.getLegendUrl=cf,bP.source.wms.getRequestParams=af,bP.source.wms.getRequestUrl=sf,bP.sphere={},bP.sphere.DEFAULT_RADIUS=ze,bP.sphere.getArea=function t(e,i){const n=(i=i||{}).radius||ze,r=i.projection||"EPSG:3857",s=e.getType();"GeometryCollection"!==s&&(e=e.clone().transform(r,"EPSG:4326"));let o,a,l,h,c,u,d=0;switch(s){case"Point":case"MultiPoint":case"LineString":case"MultiLineString":case"LinearRing":break;case"Polygon":for(o=e.getCoordinates(),d=Math.abs($e(o[0],n)),l=1,h=o.length;l<h;++l)d-=Math.abs($e(o[l],n));break;case"MultiPolygon":for(o=e.getCoordinates(),l=0,h=o.length;l<h;++l)for(a=o[l],d+=Math.abs($e(a[0],n)),c=1,u=a.length;c<u;++c)d-=Math.abs($e(a[c],n));break;case"GeometryCollection":{const n=e.getGeometries();for(l=0,h=n.length;l<h;++l)d+=t(n[l],i);break}default:throw new Error("Unsupported geometry type: "+s)}return d},bP.sphere.getDistance=Xe,bP.sphere.getLength=function t(e,i){const n=(i=i||{}).radius||ze,r=i.projection||"EPSG:3857",s=e.getType();"GeometryCollection"!==s&&(e=e.clone().transform(r,"EPSG:4326"));let o,a,l,h,c,u,d=0;switch(s){case"Point":case"MultiPoint":break;case"LineString":case"LinearRing":o=e.getCoordinates(),d=Ve(o,n);break;case"MultiLineString":case"Polygon":for(o=e.getCoordinates(),l=0,h=o.length;l<h;++l)d+=Ve(o[l],n);break;case"MultiPolygon":for(o=e.getCoordinates(),l=0,h=o.length;l<h;++l)for(a=o[l],c=0,u=a.length;c<u;++c)d+=Ve(a[c],n);break;case"GeometryCollection":{const n=e.getGeometries();for(l=0,h=n.length;l<h;++l)d+=t(n[l],i);break}default:throw new Error("Unsupported geometry type: "+s)}return d},bP.sphere.offset=We,bP.string={},bP.string.compareVersions=Je,bP.string.padNumber=qe,bP.structs={},bP.structs.LRUCache=Du,bP.structs.PriorityQueue=ao,bP.structs.PriorityQueue.DROP=oo,bP.structs.RBush=zd,bP.style={},bP.style.Circle=rc,bP.style.Fill=sc,bP.style.Icon=ac,bP.style.IconImage=Fh,bP.style.IconImage.get=Lh,bP.style.IconImageCache=bh,bP.style.IconImageCache.getCacheKey=Rh,bP.style.IconImageCache.shared=Ph,bP.style.Image=ic,bP.style.RegularShape=nc,bP.style.Stroke=lc,bP.style.Style=hc,bP.style.Style.createDefaultStyle=dc,bP.style.Style.createEditingStyle=gc,bP.style.Style.toFunction=cc,bP.style.Text=pc,bP.style.flat={},bP.style.flat.createDefaultStyle=n_,bP.tilecoord={},bP.tilecoord.createOrUpdate=Nu,bP.tilecoord.fromKey=function(t){return t.split("/").map(Number)},bP.tilecoord.getCacheKey=ju,bP.tilecoord.getCacheKeyForTileKey=function(t){const[e,i,n]=t.substring(t.lastIndexOf("/")+1,t.length).split(",").map(Number);return ku(e,i,n)},bP.tilecoord.getKey=Gu,bP.tilecoord.getKeyZXY=ku,bP.tilecoord.hash=Uu,bP.tilecoord.hashZXY=Bu,bP.tilecoord.withinExtentAndZ=zu,bP.tilegrid={},bP.tilegrid.TileGrid=Vu,bP.tilegrid.WMTS=$u,bP.tilegrid.WMTS.createFromCapabilitiesMatrixSet=Wu,bP.tilegrid.common={},bP.tilegrid.common.DEFAULT_MAX_ZOOM=42,bP.tilegrid.common.DEFAULT_TILE_SIZE=Co,bP.tilegrid.createForExtent=Hu,bP.tilegrid.createForProjection=Ju,bP.tilegrid.createXYZ=Ku,bP.tilegrid.extentFromProjection=Qu,bP.tilegrid.getForProjection=Zu,bP.tilegrid.wrapX=Yu,bP.tileurlfunction={},bP.tileurlfunction.createFromTemplate=ld,bP.tileurlfunction.createFromTemplates=hd,bP.tileurlfunction.createFromTileUrlFunctions=cd,bP.tileurlfunction.nullTileUrlFunction=ud,bP.transform={},bP.transform.apply=Qn,bP.transform.compose=nr,bP.transform.composeCssTransform=function(t,e,i,n,r,s,o){return ar(nr([1,0,0,1,0,0],t,e,i,n,r,s,o))},bP.transform.create=Yn,bP.transform.determinant=sr,bP.transform.equivalent=hr,bP.transform.fromString=lr,bP.transform.invert=function(t){return rr(t,t)},bP.transform.makeInverse=rr,bP.transform.makeScale=function(t,e,i){return qn(t,e,0,0,i,0,0)},bP.transform.multiply=Kn,bP.transform.reset=Hn,bP.transform.rotate=tr,bP.transform.scale=er,bP.transform.set=qn,bP.transform.setFromArray=Jn,bP.transform.toString=ar,bP.transform.translate=ir,bP.uri={},bP.uri.appendParams=td,bP.uri.expandUrl=ad,bP.uri.pickUrl=od,bP.uri.renderXYZTemplate=sd,bP.util={},bP.util.VERSION="10.8.0",bP.util.abstract=U,bP.util.getUid=z,bP.vec={},bP.vec.mat4={},bP.vec.mat4.create=Jd,bP.vec.mat4.fromTransform=Qd,bP.vec.mat4.orthographic=tg,bP.vec.mat4.scale=eg,bP.vec.mat4.translate=ig,bP.vec.mat4.translation=ng,bP.webgl={},bP.webgl.ARRAY_BUFFER=Kf,bP.webgl.BaseTileRepresentation=Fp,bP.webgl.Buffer=Mp,bP.webgl.Buffer.getArrayClassForType=Ap,bP.webgl.Canvas={},bP.webgl.Canvas.Canvas=rg,bP.webgl.Canvas.createProgram=og,bP.webgl.DYNAMIC_DRAW=Qf,bP.webgl.ELEMENT_ARRAY_BUFFER=qf,bP.webgl.FLOAT=tp,bP.webgl.Helper=$p,bP.webgl.Helper.computeAttributesStride=Wp,bP.webgl.PaletteTexture=Yp,bP.webgl.PostProcessingPass=Np,bP.webgl.RenderTarget=Kp,bP.webgl.STATIC_DRAW=Jf,bP.webgl.STREAM_DRAW=35040,bP.webgl.TileGeometry=Jp,bP.webgl.TileTexture=i_,bP.webgl.UNSIGNED_BYTE=5121,bP.webgl.UNSIGNED_INT=5125,bP.webgl.UNSIGNED_SHORT=5123,bP.webgl.getContext=ip,bP.webgl.getSupportedExtensions=function(){if(!np){const t=ip(document.createElement("canvas"));t&&(np=t.getSupportedExtensions())}return np},bP.xml={},bP.xml.OBJECT_PROPERTY_NODE_FACTORY=xp,bP.xml.XML_SCHEMA_INSTANCE_URI=rp,bP.xml.createElementNS=sp,bP.xml.getAllTextContent=op,bP.xml.getAllTextContent_=ap,bP.xml.getAttributeNS=hp,bP.xml.getDocument=Ip,bP.xml.getXMLSerializer=Pp,bP.xml.isDocument=lp,bP.xml.makeArrayExtender=up,bP.xml.makeArrayPusher=dp,bP.xml.makeArraySerializer=mp,bP.xml.makeChildAppender=_p,bP.xml.makeObjectPropertyPusher=fp,bP.xml.makeObjectPropertySetter=pp,bP.xml.makeReplacer=gp,bP.xml.makeSequence=vp,bP.xml.makeSimpleNodeFactory=yp,bP.xml.makeStructureNS=Sp,bP.xml.parse=cp,bP.xml.parseNode=Ep,bP.xml.pushParseAndPop=wp,bP.xml.pushSerializeAndPop=Cp,bP.xml.registerDocument=function(t){Rp=t},bP.xml.registerXMLSerializer=function(t){bp=t},bP.xml.serialize=Tp,bP.VERSION=bP.util.VERSION,bP.getUid=bP.util.getUid,bP}();-//# sourceMappingURL=ol.js.mapdiff --git a/.eslintignore b/apps/mobile/.eslintignoresimilarity index 100%rename from .eslintignorerename to apps/mobile/.eslintignorediff --git a/.eslintrc.js b/apps/mobile/.eslintrc.jssimilarity index 100%rename from .eslintrc.jsrename to apps/mobile/.eslintrc.jsdiff --git a/App.tsx b/apps/mobile/App.tsxsimilarity index 100%rename from App.tsxrename to apps/mobile/App.tsxdiff --git a/android/app/build.gradle b/apps/mobile/android/app/build.gradlesimilarity index 100%rename from android/app/build.gradlerename to apps/mobile/android/app/build.gradlediff --git a/android/app/debug.keystore b/apps/mobile/android/app/debug.keystoresimilarity index 100%rename from android/app/debug.keystorerename to apps/mobile/android/app/debug.keystorediff --git a/android/app/proguard-rules.pro b/apps/mobile/android/app/proguard-rules.prosimilarity index 100%rename from android/app/proguard-rules.prorename to apps/mobile/android/app/proguard-rules.prodiff --git a/android/app/src/main/AndroidManifest.xml b/apps/mobile/android/app/src/main/AndroidManifest.xmlsimilarity index 100%rename from android/app/src/main/AndroidManifest.xmlrename to apps/mobile/android/app/src/main/AndroidManifest.xmldiff --git a/android/app/src/main/assets/fonts/Inter-Bold.ttf b/apps/mobile/android/app/src/main/assets/fonts/Inter-Bold.ttfsimilarity index 100%rename from android/app/src/main/assets/fonts/Inter-Bold.ttfrename to apps/mobile/android/app/src/main/assets/fonts/Inter-Bold.ttfdiff --git a/android/app/src/main/assets/fonts/Inter-Medium.ttf b/apps/mobile/android/app/src/main/assets/fonts/Inter-Medium.ttfsimilarity index 100%rename from android/app/src/main/assets/fonts/Inter-Medium.ttfrename to apps/mobile/android/app/src/main/assets/fonts/Inter-Medium.ttfdiff --git a/android/app/src/main/assets/fonts/Inter-Regular.ttf b/apps/mobile/android/app/src/main/assets/fonts/Inter-Regular.ttfsimilarity index 100%rename from android/app/src/main/assets/fonts/Inter-Regular.ttfrename to apps/mobile/android/app/src/main/assets/fonts/Inter-Regular.ttfdiff --git a/android/app/src/main/assets/fonts/Inter-SemiBold.ttf b/apps/mobile/android/app/src/main/assets/fonts/Inter-SemiBold.ttfsimilarity index 100%rename from android/app/src/main/assets/fonts/Inter-SemiBold.ttfrename to apps/mobile/android/app/src/main/assets/fonts/Inter-SemiBold.ttfdiff --git a/android/app/src/main/assets/openlayers/ol.css b/apps/mobile/android/app/src/main/assets/openlayers/ol.csssimilarity index 100%rename from android/app/src/main/assets/openlayers/ol.cssrename to apps/mobile/android/app/src/main/assets/openlayers/ol.cssdiff --git a/apps/mobile/android/app/src/main/assets/openlayers/ol.js b/apps/mobile/android/app/src/main/assets/openlayers/ol.jsnew file mode 100644index 00000000..3c21a786--- /dev/null+++ b/apps/mobile/android/app/src/main/assets/openlayers/ol.js@@ -0,0 +1,37650 @@+var ol = (function () {+ "use strict"+ var t = "add",+ e = "remove",+ i = "propertychange",+ n = "change",+ r = "error",+ s = "contextmenu",+ o = "click",+ a = "dblclick",+ l = "dragenter",+ h = "dragover",+ c = "drop",+ u = "keydown",+ d = "keypress",+ g = "load",+ f = "touchmove",+ p = "wheel"+ class _ {+ constructor() {+ this.disposed = !1+ }+ dispose() {+ this.disposed || ((this.disposed = !0), this.disposeInternal())+ }+ disposeInternal() {}+ }+ function m(t, e, i) {+ let n, r+ i = i || y+ let s = 0,+ o = t.length,+ a = !1+ for (; s < o; ) (n = s + ((o - s) >> 1)), (r = +i(t[n], e)), r < 0 ? (s = n + 1) : ((o = n), (a = !r))+ return a ? s : ~s+ }+ function y(t, e) {+ return t > e ? 1 : t < e ? -1 : 0+ }+ function x(t, e) {+ return t < e ? 1 : t > e ? -1 : 0+ }+ function v(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 S(t, e, i) {+ for (; e < i; ) {+ const n = t[e]+ ;(t[e] = t[i]), (t[i] = n), ++e, --i+ }+ }+ function E(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 w(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 T(t, e, i) {+ const n = e || y+ 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 C() {+ return !0+ }+ function b() {+ return !1+ }+ function R() {}+ function P(t) {+ let e, i, n+ return function () {+ const r = Array.prototype.slice.call(arguments)+ return (i && this === n && w(r, i)) || ((n = this), (i = r), (e = t.apply(this, arguments))), e+ }+ }+ function I(t) {+ return (function () {+ let e+ try {+ e = t()+ } catch (t) {+ return Promise.reject(t)+ }+ return e instanceof Promise ? e : Promise.resolve(e)+ })()+ }+ function F(t) {+ for (const e in t) delete t[e]+ }+ function L(t) {+ let e+ for (e in t) return !1+ return !e+ }+ class M {+ constructor(t) {+ this.propagationStopped, this.defaultPrevented, (this.type = t), (this.target = null)+ }+ preventDefault() {+ this.defaultPrevented = !0+ }+ stopPropagation() {+ this.propagationStopped = !0+ }+ }+ function A(t) {+ t.stopPropagation()+ }+ class O extends _ {+ constructor(t) {+ super(),+ (this.eventTarget_ = t),+ (this.pendingRemovals_ = null),+ (this.dispatching_ = null),+ (this.listeners_ = null)+ }+ addEventListener(t, e) {+ if (!t || !e) return+ const i = this.listeners_ || (this.listeners_ = {}),+ n = i[t] || (i[t] = [])+ n.includes(e) || n.push(e)+ }+ dispatchEvent(t) {+ const e = "string" == typeof t,+ i = e ? t : t.type,+ n = this.listeners_ && this.listeners_[i]+ if (!n) return+ const r = e ? new M(t) : t+ r.target || (r.target = this.eventTarget_ || this)+ const s = this.dispatching_ || (this.dispatching_ = {}),+ o = this.pendingRemovals_ || (this.pendingRemovals_ = {})+ let a+ i in s || ((s[i] = 0), (o[i] = 0)), ++s[i]+ for (let t = 0, e = n.length; t < e; ++t)+ if (+ ((a = "handleEvent" in n[t] ? n[t].handleEvent(r) : n[t].call(this, r)), !1 === a || r.propagationStopped)+ ) {+ a = !1+ break+ }+ if (0 == --s[i]) {+ let t = o[i]+ for (delete o[i]; t--; ) this.removeEventListener(i, R)+ delete s[i]+ }+ return a+ }+ disposeInternal() {+ this.listeners_ && F(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] = R), ++this.pendingRemovals_[t])+ : (i.splice(n, 1), 0 === i.length && delete this.listeners_[t]))+ }+ }+ function D(t, e, i, n, r) {+ if (r) {+ const r = i+ i = function (s) {+ return t.removeEventListener(e, i), r.call(n ?? this, s)+ }+ } else n && n !== t && (i = i.bind(n))+ const s = { target: t, type: e, listener: i }+ return t.addEventListener(e, i), s+ }+ function N(t, e, i, n) {+ return D(t, e, i, n, !0)+ }+ function k(t) {+ t && t.target && (t.target.removeEventListener(t.type, t.listener), F(t))+ }+ class G extends O {+ constructor() {+ super(),+ (this.on = this.onInternal),+ (this.once = this.onceInternal),+ (this.un = this.unInternal),+ (this.revision_ = 0)+ }+ changed() {+ ++this.revision_, this.dispatchEvent(n)+ }+ 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] = D(this, t[r], e)+ return n+ }+ return D(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] = N(this, t[r], e)+ } else i = N(this, t, e)+ return (e.ol_key = i), i+ }+ unInternal(t, e) {+ const i = e.ol_key+ if (i) j(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 j(t) {+ if (Array.isArray(t)) for (let e = 0, i = t.length; e < i; ++e) k(t[e])+ else k(t)+ }+ function U() {+ throw new Error("Unimplemented abstract method.")+ }+ G.prototype.on, G.prototype.once, G.prototype.un+ let B = 0+ function z(t) {+ return t.ol_uid || (t.ol_uid = String(++B))+ }+ class X extends M {+ constructor(t, e, i) {+ super(t), (this.key = e), (this.oldValue = i)+ }+ }+ class V extends G {+ constructor(t) {+ super(), this.on, this.once, this.un, z(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 X(n, t, e)),+ (n = i),+ this.hasListener(n) && this.dispatchEvent(new X(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], L(this.values_) && (this.values_ = null), e || this.notify(t, i)+ }+ }+ }+ const $ = "length"+ class W extends M {+ constructor(t, e, i) {+ super(t), (this.element = e), (this.index = i)+ }+ }+ class Z extends V {+ 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($)+ }+ insertAt(e, i) {+ if (e < 0 || e > this.getLength()) throw new Error("Index out of bounds: " + e)+ this.unique_ && this.assertUnique_(i),+ this.array_.splice(e, 0, i),+ this.updateLength_(),+ this.dispatchEvent(new W(t, i, e))+ }+ 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 i = this.array_[t]+ return this.array_.splice(t, 1), this.updateLength_(), this.dispatchEvent(new W(e, i, t)), i+ }+ setAt(i, n) {+ if (i >= this.getLength()) return void this.insertAt(i, n)+ if (i < 0) throw new Error("Index out of bounds: " + i)+ this.unique_ && this.assertUnique_(n, i)+ const r = this.array_[i]+ ;(this.array_[i] = n), this.dispatchEvent(new W(e, r, i)), this.dispatchEvent(new W(t, n, i))+ }+ updateLength_() {+ this.set($, this.array_.length)+ }+ assertUnique_(t, e) {+ const i = this.array_+ for (let n = 0, r = i.length; n < r; ++n)+ if (i[n] === t && n !== e) throw new Error("Duplicate item added to a unique collection")+ }+ }+ 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 O {+ 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(n)+ }+ release() {+ this.setState(J)+ }+ getKey() {+ return this.key + "/" + this.tileCoord+ }+ getTileCoord() {+ return this.tileCoord+ }+ getState() {+ return this.state+ }+ setState(t) {+ if (this.state !== J) {+ if (this.state !== q && this.state > t) throw new Error("Tile load sequence violation")+ ;(this.state = t), this.changed()+ }+ }+ load() {+ U()+ }+ getAlpha(t, e) {+ if (!this.transition_) return 1+ let i = this.transitionStarts_[t]+ if (i) {+ 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("safari") && !rt.includes("chrom"),+ ot = st && (rt.includes("version/15.4") || /cpu (os|iphone os) 15_4 like mac os x/.test(rt)),+ at = rt.includes("webkit") && !rt.includes("edge"),+ lt = rt.includes("macintosh"),+ ht = "undefined" != typeof devicePixelRatio ? devicePixelRatio : 1,+ ct =+ "undefined" != typeof WorkerGlobalScope &&+ "undefined" != typeof OffscreenCanvas &&+ self instanceof WorkerGlobalScope,+ ut = "undefined" != typeof Image && Image.prototype.decode,+ dt = "function" == typeof createImageBitmap,+ gt = (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 ft(t, e, i, n) {+ let r+ return (+ (r =+ i && i.length+ ? i.shift()+ : ct+ ? new (class extends OffscreenCanvas {+ style = {}+ })(t ?? 300, e ?? 150)+ : document.createElement("canvas")),+ t && (r.width = t),+ e && (r.height = e),+ r.getContext("2d", n)+ )+ }+ let pt+ function _t() {+ return pt || (pt = ft(1, 1)), pt+ }+ function mt(t) {+ const e = t.canvas+ ;(e.width = 1), (e.height = 1), t.clearRect(0, 0, 1, 1)+ }+ function yt(t) {+ let e = t.offsetWidth+ const i = getComputedStyle(t)+ return (e += parseInt(i.marginLeft, 10) + parseInt(i.marginRight, 10)), e+ }+ function xt(t) {+ let e = t.offsetHeight+ const i = getComputedStyle(t)+ return (e += parseInt(i.marginTop, 10) + parseInt(i.marginBottom, 10)), e+ }+ function vt(t, e) {+ const i = e.parentNode+ i && i.replaceChild(t, e)+ }+ function St(t) {+ for (; t.lastChild; ) t.lastChild.remove()+ }+ function Et(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 wt() {+ 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 Tt(t) {+ return (+ ("undefined" != typeof HTMLCanvasElement && t instanceof HTMLCanvasElement) ||+ ("undefined" != typeof OffscreenCanvas && t instanceof OffscreenCanvas)+ )+ }+ function Ct(t) {+ return t instanceof Image ||+ t instanceof HTMLCanvasElement ||+ t instanceof HTMLVideoElement ||+ t instanceof ImageBitmap+ ? t+ : null+ }+ function bt(t) {+ return t instanceof Uint8Array ||+ t instanceof Uint8ClampedArray ||+ t instanceof Float32Array ||+ t instanceof DataView+ ? t+ : null+ }+ const Rt = new Error("disposed")+ let Pt = null+ function It(t) {+ Pt || (Pt = ft(t.width, t.height, void 0, { willReadFrequently: !0 }))+ const e = Pt.canvas,+ i = t.width+ e.width !== i && (e.width = i)+ const n = t.height+ return (+ e.height !== n && (e.height = n),+ Pt.clearRect(0, 0, i, n),+ Pt.drawImage(t, 0, 0),+ Pt.getImageData(0, 0, i, n).data+ )+ }+ const Ft = [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 = Ct(this.data_)+ return t ? [t.width, t.height] : Ft+ }+ 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 Mt(t, e) {+ if (!t) throw new Error(e)+ }+ class At extends V {+ 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 At(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_ && (k(this.geometryChangeKey_), (this.geometryChangeKey_ = null))+ const t = this.getGeometry()+ t && (this.geometryChangeKey_ = D(t, n, this.handleGeometryChange_, this)), this.changed()+ }+ setGeometry(t) {+ this.set(this.geometryName_, t)+ }+ setStyle(t) {+ ;(this.style_ = t), (this.styleFunction_ = t ? Ot(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 Ot(t) {+ if ("function" == typeof t) return t+ let e+ if (Array.isArray(t)) e = t+ else {+ Mt("function" == typeof t.getZIndex, "Expected an `ol/style/Style` or an array of `ol/style/Style.js`")+ e = [t]+ }+ return function () {+ return e+ }+ }+ var Dt = 0,+ Nt = 1,+ kt = 2,+ Gt = 4,+ jt = 8,+ Ut = 16+ function Bt(t) {+ const e = Ht()+ for (let i = 0, n = t.length; i < n; ++i) ne(e, t[i])+ return e+ }+ function zt(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 Xt(t, e) {+ return e ? ((e[0] = t[0]), (e[1] = t[1]), (e[2] = t[2]), (e[3] = t[3]), e) : t.slice()+ }+ function Vt(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 $t(t, e) {+ return Zt(t, e[0], e[1])+ }+ function Wt(t, e) {+ return t[0] <= e[0] && e[2] <= t[2] && t[1] <= e[1] && e[3] <= t[3]+ }+ function Zt(t, e, i) {+ return t[0] <= e && e <= t[2] && t[1] <= i && i <= t[3]+ }+ function Yt(t, e) {+ const i = t[0],+ n = t[1],+ r = t[2],+ s = t[3],+ o = e[0],+ a = e[1]+ let l = Dt+ return o < i ? (l |= Ut) : o > r && (l |= Gt), a < n ? (l |= jt) : a > s && (l |= kt), l === Dt && (l = Nt), l+ }+ function Ht() {+ return [1 / 0, 1 / 0, -1 / 0, -1 / 0]+ }+ function Kt(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 qt(t) {+ return Kt(1 / 0, 1 / 0, -1 / 0, -1 / 0, t)+ }+ function Jt(t, e) {+ const i = t[0],+ n = t[1]+ return Kt(i, n, i, n, e)+ }+ function Qt(t, e, i, n, r) {+ return se(qt(r), t, e, i, n)+ }+ function te(t, e) {+ return t[0] == e[0] && t[2] == e[2] && t[1] == e[1] && t[3] == e[3]+ }+ function ee(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 ie(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 ne(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 re(t, e) {+ for (let i = 0, n = e.length; i < n; ++i) ne(t, e[i])+ return t+ }+ function se(t, e, i, n, r) {+ for (; i < n; i += r) ae(t, e[i], e[i + 1])+ return t+ }+ function oe(t, e) {+ for (let i = 0, n = e.length; i < n; ++i) re(t, e[i])+ return t+ }+ function ae(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 le(t, e) {+ let i+ return (i = e(ce(t))), i || ((i = e(ue(t))), i || ((i = e(xe(t))), i || ((i = e(ye(t))), i || !1)))+ }+ function he(t) {+ let e = 0+ return Ee(t) || (e = ve(t) * _e(t)), e+ }+ function ce(t) {+ return [t[0], t[1]]+ }+ function ue(t) {+ return [t[2], t[1]]+ }+ function de(t) {+ return [(t[0] + t[2]) / 2, (t[1] + t[3]) / 2]+ }+ function ge(t, e) {+ let i+ if ("bottom-left" === e) i = ce(t)+ else if ("bottom-right" === e) i = ue(t)+ else if ("top-left" === e) i = ye(t)+ else {+ if ("top-right" !== e) throw new Error("Invalid corner")+ i = xe(t)+ }+ return i+ }+ function fe(t, e, i, n, r) {+ const [s, o, a, l, h, c, u, d] = pe(t, e, i, n)+ return Kt(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 pe(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 _e(t) {+ return t[3] - t[1]+ }+ function me(t, e, i) {+ const n = i || [1 / 0, 1 / 0, -1 / 0, -1 / 0]+ return (+ Se(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]))+ : qt(n),+ n+ )+ }+ function ye(t) {+ return [t[0], t[3]]+ }+ function xe(t) {+ return [t[2], t[3]]+ }+ function ve(t) {+ return t[2] - t[0]+ }+ function Se(t, e) {+ return t[0] <= e[2] && t[2] >= e[0] && t[1] <= e[3] && t[3] >= e[1]+ }+ function Ee(t) {+ return t[2] < t[0] || t[3] < t[1]+ }+ function we(t, e) {+ return e ? ((e[0] = t[0]), (e[1] = t[1]), (e[2] = t[2]), (e[3] = t[3]), e) : t+ }+ function Te(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 Ce(t, e, i) {+ let n = !1+ const r = Yt(t, e),+ s = Yt(t, i)+ if (r === Nt || s === Nt) 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, _+ s & kt && !(r & kt) && ((p = d - (g - h) / f), (n = p >= o && p <= l)),+ n || !(s & Gt) || r & Gt || ((_ = g - (d - l) * f), (n = _ >= a && _ <= h)),+ n || !(s & jt) || r & jt || ((p = d - (g - a) / f), (n = p >= o && p <= l)),+ n || !(s & Ut) || r & Ut || ((_ = g - (d - o) * f), (n = _ >= a && _ <= h))+ }+ return n+ }+ function be(t, e, i, n) {+ if (Ee(t)) return qt(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 Kt(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 Re(t, e) {+ const i = e.getExtent(),+ n = de(t)+ if (e.canWrapX() && (n[0] < i[0] || n[0] >= i[2])) {+ const e = ve(i),+ r = Math.floor((n[0] - i[0]) / e) * e+ ;(t[0] -= r), (t[2] -= r)+ }+ return t+ }+ function Pe(t, e, i) {+ if (e.canWrapX()) {+ const n = e.getExtent()+ if (!isFinite(t[0]) || !isFinite(t[2])) return [[n[0], t[1], n[2], t[3]]]+ Re(t, e)+ const r = ve(n)+ if (ve(t) > r && !i) return [[n[0], t[1], n[2], t[3]]]+ if (t[0] < n[0])+ return [+ [t[0] + r, t[1], n[2], t[3]],+ [n[0], t[1], t[2], t[3]]+ ]+ if (t[2] > n[2])+ return [+ [t[0], t[1], n[2], t[3]],+ [n[0], t[1], t[2] - r, t[3]]+ ]+ }+ return [t]+ }+ function Ie(t, e, i) {+ return Math.min(Math.max(t, e), i)+ }+ function Fe(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 Le(t, e, i, n)+ }+ function Le(t, e, i, n) {+ const r = i - t,+ s = n - e+ return r * r + s * s+ }+ function Me(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 Ae(t) {+ return (180 * t) / Math.PI+ }+ function Oe(t) {+ return (t * Math.PI) / 180+ }+ function De(t, e) {+ const i = t % e+ return i * e < 0 ? i + e : i+ }+ function Ne(t, e, i) {+ return t + i * (e - t)+ }+ function ke(t, e) {+ const i = Math.pow(10, e)+ return Math.round(t * i) / i+ }+ function Ge(t, e) {+ return Math.round(ke(t, e))+ }+ function je(t, e) {+ return Math.floor(ke(t, e))+ }+ function Ue(t, e) {+ return Math.ceil(ke(t, e))+ }+ function Be(t, e, i) {+ if (t >= e && t < i) return t+ const n = i - e+ return ((((t - e) % n) + n) % n) + e+ }+ const ze = 6371008.8+ function Xe(t, e, i) {+ i = i || ze+ const n = Oe(t[1]),+ r = Oe(e[1]),+ s = (r - n) / 2,+ o = Oe(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 Ve(t, e) {+ let i = 0+ for (let n = 0, r = t.length; n < r - 1; ++n) i += Xe(t[n], t[n + 1], e)+ return i+ }+ function $e(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 += Oe(n - r) * (2 + Math.sin(Oe(s)) + Math.sin(Oe(o)))), (r = n), (s = o)+ }+ return (i * e * e) / 2+ }+ function We(t, e, i, n) {+ n = n || ze+ const r = Oe(t[1]),+ s = Oe(t[0]),+ o = e / n,+ a = Math.asin(Math.sin(r) * Math.cos(o) + Math.cos(r) * Math.sin(o) * Math.cos(i))+ return [Ae(s + Math.atan2(Math.sin(i) * Math.sin(o) * Math.cos(r), Math.cos(o) - Math.sin(r) * Math.sin(a))), Ae(a)]+ }+ const Ze = { info: 1, warn: 2, error: 3, none: 4 }+ let Ye = Ze.info+ function He(...t) {+ Ye > Ze.warn || console.warn(...t)+ }+ function Ke(...t) {+ Ye > Ze.error || console.error(...t)+ }+ function qe(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 Je(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 Qe(t, e) {+ return (t[0] += +e[0]), (t[1] += +e[1]), t+ }+ function ti(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 ei(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 ii(t, e, i) {+ const n = De(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 = ke(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 += " " + qe(a, 2) + "′"),+ 0 !== l && (h += " " + qe(l, 2, s) + "″"),+ 0 !== n && (h += " " + t.charAt(n < 0 ? 1 : 0)),+ h+ )+ }+ function ni(t, e, i) {+ return t ? e.replace("{x}", t[0].toFixed(i)).replace("{y}", t[1].toFixed(i)) : ""+ }+ function ri(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 si(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 oi(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 li(t, e) {+ return Math.sqrt(ai(t, e))+ }+ function hi(t, e) {+ return ai(t, ei(t, e))+ }+ function ci(t, e) {+ return ni(t, "{x}, {y}", e)+ }+ function ui(t, e) {+ if (e.canWrapX()) {+ const i = ve(e.getExtent()),+ n = di(t, e, i)+ n && (t[0] -= n * i)+ }+ return t+ }+ function di(t, e, i) {+ const n = e.getExtent()+ let r = 0+ return e.canWrapX() && (t[0] < n[0] || t[0] > n[2]) && ((i = i || ve(n)), (r = Math.floor((t[0] - n[0]) / i))), r+ }+ function gi(t, e, i) {+ const n = Math.sqrt((e[0] - t[0]) * (e[0] - t[0]) + (e[1] - t[1]) * (e[1] - t[1])),+ r = [(e[0] - t[0]) / n, (e[1] - t[1]) / n],+ s = [-r[1], r[0]],+ o = Math.sqrt((i[0] - t[0]) * (i[0] - t[0]) + (i[1] - t[1]) * (i[1] - t[1])),+ a = [(i[0] - t[0]) / o, (i[1] - t[1]) / o]+ let l = 0 === n || 0 === o ? 0 : Math.acos(Ie(a[0] * r[0] + a[1] * r[1], -1, 1))+ l = Math.max(l, 1e-5)+ return a[0] * s[0] + a[1] * s[1] > 0 ? l : 2 * Math.PI - l+ }+ const fi = { 9001: "m", 9002: "ft", 9003: "us-ft", 9101: "radians", 9102: "degrees" }+ function pi(t) {+ return fi[t]+ }+ const _i = {+ "radians": 6370997 / (2 * Math.PI),+ "degrees": (2 * Math.PI * 6370997) / 360,+ "ft": 0.3048,+ "m": 1,+ "us-ft": 1200 / 3937+ }+ class mi {+ 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_ || _i[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 yi = 6378137,+ xi = Math.PI * yi,+ vi = [-xi, -xi, xi, xi],+ Si = [-180, -85, 180, 85],+ Ei = yi * Math.log(Math.tan(Math.PI / 2))+ class wi extends mi {+ constructor(t) {+ super({+ code: t,+ units: "m",+ extent: vi,+ global: !0,+ worldExtent: Si,+ getPointResolution: function (t, e) {+ return t / Math.cosh(e[1] / yi)+ }+ })+ }+ }+ const Ti = [+ new wi("EPSG:3857"),+ new wi("EPSG:102100"),+ new wi("EPSG:102113"),+ new wi("EPSG:900913"),+ new wi("http://www.opengis.net/def/crs/EPSG/0/3857"),+ new wi("http://www.opengis.net/gml/srs/epsg.xml#3857")+ ]+ function Ci(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] = (xi * t[i]) / 180+ let n = yi * Math.log(Math.tan((Math.PI * (+t[i + 1] + 90)) / 360))+ n > Ei ? (n = Ei) : n < -Ei && (n = -Ei), (e[i + 1] = n)+ }+ return e+ }+ function bi(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]) / xi), (e[i + 1] = (360 * Math.atan(Math.exp(t[i + 1] / yi))) / Math.PI - 90)+ return e+ }+ const Ri = 6378137,+ Pi = [-180, -90, 180, 90],+ Ii = (Math.PI * Ri) / 180+ class Fi extends mi {+ constructor(t, e) {+ super({+ code: t,+ units: "degrees",+ extent: Pi,+ axisOrientation: e,+ global: !0,+ metersPerUnit: Ii,+ worldExtent: Pi+ })+ }+ }+ const Li = [+ new Fi("CRS:84"),+ new Fi("EPSG:4326", "neu"),+ new Fi("urn:ogc:def:crs:OGC:1.3:CRS84"),+ new Fi("urn:ogc:def:crs:OGC:2:84"),+ new Fi("http://www.opengis.net/def/crs/OGC/1.3/CRS84"),+ new Fi("http://www.opengis.net/gml/srs/epsg.xml#4326", "neu"),+ new Fi("http://www.opengis.net/def/crs/EPSG/0/4326", "neu")+ ]+ let Mi = {}+ function Ai() {+ Mi = {}+ }+ function Oi(t) {+ return Mi[t] || Mi[t.replace(/urn:(x-)?ogc:def:crs:EPSG:(.*:)?(\w+)$/, "EPSG:$3")] || null+ }+ function Di(t, e) {+ Mi[t] = e+ }+ let Ni = {}+ function ki() {+ Ni = {}+ }+ function Gi(t, e, i) {+ const n = t.getCode(),+ r = e.getCode()+ n in Ni || (Ni[n] = {}), (Ni[n][r] = i)+ }+ function ji(t, e) {+ return t in Ni && e in Ni[t] ? Ni[t][e] : null+ }+ const Ui = 0.9996,+ Bi = 0.00669438,+ zi = Bi * Bi,+ Xi = zi * Bi,+ Vi = Bi / (1 - Bi),+ $i = Math.sqrt(1 - Bi),+ Wi = (1 - $i) / (1 + $i),+ Zi = Wi * Wi,+ Yi = Zi * Wi,+ Hi = Yi * Wi,+ Ki = Hi * Wi,+ qi = 0.9983242984503243,+ Ji = (15 * zi) / 256 + (45 * Xi) / 1024,+ Qi = (35 * Xi) / 3072,+ tn = 1.5 * Wi - (27 / 32) * Yi + (269 / 512) * Ki,+ en = (21 / 16) * Zi - (55 / 32) * Hi,+ nn = (151 / 96) * Yi - (417 / 128) * Ki,+ rn = (1097 / 512) * Hi,+ sn = 6378137+ function on(t, e, i) {+ const n = t - 5e5,+ r = (i.north ? e : e - 1e7) / Ui / (sn * qi),+ s = r + tn * Math.sin(2 * r) + en * Math.sin(4 * r) + nn * Math.sin(6 * r) + rn * 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 - Bi * a,+ g = Math.sqrt(1 - Bi * a),+ f = Vi * l ** 2,+ p = f * f,+ _ = n / ((sn / g) * Ui),+ m = _ * _,+ y = m * _,+ x = y * _,+ v = x * _,+ S =+ s -+ (h / ((1 - Bi) / d)) * (m / 2 - (x / 24) * (5 + 3 * c + 10 * f - 4 * p - 9 * Vi)) ++ ((v * _) / 720) * (61 + 90 * c + 298 * f + 45 * u - 252 * Vi - 3 * p)+ let E = (_ - (y / 6) * (1 + 2 * c + f) + (v / 120) * (5 - 2 * f + 28 * c - 3 * p + 8 * Vi + 24 * u)) / l+ return (E = Be(E + Oe(ln(i.number)), -Math.PI, Math.PI)), [Ae(E), Ae(S)]+ }+ function an(t, e, i) {+ ;(t = Be(t, -180, 180)), e < -80 ? (e = -80) : e > 84 && (e = 84)+ const n = Oe(e),+ r = Math.sin(n),+ s = Math.cos(n),+ o = r / s,+ a = o * o,+ l = a * a,+ h = Oe(t),+ c = Oe(ln(i.number)),+ u = sn / Math.sqrt(1 - Bi * r ** 2),+ d = Vi * s ** 2,+ g = s * Be(h - c, -Math.PI, Math.PI),+ f = g * g,+ p = f * g,+ _ = p * g,+ m = _ * g,+ y = m * g,+ x = sn * (qi * n - 0.002514607064228144 * Math.sin(2 * n) + Ji * Math.sin(4 * n) - Qi * Math.sin(6 * n)),+ v = Ui * u * (g + (p / 6) * (1 - a + d) + (m / 120) * (5 - 18 * a + l + 72 * d - 58 * Vi)) + 5e5+ let S =+ Ui *+ (x ++ u * o * (f / 2 + (_ / 24) * (5 - a + 9 * d + 4 * d ** 2) + (y / 720) * (61 - 58 * a + l + 600 * d - 330 * Vi)))+ return i.north || (S += 1e7), [v, S]+ }+ function ln(t) {+ return 6 * (t - 1) - 180 + 3+ }+ const hn = [/^EPSG:(\d+)$/, /^urn:ogc:def:crs:EPSG::(\d+)$/, /^http:\/\/www\.opengis\.net\/def\/crs\/EPSG\/0\/(\d+)$/]+ function cn(t) {+ let e = 0+ for (const i of hn) {+ 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 un(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 dn(t) {+ return cn(t) ? new mi({ code: t, units: "m" }) : null+ }+ function gn(t) {+ const e = cn(t.getCode())+ return e ? { forward: un(an, e), inverse: un(on, e) } : null+ }+ const fn = [gn],+ pn = [dn]+ let _n = !0+ function mn(t) {+ _n = !(void 0 === t || t)+ }+ function yn(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 xn(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 vn(t) {+ Di(t.getCode(), t), Gi(t, t, yn)+ }+ function Sn(t) {+ t.forEach(vn)+ }+ function En(t) {+ if ("string" != typeof t) return t+ const e = Oi(t)+ if (e) return e+ for (const e of pn) {+ const i = e(t)+ if (i) return i+ }+ return null+ }+ function wn(t, e, i, n) {+ let r+ const s = (t = En(t)).getPointResolutionFunc()+ if (s) {+ if (((r = s(e, i)), n && n !== t.getUnits())) {+ const e = t.getMetersPerUnit()+ e && (r = (r * e) / _i[n])+ }+ } else {+ const s = t.getUnits()+ if (("degrees" == s && !n) || "degrees" == n) r = e+ else {+ const o = Ln(t, En("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 = (Xe(t.slice(0, 2), t.slice(2, 4)) + Xe(t.slice(4, 6), t.slice(6, 8))) / 2+ } else r = e * t.getMetersPerUnit()+ const a = n ? _i[n] : t.getMetersPerUnit()+ void 0 !== a && (r /= a)+ }+ }+ return r+ }+ function Tn(t) {+ Sn(t),+ t.forEach(function (e) {+ t.forEach(function (t) {+ e !== t && Gi(e, t, yn)+ })+ })+ }+ function Cn(t, e, i, n) {+ t.forEach(function (t) {+ e.forEach(function (e) {+ Gi(t, e, i), Gi(e, t, n)+ })+ })+ }+ function bn(t, e) {+ return t ? ("string" == typeof t ? En(t) : t) : En(e)+ }+ function Rn(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 Pn(t, e, i, n) {+ const r = En(t),+ s = En(e)+ Gi(r, s, Rn(i)), Gi(s, r, Rn(n))+ }+ function In(t, e) {+ const i = On(t, void 0 !== e ? e : "EPSG:3857", "EPSG:4326"),+ n = i[0]+ return (n < -180 || n > 180) && (i[0] = De(n + 180, 360) - 180), i+ }+ function Fn(t, e) {+ if (t === e) return !0+ const i = t.getUnits() === e.getUnits()+ if (t.getCode() === e.getCode()) return i+ return Ln(t, e) === yn && i+ }+ function Ln(t, e) {+ const i = t.getCode(),+ n = e.getCode()+ let r = ji(i, n)+ if (r) return r+ let s = null,+ o = null+ for (const i of fn) s || (s = i(t)), o || (o = i(e))+ if (!s && !o) return null+ const a = "EPSG:4326"+ if (o)+ if (s) r = Mn(s.inverse, o.forward)+ else {+ const t = ji(i, a)+ t && (r = Mn(t, o.forward))+ }+ else {+ const t = ji(a, n)+ t && (r = Mn(s.inverse, t))+ }+ return r && (vn(t), vn(e), Gi(t, e, r)), r+ }+ function Mn(t, e) {+ return function (i, n, r, s) {+ return (n = t(i, n, r, s)), e(n, n, r, s)+ }+ }+ function An(t, e) {+ return Ln(En(t), En(e))+ }+ function On(t, e, i) {+ const n = An(e, i)+ if (!n) {+ const t = En(e).getCode(),+ n = En(i).getCode()+ throw new Error(`No transform available between ${t} and ${n}`)+ }+ return n(t, void 0, t.length)+ }+ function Dn(t, e, i, n) {+ return be(t, An(e, i), void 0, n)+ }+ let Nn = null+ function kn(t) {+ Nn = En(t)+ }+ function Gn() {+ return Nn+ }+ function jn(t, e) {+ return Nn ? On(t, e, Nn) : t+ }+ function Un(t, e) {+ return Nn+ ? On(t, Nn, e)+ : (_n &&+ !ri(t, [0, 0]) &&+ t[0] >= -180 &&+ t[0] <= 180 &&+ t[1] >= -90 &&+ t[1] <= 90 &&+ ((_n = !1), He("Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.")),+ t)+ }+ function Bn(t, e) {+ return Nn ? Dn(t, e, Nn) : t+ }+ function zn(t, e) {+ return Nn ? Dn(t, Nn, e) : t+ }+ function Xn(t, e) {+ if (!Nn) return t+ const i = En(e).getMetersPerUnit(),+ n = Nn.getMetersPerUnit()+ return i && n ? (t * i) / n : t+ }+ function Vn(t, e) {+ if (!Nn) return t+ const i = En(e).getMetersPerUnit(),+ n = Nn.getMetersPerUnit()+ return i && n ? (t * n) / i : t+ }+ function $n(t, e, i) {+ return function (n) {+ let r, s+ if (t.canWrapX()) {+ const e = t.getExtent(),+ o = ve(e)+ ;(s = di((n = n.slice(0)), t, o)),+ s && (n[0] = n[0] - s * o),+ (n[0] = Ie(n[0], e[0], e[2])),+ (n[1] = Ie(n[1], e[1], e[3])),+ (r = i(n))+ } else r = i(n)+ return s && e.canWrapX() && (r[0] += s * ve(e.getExtent())), r+ }+ }+ function Wn() {+ Tn(Ti), Tn(Li), Cn(Li, Ti, Ci, bi)+ }+ Wn()+ const Zn = new Array(6)+ function Yn() {+ return [1, 0, 0, 1, 0, 0]+ }+ function Hn(t) {+ return qn(t, 1, 0, 0, 1, 0, 0)+ }+ function Kn(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 qn(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 Jn(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 Qn(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 tr(t, e) {+ const i = Math.cos(e),+ n = Math.sin(e)+ return Kn(t, qn(Zn, i, n, -n, i, 0, 0))+ }+ function er(t, e, i) {+ return Kn(t, qn(Zn, e, 0, 0, i, 0, 0))+ }+ function ir(t, e, i) {+ return Kn(t, qn(Zn, 1, 0, 0, 1, e, i))+ }+ function nr(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 rr(t, e) {+ const i = sr(e)+ Mt(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 sr(t) {+ return t[0] * t[3] - t[1] * t[2]+ }+ const or = [1e5, 1e5, 1e5, 1e5, 2, 2]+ function ar(t) {+ return "matrix(" + t.join(", ") + ")"+ }+ function lr(t) {+ return t+ .substring(7, t.length - 1)+ .split(",")+ .map(parseFloat)+ }+ function hr(t, e) {+ const i = lr(t),+ n = lr(e)+ for (let t = 0; t < 6; ++t) if (0 !== Math.round((i[t] - n[t]) * or[t])) return !1+ return !0+ }+ function cr(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 ur(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 dr(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 gr(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+ }+ const fr = [1, 0, 0, 1, 0, 0],+ pr = [NaN, NaN]+ class _r extends V {+ 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 U()+ }+ closestPointXY(t, e, i, n) {+ return U()+ }+ containsXY(t, e) {+ return 0 === this.closestPointXY(t, e, pr, 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 U()+ }+ getExtent(t) {+ if (this.extentRevision_ != this.getRevision()) {+ const t = this.computeExtent(this.extent_)+ ;(isNaN(t[0]) || isNaN(t[1])) && qt(t), (this.extentRevision_ = this.getRevision())+ }+ return we(this.extent_, t)+ }+ rotate(t, e) {+ U()+ }+ scale(t, e, i) {+ U()+ }+ simplify(t) {+ return this.getSimplifiedGeometry(t * t)+ }+ getSimplifiedGeometry(t) {+ return U()+ }+ getType() {+ return U()+ }+ applyTransform(t) {+ U()+ }+ intersectsExtent(t) {+ return U()+ }+ translate(t, e) {+ U()+ }+ transform(t, e) {+ const i = En(t),+ n =+ "tile-pixels" == i.getUnits()+ ? function (t, n, r) {+ const s = i.getExtent(),+ o = i.getWorldExtent(),+ a = _e(o) / _e(s)+ nr(fr, o[0], o[3], a, -a, 0, 0, 0)+ const l = cr(t, 0, t.length, r, fr, n),+ h = An(i, e)+ return h ? h(l, l, r) : l+ }+ : An(i, e)+ return this.applyTransform(n), this+ }+ }+ class mr extends _r {+ constructor() {+ super(), (this.layout = "XY"), (this.stride = 2), this.flatCoordinates+ }+ computeExtent(t) {+ return Qt(this.flatCoordinates, 0, this.flatCoordinates.length, this.stride, t)+ }+ getCoordinates() {+ return U()+ }+ getFirstCoordinate() {+ return this.flatCoordinates.slice(0, this.stride)+ }+ getFlatCoordinates() {+ return this.flatCoordinates+ }+ getLastCoordinate() {+ return this.flatCoordinates.slice(this.flatCoordinates.length - this.stride)+ }+ getLayout() {+ return this.layout+ }+ getSimplifiedGeometry(t) {+ if (+ (this.simplifiedGeometryRevision !== this.getRevision() &&+ ((this.simplifiedGeometryMaxMinSquaredTolerance = 0), (this.simplifiedGeometryRevision = this.getRevision())),+ t < 0 ||+ (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 = xr(t)), (this.layout = t), (this.flatCoordinates = e)+ }+ setCoordinates(t, e) {+ U()+ }+ setLayout(t, e, i) {+ let n+ if (t) n = xr(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 = yr(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()+ ur(i, 0, i.length, n, t, e, i), this.changed()+ }+ }+ scale(t, e, i) {+ void 0 === e && (e = t), i || (i = de(this.getExtent()))+ const n = this.getFlatCoordinates()+ if (n) {+ const r = this.getStride()+ dr(n, 0, n.length, r, t, e, i, n), this.changed()+ }+ }+ translate(t, e) {+ const i = this.getFlatCoordinates()+ if (i) {+ const n = this.getStride()+ gr(i, 0, i.length, n, t, e, i), this.changed()+ }+ }+ }+ function yr(t) {+ let e+ return 2 == t ? (e = "XY") : 3 == t ? (e = "XYZ") : 4 == t && (e = "XYZM"), e+ }+ function xr(t) {+ let e+ return "XY" == t ? (e = 2) : "XYZ" == t || "XYM" == t ? (e = 3) : "XYZM" == t && (e = 4), e+ }+ function vr(t, e, i) {+ const n = t.getFlatCoordinates()+ if (!n) return null+ const r = t.getStride()+ return cr(n, 0, n.length, r, e, i)+ }+ function Sr(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 Er(t, e, i, n) {+ let r = 0+ for (let s = 0, o = i.length; s < o; ++s) {+ const o = i[s]+ ;(r += Sr(t, e, o, n)), (e = o)+ }+ return r+ }+ function wr(t, e, i, n) {+ let r = 0+ for (let s = 0, o = i.length; s < o; ++s) {+ const o = i[s]+ ;(r += Er(t, e, o, n)), (e = o[o.length - 1])+ }+ return r+ }+ function Tr(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] = Ne(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 Cr(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 = Le(s, o, i, n)+ a > r && (r = a), (s = i), (o = n)+ }+ return r+ }+ function br(t, e, i, n, r) {+ for (let s = 0, o = i.length; s < o; ++s) {+ const o = i[s]+ ;(r = Cr(t, e, o, n, r)), (e = o)+ }+ return r+ }+ function Rr(t, e, i, n, r) {+ for (let s = 0, o = i.length; s < o; ++s) {+ const o = i[s]+ ;(r = br(t, e, o, n, r)), (e = o[o.length - 1])+ }+ return r+ }+ function Pr(t, e, i, n, r, s, o, a, l, h, c) {+ if (e == i) return h+ let u, d+ if (0 === r) {+ if (((d = Le(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 ((Tr(t, g - n, g, n, o, a, c), (d = Le(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 && (Tr(t, i - n, e, n, o, a, c), (d = Le(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 Ir(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 = Pr(t, e, d, n, r, s, o, a, l, h, c)), (e = d)+ }+ return h+ }+ function Fr(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 = Ir(t, e, d, n, r, s, o, a, l, h, c)), (e = d[d.length - 1])+ }+ return h+ }+ function Lr(t, e, i, n) {+ for (let n = 0, r = i.length; n < r; ++n) t[e++] = i[n]+ return e+ }+ function Mr(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 Ar(t, e, i, n, r) {+ r = r || []+ let s = 0+ for (let o = 0, a = i.length; o < a; ++o) {+ const a = Mr(t, e, i[o], n)+ ;(r[s++] = a), (e = a)+ }+ return (r.length = s), r+ }+ function Or(t, e, i, n, r) {+ r = r || []+ let s = 0+ for (let o = 0, a = i.length; o < a; ++o) {+ const a = Ar(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 Dr(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 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++] = Dr(t, e, a, n, r[s])), (e = a)+ }+ return (r.length = s), r+ }+ function kr(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 ? [] : Nr(t, e, a, n, r[s])), (e = a[a.length - 1])+ }+ return (r.length = s), r+ }+ function Gr(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 = Fe(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 jr(t, e, i, n, r, s, o, a) {+ for (let l = 0, h = i.length; l < h; ++l) {+ const h = i[l]+ ;(o = Gr(t, e, h, n, r, s, o)), a.push(o), (e = h)+ }+ return o+ }+ function Ur(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]), Le(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 Br(t, e) {+ return e * Math.round(t / e)+ }+ function zr(t, e, i, n, r, s, o) {+ if (e == i) return o+ let a,+ l,+ h = Br(t[e], r),+ c = Br(t[e + 1], r)+ ;(e += n), (s[o++] = h), (s[o++] = c)+ do {+ if (((a = Br(t[e], r)), (l = Br(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 = Br(t[e], r),+ u = Br(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 Xr(t, e, i, n, r, s, o, a) {+ for (let l = 0, h = i.length; l < h; ++l) {+ const h = i[l]+ ;(o = zr(t, e, h, n, r, s, o)), a.push(o), (e = h)+ }+ return o+ }+ function Vr(t, e, i, n, r, s, o, a) {+ for (let l = 0, h = i.length; l < h; ++l) {+ const h = i[l],+ c = []+ ;(o = Xr(t, e, h, n, r, s, o, c)), a.push(c), (e = h[h.length - 1])+ }+ return o+ }+ class $r extends mr {+ 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 $r(this.flatCoordinates.slice(), this.layout)+ }+ closestPointXY(t, e, i, n) {+ return n < Vt(this.getExtent(), t, e)+ ? n+ : (this.maxDeltaRevision_ != this.getRevision() &&+ ((this.maxDelta_ = Math.sqrt(Cr(this.flatCoordinates, 0, this.flatCoordinates.length, this.stride, 0))),+ (this.maxDeltaRevision_ = this.getRevision())),+ Pr(this.flatCoordinates, 0, this.flatCoordinates.length, this.stride, this.maxDelta_, !0, t, e, i, n))+ }+ getArea() {+ return Sr(this.flatCoordinates, 0, this.flatCoordinates.length, this.stride)+ }+ getCoordinates() {+ return Dr(this.flatCoordinates, 0, this.flatCoordinates.length, this.stride)+ }+ getSimplifiedGeometryInternal(t) {+ const e = []+ return (+ (e.length = Gr(this.flatCoordinates, 0, this.flatCoordinates.length, this.stride, t, e, 0)), new $r(e, "XY")+ )+ }+ getType() {+ return "LinearRing"+ }+ intersectsExtent(t) {+ return !1+ }+ setCoordinates(t, e) {+ this.setLayout(e, t, 1),+ this.flatCoordinates || (this.flatCoordinates = []),+ (this.flatCoordinates.length = Mr(this.flatCoordinates, 0, t, this.stride)),+ this.changed()+ }+ }+ class Wr extends mr {+ constructor(t, e) {+ super(), this.setCoordinates(t, e)+ }+ clone() {+ const t = new Wr(this.flatCoordinates.slice(), this.layout)+ return t.applyProperties(this), t+ }+ closestPointXY(t, e, i, n) {+ const r = this.flatCoordinates,+ s = Le(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 Jt(this.flatCoordinates, t)+ }+ getType() {+ return "Point"+ }+ intersectsExtent(t) {+ return Zt(t, this.flatCoordinates[0], this.flatCoordinates[1])+ }+ setCoordinates(t, e) {+ this.setLayout(e, t, 0),+ this.flatCoordinates || (this.flatCoordinates = []),+ (this.flatCoordinates.length = Lr(this.flatCoordinates, 0, t, this.stride)),+ this.changed()+ }+ }+ function Zr(t, e, i, n, r) {+ return !le(r, function (r) {+ return !Yr(t, e, i, n, r[0], r[1])+ })+ }+ function Yr(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 Hr(t, e, i, n, r, s) {+ if (0 === i.length) return !1+ if (!Yr(t, e, i[0], n, r, s)) return !1+ for (let e = 1, o = i.length; e < o; ++e) if (Yr(t, i[e - 1], i[e], n, r, s)) return !1+ return !0+ }+ function Kr(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 (Hr(t, e, a, n, r, s)) return !0+ e = a[a.length - 1]+ }+ return !1+ }+ function qr(t, e, i, n, r, s, o) {+ let a, l, h, c, u, d, g+ const f = r[s + 1],+ p = []+ for (let r = 0, s = i.length; r < s; ++r) {+ const s = i[r]+ for (c = t[s - n], d = t[s - n + 1], a = e; a < s; 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), p.push(h)),+ (c = u),+ (d = g)+ }+ let _ = NaN,+ m = -1 / 0+ for (p.sort(y), c = p[0], a = 1, l = p.length; a < l; ++a) {+ u = p[a]+ const r = Math.abs(u - c)+ r > m && ((h = (c + u) / 2), Hr(t, e, i, n, h, f) && ((_ = h), (m = r))), (c = u)+ }+ return isNaN(_) && (_ = r[s]), o ? (o.push(_, f, m), o) : [_, f, m]+ }+ function Jr(t, e, i, n, r) {+ let s = []+ for (let o = 0, a = i.length; o < a; ++o) {+ const a = i[o]+ ;(s = qr(t, e, a, n, r, 2 * o, s)), (e = a[a.length - 1])+ }+ return s+ }+ function Qr(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 ts(t, e) {+ const [i, n] = t,+ [r, s] = e,+ o =+ ((i[0] - r[0]) * (r[1] - s[1]) - (i[1] - r[1]) * (r[0] - s[0])) /+ ((i[0] - n[0]) * (r[1] - s[1]) - (i[1] - n[1]) * (r[0] - s[0])),+ a =+ ((i[0] - r[0]) * (i[1] - n[1]) - (i[1] - r[1]) * (i[0] - n[0])) /+ ((i[0] - n[0]) * (r[1] - s[1]) - (i[1] - n[1]) * (r[0] - s[0]))+ if (0 <= o && o <= 1 && 0 <= a && a <= 1) return [i[0] + o * (n[0] - i[0]), i[1] + o * (n[1] - i[1])]+ }+ function es(t, e, i, n, r, s) {+ return (+ (s = s ?? se([1 / 0, 1 / 0, -1 / 0, -1 / 0], t, e, i, n)),+ !!Se(r, s) &&+ ((s[0] >= r[0] && s[2] <= r[2]) ||+ (s[1] >= r[1] && s[3] <= r[3]) ||+ Qr(t, e, i, n, function (t, e) {+ return Ce(r, t, e)+ }))+ )+ }+ function is(t, e, i, n, r) {+ for (let s = 0, o = i.length; s < o; ++s) {+ if (es(t, e, i[s], n, r)) return !0+ e = i[s]+ }+ return !1+ }+ function ns(t, e, i, n, r) {+ return (+ !!es(t, e, i, n, r) ||+ !!Yr(t, e, i, n, r[0], r[1]) ||+ !!Yr(t, e, i, n, r[0], r[3]) ||+ !!Yr(t, e, i, n, r[2], r[1]) ||+ !!Yr(t, e, i, n, r[2], r[3])+ )+ }+ function rs(t, e, i, n, r) {+ if (!ns(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) && !es(t, i[e - 1], i[e], n, r)) return !1+ return !0+ }+ function ss(t, e, i, n, r) {+ for (let s = 0, o = i.length; s < o; ++s) {+ const o = i[s]+ if (rs(t, e, o, n, r)) return !0+ e = o[o.length - 1]+ }+ return !1+ }+ function os(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 as(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 ls(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 = as(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 hs(t, e, i, n, r) {+ for (let s = 0, o = i.length; s < o; ++s) {+ const o = i[s]+ if (!ls(t, e, o, n, r)) return !1+ o.length && (e = o[o.length - 1])+ }+ return !0+ }+ function cs(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 = as(t, e, o, n)+ ;(0 === s ? (r && a) || (!r && !a) : (r && !a) || (!r && a)) && os(t, e, o, n), (e = o)+ }+ return e+ }+ function us(t, e, i, n, r) {+ for (let s = 0, o = i.length; s < o; ++s) e = cs(t, e, i[s], n, r)+ return e+ }+ function ds(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 = as(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 gs extends mr {+ 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+ ? E(this.flatCoordinates, t.getFlatCoordinates())+ : (this.flatCoordinates = t.getFlatCoordinates().slice()),+ this.ends_.push(this.flatCoordinates.length),+ this.changed()+ }+ clone() {+ const t = new gs(this.flatCoordinates.slice(), this.layout, this.ends_.slice())+ return t.applyProperties(this), t+ }+ closestPointXY(t, e, i, n) {+ return n < Vt(this.getExtent(), t, e)+ ? n+ : (this.maxDeltaRevision_ != this.getRevision() &&+ ((this.maxDelta_ = Math.sqrt(br(this.flatCoordinates, 0, this.ends_, this.stride, 0))),+ (this.maxDeltaRevision_ = this.getRevision())),+ Ir(this.flatCoordinates, 0, this.ends_, this.stride, this.maxDelta_, !0, t, e, i, n))+ }+ containsXY(t, e) {+ return Hr(this.getOrientedFlatCoordinates(), 0, this.ends_, this.stride, t, e)+ }+ getArea() {+ return Er(this.getOrientedFlatCoordinates(), 0, this.ends_, this.stride)+ }+ getCoordinates(t) {+ let e+ return (+ void 0 !== t+ ? ((e = this.getOrientedFlatCoordinates().slice()), cs(e, 0, this.ends_, this.stride, t))+ : (e = this.flatCoordinates),+ Nr(e, 0, this.ends_, this.stride)+ )+ }+ getEnds() {+ return this.ends_+ }+ getFlatInteriorPoint() {+ if (this.flatInteriorPointRevision_ != this.getRevision()) {+ const t = de(this.getExtent())+ ;(this.flatInteriorPoint_ = qr(this.getOrientedFlatCoordinates(), 0, this.ends_, this.stride, t, 0)),+ (this.flatInteriorPointRevision_ = this.getRevision())+ }+ return this.flatInteriorPoint_+ }+ getInteriorPoint() {+ return new Wr(this.getFlatInteriorPoint(), "XYM")+ }+ getLinearRingCount() {+ return this.ends_.length+ }+ getLinearRing(t) {+ return t < 0 || this.ends_.length <= t+ ? null+ : new $r(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 $r(e.slice(r, o), t)+ n.push(a), (r = o)+ }+ return n+ }+ getOrientedFlatCoordinates() {+ if (this.orientedRevision_ != this.getRevision()) {+ const t = this.flatCoordinates+ ls(t, 0, this.ends_, this.stride)+ ? (this.orientedFlatCoordinates_ = t)+ : ((this.orientedFlatCoordinates_ = t.slice()),+ (this.orientedFlatCoordinates_.length = cs(this.orientedFlatCoordinates_, 0, this.ends_, this.stride))),+ (this.orientedRevision_ = this.getRevision())+ }+ return this.orientedFlatCoordinates_+ }+ getSimplifiedGeometryInternal(t) {+ const e = [],+ i = []+ return (+ (e.length = Xr(this.flatCoordinates, 0, this.ends_, this.stride, Math.sqrt(t), e, 0, i)), new gs(e, "XY", i)+ )+ }+ getType() {+ return "Polygon"+ }+ intersectsExtent(t) {+ return rs(this.getOrientedFlatCoordinates(), 0, this.ends_, this.stride, t)+ }+ setCoordinates(t, e) {+ this.setLayout(e, t, 2), this.flatCoordinates || (this.flatCoordinates = [])+ const i = Ar(this.flatCoordinates, 0, t, this.stride, this.ends_)+ ;(this.flatCoordinates.length = 0 === i.length ? 0 : i[i.length - 1]), this.changed()+ }+ }+ function fs(t, e, i, n) {+ i = i || 32+ const r = []+ for (let s = 0; s < i; ++s) E(r, We(t, e, (2 * Math.PI * s) / i, n))+ return r.push(r[0], r[1]), new gs(r, "XY", [r.length])+ }+ function ps(t) {+ if (Ee(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 gs(s, "XY", [s.length])+ }+ function _s(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 gs(a, r, l)+ return ms(h, s, t.getRadius(), i), h+ }+ function ms(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 * De(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 ys = "accuracy",+ xs = "accuracyGeometry",+ vs = "altitude",+ Ss = "altitudeAccuracy",+ Es = "heading",+ ws = "position",+ Ts = "projection",+ Cs = "speed",+ bs = "tracking",+ Rs = "trackingOptions",+ Ps = "error"+ class Is extends M {+ constructor(t) {+ super(Ps), (this.code = t.code), (this.message = t.message)+ }+ }+ var Fs = 0,+ Ls = 1,+ Ms = 2,+ As = 3,+ Os = 4+ class Ds extends O {+ constructor(t, e, i, n) {+ super(),+ (this.extent = t),+ (this.pixelRatio_ = i),+ (this.resolution = e),+ (this.state = "function" == typeof n ? Fs : n),+ (this.image_ = null),+ (this.loader = "function" == typeof n ? n : null)+ }+ changed() {+ this.dispatchEvent(n)+ }+ getExtent() {+ return this.extent+ }+ getImage() {+ return this.image_+ }+ getPixelRatio() {+ return this.pixelRatio_+ }+ getResolution() {+ return this.resolution+ }+ getState() {+ return this.state+ }+ load() {+ if (this.state == Fs && this.loader) {+ ;(this.state = Ls), this.changed()+ const t = this.getResolution(),+ e = Array.isArray(t) ? t[0] : t+ I(() => 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 ||+ (dt && t instanceof ImageBitmap) ||+ t instanceof HTMLCanvasElement ||+ t instanceof HTMLVideoElement) &&+ (this.image_ = t),+ (this.state = Ms)+ })+ .catch((t) => {+ ;(this.state = As), console.error(t)+ })+ .finally(() => this.changed())+ }+ }+ setImage(t) {+ this.image_ = t+ }+ setResolution(t) {+ this.resolution = t+ }+ }+ function Ns(t, e, i) {+ const n = t+ let s = !0,+ o = !1,+ a = !1+ const l = [+ N(n, g, function () {+ ;(a = !0), o || e()+ })+ ]+ return (+ n.src && ut+ ? ((o = !0),+ n+ .decode()+ .then(function () {+ s && e()+ })+ .catch(function (t) {+ s && (a ? e() : i())+ }))+ : l.push(N(n, r, i)),+ function () {+ ;(s = !1), l.forEach(k)+ }+ )+ }+ function ks(t, e) {+ return new Promise((i, n) => {+ function r() {+ o(), i(t)+ }+ function s() {+ o(), n(new Error("Image load error"))+ }+ function o() {+ t.removeEventListener("load", r), t.removeEventListener("error", s)+ }+ t.addEventListener("load", r), t.addEventListener("error", s), e && (t.src = e)+ })+ }+ function Gs(t, e) {+ return (+ e && (t.src = e),+ t.src && ut+ ? new Promise((e, i) =>+ t+ .decode()+ .then(() => e(t))+ .catch((n) => (t.complete && t.width ? e(t) : i(n)))+ )+ : ks(t)+ )+ }+ function js(t, e) {+ return (+ e && (t.src = e),+ t.src && ut && dt+ ? t+ .decode()+ .then(() => createImageBitmap(t))+ .catch((e) => {+ if (t.complete && t.width) return t+ throw e+ })+ : Gs(t)+ )+ }+ class Us extends Ds {+ constructor(t, e, i, n, r) {+ super(t, e, i, void 0 !== r ? Fs : Ms),+ (this.loader_ = void 0 !== r ? r : null),+ (this.canvas_ = n),+ (this.error_ = null)+ }+ getError() {+ return this.error_+ }+ handleLoad_(t) {+ t ? ((this.error_ = t), (this.state = As)) : (this.state = Ms), this.changed()+ }+ load() {+ this.state == Fs && ((this.state = Ls), this.changed(), this.loader_(this.handleLoad_.bind(this)))+ }+ getImage() {+ return this.canvas_+ }+ }+ class Bs extends nt {+ constructor(t, e, i, n, r, s) {+ super(t, e, s),+ (this.crossOrigin_ = n?.crossOrigin),+ (this.referrerPolicy_ = n?.referrerPolicy),+ (this.src_ = i),+ (this.key = i),+ this.image_,+ ct+ ? (this.image_ = new OffscreenCanvas(1, 1))+ : ((this.image_ = new Image()),+ null !== this.crossOrigin_ && (this.image_.crossOrigin = this.crossOrigin_),+ void 0 !== this.referrerPolicy_ && (this.image_.referrerPolicy = this.referrerPolicy_)),+ (this.unlisten_ = null),+ (this.tileLoadFunction_ = r)+ }+ getImage() {+ return this.image_+ }+ setImage(t) {+ ;(this.image_ = t), (this.state = K), this.unlistenImage_(), this.changed()+ }+ getCrossOrigin() {+ return this.crossOrigin_+ }+ getReferrerPolicy() {+ return this.referrerPolicy_+ }+ handleImageError_() {+ ;(this.state = q),+ this.unlistenImage_(),+ (this.image_ = (function () {+ const t = ft(1, 1)+ return (t.fillStyle = "rgba(0,0,0,0)"), t.fillRect(0, 0, 1, 1), t.canvas+ })()),+ this.changed()+ }+ handleImageLoad_() {+ if (ct) this.state = K+ else {+ const t = this.image_+ t.naturalWidth && t.naturalHeight ? (this.state = K) : (this.state = J)+ }+ this.unlistenImage_(), this.changed()+ }+ load() {+ this.state == q &&+ ((this.state = Y),+ (this.image_ = new Image()),+ null !== this.crossOrigin_ && (this.image_.crossOrigin = this.crossOrigin_),+ void 0 !== this.referrerPolicy_ && (this.image_.referrerPolicy = this.referrerPolicy_)),+ this.state == Y &&+ ((this.state = H),+ this.changed(),+ this.tileLoadFunction_(this, this.src_),+ (this.unlisten_ = Ns(this.image_, this.handleImageLoad_.bind(this), this.handleImageError_.bind(this))))+ }+ unlistenImage_() {+ this.unlisten_ && (this.unlisten_(), (this.unlisten_ = null))+ }+ disposeInternal() {+ this.unlistenImage_(), (this.image_ = null), super.disposeInternal()+ }+ }+ class zs {+ constructor(t, e, i) {+ ;(this.decay_ = t),+ (this.minVelocity_ = e),+ (this.delay_ = i),+ (this.points_ = []),+ (this.angle_ = 0),+ (this.initialVelocity_ = 0)+ }+ begin() {+ ;(this.points_.length = 0), (this.angle_ = 0), (this.initialVelocity_ = 0)+ }+ update(t, e) {+ this.points_.push(t, e, Date.now())+ }+ end() {+ if (this.points_.length < 6) return !1+ const t = Date.now() - this.delay_,+ e = this.points_.length - 3+ if (this.points_[e + 2] < t) return !1+ let i = e - 3+ for (; i > 0 && this.points_[i + 2] > t; ) i -= 3+ const n = this.points_[e + 2] - this.points_[i + 2]+ if (n < 1e3 / 60) return !1+ const r = this.points_[e] - this.points_[i],+ s = this.points_[e + 1] - this.points_[i + 1]+ return (+ (this.angle_ = Math.atan2(s, r)),+ (this.initialVelocity_ = Math.sqrt(r * r + s * s) / n),+ this.initialVelocity_ > this.minVelocity_+ )+ }+ getDistance() {+ return (this.minVelocity_ - this.initialVelocity_) / this.decay_+ }+ getAngle() {+ return this.angle_+ }+ }+ class Xs extends M {+ constructor(t, e, i) {+ super(t), (this.map = e), (this.frameState = void 0 !== i ? i : null)+ }+ }+ class Vs extends Xs {+ constructor(t, e, i, n, r, s) {+ super(t, e, r),+ (this.originalEvent = i),+ (this.pixel_ = null),+ (this.coordinate_ = null),+ (this.dragging = void 0 !== n && n),+ (this.activePointers = s)+ }+ get pixel() {+ return this.pixel_ || (this.pixel_ = this.map.getEventPixel(this.originalEvent)), this.pixel_+ }+ set pixel(t) {+ this.pixel_ = t+ }+ get coordinate() {+ return this.coordinate_ || (this.coordinate_ = this.map.getCoordinateFromPixel(this.pixel)), this.coordinate_+ }+ set coordinate(t) {+ this.coordinate_ = t+ }+ preventDefault() {+ super.preventDefault(), "preventDefault" in this.originalEvent && this.originalEvent.preventDefault()+ }+ stopPropagation() {+ super.stopPropagation(), "stopPropagation" in this.originalEvent && this.originalEvent.stopPropagation()+ }+ }+ var $s = {+ SINGLECLICK: "singleclick",+ CLICK: o,+ DBLCLICK: a,+ POINTERDRAG: "pointerdrag",+ POINTERMOVE: "pointermove",+ POINTERDOWN: "pointerdown",+ POINTERUP: "pointerup",+ POINTEROVER: "pointerover",+ POINTEROUT: "pointerout",+ POINTERENTER: "pointerenter",+ POINTERLEAVE: "pointerleave",+ POINTERCANCEL: "pointercancel"+ },+ Ws = "pointermove",+ Zs = "pointerdown",+ Ys = "pointerup",+ Hs = "pointerout"+ class Ks extends O {+ constructor(t, e) {+ super(t),+ (this.map_ = t),+ this.clickTimeoutId_,+ (this.emulateClicks_ = !1),+ (this.dragging_ = !1),+ (this.dragListenerKeys_ = []),+ (this.moveTolerance_ = void 0 === e ? 1 : e),+ (this.down_ = null)+ const i = this.map_.getViewport()+ ;(this.activePointers_ = []),+ (this.trackedTouches_ = {}),+ (this.element_ = i),+ (this.pointerdownListenerKey_ = D(i, Zs, this.handlePointerDown_, this)),+ this.originalPointerMoveEvent_,+ (this.relayedListenerKey_ = D(i, Ws, this.relayMoveEvent_, this)),+ (this.boundHandleTouchMove_ = this.handleTouchMove_.bind(this)),+ this.element_.addEventListener(f, this.boundHandleTouchMove_, !!gt && { passive: !1 })+ }+ emulateClick_(t) {+ let e = new Vs($s.CLICK, this.map_, t)+ this.dispatchEvent(e),+ void 0 !== this.clickTimeoutId_+ ? (clearTimeout(this.clickTimeoutId_),+ (this.clickTimeoutId_ = void 0),+ (e = new Vs($s.DBLCLICK, this.map_, t)),+ this.dispatchEvent(e))+ : (this.clickTimeoutId_ = setTimeout(() => {+ this.clickTimeoutId_ = void 0+ const e = new Vs($s.SINGLECLICK, this.map_, t)+ this.dispatchEvent(e)+ }, 250))+ }+ updateActivePointers_(t) {+ const e = t,+ i = e.pointerId+ if (e.type == $s.POINTERUP || e.type == $s.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 != $s.POINTERDOWN && e.type != $s.POINTERMOVE) || (this.trackedTouches_[i] = e)+ this.activePointers_ = Object.values(this.trackedTouches_)+ }+ handlePointerUp_(t) {+ this.updateActivePointers_(t)+ const e = new Vs($s.POINTERUP, this.map_, t, void 0, void 0, this.activePointers_)+ this.dispatchEvent(e),+ this.emulateClicks_ &&+ !e.defaultPrevented &&+ !this.dragging_ &&+ this.isMouseActionButton_(t) &&+ this.emulateClick_(this.down_),+ 0 === this.activePointers_.length &&+ (this.dragListenerKeys_.forEach(k),+ (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 Vs($s.POINTERDOWN, this.map_, t, void 0, void 0, this.activePointers_)+ if (+ (this.dispatchEvent(e),+ (this.down_ = new PointerEvent(t.type, t)),+ Object.defineProperty(this.down_, "target", { writable: !1, value: t.target }),+ 0 === this.dragListenerKeys_.length)+ ) {+ const t = this.map_.getOwnerDocument()+ this.dragListenerKeys_.push(+ D(t, $s.POINTERMOVE, this.handlePointerMove_, this),+ D(t, $s.POINTERUP, this.handlePointerUp_, this),+ D(this.element_, $s.POINTERCANCEL, this.handlePointerUp_, this)+ ),+ this.element_.getRootNode &&+ this.element_.getRootNode() !== t &&+ this.dragListenerKeys_.push(D(this.element_.getRootNode(), $s.POINTERUP, this.handlePointerUp_, this))+ }+ }+ handlePointerMove_(t) {+ if (this.isMoving_(t)) {+ this.updateActivePointers_(t), (this.dragging_ = !0)+ const e = new Vs($s.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 Vs($s.POINTERMOVE, this.map_, t, e))+ }+ handleTouchMove_(t) {+ const e = this.originalPointerMoveEvent_+ ;(e && !e.defaultPrevented) || ("boolean" == typeof t.cancelable && !0 !== t.cancelable) || t.preventDefault()+ }+ isMoving_(t) {+ return (+ this.dragging_ ||+ Math.abs(t.clientX - this.down_.clientX) > this.moveTolerance_ ||+ Math.abs(t.clientY - this.down_.clientY) > this.moveTolerance_+ )+ }+ disposeInternal() {+ this.relayedListenerKey_ && (k(this.relayedListenerKey_), (this.relayedListenerKey_ = null)),+ this.element_.removeEventListener(f, this.boundHandleTouchMove_),+ this.pointerdownListenerKey_ && (k(this.pointerdownListenerKey_), (this.pointerdownListenerKey_ = null)),+ this.dragListenerKeys_.forEach(k),+ (this.dragListenerKeys_.length = 0),+ (this.element_ = null),+ super.disposeInternal()+ }+ }+ var qs = "postrender",+ Js = "movestart",+ Qs = "moveend",+ to = "loadstart",+ eo = "loadend",+ io = "layergroup",+ no = "size",+ ro = "target",+ so = "view"+ const oo = 1 / 0+ class ao {+ constructor(t, e) {+ ;(this.priorityFunction_ = t),+ (this.keyFunction_ = e),+ (this.elements_ = []),+ (this.priorities_ = []),+ (this.queuedElements_ = {})+ }+ clear() {+ ;(this.elements_.length = 0), (this.priorities_.length = 0), F(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) {+ Mt(+ !(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 != oo &&+ (this.elements_.push(t),+ this.priorities_.push(e),+ (this.queuedElements_[this.keyFunction_(t)] = !0),+ this.siftDown_(0, this.elements_.length - 1),+ !0)+ )+ }+ getCount() {+ return this.elements_.length+ }+ getLeftChildIndex_(t) {+ return 2 * t + 1+ }+ getRightChildIndex_(t) {+ return 2 * t + 2+ }+ getParentIndex_(t) {+ return (t - 1) >> 1+ }+ heapify_() {+ let t+ for (t = (this.elements_.length >> 1) - 1; t >= 0; t--) this.siftUp_(t)+ }+ isEmpty() {+ return 0 === this.elements_.length+ }+ isKeyQueued(t) {+ return t in this.queuedElements_+ }+ isQueued(t) {+ return this.isKeyQueued(this.keyFunction_(t))+ }+ siftUp_(t) {+ const e = this.elements_,+ i = this.priorities_,+ n = e.length,+ r = e[t],+ s = i[t],+ o = t+ for (; t < n >> 1; ) {+ const r = this.getLeftChildIndex_(t),+ s = this.getRightChildIndex_(t),+ o = s < n && i[s] < i[r] ? s : r+ ;(e[t] = e[o]), (i[t] = i[o]), (t = o)+ }+ ;(e[t] = r), (i[t] = s), this.siftDown_(o, t)+ }+ siftDown_(t, e) {+ const i = this.elements_,+ n = this.priorities_,+ r = i[e],+ s = n[e]+ for (; e > t; ) {+ const t = this.getParentIndex_(e)+ if (!(n[t] > s)) break+ ;(i[e] = i[t]), (n[e] = n[t]), (e = t)+ }+ ;(i[e] = r), (n[e] = s)+ }+ reprioritize() {+ const t = this.priorityFunction_,+ e = this.elements_,+ i = this.priorities_+ let n = 0+ const r = e.length+ let s, o, a+ for (o = 0; o < r; ++o)+ (s = e[o]), (a = t(s)), a == oo ? delete this.queuedElements_[this.keyFunction_(s)] : ((i[n] = a), (e[n++] = s))+ ;(e.length = n), (i.length = n), this.heapify_()+ }+ }+ class lo extends ao {+ 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(n, this.boundHandleTileChange_)+ }+ return e+ }+ getTilesLoading() {+ return this.tilesLoading_+ }+ handleTileChange(t) {+ const e = t.target,+ i = e.getState()+ if (i === K || i === q || i === J) {+ i !== q && e.removeEventListener(n, 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() !== Y ||+ e in this.tilesLoadingKeys_ ||+ ((this.tilesLoadingKeys_[e] = !0), ++this.tilesLoading_, ++i, t.load())+ }+ }+ }+ function ho(t, e, i, n, r) {+ if (!t || !(i in t.wantedTiles)) return oo+ if (!t.wantedTiles[i][e.getKey()]) return oo+ const s = t.viewState.center,+ o = n[0] - s[0],+ a = n[1] - s[1]+ return 65536 * Math.log(r) + Math.sqrt(o * o + a * a) / r+ }+ var co = 0,+ uo = 1,+ go = { CENTER: "center", RESOLUTION: "resolution", ROTATION: "rotation" }+ function fo(t, e, i) {+ return function (n, r, s, o, a) {+ if (!n) return+ if (!r && !e) return n+ const l = e ? 0 : s[0] * r,+ h = e ? 0 : s[1] * r,+ 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,+ p = t[3] - h / 2 + u+ d > g && ((d = (g + d) / 2), (g = d)), f > p && ((f = (p + f) / 2), (p = f))+ let _ = Ie(n[0], d, g),+ m = Ie(n[1], f, p)+ if (o && i && r) {+ const t = 30 * r+ ;(_ += -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] - p) / t))+ }+ return [_, m]+ }+ }+ function po(t) {+ return t+ }+ function _o(t, e, i, n) {+ const r = ve(e) / i[0],+ s = _e(e) / i[1]+ return n ? Math.min(t, Math.max(r, s)) : Math.min(t, Math.min(r, s))+ }+ function mo(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)),+ Ie(n, i / 2, 2 * e)+ )+ }+ function yo(t, e, i, n) {+ return (+ (e = void 0 === e || e),+ function (r, s, o, a) {+ if (void 0 !== r) {+ const l = t[0],+ h = t[t.length - 1],+ c = i ? _o(l, i, o, n) : l+ if (a) return e ? mo(r, c, h) : Ie(r, h, c)+ const u = Math.min(c, r),+ d = Math.floor(v(t, u, s))+ return t[d] > c && d < t.length - 1 ? t[d + 1] : t[d]+ }+ }+ )+ }+ function xo(t, e, i, n, r, s) {+ return (+ (n = void 0 === n || n),+ (i = void 0 !== i ? i : 0),+ function (o, a, l, h) {+ if (void 0 !== o) {+ const c = r ? _o(e, r, l, s) : e+ if (h) return n ? mo(o, c, i) : Ie(o, i, c)+ const u = 1e-9,+ d = Math.ceil(Math.log(e / c) / Math.log(t) - u),+ g = -a * (0.5 - u) + 0.5,+ f = Math.min(c, o),+ p = Math.floor(Math.log(e / f) / Math.log(t) + g),+ _ = Math.max(d, p)+ return Ie(e / Math.pow(t, _), i, c)+ }+ }+ )+ }+ function vo(t, e, i, n, r) {+ return (+ (i = void 0 === i || i),+ function (s, o, a, l) {+ if (void 0 !== s) {+ const o = n ? _o(t, n, a, r) : t+ return i && l ? mo(s, o, e) : Ie(s, e, o)+ }+ }+ )+ }+ function So(t) {+ if (void 0 !== t) return 0+ }+ function Eo(t) {+ if (void 0 !== t) return t+ }+ function wo(t) {+ const e = (2 * Math.PI) / t+ return function (t, i) {+ return i ? t : void 0 !== t ? (t = Math.floor(t / e + 0.5) * e) : void 0+ }+ }+ function To(t) {+ const e = void 0 === t ? Oe(5) : t+ return function (t, i) {+ return i || void 0 === t ? t : Math.abs(t) <= e ? 0 : t+ }+ }+ const Co = 256+ class bo extends V {+ constructor(t) {+ super(),+ this.on,+ this.once,+ this.un,+ (t = Object.assign({}, t)),+ (this.hints_ = [0, 0]),+ (this.animations_ = []),+ this.updateAnimationKey_,+ (this.projection_ = bn(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 && mn(),+ t.center && (t.center = Un(t.center, this.projection_)),+ t.extent && (t.extent = zn(t.extent, this.projection_)),+ this.applyOptions_(t)+ }+ applyOptions_(t) {+ const e = Object.assign({}, t)+ for (const t in go) delete e[t]+ this.setProperties(e, !0)+ const i = Io(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 = Po(t),+ r = i.constraint,+ s = Fo(t)+ ;(this.constraints_ = { center: n, resolution: r, rotation: s }),+ this.setRotation(void 0 !== t.rotation ? t.rotation : 0),+ this.setCenterInternal(void 0 !== t.center ? t.center : null),+ void 0 !== t.resolution ? this.setResolution(t.resolution) : void 0 !== t.zoom && this.setZoom(t.zoom)+ }+ get padding() {+ return this.padding_+ }+ set padding(t) {+ let e = this.padding_+ this.padding_ = t+ const i = this.getCenterInternal()+ if (i) {+ const n = t || [0, 0, 0, 0]+ e = e || [0, 0, 0, 0]+ const r = this.getResolution(),+ s = (r / 2) * (n[3] - e[3] + e[1] - n[1]),+ o = (r / 2) * (n[0] - e[0] + e[2] - n[2])+ this.setCenterInternal([i[0] + s, i[1] - o])+ }+ }+ getUpdatedOptions_(t) {+ const e = this.getProperties()+ return (+ void 0 !== e.resolution ? (e.resolution = this.getResolution()) : (e.zoom = this.getZoom()),+ (e.center = this.getCenterInternal()),+ (e.rotation = this.getRotation()),+ Object.assign({}, e, t)+ )+ }+ animate(t) {+ this.isDef() && !this.getAnimating() && this.resolveConstraints(0)+ const e = new Array(arguments.length)+ for (let t = 0; t < e.length; ++t) {+ let i = arguments[t]+ i.center && ((i = Object.assign({}, i)), (i.center = Un(i.center, this.getProjection()))),+ i.anchor && ((i = Object.assign({}, i)), (i.anchor = Un(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 && Ro(e, !0))+ let r = Date.now(),+ s = this.targetCenter_.slice(),+ o = this.targetResolution_,+ a = this.targetRotation_+ const l = []+ for (; n < i; ++n) {+ const t = arguments[n],+ i = {+ start: r,+ complete: !1,+ anchor: t.anchor,+ duration: void 0 !== t.duration ? t.duration : 1e3,+ easing: t.easing || et,+ callback: e+ }+ if (+ (t.center && ((i.sourceCenter = s), (i.targetCenter = t.center.slice()), (s = i.targetCenter)),+ void 0 !== t.zoom+ ? ((i.sourceResolution = o),+ (i.targetResolution = this.getResolutionForZoom(t.zoom)),+ (o = i.targetResolution))+ : t.resolution && ((i.sourceResolution = o), (i.targetResolution = t.resolution), (o = i.targetResolution)),+ void 0 !== t.rotation)+ ) {+ i.sourceRotation = a+ const e = De(t.rotation - a + Math.PI, 2 * Math.PI) - Math.PI+ ;(i.targetRotation = a + e), (a = i.targetRotation)+ }+ Lo(i) ? (i.complete = !0) : (r += i.duration), l.push(i)+ }+ this.animations_.push(l), this.setHint(co, 1), this.updateAnimations_()+ }+ getAnimating() {+ return this.hints_[co] > 0+ }+ getInteracting() {+ return this.hints_[uo] > 0+ }+ cancelAnimations() {+ let t+ this.setHint(co, -this.hints_[co])+ for (let e = 0, i = this.animations_.length; e < i; ++e) {+ const i = this.animations_[e]+ if ((i[0].callback && Ro(i[0].callback, !1), !t))+ for (let e = 0, n = i.length; e < n; ++e) {+ const n = i[e]+ if (!n.complete) {+ t = n.anchor+ break+ }+ }+ }+ ;(this.animations_.length = 0),+ (this.cancelAnchor_ = t),+ (this.nextCenter_ = null),+ (this.nextResolution_ = NaN),+ (this.nextRotation_ = NaN)+ }+ updateAnimations_() {+ if (+ (void 0 !== this.updateAnimationKey_ &&+ (cancelAnimationFrame(this.updateAnimationKey_), (this.updateAnimationKey_ = void 0)),+ !this.getAnimating())+ )+ return+ const t = Date.now()+ let e = !1+ for (let i = this.animations_.length - 1; i >= 0; --i) {+ const n = this.animations_[i]+ let r = !0+ for (let i = 0, s = n.length; i < s; ++i) {+ const s = n[i]+ if (s.complete) continue+ const o = t - s.start+ let a = s.duration > 0 ? o / s.duration : 1+ a >= 1 ? ((s.complete = !0), (a = 1)) : (r = !1)+ const l = s.easing(a)+ if (s.sourceCenter) {+ const t = s.sourceCenter[0],+ e = s.sourceCenter[1],+ i = s.targetCenter[0],+ n = s.targetCenter[1]+ this.nextCenter_ = s.targetCenter+ const r = t + l * (i - t),+ o = e + l * (n - e)+ this.targetCenter_ = [r, o]+ }+ if (s.sourceResolution && s.targetResolution) {+ const t = 1 === l ? s.targetResolution : s.sourceResolution + l * (s.targetResolution - s.sourceResolution)+ if (s.anchor) {+ const e = this.getViewportSize_(this.getRotation()),+ i = this.constraints_.resolution(t, 0, e, !0)+ this.targetCenter_ = this.calculateCenterZoom(i, s.anchor)+ }+ ;(this.nextResolution_ = s.targetResolution), (this.targetResolution_ = t), this.applyTargetState_(!0)+ }+ if (void 0 !== s.sourceRotation && void 0 !== s.targetRotation) {+ const t =+ 1 === l+ ? De(s.targetRotation + Math.PI, 2 * Math.PI) - Math.PI+ : s.sourceRotation + l * (s.targetRotation - s.sourceRotation)+ if (s.anchor) {+ const e = this.constraints_.rotation(t, !0)+ this.targetCenter_ = this.calculateCenterRotate(e, s.anchor)+ }+ ;(this.nextRotation_ = s.targetRotation), (this.targetRotation_ = t)+ }+ if ((this.applyTargetState_(!0), (e = !0), !s.complete)) break+ }+ if (r) {+ ;(this.animations_[i] = null),+ this.setHint(co, -1),+ (this.nextCenter_ = null),+ (this.nextResolution_ = NaN),+ (this.nextRotation_ = NaN)+ const t = n[0].callback+ t && Ro(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]]), si(i, t - this.getRotation()), Qe(i, e)), i+ }+ calculateCenterZoom(t, e) {+ let i+ const n = this.getCenterInternal(),+ r = this.getResolution()+ if (void 0 !== n && void 0 !== r) {+ i = [e[0] - (t * (e[0] - n[0])) / r, e[1] - (t * (e[1] - n[1])) / r]+ }+ 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 ? jn(t, this.getProjection()) : t+ }+ getCenterInternal() {+ return this.get(go.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 Bn(this.calculateExtentInternal(t), this.getProjection())+ }+ calculateExtentInternal(t) {+ t = t || this.getViewportSizeMinusPadding_()+ const e = this.getCenterInternal()+ Mt(e, "The view center is not defined")+ const i = this.getResolution()+ Mt(void 0 !== i, "The view resolution is not defined")+ const n = this.getRotation()+ return Mt(void 0 !== n, "The view rotation is not defined"), fe(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(go.RESOLUTION)+ }+ getResolutions() {+ return this.resolutions_+ }+ getResolutionForExtent(t, e) {+ return this.getResolutionForExtentInternal(zn(t, this.getProjection()), e)+ }+ getResolutionForExtentInternal(t, e) {+ e = e || this.getViewportSizeMinusPadding_()+ const i = ve(t) / e[0],+ n = _e(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(go.ROTATION)+ }+ getValueForResolutionFunction(t) {+ const e = Math.log(t || 2),+ i = this.getConstrainedResolution(this.maxResolution_),+ n = this.minResolution_,+ r = Math.log(i / n) / e+ return function (t) {+ return Math.log(i / t) / e / r+ }+ }+ getViewportSizeMinusPadding_(t) {+ let e = this.getViewportSize_(t)+ const i = this.padding_+ return i && (e = [e[0] - i[1] - i[3], e[1] - i[0] - i[2]]), e+ }+ getState() {+ const t = this.getProjection(),+ e = this.getResolution(),+ i = this.getRotation()+ let n = this.getCenterInternal()+ const r = this.padding_+ if (r) {+ const t = this.getViewportSizeMinusPadding_()+ n = Mo(n, this.getViewportSize_(), [t[0] / 2 + r[3], t[1] / 2 + r[0]], e, i)+ }+ return {+ center: n.slice(0),+ projection: void 0 !== t ? t : null,+ resolution: e,+ nextCenter: this.nextCenter_,+ nextResolution: this.nextResolution_,+ nextRotation: this.nextRotation_,+ rotation: i,+ zoom: this.getZoom()+ }+ }+ getViewStateAndExtent() {+ return { viewState: this.getState(), extent: this.calculateExtent() }+ }+ getZoom() {+ let t+ const e = this.getResolution()+ return void 0 !== e && (t = this.getZoomForResolution(e)), t+ }+ getZoomForResolution(t) {+ let e,+ i,+ n = this.minZoom_ || 0+ if (this.resolutions_) {+ const r = v(this.resolutions_, t, 1)+ ;(n = r), (e = this.resolutions_[r]), (i = r == this.resolutions_.length - 1 ? 2 : e / this.resolutions_[r + 1])+ } else (e = this.maxResolution_), (i = this.zoomFactor_)+ return n + Math.log(e / t) / Math.log(i)+ }+ getResolutionForZoom(t) {+ if (this.resolutions_?.length) {+ if (1 === this.resolutions_.length) return this.resolutions_[0]+ const e = Ie(Math.floor(t), 0, this.resolutions_.length - 2),+ i = this.resolutions_[e] / this.resolutions_[e + 1]+ return this.resolutions_[e] / Math.pow(i, Ie(t - e, 0, 1))+ }+ return this.maxResolution_ / Math.pow(this.zoomFactor_, t - this.minZoom_)+ }+ fit(t, e) {+ let i+ if (+ (Mt(+ Array.isArray(t) || "function" == typeof t.getSimplifiedGeometry,+ "Invalid extent or geometry provided as `geometry`"+ ),+ Array.isArray(t))+ ) {+ Mt(!Ee(t), "Cannot fit empty extent provided as `geometry`")+ i = ps(zn(t, this.getProjection()))+ } else if ("Circle" === t.getType()) {+ const e = zn(t.getExtent(), this.getProjection())+ ;(i = ps(e)), i.rotate(this.getRotation(), de(e))+ } else {+ const e = Gn()+ i = e ? t.clone().transform(e, this.getProjection()) : t+ }+ this.fitInternal(i, e)+ }+ rotatedExtentForGeometry(t) {+ const e = this.getRotation(),+ i = Math.cos(e),+ n = Math.sin(-e),+ r = t.getFlatCoordinates(),+ s = t.getStride()+ let o = 1 / 0,+ a = 1 / 0,+ l = -1 / 0,+ h = -1 / 0+ for (let t = 0, e = r.length; t < e; t += s) {+ const e = r[t] * i - r[t + 1] * n,+ s = r[t] * n + r[t + 1] * i+ ;(o = Math.min(o, e)), (a = Math.min(a, s)), (l = Math.max(l, e)), (h = Math.max(h, s))+ }+ return [o, a, l, h]+ }+ fitInternal(t, e) {+ let i = (e = e || {}).size+ i || (i = this.getViewportSizeMinusPadding_())+ const n = void 0 !== e.padding ? e.padding : [0, 0, 0, 0],+ r = void 0 !== e.nearest && e.nearest+ let s+ s = void 0 !== e.minResolution ? e.minResolution : void 0 !== e.maxZoom ? this.getResolutionForZoom(e.maxZoom) : 0+ const o = this.rotatedExtentForGeometry(t)+ let a = this.getResolutionForExtentInternal(o, [i[0] - n[1] - n[3], i[1] - n[0] - n[2]])+ ;(a = isNaN(a) ? s : Math.max(a, s)), (a = this.getConstrainedResolution(a, r ? 0 : 1))+ const l = this.getRotation(),+ h = Math.sin(l),+ c = Math.cos(l),+ u = de(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),+ p = e.callback ? e.callback : R+ void 0 !== e.duration+ ? this.animateInternal({ resolution: a, center: f, duration: e.duration, easing: e.easing }, p)+ : ((this.targetResolution_ = a), (this.targetCenter_ = f), this.applyTargetState_(!1, !0), Ro(p, !0))+ }+ centerOn(t, e, i) {+ this.centerOnInternal(Un(t, this.getProjection()), e, i)+ }+ centerOnInternal(t, e, i) {+ this.setCenterInternal(Mo(t, e, i, this.getResolution(), this.getRotation()))+ }+ calculateCenterShift(t, e, i, n) {+ let r+ const s = this.padding_+ if (s && t) {+ const o = this.getViewportSizeMinusPadding_(-i),+ a = Mo(t, n, [o[0] / 2 + s[3], o[1] / 2 + s[0]], e, i)+ r = [t[0] - a[0], t[1] - a[1]]+ }+ return r+ }+ isDef() {+ return !!this.getCenterInternal() && void 0 !== this.getResolution()+ }+ adjustCenter(t) {+ const e = jn(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 && Un(e, this.getProjection())), this.adjustResolutionInternal(t, e)+ }+ adjustResolutionInternal(t, e) {+ const i = this.getAnimating() || this.getInteracting(),+ n = this.getViewportSize_(this.getRotation()),+ r = this.constraints_.resolution(this.targetResolution_ * t, 0, n, i)+ e && (this.targetCenter_ = this.calculateCenterZoom(r, e)),+ (this.targetResolution_ *= t),+ this.applyTargetState_()+ }+ adjustZoom(t, e) {+ this.adjustResolution(Math.pow(this.zoomFactor_, -t), e)+ }+ adjustRotation(t, e) {+ e && (e = Un(e, this.getProjection())), this.adjustRotationInternal(t, e)+ }+ adjustRotationInternal(t, e) {+ const i = this.getAnimating() || this.getInteracting(),+ n = this.constraints_.rotation(this.targetRotation_ + t, i)+ e && (this.targetCenter_ = this.calculateCenterRotate(n, e)),+ (this.targetRotation_ += t),+ this.applyTargetState_()+ }+ setCenter(t) {+ this.setCenterInternal(t ? Un(t, this.getProjection()) : t)+ }+ setCenterInternal(t) {+ ;(this.targetCenter_ = t), this.applyTargetState_()+ }+ setHint(t, e) {+ return (this.hints_[t] += e), this.changed(), this.hints_[t]+ }+ setResolution(t) {+ ;(this.targetResolution_ = t), this.applyTargetState_()+ }+ setRotation(t) {+ ;(this.targetRotation_ = t), this.applyTargetState_()+ }+ setZoom(t) {+ this.setResolution(this.getResolutionForZoom(t))+ }+ applyTargetState_(t, e) {+ const i = this.getAnimating() || this.getInteracting() || e,+ n = this.constraints_.rotation(this.targetRotation_, i),+ r = this.getViewportSize_(n),+ s = this.constraints_.resolution(this.targetResolution_, 0, r, i),+ o = this.constraints_.center(+ this.targetCenter_,+ s,+ r,+ i,+ this.calculateCenterShift(this.targetCenter_, s, n, r)+ )+ this.get(go.ROTATION) !== n && this.set(go.ROTATION, n),+ this.get(go.RESOLUTION) !== s && (this.set(go.RESOLUTION, s), this.set("zoom", this.getZoom(), !0)),+ (o && this.get(go.CENTER) && ri(this.get(go.CENTER), o)) || this.set(go.CENTER, o),+ this.getAnimating() && !t && this.cancelAnimations(),+ (this.cancelAnchor_ = void 0)+ }+ resolveConstraints(t, e, i) {+ t = void 0 !== t ? t : 200+ const n = e || 0,+ r = this.constraints_.rotation(this.targetRotation_),+ s = this.getViewportSize_(r),+ o = this.constraints_.resolution(this.targetResolution_, n, s),+ a = this.constraints_.center(+ this.targetCenter_,+ o,+ s,+ !1,+ this.calculateCenterShift(this.targetCenter_, o, r, s)+ )+ if (0 === t && !this.cancelAnchor_)+ return (+ (this.targetResolution_ = o),+ (this.targetRotation_ = r),+ (this.targetCenter_ = a),+ void this.applyTargetState_()+ )+ ;(i = i || (0 === t ? this.cancelAnchor_ : void 0)),+ (this.cancelAnchor_ = void 0),+ (this.getResolution() === o &&+ this.getRotation() === r &&+ this.getCenterInternal() &&+ ri(this.getCenterInternal(), a)) ||+ (this.getAnimating() && this.cancelAnimations(),+ this.animateInternal({ rotation: r, center: a, resolution: o, duration: t, easing: tt, anchor: i }))+ }+ beginInteraction() {+ this.resolveConstraints(0), this.setHint(uo, 1)+ }+ endInteraction(t, e, i) {+ ;(i = i && Un(i, this.getProjection())), this.endInteractionInternal(t, e, i)+ }+ endInteractionInternal(t, e, i) {+ this.getInteracting() && (this.setHint(uo, -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 Ro(t, e) {+ setTimeout(function () {+ t(e)+ }, 0)+ }+ function Po(t) {+ if (void 0 !== t.extent) {+ const e = void 0 === t.smoothExtentConstraint || t.smoothExtentConstraint+ return fo(t.extent, t.constrainOnlyCenter, e)+ }+ const e = bn(t.projection, "EPSG:3857")+ if (!0 !== t.multiWorld && e.isGlobal()) {+ const t = e.getExtent().slice()+ return (t[0] = -1 / 0), (t[2] = 1 / 0), fo(t, !1, !1)+ }+ return po+ }+ function Io(t) {+ let e, i, n+ let r = void 0 !== t.minZoom ? t.minZoom : 0,+ s = void 0 !== t.maxZoom ? t.maxZoom : 28+ const o = void 0 !== t.zoomFactor ? t.zoomFactor : 2,+ a = void 0 !== t.multiWorld && t.multiWorld,+ l = void 0 === t.smoothResolutionConstraint || t.smoothResolutionConstraint,+ h = void 0 !== t.showFullExtent && t.showFullExtent,+ c = bn(t.projection, "EPSG:3857"),+ u = c.getExtent()+ let d = t.constrainOnlyCenter,+ g = t.extent+ if ((a || g || !c.isGlobal() || ((d = !1), (g = u)), void 0 !== t.resolutions)) {+ const o = t.resolutions+ ;(i = o[r]),+ (n = void 0 !== o[s] ? o[s] : o[o.length - 1]),+ (e = t.constrainResolution ? yo(o, l, !d && g, h) : vo(i, n, l, !d && g, h))+ } else {+ const a = (u ? Math.max(ve(u), _e(u)) : (360 * _i.degrees) / c.getMetersPerUnit()) / Co / Math.pow(2, 0),+ f = a / Math.pow(2, 28)+ ;(i = t.maxResolution),+ void 0 !== i ? (r = 0) : (i = a / Math.pow(o, r)),+ (n = t.minResolution),+ void 0 === n &&+ (n = void 0 !== t.maxZoom ? (void 0 !== t.maxResolution ? i / Math.pow(o, s) : a / Math.pow(o, s)) : f),+ (s = r + Math.floor(Math.log(i / n) / Math.log(o))),+ (n = i / Math.pow(o, s - r)),+ (e = t.constrainResolution ? xo(o, i, n, l, !d && g, h) : vo(i, n, l, !d && g, h))+ }+ return { constraint: e, maxResolution: i, minResolution: n, minZoom: r, zoomFactor: o }+ }+ function Fo(t) {+ if (void 0 === t.enableRotation || t.enableRotation) {+ const e = t.constrainRotation+ return void 0 === e || !0 === e ? To() : !1 === e ? Eo : "number" == typeof e ? wo(e) : Eo+ }+ return So+ }+ function Lo(t) {+ return (+ !(t.sourceCenter && t.targetCenter && !ri(t.sourceCenter, t.targetCenter)) &&+ t.sourceResolution === t.targetResolution &&+ t.sourceRotation === t.targetRotation+ )+ }+ function Mo(t, e, i, n, r) {+ const s = Math.cos(-r)+ let o = Math.sin(-r),+ a = t[0] * s - t[1] * o,+ l = t[1] * s + t[0] * o+ ;(a += (e[0] / 2 - i[0]) * n), (l += (i[1] - e[1] / 2) * n), (o = -o)+ return [a * s - l * o, l * s + a * o]+ }+ const Ao = "ol-hidden",+ Oo = "ol-selectable",+ Do = "ol-unselectable",+ No = "ol-unsupported",+ ko = "ol-control",+ Go = "ol-collapsed",+ jo = 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"+ ),+ Uo = ["style", "variant", "weight", "size", "lineHeight", "family"],+ Bo = { normal: 400, bold: 700 },+ zo = function (t) {+ const e = t.match(jo)+ if (!e) return null+ const i = { lineHeight: "normal", size: "1.2em", style: "normal", weight: "400", variant: "normal" }+ for (let t = 0, n = Uo.length; t < n; ++t) {+ const n = e[t + 1]+ void 0 !== n && (i[Uo[t]] = "string" == typeof n ? n.trim() : n)+ }+ return (+ isNaN(Number(i.weight)) && i.weight in Bo && (i.weight = Bo[i.weight]),+ (i.families = i.family.split(/,\s?/).map((t) => t.trim().replace(/^['"]|['"]$/g, ""))),+ i+ )+ }+ class Xo extends V {+ 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) k(this.listenerKeys[t])+ if (((this.listenerKeys.length = 0), (this.map_ = t), t)) {+ const e = this.target_ ?? t.getOverlayContainerStopEvent()+ this.element && e.appendChild(this.element),+ this.render !== R && this.listenerKeys.push(D(t, qs, this.render, this)),+ t.render()+ }+ }+ render(t) {}+ setTarget(t) {+ this.target_ = "string" == typeof t ? document.getElementById(t) : t+ }+ }+ class Vo extends Xo {+ constructor(t) {+ ;(t = t || {}),+ super({ element: document.createElement("div"), render: t.render, target: t.target }),+ (this.ulElement_ = document.createElement("ul")),+ (this.collapsed_ = void 0 === t.collapsed || t.collapsed),+ (this.userCollapsed_ = this.collapsed_),+ (this.overrideCollapsible_ = void 0 !== t.collapsible),+ (this.collapsible_ = void 0 === t.collapsible || t.collapsible),+ this.collapsible_ || (this.collapsed_ = !1),+ (this.attributions_ = t.attributions)+ const e = void 0 !== t.className ? t.className : "ol-attribution",+ i = void 0 !== t.tipLabel ? t.tipLabel : "Attributions",+ n = void 0 !== t.expandClassName ? t.expandClassName : e + "-expand",+ r = void 0 !== t.collapseLabel ? t.collapseLabel : "›",+ s = void 0 !== t.collapseClassName ? t.collapseClassName : e + "-collapse"+ "string" == typeof r+ ? ((this.collapseLabel_ = document.createElement("span")),+ (this.collapseLabel_.textContent = r),+ (this.collapseLabel_.className = s))+ : (this.collapseLabel_ = r)+ const a = void 0 !== t.label ? t.label : "i"+ "string" == typeof a+ ? ((this.label_ = document.createElement("span")), (this.label_.textContent = a), (this.label_.className = n))+ : (this.label_ = a)+ const l = this.collapsible_ && !this.collapsed_ ? this.collapseLabel_ : this.label_+ ;(this.toggleButton_ = document.createElement("button")),+ this.toggleButton_.setAttribute("type", "button"),+ this.toggleButton_.setAttribute("aria-expanded", String(!this.collapsed_)),+ (this.toggleButton_.title = i),+ this.toggleButton_.appendChild(l),+ this.toggleButton_.addEventListener(o, this.handleClick_.bind(this), !1)+ const h =+ e ++ " " ++ Do ++ " " ++ ko ++ (this.collapsed_ && this.collapsible_ ? " " + Go : "") ++ (this.collapsible_ ? "" : " ol-uncollapsible"),+ c = this.element+ ;(c.className = h),+ c.appendChild(this.toggleButton_),+ c.appendChild(this.ulElement_),+ (this.renderedAttributions_ = []),+ (this.renderedVisible_ = !0)+ }+ collectSourceAttributions_(t) {+ const e = this.getMap().getAllLayers(),+ i = new Set(e.flatMap((e) => e.getAttributions(t)))+ if (+ (void 0 !== this.attributions_ &&+ (Array.isArray(this.attributions_) ? this.attributions_.forEach((t) => i.add(t)) : i.add(this.attributions_)),+ !this.overrideCollapsible_)+ ) {+ const t = !e.some((t) => !1 === t.getSource()?.getAttributionsCollapsible())+ this.setCollapsible(t)+ }+ return Array.from(i)+ }+ async updateElement_(t) {+ if (!t)+ return void (this.renderedVisible_ && ((this.element.style.display = "none"), (this.renderedVisible_ = !1)))+ const e = await Promise.all(this.collectSourceAttributions_(t).map((t) => I(() => t))),+ i = e.length > 0+ if (+ (this.renderedVisible_ != i && ((this.element.style.display = i ? "" : "none"), (this.renderedVisible_ = i)),+ !w(e, this.renderedAttributions_))+ ) {+ St(this.ulElement_)+ for (let t = 0, i = e.length; t < i; ++t) {+ const i = document.createElement("li")+ ;(i.innerHTML = e[t]), this.ulElement_.appendChild(i)+ }+ this.renderedAttributions_ = e+ }+ }+ handleClick_(t) {+ t.preventDefault(), this.handleToggle_(), (this.userCollapsed_ = this.collapsed_)+ }+ handleToggle_() {+ this.element.classList.toggle(Go),+ this.collapsed_ ? vt(this.collapseLabel_, this.label_) : vt(this.label_, this.collapseLabel_),+ (this.collapsed_ = !this.collapsed_),+ this.toggleButton_.setAttribute("aria-expanded", String(!this.collapsed_))+ }+ getCollapsible() {+ return this.collapsible_+ }+ setCollapsible(t) {+ this.collapsible_ !== t &&+ ((this.collapsible_ = t),+ this.element.classList.toggle("ol-uncollapsible"),+ this.userCollapsed_ && this.handleToggle_())+ }+ setCollapsed(t) {+ ;(this.userCollapsed_ = t), this.collapsible_ && this.collapsed_ !== t && this.handleToggle_()+ }+ getCollapsed() {+ return this.collapsed_+ }+ render(t) {+ this.updateElement_(t.frameState)+ }+ }+ class $o extends Xo {+ constructor(t) {+ ;(t = t || {}), super({ element: document.createElement("div"), render: t.render, target: t.target })+ const e = void 0 !== t.className ? t.className : "ol-rotate",+ i = void 0 !== t.label ? t.label : "⇧",+ n = void 0 !== t.compassClassName ? t.compassClassName : "ol-compass"+ ;(this.label_ = null),+ "string" == typeof i+ ? ((this.label_ = document.createElement("span")), (this.label_.className = n), (this.label_.textContent = i))+ : ((this.label_ = i), this.label_.classList.add(n))+ const r = t.tipLabel ? t.tipLabel : "Reset rotation",+ s = document.createElement("button")+ ;(s.className = e + "-reset"),+ s.setAttribute("type", "button"),+ (s.title = r),+ s.appendChild(this.label_),+ s.addEventListener(o, this.handleClick_.bind(this), !1)+ const a = e + " " + Do + " " + ko,+ l = this.element+ ;(l.className = a),+ l.appendChild(s),+ (this.callResetNorth_ = t.resetNorth ? t.resetNorth : void 0),+ (this.duration_ = void 0 !== t.duration ? t.duration : 250),+ (this.autoHide_ = void 0 === t.autoHide || t.autoHide),+ (this.rotation_ = void 0),+ this.autoHide_ && this.element.classList.add(Ao)+ }+ handleClick_(t) {+ t.preventDefault(), void 0 !== this.callResetNorth_ ? this.callResetNorth_() : this.resetNorth_()+ }+ resetNorth_() {+ const t = this.getMap().getView()+ if (!t) return+ const e = t.getRotation()+ void 0 !== e &&+ (this.duration_ > 0 && e % (2 * Math.PI) != 0+ ? t.animate({ rotation: 0, duration: this.duration_, easing: tt })+ : t.setRotation(0))+ }+ render(t) {+ const e = t.frameState+ if (!e) return+ const i = e.viewState.rotation+ if (i != this.rotation_) {+ const t = "rotate(" + i + "rad)"+ if (this.autoHide_) {+ const t = this.element.classList.contains(Ao)+ t || 0 !== i ? t && 0 !== i && this.element.classList.remove(Ao) : this.element.classList.add(Ao)+ }+ this.label_.style.transform = t+ }+ this.rotation_ = i+ }+ }+ class Wo extends Xo {+ constructor(t) {+ ;(t = t || {}), super({ element: document.createElement("div"), target: t.target })+ const e = void 0 !== t.className ? t.className : "ol-zoom",+ i = void 0 !== t.delta ? t.delta : 1,+ n = void 0 !== t.zoomInClassName ? t.zoomInClassName : e + "-in",+ r = void 0 !== t.zoomOutClassName ? t.zoomOutClassName : e + "-out",+ s = void 0 !== t.zoomInLabel ? t.zoomInLabel : "+",+ a = void 0 !== t.zoomOutLabel ? t.zoomOutLabel : "–",+ l = void 0 !== t.zoomInTipLabel ? t.zoomInTipLabel : "Zoom in",+ h = void 0 !== t.zoomOutTipLabel ? t.zoomOutTipLabel : "Zoom out",+ c = document.createElement("button")+ ;(c.className = n),+ c.setAttribute("type", "button"),+ (c.title = l),+ c.appendChild("string" == typeof s ? document.createTextNode(s) : s),+ c.addEventListener(o, this.handleClick_.bind(this, i), !1)+ const u = document.createElement("button")+ ;(u.className = r),+ u.setAttribute("type", "button"),+ (u.title = h),+ u.appendChild("string" == typeof a ? document.createTextNode(a) : a),+ u.addEventListener(o, this.handleClick_.bind(this, -i), !1)+ const d = e + " " + Do + " " + ko,+ g = this.element+ ;(g.className = d),+ g.appendChild(c),+ g.appendChild(u),+ (this.duration_ = void 0 !== t.duration ? t.duration : 250)+ }+ handleClick_(t, e) {+ e.preventDefault(), this.zoomByDelta_(t)+ }+ zoomByDelta_(t) {+ const e = this.getMap().getView()+ if (!e) return+ const i = e.getZoom()+ if (void 0 !== i) {+ const n = e.getConstrainedZoom(i + t)+ this.duration_ > 0+ ? (e.getAnimating() && e.cancelAnimations(), e.animate({ zoom: n, duration: this.duration_, easing: tt }))+ : e.setZoom(n)+ }+ }+ }+ function Zo(t) {+ t = t || {}+ const e = new Z()+ ;(void 0 === t.zoom || t.zoom) && e.push(new Wo(t.zoomOptions))+ ;(void 0 === t.rotate || t.rotate) && e.push(new $o(t.rotateOptions))+ return (void 0 === t.attribution || t.attribution) && e.push(new Vo(t.attributionOptions)), e+ }+ var Yo = "active"+ class Ho extends V {+ 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(Yo)+ }+ getMap() {+ return this.map_+ }+ handleEvent(t) {+ return !0+ }+ setActive(t) {+ this.set(Yo, t)+ }+ setMap(t) {+ this.map_ = t+ }+ }+ function Ko(t, e, i) {+ const n = t.getCenterInternal()+ if (n) {+ const r = [n[0] + e[0], n[1] + e[1]]+ t.animateInternal({ duration: void 0 !== i ? i : 250, easing: it, center: t.getConstrainedCenter(r) })+ }+ }+ function qo(t, e, i, n) {+ const r = t.getZoom()+ if (void 0 === r) return+ const s = t.getConstrainedZoom(r + e),+ o = t.getResolutionForZoom(s)+ t.getAnimating() && t.cancelAnimations(),+ t.animate({ resolution: o, anchor: i, duration: void 0 !== n ? n : 250, easing: tt })+ }+ class Jo extends Ho {+ 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 == $s.DBLCLICK) {+ const i = t.originalEvent,+ n = t.map,+ r = t.coordinate,+ s = i.shiftKey ? -this.delta_ : this.delta_+ qo(n.getView(), s, r, this.duration_), i.preventDefault(), (e = !0)+ }+ return !e+ }+ }+ function Qo(t) {+ const e = arguments+ return function (t) {+ let i = !0+ for (let n = 0, r = e.length; n < r && ((i = i && e[n](t)), i); ++n);+ return i+ }+ }+ const ta = function (t) {+ const e = t.originalEvent+ return e.altKey && !(e.metaKey || e.ctrlKey) && !e.shiftKey+ },+ ea = function (t) {+ const e = t.originalEvent+ return e.altKey && !(e.metaKey || e.ctrlKey) && e.shiftKey+ },+ ia = function (t) {+ const e = t.map.getTargetElement(),+ i = e.getRootNode(),+ n = t.map.getOwnerDocument().activeElement+ return i instanceof ShadowRoot ? i.host.contains(n) : e.contains(n)+ },+ na = function (t) {+ const e = t.map.getTargetElement(),+ i = e.getRootNode()+ return !(i instanceof ShadowRoot ? i.host : e).hasAttribute("tabindex") || ia(t)+ },+ ra = C,+ sa = function (t) {+ const e = t.originalEvent+ return "pointerId" in e && 0 == e.button && !(at && lt && e.ctrlKey)+ },+ oa = b,+ aa = function (t) {+ return t.type == $s.SINGLECLICK+ },+ la = function (t) {+ const e = t.originalEvent+ return !e.altKey && !(e.metaKey || e.ctrlKey) && !e.shiftKey+ },+ ha = function (t) {+ const e = t.originalEvent+ return lt ? e.metaKey : e.ctrlKey+ },+ ca = function (t) {+ const e = t.originalEvent+ return !e.altKey && !(e.metaKey || e.ctrlKey) && e.shiftKey+ },+ ua = function (t) {+ const e = t.originalEvent,+ i = e.target.tagName+ return "INPUT" !== i && "SELECT" !== i && "TEXTAREA" !== i && !e.target.isContentEditable+ },+ da = function (t) {+ const e = t.originalEvent+ return "pointerId" in e && "mouse" == e.pointerType+ },+ ga = function (t) {+ const e = t.originalEvent+ return "pointerId" in e && e.isPrimary && 0 === e.button+ }+ class fa extends Ho {+ 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 == $s.POINTERDRAG) this.handleDragEvent(t), t.originalEvent.preventDefault()+ else if (t.type == $s.POINTERUP) {+ const e = this.handleUpEvent(t)+ this.handlingDownUpSequence = e && this.targetPointers.length > 0+ }+ } else if (t.type == $s.POINTERDOWN) {+ const i = this.handleDownEvent(t)+ ;(this.handlingDownUpSequence = i), (e = this.stopDown(i))+ } else t.type == $s.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 pa(t) {+ const e = t.length+ let i = 0,+ n = 0+ for (let r = 0; r < e; r++) (i += t[r].clientX), (n += t[r].clientY)+ return { clientX: i / e, clientY: n / e }+ }+ class _a extends fa {+ constructor(t) {+ super({ stopDown: b }),+ (t = t || {}),+ (this.kinetic_ = t.kinetic),+ (this.lastCentroid = null),+ this.lastPointersCount_,+ (this.panning_ = !1)+ const e = t.condition ? t.condition : Qo(la, ga)+ ;(this.condition_ = t.onFocusOnly ? Qo(na, 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(pa(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()+ oi(e, i.getResolution()), si(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(),+ r = i.getCenterInternal(),+ s = e.getPixelFromCoordinateInternal(r),+ o = e.getCoordinateFromPixelInternal([s[0] - t * Math.cos(n), s[1] - t * Math.sin(n)])+ i.animateInternal({ center: i.getConstrainedCenter(o), duration: 500, easing: tt })+ }+ 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 ma extends fa {+ constructor(t) {+ ;(t = t || {}),+ super({ stopDown: b }),+ (this.condition_ = t.condition ? t.condition : ea),+ (this.lastAngle_ = void 0),+ (this.duration_ = void 0 !== t.duration ? t.duration : 250)+ }+ handleDragEvent(t) {+ if (!da(t)) return+ const e = t.map,+ i = e.getView()+ if (i.getConstraints().rotation === So) return+ const n = e.getSize(),+ r = t.pixel,+ s = Math.atan2(n[1] / 2 - r[1], r[0] - n[0] / 2)+ if (void 0 !== this.lastAngle_) {+ const t = s - this.lastAngle_+ i.adjustRotationInternal(-t)+ }+ this.lastAngle_ = s+ }+ handleUpEvent(t) {+ if (!da(t)) return !0+ return t.map.getView().endInteraction(this.duration_), !1+ }+ handleDownEvent(t) {+ if (!da(t)) return !1+ if (sa(t) && this.condition_(t)) {+ return t.map.getView().beginInteraction(), (this.lastAngle_ = void 0), !0+ }+ return !1+ }+ }+ class ya extends _ {+ constructor(t) {+ super(),+ (this.geometry_ = null),+ (this.element_ = document.createElement("div")),+ (this.element_.style.position = "absolute"),+ (this.element_.style.pointerEvents = "auto"),+ (this.element_.className = "ol-box " + t),+ (this.map_ = null),+ (this.startPixel_ = null),+ (this.endPixel_ = null)+ }+ disposeInternal() {+ this.setMap(null)+ }+ render_() {+ const t = this.startPixel_,+ e = this.endPixel_,+ i = "px",+ n = this.element_.style+ ;(n.left = Math.min(t[0], e[0]) + i),+ (n.top = Math.min(t[1], e[1]) + i),+ (n.width = Math.abs(e[0] - t[0]) + i),+ (n.height = Math.abs(e[1] - t[1]) + i)+ }+ setMap(t) {+ if (this.map_) {+ this.map_.getOverlayContainer().removeChild(this.element_)+ const t = this.element_.style+ ;(t.left = "inherit"), (t.top = "inherit"), (t.width = "inherit"), (t.height = "inherit")+ }+ ;(this.map_ = t), this.map_ && this.map_.getOverlayContainer().appendChild(this.element_)+ }+ setPixels(t, e) {+ ;(this.startPixel_ = t), (this.endPixel_ = e), this.createOrUpdateGeometry(), this.render_()+ }+ createOrUpdateGeometry() {+ if (!this.map_) return+ const t = this.startPixel_,+ e = this.endPixel_,+ i = [t, [t[0], e[1]], e, [e[0], t[1]]].map(this.map_.getCoordinateFromPixelInternal, this.map_)+ ;(i[4] = i[0].slice()), this.geometry_ ? this.geometry_.setCoordinates([i]) : (this.geometry_ = new gs([i]))+ }+ getGeometry() {+ return this.geometry_+ }+ }+ const xa = "boxstart",+ va = "boxdrag",+ Sa = "boxend",+ Ea = "boxcancel"+ class wa extends M {+ constructor(t, e, i) {+ super(t), (this.coordinate = e), (this.mapBrowserEvent = i)+ }+ }+ class Ta extends fa {+ constructor(t) {+ super(),+ this.on,+ this.once,+ this.un,+ (t = t ?? {}),+ (this.box_ = new ya(t.className || "ol-dragbox")),+ (this.minArea_ = t.minArea ?? 64),+ t.onBoxEnd && (this.onBoxEnd = t.onBoxEnd),+ (this.startPixel_ = null),+ (this.condition_ = t.condition ?? sa),+ (this.boxEndCondition_ = t.boxEndCondition ?? this.defaultBoxEndCondition)+ }+ defaultBoxEndCondition(t, e, i) {+ const n = i[0] - e[0],+ r = i[1] - e[1]+ return n * n + r * r >= this.minArea_+ }+ getGeometry() {+ return this.box_.getGeometry()+ }+ handleDragEvent(t) {+ this.startPixel_ &&+ (this.box_.setPixels(this.startPixel_, t.pixel), this.dispatchEvent(new wa(va, 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 wa(e ? Sa : Ea, 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 wa(xa, t.coordinate, t)),+ !0)+ )+ }+ onBoxEnd(t) {}+ setActive(t) {+ t ||+ (this.box_.setMap(null),+ this.startPixel_ && (this.dispatchEvent(new wa(Ea, this.startPixel_, null)), (this.startPixel_ = null))),+ super.setActive(t)+ }+ setMap(t) {+ this.getMap() &&+ (this.box_.setMap(null),+ this.startPixel_ && (this.dispatchEvent(new wa(Ea, this.startPixel_, null)), (this.startPixel_ = null))),+ super.setMap(t)+ }+ }+ class Ca extends Ta {+ constructor(t) {+ super({+ condition: (t = t || {}).condition ? t.condition : ca,+ className: t.className || "ol-dragzoom",+ minArea: t.minArea+ }),+ (this.duration_ = void 0 !== t.duration ? t.duration : 200),+ (this.out_ = void 0 !== t.out && t.out)+ }+ onBoxEnd(t) {+ const e = this.getMap().getView()+ let i = this.getGeometry()+ if (this.out_) {+ const t = e.rotatedExtentForGeometry(i),+ n = e.getResolutionForExtentInternal(t),+ r = e.getResolution() / n+ ;(i = i.clone()), i.scale(r * r)+ }+ e.fitInternal(i, { duration: this.duration_, easing: tt })+ }+ }+ var ba = "ArrowLeft",+ Ra = "ArrowUp",+ Pa = "ArrowRight",+ Ia = "ArrowDown"+ class Fa extends Ho {+ constructor(t) {+ super(),+ (t = t || {}),+ (this.defaultCondition_ = function (t) {+ return la(t) && ua(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 == u) {+ const i = t.originalEvent,+ n = i.key+ if (this.condition_(t) && (n == Ia || n == ba || n == Pa || n == Ra)) {+ const r = t.map.getView(),+ s = r.getResolution() * this.pixelDelta_+ let o = 0,+ a = 0+ n == Ia ? (a = -s) : n == ba ? (o = -s) : n == Pa ? (o = s) : (a = s)+ const l = [o, a]+ si(l, r.getRotation()), Ko(r, l, this.duration_), i.preventDefault(), (e = !0)+ }+ }+ return !e+ }+ }+ class La extends Ho {+ constructor(t) {+ super(),+ (t = t || {}),+ (this.condition_ = t.condition+ ? t.condition+ : function (t) {+ return !ha(t) && ua(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 == u || t.type == d) {+ const i = t.originalEvent,+ n = i.key+ if (this.condition_(t) && ("+" === n || "-" === n)) {+ const r = t.map,+ s = "+" === n ? this.delta_ : -this.delta_+ qo(r.getView(), s, void 0, this.duration_), i.preventDefault(), (e = !0)+ }+ }+ return !e+ }+ }+ class Ma extends Ho {+ 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 : ra+ ;(this.condition_ = t.onFocusOnly ? Qo(na, e) : e),+ (this.lastAnchor_ = null),+ (this.startTime_ = void 0),+ this.timeoutId_,+ (this.mode_ = void 0),+ (this.trackpadEventGap_ = 400),+ this.trackpadTimeoutId_,+ (this.deltaPerZoom_ = 300)+ }+ endInteraction_() {+ this.trackpadTimeoutId_ = void 0+ const t = this.getMap()+ if (!t) return+ t.getView().endInteraction(+ void 0,+ this.lastDelta_ ? (this.lastDelta_ > 0 ? 1 : -1) : 0,+ this.lastAnchor_ ? t.getCoordinateFromPixel(this.lastAnchor_) : null+ )+ }+ handleEvent(t) {+ if (!this.condition_(t)) return !0+ if (t.type !== p) return !0+ const e = t.map,+ i = t.originalEvent+ i.preventDefault(), this.useAnchor_ && (this.lastAnchor_ = t.pixel)+ let n = i.deltaY+ switch (i.deltaMode) {+ case WheelEvent.DOM_DELTA_LINE:+ n *= 40+ break+ case WheelEvent.DOM_DELTA_PAGE:+ n *= 300+ }+ if (0 === n) return !1+ this.lastDelta_ = n+ const r = Date.now()+ void 0 === this.startTime_ && (this.startTime_ = r),+ (!this.mode_ || r - this.startTime_ > this.trackpadEventGap_) &&+ (this.mode_ = Math.abs(n) < 4 ? "trackpad" : "wheel")+ const s = e.getView()+ if ("trackpad" === this.mode_ && !s.getConstrainResolution() && !this.constrainResolution_)+ return (+ this.trackpadTimeoutId_+ ? clearTimeout(this.trackpadTimeoutId_)+ : (s.getAnimating() && s.cancelAnimations(), s.beginInteraction()),+ (this.trackpadTimeoutId_ = setTimeout(this.endInteraction_.bind(this), this.timeout_)),+ s.adjustZoom(-n / this.deltaPerZoom_, this.lastAnchor_ ? e.getCoordinateFromPixel(this.lastAnchor_) : null),+ (this.startTime_ = r),+ !1+ )+ this.totalDelta_ += n+ const o = Math.max(this.timeout_ - (r - this.startTime_), 0)+ return clearTimeout(this.timeoutId_), (this.timeoutId_ = setTimeout(this.handleWheelZoom_.bind(this, e), o)), !1+ }+ handleWheelZoom_(t) {+ const e = t.getView()+ e.getAnimating() && e.cancelAnimations()+ let i =+ -Ie(this.totalDelta_, -this.maxDelta_ * this.deltaPerZoom_, this.maxDelta_ * this.deltaPerZoom_) /+ this.deltaPerZoom_+ ;(e.getConstrainResolution() || this.constrainResolution_) && (i = i ? (i > 0 ? 1 : -1) : 0),+ qo(e, i, this.lastAnchor_ ? t.getCoordinateFromPixel(this.lastAnchor_) : null, this.duration_),+ (this.mode_ = void 0),+ (this.totalDelta_ = 0),+ (this.lastAnchor_ = null),+ (this.startTime_ = void 0),+ (this.timeoutId_ = void 0)+ }+ setMouseAnchor(t) {+ ;(this.useAnchor_ = t), t || (this.lastAnchor_ = null)+ }+ }+ class Aa extends fa {+ constructor(t) {+ const e = (t = t || {})+ e.stopDown || (e.stopDown = b),+ super(e),+ (this.anchor_ = null),+ (this.lastAngle_ = void 0),+ (this.rotating_ = !1),+ (this.rotationDelta_ = 0),+ (this.threshold_ = void 0 !== t.threshold ? t.threshold : 0.3),+ (this.duration_ = void 0 !== t.duration ? t.duration : 250)+ }+ handleDragEvent(t) {+ let e = 0+ const i = this.targetPointers[0],+ n = this.targetPointers[1],+ r = Math.atan2(n.clientY - i.clientY, n.clientX - i.clientX)+ if (void 0 !== this.lastAngle_) {+ const t = r - this.lastAngle_+ ;(this.rotationDelta_ += t),+ !this.rotating_ && Math.abs(this.rotationDelta_) > this.threshold_ && (this.rotating_ = !0),+ (e = t)+ }+ this.lastAngle_ = r+ const s = t.map,+ o = s.getView()+ o.getConstraints().rotation !== So &&+ ((this.anchor_ = s.getCoordinateFromPixelInternal(s.getEventPixel(pa(this.targetPointers)))),+ this.rotating_ && (s.render(), o.adjustRotationInternal(e, this.anchor_)))+ }+ 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 Oa extends fa {+ constructor(t) {+ const e = (t = t || {})+ e.stopDown || (e.stopDown = b),+ super(e),+ (this.anchor_ = null),+ (this.duration_ = void 0 !== t.duration ? t.duration : 400),+ (this.lastDistance_ = void 0),+ (this.lastScaleDelta_ = 1)+ }+ handleDragEvent(t) {+ let e = 1+ const i = this.targetPointers[0],+ n = this.targetPointers[1],+ r = i.clientX - n.clientX,+ s = i.clientY - n.clientY,+ o = Math.sqrt(r * r + s * s)+ void 0 !== this.lastDistance_ && (e = this.lastDistance_ / o), (this.lastDistance_ = o)+ const a = t.map,+ l = a.getView()+ 1 != e && (this.lastScaleDelta_ = e),+ (this.anchor_ = a.getCoordinateFromPixelInternal(a.getEventPixel(pa(this.targetPointers)))),+ a.render(),+ l.adjustResolutionInternal(e, this.anchor_)+ }+ handleUpEvent(t) {+ if (this.targetPointers.length < 2) {+ const e = t.map.getView(),+ i = this.lastScaleDelta_ > 1 ? 1 : -1+ return e.endInteraction(this.duration_, i), !1+ }+ return !0+ }+ handleDownEvent(t) {+ if (this.targetPointers.length >= 2) {+ const e = t.map+ return (+ (this.anchor_ = null),+ (this.lastDistance_ = void 0),+ (this.lastScaleDelta_ = 1),+ this.handlingDownUpSequence || e.getView().beginInteraction(),+ !0+ )+ }+ return !1+ }+ }+ function Da(t) {+ t = t || {}+ const e = new Z(),+ i = new zs(-0.005, 0.05, 100)+ ;(void 0 === t.altShiftDragRotate || t.altShiftDragRotate) && e.push(new ma())+ ;(void 0 === t.doubleClickZoom || t.doubleClickZoom) &&+ e.push(new Jo({ delta: t.zoomDelta, duration: t.zoomDuration }))+ ;(void 0 === t.dragPan || t.dragPan) && e.push(new _a({ onFocusOnly: t.onFocusOnly, kinetic: i }))+ ;(void 0 === t.pinchRotate || t.pinchRotate) && e.push(new Aa())+ ;(void 0 === t.pinchZoom || t.pinchZoom) && e.push(new Oa({ duration: t.zoomDuration }))+ ;(void 0 === t.keyboard || t.keyboard) &&+ (e.push(new Fa()), e.push(new La({ delta: t.zoomDelta, duration: t.zoomDuration })))+ ;(void 0 === t.mouseWheelZoom || t.mouseWheelZoom) &&+ e.push(new Ma({ onFocusOnly: t.onFocusOnly, duration: t.zoomDuration }))+ return (void 0 === t.shiftDragZoom || t.shiftDragZoom) && e.push(new Ca({ duration: t.zoomDuration })), e+ }+ var Na = "opacity",+ ka = "visible",+ Ga = "extent",+ ja = "zIndex",+ Ua = "maxResolution",+ Ba = "minResolution",+ za = "maxZoom",+ Xa = "minZoom",+ Va = "source",+ $a = "map"+ class Wa extends V {+ 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[Na] = void 0 !== t.opacity ? t.opacity : 1),+ Mt("number" == typeof e[Na], "Layer opacity must be a number"),+ (e[ka] = void 0 === t.visible || t.visible),+ (e[ja] = t.zIndex),+ (e[Ua] = void 0 !== t.maxResolution ? t.maxResolution : 1 / 0),+ (e[Ba] = void 0 !== t.minResolution ? t.minResolution : 0),+ (e[Xa] = void 0 !== t.minZoom ? t.minZoom : -1 / 0),+ (e[za] = 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 = Ie(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 U()+ }+ getLayerStatesArray(t) {+ return U()+ }+ getExtent() {+ return this.get(Ga)+ }+ getMaxResolution() {+ return this.get(Ua)+ }+ getMinResolution() {+ return this.get(Ba)+ }+ getMinZoom() {+ return this.get(Xa)+ }+ getMaxZoom() {+ return this.get(za)+ }+ getOpacity() {+ return this.get(Na)+ }+ getSourceState() {+ return U()+ }+ getVisible() {+ return this.get(ka)+ }+ getZIndex() {+ return this.get(ja)+ }+ setBackground(t) {+ ;(this.background_ = t), this.changed()+ }+ setExtent(t) {+ this.set(Ga, t)+ }+ setMaxResolution(t) {+ this.set(Ua, t)+ }+ setMinResolution(t) {+ this.set(Ba, t)+ }+ setMaxZoom(t) {+ this.set(za, t)+ }+ setMinZoom(t) {+ this.set(Xa, t)+ }+ setOpacity(t) {+ Mt("number" == typeof t, "Layer opacity must be a number"), this.set(Na, t)+ }+ setVisible(t) {+ this.set(ka, t)+ }+ setZIndex(t) {+ this.set(ja, t)+ }+ disposeInternal() {+ this.state_ && ((this.state_.layer = null), (this.state_ = null)), super.disposeInternal()+ }+ }+ const Za = "addlayer",+ Ya = "removelayer"+ class Ha extends M {+ constructor(t, e) {+ super(t), (this.layer = e)+ }+ }+ const Ka = "layers"+ class qa extends Wa {+ 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(Ka, this.handleLayersChanged_),+ i+ ? Array.isArray(i)+ ? (i = new Z(i.slice(), { unique: !0 }))+ : Mt("function" == typeof i.getArray, "Expected `layers` to be an array or a `Collection`")+ : (i = new Z(void 0, { unique: !0 })),+ this.setLayers(i)+ }+ handleLayerChange_() {+ this.changed()+ }+ handleLayersChanged_() {+ this.layersListenerKeys_.forEach(k), (this.layersListenerKeys_.length = 0)+ const i = this.getLayers()+ this.layersListenerKeys_.push(D(i, t, this.handleLayersAdd_, this), D(i, e, this.handleLayersRemove_, this))+ for (const t in this.listenerKeys_) this.listenerKeys_[t].forEach(k)+ F(this.listenerKeys_)+ const n = i.getArray()+ for (let t = 0, e = n.length; t < e; t++) {+ const e = n[t]+ this.registerLayerListeners_(e), this.dispatchEvent(new Ha(Za, e))+ }+ this.changed()+ }+ registerLayerListeners_(t) {+ const e = [D(t, i, this.handleLayerChange_, this), D(t, n, this.handleLayerChange_, this)]+ t instanceof qa &&+ e.push(D(t, Za, this.handleLayerGroupAdd_, this), D(t, Ya, this.handleLayerGroupRemove_, this)),+ (this.listenerKeys_[z(t)] = e)+ }+ handleLayerGroupAdd_(t) {+ this.dispatchEvent(new Ha(Za, t.layer))+ }+ handleLayerGroupRemove_(t) {+ this.dispatchEvent(new Ha(Ya, t.layer))+ }+ handleLayersAdd_(t) {+ const e = t.element+ this.registerLayerListeners_(e), this.dispatchEvent(new Ha(Za, e)), this.changed()+ }+ handleLayersRemove_(t) {+ const e = t.element,+ i = z(e)+ this.listenerKeys_[i].forEach(k), delete this.listenerKeys_[i], this.dispatchEvent(new Ha(Ya, e)), this.changed()+ }+ getLayers() {+ return this.get(Ka)+ }+ 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 Ha(Ya, t[e]))+ }+ this.set(Ka, t)+ }+ getLayersArray(t) {+ return (+ (t = void 0 !== t ? t : []),+ this.getLayers().forEach(function (e) {+ e.getLayersArray(t)+ }),+ t+ )+ }+ getLayerStatesArray(t) {+ const e = void 0 !== t ? t : [],+ i = e.length+ this.getLayers().forEach(function (t) {+ t.getLayerStatesArray(e)+ })+ const n = this.getLayerState()+ let r = n.zIndex+ t || void 0 !== n.zIndex || (r = 0)+ for (let t = i, s = e.length; t < s; t++) {+ const i = e[t]+ ;(i.opacity *= n.opacity),+ (i.visible = i.visible && n.visible),+ (i.maxResolution = Math.min(i.maxResolution, n.maxResolution)),+ (i.minResolution = Math.max(i.minResolution, n.minResolution)),+ (i.minZoom = Math.max(i.minZoom, n.minZoom)),+ (i.maxZoom = Math.min(i.maxZoom, n.maxZoom)),+ void 0 !== n.extent && (void 0 !== i.extent ? (i.extent = me(i.extent, n.extent)) : (i.extent = n.extent)),+ void 0 === i.zIndex && (i.zIndex = r)+ }+ return e+ }+ getSourceState() {+ return "ready"+ }+ }+ var Ja = "prerender",+ Qa = "postrender",+ tl = "precompose",+ el = "postcompose",+ il = "rendercomplete"+ class nl extends Wa {+ 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(Va, 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(Va) || null+ }+ getRenderSource() {+ return this.getSource()+ }+ getSourceState() {+ const t = this.getSource()+ return t ? t.getState() : "undefined"+ }+ handleSourceChange_() {+ this.changed(),+ this.sourceReady_ ||+ "ready" !== this.getSource().getState() ||+ ((this.sourceReady_ = !0), this.dispatchEvent("sourceready"))+ }+ handleSourcePropertyChange_() {+ this.sourceChangeKey_ && (k(this.sourceChangeKey_), (this.sourceChangeKey_ = null)), (this.sourceReady_ = !1)+ const t = this.getSource()+ t &&+ ((this.sourceChangeKey_ = D(t, n, this.handleSourceChange_, this)),+ "ready" === t.getState() &&+ ((this.sourceReady_ = !0),+ setTimeout(() => {+ this.dispatchEvent("sourceready")+ }, 0))),+ this.changed()+ }+ getFeatures(t) {+ return this.renderer_ ? this.renderer_.getFeatures(t) : Promise.resolve([])+ }+ getData(t) {+ return this.renderer_ && this.rendered ? this.renderer_.getData(t) : null+ }+ isVisible(t) {+ let e+ const i = this.getMapInternal()+ let n+ if (+ (!t && i && (t = i.getView()),+ (e = t instanceof bo ? { viewState: t.getState(), extent: t.calculateExtent() } : t),+ !e.layerStatesArray && i && (e.layerStatesArray = i.getLayerGroup().getLayerStatesArray()),+ e.layerStatesArray)+ ) {+ if (((n = e.layerStatesArray.find((t) => t.layer === this)), !n)) return !1+ } else n = this.getLayerState()+ const r = this.getExtent()+ return rl(n, e.viewState) && (!r || Se(r, e.extent))+ }+ getAttributions(t) {+ if (!this.isVisible(t)) return []+ const e = this.getSource()?.getAttributions()+ if (!e) return []+ let i = e(t instanceof bo ? 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($a, t)+ }+ getMapInternal() {+ return this.get($a)+ }+ setMap(t) {+ this.mapPrecomposeKey_ && (k(this.mapPrecomposeKey_), (this.mapPrecomposeKey_ = null)),+ t || this.changed(),+ this.mapRenderKey_ && (k(this.mapRenderKey_), (this.mapRenderKey_ = null)),+ t &&+ ((this.mapPrecomposeKey_ = D(t, tl, this.handlePrecompose_, this)),+ (this.mapRenderKey_ = D(this, n, t.render, t)),+ this.changed())+ }+ handlePrecompose_(t) {+ const e = t.frameState.layerStatesArray,+ i = this.getLayerState(!1)+ Mt(+ !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(Va, 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 rl(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+ }+ function sl(t, e, i = 0, n = t.length - 1, r = al) {+ for (; n > i; ) {+ if (n - i > 600) {+ const s = n - i + 1,+ o = e - i + 1,+ a = Math.log(s),+ l = 0.5 * Math.exp((2 * a) / 3),+ h = 0.5 * Math.sqrt((a * l * (s - l)) / s) * (o - s / 2 < 0 ? -1 : 1)+ sl(t, e, Math.max(i, Math.floor(e - (o * l) / s + h)), Math.min(n, Math.floor(e + ((s - o) * l) / s + h)), r)+ }+ const s = t[e]+ let o = i,+ a = n+ for (ol(t, i, e), r(t[n], s) > 0 && ol(t, i, n); o < a; ) {+ for (ol(t, o, a), o++, a--; r(t[o], s) < 0; ) o+++ for (; r(t[a], s) > 0; ) a--+ }+ 0 === r(t[i], s) ? ol(t, i, a) : (a++, ol(t, a, n)), a <= e && (i = a + 1), e <= a && (n = a - 1)+ }+ }+ function ol(t, e, i) {+ const n = t[e]+ ;(t[e] = t[i]), (t[i] = n)+ }+ function al(t, e) {+ return t < e ? -1 : t > e ? 1 : 0+ }+ let ll = class {+ constructor(t = 9) {+ ;(this._maxEntries = Math.max(4, t)),+ (this._minEntries = Math.max(2, Math.ceil(0.4 * this._maxEntries))),+ this.clear()+ }+ all() {+ return this._all(this.data, [])+ }+ search(t) {+ let e = this.data+ const i = []+ if (!xl(t, e)) return i+ const n = this.toBBox,+ r = []+ for (; e; ) {+ for (let s = 0; s < e.children.length; s++) {+ const o = e.children[s],+ a = e.leaf ? n(o) : o+ xl(t, a) && (e.leaf ? i.push(o) : yl(t, a) ? this._all(o, i) : r.push(o))+ }+ e = r.pop()+ }+ return i+ }+ collides(t) {+ let e = this.data+ if (!xl(t, e)) return !1+ const i = []+ for (; e; ) {+ for (let n = 0; n < e.children.length; n++) {+ const r = e.children[n],+ s = e.leaf ? this.toBBox(r) : r+ if (xl(t, s)) {+ if (e.leaf || yl(t, s)) return !0+ i.push(r)+ }+ }+ e = i.pop()+ }+ return !1+ }+ load(t) {+ if (!t || !t.length) return this+ if (t.length < this._minEntries) {+ for (let e = 0; e < t.length; e++) this.insert(t[e])+ return this+ }+ let e = this._build(t.slice(), 0, t.length - 1, 0)+ if (this.data.children.length)+ if (this.data.height === e.height) this._splitRoot(this.data, e)+ else {+ if (this.data.height < e.height) {+ const t = this.data+ ;(this.data = e), (e = t)+ }+ this._insert(e, this.data.height - e.height - 1, !0)+ }+ else this.data = e+ return this+ }+ insert(t) {+ return t && this._insert(t, this.data.height - 1), this+ }+ clear() {+ return (this.data = vl([])), this+ }+ remove(t, e) {+ if (!t) return this+ let i = this.data+ const n = this.toBBox(t),+ r = [],+ s = []+ let o, a, l+ for (; i || r.length; ) {+ if ((i || ((i = r.pop()), (a = r[r.length - 1]), (o = s.pop()), (l = !0)), i.leaf)) {+ const n = hl(t, i.children, e)+ if (-1 !== n) return i.children.splice(n, 1), r.push(i), this._condense(r), this+ }+ l || i.leaf || !yl(i, n)+ ? a+ ? (o++, (i = a.children[o]), (l = !1))+ : (i = null)+ : (r.push(i), s.push(o), (o = 0), (a = i), (i = i.children[0]))+ }+ return this+ }+ toBBox(t) {+ return t+ }+ compareMinX(t, e) {+ return t.minX - e.minX+ }+ compareMinY(t, e) {+ return t.minY - e.minY+ }+ toJSON() {+ return this.data+ }+ fromJSON(t) {+ return (this.data = t), this+ }+ _all(t, e) {+ const i = []+ for (; t; ) t.leaf ? e.push(...t.children) : i.push(...t.children), (t = i.pop())+ return e+ }+ _build(t, e, i, n) {+ const r = i - e + 1+ let s,+ o = this._maxEntries+ if (r <= o) return (s = vl(t.slice(e, i + 1))), cl(s, this.toBBox), s+ n || ((n = Math.ceil(Math.log(r) / Math.log(o))), (o = Math.ceil(r / Math.pow(o, n - 1)))),+ (s = vl([])),+ (s.leaf = !1),+ (s.height = n)+ const a = Math.ceil(r / o),+ l = a * Math.ceil(Math.sqrt(o))+ Sl(t, e, i, l, this.compareMinX)+ for (let r = e; r <= i; r += l) {+ const e = Math.min(r + l - 1, i)+ Sl(t, r, e, a, this.compareMinY)+ for (let i = r; i <= e; i += a) {+ const r = Math.min(i + a - 1, e)+ s.children.push(this._build(t, i, r, n - 1))+ }+ }+ return cl(s, this.toBBox), s+ }+ _chooseSubtree(t, e, i, n) {+ for (; n.push(e), !e.leaf && n.length - 1 !== i; ) {+ let i,+ n = 1 / 0,+ o = 1 / 0+ for (let a = 0; a < e.children.length; a++) {+ const l = e.children[a],+ h = pl(l),+ c =+ ((r = t),+ (s = l),+ (Math.max(s.maxX, r.maxX) - Math.min(s.minX, r.minX)) *+ (Math.max(s.maxY, r.maxY) - Math.min(s.minY, r.minY)) -+ h)+ c < o ? ((o = c), (n = h < n ? h : n), (i = l)) : c === o && h < n && ((n = h), (i = l))+ }+ e = i || e.children[0]+ }+ var r, s+ return e+ }+ _insert(t, e, i) {+ const n = i ? t : this.toBBox(t),+ r = [],+ s = this._chooseSubtree(n, this.data, e, r)+ for (s.children.push(t), dl(s, n); e >= 0 && r[e].children.length > this._maxEntries; ) this._split(r, e), e--+ this._adjustParentBBoxes(n, r, e)+ }+ _split(t, e) {+ const i = t[e],+ n = i.children.length,+ r = this._minEntries+ this._chooseSplitAxis(i, r, n)+ const s = this._chooseSplitIndex(i, r, n),+ o = vl(i.children.splice(s, i.children.length - s))+ ;(o.height = i.height),+ (o.leaf = i.leaf),+ cl(i, this.toBBox),+ cl(o, this.toBBox),+ e ? t[e - 1].children.push(o) : this._splitRoot(i, o)+ }+ _splitRoot(t, e) {+ ;(this.data = vl([t, e])), (this.data.height = t.height + 1), (this.data.leaf = !1), cl(this.data, this.toBBox)+ }+ _chooseSplitIndex(t, e, i) {+ let n,+ r = 1 / 0,+ s = 1 / 0+ for (let o = e; o <= i - e; o++) {+ const e = ul(t, 0, o, this.toBBox),+ a = ul(t, o, i, this.toBBox),+ l = ml(e, a),+ h = pl(e) + pl(a)+ l < r ? ((r = l), (n = o), (s = h < s ? h : s)) : l === r && h < s && ((s = h), (n = o))+ }+ return n || i - e+ }+ _chooseSplitAxis(t, e, i) {+ const n = t.leaf ? this.compareMinX : gl,+ r = t.leaf ? this.compareMinY : fl+ this._allDistMargin(t, e, i, n) < this._allDistMargin(t, e, i, r) && t.children.sort(n)+ }+ _allDistMargin(t, e, i, n) {+ t.children.sort(n)+ const r = this.toBBox,+ s = ul(t, 0, e, r),+ o = ul(t, i - e, i, r)+ let a = _l(s) + _l(o)+ for (let n = e; n < i - e; n++) {+ const e = t.children[n]+ dl(s, t.leaf ? r(e) : e), (a += _l(s))+ }+ for (let n = i - e - 1; n >= e; n--) {+ const e = t.children[n]+ dl(o, t.leaf ? r(e) : e), (a += _l(o))+ }+ return a+ }+ _adjustParentBBoxes(t, e, i) {+ for (let n = i; n >= 0; n--) dl(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()+ : cl(t[i], this.toBBox)+ }+ }+ function hl(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 cl(t, e) {+ ul(t, 0, t.children.length, e, t)+ }+ function ul(t, e, i, n, r) {+ r || (r = vl(null)), (r.minX = 1 / 0), (r.minY = 1 / 0), (r.maxX = -1 / 0), (r.maxY = -1 / 0)+ for (let s = e; s < i; s++) {+ const e = t.children[s]+ dl(r, t.leaf ? n(e) : e)+ }+ return r+ }+ function dl(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 gl(t, e) {+ return t.minX - e.minX+ }+ function fl(t, e) {+ return t.minY - e.minY+ }+ function pl(t) {+ return (t.maxX - t.minX) * (t.maxY - t.minY)+ }+ function _l(t) {+ return t.maxX - t.minX + (t.maxY - t.minY)+ }+ function ml(t, e) {+ const i = Math.max(t.minX, e.minX),+ n = Math.max(t.minY, e.minY),+ r = Math.min(t.maxX, e.maxX),+ s = Math.min(t.maxY, e.maxY)+ return Math.max(0, r - i) * Math.max(0, s - n)+ }+ function yl(t, e) {+ return t.minX <= e.minX && t.minY <= e.minY && e.maxX <= t.maxX && e.maxY <= t.maxY+ }+ function xl(t, e) {+ return e.minX <= t.maxX && e.minY <= t.maxY && e.maxX >= t.minX && e.maxY >= t.minY+ }+ function vl(t) {+ return { children: t, height: 1, leaf: !0, minX: 1 / 0, minY: 1 / 0, maxX: -1 / 0, maxY: -1 / 0 }+ }+ function Sl(t, e, i, n, r) {+ const s = [e, i]+ for (; s.length; ) {+ if ((i = s.pop()) - (e = s.pop()) <= n) continue+ const o = e + Math.ceil((i - e) / n / 2) * n+ sl(t, o, e, i, r), s.push(e, o, o, i)+ }+ }+ const El = [NaN, NaN, NaN, 0]+ let wl+ const Tl = /^rgba?\(\s*(\d+%?)\s+(\d+%?)\s+(\d+%?)(?:\s*\/\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,+ Cl = /^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,+ bl = /^rgba?\(\s*(\d+%)\s*,\s*(\d+%)\s*,\s*(\d+%)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,+ Rl = /^#([\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$/i+ function Pl(t, e) {+ return t.endsWith("%") ? Number(t.substring(0, t.length - 1)) / e : Number(t)+ }+ function Il(t) {+ throw new Error('failed to parse "' + t + '" as color')+ }+ function Fl(t) {+ if (t.toLowerCase().startsWith("rgb")) {+ const e = t.match(Cl) || t.match(Tl) || t.match(bl)+ if (e) {+ const t = e[4],+ i = 100 / 255+ return [+ Ie((Pl(e[1], i) + 0.5) | 0, 0, 255),+ Ie((Pl(e[2], i) + 0.5) | 0, 0, 255),+ Ie((Pl(e[3], i) + 0.5) | 0, 0, 255),+ void 0 !== t ? Ie(Pl(t, 100), 0, 1) : 1+ ]+ }+ Il(t)+ }+ if (t.startsWith("#")) {+ if (Rl.test(t)) {+ const e = t.substring(1),+ i = e.length <= 4 ? 1 : 2,+ n = [0, 0, 0, 255]+ for (let t = 0, r = e.length; t < r; t += i) {+ let r = parseInt(e.substring(t, t + i), 16)+ 1 === i && (r += r << 4), (n[t / i] = r)+ }+ return (n[3] = n[3] / 255), n+ }+ Il(t)+ }+ const e = (wl || (wl = ft(1, 1, void 0, { willReadFrequently: !0, desynchronized: !0 })), wl)+ 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 && Il(t))+ const n = e.fillStyle+ if (n.startsWith("#") || n.startsWith("rgba")) return Fl(n)+ e.clearRect(0, 0, 1, 1), e.fillRect(0, 0, 1, 1)+ const r = Array.from(e.getImageData(0, 0, 1, 1).data)+ return (r[3] = ke(r[3] / 255, 3)), r+ }+ function Ll(t) {+ return "string" == typeof t ? t : Xl(t)+ }+ const Ml = {}+ let Al = 0+ function Ol(t) {+ if (4 === t.length) return t+ const e = t.slice()+ return (e[3] = 1), e+ }+ function Dl(t) {+ return t > 0.0031308 ? 269.025 * Math.pow(t, 1 / 2.4) - 14.025 : 3294.6 * t+ }+ function Nl(t) {+ return t > 0.2068965 ? Math.pow(t, 3) : (108 / 841) * (t - 4 / 29)+ }+ function kl(t) {+ return t > 10.314724 ? Math.pow((t + 14.025) / 269.025, 2.4) : t / 3294.6+ }+ function Gl(t) {+ return t > 0.0088564 ? Math.pow(t, 1 / 3) : t / (108 / 841) + 4 / 29+ }+ function jl(t) {+ const e = kl(t[0]),+ i = kl(t[1]),+ n = kl(t[2]),+ r = Gl(0.222488403 * e + 0.716873169 * i + 0.06060791 * n),+ s = 500 * (Gl(0.452247074 * e + 0.399439023 * i + 0.148375274 * n) - r),+ o = 200 * (r - Gl(0.016863605 * e + 0.117638439 * i + 0.865350722 * n)),+ a = Math.atan2(o, s) * (180 / Math.PI)+ return [116 * r - 16, Math.sqrt(s * s + o * o), a < 0 ? a + 360 : a, t[3]]+ }+ function Ul(t) {+ const e = (t[0] + 16) / 116,+ i = t[1],+ n = (t[2] * Math.PI) / 180,+ r = Nl(e),+ s = Nl(e + (i / 500) * Math.cos(n)),+ o = Nl(e - (i / 200) * Math.sin(n)),+ a = Dl(3.021973625 * s - 1.617392459 * r - 0.404875592 * o),+ l = Dl(-0.943766287 * s + 1.916279586 * r + 0.027607165 * o),+ h = Dl(0.069407491 * s - 0.22898585 * r + 1.159737864 * o)+ return [Ie((a + 0.5) | 0, 0, 255), Ie((l + 0.5) | 0, 0, 255), Ie((h + 0.5) | 0, 0, 255), t[3]]+ }+ function Bl(t) {+ if ("none" === t) return El+ if (Ml.hasOwnProperty(t)) return Ml[t]+ if (Al >= 1024) {+ let t = 0+ for (const e in Ml) 3 & t++ || (delete Ml[e], --Al)+ }+ const e = Fl(t)+ 4 !== e.length && Il(t)+ for (const i of e) isNaN(i) && Il(t)+ return (Ml[t] = e), ++Al, e+ }+ function zl(t) {+ return Array.isArray(t) ? t : Bl(t)+ }+ function Xl(t) {+ let e = t[0]+ e != (0 | e) && (e = (e + 0.5) | 0)+ let i = t[1]+ i != (0 | i) && (i = (i + 0.5) | 0)+ let n = t[2]+ n != (0 | n) && (n = (n + 0.5) | 0)+ return "rgba(" + e + "," + i + "," + n + "," + (void 0 === t[3] ? 1 : Math.round(1e3 * t[3]) / 1e3) + ")"+ }+ function Vl(t) {+ return t[0] > 0 && t[1] > 0+ }+ function $l(t, e, i) {+ return void 0 === i && (i = [0, 0]), (i[0] = (t[0] * e + 0.5) | 0), (i[1] = (t[1] * e + 0.5) | 0), i+ }+ function Wl(t, e) {+ return Array.isArray(t) ? t : (void 0 === e ? (e = [t, t]) : ((e[0] = t), (e[1] = t)), e)+ }+ let Zl = 0+ const Yl = 1 << Zl++,+ Hl = 1 << Zl++,+ Kl = 1 << Zl++,+ ql = 1 << Zl++,+ Jl = 1 << Zl++,+ Ql = 1 << Zl++,+ th = Math.pow(2, 6) - 1,+ eh = { [Yl]: "boolean", [Hl]: "number", [Kl]: "string", [ql]: "color", [Jl]: "number[]", [Ql]: "size" },+ ih = Object.keys(eh).map(Number).sort(y)+ function nh(t) {+ const e = []+ for (const i of ih) rh(t, i) && e.push(eh[i])+ return 0 === e.length+ ? "untyped"+ : e.length < 3+ ? e.join(" or ")+ : e.slice(0, -1).join(", ") + ", or " + e[e.length - 1]+ }+ function rh(t, e) {+ return (t & e) === e+ }+ function sh(t, e) {+ return t === e+ }+ class oh {+ constructor(t, e) {+ if (+ !(function (t) {+ return t in eh+ })(t)+ )+ throw new Error(`literal expressions must have a specific type, got ${nh(t)}`)+ ;(this.type = t), (this.value = e)+ }+ }+ class ah {+ constructor(t, e, ...i) {+ ;(this.type = t), (this.operator = e), (this.args = i)+ }+ }+ function lh() {+ return { variables: new Set(), properties: new Set(), featureId: !1, geometryType: !1, mapState: !1 }+ }+ function hh(t, e, i) {+ switch (typeof t) {+ case "boolean":+ if (sh(e, Kl)) return new oh(Kl, t ? "true" : "false")+ if (!rh(e, Yl)) throw new Error(`got a boolean, but expected ${nh(e)}`)+ return new oh(Yl, t)+ case "number":+ if (sh(e, Ql)) return new oh(Ql, Wl(t))+ if (sh(e, Yl)) return new oh(Yl, !!t)+ if (sh(e, Kl)) return new oh(Kl, t.toString())+ if (!rh(e, Hl)) throw new Error(`got a number, but expected ${nh(e)}`)+ return new oh(Hl, t)+ case "string":+ if (sh(e, ql)) return new oh(ql, Bl(t))+ if (sh(e, Yl)) return new oh(Yl, !!t)+ if (!rh(e, Kl)) throw new Error(`got a string, but expected ${nh(e)}`)+ return new oh(Kl, t)+ }+ if (!Array.isArray(t)) throw new Error("expression must be an array or a primitive value")+ if (0 === t.length) throw new Error("empty expression")+ if ("string" == typeof t[0])+ return (function (t, e, i) {+ const n = t[0],+ r = uh[n]+ if (!r) throw new Error(`unknown operator: ${n}`)+ return r(t, e, i)+ })(t, e, i)+ for (const e of t) if ("number" != typeof e) throw new Error("expected an array of numbers")+ if (sh(e, Ql)) {+ if (2 !== t.length) throw new Error(`expected an array of two values for a size, got ${t.length}`)+ return new oh(Ql, t)+ }+ if (sh(e, ql)) {+ if (3 === t.length) return new oh(ql, [...t, 1])+ if (4 === t.length) return new oh(ql, t)+ throw new Error(`expected an array of 3 or 4 values for a color, got ${t.length}`)+ }+ if (!rh(e, Jl)) throw new Error(`got an array of numbers, but expected ${nh(e)}`)+ return new oh(Jl, t)+ }+ const ch = {+ Get: "get",+ Var: "var",+ Concat: "concat",+ GeometryType: "geometry-type",+ LineMetric: "line-metric",+ Any: "any",+ All: "all",+ Not: "!",+ Resolution: "resolution",+ Zoom: "zoom",+ Time: "time",+ Equal: "==",+ NotEqual: "!=",+ GreaterThan: ">",+ GreaterThanOrEqualTo: ">=",+ LessThan: "<",+ LessThanOrEqualTo: "<=",+ Multiply: "*",+ Divide: "/",+ Add: "+",+ Subtract: "-",+ Clamp: "clamp",+ Mod: "%",+ Pow: "^",+ Abs: "abs",+ Floor: "floor",+ Ceil: "ceil",+ Round: "round",+ Sin: "sin",+ Cos: "cos",+ Atan: "atan",+ Sqrt: "sqrt",+ Match: "match",+ Between: "between",+ Interpolate: "interpolate",+ Coalesce: "coalesce",+ Case: "case",+ In: "in",+ Number: "number",+ String: "string",+ Array: "array",+ Color: "color",+ Id: "id",+ Band: "band",+ Palette: "palette",+ ToString: "to-string",+ Has: "has"+ },+ uh = {+ [ch.Get]: xh(ph(1, 1 / 0), dh),+ [ch.Var]: xh(ph(1, 1), function (t, e, i) {+ const n = t[1]+ if ("string" != typeof n) throw new Error("expected a string argument for var operation")+ return i.variables.add(n), [new oh(Kl, n)]+ }),+ [ch.Has]: xh(ph(1, 1 / 0), dh),+ [ch.Id]: xh(function (t, e, i) {+ i.featureId = !0+ }, fh),+ [ch.Concat]: xh(ph(2, 1 / 0), mh(Kl)),+ [ch.GeometryType]: xh(function (t, e, i) {+ i.geometryType = !0+ }, fh),+ [ch.LineMetric]: xh(fh),+ [ch.Resolution]: xh(gh, fh),+ [ch.Zoom]: xh(gh, fh),+ [ch.Time]: xh(gh, fh),+ [ch.Any]: xh(ph(2, 1 / 0), mh(Yl)),+ [ch.All]: xh(ph(2, 1 / 0), mh(Yl)),+ [ch.Not]: xh(ph(1, 1), mh(Yl)),+ [ch.Equal]: xh(ph(2, 2), mh(th)),+ [ch.NotEqual]: xh(ph(2, 2), mh(th)),+ [ch.GreaterThan]: xh(ph(2, 2), mh(Hl)),+ [ch.GreaterThanOrEqualTo]: xh(ph(2, 2), mh(Hl)),+ [ch.LessThan]: xh(ph(2, 2), mh(Hl)),+ [ch.LessThanOrEqualTo]: xh(ph(2, 2), mh(Hl)),+ [ch.Multiply]: xh(ph(2, 1 / 0), _h),+ [ch.Coalesce]: xh(ph(2, 1 / 0), _h),+ [ch.Divide]: xh(ph(2, 2), mh(Hl)),+ [ch.Add]: xh(ph(2, 1 / 0), mh(Hl)),+ [ch.Subtract]: xh(ph(2, 2), mh(Hl)),+ [ch.Clamp]: xh(ph(3, 3), mh(Hl)),+ [ch.Mod]: xh(ph(2, 2), mh(Hl)),+ [ch.Pow]: xh(ph(2, 2), mh(Hl)),+ [ch.Abs]: xh(ph(1, 1), mh(Hl)),+ [ch.Floor]: xh(ph(1, 1), mh(Hl)),+ [ch.Ceil]: xh(ph(1, 1), mh(Hl)),+ [ch.Round]: xh(ph(1, 1), mh(Hl)),+ [ch.Sin]: xh(ph(1, 1), mh(Hl)),+ [ch.Cos]: xh(ph(1, 1), mh(Hl)),+ [ch.Atan]: xh(ph(1, 2), mh(Hl)),+ [ch.Sqrt]: xh(ph(1, 1), mh(Hl)),+ [ch.Match]: xh(ph(4, 1 / 0), yh, function (t, e, i) {+ const n = t.length - 1,+ r = Kl | Hl | Yl,+ s = hh(t[1], r, i),+ o = hh(t[t.length - 1], e, i),+ a = new Array(n - 2)+ for (let e = 0; e < n - 2; e += 2) {+ try {+ const n = hh(t[e + 2], s.type, i)+ a[e] = n+ } catch (t) {+ throw new Error(`failed to parse argument ${e + 1} of match expression: ${t.message}`)+ }+ try {+ const n = hh(t[e + 3], o.type, i)+ a[e + 1] = n+ } catch (t) {+ throw new Error(`failed to parse argument ${e + 2} of match expression: ${t.message}`)+ }+ }+ return [s, ...a, o]+ }),+ [ch.Between]: xh(ph(3, 3), mh(Hl)),+ [ch.Interpolate]: xh(ph(6, 1 / 0), yh, function (t, e, i) {+ const n = t[1]+ let r+ switch (n[0]) {+ case "linear":+ r = 1+ break+ case "exponential":+ const t = n[1]+ if ("number" != typeof t || t <= 0)+ throw new Error(`expected a number base for exponential interpolation, got ${JSON.stringify(t)} instead`)+ r = t+ break+ default:+ throw new Error(`invalid interpolation type: ${JSON.stringify(n)}`)+ }+ const s = new oh(Hl, r)+ let o+ try {+ o = hh(t[2], Hl, i)+ } catch (t) {+ throw new Error(`failed to parse argument 1 in interpolate expression: ${t.message}`)+ }+ const a = new Array(t.length - 3)+ for (let n = 0; n < a.length; n += 2) {+ try {+ const e = hh(t[n + 3], Hl, i)+ a[n] = e+ } catch (t) {+ throw new Error(`failed to parse argument ${n + 2} for interpolate expression: ${t.message}`)+ }+ try {+ const r = hh(t[n + 4], e, i)+ a[n + 1] = r+ } catch (t) {+ throw new Error(`failed to parse argument ${n + 3} for interpolate expression: ${t.message}`)+ }+ }+ return [s, o, ...a]+ }),+ [ch.Case]: xh(+ ph(3, 1 / 0),+ function (t, e, i) {+ const n = t[0],+ r = t.length - 1+ if (r % 2 == 0) throw new Error(`expected an odd number of arguments for ${n}, got ${r} instead`)+ },+ function (t, e, i) {+ const n = hh(t[t.length - 1], e, i),+ r = new Array(t.length - 1)+ for (let e = 0; e < r.length - 1; e += 2) {+ try {+ const n = hh(t[e + 1], Yl, i)+ r[e] = n+ } catch (t) {+ throw new Error(`failed to parse argument ${e} of case expression: ${t.message}`)+ }+ try {+ const s = hh(t[e + 2], n.type, i)+ r[e + 1] = s+ } catch (t) {+ throw new Error(`failed to parse argument ${e + 1} of case expression: ${t.message}`)+ }+ }+ return (r[r.length - 1] = n), r+ }+ ),+ [ch.In]: xh(ph(2, 2), function (t, e, i) {+ let n,+ r = t[2]+ if (!Array.isArray(r)) throw new Error('the second argument for the "in" operator must be an array')+ if ("string" == typeof r[0]) {+ if ("literal" !== r[0])+ throw new Error(+ 'for the "in" operator, a string array should be wrapped in a "literal" operator to disambiguate from expressions'+ )+ if (!Array.isArray(r[1]))+ throw new Error('failed to parse "in" expression: the literal operator must be followed by an array')+ ;(r = r[1]), (n = Kl)+ } else n = Hl+ const s = new Array(r.length)+ for (let t = 0; t < s.length; t++)+ try {+ const e = hh(r[t], n, i)+ s[t] = e+ } catch (e) {+ throw new Error(`failed to parse haystack item ${t} for "in" expression: ${e.message}`)+ }+ return [hh(t[1], n, i), ...s]+ }),+ [ch.Number]: xh(ph(1, 1 / 0), mh(th)),+ [ch.String]: xh(ph(1, 1 / 0), mh(th)),+ [ch.Array]: xh(ph(1, 1 / 0), mh(Hl)),+ [ch.Color]: xh(ph(1, 4), mh(Hl)),+ [ch.Band]: xh(ph(1, 3), mh(Hl)),+ [ch.Palette]: xh(ph(2, 2), function (t, e, i) {+ let n+ try {+ n = hh(t[1], Hl, i)+ } catch (t) {+ throw new Error(`failed to parse first argument in palette expression: ${t.message}`)+ }+ const r = t[2]+ if (!Array.isArray(r)) throw new Error("the second argument of palette must be an array")+ const s = new Array(r.length)+ for (let t = 0; t < s.length; t++) {+ let e+ try {+ e = hh(r[t], ql, i)+ } catch (e) {+ throw new Error(`failed to parse color at index ${t} in palette expression: ${e.message}`)+ }+ if (!(e instanceof oh)) throw new Error(`the palette color at index ${t} must be a literal value`)+ s[t] = e+ }+ return [n, ...s]+ }),+ [ch.ToString]: xh(ph(1, 1), mh(Yl | Hl | Kl | ql))+ }+ function dh(t, e, i) {+ const n = t.length - 1,+ r = new Array(n)+ for (let e = 0; e < n; ++e) {+ const n = t[e + 1]+ switch (typeof n) {+ case "number":+ r[e] = new oh(Hl, n)+ break+ case "string":+ r[e] = new oh(Kl, n)+ break+ default:+ throw new Error(`expected a string key or numeric array index for a get operation, got ${n}`)+ }+ 0 === e && i.properties.add(String(n))+ }+ return r+ }+ function gh(t, e, i) {+ i.mapState = !0+ }+ function fh(t, e, i) {+ const n = t[0]+ if (1 !== t.length) throw new Error(`expected no arguments for ${n} operation`)+ return []+ }+ function ph(t, e) {+ return function (i, n, r) {+ const s = i[0],+ o = i.length - 1+ if (t === e) {+ if (o !== t) {+ throw new Error(`expected ${t} argument${1 === t ? "" : "s"} for ${s}, got ${o}`)+ }+ } else if (o < t || o > e) {+ throw new Error(`expected ${e === 1 / 0 ? `${t} or more` : `${t} to ${e}`} arguments for ${s}, got ${o}`)+ }+ }+ }+ function _h(t, e, i) {+ const n = t.length - 1,+ r = new Array(n)+ for (let s = 0; s < n; ++s) {+ const n = hh(t[s + 1], e, i)+ r[s] = n+ }+ return r+ }+ function mh(t) {+ return function (e, i, n) {+ const r = e.length - 1,+ s = new Array(r)+ for (let i = 0; i < r; ++i) {+ const r = hh(e[i + 1], t, n)+ s[i] = r+ }+ return s+ }+ }+ function yh(t, e, i) {+ const n = t[0],+ r = t.length - 1+ if (r % 2 == 1) throw new Error(`expected an even number of arguments for operation ${n}, got ${r} instead`)+ }+ function xh(...t) {+ return function (e, i, n) {+ const r = e[0]+ let s+ for (let r = 0; r < t.length; r++) {+ const o = t[r](e, i, n)+ if (r == t.length - 1) {+ if (!o) throw new Error("expected last argument validator to return the parsed args")+ s = o+ }+ }+ return new ah(i, r, ...s)+ }+ }+ function vh(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 vh(t.getGeometries()[0])+ default:+ return ""+ }+ }+ function Sh() {+ return { variables: {}, properties: {}, resolution: NaN, featureId: null, geometryType: "" }+ }+ function Eh(t, e, i) {+ return wh(hh(t, e, i))+ }+ function wh(t, e) {+ if (t instanceof oh) {+ if (t.type === ql && "string" == typeof t.value) {+ const e = Bl(t.value)+ return function () {+ return e+ }+ }+ return function () {+ return t.value+ }+ }+ const i = t.operator+ switch (i) {+ case ch.Number:+ case ch.String:+ case ch.Coalesce:+ return (function (t) {+ const e = t.operator,+ i = t.args.length,+ n = new Array(i)+ for (let e = 0; e < i; ++e) n[e] = wh(t.args[e])+ switch (e) {+ case ch.Coalesce:+ 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 ch.Number:+ case ch.String:+ return (t) => {+ for (let r = 0; r < i; ++r) {+ const i = n[r](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 ch.Get:+ case ch.Var:+ case ch.Has:+ return (function (t) {+ const e = t.args[0],+ i = e.value+ switch (t.operator) {+ case ch.Get:+ return (e) => {+ const n = t.args+ let r = e.properties[i]+ for (let t = 1, e = n.length; t < e; ++t) {+ r = r[n[t].value]+ }+ return r+ }+ case ch.Var:+ return (t) => t.variables[i]+ case ch.Has:+ return (e) => {+ const n = t.args+ if (!(i in e.properties)) return !1+ let r = e.properties[i]+ for (let t = 1, e = n.length; t < e; ++t) {+ const e = n[t].value+ if (!r || !Object.hasOwn(r, e)) return !1+ r = r[e]+ }+ return !0+ }+ default:+ throw new Error(`Unsupported accessor operator ${t.operator}`)+ }+ })(t)+ case ch.Id:+ return (t) => t.featureId+ case ch.GeometryType:+ return (t) => t.geometryType+ case ch.Concat: {+ const e = t.args.map((t) => wh(t))+ return (t) => "".concat(...e.map((e) => e(t).toString()))+ }+ case ch.Resolution:+ return (t) => t.resolution+ case ch.Any:+ case ch.All:+ case ch.Between:+ case ch.In:+ case ch.Not:+ return (function (t) {+ const e = t.operator,+ i = t.args.length,+ n = new Array(i)+ for (let e = 0; e < i; ++e) n[e] = wh(t.args[e])+ switch (e) {+ case ch.Any:+ return (t) => {+ for (let e = 0; e < i; ++e) if (n[e](t)) return !0+ return !1+ }+ case ch.All:+ return (t) => {+ for (let e = 0; e < i; ++e) if (!n[e](t)) return !1+ return !0+ }+ case ch.Between:+ return (t) => {+ const e = n[0](t),+ i = n[1](t),+ r = n[2](t)+ return e >= i && e <= r+ }+ case ch.In:+ return (t) => {+ const e = n[0](t)+ for (let r = 1; r < i; ++r) if (e === n[r](t)) return !0+ return !1+ }+ case ch.Not:+ return (t) => !n[0](t)+ default:+ throw new Error(`Unsupported logical operator ${e}`)+ }+ })(t)+ case ch.Equal:+ case ch.NotEqual:+ case ch.LessThan:+ case ch.LessThanOrEqualTo:+ case ch.GreaterThan:+ case ch.GreaterThanOrEqualTo:+ return (function (t) {+ const e = t.operator,+ i = wh(t.args[0]),+ n = wh(t.args[1])+ switch (e) {+ case ch.Equal:+ return (t) => i(t) === n(t)+ case ch.NotEqual:+ return (t) => i(t) !== n(t)+ case ch.LessThan:+ return (t) => i(t) < n(t)+ case ch.LessThanOrEqualTo:+ return (t) => i(t) <= n(t)+ case ch.GreaterThan:+ return (t) => i(t) > n(t)+ case ch.GreaterThanOrEqualTo:+ return (t) => i(t) >= n(t)+ default:+ throw new Error(`Unsupported comparison operator ${e}`)+ }+ })(t)+ case ch.Multiply:+ case ch.Divide:+ case ch.Add:+ case ch.Subtract:+ case ch.Clamp:+ case ch.Mod:+ case ch.Pow:+ case ch.Abs:+ case ch.Floor:+ case ch.Ceil:+ case ch.Round:+ case ch.Sin:+ case ch.Cos:+ case ch.Atan:+ case ch.Sqrt:+ return (function (t) {+ const e = t.operator,+ i = t.args.length,+ n = new Array(i)+ for (let e = 0; e < i; ++e) n[e] = wh(t.args[e])+ switch (e) {+ case ch.Multiply:+ return (t) => {+ let e = 1+ for (let r = 0; r < i; ++r) e *= n[r](t)+ return e+ }+ case ch.Divide:+ return (t) => n[0](t) / n[1](t)+ case ch.Add:+ return (t) => {+ let e = 0+ for (let r = 0; r < i; ++r) e += n[r](t)+ return e+ }+ case ch.Subtract:+ return (t) => n[0](t) - n[1](t)+ case ch.Clamp:+ return (t) => {+ const e = n[0](t),+ i = n[1](t)+ if (e < i) return i+ const r = n[2](t)+ return e > r ? r : e+ }+ case ch.Mod:+ return (t) => n[0](t) % n[1](t)+ case ch.Pow:+ return (t) => Math.pow(n[0](t), n[1](t))+ case ch.Abs:+ return (t) => Math.abs(n[0](t))+ case ch.Floor:+ return (t) => Math.floor(n[0](t))+ case ch.Ceil:+ return (t) => Math.ceil(n[0](t))+ case ch.Round:+ return (t) => Math.round(n[0](t))+ case ch.Sin:+ return (t) => Math.sin(n[0](t))+ case ch.Cos:+ return (t) => Math.cos(n[0](t))+ case ch.Atan:+ return 2 === i ? (t) => Math.atan2(n[0](t), n[1](t)) : (t) => Math.atan(n[0](t))+ case ch.Sqrt:+ return (t) => Math.sqrt(n[0](t))+ default:+ throw new Error(`Unsupported numeric operator ${e}`)+ }+ })(t)+ case ch.Case:+ return (function (t) {+ const e = t.args.length,+ i = new Array(e)+ for (let n = 0; n < e; ++n) i[n] = wh(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 ch.Match:+ return (function (t) {+ const e = t.args.length,+ i = new Array(e)+ for (let n = 0; n < e; ++n) i[n] = wh(t.args[n])+ return (t) => {+ const n = i[0](t)+ for (let r = 1; r < e - 1; r += 2) if (n === i[r](t)) return i[r + 1](t)+ return i[e - 1](t)+ }+ })(t)+ case ch.Interpolate:+ return (function (t) {+ const e = t.args.length,+ i = new Array(e)+ for (let n = 0; n < e; ++n) i[n] = wh(t.args[n])+ return (t) => {+ const n = i[0](t),+ r = i[1](t)+ let s, o+ for (let a = 2; a < e; a += 2) {+ const e = i[a](t)+ let l = i[a + 1](t)+ const h = Array.isArray(l)+ if ((h && (l = Ol(l)), e >= r)) return 2 === a ? l : h ? Ch(n, r, s, o, e, l) : Th(n, r, s, o, e, l)+ ;(s = e), (o = l)+ }+ return o+ }+ })(t)+ case ch.ToString:+ return (function (t) {+ const e = t.operator,+ i = t.args.length,+ n = new Array(i)+ for (let e = 0; e < i; ++e) n[e] = wh(t.args[e])+ if (e === ch.ToString)+ return (e) => {+ const i = n[0](e)+ return t.args[0].type === ql ? Xl(i) : i.toString()+ }+ throw new Error(`Unsupported convert operator ${e}`)+ })(t)+ default:+ throw new Error(`Unsupported operator ${i}`)+ }+ }+ function Th(t, e, i, n, r, s) {+ const o = r - i+ if (0 === o) return n+ const a = e - i+ return n + (1 === t ? a / o : (Math.pow(t, a) - 1) / (Math.pow(t, o) - 1)) * (s - n)+ }+ function Ch(t, e, i, n, r, s) {+ if (0 === r - i) return n+ const o = jl(n),+ a = jl(s)+ let l = a[2] - o[2]+ l > 180 ? (l -= 360) : l < -180 && (l += 360)+ return Ul([+ Th(t, e, i, o[0], r, a[0]),+ Th(t, e, i, o[1], r, a[1]),+ o[2] + Th(t, e, i, 0, r, l),+ Th(t, e, i, n[3], r, s[3])+ ])+ }+ class bh {+ 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 = Rh(t, e)+ return i in this.cache_ ? this.cache_[i] : null+ }+ getPattern(t, e) {+ const i = Rh(t, e)+ return i in this.patternCache_ ? this.patternCache_[i] : null+ }+ set(t, e, i, n) {+ const r = Rh(t, e),+ s = r in this.cache_+ ;(this.cache_[r] = i),+ n &&+ (i.getImageState() === Fs && i.load(),+ i.getImageState() === Ls+ ? i.ready().then(() => {+ this.patternCache_[r] = _t().createPattern(i.getImage(1), "repeat")+ })+ : (this.patternCache_[r] = _t().createPattern(i.getImage(1), "repeat"))),+ s || ++this.cacheSize_+ }+ setSize(t) {+ ;(this.maxCacheSize_ = t), this.expire()+ }+ }+ function Rh(t, e) {+ return t + ":" + (e ? zl(e) : "null")+ }+ const Ph = new bh()+ let Ih = null+ class Fh extends O {+ constructor(t, e, i, n, r) {+ super(),+ (this.hitDetectionImage_ = null),+ (this.image_ = t),+ (this.crossOrigin_ = i?.crossOrigin),+ (this.referrerPolicy_ = i?.referrerPolicy),+ (this.canvas_ = {}),+ (this.color_ = r),+ (this.imageState_ = void 0 === n ? Fs : 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_ === Ms) {+ Ih || (Ih = ft(1, 1, void 0, { willReadFrequently: !0 })), Ih.drawImage(this.image_, 0, 0)+ try {+ Ih.getImageData(0, 0, 1, 1), (this.tainted_ = !1)+ } catch {+ ;(Ih = null), (this.tainted_ = !0)+ }+ }+ return !0 === this.tainted_+ }+ dispatchChangeEvent_() {+ this.dispatchEvent(n)+ }+ handleImageError_() {+ ;(this.imageState_ = As), this.dispatchChangeEvent_()+ }+ handleImageLoad_() {+ ;(this.imageState_ = Ms), (this.size_ = [this.image_.width, this.image_.height]), this.dispatchChangeEvent_()+ }+ getImage(t) {+ return (+ this.image_ || this.initializeImage_(), this.replaceColor_(t), this.canvas_[t] ? this.canvas_[t] : this.image_+ )+ }+ setImage(t) {+ this.image_ = t+ }+ getPixelRatio(t) {+ return this.replaceColor_(t), this.canvas_[t] ? t : 1+ }+ getImageState() {+ return this.imageState_+ }+ getHitDetectionImage() {+ if ((this.image_ || this.initializeImage_(), !this.hitDetectionImage_))+ if (this.isTainted_()) {+ const t = this.size_[0],+ e = this.size_[1],+ i = ft(t, e)+ i.fillRect(0, 0, t, e), (this.hitDetectionImage_ = i.canvas)+ } else this.hitDetectionImage_ = this.image_+ return this.hitDetectionImage_+ }+ getSize() {+ return this.size_+ }+ getSrc() {+ return this.src_+ }+ load() {+ if (this.imageState_ === Fs) {+ this.image_ || this.initializeImage_(), (this.imageState_ = Ls)+ try {+ void 0 !== this.src_ && (this.image_.src = this.src_)+ } catch {+ this.handleImageError_()+ }+ this.image_ instanceof HTMLImageElement &&+ Gs(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_ !== Ms) return+ const e = this.image_,+ i = ft(Math.ceil(e.width * t), Math.ceil(e.height * t)),+ n = i.canvas+ i.scale(t, t),+ i.drawImage(e, 0, 0),+ (i.globalCompositeOperation = "multiply"),+ (i.fillStyle = Ll(this.color_)),+ 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_ === Ms || this.imageState_ === As) t()+ else {+ const e = () => {+ ;(this.imageState_ !== Ms && this.imageState_ !== As) || (this.removeEventListener(n, e), t())+ }+ this.addEventListener(n, e)+ }+ })),+ this.ready_+ )+ }+ }+ function Lh(t, e, i, n, r, s) {+ let o = void 0 === e ? void 0 : Ph.get(e, r)+ return (+ o || ((o = new Fh(t, t && "src" in t ? t.src || void 0 : e, i, n, r)), Ph.set(e, r, o, s)),+ s && o && !Ph.getPattern(e, r) && Ph.set(e, r, o, s),+ o+ )+ }+ function Mh(t) {+ return t+ ? Array.isArray(t)+ ? Xl(t)+ : "object" == typeof t && "src" in t+ ? (function (t) {+ if (!t.offset || !t.size) return Ph.getPattern(t.src, t.color)+ const e = t.src + ":" + t.offset,+ i = Ph.getPattern(e, t.color)+ if (i) return i+ const n = Ph.get(t.src, null)+ if (n.getImageState() !== Ms) return null+ const r = ft(t.size[0], t.size[1])+ return (+ r.drawImage(n.getImage(1), t.offset[0], t.offset[1], t.size[0], t.size[1], 0, 0, t.size[0], t.size[1]),+ Lh(r.canvas, e, void 0, Ms, t.color, !0),+ Ph.getPattern(e, t.color)+ )+ })(t)+ : t+ : null+ }+ const Ah = "10px sans-serif",+ Oh = "#000",+ Dh = "round",+ Nh = [],+ kh = "round",+ Gh = 10,+ jh = "#000",+ Uh = "center",+ Bh = "middle",+ zh = [0, 0, 0, 0],+ Xh = new V()+ let Vh,+ $h = null+ const Wh = {},+ Zh = new Set([+ "serif",+ "sans-serif",+ "monospace",+ "cursive",+ "fantasy",+ "system-ui",+ "ui-serif",+ "ui-sans-serif",+ "ui-monospace",+ "ui-rounded",+ "emoji",+ "math",+ "fangsong"+ ])+ function Yh(t, e, i) {+ return `${t} ${e} 16px "${i}"`+ }+ const Hh = (function () {+ const t = 100+ let e, i+ async function n(t) {+ await i.ready+ const e = await i.load(t)+ if (0 === e.length) return !1+ const n = zo(t),+ r = n.families[0].toLowerCase(),+ s = n.weight+ return e.some((t) => {+ const e = t.family.replace(/^['"]|['"]$/g, "").toLowerCase(),+ i = Bo[t.weight] || t.weight+ return e === r && t.style === n.style && i == s+ })+ }+ async function r() {+ await i.ready+ let s = !0+ const o = Xh.getProperties(),+ a = Object.keys(o).filter((e) => o[e] < t)+ for (let e = a.length - 1; e >= 0; --e) {+ const i = a[e]+ let r = o[i]+ r < t && ((await n(i)) ? (F(Wh), Xh.set(i, t)) : ((r += 10), Xh.set(i, r, !0), r < t && (s = !1)))+ }+ ;(e = void 0), s || (e = setTimeout(r, 100))+ }+ return async function (t) {+ i || (i = ct ? self.fonts : document.fonts)+ const n = zo(t)+ if (!n) return+ const s = n.families+ let o = !1+ for (const t of s) {+ if (Zh.has(t)) continue+ const e = Yh(n.style, n.weight, t)+ void 0 === Xh.get(e) && (Xh.set(e, 0, !0), (o = !0))+ }+ o && (clearTimeout(e), (e = setTimeout(r, 100)))+ }+ })(),+ Kh = (function () {+ let t+ return function (e) {+ let i = Wh[e]+ if (null == i) {+ if (ct) {+ const t = zo(e),+ n = qh(e, "Žg")+ i =+ (isNaN(Number(t.lineHeight)) ? 1.2 : Number(t.lineHeight)) *+ (n.actualBoundingBoxAscent + n.actualBoundingBoxDescent)+ } else+ t ||+ ((t = document.createElement("div")),+ (t.innerHTML = "M"),+ (t.style.minHeight = "0"),+ (t.style.maxHeight = "none"),+ (t.style.height = "auto"),+ (t.style.padding = "0"),+ (t.style.border = "none"),+ (t.style.position = "absolute"),+ (t.style.display = "block"),+ (t.style.left = "-99999px")),+ (t.style.font = e),+ document.body.appendChild(t),+ (i = t.offsetHeight),+ document.body.removeChild(t)+ Wh[e] = i+ }+ return i+ }+ })()+ function qh(t, e) {+ return $h || ($h = ft(1, 1)), t != Vh && (($h.font = t), (Vh = $h.font)), $h.measureText(e)+ }+ function Jh(t, e) {+ return qh(t, e).width+ }+ function Qh(t, e, i) {+ if (e in i) return i[e]+ const n = e.split("\n").reduce((e, i) => Math.max(e, Jh(t, i)), 0)+ return (i[e] = n), n+ }+ function tc(t, e) {+ const i = [],+ n = [],+ r = []+ let s = 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) {+ ;(s = Math.max(s, o)), r.push(o), (o = 0), (a += l), (l = 0)+ continue+ }+ const d = e[h + 1] || t.font,+ g = Jh(d, u)+ i.push(g), (o += g)+ const f = Kh(d)+ n.push(f), (l = Math.max(l, f))+ }+ return { width: s, height: a, widths: i, heights: n, lineWidths: r }+ }+ function ec(t, e, i, n, r, s, o, a, l, h, c) {+ t.save(),+ 1 !== i && (void 0 === t.globalAlpha ? (t.globalAlpha = (t) => (t.globalAlpha *= i)) : (t.globalAlpha *= i)),+ e && t.transform.apply(t, e),+ n.contextInstructions+ ? (t.translate(l, h),+ t.scale(c[0], c[1]),+ (function (t, e) {+ const i = t.contextInstructions+ for (let t = 0, n = i.length; t < n; t += 2)+ Array.isArray(i[t + 1]) ? e[i[t]].apply(e, i[t + 1]) : (e[i[t]] = i[t + 1])+ })(n, t))+ : c[0] < 0 || c[1] < 0+ ? (t.translate(l, h), t.scale(c[0], c[1]), t.drawImage(n, r, s, o, a, 0, 0, o, a))+ : t.drawImage(n, r, s, o, a, l, h, o * c[0], a * c[1]),+ t.restore()+ }+ class ic {+ constructor(t) {+ ;(this.opacity_ = t.opacity),+ (this.rotateWithView_ = t.rotateWithView),+ (this.rotation_ = t.rotation),+ (this.scale_ = t.scale),+ (this.scaleArray_ = Wl(t.scale)),+ (this.displacement_ = t.displacement),+ (this.declutterMode_ = t.declutterMode)+ }+ clone() {+ const t = this.getScale()+ return new ic({+ 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 U()+ }+ getImage(t) {+ return U()+ }+ getHitDetectionImage() {+ return U()+ }+ getPixelRatio(t) {+ return 1+ }+ getImageState() {+ return U()+ }+ getImageSize() {+ return U()+ }+ getOrigin() {+ return U()+ }+ getSize() {+ return U()+ }+ 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_ = Wl(t))+ }+ listenImageChange(t) {+ U()+ }+ load() {+ U()+ }+ unlistenImageChange(t) {+ U()+ }+ ready() {+ return Promise.resolve()+ }+ }+ class nc extends ic {+ 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() ? Ls : Ms),+ this.imageState_ === Ls && this.ready().then(() => (this.imageState_ = Ms)),+ this.render()+ }+ clone() {+ const t = this.getScale(),+ e = new nc({+ fill: this.getFill() ? this.getFill().clone() : void 0,+ points: this.getPoints(),+ radius: this.getRadius(),+ radius2: this.getRadius2(),+ angle: this.getAngle(),+ stroke: this.getStroke() ? this.getStroke().clone() : void 0,+ rotation: this.getRotation(),+ rotateWithView: this.getRotateWithView(),+ scale: Array.isArray(t) ? t.slice() : t,+ displacement: this.getDisplacement().slice(),+ declutterMode: this.getDeclutterMode()+ })+ return e.setOpacity(this.getOpacity()), e+ }+ getAnchor() {+ const t = this.size_,+ e = this.getDisplacement(),+ i = this.getScaleArray()+ return [t[0] / 2 - e[0] / i[0], t[1] / 2 + e[1] / i[1]]+ }+ getAngle() {+ return this.angle_+ }+ getFill() {+ return this.fill_+ }+ setFill(t) {+ ;(this.fill_ = t), this.render()+ }+ getHitDetectionImage() {+ return (+ this.hitDetectionCanvas_ || (this.hitDetectionCanvas_ = this.createHitDetectionCanvas_(this.renderOptions_)),+ this.hitDetectionCanvas_+ )+ }+ getImage(t) {+ const e = this.fill_?.getKey(),+ i =+ `${t},${this.angle_},${this.radius},${this.radius2_},${this.points_},${e}` ++ Object.values(this.renderOptions_).join(",")+ let n = Ph.get(i, null)?.getImage(1)+ if (!n) {+ const e = this.renderOptions_,+ r = Math.ceil(e.size * t),+ s = ft(r, r)+ this.draw_(e, s, t), (n = s.canvas)+ const o = new Fh(n, void 0, null, Ms, null)+ Ph.set(i, null, o),+ createImageBitmap(n).then((t) => {+ o.setImage(t)+ })+ }+ return n+ }+ getPixelRatio(t) {+ return t+ }+ getImageSize() {+ return this.size_+ }+ getImageState() {+ return this.imageState_+ }+ getOrigin() {+ return this.origin_+ }+ getPoints() {+ return this.points_+ }+ getRadius() {+ return this.radius+ }+ setRadius(t) {+ this.radius !== t && ((this.radius = t), this.render())+ }+ getRadius2() {+ return this.radius2_+ }+ setRadius2(t) {+ this.radius2_ !== t && ((this.radius2_ = t), this.render())+ }+ getSize() {+ return this.size_+ }+ getStroke() {+ return this.stroke_+ }+ setStroke(t) {+ ;(this.stroke_ = t), this.render()+ }+ listenImageChange(t) {}+ load() {}+ unlistenImageChange(t) {}+ calculateLineJoinSize_(t, e, i) {+ if (0 === e || this.points_ === 1 / 0 || ("bevel" !== t && "miter" !== t)) return e+ let n = this.radius,+ r = void 0 === this.radius2_ ? n : this.radius2_+ if (n < r) {+ const t = n+ ;(n = r), (r = t)+ }+ const s = void 0 === this.radius2_ ? this.points_ : 2 * this.points_,+ o = (2 * Math.PI) / s,+ a = r * Math.sin(o),+ l = n - Math.sqrt(r * r - a * a),+ h = Math.sqrt(a * a + l * l),+ 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),+ p = r - Math.sqrt(n * n - f * f),+ _ = Math.sqrt(f * f + p * p) / f+ if (_ <= i) {+ const t = (_ * e) / 2 - r - n+ return 2 * Math.max(g, t)+ }+ return 2 * g+ }+ createRenderOptions() {+ let t,+ e = Dh,+ i = kh,+ n = 0,+ r = null,+ s = 0,+ o = 0+ this.stroke_ &&+ ((t = Mh(this.stroke_.getColor() ?? jh)),+ (o = this.stroke_.getWidth() ?? 1),+ (r = this.stroke_.getLineDash()),+ (s = this.stroke_.getLineDashOffset() ?? 0),+ (i = this.stroke_.getLineJoin() ?? kh),+ (e = this.stroke_.getLineCap() ?? Dh),+ (n = this.stroke_.getMiterLimit() ?? Gh))+ const a = this.calculateLineJoinSize_(i, o, n),+ l = Math.max(this.radius, this.radius2_ || 0)+ return {+ strokeStyle: t,+ strokeWidth: o,+ size: Math.ceil(2 * l + a),+ lineCap: e,+ lineDash: r,+ lineDashOffset: s,+ lineJoin: i,+ miterLimit: n+ }+ }+ render() {+ this.renderOptions_ = this.createRenderOptions()+ const t = this.renderOptions_.size+ ;(this.hitDetectionCanvas_ = null), (this.size_ = [t, t])+ }+ draw_(t, e, i) {+ if ((e.scale(i, i), e.translate(t.size / 2, t.size / 2), this.createPath_(e), this.fill_)) {+ let t = this.fill_.getColor()+ null === t && (t = Oh), (e.fillStyle = Mh(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 = zl(i)),+ null === i ? (n = 1) : Array.isArray(i) && (n = 4 === i.length ? i[3] : 1),+ 0 === n && ((e = ft(t.size, t.size)), this.drawHitDetectionCanvas_(t, e))+ }+ return e ? e.canvas : this.getImage(1)+ }+ createPath_(t) {+ let e = this.points_+ const i = this.radius+ if (e === 1 / 0) t.arc(0, 0, i, 0, 2 * Math.PI)+ else {+ const n = void 0 === this.radius2_ ? i : this.radius2_+ void 0 !== this.radius2_ && (e *= 2)+ const r = this.angle_ - Math.PI / 2,+ s = (2 * Math.PI) / e+ for (let o = 0; o < e; o++) {+ const e = r + o * s,+ a = o % 2 == 0 ? i : n+ t.lineTo(a * Math.cos(e), a * Math.sin(e))+ }+ t.closePath()+ }+ }+ drawHitDetectionCanvas_(t, e) {+ e.translate(t.size / 2, t.size / 2),+ this.createPath_(e),+ (e.fillStyle = Oh),+ 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 rc extends nc {+ 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 rc({+ fill: this.getFill() ? this.getFill().clone() : void 0,+ stroke: this.getStroke() ? this.getStroke().clone() : void 0,+ radius: this.getRadius(),+ scale: Array.isArray(t) ? t.slice() : t,+ rotation: this.getRotation(),+ rotateWithView: this.getRotateWithView(),+ displacement: this.getDisplacement().slice(),+ declutterMode: this.getDeclutterMode()+ })+ return e.setOpacity(this.getOpacity()), e+ }+ }+ class sc {+ 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 sc({ 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 = Lh(+ 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() === Fs && e.load(),+ e.getImageState() === Ls && (this.patternImage_ = e)+ }+ this.color_ = t+ }+ getKey() {+ const t = this.getColor()+ return t+ ? t instanceof CanvasPattern || t instanceof CanvasGradient+ ? z(t)+ : "object" == typeof t && "src" in t+ ? t.src + ":" + t.offset+ : zl(t).toString()+ : ""+ }+ loading() {+ return !!this.patternImage_+ }+ ready() {+ return this.patternImage_ ? this.patternImage_.ready() : Promise.resolve()+ }+ }+ function oc(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 ac extends ic {+ constructor(t) {+ const e = void 0 !== (t = t || {}).opacity ? t.opacity : 1,+ i = void 0 !== t.rotation ? t.rotation : 0,+ n = void 0 !== t.scale ? t.scale : 1,+ r = void 0 !== t.rotateWithView && t.rotateWithView+ super({+ opacity: e,+ rotation: i,+ scale: n,+ displacement: void 0 !== t.displacement ? t.displacement : [0, 0],+ rotateWithView: r,+ declutterMode: t.declutterMode+ }),+ (this.anchor_ = void 0 !== t.anchor ? t.anchor : [0.5, 0.5]),+ (this.normalizedAnchor_ = null),+ (this.anchorOrigin_ = void 0 !== t.anchorOrigin ? t.anchorOrigin : "top-left"),+ (this.anchorXUnits_ = void 0 !== t.anchorXUnits ? t.anchorXUnits : "fraction"),+ (this.anchorYUnits_ = void 0 !== t.anchorYUnits ? t.anchorYUnits : "fraction"),+ (this.crossOrigin_ = void 0 !== t.crossOrigin ? t.crossOrigin : null),+ (this.referrerPolicy_ = t.referrerPolicy)+ const s = void 0 !== t.img ? t.img : null+ let o,+ a = t.src+ if (+ (Mt(!(void 0 !== a && s), "`image` and `src` cannot be provided at the same time"),+ (void 0 !== a && 0 !== a.length) || !s || (a = s.src || z(s)),+ Mt(void 0 !== a && a.length > 0, "A defined and non-empty `src` or `image` must be provided"),+ Mt(+ !((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 = Fs)+ : void 0 !== s && (o = "complete" in s ? (s.complete ? (s.src ? Ms : Fs) : Ls) : Ms),+ (this.color_ = void 0 !== t.color ? zl(t.color) : null),+ (this.iconImage_ = Lh(+ s,+ a,+ { crossOrigin: this.crossOrigin_, referrerPolicy: this.referrerPolicy_ },+ o,+ this.color_+ )),+ (this.offset_ = void 0 !== t.offset ? t.offset : [0, 0]),+ (this.offsetOrigin_ = void 0 !== t.offsetOrigin ? t.offsetOrigin : "top-left"),+ (this.origin_ = null),+ (this.size_ = void 0 !== t.size ? t.size : null),+ this.initialOptions_,+ void 0 !== t.width || void 0 !== t.height)+ ) {+ let e, i+ if (t.size) [e, i] = t.size+ else {+ const n = this.getImage(1)+ if (n.width && n.height) (e = n.width), (i = n.height)+ else if (n instanceof HTMLImageElement) {+ this.initialOptions_ = t+ const e = () => {+ if ((this.unlistenImageChange(e), !this.initialOptions_)) return+ const i = this.iconImage_.getSize()+ this.setScale(oc(i[0], i[1], t.width, t.height))+ }+ return void this.listenImageChange(e)+ }+ }+ void 0 !== e && this.setScale(oc(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 ac({+ 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 ? zl(t) : null+ if (+ this.color_ === e ||+ (this.color_ && e && this.color_.length === e.length && this.color_.every((t, i) => t === e[i]))+ )+ return+ this.color_ = e+ const i = this.getSrc(),+ n = void 0 !== i ? null : this.getHitDetectionImage(),+ r = void 0 !== i ? Fs : this.iconImage_.getImageState()+ this.iconImage_ = Lh(+ n,+ i,+ { crossOrigin: this.crossOrigin_, referrerPolicy: this.referrerPolicy_ },+ r,+ this.color_+ )+ }+ getImage(t) {+ return this.iconImage_.getImage(t)+ }+ getPixelRatio(t) {+ return this.iconImage_.getPixelRatio(t)+ }+ getImageSize() {+ return this.iconImage_.getSize()+ }+ getImageState() {+ return this.iconImage_.getImageState()+ }+ getHitDetectionImage() {+ return this.iconImage_.getHitDetectionImage()+ }+ getOrigin() {+ if (this.origin_) return this.origin_+ let t = this.offset_+ if ("top-left" != this.offsetOrigin_) {+ const e = this.getSize(),+ i = this.iconImage_.getSize()+ if (!e || !i) return null+ ;(t = t.slice()),+ ("top-right" != this.offsetOrigin_ && "bottom-right" != this.offsetOrigin_) || (t[0] = i[0] - e[0] - t[0]),+ ("bottom-left" != this.offsetOrigin_ && "bottom-right" != this.offsetOrigin_) || (t[1] = i[1] - e[1] - t[1])+ }+ return (this.origin_ = t), this.origin_+ }+ getSrc() {+ return this.iconImage_.getSrc()+ }+ setSrc(t) {+ this.iconImage_ = Lh(+ null,+ t,+ { crossOrigin: this.crossOrigin_, referrerPolicy: this.referrerPolicy_ },+ Fs,+ this.color_+ )+ }+ getSize() {+ return this.size_ ? this.size_ : this.iconImage_.getSize()+ }+ getWidth() {+ const t = this.getScaleArray()+ return this.size_+ ? this.size_[0] * t[0]+ : this.iconImage_.getImageState() == Ms+ ? this.iconImage_.getSize()[0] * t[0]+ : void 0+ }+ getHeight() {+ const t = this.getScaleArray()+ return this.size_+ ? this.size_[1] * t[1]+ : this.iconImage_.getImageState() == Ms+ ? this.iconImage_.getSize()[1] * t[1]+ : void 0+ }+ setScale(t) {+ delete this.initialOptions_, super.setScale(t)+ }+ listenImageChange(t) {+ this.iconImage_.addEventListener(n, t)+ }+ load() {+ this.iconImage_.load()+ }+ unlistenImageChange(t) {+ this.iconImage_.removeEventListener(n, t)+ }+ ready() {+ return this.iconImage_.ready()+ }+ }+ class lc {+ 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 lc({+ color: Array.isArray(t) ? t.slice() : t || void 0,+ lineCap: this.getLineCap(),+ lineDash: this.getLineDash() ? this.getLineDash().slice() : void 0,+ lineDashOffset: this.getLineDashOffset(),+ lineJoin: this.getLineJoin(),+ miterLimit: this.getMiterLimit(),+ offset: this.getOffset(),+ width: this.getWidth()+ })+ }+ getColor() {+ return this.color_+ }+ getLineCap() {+ return this.lineCap_+ }+ getLineDash() {+ return this.lineDash_+ }+ getLineDashOffset() {+ return this.lineDashOffset_+ }+ getLineJoin() {+ return this.lineJoin_+ }+ getMiterLimit() {+ return this.miterLimit_+ }+ getOffset() {+ return this.offset_+ }+ getWidth() {+ return this.width_+ }+ setColor(t) {+ this.color_ = t+ }+ setLineCap(t) {+ this.lineCap_ = t+ }+ setLineDash(t) {+ this.lineDash_ = t+ }+ setLineDashOffset(t) {+ this.lineDashOffset_ = t+ }+ setLineJoin(t) {+ this.lineJoin_ = t+ }+ setMiterLimit(t) {+ this.miterLimit_ = t+ }+ setOffset(t) {+ this.offset_ = t+ }+ setWidth(t) {+ this.width_ = t+ }+ }+ class hc {+ constructor(t) {+ ;(t = t || {}),+ (this.geometry_ = null),+ (this.geometryFunction_ = fc),+ 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 hc({+ geometry: t ?? void 0,+ fill: this.getFill() ? this.getFill().clone() : void 0,+ image: this.getImage() ? this.getImage().clone() : void 0,+ renderer: this.getRenderer() ?? void 0,+ stroke: this.getStroke() ? this.getStroke().clone() : void 0,+ text: this.getText() ? this.getText().clone() : void 0,+ zIndex: this.getZIndex()+ })+ )+ }+ getRenderer() {+ return this.renderer_+ }+ setRenderer(t) {+ this.renderer_ = t+ }+ setHitDetectionRenderer(t) {+ this.hitDetectionRenderer_ = t+ }+ getHitDetectionRenderer() {+ return this.hitDetectionRenderer_+ }+ getGeometry() {+ return this.geometry_+ }+ getGeometryFunction() {+ return this.geometryFunction_+ }+ getFill() {+ return this.fill_+ }+ setFill(t) {+ this.fill_ = t+ }+ getImage() {+ return this.image_+ }+ setImage(t) {+ this.image_ = t+ }+ getStroke() {+ return this.stroke_+ }+ setStroke(t) {+ this.stroke_ = t+ }+ getText() {+ return this.text_+ }+ setText(t) {+ this.text_ = t+ }+ getZIndex() {+ return this.zIndex_+ }+ setGeometry(t) {+ "function" == typeof t+ ? (this.geometryFunction_ = t)+ : "string" == typeof t+ ? (this.geometryFunction_ = function (e) {+ return e.get(t)+ })+ : t+ ? void 0 !== t &&+ (this.geometryFunction_ = function () {+ return t+ })+ : (this.geometryFunction_ = fc),+ (this.geometry_ = t)+ }+ setZIndex(t) {+ this.zIndex_ = t+ }+ }+ function cc(t) {+ let e+ if ("function" == typeof t) e = t+ else {+ let i+ if (Array.isArray(t)) i = t+ else {+ Mt("function" == typeof t.getZIndex, "Expected an `Style` or an array of `Style`")+ i = [t]+ }+ e = function () {+ return i+ }+ }+ return e+ }+ let uc = null+ function dc(t, e) {+ if (!uc) {+ const t = new sc({ color: "rgba(255,255,255,0.4)" }),+ e = new lc({ color: "#3399CC", width: 1.25 })+ uc = [new hc({ image: new rc({ fill: t, stroke: e, radius: 5 }), fill: t, stroke: e })]+ }+ return uc+ }+ function gc() {+ const t = {},+ e = [255, 255, 255, 1],+ i = [0, 153, 255, 1]+ return (+ (t.Polygon = [new hc({ fill: new sc({ color: [255, 255, 255, 0.5] }) })]),+ (t.MultiPolygon = t.Polygon),+ (t.LineString = [+ new hc({ stroke: new lc({ color: e, width: 5 }) }),+ new hc({ stroke: new lc({ color: i, width: 3 }) })+ ]),+ (t.MultiLineString = t.LineString),+ (t.Circle = t.Polygon.concat(t.LineString)),+ (t.Point = [+ new hc({+ image: new rc({ radius: 6, fill: new sc({ color: i }), stroke: new lc({ color: e, width: 1.5 }) }),+ zIndex: 1 / 0+ })+ ]),+ (t.MultiPoint = t.Point),+ (t.GeometryCollection = t.Polygon.concat(t.LineString, t.Point)),+ t+ )+ }+ function fc(t) {+ return t.getGeometry()+ }+ class pc {+ 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_ = Wl(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 sc({ 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 pc({+ 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 sc ? this.getFill().clone() : this.getFill(),+ stroke: this.getStroke() ? this.getStroke().clone() : void 0,+ offsetX: this.getOffsetX(),+ offsetY: this.getOffsetY(),+ backgroundFill: this.getBackgroundFill() ? this.getBackgroundFill().clone() : void 0,+ backgroundStroke: this.getBackgroundStroke() ? this.getBackgroundStroke().clone() : void 0,+ padding: this.getPadding() || void 0,+ declutterMode: this.getDeclutterMode()+ })+ }+ getOverflow() {+ return this.overflow_+ }+ getFont() {+ return this.font_+ }+ getMaxAngle() {+ return this.maxAngle_+ }+ getPlacement() {+ return this.placement_+ }+ getRepeat() {+ return this.repeat_+ }+ getOffsetX() {+ return this.offsetX_+ }+ getOffsetY() {+ return this.offsetY_+ }+ getFill() {+ return this.fill_+ }+ getRotateWithView() {+ return this.rotateWithView_+ }+ getKeepUpright() {+ return this.keepUpright_+ }+ getRotation() {+ return this.rotation_+ }+ getScale() {+ return this.scale_+ }+ getScaleArray() {+ return this.scaleArray_+ }+ getStroke() {+ return this.stroke_+ }+ getText() {+ return this.text_+ }+ getTextAlign() {+ return this.textAlign_+ }+ getJustify() {+ return this.justify_+ }+ getTextBaseline() {+ return this.textBaseline_+ }+ getBackgroundFill() {+ return this.backgroundFill_+ }+ getBackgroundStroke() {+ return this.backgroundStroke_+ }+ getPadding() {+ return this.padding_+ }+ getDeclutterMode() {+ return this.declutterMode_+ }+ setOverflow(t) {+ this.overflow_ = t+ }+ setFont(t) {+ this.font_ = t+ }+ setMaxAngle(t) {+ this.maxAngle_ = t+ }+ setOffsetX(t) {+ this.offsetX_ = t+ }+ setOffsetY(t) {+ this.offsetY_ = t+ }+ setPlacement(t) {+ this.placement_ = t+ }+ setRepeat(t) {+ this.repeat_ = t+ }+ setRotateWithView(t) {+ this.rotateWithView_ = t+ }+ setKeepUpright(t) {+ this.keepUpright_ = t+ }+ setFill(t) {+ this.fill_ = t+ }+ setRotation(t) {+ this.rotation_ = t+ }+ setScale(t) {+ ;(this.scale_ = t), (this.scaleArray_ = Wl(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+ }+ }+ function _c(t) {+ return !0+ }+ function mc(t) {+ const e = lh(),+ i = xc(t, e),+ n = { variables: {}, properties: {}, resolution: NaN, featureId: null, geometryType: "" }+ return function (t, r) {+ if (((n.properties = t.getPropertiesInternal()), (n.resolution = r), e.featureId)) {+ const e = t.getId()+ n.featureId = void 0 !== e ? e : null+ }+ return e.geometryType && (n.geometryType = vh(t.getGeometry())), i(n)+ }+ }+ function yc(t) {+ const e = lh(),+ i = t.length,+ n = new Array(i)+ for (let r = 0; r < i; ++r) n[r] = vc(t[r], e)+ const r = { variables: {}, properties: {}, resolution: NaN, featureId: null, geometryType: "" },+ s = new Array(i)+ return function (t, o) {+ if (((r.properties = t.getPropertiesInternal()), (r.resolution = o), e.featureId)) {+ const e = t.getId()+ r.featureId = void 0 !== e ? e : null+ }+ let a = 0+ for (let t = 0; t < i; ++t) {+ const e = n[t](r)+ e && ((s[a] = e), (a += 1))+ }+ return (s.length = a), s+ }+ }+ function xc(t, e) {+ const i = t.length,+ n = new Array(i)+ for (let r = 0; r < i; ++r) {+ const i = t[r],+ s = "filter" in i ? Eh(i.filter, Yl, e) : _c+ 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] = vc(i.style[n], e)+ } else o = [vc(i.style, e)]+ n[r] = { filter: s, styles: o }+ }+ return function (e) {+ const r = []+ let s = !1+ for (let o = 0; o < i; ++o) {+ if ((0, n[o].filter)(e) && (!t[o].else || !s)) {+ s = !0+ for (const t of n[o].styles) {+ const i = t(e)+ i && r.push(i)+ }+ }+ }+ return r+ }+ }+ function vc(t, e) {+ const i = Sc(t, "", e),+ n = Ec(t, "", e),+ r = (function (t, e) {+ const i = "text-",+ n = Cc(t, i + "value", e)+ if (!n) return null+ const r = Sc(t, i, e),+ s = Sc(t, i + "background-", e),+ o = Ec(t, i, e),+ a = Ec(t, i + "background-", e),+ l = Cc(t, i + "font", e),+ h = Tc(t, i + "max-angle", e),+ c = Tc(t, i + "offset-x", e),+ u = Tc(t, i + "offset-y", e),+ d = bc(t, i + "overflow", e),+ g = Cc(t, i + "placement", e),+ f = Tc(t, i + "repeat", e),+ p = Lc(t, i + "scale", e),+ _ = bc(t, i + "rotate-with-view", e),+ m = Tc(t, i + "rotation", e),+ y = Cc(t, i + "align", e),+ x = Cc(t, i + "justify", e),+ v = Cc(t, i + "baseline", e),+ S = bc(t, i + "keep-upright", e),+ E = Pc(t, i + "padding", e),+ w = Dc(t, i + "declutter-mode"),+ T = new pc({ declutterMode: w })+ return function (t) {+ if (+ (T.setText(n(t)),+ r && T.setFill(r(t)),+ s && T.setBackgroundFill(s(t)),+ o && T.setStroke(o(t)),+ a && T.setBackgroundStroke(a(t)),+ l && T.setFont(l(t)),+ h && T.setMaxAngle(h(t)),+ c && T.setOffsetX(c(t)),+ u && T.setOffsetY(u(t)),+ d && T.setOverflow(d(t)),+ g)+ ) {+ const e = g(t)+ if ("point" !== e && "line" !== e) throw new Error("Expected point or line for text-placement")+ T.setPlacement(e)+ }+ if (+ (f && T.setRepeat(f(t)), p && T.setScale(p(t)), _ && T.setRotateWithView(_(t)), m && T.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")+ T.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")+ T.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")+ T.setTextBaseline(e)+ }+ return E && T.setPadding(E(t)), S && T.setKeepUpright(S(t)), T+ }+ })(t, e),+ s = (function (t, e) {+ if ("icon-src" in t)+ return (function (t, e) {+ const i = "icon-",+ n = i + "src",+ r = kc(t[n], n),+ s = Ic(t, i + "anchor", e),+ o = Lc(t, i + "scale", e),+ a = Tc(t, i + "opacity", e),+ l = Ic(t, i + "displacement", e),+ h = Tc(t, i + "rotation", e),+ c = bc(t, i + "rotate-with-view", e),+ u = Ac(t, i + "anchor-origin"),+ d = Oc(t, i + "anchor-x-units"),+ g = Oc(t, i + "anchor-y-units"),+ f = wc(t, i + "color")+ let p,+ _ = null+ if (void 0 !== f) {+ Array.isArray(f) && f.length > 0 && "string" == typeof f[0]+ ? (_ = Rc(t, i + "color", e))+ : (p = jc(f, i + "color"))+ }+ const m = (function (t, e) {+ const i = 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 = t[e]+ if (void 0 === i) return+ return Nc(i, e)+ })(t, i + "offset"),+ x = Ac(t, i + "offset-origin"),+ v = Mc(t, i + "width"),+ S = Mc(t, i + "height"),+ E = (function (t, e) {+ const i = t[e]+ if (void 0 === i) return+ if ("number" == typeof i) return Wl(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"),+ w = Dc(t, i + "declutter-mode"),+ T = {+ src: r,+ anchorOrigin: u,+ anchorXUnits: d,+ anchorYUnits: g,+ crossOrigin: m,+ offset: y,+ offsetOrigin: x,+ height: S,+ width: v,+ size: E,+ declutterMode: w+ }+ let C = null+ return function (t) {+ if (C) _ && C.setColor(_(t))+ else {+ const e = _ ? _(t) : p+ C = new ac(void 0 !== e ? Object.assign({}, T, { color: e }) : Object.assign({}, T))+ }+ return (+ a && C.setOpacity(a(t)),+ l && C.setDisplacement(l(t)),+ h && C.setRotation(h(t)),+ c && C.setRotateWithView(c(t)),+ o && C.setScale(o(t)),+ s && C.setAnchor(s(t)),+ C+ )+ }+ })(t, e)+ if ("shape-points" in t)+ return (function (t, e) {+ const i = "shape-",+ n = i + "points",+ r = i + "radius",+ s = Gc(t[n], n)+ if (!(r in t)) throw new Error(`Expected a number for ${r}`)+ const o = Tc(t, r, e),+ a = "number" == typeof t[r] ? t[r] : 5,+ l = i + "radius2",+ h = Tc(t, l, e),+ c = "number" == typeof t[l] ? t[l] : void 0,+ u = Sc(t, i, e),+ d = Ec(t, i, e),+ g = Lc(t, i + "scale", e),+ f = Ic(t, i + "displacement", e),+ p = Tc(t, i + "rotation", e),+ _ = bc(t, i + "rotate-with-view", e),+ m = Mc(t, i + "angle"),+ y = Dc(t, i + "declutter-mode"),+ x = new nc({ points: s, radius: a, radius2: c, angle: m, declutterMode: y })+ return function (t) {+ return (+ o && x.setRadius(o(t)),+ h && x.setRadius2(h(t)),+ u && x.setFill(u(t)),+ d && x.setStroke(d(t)),+ f && x.setDisplacement(f(t)),+ p && x.setRotation(p(t)),+ _ && x.setRotateWithView(_(t)),+ g && x.setScale(g(t)),+ x+ )+ }+ })(t, e)+ if ("circle-radius" in t)+ return (function (t, e) {+ const i = "circle-",+ n = Sc(t, i, e),+ r = Ec(t, i, e),+ s = Tc(t, i + "radius", e),+ o = Lc(t, i + "scale", e),+ a = Ic(t, i + "displacement", e),+ l = Tc(t, i + "rotation", e),+ h = bc(t, i + "rotate-with-view", e),+ c = Dc(t, i + "declutter-mode"),+ u = new rc({ radius: 5, declutterMode: c })+ return function (t) {+ return (+ s && u.setRadius(s(t)),+ n && u.setFill(n(t)),+ r && u.setStroke(r(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),+ o = Tc(t, "z-index", e)+ if (!(i || n || r || s || L(t)))+ throw new Error("No fill, stroke, point, or text symbolizer properties in style: " + JSON.stringify(t))+ const a = new hc()+ return function (t) {+ let e = !0+ if (i) {+ const n = i(t)+ n && (e = !1), a.setFill(n)+ }+ if (n) {+ const i = n(t)+ i && (e = !1), a.setStroke(i)+ }+ if (r) {+ const i = r(t)+ i && (e = !1), a.setText(i)+ }+ if (s) {+ const i = s(t)+ i && (e = !1), a.setImage(i)+ }+ return o && a.setZIndex(o(t)), e ? null : a+ }+ }+ function Sc(t, e, i) {+ let n+ if (e + "fill-pattern-src" in t)+ n = (function (t, e, i) {+ const n = Cc(t, e + "pattern-src", i),+ r = Fc(t, e + "pattern-offset", i),+ s = Fc(t, e + "pattern-size", i),+ o = Rc(t, e + "color", i)+ return function (t) {+ return { src: n(t), offset: r && r(t), size: s && s(t), color: o && o(t) }+ }+ })(t, e + "fill-", i)+ else {+ if ("none" === t[e + "fill-color"]) return (t) => null+ n = Rc(t, e + "fill-color", i)+ }+ if (!n) return null+ const r = new sc()+ return function (t) {+ const e = n(t)+ return e === El ? null : (r.setColor(e), r)+ }+ }+ function Ec(t, e, i) {+ const n = Tc(t, e + "stroke-width", i),+ r = Rc(t, e + "stroke-color", i)+ if (!n && !r) return null+ const s = Cc(t, e + "stroke-line-cap", i),+ o = Cc(t, e + "stroke-line-join", i),+ a = Pc(t, e + "stroke-line-dash", i),+ l = Tc(t, e + "stroke-line-dash-offset", i),+ h = Tc(t, e + "stroke-miter-limit", i),+ c = Tc(t, e + "stroke-offset", i),+ u = new lc()+ return function (t) {+ if (r) {+ const e = r(t)+ if (e === El) return null+ u.setColor(e)+ }+ if ((n && u.setWidth(n(t)), s)) {+ const e = s(t)+ if ("butt" !== e && "round" !== e && "square" !== e) throw new Error("Expected butt, round, or square line cap")+ 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 wc(t, e) {+ if (!(e in t)) return+ const i = t[e]+ return void 0 === i ? void 0 : i+ }+ function Tc(t, e, i) {+ const n = wc(t, e)+ if (void 0 === n) return+ const r = Eh(n, Hl, i)+ return function (t) {+ return Gc(r(t), e)+ }+ }+ function Cc(t, e, i) {+ const n = wc(t, e)+ if (void 0 === n) return null+ const r = Eh(n, Kl, i)+ return function (t) {+ return kc(r(t), e)+ }+ }+ function bc(t, e, i) {+ const n = wc(t, e)+ if (void 0 === n) return null+ const r = Eh(n, Yl, i)+ return function (t) {+ const i = r(t)+ if ("boolean" != typeof i) throw new Error(`Expected a boolean for ${e}`)+ return i+ }+ }+ function Rc(t, e, i) {+ const n = wc(t, e)+ if (void 0 === n) return null+ const r = Eh(n, ql, i)+ return function (t) {+ return jc(r(t), e)+ }+ }+ function Pc(t, e, i) {+ const n = wc(t, e)+ if (void 0 === n) return null+ if (Array.isArray(n) && (0 === n.length || "string" != typeof n[0])) {+ const t = n.map((t, n) => {+ if ("number" == typeof t) return () => t+ const r = Eh(t, Hl, i)+ return function (t) {+ return Gc(r(t), `${e}[${n}]`)+ }+ })+ return function (e) {+ const i = new Array(t.length)+ for (let n = 0; n < t.length; ++n) i[n] = t[n](e)+ return i+ }+ }+ const r = Eh(n, Jl, i)+ return function (t) {+ return Nc(r(t), e)+ }+ }+ function Ic(t, e, i) {+ const n = wc(t, e)+ if (void 0 === n) return null+ const r = Eh(n, Jl, i)+ return function (t) {+ const i = Nc(r(t), e)+ if (2 !== i.length) throw new Error(`Expected two numbers for ${e}`)+ return i+ }+ }+ function Fc(t, e, i) {+ const n = wc(t, e)+ if (void 0 === n) return null+ const r = Eh(n, Jl, i)+ return function (t) {+ return Uc(r(t), e)+ }+ }+ function Lc(t, e, i) {+ const n = wc(t, e)+ if (void 0 === n) return null+ const r = Eh(n, Jl | Hl, i)+ return function (t) {+ return (function (t, e) {+ if ("number" == typeof t) return t+ return Uc(t, e)+ })(r(t), e)+ }+ }+ function Mc(t, e) {+ const i = t[e]+ if (void 0 !== i) {+ if ("number" != typeof i) throw new Error(`Expected a number for ${e}`)+ return i+ }+ }+ function Ac(t, e) {+ const i = t[e]+ if (void 0 !== i) {+ if ("bottom-left" !== i && "bottom-right" !== i && "top-left" !== i && "top-right" !== i)+ throw new Error(`Expected bottom-left, bottom-right, top-left, or top-right for ${e}`)+ return i+ }+ }+ function Oc(t, e) {+ const i = t[e]+ if (void 0 !== i) {+ if ("pixels" !== i && "fraction" !== i) throw new Error(`Expected pixels or fraction for ${e}`)+ return i+ }+ }+ function Dc(t, e) {+ const i = t[e]+ if (void 0 !== i) {+ if ("string" != typeof i) throw new Error(`Expected a string for ${e}`)+ if ("declutter" !== i && "obstacle" !== i && "none" !== i)+ throw new Error(`Expected declutter, obstacle, or none for ${e}`)+ return i+ }+ }+ function Nc(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 kc(t, e) {+ if ("string" != typeof t) throw new Error(`Expected a string for ${e}`)+ return t+ }+ function Gc(t, e) {+ if ("number" != typeof t) throw new Error(`Expected a number for ${e}`)+ return t+ }+ function jc(t, e) {+ if ("string" == typeof t) return t+ const i = Nc(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 Uc(t, e) {+ const i = Nc(t, e)+ if (2 !== i.length) throw new Error(`Expected an array of two numbers for ${e}`)+ return i+ }+ const Bc = "renderOrder"+ class zc extends nl {+ 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(Bc)+ }+ getStyle() {+ return this.style_+ }+ getStyleFunction() {+ return this.styleFunction_+ }+ getUpdateWhileAnimating() {+ return this.updateWhileAnimating_+ }+ getUpdateWhileInteracting() {+ return this.updateWhileInteracting_+ }+ renderDeclutter(t, e) {+ const i = this.getDeclutter()+ i in t.declutter == !1 && (t.declutter[i] = new ll(9)), this.getRenderer().renderDeclutter(t, e)+ }+ setRenderOrder(t) {+ this.set(Bc, t)+ }+ setStyle(t) {+ this.style_ = void 0 === t ? dc : t+ const e = (function (t) {+ if (void 0 === t) return dc+ if (!t) return null+ if ("function" == typeof t) return t+ if (t instanceof hc) return t+ if (!Array.isArray(t)) return yc([t])+ if (0 === t.length) return []+ const e = t.length,+ i = t[0]+ if (i instanceof hc) {+ const i = new Array(e)+ for (let n = 0; n < e; ++n) {+ const e = t[n]+ if (!(e instanceof hc)) throw new Error("Expected a list of style instances")+ i[n] = e+ }+ return i+ }+ if ("style" in i) {+ const i = new Array(e)+ for (let n = 0; n < e; ++n) {+ const e = t[n]+ if (!("style" in e)) throw new Error("Expected a list of rules with a style property")+ i[n] = e+ }+ return mc(i)+ }+ const n = t+ return yc(n)+ })(t)+ ;(this.styleFunction_ = null === t ? void 0 : cc(e)), this.changed()+ }+ setDeclutter(t) {+ ;(this.declutter_ = t ? String(t) : void 0), this.changed()+ }+ }+ class Xc extends M {+ constructor(t, e, i, n) {+ super(t), (this.inversePixelTransform = e), (this.frameState = i), (this.context = n)+ }+ }+ class Vc extends _ {+ constructor(t) {+ super(), (this.map_ = t)+ }+ dispatchRenderEvent(t, e) {+ U()+ }+ calculateMatrices2D(t) {+ const e = t.viewState,+ i = t.coordinateToPixelTransform,+ n = t.pixelToCoordinateTransform+ nr(i, t.size[0] / 2, t.size[1] / 2, 1 / e.resolution, -1 / e.resolution, -e.rotation, -e.center[0], -e.center[1]),+ rr(n, i)+ }+ forEachFeatureAtCoordinate(t, e, i, n, r, s, o, a) {+ let l+ const h = e.viewState+ function c(t, e, i, n) {+ return r.call(s, e, t ? i : null, n)+ }+ const u = h.projection,+ d = ui(t.slice(), u),+ g = [[0, 0]]+ if (u.canWrapX() && n) {+ const t = ve(u.getExtent())+ g.push([-t, 0], [t, 0])+ }+ const f = e.layerStatesArray,+ p = f.length,+ _ = [],+ m = []+ for (let n = 0; n < g.length; n++)+ for (let r = p - 1; r >= 0; --r) {+ const s = f[r],+ u = s.layer+ if (u.hasRenderer() && rl(s, h) && o.call(a, u)) {+ const r = u.getRenderer(),+ o = u.getSource()+ if (r && o) {+ const a = o.getWrapX() ? d : t,+ h = c.bind(null, s.managed)+ ;(m[0] = a[0] + g[n][0]), (m[1] = a[1] + g[n][1]), (l = r.forEachFeatureAtCoordinate(m, e, i, h, _))+ }+ if (l) return l+ }+ }+ if (0 === _.length) return+ const y = 1 / _.length+ return (+ _.forEach((t, e) => (t.distanceSq += e * y)),+ _.sort((t, e) => t.distanceSq - e.distanceSq),+ _.some((t) => (l = t.callback(t.feature, t.layer, t.geometry))),+ l+ )+ }+ hasFeatureAtCoordinate(t, e, i, n, r, s) {+ return void 0 !== this.forEachFeatureAtCoordinate(t, e, i, n, C, this, r, s)+ }+ getMap() {+ return this.map_+ }+ renderFrame(t) {+ U()+ }+ scheduleExpireIconCache(t) {+ Ph.canExpireCache() && t.postRenderFunctions.push($c)+ }+ }+ function $c(t, e) {+ Ph.expire()+ }+ class Wc extends Vc {+ constructor(t) {+ super(t),+ (this.fontChangeListenerKey_ = D(Xh, i, t.redrawText, t)),+ (this.element_ = ct ? wt() : document.createElement("div"))+ const e = this.element_.style+ ;(e.position = "absolute"),+ (e.width = "100%"),+ (e.height = "100%"),+ (e.zIndex = "0"),+ (this.element_.className = Do + " ol-layers")+ const n = t.getViewport()+ n && n.insertBefore(this.element_, n.firstChild || null), (this.children_ = []), (this.renderedVisible_ = !0)+ }+ dispatchRenderEvent(t, e) {+ const i = this.getMap()+ if (i.hasListener(t)) {+ const n = new Xc(t, void 0, e)+ i.dispatchEvent(n)+ }+ }+ disposeInternal() {+ k(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(tl, t)+ const e = t.layerStatesArray.sort((t, e) => t.zIndex - e.zIndex)+ e.some((t) => t.layer instanceof zc && t.layer.getDeclutter()) && (t.declutter = {})+ const i = t.viewState+ this.children_.length = 0+ const n = []+ let r = null+ for (let s = 0, o = e.length; s < o; ++s) {+ const o = e[s]+ t.layerIndex = s+ const a = o.layer,+ l = a.getSourceState()+ if (!rl(o, i) || ("ready" != l && "undefined" != l)) {+ a.unrender()+ continue+ }+ const h = a.render(t, r)+ h && (h !== r && (this.children_.push(h), (r = h)), n.push(o))+ }+ this.declutter(t, n), Et(this.element_, this.children_)+ const s = this.getMap().getTargetElement()+ if (Tt(s)) {+ const t = s.getContext("2d")+ for (const e of this.children_) {+ const i = e.firstElementChild || e,+ n = e.style.backgroundColor+ if (+ (n && (!Tt(i) || i.width > 0) && ((t.fillStyle = n), t.fillRect(0, 0, s.width, s.height)),+ Tt(i) && i.width > 0)+ ) {+ t.save()+ const n = e.style.opacity || i.style.opacity+ t.globalAlpha = "" === n ? 1 : Number(n)+ const r = i.style.transform+ if (r) t.transform(...lr(r))+ else {+ const e = parseFloat(i.style.width) / i.width,+ n = parseFloat(i.style.height) / i.height+ t.transform(e, 0, 0, n, 0, 0)+ }+ t.drawImage(i, 0, 0), t.restore()+ }+ }+ }+ this.dispatchRenderEvent(el, t),+ this.renderedVisible_ || ((this.element_.style.display = ""), (this.renderedVisible_ = !0)),+ this.scheduleExpireIconCache(t)+ }+ declutter(t, e) {+ if (t.declutter) {+ for (let i = e.length - 1; i >= 0; --i) {+ const n = e[i],+ r = n.layer+ r.getDeclutter() && r.renderDeclutter(t, n)+ }+ e.forEach((e) => e.layer.renderDeferred(t))+ }+ }+ }+ function Zc(t) {+ t instanceof nl ? t.setMapInternal(null) : t instanceof qa && t.getLayers().forEach(Zc)+ }+ function Yc(t, e) {+ if (t instanceof nl) t.setMapInternal(e)+ else if (t instanceof qa) {+ const i = t.getLayers().getArray()+ for (let t = 0, n = i.length; t < n; ++t) Yc(i[t], e)+ }+ }+ let Hc = class extends V {+ constructor(i) {+ super(), (i = i || {}), 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 qa({ layers: t.layers })+ let r, s, o+ ;(i[io] = n),+ (i[ro] = t.target),+ (i[so] = t.view instanceof bo ? t.view : new bo()),+ void 0 !== t.controls &&+ (Array.isArray(t.controls)+ ? (r = new Z(t.controls.slice()))+ : (Mt(+ "function" == typeof t.controls.getArray,+ "Expected `controls` to be an array or an `ol/Collection.js`"+ ),+ (r = t.controls)))+ void 0 !== t.interactions &&+ (Array.isArray(t.interactions)+ ? (s = new Z(t.interactions.slice()))+ : (Mt(+ "function" == typeof t.interactions.getArray,+ "Expected `interactions` to be an array or an `ol/Collection.js`"+ ),+ (s = t.interactions)))+ void 0 !== t.overlays+ ? Array.isArray(t.overlays)+ ? (o = new Z(t.overlays.slice()))+ : (Mt(+ "function" == typeof t.overlays.getArray,+ "Expected `overlays` to be an array or an `ol/Collection.js`"+ ),+ (o = t.overlays))+ : (o = new Z())+ return { controls: r, interactions: s, keyboardEventTarget: e, overlays: o, values: i }+ })(i)+ ;(this.renderComplete_ = !1),+ (this.loaded_ = !0),+ (this.boundHandleBrowserEvent_ = this.handleBrowserEvent.bind(this)),+ (this.maxTilesLoading_ = void 0 !== i.maxTilesLoading ? i.maxTilesLoading : 16),+ (this.pixelRatio_ = void 0 !== i.pixelRatio ? i.pixelRatio : ht),+ this.postRenderTimeoutHandle_,+ this.animationDelayKey_,+ (this.animationDelay_ = this.animationDelay_.bind(this)),+ (this.coordinateToPixelTransform_ = [1, 0, 0, 1, 0, 0]),+ (this.pixelToCoordinateTransform_ = [1, 0, 0, 1, 0, 0]),+ (this.frameIndex_ = 0),+ (this.frameState_ = null),+ (this.previousExtent_ = null),+ (this.viewPropertyListenerKey_ = null),+ (this.viewChangeListenerKey_ = null),+ (this.layerGroupPropertyListenerKeys_ = null),+ ct ||+ ((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_ = i.moveTolerance),+ (this.keyboardEventTarget_ = n.keyboardEventTarget),+ (this.targetChangeHandlerKeys_ = null),+ (this.targetElement_ = null),+ ct || (this.resizeObserver_ = new ResizeObserver(() => this.updateSize())),+ (this.controls = n.controls || (ct ? new Z() : Zo())),+ (this.interactions = n.interactions || (ct ? new Z() : Da({ onFocusOnly: !0 }))),+ (this.overlays_ = n.overlays),+ (this.overlayIdIndex_ = {}),+ (this.renderer_ = null),+ (this.postRenderFunctions_ = []),+ (this.tileQueue_ = new lo(this.getTilePriority.bind(this), this.handleTileChange_.bind(this))),+ this.addChangeListener(io, this.handleLayerGroupChanged_),+ this.addChangeListener(so, this.handleViewChanged_),+ this.addChangeListener(no, this.handleSizeChanged_),+ this.addChangeListener(ro, this.handleTargetChanged_),+ this.setProperties(n.values)+ const r = this+ !i.view ||+ i.view instanceof bo ||+ i.view.then(function (t) {+ r.setView(new bo(t))+ }),+ this.controls.addEventListener(t, (t) => {+ t.element.setMap(this)+ }),+ this.controls.addEventListener(e, (t) => {+ t.element.setMap(null)+ }),+ this.interactions.addEventListener(t, (t) => {+ t.element.setMap(this)+ }),+ this.interactions.addEventListener(e, (t) => {+ t.element.setMap(null)+ }),+ this.overlays_.addEventListener(t, (t) => {+ this.addOverlayInternal_(t.element)+ }),+ this.overlays_.addEventListener(e, (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) {+ Yc(t.layer, this)+ }+ addOverlay(t) {+ this.getOverlays().push(t)+ }+ addOverlayInternal_(t) {+ const e = t.getId()+ void 0 !== e && (this.overlayIdIndex_[e.toString()] = t), t.setMap(this)+ }+ disposeInternal() {+ this.controls.clear(),+ this.interactions.clear(),+ this.overlays_.clear(),+ this.resizeObserver_?.disconnect(),+ this.setTarget(null),+ super.disposeInternal()+ }+ forEachFeatureAtPixel(t, e, i) {+ if (!this.frameState_ || !this.renderer_) return+ const n = this.getCoordinateFromPixelInternal(t),+ r = void 0 !== (i = void 0 !== i ? i : {}).hitTolerance ? i.hitTolerance : 0,+ s = void 0 !== i.layerFilter ? i.layerFilter : C,+ o = !1 !== i.checkWrapped+ return this.renderer_.forEachFeatureAtCoordinate(n, this.frameState_, r, o, e, null, s, null)+ }+ getFeaturesAtPixel(t, e) {+ const i = []+ return (+ this.forEachFeatureAtPixel(+ t,+ function (t) {+ i.push(t)+ },+ e+ ),+ i+ )+ }+ getAllLayers() {+ const t = []+ return (+ (function e(i) {+ i.forEach(function (i) {+ i instanceof qa ? 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 : C,+ r = void 0 !== e.hitTolerance ? e.hitTolerance : 0,+ s = !1 !== e.checkWrapped+ return this.renderer_.hasFeatureAtCoordinate(i, this.frameState_, r, s, n, null)+ }+ getEventCoordinate(t) {+ return this.getCoordinateFromPixel(this.getEventPixel(t))+ }+ getEventCoordinateInternal(t) {+ return this.getCoordinateFromPixelInternal(this.getEventPixel(t))+ }+ getEventPixel(t) {+ const e = this.viewport_.getBoundingClientRect(),+ i = this.getSize(),+ n = e.width / i[0],+ r = e.height / i[1],+ s = "changedTouches" in t ? t.changedTouches[0] : t+ return [(s.clientX - e.left) / n, (s.clientY - e.top) / r]+ }+ getTarget() {+ return this.get(ro)+ }+ getTargetElement() {+ return this.targetElement_+ }+ getCoordinateFromPixel(t) {+ return jn(this.getCoordinateFromPixelInternal(t), this.getView().getProjection())+ }+ getCoordinateFromPixelInternal(t) {+ const e = this.frameState_+ return e ? Qn(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(io)+ }+ setLayers(t) {+ const e = this.getLayerGroup()+ if (t instanceof Z) return void e.setLayers(t)+ const i = e.getLayers()+ i.clear(), i.extend(t)+ }+ getLayers() {+ return this.getLayerGroup().getLayers()+ }+ getLoadingOrNotReady() {+ const t = this.getLayerGroup().getLayerStatesArray()+ for (let e = 0, i = t.length; e < i; ++e) {+ const i = t[e]+ if (!i.visible) continue+ const n = i.layer.getRenderer()+ if (n && !n.ready) return !0+ const r = i.layer.getSource()+ if (r && r.loading) return !0+ }+ return !1+ }+ getPixelFromCoordinate(t) {+ const e = Un(t, this.getView().getProjection())+ return this.getPixelFromCoordinateInternal(e)+ }+ getPixelFromCoordinateInternal(t) {+ const e = this.frameState_+ return e ? Qn(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(no)+ }+ getView() {+ return this.get(so)+ }+ 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 ho(this.frameState_, t, e, i, n)+ }+ handleBrowserEvent(t, e) {+ e = e || t.type+ const i = new Vs(e, this, t)+ this.handleMapBrowserEvent(i)+ }+ handleMapBrowserEvent(t) {+ if (!this.frameState_) return+ const e = t.originalEvent,+ i = e.type+ if (i === Zs || i === p || i === u) {+ const t = this.getOwnerDocument(),+ i = this.viewport_.getRootNode ? this.viewport_.getRootNode() : t,+ n = e.target,+ r = i instanceof ShadowRoot ? (i.host === n ? i.host.ownerDocument : i) : i === t ? t.documentElement : i+ if (this.overlayContainerStopEvent_.contains(n) || !r.contains(n)) return+ }+ if (((t.frameState = this.frameState_), !1 !== this.dispatchEvent(t))) {+ const e = this.getInteractions().getArray().slice()+ for (let i = e.length - 1; i >= 0; i--) {+ const n = e[i]+ if (n.getMap() !== this || !n.getActive() || !this.getTargetElement()) 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+ if (t) {+ const e = t.viewHints+ if (e[co] || e[uo]) {+ const e = Date.now() - t.time > 8+ ;(i = e ? 0 : 8), (n = e ? 0 : 2)+ }+ }+ e.getTilesLoading() < i && (e.reprioritize(), e.loadMoreTiles(i, n))+ }+ t &&+ this.renderer_ &&+ !t.animate &&+ (this.renderComplete_+ ? (this.hasListener(il) && this.renderer_.dispatchRenderEvent(il, t),+ !1 === this.loaded_ && ((this.loaded_ = !0), this.dispatchEvent(new Xs(eo, this, t))))+ : !0 === this.loaded_ && ((this.loaded_ = !1), this.dispatchEvent(new Xs(to, this, t))))+ const i = this.postRenderFunctions_+ if (t) for (let e = 0, n = i.length; e < n; ++e) i[e](this, t)+ i.length = 0+ }+ handleSizeChanged_() {+ this.getView() && !this.getView().getAnimating() && this.getView().resolveConstraints(0), this.render()+ }+ handleTargetChanged_() {+ if (this.mapBrowserEventHandler_) {+ for (let t = 0, e = this.targetChangeHandlerKeys_.length; t < e; ++t) k(this.targetChangeHandlerKeys_[t])+ ;(this.targetChangeHandlerKeys_ = null),+ this.viewport_.removeEventListener(s, this.boundHandleBrowserEvent_),+ this.viewport_.removeEventListener(p, this.boundHandleBrowserEvent_),+ this.mapBrowserEventHandler_.dispose(),+ (this.mapBrowserEventHandler_ = null),+ this.viewport_.remove()+ }+ if (this.targetElement_ && !Tt(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 ((Tt(e) || e.appendChild(this.viewport_), this.renderer_ || (this.renderer_ = new Wc(this)), !Tt(e))) {+ this.mapBrowserEventHandler_ = new Ks(this, this.moveTolerance_)+ for (const t in $s)+ this.mapBrowserEventHandler_.addEventListener($s[t], this.handleMapBrowserEvent.bind(this))+ let t+ if (+ (this.viewport_.addEventListener(s, this.boundHandleBrowserEvent_, !1),+ this.viewport_.addEventListener(p, this.boundHandleBrowserEvent_, !!gt && { passive: !1 }),+ this.keyboardEventTarget_)+ )+ t = this.keyboardEventTarget_+ else {+ const i = e.getRootNode()+ t = i instanceof ShadowRoot ? i.host : e+ }+ if (+ ((this.targetChangeHandlerKeys_ = [+ D(t, u, this.handleBrowserEvent, this),+ D(t, d, this.handleBrowserEvent, this)+ ]),+ e instanceof HTMLElement)+ ) {+ const t = e.getRootNode()+ t instanceof ShadowRoot && this.resizeObserver_.observe(t.host), this.resizeObserver_?.observe(e)+ }+ }+ this.updateSize()+ } else+ this.renderer_ &&+ (clearTimeout(this.postRenderTimeoutHandle_),+ (this.postRenderTimeoutHandle_ = void 0),+ (this.postRenderFunctions_.length = 0),+ this.renderer_.dispose(),+ (this.renderer_ = null)),+ this.animationDelayKey_ && (cancelAnimationFrame(this.animationDelayKey_), (this.animationDelayKey_ = void 0))+ }+ handleTileChange_() {+ this.render()+ }+ handleViewPropertyChanged_() {+ this.render()+ }+ handleViewChanged_() {+ this.viewPropertyListenerKey_ && (k(this.viewPropertyListenerKey_), (this.viewPropertyListenerKey_ = null)),+ this.viewChangeListenerKey_ && (k(this.viewChangeListenerKey_), (this.viewChangeListenerKey_ = null))+ const t = this.getView()+ t &&+ (this.updateViewportSize_(this.getSize()),+ (this.viewPropertyListenerKey_ = D(t, i, this.handleViewPropertyChanged_, this)),+ (this.viewChangeListenerKey_ = D(t, n, this.handleViewPropertyChanged_, this)),+ t.resolveConstraints(0)),+ this.render()+ }+ handleLayerGroupChanged_() {+ this.layerGroupPropertyListenerKeys_ &&+ (this.layerGroupPropertyListenerKeys_.forEach(k), (this.layerGroupPropertyListenerKeys_ = null))+ const t = this.getLayerGroup()+ t &&+ (this.handleLayerAdd_(new Ha("addlayer", t)),+ (this.layerGroupPropertyListenerKeys_ = [+ D(t, i, this.render, this),+ D(t, n, this.render, this),+ D(t, "addlayer", this.handleLayerAdd_, this),+ D(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) {+ Zc(t.layer)+ }+ removeOverlay(t) {+ return this.getOverlays().remove(t)+ }+ renderFrame_(t) {+ const e = this.getSize(),+ i = this.getView(),+ n = this.frameState_+ let r = null+ if (void 0 !== e && Vl(e) && i && i.isDef()) {+ const n = i.getHints(this.frameState_ ? this.frameState_.viewHints : void 0),+ s = i.getState()+ if (+ ((r = {+ animate: !1,+ coordinateToPixelTransform: this.coordinateToPixelTransform_,+ declutter: null,+ extent: fe(s.center, s.resolution, s.rotation, e),+ index: this.frameIndex_++,+ layerIndex: 0,+ layerStatesArray: this.getLayerGroup().getLayerStatesArray(),+ pixelRatio: this.pixelRatio_,+ pixelToCoordinateTransform: this.pixelToCoordinateTransform_,+ postRenderFunctions: [],+ size: e,+ tileQueue: this.tileQueue_,+ time: t,+ usedTiles: {},+ viewState: s,+ viewHints: n,+ wantedTiles: {},+ mapId: z(this),+ renderTargets: {}+ }),+ s.nextCenter && s.nextResolution)+ ) {+ const t = isNaN(s.nextRotation) ? s.rotation : s.nextRotation+ r.nextExtent = fe(s.nextCenter, s.nextResolution, t, e)+ }+ }+ if (((this.frameState_ = r), this.renderer_.renderFrame(r), r)) {+ if (+ (r.animate && this.render(), Array.prototype.push.apply(this.postRenderFunctions_, r.postRenderFunctions), n)+ ) {+ ;(!this.previousExtent_ || (!Ee(this.previousExtent_) && !te(r.extent, this.previousExtent_))) &&+ (this.dispatchEvent(new Xs(Js, this, n)), (this.previousExtent_ = qt(this.previousExtent_)))+ }+ this.previousExtent_ &&+ !r.viewHints[co] &&+ !r.viewHints[uo] &&+ !te(r.extent, this.previousExtent_) &&+ (this.dispatchEvent(new Xs(Qs, this, r)), Xt(r.extent, this.previousExtent_))+ }+ this.dispatchEvent(new Xs(qs, this, r)),+ (this.renderComplete_ =+ (this.hasListener(to) || this.hasListener(eo) || this.hasListener(il)) &&+ !this.tileQueue_.getTilesLoading() &&+ !this.tileQueue_.getCount() &&+ !this.getLoadingOrNotReady()),+ this.postRenderTimeoutHandle_ ||+ (this.postRenderTimeoutHandle_ = setTimeout(() => {+ ;(this.postRenderTimeoutHandle_ = void 0), this.handlePostRender()+ }, 0))+ }+ setLayerGroup(t) {+ const e = this.getLayerGroup()+ e && this.handleLayerRemove_(new Ha("removelayer", e)), this.set(io, t)+ }+ setSize(t) {+ this.set(no, t)+ }+ setTarget(t) {+ this.set(ro, t)+ }+ setView(t) {+ if (!t || t instanceof bo) return void this.set(so, t)+ this.set(so, new bo())+ const e = this+ t.then(function (t) {+ e.setView(new bo(t))+ })+ }+ updateSize() {+ const t = this.getTargetElement()+ let e+ if (t) {+ let i, n+ if (Tt(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)]),+ !Vl(e) &&+ (t.offsetWidth || t.offsetHeight || t.getClientRects().length) &&+ He("No map visible because the map container's width or height are 0."))+ }+ const i = this.getSize()+ !e || (i && w(e, i)) || (this.setSize(e), this.updateViewportSize_(e))+ }+ updateViewportSize_(t) {+ const e = this.getView()+ e && e.setViewportSize(t)+ }+ }+ const Kc = "element",+ qc = "map",+ Jc = "offset",+ Qc = "position",+ tu = "positioning"+ class eu extends V {+ 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 " + Oo),+ (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(Kc, this.handleElementChanged),+ this.addChangeListener(qc, this.handleMapChanged),+ this.addChangeListener(Jc, this.handleOffsetChanged),+ this.addChangeListener(Qc, this.handlePositionChanged),+ this.addChangeListener(tu, 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(Kc)+ }+ getId() {+ return this.id+ }+ getMap() {+ return this.get(qc) || null+ }+ getOffset() {+ return this.get(Jc)+ }+ getPosition() {+ return this.get(Qc)+ }+ getPositioning() {+ return this.get(tu)+ }+ handleElementChanged() {+ St(this.element)+ const t = this.getElement()+ t && this.element.appendChild(t)+ }+ handleMapChanged() {+ this.mapPostrenderListenerKey &&+ (this.element?.remove(), k(this.mapPostrenderListenerKey), (this.mapPostrenderListenerKey = null))+ const t = this.getMap()+ if (t) {+ ;(this.mapPostrenderListenerKey = D(t, qs, this.render, this)), this.updatePixelPosition()+ const e = this.stopEvent ? t.getOverlayContainerStopEvent() : t.getOverlayContainer()+ 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(Kc, t)+ }+ setMap(t) {+ this.set(qc, t)+ }+ setOffset(t) {+ this.set(Jc, t)+ }+ setPosition(t) {+ this.set(Qc, t)+ }+ performAutoPan() {+ this.autoPan && this.panIntoView(this.autoPan)+ }+ panIntoView(t) {+ const e = this.getMap()+ if (!e || !e.getTargetElement() || !this.get(Qc)) return+ const i = this.getRect(e.getTargetElement(), e.getSize()),+ n = this.getElement(),+ r = this.getRect(n, [yt(n), xt(n)]),+ s = void 0 === (t = t || {}).margin ? 20 : t.margin+ if (!Wt(i, r)) {+ const n = r[0] - i[0],+ o = i[2] - r[2],+ a = r[1] - i[1],+ l = i[3] - r[3],+ h = [0, 0]+ if (+ (n < 0 ? (h[0] = n - s) : o < 0 && (h[0] = Math.abs(o) + s),+ a < 0 ? (h[1] = a - s) : l < 0 && (h[1] = Math.abs(l) + s),+ 0 !== h[0] || 0 !== h[1])+ ) {+ const i = e.getView().getCenterInternal(),+ n = e.getPixelFromCoordinateInternal(i)+ if (!n) return+ const r = [n[0] + h[0], n[1] + h[1]],+ s = t.animation || {}+ e.getView().animateInternal({+ center: e.getCoordinateFromPixelInternal(r),+ duration: s.duration,+ easing: s.easing+ })+ }+ }+ }+ getRect(t, e) {+ const i = t.getBoundingClientRect(),+ n = i.left + window.pageXOffset,+ r = i.top + window.pageYOffset+ return [n, r, n + e[0], r + e[1]]+ }+ setPositioning(t) {+ this.set(tu, 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),+ n = t.getSize()+ this.updateRenderedPosition(i, n)+ }+ updateRenderedPosition(t, e) {+ const i = this.element.style,+ n = this.getOffset(),+ r = this.getPositioning()+ this.setVisible(!0)+ let s = "0%",+ o = "0%"+ "bottom-right" == r || "center-right" == r || "top-right" == r+ ? (s = "-100%")+ : ("bottom-center" != r && "center-center" != r && "top-center" != r) || (s = "-50%"),+ "bottom-left" == r || "bottom-center" == r || "bottom-right" == r+ ? (o = "-100%")+ : ("center-left" != r && "center-center" != r && "center-right" != r) || (o = "-50%")+ const a = `translate(${s}, ${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 iu {+ 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 nu(t, e, i, n, r) {+ return void 0 !== r ? ((r.minX = t), (r.maxX = e), (r.minY = i), (r.maxY = n), r) : new iu(t, e, i, n)+ }+ const ru = []+ class su extends nt {+ constructor(t, e, i, n, r) {+ super(t, e, { transition: 0 }),+ (this.context_ = null),+ (this.executorGroups = {}),+ (this.loadingSourceTiles = 0),+ (this.hitDetectionImageData = {}),+ (this.replayState_ = {}),+ (this.sourceTiles = []),+ (this.errorTileKeys = {}),+ this.wantedResolution,+ (this.getSourceTiles = n.bind(void 0, this)),+ (this.removeSourceTiles_ = r),+ (this.wrappedTileCoord = i)+ }+ getContext() {+ return this.context_ || (this.context_ = ft(1, 1, ru)), this.context_+ }+ hasContext() {+ return !!this.context_+ }+ getImage() {+ return this.hasContext() ? this.getContext().canvas : null+ }+ getReplayState(t) {+ const e = z(t)+ return (+ e in this.replayState_ ||+ (this.replayState_[e] = {+ dirty: !1,+ renderedRenderOrder: null,+ renderedResolution: NaN,+ renderedPixelRatio: NaN,+ renderedRevision: -1,+ renderedTileResolution: NaN,+ renderedTileRevision: -1,+ renderedTileZ: -1+ }),+ this.replayState_[e]+ )+ }+ load() {+ this.getSourceTiles()+ }+ release() {+ this.context_ && (mt(this.context_), ru.push(this.context_.canvas), (this.context_ = null)),+ this.removeSourceTiles_(this),+ (this.sourceTiles.length = 0),+ super.release()+ }+ }+ let ou,+ au = class extends nt {+ constructor(t, e, i, n, r, s) {+ super(t, e, s),+ (this.extent = null),+ (this.format_ = n),+ (this.features_ = null),+ this.loader_,+ (this.projection = null),+ this.resolution,+ (this.tileLoadFunction_ = r),+ (this.url_ = i),+ (this.key = i)+ }+ getTileUrl() {+ return this.url_+ }+ getFormat() {+ return this.format_+ }+ getFeatures() {+ return this.features_+ }+ load() {+ this.state == Y &&+ (this.setState(H),+ this.tileLoadFunction_(this, this.url_),+ this.loader_ && this.loader_(this.extent, this.resolution, this.projection))+ }+ onLoad(t, e) {+ this.setFeatures(t)+ }+ onError() {+ this.setState(q)+ }+ setFeatures(t) {+ ;(this.features_ = t), this.setState(K)+ }+ setLoader(t) {+ this.loader_ = t+ }+ },+ lu = !1+ function hu(t, e, i, n, r, s, o) {+ const a = new XMLHttpRequest()+ a.open("GET", "function" == typeof t ? t(i, n, r) : t, !0),+ "arraybuffer" == e.getType() && (a.responseType = "arraybuffer"),+ (a.withCredentials = lu),+ (a.onload = function (t) {+ if (!a.status || (a.status >= 200 && a.status < 300)) {+ const t = e.getType()+ try {+ let n+ "text" == t || "json" == t+ ? (n = a.responseText)+ : "xml" == t+ ? (n = a.responseXML || a.responseText)+ : "arraybuffer" == t && (n = a.response),+ n ? s(e.readFeatures(n, { extent: i, featureProjection: r }), e.readProjection(n)) : o()+ } catch {+ o()+ }+ } else o()+ }),+ (a.onerror = o),+ a.send()+ }+ function cu(t, e) {+ return function (i, n, r, s, o) {+ hu(+ t,+ e,+ i,+ n,+ r,+ (t, e) => {+ this.addFeatures(t), void 0 !== s && s(t)+ },+ () => {+ this.changed(), void 0 !== o && o()+ }+ )+ }+ }+ function uu(t, e) {+ return [[-1 / 0, -1 / 0, 1 / 0, 1 / 0]]+ }+ function du(t, e, i, n) {+ const r = document.createElement("script"),+ s = "olc_" + z(e)+ function o() {+ delete window[s], r.parentNode.removeChild(r)+ }+ ;(r.async = !0), (r.src = t + (t.includes("?") ? "&" : "?") + (n || "callback") + "=" + s)+ const a = setTimeout(function () {+ o(), i && i()+ }, 1e4)+ ;(window[s] = function (t) {+ clearTimeout(a), o(), e(t)+ }),+ document.head.appendChild(r)+ }+ class gu extends Error {+ constructor(t) {+ super("Unexpected response status: " + t.status), (this.name = "ResponseError"), (this.response = t)+ }+ }+ class fu extends Error {+ constructor(t) {+ super("Failed to issue request"), (this.name = "ClientError"), (this.client = t)+ }+ }+ function pu(t) {+ return new Promise(function (e, i) {+ const n = new XMLHttpRequest()+ n.addEventListener("load", function (t) {+ const n = t.target+ if (!n.status || (n.status >= 200 && n.status < 300)) {+ let t+ try {+ t = JSON.parse(n.responseText)+ } catch (t) {+ const e = "Error parsing response text as JSON: " + t.message+ return void i(new Error(e))+ }+ e(t)+ } else i(new gu(n))+ }),+ n.addEventListener("error", function (t) {+ i(new fu(t.target))+ }),+ n.open("GET", t),+ n.setRequestHeader("Accept", "application/json"),+ n.send()+ })+ }+ function _u(t, e) {+ return e.includes("://") ? e : new URL(e, t).href+ }+ function mu(t, e, i, n, r, s, o) {+ let a, l+ void 0 !== i && void 0 !== n+ ? ((a = t - i), (l = e - n))+ : void 0 !== r && void 0 !== s+ ? ((a = r - t), (l = s - e))+ : ((a = 1), (l = 0))+ const h = Math.hypot(a, l),+ 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 === r || void 0 === s) return [t + a * o, e + l * o]+ const d = gi([t, e], [i, n], [r, s])+ if (Math.cos(d) > 0.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]+ }+ class yu {+ drawCustom(t, e, i, n, r) {}+ drawGeometry(t) {}+ setStyle(t) {}+ drawCircle(t, e, i) {}+ drawFeature(t, e, i) {}+ drawGeometryCollection(t, e, i) {}+ drawLineString(t, e, i) {}+ drawMultiLineString(t, e, i) {}+ drawMultiPoint(t, e, i) {}+ drawMultiPolygon(t, e, i) {}+ drawPoint(t, e, i) {}+ drawPolygon(t, e, i) {}+ drawText(t, e, i) {}+ setFillStrokeStyle(t, e) {}+ setImageStyle(t, e) {}+ setTextStyle(t, e) {}+ }+ class xu extends yu {+ constructor(t, e, i, n, r, s, o) {+ super(),+ (this.context_ = t),+ (this.pixelRatio_ = e),+ (this.extent_ = i),+ (this.transform_ = n),+ (this.transformRotation_ = n ? ke(Math.atan2(n[1], n[0]), 10) : 0),+ (this.viewRotation_ = r),+ (this.squaredTolerance_ = s),+ (this.userTransform_ = o),+ (this.contextFillState_ = null),+ (this.contextStrokeState_ = null),+ (this.contextTextState_ = null),+ (this.fillState_ = null),+ (this.strokeState_ = null),+ (this.image_ = null),+ (this.imageAnchorX_ = 0),+ (this.imageAnchorY_ = 0),+ (this.imageHeight_ = 0),+ (this.imageOpacity_ = 0),+ (this.imageOriginX_ = 0),+ (this.imageOriginY_ = 0),+ (this.imageRotateWithView_ = !1),+ (this.imageRotation_ = 0),+ (this.imageScale_ = [0, 0]),+ (this.imageWidth_ = 0),+ (this.text_ = ""),+ (this.textOffsetX_ = 0),+ (this.textOffsetY_ = 0),+ (this.textRotateWithView_ = !1),+ (this.textRotation_ = 0),+ (this.textScale_ = [0, 0]),+ (this.textFillState_ = null),+ (this.textStrokeState_ = null),+ (this.textState_ = null),+ (this.pixelCoordinates_ = []),+ (this.tmpLocalTransform_ = [1, 0, 0, 1, 0, 0])+ }+ drawImages_(t, e, i, n) {+ if (!this.image_) return+ const r = cr(t, e, i, n, this.transform_, this.pixelCoordinates_),+ s = this.context_,+ o = this.tmpLocalTransform_,+ a = s.globalAlpha+ 1 != this.imageOpacity_ && (s.globalAlpha = a * this.imageOpacity_)+ let l = this.imageRotation_+ 0 === this.transformRotation_ && (l -= this.viewRotation_), this.imageRotateWithView_ && (l += this.viewRotation_)+ for (let t = 0, e = r.length; t < e; t += 2) {+ const e = r[t] - this.imageAnchorX_,+ i = r[t + 1] - this.imageAnchorY_+ if (0 !== l || 1 != this.imageScale_[0] || 1 != this.imageScale_[1]) {+ const t = e + this.imageAnchorX_,+ n = i + this.imageAnchorY_+ nr(o, t, n, 1, 1, l, -t, -n),+ s.save(),+ s.transform.apply(s, o),+ s.translate(t, n),+ s.scale(this.imageScale_[0], this.imageScale_[1]),+ s.drawImage(+ this.image_,+ this.imageOriginX_,+ this.imageOriginY_,+ this.imageWidth_,+ this.imageHeight_,+ -this.imageAnchorX_,+ -this.imageAnchorY_,+ this.imageWidth_,+ this.imageHeight_+ ),+ s.restore()+ } else+ s.drawImage(+ this.image_,+ this.imageOriginX_,+ this.imageOriginY_,+ this.imageWidth_,+ this.imageHeight_,+ e,+ i,+ this.imageWidth_,+ this.imageHeight_+ )+ }+ 1 != this.imageOpacity_ && (s.globalAlpha = a)+ }+ drawText_(t, e, i, n) {+ if (!this.textState_ || "" === this.text_) return+ this.textFillState_ && this.setContextFillState_(this.textFillState_),+ this.textStrokeState_ && this.setContextStrokeState_(this.textStrokeState_),+ this.setContextTextState_(this.textState_)+ const r = cr(t, e, i, n, this.transform_, this.pixelCoordinates_),+ s = this.context_+ let o = this.textRotation_+ for (+ 0 === this.transformRotation_ && (o -= this.viewRotation_),+ this.textRotateWithView_ && (o += this.viewRotation_);+ e < i;+ e += n+ ) {+ const t = r[e] + this.textOffsetX_,+ i = r[e + 1] + this.textOffsetY_+ 0 !== o || 1 != this.textScale_[0] || 1 != this.textScale_[1]+ ? (s.save(),+ s.translate(t - this.textOffsetX_, i - this.textOffsetY_),+ s.rotate(o),+ s.translate(this.textOffsetX_, this.textOffsetY_),+ s.scale(this.textScale_[0], this.textScale_[1]),+ this.textStrokeState_ && s.strokeText(this.text_, 0, 0),+ this.textFillState_ && s.fillText(this.text_, 0, 0),+ s.restore())+ : (this.textStrokeState_ && s.strokeText(this.text_, t, i),+ this.textFillState_ && s.fillText(this.text_, t, i))+ }+ }+ moveToLineTo_(t, e, i, n, r, s) {+ const o = this.context_+ let a = cr(t, e, i, n, this.transform_, this.pixelCoordinates_)+ Math.abs(s) > 0 &&+ (a = (function (t, e, i, n, r, s) {+ ;(r = r ?? []), (s = s ?? e)+ const o = t[0],+ a = t[1],+ l = t[t.length - 4],+ h = t[t.length - 3]+ let c,+ u,+ d,+ g,+ f,+ p,+ _,+ m,+ y = 0+ for (let x = 0; x < t.length; x += e) {+ ;(d = c),+ (g = u),+ (f = void 0),+ (p = void 0),+ x + e < t.length && ((f = t[x + e]), (p = t[x + e + 1])),+ n && 0 === x && ((d = l), (g = h)),+ n && x === t.length - 2 && ((f = o), (p = a)),+ (c = t[x]),+ (u = t[x + 1]),+ ([_, m] = mu(c, u, d, g, f, p, i)),+ (r[y++] = _),+ (r[y++] = m)+ for (let e = 2; e < s; e++) r[y++] = t[x + e]+ }+ return r.length != y && (r.length = y), r+ })(a, n, s, r, a)),+ o.moveTo(a[0], a[1])+ let l = a.length+ r && (l -= 2)+ for (let t = 2; t < l; t += 2) o.lineTo(a[t], a[t + 1])+ return r && o.closePath(), i+ }+ drawRings_(t, e, i, n, r) {+ for (let s = 0, o = i.length; s < o; ++s) e = this.moveToLineTo_(t, e, i[s], n, !0, r)+ return e+ }+ drawCircle(t) {+ if (+ (this.squaredTolerance_ && (t = t.simplifyTransformed(this.squaredTolerance_, this.userTransform_)),+ Se(this.extent_, t.getExtent()))+ ) {+ if (this.fillState_ || this.strokeState_) {+ this.fillState_ && this.setContextFillState_(this.fillState_),+ this.strokeState_ && this.setContextStrokeState_(this.strokeState_)+ const e = vr(t, this.transform_, this.pixelCoordinates_),+ i = e[2] - e[0],+ n = e[3] - e[1],+ r = Math.sqrt(i * i + n * n),+ s = this.context_+ s.beginPath(),+ s.arc(e[0], e[1], r, 0, 2 * Math.PI),+ this.fillState_ && s.fill(),+ this.strokeState_ && s.stroke()+ }+ "" !== this.text_ && this.drawText_(t.getCenter(), 0, 2, 2)+ }+ }+ setStyle(t) {+ this.setFillStrokeStyle(t.getFill(), t.getStroke()),+ this.setImageStyle(t.getImage()),+ this.setTextStyle(t.getText())+ }+ setTransform(t) {+ this.transform_ = t+ }+ drawGeometry(t) {+ switch (t.getType()) {+ case "Point":+ this.drawPoint(t)+ break+ case "LineString":+ this.drawLineString(t)+ break+ case "Polygon":+ this.drawPolygon(t)+ break+ case "MultiPoint":+ this.drawMultiPoint(t)+ break+ case "MultiLineString":+ this.drawMultiLineString(t)+ break+ case "MultiPolygon":+ this.drawMultiPolygon(t)+ break+ case "GeometryCollection":+ this.drawGeometryCollection(t)+ break+ case "Circle":+ this.drawCircle(t)+ }+ }+ drawFeature(t, e) {+ const i = e.getGeometryFunction()(t)+ i && (this.setStyle(e), this.drawGeometry(i))+ }+ drawGeometryCollection(t) {+ const e = t.getGeometriesArray()+ for (let t = 0, i = e.length; t < i; ++t) this.drawGeometry(e[t])+ }+ drawPoint(t) {+ this.squaredTolerance_ && (t = t.simplifyTransformed(this.squaredTolerance_, this.userTransform_))+ const e = t.getFlatCoordinates(),+ i = t.getStride()+ this.image_ && this.drawImages_(e, 0, e.length, i), "" !== this.text_ && this.drawText_(e, 0, e.length, i)+ }+ drawMultiPoint(t) {+ this.squaredTolerance_ && (t = t.simplifyTransformed(this.squaredTolerance_, this.userTransform_))+ const e = t.getFlatCoordinates(),+ i = t.getStride()+ this.image_ && this.drawImages_(e, 0, e.length, i), "" !== this.text_ && this.drawText_(e, 0, e.length, i)+ }+ drawLineString(t) {+ if (+ (this.squaredTolerance_ && (t = t.simplifyTransformed(this.squaredTolerance_, this.userTransform_)),+ Se(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 (Se(this.extent_, e)) {+ if (this.strokeState_) {+ this.setContextStrokeState_(this.strokeState_)+ const e = this.context_,+ i = t.getFlatCoordinates()+ let n = 0+ const r = t.getEnds(),+ s = t.getStride()+ e.beginPath()+ for (let t = 0, e = r.length; t < e; ++t)+ n = this.moveToLineTo_(i, n, r[t], s, !1, this.strokeState_.strokeOffset)+ e.stroke()+ }+ if ("" !== this.text_) {+ const e = t.getFlatMidpoints()+ this.drawText_(e, 0, e.length, 2)+ }+ }+ }+ drawPolygon(t) {+ if (+ (this.squaredTolerance_ && (t = t.simplifyTransformed(this.squaredTolerance_, this.userTransform_)),+ Se(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_)),+ Se(this.extent_, t.getExtent()))+ ) {+ if (this.strokeState_ || this.fillState_) {+ this.fillState_ && this.setContextFillState_(this.fillState_),+ this.strokeState_ && this.setContextStrokeState_(this.strokeState_)+ const e = this.context_,+ i = t.getOrientedFlatCoordinates()+ let n = 0+ const r = t.getEndss(),+ s = t.getStride()+ e.beginPath()+ for (let t = 0, e = r.length; t < e; ++t) {+ const e = r[t]+ n = this.drawRings_(i, n, e, s, this.strokeState_?.strokeOffset)+ }+ this.fillState_ && e.fill(), this.strokeState_ && e.stroke()+ }+ if ("" !== this.text_) {+ const e = t.getFlatInteriorPoints()+ this.drawText_(e, 0, e.length, 2)+ }+ }+ }+ setContextFillState_(t) {+ const e = this.context_,+ i = this.contextFillState_+ i+ ? i.fillStyle != t.fillStyle && ((i.fillStyle = t.fillStyle), (e.fillStyle = t.fillStyle))+ : ((e.fillStyle = t.fillStyle), (this.contextFillState_ = { fillStyle: t.fillStyle }))+ }+ setContextStrokeState_(t) {+ const e = this.context_,+ i = this.contextStrokeState_+ i+ ? (i.lineCap != t.lineCap && ((i.lineCap = t.lineCap), (e.lineCap = t.lineCap)),+ w(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 : Uh+ 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: Mh(e || Oh) }+ } else this.fillState_ = null+ if (e) {+ const t = e.getColor(),+ i = e.getLineCap(),+ n = e.getLineDash(),+ r = e.getLineDashOffset(),+ s = e.getLineJoin(),+ o = e.getWidth(),+ a = e.getMiterLimit(),+ l = n || Nh,+ h = e.getOffset()+ this.strokeState_ = {+ lineCap: void 0 !== i ? i : Dh,+ lineDash: 1 === this.pixelRatio_ ? l : l.map((t) => t * this.pixelRatio_),+ lineDashOffset: (r || 0) * this.pixelRatio_,+ lineJoin: void 0 !== s ? s : kh,+ lineWidth: (void 0 !== o ? o : 1) * this.pixelRatio_,+ miterLimit: void 0 !== a ? a : Gh,+ strokeStyle: Mh(t || jh),+ strokeOffset: (h ?? 0) * this.pixelRatio_+ }+ } else this.strokeState_ = null+ }+ setImageStyle(t) {+ let e+ if (!t || !(e = t.getSize())) return void (this.image_ = null)+ const i = t.getPixelRatio(this.pixelRatio_),+ n = t.getAnchor(),+ r = t.getOrigin()+ ;(this.image_ = t.getImage(this.pixelRatio_)),+ (this.imageAnchorX_ = n[0] * i),+ (this.imageAnchorY_ = n[1] * i),+ (this.imageHeight_ = e[1] * i),+ (this.imageOpacity_ = t.getOpacity()),+ (this.imageOriginX_ = r[0]),+ (this.imageOriginY_ = r[1]),+ (this.imageRotateWithView_ = t.getRotateWithView()),+ (this.imageRotation_ = t.getRotation())+ const s = t.getScaleArray()+ ;(this.imageScale_ = [(s[0] * this.pixelRatio_) / i, (s[1] * this.pixelRatio_) / i]),+ (this.imageWidth_ = e[0] * i)+ }+ setTextStyle(t) {+ if (t) {+ const e = t.getFill()+ if (e) {+ const t = e.getColor()+ this.textFillState_ = { fillStyle: Mh(t || Oh) }+ } else this.textFillState_ = null+ const i = t.getStroke()+ if (i) {+ const t = i.getColor(),+ e = i.getLineCap(),+ n = i.getLineDash(),+ r = i.getLineDashOffset(),+ s = i.getLineJoin(),+ o = i.getWidth(),+ a = i.getMiterLimit()+ this.textStrokeState_ = {+ lineCap: void 0 !== e ? e : Dh,+ lineDash: n || Nh,+ lineDashOffset: r || 0,+ lineJoin: void 0 !== s ? s : kh,+ lineWidth: void 0 !== o ? o : 1,+ miterLimit: void 0 !== a ? a : Gh,+ strokeStyle: Mh(t || jh)+ }+ } else this.textStrokeState_ = null+ const n = t.getFont(),+ r = t.getOffsetX(),+ s = t.getOffsetY(),+ o = t.getRotateWithView(),+ a = t.getRotation(),+ l = t.getScaleArray(),+ h = t.getText(),+ c = t.getTextAlign(),+ u = t.getTextBaseline()+ ;(this.textState_ = {+ font: void 0 !== n ? n : Ah,+ textAlign: void 0 !== c ? c : Uh,+ textBaseline: void 0 !== u ? u : Bh+ }),+ (this.text_ = void 0 !== h ? (Array.isArray(h) ? h.reduce((t, e, i) => t + (i % 2 ? " " : e), "") : h) : ""),+ (this.textOffsetX_ = void 0 !== r ? this.pixelRatio_ * r : 0),+ (this.textOffsetY_ = void 0 !== s ? this.pixelRatio_ * s : 0),+ (this.textRotateWithView_ = void 0 !== o && o),+ (this.textRotation_ = void 0 !== a ? a : 0),+ (this.textScale_ = [this.pixelRatio_ * l[0], this.pixelRatio_ * l[1]])+ } else this.text_ = ""+ }+ }+ const vu = {+ Point: function (t, e, i, n, r, s) {+ const o = i.getImage(),+ a = i.getText(),+ l = a && a.getText(),+ h = s && o && l ? {} : void 0+ if (o) {+ if (o.getImageState() != Ms) return+ const s = t.getBuilder(i.getZIndex(), "Image")+ s.setImageStyle(o, h), s.drawPoint(e, n, r)+ }+ if (l) {+ const s = t.getBuilder(i.getZIndex(), "Text")+ s.setTextStyle(a, h), s.drawText(e, n, r)+ }+ },+ LineString: function (t, e, i, n, r) {+ const s = i.getStroke()+ if (s) {+ const o = t.getBuilder(i.getZIndex(), "LineString")+ o.setFillStrokeStyle(null, s), o.drawLineString(e, n, r)+ }+ const o = i.getText()+ if (o && o.getText()) {+ const s = t.getBuilder(i.getZIndex(), "Text")+ s.setTextStyle(o), s.drawText(e, n, r)+ }+ },+ Polygon: function (t, e, i, n, r) {+ const s = i.getFill(),+ o = i.getStroke()+ if (s || o) {+ const a = t.getBuilder(i.getZIndex(), "Polygon")+ a.setFillStrokeStyle(s, o), a.drawPolygon(e, n, r)+ }+ const a = i.getText()+ if (a && a.getText()) {+ const s = t.getBuilder(i.getZIndex(), "Text")+ s.setTextStyle(a), s.drawText(e, n, r)+ }+ },+ MultiPoint: function (t, e, i, n, r, s) {+ const o = i.getImage(),+ a = o && 0 !== o.getOpacity(),+ l = i.getText(),+ h = l && l.getText(),+ c = s && a && h ? {} : void 0+ if (a) {+ if (o.getImageState() != Ms) return+ const s = t.getBuilder(i.getZIndex(), "Image")+ s.setImageStyle(o, c), s.drawMultiPoint(e, n, r)+ }+ if (h) {+ const s = t.getBuilder(i.getZIndex(), "Text")+ s.setTextStyle(l, c), s.drawText(e, n, r)+ }+ },+ MultiLineString: function (t, e, i, n, r) {+ const s = i.getStroke()+ if (s) {+ const o = t.getBuilder(i.getZIndex(), "LineString")+ o.setFillStrokeStyle(null, s), o.drawMultiLineString(e, n, r)+ }+ const o = i.getText()+ if (o && o.getText()) {+ const s = t.getBuilder(i.getZIndex(), "Text")+ s.setTextStyle(o), s.drawText(e, n, r)+ }+ },+ MultiPolygon: function (t, e, i, n, r) {+ const s = i.getFill(),+ o = i.getStroke()+ if (o || s) {+ const a = t.getBuilder(i.getZIndex(), "Polygon")+ a.setFillStrokeStyle(s, o), a.drawMultiPolygon(e, n, r)+ }+ const a = i.getText()+ if (a && a.getText()) {+ const s = t.getBuilder(i.getZIndex(), "Text")+ s.setTextStyle(a), s.drawText(e, n, r)+ }+ },+ GeometryCollection: function (t, e, i, n, r, s) {+ const o = e.getGeometriesArray()+ let a, l+ for (a = 0, l = o.length; a < l; ++a) {+ ;(0, vu[o[a].getType()])(t, o[a], i, n, r, s)+ }+ },+ Circle: function (t, e, i, n, r) {+ const s = i.getFill(),+ o = i.getStroke()+ if (s || o) {+ const a = t.getBuilder(i.getZIndex(), "Circle")+ a.setFillStrokeStyle(s, o), a.drawCircle(e, n, r)+ }+ const a = i.getText()+ if (a && a.getText()) {+ const r = t.getBuilder(i.getZIndex(), "Text")+ r.setTextStyle(a), r.drawText(e, n)+ }+ }+ }+ function Su(t, e) {+ return parseInt(z(t), 10) - parseInt(z(e), 10)+ }+ function Eu(t, e) {+ const i = wu(t, e)+ return i * i+ }+ function wu(t, e) {+ return (0.5 * t) / e+ }+ function Tu(t, e, i, n, r, s, o, a) {+ const l = [],+ h = i.getImage()+ if (h) {+ let t = !0+ const e = h.getImageState()+ e == Ms || e == As ? (t = !1) : e == Fs && 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(() => r(null)),+ (function (t, e, i, n, r, s, o) {+ const a = i.getGeometryFunction()(e)+ if (!a) return+ const l = a.simplifyTransformed(n, r),+ h = i.getRenderer()+ if (h) Cu(t, l, i, e, o)+ else {+ ;(0, vu[l.getType()])(t, l, i, e, o, s)+ }+ })(t, e, i, n, s, o, a),+ u+ )+ }+ function Cu(t, e, i, n, r) {+ if ("GeometryCollection" == e.getType()) {+ const s = e.getGeometries()+ for (let e = 0, o = s.length; e < o; ++e) Cu(t, s[e], i, n, r)+ return+ }+ t.getBuilder(i.getZIndex(), "Default").drawCustom(e, n, i.getRenderer(), i.getHitDetectionRenderer(), r)+ }+ function bu(t) {+ if (!(t.context instanceof CanvasRenderingContext2D))+ throw new Error("Only works for render events from Canvas 2D layers")+ const e = t.inversePixelTransform[0],+ i = t.inversePixelTransform[1],+ n = Math.sqrt(e * e + i * i),+ r = t.frameState,+ s = Kn(t.inversePixelTransform.slice(), r.coordinateToPixelTransform),+ o = Eu(r.viewState.resolution, n)+ let a+ const l = Gn()+ return l && (a = Ln(l, r.viewState.projection)), new xu(t.context, n, r.extent, s, r.viewState.rotation, o, a)+ }+ let Ru+ const Pu = []+ function Iu(t, e, i, n, r) {+ t.beginPath(),+ t.moveTo(0, 0),+ t.lineTo(e, i),+ t.lineTo(n, r),+ t.closePath(),+ t.save(),+ t.clip(),+ t.fillRect(0, 0, Math.max(e, n) + 1, Math.max(i, r)),+ t.restore()+ }+ function Fu(t, e) {+ return Math.abs(t[4 * e] - 210) > 2 || Math.abs(t[4 * e + 3] - 191.25) > 2+ }+ function Lu(t, e, i, n) {+ const r = On(i, e, t)+ let s = wn(e, n, i)+ const o = e.getMetersPerUnit()+ void 0 !== o && (s *= o)+ const a = t.getMetersPerUnit()+ void 0 !== a && (s /= a)+ const l = t.getExtent()+ if (!l || $t(l, r)) {+ const e = wn(t, s, r) / s+ isFinite(e) && e > 0 && (s /= e)+ }+ return s+ }+ function Mu(t, e, i, n) {+ const r = de(i)+ let s = Lu(t, e, r, n)+ return (+ (!isFinite(s) || s <= 0) &&+ le(i, function (i) {+ return (s = Lu(t, e, i, n)), isFinite(s) && s > 0+ }),+ s+ )+ }+ function Au(t, e, i, n, r, s, o, a, l, h, c, u, d, g) {+ const f = ft(Math.round(i * t), Math.round(i * e), Pu)+ if ((u || (f.imageSmoothingEnabled = !1), 0 === l.length)) return f.canvas+ function p(t) {+ return Math.round(t * i) / i+ }+ f.scale(i, i), (f.globalCompositeOperation = "lighter")+ const _ = [1 / 0, 1 / 0, -1 / 0, -1 / 0]+ let m+ l.forEach(function (t, e, i) {+ ie(_, t.extent)+ })+ const y = i / n,+ x = (u ? 1 : 1 + Math.pow(2, -24)) / y+ if (!d || 1 !== l.length || 0 !== h) {+ if (((m = ft(Math.round(ve(_) * y), Math.round(_e(_) * y), Pu)), u || (m.imageSmoothingEnabled = !1), r && g)) {+ const t = (r[0] - _[0]) * y,+ e = -(r[3] - _[3]) * y,+ i = ve(r) * y,+ n = _e(r) * y+ m.rect(t, e, i, n), m.clip()+ }+ l.forEach(function (t, e, i) {+ if (t.image.width > 0 && t.image.height > 0) {+ if (t.clipExtent) {+ m.save()+ const e = (t.clipExtent[0] - _[0]) * y,+ i = -(t.clipExtent[3] - _[3]) * y,+ n = ve(t.clipExtent) * y,+ r = _e(t.clipExtent) * y+ m.rect(+ u ? e : Math.round(e),+ u ? i : Math.round(i),+ u ? n : Math.round(e + n) - Math.round(e),+ u ? r : Math.round(i + r) - Math.round(i)+ ),+ m.clip()+ }+ const e = (t.extent[0] - _[0]) * y,+ i = -(t.extent[3] - _[3]) * y,+ n = ve(t.extent) * y,+ r = _e(t.extent) * y+ m.drawImage(+ t.image,+ h,+ h,+ t.image.width - 2 * h,+ t.image.height - 2 * h,+ u ? e : Math.round(e),+ u ? i : Math.round(i),+ u ? n : Math.round(e + n) - Math.round(e),+ u ? r : Math.round(i + r) - Math.round(i)+ ),+ t.clipExtent && m.restore()+ }+ })+ }+ const v = ye(o)+ return (+ a.getTriangles().forEach(function (t, e, i) {+ const n = t.source,+ r = t.target+ let o = n[0][0],+ a = n[0][1],+ h = n[1][0],+ c = n[1][1],+ d = n[2][0],+ g = n[2][1]+ const y = p((r[0][0] - v[0]) / s),+ S = p(-(r[0][1] - v[1]) / s),+ E = p((r[1][0] - v[0]) / s),+ w = p(-(r[1][1] - v[1]) / s),+ T = p((r[2][0] - v[0]) / s),+ C = p(-(r[2][1] - v[1]) / s),+ b = o,+ R = a+ ;(o = 0), (a = 0), (h -= b), (c -= R), (d -= b), (g -= R)+ const P = Me([+ [h, c, 0, 0, E - y],+ [d, g, 0, 0, T - y],+ [0, 0, h, c, w - S],+ [0, 0, d, g, C - S]+ ])+ if (!P) return+ if (+ (f.save(),+ f.beginPath(),+ (function () {+ if (void 0 === Ru) {+ const t = ft(6, 6, Pu)+ ;(t.globalCompositeOperation = "lighter"),+ (t.fillStyle = "rgba(210, 0, 0, 0.75)"),+ Iu(t, 4, 5, 4, 0),+ Iu(t, 4, 5, 0, 5)+ const e = t.getImageData(0, 0, 3, 3).data+ ;(Ru = Fu(e, 0) || Fu(e, 4) || Fu(e, 8)), mt(t), Pu.push(t.canvas)+ }+ return Ru+ })() || !u)+ ) {+ f.moveTo(E, w)+ const t = 4,+ e = y - E,+ i = S - w+ for (let n = 0; n < t; n++)+ f.lineTo(E + p(((n + 1) * e) / t), w + p((n * i) / (t - 1))),+ n != t - 1 && f.lineTo(E + p(((n + 1) * e) / t), w + p(((n + 1) * i) / (t - 1)))+ f.lineTo(T, C)+ } else f.moveTo(E, w), f.lineTo(y, S), f.lineTo(T, C)+ let I+ if ((f.clip(), f.transform(P[0], P[2], P[1], P[3], y, S), f.translate(_[0] - b, _[3] - R), m))+ (I = m.canvas), f.scale(x, -x)+ else {+ const t = l[0],+ e = t.extent+ ;(I = t.image), f.scale(ve(e) / I.width, -_e(e) / I.height)+ }+ f.drawImage(I, 0, 0), f.restore()+ }),+ m && (mt(m), Pu.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,+ r = (n[0][0] - v[0]) / s,+ o = -(n[0][1] - v[1]) / s,+ a = (n[1][0] - v[0]) / s,+ l = -(n[1][1] - v[1]) / s,+ h = (n[2][0] - v[0]) / s,+ c = -(n[2][1] - v[1]) / s+ f.beginPath(), f.moveTo(a, l), f.lineTo(r, o), f.lineTo(h, c), f.closePath(), f.stroke()+ }),+ f.restore()),+ f.canvas+ )+ }+ function Ou(t) {+ return Array.isArray(t) ? Math.min(...t) : t+ }+ class Du {+ constructor(t) {+ ;(this.highWaterMark = void 0 !== t ? t : 2048),+ (this.count_ = 0),+ (this.entries_ = {}),+ (this.oldest_ = null),+ (this.newest_ = null)+ }+ deleteOldest() {+ const t = this.pop()+ t instanceof _ && t.dispose()+ }+ canExpireCache() {+ return this.highWaterMark > 0 && this.getCount() > this.highWaterMark+ }+ expireCache(t) {+ for (; this.canExpireCache(); ) this.deleteOldest()+ }+ clear() {+ for (; this.oldest_; ) this.deleteOldest()+ }+ containsKey(t) {+ return this.entries_.hasOwnProperty(t)+ }+ forEach(t) {+ let e = this.oldest_+ for (; e; ) t(e.value_, e.key_, this), (e = e.newer)+ }+ get(t, e) {+ const i = this.entries_[t]+ return (+ Mt(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 (+ Mt(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) {+ Mt(!(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 Nu(t, e, i, n) {+ return void 0 !== n ? ((n[0] = t), (n[1] = e), (n[2] = i), n) : [t, e, i]+ }+ function ku(t, e, i) {+ return t + "/" + e + "/" + i+ }+ function Gu(t) {+ return ku(t[0], t[1], t[2])+ }+ function ju(t, e, i, n, r) {+ return `${z(t)},${e},${ku(i, n, r)}`+ }+ function Uu(t) {+ return Bu(t[0], t[1], t[2])+ }+ function Bu(t, e, i) {+ return (e << t) + i+ }+ function zu(t, e) {+ const i = t[0],+ n = t[1],+ r = t[2]+ if (e.getMinZoom() > i || i > e.getMaxZoom()) return !1+ const s = e.getFullTileRange(i)+ return !s || s.containsXY(n, r)+ }+ const Xu = [0, 0, 0]+ class Vu {+ constructor(t) {+ let e+ if (+ ((this.minZoom = void 0 !== t.minZoom ? t.minZoom : 0),+ (this.resolutions_ = t.resolutions),+ Mt(+ T(this.resolutions_, (t, e) => e - t, !0),+ "`resolutions` must be sorted in descending order"+ ),+ !t.origins)+ )+ for (let t = 0, i = this.resolutions_.length - 1; t < i; ++t)+ if (e) {+ if (this.resolutions_[t] / this.resolutions_[t + 1] !== e) {+ e = void 0+ break+ }+ } else e = this.resolutions_[t] / this.resolutions_[t + 1]+ ;(this.zoomFactor_ = e),+ (this.maxZoom = this.resolutions_.length - 1),+ (this.origin_ = void 0 !== t.origin ? t.origin : null),+ (this.origins_ = null),+ void 0 !== t.origins &&+ ((this.origins_ = t.origins),+ Mt(this.origins_.length == this.resolutions_.length, "Number of `origins` and `resolutions` must be equal"))+ const i = t.extent+ void 0 === i || this.origin_ || this.origins_ || (this.origin_ = ye(i)),+ Mt(+ (!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),+ Mt(+ 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 : Co),+ Mt(+ (!this.tileSize_ && this.tileSizes_) || (this.tileSize_ && !this.tileSizes_),+ "Either `tileSize` or `tileSizes` must be configured, never both"+ ),+ (this.extent_ = void 0 !== i ? i : null),+ (this.fullTileRanges_ = null),+ (this.tmpSize_ = [0, 0]),+ (this.tmpExtent_ = [0, 0, 0, 0]),+ void 0 !== t.sizes+ ? (this.fullTileRanges_ = t.sizes.map((t, e) => {+ const n = new iu(Math.min(0, t[0]), Math.max(t[0] - 1, -1), Math.min(0, t[1]), Math.max(t[1] - 1, -1))+ if (i) {+ const t = this.getTileRangeForExtentAndZ(i, e)+ ;(n.minX = Math.max(t.minX, n.minX)),+ (n.maxX = Math.min(t.maxX, n.maxX)),+ (n.minY = Math.max(t.minY, n.minY)),+ (n.maxY = Math.min(t.maxY, n.maxY))+ }+ return n+ }))+ : i && this.calculateTileRanges_(i)+ }+ forEachTileCoord(t, e, i) {+ const n = this.getTileRangeForExtentAndZ(t, e)+ for (let t = n.minX, r = n.maxX; t <= r; ++t) for (let r = n.minY, s = n.maxY; r <= s; ++r) i([e, t, r])+ }+ forEachTileCoordParentTileRange(t, e, i, n) {+ let r,+ s,+ o,+ a = null,+ l = t[0] - 1+ for (+ 2 === this.zoomFactor_ ? ((s = t[1]), (o = t[2])) : (a = this.getTileCoordExtent(t, n));+ l >= this.minZoom;++ ) {+ if (+ (void 0 !== s && void 0 !== o+ ? ((s = Math.floor(s / 2)), (o = Math.floor(o / 2)), (r = nu(s, s, o, o, i)))+ : (r = this.getTileRangeForExtentAndZ(a, l, i)),+ e(l, r))+ )+ return !0+ --l+ }+ return !1+ }+ getExtent() {+ return this.extent_+ }+ getMaxZoom() {+ return this.maxZoom+ }+ getMinZoom() {+ return this.minZoom+ }+ getOrigin(t) {+ return this.origin_ ? this.origin_ : this.origins_[t]+ }+ getOrigins() {+ return this.origins_+ }+ getResolution(t) {+ return this.resolutions_[t]+ }+ getResolutions() {+ return this.resolutions_+ }+ getTileCoordChildTileRange(t, e, i) {+ if (t[0] < this.maxZoom) {+ if (2 === this.zoomFactor_) {+ const i = 2 * t[1],+ n = 2 * t[2]+ return nu(i, i + 1, n, n + 1, e)+ }+ const n = this.getTileCoordExtent(t, i || this.tmpExtent_)+ return this.getTileRangeForExtentAndZ(n, t[0] + 1, e)+ }+ return null+ }+ getTileRangeForTileCoordAndZ(t, e, i) {+ if (e > this.maxZoom || e < this.minZoom) return null+ const n = t[0],+ r = t[1],+ s = t[2]+ if (e === n) return nu(r, s, r, s, i)+ if (this.zoomFactor_) {+ const t = Math.pow(this.zoomFactor_, e - n),+ o = Math.floor(r * t),+ a = Math.floor(s * t)+ if (e < n) return nu(o, o, a, a, i)+ return nu(o, Math.floor(t * (r + 1)) - 1, a, Math.floor(t * (s + 1)) - 1, i)+ }+ const o = this.getTileCoordExtent(t, this.tmpExtent_)+ return this.getTileRangeForExtentAndZ(o, e, i)+ }+ getTileRangeForExtentAndZ(t, e, i) {+ this.getTileCoordForXYAndZ_(t[0], t[3], e, !1, Xu)+ const n = Xu[1],+ r = Xu[2]+ this.getTileCoordForXYAndZ_(t[2], t[1], e, !0, Xu)+ return nu(n, Xu[1], r, Xu[2], i)+ }+ getTileCoordCenter(t) {+ const e = this.getOrigin(t[0]),+ i = this.getResolution(t[0]),+ n = Wl(this.getTileSize(t[0]), this.tmpSize_)+ return [e[0] + (t[1] + 0.5) * n[0] * i, e[1] - (t[2] + 0.5) * n[1] * i]+ }+ getTileCoordExtent(t, e) {+ const i = this.getOrigin(t[0]),+ n = this.getResolution(t[0]),+ r = Wl(this.getTileSize(t[0]), this.tmpSize_),+ s = i[0] + t[1] * r[0] * n,+ o = i[1] - (t[2] + 1) * r[1] * n+ return Kt(s, o, s + r[0] * n, o + r[1] * n, e)+ }+ getTileCoordForCoordAndResolution(t, e, i) {+ return this.getTileCoordForXYAndResolution_(t[0], t[1], e, !1, i)+ }+ getTileCoordForXYAndResolution_(t, e, i, n, r) {+ const s = this.getZForResolution(i),+ o = i / this.getResolution(s),+ a = this.getOrigin(s),+ l = Wl(this.getTileSize(s), this.tmpSize_)+ let h = (o * (t - a[0])) / i / l[0],+ c = (o * (a[1] - e)) / i / l[1]+ return n ? ((h = Ue(h, 5) - 1), (c = Ue(c, 5) - 1)) : ((h = je(h, 5)), (c = je(c, 5))), Nu(s, h, c, r)+ }+ getTileCoordForXYAndZ_(t, e, i, n, r) {+ const s = this.getOrigin(i),+ o = this.getResolution(i),+ a = Wl(this.getTileSize(i), this.tmpSize_)+ let l = (t - s[0]) / o / a[0],+ h = (s[1] - e) / o / a[1]+ return n ? ((l = Ue(l, 5) - 1), (h = Ue(h, 5) - 1)) : ((l = je(l, 5)), (h = je(h, 5))), Nu(i, l, h, r)+ }+ getTileCoordForCoordAndZ(t, e, i) {+ return this.getTileCoordForXYAndZ_(t[0], t[1], e, !1, i)+ }+ getTileCoordResolution(t) {+ return this.resolutions_[t[0]]+ }+ getTileSize(t) {+ return this.tileSize_ ? this.tileSize_ : this.tileSizes_[t]+ }+ getFullTileRange(t) {+ return this.fullTileRanges_+ ? this.fullTileRanges_[t]+ : this.extent_+ ? this.getTileRangeForExtentAndZ(this.extent_, t)+ : null+ }+ getZForResolution(t, e) {+ return Ie(v(this.resolutions_, t, e || 0), this.minZoom, this.maxZoom)+ }+ tileCoordIntersectsViewport(t, e) {+ return ns(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+ }+ }+ class $u extends Vu {+ constructor(t) {+ super({+ extent: t.extent,+ origin: t.origin,+ origins: t.origins,+ resolutions: t.resolutions,+ tileSize: t.tileSize,+ tileSizes: t.tileSizes,+ sizes: t.sizes+ }),+ (this.matrixIds_ = t.matrixIds)+ }+ getMatrixId(t) {+ return this.matrixIds_[t]+ }+ getMatrixIds() {+ return this.matrixIds_+ }+ }+ function Wu(t, e, i) {+ const n = [],+ r = [],+ s = [],+ o = [],+ a = []+ i = void 0 !== i ? i : []+ const l = "TileMatrix",+ h = "Identifier",+ c = "ScaleDenominator",+ u = "TopLeftCorner",+ d = En(t.SupportedCRS),+ g = d.getMetersPerUnit(),+ f = d.getAxisOrientation().startsWith("ne")+ return (+ t[l].sort(function (t, e) {+ return e[c] - t[c]+ }),+ t[l].forEach(function (e) {+ let d+ if (+ ((d =+ !(i.length > 0) ||+ i.find(function (i) {+ return e[h] == i[l] || (!e[h].includes(":") && t[h] + ":" + e[h] === i[l])+ })),+ d)+ ) {+ r.push(e[h])+ const t = (28e-5 * e[c]) / g,+ i = e.TileWidth,+ l = e.TileHeight+ f ? s.push([e[u][1], e[u][0]]) : s.push(e[u]),+ n.push(t),+ o.push(i == l ? i : [i, l]),+ a.push([e.MatrixWidth, e.MatrixHeight])+ }+ }),+ new $u({ extent: e, origins: s, resolutions: n, matrixIds: r, tileSizes: o, sizes: a })+ )+ }+ function Zu(t) {+ let e = t.getDefaultTileGrid()+ return e || ((e = Ju(t)), t.setDefaultTileGrid(e)), e+ }+ function Yu(t, e, i) {+ const n = e[0],+ r = t.getTileCoordCenter(e),+ s = Qu(i)+ if (!$t(s, r)) {+ const e = ve(s),+ i = Math.ceil((s[0] - r[0]) / e)+ return (r[0] += e * i), t.getTileCoordForCoordAndZ(r, n)+ }+ return e+ }+ function Hu(t, e, i, n) {+ n = void 0 !== n ? n : "top-left"+ const r = qu(t, e, i)+ return new Vu({ extent: t, origin: ge(t, n), resolutions: r, tileSize: i })+ }+ function Ku(t) {+ const e = t || {},+ i = e.extent || En("EPSG:3857").getExtent(),+ n = {+ extent: i,+ minZoom: e.minZoom,+ tileSize: e.tileSize,+ resolutions: qu(i, e.maxZoom, e.tileSize, e.maxResolution)+ }+ return new Vu(n)+ }+ function qu(t, e, i, n) {+ ;(e = void 0 !== e ? e : 42), (i = Wl(void 0 !== i ? i : Co))+ const r = _e(t),+ s = ve(t)+ n = n > 0 ? n : Math.max(s / i[0], r / i[1])+ const o = e + 1,+ a = new Array(o)+ for (let t = 0; t < o; ++t) a[t] = n / Math.pow(2, t)+ return a+ }+ function Ju(t, e, i, n) {+ return Hu(Qu(t), e, i, n)+ }+ function Qu(t) {+ let e = (t = En(t)).getExtent()+ if (!e) {+ const i = (180 * _i.degrees) / t.getMetersPerUnit()+ e = Kt(-i, -i, i, i)+ }+ return e+ }+ function td(t, e) {+ const i = []+ Object.keys(e).forEach(function (t) {+ null !== e[t] && void 0 !== e[t] && i.push(t + "=" + encodeURIComponent(e[t]))+ })+ const n = i.join("&")+ return (t = t.replace(/[?&]$/, "")), (t += t.includes("?") ? "&" : "?") + n+ }+ const ed = /\{z\}/g,+ id = /\{x\}/g,+ nd = /\{y\}/g,+ rd = /\{-y\}/g+ function sd(t, e, i, n, r) {+ return t+ .replace(ed, e.toString())+ .replace(id, i.toString())+ .replace(nd, n.toString())+ .replace(rd, function () {+ if (void 0 === r) throw new Error("If the URL template has a {-y} placeholder, the grid extent must be known")+ return (r - n).toString()+ })+ }+ function od(t, e, i, n) {+ return t[De(Bu(e, i, n), t.length)]+ }+ function ad(t) {+ const e = []+ let i = /\{([a-z])-([a-z])\}/.exec(t)+ if (i) {+ const n = i[1].charCodeAt(0),+ r = i[2].charCodeAt(0)+ let s+ for (s = n; s <= r; ++s) e.push(t.replace(i[0], String.fromCharCode(s)))+ return e+ }+ if (((i = /\{(\d+)-(\d+)\}/.exec(t)), i)) {+ const n = parseInt(i[2], 10)+ for (let r = parseInt(i[1], 10); r <= n; r++) e.push(t.replace(i[0], r.toString()))+ return e+ }+ return e.push(t), e+ }+ function ld(t, e) {+ return function (i, n, r) {+ if (!i) return+ let s+ const o = i[0]+ if (e) {+ const t = e.getFullTileRange(o)+ t && (s = t.getHeight() - 1)+ }+ return sd(t, o, i[1], i[2], s)+ }+ }+ function hd(t, e) {+ const i = t.length,+ n = new Array(i)+ for (let r = 0; r < i; ++r) n[r] = ld(t[r], e)+ return cd(n)+ }+ function cd(t) {+ return 1 === t.length+ ? t[0]+ : function (e, i, n) {+ if (!e) return+ const r = De(Uu(e), t.length)+ return t[r](e, i, n)+ }+ }+ function ud(t, e, i) {}+ class dd {+ constructor(t, e, i, n, r, s, o) {+ ;(this.sourceProj_ = t), (this.targetProj_ = e)+ let a = {}+ const l = o ? Rn((t) => Qn(o, On(t, this.targetProj_, this.sourceProj_))) : An(this.targetProj_, this.sourceProj_)+ ;(this.transformInv_ = function (t) {+ const e = t[0] + "/" + t[1]+ return a[e] || (a[e] = l(t)), a[e]+ }),+ (this.maxSourceExtent_ = n),+ (this.errorThresholdSquared_ = r * r),+ (this.triangles_ = []),+ (this.wrapsXInSource_ = !1),+ (this.canWrapXInSource_ =+ this.sourceProj_.canWrapX() &&+ !!n &&+ !!this.sourceProj_.getExtent() &&+ ve(n) >= ve(this.sourceProj_.getExtent())),+ (this.sourceWorldWidth_ = this.sourceProj_.getExtent() ? ve(this.sourceProj_.getExtent()) : null),+ (this.targetWorldWidth_ = this.targetProj_.getExtent() ? ve(this.targetProj_.getExtent()) : null)+ const h = ye(i),+ c = xe(i),+ u = ue(i),+ d = ce(i),+ g = this.transformInv_(h),+ f = this.transformInv_(c),+ p = this.transformInv_(u),+ _ = this.transformInv_(d),+ m = 10 + (s ? Math.max(0, Math.ceil(Math.log2(he(i) / (s * s * 256 * 256)))) : 0)+ if ((this.addQuad_(h, c, u, d, g, f, p, _, m), this.wrapsXInSource_)) {+ let t = 1 / 0+ this.triangles_.forEach(function (e, i, n) {+ t = Math.min(t, e.source[0][0], e.source[1][0], e.source[2][0])+ }),+ this.triangles_.forEach((e) => {+ if (Math.max(e.source[0][0], e.source[1][0], e.source[2][0]) - t > this.sourceWorldWidth_ / 2) {+ const i = [+ [e.source[0][0], e.source[0][1]],+ [e.source[1][0], e.source[1][1]],+ [e.source[2][0], e.source[2][1]]+ ]+ i[0][0] - t > this.sourceWorldWidth_ / 2 && (i[0][0] -= this.sourceWorldWidth_),+ i[1][0] - t > this.sourceWorldWidth_ / 2 && (i[1][0] -= this.sourceWorldWidth_),+ i[2][0] - t > this.sourceWorldWidth_ / 2 && (i[2][0] -= this.sourceWorldWidth_)+ const n = Math.min(i[0][0], i[1][0], i[2][0])+ Math.max(i[0][0], i[1][0], i[2][0]) - n < this.sourceWorldWidth_ / 2 && (e.source = i)+ }+ })+ }+ a = {}+ }+ addTriangle_(t, e, i, n, r, s) {+ this.triangles_.push({ source: [n, r, s], target: [t, e, i] })+ }+ addQuad_(t, e, i, n, r, s, o, a, l) {+ const h = Bt([r, s, o, a]),+ c = this.sourceWorldWidth_ ? ve(h) / this.sourceWorldWidth_ : null,+ u = this.sourceWorldWidth_,+ d = this.sourceProj_.canWrapX() && c > 0.5 && c < 1+ let g = !1+ if (l > 0) {+ if (this.targetProj_.isGlobal() && this.targetWorldWidth_) {+ g = ve(Bt([t, e, i, n])) / this.targetWorldWidth_ > 0.25 || g+ }+ !d && this.sourceProj_.isGlobal() && c && (g = c > 0.25 || g)+ }+ if (+ !g &&+ this.maxSourceExtent_ &&+ isFinite(h[0]) &&+ isFinite(h[1]) &&+ isFinite(h[2]) &&+ isFinite(h[3]) &&+ !Se(h, this.maxSourceExtent_)+ )+ return+ let f = 0+ if (+ !(+ g ||+ (isFinite(r[0]) &&+ isFinite(r[1]) &&+ isFinite(s[0]) &&+ isFinite(s[1]) &&+ isFinite(o[0]) &&+ isFinite(o[1]) &&+ isFinite(a[0]) &&+ isFinite(a[1]))+ )+ )+ if (l > 0) g = !0+ else if (+ ((f =+ (isFinite(r[0]) && isFinite(r[1]) ? 0 : 8) ++ (isFinite(s[0]) && isFinite(s[1]) ? 0 : 4) ++ (isFinite(o[0]) && isFinite(o[1]) ? 0 : 2) ++ (isFinite(a[0]) && isFinite(a[1]) ? 0 : 1)),+ 1 != 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 s+ if (d) {+ s = (De(r[0], u) + De(o[0], u)) / 2 - De(n[0], u)+ } else s = (r[0] + o[0]) / 2 - n[0]+ const a = (r[1] + o[1]) / 2 - n[1]+ g = s * s + 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, r, s, 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, r, c, d, a, l - 1), this.addQuad_(h, e, i, u, c, s, o, d, l - 1)+ }+ return+ }+ }+ if (d) {+ if (!this.canWrapXInSource_) return+ this.wrapsXInSource_ = !0+ }+ 11 & f || this.addTriangle_(t, i, n, r, o, a),+ 14 & f || this.addTriangle_(t, i, e, r, o, s),+ f && (13 & f || this.addTriangle_(e, n, t, s, a, r), 7 & f || this.addTriangle_(e, n, i, s, a, o))+ }+ calculateSourceExtent() {+ const t = [1 / 0, 1 / 0, -1 / 0, -1 / 0]+ return (+ this.triangles_.forEach(function (e, i, n) {+ const r = e.source+ ne(t, r[0]), ne(t, r[1]), ne(t, r[2])+ }),+ t+ )+ }+ getTriangles() {+ return this.triangles_+ }+ }+ const gd = 0.5+ class fd extends nt {+ constructor(t, e, i, n, r, s, o, a, l, h, c, u) {+ super(r, Y, u),+ (this.renderEdges_ = void 0 !== c && c),+ (this.pixelRatio_ = o),+ (this.gutter_ = a),+ (this.canvas_ = null),+ (this.sourceTileGrid_ = e),+ (this.targetTileGrid_ = n),+ (this.wrappedTileCoord_ = s || r),+ (this.sourceTiles_ = []),+ (this.sourcesListenerKeys_ = null),+ (this.sourceZ_ = 0),+ (this.clipExtent_ = t.canWrapX() ? t.getExtent() : void 0)+ const d = n.getTileCoordExtent(this.wrappedTileCoord_),+ g = this.targetTileGrid_.getExtent()+ let f = this.sourceTileGrid_.getExtent()+ const p = g ? me(d, g) : d+ if (0 === he(p)) return void (this.state = J)+ const _ = t.getExtent()+ _ && (f = f ? me(f, _) : _)+ const m = n.getResolution(this.wrappedTileCoord_[0]),+ y = Mu(t, i, p, m)+ if (!isFinite(y) || y <= 0) return void (this.state = J)+ const x = void 0 !== h ? h : gd+ if (((this.triangulation_ = new dd(t, i, p, f, y * x, m)), 0 === this.triangulation_.getTriangles().length))+ return void (this.state = J)+ this.sourceZ_ = e.getZForResolution(y)+ let v = this.triangulation_.calculateSourceExtent()+ if (+ (f && (t.canWrapX() ? ((v[1] = Ie(v[1], f[1], f[3])), (v[3] = Ie(v[3], f[1], f[3]))) : (v = me(v, f))), he(v))+ ) {+ let i = 0,+ n = 0+ t.canWrapX() && ((i = ve(_)), (n = Math.floor((v[0] - _[0]) / i)))+ Pe(v.slice(), t, !0).forEach((t) => {+ const r = e.getTileRangeForExtentAndZ(t, this.sourceZ_)+ for (let t = r.minX; t <= r.maxX; t++)+ for (let e = r.minY; e <= r.maxY; e++) {+ const r = n * i+ this.sourceTiles_.push({ getTile: () => l(this.sourceZ_, t, e, o), offset: r })+ }+ ++n+ }),+ 0 === this.sourceTiles_.length && (this.state = J)+ } else this.state = J+ }+ getImage() {+ return this.canvas_+ }+ reproject_() {+ const t = []+ if (+ (this.sourceTiles_.forEach((e) => {+ const i = e.tile+ if (i && i.getState() == K) {+ const n = this.sourceTileGrid_.getTileCoordExtent(i.tileCoord)+ ;(n[0] += e.offset), (n[2] += e.offset)+ const r = this.clipExtent_?.slice()+ r && ((r[0] += e.offset), (r[2] += e.offset)), t.push({ extent: n, clipExtent: r, image: i.getImage() })+ }+ }),+ (this.sourceTiles_.length = 0),+ 0 === t.length)+ )+ this.state = q+ else {+ const e = this.wrappedTileCoord_[0],+ i = this.targetTileGrid_.getTileSize(e),+ n = "number" == typeof i ? i : i[0],+ r = "number" == typeof i ? i : i[1],+ s = this.targetTileGrid_.getResolution(e),+ o = this.sourceTileGrid_.getResolution(this.sourceZ_),+ a = this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_)+ ;(this.canvas_ = Au(+ n,+ r,+ this.pixelRatio_,+ o,+ this.sourceTileGrid_.getExtent(),+ s,+ a,+ this.triangulation_,+ t,+ this.gutter_,+ this.renderEdges_,+ this.interpolate+ )),+ (this.state = K)+ }+ this.changed()+ }+ load() {+ for (const t of this.sourceTiles_) t.tile = t.getTile()+ if (this.state == Y) {+ ;(this.state = H), this.changed()+ let t = 0+ ;(this.sourcesListenerKeys_ = []),+ this.sourceTiles_.forEach(({ tile: e }) => {+ const i = e.getState()+ if (i == Y || i == H) {+ t+++ const i = D(e, n, (n) => {+ const r = e.getState()+ ;(r != K && r != q && r != J) || (k(i), t--, 0 === t && (this.unlistenSources_(), this.reproject_()))+ })+ this.sourcesListenerKeys_.push(i)+ }+ }),+ 0 === t+ ? setTimeout(this.reproject_.bind(this), 0)+ : this.sourceTiles_.forEach(function ({ tile: t }, e, i) {+ t.getState() == Y && t.load()+ })+ }+ }+ unlistenSources_() {+ this.sourcesListenerKeys_.forEach(k), (this.sourcesListenerKeys_ = null)+ }+ release() {+ this.canvas_ && (mt(this.canvas_.getContext("2d")), Pu.push(this.canvas_), (this.canvas_ = null)),+ (this.sourceTiles_.length = 0),+ super.release()+ }+ }+ class pd extends V {+ constructor(t) {+ super(),+ (this.projection = En(t.projection)),+ (this.attributions_ = _d(t.attributions)),+ (this.attributionsCollapsible_ = t.attributionsCollapsible ?? !0),+ (this.loading = !1),+ (this.state_ = void 0 !== t.state ? t.state : "ready"),+ (this.wrapX_ = void 0 !== t.wrapX && t.wrapX),+ (this.interpolate_ = !!t.interpolate),+ (this.viewResolver = null),+ (this.viewRejector = null)+ const e = this+ this.viewPromise_ = new Promise(function (t, i) {+ ;(e.viewResolver = t), (e.viewRejector = i)+ })+ }+ getAttributions() {+ return this.attributions_+ }+ getAttributionsCollapsible() {+ return this.attributionsCollapsible_+ }+ getProjection() {+ return this.projection+ }+ getResolutions(t) {+ return null+ }+ getView() {+ return this.viewPromise_+ }+ getState() {+ return this.state_+ }+ getWrapX() {+ return this.wrapX_+ }+ getInterpolate() {+ return this.interpolate_+ }+ refresh() {+ this.changed()+ }+ setAttributions(t) {+ ;(this.attributions_ = _d(t)), this.changed()+ }+ setState(t) {+ ;(this.state_ = t), this.changed()+ }+ }+ function _d(t) {+ return t ? ("function" == typeof t ? t : (Array.isArray(t) || (t = [t]), (e) => t)) : null+ }+ class md extends pd {+ 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 && Wl(this.tileGrid.getTileSize(this.tileGrid.getMinZoom()), e),+ (this.tmpSize = [0, 0]),+ (this.key_ = t.key || z(this)),+ (this.tileOptions = { transition: t.transition, interpolate: t.interpolate }),+ (this.zDirection = t.zDirection ? t.zDirection : 0)+ }+ getGutterForProjection(t) {+ return 0+ }+ getKey() {+ return this.key_+ }+ setKey(t) {+ this.key_ !== t && ((this.key_ = t), this.changed())+ }+ getResolutions(t) {+ const e = t ? this.getTileGridForProjection(t) : this.tileGrid+ return e ? e.getResolutions() : null+ }+ getTile(t, e, i, n, r, s) {+ return U()+ }+ getTileGrid() {+ return this.tileGrid+ }+ getTileGridForProjection(t) {+ return this.tileGrid ? this.tileGrid : Zu(t)+ }+ getTilePixelRatio(t) {+ return this.tilePixelRatio_+ }+ getTilePixelSize(t, e, i) {+ const n = this.getTileGridForProjection(i),+ r = this.getTilePixelRatio(e),+ s = Wl(n.getTileSize(t), this.tmpSize)+ return 1 == r ? s : $l(s, r, this.tmpSize)+ }+ 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 = Yu(n, t, i)), zu(t, n) ? t : null+ }+ clear() {}+ refresh() {+ this.clear(), super.refresh()+ }+ }+ class yd extends M {+ constructor(t, e) {+ super(t), (this.tile = e)+ }+ }+ var xd = "tileloadstart",+ vd = "tileloadend",+ Sd = "tileloaderror"+ class Ed extends md {+ 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 === Ed.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 = z(e),+ n = e.getState()+ let r+ n == H+ ? ((this.tileLoadingKeys_[i] = !0), (r = xd))+ : i in this.tileLoadingKeys_ && (delete this.tileLoadingKeys_[i], (r = n == q ? Sd : n == K ? vd : void 0)),+ null != r && this.dispatchEvent(new yd(r, e))+ }+ setTileLoadFunction(t) {+ ;(this.tileLoadFunction = t), this.changed()+ }+ setTileUrlFunction(t, e) {+ ;(this.tileUrlFunction = t), void 0 !== e ? this.setKey(e) : this.changed()+ }+ setUrl(t) {+ const e = ad(t)+ ;(this.urls = e), this.setUrls(e)+ }+ setUrls(t) {+ this.urls = t+ const e = t.join("\n")+ this.generateTileUrlFunction_ ? this.setTileUrlFunction(hd(t, this.tileGrid), e) : this.setKey(e)+ }+ tileUrlFunction(t, e, i) {}+ }+ class wd extends Ed {+ constructor(t) {+ super({+ attributions: t.attributions,+ cacheSize: t.cacheSize,+ projection: t.projection,+ state: t.state,+ tileGrid: t.tileGrid,+ tileLoadFunction: t.tileLoadFunction ? t.tileLoadFunction : Td,+ 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 : Bs),+ (this.tileGridForProjection = {}),+ (this.reprojectionErrorThreshold_ = t.reprojectionErrorThreshold),+ (this.renderReprojectionEdges_ = !1)+ }+ getGutterForProjection(t) {+ return this.getProjection() && t && !Fn(this.getProjection(), t) ? 0 : this.getGutter()+ }+ getGutter() {+ return 0+ }+ getKey() {+ let t = super.getKey()+ return this.getInterpolate() || (t += ":disable-interpolation"), t+ }+ getTileGridForProjection(t) {+ const e = this.getProjection()+ if (this.tileGrid && (!e || Fn(e, t))) return this.tileGrid+ const i = z(t)+ return i in this.tileGridForProjection || (this.tileGridForProjection[i] = Zu(t)), this.tileGridForProjection[i]+ }+ createTile_(t, e, i, r, s, o) {+ const a = [t, e, i],+ l = this.getTileCoordForTileUrlFunction(a, s),+ h = l ? this.tileUrlFunction(l, r, s) : void 0,+ c = new this.tileClass(+ a,+ void 0 !== h ? Y : J,+ void 0 !== h ? h : "",+ { crossOrigin: this.crossOrigin, referrerPolicy: this.referrerPolicy },+ this.tileLoadFunction,+ this.tileOptions+ )+ return (c.key = o), c.addEventListener(n, this.handleTileChange.bind(this)), c+ }+ getTile(t, e, i, n, r, s) {+ const o = this.getProjection()+ if (!o || !r || Fn(o, r)) return this.getTileInternal(t, e, i, n, o || r)+ const a = [t, e, i],+ l = this.getKey(),+ h = this.getTileGridForProjection(o),+ c = this.getTileGridForProjection(r),+ u = this.getTileCoordForTileUrlFunction(a, r),+ d = new fd(+ o,+ h,+ r,+ c,+ a,+ u,+ this.getTilePixelRatio(n),+ this.getGutter(),+ (t, e, i, n) => this.getTileInternal(t, e, i, n, o, s),+ this.reprojectionErrorThreshold_,+ this.renderReprojectionEdges_,+ this.tileOptions+ )+ return (d.key = l), d+ }+ getTileInternal(t, e, i, n, r, s) {+ const o = this.getKey(),+ a = ju(this, o, t, e, i)+ if (s && s.containsKey(a)) {+ return s.get(a)+ }+ const l = this.createTile_(t, e, i, n, r, o)+ return s?.set(a, l), l+ }+ setRenderReprojectionEdges(t) {+ this.renderReprojectionEdges_ != t && ((this.renderReprojectionEdges_ = t), this.changed())+ }+ setTileGridForProjection(t, e) {+ const i = En(t)+ if (i) {+ const t = z(i)+ t in this.tileGridForProjection || (this.tileGridForProjection[t] = e)+ }+ }+ }+ function Td(t, e) {+ if (ct) {+ const i = t.getCrossOrigin()+ let n = "same-origin",+ r = "same-origin"+ "anonymous" === i || "" === i+ ? ((n = "cors"), (r = "omit"))+ : "use-credentials" === i && ((n = "cors"), (r = "include"))+ const s = { mode: n, credentials: r, referrerPolicy: t.getReferrerPolicy() }+ fetch(e, s)+ .then((t) => {+ if (!t.ok) throw new Error(`HTTP ${t.status}`)+ return t.blob()+ })+ .then((t) => createImageBitmap(t))+ .then((e) => {+ const i = t.getImage()+ ;(i.width = e.width), (i.height = e.height)+ i.getContext("2d").drawImage(e, 0, 0), e.close?.(), i.dispatchEvent(new Event("load"))+ })+ .catch(() => {+ t.getImage().dispatchEvent(new Event("error"))+ })+ } else t.getImage().src = e+ }+ function Cd(t) {+ const e = t[0],+ i = new Array(e)+ let n,+ r,+ s = 1 << (e - 1)+ for (n = 0; n < e; ++n)+ (r = 48), t[1] & s && (r += 1), t[2] & s && (r += 2), (i[n] = String.fromCharCode(r)), (s >>= 1)+ return i.join("")+ }+ class bd extends wd {+ constructor(t) {+ const e = void 0 !== (t = t || {}).projection ? t.projection : "EPSG:3857",+ i =+ void 0 !== t.tileGrid+ ? t.tileGrid+ : Ku({+ extent: Qu(e),+ maxResolution: t.maxResolution,+ maxZoom: t.maxZoom,+ minZoom: t.minZoom,+ tileSize: t.tileSize+ })+ super({+ attributions: t.attributions,+ cacheSize: t.cacheSize,+ crossOrigin: t.crossOrigin,+ referrerPolicy: t.referrerPolicy,+ interpolate: t.interpolate,+ projection: e,+ reprojectionErrorThreshold: t.reprojectionErrorThreshold,+ tileGrid: i,+ tileLoadFunction: t.tileLoadFunction,+ tilePixelRatio: t.tilePixelRatio,+ tileUrlFunction: t.tileUrlFunction,+ url: t.url,+ urls: t.urls,+ wrapX: void 0 === t.wrapX || t.wrapX,+ transition: t.transition,+ attributionsCollapsible: t.attributionsCollapsible,+ zDirection: t.zDirection+ }),+ (this.gutter_ = void 0 !== t.gutter ? t.gutter : 0)+ }+ getGutter() {+ return this.gutter_+ }+ }+ function Rd(t, e, i, n) {+ const r = []+ let s = [1 / 0, 1 / 0, -1 / 0, -1 / 0]+ for (let o = 0, a = i.length; o < a; ++o) {+ const a = i[o]+ ;(s = Qt(t, e, a[0], n)), r.push((s[0] + s[2]) / 2, (s[1] + s[3]) / 2), (e = a[a.length - 1])+ }+ return r+ }+ function Pd(t, e, i, n, r, s, o) {+ let a, l+ const h = (i - e) / n+ if (1 === h) a = e+ else if (2 === h) (a = e), (l = r)+ else if (0 !== h) {+ let s = t[e],+ o = t[e + 1],+ h = 0+ const c = [0]+ for (let r = e + n; r < i; r += n) {+ const e = t[r],+ i = t[r + 1]+ ;(h += Math.sqrt((e - s) * (e - s) + (i - o) * (i - o))), c.push(h), (s = e), (o = i)+ }+ const u = r * h,+ d = m(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 = o > 1 ? o : 2), (s = s || new Array(o))+ for (let e = 0; e < o; ++e) s[e] = void 0 === a ? NaN : void 0 === l ? t[a + e] : Ne(t[a + e], t[a + n + e], l)+ return s+ }+ function Id(t, e, i, n, r, s) {+ if (i == e) return null+ let o+ if (r < t[e + n - 1]) return s ? ((o = t.slice(e, e + n)), (o[n - 1] = r), o) : null+ if (t[i - 1] < r) return s ? ((o = t.slice(i - n, i)), (o[n - 1] = r), o) : null+ if (r == t[e + n - 1]) return t.slice(e, e + n)+ let a = e / n,+ l = i / n+ for (; a < l; ) {+ const e = (a + l) >> 1+ r < t[(e + 1) * n - 1] ? (l = e) : (a = e + 1)+ }+ const h = t[a * n - 1]+ if (r == h) return t.slice((a - 1) * n, (a - 1) * n + n)+ const c = (r - h) / (t[(a + 1) * n - 1] - h)+ o = []+ for (let e = 0; e < n - 1; ++e) o.push(Ne(t[(a - 1) * n + e], t[a * n + e], c))+ return o.push(r), o+ }+ function Fd(t, e, i, n, r, s, o) {+ if (o) return Id(t, e, i[i.length - 1], n, r, s)+ let a+ if (r < t[n - 1]) return s ? ((a = t.slice(0, n)), (a[n - 1] = r), a) : null+ if (t[t.length - 1] < r) return s ? ((a = t.slice(t.length - n)), (a[n - 1] = r), a) : null+ for (let s = 0, o = i.length; s < o; ++s) {+ const o = i[s]+ if (e != o) {+ if (r < t[e + n - 1]) return null+ if (r <= t[o - 1]) return Id(t, e, o, n, r, !1)+ e = o+ }+ }+ return null+ }+ class Ld extends mr {+ constructor(t, e, i) {+ super(),+ void 0 !== i && void 0 === e ? this.setFlatCoordinates(i, t) : ((e = e || 0), this.setCenterAndRadius(t, e, i))+ }+ clone() {+ const t = new Ld(this.flatCoordinates.slice(), void 0, this.layout)+ return t.applyProperties(this), t+ }+ closestPointXY(t, e, i, n) {+ const r = this.flatCoordinates,+ s = t - r[0],+ o = e - r[1],+ a = s * s + o * o+ if (a < n) {+ if (0 === a) for (let t = 0; t < this.stride; ++t) i[t] = r[t]+ else {+ const t = this.getRadius() / Math.sqrt(a)+ ;(i[0] = r[0] + t * s), (i[1] = r[1] + t * o)+ for (let t = 2; t < this.stride; ++t) i[t] = r[t]+ }+ return (i.length = this.stride), a+ }+ return n+ }+ containsXY(t, e) {+ const i = this.flatCoordinates,+ n = t - i[0],+ r = e - i[1]+ return n * n + r * r <= this.getRadiusSquared_()+ }+ getCenter() {+ return this.flatCoordinates.slice(0, this.stride)+ }+ computeExtent(t) {+ const e = this.flatCoordinates,+ i = e[this.stride] - e[0]+ return Kt(e[0] - i, e[1] - i, e[0] + i, e[1] + i, t)+ }+ getRadius() {+ return Math.sqrt(this.getRadiusSquared_())+ }+ getRadiusSquared_() {+ const t = this.flatCoordinates[this.stride] - this.flatCoordinates[0],+ e = this.flatCoordinates[this.stride + 1] - this.flatCoordinates[1]+ return t * t + e * e+ }+ getType() {+ return "Circle"+ }+ intersectsExtent(t) {+ if (Se(t, this.getExtent())) {+ const e = this.getCenter()+ return (+ (t[0] <= e[0] && t[2] >= e[0]) ||+ (t[1] <= e[1] && t[3] >= e[1]) ||+ le(t, this.intersectsCoordinate.bind(this))+ )+ }+ return !1+ }+ setCenter(t) {+ const e = this.stride,+ i = this.flatCoordinates[e] - this.flatCoordinates[0],+ n = t.slice()+ n[e] = n[0] + i+ for (let i = 1; i < e; ++i) n[e + i] = t[i]+ this.setFlatCoordinates(this.layout, n), this.changed()+ }+ setCenterAndRadius(t, e, i) {+ this.setLayout(i, t, 0), this.flatCoordinates || (this.flatCoordinates = [])+ const n = this.flatCoordinates+ let r = Lr(n, 0, t, this.stride)+ n[r++] = n[0] + e+ for (let t = 1, e = this.stride; t < e; ++t) n[r++] = n[t]+ ;(n.length = r), this.changed()+ }+ getCoordinates() {+ return null+ }+ setCoordinates(t, e) {}+ setRadius(t) {+ ;(this.flatCoordinates[this.stride] = this.flatCoordinates[0] + t), this.changed()+ }+ rotate(t, e) {+ const i = this.getCenter(),+ n = this.getStride()+ this.setCenter(ur(i, 0, i.length, n, t, e, i)), this.changed()+ }+ }+ Ld.prototype.transform+ class Md extends _r {+ constructor(t) {+ super(), (this.geometries_ = t), (this.changeEventsKeys_ = []), this.listenGeometriesChange_()+ }+ unlistenGeometriesChange_() {+ this.changeEventsKeys_.forEach(k), (this.changeEventsKeys_.length = 0)+ }+ listenGeometriesChange_() {+ const t = this.geometries_+ for (let e = 0, i = t.length; e < i; ++e) this.changeEventsKeys_.push(D(t[e], n, this.changed, this))+ }+ clone() {+ const t = new Md(Ad(this.geometries_))+ return t.applyProperties(this), t+ }+ closestPointXY(t, e, i, n) {+ if (n < Vt(this.getExtent(), t, e)) return n+ const r = this.geometries_+ for (let s = 0, o = r.length; s < o; ++s) n = r[s].closestPointXY(t, e, i, n)+ return n+ }+ containsXY(t, e) {+ const i = this.geometries_+ for (let n = 0, r = i.length; n < r; ++n) if (i[n].containsXY(t, e)) return !0+ return !1+ }+ computeExtent(t) {+ qt(t)+ const e = this.geometries_+ for (let i = 0, n = e.length; i < n; ++i) ie(t, e[i].getExtent())+ return t+ }+ getGeometries() {+ return Ad(this.geometries_)+ }+ getGeometriesArray() {+ return this.geometries_+ }+ getGeometriesArrayRecursive() {+ let t = []+ const e = this.geometries_+ for (let i = 0, n = e.length; i < n; ++i)+ e[i].getType() === this.getType() ? (t = t.concat(e[i].getGeometriesArrayRecursive())) : t.push(e[i])+ return t+ }+ getSimplifiedGeometry(t) {+ if (+ (this.simplifiedGeometryRevision !== this.getRevision() &&+ ((this.simplifiedGeometryMaxMinSquaredTolerance = 0), (this.simplifiedGeometryRevision = this.getRevision())),+ t < 0 ||+ (0 !== this.simplifiedGeometryMaxMinSquaredTolerance && t < this.simplifiedGeometryMaxMinSquaredTolerance))+ )+ return this+ const e = [],+ i = this.geometries_+ let n = !1+ for (let r = 0, s = i.length; r < s; ++r) {+ const s = i[r],+ o = s.getSimplifiedGeometry(t)+ e.push(o), o !== s && (n = !0)+ }+ if (n) {+ return new Md(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, r = i.length; n < r; ++n) i[n].rotate(t, e)+ this.changed()+ }+ scale(t, e, i) {+ i || (i = de(this.getExtent()))+ const n = this.geometries_+ for (let r = 0, s = n.length; r < s; ++r) n[r].scale(t, e, i)+ this.changed()+ }+ setGeometries(t) {+ this.setGeometriesArray(Ad(t))+ }+ setGeometriesArray(t) {+ this.unlistenGeometriesChange_(), (this.geometries_ = t), this.listenGeometriesChange_(), this.changed()+ }+ applyTransform(t) {+ const e = this.geometries_+ for (let i = 0, n = e.length; i < n; ++i) e[i].applyTransform(t)+ this.changed()+ }+ translate(t, e) {+ const i = this.geometries_+ for (let n = 0, r = i.length; n < r; ++n) i[n].translate(t, e)+ this.changed()+ }+ disposeInternal() {+ this.unlistenGeometriesChange_(), super.disposeInternal()+ }+ }+ function Ad(t) {+ return t.map((t) => t.clone())+ }+ function Od(t, e, i, n) {+ let r = t[e],+ s = t[e + 1],+ o = 0+ for (let a = e + n; a < i; a += n) {+ const e = t[a],+ i = t[a + 1]+ ;(o += Math.sqrt((e - r) * (e - r) + (i - s) * (i - s))), (r = e), (s = i)+ }+ return o+ }+ class Dd extends mr {+ 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) {+ E(this.flatCoordinates, t), this.changed()+ }+ clone() {+ const t = new Dd(this.flatCoordinates.slice(), this.layout)+ return t.applyProperties(this), t+ }+ closestPointXY(t, e, i, n) {+ return n < Vt(this.getExtent(), t, e)+ ? n+ : (this.maxDeltaRevision_ != this.getRevision() &&+ ((this.maxDelta_ = Math.sqrt(Cr(this.flatCoordinates, 0, this.flatCoordinates.length, this.stride, 0))),+ (this.maxDeltaRevision_ = this.getRevision())),+ Pr(this.flatCoordinates, 0, this.flatCoordinates.length, this.stride, this.maxDelta_, !1, t, e, i, n))+ }+ forEachSegment(t) {+ return Qr(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), Id(this.flatCoordinates, 0, this.flatCoordinates.length, this.stride, t, e))+ }+ getCoordinates() {+ return Dr(this.flatCoordinates, 0, this.flatCoordinates.length, this.stride)+ }+ getCoordinateAt(t, e) {+ return Pd(this.flatCoordinates, 0, this.flatCoordinates.length, this.stride, t, e, this.stride)+ }+ getLength() {+ return Od(this.flatCoordinates, 0, this.flatCoordinates.length, this.stride)+ }+ getFlatMidpoint() {+ return (+ this.flatMidpointRevision_ != this.getRevision() &&+ ((this.flatMidpoint_ = this.getCoordinateAt(0.5, this.flatMidpoint_ ?? void 0)),+ (this.flatMidpointRevision_ = this.getRevision())),+ this.flatMidpoint_+ )+ }+ getSimplifiedGeometryInternal(t) {+ const e = []+ return (+ (e.length = Gr(this.flatCoordinates, 0, this.flatCoordinates.length, this.stride, t, e, 0)), new Dd(e, "XY")+ )+ }+ getType() {+ return "LineString"+ }+ intersectsExtent(t) {+ return es(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 = Mr(this.flatCoordinates, 0, t, this.stride)),+ this.changed()+ }+ }+ class Nd extends mr {+ constructor(t, e, i) {+ if ((super(), (this.ends_ = []), (this.maxDelta_ = -1), (this.maxDeltaRevision_ = -1), Array.isArray(t[0])))+ this.setCoordinates(t, e)+ else if (void 0 !== e && i) this.setFlatCoordinates(e, t), (this.ends_ = i)+ else {+ const e = t,+ i = [],+ n = []+ for (let t = 0, r = e.length; t < r; ++t) {+ E(i, e[t].getFlatCoordinates()), n.push(i.length)+ }+ const r = 0 === e.length ? this.getLayout() : e[0].getLayout()+ this.setFlatCoordinates(r, i), (this.ends_ = n)+ }+ }+ appendLineString(t) {+ E(this.flatCoordinates, t.getFlatCoordinates().slice()),+ this.ends_.push(this.flatCoordinates.length),+ this.changed()+ }+ clone() {+ const t = new Nd(this.flatCoordinates.slice(), this.layout, this.ends_.slice())+ return t.applyProperties(this), t+ }+ closestPointXY(t, e, i, n) {+ return n < Vt(this.getExtent(), t, e)+ ? n+ : (this.maxDeltaRevision_ != this.getRevision() &&+ ((this.maxDelta_ = Math.sqrt(br(this.flatCoordinates, 0, this.ends_, this.stride, 0))),+ (this.maxDeltaRevision_ = this.getRevision())),+ Ir(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),+ Fd(this.flatCoordinates, 0, this.ends_, this.stride, t, e, i))+ }+ getCoordinates() {+ return Nr(this.flatCoordinates, 0, this.ends_, this.stride)+ }+ getEnds() {+ return this.ends_+ }+ getLineString(t) {+ return t < 0 || this.ends_.length <= t+ ? null+ : new Dd(this.flatCoordinates.slice(0 === t ? 0 : this.ends_[t - 1], this.ends_[t]), this.layout)+ }+ getLineStrings() {+ const t = this.flatCoordinates,+ e = this.ends_,+ i = this.layout,+ n = []+ let r = 0+ for (let s = 0, o = e.length; s < o; ++s) {+ const o = e[s],+ a = new Dd(t.slice(r, o), i)+ n.push(a), (r = o)+ }+ return n+ }+ getLength() {+ const t = this.ends_+ let e = 0,+ i = 0+ for (let n = 0, r = t.length; n < r; ++n) (i += Od(this.flatCoordinates, e, t[n], this.stride)), (e = t[n])+ return i+ }+ getFlatMidpoints() {+ const t = [],+ e = this.flatCoordinates+ let i = 0+ const n = this.ends_,+ r = this.stride+ for (let s = 0, o = n.length; s < o; ++s) {+ const o = n[s]+ E(t, Pd(e, i, o, r, 0.5)), (i = o)+ }+ return t+ }+ getSimplifiedGeometryInternal(t) {+ const e = [],+ i = []+ return (e.length = jr(this.flatCoordinates, 0, this.ends_, this.stride, t, e, 0, i)), new Nd(e, "XY", i)+ }+ getType() {+ return "MultiLineString"+ }+ intersectsExtent(t) {+ return is(this.flatCoordinates, 0, this.ends_, this.stride, t)+ }+ setCoordinates(t, e) {+ this.setLayout(e, t, 2), this.flatCoordinates || (this.flatCoordinates = [])+ const i = Ar(this.flatCoordinates, 0, t, this.stride, this.ends_)+ ;(this.flatCoordinates.length = 0 === i.length ? 0 : i[i.length - 1]), this.changed()+ }+ }+ class kd extends mr {+ constructor(t, e) {+ super(), e && !Array.isArray(t[0]) ? this.setFlatCoordinates(e, t) : this.setCoordinates(t, e)+ }+ appendPoint(t) {+ E(this.flatCoordinates, t.getFlatCoordinates()), this.changed()+ }+ clone() {+ const t = new kd(this.flatCoordinates.slice(), this.layout)+ return t.applyProperties(this), t+ }+ closestPointXY(t, e, i, n) {+ if (n < Vt(this.getExtent(), t, e)) return n+ const r = this.flatCoordinates,+ s = this.stride+ for (let o = 0, a = r.length; o < a; o += s) {+ const a = Le(t, e, r[o], r[o + 1])+ if (a < n) {+ n = a+ for (let t = 0; t < s; ++t) i[t] = r[o + t]+ i.length = s+ }+ }+ return n+ }+ getCoordinates() {+ return Dr(this.flatCoordinates, 0, this.flatCoordinates.length, this.stride)+ }+ getPoint(t) {+ const e = this.flatCoordinates.length / this.stride+ return t < 0 || e <= t+ ? null+ : new Wr(this.flatCoordinates.slice(t * this.stride, (t + 1) * this.stride), this.layout)+ }+ getPoints() {+ const t = this.flatCoordinates,+ e = this.layout,+ i = this.stride,+ n = []+ for (let r = 0, s = t.length; r < s; r += i) {+ const s = new Wr(t.slice(r, r + i), e)+ n.push(s)+ }+ return n+ }+ getType() {+ return "MultiPoint"+ }+ intersectsExtent(t) {+ const e = this.flatCoordinates,+ i = this.stride+ for (let n = 0, r = e.length; n < r; n += i) {+ if (Zt(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 = Mr(this.flatCoordinates, 0, t, this.stride)),+ this.changed()+ }+ }+ class Gd extends mr {+ constructor(t, e, i) {+ if (+ (super(),+ (this.endss_ = []),+ (this.flatInteriorPointsRevision_ = -1),+ (this.flatInteriorPoints_ = null),+ (this.maxDelta_ = -1),+ (this.maxDeltaRevision_ = -1),+ (this.orientedRevision_ = -1),+ (this.orientedFlatCoordinates_ = null),+ !i && !Array.isArray(t[0]))+ ) {+ const n = t,+ r = [],+ s = []+ for (let t = 0, e = n.length; t < e; ++t) {+ const e = n[t],+ i = r.length,+ o = e.getEnds()+ for (let t = 0, e = o.length; t < e; ++t) o[t] += i+ E(r, e.getFlatCoordinates()), s.push(o)+ }+ ;(e = 0 === n.length ? this.getLayout() : n[0].getLayout()), (t = r), (i = s)+ }+ void 0 !== e && i ? (this.setFlatCoordinates(e, t), (this.endss_ = i)) : this.setCoordinates(t, e)+ }+ appendPolygon(t) {+ let e+ if (this.flatCoordinates) {+ const i = this.flatCoordinates.length+ E(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 Gd(this.flatCoordinates.slice(), this.layout, e)+ return i.applyProperties(this), i+ }+ closestPointXY(t, e, i, n) {+ return n < Vt(this.getExtent(), t, e)+ ? n+ : (this.maxDeltaRevision_ != this.getRevision() &&+ ((this.maxDelta_ = Math.sqrt(Rr(this.flatCoordinates, 0, this.endss_, this.stride, 0))),+ (this.maxDeltaRevision_ = this.getRevision())),+ Fr(this.getOrientedFlatCoordinates(), 0, this.endss_, this.stride, this.maxDelta_, !0, t, e, i, n))+ }+ containsXY(t, e) {+ return Kr(this.getOrientedFlatCoordinates(), 0, this.endss_, this.stride, t, e)+ }+ getArea() {+ return wr(this.getOrientedFlatCoordinates(), 0, this.endss_, this.stride)+ }+ getCoordinates(t) {+ let e+ return (+ void 0 !== t+ ? ((e = this.getOrientedFlatCoordinates().slice()), us(e, 0, this.endss_, this.stride, t))+ : (e = this.flatCoordinates),+ kr(e, 0, this.endss_, this.stride)+ )+ }+ getEndss() {+ return this.endss_+ }+ getFlatInteriorPoints() {+ if (this.flatInteriorPointsRevision_ != this.getRevision()) {+ const t = Rd(this.flatCoordinates, 0, this.endss_, this.stride)+ ;(this.flatInteriorPoints_ = Jr(this.getOrientedFlatCoordinates(), 0, this.endss_, this.stride, t)),+ (this.flatInteriorPointsRevision_ = this.getRevision())+ }+ return this.flatInteriorPoints_+ }+ getInteriorPoints() {+ return new kd(this.getFlatInteriorPoints().slice(), "XYM")+ }+ getOrientedFlatCoordinates() {+ if (this.orientedRevision_ != this.getRevision()) {+ const t = this.flatCoordinates+ hs(t, 0, this.endss_, this.stride)+ ? (this.orientedFlatCoordinates_ = t)+ : ((this.orientedFlatCoordinates_ = t.slice()),+ (this.orientedFlatCoordinates_.length = us(this.orientedFlatCoordinates_, 0, this.endss_, this.stride))),+ (this.orientedRevision_ = this.getRevision())+ }+ return this.orientedFlatCoordinates_+ }+ getSimplifiedGeometryInternal(t) {+ const e = [],+ i = []+ return (+ (e.length = Vr(this.flatCoordinates, 0, this.endss_, this.stride, Math.sqrt(t), e, 0, i)), new Gd(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 gs(this.flatCoordinates.slice(e, n), this.layout, i)+ }+ getPolygons() {+ const t = this.layout,+ e = this.flatCoordinates,+ i = this.endss_,+ n = []+ let r = 0+ for (let s = 0, o = i.length; s < o; ++s) {+ const o = i[s].slice(),+ a = o[o.length - 1]+ if (0 !== r) for (let t = 0, e = o.length; t < e; ++t) o[t] -= r+ const l = new gs(e.slice(r, a), t, o)+ n.push(l), (r = a)+ }+ return n+ }+ getType() {+ return "MultiPolygon"+ }+ intersectsExtent(t) {+ return ss(this.getOrientedFlatCoordinates(), 0, this.endss_, this.stride, t)+ }+ setCoordinates(t, e) {+ this.setLayout(e, t, 3), this.flatCoordinates || (this.flatCoordinates = [])+ const i = Or(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 jd = [1, 0, 0, 1, 0, 0]+ class Ud {+ constructor(t, e, i, n, r, s) {+ this.styleFunction,+ this.extent_,+ (this.id_ = s),+ (this.type_ = t),+ (this.flatCoordinates_ = e),+ (this.flatInteriorPoints_ = null),+ (this.flatMidpoints_ = null),+ (this.ends_ = i || null),+ (this.properties_ = r),+ this.squaredTolerance_,+ (this.stride_ = n),+ this.simplifiedGeometry_+ }+ get(t) {+ return this.properties_[t]+ }+ getExtent() {+ return (+ this.extent_ ||+ (this.extent_ =+ "Point" === this.type_+ ? Jt(this.flatCoordinates_)+ : Qt(this.flatCoordinates_, 0, this.flatCoordinates_.length, 2)),+ this.extent_+ )+ }+ getFlatInteriorPoint() {+ if (!this.flatInteriorPoints_) {+ const t = de(this.getExtent())+ this.flatInteriorPoints_ = qr(this.flatCoordinates_, 0, this.ends_, 2, t, 0)+ }+ return this.flatInteriorPoints_+ }+ getFlatInteriorPoints() {+ if (!this.flatInteriorPoints_) {+ const t = ds(this.flatCoordinates_, this.ends_),+ e = Rd(this.flatCoordinates_, 0, t, 2)+ this.flatInteriorPoints_ = Jr(this.flatCoordinates_, 0, t, 2, e)+ }+ return this.flatInteriorPoints_+ }+ getFlatMidpoint() {+ return (+ this.flatMidpoints_ ||+ (this.flatMidpoints_ = Pd(this.flatCoordinates_, 0, this.flatCoordinates_.length, 2, 0.5)),+ this.flatMidpoints_+ )+ }+ getFlatMidpoints() {+ if (!this.flatMidpoints_) {+ this.flatMidpoints_ = []+ const t = this.flatCoordinates_+ let e = 0+ const i = this.ends_+ for (let n = 0, r = i.length; n < r; ++n) {+ const r = i[n],+ s = Pd(t, e, r, 2, 0.5)+ E(this.flatMidpoints_, s), (e = r)+ }+ }+ return this.flatMidpoints_+ }+ getId() {+ return this.id_+ }+ getOrientedFlatCoordinates() {+ return this.flatCoordinates_+ }+ getGeometry() {+ return this+ }+ getSimplifiedGeometry(t) {+ return this+ }+ simplifyTransformed(t, e) {+ return this+ }+ getProperties() {+ return this.properties_+ }+ getPropertiesInternal() {+ return this.properties_+ }+ getStride() {+ return this.stride_+ }+ getStyleFunction() {+ return this.styleFunction+ }+ getType() {+ return this.type_+ }+ transform(t) {+ const e = (t = En(t)).getExtent(),+ i = t.getWorldExtent()+ if (e && i) {+ const t = _e(i) / _e(e)+ nr(jd, i[0], i[3], t, -t, 0, 0, 0),+ cr(this.flatCoordinates_, 0, this.flatCoordinates_.length, 2, jd, this.flatCoordinates_)+ }+ }+ applyTransform(t) {+ t(this.flatCoordinates_, this.flatCoordinates_, this.stride_)+ }+ clone() {+ return new Ud(+ this.type_,+ this.flatCoordinates_.slice(),+ this.ends_?.slice(),+ this.stride_,+ Object.assign({}, this.properties_),+ this.id_+ )+ }+ getEnds() {+ return this.ends_+ }+ enableSimplifyTransformed() {+ return (+ (this.simplifyTransformed = P((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 = Gr(+ i,+ 0,+ this.simplifiedGeometry_.flatCoordinates_.length,+ this.simplifiedGeometry_.stride_,+ t,+ i,+ 0+ )),+ (n = [i.length])+ break+ case "MultiLineString":+ ;(n = []),+ (i.length = jr(i, 0, this.simplifiedGeometry_.ends_, this.simplifiedGeometry_.stride_, t, i, 0, n))+ break+ case "Polygon":+ ;(n = []),+ (i.length = Xr(+ i,+ 0,+ this.simplifiedGeometry_.ends_,+ this.simplifiedGeometry_.stride_,+ Math.sqrt(t),+ i,+ 0,+ n+ ))+ }+ return (+ n && (this.simplifiedGeometry_ = new Ud(this.type_, i, n, 2, this.properties_, this.id_)),+ (this.squaredTolerance_ = t),+ this.simplifiedGeometry_+ )+ })),+ this+ )+ }+ }+ function Bd(t) {+ const e = t.getType()+ switch (e) {+ case "Point":+ return new Wr(t.getFlatCoordinates())+ case "MultiPoint":+ return new kd(t.getFlatCoordinates(), "XY")+ case "LineString":+ return new Dd(t.getFlatCoordinates(), "XY")+ case "MultiLineString":+ return new Nd(t.getFlatCoordinates(), "XY", t.getEnds())+ case "Polygon":+ const i = t.getFlatCoordinates(),+ n = t.getEnds(),+ r = ds(i, n)+ return r.length > 1 ? new Gd(i, "XY", r) : new gs(i, "XY", n)+ default:+ throw new Error("Invalid geometry type:" + e)+ }+ }+ Ud.prototype.getFlatCoordinates = Ud.prototype.getOrientedFlatCoordinates+ class zd {+ constructor(t) {+ ;(this.rbush_ = new ll(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_[z(e)] = i)+ }+ load(t, e) {+ const i = new Array(e.length)+ for (let n = 0, r = e.length; n < r; n++) {+ const r = t[n],+ s = e[n],+ o = { minX: r[0], minY: r[1], maxX: r[2], maxY: r[3], value: s }+ ;(i[n] = o), (this.items_[z(s)] = o)+ }+ this.rbush_.load(i)+ }+ remove(t) {+ const e = z(t),+ i = this.items_[e]+ return delete this.items_[e], null !== this.rbush_.remove(i)+ }+ update(t, e) {+ const i = this.items_[z(e)]+ te([i.minX, i.minY, i.maxX, i.maxY], t) || (this.remove(e), this.insert(t, e))+ }+ getAll() {+ return this.rbush_.all().map(function (t) {+ return t.value+ })+ }+ getInExtent(t) {+ const e = { minX: t[0], minY: t[1], maxX: t[2], maxY: t[3] }+ return this.rbush_.search(e).map(function (t) {+ return t.value+ })+ }+ forEach(t) {+ return this.forEach_(this.getAll(), t)+ }+ forEachInExtent(t, e) {+ return this.forEach_(this.getInExtent(t), e)+ }+ forEach_(t, e) {+ let i+ for (let n = 0, r = t.length; n < r; n++) if (((i = e(t[n])), i)) return i+ return i+ }+ isEmpty() {+ return L(this.items_)+ }+ clear() {+ this.rbush_.clear(), (this.items_ = {})+ }+ getExtent(t) {+ const e = this.rbush_.toJSON()+ return Kt(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]+ }+ }+ var Xd = "addfeature",+ Vd = "changefeature",+ $d = "clear",+ Wd = "removefeature",+ Zd = "featuresloadstart",+ Yd = "featuresloadend",+ Hd = "featuresloaderror"+ class Kd extends M {+ constructor(t, e, i) {+ super(t), (this.feature = e), (this.features = i)+ }+ }+ class qd extends pd {+ constructor(t) {+ super({+ attributions: (t = t || {}).attributions,+ interpolate: !0,+ projection: void 0,+ state: "ready",+ wrapX: void 0 === t.wrapX || t.wrapX+ }),+ this.on,+ this.once,+ this.un,+ (this.loader_ = R),+ (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_ &&+ (Mt(this.format_, "`format` must be set when `url` is set"), (this.loader_ = cu(this.url_, this.format_))),+ (this.strategy_ = void 0 !== t.strategy ? t.strategy : uu)+ const e = void 0 === t.useSpatialIndex || t.useSpatialIndex+ let i, n+ ;(this.featuresRtree_ = e ? new zd() : null),+ (this.loadedExtentsRtree_ = new zd()),+ (this.loadingExtentsCount_ = 0),+ (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 Z(n)),+ void 0 !== n && this.addFeaturesInternal(n),+ void 0 !== i && this.bindFeaturesCollection_(i)+ }+ addFeature(t) {+ this.addFeatureInternal(t), this.changed()+ }+ addFeatureInternal(t) {+ const e = z(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 Kd(Xd, t))+ }+ setupChangeEvents_(t, e) {+ e instanceof Ud ||+ (this.featureChangeKeys_[t] = [+ D(e, n, this.handleFeatureChange_, this),+ D(e, i, 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 Ud) {+ const n = this.idIndex_[t]+ n instanceof Ud ? (Array.isArray(n) ? n.push(e) : (this.idIndex_[t] = [n, e])) : (i = !1)+ } else i = !1+ else this.idIndex_[t] = e+ }+ return (+ i &&+ (Mt(!(t in this.uidIndex_), "The passed `feature` was already added to the source"), (this.uidIndex_[t] = e)),+ i+ )+ }+ addFeatures(t) {+ this.addFeaturesInternal(t), this.changed()+ }+ addFeaturesInternal(t) {+ const e = [],+ i = [],+ n = []+ for (let e = 0, n = t.length; e < n; e++) {+ const n = t[e],+ r = z(n)+ this.addToIndex_(r, n) && i.push(n)+ }+ for (let t = 0, r = i.length; t < r; t++) {+ const r = i[t],+ s = z(r)+ this.setupChangeEvents_(s, r)+ const o = r.getGeometry()+ if (o) {+ const t = o.getExtent()+ e.push(t), n.push(r)+ } else this.nullGeometryFeatures_[s] = r+ }+ if ((this.featuresRtree_ && this.featuresRtree_.load(e, n), this.hasListener(Xd)))+ for (let t = 0, e = i.length; t < e; t++) this.dispatchEvent(new Kd(Xd, i[t]))+ }+ bindFeaturesCollection_(i) {+ let n = !1+ this.addEventListener(Xd, function (t) {+ n || ((n = !0), i.push(t.feature), (n = !1))+ }),+ this.addEventListener(Wd, function (t) {+ n || ((n = !0), i.remove(t.feature), (n = !1))+ }),+ i.addEventListener(t, (t) => {+ n || ((n = !0), this.addFeature(t.element), (n = !1))+ }),+ i.addEventListener(e, (t) => {+ n || ((n = !0), this.removeFeature(t.element), (n = !1))+ }),+ (this.featuresCollection_ = i)+ }+ clear(t) {+ if (t) {+ for (const t in this.featureChangeKeys_) {+ this.featureChangeKeys_[t].forEach(k)+ }+ 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 Kd($d)+ 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 Ud || 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 Ud || 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()),+ L(this.nullGeometryFeatures_) || E(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 = Pe(t, e)+ return [].concat(...i.map((t) => this.featuresRtree_.getInExtent(t)))+ }+ return this.featuresCollection_ ? this.featuresCollection_.getArray().slice(0) : []+ }+ getClosestFeatureToCoordinate(t, e) {+ const i = t[0],+ n = t[1]+ let r = null+ const s = [NaN, NaN]+ let o = 1 / 0+ const a = [-1 / 0, -1 / 0, 1 / 0, 1 / 0]+ return (+ (e = e || C),+ this.featuresRtree_.forEachInExtent(a, function (t) {+ if (e(t)) {+ const e = t.getGeometry(),+ l = o+ if (((o = e instanceof Ud ? 0 : e.closestPointXY(i, n, s, o)), o < l)) {+ r = t+ const e = Math.sqrt(o)+ ;(a[0] = i - e), (a[1] = n - e), (a[2] = i + e), (a[3] = n + e)+ }+ }+ }),+ r+ )+ }+ getExtent(t) {+ return this.featuresRtree_?.getExtent(t) ?? null+ }+ getFeatureById(t) {+ const e = this.idIndex_[t.toString()]+ return void 0 !== e ? e : null+ }+ getFeatureByUid(t) {+ const e = this.uidIndex_[t]+ return void 0 !== e ? e : null+ }+ getFormat() {+ return this.format_+ }+ getOverlaps() {+ return this.overlaps_+ }+ getUrl() {+ return this.url_+ }+ handleFeatureChange_(t) {+ const e = t.target,+ i = z(e),+ n = e.getGeometry()+ if (n) {+ const t = n.getExtent()+ i in this.nullGeometryFeatures_+ ? (delete this.nullGeometryFeatures_[i], this.featuresRtree_ && this.featuresRtree_.insert(t, e))+ : this.featuresRtree_ && this.featuresRtree_.update(t, e)+ } else+ i in this.nullGeometryFeatures_ ||+ (this.featuresRtree_ && this.featuresRtree_.remove(e), (this.nullGeometryFeatures_[i] = e))+ const r = e.getId()+ if (void 0 !== r) {+ const t = r.toString()+ this.idIndex_[t] !== e && (this.removeFromIdIndex_(e), (this.idIndex_[t] = e))+ } else this.removeFromIdIndex_(e), (this.uidIndex_[i] = e)+ this.changed(), this.dispatchEvent(new Kd(Vd, e))+ }+ hasFeature(t) {+ const e = t.getId()+ return void 0 !== e ? e in this.idIndex_ : z(t) in this.uidIndex_+ }+ isEmpty() {+ return this.featuresRtree_+ ? this.featuresRtree_.isEmpty() && L(this.nullGeometryFeatures_)+ : !this.featuresCollection_ || 0 === this.featuresCollection_.getLength()+ }+ loadFeatures(t, e, i) {+ const n = this.loadedExtentsRtree_,+ r = this.strategy_(t, e, i)+ for (let t = 0, s = r.length; t < s; ++t) {+ const s = r[t]+ n.forEachInExtent(s, function (t) {+ return Wt(t.extent, s)+ }) ||+ (++this.loadingExtentsCount_,+ this.dispatchEvent(new Kd(Zd)),+ this.loader_.call(+ this,+ s,+ e,+ i,+ (t) => {+ --this.loadingExtentsCount_, this.dispatchEvent(new Kd(Yd, void 0, t))+ },+ () => {+ --this.loadingExtentsCount_, this.dispatchEvent(new Kd(Hd))+ }+ ),+ n.insert(s, { extent: s.slice() }))+ }+ this.loading = !(this.loader_.length < 4) && this.loadingExtentsCount_ > 0+ }+ refresh() {+ this.clear(!0), this.loadedExtentsRtree_.clear(), super.refresh()+ }+ removeLoadedExtent(t) {+ const e = this.loadedExtentsRtree_,+ i = e.forEachInExtent(t, function (e) {+ if (te(e.extent, t)) return e+ })+ i && e.remove(i)+ }+ removeFeatures(t) {+ let e = !1+ for (let i = 0, n = t.length; i < n; ++i) e = this.removeFeatureInternal(t[i]) || e+ e && this.changed()+ }+ removeFeature(t) {+ if (!t) return+ this.removeFeatureInternal(t) && this.changed()+ }+ removeFeatureInternal(t) {+ const e = z(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(k), 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(Wd) && this.dispatchEvent(new Kd(Wd, 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) {+ Mt(this.format_, "`format` must be set when `url` is set"), (this.url_ = t), this.setLoader(cu(t, this.format_))+ }+ setOverlaps(t) {+ ;(this.overlaps_ = t), this.changed()+ }+ }+ function Jd() {+ return [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]+ }+ function Qd(t, e) {+ return (t[0] = e[0]), (t[1] = e[1]), (t[4] = e[2]), (t[5] = e[3]), (t[12] = e[4]), (t[13] = e[5]), t+ }+ function tg(t, e, i, n, r, s, o) {+ const a = 1 / (t - e),+ l = 1 / (i - n),+ h = 1 / (r - s)+ return (+ ((o = o ?? [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1])[0] = -2 * a),+ (o[1] = 0),+ (o[2] = 0),+ (o[3] = 0),+ (o[4] = 0),+ (o[5] = -2 * l),+ (o[6] = 0),+ (o[7] = 0),+ (o[8] = 0),+ (o[9] = 0),+ (o[10] = 2 * h),+ (o[11] = 0),+ (o[12] = (t + e) * a),+ (o[13] = (n + i) * l),+ (o[14] = (s + r) * h),+ (o[15] = 1),+ o+ )+ }+ function eg(t, e, i, n, r) {+ return (+ ((r = r ?? [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1])[0] = t[0] * e),+ (r[1] = t[1] * e),+ (r[2] = t[2] * e),+ (r[3] = t[3] * e),+ (r[4] = t[4] * i),+ (r[5] = t[5] * i),+ (r[6] = t[6] * i),+ (r[7] = t[7] * i),+ (r[8] = t[8] * n),+ (r[9] = t[9] * n),+ (r[10] = t[10] * n),+ (r[11] = t[11] * n),+ (r[12] = t[12]),+ (r[13] = t[13]),+ (r[14] = t[14]),+ (r[15] = t[15]),+ r+ )+ }+ function ig(t, e, i, n, r) {+ let s, o, a, l, h, c, u, d, g, f, p, _+ return (+ t === (r = r ?? [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1])+ ? ((r[12] = t[0] * e + t[4] * i + t[8] * n + t[12]),+ (r[13] = t[1] * e + t[5] * i + t[9] * n + t[13]),+ (r[14] = t[2] * e + t[6] * i + t[10] * n + t[14]),+ (r[15] = t[3] * e + t[7] * i + t[11] * n + t[15]))+ : ((s = t[0]),+ (o = t[1]),+ (a = t[2]),+ (l = t[3]),+ (h = t[4]),+ (c = t[5]),+ (u = t[6]),+ (d = t[7]),+ (g = t[8]),+ (f = t[9]),+ (p = t[10]),+ (_ = t[11]),+ (r[0] = s),+ (r[1] = o),+ (r[2] = a),+ (r[3] = l),+ (r[4] = h),+ (r[5] = c),+ (r[6] = u),+ (r[7] = d),+ (r[8] = g),+ (r[9] = f),+ (r[10] = p),+ (r[11] = _),+ (r[12] = s * e + h * i + g * n + t[12]),+ (r[13] = o * e + c * i + f * n + t[13]),+ (r[14] = a * e + u * i + p * n + t[14]),+ (r[15] = l * e + d * i + _ * n + t[15])),+ r+ )+ }+ function ng(t, e, i, n) {+ return (+ ((n = n ?? [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1])[0] = 1),+ (n[1] = 0),+ (n[2] = 0),+ (n[3] = 0),+ (n[4] = 0),+ (n[5] = 1),+ (n[6] = 0),+ (n[7] = 0),+ (n[8] = 0),+ (n[9] = 0),+ (n[10] = 1),+ (n[11] = 0),+ (n[12] = t),+ (n[13] = e),+ (n[14] = i),+ (n[15] = 1),+ n+ )+ }+ class rg {+ constructor(t) {+ ;(this.gl_ = t),+ (this.program_ = og(+ t,+ "\n precision mediump float;\n\n varying vec2 v_texcoord;\n\n uniform sampler2D u_texture;\n\n void main() {\n if (\n v_texcoord.x < 0.0 ||\n v_texcoord.y < 0.0 ||\n v_texcoord.x > 1.0 ||\n v_texcoord.y > 1.0\n ) {\n discard;\n }\n gl_FragColor = texture2D(u_texture, v_texcoord);\n }\n",+ "\n attribute vec4 a_position;\n attribute vec4 a_texcoord;\n\n uniform mat4 u_matrix;\n uniform mat4 u_textureMatrix;\n\n varying vec2 v_texcoord;\n\n void main() {\n gl_Position = u_matrix * a_position;\n vec2 texcoord = (u_textureMatrix * a_texcoord).xy;\n v_texcoord = texcoord;\n }\n"+ )),+ (this.positionLocation = t.getAttribLocation(this.program_, "a_position")),+ (this.texcoordLocation = t.getAttribLocation(this.program_, "a_texcoord")),+ (this.matrixLocation = t.getUniformLocation(this.program_, "u_matrix")),+ (this.textureMatrixLocation = t.getUniformLocation(this.program_, "u_textureMatrix")),+ (this.textureLocation = t.getUniformLocation(this.program_, "u_texture")),+ (this.positionBuffer = t.createBuffer()),+ t.bindBuffer(t.ARRAY_BUFFER, this.positionBuffer),+ (this.positions = [0, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 1]),+ t.bufferData(t.ARRAY_BUFFER, new Float32Array(this.positions), t.STATIC_DRAW),+ (this.texcoordBuffer = t.createBuffer()),+ t.bindBuffer(t.ARRAY_BUFFER, this.texcoordBuffer),+ (this.texcoords = [0, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 1]),+ t.bufferData(t.ARRAY_BUFFER, new Float32Array(this.texcoords), t.STATIC_DRAW)+ }+ drawImage(t, e, i, n, r, s, o, a, l, h, c, u, d) {+ const g = this.gl_+ void 0 === a && (a = n),+ void 0 === l && (l = r),+ void 0 === s && (s = e),+ void 0 === o && (o = i),+ void 0 === h && (h = s),+ void 0 === c && (c = o),+ void 0 === u && (u = g.canvas.width),+ void 0 === d && (d = g.canvas.height),+ g.bindTexture(g.TEXTURE_2D, t),+ g.useProgram(this.program_),+ g.bindBuffer(g.ARRAY_BUFFER, this.positionBuffer),+ g.enableVertexAttribArray(this.positionLocation),+ g.vertexAttribPointer(this.positionLocation, 2, g.FLOAT, !1, 0, 0),+ g.bindBuffer(g.ARRAY_BUFFER, this.texcoordBuffer),+ g.enableVertexAttribArray(this.texcoordLocation),+ g.vertexAttribPointer(this.texcoordLocation, 2, g.FLOAT, !1, 0, 0)+ let f = tg(0, u, 0, d, -1, 1)+ ;(f = ig(f, a, l, 0)), (f = eg(f, h, c, 1)), g.uniformMatrix4fv(this.matrixLocation, !1, f)+ let p = ng(n / e, r / i, 0)+ ;(p = eg(p, s / e, o / i, 1)),+ g.uniformMatrix4fv(this.textureMatrixLocation, !1, p),+ g.uniform1i(this.textureLocation, 0),+ g.drawArrays(g.TRIANGLES, 0, this.positions.length / 2)+ }+ }+ function sg(t, e, i) {+ const n = t.createShader(e)+ if (null === n) throw new Error("Shader compilation failed")+ if ((t.shaderSource(n, i), t.compileShader(n), !t.getShaderParameter(n, t.COMPILE_STATUS))) {+ const e = t.getShaderInfoLog(n)+ if (null === e) throw new Error("Shader info log creation failed")+ throw new Error(e)+ }+ return n+ }+ function og(t, e, i) {+ const n = t.createProgram(),+ r = sg(t, t.VERTEX_SHADER, i),+ s = sg(t, t.FRAGMENT_SHADER, e)+ if (null === n) throw new Error("Program creation failed")+ if ((t.attachShader(n, r), t.attachShader(n, s), t.linkProgram(n), !t.getProgramParameter(n, t.LINK_STATUS))) {+ if (null === t.getProgramInfoLog(n)) throw new Error("Program info log creation failed")+ throw new Error()+ }+ return n+ }+ function ag(t, e, i, n) {+ let r+ return (+ (r = i && i.length ? i.shift() : ct ? new OffscreenCanvas(t || 300, e || 300) : document.createElement("canvas")),+ t && (r.width = t),+ e && (r.height = e),+ r.getContext("webgl", n)+ )+ }+ function lg(t) {+ const e = t.canvas+ ;(e.width = 1), (e.height = 1), t.clear(t.COLOR_BUFFER_BIT | t.DEPTH_BUFFER_BIT | t.STENCIL_BUFFER_BIT)+ }+ const hg = []+ function cg(t, e, i, n, r, s, o, a, l, h, c, u, d, g) {+ const f = Math.round(n * e),+ p = Math.round(n * i)+ let _, m+ if (+ ((t.canvas.width = f),+ (t.canvas.height = p),+ (m = t.createTexture()),+ t.bindTexture(t.TEXTURE_2D, m),+ t.texParameteri(t.TEXTURE_2D, t.TEXTURE_WRAP_S, t.CLAMP_TO_EDGE),+ t.texParameteri(t.TEXTURE_2D, t.TEXTURE_WRAP_T, t.CLAMP_TO_EDGE),+ d+ ? (t.texParameteri(t.TEXTURE_2D, t.TEXTURE_MIN_FILTER, t.LINEAR),+ t.texParameteri(t.TEXTURE_2D, t.TEXTURE_MAG_FILTER, t.LINEAR))+ : (t.texParameteri(t.TEXTURE_2D, t.TEXTURE_MIN_FILTER, t.NEAREST),+ t.texParameteri(t.TEXTURE_2D, t.TEXTURE_MAG_FILTER, t.NEAREST)),+ t.texImage2D(t.TEXTURE_2D, 0, t.RGBA, f, p, 0, t.RGBA, c, null),+ (_ = t.createFramebuffer()),+ t.bindFramebuffer(t.FRAMEBUFFER, _),+ t.framebufferTexture2D(t.FRAMEBUFFER, t.COLOR_ATTACHMENT0, t.TEXTURE_2D, m, 0),+ null === _)+ )+ throw new Error("Could not create framebuffer")+ if (null === m) throw new Error("Could not create texture")+ if (0 === l.length) return { width: f, height: p, framebuffer: _, texture: m }+ const y = [1 / 0, 1 / 0, -1 / 0, -1 / 0]+ let x, v, S+ l.forEach(function (t, e, i) {+ ie(y, t.extent)+ })+ const E = 1 / r+ if (g && 1 === l.length && 0 === h) (x = l[0].texture), (v = l[0].width), (S = l[0].width)+ else {+ if (((x = t.createTexture()), null === m)) throw new Error("Could not create texture")+ ;(v = Math.round(ve(y) * E)), (S = Math.round(_e(y) * E))+ const e = t.getParameter(t.MAX_TEXTURE_SIZE),+ i = Math.max(v, S),+ n = i > e ? e / i : 1,+ r = Math.round(v * n),+ s = Math.round(S * n)+ t.bindTexture(t.TEXTURE_2D, x),+ t.texParameteri(t.TEXTURE_2D, t.TEXTURE_WRAP_S, t.CLAMP_TO_EDGE),+ t.texParameteri(t.TEXTURE_2D, t.TEXTURE_WRAP_T, t.CLAMP_TO_EDGE),+ d+ ? (t.texParameteri(t.TEXTURE_2D, t.TEXTURE_MIN_FILTER, t.LINEAR),+ t.texParameteri(t.TEXTURE_2D, t.TEXTURE_MAG_FILTER, t.LINEAR))+ : (t.texParameteri(t.TEXTURE_2D, t.TEXTURE_MIN_FILTER, t.NEAREST),+ t.texParameteri(t.TEXTURE_2D, t.TEXTURE_MAG_FILTER, t.NEAREST)),+ t.texImage2D(t.TEXTURE_2D, 0, t.RGBA, r, s, 0, t.RGBA, c, null)+ const o = t.createFramebuffer()+ t.bindFramebuffer(t.FRAMEBUFFER, o),+ t.framebufferTexture2D(t.FRAMEBUFFER, t.COLOR_ATTACHMENT0, t.TEXTURE_2D, x, 0)+ const a = new rg(t)+ l.forEach(function (e, i, l) {+ const c = (e.extent[0] - y[0]) * E * n,+ u = -(e.extent[3] - y[3]) * E * n,+ g = ve(e.extent) * E * n,+ f = _e(e.extent) * E * n+ if ((t.bindFramebuffer(t.FRAMEBUFFER, o), t.viewport(0, 0, r, s), e.clipExtent)) {+ const i = (e.clipExtent[0] - y[0]) * E * n,+ r = -(e.clipExtent[3] - y[3]) * E * n,+ s = ve(e.clipExtent) * E * n,+ o = _e(e.clipExtent) * E * n+ t.enable(t.SCISSOR_TEST),+ t.scissor(+ d ? i : Math.round(i),+ d ? r : Math.round(r),+ d ? s : Math.round(i + s) - Math.round(i),+ d ? o : Math.round(r + o) - Math.round(r)+ )+ }+ a.drawImage(+ e.texture,+ e.width,+ e.height,+ h,+ h,+ e.width - 2 * h,+ e.height - 2 * h,+ d ? c : Math.round(c),+ d ? u : Math.round(u),+ d ? g : Math.round(c + g) - Math.round(c),+ d ? f : Math.round(u + f) - Math.round(u),+ r,+ s+ ),+ t.disable(t.SCISSOR_TEST)+ }),+ t.deleteFramebuffer(o)+ }+ const w = ye(o),+ T = ye(y),+ C = (t) => {+ const e = ((t[0][0] - w[0]) / s) * n,+ i = (-(t[0][1] - w[1]) / s) * n+ return {+ u1: ((t[1][0] - w[0]) / s) * n,+ v1: (-(t[1][1] - w[1]) / s) * n,+ u0: e,+ v0: i,+ u2: ((t[2][0] - w[0]) / s) * n,+ v2: (-(t[2][1] - w[1]) / s) * n+ }+ }+ t.bindFramebuffer(t.FRAMEBUFFER, _), t.viewport(0, 0, f, p)+ {+ const e = [],+ i = [],+ n = og(+ t,+ "\n precision mediump float;\n\n varying vec2 v_texcoord;\n\n uniform sampler2D u_texture;\n\n void main() {\n if (v_texcoord.x < 0.0 || v_texcoord.x > 1.0 || v_texcoord.y < 0.0 || v_texcoord.y > 1.0) {\n discard;\n }\n gl_FragColor = texture2D(u_texture, v_texcoord);\n }\n",+ "\n attribute vec4 a_position;\n attribute vec2 a_texcoord;\n\n varying vec2 v_texcoord;\n\n uniform mat4 u_matrix;\n\n void main() {\n gl_Position = u_matrix * a_position;\n v_texcoord = a_texcoord;\n }\n"+ )+ t.useProgram(n)+ const s = t.getUniformLocation(n, "u_texture")+ t.bindTexture(t.TEXTURE_2D, x),+ t.uniform1i(s, 0),+ a.getTriangles().forEach(function (t, n, s) {+ const o = t.source,+ a = t.target,+ { u1: l, v1: h, u0: c, v0: u, u2: d, v2: g } = C(a),+ f = (o[0][0] - T[0]) / r / v,+ p = -(o[0][1] - T[1]) / r / S,+ _ = (o[1][0] - T[0]) / r / v,+ m = -(o[1][1] - T[1]) / r / S,+ y = (o[2][0] - T[0]) / r / v,+ x = -(o[2][1] - T[1]) / r / S+ e.push(l, h, c, u, d, g), i.push(_, m, f, p, y, x)+ })+ const o = tg(0, f, p, 0, -1, 1),+ l = t.getUniformLocation(n, "u_matrix")+ t.uniformMatrix4fv(l, !1, o)+ const h = t.getAttribLocation(n, "a_position"),+ c = t.createBuffer()+ t.bindBuffer(t.ARRAY_BUFFER, c),+ t.bufferData(t.ARRAY_BUFFER, new Float32Array(e), t.STATIC_DRAW),+ t.vertexAttribPointer(h, 2, t.FLOAT, !1, 0, 0),+ t.enableVertexAttribArray(h)+ const u = t.getAttribLocation(n, "a_texcoord"),+ d = t.createBuffer()+ t.bindBuffer(t.ARRAY_BUFFER, d),+ t.bufferData(t.ARRAY_BUFFER, new Float32Array(i), t.STATIC_DRAW),+ t.vertexAttribPointer(u, 2, t.FLOAT, !1, 0, 0),+ t.enableVertexAttribArray(u),+ t.drawArrays(t.TRIANGLES, 0, e.length / 2)+ }+ if (u) {+ const e = og(+ t,+ "\n precision mediump float;\n\n uniform vec4 u_val;\n void main() {\n gl_FragColor = u_val;\n }\n",+ "\n attribute vec4 a_position;\n\n uniform mat4 u_matrix;\n\n void main() {\n gl_Position = u_matrix * a_position;\n }\n"+ )+ t.useProgram(e)+ const i = tg(0, f, p, 0, -1, 1),+ n = t.getUniformLocation(e, "u_matrix")+ t.uniformMatrix4fv(n, !1, i)+ const r = Array.isArray(u) ? u : [0, 0, 0, 255],+ s = t.getUniformLocation(e, "u_val")+ t.uniform4fv(s, r)+ const o = t.getAttribLocation(e, "a_position"),+ l = t.createBuffer()+ t.bindBuffer(t.ARRAY_BUFFER, l), t.vertexAttribPointer(o, 2, t.FLOAT, !1, 0, 0), t.enableVertexAttribArray(o)+ const h = a.getTriangles().reduce(function (t, e) {+ const i = e.target,+ { u1: n, v1: r, u0: s, v0: o, u2: a, v2: l } = C(i)+ return t.concat([n, r, s, o, s, o, a, l, a, l, n, r])+ }, [])+ t.bufferData(t.ARRAY_BUFFER, new Float32Array(h), t.STATIC_DRAW), t.drawArrays(t.LINES, 0, h.length / 2)+ }+ return { width: f, height: p, framebuffer: _, texture: m }+ }+ class ug extends Lt {+ constructor(t) {+ super({+ tileCoord: t.tileCoord,+ loader: () => Promise.resolve(new Uint8ClampedArray(4)),+ interpolate: t.interpolate,+ transition: t.transition+ }),+ (this.renderEdges_ = void 0 !== t.renderEdges && t.renderEdges),+ (this.pixelRatio_ = t.pixelRatio),+ (this.gutter_ = t.gutter),+ (this.reprojData_ = null),+ (this.reprojError_ = null),+ (this.reprojSize_ = void 0),+ (this.sourceTileGrid_ = t.sourceTileGrid),+ (this.targetTileGrid_ = t.targetTileGrid),+ (this.wrappedTileCoord_ = t.wrappedTileCoord || t.tileCoord),+ (this.sourceTiles_ = []),+ (this.sourcesListenerKeys_ = null),+ (this.sourceZ_ = 0)+ const e = t.sourceProj,+ i = e.getExtent(),+ n = t.sourceTileGrid.getExtent()+ this.clipExtent_ = e.canWrapX() ? (n ? me(i, n) : i) : n+ const r = this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_),+ s = this.targetTileGrid_.getExtent()+ let o = this.sourceTileGrid_.getExtent()+ const a = s ? me(r, s) : r+ if (0 === he(a)) return void (this.state = J)+ i && (o = o ? me(o, i) : i)+ const l = this.targetTileGrid_.getResolution(this.wrappedTileCoord_[0]),+ h = t.targetProj,+ c = Mu(e, h, a, l)+ if (!isFinite(c) || c <= 0) return void (this.state = J)+ const u = void 0 !== t.errorThreshold ? t.errorThreshold : gd+ if (+ ((this.triangulation_ = new dd(e, h, a, o, c * u, l, t.transformMatrix)),+ 0 === this.triangulation_.getTriangles().length)+ )+ return void (this.state = J)+ this.sourceZ_ = this.sourceTileGrid_.getZForResolution(c)+ let d = this.triangulation_.calculateSourceExtent()+ if (+ (o && (e.canWrapX() ? ((d[1] = Ie(d[1], o[1], o[3])), (d[3] = Ie(d[3], o[1], o[3]))) : (d = me(d, o))), he(d))+ ) {+ let n = 0,+ r = 0+ e.canWrapX() && ((n = ve(i)), (r = Math.floor((d[0] - i[0]) / n)))+ Pe(d.slice(), e, !0).forEach((e) => {+ const i = this.sourceTileGrid_.getTileRangeForExtentAndZ(e, this.sourceZ_),+ s = t.getTileFunction+ for (let t = i.minX; t <= i.maxX; t++)+ for (let e = i.minY; e <= i.maxY; e++) {+ const i = s(this.sourceZ_, t, e, this.pixelRatio_)+ if (i) {+ const t = r * n+ this.sourceTiles_.push({ tile: i, offset: t })+ }+ }+ ++r+ }),+ 0 === this.sourceTiles_.length && (this.state = J)+ } else this.state = J+ }+ getSize() {+ return this.reprojSize_+ }+ getData() {+ return this.reprojData_+ }+ getError() {+ return this.reprojError_+ }+ reproject_() {+ const t = []+ let e = !1+ if (+ (this.sourceTiles_.forEach((i) => {+ const n = i.tile+ if (!n || n.getState() !== K) return+ const r = n.getSize(),+ s = this.gutter_+ let o+ const a = bt(n.getData())+ a ? (o = a) : ((e = !0), (o = It(Ct(n.getData()))))+ const l = [r[0] + 2 * s, r[1] + 2 * s],+ h = o instanceof Float32Array,+ c = l[0] * l[1],+ u = h ? Float32Array : Uint8ClampedArray,+ d = new u(o.buffer),+ g = u.BYTES_PER_ELEMENT,+ f = (g * d.length) / c,+ p = d.byteLength / l[1],+ _ = Math.floor(p / g / l[0]),+ m = this.sourceTileGrid_.getTileCoordExtent(n.tileCoord)+ ;(m[0] += i.offset), (m[2] += i.offset)+ const y = this.clipExtent_?.slice()+ y && ((y[0] += i.offset), (y[2] += i.offset)),+ t.push({ extent: m, clipExtent: y, data: d, dataType: u, bytesPerPixel: f, pixelSize: l, bandCount: _ })+ }),+ (this.sourceTiles_.length = 0),+ 0 === t.length)+ )+ return (this.state = q), void this.changed()+ const i = this.wrappedTileCoord_[0],+ n = this.targetTileGrid_.getTileSize(i),+ r = "number" == typeof n ? n : n[0],+ s = "number" == typeof n ? n : n[1],+ o = Math.round(r * this.pixelRatio_),+ a = Math.round(s * this.pixelRatio_),+ l = this.targetTileGrid_.getResolution(i),+ h = this.sourceTileGrid_.getResolution(this.sourceZ_),+ c = this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_),+ u = t[0].bandCount,+ d = new t[0].dataType(u * o * a),+ g = ag(o, a, hg, { premultipliedAlpha: !1, antialias: !1 })+ let f+ const p = g.RGBA+ let _+ if (t[0].dataType == Float32Array) {+ ;(_ = g.FLOAT),+ g.getExtension("WEBGL_color_buffer_float"),+ g.getExtension("OES_texture_float"),+ g.getExtension("EXT_float_blend")+ f = null !== g.getExtension("OES_texture_float_linear") && this.interpolate+ } else (_ = g.UNSIGNED_BYTE), (f = this.interpolate)+ for (let e = Math.ceil(u / 4) - 1; e >= 0; --e) {+ const i = []+ for (let n = 0, r = t.length; n < r; ++n) {+ const r = t[n],+ s = r.pixelSize,+ o = s[0],+ a = s[1],+ l = new r.dataType(4 * o * a),+ h = r.data+ let c = 4 * e+ for (let t = 0, e = l.length; t < e; t += 4)+ (l[t] = h[c]), (l[t + 1] = h[c + 1]), (l[t + 2] = h[c + 2]), (l[t + 3] = h[c + 3]), (c += u)+ const d = g.createTexture()+ g.bindTexture(g.TEXTURE_2D, d),+ f+ ? (g.texParameteri(g.TEXTURE_2D, g.TEXTURE_MIN_FILTER, g.LINEAR),+ g.texParameteri(g.TEXTURE_2D, g.TEXTURE_MAG_FILTER, g.LINEAR))+ : (g.texParameteri(g.TEXTURE_2D, g.TEXTURE_MIN_FILTER, g.NEAREST),+ g.texParameteri(g.TEXTURE_2D, g.TEXTURE_MAG_FILTER, g.NEAREST)),+ g.texParameteri(g.TEXTURE_2D, g.TEXTURE_WRAP_S, g.CLAMP_TO_EDGE),+ g.texParameteri(g.TEXTURE_2D, g.TEXTURE_WRAP_T, g.CLAMP_TO_EDGE),+ g.texImage2D(g.TEXTURE_2D, 0, p, o, a, 0, p, _, l),+ i.push({ extent: r.extent, clipExtent: r.clipExtent, texture: d, width: o, height: a })+ }+ const {+ framebuffer: n,+ width: o,+ height: a+ } = cg(g, r, s, this.pixelRatio_, h, l, c, this.triangulation_, i, this.gutter_, _, this.renderEdges_, f),+ m = o,+ y = 4 * a,+ x = new t[0].dataType(m * y)+ g.bindFramebuffer(g.FRAMEBUFFER, n), g.readPixels(0, 0, o, a, g.RGBA, _, x)+ let v = 4 * e+ for (let t = 0, e = x.length; t < e; t += 4) {+ const e = (m - 1 - ((t / y) | 0)) * y + (t % y)+ ;(d[v] = x[e]), (d[v + 1] = x[e + 1]), (d[v + 2] = x[e + 2]), (d[v + 3] = x[e + 3]), (v += u)+ }+ }+ if ((lg(g), hg.push(g.canvas), e)) {+ const t = ft(r, s),+ e = new ImageData(d, r)+ t.putImageData(e, 0, 0), (this.reprojData_ = t.canvas)+ } else this.reprojData_ = d+ ;(this.reprojSize_ = [o, a]), (this.state = K), this.changed()+ }+ load() {+ if (this.state !== Y && this.state !== q) return+ ;(this.state = H), this.changed()+ let t = 0+ ;(this.sourcesListenerKeys_ = []),+ this.sourceTiles_.forEach(({ tile: e }) => {+ const i = e.getState()+ if (i !== Y && i !== H) return+ t+++ const r = D(e, n, () => {+ const i = e.getState()+ ;(i != K && i != q && i != J) || (k(r), t--, 0 === t && (this.unlistenSources_(), this.reproject_()))+ })+ this.sourcesListenerKeys_.push(r)+ }),+ 0 === t+ ? setTimeout(this.reproject_.bind(this), 0)+ : this.sourceTiles_.forEach(function ({ tile: t }) {+ t.getState() == Y && t.load()+ })+ }+ unlistenSources_() {+ this.sourcesListenerKeys_.forEach(k), (this.sourcesListenerKeys_ = null)+ }+ }+ class dg extends md {+ constructor(t) {+ const e = void 0 === t.projection ? "EPSG:3857" : t.projection+ let i = t.tileGrid+ void 0 === i &&+ e &&+ (i = Ku({+ extent: Qu(e),+ maxResolution: t.maxResolution,+ maxZoom: t.maxZoom,+ minZoom: t.minZoom,+ tileSize: t.tileSize+ })),+ super({+ cacheSize: 0.1,+ attributions: t.attributions,+ attributionsCollapsible: t.attributionsCollapsible,+ projection: e,+ tileGrid: i,+ state: t.state,+ wrapX: t.wrapX,+ transition: t.transition,+ interpolate: t.interpolate,+ key: t.key,+ zDirection: t.zDirection+ }),+ (this.gutter_ = void 0 !== t.gutter ? t.gutter : 0),+ (this.tileSize_ = t.tileSize ? Wl(t.tileSize) : null),+ (this.tileSizes_ = null),+ (this.tileLoadingKeys_ = {}),+ (this.loader_ = t.loader),+ (this.handleTileChange_ = this.handleTileChange_.bind(this)),+ (this.bandCount = void 0 === t.bandCount ? 4 : t.bandCount),+ (this.tileGridForProjection_ = {}),+ (this.crossOrigin_ = t.crossOrigin || "anonymous"),+ (this.referrerPolicy_ = t.referrerPolicy),+ (this.transformMatrix = null)+ }+ setTileSizes(t) {+ this.tileSizes_ = t+ }+ getTileSize(t) {+ if (this.tileSizes_) return this.tileSizes_[t]+ if (this.tileSize_) return this.tileSize_+ const e = this.getTileGrid()+ return e ? Wl(e.getTileSize(t)) : [256, 256]+ }+ getGutterForProjection(t) {+ const e = this.getProjection()+ return (e && !Fn(e, t)) || this.transformMatrix ? 0 : this.gutter_+ }+ setLoader(t) {+ this.loader_ = t+ }+ getReprojTile_(t, e, i, n, r, s) {+ const o = this.tileGrid || this.getTileGridForProjection(r || n),+ a = Math.max.apply(+ null,+ o.getResolutions().map((t, e) => {+ const i = Wl(o.getTileSize(e)),+ n = this.getTileSize(e)+ return Math.max(n[0] / i[0], n[1] / i[1])+ })+ ),+ l = this.getTileGridForProjection(n),+ h = [t, e, i],+ c = this.getTileCoordForTileUrlFunction(h, n),+ u = Object.assign(+ {+ sourceProj: r || n,+ sourceTileGrid: o,+ targetProj: n,+ targetTileGrid: l,+ tileCoord: h,+ wrappedTileCoord: c,+ pixelRatio: a,+ gutter: this.gutter_,+ getTileFunction: (t, e, i, n) => this.getTile(t, e, i, n, void 0, s),+ transformMatrix: this.transformMatrix+ },+ this.tileOptions+ ),+ d = new ug(u)+ return (d.key = this.getKey()), d+ }+ getTile(t, e, i, r, s, o) {+ const a = this.getProjection()+ if (s && ((a && !Fn(a, s)) || this.transformMatrix)) return this.getReprojTile_(t, e, i, s, a, o)+ const l = this.getTileSize(t),+ h = this.loader_,+ c = new AbortController(),+ u = { signal: c.signal, crossOrigin: this.crossOrigin_, referrerPolicy: this.referrerPolicy_ },+ d = this.getTileCoordForTileUrlFunction([t, e, i])+ if (!d) return null+ const g = ju(this, this.getKey(), t, e, i)+ if (o && o.containsKey(g)) return o.get(g)+ const f = d[0],+ p = d[1],+ _ = d[2],+ m = this.getTileGrid()?.getFullTileRange(f)+ m && (u.maxY = m.getHeight() - 1)+ const y = Object.assign(+ {+ tileCoord: [t, e, i],+ loader: function () {+ return I(function () {+ return h(f, p, _, u)+ })+ },+ size: l,+ controller: c+ },+ this.tileOptions+ ),+ x = new Lt(y)+ return (x.key = this.getKey()), x.addEventListener(n, this.handleTileChange_), o?.set(g, x), x+ }+ handleTileChange_(t) {+ const e = t.target,+ i = z(e),+ n = e.getState()+ let r+ n == H+ ? ((this.tileLoadingKeys_[i] = !0), (r = xd))+ : i in this.tileLoadingKeys_ && (delete this.tileLoadingKeys_[i], (r = n == q ? Sd : n == K ? vd : void 0)),+ r && this.dispatchEvent(new yd(r, e))+ }+ getTileGridForProjection(t) {+ const e = this.getProjection()+ if (this.tileGrid && (!e || Fn(e, t)) && !this.transformMatrix) return this.tileGrid+ const i = z(t)+ return (+ i in this.tileGridForProjection_ || (this.tileGridForProjection_[i] = Zu(t)), this.tileGridForProjection_[i]+ )+ }+ setTileGridForProjection(t, e) {+ const i = En(t)+ if (i) {+ const t = z(i)+ t in this.tileGridForProjection_ || (this.tileGridForProjection_[t] = e)+ }+ }+ }+ function gg(t, e) {+ if (!t) return !1+ if (!0 === t) return !0+ if (3 !== e.getSamplesPerPixel()) return !1+ const i = e.fileDirectory.getValue("PhotometricInterpretation"),+ n = GeoTIFF.globals.photometricInterpretations+ return i === n.CMYK || i === n.YCbCr || i === n.CIELab || i === n.ICCLab+ }+ const fg = "STATISTICS_MAXIMUM",+ pg = "STATISTICS_MINIMUM"+ let _g+ function mg(t) {+ try {+ return t.getBoundingBox(!0)+ } catch {+ return [0, 0, t.getWidth(), t.getHeight()]+ }+ }+ function yg(t) {+ try {+ return t.getOrigin().slice(0, 2)+ } catch {+ return [0, t.getHeight()]+ }+ }+ function xg(t, e) {+ try {+ return t.getResolution(e)+ } catch {+ return [e.getWidth() / t.getWidth(), e.getHeight() / t.getHeight()]+ }+ }+ function vg(t) {+ const e = t.getGeoKeys()+ if (!e) return null+ if (e.ProjectedCSTypeGeoKey && 32767 !== e.ProjectedCSTypeGeoKey) {+ const t = "EPSG:" + e.ProjectedCSTypeGeoKey+ let i = En(t)+ if (!i) {+ const n = pi(e.ProjLinearUnitsGeoKey)+ n && (i = new mi({ code: t, units: n }))+ }+ return i+ }+ if (e.GeographicTypeGeoKey && 32767 !== e.GeographicTypeGeoKey) {+ const t = "EPSG:" + e.GeographicTypeGeoKey+ let i = En(t)+ if (!i) {+ const n = pi(e.GeogAngularUnitsGeoKey)+ n && (i = new mi({ code: t, units: n }))+ }+ return i+ }+ return null+ }+ function Sg(t) {+ return t.getImageCount().then(function (e) {+ const i = new Array(e)+ for (let n = 0; n < e; ++n) i[n] = t.getImage(n)+ return Promise.all(i)+ })+ }+ function Eg(t, e) {+ let i+ return (+ (i = t.blob+ ? GeoTIFF.fromBlob(t.blob)+ : t.overviews+ ? GeoTIFF.fromUrls(t.url, t.overviews, e)+ : GeoTIFF.fromUrl(t.url, e)),+ i.then(Sg)+ )+ }+ function wg(t, e, i, n, r) {+ if (Array.isArray(t)) {+ const s = t.length+ if (!Array.isArray(e) || s != e.length) {+ const t = new Error(n)+ throw (r(t), t)+ }+ for (let o = 0; o < s; ++o) wg(t[o], e[o], i, n, r)+ } else if (Math.abs(t - e) > i * t) throw new Error(n)+ }+ function Tg(t) {+ return t instanceof Int8Array+ ? 127+ : t instanceof Uint8Array || t instanceof Uint8ClampedArray+ ? 255+ : t instanceof Int16Array+ ? 32767+ : t instanceof Uint16Array+ ? 65535+ : t instanceof Int32Array+ ? 2147483647+ : t instanceof Uint32Array+ ? 4294967295+ : t instanceof Float32Array+ ? 34e37+ : 255+ }+ class Cg extends dg {+ constructor(t) {+ super({+ attributions: t.attributions,+ state: "loading",+ tileGrid: null,+ projection: t.projection || null,+ transition: t.transition,+ interpolate: !1 !== t.interpolate,+ wrapX: t.wrapX+ }),+ (this.sourceInfo_ = t.sources)+ const e = this.sourceInfo_.length+ ;(this.sourceOptions_ = t.sourceOptions),+ (this.sourceImagery_ = new Array(e)),+ (this.sourceMasks_ = new Array(e)),+ (this.resolutionFactors_ = new Array(e)),+ this.samplesPerPixel_,+ this.nodataValues_,+ this.metadata_,+ (this.normalize_ = !1 !== t.normalize),+ (this.addAlpha_ = !1),+ (this.error_ = null),+ (this.convertToRGB_ = t.convertToRGB || !1),+ this.setKey(this.sourceInfo_.map((t) => t.url).join(","))+ const i = this,+ n = new Array(e)+ for (let t = 0; t < e; ++t) n[t] = Eg(this.sourceInfo_[t], this.sourceOptions_)+ Promise.all(n)+ .then(function (t) {+ i.configure_(t)+ })+ .catch(function (t) {+ Ke(t), (i.error_ = t), i.setState("error")+ })+ }+ getError() {+ return this.error_+ }+ determineProjection(t) {+ const e = t[0]+ for (let t = e.length - 1; t >= 0; --t) {+ const i = vg(e[t])+ if (i) {+ this.projection = i+ break+ }+ }+ }+ determineTransformMatrix(t) {+ const e = t[0]+ for (let t = e.length - 1; t >= 0; --t) {+ const i = e[t].fileDirectory.getValue("ModelTransformation")+ if (i) {+ const [t, e, n, r, s, o, a, l] = i,+ h = Kn(Kn([1 / Math.sqrt(t * t + s * s), 0, 0, -1 / Math.sqrt(e * e + o * o), r, l], [t, s, e, o, 0, 0]), [+ 1,+ 0,+ 0,+ 1,+ -r,+ -l+ ])+ ;(this.transformMatrix = h), (this.addAlpha_ = !0)+ break+ }+ }+ }+ configure_(t) {+ let e, i, n, r, s+ const o = new Array(t.length),+ a = new Array(t.length),+ l = new Array(t.length)+ let h = 0+ const c = t.length+ for (let u = 0; u < c; ++u) {+ const c = [],+ d = []+ t[u].forEach((t) => {+ 4 & ~(t.fileDirectory.getValue("NewSubfileType") || 0) ? c.push(t) : d.push(t)+ })+ const g = c.length+ if (d.length > 0 && d.length !== g)+ throw new Error(`Expected one mask per image found ${d.length} masks and ${g} images`)+ let f, p+ const _ = new Array(g),+ m = new Array(g),+ y = new Array(g)+ ;(a[u] = new Array(g)), (l[u] = new Array(g))+ for (let t = 0; t < g; ++t) {+ const e = c[t],+ i = e.getGDALNoData()+ ;(l[u][t] = e.getGDALMetadata(0)), (a[u][t] = i)+ const n = this.sourceInfo_[u].bands+ o[u] = n ? n.length : e.getSamplesPerPixel()+ const r = g - (t + 1)+ f || (f = mg(e)), p || (p = yg(e))+ const s = xg(e, c[0])+ y[r] = s[0]+ const h = [e.getTileWidth(), e.getTileHeight()]+ h[0] !== h[1] && h[1] < 256 && ((h[0] = 256), (h[1] = 256)), (_[r] = h)+ const d = s[0] / Math.abs(s[1])+ m[r] = [h[0], h[1] / d]+ }+ if ((e ? me(e, f, e) : (e = f), i)) {+ wg(i, p, 0, `Origin mismatch for source ${u}, got [${p}] but expected [${i}]`, this.viewRejector)+ } else i = p+ if (s) {+ s.length - h > y.length && (h = s.length - y.length)+ const t = s[s.length - 1] / y[y.length - 1]+ this.resolutionFactors_[u] = t+ const e = y.map((e) => e * t),+ i = `Resolution mismatch for source ${u}, got [${e}] but expected [${s}]`+ wg(s.slice(h, s.length), e, 0.02, i, this.viewRejector)+ } else (s = y), (this.resolutionFactors_[u] = 1)+ n ? wg(n.slice(h, n.length), m, 0.01, `Tile size mismatch for source ${u}`, this.viewRejector) : (n = m),+ r ? wg(r.slice(h, r.length), _, 0, `Tile size mismatch for source ${u}`, this.viewRejector) : (r = _),+ (this.sourceImagery_[u] = c.reverse()),+ (this.sourceMasks_[u] = d.reverse())+ }+ for (let t = 0, e = this.sourceImagery_.length; t < e; ++t) {+ const e = this.sourceImagery_[t]+ for (; e.length < s.length; ) e.unshift(void 0)+ }+ this.getProjection() || this.determineProjection(t),+ this.determineTransformMatrix(t),+ (this.samplesPerPixel_ = o),+ (this.nodataValues_ = a),+ (this.metadata_ = l)+ t: for (let t = 0; t < c; ++t) {+ if (void 0 !== this.sourceInfo_[t].nodata) {+ this.addAlpha_ = !0+ break+ }+ if (this.sourceMasks_[t].length) {+ this.addAlpha_ = !0+ break+ }+ const e = a[t],+ i = this.sourceInfo_[t].bands+ if (i) {+ for (let t = 0; t < i.length; ++t)+ if (null !== e[i[t] - 1]) {+ this.addAlpha_ = !0+ break t+ }+ } else+ for (let t = 0; t < e.length; ++t)+ if (null !== e[t]) {+ this.addAlpha_ = !0+ break t+ }+ }+ let u = this.addAlpha_ ? 1 : 0+ for (let t = 0; t < c; ++t) u += o[t]+ this.bandCount = u+ const d = new Vu({ extent: e, minZoom: h, origin: i, resolutions: s, tileSizes: n })+ ;(this.tileGrid = d), this.setTileSizes(r), this.setLoader(this.loadTile_.bind(this)), this.setState("ready")+ 2 === s.length ? (s = [s[0], s[1], s[1] / 2]) : 1 === s.length && (s = [2 * s[0], s[0], s[0] / 2])+ let g = e+ if (this.transformMatrix) {+ const t = rr([1, 0, 0, 1, 0, 0], this.transformMatrix.slice())+ g = be(+ e,+ Rn((e) => Qn(t, e))+ )+ }+ this.viewResolver({+ showFullExtent: !0,+ projection: this.projection,+ resolutions: s,+ center: jn(de(g), this.projection),+ extent: Bn(g, this.projection),+ zoom: 1+ })+ }+ loadTile_(t, e, i, n) {+ const r = this.getTileSize(t),+ s = this.sourceImagery_.length,+ o = new Array(2 * s),+ a = this.nodataValues_,+ l = this.sourceInfo_,+ h = (_g || (_g = new GeoTIFF.Pool()), _g)+ for (let c = 0; c < s; ++c) {+ const u = l[c],+ d = this.resolutionFactors_[c],+ g = [+ Math.round(e * (r[0] * d)),+ Math.round(i * (r[1] * d)),+ Math.round((e + 1) * (r[0] * d)),+ Math.round((i + 1) * (r[1] * d))+ ],+ f = this.sourceImagery_[c][t]+ let p, _+ u.bands &&+ (p = u.bands.map(function (t) {+ return t - 1+ })),+ (_ =+ "nodata" in u && null !== u.nodata+ ? u.nodata+ : p+ ? p.map(function (t) {+ return a[c][t]+ })+ : a[c])+ const m = {+ window: g,+ width: r[0],+ height: r[1],+ samples: p,+ fillValue: _,+ pool: h,+ interleave: !1,+ signal: n.signal+ }+ gg(this.convertToRGB_, f) ? (o[c] = f.readRGB(m)) : (o[c] = f.readRasters(m))+ const y = s + c,+ x = this.sourceMasks_[c][t]+ x+ ? (o[y] = x.readRasters({ window: g, width: r[0], height: r[1], samples: [0], pool: h, interleave: !1 }))+ : (o[y] = Promise.resolve(null))+ }+ return Promise.all(o)+ .then(this.composeTile_.bind(this, r))+ .catch(function (t) {+ throw (Ke(t), t)+ })+ }+ async composeTile_(t, e) {+ const i = this.metadata_,+ n = this.sourceInfo_,+ r = this.sourceImagery_.length,+ s = this.bandCount,+ o = this.samplesPerPixel_,+ a = this.nodataValues_,+ l = this.normalize_,+ h = this.addAlpha_,+ c = t[0] * t[1],+ u = c * s+ let d+ d = l ? new Uint8Array(u) : new Float32Array(u)+ let g = 0+ for (let t = 0; t < c; ++t) {+ let s = h+ for (let c = 0; c < r; ++c) {+ const u = n[c]+ let p,+ _,+ m = u.min,+ y = u.max+ if (l) {+ const t = await i[c][0]+ void 0 === m &&+ (m =+ t && pg in t+ ? parseFloat(t[pg])+ : (f = e[c][0]) instanceof Int8Array+ ? -128+ : f instanceof Int16Array+ ? -32768+ : f instanceof Int32Array+ ? -2147483648+ : f instanceof Float32Array+ ? 12e-39+ : 0),+ void 0 === y && (y = t && fg in t ? parseFloat(t[fg]) : Tg(e[c][0])),+ (p = 255 / (y - m)),+ (_ = -m * p)+ }+ for (let i = 0; i < o[c]; ++i) {+ const n = e[c][i][t]+ let r+ if (((r = l ? Ie(p * n + _, 0, 255) : n), h)) {+ let t = u.nodata+ if (void 0 === t) {+ let e+ ;(e = u.bands ? u.bands[i] - 1 : i), (t = a[c][e])+ }+ const e = isNaN(t)+ ;((!e && n !== t) || (e && !isNaN(n))) && ((s = !1), (d[g] = r))+ } else d[g] = r+ g+++ }+ if (!s) {+ const i = e[r + c]+ i && !i[0][t] && (s = !0)+ }+ }+ h && (s || (d[g] = 255), g++)+ }+ var f+ return d+ }+ }+ Cg.prototype.getView+ const bg = "version1",+ Rg = "version2",+ Pg = "version3",+ Ig = {}+ ;(Ig[bg] = {+ level0: { supports: [], formats: [], qualities: ["native"] },+ level1: { supports: ["regionByPx", "sizeByW", "sizeByH", "sizeByPct"], formats: ["jpg"], qualities: ["native"] },+ level2: {+ supports: ["regionByPx", "regionByPct", "sizeByW", "sizeByH", "sizeByPct", "sizeByConfinedWh", "sizeByWh"],+ formats: ["jpg", "png"],+ qualities: ["native", "color", "grey", "bitonal"]+ }+ }),+ (Ig[Rg] = {+ level0: { supports: [], formats: ["jpg"], qualities: ["default"] },+ level1: { supports: ["regionByPx", "sizeByW", "sizeByH", "sizeByPct"], formats: ["jpg"], qualities: ["default"] },+ level2: {+ supports: [+ "regionByPx",+ "regionByPct",+ "sizeByW",+ "sizeByH",+ "sizeByPct",+ "sizeByConfinedWh",+ "sizeByDistortedWh",+ "sizeByWh"+ ],+ formats: ["jpg", "png"],+ qualities: ["default", "bitonal"]+ }+ }),+ (Ig[Pg] = {+ level0: { supports: [], formats: ["jpg"], qualities: ["default"] },+ level1: {+ supports: ["regionByPx", "regionSquare", "sizeByW", "sizeByH", "sizeByWh"],+ formats: ["jpg"],+ qualities: ["default"]+ },+ level2: {+ supports: [+ "regionByPx",+ "regionSquare",+ "regionByPct",+ "sizeByW",+ "sizeByH",+ "sizeByPct",+ "sizeByConfinedWh",+ "sizeByWh"+ ],+ formats: ["jpg", "png"],+ qualities: ["default"]+ }+ }),+ (Ig.none = { none: { supports: [], formats: [], qualities: [] } })+ const Fg = /^https?:\/\/library\.stanford\.edu\/iiif\/image-api\/(?:1\.1\/)?compliance\.html#level[0-2]$/,+ Lg = /^https?:\/\/iiif\.io\/api\/image\/2\/level[0-2](?:\.json)?$/,+ Mg = /(^https?:\/\/iiif\.io\/api\/image\/3\/level[0-2](?:\.json)?$)|(^level[0-2]$)/+ const Ag = {}+ ;(Ag[bg] = function (t) {+ let e = t.getComplianceLevelSupportedFeatures()+ return (+ void 0 === e && (e = Ig[bg].level0),+ {+ url: void 0 === t.imageInfo["@id"] ? void 0 : t.imageInfo["@id"].replace(/\/?(?:info\.json)?$/g, ""),+ supports: e.supports,+ formats: [...e.formats, void 0 === t.imageInfo.formats ? [] : t.imageInfo.formats],+ qualities: [...e.qualities, void 0 === t.imageInfo.qualities ? [] : t.imageInfo.qualities],+ resolutions: t.imageInfo.scale_factors,+ tileSize:+ void 0 !== t.imageInfo.tile_width+ ? void 0 !== t.imageInfo.tile_height+ ? [t.imageInfo.tile_width, t.imageInfo.tile_height]+ : [t.imageInfo.tile_width, t.imageInfo.tile_width]+ : null != t.imageInfo.tile_height+ ? [t.imageInfo.tile_height, t.imageInfo.tile_height]+ : void 0+ }+ )+ }),+ (Ag[Rg] = function (t) {+ const e = t.getComplianceLevelSupportedFeatures(),+ i = Array.isArray(t.imageInfo.profile) && t.imageInfo.profile.length > 1,+ n = i && t.imageInfo.profile[1].supports ? t.imageInfo.profile[1].supports : [],+ r = i && t.imageInfo.profile[1].formats ? t.imageInfo.profile[1].formats : [],+ s = i && t.imageInfo.profile[1].qualities ? t.imageInfo.profile[1].qualities : []+ return {+ url: t.imageInfo["@id"].replace(/\/?(?:info\.json)?$/g, ""),+ sizes:+ void 0 === t.imageInfo.sizes+ ? void 0+ : t.imageInfo.sizes.map(function (t) {+ return [t.width, t.height]+ }),+ tileSize:+ void 0 === t.imageInfo.tiles+ ? void 0+ : [+ t.imageInfo.tiles.map(function (t) {+ return t.width+ })[0],+ t.imageInfo.tiles.map(function (t) {+ return void 0 === t.height ? t.width : t.height+ })[0]+ ],+ resolutions:+ void 0 === t.imageInfo.tiles+ ? void 0+ : t.imageInfo.tiles.map(function (t) {+ return t.scaleFactors+ })[0],+ supports: [...e.supports, ...n],+ formats: [...e.formats, ...r],+ qualities: [...e.qualities, ...s]+ }+ }),+ (Ag[Pg] = function (t) {+ const e = t.getComplianceLevelSupportedFeatures(),+ i = void 0 === t.imageInfo.extraFormats ? e.formats : [...e.formats, ...t.imageInfo.extraFormats],+ n =+ void 0 !== t.imageInfo.preferredFormats &&+ Array.isArray(t.imageInfo.preferredFormats) &&+ t.imageInfo.preferredFormats.length > 0+ ? t.imageInfo.preferredFormats+ .filter(function (t) {+ return ["jpg", "png", "gif"].includes(t)+ })+ .reduce(function (t, e) {+ return void 0 === t && i.includes(e) ? e : t+ }, void 0)+ : void 0+ return {+ url: t.imageInfo.id,+ sizes:+ void 0 === t.imageInfo.sizes+ ? void 0+ : t.imageInfo.sizes.map(function (t) {+ return [t.width, t.height]+ }),+ tileSize:+ void 0 === t.imageInfo.tiles+ ? void 0+ : [+ t.imageInfo.tiles.map(function (t) {+ return t.width+ })[0],+ t.imageInfo.tiles.map(function (t) {+ return t.height+ })[0]+ ],+ resolutions:+ void 0 === t.imageInfo.tiles+ ? void 0+ : t.imageInfo.tiles.map(function (t) {+ return t.scaleFactors+ })[0],+ supports: void 0 === t.imageInfo.extraFeatures ? e.supports : [...e.supports, ...t.imageInfo.extraFeatures],+ formats: i,+ qualities:+ void 0 === t.imageInfo.extraQualities ? e.qualities : [...e.qualities, ...t.imageInfo.extraQualities],+ preferredFormat: n+ }+ })+ let Og = class extends Bs {+ constructor(t, e, i, n, r, s, o) {+ super(e, i, n, r, s, o), (this.zoomifyImage_ = null), (this.tileSize_ = t)+ }+ getImage() {+ if (this.zoomifyImage_) return this.zoomifyImage_+ const t = super.getImage()+ if (this.state == K) {+ const e = this.tileSize_+ if (t.width == e[0] && t.height == e[1]) return (this.zoomifyImage_ = t), t+ const i = ft(e[0], e[1])+ return i.drawImage(t, 0, 0), (this.zoomifyImage_ = i.canvas), i.canvas+ }+ return t+ }+ }+ function Dg(t) {+ return t.toLocaleString("en", { maximumFractionDigits: 10 })+ }+ class Ng extends Ds {+ constructor(t, e, i, n, r, s, o) {+ let a = t.getExtent()+ a && t.canWrapX() && ((a = a.slice()), (a[0] = -1 / 0), (a[2] = 1 / 0))+ let l = e.getExtent()+ l && e.canWrapX() && ((l = l.slice()), (l[0] = -1 / 0), (l[2] = 1 / 0))+ const h = l ? me(i, l) : i,+ c = Lu(t, e, de(h), n),+ u = new dd(t, e, h, a, 0.5 * c, n),+ d = u.calculateSourceExtent(),+ g = Ee(d) ? null : s(d, c, r),+ f = g ? Fs : Os,+ p = g ? g.getPixelRatio() : 1+ super(i, n, p, f),+ (this.targetProj_ = e),+ (this.maxSourceExtent_ = a),+ (this.triangulation_ = u),+ (this.targetResolution_ = n),+ (this.targetExtent_ = i),+ (this.sourceImage_ = g),+ (this.sourcePixelRatio_ = p),+ (this.interpolate_ = o),+ (this.canvas_ = null),+ (this.sourceListenerKey_ = null)+ }+ disposeInternal() {+ this.state == Ls && this.unlistenSource_(), super.disposeInternal()+ }+ getImage() {+ return this.canvas_+ }+ getProjection() {+ return this.targetProj_+ }+ reproject_() {+ const t = this.sourceImage_.getState()+ if (t == Ms) {+ const t = ve(this.targetExtent_) / this.targetResolution_,+ e = _e(this.targetExtent_) / this.targetResolution_+ this.canvas_ = Au(+ t,+ e,+ this.sourcePixelRatio_,+ Ou(this.sourceImage_.getResolution()),+ this.maxSourceExtent_,+ this.targetResolution_,+ this.targetExtent_,+ this.triangulation_,+ [{ extent: this.sourceImage_.getExtent(), image: this.sourceImage_.getImage() }],+ 0,+ void 0,+ this.interpolate_,+ !0+ )+ }+ ;(this.state = t), this.changed()+ }+ load() {+ if (this.state == Fs) {+ ;(this.state = Ls), this.changed()+ const t = this.sourceImage_.getState()+ t == Ms || t == As+ ? this.reproject_()+ : ((this.sourceListenerKey_ = D(this.sourceImage_, n, (t) => {+ const e = this.sourceImage_.getState()+ ;(e != Ms && e != As) || (this.unlistenSource_(), this.reproject_())+ })),+ this.sourceImage_.load())+ }+ }+ unlistenSource_() {+ k(this.sourceListenerKey_), (this.sourceListenerKey_ = null)+ }+ }+ const kg = "imageloadstart",+ Gg = "imageloadend",+ jg = "imageloaderror"+ class Ug extends M {+ constructor(t, e) {+ super(t), (this.image = e)+ }+ }+ class Bg extends pd {+ constructor(t) {+ super({+ attributions: t.attributions,+ projection: t.projection,+ state: t.state,+ interpolate: void 0 === t.interpolate || t.interpolate+ }),+ this.on,+ this.once,+ this.un,+ (this.loader = t.loader || null),+ (this.resolutions_ = void 0 !== t.resolutions ? t.resolutions : null),+ (this.reprojectedImage_ = null),+ (this.reprojectedRevision_ = 0),+ (this.image = null),+ this.wantedExtent_,+ this.wantedResolution_,+ (this.static_ = !!t.loader && 0 === t.loader.length),+ (this.wantedProjection_ = null)+ }+ getResolutions() {+ return this.resolutions_+ }+ setResolutions(t) {+ this.resolutions_ = t+ }+ findNearestResolution(t) {+ const e = this.getResolutions()+ if (e) {+ t = e[v(e, t, 0)]+ }+ return t+ }+ getImage(t, e, i, n) {+ const r = this.getProjection()+ if (!r || !n || Fn(r, n)) return r && (n = r), this.getImageInternal(t, e, i, n)+ if (this.reprojectedImage_) {+ if (+ this.reprojectedRevision_ == this.getRevision() &&+ Fn(this.reprojectedImage_.getProjection(), n) &&+ this.reprojectedImage_.getResolution() == e &&+ te(this.reprojectedImage_.getExtent(), t)+ )+ return this.reprojectedImage_+ this.reprojectedImage_.dispose(), (this.reprojectedImage_ = null)+ }+ return (+ (this.reprojectedImage_ = new Ng(+ r,+ n,+ t,+ e,+ i,+ (t, e, i) => this.getImageInternal(t, e, i, r),+ this.getInterpolate()+ )),+ (this.reprojectedRevision_ = this.getRevision()),+ this.reprojectedImage_+ )+ }+ getImageInternal(t, e, i, r) {+ if (this.loader) {+ const s = Xg(t, e, i, 1),+ o = this.findNearestResolution(e)+ if (+ this.image &&+ (this.static_ ||+ (this.wantedProjection_ === r &&+ ((this.wantedExtent_ && Wt(this.wantedExtent_, s)) || Wt(this.image.getExtent(), s)) &&+ ((this.wantedResolution_ && Ou(this.wantedResolution_) === o) || Ou(this.image.getResolution()) === o)))+ )+ return this.image+ ;(this.wantedProjection_ = r),+ (this.wantedExtent_ = s),+ (this.wantedResolution_ = o),+ (this.image = new Ds(s, o, i, this.loader)),+ this.image.addEventListener(n, this.handleImageChange.bind(this))+ }+ return this.image+ }+ handleImageChange(t) {+ const e = t.target+ let i+ switch (e.getState()) {+ case Ls:+ ;(this.loading = !0), (i = kg)+ break+ case Ms:+ ;(this.loading = !1), (i = Gg)+ break+ case As:+ ;(this.loading = !1), (i = jg)+ break+ default:+ return+ }+ this.hasListener(i) && this.dispatchEvent(new Ug(i, e))+ }+ }+ function zg(t, e) {+ t.getImage().src = e+ }+ function Xg(t, e, i, n) {+ const r = e / i,+ s = de(t),+ o = Ue(ve(t) / r, 4),+ a = Ue(_e(t) / r, 4)+ return fe(s, r, 0, [o + 2 * Ue(((n - 1) * o) / 2, 4), a + 2 * Ue(((n - 1) * a) / 2, 4)])+ }+ function Vg(t, e, i, n, r, s) {+ const o = r+ .getCode()+ .split(/:(?=\d+$)/)+ .pop(),+ a = i / n,+ l = [Ge(ve(e) / a, 4), Ge(_e(e) / a, 4)]+ ;(s.SIZE = l[0] + "," + l[1]),+ (s.BBOX = e.join(",")),+ (s.BBOXSR = o),+ (s.IMAGESR = o),+ (s.DPI = Math.round(s.DPI ? s.DPI * n : 90 * n))+ return td(t.replace(/MapServer\/?$/, "MapServer/export").replace(/ImageServer\/?$/, "ImageServer/exportImage"), s)+ }+ function $g(t) {+ const e = t.load ? t.load : js,+ i = En(t.projection || "EPSG:3857"),+ n = t.ratio ?? 1.5,+ r = t.crossOrigin ?? null,+ s = t.referrerPolicy+ return function (o, a, l) {+ l = t.hidpi ? l : 1+ const h = { F: "image", FORMAT: "PNG32", TRANSPARENT: !0 }+ Object.assign(h, t.params), (o = Xg(o, a, l, n))+ const c = Vg(t.url, o, a, l, i, h),+ u = new Image()+ return (+ (u.crossOrigin = r),+ void 0 !== s && (u.referrerPolicy = s),+ e(u, c).then((t) => {+ const e = (ve(o) / t.width) * l+ return { image: t, extent: o, resolution: e, pixelRatio: l }+ })+ )+ }+ }+ function Wg(t, e, i, n, r, s, o) {+ const a = (function (t, e, i, n) {+ const r = ve(t),+ s = _e(t),+ o = e[0],+ a = e[1],+ l = 0.0254 / n+ return a * r > o * s ? (r * i) / (o * l) : (s * i) / (a * l)+ })(i, n, s, o),+ l = de(i),+ h = {+ OPERATION: r ? "GETDYNAMICMAPOVERLAYIMAGE" : "GETMAPIMAGE",+ VERSION: "2.0.0",+ LOCALE: "en",+ CLIENTAGENT: "ol/source/ImageMapGuide source",+ CLIP: "1",+ SETDISPLAYDPI: o,+ SETDISPLAYWIDTH: Math.round(n[0]),+ SETDISPLAYHEIGHT: Math.round(n[1]),+ SETVIEWSCALE: a,+ SETVIEWCENTERX: l[0],+ SETVIEWCENTERY: l[1]+ }+ return Object.assign(h, e), td(t, h)+ }+ function Zg(t) {+ const e = t.load || js,+ i = t.useOverlay ?? !1,+ n = t.metersPerUnit || 1,+ r = t.displayDpi || 96,+ s = t.ratio ?? 1,+ o = t.crossOrigin ?? null,+ a = t.referrerPolicy+ return function (l, h, c) {+ const u = new Image()+ ;(u.crossOrigin = o), void 0 !== a && (u.referrerPolicy = a)+ const d = ve((l = Xg(l, h, c, s))) / h,+ g = _e(l) / h,+ f = [d * c, g * c],+ p = Wg(t.url, t.params, l, f, i, n, r)+ return e(u, p).then((t) => ({ image: t, extent: l, pixelRatio: c }))+ }+ }+ function Yg(t) {+ const e = t.load || js,+ i = t.imageExtent,+ n = t.crossOrigin ?? null+ return () => {+ const r = new Image()+ return (+ (r.crossOrigin = n),+ void 0 !== t.referrerPolicy && (r.referrerPolicy = t.referrerPolicy),+ e(r, t.url).then((t) => {+ const e = ve(i) / t.width,+ n = _e(i) / t.height+ return { image: t, extent: i, resolution: e !== n ? [e, n] : n, pixelRatio: 1 }+ })+ )+ }+ }+ const Hg = new Error("Image failed to load")+ function Kg(t, e, i, n, r) {+ return new Promise((s, o) => {+ const a = new Image()+ ;(a.crossOrigin = r.crossOrigin ?? null),+ void 0 !== r.referrerPolicy && (a.referrerPolicy = r.referrerPolicy),+ a.addEventListener("load", () => s(a)),+ a.addEventListener("error", () => o(Hg)),+ (a.src = sd(t, e, i, n, r.maxY))+ })+ }+ function qg(t) {+ return function (e, i, n, r) {+ return Kg(od(t, e, i, n), e, i, n, r)+ }+ }+ function Jg(t) {+ let e+ if (Array.isArray(t)) e = qg(t)+ else if ("string" == typeof t) {+ e = qg(ad(t))+ } else {+ if ("function" != typeof t)+ throw new Error(+ "The url option must be a single template, an array of templates, or a function for getting a URL"+ )+ ;(i = t),+ (e = function (t, e, n, r) {+ return Kg(i(t, e, n, r), t, e, n, r)+ })+ }+ var i+ return e+ }+ let Qg = 0+ function tf(t) {+ return Array.isArray(t) ? t.join("\n") : "string" == typeof t ? t : (++Qg, "url-function-key-" + Qg)+ }+ class ef extends dg {+ constructor(t) {+ let e,+ i = (t = t || {}).loader+ t.url && ((i = Jg(t.url)), (e = tf(t.url)))+ const n = i ? t.state : "loading",+ r = void 0 === t.wrapX || t.wrapX+ super({+ loader: i,+ key: e,+ attributions: t.attributions,+ attributionsCollapsible: t.attributionsCollapsible,+ maxZoom: t.maxZoom,+ minZoom: t.minZoom,+ tileSize: t.tileSize,+ gutter: t.gutter,+ maxResolution: t.maxResolution,+ projection: t.projection,+ tileGrid: t.tileGrid,+ state: n,+ wrapX: r,+ transition: t.transition,+ interpolate: !1 !== t.interpolate,+ crossOrigin: t.crossOrigin,+ referrerPolicy: t.referrerPolicy,+ zDirection: t.zDirection+ })+ }+ setUrl(t) {+ const e = Jg(t)+ this.setLoader(e), this.setKey(tf(t)), "ready" !== this.getState() && this.setState("ready")+ }+ }+ const nf = "1.3.0",+ rf = [101, 101]+ function sf(t, e, i, n, r) {+ ;(r.WIDTH = i[0]), (r.HEIGHT = i[1])+ const s = n.getAxisOrientation(),+ o = Je(r.VERSION, "1.3") >= 0+ r[o ? "CRS" : "SRS"] = n.getCode()+ const a = o && s.startsWith("ne") ? [e[1], e[0], e[3], e[2]] : e+ return (r.BBOX = a.join(",")), td(t, r)+ }+ function of(t, e, i, n, r, s, o) {+ s = Object.assign({ REQUEST: "GetMap" }, s)+ const a = e / i,+ l = [Ge(ve(t) / a, 4), Ge(_e(t) / a, 4)]+ if (1 != i)+ switch (o) {+ case "geoserver":+ const t = (90 * i + 0.5) | 0+ "FORMAT_OPTIONS" in s ? (s.FORMAT_OPTIONS += ";dpi:" + t) : (s.FORMAT_OPTIONS = "dpi:" + t)+ break+ case "mapserver":+ s.MAP_RESOLUTION = 90 * i+ break+ case "carmentaserver":+ case "qgis":+ s.DPI = 90 * i+ break+ default:+ throw new Error("Unknown `serverType` configured")+ }+ return sf(r, t, l, n, s)+ }+ function af(t, e) {+ return Object.assign(+ { REQUEST: e, SERVICE: "WMS", VERSION: nf, FORMAT: "image/png", STYLES: "", TRANSPARENT: "TRUE" },+ t+ )+ }+ function lf(t) {+ const e = void 0 === t.hidpi || t.hidpi,+ i = En(t.projection || "EPSG:3857"),+ n = t.ratio || 1.5,+ r = t.load || js,+ s = t.crossOrigin ?? null,+ o = t.referrerPolicy+ return (a, l, h) => {+ ;(a = Xg(a, l, h, n)), 1 == h || (e && void 0 !== t.serverType) || (h = 1)+ const c = of(a, l, h, i, t.url, af(t.params, "GetMap"), t.serverType),+ u = new Image()+ return (+ (u.crossOrigin = s),+ void 0 !== o && (u.referrerPolicy = o),+ r(u, c).then((t) => ({ image: t, extent: a, pixelRatio: h }))+ )+ }+ }+ function hf(t, e, i) {+ if (void 0 === t.url) return+ const n = En(t.projection || "EPSG:3857"),+ r = fe(e, i, 0, rf),+ s = { QUERY_LAYERS: t.params.LAYERS, INFO_FORMAT: "application/json" }+ Object.assign(s, af(t.params, "GetFeatureInfo"), t.params)+ const o = je((e[0] - r[0]) / i, 4),+ a = je((r[3] - e[1]) / i, 4),+ l = Je(s.VERSION, "1.3") >= 0+ return (s[l ? "I" : "X"] = o), (s[l ? "J" : "Y"] = a), sf(t.url, r, rf, n, s)+ }+ function cf(t, e) {+ if (void 0 === t.url) return+ const i = { SERVICE: "WMS", VERSION: nf, REQUEST: "GetLegendGraphic", FORMAT: "image/png" }+ if (void 0 !== e) {+ const n = En(t.projection || "EPSG:3857").getMetersPerUnit() || 1,+ r = 28e-5+ i.SCALE = (e * n) / r+ }+ if ((Object.assign(i, t.params), void 0 !== t.params && void 0 === i.LAYER)) {+ const t = i.LAYERS+ if (!(!Array.isArray(t) || 1 !== t.length)) return+ i.LAYER = t+ }+ return td(t.url, i)+ }+ const uf = { "image/png": !0, "image/jpeg": !0, "image/gif": !0, "image/webp": !0 },+ df = { "application/vnd.mapbox-vector-tile": !0, "application/geo+json": !0 }+ function gf(t, e) {+ if (!e.length) return t+ const i = new URL(t, "file:/")+ if (i.pathname.split("/").includes("collections"))+ return Ke('The "collections" query parameter cannot be added to collection endpoints'), t+ const n = e.map((t) => encodeURIComponent(t)).join(",")+ i.searchParams.append("collections", n)+ return `${t.split("?")[0]}?${decodeURIComponent(i.searchParams.toString())}`+ }+ function ff(t, e, i) {+ let n, r+ for (let i = 0; i < t.length; ++i) {+ const s = t[i]+ if ("item" === s.rel) {+ if (s.type === e) {+ n = s.href+ break+ }+ ;(uf[s.type] || (!r && s.type.startsWith("image/"))) && (r = s.href)+ }+ }+ if (!n) {+ if (!r) throw new Error('Could not find "item" link')+ n = r+ }+ return i && (n = gf(n, i)), n+ }+ function pf(t, e, i, n) {+ let r, s+ const o = {}+ for (let i = 0; i < t.length; ++i) {+ const n = t[i]+ if (((o[n.type] = n.href), "item" === n.rel)) {+ if (n.type === e) {+ r = n.href+ break+ }+ df[n.type] && (s = n.href)+ }+ }+ if (!r && i)+ for (let t = 0; t < i.length; ++t) {+ const e = i[t]+ if (o[e]) {+ r = o[e]+ break+ }+ }+ if (!r) {+ if (!s) throw new Error('Could not find "item" link')+ r = s+ }+ return n && (r = gf(r, n)), r+ }+ function _f(t, e, i, n) {+ let r = t.projection+ if (!r && ("string" == typeof e.crs ? (r = En(e.crs)) : "uri" in e.crs && (r = En(e.crs.uri)), !r))+ throw new Error(`Unsupported CRS: ${JSON.stringify(e.crs)}`)+ const s = e.orderedAxes,+ o = !(+ s+ ? s+ .slice(0, 2)+ .map((t) => t.replace(/E|X|Lon/i, "e").replace(/N|Y|Lat/i, "n"))+ .join("")+ : r.getAxisOrientation()+ ).startsWith("en"),+ a = e.tileMatrices.sort(function (t, e) {+ return e.cellSize - t.cellSize+ }),+ l = {}+ for (let t = 0; t < a.length; ++t) {+ const e = a[t]+ l[e.id] = e+ }+ const h = {},+ c = []+ if (n)+ for (let t = 0; t < n.length; ++t) {+ const e = n[t],+ i = e.tileMatrix,+ r = l[i],+ s = a.indexOf(r)+ ;(c[s] = i), (h[i] = e)+ }+ else+ for (let t = 0; t < a.length; ++t) {+ const e = a[t].id+ c.push(e)+ }+ const u = c.length,+ d = new Array(u),+ g = new Array(u),+ f = new Array(u),+ p = new Array(u),+ _ = [-1 / 0, -1 / 0, 1 / 0, 1 / 0]+ for (let t = 0; t < u; ++t) {+ const e = c[t],+ i = l[e],+ n = i.pointOfOrigin+ ;(d[t] = o ? [n[1], n[0]] : n),+ (g[t] = i.cellSize),+ (f[t] = [i.matrixWidth, i.matrixHeight]),+ (p[t] = [i.tileWidth, i.tileHeight])+ const r = h[e]+ if (r) {+ const e = i.cellSize * i.tileWidth,+ n = d[t][0] + r.minTileCol * e,+ s = d[t][0] + (r.maxTileCol + 1) * e,+ o = i.cellSize * i.tileHeight+ let a, l+ "bottomLeft" === i.cornerOfOrigin+ ? ((a = d[t][1] + r.minTileRow * o), (l = d[t][1] + (r.maxTileRow + 1) * o))+ : ((a = d[t][1] - (r.maxTileRow + 1) * o), (l = d[t][1] - r.minTileRow * o)),+ me(_, [n, a, s, l], _)+ }+ }+ const m = new $u({ origins: d, resolutions: g, sizes: f, tileSizes: p, extent: n ? _ : void 0, matrixIds: c })+ if (!i) return { grid: m, projection: r }+ const y = t.context,+ x = t.url+ return {+ grid: m,+ projection: r,+ urlTemplate: i,+ urlFunction: function (t, e, r) {+ if (!t) return+ const s = c[t[0]],+ o = l[s],+ a = "bottomLeft" === o.cornerOfOrigin,+ u = { tileMatrix: s, tileCol: t[1], tileRow: a ? -t[2] - 1 : t[2] }+ if (n) {+ const t = h[o.id]+ if (+ u.tileCol < t.minTileCol ||+ u.tileCol > t.maxTileCol ||+ u.tileRow < t.minTileRow ||+ u.tileRow > t.maxTileRow+ )+ return+ }+ Object.assign(u, { z: u.tileMatrix, x: u.tileCol, y: u.tileRow }, y)+ const d = i.replace(/\{(\w+?)\}/g, function (t, e) {+ return u[e]+ })+ return _u(x, d)+ }+ }+ }+ function mf(t) {+ return pu(t.url).then(function (e) {+ return (function (t, e) {+ const i = e.tileMatrixSetLimits+ let n+ if ("map" === e.dataType) n = ff(e.links, t.mediaType, t.collections)+ else {+ if ("vector" !== e.dataType) throw new Error('Expected tileset data type to be "map" or "vector"')+ n = pf(e.links, t.mediaType, t.supportedMediaTypes, t.collections)+ }+ if (e.tileMatrixSet) return _f(t, e.tileMatrixSet, n, i)+ const r = e.links.find((t) => "http://www.opengis.net/def/rel/ogc/1.0/tiling-scheme" === t.rel)+ if (!r) throw new Error("Expected http://www.opengis.net/def/rel/ogc/1.0/tiling-scheme link or tileMatrixSet")+ const s = r.href+ return pu(_u(t.url, s)).then(function (e) {+ return _f(t, e, n, i)+ })+ })(t, e)+ })+ }+ class yf extends Ed {+ constructor(t) {+ const e = t.projection || "EPSG:3857",+ i = t.extent || Qu(e),+ n =+ t.tileGrid ||+ Ku({+ extent: i,+ maxResolution: t.maxResolution,+ maxZoom: void 0 !== t.maxZoom ? t.maxZoom : 22,+ minZoom: t.minZoom,+ tileSize: t.tileSize || 512+ })+ super({+ attributions: t.attributions,+ attributionsCollapsible: t.attributionsCollapsible,+ cacheSize: t.cacheSize,+ interpolate: !0,+ projection: e,+ state: t.state,+ tileGrid: n,+ tileLoadFunction: t.tileLoadFunction ? t.tileLoadFunction : xf,+ tileUrlFunction: t.tileUrlFunction,+ url: t.url,+ urls: t.urls,+ wrapX: void 0 === t.wrapX || t.wrapX,+ transition: t.transition,+ zDirection: void 0 === t.zDirection ? 1 : t.zDirection+ }),+ (this.format_ = t.format ? t.format : null),+ (this.tileKeysBySourceTileUrl_ = {}),+ (this.sourceTiles_ = {}),+ (this.overlaps_ = null == t.overlaps || t.overlaps),+ (this.tileClass = t.tileClass ? t.tileClass : au),+ (this.tileGrids_ = {})+ }+ getOverlaps() {+ return this.overlaps_+ }+ getSourceTiles(t, e, i) {+ if (i.getState() === Y) {+ i.setState(H)+ const r = i.wrappedTileCoord,+ s = this.getTileGridForProjection(e)+ let o = s.getTileCoordExtent(r)+ const a = r[0],+ l = s.getResolution(a)+ zt(o, -l, o)+ const h = this.projection+ e && this.projection && !Fn(e, h) && (o = Dn(o, e, h))+ const c = this.tileGrid,+ u = c.getExtent()+ u && me(o, u, o)+ let d = l+ e && h && !Fn(e, h) && (d = l / h.getMetersPerUnit() / e.getMetersPerUnit())+ const g = c.getZForResolution(d, this.zDirection)+ c.forEachTileCoord(o, g, (r) => {+ const s = this.tileUrlFunction(r, t, e)+ this.sourceTiles_[s] ||+ (this.sourceTiles_[s] = new this.tileClass(r, s ? Y : J, s, this.format_, this.tileLoadFunction))+ const o = this.sourceTiles_[s]+ i.sourceTiles.push(o),+ this.tileKeysBySourceTileUrl_[s] || (this.tileKeysBySourceTileUrl_[s] = []),+ this.tileKeysBySourceTileUrl_[s].push(i.getKey())+ const a = o.getState()+ if (a < K) {+ const t = (e) => {+ this.handleTileChange(e)+ const r = o.getState()+ if (r === K || r === q) {+ const e = o.getKey()+ e in i.errorTileKeys ? o.getState() === K && delete i.errorTileKeys[e] : i.loadingSourceTiles--,+ r === q ? (i.errorTileKeys[e] = !0) : o.removeEventListener(n, t),+ 0 === i.loadingSourceTiles && i.setState(L(i.errorTileKeys) ? K : q)+ }+ }+ o.addEventListener(n, t), i.loadingSourceTiles+++ }+ a === Y &&+ ((o.extent = c.getTileCoordExtent(r)),+ (o.projection = this.projection),+ (o.resolution = c.getResolution(r[0])),+ o.load())+ }),+ i.loadingSourceTiles || i.setState(i.sourceTiles.some((t) => t.getState() === q) ? q : K)+ }+ return i.sourceTiles+ }+ removeSourceTiles(t) {+ const e = t.getKey(),+ i = t.sourceTiles+ for (let t = 0, n = i.length; t < n; ++t) {+ const n = i[t].getTileUrl()+ if (!this.tileKeysBySourceTileUrl_[n]) return+ const r = this.tileKeysBySourceTileUrl_[n].indexOf(e)+ ;-1 !== r &&+ (this.tileKeysBySourceTileUrl_[n].splice(r, 1),+ 0 === this.tileKeysBySourceTileUrl_[n].length &&+ (delete this.tileKeysBySourceTileUrl_[n], delete this.sourceTiles_[n]))+ }+ }+ getTile(t, e, i, n, r) {+ const s = [t, e, i]+ let o = this.getTileCoordForTileUrlFunction(s, r)+ const a = this.getTileGrid().getExtent(),+ l = this.projection,+ h = this.getTileGridForProjection(r)+ if (o && a) {+ const e = h.getTileCoordExtent(o)+ zt(e, -h.getResolution(t), e), Se(a, r && l && !Fn(r, l) ? Dn(e, r, l) : e) || (o = null)+ }+ let c = !0+ if (null !== o) {+ const e = this.tileGrid,+ i = h.getResolution(t)+ let s = i+ r && l && !Fn(r, l) && (s = i / l.getMetersPerUnit() / r.getMetersPerUnit())+ const a = e.getZForResolution(s, 1),+ u = h.getTileCoordExtent(o)+ zt(u, -i, u),+ e.forEachTileCoord(r && l && !Fn(r, l) ? Dn(u, r, l) : u, a, (t) => {+ c = c && !this.tileUrlFunction(t, n, l)+ })+ }+ const u = new su(s, c ? J : Y, o, this.getSourceTiles.bind(this, n, r), this.removeSourceTiles.bind(this))+ return (u.key = this.getKey()), u+ }+ getTileGridForProjection(t) {+ const e = t.getCode()+ let i = this.tileGrids_[e]+ if (!i) {+ const n = this.projection+ if (null !== n && !Fn(n, t)) return Zu(t)+ const r = this.tileGrid,+ s = r.getResolutions().slice(),+ o = s.map(function (t, e) {+ return r.getOrigin(e)+ }),+ a = s.map(function (t, e) {+ return r.getTileSize(e)+ }),+ l = 43+ for (let t = s.length; t < l; ++t) s.push(s[t - 1] / 2), o.push(o[t - 1]), a.push(a[t - 1])+ ;(i = new Vu({ extent: r.getExtent(), origins: o, resolutions: s, tileSizes: a })), (this.tileGrids_[e] = i)+ }+ return i+ }+ getTilePixelRatio(t) {+ return t+ }+ getTilePixelSize(t, e, i) {+ const n = Wl(this.getTileGridForProjection(i).getTileSize(t), this.tmpSize)+ return [Math.round(n[0] * e), Math.round(n[1] * e)]+ }+ setOverlaps(t) {+ ;(this.overlaps_ = t), this.changed()+ }+ }+ function xf(t, e) {+ t.setLoader(function (i, n, r) {+ hu(e, t.getFormat(), i, n, r, t.onLoad.bind(t), t.onError.bind(t))+ })+ }+ const vf = '© <a href="https://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap</a> contributors.'+ class Sf {+ constructor() {+ ;(this.instructions_ = []),+ (this.zIndex = 0),+ (this.offset_ = 0),+ (this.context_ = new Proxy(_t(), {+ get: (t, e) => {+ if ("function" == typeof _t()[e]) return this.push_(e), this.pushMethodArgs_+ },+ set: (t, e, i) => (this.push_(e, i), !0)+ }))+ }+ push_(...t) {+ const e = this.instructions_,+ i = this.zIndex + this.offset_+ e[i] || (e[i] = []), e[i].push(...t)+ }+ pushMethodArgs_ = (...t) => (this.push_(t), this)+ pushFunction(t) {+ this.push_(t)+ }+ getContext() {+ return this.context_+ }+ draw(t) {+ this.instructions_.forEach((e) => {+ for (let i = 0, n = e.length; i < n; ++i) {+ const n = e[i]+ if ("function" == typeof n) {+ n(t)+ continue+ }+ const r = e[++i]+ if ("function" == typeof t[n]) t[n](...r)+ else {+ if ("function" == typeof r) {+ t[n] = r(t)+ continue+ }+ t[n] = r+ }+ }+ })+ }+ clear() {+ ;(this.instructions_.length = 0), (this.zIndex = 0), (this.offset_ = 0)+ }+ offset() {+ ;(this.offset_ = this.instructions_.length), (this.zIndex = 0)+ }+ }+ class Ef extends G {+ constructor(t) {+ super(),+ (this.ready = !0),+ (this.boundHandleImageChange_ = this.handleImageChange_.bind(this)),+ (this.layer_ = t),+ (this.staleKeys_ = new Array()),+ (this.maxStaleKeys = 5)+ }+ getStaleKeys() {+ return this.staleKeys_+ }+ prependStaleKey(t) {+ this.staleKeys_.unshift(t),+ this.staleKeys_.length > this.maxStaleKeys && (this.staleKeys_.length = this.maxStaleKeys)+ }+ getFeatures(t) {+ return U()+ }+ getData(t) {+ return null+ }+ prepareFrame(t) {+ return U()+ }+ renderFrame(t, e) {+ return U()+ }+ forEachFeatureAtCoordinate(t, e, i, n, r) {}+ getLayer() {+ return this.layer_+ }+ handleFontsChanged() {}+ handleImageChange_(t) {+ const e = t.target+ ;(e.getState() !== Ms && e.getState() !== As) || this.renderIfReadyAndVisible()+ }+ loadImage(t) {+ let e = t.getState()+ return (+ e != Ms && e != As && t.addEventListener(n, this.boundHandleImageChange_),+ e == Fs && (t.load(), (e = t.getState())),+ e == Ms+ )+ }+ renderIfReadyAndVisible() {+ const t = this.getLayer()+ t && t.getVisible() && "ready" === t.getSourceState() && t.changed()+ }+ renderDeferred(t) {}+ disposeInternal() {+ delete this.layer_, super.disposeInternal()+ }+ }+ const wf = []+ let Tf = null+ class Cf extends Ef {+ constructor(t) {+ super(t),+ (this.container = null),+ this.renderedResolution,+ (this.tempTransform = [1, 0, 0, 1, 0, 0]),+ (this.pixelTransform = [1, 0, 0, 1, 0, 0]),+ (this.inversePixelTransform = [1, 0, 0, 1, 0, 0]),+ (this.context = null),+ (this.deferredContext_ = null),+ (this.containerReused = !1),+ (this.frameState = null)+ }+ getImageData(t, e, i) {+ let n+ Tf || (Tf = ft(1, 1, void 0, { willReadFrequently: !0 })), Tf.clearRect(0, 0, 1, 1)+ try {+ Tf.drawImage(t, e, i, 1, 1, 0, 0, 1, 1), (n = Tf.getImageData(0, 0, 1, 1).data)+ } catch {+ return (Tf = null), null+ }+ return n+ }+ getBackground(t) {+ let e = this.getLayer().getBackground()+ return "function" == typeof e && (e = e(t.viewState.resolution)), e || void 0+ }+ useContainer(t, e, i) {+ const n = this.getLayer().getClassName()+ let r, s+ if (t && t.className === n && (!i || (t && t.style.backgroundColor && w(zl(t.style.backgroundColor), zl(i))))) {+ const e = t.firstElementChild+ Tt(e) && (s = e.getContext("2d"))+ }+ if (+ (s && hr(s.canvas.style.transform, e)+ ? ((this.container = t), (this.context = s), (this.containerReused = !0))+ : this.containerReused+ ? ((this.container = null), (this.context = null), (this.containerReused = !1))+ : this.container && (this.container.style.backgroundColor = null),+ !this.container)+ ) {+ ;(r = ct ? wt() : document.createElement("div")), (r.className = n)+ let t = r.style+ ;(t.position = "absolute"), (t.width = "100%"), (t.height = "100%"), (s = ft())+ const e = s.canvas+ r.appendChild(e),+ (t = e.style),+ (t.position = "absolute"),+ (t.left = "0"),+ (t.transformOrigin = "top left"),+ (this.container = r),+ (this.context = s)+ }+ this.containerReused || !i || this.container.style.backgroundColor || (this.container.style.backgroundColor = i)+ }+ clipUnrotated(t, e, i) {+ const n = ye(i),+ r = xe(i),+ s = ue(i),+ o = ce(i)+ Qn(e.coordinateToPixelTransform, n),+ Qn(e.coordinateToPixelTransform, r),+ Qn(e.coordinateToPixelTransform, s),+ Qn(e.coordinateToPixelTransform, o)+ const a = this.inversePixelTransform+ Qn(a, n),+ Qn(a, r),+ Qn(a, s),+ Qn(a, o),+ t.save(),+ t.beginPath(),+ t.moveTo(Math.round(n[0]), Math.round(n[1])),+ t.lineTo(Math.round(r[0]), Math.round(r[1])),+ t.lineTo(Math.round(s[0]), Math.round(s[1])),+ t.lineTo(Math.round(o[0]), Math.round(o[1])),+ t.clip()+ }+ prepareContainer(t, e) {+ const i = t.extent,+ n = t.viewState.resolution,+ r = t.viewState.rotation,+ s = t.pixelRatio,+ o = Math.round((ve(i) / n) * s),+ a = Math.round((_e(i) / n) * s)+ nr(this.pixelTransform, t.size[0] / 2, t.size[1] / 2, 1 / s, 1 / s, r, -o / 2, -a / 2),+ rr(this.inversePixelTransform, this.pixelTransform)+ const l = ar(this.pixelTransform)+ if ((this.useContainer(e, l, this.getBackground(t)), !this.containerReused)) {+ const t = this.context.canvas+ t.width != o || t.height != a ? ((t.width = o), (t.height = a)) : this.context.clearRect(0, 0, o, a),+ l !== t.style.transform && (t.style.transform = l)+ }+ }+ dispatchRenderEvent_(t, e, i) {+ const n = this.getLayer()+ if (n.hasListener(t)) {+ const r = new Xc(t, this.inversePixelTransform, i, e)+ n.dispatchEvent(r)+ }+ }+ preRender(t, e) {+ ;(this.frameState = e), e.declutter || this.dispatchRenderEvent_(Ja, t, e)+ }+ postRender(t, e) {+ e.declutter || this.dispatchRenderEvent_(Qa, t, e)+ }+ renderDeferredInternal(t) {}+ getRenderContext(t) {+ return (+ t.declutter && !this.deferredContext_ && (this.deferredContext_ = new Sf()),+ t.declutter ? this.deferredContext_.getContext() : this.context+ )+ }+ renderDeferred(t) {+ t.declutter &&+ (this.dispatchRenderEvent_(Ja, this.context, t),+ t.declutter &&+ this.deferredContext_ &&+ (this.deferredContext_.draw(this.context), this.deferredContext_.clear()),+ this.renderDeferredInternal(t),+ this.dispatchRenderEvent_(Qa, this.context, t))+ }+ getRenderTransform(t, e, i, n, r, s, o) {+ const a = r / 2,+ l = s / 2,+ h = n / e,+ c = -h,+ u = -t[0] + o,+ d = -t[1]+ return nr(this.tempTransform, a, l, h, c, -i, u, d)+ }+ disposeInternal() {+ delete this.frameState, super.disposeInternal()+ }+ }+ class bf extends Cf {+ constructor(t) {+ super(t), (this.image = null), (this.renderedSourceRevision_ = 0)+ }+ getImage() {+ return this.image ? this.image.getImage() : null+ }+ prepareFrame(t) {+ const e = t.layerStatesArray[t.layerIndex],+ i = t.pixelRatio,+ n = t.viewState,+ r = n.resolution,+ s = this.getLayer().getSource(),+ o = t.viewHints+ let a = t.extent+ if ((void 0 !== e.extent && (a = me(a, zn(e.extent, n.projection))), !o[co] && !o[uo] && !Ee(a)))+ if (s) {+ this.getLayer().rendered || this.renderedSourceRevision_ === s.getRevision() || (this.image = null),+ (this.renderedSourceRevision_ = s.getRevision())+ const t = n.projection,+ e = s.getImage(a, r, i, t)+ e && (this.loadImage(e) ? (this.image = e) : e.getState() === Os && (this.image = null))+ } else this.image = null+ return !!this.image+ }+ getData(t) {+ const e = this.frameState+ if (!e) return null+ const i = this.getLayer(),+ n = Qn(e.pixelToCoordinateTransform, t.slice()),+ r = i.getExtent()+ if (r && !$t(r, n)) return null+ const s = this.image.getExtent(),+ o = this.image.getImage(),+ a = ve(s),+ l = Math.floor(o.width * ((n[0] - s[0]) / a))+ if (l < 0 || l >= o.width) return null+ const h = _e(s),+ c = Math.floor(o.height * ((s[3] - n[1]) / h))+ return c < 0 || c >= o.height ? null : this.getImageData(o, l, c)+ }+ renderFrame(t, e) {+ const i = this.image,+ n = i.getExtent(),+ r = i.getResolution(),+ [s, o] = Array.isArray(r) ? r : [r, r],+ a = i.getPixelRatio(),+ l = t.layerStatesArray[t.layerIndex],+ h = t.pixelRatio,+ c = t.viewState,+ u = c.center,+ d = c.resolution,+ g = (h * s) / (d * a),+ f = (h * o) / (d * a)+ this.prepareContainer(t, e)+ const p = this.context.canvas.width,+ _ = this.context.canvas.height,+ m = this.getRenderContext(t)+ let y = !1,+ x = !0+ if (l.extent) {+ const e = zn(l.extent, c.projection)+ ;(x = Se(e, t.extent)), (y = x && !Wt(e, t.extent)), y && this.clipUnrotated(m, t, e)+ }+ const v = i.getImage(),+ S = nr(this.tempTransform, p / 2, _ / 2, g, f, 0, (a * (n[0] - u[0])) / s, (a * (u[1] - n[3])) / o)+ this.renderedResolution = (o * h) / a+ const E = v.width * S[0],+ w = v.height * S[3]+ if (+ (this.getLayer().getSource().getInterpolate() || (m.imageSmoothingEnabled = !1),+ this.preRender(m, t),+ x && E >= 0.5 && w >= 0.5)+ ) {+ const t = S[4],+ e = S[5],+ i = l.opacity+ 1 !== i && (m.save(), (m.globalAlpha = i)),+ m.drawImage(v, 0, 0, +v.width, +v.height, t, e, E, w),+ 1 !== i && m.restore()+ }+ return this.postRender(this.context, t), y && m.restore(), (m.imageSmoothingEnabled = !0), this.container+ }+ }+ class Rf extends nl {+ constructor(t) {+ super((t = t || {}))+ }+ }+ class Pf extends Rf {+ constructor(t) {+ super(t)+ }+ createRenderer() {+ return new bf(this)+ }+ getData(t) {+ return super.getData(t)+ }+ }+ function If(t, e, i) {+ if (!(i in t)) return (t[i] = new Set([e])), !0+ const n = t[i],+ r = n.has(e)+ return r || n.add(e), !r+ }+ function Ff(t, e, i) {+ const n = t[i]+ return !!n && n.delete(e)+ }+ function Lf(t, e) {+ const i = t.layerStatesArray[t.layerIndex]+ i.extent && (e = me(e, zn(i.extent, t.viewState.projection)))+ const n = i.layer.getRenderSource()+ if (!n.getWrapX()) {+ const i = n.getTileGridForProjection(t.viewState.projection).getExtent()+ i && (e = me(e, i))+ }+ return e+ }+ class Mf extends Cf {+ constructor(t, e) {+ super(t),+ (e = e || {}),+ (this.extentChanged = !0),+ (this.renderComplete = !1),+ (this.renderedExtent_ = null),+ this.renderedPixelRatio,+ (this.renderedProjection = null),+ (this.renderedTiles = []),+ this.renderedSourceKey_,+ this.renderedSourceRevision_,+ (this.tempExtent = [1 / 0, 1 / 0, -1 / 0, -1 / 0]),+ (this.tempTileRange_ = new iu(0, 0, 0, 0)),+ (this.tempTileCoord_ = Nu(0, 0, 0))+ const i = void 0 !== e.cacheSize ? e.cacheSize : 512+ ;(this.tileCache_ = new Du(i)), (this.sourceTileCache_ = null), (this.maxStaleKeys = 0.5 * i)+ }+ getTileCache() {+ return this.tileCache_+ }+ getSourceTileCache() {+ return this.sourceTileCache_ || (this.sourceTileCache_ = new Du(512)), this.sourceTileCache_+ }+ getOrCreateTile(t, e, i, n) {+ const r = this.tileCache_,+ s = this.getLayer().getSource(),+ o = ju(s, s.getKey(), t, e, i)+ let a+ if (r.containsKey(o)) a = r.get(o)+ else {+ const l = n.viewState.projection,+ h = s.getProjection()+ if (((a = s.getTile(t, e, i, n.pixelRatio, l, !h || Fn(h, l) ? void 0 : this.getSourceTileCache())), !a))+ return null+ r.set(o, a)+ }+ return a+ }+ getTile(t, e, i, n) {+ const r = this.getOrCreateTile(t, e, i, n)+ return r || null+ }+ getData(t) {+ const e = this.frameState+ if (!e) return null+ const i = this.getLayer(),+ n = Qn(e.pixelToCoordinateTransform, t.slice()),+ r = i.getExtent()+ if (r && !$t(r, n)) return null+ const s = e.viewState,+ o = i.getRenderSource(),+ a = o.getTileGridForProjection(s.projection),+ l = o.getTilePixelRatio(e.pixelRatio)+ for (let t = a.getZForResolution(s.resolution); t >= a.getMinZoom(); --t) {+ const i = a.getTileCoordForCoordAndZ(n, t),+ r = this.getTile(t, i[1], i[2], e)+ if (!r || r.getState() !== K) continue+ const h = a.getOrigin(t),+ c = Wl(a.getTileSize(t)),+ u = a.getResolution(t)+ let d+ if (r instanceof Bs || r instanceof fd) d = r.getImage()+ else {+ if (!(r instanceof Lt)) continue+ if (((d = Ct(r.getData())), !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])),+ p = Math.round(l * o.getGutterForProjection(s.projection))+ return this.getImageData(d, g + p, f + p)+ }+ return null+ }+ prepareFrame(t) {+ this.renderedProjection+ ? t.viewState.projection !== this.renderedProjection &&+ (this.tileCache_.clear(), (this.renderedProjection = t.viewState.projection))+ : (this.renderedProjection = t.viewState.projection)+ const e = this.getLayer().getSource()+ if (!e) return !1+ const i = e.getRevision()+ return (+ this.renderedSourceRevision_+ ? this.renderedSourceRevision_ !== i &&+ ((this.renderedSourceRevision_ = i),+ this.renderedSourceKey_ === e.getKey() && (this.tileCache_.clear(), this.sourceTileCache_?.clear()))+ : (this.renderedSourceRevision_ = i),+ !0+ )+ }+ enqueueTilesForNextExtent() {+ return !0+ }+ enqueueTiles(t, e, i, n, r) {+ const s = t.viewState,+ o = this.getLayer(),+ a = o.getRenderSource(),+ l = a.getTileGridForProjection(s.projection),+ h = z(a)+ h in t.wantedTiles || (t.wantedTiles[h] = {})+ const c = t.wantedTiles[h],+ u = o.getMapInternal(),+ d = Math.max(+ i - r,+ l.getMinZoom(),+ l.getZForResolution(+ Math.min(+ o.getMaxResolution(),+ u ? u.getView().getResolutionForZoom(Math.max(o.getMinZoom(), 0)) : l.getResolution(0)+ ),+ a.zDirection+ )+ ),+ g = s.rotation,+ f = g ? pe(s.center, s.resolution, g, t.size) : void 0+ for (let r = i; r >= d; --r) {+ const i = l.getTileRangeForExtentAndZ(e, r, this.tempTileRange_),+ s = l.getResolution(r)+ for (let e = i.minX; e <= i.maxX; ++e)+ for (let o = i.minY; o <= i.maxY; ++o) {+ if (g && !l.tileCoordIntersectsViewport([r, e, o], f)) continue+ const i = this.getTile(r, e, o, t)+ if (!i) continue+ if (!If(n, i, r)) continue+ const a = i.getKey()+ if (((c[a] = !0), i.getState() === Y && !t.tileQueue.isKeyQueued(a))) {+ const n = Nu(r, e, o, this.tempTileCoord_)+ t.tileQueue.enqueue([i, h, l.getTileCoordCenter(n), s])+ }+ }+ }+ }+ findStaleTile_(t, e) {+ const i = this.tileCache_,+ n = t[0],+ r = t[1],+ s = t[2],+ o = this.getStaleKeys()+ for (let t = 0; t < o.length; ++t) {+ const a = ju(this.getLayer().getSource(), o[t], n, r, s)+ if (i.containsKey(a)) {+ const t = i.peek(a)+ if (t.getState() === K) return t.endTransition(z(this)), If(e, t, n), !0+ }+ }+ return !1+ }+ findAltTiles_(t, e, i, n) {+ const r = t.getTileRangeForTileCoordAndZ(e, i, this.tempTileRange_)+ if (!r) return !1+ let s = !0+ const o = this.tileCache_,+ a = this.getLayer().getRenderSource(),+ l = a.getKey()+ for (let t = r.minX; t <= r.maxX; ++t)+ for (let e = r.minY; e <= r.maxY; ++e) {+ const r = ju(a, l, i, t, e)+ let h = !1+ if (o.containsKey(r)) {+ const t = o.peek(r)+ t.getState() === K && (If(n, t, i), (h = !0))+ }+ h || (s = !1)+ }+ return s+ }+ renderFrame(t, e) {+ this.renderComplete = !0+ const i = t.layerStatesArray[t.layerIndex],+ n = t.viewState,+ r = n.projection,+ s = n.resolution,+ o = n.center,+ a = t.pixelRatio,+ l = this.getLayer(),+ h = l.getSource(),+ c = h.getTileGridForProjection(r),+ u = c.getZForResolution(s, h.zDirection),+ d = c.getResolution(u),+ g = h.getKey()+ this.renderedSourceKey_+ ? this.renderedSourceKey_ !== g &&+ (this.prependStaleKey(this.renderedSourceKey_), (this.renderedSourceKey_ = g))+ : (this.renderedSourceKey_ = g)+ let f = t.extent+ const p = h.getTilePixelRatio(a)+ this.prepareContainer(t, e)+ const _ = this.context.canvas.width,+ m = this.context.canvas.height,+ x = i.extent && zn(i.extent, r)+ x && (f = me(f, zn(i.extent, r)))+ const v = (d * _) / 2 / p,+ S = (d * m) / 2 / p,+ E = [o[0] - v, o[1] - S, o[0] + v, o[1] + S],+ w = {}+ this.renderedTiles.length = 0+ const T = l.getPreload()+ if (t.nextExtent && this.enqueueTilesForNextExtent()) {+ const e = c.getZForResolution(n.nextResolution, h.zDirection),+ i = Lf(t, t.nextExtent)+ this.enqueueTiles(t, i, e, w, T)+ }+ const C = Lf(t, f)+ if (+ (this.enqueueTiles(t, C, u, w, 0),+ T > 0 &&+ setTimeout(() => {+ this.enqueueTiles(t, C, u - 1, w, T - 1)+ }, 0),+ !(u in w))+ )+ return this.container+ const b = z(this),+ R = t.time+ for (const e of w[u]) {+ const i = e.getState()+ if (i === J) continue+ const n = e.tileCoord+ if (i === K) {+ if (1 === e.getAlpha(b, R)) {+ e.endTransition(b)+ continue+ }+ }+ i !== q && (this.renderComplete = !1)+ if (this.findStaleTile_(n, w)) {+ Ff(w, e, u), (t.animate = !0)+ continue+ }+ if (this.findAltTiles_(c, n, u + 1, w)) continue+ const r = c.getMinZoom()+ for (let t = u - 1; t >= r; --t) {+ if (this.findAltTiles_(c, n, t, w)) break+ }+ }+ const P = ((d / s) * a) / p,+ I = this.getRenderContext(t)+ nr(this.tempTransform, _ / 2, m / 2, P, P, 0, -_ / 2, -m / 2),+ i.extent && this.clipUnrotated(I, t, x),+ h.getInterpolate() || (I.imageSmoothingEnabled = !1),+ this.preRender(I, t)+ const F = Object.keys(w).map(Number)+ let L+ F.sort(y)+ const M = [],+ A = []+ for (let e = F.length - 1; e >= 0; --e) {+ const i = F[e],+ n = h.getTilePixelSize(i, a, r),+ s = c.getResolution(i) / d,+ o = n[0] * s * P,+ l = n[1] * s * P,+ u = c.getTileCoordForCoordAndZ(ye(E), i),+ g = c.getTileCoordExtent(u),+ f = Qn(this.tempTransform, [(p * (g[0] - E[0])) / d, (p * (E[3] - g[3])) / d]),+ _ = p * h.getGutterForProjection(r)+ for (const e of w[i]) {+ if (e.getState() !== K) continue+ const n = e.tileCoord,+ r = u[1] - n[1],+ s = Math.round(f[0] - (r - 1) * o),+ a = u[2] - n[2],+ c = Math.round(f[1] - (a - 1) * l),+ d = Math.round(f[0] - r * o),+ g = Math.round(f[1] - a * l),+ p = s - d,+ m = c - g,+ y = 1 === F.length+ let x = !1+ L = [d, g, d + p, g, d + p, g + m, d, g + m]+ for (let t = 0, e = M.length; t < e; ++t)+ if (!y && i < A[t]) {+ const e = M[t]+ Se([d, g, d + p, g + m], [e[0], e[3], e[4], e[7]]) &&+ (x || (I.save(), (x = !0)),+ I.beginPath(),+ I.moveTo(L[0], L[1]),+ I.lineTo(L[2], L[3]),+ I.lineTo(L[4], L[5]),+ I.lineTo(L[6], L[7]),+ I.moveTo(e[6], e[7]),+ I.lineTo(e[4], e[5]),+ I.lineTo(e[2], e[3]),+ I.lineTo(e[0], e[1]),+ I.clip())+ }+ M.push(L),+ A.push(i),+ this.drawTile(e, t, d, g, p, m, _, y),+ x && I.restore(),+ this.renderedTiles.unshift(e),+ this.updateUsedTiles(t.usedTiles, h, e)+ }+ }+ if (+ ((this.renderedResolution = d),+ (this.extentChanged = !this.renderedExtent_ || !te(this.renderedExtent_, E)),+ (this.renderedExtent_ = E),+ (this.renderedPixelRatio = a),+ this.postRender(this.context, t),+ i.extent && I.restore(),+ (I.imageSmoothingEnabled = !0),+ this.renderComplete)+ ) {+ const e = (t, e) => {+ const i = z(h),+ n = e.wantedTiles[i],+ r = n ? Object.keys(n).length : 0+ this.updateCacheSize(r), this.tileCache_.expireCache(), this.sourceTileCache_?.expireCache()+ }+ t.postRenderFunctions.push(e)+ }+ return this.container+ }+ updateCacheSize(t) {+ this.tileCache_.highWaterMark = Math.max(this.tileCache_.highWaterMark, 2 * t)+ }+ drawTile(t, e, i, n, r, s, o, a) {+ let l+ if (t instanceof Lt) {+ if (((l = Ct(t.getData())), !l)) throw new Error("Rendering array data is not yet supported")+ } else l = this.getTileImage(t)+ if (!l) return+ const h = this.getRenderContext(e),+ c = z(this),+ u = e.layerStatesArray[e.layerIndex],+ d = u.opacity * (a ? t.getAlpha(c, e.time) : 1),+ g = d !== h.globalAlpha+ g && (h.save(), (h.globalAlpha = d)),+ h.drawImage(l, o, o, l.width - 2 * o, l.height - 2 * o, i, n, r, s),+ g && h.restore(),+ d !== u.opacity ? (e.animate = !0) : a && t.endTransition(c)+ }+ getImage() {+ const t = this.context+ return t ? t.canvas : null+ }+ getTileImage(t) {+ return t.getImage()+ }+ updateUsedTiles(t, e, i) {+ const n = z(e)+ n in t || (t[n] = {}), (t[n][i.getKey()] = !0)+ }+ }+ var Af = "preload",+ Of = "useInterimTilesOnError"+ class Df extends nl {+ 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(Af)+ }+ setPreload(t) {+ this.set(Af, t)+ }+ getUseInterimTilesOnError() {+ return this.get(Of)+ }+ setUseInterimTilesOnError(t) {+ this.set(Of, t)+ }+ getData(t) {+ return super.getData(t)+ }+ }+ class Nf extends Df {+ constructor(t) {+ super(t)+ }+ createRenderer() {+ return new Mf(this, { cacheSize: this.getCacheSize() })+ }+ }+ function kf(t) {+ return function (e) {+ const i = e.buffers,+ n = e.meta,+ r = e.imageOps,+ s = e.width,+ o = e.height,+ a = i.length,+ l = i[0].byteLength+ if (r) {+ const e = new Array(a)+ for (let t = 0; t < a; ++t) e[t] = new ImageData(new Uint8ClampedArray(i[t]), s, o)+ return t(e, n).data.buffer+ }+ const h = new Uint8ClampedArray(l),+ c = new Array(a),+ u = new Array(a)+ for (let t = 0; t < a; ++t) (c[t] = new Uint8ClampedArray(i[t])), (u[t] = [0, 0, 0, 0])+ for (let e = 0; e < l; e += 4) {+ for (let t = 0; t < a; ++t) {+ const i = c[t]+ ;(u[t][0] = i[e]), (u[t][1] = i[e + 1]), (u[t][2] = i[e + 2]), (u[t][3] = i[e + 3])+ }+ const i = t(u, n)+ ;(h[e] = i[0]), (h[e + 1] = i[1]), (h[e + 2] = i[2]), (h[e + 3] = i[3])+ }+ return h.buffer+ }+ }+ function Gf(t, e) {+ const i = Object.keys(t.lib || {})+ .map(function (e) {+ return "const " + e + " = " + t.lib[e].toString() + ";"+ })+ .concat([+ "const __minion__ = (" + kf.toString() + ")(",+ t.operation.toString(),+ ");",+ 'self.addEventListener("message", function(event) {',+ " const buffer = __minion__(event.data);",+ " self.postMessage({buffer: buffer, meta: event.data.meta}, [buffer]);",+ "});"+ ]),+ n = new Worker(+ "undefined" == typeof Blob+ ? "data:text/javascript;base64," + Buffer.from(i.join("\n"), "binary").toString("base64")+ : URL.createObjectURL(new Blob(i, { type: "text/javascript" }))+ )+ return n.addEventListener("message", e), n+ }+ class jf extends _ {+ constructor(t) {+ let e+ super(), (this.imageOps_ = !!t.imageOps), (e = 0 === t.threads ? 0 : this.imageOps_ ? 1 : t.threads || 1)+ const i = new Array(e)+ if (e) for (let n = 0; n < e; ++n) i[n] = Gf(t, this.onWorkerMessage_.bind(this, n))+ else+ i[0] = (function (t, e) {+ const i = kf(t.operation)+ let n = !1+ return {+ postMessage: function (t) {+ setTimeout(function () {+ n || e({ data: { buffer: i(t), meta: t.meta } })+ }, 0)+ },+ terminate: function () {+ n = !0+ }+ }+ })(t, this.onWorkerMessage_.bind(this, 0))+ ;(this.workers_ = i),+ (this.queue_ = []),+ (this.maxQueueLength_ = t.queue || 1 / 0),+ (this.running_ = 0),+ (this.dataLookup_ = {}),+ (this.job_ = null)+ }+ process(t, e, i) {+ this.enqueue_({ inputs: t, meta: e, callback: i }), this.dispatch_()+ }+ enqueue_(t) {+ for (this.queue_.push(t); this.queue_.length > this.maxQueueLength_; ) this.queue_.shift().callback(null, null)+ }+ dispatch_() {+ if (this.running_ || 0 === this.queue_.length) return+ const t = this.queue_.shift()+ this.job_ = t+ const e = t.inputs[0].width,+ i = t.inputs[0].height,+ n = t.inputs.map(function (t) {+ return t.data.buffer+ }),+ r = this.workers_.length+ if (((this.running_ = r), 1 === r))+ return void this.workers_[0].postMessage(+ { buffers: n, meta: t.meta, imageOps: this.imageOps_, width: e, height: i },+ n+ )+ const s = t.inputs[0].data.length,+ o = 4 * Math.ceil(s / 4 / r)+ for (let s = 0; s < r; ++s) {+ const r = s * o,+ a = []+ for (let t = 0, e = n.length; t < e; ++t) a.push(n[t].slice(r, r + o))+ this.workers_[s].postMessage({ buffers: a, meta: t.meta, imageOps: this.imageOps_, width: e, height: i }, a)+ }+ }+ onWorkerMessage_(t, e) {+ this.disposed || ((this.dataLookup_[t] = e.data), --this.running_, 0 === this.running_ && this.resolveJob_())+ }+ resolveJob_() {+ const t = this.job_,+ e = this.workers_.length+ let i, n+ if (1 === e) (i = new Uint8ClampedArray(this.dataLookup_[0].buffer)), (n = this.dataLookup_[0].meta)+ else {+ const r = t.inputs[0].data.length+ ;(i = new Uint8ClampedArray(r)), (n = new Array(e))+ const s = 4 * Math.ceil(r / 4 / e)+ for (let t = 0; t < e; ++t) {+ const e = this.dataLookup_[t].buffer,+ r = t * s+ i.set(new Uint8ClampedArray(e), r), (n[t] = this.dataLookup_[t].meta)+ }+ }+ ;(this.job_ = null),+ (this.dataLookup_ = {}),+ t.callback(null, new ImageData(i, t.inputs[0].width, t.inputs[0].height), n),+ this.dispatch_()+ }+ disposeInternal() {+ for (let t = 0; t < this.workers_.length; ++t) this.workers_[t].terminate()+ this.workers_.length = 0+ }+ }+ const Uf = "beforeoperations",+ Bf = "afteroperations"+ class zf extends M {+ constructor(t, e, i) {+ super(t), (this.extent = e.extent), (this.resolution = e.viewState.resolution / e.pixelRatio), (this.data = i)+ }+ }+ class Xf extends Bg {+ constructor(t) {+ super({ projection: null }),+ this.on,+ this.once,+ this.un,+ (this.processor_ = null),+ (this.operationType_ = void 0 !== t.operationType ? t.operationType : "pixel"),+ (this.threads_ = void 0 !== t.threads ? t.threads : 1),+ (this.layers_ = (function (t) {+ const e = t.length,+ i = new Array(e)+ for (let n = 0; n < e; ++n) i[n] = Wf(t[n])+ return i+ })(t.sources))+ const e = this.changed.bind(this)+ for (let t = 0, i = this.layers_.length; t < i; ++t) this.layers_[t].addEventListener(n, e)+ var i+ ;(this.useResolutions_ = null !== t.resolutions),+ (this.tileQueue_ = new lo(function () {+ return 1+ }, this.processSources_.bind(this))),+ this.requestedFrameState_,+ (this.renderedImageCanvas_ = null),+ this.renderedRevision_,+ (this.frameState_ = {+ animate: !1,+ coordinateToPixelTransform: [1, 0, 0, 1, 0, 0],+ declutter: null,+ extent: null,+ index: 0,+ layerIndex: 0,+ layerStatesArray:+ ((i = this.layers_),+ i.map(function (t) {+ return t.getLayerState()+ })),+ pixelRatio: 1,+ pixelToCoordinateTransform: [1, 0, 0, 1, 0, 0],+ postRenderFunctions: [],+ size: [0, 0],+ tileQueue: this.tileQueue_,+ time: Date.now(),+ usedTiles: {},+ viewState: { rotation: 0 },+ viewHints: [],+ wantedTiles: {},+ mapId: z(this),+ renderTargets: {}+ }),+ this.setAttributions(function (e) {+ const i = []+ for (let n = 0, r = t.sources.length; n < r; ++n) {+ const r = t.sources[n],+ s = r instanceof pd ? r : r.getSource()+ if (!s) continue+ const o = s.getAttributions()?.(e)+ "string" == typeof o ? i.push(o) : void 0 !== o && i.push(...o)+ }+ return i+ }),+ void 0 !== t.operation && this.setOperation(t.operation, t.lib)+ }+ setOperation(t, e) {+ this.processor_ && this.processor_.dispose(),+ (this.processor_ = new jf({+ operation: t,+ imageOps: "image" === this.operationType_,+ queue: 1,+ lib: e,+ threads: this.threads_+ })),+ this.changed()+ }+ updateFrameState_(t, e, i) {+ const n = Object.assign({}, this.frameState_)+ n.viewState = Object.assign({}, n.viewState)+ const r = de(t)+ ;(n.size[0] = Math.ceil(ve(t) / e)),+ (n.size[1] = Math.ceil(_e(t) / e)),+ (n.extent = [+ r[0] - (n.size[0] * e) / 2,+ r[1] - (n.size[1] * e) / 2,+ r[0] + (n.size[0] * e) / 2,+ r[1] + (n.size[1] * e) / 2+ ]),+ (n.time = Date.now())+ const s = n.viewState+ return (s.center = r), (s.projection = i), (s.resolution = e), n+ }+ allSourcesReady_() {+ let t,+ e = !0+ for (let i = 0, n = this.layers_.length; i < n; ++i)+ if (((t = this.layers_[i].getSource()), !t || "ready" !== t.getState())) {+ e = !1+ break+ }+ return e+ }+ getImage(t, e, i, n) {+ if (!this.allSourcesReady_()) return null+ this.tileQueue_.loadMoreTiles(16, 16), (e = this.findNearestResolution(e))+ const r = this.updateFrameState_(t, e, n)+ if (((this.requestedFrameState_ = r), this.renderedImageCanvas_)) {+ const t = this.renderedImageCanvas_.getResolution(),+ i = this.renderedImageCanvas_.getExtent()+ ;(e === t && te(r.extent, i)) || (this.renderedImageCanvas_ = null)+ }+ return (+ (this.renderedImageCanvas_ && this.getRevision() === this.renderedRevision_) || this.processSources_(),+ r.animate && requestAnimationFrame(this.changed.bind(this)),+ this.renderedImageCanvas_+ )+ }+ processSources_() {+ const t = this.requestedFrameState_,+ e = this.layers_.length,+ i = new Array(e)+ for (let n = 0; n < e; ++n) {+ ;(t.layerIndex = n), (t.renderTargets = {})+ const e = $f(this.layers_[n], t)+ if (!e) return+ i[n] = e+ }+ const n = {}+ this.dispatchEvent(new zf(Uf, t, n)), this.processor_.process(i, n, this.onWorkerComplete_.bind(this, t))+ }+ onWorkerComplete_(t, e, i, n) {+ if (e || !i) return+ const r = t.extent,+ s = t.viewState.resolution+ if (s !== this.requestedFrameState_.viewState.resolution || !te(r, this.requestedFrameState_.extent)) return+ let o+ if (this.renderedImageCanvas_) o = this.renderedImageCanvas_.getImage().getContext("2d")+ else {+ ;(o = ft(Math.round(ve(r) / s), Math.round(_e(r) / s))), (this.renderedImageCanvas_ = new Us(r, s, 1, o.canvas))+ }+ o.putImageData(i, 0, 0),+ t.animate ? requestAnimationFrame(this.changed.bind(this)) : this.changed(),+ (this.renderedRevision_ = this.getRevision()),+ this.dispatchEvent(new zf(Bf, t, n))+ }+ getResolutions(t) {+ if (!this.useResolutions_) return null+ let e = super.getResolutions()+ if (!e)+ for (let i = 0, n = this.layers_.length; i < n; ++i) {+ if (((e = this.layers_[i].getSource().getResolutions(t)), e)) break+ }+ return e+ }+ disposeInternal() {+ this.processor_ && this.processor_.dispose(), super.disposeInternal()+ }+ }+ Xf.prototype.dispose+ let Vf = null+ function $f(t, e) {+ const i = t.getRenderer()+ if (!i) throw new Error("Unsupported layer type: " + t)+ if (!i.prepareFrame(e)) return null+ const n = e.size[0],+ r = e.size[1]+ if (0 === n || 0 === r) return null+ const s = i.renderFrame(e, null)+ let o+ if (s instanceof HTMLCanvasElement) o = s+ else {+ if ((s && (o = s.firstElementChild), !(o instanceof HTMLCanvasElement)))+ throw new Error("Unsupported rendered element: " + o)+ if (o.width === n && o.height === r) {+ return o.getContext("2d").getImageData(0, 0, n, r)+ }+ }+ if (Vf) {+ const t = Vf.canvas+ t.width !== n || t.height !== r ? (Vf = ft(n, r, void 0, { willReadFrequently: !0 })) : Vf.clearRect(0, 0, n, r)+ } else Vf = ft(n, r, void 0, { willReadFrequently: !0 })+ return Vf.drawImage(o, 0, 0, n, r), Vf.getImageData(0, 0, n, r)+ }+ function Wf(t) {+ let e+ return (+ t instanceof pd+ ? t instanceof md+ ? (e = new Nf({ source: t }))+ : t instanceof Bg && (e = new Pf({ source: t }))+ : (e = t),+ e+ )+ }+ const Zf = {+ stamen_terrain: { extension: "png" },+ stamen_terrain_background: { extension: "png" },+ stamen_terrain_labels: { extension: "png" },+ stamen_terrain_lines: { extension: "png" },+ stamen_toner_background: { extension: "png" },+ stamen_toner: { extension: "png" },+ stamen_toner_labels: { extension: "png" },+ stamen_toner_lines: { extension: "png" },+ stamen_toner_lite: { extension: "png" },+ stamen_toner_dark: { extension: "png" },+ stamen_toner_blacklite: { extension: "png" },+ stamen_watercolor: { extension: "jpg" },+ alidade_smooth: { extension: "png" },+ alidade_smooth_dark: { extension: "png" },+ alidade_satellite: { extension: "png" },+ outdoors: { extension: "png" },+ osm_bright: { extension: "png" }+ },+ Yf = {+ stamen_terrain: { minZoom: 0, maxZoom: 18, retina: !0 },+ stamen_toner: { minZoom: 0, maxZoom: 20, retina: !0 },+ stamen_toner_dark: { minZoom: 0, maxZoom: 20, retina: !0 },+ stamen_toner_blacklite: { minZoom: 0, maxZoom: 20, retina: !0 },+ stamen_watercolor: { minZoom: 1, maxZoom: 18, retina: !1 }+ }+ class Hf extends nt {+ constructor(t, e, i, n, r, s) {+ super(t, e),+ (this.src_ = i),+ (this.extent_ = n),+ (this.preemptive_ = r),+ (this.grid_ = null),+ (this.keys_ = null),+ (this.data_ = null),+ (this.jsonp_ = s)+ }+ getImage() {+ return null+ }+ getData(t) {+ if (!this.grid_ || !this.keys_) return null+ const e = (t[0] - this.extent_[0]) / (this.extent_[2] - this.extent_[0]),+ i = (t[1] - this.extent_[1]) / (this.extent_[3] - this.extent_[1]),+ n = this.grid_[Math.floor((1 - i) * this.grid_.length)]+ if ("string" != typeof n) return null+ let r = n.charCodeAt(Math.floor(e * n.length))+ r >= 93 && r--, r >= 35 && r--, (r -= 32)+ let s = null+ if (r in this.keys_) {+ const t = this.keys_[r]+ s = this.data_ && t in this.data_ ? this.data_[t] : t+ }+ return s+ }+ forDataAtCoordinate(t, e, i) {+ this.state == J && !0 === i+ ? ((this.state = Y),+ N(this, n, (i) => {+ e(this.getData(t))+ }),+ this.loadInternal_())+ : !0 === i+ ? setTimeout(() => {+ e(this.getData(t))+ }, 0)+ : e(this.getData(t))+ }+ getKey() {+ return this.src_+ }+ handleError_() {+ ;(this.state = q), this.changed()+ }+ handleLoad_(t) {+ ;(this.grid_ = t.grid), (this.keys_ = t.keys), (this.data_ = t.data), (this.state = K), this.changed()+ }+ loadInternal_() {+ if (this.state == Y)+ if (((this.state = H), this.jsonp_)) du(this.src_, this.handleLoad_.bind(this), this.handleError_.bind(this))+ else {+ const t = new XMLHttpRequest()+ t.addEventListener("load", this.onXHRLoad_.bind(this)),+ t.addEventListener("error", this.onXHRError_.bind(this)),+ t.open("GET", this.src_),+ t.send()+ }+ }+ onXHRLoad_(t) {+ const e = t.target+ if (!e.status || (e.status >= 200 && e.status < 300)) {+ let t+ try {+ t = JSON.parse(e.responseText)+ } catch {+ return void this.handleError_()+ }+ this.handleLoad_(t)+ } else this.handleError_()+ }+ onXHRError_(t) {+ this.handleError_()+ }+ load() {+ this.preemptive_ ? this.loadInternal_() : this.setState(J)+ }+ }+ const Kf = 34962,+ qf = 34963,+ Jf = 35044,+ Qf = 35048,+ tp = 5126,+ ep = ["experimental-webgl", "webgl", "webkit-3d", "moz-webgl"]+ function ip(t, e) {+ e = Object.assign({ preserveDrawingBuffer: !0, antialias: !ot }, e)+ const i = ep.length+ for (let n = 0; n < i; ++n)+ try {+ const i = t.getContext(ep[n], e)+ if (i) return i+ } catch {}+ return null+ }+ let np = null+ const rp = "http://www.w3.org/2001/XMLSchema-instance"+ function sp(t, e) {+ return Ip().createElementNS(t, e)+ }+ function op(t, e) {+ return ap(t, e, []).join("")+ }+ function ap(t, e, i) {+ if (t.nodeType == Node.CDATA_SECTION_NODE || t.nodeType == Node.TEXT_NODE)+ e ? i.push(String(t.nodeValue).replace(/(\r\n|\r|\n)/g, "")) : i.push(t.nodeValue)+ else {+ let n+ for (n = t.firstChild; n; n = n.nextSibling) ap(n, e, i)+ }+ return i+ }+ function lp(t) {+ return "documentElement" in t+ }+ function hp(t, e, i) {+ return t.getAttributeNS(e, i) || ""+ }+ function cp(t) {+ return new DOMParser().parseFromString(t, "application/xml")+ }+ function up(t, e) {+ return function (i, n) {+ const r = t.call(e ?? this, i, n)+ if (void 0 !== r) {+ E(n[n.length - 1], r)+ }+ }+ }+ function dp(t, e) {+ return function (i, n) {+ const r = t.call(e ?? this, i, n)+ if (void 0 !== r) {+ n[n.length - 1].push(r)+ }+ }+ }+ function gp(t, e) {+ return function (i, n) {+ const r = t.call(e ?? this, i, n)+ void 0 !== r && (n[n.length - 1] = r)+ }+ }+ function fp(t, e, i) {+ return function (n, r) {+ const s = t.call(i ?? this, n, r)+ if (void 0 !== s) {+ const t = r[r.length - 1],+ i = void 0 !== e ? e : n.localName+ let o+ i in t ? (o = t[i]) : ((o = []), (t[i] = o)), o.push(s)+ }+ }+ }+ function pp(t, e, i) {+ return function (n, r) {+ const s = t.call(i ?? this, n, r)+ if (void 0 !== s) {+ r[r.length - 1][void 0 !== e ? e : n.localName] = s+ }+ }+ }+ function _p(t, e) {+ return function (i, n, r) {+ t.call(e ?? this, i, n, r)+ r[r.length - 1].node.appendChild(i)+ }+ }+ function mp(t, e) {+ let i, n+ return function (e, r, s) {+ if (void 0 === i) {+ i = {}+ const r = {}+ ;(r[e.localName] = t), (i[e.namespaceURI] = r), (n = yp(e.localName))+ }+ Tp(i, n, r, s)+ }+ }+ function yp(t, e) {+ return function (i, n, r) {+ const s = n[n.length - 1].node+ let o = t+ void 0 === o && (o = r)+ return sp(void 0 !== e ? e : s.namespaceURI, o)+ }+ }+ const xp = yp()+ function vp(t, e) {+ const i = e.length,+ n = new Array(i)+ for (let r = 0; r < i; ++r) n[r] = t[e[r]]+ return n+ }+ function Sp(t, e, i) {+ let n, r+ for (i = void 0 !== i ? i : {}, n = 0, r = t.length; n < r; ++n) i[t[n]] = e+ return i+ }+ function Ep(t, e, i, n) {+ let r+ for (r = e.firstElementChild; r; r = r.nextElementSibling) {+ const e = t[r.namespaceURI]+ if (void 0 !== e) {+ const t = e[r.localName]+ void 0 !== t && t.call(n, r, i)+ }+ }+ }+ function wp(t, e, i, n, r) {+ return n.push(t), Ep(e, i, n, r), n.pop()+ }+ function Tp(t, e, i, n, r, s) {+ const o = (void 0 !== r ? r : i).length+ let a, l+ for (let h = 0; h < o; ++h)+ (a = i[h]),+ void 0 !== a &&+ ((l = e.call(s, a, n, void 0 !== r ? r[h] : void 0)),+ void 0 !== l && t[l.namespaceURI][l.localName].call(s, l, a, n))+ }+ function Cp(t, e, i, n, r, s, o) {+ return r.push(t), Tp(e, i, n, r, s, o), r.pop()+ }+ let bp, Rp+ function Pp() {+ return void 0 === bp && "undefined" != typeof XMLSerializer && (bp = new XMLSerializer()), bp+ }+ function Ip() {+ return (+ void 0 === Rp && "undefined" != typeof document && (Rp = document.implementation.createDocument("", "", null)), Rp+ )+ }+ class Fp extends O {+ constructor(t) {+ super(),+ this.tile,+ (this.handleTileChange_ = this.handleTileChange_.bind(this)),+ (this.gutter = t.gutter || 0),+ (this.helper = t.helper),+ (this.loaded = !1),+ (this.ready = !1)+ }+ setTile(t) {+ if (t !== this.tile)+ if (+ (this.tile && this.tile.removeEventListener(n, this.handleTileChange_),+ (this.tile = t),+ (this.loaded = t.getState() === K),+ this.loaded)+ )+ this.uploadTile()+ else {+ if (t instanceof Bs) {+ const e = t.getImage()+ e instanceof Image && !e.crossOrigin && (e.crossOrigin = "anonymous")+ }+ t.addEventListener(n, this.handleTileChange_)+ }+ }+ uploadTile() {+ U()+ }+ setReady() {+ ;(this.ready = !0), this.dispatchEvent(n)+ }+ handleTileChange_() {+ this.tile.getState() === K && ((this.loaded = !0), this.uploadTile())+ }+ setHelper(t) {+ ;(this.helper = t), this.helper && this.loaded && this.uploadTile()+ }+ disposeInternal() {+ this.setHelper(null), this.tile.removeEventListener(n, this.handleTileChange_)+ }+ }+ const Lp = Jf+ class Mp {+ constructor(t, e) {+ ;(this.array_ = null),+ (this.type_ = t),+ Mt(+ t === Kf || t === qf,+ "A `WebGLArrayBuffer` must either be of type `ELEMENT_ARRAY_BUFFER` or `ARRAY_BUFFER`"+ ),+ (this.usage_ = void 0 !== e ? e : Lp)+ }+ ofSize(t) {+ return (this.array_ = new (Ap(this.type_))(t)), this+ }+ fromArray(t) {+ return (this.array_ = Ap(this.type_).from(t)), this+ }+ fromArrayBuffer(t) {+ return (this.array_ = new (Ap(this.type_))(t)), this+ }+ getType() {+ return this.type_+ }+ getArray() {+ return this.array_+ }+ setArray(t) {+ const e = Ap(this.type_)+ if (!(t instanceof e)) throw new Error(`Expected ${e}`)+ this.array_ = t+ }+ getUsage() {+ return this.usage_+ }+ getSize() {+ return this.array_ ? this.array_.length : 0+ }+ }+ function Ap(t) {+ switch (t) {+ case Kf:+ return Float32Array+ case qf:+ return Uint32Array+ default:+ return Float32Array+ }+ }+ var Op = "webglcontextlost",+ Dp = "webglcontextrestored"+ class Np {+ constructor(t) {+ this.gl_ = t.webGlContext+ const e = this.gl_+ ;(this.scaleRatio_ = t.scaleRatio || 1),+ (this.renderTargetTexture_ = e.createTexture()),+ (this.renderTargetTextureSize_ = null),+ (this.frameBuffer_ = e.createFramebuffer()),+ (this.depthBuffer_ = e.createRenderbuffer())+ const i = e.createShader(e.VERTEX_SHADER)+ e.shaderSource(+ i,+ t.vertexShader ||+ "\n precision mediump float;\n\n attribute vec2 a_position;\n varying vec2 v_texCoord;\n varying vec2 v_screenCoord;\n\n uniform vec2 u_screenSize;\n\n void main() {\n v_texCoord = a_position * 0.5 + 0.5;\n v_screenCoord = v_texCoord * u_screenSize;\n gl_Position = vec4(a_position, 0.0, 1.0);\n }\n"+ ),+ e.compileShader(i)+ const n = e.createShader(e.FRAGMENT_SHADER)+ e.shaderSource(+ n,+ t.fragmentShader ||+ "\n precision mediump float;\n\n uniform sampler2D u_image;\n uniform float u_opacity;\n\n varying vec2 v_texCoord;\n\n void main() {\n gl_FragColor = texture2D(u_image, v_texCoord) * u_opacity;\n }\n"+ ),+ e.compileShader(n),+ (this.renderTargetProgram_ = e.createProgram()),+ e.attachShader(this.renderTargetProgram_, i),+ e.attachShader(this.renderTargetProgram_, n),+ e.linkProgram(this.renderTargetProgram_),+ (this.renderTargetVerticesBuffer_ = e.createBuffer())+ e.bindBuffer(e.ARRAY_BUFFER, this.renderTargetVerticesBuffer_),+ e.bufferData(e.ARRAY_BUFFER, new Float32Array([-1, -1, 1, -1, -1, 1, 1, -1, 1, 1, -1, 1]), e.STATIC_DRAW),+ (this.renderTargetAttribLocation_ = e.getAttribLocation(this.renderTargetProgram_, "a_position")),+ (this.renderTargetUniformLocation_ = e.getUniformLocation(this.renderTargetProgram_, "u_screenSize")),+ (this.renderTargetOpacityLocation_ = e.getUniformLocation(this.renderTargetProgram_, "u_opacity")),+ (this.renderTargetTextureLocation_ = e.getUniformLocation(this.renderTargetProgram_, "u_image")),+ (this.uniforms_ = []),+ t.uniforms &&+ Object.keys(t.uniforms).forEach((i) => {+ this.uniforms_.push({ value: t.uniforms[i], location: e.getUniformLocation(this.renderTargetProgram_, i) })+ })+ }+ getRenderTargetTexture() {+ return this.renderTargetTexture_+ }+ getGL() {+ return this.gl_+ }+ init(t) {+ const e = this.getGL(),+ i = [e.drawingBufferWidth * this.scaleRatio_, e.drawingBufferHeight * this.scaleRatio_]+ if (+ (e.bindFramebuffer(e.FRAMEBUFFER, this.getFrameBuffer()),+ e.bindRenderbuffer(e.RENDERBUFFER, this.getDepthBuffer()),+ e.viewport(0, 0, i[0], i[1]),+ !this.renderTargetTextureSize_ ||+ this.renderTargetTextureSize_[0] !== i[0] ||+ this.renderTargetTextureSize_[1] !== i[1])+ ) {+ this.renderTargetTextureSize_ = i+ const t = 0,+ n = e.RGBA,+ r = 0,+ s = e.RGBA,+ o = e.UNSIGNED_BYTE,+ a = null+ e.bindTexture(e.TEXTURE_2D, this.renderTargetTexture_),+ e.texImage2D(e.TEXTURE_2D, t, n, i[0], i[1], r, s, o, a),+ e.texParameteri(e.TEXTURE_2D, e.TEXTURE_MIN_FILTER, e.LINEAR),+ e.texParameteri(e.TEXTURE_2D, e.TEXTURE_WRAP_S, e.CLAMP_TO_EDGE),+ e.texParameteri(e.TEXTURE_2D, e.TEXTURE_WRAP_T, e.CLAMP_TO_EDGE),+ e.framebufferTexture2D(e.FRAMEBUFFER, e.COLOR_ATTACHMENT0, e.TEXTURE_2D, this.renderTargetTexture_, 0),+ e.renderbufferStorage(e.RENDERBUFFER, e.DEPTH_COMPONENT16, i[0], i[1]),+ e.framebufferRenderbuffer(e.FRAMEBUFFER, e.DEPTH_ATTACHMENT, e.RENDERBUFFER, this.depthBuffer_)+ }+ }+ apply(t, e, i, n) {+ const r = this.getGL(),+ s = t.size+ if (+ (r.bindFramebuffer(r.FRAMEBUFFER, e ? e.getFrameBuffer() : null),+ r.activeTexture(r.TEXTURE0),+ r.bindTexture(r.TEXTURE_2D, this.renderTargetTexture_),+ !e)+ ) {+ const e = z(r.canvas)+ if (!t.renderTargets[e]) {+ const i = r.getContextAttributes()+ i &&+ i.preserveDrawingBuffer &&+ (r.clearColor(0, 0, 0, 0), r.clearDepth(1), r.clear(r.COLOR_BUFFER_BIT | r.DEPTH_BUFFER_BIT)),+ (t.renderTargets[e] = !0)+ }+ }+ r.disable(r.DEPTH_TEST),+ r.enable(r.BLEND),+ r.blendFunc(r.ONE, r.ONE_MINUS_SRC_ALPHA),+ r.viewport(0, 0, r.drawingBufferWidth, r.drawingBufferHeight),+ r.bindBuffer(r.ARRAY_BUFFER, this.renderTargetVerticesBuffer_),+ r.useProgram(this.renderTargetProgram_),+ r.enableVertexAttribArray(this.renderTargetAttribLocation_),+ r.vertexAttribPointer(this.renderTargetAttribLocation_, 2, r.FLOAT, !1, 0, 0),+ r.uniform2f(this.renderTargetUniformLocation_, s[0], s[1]),+ r.uniform1i(this.renderTargetTextureLocation_, 0)+ const o = t.layerStatesArray[t.layerIndex].opacity+ r.uniform1f(this.renderTargetOpacityLocation_, o),+ this.applyUniforms(t),+ i && i(r, t),+ r.drawArrays(r.TRIANGLES, 0, 6),+ n && n(r, t)+ }+ getFrameBuffer() {+ return this.frameBuffer_+ }+ getDepthBuffer() {+ return this.depthBuffer_+ }+ applyUniforms(t) {+ const e = this.getGL()+ let i,+ n = 1+ this.uniforms_.forEach(function (r) {+ if (+ ((i = "function" == typeof r.value ? r.value(t) : r.value),+ i instanceof HTMLCanvasElement || i instanceof ImageData)+ )+ r.texture || (r.texture = e.createTexture()),+ e.activeTexture(e[`TEXTURE${n}`]),+ e.bindTexture(e.TEXTURE_2D, r.texture),+ e.texParameteri(e.TEXTURE_2D, e.TEXTURE_MIN_FILTER, e.LINEAR),+ e.texParameteri(e.TEXTURE_2D, e.TEXTURE_WRAP_S, e.CLAMP_TO_EDGE),+ e.texParameteri(e.TEXTURE_2D, e.TEXTURE_WRAP_T, e.CLAMP_TO_EDGE),+ i instanceof ImageData+ ? e.texImage2D(+ e.TEXTURE_2D,+ 0,+ e.RGBA,+ e.RGBA,+ i.width,+ i.height,+ 0,+ e.UNSIGNED_BYTE,+ new Uint8Array(i.data)+ )+ : e.texImage2D(e.TEXTURE_2D, 0, e.RGBA, e.RGBA, e.UNSIGNED_BYTE, i),+ e.uniform1i(r.location, n++)+ else if (Array.isArray(i))+ switch (i.length) {+ case 2:+ return void e.uniform2f(r.location, i[0], i[1])+ case 3:+ return void e.uniform3f(r.location, i[0], i[1], i[2])+ case 4:+ return void e.uniform4f(r.location, i[0], i[1], i[2], i[3])+ default:+ return+ }+ else "number" == typeof i && e.uniform1f(r.location, i)+ })+ }+ }+ const kp = {+ PROJECTION_MATRIX: "u_projectionMatrix",+ SCREEN_TO_WORLD_MATRIX: "u_screenToWorldMatrix",+ TIME: "u_time",+ ZOOM: "u_zoom",+ RESOLUTION: "u_resolution",+ ROTATION: "u_rotation",+ VIEWPORT_SIZE_PX: "u_viewportSizePx",+ PIXEL_RATIO: "u_pixelRatio",+ HIT_DETECTION: "u_hitDetection"+ },+ Gp = 5121,+ jp = 5123,+ Up = 5125,+ Bp = tp,+ zp = {}+ function Xp(t) {+ return "shared/" + t+ }+ let Vp = 0+ class $p extends _ {+ constructor(t) {+ super(),+ (t = t || {}),+ (this.boundHandleWebGLContextLost_ = this.handleWebGLContextLost.bind(this)),+ (this.boundHandleWebGLContextRestored_ = this.handleWebGLContextRestored.bind(this)),+ (this.canvasCacheKey_ = t.canvasCacheKey+ ? Xp(t.canvasCacheKey)+ : (function () {+ const t = "unique/" + Vp+ return (Vp += 1), t+ })()),+ (this.gl_ = (function (t) {+ let e = zp[t]+ if (!e) {+ const i = document.createElement("canvas")+ ;(i.width = 1),+ (i.height = 1),+ (i.style.position = "absolute"),+ (i.style.left = "0"),+ (e = { users: 0, context: ip(i) }),+ (zp[t] = e)+ }+ return (e.users += 1), e.context+ })(this.canvasCacheKey_)),+ (this.bufferCache_ = {}),+ (this.extensionCache_ = {}),+ (this.currentProgram_ = null),+ (this.needsToBeRecreated_ = !1)+ const e = this.gl_.canvas+ e.addEventListener(Op, this.boundHandleWebGLContextLost_),+ e.addEventListener(Dp, this.boundHandleWebGLContextRestored_),+ (this.offsetRotateMatrix_ = [1, 0, 0, 1, 0, 0]),+ (this.offsetScaleMatrix_ = [1, 0, 0, 1, 0, 0]),+ (this.tmpMat4_ = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]),+ (this.uniformLocationsByProgram_ = {}),+ (this.attribLocationsByProgram_ = {}),+ (this.uniforms_ = []),+ t.uniforms && this.setUniforms(t.uniforms),+ (this.postProcessPasses_ = t.postProcesses+ ? t.postProcesses.map(+ (t) =>+ new Np({+ webGlContext: this.gl_,+ scaleRatio: t.scaleRatio,+ vertexShader: t.vertexShader,+ fragmentShader: t.fragmentShader,+ uniforms: t.uniforms+ })+ )+ : [new Np({ webGlContext: this.gl_ })]),+ (this.shaderCompileErrors_ = null),+ (this.startTime_ = Date.now()),+ (this.maxAttributeCount_ = this.gl_.getParameter(this.gl_.MAX_VERTEX_ATTRIBS))+ }+ setUniforms(t) {+ ;(this.uniforms_ = []), this.addUniforms(t)+ }+ addUniforms(t) {+ for (const e in t) this.uniforms_.push({ name: e, value: t[e] })+ }+ canvasCacheKeyMatches(t) {+ return this.canvasCacheKey_ === Xp(t)+ }+ getExtension(t) {+ if (t in this.extensionCache_) return this.extensionCache_[t]+ const e = this.gl_.getExtension(t)+ return (this.extensionCache_[t] = e), e+ }+ getInstancedRenderingExtension_() {+ const t = this.getExtension("ANGLE_instanced_arrays")+ return Mt(!!t, "WebGL extension 'ANGLE_instanced_arrays' is required for vector rendering"), t+ }+ bindBuffer(t) {+ const e = this.gl_,+ i = z(t)+ let n = this.bufferCache_[i]+ if (!n) {+ ;(n = { buffer: t, webGlBuffer: e.createBuffer() }), (this.bufferCache_[i] = n)+ }+ e.bindBuffer(t.getType(), n.webGlBuffer)+ }+ flushBufferData(t) {+ const e = this.gl_+ this.bindBuffer(t), e.bufferData(t.getType(), t.getArray(), t.getUsage())+ }+ deleteBuffer(t) {+ const e = z(t)+ delete this.bufferCache_[e]+ }+ disposeInternal() {+ const t = this.gl_.canvas+ t.removeEventListener(Op, this.boundHandleWebGLContextLost_),+ t.removeEventListener(Dp, this.boundHandleWebGLContextRestored_),+ (function (t) {+ const e = zp[t]+ if (!e) return+ if (((e.users -= 1), e.users > 0)) return+ const i = e.context,+ n = i.getExtension("WEBGL_lose_context")+ n && n.loseContext()+ const r = i.canvas+ ;(r.width = 1), (r.height = 1), delete zp[t]+ })(this.canvasCacheKey_),+ delete this.gl_+ }+ prepareDraw(t, e, i) {+ const n = this.gl_,+ r = this.getCanvas(),+ s = t.size,+ o = t.pixelRatio+ ;(r.width === s[0] * o && r.height === s[1] * o) ||+ ((r.width = s[0] * o), (r.height = s[1] * o), (r.style.width = s[0] + "px"), (r.style.height = s[1] + "px"))+ for (let e = this.postProcessPasses_.length - 1; e >= 0; e--) this.postProcessPasses_[e].init(t)+ n.bindTexture(n.TEXTURE_2D, null),+ n.clearColor(0, 0, 0, 0),+ n.depthRange(0, 1),+ n.clearDepth(1),+ n.clear(n.COLOR_BUFFER_BIT | n.DEPTH_BUFFER_BIT),+ n.enable(n.BLEND),+ n.blendFunc(n.ONE, e ? n.ZERO : n.ONE_MINUS_SRC_ALPHA),+ i ? (n.enable(n.DEPTH_TEST), n.depthFunc(n.LEQUAL)) : n.disable(n.DEPTH_TEST)+ }+ bindFrameBuffer(t, e) {+ const i = this.getGL()+ i.bindFramebuffer(i.FRAMEBUFFER, t),+ e && i.framebufferTexture2D(i.FRAMEBUFFER, i.COLOR_ATTACHMENT0, i.TEXTURE_2D, e, 0)+ }+ bindInitialFrameBuffer() {+ const t = this.getGL(),+ e = this.postProcessPasses_[0].getFrameBuffer()+ t.bindFramebuffer(t.FRAMEBUFFER, e)+ const i = this.postProcessPasses_[0].getRenderTargetTexture()+ t.framebufferTexture2D(t.FRAMEBUFFER, t.COLOR_ATTACHMENT0, t.TEXTURE_2D, i, 0)+ }+ bindTexture(t, e, i) {+ const n = this.gl_+ n.activeTexture(n.TEXTURE0 + e), n.bindTexture(n.TEXTURE_2D, t), n.uniform1i(this.getUniformLocation(i), e)+ }+ bindAttribute(t, e, i) {+ const n = this.getGL()+ this.bindBuffer(t)+ const r = this.getAttributeLocation(e)+ n.enableVertexAttribArray(r), n.vertexAttribPointer(r, i, n.FLOAT, !1, 0, 0)+ }+ prepareDrawToRenderTarget(t, e, i, n) {+ const r = this.gl_,+ s = e.getSize()+ r.bindFramebuffer(r.FRAMEBUFFER, e.getFramebuffer()),+ r.bindRenderbuffer(r.RENDERBUFFER, e.getDepthbuffer()),+ r.viewport(0, 0, s[0], s[1]),+ r.bindTexture(r.TEXTURE_2D, e.getTexture()),+ r.clearColor(0, 0, 0, 0),+ r.depthRange(0, 1),+ r.clearDepth(1),+ r.clear(r.COLOR_BUFFER_BIT | r.DEPTH_BUFFER_BIT),+ r.enable(r.BLEND),+ r.blendFunc(r.ONE, i ? r.ZERO : r.ONE_MINUS_SRC_ALPHA),+ n ? (r.enable(r.DEPTH_TEST), r.depthFunc(r.LEQUAL)) : r.disable(r.DEPTH_TEST)+ }+ drawElements(t, e) {+ const i = this.gl_+ this.getExtension("OES_element_index_uint")+ const n = i.UNSIGNED_INT,+ r = e - t,+ s = 4 * t+ i.drawElements(i.TRIANGLES, r, n, s)+ }+ drawElementsInstanced(t, e, i) {+ const n = this.gl_+ this.getExtension("OES_element_index_uint")+ const r = this.getInstancedRenderingExtension_(),+ s = n.UNSIGNED_INT,+ o = e - t,+ a = 4 * t+ r.drawElementsInstancedANGLE(n.TRIANGLES, o, s, a, i)+ for (let t = 0; t < this.maxAttributeCount_; t++) r.vertexAttribDivisorANGLE(t, 0)+ }+ finalizeDraw(t, e, i) {+ for (let n = 0, r = this.postProcessPasses_.length; n < r; n++)+ n === r - 1+ ? this.postProcessPasses_[n].apply(t, null, e, i)+ : this.postProcessPasses_[n].apply(t, this.postProcessPasses_[n + 1])+ }+ getCanvas() {+ return this.gl_.canvas+ }+ getGL() {+ return this.gl_+ }+ applyFrameState(t) {+ const e = t.size,+ i = t.viewState.rotation,+ n = t.pixelRatio+ this.setUniformFloatValue(kp.TIME, 0.001 * (Date.now() - this.startTime_)),+ this.setUniformFloatValue(kp.ZOOM, t.viewState.zoom),+ this.setUniformFloatValue(kp.RESOLUTION, t.viewState.resolution),+ this.setUniformFloatValue(kp.PIXEL_RATIO, n),+ this.setUniformFloatVec2(kp.VIEWPORT_SIZE_PX, [e[0], e[1]]),+ this.setUniformFloatValue(kp.ROTATION, i)+ }+ applyHitDetectionUniform(t) {+ const e = this.getUniformLocation(kp.HIT_DETECTION)+ this.getGL().uniform1i(e, t ? 1 : 0), t && this.setUniformFloatValue(kp.PIXEL_RATIO, 0.5)+ }+ applyUniforms(t) {+ const e = this.gl_+ let i,+ n = 0+ this.uniforms_.forEach((r) => {+ if (+ ((i = "function" == typeof r.value ? r.value(t) : r.value),+ i instanceof HTMLCanvasElement ||+ i instanceof HTMLImageElement ||+ i instanceof ImageData ||+ i instanceof WebGLTexture)+ ) {+ i instanceof WebGLTexture && !r.texture+ ? ((r.prevValue = void 0), (r.texture = i))+ : r.texture || ((r.prevValue = void 0), (r.texture = e.createTexture())),+ this.bindTexture(r.texture, n, r.name),+ e.texParameteri(e.TEXTURE_2D, e.TEXTURE_MIN_FILTER, e.LINEAR),+ e.texParameteri(e.TEXTURE_2D, e.TEXTURE_WRAP_S, e.CLAMP_TO_EDGE),+ e.texParameteri(e.TEXTURE_2D, e.TEXTURE_WRAP_T, e.CLAMP_TO_EDGE)+ const t = !(i instanceof HTMLImageElement) || i.complete+ i instanceof WebGLTexture ||+ !t ||+ r.prevValue === i ||+ ((r.prevValue = i), e.texImage2D(e.TEXTURE_2D, 0, e.RGBA, e.RGBA, e.UNSIGNED_BYTE, i)),+ n+++ } else if (Array.isArray(i) && 6 === i.length) this.setUniformMatrixValue(r.name, Qd(this.tmpMat4_, i))+ else if (Array.isArray(i) && i.length <= 4)+ switch (i.length) {+ case 2:+ return void e.uniform2f(this.getUniformLocation(r.name), i[0], i[1])+ case 3:+ return void e.uniform3f(this.getUniformLocation(r.name), i[0], i[1], i[2])+ case 4:+ return void e.uniform4f(this.getUniformLocation(r.name), i[0], i[1], i[2], i[3])+ default:+ return+ }+ else "number" == typeof i && e.uniform1f(this.getUniformLocation(r.name), i)+ })+ }+ useProgram(t, e) {+ this.disableAllAttributes_()+ this.gl_.useProgram(t), (this.currentProgram_ = t), e && (this.applyFrameState(e), this.applyUniforms(e))+ }+ compileShader(t, e) {+ const i = this.gl_,+ n = i.createShader(e)+ return i.shaderSource(n, t), i.compileShader(n), n+ }+ getProgram(t, e) {+ const i = this.gl_,+ n = this.compileShader(t, i.FRAGMENT_SHADER),+ r = this.compileShader(e, i.VERTEX_SHADER),+ s = i.createProgram()+ if ((i.attachShader(s, n), i.attachShader(s, r), i.linkProgram(s), !i.getShaderParameter(n, i.COMPILE_STATUS))) {+ const t = `Fragment shader compilation failed: ${i.getShaderInfoLog(n)}`+ throw new Error(t)+ }+ if ((i.deleteShader(n), !i.getShaderParameter(r, i.COMPILE_STATUS))) {+ const t = `Vertex shader compilation failed: ${i.getShaderInfoLog(r)}`+ throw new Error(t)+ }+ if ((i.deleteShader(r), !i.getProgramParameter(s, i.LINK_STATUS))) {+ const t = `GL program linking failed: ${i.getProgramInfoLog(s)}`+ throw new Error(t)+ }+ return s+ }+ getUniformLocation(t) {+ const e = z(this.currentProgram_)+ return (+ void 0 === this.uniformLocationsByProgram_[e] && (this.uniformLocationsByProgram_[e] = {}),+ void 0 === this.uniformLocationsByProgram_[e][t] &&+ (this.uniformLocationsByProgram_[e][t] = this.gl_.getUniformLocation(this.currentProgram_, t)),+ this.uniformLocationsByProgram_[e][t]+ )+ }+ getAttributeLocation(t) {+ const e = z(this.currentProgram_)+ return (+ void 0 === this.attribLocationsByProgram_[e] && (this.attribLocationsByProgram_[e] = {}),+ void 0 === this.attribLocationsByProgram_[e][t] &&+ (this.attribLocationsByProgram_[e][t] = this.gl_.getAttribLocation(this.currentProgram_, t)),+ this.attribLocationsByProgram_[e][t]+ )+ }+ makeProjectionTransform(t, e) {+ const i = t.size,+ n = t.viewState.rotation,+ r = t.viewState.resolution,+ s = t.viewState.center+ return nr(e, 0, 0, 2 / (r * i[0]), 2 / (r * i[1]), -n, -s[0], -s[1]), e+ }+ setUniformFloatValue(t, e) {+ this.gl_.uniform1f(this.getUniformLocation(t), e)+ }+ setUniformFloatVec2(t, e) {+ this.gl_.uniform2fv(this.getUniformLocation(t), e)+ }+ setUniformFloatVec4(t, e) {+ this.gl_.uniform4fv(this.getUniformLocation(t), e)+ }+ setUniformMatrixValue(t, e) {+ this.gl_.uniformMatrix4fv(this.getUniformLocation(t), !1, e)+ }+ disableAllAttributes_() {+ for (let t = 0; t < this.maxAttributeCount_; t++) this.gl_.disableVertexAttribArray(t)+ }+ enableAttributeArray_(t, e, i, n, r, s) {+ const o = this.getAttributeLocation(t)+ o < 0 ||+ (this.gl_.enableVertexAttribArray(o),+ this.gl_.vertexAttribPointer(o, e, i, !1, n, r),+ s && this.getInstancedRenderingExtension_().vertexAttribDivisorANGLE(o, 1))+ }+ enableAttributes_(t, e) {+ const i = Wp(t)+ let n = 0+ for (let r = 0; r < t.length; r++) {+ const s = t[r]+ s.name && this.enableAttributeArray_(s.name, s.size, s.type || tp, i, n, e), (n += s.size * Zp(s.type))+ }+ }+ enableAttributes(t) {+ this.enableAttributes_(t, !1)+ }+ enableAttributesInstanced(t) {+ this.enableAttributes_(t, !0)+ }+ handleWebGLContextLost(t) {+ F(this.bufferCache_), (this.currentProgram_ = null), t.preventDefault()+ }+ handleWebGLContextRestored() {+ this.needsToBeRecreated_ = !0+ }+ needsToBeRecreated() {+ return this.needsToBeRecreated_+ }+ createTexture(t, e, i, n) {+ const r = this.gl_+ i = i || r.createTexture()+ const s = n ? r.NEAREST : r.LINEAR+ r.bindTexture(r.TEXTURE_2D, i),+ r.texParameteri(r.TEXTURE_2D, r.TEXTURE_MIN_FILTER, s),+ r.texParameteri(r.TEXTURE_2D, r.TEXTURE_MAG_FILTER, s),+ r.texParameteri(r.TEXTURE_2D, r.TEXTURE_WRAP_S, r.CLAMP_TO_EDGE),+ r.texParameteri(r.TEXTURE_2D, r.TEXTURE_WRAP_T, r.CLAMP_TO_EDGE)+ const o = r.RGBA,+ a = r.RGBA,+ l = r.UNSIGNED_BYTE+ return (+ e instanceof Uint8Array+ ? r.texImage2D(r.TEXTURE_2D, 0, o, t[0], t[1], 0, a, l, e)+ : e+ ? r.texImage2D(r.TEXTURE_2D, 0, o, a, l, e)+ : r.texImage2D(r.TEXTURE_2D, 0, o, t[0], t[1], 0, a, l, null),+ i+ )+ }+ }+ function Wp(t) {+ let e = 0+ for (let i = 0; i < t.length; i++) {+ const n = t[i]+ e += n.size * Zp(n.type)+ }+ return e+ }+ function Zp(t) {+ switch (t) {+ case Gp:+ return Uint8Array.BYTES_PER_ELEMENT+ case jp:+ return Uint16Array.BYTES_PER_ELEMENT+ case Up:+ return Uint32Array.BYTES_PER_ELEMENT+ default:+ return Float32Array.BYTES_PER_ELEMENT+ }+ }+ class Yp {+ constructor(t, e) {+ ;(this.name = t), (this.data = e), (this.texture_ = null)+ }+ getTexture(t) {+ if (!this.texture_) {+ const e = t.createTexture()+ t.bindTexture(t.TEXTURE_2D, e),+ t.texParameteri(t.TEXTURE_2D, t.TEXTURE_WRAP_S, t.CLAMP_TO_EDGE),+ t.texParameteri(t.TEXTURE_2D, t.TEXTURE_WRAP_T, t.CLAMP_TO_EDGE),+ t.texParameteri(t.TEXTURE_2D, t.TEXTURE_MIN_FILTER, t.NEAREST),+ t.texParameteri(t.TEXTURE_2D, t.TEXTURE_MAG_FILTER, t.NEAREST),+ t.texImage2D(t.TEXTURE_2D, 0, t.RGBA, this.data.length / 4, 1, 0, t.RGBA, t.UNSIGNED_BYTE, this.data),+ (this.texture_ = e)+ }+ return this.texture_+ }+ delete(t) {+ this.texture_ && t.deleteTexture(this.texture_), (this.texture_ = null)+ }+ }+ const Hp = new Uint8Array(4)+ class Kp {+ constructor(t, e) {+ this.helper_ = t+ const i = t.getGL()+ ;(this.texture_ = i.createTexture()),+ (this.framebuffer_ = i.createFramebuffer()),+ (this.depthbuffer_ = i.createRenderbuffer()),+ (this.size_ = e || [1, 1]),+ (this.data_ = new Uint8Array(0)),+ (this.dataCacheDirty_ = !0),+ this.updateSize_()+ }+ setSize(t) {+ w(t, this.size_) || ((this.size_[0] = t[0]), (this.size_[1] = t[1]), this.updateSize_())+ }+ getSize() {+ return this.size_+ }+ clearCachedData() {+ this.dataCacheDirty_ = !0+ }+ readAll() {+ if (this.dataCacheDirty_) {+ const t = this.size_,+ e = this.helper_.getGL()+ e.bindFramebuffer(e.FRAMEBUFFER, this.framebuffer_),+ e.readPixels(0, 0, t[0], t[1], e.RGBA, e.UNSIGNED_BYTE, this.data_),+ (this.dataCacheDirty_ = !1)+ }+ return this.data_+ }+ readPixel(t, e) {+ if (t < 0 || e < 0 || t > this.size_[0] || e >= this.size_[1])+ return (Hp[0] = 0), (Hp[1] = 0), (Hp[2] = 0), (Hp[3] = 0), Hp+ this.readAll()+ const i = Math.floor(t) + (this.size_[1] - Math.floor(e) - 1) * this.size_[0]+ return (+ (Hp[0] = this.data_[4 * i]),+ (Hp[1] = this.data_[4 * i + 1]),+ (Hp[2] = this.data_[4 * i + 2]),+ (Hp[3] = this.data_[4 * i + 3]),+ Hp+ )+ }+ getTexture() {+ return this.texture_+ }+ getFramebuffer() {+ return this.framebuffer_+ }+ getDepthbuffer() {+ return this.depthbuffer_+ }+ updateSize_() {+ const t = this.size_,+ e = this.helper_.getGL()+ ;(this.texture_ = this.helper_.createTexture(t, null, this.texture_)),+ e.bindFramebuffer(e.FRAMEBUFFER, this.framebuffer_),+ e.viewport(0, 0, t[0], t[1]),+ e.framebufferTexture2D(e.FRAMEBUFFER, e.COLOR_ATTACHMENT0, e.TEXTURE_2D, this.texture_, 0),+ e.bindRenderbuffer(e.RENDERBUFFER, this.depthbuffer_),+ e.renderbufferStorage(e.RENDERBUFFER, e.DEPTH_COMPONENT16, t[0], t[1]),+ e.framebufferRenderbuffer(e.FRAMEBUFFER, e.DEPTH_ATTACHMENT, e.RENDERBUFFER, this.depthbuffer_),+ (this.data_ = new Uint8Array(t[0] * t[1] * 4))+ }+ }+ class qp {+ constructor() {+ ;(this.globalCounter_ = 0),+ (this.refToFeature_ = new Map()),+ (this.uidToRef_ = new Map()),+ (this.freeGlobalRef_ = []),+ (this.polygonBatch = { entries: {}, geometriesCount: 0, verticesCount: 0, ringsCount: 0 }),+ (this.pointBatch = { entries: {}, geometriesCount: 0 }),+ (this.lineStringBatch = { entries: {}, geometriesCount: 0, verticesCount: 0 })+ }+ addFeatures(t, e) {+ for (let i = 0; i < t.length; i++) this.addFeature(t[i], e)+ }+ addFeature(t, e) {+ let i = t.getGeometry()+ i && (e && ((i = i.clone()), i.applyTransform(e)), this.addGeometry_(i, t))+ }+ clearFeatureEntryInPointBatch_(t) {+ const e = z(t),+ i = this.pointBatch.entries[e]+ if (i) return (this.pointBatch.geometriesCount -= i.flatCoordss.length), delete this.pointBatch.entries[e], i+ }+ clearFeatureEntryInLineStringBatch_(t) {+ const e = z(t),+ i = this.lineStringBatch.entries[e]+ if (i)+ return (+ (this.lineStringBatch.verticesCount -= i.verticesCount),+ (this.lineStringBatch.geometriesCount -= i.flatCoordss.length),+ delete this.lineStringBatch.entries[e],+ i+ )+ }+ clearFeatureEntryInPolygonBatch_(t) {+ const e = z(t),+ i = this.polygonBatch.entries[e]+ if (i)+ return (+ (this.polygonBatch.verticesCount -= i.verticesCount),+ (this.polygonBatch.ringsCount -= i.ringsCount),+ (this.polygonBatch.geometriesCount -= i.flatCoordss.length),+ delete this.polygonBatch.entries[e],+ i+ )+ }+ addGeometry_(t, e) {+ const i = t.getType()+ switch (i) {+ case "GeometryCollection": {+ const i = t.getGeometriesArray()+ for (const t of i) this.addGeometry_(t, e)+ break+ }+ case "MultiPolygon": {+ const n = t+ this.addCoordinates_(i, n.getFlatCoordinates(), n.getEndss(), e, z(e), n.getStride())+ break+ }+ case "MultiLineString": {+ const n = t+ this.addCoordinates_(i, n.getFlatCoordinates(), n.getEnds(), e, z(e), n.getStride())+ break+ }+ case "MultiPoint": {+ const n = t+ this.addCoordinates_(i, n.getFlatCoordinates(), null, e, z(e), n.getStride())+ break+ }+ case "Polygon": {+ const n = t+ this.addCoordinates_(i, n.getFlatCoordinates(), n.getEnds(), e, z(e), n.getStride())+ break+ }+ case "Point": {+ const n = t+ this.addCoordinates_(i, n.getFlatCoordinates(), null, e, z(e), n.getStride())+ break+ }+ case "LineString":+ case "LinearRing": {+ const n = t,+ r = n.getStride()+ this.addCoordinates_(i, n.getFlatCoordinates(), null, e, z(e), r, n.getLayout?.())+ break+ }+ }+ }+ addCoordinates_(t, e, i, n, r, s, o) {+ let a+ switch (t) {+ case "MultiPolygon": {+ const t = i+ for (let i = 0, a = t.length; i < a; i++) {+ let a = t[i]+ const l = i > 0 ? t[i - 1] : null,+ h = l ? l[l.length - 1] : 0,+ c = a[a.length - 1]+ ;(a = h > 0 ? a.map((t) => t - h) : a), this.addCoordinates_("Polygon", e.slice(h, c), a, n, r, s, o)+ }+ break+ }+ case "MultiLineString": {+ const t = i+ for (let i = 0, a = t.length; i < a; i++) {+ const a = i > 0 ? t[i - 1] : 0+ this.addCoordinates_("LineString", e.slice(a, t[i]), null, n, r, s, o)+ }+ break+ }+ case "MultiPoint":+ for (let t = 0, i = e.length; t < i; t += s)+ this.addCoordinates_("Point", e.slice(t, t + 2), null, n, r, null, null)+ break+ case "Polygon": {+ const t = i+ if (n instanceof Ud) {+ const i = ds(e, t)+ if (i.length > 1) return void this.addCoordinates_("MultiPolygon", e, i, n, r, s, o)+ }+ this.polygonBatch.entries[r] ||+ (this.polygonBatch.entries[r] = this.addRefToEntry_(r, {+ feature: n,+ flatCoordss: [],+ verticesCount: 0,+ ringsCount: 0,+ ringsVerticesCounts: []+ })),+ (a = e.length / s)+ const l = i.length,+ h = i.map((t, e, i) => (e > 0 ? (t - i[e - 1]) / s : t / s))+ ;(this.polygonBatch.verticesCount += a),+ (this.polygonBatch.ringsCount += l),+ this.polygonBatch.geometriesCount++,+ this.polygonBatch.entries[r].flatCoordss.push(+ (function (t, e) {+ if (2 === e) return t+ return t.filter((t, i) => i % e < 2)+ })(e, s)+ ),+ this.polygonBatch.entries[r].ringsVerticesCounts.push(h),+ (this.polygonBatch.entries[r].verticesCount += a),+ (this.polygonBatch.entries[r].ringsCount += l)+ for (let i = 0, a = t.length; i < a; i++) {+ const a = i > 0 ? t[i - 1] : 0+ this.addCoordinates_("LinearRing", e.slice(a, t[i]), null, n, r, s, o)+ }+ break+ }+ case "Point":+ this.pointBatch.entries[r] ||+ (this.pointBatch.entries[r] = this.addRefToEntry_(r, { feature: n, flatCoordss: [] })),+ this.pointBatch.geometriesCount++,+ this.pointBatch.entries[r].flatCoordss.push(e)+ break+ case "LineString":+ case "LinearRing":+ this.lineStringBatch.entries[r] ||+ (this.lineStringBatch.entries[r] = this.addRefToEntry_(r, {+ feature: n,+ flatCoordss: [],+ verticesCount: 0+ })),+ (a = e.length / s),+ (this.lineStringBatch.verticesCount += a),+ this.lineStringBatch.geometriesCount++,+ this.lineStringBatch.entries[r].flatCoordss.push(+ (function (t, e, i) {+ if (3 === e && "XYM" === i) return t+ if (4 === e) return t.filter((t, i) => i % e != 2)+ if (3 === e) return t.map((t, i) => (i % e != 2 ? t : 0))+ return new Array(1.5 * t.length).fill(0).map((e, i) => (i % 3 == 2 ? 0 : t[Math.round(i / 1.5)]))+ })(e, s, o)+ ),+ (this.lineStringBatch.entries[r].verticesCount += a)+ }+ }+ addRefToEntry_(t, e) {+ const i = this.uidToRef_.get(t),+ n = i || this.freeGlobalRef_.pop() || ++this.globalCounter_+ return (e.ref = n), i || (this.refToFeature_.set(n, e.feature), this.uidToRef_.set(t, n)), e+ }+ removeRef_(t, e) {+ if (!t) throw new Error("This feature has no ref: " + e)+ this.refToFeature_.delete(t), this.uidToRef_.delete(e), this.freeGlobalRef_.push(t)+ }+ changeFeature(t, e) {+ if (!this.uidToRef_.get(z(t))) return+ this.removeFeature(t)+ let i = t.getGeometry()+ i && (e && ((i = i.clone()), i.applyTransform(e)), this.addGeometry_(i, t))+ }+ removeFeature(t) {+ let e = this.clearFeatureEntryInPointBatch_(t)+ ;(e = this.clearFeatureEntryInPolygonBatch_(t) || e),+ (e = this.clearFeatureEntryInLineStringBatch_(t) || e),+ e && this.removeRef_(e.ref, z(e.feature))+ }+ clear() {+ ;(this.polygonBatch.entries = {}),+ (this.polygonBatch.geometriesCount = 0),+ (this.polygonBatch.verticesCount = 0),+ (this.polygonBatch.ringsCount = 0),+ (this.lineStringBatch.entries = {}),+ (this.lineStringBatch.geometriesCount = 0),+ (this.lineStringBatch.verticesCount = 0),+ (this.pointBatch.entries = {}),+ (this.pointBatch.geometriesCount = 0),+ (this.globalCounter_ = 0),+ (this.freeGlobalRef_ = []),+ this.refToFeature_.clear(),+ this.uidToRef_.clear()+ }+ getFeatureFromRef(t) {+ return this.refToFeature_.get(t)+ }+ isEmpty() {+ return 0 === this.globalCounter_+ }+ filter(t) {+ const e = new qp()+ ;(e.globalCounter_ = this.globalCounter_), (e.uidToRef_ = this.uidToRef_), (e.refToFeature_ = this.refToFeature_)+ let i = !0+ for (const n of this.refToFeature_.values()) t(n) && (e.addFeature(n), (i = !1))+ return i ? new qp() : e+ }+ }+ class Jp extends Fp {+ constructor(t, e) {+ super(t),+ (this.batch_ = new qp()),+ (this.styleRenderer_ = e),+ (this.buffers = null),+ (this.maskVertices = new Mp(Kf, Jf)),+ this.setTile(t.tile)+ }+ generateMaskBuffer_() {+ const t = this.tile.getSourceTiles()[0].extent+ this.maskVertices.fromArray([t[0], t[1], t[2], t[1], t[2], t[3], t[0], t[3]]),+ this.helper.flushBufferData(this.maskVertices)+ }+ uploadTile() {+ this.generateMaskBuffer_(), this.batch_.clear()+ const t = this.tile.getSourceTiles(),+ e = t.reduce((t, e) => t.concat(e.getFeatures()), [])+ this.batch_.addFeatures(e)+ const i = ir([1, 0, 0, 1, 0, 0], -t[0].extent[0], -t[0].extent[1])+ this.styleRenderer_.generateBuffers(this.batch_, i).then((t) => {+ ;(this.buffers = t), this.setReady()+ })+ }+ disposeInternal() {+ if (this.buffers) {+ const t = (t) => {+ for (const e of t) e && this.helper.deleteBuffer(e)+ }+ this.buffers.pointBuffers && t(this.buffers.pointBuffers),+ this.buffers.lineStringBuffers && t(this.buffers.lineStringBuffers),+ this.buffers.polygonBuffers && t(this.buffers.polygonBuffers)+ }+ super.disposeInternal()+ }+ }+ function Qp(t, e, i) {+ const n = i ? t.LINEAR : t.NEAREST+ t.bindTexture(t.TEXTURE_2D, e),+ t.texParameteri(t.TEXTURE_2D, t.TEXTURE_WRAP_S, t.CLAMP_TO_EDGE),+ t.texParameteri(t.TEXTURE_2D, t.TEXTURE_WRAP_T, t.CLAMP_TO_EDGE),+ t.texParameteri(t.TEXTURE_2D, t.TEXTURE_MIN_FILTER, n),+ t.texParameteri(t.TEXTURE_2D, t.TEXTURE_MAG_FILTER, n)+ }+ function t_(t, e, i, n, r, s) {+ const o = t.getGL()+ let a, l+ if (i instanceof Float32Array) {+ ;(a = o.FLOAT), t.getExtension("OES_texture_float")+ l = null !== t.getExtension("OES_texture_float_linear")+ } else (a = o.UNSIGNED_BYTE), (l = !0)+ Qp(o, e, s && l)+ const h = i.byteLength / n[1]+ let c,+ u = 1+ switch ((h % 8 == 0 ? (u = 8) : h % 4 == 0 ? (u = 4) : h % 2 == 0 && (u = 2), r)) {+ case 1:+ c = o.LUMINANCE+ break+ case 2:+ c = o.LUMINANCE_ALPHA+ break+ case 3:+ c = o.RGB+ break+ case 4:+ c = o.RGBA+ break+ default:+ throw new Error(`Unsupported number of bands: ${r}`)+ }+ const d = o.getParameter(o.UNPACK_ALIGNMENT)+ o.pixelStorei(o.UNPACK_ALIGNMENT, u),+ o.texImage2D(o.TEXTURE_2D, 0, c, n[0], n[1], 0, c, a, i),+ o.pixelStorei(o.UNPACK_ALIGNMENT, d)+ }+ let e_ = null+ class i_ extends Fp {+ constructor(t) {+ super(t),+ (this.textures = []),+ (this.renderSize_ = Wl(t.grid.getTileSize(t.tile.tileCoord[0]))),+ (this.bandCount = NaN)+ const e = new Mp(Kf, Jf)+ e.fromArray([0, 1, 1, 1, 1, 0, 0, 0]), this.helper.flushBufferData(e), (this.coords = e), this.setTile(t.tile)+ }+ setHelper(t) {+ const e = this.helper?.getGL()+ if (e) {+ this.helper.deleteBuffer(this.coords)+ for (let t = 0; t < this.textures.length; ++t) e.deleteTexture(this.textures[t])+ }+ super.setHelper(t), t && t.flushBufferData(this.coords)+ }+ uploadTile() {+ const t = this.helper,+ e = t.getGL(),+ i = this.tile+ let n+ ;(this.textures.length = 0), (n = i instanceof Bs || i instanceof fd ? i.getImage() : i.getData())+ const r = Ct(n)+ if (r) {+ const t = e.createTexture()+ return (+ this.textures.push(t),+ (this.bandCount = 4),+ (function (t, e, i, n) {+ Qp(t, e, n), t.texImage2D(t.TEXTURE_2D, 0, t.RGBA, t.RGBA, t.UNSIGNED_BYTE, i)+ })(e, t, r, i.interpolate),+ void this.setReady()+ )+ }+ n = bt(n)+ const s = i.getSize(),+ o = [s[0] + 2 * this.gutter, s[1] + 2 * this.gutter],+ a = n instanceof Float32Array,+ l = o[0] * o[1],+ h = a ? Float32Array : Uint8Array,+ c = h.BYTES_PER_ELEMENT,+ u = n.byteLength / o[1]+ this.bandCount = Math.floor(u / c / o[0])+ const d = Math.ceil(this.bandCount / 4)+ if (1 === d) {+ const r = e.createTexture()+ return this.textures.push(r), t_(t, r, n, o, this.bandCount, i.interpolate), void this.setReady()+ }+ const g = new Array(d)+ for (let t = 0; t < d; ++t) {+ const i = e.createTexture()+ this.textures.push(i)+ const n = t < d - 1 ? 4 : ((this.bandCount - 1) % 4) + 1+ g[t] = new h(l * n)+ }+ let f = 0,+ p = 0+ const _ = o[0] * this.bandCount+ for (let t = 0; t < o[1]; ++t) {+ for (let t = 0; t < _; ++t) {+ const e = n[p + t],+ i = Math.floor(f / this.bandCount),+ r = t % this.bandCount,+ s = g[Math.floor(r / 4)]+ ;(s[i * (s.length / l) + (r % 4)] = e), ++f+ }+ p += u / c+ }+ for (let e = 0; e < d; ++e) {+ const n = this.textures[e],+ r = g[e]+ t_(t, n, r, o, r.length / l, i.interpolate)+ }+ this.setReady()+ }+ getImagePixelData_(t, e, i) {+ const n = this.gutter,+ r = this.renderSize_[0],+ s = this.renderSize_[1]+ e_ || (e_ = ft(1, 1, void 0, { willReadFrequently: !0 })), e_.clearRect(0, 0, 1, 1)+ const o = t.width - 2 * n,+ a = t.height - 2 * n,+ l = n + Math.floor(o * (e / r)),+ h = n + Math.floor(a * (i / s))+ let c+ try {+ e_.drawImage(t, l, h, 1, 1, 0, 0, 1, 1), (c = e_.getImageData(0, 0, 1, 1).data)+ } catch {+ return (e_ = null), null+ }+ return c+ }+ getArrayPixelData_(t, e, i, n) {+ const r = this.gutter,+ s = this.renderSize_[0],+ o = this.renderSize_[1],+ a = e[0],+ l = e[1],+ h = a + 2 * r,+ c = l + 2 * r,+ u = r + Math.floor(a * (i / s)),+ d = r + Math.floor(l * (n / o))+ if (t instanceof DataView) {+ const e = t.byteLength / (h * c),+ i = e * (d * h + u),+ n = t.buffer.slice(i, i + e)+ return new DataView(n)+ }+ const g = this.bandCount * (d * h + u)+ return t.slice(g, g + this.bandCount)+ }+ getPixelData(t, e) {+ if (!this.loaded) return null+ if (this.tile instanceof Lt) {+ const i = this.tile.getData(),+ n = bt(i)+ if (n) {+ const i = this.tile.getSize()+ return this.getArrayPixelData_(n, i, t, e)+ }+ return this.getImagePixelData_(Ct(i), t, e)+ }+ return this.getImagePixelData_(this.tile.getImage(), t, e)+ }+ }+ function n_() {+ return {+ "fill-color": "rgba(255,255,255,0.4)",+ "stroke-color": "#3399CC",+ "stroke-width": 1.25,+ "circle-radius": 5,+ "circle-fill-color": "rgba(255,255,255,0.4)",+ "circle-stroke-width": 1.25,+ "circle-stroke-color": "#3399CC"+ }+ }+ const r_ = [+ "d35379db-88df-4056-af3a-620245f8e347",+ "f17cb550-5864-4468-aeb7-f3180cfb622f",+ "689b58e2-cf7b-45e0-9fff-9cfc0883d6b4"+ ]+ function s_(t, e, i, n, r) {+ ;(r.width = i[0]), (r.height = i[1])+ const s = n.getAxisOrientation()+ ;(r.crs = n.getCode()), (r["bbox-crs"] = n.getCode())+ const o = s.startsWith("ne") ? [e[1], e[0], e[3], e[2]] : e+ return (r.bbox = o.join(",")), td(t, r)+ }+ function o_(t, e, i, n, r, s) {+ s = Object.assign({}, s)+ const o = e / i,+ a = [Ge(ve(t) / o, 4), Ge(_e(t) / o, 4)]+ return 1 !== i && (s["mm-per-pixel"] = 0.28 / i), s_(r, t, a, n, s)+ }+ function a_(t) {+ const e = void 0 === t.hidpi || t.hidpi,+ i = En(t.projection || "EPSG:3857"),+ n = t.ratio || 1.5,+ r = t.load || js,+ s = t.crossOrigin ?? null+ return (o, a, l) => {+ ;(o = Xg(o, a, l, n)), 1 === l || e || (l = 1)+ const h = o_(o, a, l, i, t.url, t.params),+ c = new Image()+ return (+ (c.crossOrigin = s),+ void 0 !== t.referrerPolicy && (c.referrerPolicy = t.referrerPolicy),+ r(c, h).then((t) => ({ image: t, extent: o, pixelRatio: l }))+ )+ }+ }+ const l_ = [512, 512]+ function h_(t) {+ const e = t.split(".")[1].replace(/-/g, "+").replace(/_/g, "/"),+ i = atob(e).split(""),+ n = i.length,+ r = new Array(n)+ for (let t = 0; t < n; ++t) {+ const e = i[t]+ r[t] = "%" + ("00" + e.charCodeAt(0).toString(16)).slice(-2)+ }+ return JSON.parse(decodeURIComponent(r.join("")))+ }+ function c_(t) {+ const e = "http://www.opengis.net/def/crs/",+ i = t.getCode()+ return i.startsWith(e)+ ? i+ : i.startsWith("EPSG:")+ ? `${e}EPSG/0/${i.slice(5)}`+ : Fn(t, En("EPSG:4326"))+ ? `${e}EPSG/0/4326`+ : i+ }+ function u_(t, e) {+ if (!e) return ""+ let i = e.toString()+ return (+ e.name &&+ "function" !== e.name &&+ i.match(new RegExp("^" + e.name.replace("$", "\\$") + "\\b")) &&+ (i = "function " + i),+ `var ${t} = ${i};`+ )+ }+ class d_ extends Ef {+ constructor(t, e) {+ super(t),+ (e = e || {}),+ (this.inversePixelTransform_ = [1, 0, 0, 1, 0, 0]),+ (this.postProcesses_ = e.postProcesses),+ (this.uniforms_ = e.uniforms),+ this.helper,+ (this.onMapChanged_ = () => {+ this.clearCache(), this.removeHelper()+ }),+ t.addChangeListener($a, this.onMapChanged_),+ (this.dispatchPreComposeEvent = this.dispatchPreComposeEvent.bind(this)),+ (this.dispatchPostComposeEvent = this.dispatchPostComposeEvent.bind(this))+ }+ dispatchPreComposeEvent(t, e) {+ const i = this.getLayer()+ if (i.hasListener(tl)) {+ const n = new Xc(tl, void 0, e, t)+ i.dispatchEvent(n)+ }+ }+ dispatchPostComposeEvent(t, e) {+ const i = this.getLayer()+ if (i.hasListener(el)) {+ const n = new Xc(el, void 0, e, t)+ i.dispatchEvent(n)+ }+ }+ reset(t) {+ ;(this.uniforms_ = t.uniforms), this.helper && this.helper.setUniforms(this.uniforms_)+ }+ removeHelper() {+ this.helper && (this.helper.dispose(), delete this.helper)+ }+ prepareFrame(t) {+ if (this.getLayer().getRenderSource()) {+ let e,+ i = !0,+ n = -1+ for (let r = 0, s = t.layerStatesArray.length; r < s; r++) {+ const s = t.layerStatesArray[r].layer,+ o = s.getRenderer()+ if (!(o instanceof d_)) {+ i = !0+ continue+ }+ const a = s.getClassName()+ if (((i || a !== e) && ((n += 1), (i = !1)), (e = a), o === this)) break+ }+ const r = "map/" + t.mapId + "/group/" + n+ ;(this.helper && this.helper.canvasCacheKeyMatches(r) && !this.helper.needsToBeRecreated()) ||+ (this.removeHelper(),+ (this.helper = new $p({ postProcesses: this.postProcesses_, uniforms: this.uniforms_, canvasCacheKey: r })),+ e && (this.helper.getCanvas().className = e),+ this.afterHelperCreated())+ }+ return this.prepareFrameInternal(t)+ }+ afterHelperCreated() {}+ prepareFrameInternal(t) {+ return !0+ }+ clearCache() {}+ disposeInternal() {+ this.clearCache(),+ this.removeHelper(),+ this.getLayer()?.removeChangeListener($a, this.onMapChanged_),+ super.disposeInternal()+ }+ dispatchRenderEvent_(t, e, i) {+ const n = this.getLayer()+ if (n.hasListener(t)) {+ nr(this.inversePixelTransform_, 0, 0, i.pixelRatio, -i.pixelRatio, 0, 0, -i.size[1])+ const r = new Xc(t, this.inversePixelTransform_, i, e)+ n.dispatchEvent(r)+ }+ }+ preRender(t, e) {+ this.dispatchRenderEvent_(Ja, t, e)+ }+ postRender(t, e) {+ this.dispatchRenderEvent_(Qa, t, e)+ }+ }+ const g_ = {+ TILE_TRANSFORM: "u_tileTransform",+ TRANSITION_ALPHA: "u_transitionAlpha",+ DEPTH: "u_depth",+ RENDER_EXTENT: "u_renderExtent",+ PATTERN_ORIGIN: "u_patternOrigin",+ RESOLUTION: "u_resolution",+ ZOOM: "u_zoom",+ GLOBAL_ALPHA: "u_globalAlpha",+ PROJECTION_MATRIX: "u_projectionMatrix",+ SCREEN_TO_WORLD_MATRIX: "u_screenToWorldMatrix"+ }+ function f_(t) {+ return 1 / (t + 2)+ }+ function p_() {+ return { tileIds: new Set(), representationsByZ: {} }+ }+ function __(t, e) {+ return t.tileIds.has(z(e))+ }+ function m_(t, e, i) {+ const n = t.representationsByZ+ i in n || (n[i] = new Set()), n[i].add(e), t.tileIds.add(z(e.tile))+ }+ function y_(t, e) {+ const i = t.layerStatesArray[t.layerIndex]+ i.extent && (e = me(e, zn(i.extent, t.viewState.projection)))+ const n = i.layer.getRenderSource()+ if (!n.getWrapX()) {+ const i = n.getTileGridForProjection(t.viewState.projection).getExtent()+ i && (e = me(e, i))+ }+ return e+ }+ function x_(t, e) {+ return `${z(t)},${t.getKey()},${Gu(e)}`+ }+ class v_ extends d_ {+ constructor(t, e) {+ super(t, { uniforms: e.uniforms, postProcesses: e.postProcesses }),+ (this.renderComplete = !1),+ (this.tileTransform_ = [1, 0, 0, 1, 0, 0]),+ (this.tempMat4 = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]),+ (this.tempTileRange_ = new iu(0, 0, 0, 0)),+ (this.tempTileCoord_ = Nu(0, 0, 0)),+ (this.tempSize_ = [0, 0])+ const i = void 0 !== e.cacheSize ? e.cacheSize : 512+ ;(this.tileRepresentationCache = new Du(i)), (this.frameState = null), (this.renderedProjection_ = void 0)+ }+ reset(t) {+ super.reset({ uniforms: t.uniforms })+ }+ prepareFrameInternal(t) {+ this.renderedProjection_+ ? t.viewState.projection !== this.renderedProjection_ &&+ (this.clearCache(), (this.renderedProjection_ = t.viewState.projection))+ : (this.renderedProjection_ = t.viewState.projection)+ const e = this.getLayer().getRenderSource()+ return !!e && !Ee(y_(t, t.extent)) && "ready" === e.getState()+ }+ createTileRepresentation(t) {+ return U()+ }+ enqueueTiles(t, e, i, n, r) {+ const s = t.viewState,+ o = this.getLayer(),+ a = o.getRenderSource(),+ l = a.getTileGridForProjection(s.projection),+ h = a.getGutterForProjection(s.projection),+ c = z(a)+ c in t.wantedTiles || (t.wantedTiles[c] = {})+ const u = t.wantedTiles[c],+ d = this.tileRepresentationCache,+ g = o.getMapInternal(),+ f = Math.max(+ i - r,+ l.getMinZoom(),+ l.getZForResolution(+ Math.min(+ o.getMaxResolution(),+ g ? g.getView().getResolutionForZoom(Math.max(o.getMinZoom(), 0)) : l.getResolution(0)+ ),+ a.zDirection+ )+ ),+ p = s.rotation,+ _ = p ? pe(s.center, s.resolution, p, t.size) : void 0+ for (let r = i; r >= f; --r) {+ const i = l.getTileRangeForExtentAndZ(e, r, this.tempTileRange_),+ o = l.getResolution(r)+ for (let e = i.minX; e <= i.maxX; ++e)+ for (let g = i.minY; g <= i.maxY; ++g) {+ if (p && !l.tileCoordIntersectsViewport([r, e, g], _)) continue+ const i = Nu(r, e, g, this.tempTileCoord_),+ f = x_(a, i)+ let m, y+ if (+ (d.containsKey(f) && ((m = d.get(f)), (y = m.tile)),+ !((m && m.tile.key === a.getKey()) || ((y = a.getTile(r, e, g, t.pixelRatio, s.projection)), y)))+ )+ continue+ if (__(n, y)) continue+ m+ ? m.setTile(y)+ : ((m = this.createTileRepresentation({ tile: y, grid: l, helper: this.helper, gutter: h })),+ d.set(f, m)),+ m_(n, m, r)+ const x = y.getKey()+ ;(u[x] = !0),+ y.getState() === Y &&+ (t.tileQueue.isKeyQueued(x) || t.tileQueue.enqueue([y, c, l.getTileCoordCenter(i), o]))+ }+ }+ }+ beforeTilesRender(t, e) {+ this.helper.prepareDraw(this.frameState, !e, !0)+ }+ beforeTilesMaskRender(t) {+ return !1+ }+ renderTile(t, e, i, n, r, s, o, a, l, h, c) {}+ renderTileMask(t, e, i, n) {}+ drawTile_(t, e, i, n, r, s, o) {+ if (!e.ready) return+ const a = e.tile.tileCoord,+ l = Gu(a),+ h = l in s ? s[l] : 1,+ c = o.getResolution(i),+ u = Wl(o.getTileSize(i), this.tempSize_),+ d = o.getOrigin(i),+ g = o.getTileCoordExtent(a),+ f = h < 1 ? -1 : f_(i)+ h < 1 && (t.animate = !0)+ const p = t.viewState,+ _ = p.center[0],+ m = p.center[1],+ y = u[0] + 2 * n,+ x = u[1] + 2 * n,+ v = y / x,+ S = (_ - d[0]) / (u[0] * c),+ E = (d[1] - m) / (u[1] * c),+ w = p.resolution / c,+ T = a[1],+ C = a[2]+ Hn(this.tileTransform_),+ er(this.tileTransform_, 2 / ((t.size[0] * w) / y), -2 / ((t.size[1] * w) / y)),+ tr(this.tileTransform_, p.rotation),+ er(this.tileTransform_, 1, 1 / v),+ ir(this.tileTransform_, (u[0] * (T - S) - n) / y, (u[1] * (C - E) - n) / x),+ this.renderTile(e, this.tileTransform_, t, r, c, u, d, g, f, n, h)+ }+ renderFrame(t) {+ ;(this.frameState = t), (this.renderComplete = !0)+ const e = this.helper.getGL()+ this.preRender(e, t)+ const i = t.viewState,+ n = this.getLayer(),+ r = n.getRenderSource(),+ s = r.getTileGridForProjection(i.projection),+ o = r.getGutterForProjection(i.projection),+ a = y_(t, t.extent),+ l = s.getZForResolution(i.resolution, r.zDirection),+ h = p_(),+ c = n.getPreload()+ if (t.nextExtent) {+ const e = s.getZForResolution(i.nextResolution, r.zDirection),+ n = y_(t, t.nextExtent)+ this.enqueueTiles(t, n, e, h, c)+ }+ this.enqueueTiles(t, a, l, h, 0),+ c > 0 &&+ setTimeout(() => {+ this.enqueueTiles(t, a, l - 1, h, c - 1)+ }, 0)+ const u = {}+ let d = !1+ const g = h.representationsByZ+ if (l in g) {+ const e = z(this),+ i = t.time+ for (const t of g[l]) {+ const n = t.tile+ if (n.getState() === J) continue+ const r = n.tileCoord+ if (t.ready) {+ const t = n.getAlpha(e, i)+ if (1 === t) {+ n.endTransition(e)+ continue+ }+ d = !0+ u[Gu(r)] = t+ }+ this.renderComplete = !1+ if (this.findAltTiles_(s, r, l + 1, h)) continue+ const o = s.getMinZoom()+ for (let t = l - 1; t >= o; --t) {+ if (this.findAltTiles_(s, r, t, h)) break+ }+ }+ }+ const f = Object.keys(g).map(Number).sort(x)+ if (this.beforeTilesMaskRender(t))+ for (let t = 0, e = f.length; t < e; ++t) {+ const e = f[t]+ for (const t of g[e]) {+ const i = t.tile.tileCoord+ if (Gu(i) in u) continue+ const n = s.getTileCoordExtent(i)+ this.renderTileMask(t, e, n, f_(e))+ }+ }+ this.beforeTilesRender(t, d)+ for (let e = 0, i = f.length; e < i; ++e) {+ const i = f[e]+ for (const e of g[i]) {+ Gu(e.tile.tileCoord) in u || this.drawTile_(t, e, i, o, a, u, s)+ }+ }+ if (l in g)+ for (const e of g[l]) {+ Gu(e.tile.tileCoord) in u && this.drawTile_(t, e, l, o, a, u, s)+ }+ this.beforeFinalize(t), this.helper.finalizeDraw(t, this.dispatchPreComposeEvent, this.dispatchPostComposeEvent)+ const p = this.helper.getCanvas()+ return this.tileRepresentationCache.expireCache(), this.postRender(e, t), p+ }+ beforeFinalize(t) {}+ findAltTiles_(t, e, i, n) {+ const r = t.getTileRangeForTileCoordAndZ(e, i, this.tempTileRange_)+ if (!r) return !1+ let s = !0+ const o = this.tileRepresentationCache,+ a = this.getLayer().getRenderSource()+ for (let t = r.minX; t <= r.maxX; ++t)+ for (let e = r.minY; e <= r.maxY; ++e) {+ const r = x_(a, [i, t, e])+ let l = !1+ if (o.containsKey(r)) {+ const t = o.get(r)+ t.ready && !__(n, t.tile) && (m_(n, t, i), (l = !0))+ }+ l || (s = !1)+ }+ return s+ }+ clearCache() {+ super.clearCache()+ const t = this.tileRepresentationCache+ t.forEach((t) => t.dispose()), t.clear()+ }+ afterHelperCreated() {+ super.afterHelperCreated(), this.tileRepresentationCache.forEach((t) => t.setHelper(this.helper))+ }+ disposeInternal() {+ super.disposeInternal(), delete this.frameState+ }+ }+ const S_ = {+ ...g_,+ TILE_TEXTURE_ARRAY: "u_tileTextures",+ TEXTURE_PIXEL_WIDTH: "u_texturePixelWidth",+ TEXTURE_PIXEL_HEIGHT: "u_texturePixelHeight",+ TEXTURE_RESOLUTION: "u_textureResolution",+ TEXTURE_ORIGIN_X: "u_textureOriginX",+ TEXTURE_ORIGIN_Y: "u_textureOriginY"+ },+ E_ = { TEXTURE_COORD: "a_textureCoord" },+ w_ = [{ name: E_.TEXTURE_COORD, size: 2, type: Bp }]+ class T_ extends v_ {+ constructor(t, e) {+ super(t, e),+ this.program_,+ (this.vertexShader_ = e.vertexShader),+ (this.fragmentShader_ = e.fragmentShader),+ (this.indices_ = new Mp(qf, Jf)),+ this.indices_.fromArray([0, 1, 3, 1, 2, 3]),+ (this.paletteTextures_ = e.paletteTextures || [])+ }+ reset(t) {+ if ((super.reset(t), this.helper)) {+ const t = this.helper.getGL()+ for (const e of this.paletteTextures_) e.delete(t)+ }+ if (+ ((this.vertexShader_ = t.vertexShader),+ (this.fragmentShader_ = t.fragmentShader),+ (this.paletteTextures_ = t.paletteTextures || []),+ this.helper)+ ) {+ this.program_ = this.helper.getProgram(this.fragmentShader_, this.vertexShader_)+ const t = this.helper.getGL()+ for (const e of this.paletteTextures_) e.getTexture(t)+ }+ }+ afterHelperCreated() {+ super.afterHelperCreated()+ const t = this.helper.getGL()+ for (const e of this.paletteTextures_) e.getTexture(t)+ ;(this.program_ = this.helper.getProgram(this.fragmentShader_, this.vertexShader_)),+ this.helper.flushBufferData(this.indices_)+ }+ removeHelper() {+ if (this.helper) {+ const t = this.helper.getGL()+ for (const e of this.paletteTextures_) e.delete(t)+ }+ super.removeHelper()+ }+ createTileRepresentation(t) {+ return new i_(t)+ }+ beforeTilesRender(t, e) {+ super.beforeTilesRender(t, e), this.helper.useProgram(this.program_, t)+ }+ renderTile(t, e, i, n, r, s, o, a, l, h, c) {+ const u = this.helper.getGL()+ this.helper.bindBuffer(t.coords), this.helper.bindBuffer(this.indices_), this.helper.enableAttributes(w_)+ let d = 0+ for (; d < t.textures.length; ) {+ const e = `${S_.TILE_TEXTURE_ARRAY}[${d}]`+ this.helper.bindTexture(t.textures[d], d, e), ++d+ }+ for (let t = 0; t < this.paletteTextures_.length; ++t) {+ const e = this.paletteTextures_[t],+ i = e.getTexture(u)+ this.helper.bindTexture(i, d, e.name), ++d+ }+ const g = i.viewState,+ f = s[0] + 2 * h,+ p = s[1] + 2 * h,+ _ = t.tile.tileCoord,+ m = _[1],+ y = _[2]+ this.helper.setUniformMatrixValue(S_.TILE_TRANSFORM, Qd(this.tempMat4, e)),+ this.helper.setUniformFloatValue(S_.TRANSITION_ALPHA, c),+ this.helper.setUniformFloatValue(S_.DEPTH, l)+ let x = n+ h > 0 && ((x = a), me(x, n, x)),+ this.helper.setUniformFloatVec4(S_.RENDER_EXTENT, x),+ this.helper.setUniformFloatValue(S_.RESOLUTION, g.resolution),+ this.helper.setUniformFloatValue(S_.ZOOM, g.zoom),+ this.helper.setUniformFloatValue(S_.TEXTURE_PIXEL_WIDTH, f),+ this.helper.setUniformFloatValue(S_.TEXTURE_PIXEL_HEIGHT, p),+ this.helper.setUniformFloatValue(S_.TEXTURE_RESOLUTION, r),+ this.helper.setUniformFloatValue(S_.TEXTURE_ORIGIN_X, o[0] + m * s[0] * r - h * r),+ this.helper.setUniformFloatValue(S_.TEXTURE_ORIGIN_Y, o[1] - y * s[1] * r + h * r),+ this.helper.drawElements(0, this.indices_.getSize())+ }+ getData(t) {+ if (!this.helper.getGL()) return null+ const e = this.frameState+ if (!e) return null+ const i = this.getLayer(),+ n = Qn(e.pixelToCoordinateTransform, t.slice()),+ r = e.viewState,+ s = i.getExtent()+ if (s && !$t(zn(s, r.projection), n)) return null+ const o = i.getSources(Bt([n]), r.resolution)+ let a, l, h+ for (a = o.length - 1; a >= 0; --a)+ if (((l = o[a]), "ready" === l.getState())) {+ if (((h = l.getTileGridForProjection(r.projection)), l.getWrapX())) break+ const t = h.getExtent()+ if (!t || $t(t, n)) break+ }+ if (a < 0) return null+ const c = this.tileRepresentationCache+ for (let t = h.getZForResolution(r.resolution); t >= h.getMinZoom(); --t) {+ const e = h.getTileCoordForCoordAndZ(n, t),+ i = x_(l, e)+ if (!c.containsKey(i)) continue+ const r = c.get(i)+ if (r.tile.getState() === J) return null+ if (!r.loaded) continue+ const s = h.getOrigin(t),+ o = Wl(h.getTileSize(t)),+ a = h.getResolution(t),+ u = (n[0] - s[0]) / a - e[1] * o[0],+ d = (s[1] - n[1]) / a - e[2] * o[1]+ return r.getPixelData(u, d)+ }+ return null+ }+ disposeInternal() {+ const t = this.helper+ if (t) {+ const e = t.getGL()+ for (const t of this.paletteTextures_) t.delete(e)+ ;(this.paletteTextures_.length = 0),+ e.deleteProgram(this.program_),+ delete this.program_,+ t.deleteBuffer(this.indices_)+ }+ super.disposeInternal(), delete this.indices_+ }+ }+ const C_ = {+ TEXTURE: "u_texture",+ VELOCITY_TEXTURE: "u_velocityTexture",+ POSITION_TEXTURE: "u_positionTexture",+ PARTICLE_COUNT_SQRT: "u_particleCountSqrt",+ MAX_SPEED: "u_maxSpeed",+ RANDOM_SEED: "u_randomSeed",+ SPEED_FACTOR: "u_speedFactor",+ DROP_RATE: "u_dropRate",+ DROP_RATE_BUMP: "u_dropRateBump",+ OPACITY: "u_opacity",+ ROTATION: kp.ROTATION,+ VIEWPORT_SIZE_PX: kp.VIEWPORT_SIZE_PX+ },+ b_ = "a_position",+ R_ = "a_index",+ P_ = "v_position"+ class I_ extends T_ {+ constructor(t, e) {+ super(t, {+ vertexShader: e.tileVertexShader,+ fragmentShader: e.tileFragmentShader,+ cacheSize: e.cacheSize,+ postProcesses: [{}],+ uniforms: { [C_.MAX_SPEED]: e.maxSpeed }+ }),+ (this.particleColorFragmentShader_ = e.particleColorFragmentShader),+ (this.velocityTexture_ = null),+ (this.particleCountSqrt_ = e.particles ? Math.ceil(Math.sqrt(e.particles)) : 256),+ this.particleIndexBuffer_,+ this.quadBuffer_,+ this.particlePositionProgram_,+ (this.particlePositionVertexShader_ = e.particlePositionVertexShader),+ (this.particlePositionFragmentShader_ = e.particlePositionFragmentShader),+ this.previousPositionTexture_,+ this.nextPositionTexture_,+ this.particleColorProgram_,+ (this.particleColorVertexShader_ = e.particleColorVertexShader),+ (this.particleColorFragmentShader_ = e.particleColorFragmentShader),+ this.textureProgram_,+ (this.textureVertexShader_ = e.textureVertexShader),+ (this.textureFragmentShader_ = e.textureFragmentShader),+ this.previousTrailsTexture_,+ this.nextTrailsTexture_,+ (this.fadeOpacity_ = 0.996),+ (this.maxSpeed_ = e.maxSpeed),+ (this.speedFactor_ = e.speedFactor || 0.001),+ (this.dropRate_ = 0.003),+ (this.dropRateBump_ = 0.01),+ (this.tempVec2_ = [0, 0]),+ (this.renderedWidth_ = 0),+ (this.renderedHeight_ = 0)+ }+ afterHelperCreated() {+ super.afterHelperCreated()+ const t = this.helper,+ e = t.getGL()+ this.framebuffer_ = e.createFramebuffer()+ const i = this.particleCountSqrt_ * this.particleCountSqrt_,+ n = new Float32Array(i)+ for (let t = 0; t < i; ++t) n[t] = t+ const r = new Mp(Kf, Jf)+ r.setArray(n), t.flushBufferData(r), (this.particleIndexBuffer_ = r)+ const s = new Float32Array([0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1]),+ o = new Mp(Kf, Jf)+ o.setArray(s), t.flushBufferData(o), (this.quadBuffer_ = o)+ const a = new Uint8Array(4 * i)+ for (let t = 0; t < a.length; ++t) a[t] = Math.floor(256 * Math.random())+ ;(this.previousPositionTexture_ = t.createTexture(+ [this.particleCountSqrt_, this.particleCountSqrt_],+ a,+ null,+ !0+ )),+ (this.nextPositionTexture_ = t.createTexture([this.particleCountSqrt_, this.particleCountSqrt_], a, null, !0)),+ (this.particlePositionProgram_ = t.getProgram(+ this.particlePositionFragmentShader_,+ this.particlePositionVertexShader_+ )),+ (this.particleColorProgram_ = t.getProgram(this.particleColorFragmentShader_, this.particleColorVertexShader_)),+ (this.textureProgram_ = t.getProgram(this.textureFragmentShader_, this.textureVertexShader_))+ }+ createSizeDependentTextures_() {+ const t = this.helper,+ e = t.getGL(),+ i = t.getCanvas(),+ n = i.width,+ r = i.height,+ s = new Uint8Array(n * r * 4)+ this.nextTrailsTexture_ && e.deleteTexture(this.nextTrailsTexture_),+ (this.nextTrailsTexture_ = t.createTexture([n, r], s, null, !0)),+ this.previousTrailsTexture_ && e.deleteTexture(this.previousTrailsTexture_),+ (this.previousTrailsTexture_ = t.createTexture([n, r], s, null, !0))+ }+ beforeFinalize(t) {+ const e = this.helper,+ i = e.getGL(),+ n = e.getCanvas(),+ r = n.width,+ s = n.height+ ;(this.renderedWidth_ == r && this.renderedHeight_ == s) || this.createSizeDependentTextures_()+ const o = [r, s]+ ;(this.velocityTexture_ = e.createTexture(o, null, this.velocityTexture_)),+ i.copyTexImage2D(i.TEXTURE_2D, 0, i.RGBA, 0, 0, r, s, 0),+ this.drawParticleTrails_(t),+ this.updateParticlePositions_(t),+ (t.animate = !0),+ (this.renderedWidth_ = r),+ (this.renderedHeight_ = s)+ }+ drawParticleTrails_(t) {+ const e = this.helper,+ i = e.getGL()+ e.bindFrameBuffer(this.framebuffer_, this.nextTrailsTexture_),+ this.drawTexture_(this.previousTrailsTexture_, this.fadeOpacity_),+ this.drawParticleColor_(t),+ e.bindInitialFrameBuffer(),+ i.clearColor(0, 0, 0, 0),+ i.clear(i.COLOR_BUFFER_BIT),+ i.enable(i.BLEND),+ i.blendFunc(i.SRC_ALPHA, i.ONE_MINUS_SRC_ALPHA),+ this.drawTexture_(this.nextTrailsTexture_, 1),+ i.disable(i.BLEND)+ const n = this.nextTrailsTexture_+ ;(this.nextTrailsTexture_ = this.previousTrailsTexture_), (this.previousTrailsTexture_ = n)+ }+ drawTexture_(t, e) {+ const i = this.helper,+ n = i.getGL()+ i.useProgram(this.textureProgram_),+ i.bindTexture(t, 0, C_.TEXTURE),+ i.bindAttribute(this.quadBuffer_, b_, 2),+ this.helper.setUniformFloatValue(C_.OPACITY, e),+ n.drawArrays(n.TRIANGLES, 0, 6)+ }+ drawParticleColor_(t) {+ const e = this.helper,+ i = e.getGL()+ e.useProgram(this.particleColorProgram_)+ const n = this.particleCountSqrt_ * this.particleCountSqrt_+ e.bindAttribute(this.particleIndexBuffer_, R_, 1),+ e.bindTexture(this.previousPositionTexture_, 0, C_.POSITION_TEXTURE),+ e.bindTexture(this.velocityTexture_, 1, C_.VELOCITY_TEXTURE),+ this.helper.setUniformFloatValue(C_.PARTICLE_COUNT_SQRT, this.particleCountSqrt_)+ const r = this.tempVec2_+ ;(r[0] = Math.cos(-t.viewState.rotation)),+ (r[1] = Math.sin(-t.viewState.rotation)),+ this.helper.setUniformFloatVec2(C_.ROTATION, r),+ this.helper.setUniformFloatValue(C_.MAX_SPEED, this.maxSpeed_),+ i.drawArrays(i.POINTS, 0, n)+ }+ updateParticlePositions_(t) {+ const e = this.helper,+ i = e.getGL()+ e.useProgram(this.particlePositionProgram_),+ i.viewport(0, 0, this.particleCountSqrt_, this.particleCountSqrt_),+ e.bindFrameBuffer(this.framebuffer_, this.nextPositionTexture_),+ e.bindTexture(this.previousPositionTexture_, 0, C_.POSITION_TEXTURE),+ e.bindTexture(this.velocityTexture_, 1, C_.VELOCITY_TEXTURE),+ e.bindAttribute(this.quadBuffer_, b_, 2),+ e.setUniformFloatValue(C_.RANDOM_SEED, Math.random()),+ e.setUniformFloatValue(C_.SPEED_FACTOR, this.speedFactor_),+ e.setUniformFloatValue(C_.DROP_RATE, this.dropRate_),+ e.setUniformFloatValue(C_.DROP_RATE_BUMP, this.dropRateBump_)+ const n = this.tempVec2_+ ;(n[0] = Math.cos(-t.viewState.rotation)),+ (n[1] = Math.sin(-t.viewState.rotation)),+ this.helper.setUniformFloatVec2(C_.ROTATION, n)+ const r = t.size+ this.helper.setUniformFloatVec2(C_.VIEWPORT_SIZE_PX, [r[0], r[1]]), i.drawArrays(i.TRIANGLES, 0, 6)+ const s = this.nextPositionTexture_+ ;(this.nextPositionTexture_ = this.previousPositionTexture_), (this.previousPositionTexture_ = s)+ }+ }+ const F_ = "GENERATE_POLYGON_BUFFERS",+ L_ = "GENERATE_POINT_BUFFERS",+ M_ = "GENERATE_LINE_STRING_BUFFERS"+ function A_(t, e) {+ e = e || []+ const i = 256,+ n = 255,+ r = Math.floor(t / i / i / i) / n,+ s = (Math.floor(t / i / i) % i) / n,+ o = (Math.floor(t / i) % i) / n,+ a = (t % i) / n+ return (e[0] = 256 * r * 255 + 255 * s), (e[1] = 256 * o * 255 + 255 * a), e+ }+ function O_(t) {+ let e = 0+ const i = 256,+ n = 255+ return (+ (e += Math.round(t[0] * i * i * i * n)),+ (e += Math.round(t[1] * i * i * n)),+ (e += Math.round(t[2] * i * n)),+ (e += Math.round(t[3] * n)),+ e+ )+ }+ function D_() {+ const t =+ 'function t(t,n,x=2){const o=n&&n.length,i=o?n[0]*x:t.length;let f=e(t,0,i,x,!0);const l=[];if(!f||f.next===f.prev)return l;let c,y,h;if(o&&(f=function(t,n,r,x){const o=[];for(let r=0,i=n.length;r<i;r++){const f=e(t,n[r]*x,r<i-1?n[r+1]*x:t.length,x,!1);f===f.next&&(f.steiner=!0),o.push(a(f))}o.sort(u);for(let t=0;t<o.length;t++)r=s(o[t],r);return r}(t,n,f,x)),t.length>80*x){c=t[0],y=t[1];let e=c,n=y;for(let r=x;r<i;r+=x){const x=t[r],o=t[r+1];x<c&&(c=x),o<y&&(y=o),x>e&&(e=x),o>n&&(n=o)}h=Math.max(e-c,n-y),h=0!==h?32767/h:0}return r(f,l,x,c,y,h,0),l}function e(t,e,n,r,x){let o;if(x===function(t,e,n,r){let x=0;for(let o=e,i=n-r;o<n;o+=r)x+=(t[i]-t[o])*(t[o+1]+t[i+1]),i=o;return x}(t,e,n,r)>0)for(let x=e;x<n;x+=r)o=d(x/r|0,t[x],t[x+1],o);else for(let x=n-r;x>=e;x-=r)o=d(x/r|0,t[x],t[x+1],o);return o&&b(o,o.next)&&(w(o),o=o.next),o}function n(t,e){if(!t)return t;e||(e=t);let n,r=t;do{if(n=!1,r.steiner||!b(r,r.next)&&0!==v(r.prev,r,r.next))r=r.next;else{if(w(r),r=e=r.prev,r===r.next)break;n=!0}}while(n||r!==e);return e}function r(t,e,u,s,l,a,y){if(!t)return;!y&&a&&function(t,e,n,r){let x=t;do{0===x.z&&(x.z=c(x.x,x.y,e,n,r)),x.prevZ=x.prev,x.nextZ=x.next,x=x.next}while(x!==t);x.prevZ.nextZ=null,x.prevZ=null,function(t){let e,n=1;do{let r,x=t;t=null;let o=null;for(e=0;x;){e++;let i=x,f=0;for(let t=0;t<n&&(f++,i=i.nextZ,i);t++);let u=n;for(;f>0||u>0&&i;)0!==f&&(0===u||!i||x.z<=i.z)?(r=x,x=x.nextZ,f--):(r=i,i=i.nextZ,u--),o?o.nextZ=r:t=r,r.prevZ=o,o=r;x=i}o.nextZ=null,n*=2}while(e>1)}(x)}(t,s,l,a);let h=t;for(;t.prev!==t.next;){const c=t.prev,p=t.next;if(a?o(t,s,l,a):x(t))e.push(c.i,t.i,p.i),w(t),t=p.next,h=p.next;else if((t=p)===h){y?1===y?r(t=i(n(t),e),e,u,s,l,a,2):2===y&&f(t,e,u,s,l,a):r(n(t),e,u,s,l,a,1);break}}}function x(t){const e=t.prev,n=t,r=t.next;if(v(e,n,r)>=0)return!1;const x=e.x,o=n.x,i=r.x,f=e.y,u=n.y,s=r.y,l=Math.min(x,o,i),c=Math.min(f,u,s),a=Math.max(x,o,i),y=Math.max(f,u,s);let p=r.next;for(;p!==e;){if(p.x>=l&&p.x<=a&&p.y>=c&&p.y<=y&&h(x,f,o,u,i,s,p.x,p.y)&&v(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function o(t,e,n,r){const x=t.prev,o=t,i=t.next;if(v(x,o,i)>=0)return!1;const f=x.x,u=o.x,s=i.x,l=x.y,a=o.y,y=i.y,p=Math.min(f,u,s),b=Math.min(l,a,y),M=Math.max(f,u,s),m=Math.max(l,a,y),A=c(p,b,e,n,r),g=c(M,m,e,n,r);let Z=t.prevZ,d=t.nextZ;for(;Z&&Z.z>=A&&d&&d.z<=g;){if(Z.x>=p&&Z.x<=M&&Z.y>=b&&Z.y<=m&&Z!==x&&Z!==i&&h(f,l,u,a,s,y,Z.x,Z.y)&&v(Z.prev,Z,Z.next)>=0)return!1;if(Z=Z.prevZ,d.x>=p&&d.x<=M&&d.y>=b&&d.y<=m&&d!==x&&d!==i&&h(f,l,u,a,s,y,d.x,d.y)&&v(d.prev,d,d.next)>=0)return!1;d=d.nextZ}for(;Z&&Z.z>=A;){if(Z.x>=p&&Z.x<=M&&Z.y>=b&&Z.y<=m&&Z!==x&&Z!==i&&h(f,l,u,a,s,y,Z.x,Z.y)&&v(Z.prev,Z,Z.next)>=0)return!1;Z=Z.prevZ}for(;d&&d.z<=g;){if(d.x>=p&&d.x<=M&&d.y>=b&&d.y<=m&&d!==x&&d!==i&&h(f,l,u,a,s,y,d.x,d.y)&&v(d.prev,d,d.next)>=0)return!1;d=d.nextZ}return!0}function i(t,e){let r=t;do{const n=r.prev,x=r.next.next;!b(n,x)&&M(n,r,r.next,x)&&g(n,x)&&g(x,n)&&(e.push(n.i,r.i,x.i),w(r),w(r.next),r=t=x),r=r.next}while(r!==t);return n(r)}function f(t,e,x,o,i,f){let u=t;do{let t=u.next.next;for(;t!==u.prev;){if(u.i!==t.i&&p(u,t)){let s=Z(u,t);return u=n(u,u.next),s=n(s,s.next),r(u,e,x,o,i,f,0),void r(s,e,x,o,i,f,0)}t=t.next}u=u.next}while(u!==t)}function u(t,e){let n=t.x-e.x;if(0===n&&(n=t.y-e.y,0===n)){n=(t.next.y-t.y)/(t.next.x-t.x)-(e.next.y-e.y)/(e.next.x-e.x)}return n}function s(t,e){const r=function(t,e){let n=e;const r=t.x,x=t.y;let o,i=-1/0;if(b(t,n))return n;do{if(b(t,n.next))return n.next;if(x<=n.y&&x>=n.next.y&&n.next.y!==n.y){const t=n.x+(x-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(t<=r&&t>i&&(i=t,o=n.x<n.next.x?n:n.next,t===r))return o}n=n.next}while(n!==e);if(!o)return null;const f=o,u=o.x,s=o.y;let c=1/0;n=o;do{if(r>=n.x&&n.x>=u&&r!==n.x&&y(x<s?r:i,x,u,s,x<s?i:r,x,n.x,n.y)){const e=Math.abs(x-n.y)/(r-n.x);g(n,t)&&(e<c||e===c&&(n.x>o.x||n.x===o.x&&l(o,n)))&&(o=n,c=e)}n=n.next}while(n!==f);return o}(t,e);if(!r)return e;const x=Z(r,t);return n(x,x.next),n(r,r.next)}function l(t,e){return v(t.prev,t,e.prev)<0&&v(e.next,t,t.next)<0}function c(t,e,n,r,x){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-n)*x|0)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-r)*x|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function a(t){let e=t,n=t;do{(e.x<n.x||e.x===n.x&&e.y<n.y)&&(n=e),e=e.next}while(e!==t);return n}function y(t,e,n,r,x,o,i,f){return(x-i)*(e-f)>=(t-i)*(o-f)&&(t-i)*(r-f)>=(n-i)*(e-f)&&(n-i)*(o-f)>=(x-i)*(r-f)}function h(t,e,n,r,x,o,i,f){return!(t===i&&e===f)&&y(t,e,n,r,x,o,i,f)}function p(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){let n=t;do{if(n.i!==t.i&&n.next.i!==t.i&&n.i!==e.i&&n.next.i!==e.i&&M(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}(t,e)&&(g(t,e)&&g(e,t)&&function(t,e){let n=t,r=!1;const x=(t.x+e.x)/2,o=(t.y+e.y)/2;do{n.y>o!=n.next.y>o&&n.next.y!==n.y&&x<(n.next.x-n.x)*(o-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next}while(n!==t);return r}(t,e)&&(v(t.prev,t,e.prev)||v(t,e.prev,e))||b(t,e)&&v(t.prev,t,t.next)>0&&v(e.prev,e,e.next)>0)}function v(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function b(t,e){return t.x===e.x&&t.y===e.y}function M(t,e,n,r){const x=A(v(t,e,n)),o=A(v(t,e,r)),i=A(v(n,r,t)),f=A(v(n,r,e));return x!==o&&i!==f||(!(0!==x||!m(t,n,e))||(!(0!==o||!m(t,r,e))||(!(0!==i||!m(n,t,r))||!(0!==f||!m(n,e,r)))))}function m(t,e,n){return e.x<=Math.max(t.x,n.x)&&e.x>=Math.min(t.x,n.x)&&e.y<=Math.max(t.y,n.y)&&e.y>=Math.min(t.y,n.y)}function A(t){return t>0?1:t<0?-1:0}function g(t,e){return v(t.prev,t,t.next)<0?v(t,e,t.next)>=0&&v(t,t.prev,e)>=0:v(t,e,t.prev)<0||v(t,t.next,e)<0}function Z(t,e){const n=F(t.i,t.x,t.y),r=F(e.i,e.x,e.y),x=t.next,o=e.prev;return t.next=e,e.prev=t,n.next=x,x.prev=n,r.next=n,n.prev=r,o.next=r,r.prev=o,r}function d(t,e,n,r){const x=F(t,e,n);return r?(x.next=r.next,x.prev=r,r.next.prev=x,r.next=x):(x.prev=x,x.next=x),x}function w(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function F(t,e,n){return{i:t,x:e,y:n,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function E(t,e,n){const r=Math.sqrt((e[0]-t[0])*(e[0]-t[0])+(e[1]-t[1])*(e[1]-t[1])),x=[(e[0]-t[0])/r,(e[1]-t[1])/r],o=[-x[1],x[0]],i=Math.sqrt((n[0]-t[0])*(n[0]-t[0])+(n[1]-t[1])*(n[1]-t[1])),f=[(n[0]-t[0])/i,(n[1]-t[1])/i];let u=0===r||0===i?0:Math.acos((s=f[0]*x[0]+f[1]*x[1],l=-1,c=1,Math.min(Math.max(s,l),c)));var s,l,c;u=Math.max(u,1e-5);return f[0]*o[0]+f[1]*o[1]>0?u:2*Math.PI-u}function I(t,e){const n=e[0],r=e[1];return e[0]=t[0]*n+t[2]*r+t[4],e[1]=t[1]*n+t[3]*r+t[5],e}function z(t,e){const n=(r=e)[0]*r[3]-r[1]*r[2];var r;!function(t,e){if(!t)throw new Error(e)}(0!==n,"Transformation matrix cannot be inverted");const x=e[0],o=e[1],i=e[2],f=e[3],u=e[4],s=e[5];return t[0]=f/n,t[1]=-o/n,t[2]=-i/n,t[3]=x/n,t[4]=(i*s-f*u)/n,t[5]=-(x*s-o*u)/n,t}new Array(6);const B=[],P={vertexAttributesPosition:0,instanceAttributesPosition:0,indicesPosition:0};function N(t,e,n,r,x){const o=t[e++],i=t[e++],f=B;f.length=r;for(let n=0;n<f.length;n++)f[n]=t[e+n];let u=x?x.instanceAttributesPosition:0;return n[u++]=o,n[u++]=i,f.length&&(n.set(f,u),u+=f.length),P.instanceAttributesPosition=u,P}function R(t,e,n,r,x,o,i,f,u,s){const l=[t[e],t[e+1]],c=[t[n],t[n+1]],a=t[e+2],y=t[n+2],h=I(f,[...l]),p=I(f,[...c]);let v=-1,b=-1,M=s;const m=null!==x;if(null!==r){v=E(h,p,I(f,[...[t[r],t[r+1]]])),Math.cos(v)<=.985&&(M+=Math.tan((v-Math.PI)/2))}if(m){b=E(p,h,I(f,[...[t[x],t[x+1]]])),Math.cos(b)<=.985&&(M+=Math.tan((Math.PI-b)/2))}const A=Math.pow(2,24),g=u%A,Z=Math.floor(u/A)*A;return o.push(l[0],l[1],a,c[0],c[1],y,v,b,g,Z,s),o.push(...i),{length:u+Math.sqrt((p[0]-h[0])*(p[0]-h[0])+(p[1]-h[1])*(p[1]-h[1])),angle:M}}function S(e,n,r,x,o){const i=2+o;let f=n;const u=e.slice(f,f+o);f+=o;const s=e[f++];let l=0;const c=new Array(s-1);for(let t=0;t<s;t++)l+=e[f++],t<s-1&&(c[t]=l);const a=e.slice(f,f+2*l),y=t(a,c,2);for(let t=0;t<y.length;t++)x.push(y[t]+r.length/i);for(let t=0;t<a.length;t+=2)r.push(a[t],a[t+1],...u);return f+2*l}const T="GENERATE_POLYGON_BUFFERS",_="GENERATE_POINT_BUFFERS",O="GENERATE_LINE_STRING_BUFFERS",U=self;U.onmessage=t=>{const e=t.data;switch(e.type){case _:{const t=2,n=2,r=e.customAttributesSize,x=n+r,o=new Float32Array(e.renderInstructions),i=o.length/x*(t+r),f=Uint32Array.from([0,1,3,1,2,3]),u=Float32Array.from([-1,-1,1,-1,1,1,-1,1]),s=new Float32Array(i);let l;for(let t=0;t<o.length;t+=x)l=N(o,t,s,r,l);const c=Object.assign({indicesBuffer:f.buffer,vertexAttributesBuffer:u.buffer,instanceAttributesBuffer:s.buffer,renderInstructions:o.buffer},e);U.postMessage(c,[u.buffer,s.buffer,f.buffer,o.buffer]);break}case O:{const t=[],n=e.customAttributesSize,r=3,x=new Float32Array(e.renderInstructions);let o=0;const i=[1,0,0,1,0,0];let f,u;for(z(i,e.renderInstructionsTransform);o<x.length;){u=Array.from(x.slice(o,o+n)),o+=n,f=x[o++];const e=o,s=o+(f-1)*r,l=x[e]===x[s]&&x[e+1]===x[s+1];let c=0,a=0;for(let n=0;n<f-1;n++){let y=null;n>0?y=o+(n-1)*r:l&&(y=s-r);let h=null;n<f-2?h=o+(n+2)*r:l&&(h=e+r);const p=R(x,o+n*r,o+(n+1)*r,y,h,t,u,i,c,a);c=p.length,a=p.angle}o+=f*r}const s=Uint32Array.from([0,1,3,1,2,3]),l=Float32Array.from([-1,-1,1,-1,1,1,-1,1]),c=Float32Array.from(t),a=Object.assign({indicesBuffer:s.buffer,vertexAttributesBuffer:l.buffer,instanceAttributesBuffer:c.buffer,renderInstructions:x.buffer},e);U.postMessage(a,[l.buffer,c.buffer,s.buffer,x.buffer]);break}case T:{const t=[],n=[],r=e.customAttributesSize,x=new Float32Array(e.renderInstructions);let o=0;for(;o<x.length;)o=S(x,o,t,n,r);const i=Uint32Array.from(n),f=Float32Array.from(t),u=Float32Array.from([]),s=Object.assign({indicesBuffer:i.buffer,vertexAttributesBuffer:f.buffer,instanceAttributesBuffer:u.buffer,renderInstructions:x.buffer},e);U.postMessage(s,[f.buffer,u.buffer,i.buffer,x.buffer]);break}}};'+ return new Worker(+ "undefined" == typeof Blob+ ? "data:application/javascript;base64," + Buffer.from(t, "binary").toString("base64")+ : URL.createObjectURL(new Blob([t], { type: "application/javascript" }))+ )+ }+ function N_(t, e) {+ const i = t.viewState.projection,+ n = e.getSource().getWrapX() && i.canWrapX(),+ r = i.getExtent(),+ s = t.extent,+ o = n ? ve(r) : null,+ a = n ? Math.ceil((s[2] - r[2]) / o) + 1 : 1+ return [n ? Math.floor((s[0] - r[0]) / o) : 0, a, o]+ }+ class k_ extends d_ {+ constructor(t, e) {+ const i = e.uniforms || {},+ n = [1, 0, 0, 1, 0, 0]+ ;(i[kp.PROJECTION_MATRIX] = n),+ super(t, { uniforms: i, postProcesses: e.postProcesses }),+ (this.sourceRevision_ = -1),+ (this.verticesBuffer_ = new Mp(Kf, Qf)),+ (this.instanceAttributesBuffer_ = new Mp(Kf, Qf)),+ (this.indicesBuffer_ = new Mp(qf, Qf)),+ (this.vertexShader_ = e.vertexShader),+ (this.fragmentShader_ = e.fragmentShader),+ this.program_,+ (this.hitDetectionEnabled_ = e.hitDetectionEnabled ?? !0)+ const r = e.attributes+ ? e.attributes.map(function (t) {+ return { name: "a_" + t.name, size: 1, type: Bp }+ })+ : []+ ;(this.attributes = [{ name: "a_localPosition", size: 2, type: Bp }]),+ (this.instanceAttributes = [{ name: "a_position", size: 2, type: Bp }]),+ this.hitDetectionEnabled_ &&+ (this.instanceAttributes.push({ name: "a_hitColor", size: 2, type: Bp }),+ this.instanceAttributes.push({ name: "a_featureUid", size: 1, type: Bp })),+ this.instanceAttributes.push(...r),+ (this.customAttributes = e.attributes ? e.attributes : []),+ (this.previousExtent_ = [1 / 0, 1 / 0, -1 / 0, -1 / 0]),+ (this.currentTransform_ = n),+ (this.renderTransform_ = [1, 0, 0, 1, 0, 0]),+ (this.invertRenderTransform_ = [1, 0, 0, 1, 0, 0]),+ (this.renderInstructions_ = new Float32Array(0)),+ this.hitRenderTarget_,+ (this.lastSentId = 0),+ (this.worker_ = D_()),+ this.worker_.addEventListener("message", (t) => {+ const e = t.data+ if (e.type === L_) {+ const i = e.projectionTransform+ this.verticesBuffer_.fromArrayBuffer(e.vertexAttributesBuffer),+ this.instanceAttributesBuffer_.fromArrayBuffer(e.instanceAttributesBuffer),+ this.helper.flushBufferData(this.verticesBuffer_),+ this.helper.flushBufferData(this.instanceAttributesBuffer_),+ this.indicesBuffer_.fromArrayBuffer(e.indicesBuffer),+ this.helper.flushBufferData(this.indicesBuffer_),+ (this.renderTransform_ = i),+ rr(this.invertRenderTransform_, this.renderTransform_),+ (this.renderInstructions_ = new Float32Array(t.data.renderInstructions)),+ e.id === this.lastSentId && (this.ready = !0),+ this.getLayer().changed()+ }+ }),+ (this.featureCache_ = {}),+ (this.featureCount_ = 0)+ const s = this.getLayer().getSource()+ ;(this.sourceListenKeys_ = [+ D(s, Xd, this.handleSourceFeatureAdded_, this),+ D(s, Vd, this.handleSourceFeatureChanged_, this),+ D(s, Wd, this.handleSourceFeatureDelete_, this),+ D(s, $d, this.handleSourceFeatureClear_, this)+ ]),+ s.forEachFeature((t) => {+ const e = t.getGeometry()+ e &&+ "Point" === e.getType() &&+ ((this.featureCache_[z(t)] = {+ feature: t,+ properties: t.getProperties(),+ flatCoordinates: e.getFlatCoordinates()+ }),+ this.featureCount_++)+ })+ }+ afterHelperCreated() {+ ;(this.program_ = this.helper.getProgram(this.fragmentShader_, this.vertexShader_)),+ this.hitDetectionEnabled_ && (this.hitRenderTarget_ = new Kp(this.helper)),+ this.verticesBuffer_.getArray() && this.helper.flushBufferData(this.verticesBuffer_),+ this.indicesBuffer_.getArray() && this.helper.flushBufferData(this.indicesBuffer_)+ }+ handleSourceFeatureAdded_(t) {+ const e = t.feature,+ i = e.getGeometry()+ i &&+ "Point" === i.getType() &&+ ((this.featureCache_[z(e)] = {+ feature: e,+ properties: e.getProperties(),+ flatCoordinates: i.getFlatCoordinates()+ }),+ this.featureCount_++)+ }+ handleSourceFeatureChanged_(t) {+ const e = t.feature,+ i = z(e),+ n = this.featureCache_[i],+ r = e.getGeometry()+ n+ ? r && "Point" === r.getType()+ ? ((n.properties = e.getProperties()), (n.flatCoordinates = r.getFlatCoordinates()))+ : (delete this.featureCache_[i], this.featureCount_--)+ : r &&+ "Point" === r.getType() &&+ ((this.featureCache_[i] = {+ feature: e,+ properties: e.getProperties(),+ flatCoordinates: r.getFlatCoordinates()+ }),+ this.featureCount_++)+ }+ handleSourceFeatureDelete_(t) {+ const e = z(t.feature)+ e in this.featureCache_ && (delete this.featureCache_[e], this.featureCount_--)+ }+ handleSourceFeatureClear_() {+ ;(this.featureCache_ = {}), (this.featureCount_ = 0)+ }+ renderFrame(t) {+ const e = this.helper.getGL()+ this.preRender(e, t)+ const [i, n, r] = N_(t, this.getLayer())+ this.renderWorlds(t, !1, i, n, r),+ this.helper.finalizeDraw(t, this.dispatchPreComposeEvent, this.dispatchPostComposeEvent),+ this.hitDetectionEnabled_ && (this.renderWorlds(t, !0, i, n, r), this.hitRenderTarget_.clearCachedData()),+ this.postRender(e, t)+ return this.helper.getCanvas()+ }+ prepareFrameInternal(t) {+ const e = this.getLayer(),+ i = e.getSource(),+ n = t.viewState,+ r = !t.viewHints[co] && !t.viewHints[uo],+ s = !te(this.previousExtent_, t.extent),+ o = this.sourceRevision_ < i.getRevision()+ if ((o && (this.sourceRevision_ = i.getRevision()), r && (s || o))) {+ const r = n.projection,+ s = n.resolution,+ o = e instanceof zc ? e.getRenderBuffer() : 0,+ a = zt(t.extent, o * s)+ i.loadFeatures(a, s, r), this.rebuildBuffers_(t), (this.previousExtent_ = t.extent.slice())+ }+ return this.helper.useProgram(this.program_, t), this.helper.prepareDraw(t), !0+ }+ rebuildBuffers_(t) {+ const e = [1, 0, 0, 1, 0, 0]+ this.helper.makeProjectionTransform(t, e)+ const i = Gn(),+ n = (this.hitDetectionEnabled_ ? 5 : 2) + this.customAttributes.length,+ r = n * this.featureCount_,+ s =+ this.renderInstructions_ && this.renderInstructions_.length === r+ ? this.renderInstructions_+ : new Float32Array(r)+ this.renderInstructions_ = null+ let o = []+ const a = []+ let l = -1+ const h = t.viewState.projection+ for (const t in this.featureCache_) {+ const n = this.featureCache_[t]+ if (+ (i ? (o = Un(n.flatCoordinates, h)) : ((o[0] = n.flatCoordinates[0]), (o[1] = n.flatCoordinates[1])),+ Qn(e, o),+ (s[++l] = o[0]),+ (s[++l] = o[1]),+ this.hitDetectionEnabled_)+ ) {+ const e = A_(l + 3, a)+ ;(s[++l] = e[0]), (s[++l] = e[1]), (s[++l] = Number(t))+ }+ for (let t = 0; t < this.customAttributes.length; t++) {+ const e = this.customAttributes[t].callback(n.feature, n.properties)+ s[++l] = e+ }+ }+ const c = { id: ++this.lastSentId, type: L_, renderInstructions: s.buffer, customAttributesSize: n - 2 }+ ;(c.projectionTransform = e), (this.ready = !1), this.worker_.postMessage(c, [s.buffer])+ }+ forEachFeatureAtCoordinate(t, e, i, n, r) {+ if (+ (Mt(+ this.hitDetectionEnabled_,+ "`forEachFeatureAtCoordinate` cannot be used on a WebGL layer if the hit detection logic has been disabled using the `disableHitDetection: true` option."+ ),+ !this.renderInstructions_ || !this.hitDetectionEnabled_)+ )+ return+ const s = Qn(e.coordinateToPixelTransform, t.slice()),+ o = this.hitRenderTarget_.readPixel(s[0] / 2, s[1] / 2),+ a = O_([o[0] / 255, o[1] / 255, o[2] / 255, o[3] / 255]),+ l = this.renderInstructions_[a],+ h = Math.floor(l).toString(),+ c = this.getLayer().getSource().getFeatureByUid(h)+ return c ? n(c, this.getLayer(), null) : void 0+ }+ renderWorlds(t, e, i, n, r) {+ let s = i+ this.helper.useProgram(this.program_, t),+ e &&+ (this.hitRenderTarget_.setSize([Math.floor(t.size[0] / 2), Math.floor(t.size[1] / 2)]),+ this.helper.prepareDrawToRenderTarget(t, this.hitRenderTarget_, !0))+ const o = this.instanceAttributes.reduce((t, e) => t + (e.size || 1), 0),+ a = this.instanceAttributesBuffer_.getSize() / o+ do {+ this.helper.bindBuffer(this.indicesBuffer_),+ this.helper.bindBuffer(this.verticesBuffer_),+ this.helper.enableAttributes(this.attributes),+ this.helper.bindBuffer(this.instanceAttributesBuffer_),+ this.helper.enableAttributesInstanced(this.instanceAttributes),+ this.helper.makeProjectionTransform(t, this.currentTransform_),+ ir(this.currentTransform_, s * r, 0),+ Kn(this.currentTransform_, this.invertRenderTransform_),+ this.helper.applyUniforms(t),+ this.helper.applyHitDetectionUniform(e)+ const i = this.indicesBuffer_.getSize()+ this.helper.drawElementsInstanced(0, i, a)+ } while (++s < n)+ }+ disposeInternal() {+ this.worker_.terminate(),+ this.sourceListenKeys_.forEach(function (t) {+ k(t)+ }),+ (this.sourceListenKeys_ = null),+ super.disposeInternal()+ }+ renderDeclutter() {}+ }+ function G_(t) {+ const e = t.toString()+ return e.includes(".") ? e : e + ".0"+ }+ function j_(t) {+ if (t.length < 2 || t.length > 4) throw new Error("`formatArray` can only output `vec2`, `vec3` or `vec4` arrays.")+ return `vec${t.length}(${t.map(G_).join(", ")})`+ }+ function U_(t) {+ const e = zl(t),+ i = e.length > 3 ? e[3] : 1+ return j_([e[0] / 255, e[1] / 255, e[2] / 255, i])+ }+ function B_(t) {+ return j_(Wl(t))+ }+ const z_ = {}+ let X_ = 0+ function V_(t) {+ return t in z_ || (z_[t] = X_++), z_[t]+ }+ function $_(t) {+ return G_(V_(t))+ }+ function W_(t) {+ return "u_var_" + t+ }+ function Z_() {+ return { variables: {}, properties: {}, functions: {}, bandCount: 0, featureId: !1, geometryType: !1 }+ }+ const Y_ = "getBandValue",+ H_ = "u_paletteTextures",+ K_ = "featureId",+ q_ = "geometryType",+ J_ = -9999999+ function Q_(t, e, i, n) {+ return im(hh(t, e, i), e, n)+ }+ function tm(t) {+ return (e, i, n) => {+ const r = i.args.length,+ s = new Array(r)+ for (let t = 0; t < r; ++t) s[t] = im(i.args[t], n, e)+ return t(s, e)+ }+ }+ const em = {+ [ch.Get]: (t, e) => {+ const i = e.args[0].value+ i in t.properties || (t.properties[i] = { name: i, type: e.type })+ let n = "a_prop_" + i+ return sh(e.type, Yl) && (n = `(${n} > 0.0)`), n+ },+ [ch.Id]: (t) => ((t.featureId = !0), "a_" + K_),+ [ch.GeometryType]: (t) => ((t.geometryType = !0), "a_" + q_),+ [ch.LineMetric]: () => "currentLineMetric",+ [ch.Var]: (t, e) => {+ const i = e.args[0].value+ i in t.variables || (t.variables[i] = { name: i, type: e.type })+ let n = W_(i)+ return sh(e.type, Yl) && (n = `(${n} > 0.0)`), n+ },+ [ch.Has]: (t, e) => {+ const i = e.args[0].value+ return i in t.properties || (t.properties[i] = { name: i, type: e.type }), `(a_prop_${i} != ${G_(J_)})`+ },+ [ch.Resolution]: () => "u_resolution",+ [ch.Zoom]: () => "u_zoom",+ [ch.Time]: () => "u_time",+ [ch.Any]: tm((t) => `(${t.join(" || ")})`),+ [ch.All]: tm((t) => `(${t.join(" && ")})`),+ [ch.Not]: tm(([t]) => `(!${t})`),+ [ch.Equal]: tm(([t, e]) => `(${t} == ${e})`),+ [ch.NotEqual]: tm(([t, e]) => `(${t} != ${e})`),+ [ch.GreaterThan]: tm(([t, e]) => `(${t} > ${e})`),+ [ch.GreaterThanOrEqualTo]: tm(([t, e]) => `(${t} >= ${e})`),+ [ch.LessThan]: tm(([t, e]) => `(${t} < ${e})`),+ [ch.LessThanOrEqualTo]: tm(([t, e]) => `(${t} <= ${e})`),+ [ch.Multiply]: tm((t) => `(${t.join(" * ")})`),+ [ch.Divide]: tm(([t, e]) => `(${t} / ${e})`),+ [ch.Add]: tm((t) => `(${t.join(" + ")})`),+ [ch.Subtract]: tm(([t, e]) => `(${t} - ${e})`),+ [ch.Clamp]: tm(([t, e, i]) => `clamp(${t}, ${e}, ${i})`),+ [ch.Mod]: tm(([t, e]) => `mod(${t}, ${e})`),+ [ch.Pow]: tm(([t, e]) => `pow(${t}, ${e})`),+ [ch.Abs]: tm(([t]) => `abs(${t})`),+ [ch.Floor]: tm(([t]) => `floor(${t})`),+ [ch.Ceil]: tm(([t]) => `ceil(${t})`),+ [ch.Round]: tm(([t]) => `floor(${t} + 0.5)`),+ [ch.Sin]: tm(([t]) => `sin(${t})`),+ [ch.Cos]: tm(([t]) => `cos(${t})`),+ [ch.Atan]: tm(([t, e]) => (void 0 !== e ? `atan(${t}, ${e})` : `atan(${t})`)),+ [ch.Sqrt]: tm(([t]) => `sqrt(${t})`),+ [ch.Match]: tm((t) => {+ const e = t[0],+ i = t[t.length - 1]+ let n = null+ for (let r = t.length - 3; r >= 1; r -= 2) {+ n = `(${e} == ${t[r]} ? ${t[r + 1]} : ${n || i})`+ }+ return n+ }),+ [ch.Between]: tm(([t, e, i]) => `(${t} >= ${e} && ${t} <= ${i})`),+ [ch.Interpolate]: tm(([t, e, ...i]) => {+ let n = ""+ for (let r = 0; r < i.length - 2; r += 2) {+ const s = i[r],+ o = n || i[r + 1],+ a = i[r + 2],+ l = i[r + 3]+ let h+ ;(h =+ t === G_(1)+ ? `(${e} - ${s}) / (${a} - ${s})`+ : `(pow(${t}, (${e} - ${s})) - 1.0) / (pow(${t}, (${a} - ${s})) - 1.0)`),+ (n = `mix(${o}, ${l}, clamp(${h}, 0.0, 1.0))`)+ }+ return n+ }),+ [ch.Case]: tm((t) => {+ const e = t[t.length - 1]+ let i = null+ for (let n = t.length - 3; n >= 0; n -= 2) {+ i = `(${t[n]} ? ${t[n + 1]} : ${i || e})`+ }+ return i+ }),+ [ch.In]: tm(([t, ...e], i) => {+ const n = (function (t, e) {+ return `operator_${t}_${Object.keys(e.functions).length}`+ })("in", i),+ r = []+ for (let t = 0; t < e.length; t += 1) r.push(` if (inputValue == ${e[t]}) { return true; }`)+ return (i.functions[n] = `bool ${n}(float inputValue) {\n${r.join("\n")}\n return false;\n}`), `${n}(${t})`+ }),+ [ch.Array]: tm((t) => `vec${t.length}(${t.join(", ")})`),+ [ch.Color]: tm((t) => {+ if (1 === t.length) return `vec4(vec3(${t[0]} / 255.0), 1.0)`+ if (2 === t.length) return `vec4(vec3(${t[0]} / 255.0), ${t[1]})`+ const e = t.slice(0, 3).map((t) => `${t} / 255.0`)+ if (3 === t.length) return `vec4(${e.join(", ")}, 1.0)`+ const i = t[3]+ return `vec4(${e.join(", ")}, ${i})`+ }),+ [ch.Band]: tm(([t, e, i], n) => {+ if (!(Y_ in n.functions)) {+ let t = ""+ const e = n.bandCount || 1+ for (let i = 0; i < e; i++) {+ const n = Math.floor(i / 4)+ let r = i % 4+ i === e - 1 && 1 === r && (r = 3)+ t += ` if (band == ${+ i + 1+ }.0) {\n return texture2D(${`${S_.TILE_TEXTURE_ARRAY}[${n}]`}, v_textureCoord + vec2(dx, dy))[${r}];\n }\n`+ }+ n.functions[+ Y_+ ] = `float getBandValue(float band, float xOffset, float yOffset) {\n float dx = xOffset / ${S_.TEXTURE_PIXEL_WIDTH};\n float dy = yOffset / ${S_.TEXTURE_PIXEL_HEIGHT};\n${t}\n}`+ }+ return `${Y_}(${t}, ${e ?? "0.0"}, ${i ?? "0.0"})`+ }),+ [ch.Palette]: (t, e) => {+ const [i, ...n] = e.args,+ r = n.length,+ s = new Uint8Array(4 * r)+ for (let t = 0; t < n.length; t++) {+ const e = zl(n[t].value),+ i = 4 * t+ ;(s[i] = e[0]), (s[i + 1] = e[1]), (s[i + 2] = e[2]), (s[i + 3] = 255 * e[3])+ }+ t.paletteTextures || (t.paletteTextures = [])+ const o = `${H_}[${t.paletteTextures.length}]`,+ a = new Yp(o, s)+ t.paletteTextures.push(a)+ return `texture2D(${o}, vec2((${im(i, Hl, t)} + 0.5) / ${r}.0, 0.5))`+ }+ }+ function im(t, e, i) {+ if (t instanceof ah) {+ const n = em[t.operator]+ if (void 0 === n) throw new Error(`No compiler defined for this operator: ${JSON.stringify(t.operator)}`)+ return n(i, t, e)+ }+ if ((t.type & Hl) > 0) return G_(t.value)+ if ((t.type & Yl) > 0) return t.value.toString()+ if ((t.type & Kl) > 0) return $_(t.value.toString())+ if ((t.type & ql) > 0) return U_(t.value)+ if ((t.type & Jl) > 0) return j_(t.value)+ if ((t.type & Ql) > 0) return B_(t.value)+ throw new Error(`Unexpected expression ${t.value} (expected type ${nh(e)})`)+ }+ function nm(t, e, i, n) {+ let r = 0+ for (const s in e) {+ const o = e[s],+ a = o.callback.call(i, i.feature)+ let l = a?.[0] ?? a+ l === J_ && console.warn('The "has" operator might return false positives.'),+ void 0 === l ? (l = J_) : null === l && (l = 0),+ (t[n + r++] = l),+ o.size &&+ 1 !== o.size &&+ ((t[n + r++] = a[1]), o.size < 3 || ((t[n + r++] = a[2]), o.size < 4 || (t[n + r++] = a[3])))+ }+ return r+ }+ function rm(t) {+ return Object.keys(t).reduce((e, i) => e + (t[i].size || 1), 0)+ }+ function sm(t, e, i, n) {+ const r = (2 + rm(i)) * t.geometriesCount+ ;(e && e.length === r) || (e = new Float32Array(r))+ const s = []+ let o = 0+ for (const r in t.entries) {+ const a = t.entries[r]+ for (let t = 0, r = a.flatCoordss.length; t < r; t++)+ (s[0] = a.flatCoordss[t][0]),+ (s[1] = a.flatCoordss[t][1]),+ Qn(n, s),+ (e[o++] = s[0]),+ (e[o++] = s[1]),+ (o += nm(e, i, a, o))+ }+ return e+ }+ function om(t, e, i, n) {+ const r = 3 * t.verticesCount + (1 + rm(i)) * t.geometriesCount+ ;(e && e.length === r) || (e = new Float32Array(r))+ const s = []+ let o = 0+ for (const r in t.entries) {+ const a = t.entries[r]+ for (let t = 0, r = a.flatCoordss.length; t < r; t++) {+ ;(s.length = a.flatCoordss[t].length),+ cr(a.flatCoordss[t], 0, s.length, 3, n, s, 3),+ (o += nm(e, i, a, o)),+ (e[o++] = s.length / 3)+ for (let t = 0, i = s.length; t < i; t += 3) (e[o++] = s[t]), (e[o++] = s[t + 1]), (e[o++] = s[t + 2])+ }+ }+ return e+ }+ function am(t, e, i, n) {+ const r = 2 * t.verticesCount + (1 + rm(i)) * t.geometriesCount + t.ringsCount+ ;(e && e.length === r) || (e = new Float32Array(r))+ const s = []+ let o = 0+ for (const r in t.entries) {+ const a = t.entries[r]+ for (let t = 0, r = a.flatCoordss.length; t < r; t++) {+ ;(s.length = a.flatCoordss[t].length),+ cr(a.flatCoordss[t], 0, s.length, 2, n, s),+ (o += nm(e, i, a, o)),+ (e[o++] = a.ringsVerticesCounts[t].length)+ for (let i = 0, n = a.ringsVerticesCounts[t].length; i < n; i++) e[o++] = a.ringsVerticesCounts[t][i]+ for (let t = 0, i = s.length; t < i; t += 2) (e[o++] = s[t]), (e[o++] = s[t + 1])+ }+ }+ return e+ }+ function lm(t, e, i = 2) {+ const n = e && e.length,+ r = n ? e[0] * i : t.length+ let s = hm(t, 0, r, i, !0)+ const o = []+ if (!s || s.next === s.prev) return o+ let a, l, h+ if (+ (n &&+ (s = (function (t, e, i, n) {+ const r = []+ for (let i = 0, s = e.length; i < s; i++) {+ const o = hm(t, e[i] * n, i < s - 1 ? e[i + 1] * n : t.length, n, !1)+ o === o.next && (o.steiner = !0), r.push(vm(o))+ }+ r.sort(_m)+ for (let t = 0; t < r.length; t++) i = mm(r[t], i)+ return i+ })(t, e, s, i)),+ t.length > 80 * i)+ ) {+ ;(a = t[0]), (l = t[1])+ let e = a,+ n = l+ for (let s = i; s < r; s += i) {+ const i = t[s],+ r = t[s + 1]+ i < a && (a = i), r < l && (l = r), i > e && (e = i), r > n && (n = r)+ }+ ;(h = Math.max(e - a, n - l)), (h = 0 !== h ? 32767 / h : 0)+ }+ return um(s, o, i, a, l, h, 0), o+ }+ function hm(t, e, i, n, r) {+ let s+ if (+ r ===+ (function (t, e, i, n) {+ let r = 0+ for (let s = e, o = i - n; s < i; s += n) (r += (t[o] - t[s]) * (t[s + 1] + t[o + 1])), (o = s)+ return r+ })(t, e, i, n) >+ 0+ )+ for (let r = e; r < i; r += n) s = Lm((r / n) | 0, t[r], t[r + 1], s)+ else for (let r = i - n; r >= e; r -= n) s = Lm((r / n) | 0, t[r], t[r + 1], s)+ return s && Cm(s, s.next) && (Mm(s), (s = s.next)), s+ }+ function cm(t, e) {+ if (!t) return t+ e || (e = t)+ let i,+ n = t+ do {+ if (((i = !1), n.steiner || (!Cm(n, n.next) && 0 !== Tm(n.prev, n, n.next)))) n = n.next+ else {+ if ((Mm(n), (n = e = n.prev), n === n.next)) break+ i = !0+ }+ } while (i || n !== e)+ return e+ }+ function um(t, e, i, n, r, s, o) {+ if (!t) return+ !o &&+ s &&+ (function (t, e, i, n) {+ let r = t+ do {+ 0 === r.z && (r.z = xm(r.x, r.y, e, i, n)), (r.prevZ = r.prev), (r.nextZ = r.next), (r = r.next)+ } while (r !== t)+ ;(r.prevZ.nextZ = null),+ (r.prevZ = null),+ (function (t) {+ let e,+ i = 1+ do {+ let n,+ r = t+ t = null+ let s = null+ for (e = 0; r; ) {+ e+++ let o = r,+ a = 0+ for (let t = 0; t < i && (a++, (o = o.nextZ), o); t++);+ let l = i+ for (; a > 0 || (l > 0 && o); )+ 0 !== a && (0 === l || !o || r.z <= o.z)+ ? ((n = r), (r = r.nextZ), a--)+ : ((n = o), (o = o.nextZ), l--),+ s ? (s.nextZ = n) : (t = n),+ (n.prevZ = s),+ (s = n)+ r = o+ }+ ;(s.nextZ = null), (i *= 2)+ } while (e > 1)+ })(r)+ })(t, n, r, s)+ let a = t+ for (; t.prev !== t.next; ) {+ const l = t.prev,+ h = t.next+ if (s ? gm(t, n, r, s) : dm(t)) e.push(l.i, t.i, h.i), Mm(t), (t = h.next), (a = h.next)+ else if ((t = h) === a) {+ o+ ? 1 === o+ ? um((t = fm(cm(t), e)), e, i, n, r, s, 2)+ : 2 === o && pm(t, e, i, n, r, s)+ : um(cm(t), e, i, n, r, s, 1)+ break+ }+ }+ }+ function dm(t) {+ const e = t.prev,+ i = t,+ n = t.next+ if (Tm(e, i, n) >= 0) return !1+ const r = e.x,+ s = i.x,+ o = n.x,+ a = e.y,+ l = i.y,+ h = n.y,+ c = Math.min(r, s, o),+ u = Math.min(a, l, h),+ d = Math.max(r, s, o),+ g = Math.max(a, l, h)+ let f = n.next+ for (; f !== e; ) {+ if (f.x >= c && f.x <= d && f.y >= u && f.y <= g && Em(r, a, s, l, o, h, f.x, f.y) && Tm(f.prev, f, f.next) >= 0)+ return !1+ f = f.next+ }+ return !0+ }+ function gm(t, e, i, n) {+ const r = t.prev,+ s = t,+ o = t.next+ if (Tm(r, s, o) >= 0) return !1+ const a = r.x,+ l = s.x,+ h = o.x,+ c = r.y,+ u = s.y,+ d = o.y,+ g = Math.min(a, l, h),+ f = Math.min(c, u, d),+ p = Math.max(a, l, h),+ _ = Math.max(c, u, d),+ m = xm(g, f, e, i, n),+ y = xm(p, _, e, i, n)+ let x = t.prevZ,+ v = t.nextZ+ for (; x && x.z >= m && v && v.z <= y; ) {+ if (+ x.x >= g &&+ x.x <= p &&+ x.y >= f &&+ x.y <= _ &&+ x !== r &&+ x !== o &&+ Em(a, c, l, u, h, d, x.x, x.y) &&+ Tm(x.prev, x, x.next) >= 0+ )+ return !1+ if (+ ((x = x.prevZ),+ v.x >= g &&+ v.x <= p &&+ v.y >= f &&+ v.y <= _ &&+ v !== r &&+ v !== o &&+ Em(a, c, l, u, h, d, v.x, v.y) &&+ Tm(v.prev, v, v.next) >= 0)+ )+ return !1+ v = v.nextZ+ }+ for (; x && x.z >= m; ) {+ if (+ x.x >= g &&+ x.x <= p &&+ x.y >= f &&+ x.y <= _ &&+ x !== r &&+ x !== o &&+ Em(a, c, l, u, h, d, x.x, x.y) &&+ Tm(x.prev, x, x.next) >= 0+ )+ return !1+ x = x.prevZ+ }+ for (; v && v.z <= y; ) {+ if (+ v.x >= g &&+ v.x <= p &&+ v.y >= f &&+ v.y <= _ &&+ v !== r &&+ v !== o &&+ Em(a, c, l, u, h, d, v.x, v.y) &&+ Tm(v.prev, v, v.next) >= 0+ )+ return !1+ v = v.nextZ+ }+ return !0+ }+ function fm(t, e) {+ let i = t+ do {+ const n = i.prev,+ r = i.next.next+ !Cm(n, r) &&+ bm(n, i, i.next, r) &&+ Im(n, r) &&+ Im(r, n) &&+ (e.push(n.i, i.i, r.i), Mm(i), Mm(i.next), (i = t = r)),+ (i = i.next)+ } while (i !== t)+ return cm(i)+ }+ function pm(t, e, i, n, r, s) {+ let o = t+ do {+ let t = o.next.next+ for (; t !== o.prev; ) {+ if (o.i !== t.i && wm(o, t)) {+ let a = Fm(o, t)+ return (o = cm(o, o.next)), (a = cm(a, a.next)), um(o, e, i, n, r, s, 0), void um(a, e, i, n, r, s, 0)+ }+ t = t.next+ }+ o = o.next+ } while (o !== t)+ }+ function _m(t, e) {+ let i = t.x - e.x+ if (0 === i && ((i = t.y - e.y), 0 === i)) {+ i = (t.next.y - t.y) / (t.next.x - t.x) - (e.next.y - e.y) / (e.next.x - e.x)+ }+ return i+ }+ function mm(t, e) {+ const i = (function (t, e) {+ let i = e+ const n = t.x,+ r = t.y+ let s,+ o = -1 / 0+ if (Cm(t, i)) return i+ do {+ if (Cm(t, i.next)) return i.next+ if (r <= i.y && r >= i.next.y && i.next.y !== i.y) {+ const t = i.x + ((r - i.y) * (i.next.x - i.x)) / (i.next.y - i.y)+ if (t <= n && t > o && ((o = t), (s = i.x < i.next.x ? i : i.next), t === n)) return s+ }+ i = i.next+ } while (i !== e)+ if (!s) return null+ const a = s,+ l = s.x,+ h = s.y+ let c = 1 / 0+ i = s+ do {+ if (n >= i.x && i.x >= l && n !== i.x && Sm(r < h ? n : o, r, l, h, r < h ? o : n, r, i.x, i.y)) {+ const e = Math.abs(r - i.y) / (n - i.x)+ Im(i, t) && (e < c || (e === c && (i.x > s.x || (i.x === s.x && ym(s, i))))) && ((s = i), (c = e))+ }+ i = i.next+ } while (i !== a)+ return s+ })(t, e)+ if (!i) return e+ const n = Fm(i, t)+ return cm(n, n.next), cm(i, i.next)+ }+ function ym(t, e) {+ return Tm(t.prev, t, e.prev) < 0 && Tm(e.next, t, t.next) < 0+ }+ function xm(t, e, i, n, r) {+ return (+ (t =+ 1431655765 &+ ((t =+ 858993459 &+ ((t = 252645135 & ((t = 16711935 & ((t = ((t - i) * r) | 0) | (t << 8))) | (t << 4))) | (t << 2))) |+ (t << 1))) |+ ((e =+ 1431655765 &+ ((e =+ 858993459 &+ ((e = 252645135 & ((e = 16711935 & ((e = ((e - n) * r) | 0) | (e << 8))) | (e << 4))) | (e << 2))) |+ (e << 1))) <<+ 1)+ )+ }+ function vm(t) {+ let e = t,+ i = t+ do {+ ;(e.x < i.x || (e.x === i.x && e.y < i.y)) && (i = e), (e = e.next)+ } while (e !== t)+ return i+ }+ function Sm(t, e, i, n, r, s, o, a) {+ return (+ (r - o) * (e - a) >= (t - o) * (s - a) &&+ (t - o) * (n - a) >= (i - o) * (e - a) &&+ (i - o) * (s - a) >= (r - o) * (n - a)+ )+ }+ function Em(t, e, i, n, r, s, o, a) {+ return !(t === o && e === a) && Sm(t, e, i, n, r, s, o, a)+ }+ function wm(t, e) {+ return (+ t.next.i !== e.i &&+ t.prev.i !== e.i &&+ !(function (t, e) {+ let i = t+ do {+ if (i.i !== t.i && i.next.i !== t.i && i.i !== e.i && i.next.i !== e.i && bm(i, i.next, t, e)) return !0+ i = i.next+ } while (i !== t)+ return !1+ })(t, e) &&+ ((Im(t, e) &&+ Im(e, t) &&+ (function (t, e) {+ let i = t,+ n = !1+ const r = (t.x + e.x) / 2,+ s = (t.y + e.y) / 2+ do {+ i.y > s != i.next.y > s &&+ i.next.y !== i.y &&+ r < ((i.next.x - i.x) * (s - i.y)) / (i.next.y - i.y) + i.x &&+ (n = !n),+ (i = i.next)+ } while (i !== t)+ return n+ })(t, e) &&+ (Tm(t.prev, t, e.prev) || Tm(t, e.prev, e))) ||+ (Cm(t, e) && Tm(t.prev, t, t.next) > 0 && Tm(e.prev, e, e.next) > 0))+ )+ }+ function Tm(t, e, i) {+ return (e.y - t.y) * (i.x - e.x) - (e.x - t.x) * (i.y - e.y)+ }+ function Cm(t, e) {+ return t.x === e.x && t.y === e.y+ }+ function bm(t, e, i, n) {+ const r = Pm(Tm(t, e, i)),+ s = Pm(Tm(t, e, n)),+ o = Pm(Tm(i, n, t)),+ a = Pm(Tm(i, n, e))+ return (+ (r !== s && o !== a) ||+ !(0 !== r || !Rm(t, i, e)) ||+ !(0 !== s || !Rm(t, n, e)) ||+ !(0 !== o || !Rm(i, t, n)) ||+ !(0 !== a || !Rm(i, e, n))+ )+ }+ function Rm(t, e, i) {+ return (+ e.x <= Math.max(t.x, i.x) && e.x >= Math.min(t.x, i.x) && e.y <= Math.max(t.y, i.y) && e.y >= Math.min(t.y, i.y)+ )+ }+ function Pm(t) {+ return t > 0 ? 1 : t < 0 ? -1 : 0+ }+ function Im(t, e) {+ return Tm(t.prev, t, t.next) < 0+ ? Tm(t, e, t.next) >= 0 && Tm(t, t.prev, e) >= 0+ : Tm(t, e, t.prev) < 0 || Tm(t, t.next, e) < 0+ }+ function Fm(t, e) {+ const i = Am(t.i, t.x, t.y),+ n = Am(e.i, e.x, e.y),+ r = t.next,+ s = e.prev+ return (+ (t.next = e), (e.prev = t), (i.next = r), (r.prev = i), (n.next = i), (i.prev = n), (s.next = n), (n.prev = s), n+ )+ }+ function Lm(t, e, i, n) {+ const r = Am(t, e, i)+ return n ? ((r.next = n.next), (r.prev = n), (n.next.prev = r), (n.next = r)) : ((r.prev = r), (r.next = r)), r+ }+ function Mm(t) {+ ;(t.next.prev = t.prev),+ (t.prev.next = t.next),+ t.prevZ && (t.prevZ.nextZ = t.nextZ),+ t.nextZ && (t.nextZ.prevZ = t.prevZ)+ }+ function Am(t, e, i) {+ return { i: t, x: e, y: i, prev: null, next: null, z: 0, prevZ: null, nextZ: null, steiner: !1 }+ }+ const Om = 0.985,+ Dm = [],+ Nm = { vertexAttributesPosition: 0, instanceAttributesPosition: 0, indicesPosition: 0 }+ function km(t, e, i) {+ return Q_(e, i, lh(), t)+ }+ function Gm(t) {+ const e = zl(t)+ return [256 * e[0] + e[1], 256 * e[2] + Math.round(255 * e[3])]+ }+ const jm =+ "vec4 unpackColor(vec2 packedColor) {\n return vec4(\n min(floor(packedColor[0] / 256.0) / 255.0, 1.0),\n min(mod(packedColor[0], 256.0) / 255.0, 1.0),\n min(floor(packedColor[1] / 256.0) / 255.0, 1.0),\n min(mod(packedColor[1], 256.0) / 255.0, 1.0)\n );\n}"+ function Um(t) {+ return t === ql || t === Ql ? 2 : t === Jl ? 4 : 1+ }+ function Bm(t) {+ const e = Um(t)+ return e > 1 ? `vec${e}` : "float"+ }+ function zm(t, e) {+ for (const i in e.variables) {+ const n = e.variables[i],+ r = W_(n.name)+ let s = Bm(n.type)+ n.type === ql && (s = "vec4"), t.addUniform(r, s)+ }+ for (const i in e.properties) {+ const n = e.properties[i],+ r = Bm(n.type),+ s = `a_prop_${n.name}`+ n.type === ql ? t.addAttribute(s, r, `unpackColor(${s})`, "vec4") : t.addAttribute(s, r)+ }+ for (const i in e.functions) t.addVertexShaderFunction(e.functions[i]), t.addFragmentShaderFunction(e.functions[i])+ }+ function Xm(t, e) {+ const i = {}+ for (const n in t.variables) {+ const r = t.variables[n]+ i[W_(r.name)] = () => {+ const t = e[r.name]+ if ("number" == typeof t) return t+ if ("boolean" == typeof t) return t ? 1 : 0+ if (r.type === ql) {+ const e = [...zl(t || "#eee")]+ return (e[0] /= 255), (e[1] /= 255), (e[2] /= 255), (e[3] ??= 1), e+ }+ return "string" == typeof t ? V_(t) : t+ }+ }+ return i+ }+ function Vm(t) {+ const e = {}+ for (const i in t.properties) {+ const n = t.properties[i],+ r = (t) => {+ const e = t.get(n.name)+ return n.type === ql+ ? Gm([...zl(e || "#eee")])+ : "string" == typeof e+ ? V_(e)+ : "boolean" == typeof e+ ? e+ ? 1+ : 0+ : e+ }+ e[`prop_${n.name}`] = { size: Um(n.type), callback: r }+ }+ return e+ }+ const $m = `#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\nuniform mat4 u_projectionMatrix;\nuniform mat4 u_screenToWorldMatrix;\nuniform vec2 u_viewportSizePx;\nuniform float u_pixelRatio;\nuniform float u_globalAlpha;\nuniform float u_time;\nuniform float u_zoom;\nuniform float u_resolution;\nuniform float u_rotation;\nuniform vec4 u_renderExtent;\nuniform vec2 u_patternOrigin;\nuniform float u_depth;\nuniform mediump int u_hitDetection;\n\nconst float PI = 3.141592653589793238;\nconst float TWO_PI = 2.0 * PI;\nfloat currentLineMetric = 0.; // an actual value will be used in the stroke shaders\n\n${jm}\n`,+ Wm = {+ "fill-color": "rgba(255,255,255,0.4)",+ "stroke-color": "#3399CC",+ "stroke-width": 1.25,+ "circle-radius": 5,+ "circle-fill-color": "rgba(255,255,255,0.4)",+ "circle-stroke-width": 1.25,+ "circle-stroke-color": "#3399CC"+ }+ class Zm {+ constructor() {+ ;(this.uniforms_ = []),+ (this.attributes_ = []),+ (this.hasSymbol_ = !1),+ (this.symbolSizeExpression_ = `vec2(${G_(Wm["circle-radius"])} + ${G_(0.5 * Wm["circle-stroke-width"])})`),+ (this.symbolRotationExpression_ = "0.0"),+ (this.symbolOffsetExpression_ = "vec2(0.0)"),+ (this.symbolColorExpression_ = U_(Wm["circle-fill-color"])),+ (this.texCoordExpression_ = "vec4(0.0, 0.0, 1.0, 1.0)"),+ (this.discardExpression_ = "false"),+ (this.symbolRotateWithView_ = !1),+ (this.hasStroke_ = !1),+ (this.strokeWidthExpression_ = G_(Wm["stroke-width"])),+ (this.strokeColorExpression_ = U_(Wm["stroke-color"])),+ (this.strokeOffsetExpression_ = "0."),+ (this.strokeCapExpression_ = $_("round")),+ (this.strokeJoinExpression_ = $_("round")),+ (this.strokeMiterLimitExpression_ = "10."),+ (this.strokeDistanceFieldExpression_ = "-1000."),+ (this.strokePatternLengthExpression_ = null),+ (this.hasFill_ = !1),+ (this.fillColorExpression_ = U_(Wm["fill-color"])),+ (this.vertexShaderFunctions_ = []),+ (this.fragmentShaderFunctions_ = [])+ }+ addUniform(t, e) {+ return this.uniforms_.push({ name: t, type: e }), this+ }+ addAttribute(t, e, i, n) {+ return (+ this.attributes_.push({+ name: t,+ type: e,+ varyingName: t.replace(/^a_/, "v_"),+ varyingType: n ?? e,+ varyingExpression: i ?? t+ }),+ this+ )+ }+ setSymbolSizeExpression(t) {+ return (this.hasSymbol_ = !0), (this.symbolSizeExpression_ = t), this+ }+ getSymbolSizeExpression() {+ return this.symbolSizeExpression_+ }+ setSymbolRotationExpression(t) {+ return (this.symbolRotationExpression_ = t), this+ }+ setSymbolOffsetExpression(t) {+ return (this.symbolOffsetExpression_ = t), this+ }+ getSymbolOffsetExpression() {+ return this.symbolOffsetExpression_+ }+ setSymbolColorExpression(t) {+ return (this.hasSymbol_ = !0), (this.symbolColorExpression_ = t), this+ }+ getSymbolColorExpression() {+ return this.symbolColorExpression_+ }+ setTextureCoordinateExpression(t) {+ return (this.texCoordExpression_ = t), this+ }+ setFragmentDiscardExpression(t) {+ return (this.discardExpression_ = t), this+ }+ getFragmentDiscardExpression() {+ return this.discardExpression_+ }+ setSymbolRotateWithView(t) {+ return (this.symbolRotateWithView_ = t), this+ }+ setStrokeWidthExpression(t) {+ return (this.hasStroke_ = !0), (this.strokeWidthExpression_ = t), this+ }+ setStrokeColorExpression(t) {+ return (this.hasStroke_ = !0), (this.strokeColorExpression_ = t), this+ }+ getStrokeColorExpression() {+ return this.strokeColorExpression_+ }+ setStrokeOffsetExpression(t) {+ return (this.strokeOffsetExpression_ = t), this+ }+ setStrokeCapExpression(t) {+ return (this.strokeCapExpression_ = t), this+ }+ setStrokeJoinExpression(t) {+ return (this.strokeJoinExpression_ = t), this+ }+ setStrokeMiterLimitExpression(t) {+ return (this.strokeMiterLimitExpression_ = t), this+ }+ setStrokeDistanceFieldExpression(t) {+ return (this.strokeDistanceFieldExpression_ = t), this+ }+ setStrokePatternLengthExpression(t) {+ return (this.strokePatternLengthExpression_ = t), this+ }+ getStrokePatternLengthExpression() {+ return this.strokePatternLengthExpression_+ }+ setFillColorExpression(t) {+ return (this.hasFill_ = !0), (this.fillColorExpression_ = t), this+ }+ getFillColorExpression() {+ return this.fillColorExpression_+ }+ addVertexShaderFunction(t) {+ return this.vertexShaderFunctions_.includes(t) || this.vertexShaderFunctions_.push(t), this+ }+ addFragmentShaderFunction(t) {+ return this.fragmentShaderFunctions_.includes(t) || this.fragmentShaderFunctions_.push(t), this+ }+ getSymbolVertexShader() {+ return this.hasSymbol_+ ? `${$m}\n${this.uniforms_+ .map((t) => `uniform ${t.type} ${t.name};`)+ .join(+ "\n"+ )}\nattribute vec2 a_position;\nattribute vec2 a_localPosition;\nattribute vec2 a_hitColor;\n\nvarying vec2 v_texCoord;\nvarying vec2 v_quadCoord;\nvarying vec4 v_hitColor;\nvarying vec2 v_centerPx;\nvarying float v_angle;\nvarying vec2 v_quadSizePx;\n\n${this.attributes_+ .map((t) => `attribute ${t.type} ${t.name};\nvarying ${t.varyingType} ${t.varyingName};`)+ .join("\n")}\n${this.vertexShaderFunctions_.join(+ "\n"+ )}\nvec2 pxToScreen(vec2 coordPx) {\n vec2 scaled = coordPx / u_viewportSizePx / 0.5;\n return scaled;\n}\n\nvec2 screenToPx(vec2 coordScreen) {\n return (coordScreen * 0.5 + 0.5) * u_viewportSizePx;\n}\n\nvoid main(void) {\n v_quadSizePx = ${+ this.symbolSizeExpression_+ };\n vec2 halfSizePx = v_quadSizePx * 0.5;\n vec2 centerOffsetPx = ${+ this.symbolOffsetExpression_+ };\n vec2 offsetPx = centerOffsetPx + a_localPosition * halfSizePx * vec2(1., -1.);\n float angle = ${+ this.symbolRotationExpression_+ }${+ this.symbolRotateWithView_ ? " + u_rotation" : ""+ };\n float c = cos(-angle);\n float s = sin(-angle);\n offsetPx = vec2(c * offsetPx.x - s * offsetPx.y, s * offsetPx.x + c * offsetPx.y);\n vec4 center = u_projectionMatrix * vec4(a_position, 0.0, 1.0);\n gl_Position = center + vec4(pxToScreen(offsetPx), u_depth, 0.);\n vec4 texCoord = ${+ this.texCoordExpression_+ };\n float u = mix(texCoord.s, texCoord.p, a_localPosition.x * 0.5 + 0.5);\n float v = mix(texCoord.t, texCoord.q, a_localPosition.y * 0.5 + 0.5);\n v_texCoord = vec2(u, v);\n v_hitColor = unpackColor(a_hitColor);\n v_angle = angle;\n c = cos(-v_angle);\n s = sin(-v_angle);\n centerOffsetPx = vec2(c * centerOffsetPx.x - s * centerOffsetPx.y, s * centerOffsetPx.x + c * centerOffsetPx.y);\n v_centerPx = screenToPx(center.xy) + centerOffsetPx;\n${this.attributes_+ .map((t) => ` ${t.varyingName} = ${t.varyingExpression};`)+ .join("\n")}\n}`+ : null+ }+ getSymbolFragmentShader() {+ return this.hasSymbol_+ ? `${$m}\n${this.uniforms_+ .map((t) => `uniform ${t.type} ${t.name};`)+ .join(+ "\n"+ )}\nvarying vec2 v_texCoord;\nvarying vec4 v_hitColor;\nvarying vec2 v_centerPx;\nvarying float v_angle;\nvarying vec2 v_quadSizePx;\n${this.attributes_+ .map((t) => `varying ${t.varyingType} ${t.varyingName};`)+ .join("\n")}\n${this.fragmentShaderFunctions_.join("\n")}\n\nvoid main(void) {\n${this.attributes_+ .map((t) => ` ${t.varyingType} ${t.name} = ${t.varyingName}; // assign to original attribute name`)+ .join("\n")}\n if (${+ this.discardExpression_+ }) { discard; }\n vec2 coordsPx = gl_FragCoord.xy / u_pixelRatio - v_centerPx; // relative to center\n float c = cos(v_angle);\n float s = sin(v_angle);\n coordsPx = vec2(c * coordsPx.x - s * coordsPx.y, s * coordsPx.x + c * coordsPx.y);\n gl_FragColor = ${+ this.symbolColorExpression_+ };\n gl_FragColor.rgb *= gl_FragColor.a;\n if (u_hitDetection > 0) {\n if (gl_FragColor.a < 0.05) { discard; };\n gl_FragColor = v_hitColor;\n }\n}`+ : null+ }+ getStrokeVertexShader() {+ return this.hasStroke_+ ? `${$m}\n${this.uniforms_+ .map((t) => `uniform ${t.type} ${t.name};`)+ .join(+ "\n"+ )}\nattribute vec2 a_segmentStart;\nattribute vec2 a_segmentEnd;\nattribute vec2 a_localPosition;\nattribute float a_measureStart;\nattribute float a_measureEnd;\nattribute float a_angleTangentSum;\nattribute float a_distanceLow;\nattribute float a_distanceHigh;\nattribute vec2 a_joinAngles;\nattribute vec2 a_hitColor;\n\nvarying vec2 v_segmentStartPx;\nvarying vec2 v_segmentEndPx;\nvarying float v_angleStart;\nvarying float v_angleEnd;\nvarying float v_width;\nvarying vec4 v_hitColor;\nvarying float v_distancePx;\nvarying float v_measureStart;\nvarying float v_measureEnd;\n\n${this.attributes_+ .map((t) => `attribute ${t.type} ${t.name};\nvarying ${t.varyingType} ${t.varyingName};`)+ .join("\n")}\n${this.vertexShaderFunctions_.join(+ "\n"+ )}\nvec2 worldToPx(vec2 worldPos) {\n vec4 screenPos = u_projectionMatrix * vec4(worldPos, 0.0, 1.0);\n return (0.5 * screenPos.xy + 0.5) * u_viewportSizePx;\n}\n\nvec4 pxToScreen(vec2 pxPos) {\n vec2 screenPos = 2.0 * pxPos / u_viewportSizePx - 1.0;\n return vec4(screenPos, u_depth, 1.0);\n}\n\nbool isCap(float joinAngle) {\n return joinAngle < -0.1;\n}\n\nvec2 getJoinOffsetDirection(vec2 normalPx, float joinAngle) {\n float halfAngle = joinAngle / 2.0;\n float c = cos(halfAngle);\n float s = sin(halfAngle);\n vec2 angleBisectorNormal = vec2(s * normalPx.x + c * normalPx.y, -c * normalPx.x + s * normalPx.y);\n float length = 1.0 / s;\n return angleBisectorNormal * length;\n}\n\nvec2 getOffsetPoint(vec2 point, vec2 normal, float joinAngle, float offsetPx) {\n // if on a cap or the join angle is too high, offset the line along the segment normal\n if (cos(joinAngle) > 0.998 || isCap(joinAngle)) {\n return point - normal * offsetPx;\n }\n // offset is applied along the inverted normal (positive offset goes "right" relative to line direction)\n return point - getJoinOffsetDirection(normal, joinAngle) * offsetPx;\n}\n\nvoid main(void) {\n v_angleStart = a_joinAngles.x;\n v_angleEnd = a_joinAngles.y;\n float startEndRatio = a_localPosition.x * 0.5 + 0.5;\n currentLineMetric = mix(a_measureStart, a_measureEnd, startEndRatio);\n // we're reading the fractional part while keeping the sign (so -4.12 gives -0.12, 3.45 gives 0.45)\n\n float lineWidth = ${+ this.strokeWidthExpression_+ };\n float lineOffsetPx = ${+ this.strokeOffsetExpression_+ };\n\n // compute segment start/end in px with offset\n vec2 segmentStartPx = worldToPx(a_segmentStart);\n vec2 segmentEndPx = worldToPx(a_segmentEnd);\n vec2 tangentPx = normalize(segmentEndPx - segmentStartPx);\n vec2 normalPx = vec2(-tangentPx.y, tangentPx.x);\n segmentStartPx = getOffsetPoint(segmentStartPx, normalPx, v_angleStart, lineOffsetPx),\n segmentEndPx = getOffsetPoint(segmentEndPx, normalPx, v_angleEnd, lineOffsetPx);\n\n // compute current vertex position\n float normalDir = -1. * a_localPosition.y;\n float tangentDir = -1. * a_localPosition.x;\n float angle = mix(v_angleStart, v_angleEnd, startEndRatio);\n vec2 joinDirection;\n vec2 positionPx = mix(segmentStartPx, segmentEndPx, startEndRatio);\n // if angle is too high, do not make a proper join\n if (cos(angle) > 0.985 || isCap(angle)) {\n joinDirection = normalPx * normalDir - tangentPx * tangentDir;\n } else {\n joinDirection = getJoinOffsetDirection(normalPx * normalDir, angle);\n }\n positionPx = positionPx + joinDirection * (lineWidth * 0.5 + 1.); // adding 1 pixel for antialiasing\n gl_Position = pxToScreen(positionPx);\n\n v_segmentStartPx = segmentStartPx;\n v_segmentEndPx = segmentEndPx;\n v_width = lineWidth;\n v_hitColor = unpackColor(a_hitColor);\n\n v_distancePx = a_distanceLow / u_resolution - (lineOffsetPx * a_angleTangentSum);\n float distanceHighPx = a_distanceHigh / u_resolution;\n ${+ null !== this.strokePatternLengthExpression_+ ? `v_distancePx = mod(v_distancePx, ${this.strokePatternLengthExpression_});\n distanceHighPx = mod(distanceHighPx, ${this.strokePatternLengthExpression_});\n `+ : ""+ }v_distancePx += distanceHighPx;\n\n v_measureStart = a_measureStart;\n v_measureEnd = a_measureEnd;\n${this.attributes_+ .map((t) => ` ${t.varyingName} = ${t.varyingExpression};`)+ .join("\n")}\n}`+ : null+ }+ getStrokeFragmentShader() {+ return this.hasStroke_+ ? `${$m}\n${this.uniforms_+ .map((t) => `uniform ${t.type} ${t.name};`)+ .join(+ "\n"+ )}\nvarying vec2 v_segmentStartPx;\nvarying vec2 v_segmentEndPx;\nvarying float v_angleStart;\nvarying float v_angleEnd;\nvarying float v_width;\nvarying vec4 v_hitColor;\nvarying float v_distancePx;\nvarying float v_measureStart;\nvarying float v_measureEnd;\n${this.attributes_+ .map((t) => `varying ${t.varyingType} ${t.varyingName};`)+ .join("\n")}\n${this.fragmentShaderFunctions_.join(+ "\n"+ )}\n\nvec2 pxToWorld(vec2 pxPos) {\n vec2 screenPos = 2.0 * pxPos / u_viewportSizePx - 1.0;\n return (u_screenToWorldMatrix * vec4(screenPos, 0.0, 1.0)).xy;\n}\n\nbool isCap(float joinAngle) {\n return joinAngle < -0.1;\n}\n\nfloat segmentDistanceField(vec2 point, vec2 start, vec2 end, float width) {\n vec2 tangent = normalize(end - start);\n vec2 normal = vec2(-tangent.y, tangent.x);\n vec2 startToPoint = point - start;\n return abs(dot(startToPoint, normal)) - width * 0.5;\n}\n\nfloat buttCapDistanceField(vec2 point, vec2 start, vec2 end) {\n vec2 startToPoint = point - start;\n vec2 tangent = normalize(end - start);\n return dot(startToPoint, -tangent);\n}\n\nfloat squareCapDistanceField(vec2 point, vec2 start, vec2 end, float width) {\n return buttCapDistanceField(point, start, end) - width * 0.5;\n}\n\nfloat roundCapDistanceField(vec2 point, vec2 start, vec2 end, float width) {\n float onSegment = max(0., 1000. * dot(point - start, end - start)); // this is very high when inside the segment\n return length(point - start) - width * 0.5 - onSegment;\n}\n\nfloat roundJoinDistanceField(vec2 point, vec2 start, vec2 end, float width) {\n return roundCapDistanceField(point, start, end, width);\n}\n\nfloat bevelJoinField(vec2 point, vec2 start, vec2 end, float width, float joinAngle) {\n vec2 startToPoint = point - start;\n vec2 tangent = normalize(end - start);\n float c = cos(joinAngle * 0.5);\n float s = sin(joinAngle * 0.5);\n float direction = -sign(sin(joinAngle));\n vec2 bisector = vec2(c * tangent.x - s * tangent.y, s * tangent.x + c * tangent.y);\n float radius = width * 0.5 * s;\n return dot(startToPoint, bisector * direction) - radius;\n}\n\nfloat miterJoinDistanceField(vec2 point, vec2 start, vec2 end, float width, float joinAngle) {\n if (cos(joinAngle) > 0.985) { // avoid risking a division by zero\n return bevelJoinField(point, start, end, width, joinAngle);\n }\n float miterLength = 1. / sin(joinAngle * 0.5);\n float miterLimit = ${+ this.strokeMiterLimitExpression_+ };\n if (miterLength > miterLimit) {\n return bevelJoinField(point, start, end, width, joinAngle);\n }\n return -1000.;\n}\n\nfloat capDistanceField(vec2 point, vec2 start, vec2 end, float width, float capType) {\n if (capType == ${$_(+ "butt"+ )}) {\n return buttCapDistanceField(point, start, end);\n } else if (capType == ${$_(+ "square"+ )}) {\n return squareCapDistanceField(point, start, end, width);\n }\n return roundCapDistanceField(point, start, end, width);\n}\n\nfloat joinDistanceField(vec2 point, vec2 start, vec2 end, float width, float joinAngle, float joinType) {\n if (joinType == ${$_(+ "bevel"+ )}) {\n return bevelJoinField(point, start, end, width, joinAngle);\n } else if (joinType == ${$_(+ "miter"+ )}) {\n return miterJoinDistanceField(point, start, end, width, joinAngle);\n }\n return roundJoinDistanceField(point, start, end, width);\n}\n\nfloat computeSegmentPointDistance(vec2 point, vec2 start, vec2 end, float width, float joinAngle, float capType, float joinType) {\n if (isCap(joinAngle)) {\n return capDistanceField(point, start, end, width, capType);\n }\n return joinDistanceField(point, start, end, width, joinAngle, joinType);\n}\n\nfloat distanceFromSegment(vec2 point, vec2 start, vec2 end) {\n vec2 tangent = end - start;\n vec2 startToPoint = point - start;\n // inspire by capsule fn in https://iquilezles.org/articles/distfunctions/\n float h = clamp(dot(startToPoint, tangent) / dot(tangent, tangent), 0.0, 1.0);\n return length(startToPoint - tangent * h);\n}\n\nvoid main(void) {\n${this.attributes_+ .map((t) => ` ${t.varyingType} ${t.name} = ${t.varyingName}; // assign to original attribute name`)+ .join(+ "\n"+ )}\n\n vec2 currentPointPx = gl_FragCoord.xy / u_pixelRatio;\n #ifdef GL_FRAGMENT_PRECISION_HIGH\n vec2 worldPos = pxToWorld(currentPointPx);\n if (\n abs(u_renderExtent[0] - u_renderExtent[2]) > 0.0 && (\n worldPos[0] < u_renderExtent[0] ||\n worldPos[1] < u_renderExtent[1] ||\n worldPos[0] > u_renderExtent[2] ||\n worldPos[1] > u_renderExtent[3]\n )\n ) {\n discard;\n }\n #endif\n\n float segmentLengthPx = length(v_segmentEndPx - v_segmentStartPx);\n segmentLengthPx = max(segmentLengthPx, 1.17549429e-38); // avoid divide by zero\n vec2 segmentTangent = (v_segmentEndPx - v_segmentStartPx) / segmentLengthPx;\n vec2 segmentNormal = vec2(-segmentTangent.y, segmentTangent.x);\n vec2 startToPointPx = currentPointPx - v_segmentStartPx;\n float lengthToPointPx = max(0., min(dot(segmentTangent, startToPointPx), segmentLengthPx));\n float currentLengthPx = lengthToPointPx + v_distancePx;\n float currentRadiusPx = distanceFromSegment(currentPointPx, v_segmentStartPx, v_segmentEndPx);\n float currentRadiusRatio = dot(segmentNormal, startToPointPx) * 2. / v_width;\n currentLineMetric = mix(v_measureStart, v_measureEnd, lengthToPointPx / segmentLengthPx);\n\n if (${+ this.discardExpression_+ }) { discard; }\n\n float capType = ${this.strokeCapExpression_};\n float joinType = ${+ this.strokeJoinExpression_+ };\n float segmentStartDistance = computeSegmentPointDistance(currentPointPx, v_segmentStartPx, v_segmentEndPx, v_width, v_angleStart, capType, joinType);\n float segmentEndDistance = computeSegmentPointDistance(currentPointPx, v_segmentEndPx, v_segmentStartPx, v_width, v_angleEnd, capType, joinType);\n float distanceField = max(\n segmentDistanceField(currentPointPx, v_segmentStartPx, v_segmentEndPx, v_width),\n max(segmentStartDistance, segmentEndDistance)\n );\n distanceField = max(distanceField, ${+ this.strokeDistanceFieldExpression_+ });\n\n vec4 color = ${+ this.strokeColorExpression_+ };\n color.a *= smoothstep(0.5, -0.5, distanceField);\n gl_FragColor = color;\n gl_FragColor.a *= u_globalAlpha;\n gl_FragColor.rgb *= gl_FragColor.a;\n if (u_hitDetection > 0) {\n if (gl_FragColor.a < 0.1) { discard; };\n gl_FragColor = v_hitColor;\n }\n}`+ : null+ }+ getFillVertexShader() {+ return this.hasFill_+ ? `${$m}\n${this.uniforms_+ .map((t) => `uniform ${t.type} ${t.name};`)+ .join(+ "\n"+ )}\nattribute vec2 a_position;\nattribute vec2 a_hitColor;\n\nvarying vec4 v_hitColor;\n\n${this.attributes_+ .map((t) => `attribute ${t.type} ${t.name};\nvarying ${t.varyingType} ${t.varyingName};`)+ .join("\n")}\n${this.vertexShaderFunctions_.join(+ "\n"+ )}\nvoid main(void) {\n gl_Position = u_projectionMatrix * vec4(a_position, u_depth, 1.0);\n v_hitColor = unpackColor(a_hitColor);\n${this.attributes_+ .map((t) => ` ${t.varyingName} = ${t.varyingExpression};`)+ .join("\n")}\n}`+ : null+ }+ getFillFragmentShader() {+ return this.hasFill_+ ? `${$m}\n${this.uniforms_+ .map((t) => `uniform ${t.type} ${t.name};`)+ .join("\n")}\nvarying vec4 v_hitColor;\n${this.attributes_+ .map((t) => `varying ${t.varyingType} ${t.varyingName};`)+ .join("\n")}\n${this.fragmentShaderFunctions_.join(+ "\n"+ )}\nvec2 pxToWorld(vec2 pxPos) {\n vec2 screenPos = 2.0 * pxPos / u_viewportSizePx - 1.0;\n return (u_screenToWorldMatrix * vec4(screenPos, 0.0, 1.0)).xy;\n}\n\nvec2 worldToPx(vec2 worldPos) {\n vec4 screenPos = u_projectionMatrix * vec4(worldPos, 0.0, 1.0);\n return (0.5 * screenPos.xy + 0.5) * u_viewportSizePx;\n}\n\nvoid main(void) {\n${this.attributes_+ .map((t) => ` ${t.varyingType} ${t.name} = ${t.varyingName}; // assign to original attribute name`)+ .join(+ "\n"+ )}\n vec2 pxPos = gl_FragCoord.xy / u_pixelRatio;\n vec2 pxOrigin = worldToPx(u_patternOrigin);\n #ifdef GL_FRAGMENT_PRECISION_HIGH\n vec2 worldPos = pxToWorld(pxPos);\n if (\n abs(u_renderExtent[0] - u_renderExtent[2]) > 0.0 && (\n worldPos[0] < u_renderExtent[0] ||\n worldPos[1] < u_renderExtent[1] ||\n worldPos[0] > u_renderExtent[2] ||\n worldPos[1] > u_renderExtent[3]\n )\n ) {\n discard;\n }\n #endif\n if (${+ this.discardExpression_+ }) { discard; }\n gl_FragColor = ${+ this.fillColorExpression_+ };\n gl_FragColor.a *= u_globalAlpha;\n gl_FragColor.rgb *= gl_FragColor.a;\n if (u_hitDetection > 0) {\n if (gl_FragColor.a < 0.1) { discard; };\n gl_FragColor = v_hitColor;\n }\n}`+ : null+ }+ }+ function Ym(t) {+ return (+ JSON.stringify(t)+ .split("")+ .reduce((t, e) => (t << 5) - t + e.charCodeAt(0), 0) >>> 0+ ).toString()+ }+ function Hm(t, e, i, n) {+ if (`${n}radius` in t && "icon-" !== n) {+ let r = km(i, t[`${n}radius`], Hl)+ if (`${n}radius2` in t) {+ r = `max(${r}, ${km(i, t[`${n}radius2`], Hl)})`+ }+ ;`${n}stroke-width` in t && (r = `(${r} + ${km(i, t[`${n}stroke-width`], Hl)} * 0.5)`),+ e.setSymbolSizeExpression(`vec2(${r} * 2. + 0.5)`)+ }+ if (`${n}scale` in t) {+ const r = km(i, t[`${n}scale`], Ql)+ e.setSymbolSizeExpression(`${e.getSymbolSizeExpression()} * ${r}`)+ }+ ;`${n}displacement` in t && e.setSymbolOffsetExpression(km(i, t[`${n}displacement`], Jl)),+ `${n}rotation` in t && e.setSymbolRotationExpression(km(i, t[`${n}rotation`], Hl)),+ `${n}rotate-with-view` in t && e.setSymbolRotateWithView(!!t[`${n}rotate-with-view`])+ }+ function Km(t, e, i, n, r) {+ let s = "vec4(0.)"+ if ((null !== e && (s = e), null !== i && null !== n)) {+ s = `mix(${i}, ${s}, ${`smoothstep(-${n} + 0.63, -${n} - 0.58, ${t})`})`+ }+ let o = `${s} * vec4(1.0, 1.0, 1.0, ${`(1.0 - smoothstep(-0.63, 0.58, ${t}))`})`+ return null !== r && (o = `${o} * vec4(1.0, 1.0, 1.0, ${r})`), o+ }+ function qm(t, e, i, n, r) {+ const s = new Image()+ ;(s.crossOrigin = void 0 === t[`${n}cross-origin`] ? "anonymous" : t[`${n}cross-origin`]),+ Mt("string" == typeof t[`${n}src`], `WebGL layers do not support expressions for the ${n}src style property`),+ (s.src = t[`${n}src`]),+ (i[`u_texture${r}_size`] = () => (s.complete ? [s.width, s.height] : [0, 0])),+ e.addUniform(`u_texture${r}_size`, "vec2")+ const o = `u_texture${r}_size`+ return (i[`u_texture${r}`] = s), e.addUniform(`u_texture${r}`, "sampler2D"), o+ }+ function Jm(t, e, i, n, r) {+ let s = km(i, t[`${e}offset`], Ql)+ if (`${e}offset-origin` in t)+ switch (t[`${e}offset-origin`]) {+ case "top-right":+ s = `vec2(${n}.x, 0.) + ${r} * vec2(-1., 0.) + ${s} * vec2(-1., 1.)`+ break+ case "bottom-left":+ s = `vec2(0., ${n}.y) + ${r} * vec2(0., -1.) + ${s} * vec2(1., -1.)`+ break+ case "bottom-right":+ s = `${n} - ${r} - ${s}`+ }+ return s+ }+ function Qm(t, e, i) {+ const n = { variables: {}, properties: {}, functions: {}, bandCount: 0, featureId: !1, geometryType: !1 },+ r = new Zm(),+ s = {}+ if (+ ("icon-src" in t+ ? (function (t, e, i, n) {+ let r = "vec4(1.0)"+ "icon-color" in t && (r = km(n, t["icon-color"], ql)),+ "icon-opacity" in t && (r = `${r} * vec4(1.0, 1.0, 1.0, ${km(n, t["icon-opacity"], Hl)})`)+ const s = Ym(t["icon-src"]),+ o = qm(t, e, i, "icon-", s)+ if (+ (e.setSymbolColorExpression(`${r} * texture2D(u_texture${s}, v_texCoord)`).setSymbolSizeExpression(o),+ "icon-width" in t &&+ "icon-height" in t &&+ e.setSymbolSizeExpression(`vec2(${km(n, t["icon-width"], Hl)}, ${km(n, t["icon-height"], Hl)})`),+ "icon-offset" in t && "icon-size" in t)+ ) {+ const i = km(n, t["icon-size"], Jl),+ r = e.getSymbolSizeExpression()+ e.setSymbolSizeExpression(i)+ const s = Jm(t, "icon-", n, "v_quadSizePx", i)+ e.setTextureCoordinateExpression(`(vec4((${s}).xyxy) + vec4(0., 0., ${i})) / (${r}).xyxy`)+ }+ if ((Hm(t, e, n, "icon-"), "icon-anchor" in t)) {+ const i = km(n, t["icon-anchor"], Jl)+ let r,+ s = "1.0"+ "icon-scale" in t && (s = km(n, t["icon-scale"], Ql)),+ (r =+ "pixels" === t["icon-anchor-x-units"] && "pixels" === t["icon-anchor-y-units"]+ ? `${i} * ${s}`+ : "pixels" === t["icon-anchor-x-units"]+ ? `${i} * vec2(vec2(${s}).x, v_quadSizePx.y)`+ : "pixels" === t["icon-anchor-y-units"]+ ? `${i} * vec2(v_quadSizePx.x, vec2(${s}).x)`+ : `${i} * v_quadSizePx`)+ let o = `v_quadSizePx * vec2(0.5, -0.5) + ${r} * vec2(-1., 1.)`+ if ("icon-anchor-origin" in t)+ switch (t["icon-anchor-origin"]) {+ case "top-right":+ o = `v_quadSizePx * -0.5 + ${r}`+ break+ case "bottom-left":+ o = `v_quadSizePx * 0.5 - ${r}`+ break+ case "bottom-right":+ o = `v_quadSizePx * vec2(-0.5, 0.5) + ${r} * vec2(1., -1.)`+ }+ e.setSymbolOffsetExpression(`${e.getSymbolOffsetExpression()} + ${o}`)+ }+ })(t, r, s, n)+ : "shape-points" in t+ ? (function (t, e, i, n) {+ ;(n.functions.round = "float round(float v) {\n return sign(v) * floor(abs(v) + 0.5);\n}"),+ (n.functions.starDistanceField =+ "float starDistanceField(vec2 point, float numPoints, float radius, float radius2, float angle) {\n float startAngle = -PI * 0.5 + angle; // tip starts upwards and rotates clockwise with angle\n float c = cos(startAngle);\n float s = sin(startAngle);\n vec2 pointRotated = vec2(c * point.x - s * point.y, s * point.x + c * point.y);\n float alpha = TWO_PI / numPoints; // the angle of one sector\n float beta = atan(pointRotated.y, pointRotated.x);\n float gamma = round(beta / alpha) * alpha; // angle in sector\n c = cos(-gamma);\n s = sin(-gamma);\n vec2 inSector = vec2(c * pointRotated.x - s * pointRotated.y, abs(s * pointRotated.x + c * pointRotated.y));\n vec2 tipToPoint = inSector + vec2(-radius, 0.);\n vec2 edgeNormal = vec2(radius2 * sin(alpha * 0.5), -radius2 * cos(alpha * 0.5) + radius);\n return dot(normalize(edgeNormal), tipToPoint);\n}"),+ (n.functions.regularDistanceField =+ "float regularDistanceField(vec2 point, float numPoints, float radius, float angle) {\n float startAngle = -PI * 0.5 + angle; // tip starts upwards and rotates clockwise with angle\n float c = cos(startAngle);\n float s = sin(startAngle);\n vec2 pointRotated = vec2(c * point.x - s * point.y, s * point.x + c * point.y);\n float alpha = TWO_PI / numPoints; // the angle of one sector\n float radiusIn = radius * cos(PI / numPoints);\n float beta = atan(pointRotated.y, pointRotated.x);\n float gamma = round((beta - alpha * 0.5) / alpha) * alpha + alpha * 0.5; // angle in sector from mid\n c = cos(-gamma);\n s = sin(-gamma);\n vec2 inSector = vec2(c * pointRotated.x - s * pointRotated.y, abs(s * pointRotated.x + c * pointRotated.y));\n return inSector.x - radiusIn;\n}"),+ Hm(t, e, n, "shape-")+ let r = null+ "shape-opacity" in t && (r = km(n, t["shape-opacity"], Hl))+ let s = "coordsPx"+ "shape-scale" in t && (s = `coordsPx / ${km(n, t["shape-scale"], Ql)}`)+ let o = null+ "shape-fill-color" in t && (o = km(n, t["shape-fill-color"], ql))+ let a = null+ "shape-stroke-color" in t && (a = km(n, t["shape-stroke-color"], ql))+ let l = null+ "shape-stroke-width" in t && (l = km(n, t["shape-stroke-width"], Hl))+ const h = km(n, t["shape-points"], Hl)+ let c,+ u = "0."+ "shape-angle" in t && (u = km(n, t["shape-angle"], Hl))+ let d = km(n, t["shape-radius"], Hl)+ if ((null !== l && (d = `${d} + ${l} * 0.5`), "shape-radius2" in t)) {+ let e = km(n, t["shape-radius2"], Hl)+ null !== l && (e = `${e} + ${l} * 0.5`), (c = `starDistanceField(${s}, ${h}, ${d}, ${e}, ${u})`)+ } else c = `regularDistanceField(${s}, ${h}, ${d}, ${u})`+ const g = Km(c, o, a, l, r)+ e.setSymbolColorExpression(g)+ })(t, r, 0, n)+ : "circle-radius" in t &&+ (function (t, e, i, n) {+ ;(n.functions.circleDistanceField =+ "float circleDistanceField(vec2 point, float radius) {\n return length(point) - radius;\n}"),+ Hm(t, e, n, "circle-")+ let r = null+ "circle-opacity" in t && (r = km(n, t["circle-opacity"], Hl))+ let s = "coordsPx"+ "circle-scale" in t && (s = `coordsPx / ${km(n, t["circle-scale"], Ql)}`)+ let o = null+ "circle-fill-color" in t && (o = km(n, t["circle-fill-color"], ql))+ let a = null+ "circle-stroke-color" in t && (a = km(n, t["circle-stroke-color"], ql))+ let l = km(n, t["circle-radius"], Hl),+ h = null+ "circle-stroke-width" in t && ((h = km(n, t["circle-stroke-width"], Hl)), (l = `(${l} + ${h} * 0.5)`))+ const c = Km(`circleDistanceField(${s}, ${l})`, o, a, h, r)+ e.setSymbolColorExpression(c)+ })(t, r, 0, n),+ (function (t, e, i, n) {+ if (+ ("stroke-color" in t && e.setStrokeColorExpression(km(n, t["stroke-color"], ql)), "stroke-pattern-src" in t)+ ) {+ const r = Ym(t["stroke-pattern-src"]),+ s = qm(t, e, i, "stroke-pattern-", r)+ let o = s,+ a = "vec2(0.)"+ "stroke-pattern-offset" in t &&+ "stroke-pattern-size" in t &&+ ((o = km(n, t["stroke-pattern-size"], Jl)), (a = Jm(t, "stroke-pattern-", n, s, o)))+ let l = "0."+ "stroke-pattern-spacing" in t && (l = km(n, t["stroke-pattern-spacing"], Hl))+ let h = "0."+ "stroke-pattern-start-offset" in t && (h = km(n, t["stroke-pattern-start-offset"], Hl)),+ (n.functions.sampleStrokePattern =+ "vec4 sampleStrokePattern(sampler2D texture, vec2 textureSize, vec2 textureOffset, vec2 sampleSize, float spacingPx, float startOffsetPx, float currentLengthPx, float currentRadiusRatio, float lineWidth) {\n float currentLengthScaled = (currentLengthPx - startOffsetPx) * sampleSize.y / lineWidth;\n float spacingScaled = spacingPx * sampleSize.y / lineWidth;\n float uCoordPx = mod(currentLengthScaled, (sampleSize.x + spacingScaled));\n float isInsideOfPattern = step(uCoordPx, sampleSize.x);\n float vCoordPx = (-currentRadiusRatio * 0.5 + 0.5) * sampleSize.y;\n // make sure that we're not sampling too close to the borders to avoid interpolation with outside pixels\n uCoordPx = clamp(uCoordPx, 0.5, sampleSize.x - 0.5);\n vCoordPx = clamp(vCoordPx, 0.5, sampleSize.y - 0.5);\n vec2 texCoord = (vec2(uCoordPx, vCoordPx) + textureOffset) / textureSize;\n return texture2D(texture, texCoord) * vec4(1.0, 1.0, 1.0, isInsideOfPattern);\n}")+ const c = `u_texture${r}`+ let u = "1."+ "stroke-color" in t && (u = e.getStrokeColorExpression()),+ e.setStrokeColorExpression(+ `${u} * sampleStrokePattern(${c}, ${s}, ${a}, ${o}, ${l}, ${h}, currentLengthPx, currentRadiusRatio, v_width)`+ ),+ (n.functions.computeStrokePatternLength =+ "float computeStrokePatternLength(vec2 sampleSize, float spacingPx, float lineWidth) {\n float patternLengthPx = sampleSize.x / sampleSize.y * lineWidth;\n return patternLengthPx + spacingPx;\n}"),+ e.setStrokePatternLengthExpression(`computeStrokePatternLength(${o}, ${l}, v_width)`)+ }+ if (+ ("stroke-width" in t && e.setStrokeWidthExpression(km(n, t["stroke-width"], Hl)),+ "stroke-offset" in t && e.setStrokeOffsetExpression(km(n, t["stroke-offset"], Hl)),+ "stroke-line-cap" in t && e.setStrokeCapExpression(km(n, t["stroke-line-cap"], Kl)),+ "stroke-line-join" in t && e.setStrokeJoinExpression(km(n, t["stroke-line-join"], Kl)),+ "stroke-miter-limit" in t && e.setStrokeMiterLimitExpression(km(n, t["stroke-miter-limit"], Hl)),+ "stroke-line-dash" in t)+ ) {+ n.functions.getSingleDashDistance = `float getSingleDashDistance(float distance, float radius, float dashOffset, float dashLength, float dashLengthTotal, float capType, float lineWidth) {\n float localDistance = mod(distance, dashLengthTotal);\n float distanceSegment = abs(localDistance - dashOffset - dashLength * 0.5) - dashLength * 0.5;\n distanceSegment = min(distanceSegment, dashLengthTotal - localDistance);\n if (capType == ${$_(+ "square"+ )}) {\n distanceSegment -= lineWidth * 0.5;\n } else if (capType == ${$_(+ "round"+ )}) {\n distanceSegment = min(distanceSegment, sqrt(distanceSegment * distanceSegment + radius * radius) - lineWidth * 0.5);\n }\n return distanceSegment;\n}`+ let i = t["stroke-line-dash"].map((t) => km(n, t, Hl))+ i.length % 2 == 1 && (i = [...i, ...i])+ let r = "0."+ "stroke-line-dash-offset" in t && (r = km(n, t["stroke-line-dash-offset"], Hl))+ const s = `dashDistanceField_${Ym(t["stroke-line-dash"])}`,+ o = i.map((t, e) => `float dashLength${e}`).join(", "),+ a = i.map((t, e) => `dashLength${e}`).join(" + ")+ let l = "0.",+ h = `getSingleDashDistance(distance, radius, ${l}, dashLength0, totalDashLength, capType, lineWidth)`+ for (let t = 2; t < i.length; t += 2)+ (l = `${l} + dashLength${t - 2} + dashLength${t - 1}`),+ (h = `min(${h}, getSingleDashDistance(distance, radius, ${l}, dashLength${t}, totalDashLength, capType, lineWidth))`)+ n.functions[+ s+ ] = `float ${s}(float distance, float radius, float capType, float lineWidth, ${o}) {\n float totalDashLength = ${a};\n return ${h};\n}`+ const c = i.map((t, e) => `${t}`).join(", ")+ e.setStrokeDistanceFieldExpression(`${s}(currentLengthPx + ${r}, currentRadiusPx, capType, v_width, ${c})`)+ let u = i.join(" + ")+ e.getStrokePatternLengthExpression() &&+ ((n.functions.combinePatternLengths =+ "float combinePatternLengths(float patternLength1, float patternLength2) {\n return patternLength1 * patternLength2;\n}"),+ (u = `combinePatternLengths(${e.getStrokePatternLengthExpression()}, ${u})`)),+ e.setStrokePatternLengthExpression(u)+ }+ })(t, r, s, n),+ (function (t, e, i, n) {+ if (("fill-color" in t && e.setFillColorExpression(km(n, t["fill-color"], ql)), "fill-pattern-src" in t)) {+ const r = Ym(t["fill-pattern-src"]),+ s = qm(t, e, i, "fill-pattern-", r)+ let o = s,+ a = "vec2(0.)"+ "fill-pattern-offset" in t &&+ "fill-pattern-size" in t &&+ ((o = km(n, t["fill-pattern-size"], Jl)), (a = Jm(t, "fill-pattern-", n, s, o))),+ (n.functions.sampleFillPattern =+ "vec4 sampleFillPattern(sampler2D texture, vec2 textureSize, vec2 textureOffset, vec2 sampleSize, vec2 pxOrigin, vec2 pxPosition) {\n float scaleRatio = pow(2., mod(u_zoom + 0.5, 1.) - 0.5);\n vec2 pxRelativePos = pxPosition - pxOrigin;\n // rotate the relative position from origin by the current view rotation\n pxRelativePos = vec2(pxRelativePos.x * cos(u_rotation) - pxRelativePos.y * sin(u_rotation), pxRelativePos.x * sin(u_rotation) + pxRelativePos.y * cos(u_rotation));\n // sample position is computed according to the sample offset & size\n vec2 samplePos = mod(pxRelativePos / scaleRatio, sampleSize);\n // also make sure that we're not sampling too close to the borders to avoid interpolation with outside pixels\n samplePos = clamp(samplePos, vec2(0.5), sampleSize - vec2(0.5));\n samplePos.y = sampleSize.y - samplePos.y; // invert y axis so that images appear upright\n return texture2D(texture, (samplePos + textureOffset) / textureSize);\n}")+ const l = `u_texture${r}`+ let h = "1."+ "fill-color" in t && (h = e.getFillColorExpression()),+ e.setFillColorExpression(`${h} * sampleFillPattern(${l}, ${s}, ${a}, ${o}, pxOrigin, pxPos)`)+ }+ })(t, r, s, n),+ i)+ ) {+ const t = km(n, i, Yl)+ r.setFragmentDiscardExpression(`!${t}`)+ }+ const o = {}+ function a(t, e, i, s) {+ if (!n[t]) return+ const a = Bm(i),+ l = Um(i)+ r.addAttribute(`a_${e}`, a), (o[e] = { size: l, callback: s })+ }+ return (+ a("geometryType", q_, Kl, (t) => V_(vh(t.getGeometry()))),+ a("featureId", K_, Kl | Hl, (t) => {+ const e = t.getId() ?? null+ return "string" == typeof e ? V_(e) : e+ }),+ zm(r, n),+ { builder: r, attributes: { ...o, ...Vm(n) }, uniforms: { ...s, ...Xm(n, e) } }+ )+ }+ const ty = []+ let ey+ function iy() {+ return ey || (ey = D_()), ey+ }+ let ny = 0+ const ry = "a_position",+ sy = "a_localPosition",+ oy = "a_segmentStart",+ ay = "a_segmentEnd",+ ly = "a_measureStart",+ hy = "a_measureEnd",+ cy = "a_angleTangentSum",+ uy = "a_joinAngles",+ dy = "a_distanceLow",+ gy = "a_distanceHigh"+ class fy {+ constructor(t, e, i, n) {+ this.helper_,+ (this.hitDetectionEnabled_ = !!n),+ (this.styleShaders = py(t, e)),+ (this.customAttributes_ = {}),+ (this.uniforms_ = {}),+ this.hitDetectionEnabled_ &&+ (this.customAttributes_.hitColor = {+ callback() {+ return A_(this.ref, ty)+ },+ size: 2+ })+ for (const t of this.styleShaders) {+ for (const e in t.attributes) e in this.customAttributes_ || (this.customAttributes_[e] = t.attributes[e])+ for (const e in t.uniforms) e in this.uniforms_ || (this.uniforms_[e] = t.uniforms[e])+ }+ ;(this.renderPasses_ = this.styleShaders.map((t) => {+ const e = {},+ i = Object.entries(this.customAttributes_).map(([e, i]) => ({+ name: e in t.attributes || "hitColor" === e ? `a_${e}` : null,+ size: i.size || 1,+ type: Bp+ }))+ return (+ t.builder.getFillVertexShader() &&+ (e.fillRenderPass = {+ vertexShader: t.builder.getFillVertexShader(),+ fragmentShader: t.builder.getFillFragmentShader(),+ attributesDesc: [{ name: ry, size: 2, type: Bp }, ...i],+ instancedAttributesDesc: [],+ instancePrimitiveVertexCount: 3+ }),+ t.builder.getStrokeVertexShader() &&+ (e.strokeRenderPass = {+ vertexShader: t.builder.getStrokeVertexShader(),+ fragmentShader: t.builder.getStrokeFragmentShader(),+ attributesDesc: [{ name: sy, size: 2, type: Bp }],+ instancedAttributesDesc: [+ { name: oy, size: 2, type: Bp },+ { name: ly, size: 1, type: Bp },+ { name: ay, size: 2, type: Bp },+ { name: hy, size: 1, type: Bp },+ { name: uy, size: 2, type: Bp },+ { name: dy, size: 1, type: Bp },+ { name: gy, size: 1, type: Bp },+ { name: cy, size: 1, type: Bp },+ ...i+ ],+ instancePrimitiveVertexCount: 6+ }),+ t.builder.getSymbolVertexShader() &&+ (e.symbolRenderPass = {+ vertexShader: t.builder.getSymbolVertexShader(),+ fragmentShader: t.builder.getSymbolFragmentShader(),+ attributesDesc: [{ name: sy, size: 2, type: Bp }],+ instancedAttributesDesc: [{ name: ry, size: 2, type: Bp }, ...i],+ instancePrimitiveVertexCount: 6+ }),+ e+ )+ })),+ (this.hasFill_ = this.renderPasses_.some((t) => t.fillRenderPass)),+ (this.hasStroke_ = this.renderPasses_.some((t) => t.strokeRenderPass)),+ (this.hasSymbol_ = this.renderPasses_.some((t) => t.symbolRenderPass)),+ this.setHelper(i)+ }+ async generateBuffers(t, e) {+ if (t.isEmpty()) return null+ const i = this.generateRenderInstructions_(t, e),+ [n, r, s] = await Promise.all([+ this.generateBuffersForType_(i.polygonInstructions, "Polygon", e),+ this.generateBuffersForType_(i.lineStringInstructions, "LineString", e),+ this.generateBuffersForType_(i.pointInstructions, "Point", e)+ ])+ return {+ polygonBuffers: n,+ lineStringBuffers: r,+ pointBuffers: s,+ invertVerticesTransform: rr([1, 0, 0, 1, 0, 0], e)+ }+ }+ generateRenderInstructions_(t, e) {+ return {+ polygonInstructions: this.hasFill_ ? am(t.polygonBatch, new Float32Array(0), this.customAttributes_, e) : null,+ lineStringInstructions: this.hasStroke_+ ? om(t.lineStringBatch, new Float32Array(0), this.customAttributes_, e)+ : null,+ pointInstructions: this.hasSymbol_ ? sm(t.pointBatch, new Float32Array(0), this.customAttributes_, e) : null+ }+ }+ generateBuffersForType_(t, e, i) {+ if (null === t) return null+ const n = ny+++ let r+ switch (e) {+ case "Polygon":+ r = F_+ break+ case "LineString":+ r = M_+ break+ case "Point":+ r = L_+ }+ const s = {+ id: n,+ type: r,+ renderInstructions: t.buffer,+ renderInstructionsTransform: i,+ customAttributesSize: rm(this.customAttributes_)+ },+ o = iy()+ return (+ o.postMessage(s, [t.buffer]),+ (t = null),+ new Promise((t) => {+ const e = (i) => {+ const r = i.data+ if (r.id !== n) return+ if ((o.removeEventListener("message", e), !this.helper_.getGL())) return+ const s = new Mp(qf, Qf).fromArrayBuffer(r.indicesBuffer),+ a = new Mp(Kf, Qf).fromArrayBuffer(r.vertexAttributesBuffer),+ l = new Mp(Kf, Qf).fromArrayBuffer(r.instanceAttributesBuffer)+ this.helper_.flushBufferData(s),+ this.helper_.flushBufferData(a),+ this.helper_.flushBufferData(l),+ t([s, a, l])+ }+ o.addEventListener("message", e)+ })+ )+ }+ render(t, e, i) {+ for (const n of this.renderPasses_)+ n.fillRenderPass &&+ this.renderInternal_(t.polygonBuffers[0], t.polygonBuffers[1], t.polygonBuffers[2], n.fillRenderPass, e, i),+ n.strokeRenderPass &&+ this.renderInternal_(+ t.lineStringBuffers[0],+ t.lineStringBuffers[1],+ t.lineStringBuffers[2],+ n.strokeRenderPass,+ e,+ i+ ),+ n.symbolRenderPass &&+ this.renderInternal_(t.pointBuffers[0], t.pointBuffers[1], t.pointBuffers[2], n.symbolRenderPass, e, i)+ }+ renderInternal_(t, e, i, n, r, s) {+ const o = t.getSize()+ if (0 === o) return+ const a = n.instancedAttributesDesc.length+ if (+ (this.helper_.useProgram(n.program, r),+ this.helper_.bindBuffer(e),+ this.helper_.bindBuffer(t),+ this.helper_.enableAttributes(n.attributesDesc),+ this.helper_.bindBuffer(i),+ this.helper_.enableAttributesInstanced(n.instancedAttributesDesc),+ s(),+ a)+ ) {+ const t = n.instancedAttributesDesc.reduce((t, e) => t + (e.size || 1), 0),+ e = i.getSize() / t+ this.helper_.drawElementsInstanced(0, o, e)+ } else this.helper_.drawElements(0, o)+ }+ setHelper(t, e = null) {+ this.helper_ = t+ for (const t of this.renderPasses_)+ t.fillRenderPass &&+ (t.fillRenderPass.program = this.helper_.getProgram(+ t.fillRenderPass.fragmentShader,+ t.fillRenderPass.vertexShader+ )),+ t.strokeRenderPass &&+ (t.strokeRenderPass.program = this.helper_.getProgram(+ t.strokeRenderPass.fragmentShader,+ t.strokeRenderPass.vertexShader+ )),+ t.symbolRenderPass &&+ (t.symbolRenderPass.program = this.helper_.getProgram(+ t.symbolRenderPass.fragmentShader,+ t.symbolRenderPass.vertexShader+ ))+ this.helper_.addUniforms(this.uniforms_),+ e &&+ (e.polygonBuffers &&+ (this.helper_.flushBufferData(e.polygonBuffers[0]),+ this.helper_.flushBufferData(e.polygonBuffers[1]),+ this.helper_.flushBufferData(e.polygonBuffers[2])),+ e.lineStringBuffers &&+ (this.helper_.flushBufferData(e.lineStringBuffers[0]),+ this.helper_.flushBufferData(e.lineStringBuffers[1]),+ this.helper_.flushBufferData(e.lineStringBuffers[2])),+ e.pointBuffers &&+ (this.helper_.flushBufferData(e.pointBuffers[0]),+ this.helper_.flushBufferData(e.pointBuffers[1]),+ this.helper_.flushBufferData(e.pointBuffers[2])))+ }+ }+ function py(t, e) {+ const i = Array.isArray(t) ? t : [t]+ if ("style" in i[0]) {+ const t = [],+ n = i,+ r = []+ for (const i of n) {+ const n = Array.isArray(i.style) ? i.style : [i.style]+ let s = i.filter+ i.else &&+ r.length &&+ ((s = ["all", ...r.map((t) => ["!", t])]), i.filter && s.push(i.filter), s.length < 3 && (s = s[1])),+ i.filter && r.push(i.filter)+ const o = n.map((t) => Qm(t, e, s))+ t.push(...o)+ }+ return t+ }+ return "builder" in i[0] ? i : i.map((t) => Qm(t, e, null))+ }+ const _y = {+ ...kp,+ RENDER_EXTENT: "u_renderExtent",+ PATTERN_ORIGIN: "u_patternOrigin",+ GLOBAL_ALPHA: "u_globalAlpha"+ }+ class my extends d_ {+ constructor(t, e) {+ super(t, {+ uniforms: { [_y.RENDER_EXTENT]: [0, 0, 0, 0], [_y.PATTERN_ORIGIN]: [0, 0], [_y.GLOBAL_ALPHA]: 1 },+ postProcesses: e.postProcesses+ }),+ (this.hitDetectionEnabled_ = !e.disableHitDetection),+ this.hitRenderTarget_,+ (this.sourceRevision_ = -1),+ (this.previousExtent_ = [1 / 0, 1 / 0, -1 / 0, -1 / 0]),+ (this.currentTransform_ = [1, 0, 0, 1, 0, 0]),+ (this.tmpCoords_ = [0, 0]),+ (this.tmpTransform_ = [1, 0, 0, 1, 0, 0]),+ (this.tmpMat4_ = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]),+ (this.currentFrameStateTransform_ = [1, 0, 0, 1, 0, 0]),+ (this.styleVariables_ = {}),+ (this.style_ = []),+ (this.styleRenderer_ = null),+ (this.buffers_ = null),+ this.applyOptions_(e),+ (this.batch_ = new qp()),+ (this.initialFeaturesAdded_ = !1),+ (this.sourceListenKeys_ = null)+ }+ addInitialFeatures_(t) {+ const e = this.getLayer().getSource(),+ i = Gn()+ let n+ i && (n = Ln(i, t.viewState.projection)),+ this.batch_.addFeatures(e.getFeatures(), n),+ (this.sourceListenKeys_ = [+ D(e, Xd, this.handleSourceFeatureAdded_.bind(this, n)),+ D(e, Vd, this.handleSourceFeatureChanged_.bind(this, n), this),+ D(e, Wd, this.handleSourceFeatureDelete_, this),+ D(e, $d, this.handleSourceFeatureClear_, this)+ ])+ }+ applyOptions_(t) {+ ;(this.styleVariables_ = t.variables), (this.style_ = t.style)+ }+ createRenderers_() {+ ;(this.buffers_ = null),+ (this.styleRenderer_ = new fy(this.style_, this.styleVariables_, this.helper, this.hitDetectionEnabled_))+ }+ reset(t) {+ this.applyOptions_(t), this.helper && this.createRenderers_(), super.reset(t)+ }+ afterHelperCreated() {+ this.styleRenderer_ ? this.styleRenderer_.setHelper(this.helper, this.buffers_) : this.createRenderers_(),+ this.hitDetectionEnabled_ && (this.hitRenderTarget_ = new Kp(this.helper))+ }+ handleSourceFeatureAdded_(t, e) {+ const i = e.feature+ this.batch_.addFeature(i, t)+ }+ handleSourceFeatureChanged_(t, e) {+ const i = e.feature+ this.batch_.changeFeature(i, t)+ }+ handleSourceFeatureDelete_(t) {+ const e = t.feature+ this.batch_.removeFeature(e)+ }+ handleSourceFeatureClear_() {+ this.batch_.clear()+ }+ applyUniforms_(t) {+ Jn(this.tmpTransform_, this.currentFrameStateTransform_),+ Kn(this.tmpTransform_, t),+ this.helper.setUniformMatrixValue(_y.PROJECTION_MATRIX, Qd(this.tmpMat4_, this.tmpTransform_)),+ rr(this.tmpTransform_, this.tmpTransform_),+ this.helper.setUniformMatrixValue(_y.SCREEN_TO_WORLD_MATRIX, Qd(this.tmpMat4_, this.tmpTransform_)),+ (this.tmpCoords_[0] = 0),+ (this.tmpCoords_[1] = 0),+ rr(this.tmpTransform_, t),+ Qn(this.tmpTransform_, this.tmpCoords_),+ this.helper.setUniformFloatVec2(_y.PATTERN_ORIGIN, this.tmpCoords_)+ }+ renderFrame(t) {+ const e = this.helper.getGL()+ this.preRender(e, t)+ const [i, n, r] = N_(t, this.getLayer())+ this.helper.prepareDraw(t),+ this.renderWorlds(t, !1, i, n, r),+ this.helper.finalizeDraw(t, this.dispatchPreComposeEvent, this.dispatchPostComposeEvent)+ const s = this.helper.getCanvas()+ return (+ this.hitDetectionEnabled_ && (this.renderWorlds(t, !0, i, n, r), this.hitRenderTarget_.clearCachedData()),+ this.postRender(e, t),+ s+ )+ }+ prepareFrameInternal(t) {+ this.initialFeaturesAdded_ || (this.addInitialFeatures_(t), (this.initialFeaturesAdded_ = !0))+ const e = this.getLayer(),+ i = e.getSource(),+ n = t.viewState,+ r = !t.viewHints[co] && !t.viewHints[uo],+ s = !te(this.previousExtent_, t.extent),+ o = this.sourceRevision_ < i.getRevision()+ if ((o && (this.sourceRevision_ = i.getRevision()), r && (s || o))) {+ const r = n.projection,+ s = n.resolution,+ o = e instanceof zc ? e.getRenderBuffer() : 0,+ a = zt(t.extent, o * s),+ l = Gn()+ l ? i.loadFeatures(Bn(a, l), Xn(s, r), l) : i.loadFeatures(a, s, r), (this.ready = !1)+ const h = this.helper.makeProjectionTransform(t, [1, 0, 0, 1, 0, 0])+ this.styleRenderer_.generateBuffers(this.batch_, h).then((t) => {+ this.buffers_ && this.disposeBuffers(this.buffers_),+ (this.buffers_ = t),+ (this.ready = !0),+ this.getLayer().changed()+ }),+ (this.previousExtent_ = t.extent.slice())+ }+ return !0+ }+ renderWorlds(t, e, i, n, r) {+ let s = i+ e &&+ (this.hitRenderTarget_.setSize([Math.floor(t.size[0] / 2), Math.floor(t.size[1] / 2)]),+ this.helper.prepareDrawToRenderTarget(t, this.hitRenderTarget_, !0))+ do {+ this.helper.makeProjectionTransform(t, this.currentFrameStateTransform_),+ ir(this.currentFrameStateTransform_, s * r, 0),+ this.buffers_ &&+ this.styleRenderer_.render(this.buffers_, t, () => {+ this.applyUniforms_(this.buffers_.invertVerticesTransform), this.helper.applyHitDetectionUniform(e)+ })+ } while (++s < n)+ }+ forEachFeatureAtCoordinate(t, e, i, n, r) {+ if (+ (Mt(+ this.hitDetectionEnabled_,+ "`forEachFeatureAtCoordinate` cannot be used on a WebGL layer if the hit detection logic has been disabled using the `disableHitDetection: true` option."+ ),+ !this.styleRenderer_ || !this.hitDetectionEnabled_)+ )+ return+ const s = Qn(e.coordinateToPixelTransform, t.slice()),+ o = this.hitRenderTarget_.readPixel(s[0] / 2, s[1] / 2),+ a = O_([o[0] / 255, o[1] / 255, o[2] / 255, o[3] / 255]),+ l = this.batch_.getFeatureFromRef(a)+ return l ? n(l, this.getLayer(), null) : void 0+ }+ disposeBuffers(t) {+ const e = (t) => {+ for (const e of t) e && this.helper.deleteBuffer(e)+ }+ t.pointBuffers && e(t.pointBuffers),+ t.lineStringBuffers && e(t.lineStringBuffers),+ t.polygonBuffers && e(t.polygonBuffers)+ }+ disposeInternal() {+ this.buffers_ && this.disposeBuffers(this.buffers_),+ this.sourceListenKeys_ &&+ (this.sourceListenKeys_.forEach(function (t) {+ k(t)+ }),+ (this.sourceListenKeys_ = null)),+ super.disposeInternal()+ }+ renderDeclutter() {}+ }+ const yy = { ...g_, TILE_MASK_TEXTURE: "u_depthMask", TILE_ZOOM_LEVEL: "u_tileZoomLevel" },+ xy = { POSITION: "a_position" }+ class vy extends v_ {+ constructor(t, e) {+ super(t, {+ cacheSize: e.cacheSize,+ uniforms: { [yy.PATTERN_ORIGIN]: [0, 0], [yy.TILE_MASK_TEXTURE]: () => this.tileMaskTarget_.getTexture() }+ }),+ (this.hitDetectionEnabled_ = !e.disableHitDetection),+ (this.style_ = null),+ (this.styleVariables_ = e.variables || {}),+ (this.styleRenderer_ = null),+ (this.currentFrameStateTransform_ = [1, 0, 0, 1, 0, 0]),+ (this.tmpTransform_ = [1, 0, 0, 1, 0, 0]),+ (this.tmpMat4_ = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]),+ (this.tileMaskTarget_ = null),+ (this.tileMaskIndices_ = new Mp(qf, Jf)),+ this.tileMaskIndices_.fromArray([0, 1, 3, 1, 2, 3]),+ (this.tileMaskAttributes_ = [{ name: xy.POSITION, size: 2, type: Bp }]),+ this.tileMaskProgram_,+ this.applyOptions_(e)+ }+ reset(t) {+ super.reset(t), this.applyOptions_(t), this.helper && (this.createRenderers_(), this.initTileMask_())+ }+ applyOptions_(t) {+ this.style_ = t.style+ }+ createRenderers_() {+ function t(t) {+ const e = t.getFragmentDiscardExpression(),+ i = `texture2D(${yy.TILE_MASK_TEXTURE}, gl_FragCoord.xy / u_pixelRatio / u_viewportSizePx).r * 50. > ${yy.TILE_ZOOM_LEVEL} + 0.5`+ t.setFragmentDiscardExpression("false" !== e ? `(${e}) || (${i})` : i),+ t.addUniform(yy.TILE_MASK_TEXTURE, "sampler2D"),+ t.addUniform(yy.TILE_ZOOM_LEVEL, "float")+ }+ const e = py(this.style_, this.styleVariables_)+ for (const i of e) t(i.builder)+ this.styleRenderer_ = new fy(e, this.styleVariables_, this.helper, this.hitDetectionEnabled_)+ }+ initTileMask_() {+ this.tileMaskTarget_ = new Kp(this.helper)+ const t = new Zm()+ .setFillColorExpression(`vec4(${yy.TILE_ZOOM_LEVEL} / 50., 0., 0., 1.)`)+ .addUniform(yy.TILE_ZOOM_LEVEL, "float")+ ;(this.tileMaskProgram_ = this.helper.getProgram(t.getFillFragmentShader(), t.getFillVertexShader())),+ this.helper.flushBufferData(this.tileMaskIndices_)+ }+ afterHelperCreated() {+ this.createRenderers_(), this.initTileMask_()+ }+ createTileRepresentation(t) {+ const e = new Jp(t, this.styleRenderer_),+ i = () => {+ e.ready && (this.getLayer().changed(), e.removeEventListener(n, i))+ }+ return e.addEventListener(n, i), e+ }+ beforeTilesRender(t, e) {+ super.beforeTilesRender(t, !0), this.helper.makeProjectionTransform(t, this.currentFrameStateTransform_)+ }+ beforeTilesMaskRender(t) {+ this.helper.makeProjectionTransform(t, this.currentFrameStateTransform_)+ const e = t.pixelRatio,+ i = t.size+ return (+ this.tileMaskTarget_.setSize([i[0] * e, i[1] * e]),+ this.helper.prepareDrawToRenderTarget(t, this.tileMaskTarget_, !0, !0),+ this.helper.useProgram(this.tileMaskProgram_, t),+ Jn(this.tmpTransform_, this.currentFrameStateTransform_),+ this.helper.setUniformMatrixValue(yy.PROJECTION_MATRIX, Qd(this.tmpMat4_, this.tmpTransform_)),+ rr(this.tmpTransform_, this.currentFrameStateTransform_),+ this.helper.setUniformMatrixValue(yy.SCREEN_TO_WORLD_MATRIX, Qd(this.tmpMat4_, this.tmpTransform_)),+ !0+ )+ }+ renderTileMask(t, e, i, n) {+ if (!t.ready) return+ this.helper.setUniformFloatValue(yy.DEPTH, n),+ this.helper.setUniformFloatValue(yy.TILE_ZOOM_LEVEL, e),+ this.helper.setUniformFloatVec4(yy.RENDER_EXTENT, i),+ this.helper.setUniformFloatValue(yy.GLOBAL_ALPHA, 1),+ this.helper.bindBuffer(t.maskVertices),+ this.helper.bindBuffer(this.tileMaskIndices_),+ this.helper.enableAttributes(this.tileMaskAttributes_)+ const r = this.tileMaskIndices_.getSize()+ this.helper.drawElements(0, r)+ }+ applyUniforms_(t, e, i, n, r) {+ Jn(this.tmpTransform_, this.currentFrameStateTransform_),+ Kn(this.tmpTransform_, i),+ this.helper.setUniformMatrixValue(yy.PROJECTION_MATRIX, Qd(this.tmpMat4_, this.tmpTransform_)),+ rr(this.tmpTransform_, this.currentFrameStateTransform_),+ this.helper.setUniformMatrixValue(yy.SCREEN_TO_WORLD_MATRIX, Qd(this.tmpMat4_, this.tmpTransform_)),+ this.helper.setUniformFloatValue(yy.GLOBAL_ALPHA, t),+ this.helper.setUniformFloatValue(yy.DEPTH, r),+ this.helper.setUniformFloatValue(yy.TILE_ZOOM_LEVEL, n),+ this.helper.setUniformFloatVec4(yy.RENDER_EXTENT, e)+ }+ renderTile(t, e, i, n, r, s, o, a, l, h, c) {+ const u = me(a, n, a),+ d = t.tile.getTileCoord()[0],+ g = t.buffers+ g &&+ this.styleRenderer_.render(g, i, () => {+ this.applyUniforms_(c, u, g.invertVerticesTransform, d, l)+ })+ }+ renderDeclutter(t) {}+ disposeInternal() {+ super.disposeInternal()+ }+ }+ const Sy = 0,+ Ey = 1,+ wy = 2,+ Ty = 3,+ Cy = 4,+ by = 5,+ Ry = 6,+ Py = 7,+ Iy = 8,+ Fy = 9,+ Ly = 10,+ My = 11,+ Ay = 12,+ Oy = [Iy],+ Dy = [Ay],+ Ny = [Ey],+ ky = [Ty]+ class Gy extends yu {+ constructor(t, e, i, n) {+ super(),+ (this.tolerance = t),+ (this.maxExtent = e),+ (this.pixelRatio = n),+ (this.maxLineWidth = 0),+ (this.resolution = i),+ (this.beginGeometryInstruction1_ = null),+ (this.beginGeometryInstruction2_ = null),+ (this.bufferedMaxExtent_ = null),+ (this.instructions = []),+ (this.coordinates = []),+ (this.tmpCoordinate_ = []),+ (this.hitDetectionInstructions = []),+ (this.state = {})+ }+ applyPixelRatio(t) {+ const e = this.pixelRatio+ return 1 == e+ ? t+ : t.map(function (t) {+ return t * e+ })+ }+ appendFlatPointCoordinates(t, e) {+ const i = this.getBufferedMaxExtent(),+ n = this.tmpCoordinate_,+ r = this.coordinates+ let s = r.length+ for (let o = 0, a = t.length; o < a; o += e)+ (n[0] = t[o]), (n[1] = t[o + 1]), $t(i, n) && ((r[s++] = n[0]), (r[s++] = n[1]))+ return s+ }+ appendFlatLineCoordinates(t, e, i, n, r, s) {+ const o = this.coordinates+ let a = o.length+ const l = this.getBufferedMaxExtent()+ s && (e += n)+ let h = t[e],+ c = t[e + 1]+ const u = this.tmpCoordinate_+ let d,+ g,+ f,+ p = !0+ for (d = e + n; d < i; d += n)+ (u[0] = t[d]),+ (u[1] = t[d + 1]),+ (f = Yt(l, u)),+ f !== g+ ? (p && ((o[a++] = h), (o[a++] = c), (p = !1)), (o[a++] = u[0]), (o[a++] = u[1]))+ : f === Nt+ ? ((o[a++] = u[0]), (o[a++] = u[1]), (p = !1))+ : (p = !0),+ (h = u[0]),+ (c = u[1]),+ (g = f)+ return ((r && p) || d === e + n) && ((o[a++] = h), (o[a++] = c)), a+ }+ drawCustomCoordinates_(t, e, i, n, r) {+ for (let s = 0, o = i.length; s < o; ++s) {+ const o = i[s],+ a = this.appendFlatLineCoordinates(t, e, o, n, !1, !1)+ r.push(a), (e = o)+ }+ return e+ }+ drawCustom(t, e, i, n, r) {+ this.beginGeometry(t, e, r)+ const s = t.getType(),+ o = t.getStride(),+ a = this.coordinates.length+ let l, h, c, u, d+ switch (s) {+ case "MultiPolygon":+ ;(l = t.getOrientedFlatCoordinates()), (u = [])+ 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)), u.push(i)+ }+ this.instructions.push([Cy, a, u, t, i, kr, r]),+ this.hitDetectionInstructions.push([Cy, a, u, t, n || i, kr, r])+ break+ case "Polygon":+ case "MultiLineString":+ ;(c = []),+ (l = "Polygon" == s ? t.getOrientedFlatCoordinates() : t.getFlatCoordinates()),+ (d = this.drawCustomCoordinates_(l, 0, t.getEnds(), o, c)),+ this.instructions.push([Cy, a, c, t, i, Nr, r]),+ this.hitDetectionInstructions.push([Cy, a, c, t, n || i, Nr, r])+ break+ case "LineString":+ case "Circle":+ ;(l = t.getFlatCoordinates()),+ (h = this.appendFlatLineCoordinates(l, 0, l.length, o, !1, !1)),+ this.instructions.push([Cy, a, h, t, i, Dr, r]),+ this.hitDetectionInstructions.push([Cy, a, h, t, n || i, Dr, r])+ break+ case "MultiPoint":+ ;(l = t.getFlatCoordinates()),+ (h = this.appendFlatPointCoordinates(l, o)),+ h > a &&+ (this.instructions.push([Cy, a, h, t, i, Dr, r]),+ this.hitDetectionInstructions.push([Cy, a, h, t, n || i, Dr, r]))+ break+ case "Point":+ ;(l = t.getFlatCoordinates()),+ this.coordinates.push(l[0], l[1]),+ (h = this.coordinates.length),+ this.instructions.push([Cy, a, h, t, i, void 0, r]),+ this.hitDetectionInstructions.push([Cy, a, h, t, n || i, void 0, r])+ }+ this.endGeometry(e)+ }+ beginGeometry(t, e, i) {+ ;(this.beginGeometryInstruction1_ = [Sy, e, 0, t, i]),+ this.instructions.push(this.beginGeometryInstruction1_),+ (this.beginGeometryInstruction2_ = [Sy, e, 0, t, i]),+ this.hitDetectionInstructions.push(this.beginGeometryInstruction2_)+ }+ finish() {+ return {+ instructions: this.instructions,+ hitDetectionInstructions: this.hitDetectionInstructions,+ coordinates: this.coordinates+ }+ }+ reverseHitDetectionInstructions() {+ const t = this.hitDetectionInstructions+ let e+ t.reverse()+ const i = t.length+ let n,+ r,+ s = -1+ for (e = 0; e < i; ++e)+ (n = t[e]),+ (r = n[0]),+ r == Py ? (s = e) : r == Sy && ((n[2] = e), S(this.hitDetectionInstructions, s, e), (s = -1))+ }+ fillStyleToState(t, e = {}) {+ if (t) {+ const i = t.getColor()+ ;(e.fillPatternScale = i && "object" == typeof i && "src" in i ? this.pixelRatio : 1),+ (e.fillStyle = Mh(i || Oh))+ } else e.fillStyle = void 0+ return e+ }+ strokeStyleToState(t, e = {}) {+ if (t) {+ const i = t.getColor()+ e.strokeStyle = Mh(i || jh)+ const n = t.getLineCap()+ e.lineCap = void 0 !== n ? n : Dh+ const r = t.getLineDash()+ e.lineDash = r ? r.slice() : Nh+ const s = t.getLineDashOffset()+ e.lineDashOffset = s || 0+ const o = t.getLineJoin()+ e.lineJoin = void 0 !== o ? o : kh+ const a = t.getWidth()+ e.lineWidth = void 0 !== a ? a : 1+ const l = t.getMiterLimit()+ e.miterLimit = void 0 !== l ? l : Gh+ 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 = [Ly, e]+ return "string" != typeof e && i.push(t.fillPatternScale), i+ }+ applyStroke(t) {+ this.instructions.push(this.createStroke(t))+ }+ createStroke(t) {+ return [+ My,+ 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+ ;("string" == typeof i && t.currentFillStyle == i) ||+ (this.instructions.push(e.call(this, t)), (t.currentFillStyle = i))+ }+ updateStrokeStyle(t, e) {+ const i = t.strokeStyle,+ n = t.lineCap,+ r = t.lineDash,+ s = t.lineDashOffset,+ o = t.lineJoin,+ a = t.lineWidth,+ l = t.miterLimit,+ h = t.strokeOffset+ ;(t.currentStrokeStyle != i ||+ t.currentLineCap != n ||+ (r != t.currentLineDash && !w(t.currentLineDash, r)) ||+ t.currentLineDashOffset != s ||+ t.currentLineJoin != o ||+ t.currentLineWidth != a ||+ t.currentMiterLimit != l ||+ t.currentStrokeOffset != h) &&+ (e.call(this, t),+ (t.currentStrokeStyle = i),+ (t.currentLineCap = n),+ (t.currentLineDash = r),+ (t.currentLineDashOffset = s),+ (t.currentLineJoin = o),+ (t.currentLineWidth = a),+ (t.currentMiterLimit = l),+ (t.currentStrokeOffset = h))+ }+ endGeometry(t) {+ ;(this.beginGeometryInstruction1_[2] = this.instructions.length),+ (this.beginGeometryInstruction1_ = null),+ (this.beginGeometryInstruction2_[2] = this.hitDetectionInstructions.length),+ (this.beginGeometryInstruction2_ = null)+ const e = [Py, t]+ this.instructions.push(e), this.hitDetectionInstructions.push(e)+ }+ getBufferedMaxExtent() {+ if (!this.bufferedMaxExtent_ && ((this.bufferedMaxExtent_ = Xt(this.maxExtent)), this.maxLineWidth > 0)) {+ const t = (this.resolution * (this.maxLineWidth + 1)) / 2+ zt(this.bufferedMaxExtent_, t, this.bufferedMaxExtent_)+ }+ return this.bufferedMaxExtent_+ }+ }+ class jy extends Gy {+ 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 && !$t(this.maxExtent, t.getFlatCoordinates()))) return+ this.beginGeometry(t, e, i)+ const n = t.getFlatCoordinates(),+ r = t.getStride(),+ s = this.coordinates.length,+ o = this.appendFlatPointCoordinates(n, r)+ this.instructions.push([+ Ry,+ s,+ o,+ this.image_,+ this.anchorX_ * this.imagePixelRatio_,+ this.anchorY_ * this.imagePixelRatio_,+ Math.ceil(this.height_ * this.imagePixelRatio_),+ this.opacity_,+ this.originX_ * this.imagePixelRatio_,+ this.originY_ * this.imagePixelRatio_,+ this.rotateWithView_,+ this.rotation_,+ [+ (this.scale_[0] * this.pixelRatio) / this.imagePixelRatio_,+ (this.scale_[1] * this.pixelRatio) / this.imagePixelRatio_+ ],+ Math.ceil(this.width_ * this.imagePixelRatio_),+ this.declutterMode_,+ this.declutterImageWithText_+ ]),+ this.hitDetectionInstructions.push([+ Ry,+ s,+ o,+ this.hitDetectionImage_,+ this.anchorX_,+ this.anchorY_,+ this.height_,+ 1,+ this.originX_,+ this.originY_,+ this.rotateWithView_,+ this.rotation_,+ this.scale_,+ this.width_,+ this.declutterMode_,+ this.declutterImageWithText_+ ]),+ this.endGeometry(e)+ }+ drawMultiPoint(t, e, i) {+ if (!this.image_) return+ this.beginGeometry(t, e, i)+ const n = t.getFlatCoordinates(),+ r = []+ for (let e = 0, i = n.length; e < i; e += t.getStride())+ (this.maxExtent && !$t(this.maxExtent, n.slice(e, e + 2))) || r.push(n[e], n[e + 1])+ const s = this.coordinates.length,+ o = this.appendFlatPointCoordinates(r, 2)+ this.instructions.push([+ Ry,+ s,+ o,+ this.image_,+ this.anchorX_ * this.imagePixelRatio_,+ this.anchorY_ * this.imagePixelRatio_,+ Math.ceil(this.height_ * this.imagePixelRatio_),+ this.opacity_,+ this.originX_ * this.imagePixelRatio_,+ this.originY_ * this.imagePixelRatio_,+ this.rotateWithView_,+ this.rotation_,+ [+ (this.scale_[0] * this.pixelRatio) / this.imagePixelRatio_,+ (this.scale_[1] * this.pixelRatio) / this.imagePixelRatio_+ ],+ Math.ceil(this.width_ * this.imagePixelRatio_),+ this.declutterMode_,+ this.declutterImageWithText_+ ]),+ this.hitDetectionInstructions.push([+ Ry,+ s,+ o,+ this.hitDetectionImage_,+ this.anchorX_,+ this.anchorY_,+ this.height_,+ 1,+ this.originX_,+ this.originY_,+ this.rotateWithView_,+ this.rotation_,+ this.scale_,+ this.width_,+ this.declutterMode_,+ this.declutterImageWithText_+ ]),+ this.endGeometry(e)+ }+ finish() {+ return (+ this.reverseHitDetectionInstructions(),+ (this.anchorX_ = void 0),+ (this.anchorY_ = void 0),+ (this.hitDetectionImage_ = null),+ (this.image_ = null),+ (this.imagePixelRatio_ = void 0),+ (this.height_ = void 0),+ (this.scale_ = void 0),+ (this.opacity_ = void 0),+ (this.originX_ = void 0),+ (this.originY_ = void 0),+ (this.rotateWithView_ = void 0),+ (this.rotation_ = void 0),+ (this.width_ = void 0),+ super.finish()+ )+ }+ setImageStyle(t, e) {+ const i = t.getAnchor(),+ n = t.getSize(),+ r = t.getOrigin()+ ;(this.imagePixelRatio_ = t.getPixelRatio(this.pixelRatio)),+ (this.anchorX_ = i[0]),+ (this.anchorY_ = i[1]),+ (this.hitDetectionImage_ = t.getHitDetectionImage()),+ (this.image_ = t.getImage(this.pixelRatio)),+ (this.height_ = n[1]),+ (this.opacity_ = t.getOpacity()),+ (this.originX_ = r[0]),+ (this.originY_ = r[1]),+ (this.rotateWithView_ = t.getRotateWithView()),+ (this.rotation_ = t.getRotation()),+ (this.scale_ = t.getScaleArray()),+ (this.width_ = n[0]),+ (this.declutterMode_ = t.getDeclutterMode()),+ (this.declutterImageWithText_ = e)+ }+ }+ class Uy extends Gy {+ constructor(t, e, i, n) {+ super(t, e, i, n)+ }+ drawFlatCoordinates_(t, e, i, n, r) {+ const s = this.coordinates.length,+ o = this.appendFlatLineCoordinates(t, e, i, n, !1, !1)+ return (+ this.instructions.push([Fy, s, o, r * this.pixelRatio]), this.hitDetectionInstructions.push([Fy, s, o, r]), i+ )+ }+ drawLineString(t, e, i) {+ const n = this.state,+ r = n.strokeStyle,+ s = n.lineWidth,+ o = n.strokeOffset+ if (void 0 === r || void 0 === s) return+ this.updateStrokeStyle(n, this.applyStroke),+ this.beginGeometry(t, e, i),+ this.hitDetectionInstructions.push(+ [My, n.strokeStyle, n.lineWidth, n.lineCap, n.lineJoin, n.miterLimit, Nh, 0],+ Ny+ )+ const a = t.getFlatCoordinates(),+ l = t.getStride()+ this.drawFlatCoordinates_(a, 0, a.length, l, o), this.hitDetectionInstructions.push(Dy), this.endGeometry(e)+ }+ drawMultiLineString(t, e, i) {+ const n = this.state,+ r = n.strokeStyle,+ s = n.lineWidth,+ o = n.strokeOffset+ if (void 0 === r || void 0 === s) return+ this.updateStrokeStyle(n, this.applyStroke),+ this.beginGeometry(t, e, i),+ this.hitDetectionInstructions.push(+ [My, n.strokeStyle, n.lineWidth, n.lineCap, n.lineJoin, n.miterLimit, Nh, 0],+ Ny+ )+ 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(Dy), this.endGeometry(e)+ }+ finish() {+ const t = this.state+ return (+ null != t.lastStroke && t.lastStroke != this.coordinates.length && this.instructions.push(Dy),+ this.reverseHitDetectionInstructions(),+ (this.state = null),+ super.finish()+ )+ }+ applyStroke(t) {+ null != t.lastStroke &&+ t.lastStroke != this.coordinates.length &&+ (this.instructions.push(Dy), (t.lastStroke = this.coordinates.length)),+ (t.lastStroke = 0),+ super.applyStroke(t),+ this.instructions.push(Ny)+ }+ }+ class By extends Gy {+ constructor(t, e, i, n) {+ super(t, e, i, n)+ }+ drawFlatCoordinatess_(t, e, i, n, r) {+ const s = this.state,+ o = void 0 !== s.fillStyle,+ a = void 0 !== s.strokeStyle,+ l = i.length+ this.instructions.push(Ny), this.hitDetectionInstructions.push(Ny)+ for (let s = 0; s < l; ++s) {+ const o = i[s],+ l = this.coordinates.length,+ h = this.appendFlatLineCoordinates(t, e, o, n, !0, !a)+ this.instructions.push([Fy, l, h, r * this.pixelRatio, !0]),+ this.hitDetectionInstructions.push([Fy, l, h, r, !0]),+ a && (this.instructions.push(ky), this.hitDetectionInstructions.push(ky)),+ (e = o)+ }+ return (+ o && (this.instructions.push(Oy), this.hitDetectionInstructions.push(Oy)),+ a && (this.instructions.push(Dy), this.hitDetectionInstructions.push(Dy)),+ e+ )+ }+ drawCircle(t, e, i) {+ const n = this.state,+ r = n.fillStyle,+ s = n.strokeStyle,+ o = n.strokeOffset+ if (void 0 === r && void 0 === s) return+ if (this.handleStrokeOffset_(() => this.drawCircle(t, e, i))) return+ this.setFillStrokeStyles_(),+ this.beginGeometry(t, e, i),+ void 0 !== n.fillStyle && this.hitDetectionInstructions.push([Ly, Oh]),+ void 0 !== n.strokeStyle &&+ this.hitDetectionInstructions.push([+ My,+ n.strokeStyle,+ n.lineWidth,+ n.lineCap,+ n.lineJoin,+ n.miterLimit,+ Nh,+ 0+ ])+ const a = t.getFlatCoordinates(),+ l = t.getStride(),+ h = this.coordinates.length+ this.appendFlatLineCoordinates(a, 0, a.length, l, !1, !1)+ const c = [wy, h, o]+ this.instructions.push(Ny, c),+ this.hitDetectionInstructions.push(Ny, c),+ void 0 !== n.fillStyle && (this.instructions.push(Oy), this.hitDetectionInstructions.push(Oy)),+ void 0 !== n.strokeStyle && (this.instructions.push(Dy), this.hitDetectionInstructions.push(Dy)),+ this.endGeometry(e)+ }+ drawPolygon(t, e, i) {+ const n = this.state,+ r = n.fillStyle,+ s = n.strokeStyle,+ o = n.strokeOffset+ if (void 0 === r && void 0 === s) return+ if (this.handleStrokeOffset_(() => this.drawPolygon(t, e, i))) return+ this.setFillStrokeStyles_(),+ this.beginGeometry(t, e, i),+ void 0 !== n.fillStyle && this.hitDetectionInstructions.push([Ly, Oh]),+ void 0 !== n.strokeStyle &&+ this.hitDetectionInstructions.push([+ My,+ n.strokeStyle,+ n.lineWidth,+ n.lineCap,+ n.lineJoin,+ n.miterLimit,+ Nh,+ 0+ ])+ const a = t.getEnds(),+ l = t.getOrientedFlatCoordinates(),+ h = t.getStride()+ this.drawFlatCoordinatess_(l, 0, a, h, o), this.endGeometry(e)+ }+ drawMultiPolygon(t, e, i) {+ const n = this.state,+ r = n.fillStyle,+ s = n.strokeStyle,+ o = n.strokeOffset+ if (void 0 === r && void 0 === s) return+ if (this.handleStrokeOffset_(() => this.drawMultiPolygon(t, e, i))) return+ this.setFillStrokeStyles_(),+ this.beginGeometry(t, e, i),+ void 0 !== n.fillStyle && this.hitDetectionInstructions.push([Ly, Oh]),+ void 0 !== n.strokeStyle &&+ this.hitDetectionInstructions.push([+ My,+ n.strokeStyle,+ n.lineWidth,+ n.lineCap,+ n.lineJoin,+ n.miterLimit,+ Nh,+ 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] = Br(e[i], t)+ }+ return super.finish()+ }+ setFillStrokeStyles_() {+ const t = this.state+ this.updateFillStyle(t, this.createFill), this.updateStrokeStyle(t, this.applyStroke)+ }+ handleStrokeOffset_(t) {+ const e = this.state,+ i = e.fillStyle,+ n = e.strokeStyle,+ r = e.strokeOffset+ return (+ Math.abs(r) > 0 &&+ void 0 !== i &&+ void 0 !== n &&+ ((e.strokeStyle = void 0),+ (e.strokeOffset = 0),+ t(),+ (e.fillStyle = void 0),+ (e.strokeStyle = n),+ (e.strokeOffset = r),+ t(),+ (e.fillStyle = i),+ !0)+ )+ }+ }+ function zy(t, e, i, n, r) {+ const s = []+ let o = i,+ a = 0,+ l = e.slice(i, 2)+ for (; a < t && o + r < n; ) {+ const [i, n] = l.slice(-2),+ h = e[o + r],+ c = e[o + r + 1],+ u = Math.sqrt((h - i) * (h - i) + (c - n) * (c - n))+ if (((a += u), a >= t)) {+ const e = (t - a + u) / u,+ d = Ne(i, h, e),+ g = Ne(n, c, e)+ l.push(d, g), s.push(l), (l = [d, g]), a == t && (o += r), (a = 0)+ } else if (a < t) l.push(e[o + r], e[o + r + 1]), (o += r)+ else {+ const t = u - a,+ e = Ne(i, h, t / u),+ d = Ne(n, c, t / u)+ l.push(e, d), s.push(l), (l = [e, d]), (a = 0), (o += r)+ }+ }+ return a > 0 && s.push(l), s+ }+ function Xy(t, e, i, n, r) {+ let s,+ o,+ a,+ l,+ h,+ c,+ u,+ d,+ g,+ f,+ p = i,+ _ = i,+ m = 0,+ y = 0,+ x = i+ for (o = i; o < n; o += r) {+ const i = e[o],+ n = e[o + 1]+ void 0 !== h &&+ ((g = i - h),+ (f = n - c),+ (l = Math.sqrt(g * g + f * f)),+ void 0 !== u &&+ ((y += a),+ (s = Math.acos((u * g + d * f) / (a * l))),+ s > t && (y > m && ((m = y), (p = x), (_ = o)), (y = 0), (x = o - r))),+ (a = l),+ (u = g),+ (d = f)),+ (h = i),+ (c = n)+ }+ return (y += l), y > m ? [x, o] : [p, _]+ }+ const Vy = {+ left: 0,+ center: 0.5,+ right: 1,+ top: 0,+ middle: 0.5,+ hanging: 0.2,+ alphabetic: 0.8,+ ideographic: 0.8,+ bottom: 1+ }+ class $y extends Gy {+ 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[Oh] = { fillStyle: Oh }),+ (this.textStrokeState_ = null),+ (this.strokeStates = {}),+ (this.textState_ = {}),+ (this.textStates = {}),+ (this.textKey_ = ""),+ (this.fillKey_ = ""),+ (this.strokeKey_ = ""),+ (this.declutterMode_ = void 0),+ (this.declutterImageWithText_ = void 0)+ }+ finish() {+ const t = super.finish()+ return (t.textStates = this.textStates), (t.fillStates = this.fillStates), (t.strokeStates = this.strokeStates), t+ }+ drawText(t, e, i) {+ const n = this.textFillState_,+ r = this.textStrokeState_,+ s = this.textState_+ if ("" === this.text_ || !s || (!n && !r)) return+ const o = this.coordinates+ let a = o.length+ const l = t.getType()+ let h = null,+ c = t.getStride()+ if (+ "line" !== s.placement ||+ ("LineString" != l && "MultiLineString" != l && "Polygon" != l && "MultiPolygon" != l)+ ) {+ let n = s.overflow ? null : []+ switch (l) {+ case "Point":+ case "MultiPoint":+ h = t.getFlatCoordinates()+ break+ case "LineString":+ h = t.getFlatMidpoint()+ break+ case "Circle":+ h = t.getCenter()+ break+ case "MultiLineString":+ ;(h = t.getFlatMidpoints()), (c = 2)+ break+ case "Polygon":+ ;(h = t.getFlatInteriorPoint()), s.overflow || 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)+ s.overflow || n.push(e[t + 2] / this.resolution), h.push(e[t], e[t + 1])+ if (0 === h.length) return+ c = 2+ }+ const r = this.appendFlatPointCoordinates(h, c)+ if (r === a) return+ if (n && (r - a) / 2 != h.length / c) {+ let t = a / 2+ n = n.filter((e, i) => {+ const n = o[2 * (t + i)] === h[i * c] && o[2 * (t + i) + 1] === h[i * c + 1]+ return n || --t, n+ })+ }+ this.saveTextStates_()+ const u = s.backgroundFill ? this.createFill(this.fillStyleToState(s.backgroundFill)) : null,+ d = s.backgroundStroke ? this.createStroke(this.strokeStyleToState(s.backgroundStroke)) : null+ this.beginGeometry(t, e, i)+ let g = s.padding+ if (g != zh && (s.scale[0] < 0 || s.scale[1] < 0)) {+ let t = s.padding[0],+ e = s.padding[1],+ i = s.padding[2],+ n = s.padding[3]+ s.scale[0] < 0 && ((e = -e), (n = -n)), s.scale[1] < 0 && ((t = -t), (i = -i)), (g = [t, e, i, n])+ }+ const f = this.pixelRatio+ this.instructions.push([+ Ry,+ a,+ r,+ null,+ NaN,+ NaN,+ NaN,+ 1,+ 0,+ 0,+ this.textRotateWithView_,+ this.textRotation_,+ [1, 1],+ NaN,+ this.declutterMode_,+ this.declutterImageWithText_,+ g == zh+ ? zh+ : g.map(function (t) {+ return t * f+ }),+ u,+ d,+ this.text_,+ this.textKey_,+ this.strokeKey_,+ this.fillKey_,+ this.textOffsetX_,+ this.textOffsetY_,+ n+ ])+ const p = 1 / f,+ _ = u ? u.slice(0) : null+ _ && (_[1] = Oh),+ this.hitDetectionInstructions.push([+ Ry,+ a,+ r,+ null,+ NaN,+ NaN,+ NaN,+ 1,+ 0,+ 0,+ this.textRotateWithView_,+ this.textRotation_,+ [p, p],+ NaN,+ this.declutterMode_,+ this.declutterImageWithText_,+ g,+ _,+ d,+ this.text_,+ this.textKey_,+ this.strokeKey_,+ this.fillKey_ ? Oh : this.fillKey_,+ this.textOffsetX_,+ this.textOffsetY_,+ n+ ]),+ this.endGeometry(e)+ } else {+ if (!Se(this.maxExtent, t.getExtent())) return+ let n+ if (((h = t.getFlatCoordinates()), "LineString" == l)) n = [h.length]+ else if ("MultiLineString" == l) n = t.getEnds()+ else if ("Polygon" == l) n = t.getEnds().slice(0, 1)+ else if ("MultiPolygon" == l) {+ const e = t.getEndss()+ n = []+ for (let t = 0, i = e.length; t < i; ++t) n.push(e[t][0])+ }+ this.beginGeometry(t, e, i)+ const r = s.repeat,+ u = r ? void 0 : s.textAlign+ let d = 0+ for (let t = 0, e = n.length; t < e; ++t) {+ let e+ e = r ? zy(r * this.resolution, h, d, n[t], c) : [h.slice(d, n[t])]+ for (let i = 0, r = e.length; i < r; ++i) {+ const r = e[i]+ let l = 0,+ h = r.length+ if (null == u) {+ const t = Xy(s.maxAngle, r, 0, r.length, 2)+ ;(l = t[0]), (h = t[1])+ }+ for (let t = l; t < h; t += c) o.push(r[t], r[t + 1])+ const g = o.length+ ;(d = n[t]), this.drawChars_(a, g), (a = g)+ }+ }+ this.endGeometry(e)+ }+ }+ saveTextStates_() {+ const t = this.textStrokeState_,+ e = this.textState_,+ i = this.textFillState_,+ n = this.strokeKey_+ t &&+ (n in this.strokeStates ||+ (this.strokeStates[n] = {+ strokeStyle: t.strokeStyle,+ lineCap: t.lineCap,+ lineDashOffset: t.lineDashOffset,+ lineWidth: t.lineWidth,+ lineJoin: t.lineJoin,+ miterLimit: t.miterLimit,+ lineDash: t.lineDash+ }))+ const r = this.textKey_+ r in this.textStates ||+ (this.textStates[r] = {+ font: e.font,+ textAlign: e.textAlign || Uh,+ justify: e.justify,+ textBaseline: e.textBaseline || Bh,+ scale: e.scale+ })+ const s = this.fillKey_+ i && (s in this.fillStates || (this.fillStates[s] = { fillStyle: i.fillStyle }))+ }+ drawChars_(t, e) {+ const i = this.textStrokeState_,+ n = this.textState_,+ r = this.strokeKey_,+ s = this.textKey_,+ o = this.fillKey_+ this.saveTextStates_()+ const a = this.pixelRatio,+ l = Vy[n.textBaseline],+ h = this.textOffsetY_ * a,+ c = this.text_,+ u = i ? (i.lineWidth * Math.abs(n.scale[0])) / 2 : 0+ this.instructions.push([+ by,+ t,+ e,+ l,+ n.overflow,+ o,+ n.maxAngle,+ a,+ h,+ r,+ u * a,+ c,+ s,+ 1,+ this.declutterMode_,+ this.textKeepUpright_+ ]),+ this.hitDetectionInstructions.push([+ by,+ t,+ e,+ l,+ n.overflow,+ o ? Oh : o,+ n.maxAngle,+ a,+ h,+ r,+ u * a,+ c,+ s,+ 1 / a,+ this.declutterMode_,+ this.textKeepUpright_+ ])+ }+ setTextStyle(t, e) {+ let i, n, r+ if (t) {+ const e = t.getFill()+ e+ ? ((n = this.textFillState_),+ n || ((n = {}), (this.textFillState_ = n)),+ (n.fillStyle = Mh(e.getColor() || Oh)))+ : ((n = null), (this.textFillState_ = n))+ const s = t.getStroke()+ if (s) {+ ;(r = this.textStrokeState_), r || ((r = {}), (this.textStrokeState_ = r))+ const t = s.getLineDash(),+ e = s.getLineDashOffset(),+ i = s.getWidth(),+ n = s.getMiterLimit()+ ;(r.lineCap = s.getLineCap() || Dh),+ (r.lineDash = t ? t.slice() : Nh),+ (r.lineDashOffset = void 0 === e ? 0 : e),+ (r.lineJoin = s.getLineJoin() || kh),+ (r.lineWidth = void 0 === i ? 1 : i),+ (r.miterLimit = void 0 === n ? Gh : n),+ (r.strokeStyle = Mh(s.getColor() || jh))+ } else (r = null), (this.textStrokeState_ = r)+ i = this.textState_+ const o = t.getFont() || Ah+ Hh(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() || Bh),+ (i.backgroundFill = t.getBackgroundFill()),+ (i.backgroundStroke = t.getBackgroundStroke()),+ (i.padding = t.getPadding() || zh),+ (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_ = r+ ? ("string" == typeof r.strokeStyle ? r.strokeStyle : z(r.strokeStyle)) ++ r.lineCap ++ r.lineDashOffset ++ "|" ++ r.lineWidth ++ r.lineJoin ++ r.miterLimit ++ "[" ++ r.lineDash.join() ++ "]"+ : ""),+ (this.textKey_ =+ i.font + i.scale + (i.textAlign || "?") + (i.repeat || "?") + (i.justify || "?") + (i.textBaseline || "?")),+ (this.fillKey_ =+ n && n.fillStyle ? ("string" == typeof n.fillStyle ? n.fillStyle : "|" + z(n.fillStyle)) : "")+ } else this.text_ = ""+ ;(this.declutterMode_ = t.getDeclutterMode()), (this.declutterImageWithText_ = e)+ }+ }+ const Wy = { Circle: By, Default: Gy, Image: jy, LineString: Uy, Polygon: By, Text: $y }+ class Zy {+ constructor(t, e, i, n) {+ ;(this.tolerance_ = t),+ (this.maxExtent_ = e),+ (this.pixelRatio_ = n),+ (this.resolution_ = i),+ (this.buildersByZIndex_ = {})+ }+ finish() {+ const t = {}+ for (const e in this.buildersByZIndex_) {+ t[e] = t[e] || {}+ const i = this.buildersByZIndex_[e]+ for (const n in i) {+ const r = i[n].finish()+ t[e][n] = r+ }+ }+ return t+ }+ getBuilder(t, e) {+ const i = void 0 !== t ? t.toString() : "0"+ let n = this.buildersByZIndex_[i]+ void 0 === n && ((n = {}), (this.buildersByZIndex_[i] = n))+ let r = n[e]+ if (void 0 === r) {+ ;(r = new (0, Wy[e])(this.tolerance_, this.maxExtent_, this.resolution_, this.pixelRatio_)), (n[e] = r)+ }+ return r+ }+ }+ function Yy(t, e, i, n, r, s, o, a, l, h, c, u, d = !0) {+ let g = t[e],+ f = t[e + 1],+ p = 0,+ _ = 0,+ m = 0,+ y = 0+ function x() {+ ;(p = g),+ (_ = f),+ (g = t[(e += n)]),+ (f = t[e + 1]),+ (y += m),+ (m = Math.sqrt((g - p) * (g - p) + (f - _) * (f - _)))+ }+ do {+ x()+ } while (e < i - n && y + m < s)+ let v = 0 === m ? 0 : (s - y) / m+ const S = Ne(p, g, v),+ E = Ne(_, f, v),+ w = e - n,+ T = y,+ C = s + a * l(h, r, c)+ for (; e < i - n && y + m < C; ) x()+ v = 0 === m ? 0 : (C - y) / m+ const b = Ne(p, g, v),+ R = Ne(_, f, v)+ let P = !1+ if (d)+ if (u) {+ const t = [S, E, b, R]+ ur(t, 0, 4, 2, u, t, t), (P = t[0] > t[2])+ } else P = S > b+ const I = Math.PI,+ F = [],+ L = w + n === e+ let M+ if (((m = 0), (y = T), (g = t[(e = w)]), (f = t[e + 1]), L)) {+ x(), (M = Math.atan2(f - _, g - p)), P && (M += M > 0 ? -I : I)+ const t = (b + S) / 2,+ e = (R + E) / 2+ return (F[0] = [t, e, (C - s) / 2, M, r]), F+ }+ for (let t = 0, u = (r = r.replace(/\n/g, " ")).length; t < u; ) {+ x()+ let d = Math.atan2(f - _, g - p)+ if ((P && (d += d > 0 ? -I : I), void 0 !== M)) {+ let t = d - M+ if (((t += t > I ? -2 * I : t < -I ? 2 * I : 0), Math.abs(t) > o)) return null+ }+ M = d+ const S = t+ let E = 0+ for (; t < u; ++t) {+ const o = a * l(h, r[P ? u - t - 1 : t], c)+ if (e + n < i && y + m < s + E + o / 2) break+ E += o+ }+ if (t === S) continue+ const w = P ? r.substring(u - S, u - t) : r.substring(S, t)+ v = 0 === m ? 0 : (s + E / 2 - y) / m+ const T = Ne(p, g, v),+ C = Ne(_, f, v)+ F.push([T, C, E / 2, d, w]), (s += E)+ }+ return F+ }+ const Hy = [1 / 0, 1 / 0, -1 / 0, -1 / 0],+ Ky = [],+ qy = [],+ Jy = [],+ Qy = []+ function tx(t) {+ return t[3].declutterBox+ }+ const ex = 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 ix(t, e) {+ return (+ "start" === e ? (e = ex.test(t) ? "right" : "left") : "end" === e && (e = ex.test(t) ? "left" : "right"), Vy[e]+ )+ }+ function nx(t, e, i) {+ return i > 0 && t.push("\n", ""), t.push(e, ""), t+ }+ function rx(t, e, i) {+ return i % 2 == 0 && (t += e), t+ }+ class sx {+ constructor(t, e, i, n, r) {+ ;(this.overlaps = i),+ (this.pixelRatio = e),+ (this.resolution = t),+ this.alignAndScaleFill_,+ (this.instructions = n.instructions),+ (this.coordinates = n.coordinates),+ (this.coordinateCache_ = {}),+ (this.renderedTransform_ = [1, 0, 0, 1, 0, 0]),+ (this.hitDetectionInstructions = n.hitDetectionInstructions),+ (this.pixelCoordinates_ = null),+ (this.viewRotation_ = 0),+ (this.fillStates = n.fillStates || {}),+ (this.strokeStates = n.strokeStates || {}),+ (this.textStates = n.textStates || {}),+ (this.widths_ = {}),+ (this.labels_ = {}),+ (this.zIndexContext_ = r ? new Sf() : null)+ }+ getZIndexContext() {+ return this.zIndexContext_+ }+ createLabel(t, e, i, n) {+ const r = t + e + i + n+ if (this.labels_[r]) return this.labels_[r]+ const s = n ? this.strokeStates[n] : null,+ o = i ? this.fillStates[i] : null,+ a = this.textStates[e],+ l = this.pixelRatio,+ h = [a.scale[0] * l, a.scale[1] * l],+ c = a.justify ? Vy[a.justify] : ix(Array.isArray(t) ? t[0] : t, a.textAlign || Uh),+ u = n && s.lineWidth ? s.lineWidth : 0,+ d = Array.isArray(t) ? t : String(t).split("\n").reduce(nx, []),+ { width: g, height: f, widths: p, heights: _, lineWidths: m } = tc(a, d),+ y = g + u,+ x = [],+ v = (y + 2) * h[0],+ S = (f + u) * h[1],+ E = {+ width: v < 0 ? Math.floor(v) : Math.ceil(v),+ height: S < 0 ? Math.floor(S) : Math.ceil(S),+ contextInstructions: x+ }+ ;(1 == h[0] && 1 == h[1]) || x.push("scale", h),+ n &&+ (x.push("strokeStyle", s.strokeStyle),+ x.push("lineWidth", u),+ x.push("lineCap", s.lineCap),+ x.push("lineJoin", s.lineJoin),+ x.push("miterLimit", s.miterLimit),+ x.push("setLineDash", [s.lineDash]),+ x.push("lineDashOffset", s.lineDashOffset)),+ i && x.push("fillStyle", o.fillStyle),+ x.push("textBaseline", "middle"),+ x.push("textAlign", "center")+ const w = 0.5 - c+ let T = c * y + w * u+ const C = [],+ b = []+ let R,+ P = 0,+ I = 0,+ F = 0,+ L = 0+ for (let t = 0, e = d.length; t < e; t += 2) {+ const e = d[t]+ if ("\n" === e) {+ ;(I += P), (P = 0), (T = c * y + w * u), ++L+ continue+ }+ const r = d[t + 1] || a.font+ r !== R && (n && C.push("font", r), i && b.push("font", r), (R = r)), (P = Math.max(P, _[F]))+ const s = [e, T + w * p[F] + c * (p[F] - m[L]), 0.5 * (u + P) + I]+ ;(T += p[F]), n && C.push("strokeText", s), i && b.push("fillText", s), ++F+ }+ return Array.prototype.push.apply(x, C), Array.prototype.push.apply(x, b), (this.labels_[r] = E), E+ }+ replayTextBackground_(t, e, i, n, r, s, o) {+ t.beginPath(),+ t.moveTo.apply(t, e),+ t.lineTo.apply(t, i),+ t.lineTo.apply(t, n),+ t.lineTo.apply(t, r),+ t.lineTo.apply(t, e),+ s && ((this.alignAndScaleFill_ = s[2]), (t.fillStyle = s[1]), this.fill_(t)),+ o && (this.setStrokeStyle_(t, o), t.stroke())+ }+ calculateImageOrLabelDimensions_(t, e, i, n, r, s, o, a, l, h, c, u, d, g, f, p) {+ let _ = i - (o *= u[0]),+ m = n - (a *= u[1])+ const y = r + l > t ? t - l : r,+ x = s + h > e ? e - h : s,+ v = g[3] + y * u[0] + g[1],+ S = g[0] + x * u[1] + g[2],+ E = _ - g[3],+ w = m - g[0]+ let T+ return (+ (f || 0 !== c) &&+ ((Ky[0] = E),+ (Qy[0] = E),+ (Ky[1] = w),+ (qy[1] = w),+ (qy[0] = E + v),+ (Jy[0] = qy[0]),+ (Jy[1] = w + S),+ (Qy[1] = Jy[1])),+ 0 !== c+ ? ((T = nr([1, 0, 0, 1, 0, 0], i, n, 1, 1, c, -i, -n)),+ Qn(T, Ky),+ Qn(T, qy),+ Qn(T, Jy),+ Qn(T, Qy),+ Kt(+ Math.min(Ky[0], qy[0], Jy[0], Qy[0]),+ Math.min(Ky[1], qy[1], Jy[1], Qy[1]),+ Math.max(Ky[0], qy[0], Jy[0], Qy[0]),+ Math.max(Ky[1], qy[1], Jy[1], Qy[1]),+ Hy+ ))+ : Kt(Math.min(E, E + v), Math.min(w, w + S), Math.max(E, E + v), Math.max(w, w + S), Hy),+ d && ((_ = Math.round(_)), (m = Math.round(m))),+ {+ drawImageX: _,+ drawImageY: m,+ drawImageW: y,+ drawImageH: x,+ originX: l,+ originY: h,+ declutterBox: { minX: Hy[0], minY: Hy[1], maxX: Hy[2], maxY: Hy[3], value: p },+ canvasTransform: T,+ scale: u+ }+ )+ }+ replayImageOrLabel_(t, e, i, n, r, s, o) {+ const a = !(!s && !o),+ l = n.declutterBox,+ h = o ? (o[2] * n.scale[0]) / 2 : 0+ return (+ l.minX - h <= e[0] &&+ l.maxX + h >= 0 &&+ l.minY - h <= e[1] &&+ l.maxY + h >= 0 &&+ (a && this.replayTextBackground_(t, Ky, qy, Jy, Qy, s, o),+ ec(+ t,+ n.canvasTransform,+ r,+ i,+ n.originX,+ n.originY,+ n.drawImageW,+ n.drawImageH,+ n.drawImageX,+ n.drawImageY,+ n.scale+ )),+ !0+ )+ }+ fill_(t) {+ const e = this.alignAndScaleFill_+ if (e) {+ const i = Qn(this.renderedTransform_, [0, 0]),+ n = 512 * this.pixelRatio+ t.save(), t.translate(i[0] % n, i[1] % n), 1 !== e && t.scale(e, e)+ }+ t.fill(), e && t.restore()+ }+ setStrokeStyle_(t, e) {+ ;(t.strokeStyle = e[1]),+ e[1] &&+ ((t.lineWidth = e[2]),+ (t.lineCap = e[3]),+ (t.lineJoin = e[4]),+ (t.miterLimit = e[5]),+ (t.lineDashOffset = e[7]),+ t.setLineDash(e[6]))+ }+ drawLabelWithPointPlacement_(t, e, i, n) {+ const r = this.textStates[e],+ s = this.createLabel(t, e, n, i),+ o = this.strokeStates[i],+ a = this.pixelRatio,+ l = ix(Array.isArray(t) ? t[0] : t, r.textAlign || Uh),+ h = Vy[r.textBaseline || Bh],+ c = o && o.lineWidth ? o.lineWidth : 0+ return {+ label: s,+ anchorX: l * (s.width / a - 2 * r.scale[0]) + 2 * (0.5 - l) * c,+ anchorY: (h * s.height) / a + 2 * (0.5 - h) * c+ }+ }+ execute_(t, e, i, n, r, s, o, a) {+ const l = this.zIndexContext_+ let h+ this.pixelCoordinates_ && w(i, this.renderedTransform_)+ ? (h = this.pixelCoordinates_)+ : (this.pixelCoordinates_ || (this.pixelCoordinates_ = []),+ (h = cr(this.coordinates, 0, this.coordinates.length, 2, i, this.pixelCoordinates_)),+ Jn(this.renderedTransform_, i))+ let c = 0+ const u = n.length+ let d,+ g,+ f,+ p,+ _,+ m,+ y,+ x,+ v,+ S,+ E,+ T,+ C,+ b,+ R,+ P,+ I = 0,+ F = 0,+ L = 0+ const M = 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 },+ N = this.instructions != n || this.overlaps ? 0 : 200+ let k, G, j, U+ for (; c < u; ) {+ const i = n[c]+ switch (i[0]) {+ case Sy:+ ;(k = i[1]),+ (U = i[3]),+ k.getGeometry() ? (void 0 === o || Se(o, U.getExtent()) ? ++c : (c = i[2] + 1)) : (c = i[2]),+ l && (l.zIndex = i[4])+ break+ case Ey:+ F > N && (this.fill_(t), (F = 0)),+ L > N && (t.stroke(), (L = 0)),+ F || L || (t.beginPath(), (x = NaN), (v = NaN)),+ ++c+ break+ case wy:+ ;(I = i[1]), (p = i[2] ?? 0)+ const n = h[I],+ u = h[I + 1],+ w = h[I + 2] - p - n,+ B = h[I + 3] - p - u,+ z = Math.sqrt(w * w + B * B)+ t.moveTo(n + z, u), t.arc(n, u, z, 0, 2 * Math.PI, !0), ++c+ break+ case Ty:+ t.closePath(), ++c+ break+ case Cy:+ ;(I = i[1]), (d = i[2])+ const X = i[3],+ V = i[4],+ $ = i[5]+ ;(D.geometry = X), (D.feature = k), c in M || (M[c] = [])+ const W = M[c]+ $ ? $(h, I, d, 2, W) : ((W[0] = h[I]), (W[1] = h[I + 1]), (W.length = 2)),+ l && (l.zIndex = i[6]),+ V(W, D),+ ++c+ break+ case Ry:+ ;(I = i[1]), (d = i[2]), (T = i[3]), (g = i[4]), (f = i[5])+ let Z = i[6]+ const Y = i[7],+ H = i[8],+ K = i[9],+ q = i[10]+ let J = i[11]+ const Q = i[12]+ let tt = i[13]+ y = i[14] || "declutter"+ const et = i[15]+ if (!T && i.length >= 20) {+ ;(C = i[19]), (b = i[20]), (R = i[21]), (P = i[22])+ const t = this.drawLabelWithPointPlacement_(C, b, R, P)+ ;(T = t.label), (i[3] = T)+ const e = i[23]+ ;(g = (t.anchorX - e) * this.pixelRatio), (i[4] = g)+ const n = i[24]+ ;(f = (t.anchorY - n) * this.pixelRatio),+ (i[5] = f),+ (Z = T.height),+ (i[6] = Z),+ (tt = T.width),+ (i[13] = tt)+ }+ let it, nt, rt, st+ i.length > 25 && (it = i[25]),+ i.length > 17 ? ((nt = i[16]), (rt = i[17]), (st = i[18])) : ((nt = zh), (rt = null), (st = null)),+ q && O ? (J += A) : q || O || (J -= A)+ let ot = 0+ for (; I < d; I += 2) {+ if (it && it[ot++] < tt / this.pixelRatio) continue+ const i = this.calculateImageOrLabelDimensions_(+ T.width,+ T.height,+ h[I],+ h[I + 1],+ tt,+ Z,+ g,+ f,+ H,+ K,+ J,+ Q,+ r,+ nt,+ !!rt || !!st,+ k+ ),+ n = [t, e, T, i, Y, rt, st]+ if (a) {+ let t, e, r, s, o+ if (et) {+ const i = d - I+ if (!et[i]) {+ et[i] = { args: n, declutterMode: y }+ continue+ }+ const s = et[i]+ ;(t = s.args), (e = s.declutterMode), delete et[i], (r = tx(t))+ }+ if (+ (!t || ("declutter" === e && a.collides(r)) || (s = !0),+ ("declutter" === y && a.collides(i.declutterBox)) || (o = !0),+ "declutter" === e && "declutter" === y)+ ) {+ const t = s && o+ ;(s = t), (o = t)+ }+ s && ("none" !== e && a.insert(r), this.replayImageOrLabel_.apply(this, t)),+ o && ("none" !== y && a.insert(i.declutterBox), this.replayImageOrLabel_.apply(this, n))+ } else this.replayImageOrLabel_.apply(this, n)+ }+ ++c+ break+ case by:+ const at = i[1],+ lt = i[2],+ ht = i[3],+ ct = i[4]+ P = i[5]+ const ut = i[6],+ dt = i[7],+ gt = i[8]+ R = i[9]+ const ft = i[10]+ ;(C = i[11]), Array.isArray(C) && (C = C.reduce(rx, "")), (b = i[12])+ const pt = [i[13], i[13]]+ y = i[14] || "declutter"+ const _t = i[15],+ mt = this.textStates[b],+ yt = mt.font,+ xt = [mt.scale[0] * dt, mt.scale[1] * dt]+ let vt+ yt in this.widths_ ? (vt = this.widths_[yt]) : ((vt = {}), (this.widths_[yt] = vt))+ const St = Od(h, at, lt, 2),+ Et = Math.abs(xt[0]) * Qh(yt, C, vt)+ if (ct || Et <= St) {+ const i = Yy(+ h,+ at,+ lt,+ 2,+ C,+ (St - Et) * ix(C, this.textStates[b].textAlign),+ ut,+ Math.abs(xt[0]),+ Qh,+ yt,+ vt,+ O ? 0 : this.viewRotation_,+ _t+ )+ t: if (i) {+ const n = []+ let r, s, o, l, h+ if (R)+ for (r = 0, s = i.length; r < s; ++r) {+ ;(h = i[r]),+ (o = h[4]),+ (l = this.createLabel(o, b, "", R)),+ (g = h[2] + (xt[0] < 0 ? -ft : ft)),+ (f = ht * l.height + (2 * (0.5 - ht) * ft * xt[1]) / xt[0] - gt)+ const s = this.calculateImageOrLabelDimensions_(+ l.width,+ l.height,+ h[0],+ h[1],+ l.width,+ l.height,+ g,+ f,+ 0,+ 0,+ h[3],+ pt,+ !1,+ zh,+ !1,+ k+ )+ if (a && "declutter" === y && a.collides(s.declutterBox)) break t+ n.push([t, e, l, s, 1, null, null])+ }+ if (P)+ for (r = 0, s = i.length; r < s; ++r) {+ ;(h = i[r]), (o = h[4]), (l = this.createLabel(o, b, P, "")), (g = h[2]), (f = ht * l.height - gt)+ const s = this.calculateImageOrLabelDimensions_(+ l.width,+ l.height,+ h[0],+ h[1],+ l.width,+ l.height,+ g,+ f,+ 0,+ 0,+ h[3],+ pt,+ !1,+ zh,+ !1,+ k+ )+ if (a && "declutter" === y && a.collides(s.declutterBox)) break t+ n.push([t, e, l, s, 1, null, null])+ }+ a && "none" !== y && a.load(n.map(tx))+ for (let t = 0, e = n.length; t < e; ++t) this.replayImageOrLabel_.apply(this, n[t])+ }+ }+ ++c+ break+ case Py:+ if (void 0 !== s) {+ k = i[1]+ const t = s(k, U, y)+ if (t) return t+ }+ ++c+ break+ case Iy:+ N ? F++ : this.fill_(t), ++c+ break+ case Fy:+ for (+ I = i[1],+ d = i[2],+ p = i[3],+ _ = i[4] ?? !1,+ G = h[I],+ j = h[I + 1],+ p &&+ ((m = I), ([G, j] = mu(G, j, _ ? h[d - 4] : void 0, _ ? h[d - 3] : void 0, h[I + 2], h[I + 3], p))),+ t.moveTo(G, j),+ x = (G + 0.5) | 0,+ v = (j + 0.5) | 0,+ I += 2;+ I < d;+ I += 2+ )+ (G = h[I]),+ (j = h[I + 1]),+ (S = (G + 0.5) | 0),+ (E = (j + 0.5) | 0),+ (I != d - 2 && S === x && E === v) ||+ (p &&+ ([G, j] =+ I == d - 2+ ? mu(G, j, h[I - 2], h[I - 1], _ ? h[m + 2] : void 0, _ ? h[m + 3] : void 0, p)+ : mu(G, j, h[I - 2], h[I - 1], h[I + 2], h[I + 3], p)),+ t.lineTo(G, j),+ (x = S),+ (v = E))+ ++c+ break+ case Ly:+ ;(this.alignAndScaleFill_ = i[2]),+ F && (this.fill_(t), (F = 0), L && (t.stroke(), (L = 0))),+ (t.fillStyle = i[1]),+ ++c+ break+ case My:+ L && (t.stroke(), (L = 0)), this.setStrokeStyle_(t, i), ++c+ break+ case Ay:+ N ? L++ : t.stroke(), ++c+ break+ default:+ ++c+ }+ }+ F && this.fill_(t), L && t.stroke()+ }+ execute(t, e, i, n, r, s) {+ ;(this.viewRotation_ = n), this.execute_(t, e, i, this.instructions, r, void 0, void 0, s)+ }+ executeHitDetection(t, e, i, n, r) {+ return (+ (this.viewRotation_ = i),+ this.execute_(t, [t.canvas.width, t.canvas.height], e, this.hitDetectionInstructions, !0, n, r)+ )+ }+ }+ const ox = ["Polygon", "Circle", "LineString", "Image", "Text", "Default"],+ ax = ["Image", "Text"],+ lx = ox.filter((t) => !ax.includes(t))+ let hx = !1,+ cx = !1+ class ux {+ constructor(t, e, i, n, r, s, o) {+ ;(this.maxExtent_ = t),+ (this.overlaps_ = n),+ (this.pixelRatio_ = i),+ (this.resolution_ = e),+ (this.renderBuffer_ = s),+ (this.executorsByZIndex_ = {}),+ (this.hitDetectionContext_ = null),+ (this.hitDetectionTransform_ = [1, 0, 0, 1, 0, 0]),+ (this.renderedContext_ = null),+ (this.deferredZIndexContexts_ = {}),+ this.createExecutors_(r, o)+ }+ clip(t, e) {+ const i = this.getClipCoords(e)+ t.beginPath(), t.moveTo(i[0], i[1]), t.lineTo(i[2], i[3]), t.lineTo(i[4], i[5]), t.lineTo(i[6], i[7]), t.clip()+ }+ createExecutors_(t, e) {+ for (const i in t) {+ let n = this.executorsByZIndex_[i]+ void 0 === n && ((n = {}), (this.executorsByZIndex_[i] = n))+ const r = t[i]+ for (const t in r) {+ const i = r[t]+ n[t] = new sx(this.resolution_, this.pixelRatio_, this.overlaps_, i, e)+ }+ }+ }+ hasExecutors(t) {+ for (const e in this.executorsByZIndex_) {+ const i = this.executorsByZIndex_[e]+ for (let e = 0, n = t.length; e < n; ++e) if (t[e] in i) return !0+ }+ return !1+ }+ forEachFeatureAtCoordinate(t, e, i, n, r, s) {+ !1 === cx &&+ (function () {+ let t = 0+ const e = (e) => {+ const i = ft(1, 1, null, { willReadFrequently: e })+ let n = 0+ const r = performance.now()+ for (; performance.now() - r < 50; ++n)+ (i.fillStyle = `rgba(255,0,${n % 256},1)`), i.fillRect(0, 0, 1, 1), i.getImageData(0, 0, 1, 1)+ return (t = n > t ? n : t), n+ },+ i = { [e(!0)]: !0, [e(!1)]: !1, [e(void 0)]: void 0 }+ ;(hx = i[t]), (cx = !0)+ })()+ const o = 2 * (n = Math.round(n)) + 1,+ a = nr(this.hitDetectionTransform_, n + 0.5, n + 0.5, 1 / e, -1 / e, -i, -t[0], -t[1]),+ l = !this.hitDetectionContext_+ l && (this.hitDetectionContext_ = ft(o, o, null, { willReadFrequently: hx }))+ 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]), ne(c, t), zt(c, e * (this.renderBuffer_ + n), c))+ const u = gx(n)+ let d+ function g(t, e, i) {+ const a = h.getImageData(0, 0, o, o).data+ for (let l = 0, c = u.length; l < c; l++)+ if (a[u[l]] > 0) {+ if (!s || "none" === i || ("Image" !== d && "Text" !== d) || s.includes(t)) {+ const i = (u[l] - 3) / 4,+ s = n - (i % o),+ a = n - ((i / o) | 0),+ h = r(t, e, s * s + a * a)+ if (h) return h+ }+ h.clearRect(0, 0, o, o)+ break+ }+ }+ const f = Object.keys(this.executorsByZIndex_).map(Number)+ let p, _, m, x, v+ for (f.sort(y), p = f.length - 1; p >= 0; --p) {+ const t = f[p].toString()+ for (m = this.executorsByZIndex_[t], _ = ox.length - 1; _ >= 0; --_)+ if (((d = ox[_]), (x = m[d]), void 0 !== x && ((v = x.executeHitDetection(h, a, i, g, c)), v))) return v+ }+ }+ getClipCoords(t) {+ const e = this.maxExtent_+ if (!e) return null+ const i = e[0],+ n = e[1],+ r = e[2],+ s = e[3],+ o = [i, n, i, s, r, s, r, n]+ return cr(o, 0, 8, 2, t, o), o+ }+ isEmpty() {+ return L(this.executorsByZIndex_)+ }+ execute(t, e, i, n, r, s, o) {+ const a = Object.keys(this.executorsByZIndex_).map(Number)+ a.sort(o ? x : y), (s = s || ox)+ const l = ox.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 = s.length; c < d; ++c) {+ const d = s[c],+ g = u[d]+ if (void 0 !== g) {+ const s = null === o ? void 0 : g.getZIndexContext(),+ c = s ? s.getContext() : t,+ u = this.maxExtent_ && "Image" !== d && "Text" !== d+ if (+ (u && (c.save(), this.clip(c, i)),+ s && "Text" !== d && "Image" !== d+ ? s.pushFunction((t) => g.execute(t, e, i, n, r, o))+ : g.execute(c, e, i, n, r, o),+ u && c.restore(),+ s)+ ) {+ s.offset()+ const t = a[h] * l + ox.indexOf(d)+ this.deferredZIndexContexts_[t] || (this.deferredZIndexContexts_[t] = []),+ this.deferredZIndexContexts_[t].push(s)+ }+ }+ }+ }+ this.renderedContext_ = t+ }+ getDeferredZIndexContexts() {+ return this.deferredZIndexContexts_+ }+ getRenderedContext() {+ return this.renderedContext_+ }+ renderDeferred() {+ const t = this.deferredZIndexContexts_,+ e = Object.keys(t).map(Number).sort(y)+ 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 dx = {}+ function gx(t) {+ if (void 0 !== dx[t]) return dx[t]+ const e = 2 * t + 1,+ i = t * t,+ n = new Array(i + 1)+ for (let r = 0; r <= t; ++r)+ for (let s = 0; s <= t; ++s) {+ const o = r * r + s * s+ if (o > i) break+ let a = n[o]+ a || ((a = []), (n[o] = a)),+ a.push(4 * ((t + r) * e + (t + s)) + 3),+ r > 0 && a.push(4 * ((t - r) * e + (t + s)) + 3),+ s > 0 && (a.push(4 * ((t + r) * e + (t - s)) + 3), r > 0 && a.push(4 * ((t - r) * e + (t - s)) + 3))+ }+ const r = []+ for (let t = 0, e = n.length; t < e; ++t) n[t] && r.push(...n[t])+ return (dx[t] = r), r+ }+ const fx = 0.5+ function px(t, e, i, n, r, s, o, a, l) {+ const h = l ? Bn(r, l) : r,+ c = ft(t[0] * fx, t[1] * fx)+ c.imageSmoothingEnabled = !1+ const u = c.canvas,+ d = new xu(c, fx, r, null, o, a, l ? Ln(Gn(), l) : null),+ g = i.length,+ f = Math.floor(16777215 / g),+ p = {}+ for (let t = 1; t <= g; ++t) {+ const e = i[t - 1],+ r = e.getStyleFunction() || n+ if (!r) continue+ let o = r(e, s)+ if (!o) continue+ Array.isArray(o) || (o = [o])+ const a = (t * 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 || !Se(h, n.getExtent())) continue+ const r = i.clone(),+ s = r.getFill()+ s && s.setColor(a)+ const l = r.getStroke()+ l && (l.setColor(a), l.setLineDash(null)), r.setText(void 0)+ const c = i.getImage()+ if (c) {+ const t = c.getImageSize()+ if (!t) continue+ const e = ft(t[0], t[1], void 0, { alpha: !1 }),+ i = e.canvas+ ;(e.fillStyle = a),+ e.fillRect(0, 0, i.width, i.height),+ r.setImage(+ new ac({+ img: i,+ anchor: c.getAnchor(),+ anchorXUnits: "pixels",+ anchorYUnits: "pixels",+ offset: c.getOrigin(),+ opacity: 1,+ size: c.getSize(),+ scale: c.getScale(),+ rotation: c.getRotation(),+ rotateWithView: c.getRotateWithView()+ })+ )+ }+ const u = r.getZIndex() || 0+ let d = p[u]+ d || ((d = {}), (p[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, r)+ }+ } else d[g.replace("Multi", "")].push(n, r)+ }+ }+ const _ = Object.keys(p).map(Number).sort(y)+ for (let t = 0, i = _.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, r = e.length; i < r; ++i) d.setTransform(e[i]), d.drawGeometry(n[t])+ }+ }+ }+ return c.getImageData(0, 0, u.width, u.height)+ }+ function _x(t, e, i) {+ const n = []+ if (i) {+ const r = Math.floor(Math.round(t[0]) * fx),+ s = Math.floor(Math.round(t[1]) * fx),+ o = 4 * (Ie(r, 0, i.width - 1) + Ie(s, 0, i.height - 1) * i.width),+ a = i.data[o],+ l = i.data[o + 1],+ h = i.data[o + 2] + 256 * (l + 256 * a),+ c = Math.floor(16777215 / e.length)+ h && h % c == 0 && n.push(e[h / c - 1])+ }+ return n+ }+ class mx extends Cf {+ constructor(t) {+ super(t),+ (this.boundHandleStyleImageChange_ = this.handleStyleImageChange_.bind(this)),+ this.animatingOrInteracting_,+ (this.hitDetectionImageData_ = null),+ (this.clipExtent_ = null),+ (this.extendX_ = !1),+ (this.renderedFeatures_ = null),+ (this.renderedRevision_ = -1),+ (this.renderedResolution_ = NaN),+ (this.renderedExtent_ = [1 / 0, 1 / 0, -1 / 0, -1 / 0]),+ (this.wrappedRenderedExtent_ = [1 / 0, 1 / 0, -1 / 0, -1 / 0]),+ this.renderedRotation_,+ (this.renderedCenter_ = null),+ (this.renderedProjection_ = null),+ (this.renderedPixelRatio_ = 1),+ (this.renderedRenderOrder_ = null),+ this.renderedFrameDeclutter_,+ (this.replayGroup_ = null),+ (this.replayGroupChanged = !0),+ (this.clipping = !0),+ (this.targetContext_ = null),+ (this.opacity_ = 1)+ }+ renderWorlds(t, e, i) {+ const n = e.extent,+ r = e.viewState,+ s = r.center,+ o = r.resolution,+ a = r.projection,+ l = r.rotation,+ h = a.getExtent(),+ c = this.getLayer().getSource(),+ u = this.getLayer().getDeclutter(),+ d = e.pixelRatio,+ g = e.viewHints,+ f = !(g[co] || g[uo]),+ p = this.context,+ _ = Math.round((ve(n) / o) * d),+ m = Math.round((_e(n) / o) * d),+ y = c.getWrapX() && a.canWrapX(),+ x = y ? ve(h) : null,+ v = y ? Math.ceil((n[2] - h[2]) / x) + (this.extendX_ ? 2 : 1) : 1+ let S = y ? Math.floor((n[0] - h[0]) / x) - (this.extendX_ ? 1 : 0) : 0+ do {+ let n = this.getRenderTransform(s, o, 0, d, _, m, S * x)+ e.declutter && (n = n.slice(0)),+ t.execute(+ p,+ [p.canvas.width, p.canvas.height],+ n,+ l,+ f,+ void 0 === i ? ox : i ? ax : lx,+ i ? u && e.declutter[u] : void 0+ )+ } while (++S < v)+ }+ setDrawContext_() {+ 1 !== this.opacity_ &&+ ((this.targetContext_ = this.context),+ (this.context = ft(this.context.canvas.width, this.context.canvas.height, wf)))+ }+ 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),+ mt(this.context),+ wf.push(this.context.canvas),+ (this.context = this.targetContext_),+ (this.targetContext_ = null)+ }+ }+ renderDeclutter(t) {+ this.replayGroup_ && this.getLayer().getDeclutter() && this.renderWorlds(this.replayGroup_, t, !0)+ }+ renderDeferredInternal(t) {+ this.replayGroup_ &&+ (this.clipExtent_ && this.clipUnrotated(this.context, t, this.clipExtent_),+ this.replayGroup_.renderDeferred(),+ this.clipExtent_ && (this.context.restore(), (this.clipExtent_ = null)),+ this.resetDrawContext_())+ }+ renderFrame(t, e) {+ const i = t.layerStatesArray[t.layerIndex]+ this.opacity_ = i.opacity+ const n = t.viewState+ this.prepareContainer(t, e)+ const r = this.context,+ s = this.replayGroup_+ let o = s && !s.isEmpty()+ if (!o) {+ if (!(this.getLayer().hasListener(Ja) || this.getLayer().hasListener(Qa))) return this.container+ }+ this.setDrawContext_(), this.preRender(r, t)+ const a = n.projection+ this.clipExtent_ = null+ let l = !1+ if (o && i.extent && this.clipping) {+ const e = zn(i.extent, a)+ o = Se(e, t.extent)+ o && !Wt(e, t.extent) && (t.declutter ? (this.clipExtent_ = e) : (this.clipUnrotated(r, t, e), (l = !0)))+ }+ return (+ o && this.renderWorlds(s, t, !this.getLayer().getDeclutter() && void 0),+ l && r.restore(),+ this.postRender(r, t),+ this.renderedRotation_ !== n.rotation &&+ ((this.renderedRotation_ = n.rotation), (this.hitDetectionImageData_ = null)),+ t.declutter || this.resetDrawContext_(),+ this.container+ )+ }+ getFeatures(t) {+ return new Promise((e) => {+ if (this.frameState && !this.hitDetectionImageData_ && !this.animatingOrInteracting_) {+ const t = this.frameState.size.slice(),+ e = this.renderedCenter_,+ i = this.renderedResolution_,+ n = this.renderedRotation_,+ r = this.renderedProjection_,+ s = this.wrappedRenderedExtent_,+ o = this.getLayer(),+ a = [],+ l = t[0] * fx,+ h = t[1] * fx+ a.push(this.getRenderTransform(e, i, n, fx, l, h, 0).slice())+ const c = o.getSource(),+ u = r.getExtent()+ if (c.getWrapX() && r.canWrapX() && !Wt(u, s)) {+ let t = s[0]+ const r = ve(u)+ let o,+ c = 0+ for (; t < u[0]; ) --c, (o = r * c), a.push(this.getRenderTransform(e, i, n, fx, l, h, o).slice()), (t += r)+ for (c = 0, t = s[2]; t > u[2]; )+ ++c, (o = r * c), a.push(this.getRenderTransform(e, i, n, fx, l, h, o).slice()), (t -= r)+ }+ const d = Gn()+ this.hitDetectionImageData_ = px(+ t,+ a,+ this.renderedFeatures_,+ o.getStyleFunction(),+ s,+ i,+ n,+ Eu(i, this.renderedPixelRatio_),+ d ? r : null+ )+ }+ e(_x(t, this.renderedFeatures_, this.hitDetectionImageData_))+ })+ }+ forEachFeatureAtCoordinate(t, e, i, n, r) {+ if (!this.replayGroup_) return+ const s = e.viewState.resolution,+ o = e.viewState.rotation,+ a = this.getLayer(),+ l = {},+ h = this.getLayer().getDeclutter()+ return this.replayGroup_.forEachFeatureAtCoordinate(+ t,+ s,+ o,+ i,+ function (t, e, i) {+ const s = z(t),+ o = l[s]+ if (o) {+ if (!0 !== o && i < o.distanceSq) {+ if (0 === i) return (l[s] = !0), r.splice(r.lastIndexOf(o), 1), n(t, a, e)+ ;(o.geometry = e), (o.distanceSq = i)+ }+ } else {+ if (0 === i) return (l[s] = !0), n(t, a, e)+ r.push((l[s] = { feature: t, layer: a, geometry: e, distanceSq: i, callback: n }))+ }+ },+ h ? e.declutter?.[h]?.all().map((t) => t.value) : null+ )+ }+ handleFontsChanged() {+ const t = this.getLayer()+ t.getVisible() && this.replayGroup_ && t.changed()+ }+ handleStyleImageChange_(t) {+ this.renderIfReadyAndVisible()+ }+ prepareFrame(t) {+ const e = this.getLayer(),+ i = e.getSource()+ if (!i) return !1+ const n = t.viewHints[co],+ r = t.viewHints[uo],+ s = e.getUpdateWhileAnimating(),+ o = e.getUpdateWhileInteracting()+ if ((this.ready && !s && n) || (!o && r)) return (this.animatingOrInteracting_ = !0), !0+ this.animatingOrInteracting_ = !1+ const a = t.extent,+ l = t.viewState,+ h = l.projection,+ c = l.resolution,+ u = t.pixelRatio,+ d = e.getRevision(),+ g = e.getRenderBuffer()+ let f = e.getRenderOrder()+ void 0 === f && (f = Su)+ const p = l.center.slice(),+ _ = zt(a, g * c),+ m = _.slice(),+ y = [_.slice()],+ x = h.getExtent(),+ v = i.getWrapX() && h.canWrapX()+ if (((this.extendX_ = !1), v)) {+ const t = i.getExtent()+ t && !Ee(t) && (this.extendX_ = t[0] < x[0] || t[2] > x[2])+ }+ if (v && (!Wt(x, t.extent) || this.extendX_)) {+ const t = ve(x),+ e = Math.max(ve(_) / 2, t)+ let i = x[0],+ n = x[2]+ this.extendX_ && ((i -= t), (n += t)), (_[0] = i - e), (_[2] = n + e), ui(p, h)+ const r = Re(y[0], h)+ r[0] < x[0] && r[2] < x[2]+ ? y.push([r[0] + t, r[1], r[2] + t, r[3]])+ : r[0] > x[0] && r[2] > x[2] && y.push([r[0] - t, r[1], r[2] - t, r[3]])+ }+ if (+ this.ready &&+ this.renderedResolution_ == c &&+ this.renderedPixelRatio_ === u &&+ this.renderedRevision_ == d &&+ this.renderedRenderOrder_ == f &&+ this.renderedFrameDeclutter_ === !!t.declutter &&+ Wt(this.wrappedRenderedExtent_, _)+ )+ return (+ w(this.renderedExtent_, m) || ((this.hitDetectionImageData_ = null), (this.renderedExtent_ = m)),+ (this.renderedCenter_ = p),+ (this.replayGroupChanged = !1),+ !0+ )+ this.replayGroup_ = null+ const S = new Zy(wu(c, u), _, c, u),+ E = Gn()+ let T+ if (E) {+ for (let t = 0, e = y.length; t < e; ++t) {+ const e = Bn(y[t], h)+ i.loadFeatures(e, Xn(c, h), E)+ }+ T = Ln(E, h)+ } else for (let t = 0, e = y.length; t < e; ++t) i.loadFeatures(y[t], c, h)+ const C = Eu(c, u)+ let b = !0+ const R = (t, i) => {+ let n+ const r = t.getStyleFunction() || e.getStyleFunction()+ if ((r && (n = r(t, c)), n)) {+ const e = this.renderFeature(t, C, n, S, T, this.getLayer().getDeclutter(), i)+ b = b && !e+ }+ },+ P = Bn(_, h),+ I = i.getFeaturesInExtent(P)+ f && I.sort(f)+ for (let t = 0, e = I.length; t < e; ++t) R(I[t], t)+ ;(this.renderedFeatures_ = I), (this.ready = b)+ const F = S.finish(),+ L = new ux(_, c, u, i.getOverlaps(), F, e.getRenderBuffer(), !!t.declutter)+ return (+ (this.renderedResolution_ = c),+ (this.renderedRevision_ = d),+ (this.renderedRenderOrder_ = f),+ (this.renderedFrameDeclutter_ = !!t.declutter),+ (this.renderedExtent_ = m),+ (this.wrappedRenderedExtent_ = _),+ (this.renderedCenter_ = p),+ (this.renderedProjection_ = h),+ (this.renderedPixelRatio_ = u),+ (this.replayGroup_ = L),+ (this.hitDetectionImageData_ = null),+ (this.replayGroupChanged = !0),+ !0+ )+ }+ renderFeature(t, e, i, n, r, s, o) {+ if (!i) return !1+ let a = !1+ if (Array.isArray(i))+ for (let l = 0, h = i.length; l < h; ++l) a = Tu(n, t, i[l], e, this.boundHandleStyleImageChange_, r, s, o) || a+ else a = Tu(n, t, i, e, this.boundHandleStyleImageChange_, r, s, o)+ return a+ }+ }+ class yx extends bf {+ constructor(t) {+ super(t),+ (this.vectorRenderer_ = new mx(t)),+ (this.layerImageRatio_ = t.getImageRatio()),+ (this.coordinateToVectorPixelTransform_ = [1, 0, 0, 1, 0, 0]),+ (this.renderedPixelToCoordinateTransform_ = null)+ }+ disposeInternal() {+ this.vectorRenderer_.dispose(), super.disposeInternal()+ }+ getFeatures(t) {+ if (!this.vectorRenderer_) return Promise.resolve([])+ const e = Qn(this.coordinateToVectorPixelTransform_, Qn(this.renderedPixelToCoordinateTransform_, t.slice()))+ return this.vectorRenderer_.getFeatures(e)+ }+ handleFontsChanged() {+ this.vectorRenderer_.handleFontsChanged()+ }+ prepareFrame(t) {+ const e = t.pixelRatio,+ i = t.viewState,+ r = i.resolution,+ s = t.viewHints,+ o = this.vectorRenderer_+ let a = t.extent+ 1 !== this.layerImageRatio_ && ((a = a.slice(0)), Te(a, this.layerImageRatio_))+ const l = ve(a) / r,+ h = _e(a) / r+ if (!s[co] && !s[uo] && !Ee(a)) {+ o.useContainer(null, null)+ const s = o.context,+ c = t.layerStatesArray[t.layerIndex],+ u = Object.assign({}, c, { opacity: 1 }),+ d = Object.assign({}, t, {+ extent: a,+ size: [l, h],+ viewState: Object.assign({}, t.viewState, { rotation: 0 }),+ layerStatesArray: [u],+ layerIndex: 0,+ declutter: null+ }),+ g = this.getLayer().getDeclutter()+ g && (d.declutter = { [g]: new ll(9) })+ const f = new Us(a, r, e, s.canvas, function (t) {+ o.prepareFrame(d) &&+ o.replayGroupChanged &&+ ((o.clipping = !1), o.renderFrame(d, null), o.renderDeclutter(d), o.renderDeferred(d), t())+ })+ f.addEventListener(n, () => {+ if (f.getState() !== Ms) return+ this.image = f+ const t = f.getPixelRatio(),+ n = (Ou(f.getResolution()) * e) / t+ ;(this.renderedResolution = n),+ (this.coordinateToVectorPixelTransform_ = nr(+ this.coordinateToVectorPixelTransform_,+ l / 2,+ h / 2,+ 1 / n,+ -1 / n,+ 0,+ -i.center[0],+ -i.center[1]+ ))+ }),+ f.load()+ }+ return (+ this.image && (this.renderedPixelToCoordinateTransform_ = t.pixelToCoordinateTransform.slice()),+ !this.getLayer().getSource()?.loading && !!this.image+ )+ }+ preRender() {}+ postRender() {}+ renderDeclutter() {}+ forEachFeatureAtCoordinate(t, e, i, n, r) {+ return this.vectorRenderer_+ ? this.vectorRenderer_.forEachFeatureAtCoordinate(t, e, i, n, r)+ : super.forEachFeatureAtCoordinate(t, e, i, n, r)+ }+ }+ const xx = {+ image: ["Polygon", "Circle", "LineString", "Image", "Text"],+ hybrid: ["Polygon", "LineString"],+ vector: []+ },+ vx = {+ hybrid: ["Image", "Text", "Default"],+ vector: ["Polygon", "Circle", "LineString", "Image", "Text", "Default"]+ }+ class Sx extends Mf {+ constructor(t, e) {+ super(t, e),+ (this.boundHandleStyleImageChange_ = this.handleStyleImageChange_.bind(this)),+ this.renderedLayerRevision_,+ (this.renderedPixelToCoordinateTransform_ = null),+ this.renderedRotation_,+ (this.renderedOpacity_ = 1),+ (this.tmpTransform_ = [1, 0, 0, 1, 0, 0]),+ (this.tileClipContexts_ = null)+ }+ enqueueTilesForNextExtent() {+ return "vector" !== this.getLayer().getRenderMode()+ }+ drawTile(t, e, i, n, r, s, o, a) {+ this.updateExecutorGroup_(t, e.pixelRatio, e.viewState.projection),+ this.tileImageNeedsRender_(t) && this.renderTileImage_(t, e),+ super.drawTile(t, e, i, n, r, s, o, a)+ }+ getTile(t, e, i, n) {+ const r = this.getOrCreateTile(t, e, i, n)+ if (!r) return null+ const s = n.viewState,+ o = s.resolution,+ a = n.viewHints,+ l = this.getLayer().getSource(),+ h = l.getTileGridForProjection(s.projection),+ c = !(a[co] || a[uo]),+ u = h.getZForResolution(o, l.zDirection) === t+ return c && u ? (r.wantedResolution = o) : r.wantedResolution || (r.wantedResolution = h.getResolution(t)), r+ }+ prepareFrame(t) {+ const e = this.getLayer().getRevision()+ return (+ this.renderedLayerRevision_ !== e && ((this.renderedLayerRevision_ = e), (this.renderedTiles.length = 0)),+ super.prepareFrame(t)+ )+ }+ updateExecutorGroup_(t, e, i) {+ const n = this.getLayer(),+ r = n.getRevision(),+ s = n.getRenderOrder() || null,+ o = t.wantedResolution,+ a = t.getReplayState(n)+ if (+ !a.dirty &&+ a.renderedResolution === o &&+ a.renderedRevision == r &&+ a.renderedPixelRatio === e &&+ a.renderedRenderOrder == s+ )+ return+ const l = n.getSource(),+ h = !!n.getDeclutter(),+ c = l.getTileGrid(),+ u = l.getTileGridForProjection(i).getTileCoordExtent(t.wrappedTileCoord),+ d = l.getSourceTiles(e, i, t),+ g = z(n)+ delete t.hitDetectionImageData[g], (t.executorGroups[g] = []), (a.dirty = !1)+ for (let r = 0, f = d.length; r < f; ++r) {+ const f = d[r]+ if (f.getState() != K) continue+ const p = l.getProjection(),+ _ = f.tileCoord+ let m = c.getTileCoordExtent(_)+ i && p && !Fn(i, p) && (m = Dn(m, p, i, 32))+ const y = me(u, m),+ x = zt(y, n.getRenderBuffer() * o, this.tempExtent),+ v = te(m, y) ? null : x,+ S = new Zy(0, y, o, e),+ E = Eu(o, e),+ w = function (t, e) {+ let i+ const r = t.getStyleFunction() || n.getStyleFunction()+ if ((r && (i = r(t, o)), i)) {+ const n = this.renderFeature(t, E, i, S, h, e)+ a.dirty = a.dirty || n+ }+ },+ T = f.getFeatures()+ s && s !== a.renderedRenderOrder && T.sort(s)+ for (let t = 0, e = T.length; t < e; ++t) {+ let e = T[t]+ i &&+ f.projection &&+ !Fn(i, f.projection) &&+ ((e = e.clone()), e.getGeometry().applyTransform(An(f.projection, i))),+ (v && !Se(v, e.getGeometry().getExtent())) || w.call(this, e, t)+ }+ const C = S.finish(),+ b = "vector" !== n.getRenderMode() && h && 1 === d.length ? null : y,+ R = new ux(b, o, e, l.getOverlaps(), C, n.getRenderBuffer(), !0)+ t.executorGroups[g].push(R)+ }+ ;(a.renderedRevision = r), (a.renderedPixelRatio = e), (a.renderedRenderOrder = s), (a.renderedResolution = o)+ }+ forEachFeatureAtCoordinate(t, e, i, n, r) {+ const s = e.viewState.resolution,+ o = e.viewState.rotation+ i = null == i ? 0 : i+ const a = this.getLayer(),+ l = a.getSource().getTileGridForProjection(e.viewState.projection),+ h = Bt([t])+ zt(h, s * i, h)+ const c = {},+ u = function (t, e, i) {+ let s = t.getId()+ void 0 === s && (s = z(t))+ const o = c[s]+ if (o) {+ if (!0 !== o && i < o.distanceSq) {+ if (0 === i) return (c[s] = !0), r.splice(r.lastIndexOf(o), 1), n(t, a, e)+ ;(o.geometry = e), (o.distanceSq = i)+ }+ } else {+ if (0 === i) return (c[s] = !0), n(t, a, e)+ r.push((c[s] = { feature: t, layer: a, geometry: e, distanceSq: i, callback: n }))+ }+ },+ d = this.renderedTiles,+ g = z(a),+ f = a.getDeclutter(),+ p = f ? e.declutter?.[f]?.all().map((t) => t.value) : null+ let _+ t: for (let e = 0, n = d.length; e < n; ++e) {+ const n = d[e]+ if (!Se(l.getTileCoordExtent(n.wrappedTileCoord), h)) continue+ const r = n.executorGroups[g]+ for (let e = 0, n = r.length; e < n; ++e)+ if (((_ = r[e].forEachFeatureAtCoordinate(t, s, o, i, u, p)), _)) break t+ }+ return _+ }+ getFeatures(t) {+ return 0 === this.renderedTiles.length+ ? Promise.resolve([])+ : new Promise((e, i) => {+ const n = this.getLayer(),+ r = n.getSource(),+ s = this.renderedProjection,+ o = s.getExtent(),+ a = this.renderedResolution,+ l = r.getTileGridForProjection(s),+ h = Qn(this.renderedPixelToCoordinateTransform_, t.slice()),+ c = l.getTileCoordForCoordAndResolution(h, a).toString(),+ u = this.renderedTiles.find((t) => t.tileCoord.toString() === c && t.getState() === K)+ if (!u || u.loadingSourceTiles > 0) return void e([])+ r.getWrapX() && s.canWrapX() && !Wt(o, l.getTileCoordExtent(u.tileCoord)) && ui(h, s)+ const d = z(n),+ g = ye(l.getTileCoordExtent(u.wrappedTileCoord)),+ f = [(h[0] - g[0]) / a, (g[1] - h[1]) / a],+ p = u.getSourceTiles().reduce((t, e) => t.concat(e.getFeatures()), [])+ let _ = u.hitDetectionImageData[d]+ if (!_) {+ const t = Wl(l.getTileSize(l.getZForResolution(a, r.zDirection))),+ e = this.renderedRotation_+ ;(_ = px(+ t,+ [this.getRenderTransform(l.getTileCoordCenter(u.wrappedTileCoord), a, 0, fx, t[0] * fx, t[1] * fx, 0)],+ p,+ n.getStyleFunction(),+ l.getTileCoordExtent(u.wrappedTileCoord),+ u.getReplayState(n).renderedResolution,+ e+ )),+ (u.hitDetectionImageData[d] = _)+ }+ e(_x(f, p, _))+ })+ }+ getFeaturesInExtent(t) {+ const e = [],+ i = this.getTileCache()+ if (0 === i.getCount()) return e+ const n = this.getLayer().getSource().getTileGridForProjection(this.frameState.viewState.projection),+ r = n.getZForResolution(this.renderedResolution),+ s = {}+ return (+ i.forEach((i) => {+ if (i.tileCoord[0] !== r || i.getState() !== K) return+ const o = i.getSourceTiles()+ for (let i = 0, r = o.length; i < r; ++i) {+ const r = o[i],+ a = r.getKey()+ if (a in s) continue+ s[a] = !0+ const l = r.tileCoord+ if (Se(t, n.getTileCoordExtent(l))) {+ const i = r.getFeatures()+ if (i)+ for (let n = 0, r = i.length; n < r; ++n) {+ const r = i[n],+ s = r.getGeometry()+ Se(t, s.getExtent()) && e.push(r)+ }+ }+ }+ }),+ e+ )+ }+ handleFontsChanged() {+ const t = this.getLayer()+ t.getVisible() && void 0 !== this.renderedLayerRevision_ && t.changed()+ }+ handleStyleImageChange_(t) {+ this.renderIfReadyAndVisible()+ }+ renderDeclutter(t, e) {+ const i = this.context,+ n = i.globalAlpha+ i.globalAlpha = e.opacity+ const r = t.viewHints,+ s = !(r[co] || r[uo]),+ o = [this.context.canvas.width, this.context.canvas.height],+ a = this.getLayer().getDeclutter(),+ l = a ? t.declutter?.[a] : void 0,+ h = z(this.getLayer()),+ c = this.renderedTiles+ for (let e = 0, i = c.length; e < i; ++e) {+ const i = c[e],+ n = i.executorGroups[h]+ if (n)+ for (let e = n.length - 1; e >= 0; --e)+ n[e].execute(this.context, o, this.getTileRenderTransform(i, t), t.viewState.rotation, s, ax, l)+ }+ i.globalAlpha = n+ }+ renderDeferredInternal(t) {+ const e = this.renderedTiles,+ i = z(this.getLayer()),+ n = e.reduce((t, e, n) => (e.executorGroups[i].forEach((e) => t.push({ executorGroup: e, index: n })), t), []),+ r = n.map(({ executorGroup: t }) => t.getDeferredZIndexContexts()),+ s = {}+ for (let t = 0, e = n.length; t < e; ++t) {+ const e = n[t].executorGroup.getDeferredZIndexContexts()+ for (const t in e) s[t] = !0+ }+ Object.keys(s)+ .map(Number)+ .sort(y)+ .forEach((t) => {+ r.forEach((e, i) => {+ e[t] &&+ (e[t].forEach((t) => {+ const { executorGroup: e, index: r } = n[i],+ s = e.getRenderedContext(),+ o = s.globalAlpha+ s.globalAlpha = this.renderedOpacity_+ const a = this.tileClipContexts_[r]+ a && a.draw(s), t.draw(s), a && s.restore(), (s.globalAlpha = o), t.clear()+ }),+ (e[t].length = 0))+ })+ })+ }+ getTileRenderTransform(t, e) {+ const i = e.pixelRatio,+ n = e.viewState,+ r = n.center,+ s = n.resolution,+ o = n.rotation,+ a = e.size,+ l = Math.round(a[0] * i),+ h = Math.round(a[1] * i),+ c = this.getLayer().getSource().getTileGridForProjection(e.viewState.projection),+ u = t.tileCoord,+ d = c.getTileCoordExtent(t.wrappedTileCoord),+ g = c.getTileCoordExtent(u, this.tempExtent)[0] - d[0]+ return Kn(er(this.inversePixelTransform.slice(), 1 / i, 1 / i), this.getRenderTransform(r, s, o, i, l, h, g))+ }+ postRender(t, e) {+ const i = e.viewHints,+ n = !(i[co] || i[uo])+ ;(this.renderedPixelToCoordinateTransform_ = e.pixelToCoordinateTransform.slice()),+ (this.renderedRotation_ = e.viewState.rotation),+ (this.renderedOpacity_ = e.layerStatesArray[e.layerIndex].opacity)+ const r = this.getLayer(),+ s = r.getRenderMode(),+ o = t.globalAlpha+ t.globalAlpha = this.renderedOpacity_+ const a = r.getDeclutter(),+ l = a ? vx[s].filter((t) => !ax.includes(t)) : vx[s],+ h = e.viewState,+ c = h.rotation,+ u = r.getSource(),+ d = u.getTileGridForProjection(h.projection).getZForResolution(h.resolution, u.zDirection),+ g = this.renderedTiles,+ f = [],+ p = [],+ _ = [],+ m = z(r)+ let y = !0+ for (let i = g.length - 1; i >= 0; --i) {+ const s = g[i]+ y = y && !s.getReplayState(r).dirty+ const o = s.executorGroups[m].filter((t) => t.hasExecutors(l))+ if (0 === o.length) continue+ const h = this.getTileRenderTransform(s, e),+ u = s.tileCoord[0]+ let x = !1+ const v = o[0].getClipCoords(h)+ let S,+ E = t+ if (v) {+ ;(S = new Sf()), (E = S.getContext())+ for (let t = 0, e = f.length; t < e; ++t)+ if (d !== u && u < p[t]) {+ const e = f[t]+ Se([v[0], v[3], v[4], v[7]], [e[0], e[3], e[4], e[7]]) &&+ (x || (E.save(), (x = !0)),+ E.beginPath(),+ E.moveTo(v[0], v[1]),+ E.lineTo(v[2], v[3]),+ E.lineTo(v[4], v[5]),+ E.lineTo(v[6], v[7]),+ E.moveTo(e[6], e[7]),+ E.lineTo(e[4], e[5]),+ E.lineTo(e[2], e[3]),+ E.lineTo(e[0], e[1]),+ E.clip())+ }+ f.push(v), p.push(u)+ }+ for (let i = 0, r = o.length; i < r; ++i) {+ o[i].execute(t, [t.canvas.width, t.canvas.height], h, c, n, l, e.declutter?.[a])+ }+ x && (E === t ? E.restore() : (_[i] = S))+ }+ ;(t.globalAlpha = o),+ (this.ready = y),+ (this.tileClipContexts_ = _),+ e.declutter || this.renderDeferredInternal(e),+ super.postRender(t, e)+ }+ renderFeature(t, e, i, n, r, s) {+ if (!i) return !1+ let o = !1+ if (Array.isArray(i))+ for (let a = 0, l = i.length; a < l; ++a)+ o = Tu(n, t, i[a], e, this.boundHandleStyleImageChange_, void 0, r, s) || o+ else o = Tu(n, t, i, e, this.boundHandleStyleImageChange_, void 0, r, s)+ return o+ }+ tileImageNeedsRender_(t) {+ const e = this.getLayer()+ if ("vector" === e.getRenderMode()) return !1+ const i = t.getReplayState(e),+ n = e.getRevision(),+ r = t.wantedResolution+ return i.renderedTileResolution !== r || i.renderedTileRevision !== n+ }+ renderTileImage_(t, e) {+ const i = this.getLayer(),+ n = t.getReplayState(i),+ r = i.getRevision(),+ s = t.executorGroups[z(i)]+ n.renderedTileRevision = r+ const o = t.wrappedTileCoord,+ a = o[0],+ l = i.getSource()+ let h = e.pixelRatio+ const c = e.viewState.projection,+ u = l.getTileGridForProjection(c),+ d = u.getResolution(t.tileCoord[0]),+ g = (e.pixelRatio / t.wantedResolution) * d,+ f = u.getResolution(a),+ p = t.getContext()+ h = Math.round(Math.max(h, g / h))+ const _ = l.getTilePixelSize(a, h, c)+ ;(p.canvas.width = _[0]), (p.canvas.height = _[1])+ const m = h / g+ if (1 !== m) {+ const t = Hn(this.tmpTransform_)+ er(t, m, m), p.setTransform.apply(p, t)+ }+ const y = u.getTileCoordExtent(o, this.tempExtent),+ x = g / f,+ v = Hn(this.tmpTransform_)+ er(v, x, -x), ir(v, -y[0], -y[3])+ for (let t = 0, e = s.length; t < e; ++t) {+ s[t].execute(p, [p.canvas.width * m, p.canvas.height * m], v, 0, !0, xx[i.getRenderMode()], null)+ }+ n.renderedTileResolution = t.wantedResolution+ }+ }+ let Ex = null+ function wx(t) {+ Ex = t+ const e = Object.keys(t.defs),+ i = e.length+ let n, r+ for (n = 0; n < i; ++n) {+ const i = e[n]+ if (!Oi(i)) {+ const e = t.defs(i)+ let n = e.units+ n || "longlat" !== e.projName || (n = "degrees"),+ vn(new mi({ code: i, axisOrientation: e.axis, metersPerUnit: e.to_meter, units: n }))+ }+ }+ for (n = 0; n < i; ++n) {+ const s = e[n],+ o = Oi(s)+ for (r = 0; r < i; ++r) {+ const i = e[r],+ n = Oi(i)+ if (!ji(s, i))+ if (t.defs[s] === t.defs[i]) Tn([o, n])+ else {+ const e = t(s, i)+ Pn(o, n, $n(o, n, e.forward), $n(n, o, e.inverse))+ }+ }+ }+ }+ let Tx = async function (t) {+ if ("string" != typeof t || !t.includes(":")) throw new Error("Invalid code")+ const [e, i] = t.toLowerCase().split(":", 2),+ n = await fetch(`https://spatialreference.org/ref/${e}/${i}/ogcwkt/`)+ if (!n.ok) throw new Error(`Unexpected response from spatialreference.org: ${n.status}`)+ return n.text()+ }+ async function Cx(t) {+ const e = Ex+ if (!e) throw new Error("Proj4 must be registered first with register(proj4)")+ return e.defs(t) || (e.defs(t, await Tx(t)), wx(e)), Oi(t)+ }+ let bx = async function (t) {+ return await Tx("EPSG:" + t)+ }+ const Rx = `\n attribute vec2 ${E_.TEXTURE_COORD};\n uniform mat4 ${S_.TILE_TRANSFORM};\n uniform float ${S_.TEXTURE_PIXEL_WIDTH};\n uniform float ${S_.TEXTURE_PIXEL_HEIGHT};\n uniform float ${S_.TEXTURE_RESOLUTION};\n uniform float ${S_.TEXTURE_ORIGIN_X};\n uniform float ${S_.TEXTURE_ORIGIN_Y};\n uniform float ${S_.DEPTH};\n\n varying vec2 v_textureCoord;\n varying vec2 v_mapCoord;\n\n void main() {\n v_textureCoord = ${E_.TEXTURE_COORD};\n v_mapCoord = vec2(\n ${S_.TEXTURE_ORIGIN_X} + ${S_.TEXTURE_RESOLUTION} * ${S_.TEXTURE_PIXEL_WIDTH} * v_textureCoord[0],\n ${S_.TEXTURE_ORIGIN_Y} - ${S_.TEXTURE_RESOLUTION} * ${S_.TEXTURE_PIXEL_HEIGHT} * v_textureCoord[1]\n );\n gl_Position = ${S_.TILE_TRANSFORM} * vec4(${E_.TEXTURE_COORD}, ${S_.DEPTH}, 1.0);\n }\n`,+ Px = `\n #ifdef GL_FRAGMENT_PRECISION_HIGH\n precision highp float;\n #else\n precision mediump float;\n #endif\n\n uniform vec4 ${S_.RENDER_EXTENT};\n uniform float ${C_.MAX_SPEED};\n uniform sampler2D ${S_.TILE_TEXTURE_ARRAY}[1];\n\n varying vec2 v_textureCoord;\n varying vec2 v_mapCoord;\n\n void main() {\n if (\n v_mapCoord[0] < ${S_.RENDER_EXTENT}[0] ||\n v_mapCoord[1] < ${S_.RENDER_EXTENT}[1] ||\n v_mapCoord[0] > ${S_.RENDER_EXTENT}[2] ||\n v_mapCoord[1] > ${S_.RENDER_EXTENT}[3]\n ) {\n discard;\n }\n\n vec4 velocity = texture2D(${S_.TILE_TEXTURE_ARRAY}[0], v_textureCoord);\n gl_FragColor = vec4((velocity.xy + ${C_.MAX_SPEED}) / (2.0 * ${C_.MAX_SPEED}), 0, 1);\n }\n`,+ Ix = `\n #ifdef GL_FRAGMENT_PRECISION_HIGH\n precision highp float;\n #else\n precision mediump float;\n #endif\n\n attribute vec2 ${b_};\n\n varying vec2 ${P_};\n\n void main() {\n ${P_} = ${b_};\n gl_Position = vec4(1.0 - 2.0 * ${b_}, 0, 1);\n }\n`,+ Fx = `\n #ifdef GL_FRAGMENT_PRECISION_HIGH\n precision highp float;\n #else\n precision mediump float;\n #endif\n\n uniform sampler2D ${C_.TEXTURE};\n uniform float ${C_.OPACITY};\n\n varying vec2 ${P_};\n\n void main() {\n vec4 color = texture2D(${C_.TEXTURE}, 1.0 - ${P_});\n gl_FragColor = vec4(floor(255.0 * color * ${C_.OPACITY}) / 255.0);\n }\n`,+ Lx = `\n #ifdef GL_FRAGMENT_PRECISION_HIGH\n precision highp float;\n #else\n precision mediump float;\n #endif\n\n uniform sampler2D ${C_.POSITION_TEXTURE};\n uniform sampler2D ${C_.VELOCITY_TEXTURE};\n uniform float ${C_.RANDOM_SEED};\n uniform float ${C_.SPEED_FACTOR};\n uniform float ${C_.DROP_RATE};\n uniform float ${C_.DROP_RATE_BUMP};\n uniform vec2 ${C_.ROTATION};\n uniform vec2 ${C_.VIEWPORT_SIZE_PX};\n\n varying vec2 ${P_};\n\n // pseudo-random generator\n const vec3 randConstants = vec3(12.9898, 78.233, 4375.85453);\n\n float rand(const vec2 co) {\n float t = dot(randConstants.xy, co);\n return fract(sin(t) * (randConstants.z + t));\n }\n\n void main() {\n vec4 positionColor = texture2D(${C_.POSITION_TEXTURE}, ${P_});\n\n // decode particle position from pixel RGBA\n vec2 particlePosition = vec2(\n positionColor.r / 255.0 + positionColor.b,\n positionColor.g / 255.0 + positionColor.a\n );\n\n vec4 velocityColor = texture2D(${C_.VELOCITY_TEXTURE}, particlePosition);\n if (velocityColor.a == 0.0) {\n discard;\n }\n\n float vx = 2.0 * velocityColor.r - 1.0;\n float vy = 2.0 * velocityColor.g - 1.0;\n\n // normalized veloicty (magnitude 0 - 1)\n vec2 velocity = vec2(\n vx * ${C_.ROTATION}.x - vy * ${C_.ROTATION}.y,\n vx * ${C_.ROTATION}.y + vy * ${C_.ROTATION}.x\n );\n\n // account for aspect ratio (square particle position texture, non-square map)\n float aspectRatio = ${C_.VIEWPORT_SIZE_PX}.x / ${C_.VIEWPORT_SIZE_PX}.y;\n vec2 offset = vec2(velocity.x / aspectRatio, velocity.y) * ${C_.SPEED_FACTOR};\n\n // update particle position, wrapping around the edge\n particlePosition = fract(1.0 + particlePosition + offset);\n\n // a random seed to use for the particle drop\n vec2 seed = (particlePosition + ${P_}) * ${C_.RANDOM_SEED};\n\n // drop rate is a chance a particle will restart at random position, to avoid degeneration\n float dropRate = ${C_.DROP_RATE} + length(velocity) * ${C_.DROP_RATE_BUMP};\n float drop = step(1.0 - dropRate, rand(seed));\n\n vec2 randomPosition = vec2(rand(seed + 1.3), rand(seed + 2.1));\n particlePosition = mix(particlePosition, randomPosition, drop);\n\n // encode the new particle position back into RGBA\n gl_FragColor = vec4(\n fract(particlePosition * 255.0),\n floor(particlePosition * 255.0) / 255.0\n );\n }\n`,+ Mx = `\n #ifdef GL_FRAGMENT_PRECISION_HIGH\n precision highp float;\n #else\n precision mediump float;\n #endif\n\n attribute float ${R_};\n\n uniform sampler2D ${C_.POSITION_TEXTURE};\n uniform float ${C_.PARTICLE_COUNT_SQRT};\n\n varying vec2 ${P_};\n\n void main() {\n vec4 color = texture2D(\n ${C_.POSITION_TEXTURE},\n vec2(\n fract(${R_} / ${C_.PARTICLE_COUNT_SQRT}),\n floor(${R_} / ${C_.PARTICLE_COUNT_SQRT}) / ${C_.PARTICLE_COUNT_SQRT}\n )\n );\n\n ${P_} = vec2(\n color.r / 255.0 + color.b,\n color.g / 255.0 + color.a\n );\n\n gl_PointSize = 1.0;\n gl_Position = vec4(\n 2.0 * ${P_}.x - 1.0,\n 2.0 * ${P_}.y - 1.0,\n 0,\n 1\n );\n }\n`+ const Ax = []+ class Ox extends Df {+ constructor(t) {+ const e = Object.assign({}, t)+ if (+ (delete e.maxSpeed,+ delete e.speedFactor,+ delete e.particles,+ super(e),+ (this.style_ = t.style || {}),+ !(t.maxSpeed > 0))+ )+ throw new Error("maxSpeed is required")+ ;(this.maxSpeed_ = t.maxSpeed),+ (this.speedFactor_ = t.speedFactor),+ (this.particles_ = t.particles),+ (this.styleVariables_ = this.style_.variables || {}),+ this.addChangeListener(Va, this.handleSourceUpdate_)+ }+ handleSourceUpdate_() {+ this.hasRenderer() && this.getRenderer().clearCache()+ }+ updateStyleVariables(t) {+ Object.assign(this.styleVariables_, t), this.changed()+ }+ getSources(t, e) {+ const i = this.getSource()+ return (Ax[0] = i), Ax+ }+ createRenderer() {+ const t = (function (t) {+ const e = { variables: {}, properties: {}, functions: {}, bandCount: 0, featureId: !1, geometryType: !1 },+ i = []+ if (void 0 !== t.color) {+ const n = km(e, t.color, ql)+ i.push(`color = ${n};`)+ }+ const n = Object.keys(e.variables)+ if (n.length > 1 && !t.variables) throw new Error(`Missing variables in style (expected ${e.variables})`)+ const r = {}+ for (const e of n) {+ if (!(e in t.variables)) throw new Error(`Missing '${e}' in style variables`)+ r[W_(e)] = function () {+ let i = t.variables[e]+ return "string" == typeof i && (i = V_(i)), void 0 !== i ? i : -9999999+ }+ }+ const s = Object.keys(r).map(function (t) {+ return `uniform float ${t};`+ }),+ o = Object.keys(e.functions).map(function (t) {+ return e.functions[t]+ }),+ a = `\n #ifdef GL_FRAGMENT_PRECISION_HIGH\n precision highp float;\n #else\n precision mediump float;\n #endif\n\n uniform sampler2D ${+ C_.VELOCITY_TEXTURE+ };\n uniform float ${C_.MAX_SPEED};\n uniform vec2 ${C_.ROTATION};\n\n ${s.join(+ "\n"+ )}\n\n varying vec2 ${P_};\n \n ${o.join(+ "\n"+ )}\n\n void main() {\n vec4 velocityColor = texture2D(${+ C_.VELOCITY_TEXTURE+ }, ${P_});\n\n float vx = mix(-${C_.MAX_SPEED}, ${+ C_.MAX_SPEED+ }, velocityColor.r);\n float vy = mix(-${C_.MAX_SPEED}, ${+ C_.MAX_SPEED+ }, velocityColor.g);\n\n vec2 velocity = vec2(\n vx * ${C_.ROTATION}.x - vy * ${+ C_.ROTATION+ }.y,\n vx * ${C_.ROTATION}.y + vy * ${+ C_.ROTATION+ }.x\n );\n\n float a_prop_speed = length(velocity);\n\n vec4 color;\n\n ${i.join(+ "\n"+ )}\n\n if (color.a == 0.0) {\n discard;\n }\n\n gl_FragColor = color;\n }\n `+ return {+ tileVertexShader: Rx,+ tileFragmentShader: Px,+ particleColorVertexShader: Mx,+ particleColorFragmentShader: a,+ particlePositionVertexShader: Ix,+ particlePositionFragmentShader: Lx,+ textureVertexShader: Ix,+ textureFragmentShader: Fx+ }+ })(this.style_)+ return new I_(this, {+ ...t,+ cacheSize: this.getCacheSize(),+ maxSpeed: this.maxSpeed_,+ speedFactor: this.speedFactor_,+ particles: this.particles_+ })+ }+ }+ function Dx(t, e, i) {+ const n = []+ let r = t(0),+ s = t(1),+ o = e(r),+ a = e(s)+ const l = [s, r],+ h = [a, o],+ c = [1, 0],+ u = {}+ let d,+ g,+ f,+ p,+ _,+ m,+ y = 1e5+ for (; --y > 0 && c.length > 0; )+ (f = c.pop()),+ (r = l.pop()),+ (o = h.pop()),+ (m = f.toString()),+ m in u || (n.push(o[0], o[1]), (u[m] = !0)),+ (p = c.pop()),+ (s = l.pop()),+ (a = h.pop()),+ (_ = (f + p) / 2),+ (d = t(_)),+ (g = e(d)),+ Fe(g[0], g[1], o[0], o[1], a[0], a[1]) < i+ ? (n.push(a[0], a[1]), (m = p.toString()), (u[m] = !0))+ : (c.push(p, _, _, f), h.push(a, g, g, o), l.push(s, d, d, r))+ return n+ }+ function Nx(t, e, i, n, r) {+ return Dx(+ function (n) {+ return [t, e + (i - e) * n]+ },+ An(En("EPSG:4326"), n),+ r+ )+ }+ function kx(t, e, i, n, r) {+ return Dx(+ function (n) {+ return [e + (i - e) * n, t]+ },+ An(En("EPSG:4326"), n),+ r+ )+ }+ Ox.prototype.dispose+ class Gx extends zc {+ constructor(t) {+ super(t)+ }+ createRenderer() {+ return new mx(this)+ }+ }+ const jx = new lc({ color: "rgba(0,0,0,0.2)" }),+ Ux = [+ 90,+ 45,+ 30,+ 20,+ 10,+ 5,+ 2,+ 1,+ 0.5,+ 20 / 60,+ 10 / 60,+ 5 / 60,+ 2 / 60,+ 1 / 60,+ 30 / 3600,+ 20 / 3600,+ 10 / 3600,+ 5 / 3600,+ 2 / 3600,+ 1 / 3600+ ]+ const Bx = "blur",+ zx = "gradient",+ Xx = "radius",+ Vx = ["#00f", "#0ff", "#0f0", "#ff0", "#f00"]+ function $x(t, e) {+ const i = `\n attribute vec2 ${E_.TEXTURE_COORD};\n uniform mat4 ${S_.TILE_TRANSFORM};\n uniform float ${S_.TEXTURE_PIXEL_WIDTH};\n uniform float ${S_.TEXTURE_PIXEL_HEIGHT};\n uniform float ${S_.TEXTURE_RESOLUTION};\n uniform float ${S_.TEXTURE_ORIGIN_X};\n uniform float ${S_.TEXTURE_ORIGIN_Y};\n uniform float ${S_.DEPTH};\n\n varying vec2 v_textureCoord;\n varying vec2 v_mapCoord;\n\n void main() {\n v_textureCoord = ${E_.TEXTURE_COORD};\n v_mapCoord = vec2(\n ${S_.TEXTURE_ORIGIN_X} + ${S_.TEXTURE_RESOLUTION} * ${S_.TEXTURE_PIXEL_WIDTH} * v_textureCoord[0],\n ${S_.TEXTURE_ORIGIN_Y} - ${S_.TEXTURE_RESOLUTION} * ${S_.TEXTURE_PIXEL_HEIGHT} * v_textureCoord[1]\n );\n gl_Position = ${S_.TILE_TRANSFORM} * vec4(${E_.TEXTURE_COORD}, ${S_.DEPTH}, 1.0);\n }\n `,+ n = { variables: {}, properties: {}, functions: {}, bandCount: 0, featureId: !1, geometryType: !1, bandCount: e },+ r = []+ if (void 0 !== t.color) {+ const e = km(n, t.color, ql)+ r.push(`color = ${e};`)+ }+ if (void 0 !== t.contrast) {+ const e = km(n, t.contrast, Hl)+ r.push(`color.rgb = clamp((${e} + 1.0) * color.rgb - (${e} / 2.0), vec3(0.0, 0.0, 0.0), vec3(1.0, 1.0, 1.0));`)+ }+ if (void 0 !== t.exposure) {+ const e = km(n, t.exposure, Hl)+ r.push(`color.rgb = clamp((${e} + 1.0) * color.rgb, vec3(0.0, 0.0, 0.0), vec3(1.0, 1.0, 1.0));`)+ }+ if (void 0 !== t.saturation) {+ const e = km(n, t.saturation, Hl)+ r.push(+ `\n float saturation = ${e} + 1.0;\n float sr = (1.0 - saturation) * 0.2126;\n float sg = (1.0 - saturation) * 0.7152;\n float sb = (1.0 - saturation) * 0.0722;\n mat3 saturationMatrix = mat3(\n sr + saturation, sr, sr,\n sg, sg + saturation, sg,\n sb, sb, sb + saturation\n );\n color.rgb = clamp(saturationMatrix * color.rgb, vec3(0.0, 0.0, 0.0), vec3(1.0, 1.0, 1.0));\n `+ )+ }+ if (void 0 !== t.gamma) {+ const e = km(n, t.gamma, Hl)+ r.push(`color.rgb = pow(color.rgb, vec3(1.0 / ${e}));`)+ }+ if (void 0 !== t.brightness) {+ const e = km(n, t.brightness, Hl)+ r.push(`color.rgb = clamp(color.rgb + ${e}, vec3(0.0, 0.0, 0.0), vec3(1.0, 1.0, 1.0));`)+ }+ const s = {},+ o = Object.keys(n.variables).length+ if (o > 1 && !t.variables) throw new Error(`Missing variables in style (expected ${n.variables})`)+ for (let e = 0; e < o; ++e) {+ const i = n.variables[Object.keys(n.variables)[e]]+ if (!(i.name in t.variables)) throw new Error(`Missing '${i.name}' in style variables`)+ s[W_(i.name)] = function () {+ let e = t.variables[i.name]+ return "string" == typeof e && (e = V_(e)), void 0 !== e ? e : -9999999+ }+ }+ const a = Object.keys(s).map(function (t) {+ return `uniform float ${t};`+ }),+ l = Math.ceil(e / 4)+ a.push(`uniform sampler2D ${S_.TILE_TEXTURE_ARRAY}[${l}];`),+ n.paletteTextures && a.push(`uniform sampler2D ${H_}[${n.paletteTextures.length}];`)+ const h = Object.keys(n.functions).map(function (t) {+ return n.functions[t]+ })+ return {+ vertexShader: i,+ fragmentShader: `\n #ifdef GL_FRAGMENT_PRECISION_HIGH\n precision highp float;\n #else\n precision mediump float;\n #endif\n\n varying vec2 v_textureCoord;\n varying vec2 v_mapCoord;\n uniform vec4 ${+ S_.RENDER_EXTENT+ };\n uniform float ${S_.TRANSITION_ALPHA};\n uniform float ${S_.TEXTURE_PIXEL_WIDTH};\n uniform float ${+ S_.TEXTURE_PIXEL_HEIGHT+ };\n uniform float ${S_.RESOLUTION};\n uniform float ${S_.ZOOM};\n\n ${a.join("\n")}\n\n ${h.join(+ "\n"+ )}\n\n void main() {\n if (\n v_mapCoord[0] < ${S_.RENDER_EXTENT}[0] ||\n v_mapCoord[1] < ${+ S_.RENDER_EXTENT+ }[1] ||\n v_mapCoord[0] > ${S_.RENDER_EXTENT}[2] ||\n v_mapCoord[1] > ${+ S_.RENDER_EXTENT+ }[3]\n ) {\n discard;\n }\n\n vec4 color = texture2D(${+ S_.TILE_TEXTURE_ARRAY+ }[0], v_textureCoord);\n\n ${r.join(+ "\n"+ )}\n\n gl_FragColor = color;\n gl_FragColor.rgb *= gl_FragColor.a;\n gl_FragColor *= ${+ S_.TRANSITION_ALPHA+ };\n }`,+ uniforms: s,+ paletteTextures: n.paletteTextures+ }+ }+ class Wx extends Df {+ constructor(t) {+ const e = (t = t ? Object.assign({}, t) : {}).style || {}+ delete t.style,+ super(t),+ (this.sources_ = t.sources),+ (this.renderedSource_ = null),+ (this.renderedResolution_ = NaN),+ (this.style_ = e),+ (this.styleVariables_ = this.style_.variables || {}),+ this.handleSourceUpdate_(),+ this.addChangeListener(Va, this.handleSourceUpdate_)+ }+ getSources(t, e) {+ const i = this.getSource()+ return this.sources_ ? ("function" == typeof this.sources_ ? this.sources_(t, e) : this.sources_) : i ? [i] : []+ }+ getRenderSource() {+ return this.renderedSource_ || this.getSource()+ }+ getSourceState() {+ const t = this.getRenderSource()+ return t ? t.getState() : "undefined"+ }+ handleSourceUpdate_() {+ this.hasRenderer() && this.getRenderer().clearCache()+ const t = this.getSource()+ if (t)+ if ("loading" === t.getState()) {+ const e = () => {+ "ready" === t.getState() && (t.removeEventListener("change", e), this.setStyle(this.style_))+ }+ t.addEventListener("change", e)+ } else this.setStyle(this.style_)+ }+ getSourceBandCount_() {+ const t = Number.MAX_SAFE_INTEGER,+ e = this.getSources([-t, -t, t, t], t)+ return e && e.length && "bandCount" in e[0] ? e[0].bandCount : 4+ }+ createRenderer() {+ const t = $x(this.style_, this.getSourceBandCount_())+ return new T_(this, {+ vertexShader: t.vertexShader,+ fragmentShader: t.fragmentShader,+ uniforms: t.uniforms,+ cacheSize: this.getCacheSize(),+ paletteTextures: t.paletteTextures+ })+ }+ renderSources(t, e) {+ const i = this.getRenderer()+ let n+ for (let r = 0, s = e.length; r < s; ++r)+ (this.renderedSource_ = e[r]), i.prepareFrame(t) && (n = i.renderFrame(t))+ return n+ }+ render(t, e) {+ this.rendered = !0+ const i = t.viewState,+ n = this.getSources(t.extent, i.resolution)+ let r = !0+ for (let t = 0, e = n.length; t < e; ++t) {+ const e = n[t],+ i = e.getState()+ if ("loading" == i) {+ const t = () => {+ "ready" == e.getState() && (e.removeEventListener("change", t), this.changed())+ }+ e.addEventListener("change", t)+ }+ r = r && "ready" == i+ }+ const s = this.renderSources(t, n)+ if (this.getRenderer().renderComplete && r) return (this.renderedResolution_ = i.resolution), s+ if (this.renderedResolution_ > 0.5 * i.resolution) {+ const e = this.getSources(t.extent, this.renderedResolution_).filter((t) => !n.includes(t))+ if (e.length > 0) return this.renderSources(t, e)+ }+ return s+ }+ setStyle(t) {+ if (((this.styleVariables_ = t.variables || {}), (this.style_ = t), this.hasRenderer())) {+ const t = $x(this.style_, this.getSourceBandCount_())+ this.getRenderer().reset({+ vertexShader: t.vertexShader,+ fragmentShader: t.fragmentShader,+ uniforms: t.uniforms,+ paletteTextures: t.paletteTextures+ }),+ this.changed()+ }+ }+ updateStyleVariables(t) {+ Object.assign(this.styleVariables_, t), this.changed()+ }+ }+ Wx.prototype.dispose+ const Zx = "addfeatures"+ class Yx extends M {+ constructor(t, e, i, n) {+ super(t), (this.features = i), (this.file = e), (this.projection = n)+ }+ }+ function Hx(t, e) {+ const i = t.length+ return e < 0 ? t[e + i] : e >= i ? t[e - i] : t[e]+ }+ function Kx(t, e) {+ const i = t.length+ let n = Math.floor(e)+ const r = e - n+ n >= i ? (n -= i) : n < 0 && (n += i)+ let s = n + 1+ s >= i && (s -= i)+ const o = t[n],+ a = o[0],+ l = o[1],+ h = t[s]+ return [a + (h[0] - a) * r, l + (h[1] - l) * r]+ }+ const qx = { index: -1, endIndex: NaN, closestTargetDistance: 1 / 0 }+ function Jx(t, e, i, n) {+ const r = t[0],+ s = t[1]+ let o = 1 / 0,+ a = -1,+ l = NaN+ for (let t = 0; t < e.targets.length; ++t) {+ const i = e.targets[t],+ n = i.coordinates+ let h,+ c = 1 / 0+ for (let t = 0; t < n.length - 1; ++t) {+ const e = sv(r, s, n[t], n[t + 1])+ e.squaredDistance < c && ((c = e.squaredDistance), (h = t + e.along))+ }+ c < o &&+ ((o = c),+ i.ring &&+ e.targetIndex === t &&+ (i.endIndex > i.startIndex+ ? h < i.startIndex && (h += n.length)+ : i.endIndex < i.startIndex && h > i.startIndex && (h -= n.length)),+ (l = h),+ (a = t))+ }+ const h = e.targets[a]+ let c = h.ring+ if (e.targetIndex === a && c) {+ const t = Kx(h.coordinates, l)+ li(i.getPixelFromCoordinate(t), i.getPixelFromCoordinate(e.startCoord)) > n && (c = !1)+ }+ if (c) {+ const t = h.coordinates,+ e = t.length,+ i = h.startIndex,+ n = l+ if (i < n) {+ const r = nv(t, i, n)+ nv(t, i, n - e) < r && (l -= e)+ } else {+ const r = nv(t, i, n)+ nv(t, i, n + e) < r && (l += e)+ }+ }+ return (qx.index = a), (qx.endIndex = l), (qx.closestTargetDistance = o), qx+ }+ function Qx(t, e) {+ const i = []+ for (let n = 0; n < e.length; ++n) {+ tv(t, e[n].getGeometry(), i)+ }+ return i+ }+ function tv(t, e, i) {+ if (e instanceof Dd) ev(t, e.getCoordinates(), !1, i)+ else if (e instanceof Nd) {+ const n = e.getCoordinates()+ for (let e = 0, r = n.length; e < r; ++e) ev(t, n[e], !1, i)+ } else if (e instanceof gs) {+ const n = e.getCoordinates()+ for (let e = 0, r = n.length; e < r; ++e) ev(t, n[e], !0, i)+ } else if (e instanceof Gd) {+ const n = e.getCoordinates()+ for (let e = 0, r = n.length; e < r; ++e) {+ const r = n[e]+ for (let e = 0, n = r.length; e < n; ++e) ev(t, r[e], !0, i)+ }+ } else if (e instanceof Md) {+ const n = e.getGeometries()+ for (let e = 0; e < n.length; ++e) tv(t, n[e], i)+ } else;+ }+ function ev(t, e, i, n) {+ const r = t[0],+ s = t[1]+ for (let t = 0, o = e.length - 1; t < o; ++t) {+ const o = sv(r, s, e[t], e[t + 1])+ if (0 === o.squaredDistance) {+ const r = t + o.along+ return void n.push({ coordinates: e, ring: i, startIndex: r, endIndex: r })+ }+ }+ }+ function iv(t, e) {+ return Le(t[0], t[1], e[0], e[1])+ }+ function nv(t, e, i) {+ let n, r+ e < i ? ((n = e), (r = i)) : ((n = i), (r = e))+ const s = Math.ceil(n),+ o = Math.floor(r)+ if (s > o) {+ return iv(Kx(t, n), Kx(t, r))+ }+ let a = 0+ if (n < s) {+ a += iv(Kx(t, n), Hx(t, s))+ }+ if (o < r) {+ a += iv(Hx(t, o), Kx(t, r))+ }+ for (let e = s; e < o - 1; ++e) {+ a += iv(Hx(t, e), Hx(t, e + 1))+ }+ return a+ }+ const rv = { along: 0, squaredDistance: 0 }+ function sv(t, e, i, n) {+ const r = i[0],+ s = i[1],+ o = n[0] - r,+ a = n[1] - s+ let l = 0,+ h = r,+ c = s+ return (+ (0 === o && 0 === a) ||+ ((l = Ie(((t - r) * o + (e - s) * a) / (o * o + a * a), 0, 1)), (h += o * l), (c += a * l)),+ (rv.along = l),+ (rv.squaredDistance = ke(Le(t, e, h, c), 10)),+ rv+ )+ }+ const ov = "drawstart",+ av = "drawend",+ lv = "drawabort"+ class hv extends M {+ constructor(t, e) {+ super(t), (this.feature = e)+ }+ }+ function cv() {+ const t = gc()+ return function (e, i) {+ return t[e.getGeometry().getType()]+ }+ }+ const uv = "extentchanged"+ class dv extends M {+ constructor(t) {+ super(uv), (this.extent = t)+ }+ }+ function gv() {+ const t = gc()+ return function (e, i) {+ return t.Polygon+ }+ }+ function fv() {+ const t = gc()+ return function (e, i) {+ return t.Point+ }+ }+ function pv(t) {+ return function (e) {+ return Bt([t, e])+ }+ }+ function _v(t, e) {+ return t[0] == e[0]+ ? function (i) {+ return Bt([t, [i[0], e[1]]])+ }+ : t[1] == e[1]+ ? function (i) {+ return Bt([t, [e[0], i[1]]])+ }+ : null+ }+ function mv(t) {+ return parseFloat(t)+ }+ function yv(t) {+ return (function (t) {+ return ke(t, 5)+ })(t).toString()+ }+ function xv(t, e) {+ return !isNaN(t) && t !== mv(yv(e))+ }+ const vv = [0, 0, 0, 0],+ Sv = [],+ Ev = "modifystart",+ wv = "modifyend"+ function Tv(t, e, i) {+ let n+ switch (e) {+ case "LineString":+ n = t+ break+ case "MultiLineString":+ case "Polygon":+ n = t[i[0]]+ break+ case "MultiPolygon":+ n = t[i[1]][i[0]]+ }+ return n+ }+ class Cv extends M {+ constructor(t, e, i) {+ super(t), (this.features = e), (this.mapBrowserEvent = i)+ }+ }+ function bv(t, e) {+ return t.index - e.index+ }+ function Rv(t, e, i) {+ const n = e.geometry+ if ("Circle" === n.getType()) {+ let r = n+ if (1 === e.index) {+ const e = Gn()+ e && (r = r.clone().transform(e, i))+ const n = ai(r.getCenter(), Un(t, i)),+ s = Math.sqrt(n) - r.getRadius()+ return s * s+ }+ }+ const r = Un(t, i)+ return (Sv[0] = Un(e.segment[0], i)), (Sv[1] = Un(e.segment[1], i)), hi(r, Sv)+ }+ function Pv(t, e, i) {+ const n = e.geometry+ if ("Circle" === n.getType() && 1 === e.index) {+ let e = n+ const r = Gn()+ return r && (e = e.clone().transform(r, i)), jn(e.getClosestPoint(Un(t, i)), i)+ }+ const r = Un(t, i)+ return (Sv[0] = Un(e.segment[0], i)), (Sv[1] = Un(e.segment[1], i)), jn(ei(r, Sv), i)+ }+ function Iv() {+ const t = gc()+ return function (e, i) {+ return t.Point+ }+ }+ const Fv = "select"+ class Lv extends M {+ constructor(t, e, i, n) {+ super(t), (this.selected = e), (this.deselected = i), (this.mapBrowserEvent = n)+ }+ }+ const Mv = {}+ class Av extends Ho {+ constructor(t) {+ let e+ if (+ (super(),+ this.on,+ this.once,+ this.un,+ (t = t || {}),+ (this.boundAddFeature_ = this.addFeature_.bind(this)),+ (this.boundRemoveFeature_ = this.removeFeature_.bind(this)),+ (this.condition_ = t.condition ? t.condition : aa),+ (this.addCondition_ = t.addCondition ? t.addCondition : oa),+ (this.removeCondition_ = t.removeCondition ? t.removeCondition : oa),+ (this.toggleCondition_ = t.toggleCondition ? t.toggleCondition : ca),+ (this.multi_ = !!t.multi && t.multi),+ (this.filter_ = t.filter ? t.filter : C),+ (this.hitTolerance_ = t.hitTolerance ? t.hitTolerance : 0),+ (this.style_ =+ void 0 !== t.style+ ? t.style+ : (function () {+ const t = gc()+ return (+ E(t.Polygon, t.LineString),+ E(t.GeometryCollection, t.LineString),+ function (e) {+ return e.getGeometry() ? t[e.getGeometry().getType()] : null+ }+ )+ })()),+ (this.features_ = t.features || new Z()),+ t.layers)+ )+ if ("function" == typeof t.layers) e = t.layers+ else {+ const i = t.layers+ e = function (t) {+ return i.includes(t)+ }+ }+ else e = C+ ;(this.layerFilter_ = e), (this.featureLayerAssociation_ = {})+ }+ addFeatureLayerAssociation_(t, e) {+ this.featureLayerAssociation_[z(t)] = e+ }+ getFeatures() {+ return this.features_+ }+ getHitTolerance() {+ return this.hitTolerance_+ }+ getLayer(t) {+ return this.featureLayerAssociation_[z(t)]+ }+ setHitTolerance(t) {+ this.hitTolerance_ = t+ }+ setMap(i) {+ this.getMap() && this.style_ && this.features_.forEach(this.restorePreviousStyle_.bind(this)),+ super.setMap(i),+ i+ ? (this.features_.addEventListener(t, this.boundAddFeature_),+ this.features_.addEventListener(e, this.boundRemoveFeature_),+ this.style_ && this.features_.forEach(this.applySelectedStyle_.bind(this)))+ : (this.features_.removeEventListener(t, this.boundAddFeature_),+ this.features_.removeEventListener(e, this.boundRemoveFeature_))+ }+ addFeature_(t) {+ const e = t.element+ if ((this.style_ && this.applySelectedStyle_(e), !this.getLayer(e))) {+ const t = this.findLayerOfFeature_(e)+ t && this.addFeatureLayerAssociation_(e, t)+ }+ }+ removeFeature_(t) {+ this.style_ && this.restorePreviousStyle_(t.element), this.removeFeatureLayerAssociation_(t.element)+ }+ findLayerOfFeature_(t) {+ return this.getMap()+ .getAllLayers()+ .find(function (e) {+ if (e instanceof Gx && e.getSource() && e.getSource().hasFeature(t)) return e+ })+ }+ getStyle() {+ return this.style_+ }+ applySelectedStyle_(t) {+ const e = z(t)+ e in Mv || (Mv[e] = t.getStyle()), t.setStyle(this.style_)+ }+ restorePreviousStyle_(t) {+ const e = this.getMap().getInteractions().getArray()+ for (let i = e.length - 1; i >= 0; --i) {+ const n = e[i]+ if (n !== this && n instanceof Av && n.getStyle() && -1 !== n.getFeatures().getArray().lastIndexOf(t))+ return void t.setStyle(n.getStyle())+ }+ const i = z(t)+ t.setStyle(Mv[i]), delete Mv[i]+ }+ removeFeatureLayerAssociation_(t) {+ delete this.featureLayerAssociation_[z(t)]+ }+ selectFeature(t) {+ const e = this.findLayerOfFeature_(t)+ if (!this.layerFilter_(e) || !this.filter_(t, e)) return !1+ const i = this.getFeatures()+ return (+ !i.getArray().includes(t) &&+ (this.addFeatureLayerAssociation_(t, e), i.push(t), this.dispatchEvent(new Lv(Fv, [t], [], void 0)), !0)+ )+ }+ deselectFeature(t) {+ const e = this.getFeatures(),+ i = e.getArray().indexOf(t)+ return -1 !== i && (e.removeAt(i), this.dispatchEvent(new Lv(Fv, [], [t], void 0)), !0)+ }+ toggleFeature(t) {+ this.deselectFeature(t) || this.selectFeature(t)+ }+ clearSelection() {+ const t = this.getFeatures()+ if (0 !== t.getLength()) {+ const e = t.getArray().slice()+ t.clear(), this.dispatchEvent(new Lv(Fv, [], e, void 0))+ }+ }+ handleEvent(t) {+ if (!this.condition_(t)) return !0+ const e = this.addCondition_(t),+ i = this.removeCondition_(t),+ n = this.toggleCondition_(t),+ r = !e && !i && !n,+ s = t.map,+ o = this.getFeatures(),+ a = [],+ l = []+ if (r) {+ s.forEachFeatureAtPixel(+ t.pixel,+ (t, e) => {+ if (t instanceof At && this.filter_(t, e))+ return this.addFeatureLayerAssociation_(t, e), l.push(t), !this.multi_+ },+ { layerFilter: this.layerFilter_, hitTolerance: this.hitTolerance_ }+ )+ for (let t = o.getLength() - 1; t >= 0; --t) {+ const e = o.item(t),+ i = l.indexOf(e)+ ;-1 === i ? (o.removeAt(t), a.push(e)) : l.splice(i, 1)+ }+ 0 !== l.length && o.extend(l)+ } else {+ s.forEachFeatureAtPixel(+ t.pixel,+ (t, r) => {+ if (!(t instanceof At && this.filter_(t, r))) return+ const s = o.getArray().includes(t)+ return (+ s && (i || n) ? a.push(t) : s || (!e && !n) || (this.addFeatureLayerAssociation_(t, r), l.push(t)),+ !this.multi_+ )+ },+ { layerFilter: this.layerFilter_, hitTolerance: this.hitTolerance_ }+ )+ for (let t = a.length - 1; t >= 0; --t) o.remove(a[t])+ o.extend(l)+ }+ return (l.length > 0 || a.length > 0) && this.dispatchEvent(new Lv(Fv, l, a, t)), !0+ }+ }+ const Ov = "snap",+ Dv = "unsnap"+ class Nv extends M {+ constructor(t, e) {+ super(t),+ (this.vertex = e.vertex),+ (this.vertexPixel = e.vertexPixel),+ (this.feature = e.feature),+ (this.segment = e.segment)+ }+ }+ const kv = {+ Circle(t, e) {+ let i = t+ const n = Gn()+ n && (i = i.clone().transform(n, e))+ const r = _s(i)+ return n && r.transform(e, n), kv.Polygon(r)+ },+ GeometryCollection(t, e) {+ const i = [],+ n = t.getGeometriesArray()+ for (let t = 0; t < n.length; ++t) {+ const r = this[n[t].getType()]+ r && i.push(r(n[t], e))+ }+ return i.flat()+ },+ LineString(t) {+ const e = [],+ i = t.getFlatCoordinates(),+ n = t.getStride()+ for (let t = 0, r = i.length - n; t < r; t += n) e.push([i.slice(t, t + 2), i.slice(t + n, t + n + 2)])+ return e+ },+ MultiLineString(t) {+ const e = [],+ i = t.getFlatCoordinates(),+ n = t.getStride(),+ r = t.getEnds()+ let s = 0+ for (let t = 0, o = r.length; t < o; ++t) {+ const o = r[t]+ for (let t = s, r = o - n; t < r; t += n) e.push([i.slice(t, t + 2), i.slice(t + n, t + n + 2)])+ s = o+ }+ return e+ },+ MultiPoint(t) {+ const e = [],+ i = t.getFlatCoordinates(),+ n = t.getStride()+ for (let t = 0, r = i.length; t < r; t += n) e.push([i.slice(t, t + 2)])+ return e+ },+ MultiPolygon(t) {+ const e = [],+ i = t.getFlatCoordinates(),+ n = t.getStride(),+ r = t.getEndss()+ let s = 0+ for (let t = 0, o = r.length; t < o; ++t) {+ const o = r[t]+ for (let t = 0, r = o.length; t < r; ++t) {+ const r = o[t]+ for (let t = s, o = r - n; t < o; t += n) e.push([i.slice(t, t + 2), i.slice(t + n, t + n + 2)])+ s = r+ }+ }+ return e+ },+ Point: (t) => [[t.getFlatCoordinates().slice(0, 2)]],+ Polygon(t) {+ const e = [],+ i = t.getFlatCoordinates(),+ n = t.getStride(),+ r = t.getEnds()+ let s = 0+ for (let t = 0, o = r.length; t < o; ++t) {+ const o = r[t]+ for (let t = s, r = o - n; t < r; t += n) e.push([i.slice(t, t + 2), i.slice(t + n, t + n + 2)])+ s = o+ }+ return e+ }+ }+ function Gv(t) {+ return t.feature ? t.feature : t.element ? t.element : null+ }+ const jv = [],+ Uv = [],+ Bv = []+ const zv = "translatestart",+ Xv = "translating",+ Vv = "translateend"+ class $v extends M {+ constructor(t, e, i, n, r) {+ super(t), (this.features = e), (this.coordinate = i), (this.startCoordinate = n), (this.mapBrowserEvent = r)+ }+ }+ function Wv(t, e, i, n, r, s) {+ void 0 !== r ? (s = void 0 !== s ? s : 0) : ((r = []), (s = 0))+ let o = e+ for (; o < i; ) {+ const e = t[o++]+ ;(r[s++] = t[o++]), (r[s++] = e)+ for (let e = 2; e < n; ++e) r[s++] = t[o++]+ }+ return (r.length = s), r+ }+ class Zv {+ constructor() {+ ;(this.dataProjection = void 0),+ (this.defaultFeatureProjection = void 0),+ (this.featureClass = At),+ (this.supportedMediaTypes = null)+ }+ getReadOptions(t, e) {+ if (e) {+ let i = e.dataProjection ? En(e.dataProjection) : this.readProjection(t)+ e.extent && i && "tile-pixels" === i.getUnits() && ((i = En(i)), i.setWorldExtent(e.extent)),+ (e = { dataProjection: i, featureProjection: e.featureProjection })+ }+ return this.adaptOptions(e)+ }+ adaptOptions(t) {+ return Object.assign(+ {+ dataProjection: this.dataProjection,+ featureProjection: this.defaultFeatureProjection,+ featureClass: this.featureClass+ },+ t+ )+ }+ getType() {+ return U()+ }+ readFeature(t, e) {+ return U()+ }+ readFeatures(t, e) {+ return U()+ }+ readGeometry(t, e) {+ return U()+ }+ readProjection(t) {+ return U()+ }+ writeFeature(t, e) {+ return U()+ }+ writeFeatures(t, e) {+ return U()+ }+ writeGeometry(t, e) {+ return U()+ }+ }+ function Yv(t, e, i) {+ const n = i ? En(i.featureProjection) : null,+ r = i ? En(i.dataProjection) : null+ let s = t+ if (n && r && !Fn(n, r)) {+ e && (s = t.clone())+ const i = e ? n : r,+ o = e ? r : n+ "tile-pixels" === i.getUnits() ? s.transform(i, o) : s.applyTransform(An(i, o))+ }+ if (e && i && void 0 !== i.decimals) {+ const e = Math.pow(10, i.decimals),+ n = function (t) {+ for (let i = 0, n = t.length; i < n; ++i) t[i] = Math.round(t[i] * e) / e+ return t+ }+ s === t && (s = t.clone()), s.applyTransform(n)+ }+ return s+ }+ function Hv(t, e) {+ const i = e ? En(e.featureProjection) : null,+ n = e ? En(e.dataProjection) : null+ return i && n && !Fn(i, n) ? Dn(t, n, i) : t+ }+ const Kv = { Point: Wr, LineString: Dd, Polygon: gs, MultiPoint: kd, MultiLineString: Nd, MultiPolygon: Gd }+ function qv(t, e) {+ const i = t.geometry+ if (!i) return []+ if (Array.isArray(i)) return i.map((e) => qv({ ...t, geometry: e })).flat()+ const n = "MultiPolygon" === i.type ? "Polygon" : i.type+ if ("GeometryCollection" === n || "Circle" === n) throw new Error("Unsupported geometry type: " + n)+ const r = i.layout.length+ return Yv(+ new Ud(+ n,+ "Polygon" === n+ ? (function (t, e, i) {+ return Array.isArray(e[0])+ ? (hs(t, 0, e, i) || us((t = t.slice()), 0, e, i), t)+ : (ls(t, 0, e, i) || cs((t = t.slice()), 0, e, i), t)+ })(i.flatCoordinates, i.ends, r)+ : i.flatCoordinates,+ i.ends?.flat(),+ r,+ t.properties || {},+ t.id+ ).enableSimplifyTransformed(),+ !1,+ e+ )+ }+ function Jv(t, e) {+ if (!t) return null+ if (Array.isArray(t)) {+ const i = t.map((t) => Jv(t, e))+ return new Md(i)+ }+ return Yv(new (0, Kv[t.type])(t.flatCoordinates, t.layout || "XY", t.ends), !1, e)+ }+ class Qv extends Zv {+ constructor() {+ super()+ }+ getType() {+ return "json"+ }+ readFeature(t, e) {+ return this.readFeatureFromObject(tS(t), this.getReadOptions(t, e))+ }+ readFeatures(t, e) {+ return this.readFeaturesFromObject(tS(t), this.getReadOptions(t, e))+ }+ readFeatureFromObject(t, e) {+ return U()+ }+ readFeaturesFromObject(t, e) {+ return U()+ }+ readGeometry(t, e) {+ return this.readGeometryFromObject(tS(t), this.getReadOptions(t, e))+ }+ readGeometryFromObject(t, e) {+ return U()+ }+ readProjection(t) {+ return this.readProjectionFromObject(tS(t))+ }+ readProjectionFromObject(t) {+ return U()+ }+ writeFeature(t, e) {+ return JSON.stringify(this.writeFeatureObject(t, e))+ }+ writeFeatureObject(t, e) {+ return U()+ }+ writeFeatures(t, e) {+ return JSON.stringify(this.writeFeaturesObject(t, e))+ }+ writeFeaturesObject(t, e) {+ return U()+ }+ writeGeometry(t, e) {+ return JSON.stringify(this.writeGeometryObject(t, e))+ }+ writeGeometryObject(t, e) {+ return U()+ }+ }+ function tS(t) {+ if ("string" == typeof t) {+ const e = JSON.parse(t)+ return e || null+ }+ return null !== t ? t : null+ }+ const eS = {+ Point: function (t) {+ let e+ e =+ void 0 !== t.m && void 0 !== t.z+ ? new Wr([t.x, t.y, t.z, t.m], "XYZM")+ : void 0 !== t.z+ ? new Wr([t.x, t.y, t.z], "XYZ")+ : void 0 !== t.m+ ? new Wr([t.x, t.y, t.m], "XYM")+ : new Wr([t.x, t.y])+ return e+ },+ LineString: function (t) {+ const e = rS(t)+ return new Dd(t.paths[0], e)+ },+ Polygon: function (t) {+ const e = rS(t)+ return new gs(t.rings, e)+ },+ MultiPoint: function (t) {+ const e = rS(t)+ return new kd(t.points, e)+ },+ MultiLineString: function (t) {+ const e = rS(t)+ return new Nd(t.paths, e)+ },+ MultiPolygon: function (t) {+ const e = rS(t)+ return new Gd(t.rings, e)+ }+ },+ iS = {+ Point: function (t, e) {+ const i = t.getCoordinates()+ let n+ const r = t.getLayout()+ if ("XYZ" === r) n = { x: i[0], y: i[1], z: i[2] }+ else if ("XYM" === r) n = { x: i[0], y: i[1], m: i[2] }+ else if ("XYZM" === r) n = { x: i[0], y: i[1], z: i[2], m: i[3] }+ else {+ if ("XY" !== r) throw new Error("Invalid geometry layout")+ n = { x: i[0], y: i[1] }+ }+ return n+ },+ LineString: function (t, e) {+ const i = sS(t)+ return { hasZ: i.hasZ, hasM: i.hasM, paths: [t.getCoordinates()] }+ },+ Polygon: function (t, e) {+ const i = sS(t)+ return { hasZ: i.hasZ, hasM: i.hasM, rings: t.getCoordinates(!1) }+ },+ MultiPoint: function (t, e) {+ const i = sS(t)+ return { hasZ: i.hasZ, hasM: i.hasM, points: t.getCoordinates() }+ },+ MultiLineString: function (t, e) {+ const i = sS(t)+ return { hasZ: i.hasZ, hasM: i.hasM, paths: t.getCoordinates() }+ },+ MultiPolygon: function (t, e) {+ const i = sS(t),+ n = t.getCoordinates(!1),+ r = []+ for (let t = 0; t < n.length; t++) for (let e = n[t].length - 1; e >= 0; e--) r.push(n[t][e])+ return { hasZ: i.hasZ, hasM: i.hasM, rings: r }+ }+ }+ function nS(t, e) {+ if (!t) return null+ let i+ if ("number" == typeof t.x && "number" == typeof t.y) i = "Point"+ else if (t.points) i = "MultiPoint"+ else if (t.paths) {+ i = 1 === t.paths.length ? "LineString" : "MultiLineString"+ } else if (t.rings) {+ const e = t,+ n = rS(e),+ r = (function (t, e) {+ const i = [],+ n = [],+ r = []+ let s, o+ for (s = 0, o = t.length; s < o; ++s) {+ ;(i.length = 0), Mr(i, 0, t[s], e.length)+ as(i, 0, i.length, e.length) ? n.push([t[s]]) : r.push(t[s])+ }+ for (; r.length; ) {+ const t = r.shift()+ let e = !1+ for (s = n.length - 1; s >= 0; s--) {+ const i = n[s][0]+ if (Wt(new $r(i).getExtent(), new $r(t).getExtent())) {+ n[s].push(t), (e = !0)+ break+ }+ }+ e || n.push([t.reverse()])+ }+ return n+ })(e.rings, n)+ 1 === r.length+ ? ((i = "Polygon"), (t = Object.assign({}, t, { rings: r[0] })))+ : ((i = "MultiPolygon"), (t = Object.assign({}, t, { rings: r })))+ }+ return Yv((0, eS[i])(t), !1, e)+ }+ function rS(t) {+ let e = "XY"+ return !0 === t.hasZ && !0 === t.hasM ? (e = "XYZM") : !0 === t.hasZ ? (e = "XYZ") : !0 === t.hasM && (e = "XYM"), e+ }+ function sS(t) {+ const e = t.getLayout()+ return { hasZ: "XYZ" === e || "XYZM" === e, hasM: "XYM" === e || "XYZM" === e }+ }+ function oS(t, e) {+ return (0, iS[t.getType()])(Yv(t, !0, e), e)+ }+ class aS extends Zv {+ constructor() {+ super(), (this.xmlSerializer_ = Pp())+ }+ getType() {+ return "xml"+ }+ readFeature(t, e) {+ if (!t) return null+ if ("string" == typeof t) {+ const i = cp(t)+ return this.readFeatureFromDocument(i, e)+ }+ return lp(t) ? this.readFeatureFromDocument(t, e) : this.readFeatureFromNode(t, e)+ }+ readFeatureFromDocument(t, e) {+ const i = this.readFeaturesFromDocument(t, e)+ return i.length > 0 ? i[0] : null+ }+ readFeatureFromNode(t, e) {+ return null+ }+ readFeatures(t, e) {+ if (!t) return []+ if ("string" == typeof t) {+ const i = cp(t)+ return this.readFeaturesFromDocument(i, e)+ }+ return lp(t) ? this.readFeaturesFromDocument(t, e) : this.readFeaturesFromNode(t, e)+ }+ readFeaturesFromDocument(t, e) {+ const i = []+ for (let n = t.firstChild; n; n = n.nextSibling)+ n.nodeType == Node.ELEMENT_NODE && E(i, this.readFeaturesFromNode(n, e))+ return i+ }+ readFeaturesFromNode(t, e) {+ return U()+ }+ readGeometry(t, e) {+ if (!t) return null+ if ("string" == typeof t) {+ const i = cp(t)+ return this.readGeometryFromDocument(i, e)+ }+ return lp(t) ? this.readGeometryFromDocument(t, e) : this.readGeometryFromNode(t, e)+ }+ readGeometryFromDocument(t, e) {+ return null+ }+ readGeometryFromNode(t, e) {+ return null+ }+ readProjection(t) {+ if (!t) return null+ if ("string" == typeof t) {+ const e = cp(t)+ return this.readProjectionFromDocument(e)+ }+ return lp(t) ? this.readProjectionFromDocument(t) : this.readProjectionFromNode(t)+ }+ readProjectionFromDocument(t) {+ return this.dataProjection+ }+ readProjectionFromNode(t) {+ return this.dataProjection+ }+ writeFeature(t, e) {+ const i = this.writeFeatureNode(t, e)+ return this.xmlSerializer_.serializeToString(i)+ }+ writeFeatureNode(t, e) {+ return null+ }+ writeFeatures(t, e) {+ const i = this.writeFeaturesNode(t, e)+ return this.xmlSerializer_.serializeToString(i)+ }+ writeFeaturesNode(t, e) {+ return null+ }+ writeGeometry(t, e) {+ const i = this.writeGeometryNode(t, e)+ return this.xmlSerializer_.serializeToString(i)+ }+ writeGeometryNode(t, e) {+ return null+ }+ }+ const lS = "http://www.opengis.net/gml",+ hS = /^\s*$/+ class cS extends aS {+ constructor(t) {+ super(),+ (t = t || {}),+ (this.featureType = t.featureType),+ (this.featureNS = t.featureNS),+ (this.srsName = t.srsName),+ (this.schemaLocation = ""),+ (this.FEATURE_COLLECTION_PARSERS = {}),+ (this.FEATURE_COLLECTION_PARSERS[this.namespace] = {+ featureMember: dp(this.readFeaturesInternal),+ featureMembers: gp(this.readFeaturesInternal)+ }),+ (this.supportedMediaTypes = ["application/gml+xml"])+ }+ readFeaturesInternal(t, e) {+ const i = t.localName+ let n = null+ if ("FeatureCollection" == i) n = wp([], this.FEATURE_COLLECTION_PARSERS, t, e, this)+ else if ("featureMembers" == i || "featureMember" == i || "member" == i) {+ const r = e[0]+ let s = r.featureType,+ o = r.featureNS+ const a = "p",+ l = "p0"+ if (!s && t.childNodes) {+ ;(s = []), (o = {})+ for (let e = 0, i = t.childNodes.length; e < i; ++e) {+ const i = t.childNodes[e]+ if (1 === i.nodeType) {+ const t = i.nodeName.split(":").pop()+ if (!s.includes(t)) {+ let e = "",+ n = 0+ const r = i.namespaceURI+ for (const t in o) {+ if (o[t] === r) {+ e = t+ break+ }+ ++n+ }+ e || ((e = a + n), (o[e] = r)), s.push(e + ":" + t)+ }+ }+ }+ "featureMember" != i && ((r.featureType = s), (r.featureNS = o))+ }+ if ("string" == typeof o) {+ const t = o+ ;(o = {}), (o[l] = t)+ }+ const h = {},+ c = Array.isArray(s) ? s : [s]+ for (const t in o) {+ const e = {}+ for (let n = 0, r = c.length; n < r; ++n) {+ ;(c[n].includes(":") ? c[n].split(":")[0] : l) === t &&+ (e[c[n].split(":").pop()] =+ "featureMembers" == i ? dp(this.readFeatureElement, this) : gp(this.readFeatureElement, this))+ }+ h[o[t]] = e+ }+ n = wp("featureMember" == i || "member" == i ? void 0 : [], h, t, e)+ }+ return null === n && (n = []), n+ }+ readGeometryOrExtent(t, e) {+ const i = e[0]+ return (+ (i.srsName = t.firstElementChild.getAttribute("srsName")),+ (i.srsDimension = t.firstElementChild.getAttribute("srsDimension")),+ wp(null, this.GEOMETRY_PARSERS, t, e, this)+ )+ }+ readExtentElement(t, e) {+ const i = e[0],+ n = this.readGeometryOrExtent(t, e)+ return n ? Hv(n, i) : void 0+ }+ readGeometryElement(t, e) {+ const i = e[0],+ n = this.readGeometryOrExtent(t, e)+ return n ? Yv(n, !1, i) : void 0+ }+ readFeatureElementInternal(t, e, i) {+ let n+ const r = {}+ for (let s = t.firstElementChild; s; s = s.nextElementSibling) {+ let t+ const o = s.localName+ 0 === s.childNodes.length ||+ (1 === s.childNodes.length && (3 === s.firstChild.nodeType || 4 === s.firstChild.nodeType))+ ? ((t = op(s, !1)), hS.test(t) && (t = void 0))+ : (i && (t = "boundedBy" === o ? this.readExtentElement(s, e) : this.readGeometryElement(s, e)),+ t ? "boundedBy" !== o && (n = o) : (t = this.readFeatureElementInternal(s, e, !1)))+ const a = s.attributes.length+ if (a > 0 && !(t instanceof _r)) {+ t = { _content_: t }+ for (let e = 0; e < a; e++) {+ t[s.attributes[e].name] = s.attributes[e].value+ }+ }+ r[o] ? (r[o] instanceof Array || (r[o] = [r[o]]), r[o].push(t)) : (r[o] = t)+ }+ if (!i) return r+ const s = new At(r)+ n && s.setGeometryName(n)+ const o = t.getAttribute("fid") || hp(t, this.namespace, "id")+ return o && s.setId(o), s+ }+ readFeatureElement(t, e) {+ return this.readFeatureElementInternal(t, e, !0)+ }+ readPoint(t, e) {+ const i = this.readFlatCoordinatesFromNode(t, e)+ if (i) return new Wr(i, "XYZ")+ }+ readMultiPoint(t, e) {+ const i = wp([], this.MULTIPOINT_PARSERS, t, e, this)+ if (i) return new kd(i)+ }+ readMultiLineString(t, e) {+ const i = wp([], this.MULTILINESTRING_PARSERS, t, e, this)+ if (i) return new Nd(i)+ }+ readMultiPolygon(t, e) {+ const i = wp([], this.MULTIPOLYGON_PARSERS, t, e, this)+ if (i) return new Gd(i)+ }+ pointMemberParser(t, e) {+ Ep(this.POINTMEMBER_PARSERS, t, e, this)+ }+ lineStringMemberParser(t, e) {+ Ep(this.LINESTRINGMEMBER_PARSERS, t, e, this)+ }+ polygonMemberParser(t, e) {+ Ep(this.POLYGONMEMBER_PARSERS, t, e, this)+ }+ readLineString(t, e) {+ const i = this.readFlatCoordinatesFromNode(t, e)+ if (i) {+ return new Dd(i, "XYZ")+ }+ }+ readFlatLinearRing(t, e) {+ const i = wp(null, this.GEOMETRY_FLAT_COORDINATES_PARSERS, t, e, this)+ if (i) return i+ }+ readLinearRing(t, e) {+ const i = this.readFlatCoordinatesFromNode(t, e)+ if (i) return new $r(i, "XYZ")+ }+ readPolygon(t, e) {+ const i = wp([null], this.FLAT_LINEAR_RINGS_PARSERS, t, e, this)+ if (i && i[0]) {+ const t = i[0],+ e = [t.length]+ let n, r+ for (n = 1, r = i.length; n < r; ++n) E(t, i[n]), e.push(t.length)+ return new gs(t, "XYZ", e)+ }+ }+ readFlatCoordinatesFromNode(t, e) {+ return wp(null, this.GEOMETRY_FLAT_COORDINATES_PARSERS, t, e, this)+ }+ readGeometryFromNode(t, e) {+ const i = this.readGeometryElement(t, [this.getReadOptions(t, e || {})])+ return i || null+ }+ readFeaturesFromNode(t, e) {+ const i = { featureType: this.featureType, featureNS: this.featureNS }+ i && Object.assign(i, this.getReadOptions(t, e))+ return this.readFeaturesInternal(t, [i]) || []+ }+ readProjectionFromNode(t) {+ return En(this.srsName ? this.srsName : t.firstElementChild.getAttribute("srsName"))+ }+ }+ function uS(t) {+ return dS(op(t, !1))+ }+ function dS(t) {+ const e = /^\s*(true|1)|(false|0)\s*$/.exec(t)+ if (e) return void 0 !== e[1] || !1+ }+ function gS(t) {+ const e = op(t, !1),+ i = Date.parse(e)+ return isNaN(i) ? void 0 : i / 1e3+ }+ function fS(t) {+ return pS(op(t, !1))+ }+ function pS(t) {+ const e = /^\s*([+\-]?\d*\.?\d+(?:e[+\-]?\d+)?)\s*$/i.exec(t)+ if (e) return parseFloat(e[1])+ }+ function _S(t) {+ return mS(op(t, !1))+ }+ function mS(t) {+ const e = /^\s*(\d+)\s*$/.exec(t)+ if (e) return parseInt(e[1], 10)+ }+ function yS(t) {+ return op(t, !1).trim()+ }+ function xS(t, e) {+ RS(t, e ? "1" : "0")+ }+ function vS(t, e) {+ t.appendChild(Ip().createCDATASection(e))+ }+ function SS(t, e) {+ const i = new Date(1e3 * e),+ n =+ i.getUTCFullYear() ++ "-" ++ qe(i.getUTCMonth() + 1, 2) ++ "-" ++ qe(i.getUTCDate(), 2) ++ "T" ++ qe(i.getUTCHours(), 2) ++ ":" ++ qe(i.getUTCMinutes(), 2) ++ ":" ++ qe(i.getUTCSeconds(), 2) ++ "Z"+ t.appendChild(Ip().createTextNode(n))+ }+ function ES(t, e) {+ const i = e.toPrecision()+ t.appendChild(Ip().createTextNode(i))+ }+ function wS(t, e) {+ const i = e.toString()+ t.appendChild(Ip().createTextNode(i))+ }+ ;(cS.prototype.namespace = lS),+ (cS.prototype.FLAT_LINEAR_RINGS_PARSERS = { "http://www.opengis.net/gml": {} }),+ (cS.prototype.GEOMETRY_FLAT_COORDINATES_PARSERS = { "http://www.opengis.net/gml": {} }),+ (cS.prototype.GEOMETRY_PARSERS = { "http://www.opengis.net/gml": {} }),+ (cS.prototype.MULTIPOINT_PARSERS = {+ "http://www.opengis.net/gml": {+ pointMember: dp(cS.prototype.pointMemberParser),+ pointMembers: dp(cS.prototype.pointMemberParser)+ }+ }),+ (cS.prototype.MULTILINESTRING_PARSERS = {+ "http://www.opengis.net/gml": {+ lineStringMember: dp(cS.prototype.lineStringMemberParser),+ lineStringMembers: dp(cS.prototype.lineStringMemberParser)+ }+ }),+ (cS.prototype.MULTIPOLYGON_PARSERS = {+ "http://www.opengis.net/gml": {+ polygonMember: dp(cS.prototype.polygonMemberParser),+ polygonMembers: dp(cS.prototype.polygonMemberParser)+ }+ }),+ (cS.prototype.POINTMEMBER_PARSERS = {+ "http://www.opengis.net/gml": { Point: dp(cS.prototype.readFlatCoordinatesFromNode) }+ }),+ (cS.prototype.LINESTRINGMEMBER_PARSERS = {+ "http://www.opengis.net/gml": { LineString: dp(cS.prototype.readLineString) }+ }),+ (cS.prototype.POLYGONMEMBER_PARSERS = { "http://www.opengis.net/gml": { Polygon: dp(cS.prototype.readPolygon) } }),+ (cS.prototype.RING_PARSERS = { "http://www.opengis.net/gml": { LinearRing: gp(cS.prototype.readFlatLinearRing) } })+ const TS = /^\s/,+ CS = /\s$/,+ bS = /(\n|\t|\r|<|&| {2})/+ function RS(t, e) {+ "string" == typeof e && (TS.test(e) || CS.test(e) || bS.test(e))+ ? e.split("]]>").forEach((e, i, n) => {+ i < n.length - 1 && (e += "]]"), i > 0 && (e = ">" + e), vS(t, e)+ })+ : t.appendChild(Ip().createTextNode(e))+ }+ const PS = lS + " http://schemas.opengis.net/gml/2.1.2/feature.xsd",+ IS = {+ MultiLineString: "lineStringMember",+ MultiCurve: "curveMember",+ MultiPolygon: "polygonMember",+ MultiSurface: "surfaceMember"+ }+ class FS extends cS {+ constructor(t) {+ super((t = t || {})),+ (this.FEATURE_COLLECTION_PARSERS[lS].featureMember = dp(this.readFeaturesInternal)),+ (this.schemaLocation = t.schemaLocation ? t.schemaLocation : PS)+ }+ readFlatCoordinates(t, e) {+ const i = op(t, !1).replace(/^\s*|\s*$/g, ""),+ n = e[0].srsName+ let r = "enu"+ if (n) {+ const t = En(n)+ t && (r = t.getAxisOrientation())+ }+ const s = i.trim().split(/\s+/),+ o = []+ for (let t = 0, e = s.length; t < e; t++) {+ const e = s[t].split(/,+/),+ i = parseFloat(e[0]),+ n = parseFloat(e[1]),+ a = 3 === e.length ? parseFloat(e[2]) : 0+ r.startsWith("en") ? o.push(i, n, a) : o.push(n, i, a)+ }+ return o+ }+ readBox(t, e) {+ const i = wp([null], this.BOX_PARSERS_, t, e, this)+ return Kt(i[1][0], i[1][1], i[1][3], i[1][4])+ }+ innerBoundaryIsParser(t, e) {+ const i = wp(void 0, this.RING_PARSERS, t, e, this)+ if (i) {+ e[e.length - 1].push(i)+ }+ }+ outerBoundaryIsParser(t, e) {+ const i = wp(void 0, this.RING_PARSERS, t, e, this)+ if (i) {+ e[e.length - 1][0] = i+ }+ }+ GEOMETRY_NODE_FACTORY_(t, e, i) {+ const n = e[e.length - 1],+ r = n.multiSurface,+ s = n.surface,+ o = n.multiCurve+ return (+ Array.isArray(t)+ ? (i = "Envelope")+ : "MultiPolygon" === (i = t.getType()) && !0 === r+ ? (i = "MultiSurface")+ : "Polygon" === i && !0 === s+ ? (i = "Surface")+ : "MultiLineString" === i && !0 === o && (i = "MultiCurve"),+ sp("http://www.opengis.net/gml", i)+ )+ }+ writeFeatureElement(t, e, i) {+ const n = e.getId()+ n && t.setAttribute("fid", n)+ const r = i[i.length - 1],+ s = r.featureNS,+ o = e.getGeometryName()+ r.serializers || ((r.serializers = {}), (r.serializers[s] = {}))+ const a = [],+ l = []+ if (e.hasProperties()) {+ const t = e.getProperties()+ for (const e in t) {+ const i = t[e]+ null != i &&+ (a.push(e),+ l.push(i),+ e == o || "function" == typeof i.getSimplifiedGeometry+ ? e in r.serializers[s] || (r.serializers[s][e] = _p(this.writeGeometryElement, this))+ : e in r.serializers[s] || (r.serializers[s][e] = _p(RS)))+ }+ }+ const h = Object.assign({}, r)+ ;(h.node = t), Cp(h, r.serializers, yp(void 0, s), l, i, a)+ }+ writeCurveOrLineString(t, e, i) {+ const n = i[i.length - 1].srsName+ if (+ ("LineStringSegment" !== t.nodeName && n && t.setAttribute("srsName", n),+ "LineString" === t.nodeName || "LineStringSegment" === t.nodeName)+ ) {+ const n = this.createCoordinatesNode_(t.namespaceURI)+ t.appendChild(n), this.writeCoordinates_(n, e, i)+ } else if ("Curve" === t.nodeName) {+ const n = sp(t.namespaceURI, "segments")+ t.appendChild(n), this.writeCurveSegments_(n, e, i)+ }+ }+ writeLineStringOrCurveMember(t, e, i) {+ const n = this.GEOMETRY_NODE_FACTORY_(e, i)+ n && (t.appendChild(n), this.writeCurveOrLineString(n, e, i))+ }+ writeMultiCurveOrLineString(t, e, i) {+ const n = i[i.length - 1],+ r = n.hasZ,+ s = n.srsName,+ o = n.curve+ s && t.setAttribute("srsName", s)+ const a = e.getLineStrings()+ Cp(+ { node: t, hasZ: r, srsName: s, curve: o },+ this.LINESTRINGORCURVEMEMBER_SERIALIZERS,+ this.MULTIGEOMETRY_MEMBER_NODE_FACTORY_,+ a,+ i,+ void 0,+ this+ )+ }+ writeGeometryElement(t, e, i) {+ const n = i[i.length - 1],+ r = Object.assign({}, n)+ let s+ ;(r.node = t),+ (s = Array.isArray(e) ? Hv(e, n) : Yv(e, !0, n)),+ Cp(r, this.GEOMETRY_SERIALIZERS, this.GEOMETRY_NODE_FACTORY_, [s], i, void 0, this)+ }+ createCoordinatesNode_(t) {+ const e = sp(t, "coordinates")+ return e.setAttribute("decimal", "."), e.setAttribute("cs", ","), e.setAttribute("ts", " "), e+ }+ writeCoordinates_(t, e, i) {+ const n = i[i.length - 1],+ r = n.hasZ,+ s = n.srsName,+ o = e.getCoordinates(),+ a = o.length,+ l = new Array(a)+ for (let t = 0; t < a; ++t) {+ const e = o[t]+ l[t] = this.getCoords_(e, s, r)+ }+ RS(t, l.join(" "))+ }+ writeCurveSegments_(t, e, i) {+ const n = sp(t.namespaceURI, "LineStringSegment")+ t.appendChild(n), this.writeCurveOrLineString(n, e, i)+ }+ writeSurfaceOrPolygon(t, e, i) {+ const n = i[i.length - 1],+ r = n.hasZ,+ s = n.srsName+ if (+ ("PolygonPatch" !== t.nodeName && s && t.setAttribute("srsName", s),+ "Polygon" === t.nodeName || "PolygonPatch" === t.nodeName)+ ) {+ const n = e.getLinearRings()+ Cp({ node: t, hasZ: r, srsName: s }, this.RING_SERIALIZERS, this.RING_NODE_FACTORY_, n, i, void 0, this)+ } else if ("Surface" === t.nodeName) {+ const n = sp(t.namespaceURI, "patches")+ t.appendChild(n), this.writeSurfacePatches_(n, e, i)+ }+ }+ RING_NODE_FACTORY_(t, e, i) {+ const n = e[e.length - 1],+ r = n.node,+ s = n.exteriorWritten+ return (+ void 0 === s && (n.exteriorWritten = !0),+ sp(r.namespaceURI, void 0 !== s ? "innerBoundaryIs" : "outerBoundaryIs")+ )+ }+ writeSurfacePatches_(t, e, i) {+ const n = sp(t.namespaceURI, "PolygonPatch")+ t.appendChild(n), this.writeSurfaceOrPolygon(n, e, i)+ }+ writeRing(t, e, i) {+ const n = sp(t.namespaceURI, "LinearRing")+ t.appendChild(n), this.writeLinearRing(n, e, i)+ }+ getCoords_(t, e, i) {+ let n = (e ? En(e).getAxisOrientation() : "enu").startsWith("en") ? t[0] + "," + t[1] : t[1] + "," + t[0]+ if (i) {+ n += "," + (t[2] || 0)+ }+ return n+ }+ writePoint(t, e, i) {+ const n = i[i.length - 1],+ r = n.hasZ,+ s = n.srsName+ s && t.setAttribute("srsName", s)+ const o = this.createCoordinatesNode_(t.namespaceURI)+ t.appendChild(o)+ const a = e.getCoordinates()+ RS(o, this.getCoords_(a, s, r))+ }+ writeMultiPoint(t, e, i) {+ const n = i[i.length - 1],+ r = n.hasZ,+ s = n.srsName+ s && t.setAttribute("srsName", s)+ const o = e.getPoints()+ Cp({ node: t, hasZ: r, srsName: s }, this.POINTMEMBER_SERIALIZERS, yp("pointMember"), o, i, void 0, this)+ }+ writePointMember(t, e, i) {+ const n = sp(t.namespaceURI, "Point")+ t.appendChild(n), this.writePoint(n, e, i)+ }+ writeLinearRing(t, e, i) {+ const n = i[i.length - 1].srsName+ n && t.setAttribute("srsName", n)+ const r = this.createCoordinatesNode_(t.namespaceURI)+ t.appendChild(r), this.writeCoordinates_(r, e, i)+ }+ writeMultiSurfaceOrPolygon(t, e, i) {+ const n = i[i.length - 1],+ r = n.hasZ,+ s = n.srsName,+ o = n.surface+ s && t.setAttribute("srsName", s)+ const a = e.getPolygons()+ Cp(+ { node: t, hasZ: r, srsName: s, surface: o },+ this.SURFACEORPOLYGONMEMBER_SERIALIZERS,+ this.MULTIGEOMETRY_MEMBER_NODE_FACTORY_,+ a,+ i,+ void 0,+ this+ )+ }+ writeSurfaceOrPolygonMember(t, e, i) {+ const n = this.GEOMETRY_NODE_FACTORY_(e, i)+ n && (t.appendChild(n), this.writeSurfaceOrPolygon(n, e, i))+ }+ writeEnvelope(t, e, i) {+ const n = i[i.length - 1].srsName+ n && t.setAttribute("srsName", n)+ const r = [e[0] + " " + e[1], e[2] + " " + e[3]]+ Cp({ node: t }, this.ENVELOPE_SERIALIZERS, xp, r, i, ["lowerCorner", "upperCorner"], this)+ }+ MULTIGEOMETRY_MEMBER_NODE_FACTORY_(t, e, i) {+ const n = e[e.length - 1].node+ return sp("http://www.opengis.net/gml", IS[n.nodeName])+ }+ }+ ;(FS.prototype.GEOMETRY_FLAT_COORDINATES_PARSERS = {+ "http://www.opengis.net/gml": { coordinates: gp(FS.prototype.readFlatCoordinates) }+ }),+ (FS.prototype.FLAT_LINEAR_RINGS_PARSERS = {+ "http://www.opengis.net/gml": {+ innerBoundaryIs: FS.prototype.innerBoundaryIsParser,+ outerBoundaryIs: FS.prototype.outerBoundaryIsParser+ }+ }),+ (FS.prototype.BOX_PARSERS_ = {+ "http://www.opengis.net/gml": { coordinates: dp(FS.prototype.readFlatCoordinates) }+ }),+ (FS.prototype.GEOMETRY_PARSERS = {+ "http://www.opengis.net/gml": {+ Point: gp(cS.prototype.readPoint),+ MultiPoint: gp(cS.prototype.readMultiPoint),+ LineString: gp(cS.prototype.readLineString),+ MultiLineString: gp(cS.prototype.readMultiLineString),+ LinearRing: gp(cS.prototype.readLinearRing),+ Polygon: gp(cS.prototype.readPolygon),+ MultiPolygon: gp(cS.prototype.readMultiPolygon),+ Box: gp(FS.prototype.readBox)+ }+ }),+ (FS.prototype.GEOMETRY_SERIALIZERS = {+ "http://www.opengis.net/gml": {+ Curve: _p(FS.prototype.writeCurveOrLineString),+ MultiCurve: _p(FS.prototype.writeMultiCurveOrLineString),+ Point: _p(FS.prototype.writePoint),+ MultiPoint: _p(FS.prototype.writeMultiPoint),+ LineString: _p(FS.prototype.writeCurveOrLineString),+ MultiLineString: _p(FS.prototype.writeMultiCurveOrLineString),+ LinearRing: _p(FS.prototype.writeLinearRing),+ Polygon: _p(FS.prototype.writeSurfaceOrPolygon),+ MultiPolygon: _p(FS.prototype.writeMultiSurfaceOrPolygon),+ Surface: _p(FS.prototype.writeSurfaceOrPolygon),+ MultiSurface: _p(FS.prototype.writeMultiSurfaceOrPolygon),+ Envelope: _p(FS.prototype.writeEnvelope)+ }+ }),+ (FS.prototype.LINESTRINGORCURVEMEMBER_SERIALIZERS = {+ "http://www.opengis.net/gml": {+ lineStringMember: _p(FS.prototype.writeLineStringOrCurveMember),+ curveMember: _p(FS.prototype.writeLineStringOrCurveMember)+ }+ }),+ (FS.prototype.RING_SERIALIZERS = {+ "http://www.opengis.net/gml": {+ outerBoundaryIs: _p(FS.prototype.writeRing),+ innerBoundaryIs: _p(FS.prototype.writeRing)+ }+ }),+ (FS.prototype.POINTMEMBER_SERIALIZERS = {+ "http://www.opengis.net/gml": { pointMember: _p(FS.prototype.writePointMember) }+ }),+ (FS.prototype.SURFACEORPOLYGONMEMBER_SERIALIZERS = {+ "http://www.opengis.net/gml": {+ surfaceMember: _p(FS.prototype.writeSurfaceOrPolygonMember),+ polygonMember: _p(FS.prototype.writeSurfaceOrPolygonMember)+ }+ }),+ (FS.prototype.ENVELOPE_SERIALIZERS = { "http://www.opengis.net/gml": { lowerCorner: _p(RS), upperCorner: _p(RS) } })+ const LS = lS + " http://schemas.opengis.net/gml/3.1.1/profiles/gmlsfProfile/1.0.0/gmlsf.xsd",+ MS = {+ MultiLineString: "lineStringMember",+ MultiCurve: "curveMember",+ MultiPolygon: "polygonMember",+ MultiSurface: "surfaceMember"+ }+ class AS extends cS {+ constructor(t) {+ super((t = t || {})),+ (this.surface_ = void 0 !== t.surface && t.surface),+ (this.curve_ = void 0 !== t.curve && t.curve),+ (this.multiCurve_ = void 0 === t.multiCurve || t.multiCurve),+ (this.multiSurface_ = void 0 === t.multiSurface || t.multiSurface),+ (this.schemaLocation = t.schemaLocation ? t.schemaLocation : LS),+ (this.hasZ = void 0 !== t.hasZ && t.hasZ)+ }+ readMultiCurve(t, e) {+ const i = wp([], this.MULTICURVE_PARSERS, t, e, this)+ if (i) {+ return new Nd(i)+ }+ }+ readFlatCurveRing(t, e) {+ const i = wp([], this.MULTICURVE_PARSERS, t, e, this),+ n = []+ for (let t = 0, e = i.length; t < e; ++t) E(n, i[t].getFlatCoordinates())+ return n+ }+ readMultiSurface(t, e) {+ const i = wp([], this.MULTISURFACE_PARSERS, t, e, this)+ if (i) return new Gd(i)+ }+ curveMemberParser(t, e) {+ Ep(this.CURVEMEMBER_PARSERS, t, e, this)+ }+ surfaceMemberParser(t, e) {+ Ep(this.SURFACEMEMBER_PARSERS, t, e, this)+ }+ readPatch(t, e) {+ return wp([null], this.PATCHES_PARSERS, t, e, this)+ }+ readSegment(t, e) {+ return wp([], this.SEGMENTS_PARSERS, t, e, this)+ }+ readPolygonPatch(t, e) {+ return wp([null], this.FLAT_LINEAR_RINGS_PARSERS, t, e, this)+ }+ readLineStringSegment(t, e) {+ return wp([null], this.GEOMETRY_FLAT_COORDINATES_PARSERS, t, e, this)+ }+ interiorParser(t, e) {+ const i = wp(void 0, this.RING_PARSERS, t, e, this)+ if (i) {+ e[e.length - 1].push(i)+ }+ }+ exteriorParser(t, e) {+ const i = wp(void 0, this.RING_PARSERS, t, e, this)+ if (i) {+ e[e.length - 1][0] = i+ }+ }+ readSurface(t, e) {+ const i = wp([null], this.SURFACE_PARSERS, t, e, this)+ if (i && i[0]) {+ const t = i[0],+ e = [t.length]+ let n, r+ for (n = 1, r = i.length; n < r; ++n) E(t, i[n]), e.push(t.length)+ return new gs(t, "XYZ", e)+ }+ }+ readCurve(t, e) {+ const i = wp([null], this.CURVE_PARSERS, t, e, this)+ if (i) {+ return new Dd(i, "XYZ")+ }+ }+ readEnvelope(t, e) {+ const i = wp([null], this.ENVELOPE_PARSERS, t, e, this)+ return Kt(i[1][0], i[1][1], i[2][0], i[2][1])+ }+ readFlatPos(t, e) {+ let i = op(t, !1)+ const n = /^\s*([+\-]?\d*\.?\d+(?:[eE][+\-]?\d+)?)\s*/,+ r = []+ let s+ for (; (s = n.exec(i)); ) r.push(parseFloat(s[1])), (i = i.substr(s[0].length))+ if ("" !== i) return+ const o = e[0].srsName+ if ("neu" === (o ? En(o).getAxisOrientation() : "enu"))+ for (let t = 0, e = r.length; t < e; t += 3) {+ const e = r[t],+ i = r[t + 1]+ ;(r[t] = i), (r[t + 1] = e)+ }+ const a = r.length+ return 2 == a && r.push(0), 0 !== a ? r : void 0+ }+ readFlatPosList(t, e) {+ const i = op(t, !1).replace(/^\s*|\s*$/g, ""),+ n = e[0],+ r = n.srsName,+ s = n.srsDimension,+ o = r ? En(r).getAxisOrientation() : "enu",+ a = i.split(/\s+/)+ let l = 2+ t.getAttribute("srsDimension")+ ? (l = mS(t.getAttribute("srsDimension")))+ : t.getAttribute("dimension")+ ? (l = mS(t.getAttribute("dimension")))+ : t.parentNode.getAttribute("srsDimension")+ ? (l = mS(t.parentNode.getAttribute("srsDimension")))+ : s && (l = mS(s))+ const h = o.startsWith("en")+ let c, u, d+ const g = []+ for (let t = 0, e = a.length; t < e; t += l)+ (c = parseFloat(a[t])),+ (u = parseFloat(a[t + 1])),+ (d = 3 === l ? parseFloat(a[t + 2]) : 0),+ h ? g.push(c, u, d) : g.push(u, c, d)+ return g+ }+ writePos_(t, e, i) {+ const n = i[i.length - 1],+ r = n.hasZ,+ s = r ? "3" : "2"+ t.setAttribute("srsDimension", s)+ const o = n.srsName,+ a = o ? En(o).getAxisOrientation() : "enu",+ l = e.getCoordinates()+ let h = a.startsWith("en") ? l[0] + " " + l[1] : l[1] + " " + l[0]+ if (r) {+ h += " " + (l[2] || 0)+ }+ RS(t, h)+ }+ getCoords_(t, e, i) {+ let n = (e ? En(e).getAxisOrientation() : "enu").startsWith("en") ? t[0] + " " + t[1] : t[1] + " " + t[0]+ if (i) {+ n += " " + (t[2] || 0)+ }+ return n+ }+ writePosList_(t, e, i) {+ const n = i[i.length - 1],+ r = n.hasZ,+ s = r ? "3" : "2"+ t.setAttribute("srsDimension", s)+ const o = n.srsName,+ a = e.getCoordinates(),+ l = a.length,+ h = new Array(l)+ let c+ for (let t = 0; t < l; ++t) (c = a[t]), (h[t] = this.getCoords_(c, o, r))+ RS(t, h.join(" "))+ }+ writePoint(t, e, i) {+ const n = i[i.length - 1].srsName+ n && t.setAttribute("srsName", n)+ const r = sp(t.namespaceURI, "pos")+ t.appendChild(r), this.writePos_(r, e, i)+ }+ writeEnvelope(t, e, i) {+ const n = i[i.length - 1].srsName+ n && t.setAttribute("srsName", n)+ const r = [e[0] + " " + e[1], e[2] + " " + e[3]]+ Cp({ node: t }, this.ENVELOPE_SERIALIZERS, xp, r, i, ["lowerCorner", "upperCorner"], this)+ }+ writeLinearRing(t, e, i) {+ const n = i[i.length - 1].srsName+ n && t.setAttribute("srsName", n)+ const r = sp(t.namespaceURI, "posList")+ t.appendChild(r), this.writePosList_(r, e, i)+ }+ RING_NODE_FACTORY_(t, e, i) {+ const n = e[e.length - 1],+ r = n.node,+ s = n.exteriorWritten+ return void 0 === s && (n.exteriorWritten = !0), sp(r.namespaceURI, void 0 !== s ? "interior" : "exterior")+ }+ writeSurfaceOrPolygon(t, e, i) {+ const n = i[i.length - 1],+ r = n.hasZ,+ s = n.srsName+ if (+ ("PolygonPatch" !== t.nodeName && s && t.setAttribute("srsName", s),+ "Polygon" === t.nodeName || "PolygonPatch" === t.nodeName)+ ) {+ const n = e.getLinearRings()+ Cp({ node: t, hasZ: r, srsName: s }, this.RING_SERIALIZERS, this.RING_NODE_FACTORY_, n, i, void 0, this)+ } else if ("Surface" === t.nodeName) {+ const n = sp(t.namespaceURI, "patches")+ t.appendChild(n), this.writeSurfacePatches_(n, e, i)+ }+ }+ writeCurveOrLineString(t, e, i) {+ const n = i[i.length - 1].srsName+ if (+ ("LineStringSegment" !== t.nodeName && n && t.setAttribute("srsName", n),+ "LineString" === t.nodeName || "LineStringSegment" === t.nodeName)+ ) {+ const n = sp(t.namespaceURI, "posList")+ t.appendChild(n), this.writePosList_(n, e, i)+ } else if ("Curve" === t.nodeName) {+ const n = sp(t.namespaceURI, "segments")+ t.appendChild(n), this.writeCurveSegments_(n, e, i)+ }+ }+ writeMultiSurfaceOrPolygon(t, e, i) {+ const n = i[i.length - 1],+ r = n.hasZ,+ s = n.srsName,+ o = n.surface+ s && t.setAttribute("srsName", s)+ const a = e.getPolygons()+ Cp(+ { node: t, hasZ: r, srsName: s, surface: o },+ this.SURFACEORPOLYGONMEMBER_SERIALIZERS,+ this.MULTIGEOMETRY_MEMBER_NODE_FACTORY_,+ a,+ i,+ void 0,+ this+ )+ }+ writeMultiPoint(t, e, i) {+ const n = i[i.length - 1],+ r = n.srsName,+ s = n.hasZ+ r && t.setAttribute("srsName", r)+ const o = e.getPoints()+ Cp({ node: t, hasZ: s, srsName: r }, this.POINTMEMBER_SERIALIZERS, yp("pointMember"), o, i, void 0, this)+ }+ writeMultiCurveOrLineString(t, e, i) {+ const n = i[i.length - 1],+ r = n.hasZ,+ s = n.srsName,+ o = n.curve+ s && t.setAttribute("srsName", s)+ const a = e.getLineStrings()+ Cp(+ { node: t, hasZ: r, srsName: s, curve: o },+ this.LINESTRINGORCURVEMEMBER_SERIALIZERS,+ this.MULTIGEOMETRY_MEMBER_NODE_FACTORY_,+ a,+ i,+ void 0,+ this+ )+ }+ writeRing(t, e, i) {+ const n = sp(t.namespaceURI, "LinearRing")+ t.appendChild(n), this.writeLinearRing(n, e, i)+ }+ writeSurfaceOrPolygonMember(t, e, i) {+ const n = this.GEOMETRY_NODE_FACTORY_(e, i)+ n && (t.appendChild(n), this.writeSurfaceOrPolygon(n, e, i))+ }+ writePointMember(t, e, i) {+ const n = sp(t.namespaceURI, "Point")+ t.appendChild(n), this.writePoint(n, e, i)+ }+ writeLineStringOrCurveMember(t, e, i) {+ const n = this.GEOMETRY_NODE_FACTORY_(e, i)+ n && (t.appendChild(n), this.writeCurveOrLineString(n, e, i))+ }+ writeSurfacePatches_(t, e, i) {+ const n = sp(t.namespaceURI, "PolygonPatch")+ t.appendChild(n), this.writeSurfaceOrPolygon(n, e, i)+ }+ writeCurveSegments_(t, e, i) {+ const n = sp(t.namespaceURI, "LineStringSegment")+ t.appendChild(n), this.writeCurveOrLineString(n, e, i)+ }+ writeGeometryElement(t, e, i) {+ const n = i[i.length - 1],+ r = Object.assign({}, n)+ let s+ ;(r.node = t),+ (s = Array.isArray(e) ? Hv(e, n) : Yv(e, !0, n)),+ Cp(r, this.GEOMETRY_SERIALIZERS, this.GEOMETRY_NODE_FACTORY_, [s], i, void 0, this)+ }+ writeFeatureElement(t, e, i) {+ const n = e.getId()+ n && t.setAttribute("fid", n)+ const r = i[i.length - 1],+ s = r.featureNS,+ o = e.getGeometryName()+ r.serializers || ((r.serializers = {}), (r.serializers[s] = {}))+ const a = [],+ l = []+ if (e.hasProperties()) {+ const t = e.getProperties()+ for (const e in t) {+ const i = t[e]+ null != i &&+ (a.push(e),+ l.push(i),+ e == o || "function" == typeof i.getSimplifiedGeometry+ ? e in r.serializers[s] || (r.serializers[s][e] = _p(this.writeGeometryElement, this))+ : e in r.serializers[s] || (r.serializers[s][e] = _p(RS)))+ }+ }+ const h = Object.assign({}, r)+ ;(h.node = t), Cp(h, r.serializers, yp(void 0, s), l, i, a)+ }+ writeFeatureMembers_(t, e, i) {+ const n = i[i.length - 1],+ r = n.featureType,+ s = n.featureNS,+ o = {}+ ;(o[s] = {}), (o[s][r] = _p(this.writeFeatureElement, this))+ const a = Object.assign({}, n)+ ;(a.node = t), Cp(a, o, yp(r, s), e, i)+ }+ MULTIGEOMETRY_MEMBER_NODE_FACTORY_(t, e, i) {+ const n = e[e.length - 1].node+ return sp(this.namespace, MS[n.nodeName])+ }+ GEOMETRY_NODE_FACTORY_(t, e, i) {+ const n = e[e.length - 1],+ r = n.multiSurface,+ s = n.surface,+ o = n.curve,+ a = n.multiCurve+ return (+ Array.isArray(t)+ ? (i = "Envelope")+ : "MultiPolygon" === (i = t.getType()) && !0 === r+ ? (i = "MultiSurface")+ : "Polygon" === i && !0 === s+ ? (i = "Surface")+ : "LineString" === i && !0 === o+ ? (i = "Curve")+ : "MultiLineString" === i && !0 === a && (i = "MultiCurve"),+ sp(this.namespace, i)+ )+ }+ writeGeometryNode(t, e) {+ e = this.adaptOptions(e)+ const i = sp(this.namespace, "geom"),+ n = {+ node: i,+ hasZ: this.hasZ,+ srsName: this.srsName,+ curve: this.curve_,+ surface: this.surface_,+ multiSurface: this.multiSurface_,+ multiCurve: this.multiCurve_+ }+ return e && Object.assign(n, e), this.writeGeometryElement(i, t, [n]), i+ }+ writeFeaturesNode(t, e) {+ e = this.adaptOptions(e)+ const i = sp(this.namespace, "featureMembers")+ i.setAttributeNS(rp, "xsi:schemaLocation", this.schemaLocation)+ const n = {+ srsName: this.srsName,+ hasZ: this.hasZ,+ curve: this.curve_,+ surface: this.surface_,+ multiSurface: this.multiSurface_,+ multiCurve: this.multiCurve_,+ featureNS: this.featureNS,+ featureType: this.featureType+ }+ return e && Object.assign(n, e), this.writeFeatureMembers_(i, t, [n]), i+ }+ }+ ;(AS.prototype.GEOMETRY_FLAT_COORDINATES_PARSERS = {+ "http://www.opengis.net/gml": {+ pos: gp(AS.prototype.readFlatPos),+ posList: gp(AS.prototype.readFlatPosList),+ coordinates: gp(FS.prototype.readFlatCoordinates)+ }+ }),+ (AS.prototype.FLAT_LINEAR_RINGS_PARSERS = {+ "http://www.opengis.net/gml": { interior: AS.prototype.interiorParser, exterior: AS.prototype.exteriorParser }+ }),+ (AS.prototype.GEOMETRY_PARSERS = {+ "http://www.opengis.net/gml": {+ Point: gp(cS.prototype.readPoint),+ MultiPoint: gp(cS.prototype.readMultiPoint),+ LineString: gp(cS.prototype.readLineString),+ MultiLineString: gp(cS.prototype.readMultiLineString),+ LinearRing: gp(cS.prototype.readLinearRing),+ Polygon: gp(cS.prototype.readPolygon),+ MultiPolygon: gp(cS.prototype.readMultiPolygon),+ Surface: gp(AS.prototype.readSurface),+ MultiSurface: gp(AS.prototype.readMultiSurface),+ Curve: gp(AS.prototype.readCurve),+ MultiCurve: gp(AS.prototype.readMultiCurve),+ Envelope: gp(AS.prototype.readEnvelope)+ }+ }),+ (AS.prototype.MULTICURVE_PARSERS = {+ "http://www.opengis.net/gml": {+ curveMember: dp(AS.prototype.curveMemberParser),+ curveMembers: dp(AS.prototype.curveMemberParser)+ }+ }),+ (AS.prototype.MULTISURFACE_PARSERS = {+ "http://www.opengis.net/gml": {+ surfaceMember: dp(AS.prototype.surfaceMemberParser),+ surfaceMembers: dp(AS.prototype.surfaceMemberParser)+ }+ }),+ (AS.prototype.CURVEMEMBER_PARSERS = {+ "http://www.opengis.net/gml": { LineString: dp(cS.prototype.readLineString), Curve: dp(AS.prototype.readCurve) }+ }),+ (AS.prototype.SURFACEMEMBER_PARSERS = {+ "http://www.opengis.net/gml": { Polygon: dp(cS.prototype.readPolygon), Surface: dp(AS.prototype.readSurface) }+ }),+ (AS.prototype.SURFACE_PARSERS = { "http://www.opengis.net/gml": { patches: gp(AS.prototype.readPatch) } }),+ (AS.prototype.CURVE_PARSERS = { "http://www.opengis.net/gml": { segments: gp(AS.prototype.readSegment) } }),+ (AS.prototype.ENVELOPE_PARSERS = {+ "http://www.opengis.net/gml": {+ lowerCorner: dp(AS.prototype.readFlatPosList),+ upperCorner: dp(AS.prototype.readFlatPosList)+ }+ }),+ (AS.prototype.PATCHES_PARSERS = {+ "http://www.opengis.net/gml": { PolygonPatch: gp(AS.prototype.readPolygonPatch) }+ }),+ (AS.prototype.SEGMENTS_PARSERS = {+ "http://www.opengis.net/gml": { LineStringSegment: up(AS.prototype.readLineStringSegment) }+ }),+ (cS.prototype.RING_PARSERS = {+ "http://www.opengis.net/gml": {+ LinearRing: gp(cS.prototype.readFlatLinearRing),+ Ring: gp(AS.prototype.readFlatCurveRing)+ }+ }),+ AS.prototype.writeFeatures,+ (AS.prototype.RING_SERIALIZERS = {+ "http://www.opengis.net/gml": { exterior: _p(AS.prototype.writeRing), interior: _p(AS.prototype.writeRing) }+ }),+ (AS.prototype.ENVELOPE_SERIALIZERS = {+ "http://www.opengis.net/gml": { lowerCorner: _p(RS), upperCorner: _p(RS) }+ }),+ (AS.prototype.SURFACEORPOLYGONMEMBER_SERIALIZERS = {+ "http://www.opengis.net/gml": {+ surfaceMember: _p(AS.prototype.writeSurfaceOrPolygonMember),+ polygonMember: _p(AS.prototype.writeSurfaceOrPolygonMember)+ }+ }),+ (AS.prototype.POINTMEMBER_SERIALIZERS = {+ "http://www.opengis.net/gml": { pointMember: _p(AS.prototype.writePointMember) }+ }),+ (AS.prototype.LINESTRINGORCURVEMEMBER_SERIALIZERS = {+ "http://www.opengis.net/gml": {+ lineStringMember: _p(AS.prototype.writeLineStringOrCurveMember),+ curveMember: _p(AS.prototype.writeLineStringOrCurveMember)+ }+ }),+ (AS.prototype.GEOMETRY_SERIALIZERS = {+ "http://www.opengis.net/gml": {+ Curve: _p(AS.prototype.writeCurveOrLineString),+ MultiCurve: _p(AS.prototype.writeMultiCurveOrLineString),+ Point: _p(AS.prototype.writePoint),+ MultiPoint: _p(AS.prototype.writeMultiPoint),+ LineString: _p(AS.prototype.writeCurveOrLineString),+ MultiLineString: _p(AS.prototype.writeMultiCurveOrLineString),+ LinearRing: _p(AS.prototype.writeLinearRing),+ Polygon: _p(AS.prototype.writeSurfaceOrPolygon),+ MultiPolygon: _p(AS.prototype.writeMultiSurfaceOrPolygon),+ Surface: _p(AS.prototype.writeSurfaceOrPolygon),+ MultiSurface: _p(AS.prototype.writeMultiSurfaceOrPolygon),+ Envelope: _p(AS.prototype.writeEnvelope)+ }+ })+ const OS = AS+ OS.prototype.writeFeatures, OS.prototype.writeFeaturesNode+ class DS extends AS {+ constructor(t) {+ super((t = t || {})),+ (this.schemaLocation = t.schemaLocation+ ? t.schemaLocation+ : this.namespace + " http://schemas.opengis.net/gml/3.2.1/gml.xsd")+ }+ writeGeometryElement(t, e, i) {+ const n = i[i.length - 1]+ ;(i[i.length - 1] = Object.assign({ multiCurve: !0, multiSurface: !0 }, n)), super.writeGeometryElement(t, e, i)+ }+ }+ ;(DS.prototype.namespace = "http://www.opengis.net/gml/3.2"),+ (DS.prototype.GEOMETRY_FLAT_COORDINATES_PARSERS = {+ "http://www.opengis.net/gml/3.2": {+ pos: gp(AS.prototype.readFlatPos),+ posList: gp(AS.prototype.readFlatPosList),+ coordinates: gp(FS.prototype.readFlatCoordinates)+ }+ }),+ (DS.prototype.FLAT_LINEAR_RINGS_PARSERS = {+ "http://www.opengis.net/gml/3.2": { interior: AS.prototype.interiorParser, exterior: AS.prototype.exteriorParser }+ }),+ (DS.prototype.GEOMETRY_PARSERS = {+ "http://www.opengis.net/gml/3.2": {+ Point: gp(cS.prototype.readPoint),+ MultiPoint: gp(cS.prototype.readMultiPoint),+ LineString: gp(cS.prototype.readLineString),+ MultiLineString: gp(cS.prototype.readMultiLineString),+ LinearRing: gp(cS.prototype.readLinearRing),+ Polygon: gp(cS.prototype.readPolygon),+ MultiPolygon: gp(cS.prototype.readMultiPolygon),+ Surface: gp(DS.prototype.readSurface),+ MultiSurface: gp(AS.prototype.readMultiSurface),+ Curve: gp(DS.prototype.readCurve),+ MultiCurve: gp(AS.prototype.readMultiCurve),+ Envelope: gp(DS.prototype.readEnvelope)+ }+ }),+ (DS.prototype.MULTICURVE_PARSERS = {+ "http://www.opengis.net/gml/3.2": {+ curveMember: dp(AS.prototype.curveMemberParser),+ curveMembers: dp(AS.prototype.curveMemberParser)+ }+ }),+ (DS.prototype.MULTISURFACE_PARSERS = {+ "http://www.opengis.net/gml/3.2": {+ surfaceMember: dp(AS.prototype.surfaceMemberParser),+ surfaceMembers: dp(AS.prototype.surfaceMemberParser)+ }+ }),+ (DS.prototype.CURVEMEMBER_PARSERS = {+ "http://www.opengis.net/gml/3.2": {+ LineString: dp(cS.prototype.readLineString),+ Curve: dp(AS.prototype.readCurve)+ }+ }),+ (DS.prototype.SURFACEMEMBER_PARSERS = {+ "http://www.opengis.net/gml/3.2": { Polygon: dp(cS.prototype.readPolygon), Surface: dp(AS.prototype.readSurface) }+ }),+ (DS.prototype.SURFACE_PARSERS = { "http://www.opengis.net/gml/3.2": { patches: gp(AS.prototype.readPatch) } }),+ (DS.prototype.CURVE_PARSERS = { "http://www.opengis.net/gml/3.2": { segments: gp(AS.prototype.readSegment) } }),+ (DS.prototype.ENVELOPE_PARSERS = {+ "http://www.opengis.net/gml/3.2": {+ lowerCorner: dp(AS.prototype.readFlatPosList),+ upperCorner: dp(AS.prototype.readFlatPosList)+ }+ }),+ (DS.prototype.PATCHES_PARSERS = {+ "http://www.opengis.net/gml/3.2": { PolygonPatch: gp(AS.prototype.readPolygonPatch) }+ }),+ (DS.prototype.SEGMENTS_PARSERS = {+ "http://www.opengis.net/gml/3.2": { LineStringSegment: up(AS.prototype.readLineStringSegment) }+ }),+ (DS.prototype.MULTIPOINT_PARSERS = {+ "http://www.opengis.net/gml/3.2": {+ pointMember: dp(cS.prototype.pointMemberParser),+ pointMembers: dp(cS.prototype.pointMemberParser)+ }+ }),+ (DS.prototype.MULTILINESTRING_PARSERS = {+ "http://www.opengis.net/gml/3.2": {+ lineStringMember: dp(cS.prototype.lineStringMemberParser),+ lineStringMembers: dp(cS.prototype.lineStringMemberParser)+ }+ }),+ (DS.prototype.MULTIPOLYGON_PARSERS = {+ "http://www.opengis.net/gml/3.2": {+ polygonMember: dp(cS.prototype.polygonMemberParser),+ polygonMembers: dp(cS.prototype.polygonMemberParser)+ }+ }),+ (DS.prototype.POINTMEMBER_PARSERS = {+ "http://www.opengis.net/gml/3.2": { Point: dp(cS.prototype.readFlatCoordinatesFromNode) }+ }),+ (DS.prototype.LINESTRINGMEMBER_PARSERS = {+ "http://www.opengis.net/gml/3.2": { LineString: dp(cS.prototype.readLineString) }+ }),+ (DS.prototype.POLYGONMEMBER_PARSERS = {+ "http://www.opengis.net/gml/3.2": { Polygon: dp(cS.prototype.readPolygon) }+ }),+ (DS.prototype.RING_PARSERS = {+ "http://www.opengis.net/gml/3.2": {+ LinearRing: gp(cS.prototype.readFlatLinearRing),+ Ring: gp(DS.prototype.readFlatCurveRing)+ }+ }),+ (DS.prototype.RING_SERIALIZERS = {+ "http://www.opengis.net/gml/3.2": { exterior: _p(AS.prototype.writeRing), interior: _p(AS.prototype.writeRing) }+ }),+ (DS.prototype.ENVELOPE_SERIALIZERS = {+ "http://www.opengis.net/gml/3.2": { lowerCorner: _p(RS), upperCorner: _p(RS) }+ }),+ (DS.prototype.SURFACEORPOLYGONMEMBER_SERIALIZERS = {+ "http://www.opengis.net/gml/3.2": {+ surfaceMember: _p(AS.prototype.writeSurfaceOrPolygonMember),+ polygonMember: _p(AS.prototype.writeSurfaceOrPolygonMember)+ }+ }),+ (DS.prototype.POINTMEMBER_SERIALIZERS = {+ "http://www.opengis.net/gml/3.2": { pointMember: _p(AS.prototype.writePointMember) }+ }),+ (DS.prototype.LINESTRINGORCURVEMEMBER_SERIALIZERS = {+ "http://www.opengis.net/gml/3.2": {+ lineStringMember: _p(AS.prototype.writeLineStringOrCurveMember),+ curveMember: _p(AS.prototype.writeLineStringOrCurveMember)+ }+ }),+ (DS.prototype.GEOMETRY_SERIALIZERS = {+ "http://www.opengis.net/gml/3.2": {+ Curve: _p(AS.prototype.writeCurveOrLineString),+ MultiCurve: _p(AS.prototype.writeMultiCurveOrLineString),+ Point: _p(DS.prototype.writePoint),+ MultiPoint: _p(AS.prototype.writeMultiPoint),+ LineString: _p(AS.prototype.writeCurveOrLineString),+ MultiLineString: _p(AS.prototype.writeMultiCurveOrLineString),+ LinearRing: _p(AS.prototype.writeLinearRing),+ Polygon: _p(AS.prototype.writeSurfaceOrPolygon),+ MultiPolygon: _p(AS.prototype.writeMultiSurfaceOrPolygon),+ Surface: _p(AS.prototype.writeSurfaceOrPolygon),+ MultiSurface: _p(AS.prototype.writeMultiSurfaceOrPolygon),+ Envelope: _p(AS.prototype.writeEnvelope)+ }+ })+ const NS = [null, "http://www.topografix.com/GPX/1/0", "http://www.topografix.com/GPX/1/1"],+ kS = { rte: gE, trk: fE, wpt: pE },+ GS = Sp(NS, { rte: dp(gE), trk: dp(fE), wpt: dp(pE) }),+ jS = Sp(NS, { text: pp(yS, "linkText"), type: pp(yS, "linkType") }),+ US = Sp(NS, {+ name: pp(yS),+ email: function (t, e) {+ const i = e[e.length - 1],+ n = t.getAttribute("id"),+ r = t.getAttribute("domain")+ null !== n && null !== r && (i.email = `${n}@${r}`)+ },+ link: uE+ }),+ BS = Sp(NS, {+ name: pp(yS),+ desc: pp(yS),+ author: pp(function (t, e) {+ const i = wp({}, US, t, e)+ if (i) return i+ return+ }),+ copyright: pp(function (t, e) {+ const i = wp({}, zS, t, e)+ if (i) {+ const e = t.getAttribute("author")+ return null !== e && (i.author = e), i+ }+ return+ }),+ link: uE,+ time: pp(gS),+ keywords: pp(yS),+ bounds: function (t, e) {+ const i = e[e.length - 1],+ n = t.getAttribute("minlat"),+ r = t.getAttribute("minlon"),+ s = t.getAttribute("maxlat"),+ o = t.getAttribute("maxlon")+ null !== r &&+ null !== n &&+ null !== o &&+ null !== s &&+ (i.bounds = [+ [parseFloat(r), parseFloat(n)],+ [parseFloat(o), parseFloat(s)]+ ])+ },+ extensions: dE+ }),+ zS = Sp(NS, { year: pp(_S), license: pp(yS) }),+ XS = Sp(NS, {+ rte: _p(function (t, e, i) {+ const n = i[0],+ r = e.getProperties(),+ s = { node: t }+ s.properties = r+ const o = e.getGeometry()+ if ("LineString" == o.getType()) {+ const t = Yv(o, !0, n)+ ;(s.geometryLayout = t.getLayout()), (r.rtept = t.getCoordinates())+ }+ const a = i[i.length - 1].node,+ l = JS[a.namespaceURI],+ h = vp(r, l)+ Cp(s, QS, xp, h, i, l)+ }),+ trk: _p(function (t, e, i) {+ const n = i[0],+ r = e.getProperties(),+ s = { node: t }+ s.properties = r+ const o = e.getGeometry()+ if ("MultiLineString" == o.getType()) {+ const t = Yv(o, !0, n)+ r.trkseg = t.getLineStrings()+ }+ const a = i[i.length - 1].node,+ l = eE[a.namespaceURI],+ h = vp(r, l)+ Cp(s, iE, xp, h, i, l)+ }),+ wpt: _p(function (t, e, i) {+ const n = i[0],+ r = i[i.length - 1]+ r.properties = e.getProperties()+ const s = e.getGeometry()+ if ("Point" == s.getType()) {+ const e = Yv(s, !0, n)+ ;(r.geometryLayout = e.getLayout()), mE(t, e.getCoordinates(), i)+ }+ })+ })+ const VS = Sp(NS, {+ name: pp(yS),+ cmt: pp(yS),+ desc: pp(yS),+ src: pp(yS),+ link: uE,+ number: pp(_S),+ extensions: dE,+ type: pp(yS),+ rtept: function (t, e) {+ const i = wp({}, $S, t, e)+ if (i) {+ const n = e[e.length - 1]+ hE(n.flatCoordinates, n.layoutOptions, t, i)+ }+ }+ }),+ $S = Sp(NS, { ele: pp(fS), time: pp(gS) }),+ WS = Sp(NS, {+ name: pp(yS),+ cmt: pp(yS),+ desc: pp(yS),+ src: pp(yS),+ link: uE,+ number: pp(_S),+ type: pp(yS),+ extensions: dE,+ trkseg: function (t, e) {+ const i = e[e.length - 1]+ Ep(ZS, t, e)+ const n = i.flatCoordinates+ i.ends.push(n.length)+ }+ }),+ ZS = Sp(NS, {+ trkpt: function (t, e) {+ const i = wp({}, YS, t, e)+ if (i) {+ const n = e[e.length - 1]+ hE(n.flatCoordinates, n.layoutOptions, t, i)+ }+ }+ }),+ YS = Sp(NS, { ele: pp(fS), time: pp(gS) }),+ HS = Sp(NS, {+ ele: pp(fS),+ time: pp(gS),+ magvar: pp(fS),+ geoidheight: pp(fS),+ name: pp(yS),+ cmt: pp(yS),+ desc: pp(yS),+ src: pp(yS),+ link: uE,+ sym: pp(yS),+ type: pp(yS),+ fix: pp(yS),+ sat: pp(_S),+ hdop: pp(fS),+ vdop: pp(fS),+ pdop: pp(fS),+ ageofdgpsdata: pp(fS),+ dgpsid: pp(_S),+ extensions: dE+ }),+ KS = ["text", "type"],+ qS = Sp(NS, { text: _p(RS), type: _p(RS) }),+ JS = Sp(NS, ["name", "cmt", "desc", "src", "link", "number", "type", "rtept"]),+ QS = Sp(NS, {+ name: _p(RS),+ cmt: _p(RS),+ desc: _p(RS),+ src: _p(RS),+ link: _p(_E),+ number: _p(wS),+ type: _p(RS),+ rtept: mp(_p(mE))+ }),+ tE = Sp(NS, ["ele", "time"]),+ eE = Sp(NS, ["name", "cmt", "desc", "src", "link", "number", "type", "trkseg"]),+ iE = Sp(NS, {+ name: _p(RS),+ cmt: _p(RS),+ desc: _p(RS),+ src: _p(RS),+ link: _p(_E),+ number: _p(wS),+ type: _p(RS),+ trkseg: mp(+ _p(function (t, e, i) {+ const n = { node: t }+ ;(n.geometryLayout = e.getLayout()), (n.properties = {}), Cp(n, rE, nE, e.getCoordinates(), i)+ })+ )+ }),+ nE = yp("trkpt"),+ rE = Sp(NS, { trkpt: _p(mE) }),+ sE = Sp(NS, [+ "ele",+ "time",+ "magvar",+ "geoidheight",+ "name",+ "cmt",+ "desc",+ "src",+ "link",+ "sym",+ "type",+ "fix",+ "sat",+ "hdop",+ "vdop",+ "pdop",+ "ageofdgpsdata",+ "dgpsid"+ ]),+ oE = Sp(NS, {+ ele: _p(ES),+ time: _p(SS),+ magvar: _p(ES),+ geoidheight: _p(ES),+ name: _p(RS),+ cmt: _p(RS),+ desc: _p(RS),+ src: _p(RS),+ link: _p(_E),+ sym: _p(RS),+ type: _p(RS),+ fix: _p(RS),+ sat: _p(wS),+ hdop: _p(ES),+ vdop: _p(ES),+ pdop: _p(ES),+ ageofdgpsdata: _p(ES),+ dgpsid: _p(wS)+ }),+ aE = { Point: "wpt", LineString: "rte", MultiLineString: "trk" }+ function lE(t, e, i) {+ const n = t.getGeometry()+ if (n) {+ const t = aE[n.getType()]+ if (t) {+ return sp(e[e.length - 1].node.namespaceURI, t)+ }+ }+ }+ function hE(t, e, i, n) {+ return (+ t.push(parseFloat(i.getAttribute("lon")), parseFloat(i.getAttribute("lat"))),+ "ele" in n ? (t.push(n.ele), delete n.ele, (e.hasZ = !0)) : t.push(0),+ "time" in n ? (t.push(n.time), delete n.time, (e.hasM = !0)) : t.push(0),+ t+ )+ }+ function cE(t, e, i) {+ let n = "XY",+ r = 2+ if (+ (t.hasZ && t.hasM ? ((n = "XYZM"), (r = 4)) : t.hasZ ? ((n = "XYZ"), (r = 3)) : t.hasM && ((n = "XYM"), (r = 3)),+ 4 !== r)+ ) {+ for (let i = 0, n = e.length / 4; i < n; i++)+ (e[i * r] = e[4 * i]),+ (e[i * r + 1] = e[4 * i + 1]),+ t.hasZ && (e[i * r + 2] = e[4 * i + 2]),+ t.hasM && (e[i * r + 2] = e[4 * i + 3])+ if (((e.length = (e.length / 4) * r), i)) for (let t = 0, e = i.length; t < e; t++) i[t] = (i[t] / 4) * r+ }+ return n+ }+ function uE(t, e) {+ const i = e[e.length - 1],+ n = t.getAttribute("href")+ null !== n && (i.link = n), Ep(jS, t, e)+ }+ function dE(t, e) {+ e[e.length - 1].extensionsNode_ = t+ }+ function gE(t, e) {+ const i = e[0],+ n = wp({ flatCoordinates: [], layoutOptions: {} }, VS, t, e)+ if (!n) return+ const r = n.flatCoordinates+ delete n.flatCoordinates+ const s = n.layoutOptions+ delete n.layoutOptions+ const o = cE(s, r),+ a = new Dd(r, o)+ Yv(a, !1, i)+ const l = new At(a)+ return l.setProperties(n, !0), l+ }+ function fE(t, e) {+ const i = e[0],+ n = wp({ flatCoordinates: [], ends: [], layoutOptions: {} }, WS, t, e)+ if (!n) return+ const r = n.flatCoordinates+ delete n.flatCoordinates+ const s = n.ends+ delete n.ends+ const o = n.layoutOptions+ delete n.layoutOptions+ const a = cE(o, r, s),+ l = new Nd(r, a, s)+ Yv(l, !1, i)+ const h = new At(l)+ return h.setProperties(n, !0), h+ }+ function pE(t, e) {+ const i = e[0],+ n = wp({}, HS, t, e)+ if (!n) return+ const r = {},+ s = hE([], r, t, n),+ o = cE(r, s),+ a = new Wr(s, o)+ Yv(a, !1, i)+ const l = new At(a)+ return l.setProperties(n, !0), l+ }+ function _E(t, e, i) {+ t.setAttribute("href", e)+ const n = i[i.length - 1].properties,+ r = [n.linkText, n.linkType]+ Cp({ node: t }, qS, xp, r, i, KS)+ }+ function mE(t, e, i) {+ const n = i[i.length - 1],+ r = n.node.namespaceURI,+ s = n.properties+ t.setAttributeNS(null, "lat", String(e[1])), t.setAttributeNS(null, "lon", String(e[0]))+ switch (n.geometryLayout) {+ case "XYZM":+ 0 !== e[3] && (s.time = e[3])+ case "XYZ":+ 0 !== e[2] && (s.ele = e[2])+ break+ case "XYM":+ 0 !== e[2] && (s.time = e[2])+ }+ const o = "rtept" == t.nodeName ? tE[r] : sE[r],+ a = vp(s, o)+ Cp({ node: t, properties: s }, oE, xp, a, i, o)+ }+ function yE(t, e) {+ if (!t) return null+ let i+ switch (t.type) {+ case "Point":+ i = (function (t) {+ const e = t.coordinates+ return { type: "Point", flatCoordinates: e, layout: yr(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: yr(e[0]?.length || 2) }+ })(t)+ break+ case "Polygon":+ i = (function (t) {+ const e = t.coordinates,+ i = [],+ n = e[0]?.[0]?.length,+ r = Ar(i, 0, e, n)+ return { type: "Polygon", flatCoordinates: i, ends: r, layout: yr(n) }+ })(t)+ break+ case "MultiPoint":+ i = (function (t) {+ const e = t.coordinates+ return { type: "MultiPoint", flatCoordinates: e.flat(), layout: yr(e[0]?.length || 2) }+ })(t)+ break+ case "MultiLineString":+ i = (function (t) {+ const e = t.coordinates,+ i = e[0]?.[0]?.length || 2,+ n = [],+ r = Ar(n, 0, e, i)+ return { type: "MultiLineString", flatCoordinates: n, ends: r, layout: yr(i) }+ })(t)+ break+ case "MultiPolygon":+ i = (function (t) {+ const e = t.coordinates,+ i = [],+ n = e[0]?.[0]?.[0].length || 2,+ r = Or(i, 0, e, n)+ return { type: "MultiPolygon", flatCoordinates: i, ends: r, layout: yr(n) }+ })(t)+ break+ case "GeometryCollection":+ i = (function (t) {+ const e = t.geometries.map(function (t) {+ return yE(t)+ })+ return e+ })(t)+ break+ default:+ throw new Error("Unsupported GeoJSON type: " + t.type)+ }+ return i+ }+ function xE(t, e) {+ const i = (t = Yv(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 xE(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+ }+ class vE extends Zv {+ constructor() {+ super()+ }+ getType() {+ return "text"+ }+ readFeature(t, e) {+ return this.readFeatureFromText(SE(t), this.adaptOptions(e))+ }+ readFeatureFromText(t, e) {+ return U()+ }+ readFeatures(t, e) {+ return this.readFeaturesFromText(SE(t), this.adaptOptions(e))+ }+ readFeaturesFromText(t, e) {+ return U()+ }+ readGeometry(t, e) {+ return this.readGeometryFromText(SE(t), this.adaptOptions(e))+ }+ readGeometryFromText(t, e) {+ return U()+ }+ readProjection(t) {+ return this.readProjectionFromText(SE(t))+ }+ readProjectionFromText(t) {+ return this.dataProjection+ }+ writeFeature(t, e) {+ return this.writeFeatureText(t, this.adaptOptions(e))+ }+ writeFeatureText(t, e) {+ return U()+ }+ writeFeatures(t, e) {+ return this.writeFeaturesText(t, this.adaptOptions(e))+ }+ writeFeaturesText(t, e) {+ return U()+ }+ writeGeometry(t, e) {+ return this.writeGeometryText(t, this.adaptOptions(e))+ }+ writeGeometryText(t, e) {+ return U()+ }+ }+ function SE(t) {+ return "string" == typeof t ? t : ""+ }+ const EE = /^B(\d{2})(\d{2})(\d{2})(\d{2})(\d{5})([NS])(\d{3})(\d{5})([EW])([AV])(\d{5})(\d{5})/,+ wE = /^H.([A-Z]{3}).*?:(.*)/,+ TE = /^HFDTE(\d{2})(\d{2})(\d{2})/,+ CE = /^HFDTEDATE:(\d{2})(\d{2})(\d{2}),(\d{2})/,+ bE = /\r\n|\r|\n/+ const RE = ["http://www.google.com/kml/ext/2.2"],+ PE = [+ null,+ "http://earth.google.com/kml/2.0",+ "http://earth.google.com/kml/2.1",+ "http://earth.google.com/kml/2.2",+ "http://www.opengis.net/kml/2.2"+ ],+ IE = { fraction: "fraction", pixels: "pixels", insetPixels: "pixels" },+ FE = Sp(+ PE,+ {+ ExtendedData: Aw,+ Region: Ow,+ MultiGeometry: pp(Tw, "geometry"),+ LineString: pp(Sw, "geometry"),+ LinearRing: pp(Ew, "geometry"),+ Point: pp(Cw, "geometry"),+ Polygon: pp(Rw, "geometry"),+ Style: pp(Iw),+ StyleMap: function (t, e) {+ const i = aw.call(this, t, e)+ if (!i) return+ const n = e[e.length - 1]+ if (Array.isArray(i)) n.Style = i+ else {+ if ("string" != typeof i) throw new Error("`styleMapValue` has an unknown type")+ n.styleUrl = i+ }+ },+ address: pp(yS),+ description: pp(yS),+ name: pp(yS),+ open: pp(uS),+ phoneNumber: pp(yS),+ styleUrl: pp(rw),+ visibility: pp(uS)+ },+ Sp(RE, {+ MultiTrack: pp(function (t, e) {+ const i = wp([], fw, t, e)+ if (!i) return+ return new Nd(i)+ }, "geometry"),+ Track: pp(_w, "geometry")+ })+ ),+ LE = Sp(PE, {+ ExtendedData: Aw,+ Region: Ow,+ Link: function (t, e) {+ Ep(ME, t, e)+ },+ address: pp(yS),+ description: pp(yS),+ name: pp(yS),+ open: pp(uS),+ phoneNumber: pp(yS),+ visibility: pp(uS)+ }),+ ME = Sp(PE, { href: pp(nw) }),+ AE = Sp(PE, {+ Altitude: pp(fS),+ Longitude: pp(fS),+ Latitude: pp(fS),+ Tilt: pp(fS),+ AltitudeMode: pp(yS),+ Heading: pp(fS),+ Roll: pp(fS)+ }),+ OE = Sp(PE, {+ LatLonAltBox: function (t, e) {+ const i = wp({}, kw, t, e)+ if (!i) return+ const n = e[e.length - 1],+ r = [parseFloat(i.west), parseFloat(i.south), parseFloat(i.east), parseFloat(i.north)]+ ;(n.extent = r),+ (n.altitudeMode = i.altitudeMode),+ (n.minAltitude = parseFloat(i.minAltitude)),+ (n.maxAltitude = parseFloat(i.maxAltitude))+ },+ Lod: function (t, e) {+ const i = wp({}, Gw, t, e)+ if (!i) return+ const n = e[e.length - 1]+ ;(n.minLodPixels = parseFloat(i.minLodPixels)),+ (n.maxLodPixels = parseFloat(i.maxLodPixels)),+ (n.minFadeExtent = parseFloat(i.minFadeExtent)),+ (n.maxFadeExtent = parseFloat(i.maxFadeExtent))+ }+ }),+ DE = Sp(PE, ["Document", "Placemark"]),+ NE = Sp(PE, {+ Document: _p(function (t, e, i) {+ Cp({ node: t }, Xw, Vw, e, i, void 0, this)+ }),+ Placemark: _p(fT)+ })+ let kE,+ GE,+ jE,+ UE,+ BE,+ zE,+ XE = null+ let VE,+ $E = null+ let WE,+ ZE = null+ let YE = null+ let HE = null+ let KE,+ qE = null+ function JE(t) {+ return 32 / Math.min(t[0], t[1])+ }+ function QE(t) {+ return t+ }+ function tw(t, e, i) {+ return Array.isArray(t) ? t : "string" == typeof t ? tw(i[t], e, i) : e+ }+ function ew(t) {+ const e = op(t, !1),+ i = /^\s*#?\s*([0-9A-Fa-f]{8})\s*$/.exec(e)+ if (i) {+ const t = i[1]+ return [+ parseInt(t.substr(6, 2), 16),+ parseInt(t.substr(4, 2), 16),+ parseInt(t.substr(2, 2), 16),+ parseInt(t.substr(0, 2), 16) / 255+ ]+ }+ }+ function iw(t) {+ let e = op(t, !1)+ const i = []+ e = e.replace(/\s*,\s*/g, ",")+ const n =+ /^\s*([+\-]?\d*\.?\d+(?:e[+\-]?\d+)?),([+\-]?\d*\.?\d+(?:e[+\-]?\d+)?)(?:\s+|,|$)(?:([+\-]?\d*\.?\d+(?:e[+\-]?\d+)?)(?:\s+|$))?\s*/i+ let r+ for (; (r = n.exec(e)); ) {+ const t = parseFloat(r[1]),+ n = parseFloat(r[2]),+ s = r[3] ? parseFloat(r[3]) : 0+ i.push(t, n, s), (e = e.substr(r[0].length))+ }+ if ("" === e) return i+ }+ function nw(t) {+ const e = op(t, !1).trim()+ let i = t.baseURI+ if (((i && "about:blank" != i) || (i = window.location.href), i)) {+ return new URL(e, i).href+ }+ return e+ }+ function rw(t) {+ const e = op(t, !1)+ .trim()+ .replace(/^(?!.*#)/, "#")+ let i = t.baseURI+ if (((i && "about:blank" != i) || (i = window.location.href), i)) {+ return new URL(e, i).href+ }+ return e+ }+ function sw(t) {+ return fS(t)+ }+ const ow = Sp(PE, {+ Pair: function (t, e) {+ const i = wp({}, Dw, t, e, this)+ if (!i) return+ const n = i.key+ if (n && "normal" == n) {+ const t = i.styleUrl+ t && (e[e.length - 1] = t)+ const n = i.Style+ n && (e[e.length - 1] = n)+ }+ }+ })+ function aw(t, e) {+ return wp(void 0, ow, t, e, this)+ }+ const lw = Sp(PE, {+ Icon: pp(function (t, e) {+ const i = wp({}, mw, t, e)+ if (i) return i+ return null+ }),+ color: pp(ew),+ heading: pp(fS),+ hotSpot: pp(function (t) {+ const e = t.getAttribute("xunits"),+ i = t.getAttribute("yunits")+ let n+ return (+ (n =+ "insetPixels" !== e+ ? "insetPixels" !== i+ ? "bottom-left"+ : "top-left"+ : "insetPixels" !== i+ ? "bottom-right"+ : "top-right"),+ {+ x: parseFloat(t.getAttribute("x")),+ xunits: IE[e],+ y: parseFloat(t.getAttribute("y")),+ yunits: IE[i],+ origin: n+ }+ )+ }),+ scale: pp(sw)+ })+ const hw = Sp(PE, { color: pp(ew), scale: pp(sw) })+ const cw = Sp(PE, { color: pp(ew), width: pp(fS) })+ const uw = Sp(PE, { color: pp(ew), fill: pp(uS), outline: pp(uS) })+ const dw = Sp(PE, { coordinates: gp(iw) })+ function gw(t, e) {+ return wp(null, dw, t, e)+ }+ const fw = Sp(RE, { Track: dp(_w) })+ const pw = Sp(+ PE,+ {+ when: function (t, e) {+ const i = e[e.length - 1].whens,+ n = op(t, !1),+ r = Date.parse(n)+ i.push(isNaN(r) ? 0 : r)+ }+ },+ Sp(RE, {+ coord: function (t, e) {+ const i = e[e.length - 1].coordinates,+ n = op(t, !1),+ r =+ /^\s*([+\-]?\d+(?:\.\d*)?(?:e[+\-]?\d*)?)\s+([+\-]?\d+(?:\.\d*)?(?:e[+\-]?\d*)?)\s+([+\-]?\d+(?:\.\d*)?(?:e[+\-]?\d*)?)\s*$/i.exec(+ n+ )+ if (r) {+ const t = parseFloat(r[1]),+ e = parseFloat(r[2]),+ n = parseFloat(r[3])+ i.push([t, e, n])+ } else i.push([])+ }+ })+ )+ function _w(t, e) {+ const i = wp({ coordinates: [], whens: [] }, pw, t, e)+ if (!i) return+ const n = [],+ r = i.coordinates,+ s = i.whens+ for (let t = 0, e = Math.min(r.length, s.length); t < e; ++t)+ 3 == r[t].length && n.push(r[t][0], r[t][1], r[t][2], s[t])+ return new Dd(n, "XYZM")+ }+ const mw = Sp(PE, { href: pp(nw) }, Sp(RE, { x: pp(fS), y: pp(fS), w: pp(fS), h: pp(fS) }))+ const yw = Sp(PE, { coordinates: gp(iw) })+ function xw(t, e) {+ return wp(null, yw, t, e)+ }+ const vw = Sp(PE, { extrude: pp(uS), tessellate: pp(uS), altitudeMode: pp(yS) })+ function Sw(t, e) {+ const i = wp({}, vw, t, e),+ n = xw(t, e)+ if (n) {+ const t = new Dd(n, "XYZ")+ return t.setProperties(i, !0), t+ }+ }+ function Ew(t, e) {+ const i = wp({}, vw, t, e),+ n = xw(t, e)+ if (n) {+ const t = new gs(n, "XYZ", [n.length])+ return t.setProperties(i, !0), t+ }+ }+ const ww = Sp(PE, { LineString: dp(Sw), LinearRing: dp(Ew), MultiGeometry: dp(Tw), Point: dp(Cw), Polygon: dp(Rw) })+ function Tw(t, e) {+ const i = wp([], ww, t, e)+ if (!i) return null+ if (0 === i.length) return new Md(i)+ let n,+ r = !0+ const s = i[0].getType()+ let o+ for (let t = 1, e = i.length; t < e; ++t)+ if (((o = i[t]), o.getType() != s)) {+ r = !1+ break+ }+ if (r) {+ let t, e+ if ("Point" == s) {+ const r = i[0]+ ;(t = r.getLayout()), (e = r.getFlatCoordinates())+ for (let t = 1, n = i.length; t < n; ++t) (o = i[t]), E(e, o.getFlatCoordinates())+ ;(n = new kd(e, t)), Fw(n, i)+ } else if ("LineString" == s) (n = new Nd(i)), Fw(n, i)+ else if ("Polygon" == s) (n = new Gd(i)), Fw(n, i)+ else {+ if ("GeometryCollection" != s && !s.startsWith("Multi")) throw new Error("Unknown geometry type found")+ n = new Md(i)+ }+ } else n = new Md(i)+ return n+ }+ function Cw(t, e) {+ const i = wp({}, vw, t, e),+ n = xw(t, e)+ if (n) {+ const t = new Wr(n, "XYZ")+ return t.setProperties(i, !0), t+ }+ }+ const bw = Sp(PE, {+ innerBoundaryIs: function (t, e) {+ const i = wp([], jw, t, e)+ if (i.length > 0) {+ e[e.length - 1].push(...i)+ }+ },+ outerBoundaryIs: function (t, e) {+ const i = wp(void 0, Uw, t, e)+ if (i) {+ e[e.length - 1][0] = i+ }+ }+ })+ function Rw(t, e) {+ const i = wp({}, vw, t, e),+ n = wp([null], bw, t, e)+ if (n && n[0]) {+ const t = n[0],+ e = [t.length]+ for (let i = 1, r = n.length; i < r; ++i) E(t, n[i]), e.push(t.length)+ const r = new gs(t, "XYZ", e)+ return r.setProperties(i, !0), r+ }+ }+ const Pw = Sp(PE, {+ IconStyle: function (t, e) {+ const i = wp({}, lw, t, e)+ if (!i) return+ const n = e[e.length - 1],+ r = "Icon" in i ? i.Icon : {},+ s = !("Icon" in i) || Object.keys(r).length > 0+ let o+ const a = r.href+ let l, h, c+ a ? (o = a) : s && (o = zE)+ let u = "bottom-left"+ const d = i.hotSpot+ let g+ d+ ? ((l = [d.x, d.y]), (h = d.xunits), (c = d.yunits), (u = d.origin))+ : /^https?:\/\/maps\.(?:google|gstatic)\.com\//.test(o) &&+ (o.includes("pushpin")+ ? ((l = GE), (h = jE), (c = UE))+ : o.includes("arrow-reverse")+ ? ((l = [54, 42]), (h = jE), (c = UE))+ : o.includes("paddle") && ((l = [32, 1]), (h = jE), (c = UE)))+ const f = r.x,+ p = r.y+ let _+ void 0 !== f && void 0 !== p && (g = [f, p])+ const m = r.w,+ y = r.h+ let x+ void 0 !== m && void 0 !== y && (_ = [m, y])+ const v = i.heading+ void 0 !== v && (x = Oe(v))+ const S = i.scale,+ E = i.color+ if (s) {+ o == zE && (_ = BE)+ const t = new ac({+ anchor: l,+ anchorOrigin: u,+ anchorXUnits: h,+ anchorYUnits: c,+ crossOrigin: this.crossOrigin_,+ referrerPolicy: this.referrerPolicy_,+ offset: g,+ offsetOrigin: "bottom-left",+ rotation: x,+ scale: S,+ size: _,+ src: this.iconUrlFunction_(o),+ color: E+ }),+ e = t.getScaleArray()[0],+ i = t.getSize()+ if (null === i) {+ const i = t.getImageState()+ if (i === Fs || i === Ls) {+ const n = function () {+ const i = t.getImageState()+ if (i !== Fs && i !== Ls) {+ const i = t.getSize()+ if (i && 2 == i.length) {+ const n = JE(i)+ t.setScale(e * n)+ }+ t.unlistenImageChange(n)+ }+ }+ t.listenImageChange(n), i === Fs && t.load()+ }+ } else if (2 == i.length) {+ const n = JE(i)+ t.setScale(e * n)+ }+ n.imageStyle = t+ } else n.imageStyle = VE+ },+ LabelStyle: function (t, e) {+ const i = wp({}, hw, t, e)+ if (!i) return+ const n = e[e.length - 1],+ r = new pc({ fill: new sc({ color: "color" in i ? i.color : kE }), scale: i.scale })+ n.textStyle = r+ },+ LineStyle: function (t, e) {+ const i = wp({}, cw, t, e)+ if (!i) return+ const n = e[e.length - 1],+ r = new lc({ color: "color" in i ? i.color : kE, width: "width" in i ? i.width : 1 })+ n.strokeStyle = r+ },+ PolyStyle: function (t, e) {+ const i = wp({}, uw, t, e)+ if (!i) return+ const n = e[e.length - 1],+ r = new sc({ color: "color" in i ? i.color : kE })+ n.fillStyle = r+ const s = i.fill+ void 0 !== s && (n.fill = s)+ const o = i.outline+ void 0 !== o && (n.outline = o)+ }+ })+ function Iw(t, e) {+ const i = wp({}, Pw, t, e, this)+ if (!i) return null+ let n = "fillStyle" in i ? i.fillStyle : XE+ const r = i.fill+ let s+ void 0 === r || r || (n = null), "imageStyle" in i ? i.imageStyle != VE && (s = i.imageStyle) : (s = $E)+ const o = "textStyle" in i ? i.textStyle : YE,+ a = "strokeStyle" in i ? i.strokeStyle : ZE,+ l = i.outline+ return void 0 === l || l+ ? [new hc({ fill: n, image: s, stroke: a, text: o, zIndex: void 0 })]+ : [+ new hc({+ geometry: function (t) {+ const e = t.getGeometry(),+ i = e.getType()+ if ("GeometryCollection" === i) {+ return new Md(+ e.getGeometriesArrayRecursive().filter(function (t) {+ const e = t.getType()+ return "Polygon" !== e && "MultiPolygon" !== e+ })+ )+ }+ if ("Polygon" !== i && "MultiPolygon" !== i) return e+ },+ fill: n,+ image: s,+ stroke: a,+ text: o,+ zIndex: void 0+ }),+ new hc({+ geometry: function (t) {+ const e = t.getGeometry(),+ i = e.getType()+ if ("GeometryCollection" === i) {+ return new Md(+ e.getGeometriesArrayRecursive().filter(function (t) {+ const e = t.getType()+ return "Polygon" === e || "MultiPolygon" === e+ })+ )+ }+ if ("Polygon" === i || "MultiPolygon" === i) return e+ },+ fill: n,+ stroke: null,+ zIndex: void 0+ })+ ]+ }+ function Fw(t, e) {+ const i = e.length,+ n = new Array(e.length),+ r = new Array(e.length),+ s = new Array(e.length)+ let o, a, l+ ;(o = !1), (a = !1), (l = !1)+ for (let t = 0; t < i; ++t) {+ const i = e[t]+ ;(n[t] = i.get("extrude")),+ (r[t] = i.get("tessellate")),+ (s[t] = i.get("altitudeMode")),+ (o = o || void 0 !== n[t]),+ (a = a || void 0 !== r[t]),+ (l = l || s[t])+ }+ o && t.set("extrude", n), a && t.set("tessellate", r), l && t.set("altitudeMode", s)+ }+ const Lw = Sp(PE, { displayName: pp(yS), value: pp(yS) })+ const Mw = Sp(PE, {+ Data: function (t, e) {+ const i = t.getAttribute("name")+ Ep(Lw, t, e)+ const n = e[e.length - 1]+ i && n.displayName+ ? (n[i] = {+ value: n.value,+ displayName: n.displayName,+ toString: function () {+ return n.value+ }+ })+ : null !== i+ ? (n[i] = n.value)+ : null !== n.displayName && (n[n.displayName] = n.value),+ delete n.value+ },+ SchemaData: function (t, e) {+ Ep(Nw, t, e)+ }+ })+ function Aw(t, e) {+ Ep(Mw, t, e)+ }+ function Ow(t, e) {+ Ep(OE, t, e)+ }+ const Dw = Sp(PE, { Style: pp(Iw), key: pp(yS), styleUrl: pp(rw) })+ const Nw = Sp(PE, {+ SimpleData: function (t, e) {+ const i = t.getAttribute("name")+ if (null !== i) {+ const n = yS(t)+ e[e.length - 1][i] = n+ }+ }+ })+ const kw = Sp(PE, {+ altitudeMode: pp(yS),+ minAltitude: pp(fS),+ maxAltitude: pp(fS),+ north: pp(fS),+ south: pp(fS),+ east: pp(fS),+ west: pp(fS)+ })+ const Gw = Sp(PE, { minLodPixels: pp(fS), maxLodPixels: pp(fS), minFadeExtent: pp(fS), maxFadeExtent: pp(fS) })+ const jw = Sp(PE, { LinearRing: dp(gw) })+ const Uw = Sp(PE, { LinearRing: gp(gw) })+ function Bw(t, e) {+ const i = zl(e),+ n = [255 * (4 == i.length ? i[3] : 1), i[2], i[1], i[0]]+ for (let t = 0; t < 4; ++t) {+ const e = Math.floor(n[t]).toString(16)+ n[t] = 1 == e.length ? "0" + e : e+ }+ RS(t, n.join(""))+ }+ const zw = Sp(PE, {+ Data: _p(function (t, e, i) {+ t.setAttribute("name", e.name)+ const n = { node: t },+ r = e.value+ "object" == typeof r+ ? (null !== r && r.displayName && Cp(n, zw, xp, [r.displayName], i, ["displayName"]),+ null !== r && r.value && Cp(n, zw, xp, [r.value], i, ["value"]))+ : Cp(n, zw, xp, [r], i, ["value"])+ }),+ value: _p(function (t, e) {+ RS(t, e)+ }),+ displayName: _p(function (t, e) {+ RS(t, e)+ })+ })+ const Xw = Sp(PE, { Placemark: _p(fT) }),+ Vw = function (t, e, i) {+ return sp(e[e.length - 1].node.namespaceURI, "Placemark")+ }+ const $w = yp("Data")+ const Ww = Sp(PE, ["href"], Sp(RE, ["x", "y", "w", "h"])),+ Zw = Sp(PE, { href: _p(RS) }, Sp(RE, { x: _p(ES), y: _p(ES), w: _p(ES), h: _p(ES) })),+ Yw = function (t, e, i) {+ return sp(RE[0], "gx:" + i)+ }+ const Hw = Sp(PE, ["scale", "heading", "Icon", "color", "hotSpot"]),+ Kw = Sp(PE, {+ Icon: _p(function (t, e, i) {+ const n = { node: t },+ r = i[i.length - 1].node+ let s = Ww[r.namespaceURI],+ o = vp(e, s)+ Cp(n, Zw, xp, o, i, s), (s = Ww[RE[0]]), (o = vp(e, s)), Cp(n, Zw, Yw, o, i, s)+ }),+ color: _p(Bw),+ heading: _p(ES),+ hotSpot: _p(function (t, e) {+ t.setAttribute("x", String(e.x)),+ t.setAttribute("y", String(e.y)),+ t.setAttribute("xunits", e.xunits),+ t.setAttribute("yunits", e.yunits)+ }),+ scale: _p(TT)+ })+ const qw = Sp(PE, ["color", "scale"]),+ Jw = Sp(PE, { color: _p(Bw), scale: _p(TT) })+ const Qw = Sp(PE, ["color", "width"]),+ tT = Sp(PE, { color: _p(Bw), width: _p(ES) })+ const eT = {+ Point: "Point",+ LineString: "LineString",+ LinearRing: "LinearRing",+ Polygon: "Polygon",+ MultiPoint: "MultiGeometry",+ MultiLineString: "MultiGeometry",+ MultiPolygon: "MultiGeometry",+ GeometryCollection: "MultiGeometry"+ },+ iT = function (t, e, i) {+ if (t) {+ return sp(e[e.length - 1].node.namespaceURI, eT[t.getType()])+ }+ },+ nT = yp("Point"),+ rT = yp("LineString"),+ sT = yp("LinearRing"),+ oT = yp("Polygon"),+ aT = Sp(PE, { LineString: _p(mT), Point: _p(mT), Polygon: _p(ET), GeometryCollection: _p(lT) })+ function lT(t, e, i) {+ const n = { node: t },+ r = e.getType()+ let s,+ o = []+ if ("GeometryCollection" === r)+ e.getGeometriesArrayRecursive().forEach(function (t) {+ const e = t.getType()+ if ("MultiPoint" === e) o = o.concat(t.getPoints())+ else if ("MultiLineString" === e) o = o.concat(t.getLineStrings())+ else if ("MultiPolygon" === e) o = o.concat(t.getPolygons())+ else {+ if ("Point" !== e && "LineString" !== e && "Polygon" !== e) throw new Error("Unknown geometry type")+ o.push(t)+ }+ }),+ (s = iT)+ else if ("MultiPoint" === r) (o = e.getPoints()), (s = nT)+ else if ("MultiLineString" === r) (o = e.getLineStrings()), (s = rT)+ else {+ if ("MultiPolygon" !== r) throw new Error("Unknown geometry type")+ ;(o = e.getPolygons()), (s = oT)+ }+ Cp(n, aT, s, o, i)+ }+ const hT = Sp(PE, { LinearRing: _p(mT) })+ function cT(t, e, i) {+ Cp({ node: t }, hT, sT, [e], i)+ }+ const uT = Sp(PE, {+ ExtendedData: _p(function (t, e, i) {+ const n = { node: t },+ r = e.names,+ s = e.values,+ o = r.length+ for (let t = 0; t < o; t++) Cp(n, zw, $w, [{ name: r[t], value: s[t] }], i)+ }),+ MultiGeometry: _p(lT),+ LineString: _p(mT),+ LinearRing: _p(mT),+ Point: _p(mT),+ Polygon: _p(ET),+ Style: _p(function (t, e, i) {+ const n = { node: t },+ r = {}+ if (e.pointStyles.length) {+ const t = e.pointStyles[0].getText()+ t && (r.LabelStyle = t)+ const i = e.pointStyles[0].getImage()+ i && "function" == typeof i.getSrc && (r.IconStyle = i)+ }+ if (e.lineStyles.length) {+ const t = e.lineStyles[0].getStroke()+ t && (r.LineStyle = t)+ }+ if (e.polyStyles.length) {+ const t = e.polyStyles[0].getStroke()+ t && !r.LineStyle && (r.LineStyle = t), (r.PolyStyle = e.polyStyles[0])+ }+ const s = i[i.length - 1].node,+ o = CT[s.namespaceURI],+ a = vp(r, o)+ Cp(n, bT, xp, a, i, o)+ }),+ address: _p(RS),+ description: _p(RS),+ name: _p(RS),+ open: _p(xS),+ phoneNumber: _p(RS),+ styleUrl: _p(RS),+ visibility: _p(xS)+ }),+ dT = Sp(PE, ["name", "open", "visibility", "address", "phoneNumber", "description", "styleUrl", "Style"]),+ gT = yp("ExtendedData")+ function fT(t, e, i) {+ const n = { node: t }+ e.getId() && t.setAttribute("id", e.getId())+ const r = e.getProperties(),+ s = { address: 1, description: 1, name: 1, open: 1, phoneNumber: 1, styleUrl: 1, visibility: 1 }+ s[e.getGeometryName()] = 1+ const o = Object.keys(r || {})+ .sort()+ .filter(function (t) {+ return !s[t]+ }),+ a = e.getStyleFunction()+ if (a) {+ const t = a(e, 0)+ if (t) {+ const i = Array.isArray(t) ? t : [t]+ let n = i+ if (+ (e.getGeometry() &&+ (n = i.filter(function (t) {+ const i = t.getGeometryFunction()(e)+ if (i) {+ const t = i.getType()+ return "GeometryCollection" === t+ ? i.getGeometriesArrayRecursive().filter(function (t) {+ const e = t.getType()+ return "Point" === e || "MultiPoint" === e+ }).length+ : "Point" === t || "MultiPoint" === t+ }+ })),+ this.writeStyles_)+ ) {+ let t = i,+ s = i+ e.getGeometry() &&+ ((t = i.filter(function (t) {+ const i = t.getGeometryFunction()(e)+ if (i) {+ const t = i.getType()+ return "GeometryCollection" === t+ ? i.getGeometriesArrayRecursive().filter(function (t) {+ const e = t.getType()+ return "LineString" === e || "MultiLineString" === e+ }).length+ : "LineString" === t || "MultiLineString" === t+ }+ })),+ (s = i.filter(function (t) {+ const i = t.getGeometryFunction()(e)+ if (i) {+ const t = i.getType()+ return "GeometryCollection" === t+ ? i.getGeometriesArrayRecursive().filter(function (t) {+ const e = t.getType()+ return "Polygon" === e || "MultiPolygon" === e+ }).length+ : "Polygon" === t || "MultiPolygon" === t+ }+ }))),+ (r.Style = { pointStyles: n, lineStyles: t, polyStyles: s })+ }+ if (n.length && void 0 === r.name) {+ const t = n[0].getText()+ t && (r.name = t.getText())+ }+ }+ }+ const l = i[i.length - 1].node,+ h = dT[l.namespaceURI],+ c = vp(r, h)+ if ((Cp(n, uT, xp, c, i, h), o.length > 0)) {+ const t = vp(r, o)+ Cp(n, uT, gT, [{ names: o, values: t }], i)+ }+ const u = i[0]+ let d = e.getGeometry()+ d && (d = Yv(d, !0, u)), Cp(n, uT, iT, [d], i)+ }+ const pT = Sp(PE, ["extrude", "tessellate", "altitudeMode", "coordinates"]),+ _T = Sp(PE, {+ extrude: _p(xS),+ tessellate: _p(xS),+ altitudeMode: _p(RS),+ coordinates: _p(function (t, e, i) {+ const n = i[i.length - 1],+ r = n.layout,+ s = n.stride+ let o+ if ("XY" == r || "XYM" == r) o = 2+ else {+ if ("XYZ" != r && "XYZM" != r) throw new Error("Invalid geometry layout")+ o = 3+ }+ const a = e.length+ let l = ""+ if (a > 0) {+ l += e[0]+ for (let t = 1; t < o; ++t) l += "," + e[t]+ for (let t = s; t < a; t += s) {+ l += " " + e[t]+ for (let i = 1; i < o; ++i) l += "," + e[t + i]+ }+ }+ RS(t, l)+ })+ })+ function mT(t, e, i) {+ const n = e.getFlatCoordinates(),+ r = { node: t }+ ;(r.layout = e.getLayout()), (r.stride = e.getStride())+ const s = e.getProperties()+ s.coordinates = n+ const o = i[i.length - 1].node,+ a = pT[o.namespaceURI],+ l = vp(s, a)+ Cp(r, _T, xp, l, i, a)+ }+ const yT = Sp(PE, ["color", "fill", "outline"]),+ xT = Sp(PE, { outerBoundaryIs: _p(cT), innerBoundaryIs: _p(cT) }),+ vT = yp("innerBoundaryIs"),+ ST = yp("outerBoundaryIs")+ function ET(t, e, i) {+ const n = e.getLinearRings(),+ r = n.shift(),+ s = { node: t }+ Cp(s, xT, vT, n, i), Cp(s, xT, ST, [r], i)+ }+ const wT = Sp(PE, { color: _p(Bw), fill: _p(xS), outline: _p(xS) })+ function TT(t, e) {+ ES(t, Math.round(1e6 * e) / 1e6)+ }+ const CT = Sp(PE, ["IconStyle", "LabelStyle", "LineStyle", "PolyStyle"]),+ bT = Sp(PE, {+ IconStyle: _p(function (t, e, i) {+ const n = { node: t },+ r = {},+ s = e.getSrc(),+ o = e.getSize(),+ a = e.getImageSize(),+ l = { href: s }+ if (o) {+ ;(l.w = o[0]), (l.h = o[1])+ const t = e.getAnchor(),+ i = e.getOrigin()+ if (+ (i && a && 0 !== i[0] && i[1] !== o[1] && ((l.x = i[0]), (l.y = a[1] - (i[1] + o[1]))),+ t && (t[0] !== o[0] / 2 || t[1] !== o[1] / 2))+ ) {+ const e = { x: t[0], xunits: "pixels", y: o[1] - t[1], yunits: "pixels" }+ r.hotSpot = e+ }+ }+ r.Icon = l+ let h = e.getScaleArray()[0],+ c = o+ if ((null === c && (c = BE), 2 == c.length)) {+ h /= JE(c)+ }+ 1 !== h && (r.scale = h)+ const u = e.getRotation()+ 0 !== u && (r.heading = u)+ const d = e.getColor()+ d && (r.color = d)+ const g = i[i.length - 1].node,+ f = Hw[g.namespaceURI],+ p = vp(r, f)+ Cp(n, Kw, xp, p, i, f)+ }),+ LabelStyle: _p(function (t, e, i) {+ const n = { node: t },+ r = {},+ s = e.getFill()+ s && (r.color = s.getColor())+ const o = e.getScale()+ o && 1 !== o && (r.scale = o)+ const a = i[i.length - 1].node,+ l = qw[a.namespaceURI],+ h = vp(r, l)+ Cp(n, Jw, xp, h, i, l)+ }),+ LineStyle: _p(function (t, e, i) {+ const n = { node: t },+ r = { color: e.getColor(), width: Number(e.getWidth()) || 1 },+ s = i[i.length - 1].node,+ o = Qw[s.namespaceURI],+ a = vp(r, o)+ Cp(n, tT, xp, a, i, o)+ }),+ PolyStyle: _p(function (t, e, i) {+ const n = { node: t },+ r = e.getFill(),+ s = e.getStroke(),+ o = { color: r ? r.getColor() : void 0, fill: !!r && void 0, outline: !!s && void 0 },+ a = i[i.length - 1].node,+ l = yT[a.namespaceURI],+ h = vp(o, l)+ Cp(n, wT, xp, h, i, l)+ })+ })+ const RT = 4294967296,+ PT = 1 / RT,+ IT = "undefined" == typeof TextDecoder ? null : new TextDecoder("utf-8")+ class FT {+ constructor(t = new Uint8Array(16)) {+ ;(this.buf = ArrayBuffer.isView(t) ? t : new Uint8Array(t)),+ (this.dataView = new DataView(this.buf.buffer)),+ (this.pos = 0),+ (this.type = 0),+ (this.length = this.buf.length)+ }+ readFields(t, e, i = this.length) {+ for (; this.pos < i; ) {+ const i = this.readVarint(),+ n = i >> 3,+ r = this.pos+ ;(this.type = 7 & i), t(n, e, this), this.pos === r && this.skip(i)+ }+ return e+ }+ readMessage(t, e) {+ return this.readFields(t, e, this.readVarint() + this.pos)+ }+ readFixed32() {+ const t = this.dataView.getUint32(this.pos, !0)+ return (this.pos += 4), t+ }+ readSFixed32() {+ const t = this.dataView.getInt32(this.pos, !0)+ return (this.pos += 4), t+ }+ readFixed64() {+ const t = this.dataView.getUint32(this.pos, !0) + this.dataView.getUint32(this.pos + 4, !0) * RT+ return (this.pos += 8), t+ }+ readSFixed64() {+ const t = this.dataView.getUint32(this.pos, !0) + this.dataView.getInt32(this.pos + 4, !0) * RT+ return (this.pos += 8), t+ }+ readFloat() {+ const t = this.dataView.getFloat32(this.pos, !0)+ return (this.pos += 4), t+ }+ readDouble() {+ const t = this.dataView.getFloat64(this.pos, !0)+ return (this.pos += 8), t+ }+ readVarint(t) {+ const e = this.buf+ let i, n+ return (+ (n = e[this.pos++]),+ (i = 127 & n),+ n < 128+ ? i+ : ((n = e[this.pos++]),+ (i |= (127 & n) << 7),+ n < 128+ ? i+ : ((n = e[this.pos++]),+ (i |= (127 & n) << 14),+ n < 128+ ? i+ : ((n = e[this.pos++]),+ (i |= (127 & n) << 21),+ n < 128+ ? i+ : ((n = e[this.pos]),+ (i |= (15 & n) << 28),+ (function (t, e, i) {+ const n = i.buf+ let r, s+ if (((s = n[i.pos++]), (r = (112 & s) >> 4), s < 128)) return LT(t, r, e)+ if (((s = n[i.pos++]), (r |= (127 & s) << 3), s < 128)) return LT(t, r, e)+ if (((s = n[i.pos++]), (r |= (127 & s) << 10), s < 128)) return LT(t, r, e)+ if (((s = n[i.pos++]), (r |= (127 & s) << 17), s < 128)) return LT(t, r, e)+ if (((s = n[i.pos++]), (r |= (127 & s) << 24), s < 128)) return LT(t, r, e)+ if (((s = n[i.pos++]), (r |= (1 & s) << 31), s < 128)) return LT(t, r, e)+ throw new Error("Expected varint not more than 10 bytes")+ })(i, t, this)))))+ )+ }+ readVarint64() {+ return this.readVarint(!0)+ }+ readSVarint() {+ const t = this.readVarint()+ return t % 2 == 1 ? (t + 1) / -2 : t / 2+ }+ readBoolean() {+ return Boolean(this.readVarint())+ }+ readString() {+ const t = this.readVarint() + this.pos,+ e = this.pos+ return (+ (this.pos = t),+ t - e >= 12 && IT+ ? IT.decode(this.buf.subarray(e, t))+ : (function (t, e, i) {+ let n = "",+ r = e+ for (; r < i; ) {+ const e = t[r]+ let s,+ o,+ a,+ l = null,+ h = e > 239 ? 4 : e > 223 ? 3 : e > 191 ? 2 : 1+ if (r + h > i) break+ 1 === h+ ? e < 128 && (l = e)+ : 2 === h+ ? ((s = t[r + 1]), 128 == (192 & s) && ((l = ((31 & e) << 6) | (63 & s)), l <= 127 && (l = null)))+ : 3 === h+ ? ((s = t[r + 1]),+ (o = t[r + 2]),+ 128 == (192 & s) &&+ 128 == (192 & o) &&+ ((l = ((15 & e) << 12) | ((63 & s) << 6) | (63 & o)),+ (l <= 2047 || (l >= 55296 && l <= 57343)) && (l = null)))+ : 4 === h &&+ ((s = t[r + 1]),+ (o = t[r + 2]),+ (a = t[r + 3]),+ 128 == (192 & s) &&+ 128 == (192 & o) &&+ 128 == (192 & a) &&+ ((l = ((15 & e) << 18) | ((63 & s) << 12) | ((63 & o) << 6) | (63 & a)),+ (l <= 65535 || l >= 1114112) && (l = null))),+ null === l+ ? ((l = 65533), (h = 1))+ : l > 65535 &&+ ((l -= 65536), (n += String.fromCharCode(((l >>> 10) & 1023) | 55296)), (l = 56320 | (1023 & l))),+ (n += String.fromCharCode(l)),+ (r += h)+ }+ return n+ })(this.buf, e, t)+ )+ }+ readBytes() {+ const t = this.readVarint() + this.pos,+ e = this.buf.subarray(this.pos, t)+ return (this.pos = t), e+ }+ readPackedVarint(t = [], e) {+ const i = this.readPackedEnd()+ for (; this.pos < i; ) t.push(this.readVarint(e))+ return t+ }+ readPackedSVarint(t = []) {+ const e = this.readPackedEnd()+ for (; this.pos < e; ) t.push(this.readSVarint())+ return t+ }+ readPackedBoolean(t = []) {+ const e = this.readPackedEnd()+ for (; this.pos < e; ) t.push(this.readBoolean())+ return t+ }+ readPackedFloat(t = []) {+ const e = this.readPackedEnd()+ for (; this.pos < e; ) t.push(this.readFloat())+ return t+ }+ readPackedDouble(t = []) {+ const e = this.readPackedEnd()+ for (; this.pos < e; ) t.push(this.readDouble())+ return t+ }+ readPackedFixed32(t = []) {+ const e = this.readPackedEnd()+ for (; this.pos < e; ) t.push(this.readFixed32())+ return t+ }+ readPackedSFixed32(t = []) {+ const e = this.readPackedEnd()+ for (; this.pos < e; ) t.push(this.readSFixed32())+ return t+ }+ readPackedFixed64(t = []) {+ const e = this.readPackedEnd()+ for (; this.pos < e; ) t.push(this.readFixed64())+ return t+ }+ readPackedSFixed64(t = []) {+ const e = this.readPackedEnd()+ for (; this.pos < e; ) t.push(this.readSFixed64())+ return t+ }+ readPackedEnd() {+ return 2 === this.type ? this.readVarint() + this.pos : this.pos + 1+ }+ skip(t) {+ const e = 7 & t+ if (0 === e) for (; this.buf[this.pos++] > 127; );+ else if (2 === e) this.pos = this.readVarint() + this.pos+ else if (5 === e) this.pos += 4+ else {+ if (1 !== e) throw new Error(`Unimplemented type: ${e}`)+ this.pos += 8+ }+ }+ writeTag(t, e) {+ this.writeVarint((t << 3) | e)+ }+ realloc(t) {+ let e = this.length || 16+ for (; e < this.pos + t; ) e *= 2+ if (e !== this.length) {+ const t = new Uint8Array(e)+ t.set(this.buf), (this.buf = t), (this.dataView = new DataView(t.buffer)), (this.length = e)+ }+ }+ finish() {+ return (this.length = this.pos), (this.pos = 0), this.buf.subarray(0, this.length)+ }+ writeFixed32(t) {+ this.realloc(4), this.dataView.setInt32(this.pos, t, !0), (this.pos += 4)+ }+ writeSFixed32(t) {+ this.realloc(4), this.dataView.setInt32(this.pos, t, !0), (this.pos += 4)+ }+ writeFixed64(t) {+ this.realloc(8),+ this.dataView.setInt32(this.pos, -1 & t, !0),+ this.dataView.setInt32(this.pos + 4, Math.floor(t * PT), !0),+ (this.pos += 8)+ }+ writeSFixed64(t) {+ this.realloc(8),+ this.dataView.setInt32(this.pos, -1 & t, !0),+ this.dataView.setInt32(this.pos + 4, Math.floor(t * PT), !0),+ (this.pos += 8)+ }+ writeVarint(t) {+ ;(t = +t || 0) > 268435455 || t < 0+ ? (function (t, e) {+ let i, n+ t >= 0+ ? ((i = t % 4294967296 | 0), (n = (t / 4294967296) | 0))+ : ((i = ~(-t % 4294967296)),+ (n = ~(-t / 4294967296)),+ 4294967295 ^ i ? (i = (i + 1) | 0) : ((i = 0), (n = (n + 1) | 0)))+ if (t >= 0x10000000000000000 || t < -0x10000000000000000)+ throw new Error("Given varint doesn't fit into 10 bytes")+ e.realloc(10),+ (function (t, e, i) {+ ;(i.buf[i.pos++] = (127 & t) | 128),+ (t >>>= 7),+ (i.buf[i.pos++] = (127 & t) | 128),+ (t >>>= 7),+ (i.buf[i.pos++] = (127 & t) | 128),+ (t >>>= 7),+ (i.buf[i.pos++] = (127 & t) | 128),+ (t >>>= 7),+ (i.buf[i.pos] = 127 & t)+ })(i, 0, e),+ (function (t, e) {+ const i = (7 & t) << 4+ if (((e.buf[e.pos++] |= i | ((t >>>= 3) ? 128 : 0)), !t)) return+ if (((e.buf[e.pos++] = (127 & t) | ((t >>>= 7) ? 128 : 0)), !t)) return+ if (((e.buf[e.pos++] = (127 & t) | ((t >>>= 7) ? 128 : 0)), !t)) return+ if (((e.buf[e.pos++] = (127 & t) | ((t >>>= 7) ? 128 : 0)), !t)) return+ if (((e.buf[e.pos++] = (127 & t) | ((t >>>= 7) ? 128 : 0)), !t)) return+ e.buf[e.pos++] = 127 & t+ })(n, e)+ })(t, this)+ : (this.realloc(4),+ (this.buf[this.pos++] = (127 & t) | (t > 127 ? 128 : 0)),+ t <= 127 ||+ ((this.buf[this.pos++] = (127 & (t >>>= 7)) | (t > 127 ? 128 : 0)),+ t <= 127 ||+ ((this.buf[this.pos++] = (127 & (t >>>= 7)) | (t > 127 ? 128 : 0)),+ t <= 127 || (this.buf[this.pos++] = (t >>> 7) & 127))))+ }+ writeSVarint(t) {+ this.writeVarint(t < 0 ? 2 * -t - 1 : 2 * t)+ }+ writeBoolean(t) {+ this.writeVarint(+t)+ }+ writeString(t) {+ ;(t = String(t)), this.realloc(4 * t.length), this.pos+++ const e = this.pos+ this.pos = (function (t, e, i) {+ for (let n, r, s = 0; s < e.length; s++) {+ if (((n = e.charCodeAt(s)), n > 55295 && n < 57344)) {+ if (!r) {+ n > 56319 || s + 1 === e.length ? ((t[i++] = 239), (t[i++] = 191), (t[i++] = 189)) : (r = n)+ continue+ }+ if (n < 56320) {+ ;(t[i++] = 239), (t[i++] = 191), (t[i++] = 189), (r = n)+ continue+ }+ ;(n = ((r - 55296) << 10) | (n - 56320) | 65536), (r = null)+ } else r && ((t[i++] = 239), (t[i++] = 191), (t[i++] = 189), (r = null))+ n < 128+ ? (t[i++] = n)+ : (n < 2048+ ? (t[i++] = (n >> 6) | 192)+ : (n < 65536+ ? (t[i++] = (n >> 12) | 224)+ : ((t[i++] = (n >> 18) | 240), (t[i++] = ((n >> 12) & 63) | 128)),+ (t[i++] = ((n >> 6) & 63) | 128)),+ (t[i++] = (63 & n) | 128))+ }+ return i+ })(this.buf, t, this.pos)+ const i = this.pos - e+ i >= 128 && MT(e, i, this), (this.pos = e - 1), this.writeVarint(i), (this.pos += i)+ }+ writeFloat(t) {+ this.realloc(4), this.dataView.setFloat32(this.pos, t, !0), (this.pos += 4)+ }+ writeDouble(t) {+ this.realloc(8), this.dataView.setFloat64(this.pos, t, !0), (this.pos += 8)+ }+ writeBytes(t) {+ const e = t.length+ this.writeVarint(e), this.realloc(e)+ for (let i = 0; i < e; i++) this.buf[this.pos++] = t[i]+ }+ writeRawMessage(t, e) {+ this.pos+++ const i = this.pos+ t(e, this)+ const n = this.pos - i+ n >= 128 && MT(i, n, this), (this.pos = i - 1), this.writeVarint(n), (this.pos += n)+ }+ writeMessage(t, e, i) {+ this.writeTag(t, 2), this.writeRawMessage(e, i)+ }+ writePackedVarint(t, e) {+ e.length && this.writeMessage(t, AT, e)+ }+ writePackedSVarint(t, e) {+ e.length && this.writeMessage(t, OT, e)+ }+ writePackedBoolean(t, e) {+ e.length && this.writeMessage(t, kT, e)+ }+ writePackedFloat(t, e) {+ e.length && this.writeMessage(t, DT, e)+ }+ writePackedDouble(t, e) {+ e.length && this.writeMessage(t, NT, e)+ }+ writePackedFixed32(t, e) {+ e.length && this.writeMessage(t, GT, e)+ }+ writePackedSFixed32(t, e) {+ e.length && this.writeMessage(t, jT, e)+ }+ writePackedFixed64(t, e) {+ e.length && this.writeMessage(t, UT, e)+ }+ writePackedSFixed64(t, e) {+ e.length && this.writeMessage(t, BT, e)+ }+ writeBytesField(t, e) {+ this.writeTag(t, 2), this.writeBytes(e)+ }+ writeFixed32Field(t, e) {+ this.writeTag(t, 5), this.writeFixed32(e)+ }+ writeSFixed32Field(t, e) {+ this.writeTag(t, 5), this.writeSFixed32(e)+ }+ writeFixed64Field(t, e) {+ this.writeTag(t, 1), this.writeFixed64(e)+ }+ writeSFixed64Field(t, e) {+ this.writeTag(t, 1), this.writeSFixed64(e)+ }+ writeVarintField(t, e) {+ this.writeTag(t, 0), this.writeVarint(e)+ }+ writeSVarintField(t, e) {+ this.writeTag(t, 0), this.writeSVarint(e)+ }+ writeStringField(t, e) {+ this.writeTag(t, 2), this.writeString(e)+ }+ writeFloatField(t, e) {+ this.writeTag(t, 5), this.writeFloat(e)+ }+ writeDoubleField(t, e) {+ this.writeTag(t, 1), this.writeDouble(e)+ }+ writeBooleanField(t, e) {+ this.writeVarintField(t, +e)+ }+ }+ function LT(t, e, i) {+ return i ? 4294967296 * e + (t >>> 0) : 4294967296 * (e >>> 0) + (t >>> 0)+ }+ function MT(t, e, i) {+ const n = e <= 16383 ? 1 : e <= 2097151 ? 2 : e <= 268435455 ? 3 : Math.floor(Math.log(e) / (7 * Math.LN2))+ i.realloc(n)+ for (let e = i.pos - 1; e >= t; e--) i.buf[e + n] = i.buf[e]+ }+ function AT(t, e) {+ for (let i = 0; i < t.length; i++) e.writeVarint(t[i])+ }+ function OT(t, e) {+ for (let i = 0; i < t.length; i++) e.writeSVarint(t[i])+ }+ function DT(t, e) {+ for (let i = 0; i < t.length; i++) e.writeFloat(t[i])+ }+ function NT(t, e) {+ for (let i = 0; i < t.length; i++) e.writeDouble(t[i])+ }+ function kT(t, e) {+ for (let i = 0; i < t.length; i++) e.writeBoolean(t[i])+ }+ function GT(t, e) {+ for (let i = 0; i < t.length; i++) e.writeFixed32(t[i])+ }+ function jT(t, e) {+ for (let i = 0; i < t.length; i++) e.writeSFixed32(t[i])+ }+ function UT(t, e) {+ for (let i = 0; i < t.length; i++) e.writeFixed64(t[i])+ }+ function BT(t, e) {+ for (let i = 0; i < t.length; i++) e.writeSFixed64(t[i])+ }+ function zT(t, e, i) {+ if (3 === t) {+ const t = { keys: [], values: [], features: [] },+ n = i.readVarint() + i.pos+ i.readFields(XT, t, n), (t.length = t.features.length), t.length && (e[t.name] = t)+ }+ }+ function XT(t, e, i) {+ if (15 === t) e.version = i.readVarint()+ else if (1 === t) e.name = i.readString()+ else if (5 === t) e.extent = i.readVarint()+ else if (2 === t) e.features.push(i.pos)+ else if (3 === t) e.keys.push(i.readString())+ else if (4 === t) {+ let n = null+ const r = i.readVarint() + i.pos+ for (; i.pos < r; )+ n =+ 1 === (t = i.readVarint() >> 3)+ ? i.readString()+ : 2 === t+ ? i.readFloat()+ : 3 === t+ ? i.readDouble()+ : 4 === t+ ? i.readVarint64()+ : 5 === t+ ? i.readVarint()+ : 6 === t+ ? i.readSVarint()+ : 7 === t+ ? i.readBoolean()+ : null+ e.values.push(n)+ }+ }+ function VT(t, e, i) {+ if (1 == t) e.id = i.readVarint()+ else if (2 == t) {+ const t = i.readVarint() + i.pos+ for (; i.pos < t; ) {+ const t = e.layer.keys[i.readVarint()],+ n = e.layer.values[i.readVarint()]+ e.properties[t] = n+ }+ } else 3 == t ? (e.type = i.readVarint()) : 4 == t && (e.geometry = i.pos)+ }+ function $T(t, e, i) {+ t.pos = e.features[i]+ const n = t.readVarint() + t.pos,+ r = { layer: e, type: 0, properties: {} }+ return t.readFields(VT, r, n), r+ }+ const WT = [null],+ ZT = Sp(WT, {+ nd: function (t, e) {+ const i = e[e.length - 1]+ i.ndrefs.push(t.getAttribute("ref")),+ t.hasAttribute("lon") &&+ t.hasAttribute("lat") &&+ (i.flatCoordinates.push(parseFloat(t.getAttribute("lon"))),+ i.flatCoordinates.push(parseFloat(t.getAttribute("lat"))))+ },+ tag: KT+ }),+ YT = Sp(WT, {+ node: function (t, e) {+ const i = e[0],+ n = e[e.length - 1],+ r = t.getAttribute("id"),+ s = [parseFloat(t.getAttribute("lon")), parseFloat(t.getAttribute("lat"))]+ n.nodes[r] = s+ const o = wp({ tags: {} }, HT, t, e)+ if (!L(o.tags)) {+ const t = new Wr(s)+ Yv(t, !1, i)+ const e = new At(t)+ void 0 !== r && e.setId(r), e.setProperties(o.tags, !0), n.features.push(e)+ }+ },+ way: function (t, e) {+ const i = wp({ id: t.getAttribute("id"), ndrefs: [], flatCoordinates: [], tags: {} }, ZT, t, e)+ e[e.length - 1].ways.push(i)+ }+ })+ const HT = Sp(WT, { tag: KT })+ function KT(t, e) {+ e[e.length - 1].tags[t.getAttribute("k")] = t.getAttribute("v")+ }+ class qT {+ read(t) {+ if (!t) return null+ if ("string" == typeof t) {+ const e = cp(t)+ return this.readFromDocument(e)+ }+ return lp(t) ? this.readFromDocument(t) : this.readFromNode(t)+ }+ readFromDocument(t) {+ for (let e = t.firstChild; e; e = e.nextSibling) if (e.nodeType == Node.ELEMENT_NODE) return this.readFromNode(e)+ return null+ }+ readFromNode(t) {+ U()+ }+ }+ function JT(t) {+ return t.getAttributeNS("http://www.w3.org/1999/xlink", "href")+ }+ const QT = [null, "http://www.opengis.net/ows/1.1"],+ tC = Sp(QT, {+ ServiceIdentification: pp(function (t, e) {+ return wp({}, gC, t, e)+ }),+ ServiceProvider: pp(function (t, e) {+ return wp({}, fC, t, e)+ }),+ OperationsMetadata: pp(function (t, e) {+ return wp({}, hC, t, e)+ })+ })+ class eC extends qT {+ constructor() {+ super()+ }+ readFromNode(t) {+ const e = wp({}, tC, t, [])+ return e || null+ }+ }+ const iC = Sp(QT, {+ DeliveryPoint: pp(yS),+ City: pp(yS),+ AdministrativeArea: pp(yS),+ PostalCode: pp(yS),+ Country: pp(yS),+ ElectronicMailAddress: pp(yS)+ }),+ nC = Sp(QT, {+ Value: fp(function (t, e) {+ return yS(t)+ })+ }),+ rC = Sp(QT, {+ AllowedValues: pp(function (t, e) {+ return wp({}, nC, t, e)+ })+ }),+ sC = Sp(QT, {+ Phone: pp(function (t, e) {+ return wp({}, cC, t, e)+ }),+ Address: pp(function (t, e) {+ return wp({}, iC, t, e)+ })+ }),+ oC = Sp(QT, {+ HTTP: pp(function (t, e) {+ return wp({}, aC, t, e)+ })+ }),+ aC = Sp(QT, {+ Get: fp(function (t, e) {+ const i = JT(t)+ if (!i) return+ return wp({ href: i }, uC, t, e)+ }),+ Post: void 0+ }),+ lC = Sp(QT, {+ DCP: pp(function (t, e) {+ return wp({}, oC, t, e)+ })+ }),+ hC = Sp(QT, {+ Operation: function (t, e) {+ const i = t.getAttribute("name"),+ n = wp({}, lC, t, e)+ if (!n) return+ e[e.length - 1][i] = n+ }+ }),+ cC = Sp(QT, { Voice: pp(yS), Facsimile: pp(yS) }),+ uC = Sp(QT, {+ Constraint: fp(function (t, e) {+ const i = t.getAttribute("name")+ if (!i) return+ return wp({ name: i }, rC, t, e)+ })+ }),+ dC = Sp(QT, {+ IndividualName: pp(yS),+ PositionName: pp(yS),+ ContactInfo: pp(function (t, e) {+ return wp({}, sC, t, e)+ })+ }),+ gC = Sp(QT, {+ Abstract: pp(yS),+ AccessConstraints: pp(yS),+ Fees: pp(yS),+ Title: pp(yS),+ ServiceTypeVersion: pp(yS),+ ServiceType: pp(yS)+ }),+ fC = Sp(QT, {+ ProviderName: pp(yS),+ ProviderSite: pp(JT),+ ServiceContact: pp(function (t, e) {+ return wp({}, dC, t, e)+ })+ })+ function pC(t, e, i) {+ i = i || 1e5+ const n = new Array(e).fill(0)+ for (let r = 0, s = t.length; r < s; )+ for (let s = 0; s < e; ++s, ++r) {+ const e = t[r] * i,+ o = e < 0 ? Math.ceil(e - 0.5) : Math.round(e),+ a = o - n[s]+ ;(n[s] = o), (t[r] = a)+ }+ return mC(t)+ }+ function _C(t, e, i) {+ i = i || 1e5+ const n = new Array(e).fill(0),+ r = yC(t)+ for (let t = 0, s = r.length; t < s; ) for (let s = 0; s < e; ++s, ++t) (n[s] += r[t]), (r[t] = n[s] / i)+ return r+ }+ function mC(t) {+ for (let e = 0, i = t.length; e < i; ++e) {+ const i = t[e]+ t[e] = i < 0 ? ~(i << 1) : i << 1+ }+ return xC(t)+ }+ function yC(t) {+ const e = vC(t)+ for (let t = 0, i = e.length; t < i; ++t) {+ const i = e[t]+ e[t] = 1 & i ? ~(i >> 1) : i >> 1+ }+ return e+ }+ function xC(t) {+ let e = ""+ for (let i = 0, n = t.length; i < n; ++i) e += SC(t[i])+ return e+ }+ function vC(t) {+ const e = []+ let i = 0,+ n = 0+ for (let r = 0, s = t.length; r < s; ++r) {+ const s = t.charCodeAt(r) - 63+ ;(i |= (31 & s) << n), s < 32 ? (e.push(i), (i = 0), (n = 0)) : (n += 5)+ }+ return e+ }+ function SC(t) {+ let e,+ i = ""+ for (; t >= 32; ) (e = 63 + (32 | (31 & t))), (i += String.fromCharCode(e)), (t >>= 5)+ return (e = t + 63), (i += String.fromCharCode(e)), i+ }+ const EC = {+ Point: function (t, e, i) {+ const n = t.coordinates+ e && i && RC(n, e, i)+ return new Wr(n)+ },+ LineString: function (t, e) {+ const i = wC(t.arcs, e)+ return new Dd(i)+ },+ Polygon: function (t, e) {+ const i = []+ for (let n = 0, r = t.arcs.length; n < r; ++n) i[n] = wC(t.arcs[n], e)+ return new gs(i)+ },+ MultiPoint: function (t, e, i) {+ const n = t.coordinates+ if (e && i) for (let t = 0, r = n.length; t < r; ++t) RC(n[t], e, i)+ return new kd(n)+ },+ MultiLineString: function (t, e) {+ const i = []+ for (let n = 0, r = t.arcs.length; n < r; ++n) i[n] = wC(t.arcs[n], e)+ return new Nd(i)+ },+ MultiPolygon: function (t, e) {+ const i = []+ for (let n = 0, r = t.arcs.length; n < r; ++n) {+ const r = t.arcs[n],+ s = []+ for (let t = 0, i = r.length; t < i; ++t) s[t] = wC(r[t], e)+ i[n] = s+ }+ return new Gd(i)+ }+ }+ function wC(t, e) {+ const i = []+ let n+ for (let r = 0, s = t.length; r < s; ++r)+ if (((n = t[r]), r > 0 && i.pop(), n >= 0)) {+ const t = e[n]+ for (let e = 0, n = t.length; e < n; ++e) i.push(t[e].slice(0))+ } else {+ const t = e[~n]+ for (let e = t.length - 1; e >= 0; --e) i.push(t[e].slice(0))+ }+ return i+ }+ function TC(t, e, i, n, r, s, o) {+ const a = t.geometries,+ l = []+ for (let t = 0, h = a.length; t < h; ++t) l[t] = CC(a[t], e, i, n, r, s, o)+ return l+ }+ function CC(t, e, i, n, r, s, o) {+ let a = null+ const l = t.type+ if (l) {+ const r = EC[l]+ ;(a = "Point" === l || "MultiPoint" === l ? r(t, i, n) : r(t, e)), (a = Yv(a, !1, o))+ }+ const h = new At({ geometry: a })+ void 0 !== t.id && h.setId(t.id)+ let c = t.properties+ return r && (c || (c = {}), (c[r] = s)), c && h.setProperties(c, !0), h+ }+ function bC(t, e, i) {+ let n = 0,+ r = 0+ for (let s = 0, o = t.length; s < o; ++s) {+ const o = t[s]+ ;(n += o[0]), (r += o[1]), (o[0] = n), (o[1] = r), RC(o, e, i)+ }+ }+ function RC(t, e, i) {+ ;(t[0] = t[0] * e[0] + i[0]), (t[1] = t[1] * e[1] + i[1])+ }+ class PC {+ constructor(t) {+ this.tagName_ = t+ }+ getTagName() {+ return this.tagName_+ }+ }+ class IC extends PC {+ constructor(t, e) {+ super(t), (this.conditions = e), Mt(this.conditions.length >= 2, "At least 2 conditions are required")+ }+ }+ class FC extends IC {+ constructor(t) {+ super("And", Array.prototype.slice.call(arguments))+ }+ }+ class LC extends PC {+ constructor(t, e, i) {+ if ((super("BBOX"), (this.geometryName = t), (this.extent = e), 4 !== e.length))+ throw new Error("Expected an extent with four values ([minX, minY, maxX, maxY])")+ this.srsName = i+ }+ }+ class MC extends PC {+ constructor(t, e, i, n) {+ super(t), (this.geometryName = e || "the_geom"), (this.geometry = i), (this.srsName = n)+ }+ }+ class AC extends MC {+ constructor(t, e, i) {+ super("Contains", t, e, i)+ }+ }+ class OC extends MC {+ constructor(t, e, i, n, r) {+ super("DWithin", t, e, r), (this.distance = i), (this.unit = n)+ }+ }+ class DC extends MC {+ constructor(t, e, i) {+ super("Disjoint", t, e, i)+ }+ }+ class NC extends PC {+ constructor(t, e) {+ super(t), (this.propertyName = e)+ }+ }+ class kC extends NC {+ constructor(t, e, i) {+ super("During", t), (this.begin = e), (this.end = i)+ }+ }+ class GC extends NC {+ constructor(t, e, i, n) {+ super(t, e), (this.expression = i), (this.matchCase = n)+ }+ }+ class jC extends GC {+ constructor(t, e, i) {+ super("PropertyIsEqualTo", t, e, i)+ }+ }+ class UC extends GC {+ constructor(t, e) {+ super("PropertyIsGreaterThan", t, e)+ }+ }+ class BC extends GC {+ constructor(t, e) {+ super("PropertyIsGreaterThanOrEqualTo", t, e)+ }+ }+ class zC extends MC {+ constructor(t, e, i) {+ super("Intersects", t, e, i)+ }+ }+ class XC extends NC {+ constructor(t, e, i) {+ super("PropertyIsBetween", t), (this.lowerBoundary = e), (this.upperBoundary = i)+ }+ }+ class VC extends NC {+ constructor(t, e, i, n, r, s) {+ super("PropertyIsLike", t),+ (this.pattern = e),+ (this.wildCard = void 0 !== i ? i : "*"),+ (this.singleChar = void 0 !== n ? n : "."),+ (this.escapeChar = void 0 !== r ? r : "!"),+ (this.matchCase = s)+ }+ }+ class $C extends NC {+ constructor(t) {+ super("PropertyIsNull", t)+ }+ }+ class WC extends GC {+ constructor(t, e) {+ super("PropertyIsLessThan", t, e)+ }+ }+ class ZC extends GC {+ constructor(t, e) {+ super("PropertyIsLessThanOrEqualTo", t, e)+ }+ }+ class YC extends PC {+ constructor(t) {+ super("Not"), (this.condition = t)+ }+ }+ class HC extends GC {+ constructor(t, e, i) {+ super("PropertyIsNotEqualTo", t, e, i)+ }+ }+ class KC extends IC {+ constructor(t) {+ super("Or", Array.prototype.slice.call(arguments))+ }+ }+ class qC extends PC {+ constructor(t) {+ super("ResourceId"), (this.rid = t)+ }+ }+ class JC extends MC {+ constructor(t, e, i) {+ super("Within", t, e, i)+ }+ }+ function QC(t) {+ const e = [null].concat(Array.prototype.slice.call(arguments))+ return new (Function.prototype.bind.apply(FC, e))()+ }+ function tb(t, e, i) {+ return new LC(t, e, i)+ }+ const eb = {+ "http://www.opengis.net/gml": { boundedBy: pp(cS.prototype.readExtentElement, "bounds") },+ "http://www.opengis.net/wfs/2.0": { member: dp(cS.prototype.readFeaturesInternal) }+ },+ ib = {+ "http://www.opengis.net/wfs": { totalInserted: pp(_S), totalUpdated: pp(_S), totalDeleted: pp(_S) },+ "http://www.opengis.net/wfs/2.0": { totalInserted: pp(_S), totalUpdated: pp(_S), totalDeleted: pp(_S) }+ },+ nb = {+ "http://www.opengis.net/wfs": {+ TransactionSummary: pp(fb, "transactionSummary"),+ InsertResults: pp(yb, "insertIds")+ },+ "http://www.opengis.net/wfs/2.0": {+ TransactionSummary: pp(fb, "transactionSummary"),+ InsertResults: pp(yb, "insertIds")+ }+ },+ rb = {+ "http://www.opengis.net/wfs": { PropertyName: _p(RS) },+ "http://www.opengis.net/wfs/2.0": { PropertyName: _p(RS) }+ },+ sb = {+ "http://www.opengis.net/wfs": {+ Insert: _p(xb),+ Update: _p(wb),+ Delete: _p(Eb),+ Property: _p(Tb),+ Native: _p(Cb)+ },+ "http://www.opengis.net/wfs/2.0": {+ Insert: _p(xb),+ Update: _p(wb),+ Delete: _p(Eb),+ Property: _p(Tb),+ Native: _p(Cb)+ }+ },+ ob = "feature",+ ab = "http://www.w3.org/2000/xmlns/",+ lb = {+ "2.0.0": "http://www.opengis.net/ogc/1.1",+ "1.1.0": "http://www.opengis.net/ogc",+ "1.0.0": "http://www.opengis.net/ogc"+ },+ hb = {+ "2.0.0": "http://www.opengis.net/wfs/2.0",+ "1.1.0": "http://www.opengis.net/wfs",+ "1.0.0": "http://www.opengis.net/wfs"+ },+ cb = {+ "2.0.0": "http://www.opengis.net/fes/2.0",+ "1.1.0": "http://www.opengis.net/fes",+ "1.0.0": "http://www.opengis.net/fes"+ },+ ub = {+ "2.0.0": "http://www.opengis.net/wfs/2.0 http://schemas.opengis.net/wfs/2.0/wfs.xsd",+ "1.1.0": "http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsd",+ "1.0.0": "http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.0.0/wfs.xsd"+ },+ db = { "2.0.0": DS, "1.1.0": AS, "1.0.0": FS }+ function gb(t, e, i, n) {+ Cp(n, sb, yp(t), e, i)+ }+ function fb(t, e) {+ return wp({}, ib, t, e)+ }+ const pb = {+ "http://www.opengis.net/ogc": {+ FeatureId: dp(function (t, e) {+ return t.getAttribute("fid")+ })+ },+ "http://www.opengis.net/ogc/1.1": {+ FeatureId: dp(function (t, e) {+ return t.getAttribute("fid")+ })+ }+ }+ function _b(t, e) {+ Ep(pb, t, e)+ }+ const mb = { "http://www.opengis.net/wfs": { Feature: _b }, "http://www.opengis.net/wfs/2.0": { Feature: _b } }+ function yb(t, e) {+ return wp([], mb, t, e)+ }+ function xb(t, e, i) {+ const n = i[i.length - 1],+ r = n.featureType,+ s = n.featureNS,+ o = n.gmlVersion,+ a = sp(s, r)+ t.appendChild(a),+ 2 === o+ ? FS.prototype.writeFeatureElement(a, e, i)+ : 3 === o+ ? AS.prototype.writeFeatureElement(a, e, i)+ : DS.prototype.writeFeatureElement(a, e, i)+ }+ function vb(t, e, i) {+ const n = i[i.length - 1].version,+ r = lb[n],+ s = sp(r, "Filter"),+ o = sp(r, "FeatureId")+ s.appendChild(o), o.setAttribute("fid", e), t.appendChild(s)+ }+ function Sb(t, e) {+ const i = (t = t || ob) + ":"+ return e.startsWith(i) ? e : i + e+ }+ function Eb(t, e, i) {+ const n = i[i.length - 1]+ Mt(void 0 !== e.getId(), "Features must have an id set")+ const r = n.featureType,+ s = n.featurePrefix,+ o = n.featureNS,+ a = Sb(s, r)+ t.setAttribute("typeName", a), t.setAttributeNS(ab, "xmlns:" + s, o)+ const l = e.getId()+ void 0 !== l && vb(t, l, i)+ }+ function wb(t, e, i) {+ const n = i[i.length - 1]+ Mt(void 0 !== e.getId(), "Features must have an id set")+ const r = n.version,+ s = n.featureType,+ o = n.featurePrefix,+ a = n.featureNS,+ l = Sb(o, s),+ h = e.getGeometryName()+ t.setAttribute("typeName", l), t.setAttributeNS(ab, "xmlns:" + o, a)+ const c = e.getId()+ if (void 0 !== c) {+ const s = e.getKeys(),+ o = []+ for (let t = 0, i = s.length; t < i; t++) {+ const i = e.get(s[t])+ if (void 0 !== i) {+ let e = s[t]+ i && "function" == typeof i.getSimplifiedGeometry && (e = h), o.push({ name: e, value: i })+ }+ }+ Cp({ version: r, gmlVersion: n.gmlVersion, node: t, hasZ: n.hasZ, srsName: n.srsName }, sb, yp("Property"), o, i),+ vb(t, c, i)+ }+ }+ function Tb(t, e, i) {+ const n = i[i.length - 1],+ r = n.version,+ s = hb[r],+ o = sp(s, "2.0.0" === r ? "ValueReference" : "Name"),+ a = n.gmlVersion+ if ((t.appendChild(o), RS(o, e.name), void 0 !== e.value && null !== e.value)) {+ const n = sp(s, "Value")+ t.appendChild(n),+ e.value && "function" == typeof e.value.getSimplifiedGeometry+ ? 2 === a+ ? FS.prototype.writeGeometryElement(n, e.value, i)+ : 3 === a+ ? AS.prototype.writeGeometryElement(n, e.value, i)+ : DS.prototype.writeGeometryElement(n, e.value, i)+ : RS(n, e.value)+ }+ }+ function Cb(t, e, i) {+ e.vendorId && t.setAttribute("vendorId", e.vendorId),+ void 0 !== e.safeToIgnore && t.setAttribute("safeToIgnore", String(e.safeToIgnore)),+ void 0 !== e.value && RS(t, e.value)+ }+ const bb = {+ "http://www.opengis.net/wfs": { Query: _p(Rb) },+ "http://www.opengis.net/wfs/2.0": { Query: _p(Rb) },+ "http://www.opengis.net/ogc": {+ During: _p(Mb),+ And: _p(Ab),+ Or: _p(Ab),+ Not: _p(Ob),+ BBOX: _p(Ib),+ Contains: _p(Fb),+ Intersects: _p(Fb),+ Within: _p(Fb),+ DWithin: _p(Lb),+ PropertyIsEqualTo: _p(Db),+ PropertyIsNotEqualTo: _p(Db),+ PropertyIsLessThan: _p(Db),+ PropertyIsLessThanOrEqualTo: _p(Db),+ PropertyIsGreaterThan: _p(Db),+ PropertyIsGreaterThanOrEqualTo: _p(Db),+ PropertyIsNull: _p(Nb),+ PropertyIsBetween: _p(kb),+ PropertyIsLike: _p(Gb)+ },+ "http://www.opengis.net/fes/2.0": {+ During: _p(Mb),+ And: _p(Ab),+ Or: _p(Ab),+ Not: _p(Ob),+ BBOX: _p(Ib),+ Contains: _p(Fb),+ Disjoint: _p(Fb),+ Intersects: _p(Fb),+ ResourceId: _p(function (t, e, i) {+ t.setAttribute("rid", e.rid)+ }),+ Within: _p(Fb),+ DWithin: _p(Lb),+ PropertyIsEqualTo: _p(Db),+ PropertyIsNotEqualTo: _p(Db),+ PropertyIsLessThan: _p(Db),+ PropertyIsLessThanOrEqualTo: _p(Db),+ PropertyIsGreaterThan: _p(Db),+ PropertyIsGreaterThanOrEqualTo: _p(Db),+ PropertyIsNull: _p(Nb),+ PropertyIsBetween: _p(kb),+ PropertyIsLike: _p(Gb)+ }+ }+ function Rb(t, e, i) {+ const n = i[i.length - 1],+ r = n.version,+ s = n.featurePrefix,+ o = n.featureNS,+ a = n.propertyNames,+ l = n.srsName+ let h, c+ ;(h = s ? Sb(s, e) : e),+ (c = "2.0.0" === r ? "typeNames" : "typeName"),+ t.setAttribute(c, h),+ l && t.setAttribute("srsName", l),+ o && t.setAttributeNS(ab, "xmlns:" + s, o)+ const u = Object.assign({}, n)+ ;(u.node = t), Cp(u, rb, yp("PropertyName"), a, i)+ const d = n.filter+ if (d) {+ const e = sp(Vb(r), "Filter")+ t.appendChild(e), Pb(e, d, i)+ }+ }+ function Pb(t, e, i) {+ const n = i[i.length - 1],+ r = { node: t }+ Object.assign(r, { context: n }), Cp(r, bb, yp(e.getTagName()), [e], i)+ }+ function Ib(t, e, i) {+ const n = i[i.length - 1],+ r = n.context.version+ n.srsName = e.srsName+ const s = db[r]+ Bb(r, t, e.geometryName), s.prototype.writeGeometryElement(t, e.extent, i)+ }+ function Fb(t, e, i) {+ const n = i[i.length - 1],+ r = n.context.version+ n.srsName = e.srsName+ const s = db[r]+ Bb(r, t, e.geometryName), s.prototype.writeGeometryElement(t, e.geometry, i)+ }+ function Lb(t, e, i) {+ const n = i[i.length - 1].context.version+ Fb(t, e, i)+ const r = sp(Vb(n), "Distance")+ RS(r, e.distance.toString()),+ "2.0.0" === n ? r.setAttribute("uom", e.unit) : r.setAttribute("units", e.unit),+ t.appendChild(r)+ }+ function Mb(t, e, i) {+ const n = i[i.length - 1].context.version+ jb(cb[n], "ValueReference", t, e.propertyName)+ const r = sp(lS, "TimePeriod")+ t.appendChild(r)+ const s = sp(lS, "begin")+ r.appendChild(s), zb(s, e.begin)+ const o = sp(lS, "end")+ r.appendChild(o), zb(o, e.end)+ }+ function Ab(t, e, i) {+ const n = i[i.length - 1].context,+ r = { node: t }+ Object.assign(r, { context: n })+ const s = e.conditions+ for (let t = 0, e = s.length; t < e; ++t) {+ const e = s[t]+ Cp(r, bb, yp(e.getTagName()), [e], i)+ }+ }+ function Ob(t, e, i) {+ const n = i[i.length - 1].context,+ r = { node: t }+ Object.assign(r, { context: n })+ const s = e.condition+ Cp(r, bb, yp(s.getTagName()), [s], i)+ }+ function Db(t, e, i) {+ const n = i[i.length - 1].context.version+ void 0 !== e.matchCase && t.setAttribute("matchCase", e.matchCase.toString()),+ Bb(n, t, e.propertyName),+ Ub(n, t, "" + e.expression)+ }+ function Nb(t, e, i) {+ Bb(i[i.length - 1].context.version, t, e.propertyName)+ }+ function kb(t, e, i) {+ const n = i[i.length - 1].context.version,+ r = Vb(n)+ Bb(n, t, e.propertyName)+ const s = sp(r, "LowerBoundary")+ t.appendChild(s), Ub(n, s, "" + e.lowerBoundary)+ const o = sp(r, "UpperBoundary")+ t.appendChild(o), Ub(n, o, "" + e.upperBoundary)+ }+ function Gb(t, e, i) {+ const n = i[i.length - 1].context.version+ t.setAttribute("wildCard", e.wildCard),+ t.setAttribute("singleChar", e.singleChar),+ t.setAttribute("escapeChar", e.escapeChar),+ void 0 !== e.matchCase && t.setAttribute("matchCase", e.matchCase.toString()),+ Bb(n, t, e.propertyName),+ Ub(n, t, "" + e.pattern)+ }+ function jb(t, e, i, n) {+ const r = sp(t, e)+ RS(r, n), i.appendChild(r)+ }+ function Ub(t, e, i) {+ jb(Vb(t), "Literal", e, i)+ }+ function Bb(t, e, i) {+ "2.0.0" === t ? jb(cb[t], "ValueReference", e, i) : jb(lb[t], "PropertyName", e, i)+ }+ function zb(t, e) {+ const i = sp(lS, "TimeInstant")+ t.appendChild(i)+ const n = sp(lS, "timePosition")+ i.appendChild(n), RS(n, e)+ }+ function Xb(t, e, i) {+ const n = i[i.length - 1],+ r = Object.assign({}, n)+ ;(r.node = t), Cp(r, bb, yp("Query"), e, i)+ }+ function Vb(t) {+ let e+ return (e = "2.0.0" === t ? cb[t] : lb[t]), e+ }+ const $b = 1,+ Wb = 2,+ Zb = 3,+ Yb = 4,+ Hb = 5,+ Kb = 6,+ qb = 7,+ Jb = 15,+ Qb = 16,+ tR = 17+ class eR {+ constructor(t) {+ ;(this.view_ = t),+ (this.pos_ = 0),+ (this.initialized_ = !1),+ (this.isLittleEndian_ = !1),+ (this.hasZ_ = !1),+ (this.hasM_ = !1),+ (this.srid_ = null),+ (this.layout_ = "XY")+ }+ readUint8() {+ return this.view_.getUint8(this.pos_++)+ }+ readUint32(t) {+ return this.view_.getUint32((this.pos_ += 4) - 4, void 0 !== t ? t : this.isLittleEndian_)+ }+ readDouble(t) {+ return this.view_.getFloat64((this.pos_ += 8) - 8, void 0 !== t ? t : this.isLittleEndian_)+ }+ readPoint() {+ const t = []+ return (+ t.push(this.readDouble()),+ t.push(this.readDouble()),+ this.hasZ_ && t.push(this.readDouble()),+ this.hasM_ && t.push(this.readDouble()),+ t+ )+ }+ readLineString() {+ const t = this.readUint32(),+ e = []+ for (let i = 0; i < t; i++) e.push(this.readPoint())+ return e+ }+ readPolygon() {+ const t = this.readUint32(),+ e = []+ for (let i = 0; i < t; i++) e.push(this.readLineString())+ return e+ }+ readWkbHeader(t) {+ const e = this.readUint8() > 0,+ i = this.readUint32(e),+ n = Math.floor((268435455 & i) / 1e3),+ r = Boolean(2147483648 & i) || 1 === n || 3 === n,+ s = Boolean(1073741824 & i) || 2 === n || 3 === n,+ o = Boolean(536870912 & i),+ a = (268435455 & i) % 1e3,+ l = ["XY", r ? "Z" : "", s ? "M" : ""].join(""),+ h = o ? this.readUint32(e) : null+ if (void 0 !== t && t !== a) throw new Error("Unexpected WKB geometry type " + a)+ if (this.initialized_) {+ if (this.isLittleEndian_ !== e) throw new Error("Inconsistent endian")+ if (this.layout_ !== l) throw new Error("Inconsistent geometry layout")+ if (h && this.srid_ !== h) throw new Error("Inconsistent coordinate system (SRID)")+ } else+ (this.isLittleEndian_ = e),+ (this.hasZ_ = r),+ (this.hasM_ = s),+ (this.layout_ = l),+ (this.srid_ = h),+ (this.initialized_ = !0)+ return a+ }+ readWkbPayload(t) {+ switch (t) {+ case $b:+ return this.readPoint()+ case Wb:+ return this.readLineString()+ case Zb:+ case tR:+ return this.readPolygon()+ case Yb:+ return this.readMultiPoint()+ case Hb:+ return this.readMultiLineString()+ case Kb:+ case Jb:+ case Qb:+ return this.readMultiPolygon()+ case qb:+ return this.readGeometryCollection()+ default:+ throw new Error("Unsupported WKB geometry type " + t + " is found")+ }+ }+ readWkbBlock(t) {+ return this.readWkbPayload(this.readWkbHeader(t))+ }+ readWkbCollection(t, e) {+ const i = this.readUint32(),+ n = []+ for (let r = 0; r < i; r++) {+ const i = t.call(this, e)+ i && n.push(i)+ }+ return n+ }+ readMultiPoint() {+ return this.readWkbCollection(this.readWkbBlock, $b)+ }+ readMultiLineString() {+ return this.readWkbCollection(this.readWkbBlock, Wb)+ }+ readMultiPolygon() {+ return this.readWkbCollection(this.readWkbBlock, Zb)+ }+ readGeometryCollection() {+ return this.readWkbCollection(this.readGeometry)+ }+ readGeometry() {+ const t = this.readWkbHeader(),+ e = this.readWkbPayload(t)+ switch (t) {+ case $b:+ return new Wr(e, this.layout_)+ case Wb:+ return new Dd(e, this.layout_)+ case Zb:+ case tR:+ return new gs(e, this.layout_)+ case Yb:+ return new kd(e, this.layout_)+ case Hb:+ return new Nd(e, this.layout_)+ case Kb:+ case Jb:+ case Qb:+ return new Gd(e, this.layout_)+ case qb:+ return new Md(e)+ default:+ return null+ }+ }+ getSrid() {+ return this.srid_+ }+ }+ class iR {+ constructor(t) {+ ;(t = t || {}),+ (this.layout_ = t.layout),+ (this.isLittleEndian_ = !1 !== t.littleEndian),+ (this.isEWKB_ = !1 !== t.ewkb),+ (this.writeQueue_ = []),+ (this.nodata_ = Object.assign({ X: 0, Y: 0, Z: 0, M: 0 }, t.nodata))+ }+ writeUint8(t) {+ this.writeQueue_.push([1, t])+ }+ writeUint32(t) {+ this.writeQueue_.push([4, t])+ }+ writeDouble(t) {+ this.writeQueue_.push([8, t])+ }+ writePoint(t, e) {+ const i = Object.assign.apply(+ null,+ e.split("").map((e, i) => ({ [e]: t[i] }))+ )+ for (const t of this.layout_) this.writeDouble(t in i ? i[t] : this.nodata_[t])+ }+ writeLineString(t, e) {+ this.writeUint32(t.length)+ for (let i = 0; i < t.length; i++) this.writePoint(t[i], e)+ }+ writePolygon(t, e) {+ this.writeUint32(t.length)+ for (let i = 0; i < t.length; i++) this.writeLineString(t[i], e)+ }+ writeWkbHeader(t, e) {+ ;(t %= 1e3),+ this.layout_.includes("Z") && (t += this.isEWKB_ ? 2147483648 : 1e3),+ this.layout_.includes("M") && (t += this.isEWKB_ ? 1073741824 : 2e3),+ this.isEWKB_ && Number.isInteger(e) && (t |= 536870912),+ this.writeUint8(this.isLittleEndian_ ? 1 : 0),+ this.writeUint32(t),+ this.isEWKB_ && Number.isInteger(e) && this.writeUint32(e)+ }+ writeMultiPoint(t, e) {+ this.writeUint32(t.length)+ for (let i = 0; i < t.length; i++) this.writeWkbHeader(1), this.writePoint(t[i], e)+ }+ writeMultiLineString(t, e) {+ this.writeUint32(t.length)+ for (let i = 0; i < t.length; i++) this.writeWkbHeader(2), this.writeLineString(t[i], e)+ }+ writeMultiPolygon(t, e) {+ this.writeUint32(t.length)+ for (let i = 0; i < t.length; i++) this.writeWkbHeader(3), this.writePolygon(t[i], e)+ }+ writeGeometryCollection(t) {+ this.writeUint32(t.length)+ for (let e = 0; e < t.length; e++) this.writeGeometry(t[e])+ }+ findMinimumLayout(t, e = "XYZM") {+ if (t instanceof mr) return (i = t.getLayout()) === (n = e) ? i : "XYZM" === i ? n : "XYZM" === n ? i : "XY"+ var i, n+ if (t instanceof Md) {+ const i = t.getGeometriesArray()+ for (let t = 0; t < i.length && "XY" !== e; t++) e = this.findMinimumLayout(i[t], e)+ }+ return e+ }+ writeGeometry(t, e) {+ const i = {+ Point: $b,+ LineString: Wb,+ Polygon: Zb,+ MultiPoint: Yb,+ MultiLineString: Hb,+ MultiPolygon: Kb,+ GeometryCollection: qb+ },+ n = t.getType(),+ r = i[n]+ if (!r) throw new Error("GeometryType " + n + " is not supported")+ if ((this.layout_ || (this.layout_ = this.findMinimumLayout(t)), this.writeWkbHeader(r, e), t instanceof mr)) {+ ;({+ Point: this.writePoint,+ LineString: this.writeLineString,+ Polygon: this.writePolygon,+ MultiPoint: this.writeMultiPoint,+ MultiLineString: this.writeMultiLineString,+ MultiPolygon: this.writeMultiPolygon+ })[n].call(this, t.getCoordinates(), t.getLayout())+ } else t instanceof Md && this.writeGeometryCollection(t.getGeometriesArray())+ }+ getBuffer() {+ const t = this.writeQueue_.reduce((t, e) => t + e[0], 0),+ e = new ArrayBuffer(t),+ i = new DataView(e)+ let n = 0+ return (+ this.writeQueue_.forEach((t) => {+ switch (t[0]) {+ case 1:+ i.setUint8(n, t[1])+ break+ case 4:+ i.setUint32(n, t[1], this.isLittleEndian_)+ break+ case 8:+ i.setFloat64(n, t[1], this.isLittleEndian_)+ }+ n += t[0]+ }),+ e+ )+ }+ }+ function nR(t) {+ return "string" == typeof t+ ? (function (t) {+ const e = new Uint8Array(t.length / 2)+ for (let i = 0; i < t.length / 2; i++) e[i] = parseInt(t.substr(2 * i, 2), 16)+ return new DataView(e.buffer)+ })(t)+ : ArrayBuffer.isView(t)+ ? t instanceof DataView+ ? t+ : new DataView(t.buffer, t.byteOffset, t.byteLength)+ : t instanceof ArrayBuffer+ ? new DataView(t)+ : null+ }+ const rR = { POINT: Wr, LINESTRING: Dd, POLYGON: gs, MULTIPOINT: kd, MULTILINESTRING: Nd, MULTIPOLYGON: Gd },+ sR = "EMPTY",+ oR = 0,+ aR = 1,+ lR = 2,+ hR = 3,+ cR = 4,+ uR = 5,+ dR = 6,+ gR = {+ Point: "POINT",+ LineString: "LINESTRING",+ Polygon: "POLYGON",+ MultiPoint: "MULTIPOINT",+ MultiLineString: "MULTILINESTRING",+ MultiPolygon: "MULTIPOLYGON",+ GeometryCollection: "GEOMETRYCOLLECTION",+ Circle: "CIRCLE"+ }+ class fR {+ constructor(t) {+ ;(this.wkt = t), (this.index_ = -1)+ }+ isAlpha_(t) {+ return (t >= "a" && t <= "z") || (t >= "A" && t <= "Z")+ }+ isNumeric_(t, e) {+ return (e = void 0 !== e && e), (t >= "0" && t <= "9") || ("." == t && !e)+ }+ isWhiteSpace_(t) {+ return " " == t || "\t" == t || "\r" == t || "\n" == t+ }+ nextChar_() {+ return this.wkt.charAt(++this.index_)+ }+ nextToken() {+ const t = this.nextChar_(),+ e = this.index_+ let i,+ n = t+ if ("(" == t) i = lR+ else if ("," == t) i = uR+ else if (")" == t) i = hR+ else if (this.isNumeric_(t) || "-" == t) (i = cR), (n = this.readNumber_())+ else if (this.isAlpha_(t)) (i = aR), (n = this.readText_())+ else {+ if (this.isWhiteSpace_(t)) return this.nextToken()+ if ("" !== t) throw new Error("Unexpected character: " + t)+ i = dR+ }+ return { position: e, value: n, type: i }+ }+ readNumber_() {+ let t+ const e = this.index_+ let i = !1,+ n = !1+ do {+ "." == t ? (i = !0) : ("e" != t && "E" != t) || (n = !0), (t = this.nextChar_())+ } while (this.isNumeric_(t, i) || (!n && ("e" == t || "E" == t)) || (n && ("-" == t || "+" == t)))+ return parseFloat(this.wkt.substring(e, this.index_--))+ }+ readText_() {+ let t+ const e = this.index_+ do {+ t = this.nextChar_()+ } while (this.isAlpha_(t))+ return this.wkt.substring(e, this.index_--).toUpperCase()+ }+ }+ class pR {+ constructor(t) {+ ;(this.lexer_ = t), (this.token_ = { position: 0, type: oR }), (this.layout_ = "XY")+ }+ consume_() {+ this.token_ = this.lexer_.nextToken()+ }+ isTokenType(t) {+ return this.token_.type == t+ }+ match(t) {+ const e = this.isTokenType(t)+ return e && this.consume_(), e+ }+ parse() {+ return this.consume_(), this.parseGeometry_()+ }+ parseGeometryLayout_() {+ let t = "XY"+ const e = this.token_+ if (this.isTokenType(aR)) {+ const i = e.value+ "Z" === i ? (t = "XYZ") : "M" === i ? (t = "XYM") : "ZM" === i && (t = "XYZM"), "XY" !== t && this.consume_()+ }+ return t+ }+ parseGeometryCollectionText_() {+ if (this.match(lR)) {+ const t = []+ do {+ t.push(this.parseGeometry_())+ } while (this.match(uR))+ if (this.match(hR)) return t+ }+ throw new Error(this.formatErrorMessage_())+ }+ parsePointText_() {+ if (this.match(lR)) {+ const t = this.parsePoint_()+ if (this.match(hR)) return t+ }+ throw new Error(this.formatErrorMessage_())+ }+ parseLineStringText_() {+ if (this.match(lR)) {+ const t = this.parsePointList_()+ if (this.match(hR)) return t+ }+ throw new Error(this.formatErrorMessage_())+ }+ parsePolygonText_() {+ if (this.match(lR)) {+ const t = this.parseLineStringTextList_()+ if (this.match(hR)) return t+ }+ throw new Error(this.formatErrorMessage_())+ }+ parseMultiPointText_() {+ if (this.match(lR)) {+ let t+ if (((t = this.token_.type == lR ? this.parsePointTextList_() : this.parsePointList_()), this.match(hR)))+ return t+ }+ throw new Error(this.formatErrorMessage_())+ }+ parseMultiLineStringText_() {+ if (this.match(lR)) {+ const t = this.parseLineStringTextList_()+ if (this.match(hR)) return t+ }+ throw new Error(this.formatErrorMessage_())+ }+ parseMultiPolygonText_() {+ if (this.match(lR)) {+ const t = this.parsePolygonTextList_()+ if (this.match(hR)) return t+ }+ throw new Error(this.formatErrorMessage_())+ }+ parsePoint_() {+ const t = [],+ e = this.layout_.length+ for (let i = 0; i < e; ++i) {+ const e = this.token_+ if (!this.match(cR)) break+ t.push(e.value)+ }+ if (t.length == e) return t+ throw new Error(this.formatErrorMessage_())+ }+ parsePointList_() {+ const t = [this.parsePoint_()]+ for (; this.match(uR); ) t.push(this.parsePoint_())+ return t+ }+ parsePointTextList_() {+ const t = [this.parsePointText_()]+ for (; this.match(uR); ) t.push(this.parsePointText_())+ return t+ }+ parseLineStringTextList_() {+ const t = [this.parseLineStringText_()]+ for (; this.match(uR); ) t.push(this.parseLineStringText_())+ return t+ }+ parsePolygonTextList_() {+ const t = [this.parsePolygonText_()]+ for (; this.match(uR); ) t.push(this.parsePolygonText_())+ return t+ }+ isEmptyGeometry_() {+ const t = this.isTokenType(aR) && this.token_.value == sR+ return t && this.consume_(), t+ }+ formatErrorMessage_() {+ return (+ "Unexpected `" + this.token_.value + "` at position " + this.token_.position + " in `" + this.lexer_.wkt + "`"+ )+ }+ parseGeometry_() {+ const t = this.token_+ if (this.match(aR)) {+ const e = t.value+ this.layout_ = this.parseGeometryLayout_()+ const i = this.isEmptyGeometry_()+ if ("GEOMETRYCOLLECTION" == e) {+ if (i) return new Md([])+ const t = this.parseGeometryCollectionText_()+ return new Md(t)+ }+ const n = rR[e]+ if (!n) throw new Error("Invalid geometry type: " + e)+ let r+ if (i) r = "POINT" == e ? [NaN, NaN] : []+ else+ switch (e) {+ case "POINT":+ r = this.parsePointText_()+ break+ case "LINESTRING":+ r = this.parseLineStringText_()+ break+ case "POLYGON":+ r = this.parsePolygonText_()+ break+ case "MULTIPOINT":+ r = this.parseMultiPointText_()+ break+ case "MULTILINESTRING":+ r = this.parseMultiLineStringText_()+ break+ case "MULTIPOLYGON":+ r = this.parseMultiPolygonText_()+ }+ return new n(r, this.layout_)+ }+ throw new Error(this.formatErrorMessage_())+ }+ }+ function _R(t) {+ const e = t.getCoordinates()+ return 0 === e.length ? "" : e.join(" ")+ }+ function mR(t) {+ const e = t.getCoordinates(),+ i = []+ for (let t = 0, n = e.length; t < n; ++t) i.push(e[t].join(" "))+ return i.join(",")+ }+ function yR(t) {+ const e = [],+ i = t.getLinearRings()+ for (let t = 0, n = i.length; t < n; ++t) e.push("(" + mR(i[t]) + ")")+ return e.join(",")+ }+ const xR = {+ Point: _R,+ LineString: mR,+ Polygon: yR,+ MultiPoint: function (t) {+ const e = [],+ i = t.getPoints()+ for (let t = 0, n = i.length; t < n; ++t) e.push("(" + _R(i[t]) + ")")+ return e.join(",")+ },+ MultiLineString: function (t) {+ const e = [],+ i = t.getLineStrings()+ for (let t = 0, n = i.length; t < n; ++t) e.push("(" + mR(i[t]) + ")")+ return e.join(",")+ },+ MultiPolygon: function (t) {+ const e = [],+ i = t.getPolygons()+ for (let t = 0, n = i.length; t < n; ++t) e.push("(" + yR(i[t]) + ")")+ return e.join(",")+ },+ GeometryCollection: function (t) {+ const e = [],+ i = t.getGeometries()+ for (let t = 0, n = i.length; t < n; ++t) e.push(vR(i[t]))+ return e.join(",")+ }+ }+ function vR(t) {+ const e = t.getType(),+ i = (0, xR[e])(t)+ let n = gR[e]+ if ("function" == typeof t.getFlatCoordinates) {+ const e = (function (t) {+ const e = t.getLayout()+ let i = ""+ return ("XYZ" !== e && "XYZM" !== e) || (i += "Z"), ("XYM" !== e && "XYZM" !== e) || (i += "M"), i+ })(t)+ e.length > 0 && (n += " " + e)+ }+ return 0 === i.length ? n + " " + sR : n + "(" + i + ")"+ }+ const SR = [null, "http://www.opengis.net/wms", "http://www.opengis.net/sld"]+ function ER(t) {+ return Je(t[0].version, "1.3") >= 0+ }+ const wR = Sp(SR, {+ Service: pp(function (t, e) {+ return wp({}, ER(e) ? RR : bR, t, e)+ }),+ Capability: pp(function (t, e) {+ return wp({}, TR, t, e)+ })+ }),+ TR = Sp(SR, {+ Request: pp(function (t, e) {+ return wp({}, kR, t, e)+ }),+ Exception: pp(function (t, e) {+ return wp([], LR, t, e)+ }),+ Layer: pp(function (t, e) {+ const i = wp({}, ER(e) ? OR : AR, t, e)+ if (void 0 === i.Layer) return Object.assign(i, $R(t, e))+ return i+ }),+ UserDefinedSymbolization: pp(function (t, e) {+ return {+ SupportSLD: !!dS(t.getAttribute("SupportSLD")),+ UserLayer: !!dS(t.getAttribute("UserLayer")),+ UserStyle: !!dS(t.getAttribute("UserStyle")),+ RemoteWFS: !!dS(t.getAttribute("RemoteWFS")),+ InlineFeatureData: !!dS(t.getAttribute("InlineFeatureData")),+ RemoteWCS: !!dS(t.getAttribute("RemoteWCS"))+ }+ })+ })+ const CR = {+ Name: pp(yS),+ Title: pp(yS),+ Abstract: pp(yS),+ KeywordList: pp(HR),+ OnlineResource: pp(JT),+ ContactInformation: pp(function (t, e) {+ return wp({}, PR, t, e)+ }),+ Fees: pp(yS),+ AccessConstraints: pp(yS)+ },+ bR = Sp(SR, CR),+ RR = Sp(SR, { ...CR, LayerLimit: pp(_S), MaxWidth: pp(_S), MaxHeight: pp(_S) }),+ PR = Sp(SR, {+ ContactPersonPrimary: pp(function (t, e) {+ return wp({}, IR, t, e)+ }),+ ContactPosition: pp(yS),+ ContactAddress: pp(function (t, e) {+ return wp({}, FR, t, e)+ }),+ ContactVoiceTelephone: pp(yS),+ ContactFacsimileTelephone: pp(yS),+ ContactElectronicMailAddress: pp(yS)+ }),+ IR = Sp(SR, { ContactPerson: pp(yS), ContactOrganization: pp(yS) }),+ FR = Sp(SR, {+ AddressType: pp(yS),+ Address: pp(yS),+ City: pp(yS),+ StateOrProvince: pp(yS),+ PostCode: pp(yS),+ Country: pp(yS)+ }),+ LR = Sp(SR, { Format: dp(yS) }),+ MR = {+ Name: pp(yS),+ Title: pp(yS),+ Abstract: pp(yS),+ KeywordList: pp(HR),+ BoundingBox: fp(VR),+ Dimension: fp(function (t, e) {+ const i = {+ name: t.getAttribute("name"),+ units: t.getAttribute("units"),+ unitSymbol: t.getAttribute("unitSymbol")+ }+ ER(e) &&+ Object.assign(i, {+ default: t.getAttribute("default"),+ multipleValues: dS(t.getAttribute("multipleValues")),+ nearestValue: dS(t.getAttribute("nearestValue")),+ current: dS(t.getAttribute("current")),+ values: yS(t)+ })+ return i+ }),+ Attribution: pp(function (t, e) {+ return wp({}, DR, t, e)+ }),+ AuthorityURL: fp(function (t, e) {+ const i = WR(t, e)+ if (i) return (i.name = t.getAttribute("name")), i+ return+ }),+ Identifier: fp(yS),+ MetadataURL: fp(function (t, e) {+ const i = WR(t, e)+ if (i) return (i.type = t.getAttribute("type")), i+ return+ }),+ DataURL: fp(WR),+ FeatureListURL: fp(WR),+ Style: fp(function (t, e) {+ return wp({}, BR, t, e)+ }),+ Layer: fp($R)+ },+ AR = Sp(SR, {+ ...MR,+ SRS: fp(yS),+ Extent: pp(function (t, e) {+ return {+ name: t.getAttribute("name"),+ default: t.getAttribute("default"),+ nearestValue: dS(t.getAttribute("nearestValue"))+ }+ }),+ ScaleHint: fp(function (t, e) {+ return { min: pS(t.getAttribute("min")), max: pS(t.getAttribute("max")) }+ }),+ LatLonBoundingBox: pp((t, e) => VR(t, e, !1)),+ Layer: fp($R)+ }),+ OR = Sp(SR, {+ ...MR,+ CRS: fp(yS),+ EX_GeographicBoundingBox: pp(function (t, e) {+ const i = wp({}, NR, t, e)+ if (!i) return+ const n = i.westBoundLongitude,+ r = i.southBoundLatitude,+ s = i.eastBoundLongitude,+ o = i.northBoundLatitude+ if (void 0 === n || void 0 === r || void 0 === s || void 0 === o) return+ return [n, r, s, o]+ }),+ MinScaleDenominator: pp(fS),+ MaxScaleDenominator: pp(fS),+ Layer: fp($R)+ }),+ DR = Sp(SR, { Title: pp(yS), OnlineResource: pp(JT), LogoURL: pp(YR) }),+ NR = Sp(SR, {+ westBoundLongitude: pp(fS),+ eastBoundLongitude: pp(fS),+ southBoundLatitude: pp(fS),+ northBoundLatitude: pp(fS)+ }),+ kR = Sp(SR, {+ GetCapabilities: pp(ZR),+ GetMap: pp(ZR),+ GetFeatureInfo: pp(ZR),+ DescribeLayer: pp(ZR),+ GetLegendGraphic: pp(ZR)+ }),+ GR = Sp(SR, {+ Format: fp(yS),+ DCPType: fp(function (t, e) {+ return wp({}, jR, t, e)+ })+ }),+ jR = Sp(SR, {+ HTTP: pp(function (t, e) {+ return wp({}, UR, t, e)+ })+ }),+ UR = Sp(SR, { Get: pp(WR), Post: pp(WR) }),+ BR = Sp(SR, {+ Name: pp(yS),+ Title: pp(yS),+ Abstract: pp(yS),+ LegendURL: fp(YR),+ StyleSheetURL: pp(WR),+ StyleURL: pp(WR)+ }),+ zR = Sp(SR, { Format: pp(yS), OnlineResource: pp(JT) }),+ XR = Sp(SR, { Keyword: dp(yS) })+ function VR(t, e, i = !0) {+ const n = {+ extent: [+ pS(t.getAttribute("minx")),+ pS(t.getAttribute("miny")),+ pS(t.getAttribute("maxx")),+ pS(t.getAttribute("maxy"))+ ],+ res: [pS(t.getAttribute("resx")), pS(t.getAttribute("resy"))]+ }+ return i ? (ER(e) ? (n.crs = t.getAttribute("CRS")) : (n.srs = t.getAttribute("SRS")), n) : n+ }+ function $R(t, e) {+ const i = ER(e),+ n = e[e.length - 1],+ r = wp({}, i ? OR : AR, t, e)+ if (!r) return+ let s = dS(t.getAttribute("queryable"))+ void 0 === s && (s = n.queryable), (r.queryable = void 0 !== s && s)+ let o = mS(t.getAttribute("cascaded"))+ void 0 === o && (o = n.cascaded), (r.cascaded = o)+ let a = dS(t.getAttribute("opaque"))+ void 0 === a && (a = n.opaque), (r.opaque = void 0 !== a && a)+ let l = dS(t.getAttribute("noSubsets"))+ void 0 === l && (l = n.noSubsets), (r.noSubsets = void 0 !== l && l)+ let h = pS(t.getAttribute("fixedWidth"))+ h || (h = n.fixedWidth), (r.fixedWidth = h)+ let c = pS(t.getAttribute("fixedHeight"))+ c || (c = n.fixedHeight), (r.fixedHeight = c)+ const u = ["Style", "AuthorityURL"]+ i ? u.push("CRS") : u.push("SRS", "Dimension"),+ u.forEach(function (t) {+ if (t in n) {+ const e = r[t] || []+ r[t] = e.concat(n[t])+ }+ })+ const d = ["BoundingBox", "Attribution"]+ return (+ i+ ? d.push("Dimension", "EX_GeographicBoundingBox", "MinScaleDenominator", "MaxScaleDenominator")+ : d.push("LatLonBoundingBox", "ScaleHint", "Extent"),+ d.forEach(function (t) {+ if (!(t in r)) {+ const e = n[t]+ r[t] = e+ }+ }),+ r+ )+ }+ function WR(t, e) {+ return wp({}, zR, t, e)+ }+ function ZR(t, e) {+ return wp({}, GR, t, e)+ }+ function YR(t, e) {+ const i = WR(t, e)+ if (i) {+ const e = [mS(t.getAttribute("width")), mS(t.getAttribute("height"))]+ return (i.size = e), i+ }+ }+ function HR(t, e) {+ return wp([], XR, t, e)+ }+ const KR = [null, "http://www.opengis.net/wmts/1.0"],+ qR = [null, "http://www.opengis.net/ows/1.1"],+ JR = Sp(KR, {+ Contents: pp(function (t, e) {+ return wp({}, QR, t, e)+ })+ })+ const QR = Sp(KR, {+ Layer: fp(function (t, e) {+ return wp({}, tP, t, e)+ }),+ TileMatrixSet: fp(function (t, e) {+ return wp({}, aP, t, e)+ })+ }),+ tP = Sp(+ KR,+ {+ Style: fp(function (t, e) {+ const i = wp({}, eP, t, e)+ if (!i) return+ const n = "true" === t.getAttribute("isDefault")+ return (i.isDefault = n), i+ }),+ Format: fp(yS),+ TileMatrixSetLink: fp(function (t, e) {+ return wp({}, iP, t, e)+ }),+ Dimension: fp(function (t, e) {+ return wp({}, sP, t, e)+ }),+ ResourceURL: fp(function (t, e) {+ const i = t.getAttribute("format"),+ n = t.getAttribute("template"),+ r = t.getAttribute("resourceType"),+ s = {}+ i && (s.format = i)+ n && (s.template = n)+ r && (s.resourceType = r)+ return s+ })+ },+ Sp(qR, {+ Title: pp(yS),+ Abstract: pp(yS),+ WGS84BoundingBox: pp(hP),+ BoundingBox: fp(function (t, e) {+ const i = t.getAttribute("crs"),+ n = wp([], oP, t, e)+ if (2 != n.length) return+ return { extent: Bt(n), crs: i }+ }),+ Identifier: pp(yS)+ })+ ),+ eP = Sp(+ KR,+ {+ LegendURL: fp(function (t, e) {+ const i = {}+ return (i.format = t.getAttribute("format")), (i.href = JT(t)), i+ })+ },+ Sp(qR, { Title: pp(yS), Identifier: pp(yS) })+ ),+ iP = Sp(KR, {+ TileMatrixSet: pp(yS),+ TileMatrixSetLimits: pp(function (t, e) {+ return wp([], nP, t, e)+ })+ }),+ nP = Sp(KR, {+ TileMatrixLimits: dp(function (t, e) {+ return wp({}, rP, t, e)+ })+ }),+ rP = Sp(KR, { TileMatrix: pp(yS), MinTileRow: pp(_S), MaxTileRow: pp(_S), MinTileCol: pp(_S), MaxTileCol: pp(_S) }),+ sP = Sp(KR, { Default: pp(yS), Value: fp(yS) }, Sp(qR, { Identifier: pp(yS) })),+ oP = Sp(qR, { LowerCorner: dp(cP), UpperCorner: dp(cP) }),+ aP = Sp(+ KR,+ {+ WellKnownScaleSet: pp(yS),+ TileMatrix: fp(function (t, e) {+ return wp({}, lP, t, e)+ })+ },+ Sp(qR, { SupportedCRS: pp(yS), Identifier: pp(yS), BoundingBox: pp(hP) })+ ),+ lP = Sp(+ KR,+ {+ TopLeftCorner: pp(cP),+ ScaleDenominator: pp(fS),+ TileWidth: pp(_S),+ TileHeight: pp(_S),+ MatrixWidth: pp(_S),+ MatrixHeight: pp(_S)+ },+ Sp(qR, { Identifier: pp(yS) })+ )+ function hP(t, e) {+ const i = wp([], oP, t, e)+ if (2 == i.length) return Bt(i)+ }+ function cP(t, e) {+ const i = yS(t).split(/\s+/)+ if (!i || 2 != i.length) return+ const n = +i[0],+ r = +i[1]+ return isNaN(n) || isNaN(r) ? void 0 : [n, r]+ }+ const uP = ["fullscreenchange", "webkitfullscreenchange"],+ dP = "enterfullscreen",+ gP = "leavefullscreen"+ function fP(t) {+ const e = t.body+ return !!(e.webkitRequestFullscreen || (e.requestFullscreen && t.fullscreenEnabled))+ }+ function pP(t) {+ return !(!t.webkitIsFullScreen && !t.fullscreenElement)+ }+ function _P(t) {+ t.requestFullscreen ? t.requestFullscreen() : t.webkitRequestFullscreen && t.webkitRequestFullscreen()+ }+ const mP = "projection",+ yP = "coordinateFormat"+ const xP = 0.75,+ vP = 0.1+ const SP = "units",+ EP = [1, 2, 5],+ wP = 25.4 / 0.28+ const TP = 0,+ CP = 1+ var bP = {}+ return (+ (bP.Collection = Z),+ (bP.Collection.CollectionEvent = W),+ (bP.DataTile = Lt),+ (bP.DataTile.asArrayLike = bt),+ (bP.DataTile.asImageLike = Ct),+ (bP.DataTile.disposedError = Rt),+ (bP.DataTile.toArray = It),+ (bP.Disposable = _),+ (bP.Feature = At),+ (bP.Feature.createStyleFunction = Ot),+ (bP.Geolocation = class extends V {+ constructor(t) {+ super(),+ this.on,+ this.once,+ this.un,+ (t = t || {}),+ (this.position_ = null),+ (this.transform_ = xn),+ (this.watchId_ = void 0),+ this.addChangeListener(Ts, this.handleProjectionChanged_),+ this.addChangeListener(bs, this.handleTrackingChanged_),+ void 0 !== t.projection && this.setProjection(t.projection),+ void 0 !== t.trackingOptions && this.setTrackingOptions(t.trackingOptions),+ this.setTracking(void 0 !== t.tracking && t.tracking)+ }+ disposeInternal() {+ this.setTracking(!1), super.disposeInternal()+ }+ handleProjectionChanged_() {+ const t = this.getProjection()+ t &&+ ((this.transform_ = Ln(En("EPSG:4326"), t)), this.position_ && this.set(ws, this.transform_(this.position_)))+ }+ handleTrackingChanged_() {+ if ("geolocation" in navigator) {+ const t = this.getTracking()+ t && void 0 === this.watchId_+ ? (this.watchId_ = navigator.geolocation.watchPosition(+ this.positionChange_.bind(this),+ this.positionError_.bind(this),+ this.getTrackingOptions()+ ))+ : t ||+ void 0 === this.watchId_ ||+ (navigator.geolocation.clearWatch(this.watchId_), (this.watchId_ = void 0))+ }+ }+ positionChange_(t) {+ const e = t.coords+ this.set(ys, e.accuracy),+ this.set(vs, null === e.altitude ? void 0 : e.altitude),+ this.set(Ss, null === e.altitudeAccuracy ? void 0 : e.altitudeAccuracy),+ this.set(Es, null === e.heading ? void 0 : Oe(e.heading)),+ this.position_+ ? ((this.position_[0] = e.longitude), (this.position_[1] = e.latitude))+ : (this.position_ = [e.longitude, e.latitude])+ const i = this.transform_(this.position_)+ this.set(ws, i.slice()), this.set(Cs, null === e.speed ? void 0 : e.speed)+ const n = fs(this.position_, e.accuracy)+ n.applyTransform(this.transform_), this.set(xs, n), this.changed()+ }+ positionError_(t) {+ this.dispatchEvent(new Is(t))+ }+ getAccuracy() {+ return this.get(ys)+ }+ getAccuracyGeometry() {+ return this.get(xs) || null+ }+ getAltitude() {+ return this.get(vs)+ }+ getAltitudeAccuracy() {+ return this.get(Ss)+ }+ getHeading() {+ return this.get(Es)+ }+ getPosition() {+ return this.get(ws)+ }+ getProjection() {+ return this.get(Ts)+ }+ getSpeed() {+ return this.get(Cs)+ }+ getTracking() {+ return this.get(bs)+ }+ getTrackingOptions() {+ return this.get(Rs)+ }+ setProjection(t) {+ this.set(Ts, En(t))+ }+ setTracking(t) {+ this.set(bs, t)+ }+ setTrackingOptions(t) {+ this.set(Rs, t)+ }+ }),+ (bP.Geolocation.GeolocationError = Is),+ (bP.Image = Ds),+ (bP.Image.decode = js),+ (bP.Image.decodeFallback = Gs),+ (bP.Image.listenImage = Ns),+ (bP.Image.load = ks),+ (bP.ImageCanvas = Us),+ (bP.ImageTile = Bs),+ (bP.Kinetic = zs),+ (bP.Map = Hc),+ (bP.MapBrowserEvent = Vs),+ (bP.MapBrowserEventHandler = Ks),+ (bP.MapEvent = Xs),+ (bP.Object = V),+ (bP.Object.ObjectEvent = X),+ (bP.Observable = G),+ (bP.Observable.unByKey = j),+ (bP.Overlay = eu),+ (bP.Tile = nt),+ (bP.TileQueue = lo),+ (bP.TileQueue.getTilePriority = ho),+ (bP.TileRange = iu),+ (bP.TileRange.createOrUpdate = nu),+ (bP.VectorRenderTile = su),+ (bP.VectorTile = au),+ (bP.View = bo),+ (bP.View.createCenterConstraint = Po),+ (bP.View.createResolutionConstraint = Io),+ (bP.View.createRotationConstraint = Fo),+ (bP.View.getView = async function (t, ...e) {+ let i = await t.getView()+ for (const t of e) i = t(i)+ return i+ }),+ (bP.View.isNoopAnimation = Lo),+ (bP.View.withExtentCenter = function () {+ return function (t) {+ if (!t.extent) return t+ const e = de(t.extent),+ i = { ...t, center: e }+ return delete i.extent, i+ }+ }),+ (bP.View.withHigherResolutions = function (t) {+ return function (e) {+ if (!e.resolutions) return e+ const i = [...e.resolutions],+ n = i[i.length - 1]+ for (let e = 0; e < t; ++e) i.push(n / Math.pow(2, e + 1))+ return { ...e, resolutions: i }+ }+ }),+ (bP.View.withLowerResolutions = function (t) {+ return function (e) {+ if (!e.resolutions) return e+ const i = [...e.resolutions],+ n = i[0]+ for (let e = 0; e < t; ++e) i.unshift(n * Math.pow(2, e + 1))+ return { ...e, resolutions: i }+ }+ }),+ (bP.View.withZoom = function (t) {+ return function (e) {+ return { ...e, zoom: t }+ }+ }),+ (bP.array = {}),+ (bP.array.ascending = y),+ (bP.array.binarySearch = m),+ (bP.array.descending = x),+ (bP.array.equals = w),+ (bP.array.extend = E),+ (bP.array.isSorted = T),+ (bP.array.linearFindNearest = v),+ (bP.array.remove = function (t, e) {+ const i = t.indexOf(e),+ n = i > -1+ return n && t.splice(i, 1), n+ }),+ (bP.array.reverseSubArray = S),+ (bP.array.stableSort = function (t, e) {+ const i = t.length,+ n = Array(t.length)+ let r+ for (r = 0; r < i; r++) n[r] = { index: r, value: t[r] }+ for (+ n.sort(function (t, i) {+ return e(t.value, i.value) || t.index - i.index+ }),+ r = 0;+ r < t.length;+ r+++ )+ t[r] = n[r].value+ }),+ (bP.asserts = {}),+ (bP.asserts.assert = Mt),+ (bP.centerconstraint = {}),+ (bP.centerconstraint.createExtent = fo),+ (bP.centerconstraint.none = po),+ (bP.color = {}),+ (bP.color.NO_COLOR = El),+ (bP.color.asArray = zl),+ (bP.color.asString = Ll),+ (bP.color.fromString = Bl),+ (bP.color.isStringColor = function (t) {+ try {+ return Bl(t), !0+ } catch {+ return !1+ }+ }),+ (bP.color.lchaToRgba = Ul),+ (bP.color.rgbaToLcha = jl),+ (bP.color.toString = Xl),+ (bP.color.withAlpha = Ol),+ (bP.colorlike = {}),+ (bP.colorlike.asColorLike = Mh),+ (bP.console = {}),+ (bP.console.error = Ke),+ (bP.console.log = function (...t) {+ Ye > Ze.info || console.log(...t)+ }),+ (bP.console.setLevel = function (t) {+ Ye = Ze[t]+ }),+ (bP.console.warn = He),+ (bP.control = {}),+ (bP.control.Attribution = Vo),+ (bP.control.Control = Xo),+ (bP.control.FullScreen = class extends Xo {+ 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(o, this.handleClick_.bind(this), !1),+ this.setClassName_(this.button_, this.isInFullscreen_),+ (this.element.className = `${this.cssClassName_} ${Do} ${ko}`),+ this.element.appendChild(this.button_)+ }+ handleClick_(t) {+ t.preventDefault(), this.handleFullScreen_()+ }+ handleFullScreen_() {+ const t = this.getMap()+ if (!t) return+ const e = t.getOwnerDocument()+ if (fP(e))+ if (pP(e))+ !(function (t) {+ t.exitFullscreen ? t.exitFullscreen() : t.webkitExitFullscreen && t.webkitExitFullscreen()+ })(e)+ else {+ let i+ ;(i = this.source_+ ? "string" == typeof this.source_+ ? e.getElementById(this.source_)+ : this.source_+ : t.getTargetElement()),+ this.keys_+ ? (function (t) {+ t.webkitRequestFullscreen ? t.webkitRequestFullscreen() : _P(t)+ })(i)+ : _P(i)+ }+ }+ handleFullScreenChange_() {+ const t = this.getMap()+ if (!t) return+ const e = this.isInFullscreen_+ ;(this.isInFullscreen_ = pP(t.getOwnerDocument())),+ e !== this.isInFullscreen_ &&+ (this.setClassName_(this.button_, this.isInFullscreen_),+ this.isInFullscreen_+ ? (vt(this.labelActiveNode_, this.labelNode_), this.dispatchEvent(dP))+ : (vt(this.labelNode_, this.labelActiveNode_), this.dispatchEvent(gP)),+ 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(ro, this.boundHandleMapTargetChange_),+ super.setMap(t),+ this.handleMapTargetChange_(),+ t && t.addChangeListener(ro, this.boundHandleMapTargetChange_)+ }+ handleMapTargetChange_() {+ const t = this.documentListeners_+ for (let e = 0, i = t.length; e < i; ++e) k(t[e])+ t.length = 0+ const e = this.getMap()+ if (e) {+ const i = e.getOwnerDocument()+ fP(i) ? this.element.classList.remove(No) : this.element.classList.add(No)+ for (let e = 0, n = uP.length; e < n; ++e) t.push(D(i, uP[e], this.handleFullScreenChange_, this))+ this.handleFullScreenChange_()+ }+ }+ }),+ (bP.control.MousePosition = class extends Xo {+ constructor(t) {+ t = t || {}+ const e = document.createElement("div")+ ;(e.className = void 0 !== t.className ? t.className : "ol-mouse-position"),+ super({ element: e, render: t.render, target: t.target }),+ this.on,+ this.once,+ this.un,+ this.addChangeListener(mP, this.handleProjectionChanged_),+ t.coordinateFormat && this.setCoordinateFormat(t.coordinateFormat),+ t.projection && this.setProjection(t.projection),+ (this.renderOnMouseOut_ = void 0 !== t.placeholder),+ (this.placeholder_ = this.renderOnMouseOut_ ? t.placeholder : " "),+ (this.renderedHTML_ = e.innerHTML),+ (this.mapProjection_ = null),+ (this.transform_ = null),+ (this.wrapX_ = !1 !== t.wrapX)+ }+ handleProjectionChanged_() {+ this.transform_ = null+ }+ getCoordinateFormat() {+ return this.get(yP)+ }+ getProjection() {+ return this.get(mP)+ }+ handleMouseMove(t) {+ const e = this.getMap()+ this.updateHTML_(e.getEventPixel(t))+ }+ handleMouseOut(t) {+ this.updateHTML_(null)+ }+ setMap(t) {+ if ((super.setMap(t), t)) {+ const e = t.getViewport()+ this.listenerKeys.push(D(e, Ws, this.handleMouseMove, this)),+ this.renderOnMouseOut_ && this.listenerKeys.push(D(e, Hs, this.handleMouseOut, this)),+ this.updateHTML_(null)+ }+ }+ setCoordinateFormat(t) {+ this.set(yP, t)+ }+ setProjection(t) {+ this.set(mP, En(t))+ }+ updateHTML_(t) {+ let e = this.placeholder_+ if (t && this.mapProjection_) {+ if (!this.transform_) {+ const t = this.getProjection()+ this.transform_ = t ? Ln(this.mapProjection_, t) : xn+ }+ const i = this.getMap().getCoordinateFromPixelInternal(t)+ if (i) {+ const t = Gn()+ if ((t && (this.transform_ = Ln(this.mapProjection_, t)), this.transform_(i, i), this.wrapX_)) {+ ui(i, t || this.getProjection() || this.mapProjection_)+ }+ const n = this.getCoordinateFormat()+ e = n ? n(i) : i.toString()+ }+ }+ ;(this.renderedHTML_ && e === this.renderedHTML_) || ((this.element.innerHTML = e), (this.renderedHTML_ = e))+ }+ render(t) {+ const e = t.frameState+ e+ ? this.mapProjection_ != e.viewState.projection &&+ ((this.mapProjection_ = e.viewState.projection), (this.transform_ = null))+ : (this.mapProjection_ = null)+ }+ }),+ (bP.control.OverviewMap = class extends Xo {+ constructor(t) {+ ;(t = t || {}),+ super({ element: document.createElement("div"), render: t.render, target: t.target }),+ (this.boundHandleRotationChanged_ = this.handleRotationChanged_.bind(this)),+ (this.collapsed_ = void 0 === t.collapsed || t.collapsed),+ (this.collapsible_ = void 0 === t.collapsible || t.collapsible),+ this.collapsible_ || (this.collapsed_ = !1),+ (this.rotateWithView_ = void 0 !== t.rotateWithView && t.rotateWithView),+ (this.viewExtent_ = void 0)+ const e = void 0 !== t.className ? t.className : "ol-overviewmap",+ i = void 0 !== t.tipLabel ? t.tipLabel : "Overview map",+ n = void 0 !== t.collapseLabel ? t.collapseLabel : "‹"+ "string" == typeof n+ ? ((this.collapseLabel_ = document.createElement("span")), (this.collapseLabel_.textContent = n))+ : (this.collapseLabel_ = n)+ const r = void 0 !== t.label ? t.label : "›"+ "string" == typeof r+ ? ((this.label_ = document.createElement("span")), (this.label_.textContent = r))+ : (this.label_ = r)+ const s = this.collapsible_ && !this.collapsed_ ? this.collapseLabel_ : this.label_,+ a = document.createElement("button")+ a.setAttribute("type", "button"),+ (a.title = i),+ a.appendChild(s),+ a.addEventListener(o, this.handleClick_.bind(this), !1),+ (this.ovmapDiv_ = document.createElement("div")),+ (this.ovmapDiv_.className = "ol-overviewmap-map"),+ (this.view_ = t.view)+ const l = new Hc({ view: t.view, controls: new Z(), interactions: new Z() })+ ;(this.ovmap_ = l),+ t.layers &&+ t.layers.forEach(function (t) {+ l.addLayer(t)+ })+ const h = document.createElement("div")+ ;(h.className = "ol-overviewmap-box"),+ (h.style.boxSizing = "border-box"),+ (this.boxOverlay_ = new eu({ position: [0, 0], positioning: "center-center", element: h })),+ this.ovmap_.addOverlay(this.boxOverlay_)+ const c =+ e ++ " " ++ Do ++ " " ++ ko ++ (this.collapsed_ && this.collapsible_ ? " " + Go : "") ++ (this.collapsible_ ? "" : " ol-uncollapsible"),+ u = this.element+ ;(u.className = c), u.appendChild(this.ovmapDiv_), u.appendChild(a)+ const d = this.boxOverlay_,+ g = this.boxOverlay_.getElement(),+ f = function (t) {+ const e = { clientX: (i = t).clientX, clientY: i.clientY }+ var i+ const n = l.getEventCoordinate(e)+ d.setPosition(n)+ },+ p = (t) => {+ const e = l.getEventCoordinateInternal(t),+ i = this.getMap()+ i.getView().setCenterInternal(e)+ const n = i.getOwnerDocument()+ n.removeEventListener("pointermove", f), n.removeEventListener("pointerup", p)+ }+ this.ovmapDiv_.addEventListener("pointerdown", (t) => {+ const e = this.getMap().getOwnerDocument()+ t.target === g && e.addEventListener("pointermove", f), e.addEventListener("pointerup", p)+ })+ }+ setMap(t) {+ const e = this.getMap()+ if (t !== e) {+ if (e) {+ const t = e.getView()+ t && this.unbindView_(t), this.ovmap_.setTarget(null)+ }+ if ((super.setMap(t), t)) {+ this.ovmap_.setTarget(this.ovmapDiv_), this.listenerKeys.push(D(t, i, this.handleMapPropertyChange_, this))+ const e = t.getView()+ e && this.bindView_(e), this.ovmap_.isRendered() || this.updateBoxAfterOvmapIsRendered_()+ }+ }+ }+ handleMapPropertyChange_(t) {+ if (t.key === so) {+ const e = t.oldValue+ e && this.unbindView_(e)+ const i = this.getMap().getView()+ this.bindView_(i)+ } else this.ovmap_.isRendered() || (t.key !== ro && t.key !== no) || this.ovmap_.updateSize()+ }+ bindView_(t) {+ if (!this.view_) {+ const e = new bo({ projection: t.getProjection() })+ this.ovmap_.setView(e)+ }+ t.addChangeListener(go.ROTATION, this.boundHandleRotationChanged_),+ this.handleRotationChanged_(),+ t.isDef() && (this.ovmap_.updateSize(), this.resetExtent_())+ }+ unbindView_(t) {+ t.removeChangeListener(go.ROTATION, this.boundHandleRotationChanged_)+ }+ handleRotationChanged_() {+ this.rotateWithView_ && this.ovmap_.getView().setRotation(this.getMap().getView().getRotation())+ }+ validateExtent_() {+ const t = this.getMap(),+ e = this.ovmap_+ if (!t.isRendered() || !e.isRendered()) return+ const i = t.getSize(),+ n = t.getView().calculateExtentInternal(i)+ if (this.viewExtent_ && te(n, this.viewExtent_)) return+ this.viewExtent_ = n+ const r = e.getSize(),+ s = e.getView().calculateExtentInternal(r),+ o = e.getPixelFromCoordinateInternal(ye(n)),+ a = e.getPixelFromCoordinateInternal(ue(n)),+ l = Math.abs(o[0] - a[0]),+ h = Math.abs(o[1] - a[1]),+ c = r[0],+ u = r[1]+ l < c * vP || h < u * vP || l > c * xP || h > u * xP ? this.resetExtent_() : Wt(s, n) || this.recenter_()+ }+ resetExtent_() {+ const t = this.getMap(),+ e = this.ovmap_,+ i = t.getSize(),+ n = t.getView().calculateExtentInternal(i),+ r = e.getView(),+ s = Math.log(7.5) / Math.LN2+ Te(n, 1 / (Math.pow(2, s / 2) * vP)), r.fitInternal(ps(n))+ }+ recenter_() {+ const t = this.getMap(),+ e = this.ovmap_,+ i = t.getView()+ e.getView().setCenterInternal(i.getCenterInternal())+ }+ updateBox_() {+ const t = this.getMap(),+ e = this.ovmap_+ if (!t.isRendered() || !e.isRendered()) return+ const i = t.getSize(),+ n = t.getView(),+ r = e.getView(),+ s = this.rotateWithView_ ? 0 : -n.getRotation(),+ o = this.boxOverlay_,+ a = this.boxOverlay_.getElement(),+ l = n.getCenter(),+ h = n.getResolution(),+ c = r.getResolution(),+ u = (i[0] * h) / c,+ d = (i[1] * h) / c+ if ((o.setPosition(l), a)) {+ ;(a.style.width = u + "px"), (a.style.height = d + "px")+ const t = "rotate(" + s + "rad)"+ a.style.transform = t+ }+ }+ updateBoxAfterOvmapIsRendered_() {+ this.ovmapPostrenderKey_ ||+ (this.ovmapPostrenderKey_ = N(this.ovmap_, qs, (t) => {+ delete this.ovmapPostrenderKey_, this.updateBox_()+ }))+ }+ handleClick_(t) {+ t.preventDefault(), this.handleToggle_()+ }+ handleToggle_() {+ this.element.classList.toggle(Go),+ this.collapsed_ ? vt(this.collapseLabel_, this.label_) : vt(this.label_, this.collapseLabel_),+ (this.collapsed_ = !this.collapsed_)+ const t = this.ovmap_+ if (!this.collapsed_) {+ if (t.isRendered()) return (this.viewExtent_ = void 0), void t.render()+ t.updateSize(), this.resetExtent_(), this.updateBoxAfterOvmapIsRendered_()+ }+ }+ getCollapsible() {+ return this.collapsible_+ }+ setCollapsible(t) {+ this.collapsible_ !== t &&+ ((this.collapsible_ = t),+ this.element.classList.toggle("ol-uncollapsible"),+ !t && this.collapsed_ && this.handleToggle_())+ }+ setCollapsed(t) {+ this.collapsible_ && this.collapsed_ !== t && this.handleToggle_()+ }+ getCollapsed() {+ return this.collapsed_+ }+ getRotateWithView() {+ return this.rotateWithView_+ }+ setRotateWithView(t) {+ this.rotateWithView_ !== t &&+ ((this.rotateWithView_ = t),+ 0 !== this.getMap().getView().getRotation() &&+ (this.rotateWithView_ ? this.handleRotationChanged_() : this.ovmap_.getView().setRotation(0),+ (this.viewExtent_ = void 0),+ this.validateExtent_(),+ this.updateBox_()))+ }+ getOverviewMap() {+ return this.ovmap_+ }+ render(t) {+ this.validateExtent_(), this.updateBox_()+ }+ }),+ (bP.control.Rotate = $o),+ (bP.control.ScaleLine = class extends Xo {+ constructor(t) {+ t = t || {}+ const e = document.createElement("div")+ ;(e.style.pointerEvents = "none"),+ super({ element: e, render: t.render, target: t.target }),+ this.on,+ this.once,+ this.un+ const i = void 0 !== t.className ? t.className : t.bar ? "ol-scale-bar" : "ol-scale-line"+ ;(this.innerElement_ = document.createElement("div")),+ (this.innerElement_.className = i + "-inner"),+ (this.element.className = i + " " + Do),+ this.element.appendChild(this.innerElement_),+ (this.viewState_ = null),+ (this.minWidth_ = void 0 !== t.minWidth ? t.minWidth : 64),+ (this.maxWidth_ = t.maxWidth),+ (this.renderedVisible_ = !1),+ (this.renderedWidth_ = void 0),+ (this.renderedHTML_ = ""),+ this.addChangeListener(SP, this.handleUnitsChanged_),+ this.setUnits(t.units || "metric"),+ (this.scaleBar_ = t.bar || !1),+ (this.scaleBarSteps_ = t.steps || 4),+ (this.scaleBarText_ = t.text || !1),+ (this.dpi_ = t.dpi || void 0)+ }+ getUnits() {+ return this.get(SP)+ }+ handleUnitsChanged_() {+ this.updateElement_()+ }+ setUnits(t) {+ this.set(SP, t)+ }+ setDpi(t) {+ this.dpi_ = t+ }+ updateElement_() {+ const t = this.viewState_+ if (!t)+ return void (this.renderedVisible_ && ((this.element.style.display = "none"), (this.renderedVisible_ = !1)))+ const e = t.center,+ i = t.projection,+ n = this.getUnits(),+ r = "degrees" == n ? "degrees" : "m"+ let s = wn(i, t.resolution, e, r)+ const o = (this.minWidth_ * (this.dpi_ || wP)) / wP,+ a = void 0 !== this.maxWidth_ ? (this.maxWidth_ * (this.dpi_ || wP)) / wP : void 0+ let l = o * s,+ h = ""+ if ("degrees" == n) {+ const t = _i.degrees+ ;(l *= t), l < t / 60 ? ((h = "″"), (s *= 3600)) : l < t ? ((h = "′"), (s *= 60)) : (h = "°")+ } else if ("imperial" == n)+ l < 0.9144+ ? ((h = "in"), (s /= 0.0254))+ : l < 1609.344+ ? ((h = "ft"), (s /= 0.3048))+ : ((h = "mi"), (s /= 1609.344))+ else if ("nautical" == n) (s /= 1852), (h = "NM")+ else if ("metric" == n)+ l < 1e-6+ ? ((h = "nm"), (s *= 1e9))+ : l < 0.001+ ? ((h = "μm"), (s *= 1e6))+ : l < 1+ ? ((h = "mm"), (s *= 1e3))+ : l < 1e3+ ? (h = "m")+ : ((h = "km"), (s /= 1e3))+ else {+ if ("us" != n) throw new Error("Invalid units")+ l < 0.9144+ ? ((h = "in"), (s *= 39.37))+ : l < 1609.344+ ? ((h = "ft"), (s /= 0.30480061))+ : ((h = "mi"), (s /= 1609.3472))+ }+ let c,+ u,+ d,+ g,+ f,+ p = 3 * Math.floor(Math.log(o * s) / Math.log(10)),+ _ = 0+ for (;;) {+ d = Math.floor(p / 3)+ const t = Math.pow(10, d)+ if (((c = EP[((p % 3) + 3) % 3] * t), (u = Math.round(c / s)), isNaN(u)))+ return (this.element.style.display = "none"), void (this.renderedVisible_ = !1)+ if (void 0 !== a && u >= a) {+ ;(c = _), (u = g), (d = f)+ break+ }+ if (u >= o) break+ ;(_ = c), (g = u), (f = d), ++p+ }+ const m = this.scaleBar_ ? this.createScaleBar(u, c, h) : c.toFixed(d < 0 ? -d : 0) + " " + h+ this.renderedHTML_ != m && ((this.innerElement_.innerHTML = m), (this.renderedHTML_ = m)),+ this.renderedWidth_ != u && ((this.innerElement_.style.width = u + "px"), (this.renderedWidth_ = u)),+ this.renderedVisible_ || ((this.element.style.display = ""), (this.renderedVisible_ = !0))+ }+ createScaleBar(t, e, i) {+ const n = this.getScaleForResolution(),+ r = n < 1 ? Math.round(1 / n).toLocaleString() + " : 1" : "1 : " + Math.round(n).toLocaleString(),+ s = this.scaleBarSteps_,+ o = t / s,+ a = [this.createMarker("absolute")]+ for (let n = 0; n < s; ++n) {+ const r = n % 2 == 0 ? "ol-scale-singlebar-odd" : "ol-scale-singlebar-even"+ a.push(+ `<div><div class="ol-scale-singlebar ${r}" style="width: ${o}px;"></div>` ++ this.createMarker("relative") ++ (n % 2 == 0 || 2 === s ? this.createStepText(n, t, !1, e, i) : "") ++ "</div>"+ )+ }+ a.push(this.createStepText(s, t, !0, e, i))+ return (+ (this.scaleBarText_ ? `<div class="ol-scale-text" style="width: ${t}px;">` + r + "</div>" : "") + a.join("")+ )+ }+ createMarker(t) {+ return `<div class="ol-scale-step-marker" style="position: ${t}; top: ${"absolute" === t ? 3 : -10}px;"></div>`+ }+ createStepText(t, e, i, n, r) {+ const s = (0 === t ? 0 : Math.round((n / this.scaleBarSteps_) * t * 100) / 100) + (0 === t ? "" : " " + r)+ return (+ `<div class="ol-scale-step-text" style="margin-left: ${+ 0 === t ? -3 : (e / this.scaleBarSteps_) * -1+ }px;text-align: ${0 === t ? "left" : "center"};min-width: ${+ 0 === t ? 0 : (e / this.scaleBarSteps_) * 2+ }px;left: ${i ? e + "px" : "unset"};">` ++ s ++ "</div>"+ )+ }+ getScaleForResolution() {+ return (+ wn(this.viewState_.projection, this.viewState_.resolution, this.viewState_.center, "m") *+ (1e3 / 25.4) *+ (this.dpi_ || wP)+ )+ }+ render(t) {+ const e = t.frameState+ ;(this.viewState_ = e ? e.viewState : null), this.updateElement_()+ }+ }),+ (bP.control.Zoom = Wo),+ (bP.control.ZoomSlider = class extends Xo {+ constructor(t) {+ super({ target: (t = t || {}).target, element: document.createElement("div"), render: t.render }),+ (this.dragListenerKeys_ = []),+ (this.currentResolution_ = void 0),+ (this.direction_ = TP),+ this.dragging_,+ (this.heightLimit_ = 0),+ (this.widthLimit_ = 0),+ this.startX_,+ this.startY_,+ (this.thumbSize_ = null),+ (this.sliderInitialized_ = !1),+ (this.duration_ = void 0 !== t.duration ? t.duration : 200)+ const e = void 0 !== t.className ? t.className : "ol-zoomslider",+ i = document.createElement("button")+ i.setAttribute("type", "button"), (i.className = e + "-thumb " + Do)+ const n = this.element+ ;(n.className = e + " " + Do + " " + ko),+ n.appendChild(i),+ n.addEventListener(Zs, this.handleDraggerStart_.bind(this), !1),+ n.addEventListener(Ws, this.handleDraggerDrag_.bind(this), !1),+ n.addEventListener(Ys, this.handleDraggerEnd_.bind(this), !1),+ n.addEventListener(o, this.handleContainerClick_.bind(this), !1),+ i.addEventListener(o, A, !1)+ }+ setMap(t) {+ super.setMap(t), t && t.render()+ }+ initSlider_() {+ const t = this.element+ let e = t.offsetWidth,+ i = t.offsetHeight+ if (0 === e && 0 === i) return (this.sliderInitialized_ = !1)+ const n = getComputedStyle(t)+ ;(e -= parseFloat(n.paddingRight) + parseFloat(n.paddingLeft)),+ (i -= parseFloat(n.paddingTop) + parseFloat(n.paddingBottom))+ const r = t.firstElementChild,+ s = getComputedStyle(r),+ o = r.offsetWidth + parseFloat(s.marginRight) + parseFloat(s.marginLeft),+ a = r.offsetHeight + parseFloat(s.marginTop) + parseFloat(s.marginBottom)+ return (+ (this.thumbSize_ = [o, a]),+ e > i+ ? ((this.direction_ = CP), (this.widthLimit_ = e - o))+ : ((this.direction_ = TP), (this.heightLimit_ = i - a)),+ (this.sliderInitialized_ = !0)+ )+ }+ handleContainerClick_(t) {+ const e = this.getMap().getView(),+ i = this.getRelativePosition_(t.offsetX - this.thumbSize_[0] / 2, t.offsetY - this.thumbSize_[1] / 2),+ n = this.getResolutionForPosition_(i),+ r = e.getConstrainedZoom(e.getZoomForResolution(n))+ e.animateInternal({ zoom: r, duration: this.duration_, easing: tt })+ }+ handleDraggerStart_(t) {+ if (!this.dragging_ && t.target === this.element.firstElementChild) {+ const e = this.element.firstElementChild+ if (+ (this.getMap().getView().beginInteraction(),+ (this.startX_ = t.clientX - parseFloat(e.style.left)),+ (this.startY_ = t.clientY - parseFloat(e.style.top)),+ (this.dragging_ = !0),+ 0 === this.dragListenerKeys_.length)+ ) {+ const t = this.handleDraggerDrag_,+ e = this.handleDraggerEnd_,+ i = this.getMap().getOwnerDocument()+ this.dragListenerKeys_.push(D(i, Ws, t, this), D(i, Ys, e, this))+ }+ }+ }+ handleDraggerDrag_(t) {+ if (this.dragging_) {+ const e = t.clientX - this.startX_,+ i = t.clientY - this.startY_,+ n = this.getRelativePosition_(e, i)+ ;(this.currentResolution_ = this.getResolutionForPosition_(n)),+ this.getMap().getView().setResolution(this.currentResolution_)+ }+ }+ handleDraggerEnd_(t) {+ if (this.dragging_) {+ this.getMap().getView().endInteraction(),+ (this.dragging_ = !1),+ (this.startX_ = void 0),+ (this.startY_ = void 0),+ this.dragListenerKeys_.forEach(k),+ (this.dragListenerKeys_.length = 0)+ }+ }+ setThumbPosition_(t) {+ const e = this.getPositionForResolution_(t),+ i = this.element.firstElementChild+ this.direction_ == CP+ ? (i.style.left = this.widthLimit_ * e + "px")+ : (i.style.top = this.heightLimit_ * e + "px")+ }+ getRelativePosition_(t, e) {+ let i+ return (i = this.direction_ === CP ? t / this.widthLimit_ : e / this.heightLimit_), Ie(i, 0, 1)+ }+ getResolutionForPosition_(t) {+ return this.getMap().getView().getResolutionForValueFunction()(1 - t)+ }+ getPositionForResolution_(t) {+ return Ie(1 - this.getMap().getView().getValueForResolutionFunction()(t), 0, 1)+ }+ render(t) {+ if (!t.frameState) return+ if (!this.sliderInitialized_ && !this.initSlider_()) return+ const e = t.frameState.viewState.resolution+ ;(this.currentResolution_ = e), this.setThumbPosition_(e)+ }+ }),+ (bP.control.ZoomToExtent = class extends Xo {+ constructor(t) {+ ;(t = t || {}),+ super({ element: document.createElement("div"), target: t.target }),+ (this.extent = t.extent ? t.extent : null),+ (this.fitOptions = t.fitOptions || {})+ const e = void 0 !== t.className ? t.className : "ol-zoom-extent",+ i = void 0 !== t.label ? t.label : "E",+ n = void 0 !== t.tipLabel ? t.tipLabel : "Fit to extent",+ r = document.createElement("button")+ r.setAttribute("type", "button"),+ (r.title = n),+ r.appendChild("string" == typeof i ? document.createTextNode(i) : i),+ r.addEventListener(o, this.handleClick_.bind(this), !1)+ const s = e + " " + Do + " " + ko,+ a = this.element+ ;(a.className = s), a.appendChild(r)+ }+ handleClick_(t) {+ t.preventDefault(), this.handleZoomToExtent()+ }+ handleZoomToExtent() {+ const t = this.getMap().getView(),+ e = this.extent ? zn(this.extent, t.getProjection()) : t.getProjection().getExtent()+ t.fitInternal(ps(e), this.fitOptions)+ }+ }),+ (bP.control.defaults = {}),+ (bP.control.defaults.defaults = Zo),+ (bP.coordinate = {}),+ (bP.coordinate.add = Qe),+ (bP.coordinate.angleBetween = gi),+ (bP.coordinate.closestOnCircle = ti),+ (bP.coordinate.closestOnSegment = ei),+ (bP.coordinate.createStringXY = function (t) {+ return function (e) {+ return ci(e, t)+ }+ }),+ (bP.coordinate.degreesToStringHDMS = ii),+ (bP.coordinate.distance = li),+ (bP.coordinate.equals = ri),+ (bP.coordinate.format = ni),+ (bP.coordinate.getWorldsAway = di),+ (bP.coordinate.rotate = si),+ (bP.coordinate.scale = oi),+ (bP.coordinate.squaredDistance = ai),+ (bP.coordinate.squaredDistanceToSegment = hi),+ (bP.coordinate.toStringHDMS = function (t, e) {+ return t ? ii("NS", t[1], e) + " " + ii("EW", t[0], e) : ""+ }),+ (bP.coordinate.toStringXY = ci),+ (bP.coordinate.wrapX = ui),+ (bP.css = {}),+ (bP.css.CLASS_COLLAPSED = Go),+ (bP.css.CLASS_CONTROL = ko),+ (bP.css.CLASS_HIDDEN = Ao),+ (bP.css.CLASS_SELECTABLE = Oo),+ (bP.css.CLASS_UNSELECTABLE = Do),+ (bP.css.CLASS_UNSUPPORTED = No),+ (bP.css.fontWeights = Bo),+ (bP.css.getFontParameters = zo),+ (bP.dom = {}),+ (bP.dom.createCanvasContext2D = ft),+ (bP.dom.createMockDiv = wt),+ (bP.dom.getSharedCanvasContext2D = _t),+ (bP.dom.isCanvas = Tt),+ (bP.dom.outerHeight = xt),+ (bP.dom.outerWidth = yt),+ (bP.dom.releaseCanvas = mt),+ (bP.dom.removeChildren = St),+ (bP.dom.replaceChildren = Et),+ (bP.dom.replaceNode = vt),+ (bP.easing = {}),+ (bP.easing.easeIn = Q),+ (bP.easing.easeOut = tt),+ (bP.easing.inAndOut = et),+ (bP.easing.linear = it),+ (bP.easing.upAndDown = function (t) {+ return t < 0.5 ? et(2 * t) : 1 - et(2 * (t - 0.5))+ }),+ (bP.events = {}),+ (bP.events.Event = M),+ (bP.events.Event.preventDefault = function (t) {+ t.preventDefault()+ }),+ (bP.events.Event.stopPropagation = A),+ (bP.events.SnapEvent = {}),+ (bP.events.SnapEvent.SnapEvent = Nv),+ (bP.events.Target = O),+ (bP.events.condition = {}),+ (bP.events.condition.all = Qo),+ (bP.events.condition.altKeyOnly = ta),+ (bP.events.condition.altShiftKeysOnly = ea),+ (bP.events.condition.always = ra),+ (bP.events.condition.click = function (t) {+ return t.type == $s.CLICK+ }),+ (bP.events.condition.doubleClick = function (t) {+ return t.type == $s.DBLCLICK+ }),+ (bP.events.condition.focus = ia),+ (bP.events.condition.focusWithTabindex = na),+ (bP.events.condition.mouseActionButton = sa),+ (bP.events.condition.mouseOnly = da),+ (bP.events.condition.never = oa),+ (bP.events.condition.noModifierKeys = la),+ (bP.events.condition.penOnly = function (t) {+ const e = t.originalEvent+ return "pointerId" in e && "pen" === e.pointerType+ }),+ (bP.events.condition.platformModifierKey = ha),+ (bP.events.condition.platformModifierKeyOnly = function (t) {+ const e = t.originalEvent+ return !e.altKey && (lt ? e.metaKey : e.ctrlKey) && !e.shiftKey+ }),+ (bP.events.condition.pointerMove = function (t) {+ return "pointermove" == t.type+ }),+ (bP.events.condition.primaryAction = ga),+ (bP.events.condition.shiftKeyOnly = ca),+ (bP.events.condition.singleClick = aa),+ (bP.events.condition.targetNotEditable = ua),+ (bP.events.condition.touchOnly = function (t) {+ const e = t.originalEvent+ return "pointerId" in e && "touch" === e.pointerType+ }),+ (bP.events.listen = D),+ (bP.events.listenOnce = N),+ (bP.events.unlistenByKey = k),+ (bP.expr = {}),+ (bP.expr.cpu = {}),+ (bP.expr.cpu.buildExpression = Eh),+ (bP.expr.cpu.newEvaluationContext = Sh),+ (bP.expr.expression = {}),+ (bP.expr.expression.AnyType = th),+ (bP.expr.expression.BooleanType = Yl),+ (bP.expr.expression.CallExpression = ah),+ (bP.expr.expression.ColorType = ql),+ (bP.expr.expression.LiteralExpression = oh),+ (bP.expr.expression.NoneType = 0),+ (bP.expr.expression.NumberArrayType = Jl),+ (bP.expr.expression.NumberType = Hl),+ (bP.expr.expression.Ops = ch),+ (bP.expr.expression.SizeType = Ql),+ (bP.expr.expression.StringType = Kl),+ (bP.expr.expression.computeGeometryType = vh),+ (bP.expr.expression.includesType = rh),+ (bP.expr.expression.isType = sh),+ (bP.expr.expression.newParsingContext = lh),+ (bP.expr.expression.overlapsType = function (t, e) {+ return !!(t & e)+ }),+ (bP.expr.expression.parse = hh),+ (bP.expr.expression.typeName = nh),+ (bP.expr.gpu = {}),+ (bP.expr.gpu.FEATURE_ID_PROPERTY_NAME = K_),+ (bP.expr.gpu.GEOMETRY_TYPE_PROPERTY_NAME = q_),+ (bP.expr.gpu.PALETTE_TEXTURE_ARRAY = H_),+ (bP.expr.gpu.UNDEFINED_PROP_VALUE = J_),+ (bP.expr.gpu.arrayToGlsl = j_),+ (bP.expr.gpu.buildExpression = Q_),+ (bP.expr.gpu.colorToGlsl = U_),+ (bP.expr.gpu.getStringNumberEquivalent = V_),+ (bP.expr.gpu.newCompilationContext = Z_),+ (bP.expr.gpu.numberToGlsl = G_),+ (bP.expr.gpu.sizeToGlsl = B_),+ (bP.expr.gpu.stringToGlsl = $_),+ (bP.expr.gpu.uniformNameForVariable = W_),+ (bP.extent = {}),+ (bP.extent.applyTransform = be),+ (bP.extent.approximatelyEquals = ee),+ (bP.extent.boundingExtent = Bt),+ (bP.extent.buffer = zt),+ (bP.extent.clone = Xt),+ (bP.extent.closestSquaredDistanceXY = Vt),+ (bP.extent.containsCoordinate = $t),+ (bP.extent.containsExtent = Wt),+ (bP.extent.containsXY = Zt),+ (bP.extent.coordinateRelationship = Yt),+ (bP.extent.createEmpty = Ht),+ (bP.extent.createOrUpdate = Kt),+ (bP.extent.createOrUpdateEmpty = qt),+ (bP.extent.createOrUpdateFromCoordinate = Jt),+ (bP.extent.createOrUpdateFromCoordinates = function (t, e) {+ return re(qt(e), t)+ }),+ (bP.extent.createOrUpdateFromFlatCoordinates = Qt),+ (bP.extent.createOrUpdateFromRings = function (t, e) {+ return oe(qt(e), t)+ }),+ (bP.extent.equals = te),+ (bP.extent.extend = ie),+ (bP.extent.extendCoordinate = ne),+ (bP.extent.extendCoordinates = re),+ (bP.extent.extendFlatCoordinates = se),+ (bP.extent.extendRings = oe),+ (bP.extent.extendXY = ae),+ (bP.extent.forEachCorner = le),+ (bP.extent.getArea = he),+ (bP.extent.getBottomLeft = ce),+ (bP.extent.getBottomRight = ue),+ (bP.extent.getCenter = de),+ (bP.extent.getCorner = ge),+ (bP.extent.getEnlargedArea = function (t, e) {+ const i = Math.min(t[0], e[0]),+ n = Math.min(t[1], e[1])+ return (Math.max(t[2], e[2]) - i) * (Math.max(t[3], e[3]) - n)+ }),+ (bP.extent.getForViewAndSize = fe),+ (bP.extent.getHeight = _e),+ (bP.extent.getIntersection = me),+ (bP.extent.getIntersectionArea = function (t, e) {+ return he(me(t, e))+ }),+ (bP.extent.getMargin = function (t) {+ return ve(t) + _e(t)+ }),+ (bP.extent.getRotatedViewport = pe),+ (bP.extent.getSize = function (t) {+ return [t[2] - t[0], t[3] - t[1]]+ }),+ (bP.extent.getTopLeft = ye),+ (bP.extent.getTopRight = xe),+ (bP.extent.getWidth = ve),+ (bP.extent.intersects = Se),+ (bP.extent.intersectsSegment = Ce),+ (bP.extent.isEmpty = Ee),+ (bP.extent.returnOrUpdate = we),+ (bP.extent.scaleFromCenter = Te),+ (bP.extent.wrapAndSliceX = Pe),+ (bP.extent.wrapX = Re),+ (bP.featureloader = {}),+ (bP.featureloader.loadFeaturesXhr = hu),+ (bP.featureloader.setWithCredentials = function (t) {+ lu = t+ }),+ (bP.featureloader.xhr = cu),+ (bP.format = {}),+ (bP.format.EsriJSON = class extends Qv {+ constructor(t) {+ ;(t = t || {}), super(), (this.geometryName_ = t.geometryName)+ }+ readFeatureFromObject(t, e, i) {+ const n = t,+ r = nS(n.geometry, e),+ s = new At()+ if ((this.geometryName_ && s.setGeometryName(this.geometryName_), s.setGeometry(r), n.attributes)) {+ s.setProperties(n.attributes, !0)+ const t = n.attributes[i]+ void 0 !== t && s.setId(t)+ }+ return s+ }+ readFeaturesFromObject(t, e) {+ if (((e = e || {}), t.features)) {+ const i = [],+ n = t.features+ for (let r = 0, s = n.length; r < s; ++r) i.push(this.readFeatureFromObject(n[r], e, t.objectIdFieldName))+ return i+ }+ return [this.readFeatureFromObject(t, e)]+ }+ readGeometryFromObject(t, e) {+ return nS(t, e)+ }+ readProjectionFromObject(t) {+ if (t.spatialReference && void 0 !== t.spatialReference.wkid) {+ return En("EPSG:" + t.spatialReference.wkid)+ }+ return null+ }+ writeGeometryObject(t, e) {+ return oS(t, this.adaptOptions(e))+ }+ writeFeatureObject(t, e) {+ e = this.adaptOptions(e)+ const i = {}+ if (!t.hasProperties()) return (i.attributes = {}), i+ const n = t.getProperties(),+ r = t.getGeometry()+ if (r) {+ i.geometry = oS(r, e)+ const s = e && (e.dataProjection || e.featureProjection)+ s && (i.geometry.spatialReference = { wkid: Number(En(s).getCode().split(":").pop()) }),+ delete n[t.getGeometryName()]+ }+ return L(n) ? (i.attributes = {}) : (i.attributes = n), i+ }+ writeFeaturesObject(t, e) {+ e = this.adaptOptions(e)+ const i = []+ for (let n = 0, r = t.length; n < r; ++n) i.push(this.writeFeatureObject(t[n], e))+ return { features: i }+ }+ }),+ (bP.format.Feature = Zv),+ (bP.format.Feature.createGeometry = Jv),+ (bP.format.Feature.createRenderFeature = qv),+ (bP.format.Feature.transformExtentWithOptions = Hv),+ (bP.format.Feature.transformGeometryWithOptions = Yv),+ (bP.format.GML = OS),+ (bP.format.GML2 = FS),+ (bP.format.GML3 = AS),+ (bP.format.GML32 = DS),+ (bP.format.GMLBase = cS),+ (bP.format.GMLBase.GMLNS = lS),+ (bP.format.GPX = class extends aS {+ constructor(t) {+ super(), (t = t || {}), (this.dataProjection = En("EPSG:4326")), (this.readExtensions_ = t.readExtensions)+ }+ handleReadExtensions_(t) {+ t || (t = [])+ for (let e = 0, i = t.length; e < i; ++e) {+ const i = t[e]+ if (this.readExtensions_) {+ const t = i.get("extensionsNode_") || null+ this.readExtensions_(i, t)+ }+ i.set("extensionsNode_", void 0)+ }+ }+ readMetadata(t) {+ return t+ ? "string" == typeof t+ ? this.readMetadataFromDocument(cp(t))+ : lp(t)+ ? this.readMetadataFromDocument(t)+ : this.readMetadataFromNode(t)+ : null+ }+ readMetadataFromDocument(t) {+ for (let e = t.firstChild; e; e = e.nextSibling)+ if (e.nodeType === Node.ELEMENT_NODE) {+ const t = this.readMetadataFromNode(e)+ if (t) return t+ }+ return null+ }+ readMetadataFromNode(t) {+ if (!NS.includes(t.namespaceURI)) return null+ for (let e = t.firstElementChild; e; e = e.nextElementSibling)+ if (NS.includes(e.namespaceURI) && "metadata" === e.localName) return wp({}, BS, e, [])+ return null+ }+ readFeatureFromNode(t, e) {+ if (!NS.includes(t.namespaceURI)) return null+ const i = kS[t.localName]+ if (!i) return null+ const n = i(t, [this.getReadOptions(t, e)])+ return n ? (this.handleReadExtensions_([n]), n) : null+ }+ readFeaturesFromNode(t, e) {+ if (!NS.includes(t.namespaceURI)) return []+ if ("gpx" == t.localName) {+ const i = wp([], GS, t, [this.getReadOptions(t, e)])+ return i ? (this.handleReadExtensions_(i), i) : []+ }+ return []+ }+ writeFeaturesNode(t, e) {+ e = this.adaptOptions(e)+ const i = sp("http://www.topografix.com/GPX/1/1", "gpx")+ return (+ i.setAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns:xsi", rp),+ i.setAttributeNS(+ rp,+ "xsi:schemaLocation",+ "http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd"+ ),+ i.setAttribute("version", "1.1"),+ i.setAttribute("creator", "OpenLayers"),+ Cp({ node: i }, XS, lE, t, [e]),+ i+ )+ }+ }),+ (bP.format.GeoJSON = class extends Qv {+ constructor(t) {+ ;(t = t || {}),+ super(),+ (this.dataProjection = En(t.dataProjection ? t.dataProjection : "EPSG:4326")),+ t.featureProjection && (this.defaultFeatureProjection = En(t.featureProjection)),+ t.featureClass && (this.featureClass = t.featureClass),+ (this.geometryName_ = t.geometryName),+ (this.extractGeometryName_ = t.extractGeometryName),+ (this.supportedMediaTypes = ["application/geo+json", "application/vnd.geo+json"])+ }+ readFeatureFromObject(t, e) {+ let i = null+ i = "Feature" === t.type ? t : { type: "Feature", geometry: t, properties: null }+ const n = yE(i.geometry)+ if (this.featureClass === Ud) return qv({ geometry: n, id: i.id, properties: i.properties }, e)+ const r = new At()+ return (+ this.geometryName_+ ? r.setGeometryName(this.geometryName_)+ : this.extractGeometryName_ && i.geometry_name && r.setGeometryName(i.geometry_name),+ r.setGeometry(Jv(n, e)),+ "id" in i && r.setId(i.id),+ i.properties && r.setProperties(i.properties, !0),+ r+ )+ }+ readFeaturesFromObject(t, e) {+ let i = null+ if ("FeatureCollection" === t.type) {+ i = []+ const n = t.features+ for (let t = 0, r = n.length; t < r; ++t) {+ const r = this.readFeatureFromObject(n[t], e)+ r && i.push(r)+ }+ } else i = [this.readFeatureFromObject(t, e)]+ return i.flat()+ }+ readGeometryFromObject(t, e) {+ return (function (t, e) {+ const i = yE(t)+ return Jv(i, e)+ })(t, e)+ }+ readProjectionFromObject(t) {+ const e = t.crs+ let i+ if (e)+ if ("name" == e.type) i = En(e.properties.name)+ else {+ if ("EPSG" !== e.type) throw new Error("Unknown SRS type")+ i = En("EPSG:" + e.properties.code)+ }+ else i = this.dataProjection+ return i+ }+ writeFeatureObject(t, e) {+ e = this.adaptOptions(e)+ const i = { type: "Feature", geometry: null, properties: null },+ n = t.getId()+ if ((void 0 !== n && (i.id = n), !t.hasProperties())) return i+ const r = t.getProperties(),+ s = t.getGeometry()+ return s && ((i.geometry = xE(s, e)), delete r[t.getGeometryName()]), L(r) || (i.properties = r), i+ }+ writeFeaturesObject(t, e) {+ e = this.adaptOptions(e)+ const i = []+ for (let n = 0, r = t.length; n < r; ++n) i.push(this.writeFeatureObject(t[n], e))+ return { type: "FeatureCollection", features: i }+ }+ writeGeometryObject(t, e) {+ return xE(t, this.adaptOptions(e))+ }+ }),+ (bP.format.IGC = class extends vE {+ constructor(t) {+ super(),+ (t = t || {}),+ (this.dataProjection = En("EPSG:4326")),+ (this.altitudeMode_ = t.altitudeMode ? t.altitudeMode : "none"),+ (this.lad_ = !1),+ (this.lod_ = !1),+ (this.ladStart_ = 0),+ (this.ladStop_ = 0),+ (this.lodStart_ = 0),+ (this.lodStop_ = 0)+ }+ readFeatureFromText(t, e) {+ const i = this.altitudeMode_,+ n = t.split(bE),+ r = {},+ s = []+ let o,+ a,+ l = 2e3,+ h = 0,+ c = 1,+ u = -1+ for (o = 0, a = n.length; o < a; ++o) {+ const t = n[o]+ let e+ if ("B" == t.charAt(0)) {+ if (((e = EE.exec(t)), e)) {+ const n = parseInt(e[1], 10),+ r = parseInt(e[2], 10),+ o = parseInt(e[3], 10)+ let a = parseInt(e[4], 10) + parseInt(e[5], 10) / 6e4+ this.lad_ &&+ (a +=+ parseInt(t.slice(this.ladStart_, this.ladStop_), 10) / 6e4 / 10 ** (this.ladStop_ - this.ladStart_)),+ "S" == e[6] && (a = -a)+ let d = parseInt(e[7], 10) + parseInt(e[8], 10) / 6e4+ if (+ (this.lod_ &&+ (d +=+ parseInt(t.slice(this.lodStart_, this.lodStop_), 10) /+ 6e4 /+ 10 ** (this.lodStop_ - this.lodStart_)),+ "W" == e[9] && (d = -d),+ s.push(d, a),+ "none" != i)+ ) {+ let t+ ;(t = "gps" == i ? parseInt(e[11], 10) : "barometric" == i ? parseInt(e[12], 10) : 0), s.push(t)+ }+ let g = Date.UTC(l, h, c, n, r, o)+ g < u && (g = Date.UTC(l, h, c + 1, n, r, o)), s.push(g / 1e3), (u = g)+ }+ } else if ("H" == t.charAt(0))+ (e = CE.exec(t)),+ e+ ? ((c = parseInt(e[1], 10)), (h = parseInt(e[2], 10) - 1), (l = 2e3 + parseInt(e[3], 10)))+ : ((e = TE.exec(t)),+ e+ ? ((c = parseInt(e[1], 10)), (h = parseInt(e[2], 10) - 1), (l = 2e3 + parseInt(e[3], 10)))+ : ((e = wE.exec(t)), e && (r[e[1]] = e[2].trim())))+ else if ("I" == t.charAt(0)) {+ const e = parseInt(t.slice(1, 3), 10)+ for (let i = 0; i < e; i++) {+ const e = t.slice(7 + 7 * i, 10 + 7 * i)+ if ("LAD" === e || "LOD" === e) {+ const n = parseInt(t.slice(3 + 7 * i, 5 + 7 * i), 10) - 1,+ r = parseInt(t.slice(5 + 7 * i, 7 + 7 * i), 10)+ "LAD" === e+ ? ((this.lad_ = !0), (this.ladStart_ = n), (this.ladStop_ = r))+ : "LOD" === e && ((this.lod_ = !0), (this.lodStart_ = n), (this.lodStop_ = r))+ }+ }+ }+ }+ if (0 === s.length) return null+ const d = new Dd(s, "none" == i ? "XYM" : "XYZM"),+ g = new At(Yv(d, !1, e))+ return g.setProperties(r, !0), g+ }+ readFeaturesFromText(t, e) {+ const i = this.readFeatureFromText(t, e)+ return i ? [i] : []+ }+ }),+ (bP.format.IIIFInfo = class {+ constructor(t) {+ this.setImageInfo(t)+ }+ setImageInfo(t) {+ this.imageInfo = "string" == typeof t ? JSON.parse(t) : t+ }+ getImageApiVersion() {+ if (void 0 === this.imageInfo) return+ let t = this.imageInfo["@context"] || "ol-no-context"+ "string" == typeof t && (t = [t])+ for (let e = 0; e < t.length; e++)+ switch (t[e]) {+ case "http://library.stanford.edu/iiif/image-api/1.1/context.json":+ case "http://iiif.io/api/image/1/context.json":+ return bg+ case "http://iiif.io/api/image/2/context.json":+ return Rg+ case "http://iiif.io/api/image/3/context.json":+ return Pg+ case "ol-no-context":+ if (this.getComplianceLevelEntryFromProfile(bg) && this.imageInfo.identifier) return bg+ }+ Mt(!1, "Cannot determine IIIF Image API version from provided image information JSON")+ }+ getComplianceLevelEntryFromProfile(t) {+ if (void 0 !== this.imageInfo && void 0 !== this.imageInfo.profile)+ switch ((void 0 === t && (t = this.getImageApiVersion()), t)) {+ case bg:+ if (Fg.test(this.imageInfo.profile)) return this.imageInfo.profile+ break+ case Pg:+ if (Mg.test(this.imageInfo.profile)) return this.imageInfo.profile+ break+ case Rg:+ if ("string" == typeof this.imageInfo.profile && Lg.test(this.imageInfo.profile))+ return this.imageInfo.profile+ if (+ Array.isArray(this.imageInfo.profile) &&+ this.imageInfo.profile.length > 0 &&+ "string" == typeof this.imageInfo.profile[0] &&+ Lg.test(this.imageInfo.profile[0])+ )+ return this.imageInfo.profile[0]+ }+ }+ getComplianceLevelFromProfile(t) {+ const e = this.getComplianceLevelEntryFromProfile(t)+ if (void 0 === e) return+ const i = e.match(/level[0-2](?:\.json)?$/g)+ return Array.isArray(i) ? i[0].replace(".json", "") : void 0+ }+ getComplianceLevelSupportedFeatures() {+ if (void 0 === this.imageInfo) return+ const t = this.getImageApiVersion(),+ e = this.getComplianceLevelFromProfile(t)+ return void 0 === e ? Ig.none.none : Ig[t][e]+ }+ getTileSourceOptions(t) {+ const e = t || {},+ i = this.getImageApiVersion()+ if (void 0 === i) return+ const n = void 0 === i ? void 0 : Ag[i](this)+ return void 0 !== n+ ? {+ url: n.url,+ version: i,+ size: [this.imageInfo.width, this.imageInfo.height],+ sizes: n.sizes,+ format:+ void 0 !== e.format && n.formats.includes(e.format)+ ? e.format+ : void 0 !== n.preferredFormat+ ? n.preferredFormat+ : "jpg",+ supports: n.supports,+ quality:+ e.quality && n.qualities.includes(e.quality)+ ? e.quality+ : n.qualities.includes("native")+ ? "native"+ : "default",+ resolutions: Array.isArray(n.resolutions)+ ? n.resolutions.sort(function (t, e) {+ return e - t+ })+ : void 0,+ tileSize: n.tileSize+ }+ : void 0+ }+ }),+ (bP.format.JSONFeature = Qv),+ (bP.format.KML = class extends aS {+ constructor(t) {+ super(),+ (t = t || {}),+ qE ||+ ((kE = [255, 255, 255, 1]),+ (XE = new sc({ color: kE })),+ (GE = [20, 2]),+ (jE = "pixels"),+ (UE = "pixels"),+ (BE = [64, 64]),+ (zE = "https://maps.google.com/mapfiles/kml/pushpin/ylw-pushpin.png"),+ ($E = new ac({+ anchor: GE,+ anchorOrigin: "bottom-left",+ anchorXUnits: jE,+ anchorYUnits: UE,+ crossOrigin: "anonymous",+ rotation: 0,+ scale: JE(BE),+ size: BE,+ src: zE+ })),+ (VE = "NO_IMAGE"),+ (ZE = new lc({ color: kE, width: 1 })),+ (WE = new lc({ color: [51, 51, 51, 1], width: 2 })),+ (YE = new pc({ font: "bold 16px Helvetica", fill: XE, stroke: WE, scale: 0.8 })),+ (HE = new hc({ fill: XE, image: $E, text: YE, stroke: ZE, zIndex: 0 })),+ (qE = [HE])),+ (this.dataProjection = En("EPSG:4326")),+ (this.defaultStyle_ = t.defaultStyle ? t.defaultStyle : qE),+ (this.extractStyles_ = void 0 === t.extractStyles || t.extractStyles),+ (this.writeStyles_ = void 0 === t.writeStyles || t.writeStyles),+ (this.sharedStyles_ = {}),+ (this.showPointNames_ = void 0 === t.showPointNames || t.showPointNames),+ (this.crossOrigin_ = void 0 !== t.crossOrigin ? t.crossOrigin : "anonymous"),+ (this.referrerPolicy_ = t.referrerPolicy),+ (this.iconUrlFunction_ = t.iconUrlFunction ? t.iconUrlFunction : QE),+ (this.supportedMediaTypes = ["application/vnd.google-earth.kml+xml"])+ }+ readDocumentOrFolder_(t, e) {+ const i = wp(+ [],+ Sp(PE, {+ Document: up(this.readDocumentOrFolder_, this),+ Folder: up(this.readDocumentOrFolder_, this),+ Placemark: dp(this.readPlacemark_, this),+ Style: this.readSharedStyle_.bind(this),+ StyleMap: this.readSharedStyleMap_.bind(this)+ }),+ t,+ e,+ this+ )+ if (i) return i+ }+ readPlacemark_(t, e) {+ const i = wp({ geometry: null }, FE, t, e, this)+ if (!i) return+ const n = new At(),+ r = t.getAttribute("id")+ null !== r && n.setId(r)+ const s = e[0],+ o = i.geometry+ if ((o && Yv(o, !1, s), n.setGeometry(o), delete i.geometry, this.extractStyles_)) {+ const t = (function (t, e, i, n, r) {+ return function (s, o) {+ let a = r,+ l = "",+ h = []+ if (a) {+ const t = s.getGeometry()+ if (t)+ if (t instanceof Md)+ (h = t.getGeometriesArrayRecursive().filter(function (t) {+ const e = t.getType()+ return "Point" === e || "MultiPoint" === e+ })),+ (a = h.length > 0)+ else {+ const e = t.getType()+ a = "Point" === e || "MultiPoint" === e+ }+ }+ a &&+ ((l = s.get("name")),+ (a = a && !!l),+ a &&+ /&[^&]+;/.test(l) &&+ (KE || (KE = document.createElement("textarea")), (KE.innerHTML = l), (l = KE.value)))+ let c = i+ if ((t ? (c = t) : e && (c = tw(e, i, n)), a)) {+ const t = (function (t, e) {+ const i = [0, 0]+ let n = "start"+ const r = t.getImage()+ if (r) {+ const t = r.getSize()+ if (t && 2 == t.length) {+ const e = r.getScaleArray(),+ s = r.getAnchor()+ ;(i[0] = e[0] * (t[0] - s[0])), (i[1] = e[1] * (t[1] / 2 - s[1])), (n = "left")+ }+ }+ let s = t.getText()+ s+ ? ((s = s.clone()),+ s.setFont(s.getFont() || YE.getFont()),+ s.setScale(s.getScale() || YE.getScale()),+ s.setFill(s.getFill() || YE.getFill()),+ s.setStroke(s.getStroke() || WE))+ : (s = YE.clone())+ s.setText(e), s.setOffsetX(i[0]), s.setOffsetY(i[1]), s.setTextAlign(n)+ const o = new hc({ image: r, text: s })+ return o+ })(c[0], l)+ if (h.length > 0) {+ t.setGeometry(new Md(h))+ return [+ t,+ new hc({+ geometry: c[0].getGeometry(),+ image: null,+ fill: c[0].getFill(),+ stroke: c[0].getStroke(),+ text: null+ })+ ].concat(c.slice(1))+ }+ return t+ }+ return c+ }+ })(i.Style, i.styleUrl, this.defaultStyle_, this.sharedStyles_, this.showPointNames_)+ n.setStyle(t)+ }+ return delete i.Style, n.setProperties(i, !0), n+ }+ readSharedStyle_(t, e) {+ const i = t.getAttribute("id")+ if (null !== i) {+ const n = Iw.call(this, t, e)+ if (n) {+ let e,+ r = t.baseURI+ if (((r && "about:blank" != r) || (r = window.location.href), r)) {+ e = new URL("#" + i, r).href+ } else e = "#" + i+ this.sharedStyles_[e] = n+ }+ }+ }+ readSharedStyleMap_(t, e) {+ const i = t.getAttribute("id")+ if (null === i) return+ const n = aw.call(this, t, e)+ if (!n) return+ let r,+ s = t.baseURI+ if (((s && "about:blank" != s) || (s = window.location.href), s)) {+ r = new URL("#" + i, s).href+ } else r = "#" + i+ this.sharedStyles_[r] = n+ }+ readFeatureFromNode(t, e) {+ if (!PE.includes(t.namespaceURI)) return null+ const i = this.readPlacemark_(t, [this.getReadOptions(t, e)])+ return i || null+ }+ readFeaturesFromNode(t, e) {+ if (!PE.includes(t.namespaceURI)) return []+ let i+ const n = t.localName+ if ("Document" == n || "Folder" == n)+ return (i = this.readDocumentOrFolder_(t, [this.getReadOptions(t, e)])), i || []+ if ("Placemark" == n) {+ const i = this.readPlacemark_(t, [this.getReadOptions(t, e)])+ return i ? [i] : []+ }+ if ("kml" == n) {+ i = []+ for (let n = t.firstElementChild; n; n = n.nextElementSibling) {+ const t = this.readFeaturesFromNode(n, e)+ t && E(i, t)+ }+ return i+ }+ return []+ }+ readName(t) {+ if (t) {+ if ("string" == typeof t) {+ const e = cp(t)+ return this.readNameFromDocument(e)+ }+ return lp(t) ? this.readNameFromDocument(t) : this.readNameFromNode(t)+ }+ }+ readNameFromDocument(t) {+ for (let e = t.firstChild; e; e = e.nextSibling)+ if (e.nodeType == Node.ELEMENT_NODE) {+ const t = this.readNameFromNode(e)+ if (t) return t+ }+ }+ readNameFromNode(t) {+ for (let e = t.firstElementChild; e; e = e.nextElementSibling)+ if (PE.includes(e.namespaceURI) && "name" == e.localName) return yS(e)+ for (let e = t.firstElementChild; e; e = e.nextElementSibling) {+ const t = e.localName+ if (PE.includes(e.namespaceURI) && ("Document" == t || "Folder" == t || "Placemark" == t || "kml" == t)) {+ const t = this.readNameFromNode(e)+ if (t) return t+ }+ }+ }+ readNetworkLinks(t) {+ const e = []+ if ("string" == typeof t) {+ const i = cp(t)+ E(e, this.readNetworkLinksFromDocument(i))+ } else lp(t) ? E(e, this.readNetworkLinksFromDocument(t)) : E(e, this.readNetworkLinksFromNode(t))+ return e+ }+ readNetworkLinksFromDocument(t) {+ const e = []+ for (let i = t.firstChild; i; i = i.nextSibling)+ i.nodeType == Node.ELEMENT_NODE && E(e, this.readNetworkLinksFromNode(i))+ return e+ }+ readNetworkLinksFromNode(t) {+ const e = []+ for (let i = t.firstElementChild; i; i = i.nextElementSibling)+ if (PE.includes(i.namespaceURI) && "NetworkLink" == i.localName) {+ const t = wp({}, LE, i, [])+ e.push(t)+ }+ for (let i = t.firstElementChild; i; i = i.nextElementSibling) {+ const t = i.localName+ !PE.includes(i.namespaceURI) ||+ ("Document" != t && "Folder" != t && "kml" != t) ||+ E(e, this.readNetworkLinksFromNode(i))+ }+ return e+ }+ readRegion(t) {+ const e = []+ if ("string" == typeof t) {+ const i = cp(t)+ E(e, this.readRegionFromDocument(i))+ } else lp(t) ? E(e, this.readRegionFromDocument(t)) : E(e, this.readRegionFromNode(t))+ return e+ }+ readRegionFromDocument(t) {+ const e = []+ for (let i = t.firstChild; i; i = i.nextSibling)+ i.nodeType == Node.ELEMENT_NODE && E(e, this.readRegionFromNode(i))+ return e+ }+ readRegionFromNode(t) {+ const e = []+ for (let i = t.firstElementChild; i; i = i.nextElementSibling)+ if (PE.includes(i.namespaceURI) && "Region" == i.localName) {+ const t = wp({}, OE, i, [])+ e.push(t)+ }+ for (let i = t.firstElementChild; i; i = i.nextElementSibling) {+ const t = i.localName+ !PE.includes(i.namespaceURI) ||+ ("Document" != t && "Folder" != t && "kml" != t) ||+ E(e, this.readRegionFromNode(i))+ }+ return e+ }+ readCamera(t) {+ const e = []+ if ("string" == typeof t) {+ const i = cp(t)+ E(e, this.readCameraFromDocument(i))+ } else lp(t) ? E(e, this.readCameraFromDocument(t)) : E(e, this.readCameraFromNode(t))+ return e+ }+ readCameraFromDocument(t) {+ const e = []+ for (let i = t.firstChild; i; i = i.nextSibling)+ i.nodeType === Node.ELEMENT_NODE && E(e, this.readCameraFromNode(i))+ return e+ }+ readCameraFromNode(t) {+ const e = []+ for (let i = t.firstElementChild; i; i = i.nextElementSibling)+ if (PE.includes(i.namespaceURI) && "Camera" === i.localName) {+ const t = wp({}, AE, i, [])+ e.push(t)+ }+ for (let i = t.firstElementChild; i; i = i.nextElementSibling) {+ const t = i.localName+ !PE.includes(i.namespaceURI) ||+ ("Document" !== t && "Folder" !== t && "Placemark" !== t && "kml" !== t) ||+ E(e, this.readCameraFromNode(i))+ }+ return e+ }+ writeFeaturesNode(t, e) {+ e = this.adaptOptions(e)+ const i = sp(PE[4], "kml"),+ n = "http://www.w3.org/2000/xmlns/"+ i.setAttributeNS(n, "xmlns:gx", RE[0]),+ i.setAttributeNS(n, "xmlns:xsi", rp),+ i.setAttributeNS(+ rp,+ "xsi:schemaLocation",+ "http://www.opengis.net/kml/2.2 https://developers.google.com/kml/schema/kml22gx.xsd"+ )+ const r = { node: i },+ s = {}+ t.length > 1 ? (s.Document = t) : 1 == t.length && (s.Placemark = t[0])+ const o = DE[i.namespaceURI],+ a = vp(s, o)+ return Cp(r, NE, xp, a, [e], o, this), i+ }+ }),+ (bP.format.KML.getDefaultFillStyle = function () {+ return XE+ }),+ (bP.format.KML.getDefaultImageStyle = function () {+ return $E+ }),+ (bP.format.KML.getDefaultStrokeStyle = function () {+ return ZE+ }),+ (bP.format.KML.getDefaultStyle = function () {+ return HE+ }),+ (bP.format.KML.getDefaultStyleArray = function () {+ return qE+ }),+ (bP.format.KML.getDefaultTextStyle = function () {+ return YE+ }),+ (bP.format.KML.readFlatCoordinates = iw),+ (bP.format.MVT = class extends Zv {+ constructor(t) {+ super(),+ (t = t || {}),+ (this.dataProjection = new mi({ code: "", units: "tile-pixels" })),+ (this.featureClass = t.featureClass ? t.featureClass : Ud),+ (this.geometryName_ = t.geometryName),+ (this.layerName_ = t.layerName ? t.layerName : "layer"),+ (this.layers_ = t.layers ? t.layers : null),+ (this.idProperty_ = t.idProperty),+ (this.supportedMediaTypes = ["application/vnd.mapbox-vector-tile", "application/x-protobuf"])+ }+ readRawGeometry_(t, e, i, n) {+ t.pos = e.geometry+ const r = t.readVarint() + t.pos+ let s = 1,+ o = 0,+ a = 0,+ l = 0,+ h = 0,+ c = 0+ for (; t.pos < r; ) {+ if (!o) {+ const e = t.readVarint()+ ;(s = 7 & e), (o = e >> 3)+ }+ if ((o--, 1 === s || 2 === s))+ (a += t.readSVarint()),+ (l += t.readSVarint()),+ 1 === s && h > c && (n.push(h), (c = h)),+ i.push(a, l),+ (h += 2)+ else {+ if (7 !== s) throw new Error("Invalid command found in the PBF")+ h > c && (i.push(i[c], i[c + 1]), (h += 2))+ }+ }+ h > c && (n.push(h), (c = h))+ }+ createFeature_(t, e, i) {+ const n = e.type+ if (0 === n) return null+ let r+ const s = e.properties+ let o+ this.idProperty_ ? ((o = s[this.idProperty_]), delete s[this.idProperty_]) : (o = e.id),+ (s[this.layerName_] = e.layer.name)+ const a = [],+ l = []+ this.readRawGeometry_(t, e, a, l)+ const h = (function (t, e) {+ let i+ 1 === t+ ? (i = 1 === e ? "Point" : "MultiPoint")+ : 2 === t+ ? (i = 1 === e ? "LineString" : "MultiLineString")+ : 3 === t && (i = "Polygon")+ return i+ })(n, l.length)+ if (this.featureClass === Ud) (r = new this.featureClass(h, a, l, 2, s, o)), r.transform(i.dataProjection)+ else {+ let t+ if ("Polygon" == h) {+ const e = ds(a, l)+ t = e.length > 1 ? new Gd(a, "XY", e) : new gs(a, "XY", l)+ } else+ t =+ "Point" === h+ ? new Wr(a, "XY")+ : "LineString" === h+ ? new Dd(a, "XY")+ : "MultiPoint" === h+ ? new kd(a, "XY")+ : "MultiLineString" === h+ ? new Nd(a, "XY", l)+ : null+ ;(r = new (0, this.featureClass)()), this.geometryName_ && r.setGeometryName(this.geometryName_)+ const e = Yv(t, !1, i)+ r.setGeometry(e), void 0 !== o && r.setId(o), r.setProperties(s, !0)+ }+ return r+ }+ getType() {+ return "arraybuffer"+ }+ readFeatures(t, e) {+ const i = this.layers_,+ n = En((e = this.adaptOptions(e)).dataProjection)+ n.setWorldExtent(e.extent), (e.dataProjection = n)+ const r = new FT(t),+ s = r.readFields(zT, {}),+ o = []+ for (const t in s) {+ if (i && !i.includes(t)) continue+ const a = s[t],+ l = a ? [0, 0, a.extent, a.extent] : null+ n.setExtent(l)+ for (let t = 0, i = a.length; t < i; ++t) {+ const i = $T(r, a, t),+ n = this.createFeature_(r, i, e)+ null !== n && o.push(n)+ }+ }+ return o+ }+ readProjection(t) {+ return this.dataProjection+ }+ setLayers(t) {+ this.layers_ = t+ }+ }),+ (bP.format.OSMXML = class extends aS {+ constructor() {+ super(), (this.dataProjection = En("EPSG:4326"))+ }+ readFeaturesFromNode(t, e) {+ if (((e = this.getReadOptions(t, e)), "osm" == t.localName)) {+ const i = wp({ nodes: {}, ways: [], features: [] }, YT, t, [e])+ for (let t = 0; t < i.ways.length; t++) {+ const n = i.ways[t],+ r = n.flatCoordinates+ if (!r.length)+ for (let t = 0, e = n.ndrefs.length; t < e; t++) {+ E(r, i.nodes[n.ndrefs[t]])+ }+ let s+ ;(s = n.ndrefs[0] == n.ndrefs[n.ndrefs.length - 1] ? new gs(r, "XY", [r.length]) : new Dd(r, "XY")),+ Yv(s, !1, e)+ const o = new At(s)+ void 0 !== n.id && o.setId(n.id), o.setProperties(n.tags, !0), i.features.push(o)+ }+ if (i.features) return i.features+ }+ return []+ }+ }),+ (bP.format.OWS = eC),+ (bP.format.Polyline = class extends vE {+ constructor(t) {+ super(),+ (t = t || {}),+ (this.dataProjection = En("EPSG:4326")),+ (this.factor_ = t.factor ? t.factor : 1e5),+ (this.geometryLayout_ = t.geometryLayout ? t.geometryLayout : "XY")+ }+ readFeatureFromText(t, e) {+ const i = this.readGeometryFromText(t, e)+ return new At(i)+ }+ readFeaturesFromText(t, e) {+ return [this.readFeatureFromText(t, e)]+ }+ readGeometryFromText(t, e) {+ const i = xr(this.geometryLayout_),+ n = _C(t, i, this.factor_)+ Wv(n, 0, n.length, i, n)+ return Yv(new Dd(n, this.geometryLayout_), !1, this.adaptOptions(e))+ }+ writeFeatureText(t, e) {+ const i = t.getGeometry()+ if (i) return this.writeGeometryText(i, e)+ throw new Error("Expected `feature` to have a geometry")+ }+ writeFeaturesText(t, e) {+ return this.writeFeatureText(t[0], e)+ }+ writeGeometryText(t, e) {+ const i = (t = Yv(t, !0, this.adaptOptions(e))).getFlatCoordinates(),+ n = t.getStride()+ return Wv(i, 0, i.length, n, i), pC(i, n, this.factor_)+ }+ }),+ (bP.format.Polyline.decodeDeltas = _C),+ (bP.format.Polyline.decodeFloats = function (t, e) {+ e = e || 1e5+ const i = yC(t)+ for (let t = 0, n = i.length; t < n; ++t) i[t] /= e+ return i+ }),+ (bP.format.Polyline.decodeSignedIntegers = yC),+ (bP.format.Polyline.decodeUnsignedIntegers = vC),+ (bP.format.Polyline.encodeDeltas = pC),+ (bP.format.Polyline.encodeFloats = function (t, e) {+ e = e || 1e5+ for (let i = 0, n = t.length; i < n; ++i) t[i] = Math.round(t[i] * e)+ return mC(t)+ }),+ (bP.format.Polyline.encodeSignedIntegers = mC),+ (bP.format.Polyline.encodeUnsignedInteger = SC),+ (bP.format.Polyline.encodeUnsignedIntegers = xC),+ (bP.format.TextFeature = vE),+ (bP.format.TopoJSON = class extends Qv {+ constructor(t) {+ super(),+ (t = t || {}),+ (this.layerName_ = t.layerName),+ (this.layers_ = t.layers ? t.layers : null),+ (this.dataProjection = En(t.dataProjection ? t.dataProjection : "EPSG:4326"))+ }+ readFeaturesFromObject(t, e) {+ if ("Topology" == t.type) {+ const i = t+ let n,+ r = null,+ s = null+ i.transform && ((n = i.transform), (r = n.scale), (s = n.translate))+ const o = i.arcs+ n &&+ (function (t, e, i) {+ for (let n = 0, r = t.length; n < r; ++n) bC(t[n], e, i)+ })(o, r, s)+ const a = [],+ l = i.objects,+ h = this.layerName_+ let c+ for (const t in l)+ (this.layers_ && !this.layers_.includes(t)) ||+ ("GeometryCollection" === l[t].type+ ? ((c = l[t]), a.push.apply(a, TC(c, o, r, s, h, t, e)))+ : ((c = l[t]), a.push(CC(c, o, r, s, h, t, e))))+ return a+ }+ return []+ }+ readProjectionFromObject(t) {+ return this.dataProjection+ }+ }),+ (bP.format.WFS = class extends aS {+ constructor(t) {+ super(),+ (t = t || {}),+ (this.version_ = t.version ? t.version : "1.1.0"),+ (this.featureType_ = t.featureType),+ (this.featureNS_ = t.featureNS),+ (this.gmlFormat_ = t.gmlFormat ? t.gmlFormat : new db[this.version_]()),+ (this.schemaLocation_ = t.schemaLocation ? t.schemaLocation : ub[this.version_])+ }+ getFeatureType() {+ return this.featureType_+ }+ setFeatureType(t) {+ this.featureType_ = t+ }+ readFeaturesFromNode(t, e) {+ const i = { node: t }+ Object.assign(i, { featureType: this.featureType_, featureNS: this.featureNS_ }),+ Object.assign(i, this.getReadOptions(t, e || {}))+ const n = [i]+ let r+ r = "2.0.0" === this.version_ ? eb : this.gmlFormat_.FEATURE_COLLECTION_PARSERS+ let s = wp([], r, t, n, this.gmlFormat_)+ return s || (s = []), s+ }+ readTransactionResponse(t) {+ if (t) {+ if ("string" == typeof t) {+ const e = cp(t)+ return this.readTransactionResponseFromDocument(e)+ }+ return lp(t) ? this.readTransactionResponseFromDocument(t) : this.readTransactionResponseFromNode(t)+ }+ }+ readFeatureCollectionMetadata(t) {+ if (t) {+ if ("string" == typeof t) {+ const e = cp(t)+ return this.readFeatureCollectionMetadataFromDocument(e)+ }+ return lp(t)+ ? this.readFeatureCollectionMetadataFromDocument(t)+ : this.readFeatureCollectionMetadataFromNode(t)+ }+ }+ readFeatureCollectionMetadataFromDocument(t) {+ for (let e = t.firstChild; e; e = e.nextSibling)+ if (e.nodeType == Node.ELEMENT_NODE) return this.readFeatureCollectionMetadataFromNode(e)+ }+ readFeatureCollectionMetadataFromNode(t) {+ const e = {},+ i = mS(t.getAttribute("numberOfFeatures"))+ return (e.numberOfFeatures = i), wp(e, eb, t, [], this.gmlFormat_)+ }+ readTransactionResponseFromDocument(t) {+ for (let e = t.firstChild; e; e = e.nextSibling)+ if (e.nodeType == Node.ELEMENT_NODE) return this.readTransactionResponseFromNode(e)+ }+ readTransactionResponseFromNode(t) {+ return wp({}, nb, t, [])+ }+ writeGetFeature(t) {+ const e = sp(hb[this.version_], "GetFeature")+ e.setAttribute("service", "WFS"),+ e.setAttribute("version", this.version_),+ t.handle && e.setAttribute("handle", t.handle),+ t.outputFormat && e.setAttribute("outputFormat", t.outputFormat),+ void 0 !== t.maxFeatures && e.setAttribute("maxFeatures", String(t.maxFeatures)),+ t.resultType && e.setAttribute("resultType", t.resultType),+ void 0 !== t.startIndex && e.setAttribute("startIndex", String(t.startIndex)),+ void 0 !== t.count && e.setAttribute("count", String(t.count)),+ void 0 !== t.viewParams && e.setAttribute("viewParams", t.viewParams),+ e.setAttributeNS(rp, "xsi:schemaLocation", this.schemaLocation_)+ const i = { node: e }+ if (+ (Object.assign(i, {+ version: this.version_,+ srsName: t.srsName,+ featureNS: t.featureNS ? t.featureNS : this.featureNS_,+ featurePrefix: t.featurePrefix,+ propertyNames: t.propertyNames ? t.propertyNames : []+ }),+ Mt(Array.isArray(t.featureTypes), "`options.featureTypes` must be an Array"),+ "string" == typeof t.featureTypes[0])+ ) {+ let n = t.filter+ t.bbox &&+ (Mt(t.geometryName, "`options.geometryName` must also be provided when `options.bbox` is set"),+ (n = this.combineBboxAndFilter(t.geometryName, t.bbox, t.srsName, n))),+ Object.assign(i, { geometryName: t.geometryName, filter: n }),+ Xb(e, t.featureTypes, [i])+ } else+ t.featureTypes.forEach((n) => {+ const r = this.combineBboxAndFilter(n.geometryName, n.bbox, t.srsName, t.filter)+ Object.assign(i, { geometryName: n.geometryName, filter: r }), Xb(e, [n.name], [i])+ })+ return e+ }+ combineBboxAndFilter(t, e, i, n) {+ const r = tb(t, e, i)+ return n ? QC(n, r) : r+ }+ writeTransaction(t, e, i, n) {+ const r = [],+ s = n.version ? n.version : this.version_,+ o = sp(hb[s], "Transaction")+ let a+ o.setAttribute("service", "WFS"),+ o.setAttribute("version", s),+ n && ((a = n.gmlOptions ? n.gmlOptions : {}), n.handle && o.setAttribute("handle", n.handle)),+ o.setAttributeNS(rp, "xsi:schemaLocation", ub[s])+ const l = (function (t, e, i, n) {+ const r = n.featurePrefix ? n.featurePrefix : ob+ let s+ "1.0.0" === i ? (s = 2) : "1.1.0" === i ? (s = 3) : "2.0.0" === i && (s = 3.2)+ const o = Object.assign(+ { node: t },+ {+ version: i,+ featureNS: n.featureNS,+ featureType: n.featureType,+ featurePrefix: r,+ gmlVersion: s,+ hasZ: n.hasZ,+ srsName: n.srsName+ },+ e+ )+ return o+ })(o, a, s, n)+ return (+ t && gb("Insert", t, r, l),+ e && gb("Update", e, r, l),+ i && gb("Delete", i, r, l),+ n.nativeElements && gb("Native", n.nativeElements, r, l),+ o+ )+ }+ readProjectionFromDocument(t) {+ for (let e = t.firstChild; e; e = e.nextSibling)+ if (e.nodeType == Node.ELEMENT_NODE) return this.readProjectionFromNode(e)+ return null+ }+ readProjectionFromNode(t) {+ if (t.firstElementChild && t.firstElementChild.firstElementChild)+ for (let e = (t = t.firstElementChild.firstElementChild).firstElementChild; e; e = e.nextElementSibling)+ if (0 !== e.childNodes.length && (1 !== e.childNodes.length || 3 !== e.firstChild.nodeType)) {+ const t = [{}]+ return this.gmlFormat_.readGeometryElement(e, t), En(t.pop().srsName)+ }+ return null+ }+ }),+ (bP.format.WFS.writeFilter = function (t, e) {+ const i = sp(Vb((e = e || "1.1.0")), "Filter"),+ n = { node: i }+ return Object.assign(n, { version: e, filter: t }), Pb(i, t, [n]), i+ }),+ (bP.format.WKB = class extends Zv {+ constructor(t) {+ super(),+ (t = t || {}),+ (this.splitCollection = Boolean(t.splitCollection)),+ (this.viewCache_ = null),+ (this.hex_ = !1 !== t.hex),+ (this.littleEndian_ = !1 !== t.littleEndian),+ (this.ewkb_ = !1 !== t.ewkb),+ (this.layout_ = t.geometryLayout),+ (this.nodataZ_ = t.nodataZ || 0),+ (this.nodataM_ = t.nodataM || 0),+ (this.srid_ = t.srid)+ }+ getType() {+ return this.hex_ ? "text" : "arraybuffer"+ }+ readFeature(t, e) {+ return new At({ geometry: this.readGeometry(t, e) })+ }+ readFeatures(t, e) {+ let i = []+ const n = this.readGeometry(t, e)+ return (+ (i = this.splitCollection && n instanceof Md ? n.getGeometriesArray() : [n]),+ i.map((t) => new At({ geometry: t }))+ )+ }+ readGeometry(t, e) {+ const i = nR(t)+ if (!i) return null+ const n = new eR(i).readGeometry()+ return (this.viewCache_ = i), (e = this.getReadOptions(t, e)), (this.viewCache_ = null), Yv(n, !1, e)+ }+ readProjection(t) {+ const e = this.viewCache_ || nR(t)+ if (!e) return+ const i = new eR(e)+ return i.readWkbHeader(), (i.getSrid() && En("EPSG:" + i.getSrid())) || void 0+ }+ writeFeature(t, e) {+ return this.writeGeometry(t.getGeometry(), e)+ }+ writeFeatures(t, e) {+ return this.writeGeometry(new Md(t.map((t) => t.getGeometry())), e)+ }+ writeGeometry(t, e) {+ e = this.adaptOptions(e)+ const i = new iR({+ layout: this.layout_,+ littleEndian: this.littleEndian_,+ ewkb: this.ewkb_,+ nodata: { Z: this.nodataZ_, M: this.nodataM_ }+ })+ let n = Number.isInteger(this.srid_) ? Number(this.srid_) : null+ if (!1 !== this.srid_ && !Number.isInteger(this.srid_)) {+ const t = e.dataProjection && En(e.dataProjection)+ if (t) {+ const e = t.getCode()+ e.startsWith("EPSG:") && (n = Number(e.substring(5)))+ }+ }+ i.writeGeometry(Yv(t, !0, e), n)+ const r = i.getBuffer()+ return this.hex_+ ? (function (t) {+ const e = new Uint8Array(t)+ return Array.from(e.values())+ .map((t) => (t < 16 ? "0" : "") + Number(t).toString(16).toUpperCase())+ .join("")+ })(r)+ : r+ }+ }),+ (bP.format.WKT = class extends vE {+ constructor(t) {+ super(), (t = t || {}), (this.splitCollection_ = void 0 !== t.splitCollection && t.splitCollection)+ }+ parse_(t) {+ const e = new fR(t)+ return new pR(e).parse()+ }+ readFeatureFromText(t, e) {+ const i = this.readGeometryFromText(t, e),+ n = new At()+ return n.setGeometry(i), n+ }+ readFeaturesFromText(t, e) {+ let i = []+ const n = this.readGeometryFromText(t, e)+ i = this.splitCollection_ && "GeometryCollection" == n.getType() ? n.getGeometriesArray() : [n]+ const r = []+ for (let t = 0, e = i.length; t < e; ++t) {+ const e = new At()+ e.setGeometry(i[t]), r.push(e)+ }+ return r+ }+ readGeometryFromText(t, e) {+ return Yv(this.parse_(t), !1, e)+ }+ writeFeatureText(t, e) {+ const i = t.getGeometry()+ return i ? this.writeGeometryText(i, e) : ""+ }+ writeFeaturesText(t, e) {+ if (1 == t.length) return this.writeFeatureText(t[0], e)+ const i = []+ for (let e = 0, n = t.length; e < n; ++e) i.push(t[e].getGeometry())+ const n = new Md(i)+ return this.writeGeometryText(n, e)+ }+ writeGeometryText(t, e) {+ return vR(Yv(t, !0, e))+ }+ }),+ (bP.format.WMSCapabilities = class extends qT {+ constructor() {+ super(), (this.version = void 0)+ }+ readFromNode(t) {+ this.version = t.getAttribute("version").trim()+ const e = wp({ version: this.version }, wR, t, [])+ return e || null+ }+ }),+ (bP.format.WMSGetFeatureInfo = class extends aS {+ constructor(t) {+ super(),+ (t = t || {}),+ (this.featureNS_ = "http://mapserver.gis.umn.edu/mapserver"),+ (this.gmlFormat_ = new FS()),+ (this.layers_ = t.layers ? t.layers : null)+ }+ getLayers() {+ return this.layers_+ }+ setLayers(t) {+ this.layers_ = t+ }+ readFeatures_(t, e) {+ t.setAttribute("namespaceURI", this.featureNS_)+ const i = t.localName+ let n = []+ if (0 === t.childNodes.length) return n+ if ("msGMLOutput" == i)+ for (let i = 0, r = t.childNodes.length; i < r; i++) {+ const r = t.childNodes[i]+ if (r.nodeType !== Node.ELEMENT_NODE) continue+ const s = r,+ o = e[0],+ a = "_layer",+ l = s.localName.replace(a, "")+ if (this.layers_ && !this.layers_.includes(l)) continue+ const h = l + "_feature"+ ;(o.featureType = h), (o.featureNS = this.featureNS_)+ const c = {}+ c[h] = dp(this.gmlFormat_.readFeatureElement, this.gmlFormat_)+ const u = Sp([o.featureNS, null], c)+ s.setAttribute("namespaceURI", this.featureNS_)+ const d = wp([], u, s, e, this.gmlFormat_)+ d && E(n, d)+ }+ if ("FeatureCollection" == i) {+ const e = wp([], this.gmlFormat_.FEATURE_COLLECTION_PARSERS, t, [{}], this.gmlFormat_)+ e && (n = e)+ }+ return n+ }+ readFeaturesFromNode(t, e) {+ const i = {}+ return e && Object.assign(i, this.getReadOptions(t, e)), this.readFeatures_(t, [i])+ }+ }),+ (bP.format.WMTSCapabilities = class extends qT {+ constructor() {+ super(), (this.owsParser_ = new eC())+ }+ readFromNode(t) {+ let e = t.getAttribute("version")+ e && (e = e.trim())+ let i = this.owsParser_.readFromNode(t)+ return i ? ((i.version = e), (i = wp(i, JR, t, [])), i || null) : null+ }+ }),+ (bP.format.XML = qT),+ (bP.format.XMLFeature = aS),+ (bP.format.filter = {}),+ (bP.format.filter.And = FC),+ (bP.format.filter.Bbox = LC),+ (bP.format.filter.Comparison = NC),+ (bP.format.filter.ComparisonBinary = GC),+ (bP.format.filter.Contains = AC),+ (bP.format.filter.DWithin = OC),+ (bP.format.filter.Disjoint = DC),+ (bP.format.filter.During = kC),+ (bP.format.filter.EqualTo = jC),+ (bP.format.filter.Filter = PC),+ (bP.format.filter.GreaterThan = UC),+ (bP.format.filter.GreaterThanOrEqualTo = BC),+ (bP.format.filter.Intersects = zC),+ (bP.format.filter.IsBetween = XC),+ (bP.format.filter.IsLike = VC),+ (bP.format.filter.IsNull = $C),+ (bP.format.filter.LessThan = WC),+ (bP.format.filter.LessThanOrEqualTo = ZC),+ (bP.format.filter.LogicalNary = IC),+ (bP.format.filter.Not = YC),+ (bP.format.filter.NotEqualTo = HC),+ (bP.format.filter.Or = KC),+ (bP.format.filter.ResourceId = qC),+ (bP.format.filter.Spatial = MC),+ (bP.format.filter.Within = JC),+ (bP.format.filter.and = QC),+ (bP.format.filter.bbox = tb),+ (bP.format.filter.between = function (t, e, i) {+ return new XC(t, e, i)+ }),+ (bP.format.filter.contains = function (t, e, i) {+ return new AC(t, e, i)+ }),+ (bP.format.filter.disjoint = function (t, e, i) {+ return new DC(t, e, i)+ }),+ (bP.format.filter.during = function (t, e, i) {+ return new kC(t, e, i)+ }),+ (bP.format.filter.dwithin = function (t, e, i, n, r) {+ return new OC(t, e, i, n, r)+ }),+ (bP.format.filter.equalTo = function (t, e, i) {+ return new jC(t, e, i)+ }),+ (bP.format.filter.greaterThan = function (t, e) {+ return new UC(t, e)+ }),+ (bP.format.filter.greaterThanOrEqualTo = function (t, e) {+ return new BC(t, e)+ }),+ (bP.format.filter.intersects = function (t, e, i) {+ return new zC(t, e, i)+ }),+ (bP.format.filter.isNull = function (t) {+ return new $C(t)+ }),+ (bP.format.filter.lessThan = function (t, e) {+ return new WC(t, e)+ }),+ (bP.format.filter.lessThanOrEqualTo = function (t, e) {+ return new ZC(t, e)+ }),+ (bP.format.filter.like = function (t, e, i, n, r, s) {+ return new VC(t, e, i, n, r, s)+ }),+ (bP.format.filter.not = function (t) {+ return new YC(t)+ }),+ (bP.format.filter.notEqualTo = function (t, e, i) {+ return new HC(t, e, i)+ }),+ (bP.format.filter.or = function (t) {+ const e = [null].concat(Array.prototype.slice.call(arguments))+ return new (Function.prototype.bind.apply(KC, e))()+ }),+ (bP.format.filter.resourceId = function (t) {+ return new qC(t)+ }),+ (bP.format.filter.within = function (t, e, i) {+ return new JC(t, e, i)+ }),+ (bP.format.xlink = {}),+ (bP.format.xlink.readHref = JT),+ (bP.format.xsd = {}),+ (bP.format.xsd.readBoolean = uS),+ (bP.format.xsd.readBooleanString = dS),+ (bP.format.xsd.readDateTime = gS),+ (bP.format.xsd.readDecimal = fS),+ (bP.format.xsd.readDecimalString = pS),+ (bP.format.xsd.readNonNegativeIntegerString = mS),+ (bP.format.xsd.readPositiveInteger = _S),+ (bP.format.xsd.readString = yS),+ (bP.format.xsd.writeBooleanTextNode = xS),+ (bP.format.xsd.writeCDATASection = vS),+ (bP.format.xsd.writeDateTimeTextNode = SS),+ (bP.format.xsd.writeDecimalTextNode = ES),+ (bP.format.xsd.writeNonNegativeIntegerTextNode = wS),+ (bP.format.xsd.writeStringTextNode = RS),+ (bP.functions = {}),+ (bP.functions.FALSE = b),+ (bP.functions.TRUE = C),+ (bP.functions.VOID = R),+ (bP.functions.memoizeOne = P),+ (bP.functions.toPromise = I),+ (bP.geom = {}),+ (bP.geom.Circle = Ld),+ (bP.geom.Geometry = _r),+ (bP.geom.GeometryCollection = Md),+ (bP.geom.LineString = Dd),+ (bP.geom.LinearRing = $r),+ (bP.geom.MultiLineString = Nd),+ (bP.geom.MultiPoint = kd),+ (bP.geom.MultiPolygon = Gd),+ (bP.geom.Point = Wr),+ (bP.geom.Polygon = gs),+ (bP.geom.Polygon.circular = fs),+ (bP.geom.Polygon.fromCircle = _s),+ (bP.geom.Polygon.fromExtent = ps),+ (bP.geom.Polygon.makeRegular = ms),+ (bP.geom.SimpleGeometry = mr),+ (bP.geom.SimpleGeometry.getLayoutForStride = yr),+ (bP.geom.SimpleGeometry.getStrideForLayout = xr),+ (bP.geom.SimpleGeometry.transformGeom2D = vr),+ (bP.geom.flat = {}),+ (bP.geom.flat.area = {}),+ (bP.geom.flat.area.linearRing = Sr),+ (bP.geom.flat.area.linearRings = Er),+ (bP.geom.flat.area.linearRingss = wr),+ (bP.geom.flat.center = {}),+ (bP.geom.flat.center.linearRingss = Rd),+ (bP.geom.flat.closest = {}),+ (bP.geom.flat.closest.arrayMaxSquaredDelta = br),+ (bP.geom.flat.closest.assignClosestArrayPoint = Ir),+ (bP.geom.flat.closest.assignClosestMultiArrayPoint = Fr),+ (bP.geom.flat.closest.assignClosestPoint = Pr),+ (bP.geom.flat.closest.maxSquaredDelta = Cr),+ (bP.geom.flat.closest.multiArrayMaxSquaredDelta = Rr),+ (bP.geom.flat.contains = {}),+ (bP.geom.flat.contains.linearRingContainsExtent = Zr),+ (bP.geom.flat.contains.linearRingContainsXY = Yr),+ (bP.geom.flat.contains.linearRingsContainsXY = Hr),+ (bP.geom.flat.contains.linearRingssContainsXY = Kr),+ (bP.geom.flat.deflate = {}),+ (bP.geom.flat.deflate.deflateCoordinate = Lr),+ (bP.geom.flat.deflate.deflateCoordinates = Mr),+ (bP.geom.flat.deflate.deflateCoordinatesArray = Ar),+ (bP.geom.flat.deflate.deflateMultiCoordinatesArray = Or),+ (bP.geom.flat.flip = {}),+ (bP.geom.flat.flip.flipXY = Wv),+ (bP.geom.flat.geodesic = {}),+ (bP.geom.flat.geodesic.greatCircleArc = function (t, e, i, n, r, s) {+ const o = En("EPSG:4326"),+ a = Math.cos(Oe(e)),+ l = Math.sin(Oe(e)),+ h = Math.cos(Oe(n)),+ c = Math.sin(Oe(n)),+ u = Math.cos(Oe(i - t)),+ d = Math.sin(Oe(i - t)),+ g = l * c + a * h * u+ return Dx(+ function (e) {+ if (1 <= g) return [i, n]+ const r = e * Math.acos(g),+ s = Math.cos(r),+ o = Math.sin(r),+ f = d * h,+ p = a * c - l * h * u,+ _ = Math.atan2(f, p),+ m = Math.asin(l * s + a * o * Math.cos(_))+ return [Ae(Oe(t) + Math.atan2(Math.sin(_) * o * a, s - l * Math.sin(m))), Ae(m)]+ },+ An(o, r),+ s+ )+ }),+ (bP.geom.flat.geodesic.meridian = Nx),+ (bP.geom.flat.geodesic.parallel = kx),+ (bP.geom.flat.inflate = {}),+ (bP.geom.flat.inflate.inflateCoordinates = Dr),+ (bP.geom.flat.inflate.inflateCoordinatesArray = Nr),+ (bP.geom.flat.inflate.inflateMultiCoordinatesArray = kr),+ (bP.geom.flat.interiorpoint = {}),+ (bP.geom.flat.interiorpoint.getInteriorPointOfArray = qr),+ (bP.geom.flat.interiorpoint.getInteriorPointsOfMultiArray = Jr),+ (bP.geom.flat.interpolate = {}),+ (bP.geom.flat.interpolate.interpolatePoint = Pd),+ (bP.geom.flat.interpolate.lineStringCoordinateAtM = Id),+ (bP.geom.flat.interpolate.lineStringsCoordinateAtM = Fd),+ (bP.geom.flat.intersectsextent = {}),+ (bP.geom.flat.intersectsextent.intersectsLineString = es),+ (bP.geom.flat.intersectsextent.intersectsLineStringArray = is),+ (bP.geom.flat.intersectsextent.intersectsLinearRing = ns),+ (bP.geom.flat.intersectsextent.intersectsLinearRingArray = rs),+ (bP.geom.flat.intersectsextent.intersectsLinearRingMultiArray = ss),+ (bP.geom.flat.length = {}),+ (bP.geom.flat.length.lineStringLength = Od),+ (bP.geom.flat.length.linearRingLength = function (t, e, i, n) {+ let r = Od(t, e, i, n)+ const s = t[i - n] - t[e],+ o = t[i - n + 1] - t[e + 1]+ return (r += Math.sqrt(s * s + o * o)), r+ }),+ (bP.geom.flat.orient = {}),+ (bP.geom.flat.orient.inflateEnds = ds),+ (bP.geom.flat.orient.linearRingIsClockwise = as),+ (bP.geom.flat.orient.linearRingsAreOriented = ls),+ (bP.geom.flat.orient.linearRingssAreOriented = hs),+ (bP.geom.flat.orient.orientLinearRings = cs),+ (bP.geom.flat.orient.orientLinearRingsArray = us),+ (bP.geom.flat.reverse = {}),+ (bP.geom.flat.reverse.coordinates = os),+ (bP.geom.flat.segments = {}),+ (bP.geom.flat.segments.forEach = Qr),+ (bP.geom.flat.segments.getIntersectionPoint = ts),+ (bP.geom.flat.simplify = {}),+ (bP.geom.flat.simplify.douglasPeucker = Gr),+ (bP.geom.flat.simplify.douglasPeuckerArray = jr),+ (bP.geom.flat.simplify.douglasPeuckerMultiArray = function (t, e, i, n, r, s, o, a) {+ for (let l = 0, h = i.length; l < h; ++l) {+ const h = i[l],+ c = []+ ;(o = jr(t, e, h, n, r, s, o, c)), a.push(c), (e = h[h.length - 1])+ }+ return o+ }),+ (bP.geom.flat.simplify.quantize = zr),+ (bP.geom.flat.simplify.quantizeArray = Xr),+ (bP.geom.flat.simplify.quantizeMultiArray = Vr),+ (bP.geom.flat.simplify.radialDistance = Ur),+ (bP.geom.flat.simplify.simplifyLineString = function (t, e, i, n, r, s, o) {+ return (+ (o = void 0 !== o ? o : []),+ s || ((i = Ur(t, e, i, n, r, o, 0)), (t = o), (e = 0), (n = 2)),+ (o.length = Gr(t, e, i, n, r, o, 0)),+ o+ )+ }),+ (bP.geom.flat.simplify.snap = Br),+ (bP.geom.flat.straightchunk = {}),+ (bP.geom.flat.straightchunk.matchingChunk = Xy),+ (bP.geom.flat.textpath = {}),+ (bP.geom.flat.textpath.drawTextOnPath = Yy),+ (bP.geom.flat.topology = {}),+ (bP.geom.flat.topology.lineStringIsClosed = function (t, e, i, n) {+ const r = i - n+ return t[e] === t[r] && t[e + 1] === t[r + 1] && (i - e) / n > 3 && !!Sr(t, e, i, n)+ }),+ (bP.geom.flat.transform = {}),+ (bP.geom.flat.transform.rotate = ur),+ (bP.geom.flat.transform.scale = dr),+ (bP.geom.flat.transform.transform2D = cr),+ (bP.geom.flat.transform.translate = gr),+ (bP.has = {}),+ (bP.has.CREATE_IMAGE_BITMAP = dt),+ (bP.has.DEVICE_PIXEL_RATIO = ht),+ (bP.has.IMAGE_DECODE = ut),+ (bP.has.MAC = lt),+ (bP.has.PASSIVE_EVENT_LISTENERS = gt),+ (bP.has.SAFARI = st),+ (bP.has.SAFARI_BUG_237906 = ot),+ (bP.has.WEBKIT = at),+ (bP.has.WORKER_OFFSCREEN_CANVAS = ct),+ (bP.interaction = {}),+ (bP.interaction.DblClickDragZoom = class extends Ho {+ constructor(t) {+ const e = t || {}+ super(e),+ e.stopDown && (this.stopDown = e.stopDown),+ (this.scaleDeltaByPixel_ = e.delta ? e.delta : 0.01),+ (this.duration_ = void 0 !== e.duration ? e.duration : 250),+ (this.handlingDownUpSequence_ = !1),+ (this.handlingDoubleDownSequence_ = !1),+ (this.doubleTapTimeoutId_ = void 0),+ (this.trackedPointers_ = {}),+ (this.down_ = null),+ (this.targetPointers = [])+ }+ handleEvent(t) {+ if (!t.originalEvent) return !0+ let e = !1+ if ((this.updateTrackedPointers_(t), this.handlingDownUpSequence_)) {+ if (t.type == $s.POINTERDRAG) this.handleDragEvent(t), t.originalEvent.preventDefault()+ else if (t.type == $s.POINTERUP) {+ const e = this.handleUpEvent(t)+ this.handlingDownUpSequence_ = e+ }+ } else if (t.type == $s.POINTERDOWN)+ if (this.handlingDoubleDownSequence_) {+ this.handlingDoubleDownSequence_ = !1+ const i = this.handleDownEvent(t)+ ;(this.handlingDownUpSequence_ = i), (e = this.stopDown(i))+ } else (e = this.stopDown(!1)), this.waitForDblTap_()+ return !e+ }+ handleDragEvent(t) {+ let e = 1+ const i = this.targetPointers[0],+ n = this.down_,+ r = i.clientY - n.clientY+ void 0 !== this.lastDistance_ && (e = 1 - (this.lastDistance_ - r) * this.scaleDeltaByPixel_),+ (this.lastDistance_ = r),+ 1 != e && (this.lastScaleDelta_ = e)+ const s = t.map,+ o = s.getView()+ s.render(), o.adjustResolutionInternal(e)+ }+ handleDownEvent(t) {+ if (1 == this.targetPointers.length) {+ const e = t.map+ return (+ (this.anchor_ = null),+ (this.lastDistance_ = void 0),+ (this.lastScaleDelta_ = 1),+ (this.down_ = t.originalEvent),+ this.handlingDownUpSequence_ || e.getView().beginInteraction(),+ !0+ )+ }+ return !1+ }+ handleUpEvent(t) {+ if (0 == this.targetPointers.length) {+ const e = t.map.getView(),+ i = this.lastScaleDelta_ > 1 ? 1 : -1+ return (+ e.endInteraction(this.duration_, i),+ (this.handlingDownUpSequence_ = !1),+ (this.handlingDoubleDownSequence_ = !1),+ !1+ )+ }+ return !0+ }+ stopDown(t) {+ return t+ }+ updateTrackedPointers_(t) {+ if (+ (function (t) {+ const e = t.type+ return e === $s.POINTERDOWN || e === $s.POINTERDRAG || e === $s.POINTERUP+ })(t)+ ) {+ const e = t.originalEvent,+ i = e.pointerId.toString()+ t.type == $s.POINTERUP+ ? delete this.trackedPointers_[i]+ : (t.type == $s.POINTERDOWN || i in this.trackedPointers_) && (this.trackedPointers_[i] = e),+ (this.targetPointers = Object.values(this.trackedPointers_))+ }+ }+ waitForDblTap_() {+ void 0 !== this.doubleTapTimeoutId_+ ? (clearTimeout(this.doubleTapTimeoutId_), (this.doubleTapTimeoutId_ = void 0))+ : ((this.handlingDoubleDownSequence_ = !0),+ (this.doubleTapTimeoutId_ = setTimeout(this.endInteraction_.bind(this), 250)))+ }+ endInteraction_() {+ ;(this.handlingDoubleDownSequence_ = !1), (this.doubleTapTimeoutId_ = void 0)+ }+ }),+ (bP.interaction.DoubleClickZoom = Jo),+ (bP.interaction.DragAndDrop = class extends Ho {+ constructor(t) {+ ;(t = t || {}),+ super({ handleEvent: C }),+ this.on,+ this.once,+ this.un,+ (this.readAsBuffer_ = !1),+ (this.formats_ = [])+ const e = t.formatConstructors ? t.formatConstructors : []+ for (let t = 0, i = e.length; t < i; ++t) {+ let i = e[t]+ "function" == typeof i && (i = new i()),+ this.formats_.push(i),+ (this.readAsBuffer_ = this.readAsBuffer_ || "arraybuffer" === i.getType())+ }+ ;(this.projection_ = t.projection ? En(t.projection) : null),+ (this.dropListenKeys_ = null),+ (this.source_ = t.source || null),+ (this.target = t.target ? t.target : null)+ }+ handleResult_(t, e) {+ const i = e.target.result,+ n = this.getMap()+ let r,+ s = this.projection_+ if (!s && ((s = Gn()), !s)) {+ s = n.getView().getProjection()+ }+ const o = this.formats_+ for (let e = 0, n = o.length; e < n; ++e) {+ const n = o[e]+ let a = i+ this.readAsBuffer_ &&+ "arraybuffer" !== n.getType() &&+ (void 0 === r && (r = new TextDecoder().decode(i)), (a = r))+ const l = this.tryReadFeatures_(n, a, { featureProjection: s })+ if (l && l.length > 0) {+ this.source_ && (this.source_.clear(), this.source_.addFeatures(l)), this.dispatchEvent(new Yx(Zx, t, l, s))+ break+ }+ }+ }+ registerListeners_() {+ const t = this.getMap()+ if (t) {+ const e = this.target ? this.target : t.getViewport()+ this.dropListenKeys_ = [+ D(e, c, this.handleDrop, this),+ D(e, l, this.handleStop, this),+ D(e, h, this.handleStop, this),+ D(e, c, this.handleStop, this)+ ]+ }+ }+ setActive(t) {+ !this.getActive() && t && this.registerListeners_(),+ this.getActive() && !t && this.unregisterListeners_(),+ super.setActive(t)+ }+ setMap(t) {+ this.unregisterListeners_(), super.setMap(t), this.getActive() && this.registerListeners_()+ }+ tryReadFeatures_(t, e, i) {+ try {+ return t.readFeatures(e, i)+ } catch {+ return null+ }+ }+ unregisterListeners_() {+ this.dropListenKeys_ && (this.dropListenKeys_.forEach(k), (this.dropListenKeys_ = null))+ }+ handleDrop(t) {+ const e = t.dataTransfer.files+ for (let t = 0, i = e.length; t < i; ++t) {+ const i = e.item(t),+ n = new FileReader()+ n.addEventListener(g, this.handleResult_.bind(this, i)),+ this.readAsBuffer_ ? n.readAsArrayBuffer(i) : n.readAsText(i)+ }+ }+ handleStop(t) {+ t.stopPropagation(), t.preventDefault(), (t.dataTransfer.dropEffect = "copy")+ }+ }),+ (bP.interaction.DragAndDrop.DragAndDropEvent = Yx),+ (bP.interaction.DragBox = Ta),+ (bP.interaction.DragBox.DragBoxEvent = wa),+ (bP.interaction.DragPan = _a),+ (bP.interaction.DragRotate = ma),+ (bP.interaction.DragRotateAndZoom = class extends fa {+ constructor(t) {+ super((t = t || {})),+ (this.condition_ = t.condition ? t.condition : ca),+ (this.lastAngle_ = void 0),+ (this.lastMagnitude_ = void 0),+ (this.lastScaleDelta_ = 0),+ (this.duration_ = void 0 !== t.duration ? t.duration : 400)+ }+ handleDragEvent(t) {+ if (!da(t)) return+ const e = t.map,+ i = e.getSize(),+ n = t.pixel,+ r = n[0] - i[0] / 2,+ s = i[1] / 2 - n[1],+ o = Math.atan2(s, r),+ a = Math.sqrt(r * r + s * s),+ l = e.getView()+ if (void 0 !== this.lastAngle_) {+ const t = this.lastAngle_ - o+ l.adjustRotationInternal(t)+ }+ ;(this.lastAngle_ = o),+ void 0 !== this.lastMagnitude_ && l.adjustResolutionInternal(this.lastMagnitude_ / a),+ void 0 !== this.lastMagnitude_ && (this.lastScaleDelta_ = this.lastMagnitude_ / a),+ (this.lastMagnitude_ = a)+ }+ handleUpEvent(t) {+ if (!da(t)) return !0+ const e = t.map.getView(),+ i = this.lastScaleDelta_ > 1 ? 1 : -1+ return e.endInteraction(this.duration_, i), (this.lastScaleDelta_ = 0), !1+ }+ handleDownEvent(t) {+ return (+ !!da(t) &&+ !!this.condition_(t) &&+ (t.map.getView().beginInteraction(), (this.lastAngle_ = void 0), (this.lastMagnitude_ = void 0), !0)+ )+ }+ }),+ (bP.interaction.DragZoom = Ca),+ (bP.interaction.Draw = class extends fa {+ constructor(t) {+ const e = t+ e.stopDown || (e.stopDown = b),+ super(e),+ this.on,+ this.once,+ this.un,+ (this.options_ = t),+ (this.shouldHandle_ = !1),+ (this.downPx_ = null),+ this.downTimeout_,+ this.lastDragTime_,+ this.pointerType_,+ (this.freehand_ = !1),+ (this.source_ = t.source ? t.source : null),+ (this.features_ = t.features ? t.features : null),+ (this.snapTolerance_ = t.snapTolerance ? t.snapTolerance : 12),+ (this.type_ = t.type),+ (this.mode_ = (function (t) {+ switch (t) {+ case "Point":+ case "MultiPoint":+ return "Point"+ case "LineString":+ case "MultiLineString":+ return "LineString"+ case "Polygon":+ case "MultiPolygon":+ return "Polygon"+ case "Circle":+ return "Circle"+ default:+ throw new Error("Invalid type: " + t)+ }+ })(this.type_)),+ (this.stopClick_ = !!t.stopClick),+ (this.ignoreNextUpEvent_ = !1),+ (this.minPoints_ = t.minPoints ? t.minPoints : "Polygon" === this.mode_ ? 3 : 2),+ (this.maxPoints_ = "Circle" === this.mode_ ? 2 : t.maxPoints ? t.maxPoints : 1 / 0),+ (this.finishCondition_ = t.finishCondition ? t.finishCondition : C),+ (this.geometryLayout_ = t.geometryLayout ? t.geometryLayout : "XY")+ let i = t.geometryFunction+ if (!i) {+ const t = this.mode_+ if ("Circle" === t)+ i = (t, e, i) => {+ const n = e || new Ld([NaN, NaN]),+ r = Un(t[0], i),+ s = ai(r, Un(t[t.length - 1], i))+ n.setCenterAndRadius(r, Math.sqrt(s), this.geometryLayout_)+ const o = Gn()+ return o && n.transform(i, o), n+ }+ else {+ let e+ "Point" === t ? (e = Wr) : "LineString" === t ? (e = Dd) : "Polygon" === t && (e = gs),+ (i = (i, n, r) => (+ n+ ? "Polygon" === t+ ? i[0].length+ ? n.setCoordinates([i[0].concat([i[0][0]])], this.geometryLayout_)+ : n.setCoordinates([], this.geometryLayout_)+ : n.setCoordinates(i, this.geometryLayout_)+ : (n = new e(i, this.geometryLayout_)),+ n+ ))+ }+ }+ ;(this.geometryFunction_ = i),+ (this.dragVertexDelay_ = void 0 !== t.dragVertexDelay ? t.dragVertexDelay : 500),+ (this.finishCoordinate_ = null),+ (this.sketchFeature_ = null),+ (this.sketchPoint_ = null),+ (this.sketchCoords_ = null),+ (this.sketchLine_ = null),+ (this.sketchLineCoords_ = null),+ (this.squaredClickTolerance_ = t.clickTolerance ? t.clickTolerance * t.clickTolerance : 36),+ (this.overlay_ = new Gx({+ source: new qd({ useSpatialIndex: !1, wrapX: !!t.wrapX && t.wrapX }),+ style: t.style ? t.style : cv(),+ updateWhileInteracting: !0+ })),+ (this.geometryName_ = t.geometryName),+ (this.condition_ = t.condition ? t.condition : la),+ this.freehandCondition_,+ t.freehand+ ? (this.freehandCondition_ = ra)+ : (this.freehandCondition_ = t.freehandCondition ? t.freehandCondition : ca),+ this.traceCondition_,+ this.setTrace(t.trace || !1),+ (this.traceState_ = { active: !1 }),+ (this.traceSource_ = t.traceSource || t.source || null),+ this.addChangeListener(Yo, this.updateState_)+ }+ setTrace(t) {+ let e+ ;(e = t ? (!0 === t ? ra : t) : oa), (this.traceCondition_ = e)+ }+ setMap(t) {+ super.setMap(t), this.updateState_()+ }+ setFreehand(t) {+ ;(this.freehand_ = t),+ this.freehand_+ ? (this.freehandCondition_ = ra)+ : (this.freehandCondition_ =+ this.options_ && this.options_.freehandCondition ? this.options_.freehandCondition : ca)+ }+ getOverlay() {+ return this.overlay_+ }+ getFreehand() {+ return this.freehand_+ }+ handleEvent(t) {+ t.originalEvent.type === s && t.originalEvent.preventDefault(),+ (this.freehand_ = "Point" !== this.mode_ && this.freehandCondition_(t))+ let e = t.type === $s.POINTERMOVE,+ i = !0+ if (!this.freehand_ && this.lastDragTime_ && t.type === $s.POINTERDRAG) {+ Date.now() - this.lastDragTime_ >= this.dragVertexDelay_+ ? ((this.downPx_ = t.pixel), (this.shouldHandle_ = !this.freehand_), (e = !0))+ : (this.lastDragTime_ = void 0),+ this.shouldHandle_ &&+ void 0 !== this.downTimeout_ &&+ (clearTimeout(this.downTimeout_), (this.downTimeout_ = void 0))+ }+ return (+ this.freehand_ && t.type === $s.POINTERDRAG && null !== this.sketchFeature_+ ? (this.addToDrawing_(t.coordinate), (i = !1))+ : this.freehand_ && t.type === $s.POINTERDOWN+ ? (i = !1)+ : e && this.getPointerCount() < 2+ ? ((i = t.type === $s.POINTERMOVE),+ i && this.freehand_+ ? (this.handlePointerMove_(t), this.shouldHandle_ && t.originalEvent.preventDefault())+ : ("mouse" === t.originalEvent.pointerType ||+ (t.type === $s.POINTERDRAG && void 0 === this.downTimeout_)) &&+ this.handlePointerMove_(t))+ : t.type === $s.DBLCLICK && (i = !1),+ super.handleEvent(t) && i+ )+ }+ handleDownEvent(t) {+ return (+ (this.shouldHandle_ = !this.freehand_),+ this.freehand_+ ? ((this.downPx_ = t.pixel), this.finishCoordinate_ || this.startDrawing_(t.coordinate), !0)+ : this.condition_(t)+ ? ((this.lastDragTime_ = Date.now()),+ (this.downTimeout_ = setTimeout(() => {+ this.handlePointerMove_(new Vs($s.POINTERMOVE, t.map, t.originalEvent, !1, t.frameState))+ }, this.dragVertexDelay_)),+ (this.downPx_ = t.pixel),+ !0)+ : ((this.lastDragTime_ = void 0), !1)+ )+ }+ deactivateTrace_() {+ this.traceState_ = { active: !1 }+ }+ toggleTraceState_(t) {+ if (!this.traceSource_ || !this.traceCondition_(t)) return+ if (this.traceState_.active) return void this.deactivateTrace_()+ const e = this.getMap(),+ i = Bt([+ e.getCoordinateFromPixel([t.pixel[0] - this.snapTolerance_, t.pixel[1] + this.snapTolerance_]),+ e.getCoordinateFromPixel([t.pixel[0] + this.snapTolerance_, t.pixel[1] - this.snapTolerance_])+ ]),+ n = this.traceSource_.getFeaturesInExtent(i)+ if (0 === n.length) return+ const r = Qx(t.coordinate, n)+ r.length && (this.traceState_ = { active: !0, startCoord: t.coordinate.slice(), targets: r, targetIndex: -1 })+ }+ addOrRemoveTracedCoordinates_(t, e) {+ const i = t.startIndex <= t.endIndex+ i === t.startIndex <= e+ ? (i && e > t.endIndex) || (!i && e < t.endIndex)+ ? this.addTracedCoordinates_(t, t.endIndex, e)+ : ((i && e < t.endIndex) || (!i && e > t.endIndex)) && this.removeTracedCoordinates_(e, t.endIndex)+ : (this.removeTracedCoordinates_(t.startIndex, t.endIndex), this.addTracedCoordinates_(t, t.startIndex, e))+ }+ removeTracedCoordinates_(t, e) {+ if (t === e) return+ let i = 0+ if (t < e) {+ const n = Math.ceil(t)+ let r = Math.floor(e)+ r === e && (r -= 1), (i = r - n + 1)+ } else {+ const n = Math.floor(t)+ let r = Math.ceil(e)+ r === e && (r += 1), (i = n - r + 1)+ }+ i > 0 && this.removeLastPoints_(i)+ }+ addTracedCoordinates_(t, e, i) {+ if (e === i) return+ const n = []+ if (e < i) {+ const r = Math.ceil(e)+ let s = Math.floor(i)+ s === i && (s -= 1)+ for (let e = r; e <= s; ++e) n.push(Hx(t.coordinates, e))+ } else {+ const r = Math.floor(e)+ let s = Math.ceil(i)+ s === i && (s += 1)+ for (let e = r; e >= s; --e) n.push(Hx(t.coordinates, e))+ }+ n.length && this.appendCoordinates(n)+ }+ updateTrace_(t) {+ const e = this.traceState_+ if (!e.active) return+ if (-1 === e.targetIndex) {+ if (li(t.map.getPixelFromCoordinate(e.startCoord), t.pixel) < this.snapTolerance_) return+ }+ const i = Jx(t.coordinate, e, this.getMap(), this.snapTolerance_)+ if (e.targetIndex !== i.index) {+ if (-1 !== e.targetIndex) {+ const t = e.targets[e.targetIndex]+ this.removeTracedCoordinates_(t.startIndex, t.endIndex)+ }+ const t = e.targets[i.index]+ this.addTracedCoordinates_(t, t.startIndex, i.endIndex)+ } else {+ const t = e.targets[e.targetIndex]+ this.addOrRemoveTracedCoordinates_(t, i.endIndex)+ }+ e.targetIndex = i.index+ const n = e.targets[e.targetIndex]+ n.endIndex = i.endIndex+ const r = Kx(n.coordinates, n.endIndex),+ s = this.getMap().getPixelFromCoordinate(r)+ ;(t.coordinate = r), (t.pixel = [Math.round(s[0]), Math.round(s[1])])+ }+ handleDragEvent(t) {+ ;(this.ignoreNextUpEvent_ = !0), super.handleDragEvent(t)+ }+ handleUpEvent(t) {+ let e = !0+ if (0 === this.getPointerCount()) {+ this.downTimeout_ && (clearTimeout(this.downTimeout_), (this.downTimeout_ = void 0)),+ this.handlePointerMove_(t)+ const i = this.traceState_.active+ if ((this.ignoreNextUpEvent_ || this.toggleTraceState_(t), this.shouldHandle_)) {+ const n = !this.finishCoordinate_+ n && this.startDrawing_(t.coordinate),+ !n && this.freehand_+ ? this.finishDrawing()+ : this.freehand_ ||+ (n && "Point" !== this.mode_) ||+ (this.atFinish_(t.pixel, i)+ ? this.finishCondition_(t) && this.finishDrawing()+ : this.addToDrawing_(t.coordinate)),+ (e = !1)+ } else this.freehand_ && this.abortDrawing()+ }+ return (this.ignoreNextUpEvent_ = !1), !e && this.stopClick_ && t.preventDefault(), e+ }+ handlePointerMove_(t) {+ if (+ ((this.pointerType_ = t.originalEvent.pointerType),+ this.downPx_ && ((!this.freehand_ && this.shouldHandle_) || (this.freehand_ && !this.shouldHandle_)))+ ) {+ const e = this.downPx_,+ i = t.pixel,+ n = e[0] - i[0],+ r = e[1] - i[1],+ s = n * n + r * r+ if (+ ((this.shouldHandle_ = this.freehand_ ? s > this.squaredClickTolerance_ : s <= this.squaredClickTolerance_),+ !this.shouldHandle_)+ )+ return+ }+ this.finishCoordinate_+ ? (this.updateTrace_(t), this.modifyDrawing_(t.coordinate))+ : this.createOrUpdateSketchPoint_(t.coordinate.slice())+ }+ atFinish_(t, e) {+ let i = !1+ if (this.sketchFeature_) {+ let n = !1,+ r = [this.finishCoordinate_]+ const s = this.mode_+ if ("Point" === s) i = !0+ else if ("Circle" === s) i = 2 === this.sketchCoords_.length+ else if ("LineString" === s) n = !e && this.sketchCoords_.length > this.minPoints_+ else if ("Polygon" === s) {+ const t = this.sketchCoords_+ ;(n = t[0].length > this.minPoints_),+ (r = [t[0][0], t[0][t[0].length - 2]]),+ (r = e ? [t[0][0]] : [t[0][0], t[0][t[0].length - 2]])+ }+ if (n) {+ const e = this.getMap()+ for (let n = 0, s = r.length; n < s; n++) {+ const s = r[n],+ o = e.getPixelFromCoordinate(s),+ a = t[0] - o[0],+ l = t[1] - o[1],+ h = this.freehand_ ? 1 : this.snapTolerance_+ if (((i = Math.sqrt(a * a + l * l) <= h), i)) {+ this.finishCoordinate_ = s+ break+ }+ }+ }+ }+ return i+ }+ createOrUpdateSketchPoint_(t) {+ if (this.sketchPoint_) {+ this.sketchPoint_.getGeometry().setCoordinates(t)+ } else (this.sketchPoint_ = new At(new Wr(t))), this.updateSketchFeatures_()+ }+ createOrUpdateCustomSketchLine_(t) {+ this.sketchLine_ || (this.sketchLine_ = new At())+ const e = t.getLinearRing(0)+ let i = this.sketchLine_.getGeometry()+ i+ ? (i.setFlatCoordinates(e.getLayout(), e.getFlatCoordinates()), i.changed())+ : ((i = new Dd(e.getFlatCoordinates(), e.getLayout())), this.sketchLine_.setGeometry(i))+ }+ startDrawing_(t) {+ const e = this.getMap().getView().getProjection(),+ i = xr(this.geometryLayout_)+ for (; t.length < i; ) t.push(0)+ ;(this.finishCoordinate_ = t),+ "Point" === this.mode_+ ? (this.sketchCoords_ = t.slice())+ : "Polygon" === this.mode_+ ? ((this.sketchCoords_ = [[t.slice(), t.slice()]]), (this.sketchLineCoords_ = this.sketchCoords_[0]))+ : (this.sketchCoords_ = [t.slice(), t.slice()]),+ this.sketchLineCoords_ && (this.sketchLine_ = new At(new Dd(this.sketchLineCoords_)))+ const n = this.geometryFunction_(this.sketchCoords_, void 0, e)+ ;(this.sketchFeature_ = new At()),+ this.geometryName_ && this.sketchFeature_.setGeometryName(this.geometryName_),+ this.sketchFeature_.setGeometry(n),+ this.updateSketchFeatures_(),+ this.dispatchEvent(new hv(ov, this.sketchFeature_))+ }+ modifyDrawing_(t) {+ const e = this.getMap(),+ i = this.sketchFeature_.getGeometry(),+ n = e.getView().getProjection(),+ r = xr(this.geometryLayout_)+ let s, o+ for (; t.length < r; ) t.push(0)+ if (+ ("Point" === this.mode_+ ? (o = this.sketchCoords_)+ : "Polygon" === this.mode_+ ? ((s = this.sketchCoords_[0]),+ (o = s[s.length - 1]),+ this.atFinish_(e.getPixelFromCoordinate(t)) && (t = this.finishCoordinate_.slice()))+ : ((s = this.sketchCoords_), (o = s[s.length - 1])),+ (o[0] = t[0]),+ (o[1] = t[1]),+ this.geometryFunction_(this.sketchCoords_, i, n),+ this.sketchPoint_)+ ) {+ this.sketchPoint_.getGeometry().setCoordinates(t)+ }+ if ("Polygon" === i.getType() && "Polygon" !== this.mode_) this.createOrUpdateCustomSketchLine_(i)+ else if (this.sketchLineCoords_) {+ this.sketchLine_.getGeometry().setCoordinates(this.sketchLineCoords_)+ }+ this.updateSketchFeatures_()+ }+ addToDrawing_(t) {+ const e = this.sketchFeature_.getGeometry(),+ i = this.getMap().getView().getProjection()+ let n, r+ const s = this.mode_+ return (+ "LineString" === s || "Circle" === s+ ? ((this.finishCoordinate_ = t.slice()),+ (r = this.sketchCoords_),+ r.length >= this.maxPoints_ && (this.freehand_ ? r.pop() : (n = !0)),+ r.push(t.slice()),+ this.geometryFunction_(r, e, i))+ : "Polygon" === s &&+ ((r = this.sketchCoords_[0]),+ r.length >= this.maxPoints_ && (this.freehand_ ? r.pop() : (n = !0)),+ r.push(t.slice()),+ n && (this.finishCoordinate_ = r[0]),+ this.geometryFunction_(this.sketchCoords_, e, i)),+ this.createOrUpdateSketchPoint_(t.slice()),+ this.updateSketchFeatures_(),+ n ? this.finishDrawing() : this.sketchFeature_+ )+ }+ removeLastPoints_(t) {+ if (!this.sketchFeature_) return+ const e = this.sketchFeature_.getGeometry(),+ i = this.getMap().getView().getProjection(),+ n = this.mode_+ for (let r = 0; r < t; ++r) {+ let t+ if ("LineString" === n || "Circle" === n) {+ if (((t = this.sketchCoords_), t.splice(-2, 1), t.length >= 2)) {+ this.finishCoordinate_ = t[t.length - 2].slice()+ const e = this.finishCoordinate_.slice()+ ;(t[t.length - 1] = e), this.createOrUpdateSketchPoint_(e)+ }+ this.geometryFunction_(t, e, i),+ "Polygon" === e.getType() && this.sketchLine_ && this.createOrUpdateCustomSketchLine_(e)+ } else if ("Polygon" === n) {+ ;(t = this.sketchCoords_[0]), t.splice(-2, 1)+ const n = this.sketchLine_.getGeometry()+ if (t.length >= 2) {+ const e = t[t.length - 2].slice()+ ;(t[t.length - 1] = e), this.createOrUpdateSketchPoint_(e)+ }+ n.setCoordinates(t), this.geometryFunction_(this.sketchCoords_, e, i)+ }+ if (1 === t.length) {+ this.abortDrawing()+ break+ }+ }+ this.updateSketchFeatures_()+ }+ removeLastPoint() {+ this.removeLastPoints_(1)+ }+ finishDrawing() {+ const t = this.abortDrawing_()+ if (!t) return null+ let e = this.sketchCoords_+ const i = t.getGeometry(),+ n = this.getMap().getView().getProjection()+ return (+ "LineString" === this.mode_+ ? (e.pop(), this.geometryFunction_(e, i, n))+ : "Polygon" === this.mode_ && (e[0].pop(), this.geometryFunction_(e, i, n), (e = i.getCoordinates())),+ "MultiPoint" === this.type_+ ? t.setGeometry(new kd([e]))+ : "MultiLineString" === this.type_+ ? t.setGeometry(new Nd([e]))+ : "MultiPolygon" === this.type_ && t.setGeometry(new Gd([e])),+ this.dispatchEvent(new hv(av, t)),+ this.features_ && this.features_.push(t),+ this.source_ && this.source_.addFeature(t),+ t+ )+ }+ abortDrawing_() {+ this.finishCoordinate_ = null+ const t = this.sketchFeature_+ return (+ (this.sketchFeature_ = null),+ (this.sketchPoint_ = null),+ (this.sketchLine_ = null),+ this.overlay_.getSource().clear(!0),+ this.deactivateTrace_(),+ t+ )+ }+ abortDrawing() {+ const t = this.abortDrawing_()+ t && this.dispatchEvent(new hv(lv, t))+ }+ appendCoordinates(t) {+ const e = this.mode_,+ i = !this.sketchFeature_+ let n+ if ((i && this.startDrawing_(t[0]), "LineString" === e || "Circle" === e)) n = this.sketchCoords_+ else {+ if ("Polygon" !== e) return+ n = this.sketchCoords_ && this.sketchCoords_.length ? this.sketchCoords_[0] : []+ }+ i && n.shift(), n.pop()+ for (let e = 0; e < t.length; e++) this.addToDrawing_(t[e])+ const r = t[t.length - 1]+ ;(this.sketchFeature_ = this.addToDrawing_(r)), this.modifyDrawing_(r)+ }+ extend(t) {+ const e = t.getGeometry()+ ;(this.sketchFeature_ = t), (this.sketchCoords_ = e.getCoordinates())+ const i = this.sketchCoords_[this.sketchCoords_.length - 1]+ ;(this.finishCoordinate_ = i.slice()),+ this.sketchCoords_.push(i.slice()),+ (this.sketchPoint_ = new At(new Wr(i))),+ this.updateSketchFeatures_(),+ this.dispatchEvent(new hv(ov, this.sketchFeature_))+ }+ updateSketchFeatures_() {+ const t = []+ this.sketchFeature_ && t.push(this.sketchFeature_),+ this.sketchLine_ && t.push(this.sketchLine_),+ this.sketchPoint_ && t.push(this.sketchPoint_)+ const e = this.overlay_.getSource()+ e.clear(!0), e.addFeatures(t)+ }+ updateState_() {+ const t = this.getMap(),+ e = this.getActive()+ ;(t && e) || this.abortDrawing(), this.overlay_.setMap(e ? t : null)+ }+ }),+ (bP.interaction.Draw.DrawEvent = hv),+ (bP.interaction.Draw.createBox = function () {+ return function (t, e, i) {+ const n = Bt(+ [t[0], t[t.length - 1]].map(function (t) {+ return Un(t, i)+ })+ ),+ r = [[ce(n), ue(n), xe(n), ye(n), ce(n)]]+ e ? e.setCoordinates(r) : (e = new gs(r))+ const s = Gn()+ return s && e.transform(i, s), e+ }+ }),+ (bP.interaction.Draw.createRegularPolygon = function (t, e) {+ return function (i, n, r) {+ const s = Un(i[0], r),+ o = Un(i[i.length - 1], r),+ a = Math.sqrt(ai(s, o))+ n = n || _s(new Ld(s), t)+ let l = e+ if (!e && 0 !== e) {+ const t = o[0] - s[0],+ e = o[1] - s[1]+ l = Math.atan2(e, t)+ }+ ms(n, s, a, l)+ const h = Gn()+ return h && n.transform(r, h), n+ }+ }),+ (bP.interaction.Extent = class extends fa {+ constructor(t) {+ super((t = t || {})),+ this.on,+ this.once,+ this.un,+ (this.condition_ = t.condition ? t.condition : ra),+ (this.createCondition_ = t.createCondition || this.condition_),+ (this.drag_ = t.drag || !1),+ (this.extent_ = null),+ (this.pointerHandler_ = null),+ (this.pixelTolerance_ = void 0 !== t.pixelTolerance ? t.pixelTolerance : 10),+ (this.snappedToVertex_ = !1),+ (this.extentFeature_ = null),+ (this.vertexFeature_ = null),+ t || (t = {}),+ (this.extentOverlay_ = new Gx({+ source: new qd({ useSpatialIndex: !1, wrapX: !!t.wrapX }),+ style: t.boxStyle ? t.boxStyle : gv(),+ updateWhileAnimating: !0,+ updateWhileInteracting: !0+ })),+ (this.vertexOverlay_ = new Gx({+ source: new qd({ useSpatialIndex: !1, wrapX: !!t.wrapX }),+ style: t.pointerStyle ? t.pointerStyle : fv(),+ updateWhileAnimating: !0,+ updateWhileInteracting: !0+ })),+ t.extent && this.setExtent(t.extent)+ }+ snapToVertex_(t, e) {+ const i = e.getCoordinateFromPixelInternal(t),+ n = function (t, e) {+ return hi(i, t) - hi(i, e)+ },+ r = this.getExtentInternal()+ if (r) {+ const s = (function (t) {+ return [+ [+ [t[0], t[1]],+ [t[0], t[3]]+ ],+ [+ [t[0], t[3]],+ [t[2], t[3]]+ ],+ [+ [t[2], t[3]],+ [t[2], t[1]]+ ],+ [+ [t[2], t[1]],+ [t[0], t[1]]+ ]+ ]+ })(r)+ s.sort(n)+ const o = s[0]+ let a = ei(i, o)+ const l = e.getPixelFromCoordinateInternal(a)+ if (li(t, l) <= this.pixelTolerance_) {+ const t = e.getPixelFromCoordinateInternal(o[0]),+ i = e.getPixelFromCoordinateInternal(o[1]),+ n = ai(l, t),+ r = ai(l, i),+ s = Math.sqrt(Math.min(n, r))+ return (+ (this.snappedToVertex_ = s <= this.pixelTolerance_), this.snappedToVertex_ && (a = n > r ? o[1] : o[0]), a+ )+ }+ }+ return null+ }+ handlePointerMove_(t) {+ const e = t.pixel,+ i = t.map,+ n = this.drag_ && $t(this.extent_, t.coordinate)+ let r = this.snapToVertex_(e, i)+ return (+ r || !this.createCondition_(t) || n || (r = i.getCoordinateFromPixelInternal(e)),+ n && !r+ ? this.getMap().getViewport().classList.add("ol-grab")+ : this.getMap().getViewport().classList.remove("ol-grab"),+ r ? (this.updatePointerFeature_(r), !0) : (this.noVertexFeature_(), !1)+ )+ }+ createOrUpdateExtentFeature_(t) {+ let e = this.extentFeature_+ return (+ e+ ? t+ ? e.setGeometry(ps(t))+ : e.setGeometry(void 0)+ : ((e = new At(t ? ps(t) : {})), (this.extentFeature_ = e), this.extentOverlay_.getSource().addFeature(e)),+ e+ )+ }+ updatePointerFeature_(t, e = !0) {+ let i = this.vertexFeature_+ if (+ (e &&+ !i &&+ ((i = new At(new Wr(t))), (this.vertexFeature_ = i), this.vertexOverlay_.getSource().addFeature(i)),+ i)+ ) {+ i.getGeometry().setCoordinates(t)+ }+ return i+ }+ noVertexFeature_() {+ this.vertexFeature_ &&+ (this.vertexOverlay_.getSource().removeFeature(this.vertexFeature_), (this.vertexFeature_ = null))+ }+ handleEvent(t) {+ if (!t.originalEvent || !this.condition_(t)) return this.noVertexFeature_(), !0+ let e = this.handlingDownUpSequence+ return (+ t.type != $s.POINTERMOVE || this.handlingDownUpSequence || (e = this.handlePointerMove_(t)),+ super.handleEvent(t),+ !e+ )+ }+ handleDownEvent(t) {+ const e = t.pixel,+ i = t.map,+ n = this.getExtentInternal()+ let r = this.snapToVertex_(e, i)+ const s = function (t) {+ let e = null,+ i = null+ return (+ t[0] == n[0] ? (e = n[2]) : t[0] == n[2] && (e = n[0]),+ t[1] == n[1] ? (i = n[3]) : t[1] == n[3] && (i = n[1]),+ null !== e && null !== i ? [e, i] : null+ )+ }+ if (r && n) {+ const t = r[0] == n[0] || r[0] == n[2] ? r[0] : null,+ e = r[1] == n[1] || r[1] == n[3] ? r[1] : null+ null !== t && null !== e+ ? (this.pointerHandler_ = pv(s(r)))+ : null !== t+ ? (this.pointerHandler_ = _v(s([t, n[1]]), s([t, n[3]])))+ : null !== e && (this.pointerHandler_ = _v(s([n[0], e]), s([n[2], e])))+ } else {+ r = i.getCoordinateFromPixelInternal(e)+ let s = !1+ this.drag_ &&+ $t(n, r) &&+ ((this.pointerHandler_ = (function (t, e) {+ return function (i) {+ const n = i[0] - e[0],+ r = i[1] - e[1]+ return [t[0] + n, t[1] + r, t[2] + n, t[3] + r]+ }+ })(n, r)),+ (s = !0)),+ !s && this.createCondition_(t) && (this.setExtent([r[0], r[1], r[0], r[1]]), (this.pointerHandler_ = pv(r)))+ }+ return !!this.pointerHandler_+ }+ handleDragEvent(t) {+ if (this.pointerHandler_) {+ const e = t.coordinate+ this.setExtent(this.pointerHandler_(e)), this.updatePointerFeature_(e, !1)+ }+ }+ handleUpEvent(t) {+ this.pointerHandler_ = null+ const e = this.getExtentInternal()+ return (e && 0 !== he(e)) || this.setExtent(null), !1+ }+ setMap(t) {+ this.extentOverlay_.setMap(t), this.vertexOverlay_.setMap(t), super.setMap(t)+ }+ getExtent() {+ return Bn(this.getExtentInternal(), this.getMap().getView().getProjection())+ }+ getExtentInternal() {+ return this.extent_+ }+ setExtent(t) {+ ;(this.extent_ = t || null), this.createOrUpdateExtentFeature_(t), this.dispatchEvent(new dv(this.extent_))+ }+ }),+ (bP.interaction.Extent.ExtentEvent = dv),+ (bP.interaction.Interaction = Ho),+ (bP.interaction.Interaction.pan = Ko),+ (bP.interaction.Interaction.zoomByDelta = qo),+ (bP.interaction.KeyboardPan = Fa),+ (bP.interaction.KeyboardZoom = La),+ (bP.interaction.Link = class extends Ho {+ constructor(t) {+ let e+ super(),+ (e =+ !0 ===+ (t = Object.assign({ animate: !0, params: ["x", "y", "z", "r", "l"], replace: !1, prefix: "" }, t || {}))+ .animate+ ? { duration: 250 }+ : t.animate+ ? t.animate+ : null),+ (this.animationOptions_ = e),+ (this.params_ = t.params.reduce((t, e) => ((t[e] = !0), t), {})),+ (this.replace_ = t.replace),+ (this.prefix_ = t.prefix),+ (this.listenerKeys_ = []),+ (this.initial_ = !0),+ (this.updateState_ = this.updateState_.bind(this)),+ (this.trackedCallbacks_ = {}),+ (this.trackedValues_ = {})+ }+ getParamName_(t) {+ return this.prefix_ ? this.prefix_ + t : t+ }+ get_(t, e) {+ return t.get(this.getParamName_(e))+ }+ set_(t, e, i) {+ e in this.params_ && t.set(this.getParamName_(e), i)+ }+ delete_(t, e) {+ e in this.params_ && t.delete(this.getParamName_(e))+ }+ setMap(t) {+ const e = this.getMap()+ super.setMap(t),+ t !== e &&+ (e && this.unregisterListeners_(e),+ t && ((this.initial_ = !0), this.updateState_(), this.registerListeners_(t)))+ }+ registerListeners_(t) {+ this.listenerKeys_.push(+ D(t, Qs, this.updateUrl_, this),+ D(t.getLayerGroup(), n, this.updateUrl_, this),+ D(t, "change:layergroup", this.handleChangeLayerGroup_, this)+ ),+ this.replace_ || addEventListener("popstate", this.updateState_)+ }+ unregisterListeners_(t) {+ for (let t = 0, e = this.listenerKeys_.length; t < e; ++t) k(this.listenerKeys_[t])+ ;(this.listenerKeys_.length = 0), this.replace_ || removeEventListener("popstate", this.updateState_)+ const e = new URL(window.location.href),+ i = e.searchParams+ this.delete_(i, "x"),+ this.delete_(i, "y"),+ this.delete_(i, "z"),+ this.delete_(i, "r"),+ this.delete_(i, "l"),+ window.history.replaceState(null, "", e)+ }+ handleChangeLayerGroup_() {+ const t = this.getMap()+ t && (this.unregisterListeners_(t), this.registerListeners_(t), (this.initial_ = !0), this.updateUrl_())+ }+ updateState_() {+ const t = new URL(window.location.href).searchParams+ for (const e in this.trackedCallbacks_) {+ const i = t.get(e)+ e in this.trackedCallbacks_ &&+ i !== this.trackedValues_[e] &&+ ((this.trackedValues_[e] = i), this.trackedCallbacks_[e](i))+ }+ const e = this.getMap()+ if (!e) return+ const i = e.getView()+ if (!i || !i.isDef()) return+ let n = !1+ const r = {},+ s = mv(this.get_(t, "z"))+ "z" in this.params_ && xv(s, i.getZoom()) && ((n = !0), (r.zoom = s))+ const o = mv(this.get_(t, "r"))+ "r" in this.params_ && xv(o, i.getRotation()) && ((n = !0), (r.rotation = o))+ const a = [mv(this.get_(t, "x")), mv(this.get_(t, "y"))]+ var l, h+ ;("x" in this.params_ || "y" in this.params_) &&+ ((l = a), (h = i.getCenter()), xv(l[0], h[0]) || xv(l[1], h[1])) &&+ ((n = !0), (r.center = a)),+ n &&+ (!this.initial_ && this.animationOptions_+ ? i.animate(Object.assign(r, this.animationOptions_))+ : (r.center && i.setCenter(r.center),+ "zoom" in r && i.setZoom(r.zoom),+ "rotation" in r && i.setRotation(r.rotation)))+ const c = e.getAllLayers(),+ u = this.get_(t, "l")+ if ("l" in this.params_ && u && u.length === c.length)+ for (let t = 0, e = c.length; t < e; ++t) {+ const e = parseInt(u[t])+ if (!isNaN(e)) {+ const i = Boolean(e),+ n = c[t]+ n.getVisible() !== i && n.setVisible(i)+ }+ }+ }+ track(t, e) {+ this.trackedCallbacks_[t] = e+ const i = new URL(window.location.href).searchParams.get(t)+ return (this.trackedValues_[t] = i), i+ }+ update(t, e) {+ const i = new URL(window.location.href),+ n = i.searchParams+ null === e ? n.delete(t) : n.set(t, e),+ t in this.trackedValues_ && (this.trackedValues_[t] = e),+ this.updateHistory_(i)+ }+ updateUrl_() {+ const t = this.getMap()+ if (!t) return+ const e = t.getView()+ if (!e || !e.isDef()) return+ const i = e.getCenter(),+ n = e.getZoom(),+ r = e.getRotation(),+ s = t.getAllLayers(),+ o = new Array(s.length)+ for (let t = 0, e = s.length; t < e; ++t) o[t] = s[t].getVisible() ? "1" : "0"+ const a = new URL(window.location.href),+ l = a.searchParams+ this.set_(l, "x", yv(i[0])),+ this.set_(l, "y", yv(i[1])),+ this.set_(l, "z", yv(n)),+ this.set_(l, "r", yv(r)),+ this.set_(l, "l", o.join("")),+ this.updateHistory_(a),+ (this.initial_ = !1)+ }+ updateHistory_(t) {+ t.href !== window.location.href &&+ (this.initial_ || this.replace_+ ? window.history.replaceState(history.state, "", t)+ : window.history.pushState(null, "", t))+ }+ }),+ (bP.interaction.Modify = class extends fa {+ constructor(r) {+ if (+ (super(r),+ (this.handleSourceAdd_ = this.handleSourceAdd_.bind(this)),+ (this.handleSourceRemove_ = this.handleSourceRemove_.bind(this)),+ (this.handleExternalCollectionAdd_ = this.handleExternalCollectionAdd_.bind(this)),+ (this.handleExternalCollectionRemove_ = this.handleExternalCollectionRemove_.bind(this)),+ (this.handleFeatureChange_ = this.handleFeatureChange_.bind(this)),+ this.on,+ this.once,+ this.un,+ (this.condition_ = r.condition ? r.condition : ga),+ (this.defaultDeleteCondition_ = function (t) {+ return ta(t) && aa(t)+ }),+ (this.deleteCondition_ = r.deleteCondition ? r.deleteCondition : this.defaultDeleteCondition_),+ (this.insertVertexCondition_ = r.insertVertexCondition ? r.insertVertexCondition : ra),+ (this.vertexFeature_ = null),+ (this.vertexSegments_ = null),+ (this.lastCoordinate_ = [0, 0]),+ (this.ignoreNextSingleClick_ = !1),+ (this.featuresBeingModified_ = null),+ (this.rBush_ = new zd()),+ (this.pixelTolerance_ = void 0 !== r.pixelTolerance ? r.pixelTolerance : 10),+ (this.snappedToVertex_ = !1),+ (this.changingFeature_ = !1),+ (this.dragSegments_ = []),+ (this.overlay_ = new Gx({+ source: new qd({ useSpatialIndex: !1, wrapX: !!r.wrapX }),+ style: r.style ? r.style : Iv(),+ updateWhileAnimating: !0,+ updateWhileInteracting: !0+ })),+ (this.SEGMENT_WRITERS_ = {+ Point: this.writePointGeometry_.bind(this),+ LineString: this.writeLineStringGeometry_.bind(this),+ LinearRing: this.writeLineStringGeometry_.bind(this),+ Polygon: this.writePolygonGeometry_.bind(this),+ MultiPoint: this.writeMultiPointGeometry_.bind(this),+ MultiLineString: this.writeMultiLineStringGeometry_.bind(this),+ MultiPolygon: this.writeMultiPolygonGeometry_.bind(this),+ Circle: this.writeCircleGeometry_.bind(this),+ GeometryCollection: this.writeGeometryCollectionGeometry_.bind(this)+ }),+ (this.source_ = null),+ (this.traceSource_ = r.traceSource || r.source || null),+ this.traceCondition_,+ this.setTrace(r.trace || !1),+ (this.traceState_ = { active: !1 }),+ (this.traceSegments_ = null),+ (this.hitDetection_ = null),+ (this.filterFunctionWasSupplied_ = null != r.filter),+ (this.filter_ = r.filter ? r.filter : () => !0),+ !r.features && !r.source)+ )+ throw new Error("The modify interaction requires features collection or a source")+ let s+ r.features+ ? ((s = r.features.getArray()),+ r.features.addEventListener(t, this.handleExternalCollectionAdd_),+ r.features.addEventListener(e, this.handleExternalCollectionRemove_),+ (this.featuresCollection_ = r.features))+ : r.source &&+ ((s = r.source.getFeatures()),+ r.source.addEventListener(Xd, this.handleSourceAdd_),+ r.source.addEventListener(Wd, this.handleSourceRemove_),+ (this.source_ = r.source)),+ s.forEach((t) => {+ t.addEventListener(n, this.handleFeatureChange_),+ this.filterFunctionWasSupplied_ && t.addEventListener(i, this.handleFeatureChange_)+ }),+ r.hitDetection && (this.hitDetection_ = r.hitDetection),+ (this.features_ = []),+ s.filter(this.filter_).forEach((t) => this.addFeature_(t)),+ (this.lastPointerEvent_ = null),+ (this.delta_ = [0, 0]),+ (this.snapToPointer_ = void 0 === r.snapToPointer ? !this.hitDetection_ : r.snapToPointer)+ }+ setTrace(t) {+ let e+ ;(e = t ? (!0 === t ? ra : t) : oa), (this.traceCondition_ = e)+ }+ addFeature_(t) {+ this.features_.push(t)+ const e = t.getGeometry()+ if (e) {+ const i = this.SEGMENT_WRITERS_[e.getType()]+ i && i(t, e)+ }+ const i = this.getMap()+ i && i.isRendered() && this.getActive() && this.handlePointerAtPixel_(this.lastCoordinate_)+ }+ willModifyFeatures_(t, e) {+ if (!this.featuresBeingModified_) {+ this.featuresBeingModified_ = new Z()+ const i = this.featuresBeingModified_.getArray()+ for (let t = 0, n = e.length; t < n; ++t) {+ const n = e[t].feature+ n && !i.includes(n) && this.featuresBeingModified_.push(n)+ }+ 0 === this.featuresBeingModified_.getLength()+ ? (this.featuresBeingModified_ = null)+ : this.dispatchEvent(new Cv(Ev, this.featuresBeingModified_, t))+ }+ }+ removeFeature_(t) {+ const e = this.features_.indexOf(t)+ this.features_.splice(e, 1),+ this.removeFeatureSegmentData_(t),+ this.vertexFeature_ &&+ 0 === this.features_.length &&+ (this.overlay_.getSource().removeFeature(this.vertexFeature_), (this.vertexFeature_ = null))+ }+ removeFeatureSegmentData_(t) {+ const e = this.rBush_,+ i = []+ e.forEach(function (e) {+ t === e.feature && i.push(e)+ })+ for (let t = i.length - 1; t >= 0; --t) {+ const n = i[t]+ for (let t = this.dragSegments_.length - 1; t >= 0; --t)+ this.dragSegments_[t][0] === n && this.dragSegments_.splice(t, 1)+ e.remove(n)+ }+ }+ setActive(t) {+ this.vertexFeature_ &&+ !t &&+ (this.overlay_.getSource().removeFeature(this.vertexFeature_), (this.vertexFeature_ = null)),+ super.setActive(t)+ }+ setMap(t) {+ this.overlay_.setMap(t), super.setMap(t)+ }+ getOverlay() {+ return this.overlay_+ }+ handleSourceAdd_(t) {+ const e = t.feature+ e && this.externalAddFeatureHandler_(e)+ }+ handleSourceRemove_(t) {+ const e = t.feature+ e && this.externalRemoveFeatureHandler_(e)+ }+ handleExternalCollectionAdd_(t) {+ const e = t.element+ e && this.externalAddFeatureHandler_(e)+ }+ handleExternalCollectionRemove_(t) {+ const e = t.element+ e && this.externalRemoveFeatureHandler_(e)+ }+ externalAddFeatureHandler_(t) {+ t.addEventListener(n, this.handleFeatureChange_),+ this.filterFunctionWasSupplied_ && t.addEventListener(i, this.handleFeatureChange_),+ this.filter_(t) && this.addFeature_(t)+ }+ externalRemoveFeatureHandler_(t) {+ t.removeEventListener(n, this.handleFeatureChange_),+ this.filterFunctionWasSupplied_ && t.removeEventListener(i, this.handleFeatureChange_),+ this.removeFeature_(t)+ }+ handleFeatureChange_(t) {+ if (!this.changingFeature_) {+ const e = t.target+ this.removeFeature_(e), this.filter_(e) && this.addFeature_(e)+ }+ }+ writePointGeometry_(t, e) {+ const i = e.getCoordinates(),+ n = { feature: t, geometry: e, segment: [i, i] }+ this.rBush_.insert(e.getExtent(), n)+ }+ writeMultiPointGeometry_(t, e) {+ const i = e.getCoordinates()+ for (let n = 0, r = i.length; n < r; ++n) {+ const r = i[n],+ s = { feature: t, geometry: e, depth: [n], index: n, segment: [r, r] }+ this.rBush_.insert(e.getExtent(), s)+ }+ }+ writeLineStringGeometry_(t, e) {+ const i = e.getCoordinates()+ for (let n = 0, r = i.length - 1; n < r; ++n) {+ const r = i.slice(n, n + 2),+ s = { feature: t, geometry: e, index: n, segment: r }+ this.rBush_.insert(Bt(r), s)+ }+ }+ writeMultiLineStringGeometry_(t, e) {+ const i = e.getCoordinates()+ for (let n = 0, r = i.length; n < r; ++n) {+ const r = i[n]+ for (let i = 0, s = r.length - 1; i < s; ++i) {+ const s = r.slice(i, i + 2),+ o = { feature: t, geometry: e, depth: [n], index: i, segment: s }+ this.rBush_.insert(Bt(s), o)+ }+ }+ }+ writePolygonGeometry_(t, e) {+ const i = e.getCoordinates()+ for (let n = 0, r = i.length; n < r; ++n) {+ const r = i[n]+ for (let i = 0, s = r.length - 1; i < s; ++i) {+ const s = r.slice(i, i + 2),+ o = { feature: t, geometry: e, depth: [n], index: i, segment: s }+ this.rBush_.insert(Bt(s), o)+ }+ }+ }+ writeMultiPolygonGeometry_(t, e) {+ const i = e.getCoordinates()+ for (let n = 0, r = i.length; n < r; ++n) {+ const r = i[n]+ for (let i = 0, s = r.length; i < s; ++i) {+ const s = r[i]+ for (let r = 0, o = s.length - 1; r < o; ++r) {+ const o = s.slice(r, r + 2),+ a = { feature: t, geometry: e, depth: [i, n], index: r, segment: o }+ this.rBush_.insert(Bt(o), a)+ }+ }+ }+ }+ writeCircleGeometry_(t, e) {+ const i = e.getCenter(),+ n = { feature: t, geometry: e, index: 0, segment: [i, i] },+ r = { feature: t, geometry: e, index: 1, segment: [i, i] },+ s = [n, r]+ ;(n.featureSegments = s), (r.featureSegments = s), this.rBush_.insert(Jt(i), n)+ let o = e+ const a = Gn()+ if (a && this.getMap()) {+ const t = this.getMap().getView().getProjection()+ ;(o = o.clone().transform(a, t)), (o = _s(o).transform(t, a))+ }+ this.rBush_.insert(o.getExtent(), r)+ }+ writeGeometryCollectionGeometry_(t, e) {+ const i = e.getGeometriesArray()+ for (let e = 0; e < i.length; ++e) {+ const n = i[e]+ ;(0, this.SEGMENT_WRITERS_[n.getType()])(t, n)+ }+ }+ createOrUpdateVertexFeature_(t, e, i, n) {+ let r = this.vertexFeature_+ if (r) {+ r.getGeometry().setCoordinates(t)+ } else (r = new At(new Wr(t))), (this.vertexFeature_ = r), this.overlay_.getSource().addFeature(r)+ return r.set("features", e), r.set("geometries", i), r.set("existing", n), r+ }+ handleEvent(t) {+ if (!t.originalEvent) return !0+ let e+ return (+ (this.lastPointerEvent_ = t),+ t.map.getView().getInteracting() ||+ t.type != $s.POINTERMOVE ||+ this.handlingDownUpSequence ||+ this.handlePointerMove_(t),+ this.vertexFeature_ &&+ this.deleteCondition_(t) &&+ (e = !(t.type != $s.SINGLECLICK || !this.ignoreNextSingleClick_) || this.removePoint()),+ t.type == $s.SINGLECLICK && (this.ignoreNextSingleClick_ = !1),+ super.handleEvent(t) && !e+ )+ }+ findInsertVerticesAndUpdateDragSegments_(t) {+ this.handlePointerAtPixel_(t), (this.dragSegments_.length = 0), (this.featuresBeingModified_ = null)+ if (!this.vertexFeature_) return+ const e = this.getMap().getView().getProjection(),+ i = [],+ n = this.vertexFeature_.getGeometry().getCoordinates(),+ r = Bt([n]),+ s = this.rBush_.getInExtent(r),+ o = {}+ s.sort(bv)+ for (let r = 0, a = s.length; r < a; ++r) {+ const a = s[r],+ l = a.segment+ let h = z(a.geometry)+ const c = a.depth+ if (+ (c && (h += "-" + c.join("-")),+ o[h] || (o[h] = new Array(2)),+ "Circle" !== a.geometry.getType() || 1 !== a.index)+ )+ if (!ri(l[0], n) || o[h][0])+ if (!ri(l[1], n) || o[h][1]) !(z(l) in this.vertexSegments_) || o[h][0] || o[h][1] || i.push(a)+ else {+ if (o[h][0] && 0 === o[h][0].index) {+ let t = a.geometry.getCoordinates()+ switch (a.geometry.getType()) {+ case "LineString":+ case "MultiLineString":+ continue+ case "MultiPolygon":+ t = t[c[1]]+ case "Polygon":+ if (a.index !== t[c[0]].length - 2) continue+ }+ }+ this.dragSegments_.push([a, 1]), (o[h][1] = a)+ }+ else this.dragSegments_.push([a, 0]), (o[h][0] = a)+ else {+ ri(Pv(t, a, e), n) && !o[h][0] && (this.dragSegments_.push([a, 0]), (o[h][0] = a))+ }+ }+ return i+ }+ deactivateTrace_() {+ this.traceState_ = { active: !1 }+ }+ updateTrace_(t) {+ const e = this.traceState_+ if (!e.active) return+ if (-1 === e.targetIndex) {+ if (li(t.map.getPixelFromCoordinate(e.startCoord), t.pixel) < this.pixelTolerance_) return+ }+ const i = Jx(t.coordinate, e, t.map, this.pixelTolerance_)+ if (+ -1 === e.targetIndex &&+ Math.sqrt(i.closestTargetDistance) / t.map.getView().getResolution() > this.pixelTolerance_+ )+ return+ if (e.targetIndex !== i.index) {+ if (-1 !== e.targetIndex) {+ const t = e.targets[e.targetIndex]+ this.removeTracedCoordinates_(t.startIndex, t.endIndex)+ } else+ for (const t of this.traceSegments_) {+ const e = t[0],+ i = e.geometry,+ n = t[1],+ r = i.getCoordinates()+ Tv(r, i.getType(), e.depth).splice(e.index + n, 1), i.setCoordinates(r), 0 === n && (e.index -= 1)+ }+ const t = e.targets[i.index]+ this.addTracedCoordinates_(t, t.startIndex, i.endIndex)+ } else {+ const t = e.targets[e.targetIndex]+ this.addOrRemoveTracedCoordinates_(t, i.endIndex)+ }+ e.targetIndex = i.index+ e.targets[e.targetIndex].endIndex = i.endIndex+ }+ getTraceCandidates_(t) {+ const e = this.getMap(),+ i = this.pixelTolerance_,+ n = Bt([+ e.getCoordinateFromPixel([t.pixel[0] - i, t.pixel[1] + i]),+ e.getCoordinateFromPixel([t.pixel[0] + i, t.pixel[1] - i])+ ])+ return this.traceSource_.getFeaturesInExtent(n)+ }+ toggleTraceState_(t) {+ if (!this.traceSource_ || !this.traceCondition_(t)) return+ if (this.traceState_.active) return this.deactivateTrace_(), void (this.traceSegments_ = null)+ const e = this.getTraceCandidates_(t)+ if (0 === e.length) return+ const i = Qx(t.coordinate, e)+ i.length && (this.traceState_ = { active: !0, startCoord: t.coordinate.slice(), targets: i, targetIndex: -1 })+ }+ addOrRemoveTracedCoordinates_(t, e) {+ const i = t.startIndex <= t.endIndex+ i === t.startIndex <= e+ ? (i && e > t.endIndex) || (!i && e < t.endIndex)+ ? this.addTracedCoordinates_(t, t.endIndex, e)+ : ((i && e < t.endIndex) || (!i && e > t.endIndex)) && this.removeTracedCoordinates_(e, t.endIndex)+ : (this.removeTracedCoordinates_(t.startIndex, t.endIndex), this.addTracedCoordinates_(t, t.startIndex, e))+ }+ removeTracedCoordinates_(t, e) {+ if (t === e) return+ let i = 0+ if (t < e) {+ const n = Math.ceil(t)+ let r = Math.floor(e)+ r === e && (r -= 1), (i = r - n + 1)+ } else {+ const n = Math.floor(t)+ let r = Math.ceil(e)+ r === e && (r += 1), (i = n - r + 1)+ }+ if (i > 0)+ for (const t of this.traceSegments_) {+ const e = t[0],+ n = e.geometry,+ r = t[1]+ let s = t[0].index + 1+ 1 === r && (s -= i)+ const o = n.getCoordinates()+ Tv(o, n.getType(), e.depth).splice(s, i), n.setCoordinates(o), 1 === r && (e.index -= i)+ }+ }+ addTracedCoordinates_(t, e, i) {+ if (e === i) return+ const n = []+ if (e < i) {+ const r = Math.ceil(e)+ let s = Math.floor(i)+ s === i && (s -= 1)+ for (let e = r; e <= s; ++e) n.push(Hx(t.coordinates, e))+ } else {+ const r = Math.floor(e)+ let s = Math.ceil(i)+ s === i && (s += 1)+ for (let e = r; e >= s; --e) n.push(Hx(t.coordinates, e))+ }+ if (n.length)+ for (const t of this.traceSegments_) {+ const e = t[0],+ i = e.geometry,+ r = t[1],+ s = e.index + 1+ 0 === r && n.reverse()+ const o = i.getCoordinates()+ Tv(o, i.getType(), e.depth).splice(s, 0, ...n), i.setCoordinates(o), 1 === r && (e.index += n.length)+ }+ }+ updateGeometry_(t, e) {+ const i = e[0],+ n = i.depth+ let r+ const s = i.segment,+ o = i.geometry,+ a = e[1]+ for (; t.length < o.getStride(); ) t.push(s[a][t.length])+ switch (o.getType()) {+ case "Point":+ ;(r = t), (s[0] = t), (s[1] = t)+ break+ case "MultiPoint":+ ;(r = o.getCoordinates()), (r[i.index] = t), (s[0] = t), (s[1] = t)+ break+ case "LineString":+ ;(r = o.getCoordinates()), (r[i.index + a] = t), (s[a] = t)+ break+ case "MultiLineString":+ ;(r = o.getCoordinates()), (r[n[0]][i.index + a] = t), (s[a] = t)+ break+ case "Polygon": {+ r = o.getCoordinates()+ const e = r[n[0]],+ l = i.index + a+ e[l][0] === t[0] && e[l][1] === t[1]+ ? (r = null)+ : ((e[l] = t), 0 === l ? (e[e.length - 1] = t) : l === e.length - 1 && (e[0] = t)),+ (s[a] = t)+ break+ }+ case "MultiPolygon": {+ r = o.getCoordinates()+ const e = r[n[1]][n[0]],+ l = i.index + a+ e[l][0] === t[0] && e[l][1] === t[1]+ ? (r = null)+ : ((e[l] = t), 0 === l ? (e[e.length - 1] = t) : l === e.length - 1 && (e[0] = t)),+ (s[a] = t)+ break+ }+ case "Circle":+ const e = o+ if (((s[0] = t), (s[1] = t), 0 === i.index))+ (this.changingFeature_ = !0), e.setCenter(t), (this.changingFeature_ = !1)+ else {+ this.changingFeature_ = !0+ const i = this.getMap().getView().getProjection()+ let n = li(Un(e.getCenter(), i), Un(t, i))+ const r = Gn()+ if (r) {+ const t = e.clone().transform(r, i)+ t.setRadius(n), (n = t.transform(i, r).getRadius())+ }+ e.setRadius(n), (this.changingFeature_ = !1)+ }+ }+ r && this.setGeometryCoordinates_(o, r)+ }+ handleDragEvent(t) {+ ;(this.ignoreNextSingleClick_ = !1),+ this.willModifyFeatures_(+ t,+ this.dragSegments_.map(([t]) => t)+ )+ const e = [t.coordinate[0] + this.delta_[0], t.coordinate[1] + this.delta_[1]],+ i = [],+ n = [],+ r = this.traceState_.active && !this.traceSegments_ ? this.traceState_.startCoord : null+ if (r) {+ this.traceSegments_ = []+ for (const e of this.dragSegments_) {+ li(ei(r, e[0].segment), r) / t.map.getView().getResolution() < 1 && this.traceSegments_.push(e)+ }+ }+ for (let t = 0, r = this.dragSegments_.length; t < r; ++t) {+ const r = this.dragSegments_[t],+ s = r[0],+ o = s.feature+ i.includes(o) || i.push(o)+ const a = s.geometry+ n.includes(a) || n.push(a), this.updateGeometry_(e, r)+ }+ this.updateTrace_(t), this.createOrUpdateVertexFeature_(e, i, n, !0)+ }+ handleDownEvent(t) {+ if (!this.condition_(t)) return !1+ const e = t.coordinate,+ i = this.findInsertVerticesAndUpdateDragSegments_(e)+ if (i?.length && this.insertVertexCondition_(t) && (this.willModifyFeatures_(t, i), this.vertexFeature_)) {+ const t = this.vertexFeature_.getGeometry().getCoordinates()+ for (let e = i.length - 1; e >= 0; --e) this.insertVertex_(i[e], t)+ this.ignoreNextSingleClick_ = !0+ }+ return !!this.vertexFeature_+ }+ handleUpEvent(t) {+ for (let e = this.dragSegments_.length - 1; e >= 0; --e) {+ const i = this.dragSegments_[e][0],+ n = i.geometry+ if ("Circle" === n.getType()) {+ const e = n,+ r = e.getCenter(),+ s = i.featureSegments[0],+ o = i.featureSegments[1]+ ;(s.segment[0] = r),+ (s.segment[1] = r),+ (o.segment[0] = r),+ (o.segment[1] = r),+ this.rBush_.update(Jt(r), s)+ let a = e+ const l = Gn()+ if (l) {+ const e = t.map.getView().getProjection()+ ;(a = a.clone().transform(l, e)), (a = _s(a).transform(e, l))+ }+ this.rBush_.update(a.getExtent(), o)+ } else this.rBush_.update(Bt(i.segment), i)+ }+ return (+ this.featuresBeingModified_ &&+ (this.toggleTraceState_(t),+ this.dispatchEvent(new Cv(wv, this.featuresBeingModified_, t)),+ (this.featuresBeingModified_ = null)),+ !1+ )+ }+ handlePointerMove_(t) {+ ;(this.lastCoordinate_ = t.coordinate), this.handlePointerAtPixel_(this.lastCoordinate_)+ }+ handlePointerAtPixel_(t) {+ const e = this.getMap(),+ i = e.getPixelFromCoordinate(t),+ n = e.getView().getProjection(),+ r = function (e, i) {+ return Rv(t, e, n) - Rv(t, i, n)+ }+ let s, o+ if (this.hitDetection_) {+ const t = "object" == typeof this.hitDetection_ ? (t) => t === this.hitDetection_ : void 0+ e.forEachFeatureAtPixel(+ i,+ (t, e, i) => {+ i && "Point" === i.getType() && (i = new Wr(jn(i.getCoordinates(), n)))+ const r = i || t.getGeometry()+ if (r && "Point" === r.getType() && t instanceof At && this.features_.includes(t)) {+ o = r+ const e = t.getGeometry().getFlatCoordinates().slice(0, 2)+ s = [{ feature: t, geometry: o, segment: [e, e] }]+ }+ return !0+ },+ { layerFilter: t }+ )+ }+ if (!s) {+ const i = Bn(zt(zn(Jt(t, vv), n), e.getView().getResolution() * this.pixelTolerance_, vv), n)+ s = this.rBush_.getInExtent(i)+ }+ if (s && s.length > 0) {+ const a = s.sort(r)[0],+ l = a.segment+ let h = Pv(t, a, n)+ const c = e.getPixelFromCoordinate(h)+ let u = li(i, c)+ if (o || u <= this.pixelTolerance_) {+ const i = {}+ if (+ ((i[z(l)] = !0),+ this.snapToPointer_ || ((this.delta_[0] = h[0] - t[0]), (this.delta_[1] = h[1] - t[1])),+ "Circle" === a.geometry.getType() && 1 === a.index)+ )+ (this.snappedToVertex_ = !0),+ this.createOrUpdateVertexFeature_(h, [a.feature], [a.geometry], this.snappedToVertex_)+ else {+ const t = e.getPixelFromCoordinate(l[0]),+ n = e.getPixelFromCoordinate(l[1]),+ r = ai(c, t),+ o = ai(c, n)+ if (+ ((u = Math.sqrt(Math.min(r, o))),+ (this.snappedToVertex_ = u <= this.pixelTolerance_),+ !this.snappedToVertex_ && !this.insertVertexCondition_(this.lastPointerEvent_))+ )+ return void (+ this.vertexFeature_ &&+ (this.overlay_.getSource().removeFeature(this.vertexFeature_), (this.vertexFeature_ = null))+ )+ this.snappedToVertex_ && (h = r > o ? l[1] : l[0]),+ this.createOrUpdateVertexFeature_(h, [a.feature], [a.geometry], this.snappedToVertex_)+ const d = {}+ d[z(a.geometry)] = !0+ for (let t = 1, e = s.length; t < e; ++t) {+ const e = s[t].segment+ if (!((ri(l[0], e[0]) && ri(l[1], e[1])) || (ri(l[0], e[1]) && ri(l[1], e[0])))) break+ {+ const n = z(s[t].geometry)+ n in d || ((d[n] = !0), (i[z(e)] = !0))+ }+ }+ }+ return void (this.vertexSegments_ = i)+ }+ }+ this.vertexFeature_ &&+ (this.overlay_.getSource().removeFeature(this.vertexFeature_), (this.vertexFeature_ = null))+ }+ insertVertex_(t, e) {+ const i = t.segment,+ n = t.feature,+ r = t.geometry,+ s = t.depth,+ o = t.index+ let a+ for (; e.length < r.getStride(); ) e.push(0)+ switch (r.getType()) {+ case "MultiLineString":+ case "Polygon":+ ;(a = r.getCoordinates()), a[s[0]].splice(o + 1, 0, e)+ break+ case "MultiPolygon":+ ;(a = r.getCoordinates()), a[s[1]][s[0]].splice(o + 1, 0, e)+ break+ case "LineString":+ ;(a = r.getCoordinates()), a.splice(o + 1, 0, e)+ break+ default:+ return !1+ }+ this.setGeometryCoordinates_(r, a)+ const l = this.rBush_+ l.remove(t), this.updateSegmentIndices_(r, o, s, 1)+ const h = { segment: [i[0], e], feature: n, geometry: r, depth: s, index: o }+ l.insert(Bt(h.segment), h), this.dragSegments_.push([h, 1])+ const c = { segment: [e, i[1]], feature: n, geometry: r, depth: s, index: o + 1 }+ return l.insert(Bt(c.segment), c), this.dragSegments_.push([c, 0]), !0+ }+ updatePointer_(t) {+ return (+ t && this.findInsertVerticesAndUpdateDragSegments_(t), this.vertexFeature_?.getGeometry().getCoordinates()+ )+ }+ getPoint() {+ const t = this.vertexFeature_?.getGeometry().getCoordinates()+ return t ? jn(t, this.getMap().getView().getProjection()) : null+ }+ canRemovePoint() {+ if (!this.vertexFeature_) return !1+ if (+ this.vertexFeature_.get("geometries").every((t) => "Circle" === t.getType() || t.getType().endsWith("Point"))+ )+ return !1+ const t = this.vertexFeature_.getGeometry().getCoordinates()+ return this.rBush_.getInExtent(Bt([t])).some(({ segment: e }) => ri(e[0], t) || ri(e[1], t))+ }+ removePoint(t) {+ if (+ (t && ((t = Un(t, this.getMap().getView().getProjection())), this.updatePointer_(t)),+ !this.lastPointerEvent_ || (this.lastPointerEvent_ && this.lastPointerEvent_.type != $s.POINTERDRAG))+ ) {+ const t = this.lastPointerEvent_+ this.willModifyFeatures_(+ t,+ this.dragSegments_.map(([t]) => t)+ )+ const e = this.removeVertex_()+ return (+ this.featuresBeingModified_ && this.dispatchEvent(new Cv(wv, this.featuresBeingModified_, t)),+ (this.featuresBeingModified_ = null),+ e+ )+ }+ return !1+ }+ removeVertex_() {+ const t = this.dragSegments_,+ e = {}+ let i,+ n,+ r,+ s,+ o,+ a,+ l,+ h,+ c,+ u,+ d,+ g = !1+ for (o = t.length - 1; o >= 0; --o)+ (r = t[o]),+ (u = r[0]),+ (d = z(u.feature)),+ u.depth && (d += "-" + u.depth.join("-")),+ d in e || (e[d] = {}),+ 0 === r[1]+ ? ((e[d].right = u), (e[d].index = u.index))+ : 1 == r[1] && ((e[d].left = u), (e[d].index = u.index + 1))+ for (d in e) {+ switch (+ ((c = e[d].right),+ (l = e[d].left),+ (a = e[d].index),+ (h = a - 1),+ (u = void 0 !== l ? l : c),+ h < 0 && (h = 0),+ (s = u.geometry),+ (n = s.getCoordinates()),+ (i = n),+ (g = !1),+ s.getType())+ ) {+ case "MultiLineString":+ n[u.depth[0]].length > 2 && (n[u.depth[0]].splice(a, 1), (g = !0))+ break+ case "LineString":+ n.length > 2 && (n.splice(a, 1), (g = !0))+ break+ case "MultiPolygon":+ i = i[u.depth[1]]+ case "Polygon":+ ;(i = i[u.depth[0]]),+ i.length > 4 &&+ (a == i.length - 1 && (a = 0),+ i.splice(a, 1),+ (g = !0),+ 0 === a && (i.pop(), i.push(i[0]), (h = i.length - 1)))+ }+ if (g) {+ this.setGeometryCoordinates_(s, n)+ const e = []+ if (+ (void 0 !== l && (this.rBush_.remove(l), e.push(l.segment[0])),+ void 0 !== c && (this.rBush_.remove(c), e.push(c.segment[1])),+ void 0 !== l && void 0 !== c)+ ) {+ const t = { depth: u.depth, feature: u.feature, geometry: u.geometry, index: h, segment: e }+ this.rBush_.insert(Bt(t.segment), t)+ }+ this.updateSegmentIndices_(s, a, u.depth, -1),+ this.vertexFeature_ &&+ (this.overlay_.getSource().removeFeature(this.vertexFeature_), (this.vertexFeature_ = null)),+ (t.length = 0)+ }+ }+ return g+ }+ canInsertPoint() {+ if (!this.vertexFeature_) return !1+ if (+ this.vertexFeature_.get("geometries").every((t) => "Circle" === t.getType() || t.getType().endsWith("Point"))+ )+ return !1+ const t = this.vertexFeature_.getGeometry().getCoordinates()+ return this.rBush_.getInExtent(Bt([t])).some(({ segment: e }) => !(ri(e[0], t) || ri(e[1], t)))+ }+ insertPoint(t) {+ const e = t+ ? Un(t, this.getMap().getView().getProjection())+ : this.vertexFeature_?.getGeometry().getCoordinates()+ if (!e) return !1+ return this.findInsertVerticesAndUpdateDragSegments_(e).reduce((t, i) => t || this.insertVertex_(i, e), !1)+ }+ setGeometryCoordinates_(t, e) {+ ;(this.changingFeature_ = !0), t.setCoordinates(e), (this.changingFeature_ = !1)+ }+ updateSegmentIndices_(t, e, i, n) {+ this.rBush_.forEachInExtent(t.getExtent(), function (r) {+ r.geometry === t && (void 0 === i || void 0 === r.depth || w(r.depth, i)) && r.index > e && (r.index += n)+ })+ }+ disposeInternal() {+ if ((super.disposeInternal(), this.featuresCollection_)) {+ this.featuresCollection_.removeEventListener(t, this.handleExternalCollectionAdd_),+ this.featuresCollection_.removeEventListener(e, this.handleExternalCollectionRemove_)+ for (const t of this.featuresCollection_.getArray())+ t.removeEventListener(n, this.handleFeatureChange_),+ this.filterFunctionWasSupplied_ && t.removeEventListener(i, this.handleFeatureChange_)+ } else if (this.source_) {+ this.source_.removeEventListener(Xd, this.handleSourceAdd_),+ this.source_.removeEventListener(Wd, this.handleSourceRemove_)+ for (const t of this.source_.getFeatures())+ t.removeEventListener(n, this.handleFeatureChange_),+ this.filterFunctionWasSupplied_ && t.removeEventListener(i, this.handleFeatureChange_)+ }+ }+ }),+ (bP.interaction.Modify.ModifyEvent = Cv),+ (bP.interaction.MouseWheelZoom = Ma),+ (bP.interaction.PinchRotate = Aa),+ (bP.interaction.PinchZoom = Oa),+ (bP.interaction.Pointer = fa),+ (bP.interaction.Pointer.centroid = pa),+ (bP.interaction.Select = Av),+ (bP.interaction.Select.SelectEvent = Lv),+ (bP.interaction.Snap = class extends fa {+ constructor(t) {+ ;(t = t || {}),+ super({ handleDownEvent: C, stopDown: b }),+ this.on,+ this.once,+ this.un,+ (this.source_ = t.source ? t.source : null),+ (this.vertex_ = void 0 === t.vertex || t.vertex),+ (this.edge_ = void 0 === t.edge || t.edge),+ (this.intersection_ = void 0 !== t.intersection && t.intersection),+ (this.features_ = t.features ? t.features : null),+ (this.featuresListenerKeys_ = []),+ (this.featureChangeListenerKeys_ = {}),+ (this.indexedFeaturesExtents_ = {}),+ (this.pendingFeatures_ = {}),+ (this.pixelTolerance_ = void 0 !== t.pixelTolerance ? t.pixelTolerance : 10),+ (this.rBush_ = new zd()),+ (this.snapped_ = null),+ (this.segmenters_ = Object.assign({}, kv, t.segmenters))+ }+ addFeature(t, e) {+ e = void 0 === e || e+ const i = z(t),+ r = t.getGeometry()+ if (r) {+ const e = this.segmenters_[r.getType()]+ if (e) {+ this.indexedFeaturesExtents_[i] = r.getExtent([1 / 0, 1 / 0, -1 / 0, -1 / 0])+ const n = e.call(this.segmenters_, r, this.getMap().getView().getProjection())+ let s = n.length+ for (let e = 0; e < s; ++e) {+ const i = n[e]+ ;(Uv[e] = Bt(i)), (Bv[e] = { feature: t, segment: i })+ }+ if (this.intersection_)+ for (let e = 0, i = n.length; e < i; ++e) {+ const i = n[e]+ if (1 === i.length) continue+ const r = Uv[e]+ for (let o = 0, a = e - 1; o < a; ++o) {+ const e = n[o]+ if (!Se(r, Uv[o])) continue+ const a = ts(i, e)+ if (!a) continue+ const l = [a]+ ;(Uv[s] = Bt(l)), (Bv[s++] = { feature: t, intersectionFeature: t, segment: l })+ }+ const o = this.rBush_.getInExtent(Uv[e])+ for (let e = 0, n = o.length; e < n; ++e) {+ const n = o[e].segment+ if (1 === n.length) continue+ const r = ts(i, n)+ if (!r) continue+ const a = [r]+ ;(Uv[s] = Bt(a)), (Bv[s++] = { feature: t, intersectionFeature: o[e].feature, segment: a })+ }+ }+ 1 === s ? this.rBush_.insert(Uv[0], Bv[0]) : ((Uv.length = s), (Bv.length = s), this.rBush_.load(Uv, Bv))+ }+ }+ e &&+ (this.featureChangeListenerKeys_[i] && k(this.featureChangeListenerKeys_[i]),+ (this.featureChangeListenerKeys_[i] = D(t, n, this.handleFeatureChange_, this)))+ }+ getFeatures_() {+ let t+ return this.features_ ? (t = this.features_) : this.source_ && (t = this.source_.getFeatures()), t+ }+ areSnapDataEqual_(t, e) {+ return t.segment === e.segment && t.feature === e.feature+ }+ handleEvent(t) {+ const e = this.snapTo(t.pixel, t.coordinate, t.map)+ return (+ e+ ? ((t.coordinate = e.vertex.slice(0, 2)),+ (t.pixel = e.vertexPixel),+ this.snapped_ &&+ !this.areSnapDataEqual_(this.snapped_, e) &&+ this.dispatchEvent(new Nv(Dv, this.snapped_)),+ (this.snapped_ = { vertex: t.coordinate, vertexPixel: t.pixel, feature: e.feature, segment: e.segment }),+ this.dispatchEvent(new Nv(Ov, this.snapped_)))+ : this.snapped_ && (this.dispatchEvent(new Nv(Dv, this.snapped_)), (this.snapped_ = null)),+ super.handleEvent(t)+ )+ }+ handleFeatureAdd_(t) {+ const e = Gv(t)+ e && this.addFeature(e)+ }+ handleFeatureRemove_(t) {+ const e = Gv(t)+ e && (this.removeFeature(e), delete this.pendingFeatures_[z(e)])+ }+ handleFeatureChange_(t) {+ const e = t.target+ this.handlingDownUpSequence ? (this.pendingFeatures_[z(e)] = e) : this.updateFeature_(e)+ }+ handleUpEvent(t) {+ const e = Object.values(this.pendingFeatures_)+ if (e.length) {+ for (const t of e) this.updateFeature_(t)+ F(this.pendingFeatures_)+ }+ return !1+ }+ removeFeature(t, e) {+ const i = void 0 === e || e,+ n = z(t),+ r = this.indexedFeaturesExtents_[n]+ if (r) {+ const e = this.rBush_+ e.getInExtent(r).forEach((i) => {+ ;(t !== i.feature && t !== i.intersectionFeature) || e.remove(i)+ })+ }+ i && (k(this.featureChangeListenerKeys_[n]), delete this.featureChangeListenerKeys_[n])+ }+ setMap(i) {+ const n = this.getMap(),+ r = this.featuresListenerKeys_+ let s = this.getFeatures_()+ if (+ (Array.isArray(s) || (s = s.getArray()),+ n &&+ (r.forEach(k),+ (r.length = 0),+ this.rBush_.clear(),+ Object.values(this.featureChangeListenerKeys_).forEach(k),+ (this.featureChangeListenerKeys_ = {})),+ super.setMap(i),+ i)+ ) {+ this.features_+ ? r.push(+ D(this.features_, t, this.handleFeatureAdd_, this),+ D(this.features_, e, this.handleFeatureRemove_, this)+ )+ : this.source_ &&+ r.push(+ D(this.source_, Xd, this.handleFeatureAdd_, this),+ D(this.source_, Wd, this.handleFeatureRemove_, this)+ )+ for (const t of s) this.addFeature(t)+ }+ }+ snapTo(t, e, i) {+ const n = i.getView().getProjection(),+ r = Un(e, n),+ s = Bn(zt(Bt([r]), i.getView().getResolution() * this.pixelTolerance_), n),+ o = this.rBush_.getInExtent(s),+ a = o.length+ if (0 === a) return null+ let l,+ h,+ c = 1 / 0,+ u = null+ const d = this.pixelTolerance_ * this.pixelTolerance_,+ g = () => {+ if (!l) return null+ const e = i.getPixelFromCoordinate(l)+ return ai(t, e) > d+ ? null+ : { vertex: l, vertexPixel: [Math.round(e[0]), Math.round(e[1])], feature: h, segment: u }+ }+ if (this.vertex_ || this.intersection_) {+ for (let t = 0; t < a; ++t) {+ const e = o[t]+ if ("Circle" !== e.feature.getGeometry().getType())+ for (const t of e.segment) {+ const i = ai(r, Un(t, n))+ i < c &&+ ((this.intersection_ && e.intersectionFeature) || (this.vertex_ && !e.intersectionFeature)) &&+ ((l = t), (c = i), (h = e.feature))+ }+ }+ const t = g()+ if (t) return t+ }+ if (this.edge_) {+ for (let t = 0; t < a; ++t) {+ let e = null+ const i = o[t]+ if ("Circle" === i.feature.getGeometry().getType()) {+ let t = i.feature.getGeometry()+ const s = Gn()+ s && (t = t.clone().transform(s, n)), (e = ti(r, t))+ } else {+ const [t, s] = i.segment+ s && ((jv[0] = Un(t, n)), (jv[1] = Un(s, n)), (e = ei(r, jv)))+ }+ if (e) {+ const t = ai(r, e)+ t < c &&+ ((l = jn(e, n)),+ (u = "Circle" === i.feature.getGeometry().getType() ? null : i.segment),+ (c = t),+ (h = i.feature))+ }+ }+ const t = g()+ if (t) return t+ }+ return null+ }+ updateFeature_(t) {+ this.removeFeature(t, !1), this.addFeature(t, !1)+ }+ }),+ (bP.interaction.Translate = class extends fa {+ constructor(t) {+ let e+ if (+ (super((t = t || {})),+ this.on,+ this.once,+ this.un,+ (this.lastCoordinate_ = null),+ (this.startCoordinate_ = null),+ (this.features_ = void 0 !== t.features ? t.features : null),+ t.layers && !this.features_)+ )+ if ("function" == typeof t.layers) e = t.layers+ else {+ const i = t.layers+ e = function (t) {+ return i.includes(t)+ }+ }+ else e = C+ ;(this.layerFilter_ = e),+ (this.filter_ = t.filter && !this.features_ ? t.filter : C),+ (this.hitTolerance_ = t.hitTolerance ? t.hitTolerance : 0),+ (this.condition_ = t.condition ? t.condition : ra),+ (this.lastFeature_ = null),+ this.addChangeListener(Yo, this.handleActiveChanged_)+ }+ handleDownEvent(t) {+ if (!t.originalEvent || !this.condition_(t)) return !1+ if (((this.lastFeature_ = this.featuresAtPixel_(t.pixel, t.map)), !this.lastCoordinate_ && this.lastFeature_)) {+ ;(this.startCoordinate_ = t.coordinate), (this.lastCoordinate_ = t.coordinate), this.handleMoveEvent(t)+ const e = this.features_ || new Z([this.lastFeature_])+ return this.dispatchEvent(new $v(zv, e, t.coordinate, this.startCoordinate_, t)), !0+ }+ return !1+ }+ handleUpEvent(t) {+ if (this.lastCoordinate_) {+ ;(this.lastCoordinate_ = null), this.handleMoveEvent(t)+ const e = this.features_ || new Z([this.lastFeature_])+ return (+ this.dispatchEvent(new $v(Vv, e, t.coordinate, this.startCoordinate_, t)),+ (this.startCoordinate_ = null),+ !0+ )+ }+ return !1+ }+ handleDragEvent(t) {+ if (this.lastCoordinate_) {+ const e = t.coordinate,+ i = t.map.getView().getProjection(),+ n = Un(e, i),+ r = Un(this.lastCoordinate_, i),+ s = n[0] - r[0],+ o = n[1] - r[1],+ a = this.features_ || new Z([this.lastFeature_]),+ l = Gn()+ a.forEach(function (t) {+ const e = t.getGeometry()+ l ? (e.transform(l, i), e.translate(s, o), e.transform(i, l)) : e.translate(s, o), t.setGeometry(e)+ }),+ (this.lastCoordinate_ = e),+ this.dispatchEvent(new $v(Xv, a, e, this.startCoordinate_, t))+ }+ }+ handleMoveEvent(t) {+ const e = t.map.getViewport()+ this.featuresAtPixel_(t.pixel, t.map)+ ? (e.classList.remove(this.lastCoordinate_ ? "ol-grab" : "ol-grabbing"),+ e.classList.add(this.lastCoordinate_ ? "ol-grabbing" : "ol-grab"))+ : e.classList.remove("ol-grab", "ol-grabbing")+ }+ featuresAtPixel_(t, e) {+ return e.forEachFeatureAtPixel(+ t,+ (t, e) => {+ if (t instanceof At && this.filter_(t, e) && (!this.features_ || this.features_.getArray().includes(t)))+ return t+ },+ { layerFilter: this.layerFilter_, hitTolerance: this.hitTolerance_ }+ )+ }+ getHitTolerance() {+ return this.hitTolerance_+ }+ setHitTolerance(t) {+ this.hitTolerance_ = t+ }+ setMap(t) {+ const e = this.getMap()+ super.setMap(t), this.updateState_(e)+ }+ handleActiveChanged_() {+ this.updateState_(null)+ }+ updateState_(t) {+ let e = this.getMap()+ const i = this.getActive()+ if ((!e || !i) && ((e = e || t), e)) {+ e.getViewport().classList.remove("ol-grab", "ol-grabbing")+ }+ }+ }),+ (bP.interaction.Translate.TranslateEvent = $v),+ (bP.interaction.defaults = {}),+ (bP.interaction.defaults.defaults = Da),+ (bP.layer = {}),+ (bP.layer.Base = Wa),+ (bP.layer.BaseImage = Rf),+ (bP.layer.BaseTile = Df),+ (bP.layer.BaseVector = zc),+ (bP.layer.Flow = Ox),+ (bP.layer.Graticule = class extends Gx {+ constructor(t) {+ t = t || {}+ const e = Object.assign({ updateWhileAnimating: !0, updateWhileInteracting: !0, renderBuffer: 0 }, t)+ delete e.maxLines,+ delete e.strokeStyle,+ delete e.targetSize,+ delete e.showLabels,+ delete e.lonLabelFormatter,+ delete e.latLabelFormatter,+ delete e.lonLabelPosition,+ delete e.latLabelPosition,+ delete e.lonLabelStyle,+ delete e.latLabelStyle,+ delete e.intervals,+ super(e),+ (this.projection_ = null),+ (this.maxLat_ = 1 / 0),+ (this.maxLon_ = 1 / 0),+ (this.minLat_ = -1 / 0),+ (this.minLon_ = -1 / 0),+ (this.maxX_ = 1 / 0),+ (this.maxY_ = 1 / 0),+ (this.minX_ = -1 / 0),+ (this.minY_ = -1 / 0),+ (this.targetSize_ = void 0 !== t.targetSize ? t.targetSize : 100),+ (this.maxLines_ = void 0 !== t.maxLines ? t.maxLines : 100),+ (this.meridians_ = []),+ (this.parallels_ = []),+ (this.strokeStyle_ = void 0 !== t.strokeStyle ? t.strokeStyle : jx),+ (this.fromLonLatTransform_ = void 0),+ (this.toLonLatTransform_ = void 0),+ (this.projectionCenterLonLat_ = null),+ (this.bottomLeft_ = null),+ (this.bottomRight_ = null),+ (this.topLeft_ = null),+ (this.topRight_ = null),+ (this.meridiansLabels_ = null),+ (this.parallelsLabels_ = null),+ t.showLabels &&+ ((this.lonLabelFormatter_ = null == t.lonLabelFormatter ? ii.bind(this, "EW") : t.lonLabelFormatter),+ (this.latLabelFormatter_ = null == t.latLabelFormatter ? ii.bind(this, "NS") : t.latLabelFormatter),+ (this.lonLabelPosition_ = null == t.lonLabelPosition ? 0 : t.lonLabelPosition),+ (this.latLabelPosition_ = null == t.latLabelPosition ? 1 : t.latLabelPosition),+ (this.lonLabelStyleBase_ = new hc({+ text:+ void 0 !== t.lonLabelStyle+ ? t.lonLabelStyle.clone()+ : new pc({+ font: "12px Calibri,sans-serif",+ textBaseline: "bottom",+ fill: new sc({ color: "rgba(0,0,0,1)" }),+ stroke: new lc({ color: "rgba(255,255,255,1)", width: 3 })+ })+ })),+ (this.lonLabelStyle_ = (t) => {+ const e = t.get("graticule_label")+ return this.lonLabelStyleBase_.getText().setText(e), this.lonLabelStyleBase_+ }),+ (this.latLabelStyleBase_ = new hc({+ text:+ void 0 !== t.latLabelStyle+ ? t.latLabelStyle.clone()+ : new pc({+ font: "12px Calibri,sans-serif",+ textAlign: "right",+ fill: new sc({ color: "rgba(0,0,0,1)" }),+ stroke: new lc({ color: "rgba(255,255,255,1)", width: 3 })+ })+ })),+ (this.latLabelStyle_ = (t) => {+ const e = t.get("graticule_label")+ return this.latLabelStyleBase_.getText().setText(e), this.latLabelStyleBase_+ }),+ (this.meridiansLabels_ = []),+ (this.parallelsLabels_ = []),+ this.addEventListener(Qa, this.drawLabels_.bind(this))),+ (this.intervals_ = void 0 !== t.intervals ? t.intervals : Ux),+ this.setSource(+ new qd({+ loader: this.loaderFunction.bind(this),+ strategy: this.strategyFunction.bind(this),+ features: new Z(),+ overlaps: !1,+ useSpatialIndex: !1,+ wrapX: t.wrapX+ })+ ),+ (this.featurePool_ = []),+ (this.lineStyle_ = new hc({ stroke: this.strokeStyle_ })),+ (this.loadedExtent_ = null),+ (this.renderedExtent_ = null),+ (this.renderedResolution_ = null),+ this.setRenderOrder(null)+ }+ strategyFunction(t, e) {+ let i = t.slice()+ return (+ this.projection_ && this.getSource().getWrapX() && Re(i, this.projection_),+ this.loadedExtent_ &&+ (ee(this.loadedExtent_, i, e)+ ? (i = this.loadedExtent_.slice())+ : this.getSource().removeLoadedExtent(this.loadedExtent_)),+ [i]+ )+ }+ loaderFunction(t, e, i) {+ this.loadedExtent_ = t+ const n = this.getSource(),+ r = me(this.getExtent() || [-1 / 0, -1 / 0, 1 / 0, 1 / 0], t)+ if (this.renderedExtent_ && te(this.renderedExtent_, r) && this.renderedResolution_ === e) return+ if (((this.renderedExtent_ = r), (this.renderedResolution_ = e), Ee(r))) return+ const s = de(r),+ o = (e * e) / 4+ ;(!this.projection_ || !Fn(this.projection_, i)) && this.updateProjectionInfo_(i),+ this.createGraticule_(r, s, e, o)+ let a,+ l = this.meridians_.length + this.parallels_.length+ for (+ this.meridiansLabels_ && (l += this.meridians_.length),+ this.parallelsLabels_ && (l += this.parallels_.length);+ l > this.featurePool_.length;++ )+ (a = new At()), this.featurePool_.push(a)+ const h = n.getFeaturesCollection()+ h.clear()+ let c,+ u,+ d = 0+ for (c = 0, u = this.meridians_.length; c < u; ++c)+ (a = this.featurePool_[d++]), a.setGeometry(this.meridians_[c]), a.setStyle(this.lineStyle_), h.push(a)+ for (c = 0, u = this.parallels_.length; c < u; ++c)+ (a = this.featurePool_[d++]), a.setGeometry(this.parallels_[c]), a.setStyle(this.lineStyle_), h.push(a)+ }+ addMeridian_(t, e, i, n, r, s) {+ const o = this.getMeridian_(t, e, i, n, s)+ if (Se(o.getExtent(), r)) {+ if (this.meridiansLabels_) {+ const e = this.lonLabelFormatter_(t)+ s in this.meridiansLabels_+ ? (this.meridiansLabels_[s].text = e)+ : (this.meridiansLabels_[s] = { geom: new Wr([]), text: e })+ }+ this.meridians_[s++] = o+ }+ return s+ }+ addParallel_(t, e, i, n, r, s) {+ const o = this.getParallel_(t, e, i, n, s)+ if (Se(o.getExtent(), r)) {+ if (this.parallelsLabels_) {+ const e = this.latLabelFormatter_(t)+ s in this.parallelsLabels_+ ? (this.parallelsLabels_[s].text = e)+ : (this.parallelsLabels_[s] = { geom: new Wr([]), text: e })+ }+ this.parallels_[s++] = o+ }+ return s+ }+ drawLabels_(t) {+ const e = t.frameState.viewState.rotation,+ i = t.frameState.viewState.resolution,+ n = t.frameState.size,+ r = t.frameState.extent,+ s = de(r)+ let o = r+ if (e) {+ const t = n[0] * i,+ e = n[1] * i+ o = [s[0] - t / 2, s[1] - e / 2, s[0] + t / 2, s[1] + e / 2]+ }+ let a = 0,+ l = 0,+ h = this.latLabelPosition_ < 0.5+ const c = this.projection_.getExtent(),+ u = ve(c)+ if (this.getSource().getWrapX() && this.projection_.canWrapX() && !Wt(c, r)) {+ ;(a = Math.floor((r[0] - c[0]) / u)), (l = Math.ceil((r[2] - c[2]) / u))+ h = h !== Math.abs(e) > Math.PI / 2+ }+ const d = bu(t)+ for (let t = a; t <= l; ++t) {+ let i,+ n,+ c,+ g,+ f = this.meridians_.length + this.parallels_.length+ if (this.meridiansLabels_)+ for (n = 0, c = this.meridiansLabels_.length; n < c; ++n) {+ const a = this.meridians_[n]+ if (e || 0 !== t) {+ const i = a.clone()+ i.translate(t * u, 0), i.rotate(-e, s), (g = this.getMeridianPoint_(i, o, n)), g.rotate(e, s)+ } else g = this.getMeridianPoint_(a, r, n)+ ;(i = this.featurePool_[f++]),+ i.setGeometry(g),+ i.set("graticule_label", this.meridiansLabels_[n].text),+ d.drawFeature(i, this.lonLabelStyle_(i))+ }+ if (this.parallelsLabels_ && ((t === a && h) || (t === l && !h)))+ for (n = 0, c = this.parallels_.length; n < c; ++n) {+ const a = this.parallels_[n]+ if (e || 0 !== t) {+ const i = a.clone()+ i.translate(t * u, 0), i.rotate(-e, s), (g = this.getParallelPoint_(i, o, n)), g.rotate(e, s)+ } else g = this.getParallelPoint_(a, r, n)+ ;(i = this.featurePool_[f++]),+ i.setGeometry(g),+ i.set("graticule_label", this.parallelsLabels_[n].text),+ d.drawFeature(i, this.latLabelStyle_(i))+ }+ }+ }+ createGraticule_(t, e, i, n) {+ const r = this.getInterval_(i)+ if (-1 == r)+ return (+ (this.meridians_.length = 0),+ (this.parallels_.length = 0),+ this.meridiansLabels_ && (this.meridiansLabels_.length = 0),+ void (this.parallelsLabels_ && (this.parallelsLabels_.length = 0))+ )+ let s = !1+ const o = this.projection_.getExtent(),+ a = ve(o)+ this.getSource().getWrapX() &&+ this.projection_.canWrapX() &&+ !Wt(o, t) &&+ (ve(t) >= a ? ((t[0] = o[0]), (t[2] = o[2])) : (s = !0))+ const l = [Ie(e[0], this.minX_, this.maxX_), Ie(e[1], this.minY_, this.maxY_)],+ h = this.toLonLatTransform_(l)+ isNaN(h[1]) && (h[1] = Math.abs(this.maxLat_) >= Math.abs(this.minLat_) ? this.maxLat_ : this.minLat_)+ let c = Ie(h[0], this.minLon_, this.maxLon_),+ u = Ie(h[1], this.minLat_, this.maxLat_)+ const d = this.maxLines_+ let g,+ f,+ p,+ _,+ m = t+ s ||+ (m = [+ Ie(t[0], this.minX_, this.maxX_),+ Ie(t[1], this.minY_, this.maxY_),+ Ie(t[2], this.minX_, this.maxX_),+ Ie(t[3], this.minY_, this.maxY_)+ ])+ const y = be(m, this.toLonLatTransform_, void 0, 8)+ let x = y[3],+ v = y[2],+ S = y[1],+ E = y[0]+ if (+ (s ||+ ($t(m, this.bottomLeft_) && ((E = this.minLon_), (S = this.minLat_)),+ $t(m, this.bottomRight_) && ((v = this.maxLon_), (S = this.minLat_)),+ $t(m, this.topLeft_) && ((E = this.minLon_), (x = this.maxLat_)),+ $t(m, this.topRight_) && ((v = this.maxLon_), (x = this.maxLat_)),+ (x = Ie(x, u, this.maxLat_)),+ (v = Ie(v, c, this.maxLon_)),+ (S = Ie(S, this.minLat_, u)),+ (E = Ie(E, this.minLon_, c))),+ (c = Math.floor(c / r) * r),+ (_ = Ie(c, this.minLon_, this.maxLon_)),+ (f = this.addMeridian_(_, S, x, n, t, 0)),+ (g = 0),+ s)+ )+ for (; (_ -= r) >= E && g++ < d; ) f = this.addMeridian_(_, S, x, n, t, f)+ else+ for (; _ != this.minLon_ && g++ < d; )+ (_ = Math.max(_ - r, this.minLon_)), (f = this.addMeridian_(_, S, x, n, t, f))+ if (((_ = Ie(c, this.minLon_, this.maxLon_)), (g = 0), s))+ for (; (_ += r) <= v && g++ < d; ) f = this.addMeridian_(_, S, x, n, t, f)+ else+ for (; _ != this.maxLon_ && g++ < d; )+ (_ = Math.min(_ + r, this.maxLon_)), (f = this.addMeridian_(_, S, x, n, t, f))+ for (+ this.meridians_.length = f,+ this.meridiansLabels_ && (this.meridiansLabels_.length = f),+ u = Math.floor(u / r) * r,+ p = Ie(u, this.minLat_, this.maxLat_),+ f = this.addParallel_(p, E, v, n, t, 0),+ g = 0;+ p != this.minLat_ && g++ < d;++ )+ (p = Math.max(p - r, this.minLat_)), (f = this.addParallel_(p, E, v, n, t, f))+ for (p = Ie(u, this.minLat_, this.maxLat_), g = 0; p != this.maxLat_ && g++ < d; )+ (p = Math.min(p + r, this.maxLat_)), (f = this.addParallel_(p, E, v, n, t, f))+ ;(this.parallels_.length = f), this.parallelsLabels_ && (this.parallelsLabels_.length = f)+ }+ getInterval_(t) {+ const e = this.projectionCenterLonLat_[0],+ i = this.projectionCenterLonLat_[1]+ let n = -1+ const r = Math.pow(this.targetSize_ * t, 2),+ s = [],+ o = []+ for (let t = 0, a = this.intervals_.length; t < a; ++t) {+ const a = Ie(this.intervals_[t] / 2, 0, 90),+ l = Ie(i, -90 + a, 90 - a)+ ;(s[0] = e - a),+ (s[1] = l - a),+ (o[0] = e + a),+ (o[1] = l + a),+ this.fromLonLatTransform_(s, s),+ this.fromLonLatTransform_(o, o)+ if (Math.pow(o[0] - s[0], 2) + Math.pow(o[1] - s[1], 2) <= r) break+ n = this.intervals_[t]+ }+ return n+ }+ getMeridian_(t, e, i, n, r) {+ const s = Nx(t, e, i, this.projection_, n)+ let o = this.meridians_[r]+ return o ? (o.setFlatCoordinates("XY", s), o.changed()) : ((o = new Dd(s, "XY")), (this.meridians_[r] = o)), o+ }+ getMeridianPoint_(t, e, i) {+ const n = t.getFlatCoordinates()+ let r = 1,+ s = n.length - 1+ n[r] > n[s] && ((r = s), (s = 1))+ const o = Math.max(e[1], n[r]),+ a = Math.min(e[3], n[s]),+ l = Ie(e[1] + Math.abs(e[1] - e[3]) * this.lonLabelPosition_, o, a),+ h = [n[r - 1] + ((n[s - 1] - n[r - 1]) * (l - n[r])) / (n[s] - n[r]), l],+ c = this.meridiansLabels_[i].geom+ return c.setCoordinates(h), c+ }+ getMeridians() {+ return this.meridians_+ }+ getParallel_(t, e, i, n, r) {+ const s = kx(t, e, i, this.projection_, n)+ let o = this.parallels_[r]+ return o ? (o.setFlatCoordinates("XY", s), o.changed()) : (o = new Dd(s, "XY")), o+ }+ getParallelPoint_(t, e, i) {+ const n = t.getFlatCoordinates()+ let r = 0,+ s = n.length - 2+ n[r] > n[s] && ((r = s), (s = 0))+ const o = Math.max(e[0], n[r]),+ a = Math.min(e[2], n[s]),+ l = Ie(e[0] + Math.abs(e[0] - e[2]) * this.latLabelPosition_, o, a),+ h = [l, n[r + 1] + ((n[s + 1] - n[r + 1]) * (l - n[r])) / (n[s] - n[r])],+ c = this.parallelsLabels_[i].geom+ return c.setCoordinates(h), c+ }+ getParallels() {+ return this.parallels_+ }+ updateProjectionInfo_(t) {+ const e = En("EPSG:4326"),+ i = t.getWorldExtent()+ ;(this.maxLat_ = i[3]), (this.maxLon_ = i[2]), (this.minLat_ = i[1]), (this.minLon_ = i[0])+ const n = An(t, e)+ if (this.minLon_ < this.maxLon_) this.toLonLatTransform_ = n+ else {+ const t = this.minLon_ + this.maxLon_ / 2+ ;(this.maxLon_ += 360),+ (this.toLonLatTransform_ = function (e, i, r) {+ const s = n(e, i, (r = r || 2))+ for (let e = 0, i = s.length; e < i; e += r) s[e] < t && (s[e] += 360)+ return s+ })+ }+ this.fromLonLatTransform_ = An(e, t)+ const r = be([this.minLon_, this.minLat_, this.maxLon_, this.maxLat_], this.fromLonLatTransform_, void 0, 8)+ ;(this.minX_ = r[0]),+ (this.maxX_ = r[2]),+ (this.minY_ = r[1]),+ (this.maxY_ = r[3]),+ (this.bottomLeft_ = this.fromLonLatTransform_([this.minLon_, this.minLat_])),+ (this.bottomRight_ = this.fromLonLatTransform_([this.maxLon_, this.minLat_])),+ (this.topLeft_ = this.fromLonLatTransform_([this.minLon_, this.maxLat_])),+ (this.topRight_ = this.fromLonLatTransform_([this.maxLon_, this.maxLat_])),+ (this.projectionCenterLonLat_ = this.toLonLatTransform_(de(t.getExtent()))),+ isNaN(this.projectionCenterLonLat_[1]) &&+ (this.projectionCenterLonLat_[1] =+ Math.abs(this.maxLat_) >= Math.abs(this.minLat_) ? this.maxLat_ : this.minLat_),+ (this.projection_ = t)+ }+ }),+ (bP.layer.Group = qa),+ (bP.layer.Group.GroupEvent = Ha),+ (bP.layer.Heatmap = class extends zc {+ constructor(t) {+ t = t || {}+ const e = Object.assign({}, t)+ delete e.gradient,+ delete e.radius,+ delete e.blur,+ delete e.weight,+ super(e),+ this.on,+ this.once,+ this.un,+ (this.filter_ = t.filter ?? !0),+ (this.styleVariables_ = t.variables || {}),+ (this.gradient_ = null),+ this.addChangeListener(zx, this.handleGradientChanged_),+ this.setGradient(t.gradient ? t.gradient : Vx),+ this.setBlur(void 0 !== t.blur ? t.blur : 15),+ this.setRadius(void 0 !== t.radius ? t.radius : 8)+ const i = t.weight ? t.weight : "weight"+ ;(this.weight_ = i), this.setRenderOrder(null)+ }+ getBlur() {+ return this.get(Bx)+ }+ getGradient() {+ return this.get(zx)+ }+ getRadius() {+ return this.get(Xx)+ }+ handleGradientChanged_() {+ this.gradient_ = (function (t) {+ const e = 1,+ i = 256,+ n = ft(e, i),+ r = n.createLinearGradient(0, 0, e, i),+ s = 1 / (t.length - 1)+ for (let e = 0, i = t.length; e < i; ++e) r.addColorStop(e * s, t[e])+ return (n.fillStyle = r), n.fillRect(0, 0, e, i), n.canvas+ })(this.getGradient())+ }+ setBlur(t) {+ const e = this.get(Bx)+ this.set(Bx, t), "number" != typeof t || "number" != typeof e ? this.clearRenderer() : this.changed()+ }+ setGradient(t) {+ this.set(zx, t)+ }+ setRadius(t) {+ const e = this.get(Xx)+ this.set(Xx, t), "number" != typeof t || "number" != typeof e ? this.clearRenderer() : this.changed()+ }+ setFilter(t) {+ ;(this.filter_ = t), this.changed(), this.clearRenderer()+ }+ setWeight(t) {+ ;(this.weight_ = t), this.changed(), this.clearRenderer()+ }+ createRenderer() {+ const t = new Zm(),+ e = { variables: {}, properties: {}, functions: {}, bandCount: 0, featureId: !1, geometryType: !1 },+ i = km(e, this.filter_, Yl)+ let n = km(e, this.getRadius(), Hl),+ r = km(e, this.getBlur(), Hl)+ const s = {}+ "number" == typeof this.getBlur() &&+ ((r = "a_blur"), (s.a_blur = () => this.getBlur()), t.addUniform("a_blur", "float")),+ "number" == typeof this.getRadius() &&+ ((n = "a_radius"), (s.a_radius = () => this.getRadius()), t.addUniform("a_radius", "float"))+ const o = {}+ let a = null+ if ("string" == typeof this.weight_ || "function" == typeof this.weight_) {+ const e = "string" == typeof this.weight_ ? (t) => t.get(this.weight_) : this.weight_+ ;(o.prop_weight = {+ size: 1,+ callback: (t) => {+ const i = e(t)+ return void 0 !== i ? Ie(i, 0, 1) : 1+ }+ }),+ (a = "a_prop_weight"),+ t.addAttribute("a_prop_weight", "float")+ } else {+ a = km(e, ["clamp", this.weight_, 0, 1], Hl)+ }+ t+ .addFragmentShaderFunction(+ `float getBlurSlope() {\n float blur = max(1., ${r});\n float radius = ${n};\n return radius / blur;\n}`+ )+ .setSymbolSizeExpression(`vec2(${n} + ${r}) * 2.`)+ .setSymbolColorExpression(+ `vec4(smoothstep(0., 1., (1. - length(coordsPx * 2. / v_quadSizePx)) * getBlurSlope()) * ${a})`+ )+ .setStrokeColorExpression(+ `vec4(smoothstep(0., 1., (1. - length(currentRadiusPx * 2. / v_width)) * getBlurSlope()) * ${a})`+ )+ .setStrokeWidthExpression(`(${n} + ${r}) * 2.`)+ .setFillColorExpression(`vec4(${a})`)+ .setFragmentDiscardExpression(`!${i}`),+ zm(t, e)+ const l = Vm(e),+ h = Xm(e, this.styleVariables_)+ return new my(this, {+ className: this.getClassName(),+ variables: this.styleVariables_,+ style: { builder: t, attributes: { ...l, ...o }, uniforms: { ...h, ...s } },+ disableHitDetection: !1,+ postProcesses: [+ {+ fragmentShader:+ "\n precision mediump float;\n\n uniform sampler2D u_image;\n uniform sampler2D u_gradientTexture;\n uniform float u_opacity;\n\n varying vec2 v_texCoord;\n\n void main() {\n vec4 color = texture2D(u_image, v_texCoord);\n gl_FragColor.a = color.a * u_opacity;\n gl_FragColor.rgb = texture2D(u_gradientTexture, vec2(0.5, color.a)).rgb;\n gl_FragColor.rgb *= gl_FragColor.a;\n }",+ uniforms: { u_gradientTexture: () => this.gradient_, u_opacity: () => this.getOpacity() }+ }+ ]+ })+ }+ updateStyleVariables(t) {+ Object.assign(this.styleVariables_, t), this.changed()+ }+ renderDeclutter() {}+ }),+ (bP.layer.Image = Pf),+ (bP.layer.Layer = nl),+ (bP.layer.Layer.inView = rl),+ (bP.layer.Tile = Nf),+ (bP.layer.Vector = Gx),+ (bP.layer.VectorImage = class extends zc {+ constructor(t) {+ t = t || {}+ const e = Object.assign({}, t)+ delete e.imageRatio, super(e), (this.imageRatio_ = void 0 !== t.imageRatio ? t.imageRatio : 1)+ }+ getImageRatio() {+ return this.imageRatio_+ }+ createRenderer() {+ return new yx(this)+ }+ }),+ (bP.layer.VectorTile = class extends zc {+ constructor(t) {+ t = t || {}+ const e = Object.assign({}, t)+ delete e.preload+ const i = void 0 === t.cacheSize ? 0 : t.cacheSize+ delete t.cacheSize,+ delete e.useInterimTilesOnError,+ super(e),+ this.on,+ this.once,+ this.un,+ (this.cacheSize_ = i)+ const n = t.renderMode || "hybrid"+ Mt("hybrid" == n || "vector" == n, "`renderMode` must be `'hybrid'` or `'vector'`"),+ (this.renderMode_ = n),+ this.setPreload(t.preload ? t.preload : 0),+ this.setUseInterimTilesOnError(void 0 === t.useInterimTilesOnError || t.useInterimTilesOnError),+ this.getBackground,+ this.setBackground+ }+ createRenderer() {+ return new Sx(this, { cacheSize: this.cacheSize_ })+ }+ getFeatures(t) {+ return super.getFeatures(t)+ }+ getFeaturesInExtent(t) {+ return this.getRenderer().getFeaturesInExtent(t)+ }+ getRenderMode() {+ return this.renderMode_+ }+ getPreload() {+ return this.get(Af)+ }+ getUseInterimTilesOnError() {+ return this.get(Of)+ }+ setPreload(t) {+ this.set(Af, t)+ }+ setUseInterimTilesOnError(t) {+ this.set(Of, t)+ }+ }),+ (bP.layer.WebGLPoints = class extends nl {+ constructor(t) {+ super(Object.assign({}, t)),+ (this.styleVariables_ = t.variables || {}),+ (this.parseResult_ = Qm(t.style, this.styleVariables_, t.filter)),+ (this.hitDetectionDisabled_ = !!t.disableHitDetection)+ }+ createRenderer() {+ const t = Object.keys(this.parseResult_.attributes).map((t) => ({+ name: t,+ ...this.parseResult_.attributes[t]+ }))+ return new k_(this, {+ vertexShader: this.parseResult_.builder.getSymbolVertexShader(),+ fragmentShader: this.parseResult_.builder.getSymbolFragmentShader(),+ hitDetectionEnabled: !this.hitDetectionDisabled_,+ uniforms: this.parseResult_.uniforms,+ attributes: t+ })+ }+ updateStyleVariables(t) {+ Object.assign(this.styleVariables_, t), this.changed()+ }+ }),+ (bP.layer.WebGLTile = Wx),+ (bP.layer.WebGLVector = class extends nl {+ constructor(t) {+ super(Object.assign({}, t)),+ (this.styleVariables_ = t.variables || {}),+ (this.style_ = t.style),+ (this.hitDetectionDisabled_ = !!t.disableHitDetection)+ }+ createRenderer() {+ return new my(this, {+ style: this.style_,+ variables: this.styleVariables_,+ disableHitDetection: this.hitDetectionDisabled_+ })+ }+ updateStyleVariables(t) {+ Object.assign(this.styleVariables_, t), this.changed()+ }+ setStyle(t) {+ ;(this.style_ = t), this.clearRenderer(), this.changed()+ }+ }),+ (bP.layer.WebGLVectorTile = class extends Df {+ constructor(t) {+ super(Object.assign({}, t)),+ (this.styleVariables_ = t.variables || {}),+ (this.style_ = t.style),+ (this.hitDetectionDisabled_ = !!t.disableHitDetection)+ }+ createRenderer() {+ return new vy(this, {+ style: this.style_,+ variables: this.styleVariables_,+ disableHitDetection: this.hitDetectionDisabled_,+ cacheSize: this.getCacheSize()+ })+ }+ updateStyleVariables(t) {+ Object.assign(this.styleVariables_, t), this.changed()+ }+ setStyle(t) {+ ;(this.style_ = t), this.clearRenderer(), this.changed()+ }+ }),+ (bP.loadingstrategy = {}),+ (bP.loadingstrategy.all = uu),+ (bP.loadingstrategy.bbox = function (t, e) {+ return [t]+ }),+ (bP.loadingstrategy.tile = function (t) {+ return function (e, i, n) {+ const r = t.getZForResolution(Vn(i, n)),+ s = t.getTileRangeForExtentAndZ(zn(e, n), r),+ o = [],+ a = [r, 0, 0]+ for (a[1] = s.minX; a[1] <= s.maxX; ++a[1])+ for (a[2] = s.minY; a[2] <= s.maxY; ++a[2]) o.push(Bn(t.getTileCoordExtent(a), n))+ return o+ }+ }),+ (bP.math = {}),+ (bP.math.ceil = Ue),+ (bP.math.clamp = Ie),+ (bP.math.floor = je),+ (bP.math.lerp = Ne),+ (bP.math.modulo = De),+ (bP.math.round = Ge),+ (bP.math.solveLinearSystem = Me),+ (bP.math.squaredDistance = Le),+ (bP.math.squaredSegmentDistance = Fe),+ (bP.math.toDegrees = Ae),+ (bP.math.toFixed = ke),+ (bP.math.toRadians = Oe),+ (bP.math.wrap = Be),+ (bP.net = {}),+ (bP.net.ClientError = fu),+ (bP.net.ResponseError = gu),+ (bP.net.getJSON = pu),+ (bP.net.jsonp = du),+ (bP.net.overrideXHR = function (t) {+ "undefined" != typeof XMLHttpRequest && (ou = XMLHttpRequest), (global.XMLHttpRequest = t)+ }),+ (bP.net.resolveUrl = _u),+ (bP.net.restoreXHR = function () {+ global.XMLHttpRequest = ou+ }),+ (bP.obj = {}),+ (bP.obj.clear = F),+ (bP.obj.isEmpty = L),+ (bP.proj = {}),+ (bP.proj.Projection = mi),+ (bP.proj.Units = {}),+ (bP.proj.Units.METERS_PER_UNIT = _i),+ (bP.proj.Units.fromCode = pi),+ (bP.proj.addCommon = Wn),+ (bP.proj.addCoordinateTransforms = Pn),+ (bP.proj.addEquivalentProjections = Tn),+ (bP.proj.addEquivalentTransforms = Cn),+ (bP.proj.addProjection = vn),+ (bP.proj.addProjections = Sn),+ (bP.proj.clearAllProjections = function () {+ Ai(), ki()+ }),+ (bP.proj.clearUserProjection = function () {+ Nn = null+ }),+ (bP.proj.cloneTransform = yn),+ (bP.proj.createProjection = bn),+ (bP.proj.createSafeCoordinateTransform = $n),+ (bP.proj.createTransformFromCoordinateTransform = Rn),+ (bP.proj.disableCoordinateWarning = mn),+ (bP.proj.epsg3857 = {}),+ (bP.proj.epsg3857.EXTENT = vi),+ (bP.proj.epsg3857.HALF_SIZE = xi),+ (bP.proj.epsg3857.MAX_SAFE_Y = Ei),+ (bP.proj.epsg3857.PROJECTIONS = Ti),+ (bP.proj.epsg3857.RADIUS = yi),+ (bP.proj.epsg3857.WORLD_EXTENT = Si),+ (bP.proj.epsg3857.fromEPSG4326 = Ci),+ (bP.proj.epsg3857.toEPSG4326 = bi),+ (bP.proj.epsg4326 = {}),+ (bP.proj.epsg4326.EXTENT = Pi),+ (bP.proj.epsg4326.METERS_PER_UNIT = Ii),+ (bP.proj.epsg4326.PROJECTIONS = Li),+ (bP.proj.epsg4326.RADIUS = Ri),+ (bP.proj.equivalent = Fn),+ (bP.proj.fromLonLat = function (t, e) {+ return mn(), On(t, "EPSG:4326", void 0 !== e ? e : "EPSG:3857")+ }),+ (bP.proj.fromUserCoordinate = Un),+ (bP.proj.fromUserExtent = zn),+ (bP.proj.fromUserResolution = Vn),+ (bP.proj.get = En),+ (bP.proj.getPointResolution = wn),+ (bP.proj.getTransform = An),+ (bP.proj.getTransformFromProjections = Ln),+ (bP.proj.getUserProjection = Gn),+ (bP.proj.identityTransform = xn),+ (bP.proj.proj4 = {}),+ (bP.proj.proj4.epsgLookupMapTiler = function (t) {+ return async function (e) {+ const i = await fetch(+ `https://api.maptiler.com/coordinates/search/code:${e}.json?transformations=true&exports=true&key=${t}`+ )+ if (!i.ok) throw new Error(`Unexpected response from maptiler.com: ${i.status}`)+ return i.json().then((t) => {+ const i = t.results+ if (i?.length > 0) {+ const t = i.filter((t) => "EPSG" === t.id?.authority && t.id?.code === e)[0]+ if (t) {+ const e = t.transformations+ if (e?.length > 0) {+ const i = t.default_transformation+ if (+ e.filter((t) => t.id?.authority === i?.authority && t.id?.code === i?.code && 0 === t.grids?.length)+ .length > 0+ )+ return t.exports?.proj4+ const n = e+ .filter(+ (t) =>+ 0 === t.grids?.length &&+ "EPSG" === t.target_crs?.authority &&+ 4326 === t.target_crs?.code &&+ !1 === t.deprecated &&+ !0 === t.usable+ )+ .sort((t, e) => t.accuracy - e.accuracy)[0]?.exports?.proj4+ if (n) return n+ }+ return t.exports?.proj4+ }+ }+ })+ }+ }),+ (bP.proj.proj4.fromEPSGCode = async function (t) {+ return "number" == typeof t && (t = "EPSG:" + t), await Cx(t)+ }),+ (bP.proj.proj4.fromProjectionCode = Cx),+ (bP.proj.proj4.getEPSGLookup = function () {+ return bx+ }),+ (bP.proj.proj4.getProjectionCodeLookup = function () {+ return Tx+ }),+ (bP.proj.proj4.isRegistered = function () {+ return !!Ex+ }),+ (bP.proj.proj4.register = wx),+ (bP.proj.proj4.setEPSGLookup = function (t) {+ bx = t+ }),+ (bP.proj.proj4.setProjectionCodeLookup = function (t) {+ Tx = t+ }),+ (bP.proj.proj4.unregister = function () {+ Ex = null+ }),+ (bP.proj.projections = {}),+ (bP.proj.projections.add = Di),+ (bP.proj.projections.clear = Ai),+ (bP.proj.projections.get = Oi),+ (bP.proj.setUserProjection = kn),+ (bP.proj.toLonLat = In),+ (bP.proj.toUserCoordinate = jn),+ (bP.proj.toUserExtent = Bn),+ (bP.proj.toUserResolution = Xn),+ (bP.proj.transform = On),+ (bP.proj.transformExtent = Dn),+ (bP.proj.transformWithProjections = function (t, e, i) {+ return Ln(e, i)(t)+ }),+ (bP.proj.transforms = {}),+ (bP.proj.transforms.add = Gi),+ (bP.proj.transforms.clear = ki),+ (bP.proj.transforms.get = ji),+ (bP.proj.transforms.remove = function (t, e) {+ const i = t.getCode(),+ n = e.getCode(),+ r = Ni[i][n]+ return delete Ni[i][n], L(Ni[i]) && delete Ni[i], r+ }),+ (bP.proj.useGeographic = function () {+ kn("EPSG:4326")+ }),+ (bP.proj.utm = {}),+ (bP.proj.utm.makeProjection = dn),+ (bP.proj.utm.makeTransforms = gn),+ (bP.proj.utm.zoneFromCode = cn),+ (bP.render = {}),+ (bP.render.Box = ya),+ (bP.render.Event = Xc),+ (bP.render.Feature = Ud),+ (bP.render.Feature.toFeature = function (t, e) {+ const i = t.getId(),+ n = Bd(t),+ r = t.getProperties(),+ s = new At()+ return (+ void 0 !== e && s.setGeometryName(e), s.setGeometry(n), void 0 !== i && s.setId(i), s.setProperties(r, !0), s+ )+ }),+ (bP.render.Feature.toGeometry = Bd),+ (bP.render.VectorContext = yu),+ (bP.render.canvas = {}),+ (bP.render.canvas.Builder = Gy),+ (bP.render.canvas.BuilderGroup = Zy),+ (bP.render.canvas.Executor = sx),+ (bP.render.canvas.ExecutorGroup = ux),+ (bP.render.canvas.ExecutorGroup.ALL = ox),+ (bP.render.canvas.ExecutorGroup.DECLUTTER = ax),+ (bP.render.canvas.ExecutorGroup.NON_DECLUTTER = lx),+ (bP.render.canvas.ExecutorGroup.getPixelIndexArray = gx),+ (bP.render.canvas.ImageBuilder = jy),+ (bP.render.canvas.Immediate = xu),+ (bP.render.canvas.Instruction = {}),+ (bP.render.canvas.Instruction.beginPathInstruction = Ny),+ (bP.render.canvas.Instruction.closePathInstruction = ky),+ (bP.render.canvas.Instruction.fillInstruction = Oy),+ (bP.render.canvas.Instruction.strokeInstruction = Dy),+ (bP.render.canvas.LineStringBuilder = Uy),+ (bP.render.canvas.PolygonBuilder = By),+ (bP.render.canvas.TextBuilder = $y),+ (bP.render.canvas.TextBuilder.TEXT_ALIGN = Vy),+ (bP.render.canvas.ZIndexContext = Sf),+ (bP.render.canvas.checkedFonts = Xh),+ (bP.render.canvas.defaultFillStyle = Oh),+ (bP.render.canvas.defaultFont = Ah),+ (bP.render.canvas.defaultLineCap = Dh),+ (bP.render.canvas.defaultLineDash = Nh),+ (bP.render.canvas.defaultLineDashOffset = 0),+ (bP.render.canvas.defaultLineJoin = kh),+ (bP.render.canvas.defaultLineWidth = 1),+ (bP.render.canvas.defaultMiterLimit = Gh),+ (bP.render.canvas.defaultPadding = zh),+ (bP.render.canvas.defaultStrokeOffset = 0),+ (bP.render.canvas.defaultStrokeStyle = jh),+ (bP.render.canvas.defaultTextAlign = Uh),+ (bP.render.canvas.defaultTextBaseline = Bh),+ (bP.render.canvas.drawImageOrLabel = ec),+ (bP.render.canvas.getTextDimensions = tc),+ (bP.render.canvas.hitdetect = {}),+ (bP.render.canvas.hitdetect.HIT_DETECT_RESOLUTION = fx),+ (bP.render.canvas.hitdetect.createHitDetectionImageData = px),+ (bP.render.canvas.hitdetect.hitDetect = _x),+ (bP.render.canvas.measureAndCacheTextWidth = Qh),+ (bP.render.canvas.measureTextHeight = Kh),+ (bP.render.canvas.measureTextWidth = Jh),+ (bP.render.canvas.registerFont = Hh),+ (bP.render.canvas.rotateAtOffset = function (t, e, i, n) {+ 0 !== e && (t.translate(i, n), t.rotate(e), t.translate(-i, -n))+ }),+ (bP.render.canvas.style = {}),+ (bP.render.canvas.style.buildRuleSet = xc),+ (bP.render.canvas.style.buildStyle = vc),+ (bP.render.canvas.style.flatStylesToStyleFunction = yc),+ (bP.render.canvas.style.rulesToStyleFunction = mc),+ (bP.render.canvas.textHeights = Wh),+ (bP.render.getRenderPixel = function (t, e) {+ return Qn(t.inversePixelTransform, e.slice(0))+ }),+ (bP.render.getVectorContext = bu),+ (bP.render.toContext = function (t, e) {+ const i = t.canvas,+ n = (e = e || {}).pixelRatio || ht,+ r = e.size+ r && ((i.width = r[0] * n), (i.height = r[1] * n), (i.style.width = r[0] + "px"), (i.style.height = r[1] + "px"))+ const s = [0, 0, i.width, i.height],+ o = er([1, 0, 0, 1, 0, 0], n, n)+ return new xu(t, n, s, o, 0)+ }),+ (bP.render.webgl = {}),+ (bP.render.webgl.MixedGeometryBatch = qp),+ (bP.render.webgl.ShaderBuilder = {}),+ (bP.render.webgl.ShaderBuilder.COMMON_HEADER = $m),+ (bP.render.webgl.ShaderBuilder.ShaderBuilder = Zm),+ (bP.render.webgl.VectorStyleRenderer = fy),+ (bP.render.webgl.VectorStyleRenderer.convertStyleToShaders = py),+ (bP.render.webgl.bufferUtil = {}),+ (bP.render.webgl.bufferUtil.LINESTRING_ANGLE_COSINE_CUTOFF = Om),+ (bP.render.webgl.bufferUtil.writeLineSegmentToBuffers = function (t, e, i, n, r, s, o, a, l, h) {+ const c = [t[e], t[e + 1]],+ u = [t[i], t[i + 1]],+ d = t[e + 2],+ g = t[i + 2],+ f = Qn(a, [...c]),+ p = Qn(a, [...u])+ let _ = -1,+ m = -1,+ y = h+ const x = null !== r+ if (null !== n) {+ ;(_ = gi(f, p, Qn(a, [...[t[n], t[n + 1]]]))), Math.cos(_) <= Om && (y += Math.tan((_ - Math.PI) / 2))+ }+ if (x) {+ ;(m = gi(p, f, Qn(a, [...[t[r], t[r + 1]]]))), Math.cos(m) <= Om && (y += Math.tan((Math.PI - m) / 2))+ }+ const v = Math.pow(2, 24),+ S = l % v,+ E = Math.floor(l / v) * v+ return (+ s.push(c[0], c[1], d, u[0], u[1], g, _, m, S, E, h),+ s.push(...o),+ { length: l + Math.sqrt((p[0] - f[0]) * (p[0] - f[0]) + (p[1] - f[1]) * (p[1] - f[1])), angle: y }+ )+ }),+ (bP.render.webgl.bufferUtil.writePointFeatureToBuffers = function (t, e, i, n, r) {+ const s = t[e++],+ o = t[e++],+ a = Dm+ a.length = n+ for (let i = 0; i < a.length; i++) a[i] = t[e + i]+ let l = r ? r.instanceAttributesPosition : 0+ return (+ (i[l++] = s), (i[l++] = o), a.length && (i.set(a, l), (l += a.length)), (Nm.instanceAttributesPosition = l), Nm+ )+ }),+ (bP.render.webgl.bufferUtil.writePolygonTrianglesToBuffers = function (t, e, i, n, r) {+ const s = 2 + r+ let o = e+ const a = t.slice(o, o + r)+ o += r+ const l = t[o++]+ let h = 0+ const c = new Array(l - 1)+ for (let e = 0; e < l; e++) (h += t[o++]), e < l - 1 && (c[e] = h)+ const u = t.slice(o, o + 2 * h),+ d = lm(u, c, 2)+ for (let t = 0; t < d.length; t++) n.push(d[t] + i.length / s)+ for (let t = 0; t < u.length; t += 2) i.push(u[t], u[t + 1], ...a)+ return o + 2 * h+ }),+ (bP.render.webgl.compileUtil = {}),+ (bP.render.webgl.compileUtil.UNPACK_COLOR_FN = jm),+ (bP.render.webgl.compileUtil.applyContextToBuilder = zm),+ (bP.render.webgl.compileUtil.expressionToGlsl = km),+ (bP.render.webgl.compileUtil.generateAttributesFromContext = Vm),+ (bP.render.webgl.compileUtil.generateUniformsFromContext = Xm),+ (bP.render.webgl.compileUtil.getGlslSizeFromType = Um),+ (bP.render.webgl.compileUtil.getGlslTypeFromType = Bm),+ (bP.render.webgl.compileUtil.packColor = Gm),+ (bP.render.webgl.compileUtil.unpackColor = function (t) {+ return [+ Math.min(Math.floor(t[0] / 256) / 255, 1),+ Math.min((t[0] % 256) / 255, 1),+ Math.min(Math.floor(t[1] / 256) / 255, 1),+ Math.min((t[1] % 256) / 255, 1)+ ]+ }),+ (bP.render.webgl.encodeUtil = {}),+ (bP.render.webgl.encodeUtil.colorDecodeId = O_),+ (bP.render.webgl.encodeUtil.colorEncodeIdAndPack = A_),+ (bP.render.webgl.renderinstructions = {}),+ (bP.render.webgl.renderinstructions.generateLineStringRenderInstructions = om),+ (bP.render.webgl.renderinstructions.generatePointRenderInstructions = sm),+ (bP.render.webgl.renderinstructions.generatePolygonRenderInstructions = am),+ (bP.render.webgl.renderinstructions.getCustomAttributesSize = rm),+ (bP.render.webgl.style = {}),+ (bP.render.webgl.style.computeHash = Ym),+ (bP.render.webgl.style.parseLiteralStyle = Qm),+ (bP.renderer = {}),+ (bP.renderer.Composite = Wc),+ (bP.renderer.Layer = Ef),+ (bP.renderer.Map = Vc),+ (bP.renderer.canvas = {}),+ (bP.renderer.canvas.ImageLayer = bf),+ (bP.renderer.canvas.Layer = Cf),+ (bP.renderer.canvas.Layer.canvasPool = wf),+ (bP.renderer.canvas.TileLayer = Mf),+ (bP.renderer.canvas.VectorImageLayer = yx),+ (bP.renderer.canvas.VectorLayer = mx),+ (bP.renderer.canvas.VectorTileLayer = Sx),+ (bP.renderer.vector = {}),+ (bP.renderer.vector.defaultOrder = Su),+ (bP.renderer.vector.getSquaredTolerance = Eu),+ (bP.renderer.vector.getTolerance = wu),+ (bP.renderer.vector.renderFeature = Tu),+ (bP.renderer.webgl = {}),+ (bP.renderer.webgl.FlowLayer = I_),+ (bP.renderer.webgl.Layer = d_),+ (bP.renderer.webgl.PointsLayer = k_),+ (bP.renderer.webgl.TileLayer = T_),+ (bP.renderer.webgl.TileLayer.Attributes = E_),+ (bP.renderer.webgl.TileLayer.Uniforms = S_),+ (bP.renderer.webgl.TileLayerBase = v_),+ (bP.renderer.webgl.TileLayerBase.Uniforms = g_),+ (bP.renderer.webgl.TileLayerBase.getCacheKey = x_),+ (bP.renderer.webgl.TileLayerBase.newTileRepresentationLookup = p_),+ (bP.renderer.webgl.VectorLayer = my),+ (bP.renderer.webgl.VectorLayer.Uniforms = _y),+ (bP.renderer.webgl.VectorTileLayer = vy),+ (bP.renderer.webgl.VectorTileLayer.Attributes = xy),+ (bP.renderer.webgl.VectorTileLayer.Uniforms = yy),+ (bP.reproj = {}),+ (bP.reproj.DataTile = ug),+ (bP.reproj.Image = Ng),+ (bP.reproj.Tile = fd),+ (bP.reproj.Triangulation = dd),+ (bP.reproj.calculateSourceExtentResolution = Mu),+ (bP.reproj.calculateSourceResolution = Lu),+ (bP.reproj.canvasPool = Pu),+ (bP.reproj.common = {}),+ (bP.reproj.common.ERROR_THRESHOLD = gd),+ (bP.reproj.glreproj = {}),+ (bP.reproj.glreproj.canvasGLPool = hg),+ (bP.reproj.glreproj.createCanvasContextWebGL = ag),+ (bP.reproj.glreproj.releaseGLCanvas = lg),+ (bP.reproj.glreproj.render = cg),+ (bP.reproj.render = Au),+ (bP.resolution = {}),+ (bP.resolution.fromResolutionLike = Ou),+ (bP.resolutionconstraint = {}),+ (bP.resolutionconstraint.createMinMaxResolution = vo),+ (bP.resolutionconstraint.createSnapToPower = xo),+ (bP.resolutionconstraint.createSnapToResolutions = yo),+ (bP.rotationconstraint = {}),+ (bP.rotationconstraint.createSnapToN = wo),+ (bP.rotationconstraint.createSnapToZero = To),+ (bP.rotationconstraint.disable = So),+ (bP.rotationconstraint.none = Eo),+ (bP.size = {}),+ (bP.size.buffer = function (t, e, i) {+ return void 0 === i && (i = [0, 0]), (i[0] = t[0] + 2 * e), (i[1] = t[1] + 2 * e), i+ }),+ (bP.size.hasArea = Vl),+ (bP.size.scale = $l),+ (bP.size.toSize = Wl),+ (bP.source = {}),+ (bP.source.BingMaps = class extends wd {+ constructor(t) {+ const e = void 0 !== t.hidpi && t.hidpi+ super({+ cacheSize: t.cacheSize,+ crossOrigin: "anonymous",+ interpolate: t.interpolate,+ projection: En("EPSG:3857"),+ reprojectionErrorThreshold: t.reprojectionErrorThreshold,+ state: "loading",+ tileLoadFunction: t.tileLoadFunction,+ tilePixelRatio: e ? 2 : 1,+ wrapX: void 0 === t.wrapX || t.wrapX,+ transition: t.transition,+ zDirection: t.zDirection+ }),+ (this.hidpi_ = e),+ (this.culture_ = void 0 !== t.culture ? t.culture : "en-us"),+ (this.maxZoom_ = void 0 !== t.maxZoom ? t.maxZoom : -1),+ (this.apiKey_ = t.key),+ (this.imagerySet_ = t.imagerySet),+ (this.placeholderTiles_ = t.placeholderTiles)+ const i =+ (t.url || "https://dev.virtualearth.net/REST/v1/Imagery/Metadata/") ++ this.imagerySet_ ++ "?uriScheme=https&include=ImageryProviders&key=" ++ this.apiKey_ ++ "&c=" ++ this.culture_+ fetch(i)+ .then((t) => t.json())+ .then((t) => this.handleImageryMetadataResponse(t))+ }+ getApiKey() {+ return this.apiKey_+ }+ getImagerySet() {+ return this.imagerySet_+ }+ handleImageryMetadataResponse(t) {+ if (+ 200 != t.statusCode ||+ "OK" != t.statusDescription ||+ "ValidCredentials" != t.authenticationResultCode ||+ 1 != t.resourceSets.length ||+ 1 != t.resourceSets[0].resources.length+ )+ return void this.setState("error")+ const e = t.resourceSets[0].resources[0],+ i = -1 == this.maxZoom_ ? e.zoomMax : this.maxZoom_,+ n = Qu(this.getProjection()),+ r = this.hidpi_ ? 2 : 1,+ s = e.imageWidth == e.imageHeight ? e.imageWidth / r : [e.imageWidth / r, e.imageHeight / r],+ o = Ku({ extent: n, minZoom: e.zoomMin, maxZoom: i, tileSize: s })+ this.tileGrid = o+ const a = this.culture_,+ l = this.hidpi_,+ h = this.placeholderTiles_+ if (+ ((this.tileUrlFunction = cd(+ e.imageUrlSubdomains.map(function (t) {+ const i = [0, 0, 0],+ n = e.imageUrl.replace("{subdomain}", t).replace("{culture}", a)+ return function (t, e, r) {+ if (!t) return+ Nu(t[0], t[1], t[2], i)+ const s = new URL(n.replace("{quadkey}", Cd(i))),+ o = s.searchParams+ return (+ l && (o.set("dpi", "d1"), o.set("device", "mobile")),+ !0 === h ? o.delete("n") : !1 === h && o.set("n", "z"),+ s.toString()+ )+ }+ })+ )),+ e.imageryProviders)+ ) {+ const t = Ln(En("EPSG:4326"), this.getProjection())+ this.setAttributions((i) => {+ const n = [],+ r = i.viewState,+ s = this.getTileGrid(),+ o = s.getZForResolution(r.resolution, this.zDirection),+ a = s.getTileCoordForCoordAndZ(r.center, o)[0]+ return (+ e.imageryProviders.map(function (e) {+ let r = !1+ const s = e.coverageAreas+ for (let e = 0, n = s.length; e < n; ++e) {+ const n = s[e]+ if (a >= n.zoomMin && a <= n.zoomMax) {+ const e = n.bbox+ if (Se(be([e[1], e[0], e[3], e[2]], t), i.extent)) {+ r = !0+ break+ }+ }+ }+ r && n.push(e.attribution)+ }),+ n.push(+ '<a class="ol-attribution-bing-tos" href="https://www.microsoft.com/maps/product/terms.html" target="_blank">Terms of Use</a>'+ ),+ n+ )+ })+ }+ this.setState("ready")+ }+ }),+ (bP.source.BingMaps.quadKey = Cd),+ (bP.source.CartoDB = class extends bd {+ constructor(t) {+ super({+ attributions: t.attributions,+ cacheSize: t.cacheSize,+ crossOrigin: t.crossOrigin,+ maxZoom: void 0 !== t.maxZoom ? t.maxZoom : 18,+ minZoom: t.minZoom,+ projection: t.projection,+ transition: t.transition,+ wrapX: t.wrapX,+ zDirection: t.zDirection+ }),+ (this.account_ = t.account),+ (this.mapId_ = t.map || ""),+ (this.config_ = t.config || {}),+ (this.templateCache_ = {}),+ this.initializeMap_()+ }+ getConfig() {+ return this.config_+ }+ updateConfig(t) {+ Object.assign(this.config_, t), this.initializeMap_()+ }+ setConfig(t) {+ ;(this.config_ = t || {}), this.initializeMap_()+ }+ initializeMap_() {+ const t = JSON.stringify(this.config_)+ if (this.templateCache_[t]) return void this.applyTemplate_(this.templateCache_[t])+ let e = "https://" + this.account_ + ".carto.com/api/v1/map"+ this.mapId_ && (e += "/named/" + this.mapId_)+ const i = new XMLHttpRequest()+ i.addEventListener("load", this.handleInitResponse_.bind(this, t)),+ i.addEventListener("error", this.handleInitError_.bind(this)),+ i.open("POST", e),+ i.setRequestHeader("Content-type", "application/json"),+ i.send(JSON.stringify(this.config_))+ }+ handleInitResponse_(t, e) {+ const i = e.target+ if (!i.status || (i.status >= 200 && i.status < 300)) {+ let e+ try {+ e = JSON.parse(i.responseText)+ } catch {+ return void this.setState("error")+ }+ this.applyTemplate_(e), (this.templateCache_[t] = e), this.setState("ready")+ } else this.setState("error")+ }+ handleInitError_(t) {+ this.setState("error")+ }+ applyTemplate_(t) {+ const e =+ "https://" + t.cdn_url.https + "/" + this.account_ + "/api/v1/map/" + t.layergroupid + "/{z}/{x}/{y}.png"+ this.setUrl(e)+ }+ }),+ (bP.source.Cluster = class extends qd {+ 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 (+ Mt(+ !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(n, this.boundRefresh_),+ (this.source = t),+ t && t.addEventListener(n, 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 r = 0, s = i.length; r < s; r++) {+ const s = i[r]+ if (!(z(s) in n)) {+ const i = this.geometryFunction(s)+ if (i) {+ Jt(i.getCoordinates(), t), zt(t, e, t)+ const r = this.source.getFeaturesInExtent(t).filter(function (t) {+ const e = z(t)+ return !(e in n) && ((n[e] = !0), !0)+ })+ this.features.push(this.createCluster(r, t))+ }+ }+ }+ }+ createCluster(t, e) {+ const i = [0, 0]+ for (let e = t.length - 1; e >= 0; --e) {+ const n = this.geometryFunction(t[e])+ n ? Qe(i, n.getCoordinates()) : t.splice(e, 1)+ }+ oi(i, 1 / t.length)+ const n = de(e),+ r = this.interpolationRatio,+ s = new Wr([i[0] * (1 - r) + n[0] * r, i[1] * (1 - r) + n[1] * r])+ return this.createCustomCluster_ ? this.createCustomCluster_(s, t) : new At({ geometry: s, features: t })+ }+ }),+ (bP.source.DataTile = dg),+ (bP.source.GeoTIFF = Cg),+ (bP.source.GeoZarr = class extends dg {+ constructor(t) {+ super({+ state: "loading",+ tileGrid: null,+ projection: t.projection || null,+ transition: t.transition,+ wrapX: t.wrapX+ }),+ (this.url_ = t.url),+ (this.group_ = t.group),+ (this.error_ = null),+ (this.root_ = null),+ (this.consolidatedMetadata_ = null),+ (this.bands_ = t.bands),+ (this.bandsByLevel_ = null),+ this.fillValue_,+ (this.resampleMethod_ = t.resample || "linear"),+ (this.bandCount = this.bands_.length),+ this.setLoader(this.loadTile_.bind(this)),+ this.tileGrid,+ this.configure_()+ .then(() => {+ this.setState("ready")+ })+ .catch((t) => {+ ;(this.error_ = t), this.setState("error")+ })+ }+ async configure_() {+ const t = new zarr.FetchStore(this.url_)+ this.root_ = await zarr.open(t, { kind: "group" })+ try {+ this.consolidatedMetadata_ = JSON.parse(+ new TextDecoder().decode(await t.get(this.root_.resolve("zarr.json").path))+ ).consolidated_metadata.metadata+ } catch {}+ const e = (await zarr.open(this.root_.resolve(this.group_), { kind: "group" })).attrs+ if (+ "zarr_conventions" in e &&+ Array.isArray(e.zarr_conventions) &&+ r_.every((t) => e.zarr_conventions.find((e) => e.uuid === t)) &&+ "layout" in e.multiscales+ ) {+ const {+ tileGrid: t,+ projection: i,+ bandsByLevel: n,+ fillValue: r+ } = (function (t, e, i, n) {+ const r = t.multiscales,+ s = t["spatial:bbox"],+ o = En(t["proj:code"]),+ a = [],+ l = e ? {} : null+ let h+ for (const t of r.layout) {+ const r = t["spatial:transform"],+ s = r[0],+ o = [r[2], r[5]],+ c = t.asset+ if ((a.push({ matrixId: c, resolution: s, origin: o }), e)) {+ const t = []+ for (const r of n) {+ const n = e[`${i}/${c}/${r}`]+ n && (t.push(r), void 0 === h && (h = n.fill_value))+ }+ l[c] = t+ }+ }+ a.sort((t, e) => e.resolution - t.resolution)+ const c = new $u({+ extent: s,+ origins: a.map((t) => t.origin),+ resolutions: a.map((t) => t.resolution),+ matrixIds: a.map((t) => t.matrixId)+ })+ return { tileGrid: c, projection: o, bandsByLevel: l, fillValue: h }+ })(e, this.consolidatedMetadata_, this.group_, this.bands_)+ ;(this.bandsByLevel_ = n), (this.tileGrid = t), (this.projection = i), (this.fillValue_ = r)+ }+ if ("tile_matrix_set" in e.multiscales) {+ const { tileGrid: t, projection: i } = (function (t) {+ const e = t.multiscales,+ i = e.tile_matrix_set,+ n = e.tile_matrix_limits,+ r = i.tileMatrices.length,+ s = new Array(r)+ let o = !1+ for (let t = 0; t < r; t += 1) {+ const e = i.tileMatrices[t],+ r = e.id+ ;(e.tileWidth > 512 || e.tileHeight > 512) && (o = !0), (s[t] = n[r])+ }+ const a = _f({}, i, void 0, s)+ let l = a.grid+ o &&+ (l = new $u({+ tileSize: 512,+ extent: l.getExtent(),+ origins: l.getOrigins(),+ resolutions: l.getResolutions(),+ matrixIds: l.getMatrixIds()+ }))+ return { tileGrid: l, projection: a.projection }+ })(e)+ ;(this.tileGrid = t), this.projection || (this.projection = i)+ }+ if (!this.tileGrid) throw new Error("Could not determine tile grid")+ const i = this.tileGrid.getExtent()+ setTimeout(() => {+ this.viewResolver({+ showFullExtent: !0,+ projection: this.projection,+ resolutions: this.tileGrid.getResolutions(),+ center: jn(de(i), this.projection),+ extent: Bn(i, this.projection),+ zoom: 1+ })+ })+ }+ async loadTile_(t, e, i, n) {+ const r = this.tileGrid.getResolutions(),+ s = this.tileGrid.getResolution(t),+ o = this.tileGrid.getTileCoordExtent([t, e, i]),+ a = [],+ l = []+ for (const e of this.bands_) {+ let i,+ n,+ h = 0+ if (this.bandsByLevel_)+ for (let t = 0; t < r.length; t += 1) {+ const o = r[t]+ if (i && o < s) break+ const a = this.tileGrid.getMatrixId(t)+ this.bandsByLevel_[a].includes(e) && ((i = a), (n = this.tileGrid.getResolution(t)), (h = t))+ }+ else (i = this.tileGrid.getMatrixId(t)), (n = s), (h = t)+ if (!i || !n) throw new Error(`Could not find available resolution for band ${e}`)+ const c = this.tileGrid.getOrigin(h),+ u = Math.round((o[0] - c[0]) / n),+ d = Math.round((o[2] - c[0]) / n),+ g = Math.round((c[1] - o[3]) / n),+ f = Math.round((c[1] - o[1]) / n),+ p = `${this.group_}/${i}/${e}`,+ _ = await zarr.open(this.root_.resolve(p), { kind: "array" })+ a.push(zarr.get(_, [zarr.slice(g, f), zarr.slice(u, d)])), l.push(n)+ }+ const h = await Promise.all(a),+ [c, u] = Wl(this.tileGrid.getTileSize(t))+ return (function (t, e, i, n, r, s, o) {+ const a = t.length,+ l = new Float32Array(i * n * a)+ for (let h = 0; h < n; h++)+ for (let n = 0; n < i; n++)+ for (let c = 0; c < a; ++c) {+ const u = t[c],+ d = u.shape[0],+ g = u.shape[1],+ f = r / e[c]+ let p = o+ if (1 === f) h < d && n < g && (p = u.data[h * g + n])+ else {+ const t = h * f,+ e = n * f+ switch (s) {+ case "nearest": {+ const i = Math.round(t),+ n = Math.round(e)+ i < d && n < g && (p = u.data[i * g + n])+ break+ }+ case "linear": {+ const i = Math.floor(t),+ n = Math.floor(e)+ if (i < d && n < g) {+ const r = Math.min(i + 1, d - 1),+ s = Math.min(n + 1, g - 1),+ o = e - n,+ a = t - i+ p =+ (1 - a) * ((1 - o) * u.data[i * g + n] + o * u.data[i * g + s]) ++ a * ((1 - o) * u.data[r * g + n] + o * u.data[r * g + s])+ }+ break+ }+ default:+ throw new Error(`Unsupported resample method: ${s}`)+ }+ }+ isNaN(p) && (p = o), (l[a * (h * i + n) + c] = p)+ }+ return l+ })(h, l, c, u, s, this.resampleMethod_, this.fillValue_ || 0)+ }+ }),+ (bP.source.Google = class extends wd {+ constructor(t) {+ const e = !!t.highDpi+ super({+ attributionsCollapsible: t.attributionsCollapsible,+ cacheSize: t.cacheSize,+ crossOrigin: "anonymous",+ interpolate: t.interpolate,+ projection: "EPSG:3857",+ reprojectionErrorThreshold: t.reprojectionErrorThreshold,+ state: "loading",+ tileLoadFunction: t.tileLoadFunction,+ tilePixelRatio: e ? 2 : 1,+ wrapX: void 0 === t.wrapX || t.wrapX,+ transition: t.transition,+ zDirection: t.zDirection+ }),+ (this.apiKey_ = t.key),+ (this.error_ = null)+ const i = { mapType: t.mapType || "roadmap", language: t.language || "en-US", region: t.region || "US" }+ t.imageFormat && (i.imageFormat = t.imageFormat),+ t.scale && (i.scale = t.scale),+ e && (i.highDpi = !0),+ t.layerTypes && (i.layerTypes = t.layerTypes),+ t.styles && (i.styles = t.styles),+ !0 === t.overlay && (i.overlay = !0),+ t.apiOptions && (i.apiOptions = t.apiOptions),+ (this.sessionTokenRequest_ = i),+ this.sessionTokenValue_,+ this.sessionRefreshId_,+ this.previousViewportAttribution_,+ this.previousViewportExtent_+ const n = t.url || "https://tile.googleapis.com/"+ ;(this.createSessionUrl_ = n + "v1/createSession"),+ (this.tileUrl_ = n + "v1/2dtiles"),+ (this.attributionUrl_ = n + "tile/v1/viewport"),+ this.createSession_()+ }+ getError() {+ return this.error_+ }+ fetchSessionToken(t, e) {+ return fetch(t, e)+ }+ async createSession_() {+ const t = this.createSessionUrl_ + "?key=" + this.apiKey_,+ e = {+ method: "POST",+ headers: { "Content-Type": "application/json" },+ body: JSON.stringify(this.sessionTokenRequest_)+ },+ i = await this.fetchSessionToken(t, e)+ if (!i.ok) {+ try {+ const t = await i.json()+ this.error_ = new Error(t.error.message)+ } catch {+ this.error_ = new Error("Error fetching session token")+ }+ return void this.setState("error")+ }+ const n = await i.json(),+ r = this.getTilePixelRatio(1),+ s = [n.tileWidth / r, n.tileHeight / r]+ this.tileGrid = Ku({ extent: Qu(this.getProjection()), maxZoom: 22, tileSize: s })+ const o = n.session+ this.sessionTokenValue_ = o+ const a = this.apiKey_,+ l = this.tileUrl_+ this.tileUrlFunction = function (t, e, i) {+ const n = t[0],+ r = t[1],+ s = t[2]+ return `${l}/${n}/${r}/${s}?session=${o}&key=${a}`+ }+ const h = 1e3 * parseInt(n.expiry, 10),+ c = Math.max(h - Date.now() - 6e4, 1)+ ;(this.sessionRefreshId_ = setTimeout(() => this.createSession_(), c)),+ this.setAttributions(this.fetchAttributions_.bind(this)),+ this.setState("ready")+ }+ async fetchAttributions_(t) {+ if (t.viewHints[co] || t.viewHints[uo] || t.animate) return this.previousViewportAttribution_+ const [e, i] = In(ce(t.extent), t.viewState.projection),+ [n, r] = In(xe(t.extent), t.viewState.projection),+ s = `zoom=${this.getTileGrid().getZForResolution(+ t.viewState.resolution,+ this.zDirection+ )}&north=${r}&south=${i}&east=${n}&west=${e}`+ if (this.previousViewportExtent_ == s) return this.previousViewportAttribution_+ this.previousViewportExtent_ = s+ const o = this.sessionTokenValue_,+ a = this.apiKey_,+ l = `${this.attributionUrl_}?session=${o}&key=${a}&${s}`+ return (+ (this.previousViewportAttribution_ = await fetch(l)+ .then((t) => t.json())+ .then((t) => t.copyright)),+ this.previousViewportAttribution_+ )+ }+ disposeInternal() {+ clearTimeout(this.sessionRefreshId_), super.disposeInternal()+ }+ }),+ (bP.source.IIIF = class extends wd {+ constructor(t) {+ const e = t || {}+ let i = e.url || ""+ i += i.lastIndexOf("/") === i.length - 1 || "" === i ? "" : "/"+ const n = e.version || Rg,+ r = e.sizes || [],+ s = e.size+ Mt(+ null != s && Array.isArray(s) && 2 == s.length && !isNaN(s[0]) && s[0] > 0 && !isNaN(s[1]) && s[1] > 0,+ "Missing or invalid `size`"+ )+ const o = s[0],+ a = s[1],+ l = e.tileSize,+ h = e.tilePixelRatio || 1,+ c = e.format || "jpg",+ u = e.quality || (e.version == bg ? "native" : "default")+ let d = e.resolutions || []+ const g = e.supports || [],+ f = e.extent || [0, -a, o, 0],+ p = null != r && Array.isArray(r) && r.length > 0,+ _ =+ void 0 !== l &&+ (("number" == typeof l && Number.isInteger(l) && l > 0) || (Array.isArray(l) && l.length > 0)),+ m =+ null != g &&+ Array.isArray(g) &&+ (g.includes("regionByPx") || g.includes("regionByPct")) &&+ (g.includes("sizeByWh") || g.includes("sizeByH") || g.includes("sizeByW") || g.includes("sizeByPct"))+ let y, x, v+ if (+ (d.sort(function (t, e) {+ return e - t+ }),+ _ || m)+ )+ if (+ (null != l &&+ ("number" == typeof l && Number.isInteger(l) && l > 0+ ? ((y = l), (x = l))+ : Array.isArray(l) &&+ l.length > 0 &&+ ((1 == l.length || (null == l[1] && Number.isInteger(l[0]))) && ((y = l[0]), (x = l[0])),+ 2 == l.length &&+ (Number.isInteger(l[0]) && Number.isInteger(l[1])+ ? ((y = l[0]), (x = l[1]))+ : null == l[0] && Number.isInteger(l[1]) && ((y = l[1]), (x = l[1]))))),+ (void 0 !== y && void 0 !== x) || ((y = Co), (x = Co)),+ 0 == d.length)+ ) {+ v = Math.max(Math.ceil(Math.log(o / y) / Math.LN2), Math.ceil(Math.log(a / x) / Math.LN2))+ for (let t = v; t >= 0; t--) d.push(Math.pow(2, t))+ } else {+ const t = Math.max(...d)+ v = Math.round(Math.log(t) / Math.LN2)+ }+ else if (((y = o), (x = a), (d = []), p)) {+ r.sort(function (t, e) {+ return t[0] - e[0]+ }),+ (v = -1)+ const t = []+ for (let e = 0; e < r.length; e++) {+ const i = o / r[e][0]+ d.length > 0 && d[d.length - 1] == i ? t.push(e) : (d.push(i), v++)+ }+ if (t.length > 0) for (let e = 0; e < t.length; e++) r.splice(t[e] - e, 1)+ } else d.push(1), r.push([o, a]), (v = 0)+ const S = new Vu({ tileSize: [y, x], extent: f, origin: ye(f), resolutions: d }),+ E = Og.bind(+ null,+ Wl(l || 256).map(function (t) {+ return t * h+ })+ )+ super({+ attributions: e.attributions,+ attributionsCollapsible: e.attributionsCollapsible,+ cacheSize: e.cacheSize,+ crossOrigin: e.crossOrigin,+ interpolate: e.interpolate,+ projection: e.projection,+ reprojectionErrorThreshold: e.reprojectionErrorThreshold,+ state: e.state,+ tileClass: E,+ tileGrid: S,+ tilePixelRatio: e.tilePixelRatio,+ tileUrlFunction: function (t, e, s) {+ let l, h+ const f = t[0]+ if (f > v) return+ const S = t[1],+ E = t[2],+ w = d[f]+ if (+ !(+ void 0 === S ||+ void 0 === E ||+ void 0 === w ||+ S < 0 ||+ Math.ceil(o / w / y) <= S ||+ E < 0 ||+ Math.ceil(a / w / x) <= E+ )+ ) {+ if (m || _) {+ const t = S * y * w,+ e = E * x * w+ let i = y * w,+ r = x * w,+ s = y,+ c = x+ if (+ (t + i > o && (i = o - t),+ e + r > a && (r = a - e),+ t + y * w > o && (s = Math.floor((o - t + w - 1) / w)),+ e + x * w > a && (c = Math.floor((a - e + w - 1) / w)),+ 0 == t && i == o && 0 == e && r == a)+ )+ l = "full"+ else if (!m || g.includes("regionByPx")) l = t + "," + e + "," + i + "," + r+ else if (g.includes("regionByPct")) {+ l =+ "pct:" ++ Dg((t / o) * 100) ++ "," ++ Dg((e / a) * 100) ++ "," ++ Dg((i / o) * 100) ++ "," ++ Dg((r / a) * 100)+ }+ n != Pg || (m && !g.includes("sizeByWh"))+ ? !m || g.includes("sizeByW")+ ? (h = s + ",")+ : g.includes("sizeByH")+ ? (h = "," + c)+ : g.includes("sizeByWh")+ ? (h = s + "," + c)+ : g.includes("sizeByPct") && (h = "pct:" + Dg(100 / w))+ : (h = s + "," + c)+ } else if (((l = "full"), p)) {+ const t = r[f][0],+ e = r[f][1]+ h = n == Pg ? (t == o && e == a ? "max" : t + "," + e) : t == o ? "full" : t + ","+ } else h = n == Pg ? "max" : "full"+ return i + l + "/" + h + "/0/" + u + "." + c+ }+ },+ transition: e.transition+ }),+ (this.zDirection = e.zDirection)+ }+ }),+ (bP.source.Image = Bg),+ (bP.source.Image.ImageSourceEvent = Ug),+ (bP.source.Image.defaultImageLoadFunction = zg),+ (bP.source.Image.getRequestExtent = Xg),+ (bP.source.ImageArcGISRest = class extends Bg {+ constructor(t) {+ super({+ attributions: (t = t || {}).attributions,+ interpolate: t.interpolate,+ projection: t.projection,+ resolutions: t.resolutions+ }),+ (this.crossOrigin_ = void 0 !== t.crossOrigin ? t.crossOrigin : null),+ (this.referrerPolicy_ = t.referrerPolicy),+ (this.hidpi_ = void 0 === t.hidpi || t.hidpi),+ (this.url_ = t.url),+ (this.imageLoadFunction_ = void 0 !== t.imageLoadFunction ? t.imageLoadFunction : zg),+ (this.params_ = Object.assign({}, t.params)),+ (this.imageSize_ = [0, 0]),+ (this.renderedRevision_ = 0),+ (this.ratio_ = void 0 !== t.ratio ? t.ratio : 1.5),+ (this.loaderProjection_ = null)+ }+ getParams() {+ return this.params_+ }+ getImageInternal(t, e, i, n) {+ return void 0 === this.url_+ ? null+ : ((this.loader && this.loaderProjection_ === n) ||+ ((this.loaderProjection_ = n),+ (this.loader = $g({+ crossOrigin: this.crossOrigin_,+ referrerPolicy: this.referrerPolicy_,+ params: this.params_,+ projection: n,+ hidpi: this.hidpi_,+ url: this.url_,+ ratio: this.ratio_,+ load: (t, e) => (this.image.setImage(t), this.imageLoadFunction_(this.image, e), js(t))+ }))),+ super.getImageInternal(t, e, i, n))+ }+ getImageLoadFunction() {+ return this.imageLoadFunction_+ }+ getUrl() {+ return this.url_+ }+ setImageLoadFunction(t) {+ ;(this.imageLoadFunction_ = t), this.changed()+ }+ setUrl(t) {+ t != this.url_ && ((this.url_ = t), (this.loader = null), this.changed())+ }+ setParams(t) {+ ;(this.params_ = Object.assign({}, t)), this.changed()+ }+ updateParams(t) {+ Object.assign(this.params_, t), this.changed()+ }+ changed() {+ ;(this.image = null), super.changed()+ }+ }),+ (bP.source.ImageCanvas = class extends Bg {+ constructor(t) {+ super({+ attributions: (t = t || {}).attributions,+ interpolate: t.interpolate,+ projection: t.projection,+ resolutions: t.resolutions,+ state: t.state+ }),+ (this.canvasFunction_ = t.canvasFunction),+ (this.canvas_ = null),+ (this.renderedRevision_ = 0),+ (this.ratio_ = void 0 !== t.ratio ? t.ratio : 1.5)+ }+ getImageInternal(t, e, i, n) {+ e = this.findNearestResolution(e)+ let r = this.canvas_+ if (+ r &&+ this.renderedRevision_ == this.getRevision() &&+ r.getResolution() == e &&+ r.getPixelRatio() == i &&+ Wt(r.getExtent(), t)+ )+ return r+ Te((t = t.slice()), this.ratio_)+ const s = [(ve(t) / e) * i, (_e(t) / e) * i],+ o = this.canvasFunction_.call(this, t, e, i, s, n)+ return o && (r = new Us(t, e, i, o)), (this.canvas_ = r), (this.renderedRevision_ = this.getRevision()), r+ }+ }),+ (bP.source.ImageMapGuide = class extends Bg {+ constructor(t) {+ super({ interpolate: t.interpolate, projection: t.projection, resolutions: t.resolutions }),+ (this.crossOrigin_ = void 0 !== t.crossOrigin ? t.crossOrigin : null),+ (this.referrerPolicy_ = t.referrerPolicy),+ (this.displayDpi_ = void 0 !== t.displayDpi ? t.displayDpi : 96),+ (this.params_ = Object.assign({}, t.params)),+ (this.url_ = t.url),+ (this.imageLoadFunction_ = void 0 !== t.imageLoadFunction ? t.imageLoadFunction : zg),+ (this.hidpi_ = void 0 === t.hidpi || t.hidpi),+ (this.metersPerUnit_ = void 0 !== t.metersPerUnit ? t.metersPerUnit : 1),+ (this.ratio_ = void 0 !== t.ratio ? t.ratio : 1),+ (this.useOverlay_ = void 0 !== t.useOverlay && t.useOverlay),+ (this.renderedRevision_ = 0),+ (this.loaderProjection_ = null)+ }+ getParams() {+ return this.params_+ }+ getImageInternal(t, e, i, n) {+ return void 0 === this.url_+ ? null+ : ((this.loader && this.loaderProjection_ === n) ||+ ((this.loaderProjection_ = n),+ (this.loader = Zg({+ crossOrigin: this.crossOrigin_,+ referrerPolicy: this.referrerPolicy_,+ params: this.params_,+ hidpi: this.hidpi_,+ metersPerUnit: this.metersPerUnit_,+ url: this.url_,+ useOverlay: this.useOverlay_,+ ratio: this.ratio_,+ load: (t, e) => (this.image.setImage(t), this.imageLoadFunction_(this.image, e), js(t))+ }))),+ super.getImageInternal(t, e, i, n))+ }+ getImageLoadFunction() {+ return this.imageLoadFunction_+ }+ setParams(t) {+ ;(this.params_ = Object.assign({}, t)), this.changed()+ }+ updateParams(t) {+ Object.assign(this.params_, t), this.changed()+ }+ setImageLoadFunction(t) {+ ;(this.imageLoadFunction_ = t), this.changed()+ }+ changed() {+ ;(this.image = null), super.changed()+ }+ }),+ (bP.source.ImageStatic = class extends Bg {+ constructor(t) {+ const e = void 0 !== t.crossOrigin ? t.crossOrigin : null,+ i = void 0 !== t.imageLoadFunction ? t.imageLoadFunction : zg+ super({ attributions: t.attributions, interpolate: t.interpolate, projection: En(t.projection) }),+ (this.url_ = t.url),+ (this.imageExtent_ = t.imageExtent),+ (this.image = null),+ (this.image = new Ds(+ this.imageExtent_,+ void 0,+ 1,+ Yg({+ url: t.url,+ imageExtent: t.imageExtent,+ crossOrigin: e,+ referrerPolicy: t.referrerPolicy,+ load: (t, e) => (this.image.setImage(t), i(this.image, e), js(t))+ })+ )),+ this.image.addEventListener(n, this.handleImageChange.bind(this))+ }+ getImageExtent() {+ return this.imageExtent_+ }+ getImageInternal(t, e, i, n) {+ return Se(t, this.image.getExtent()) ? this.image : null+ }+ getUrl() {+ return this.url_+ }+ }),+ (bP.source.ImageTile = ef),+ (bP.source.ImageWMS = class extends Bg {+ constructor(t) {+ super({+ attributions: (t = t || {}).attributions,+ interpolate: t.interpolate,+ projection: t.projection,+ resolutions: t.resolutions+ }),+ (this.crossOrigin_ = void 0 !== t.crossOrigin ? t.crossOrigin : null),+ (this.referrerPolicy_ = t.referrerPolicy),+ (this.url_ = t.url),+ (this.imageLoadFunction_ = void 0 !== t.imageLoadFunction ? t.imageLoadFunction : zg),+ (this.params_ = Object.assign({}, t.params)),+ (this.serverType_ = t.serverType),+ (this.hidpi_ = void 0 === t.hidpi || t.hidpi),+ (this.renderedRevision_ = 0),+ (this.ratio_ = void 0 !== t.ratio ? t.ratio : 1.5),+ (this.loaderProjection_ = null)+ }+ getFeatureInfoUrl(t, e, i, n) {+ const r = En(i),+ s = this.getProjection()+ s && s !== r && ((e = Lu(s, r, t, e)), (t = On(t, r, s)))+ return hf({ url: this.url_, params: { ...this.params_, ...n }, projection: s || r }, t, e)+ }+ getLegendUrl(t, e) {+ return cf({ url: this.url_, params: { ...this.params_, ...e } }, t)+ }+ getParams() {+ return this.params_+ }+ getImageInternal(t, e, i, n) {+ return void 0 === this.url_+ ? null+ : ((this.loader && this.loaderProjection_ === n) ||+ ((this.loaderProjection_ = n),+ (this.loader = lf({+ crossOrigin: this.crossOrigin_,+ referrerPolicy: this.referrerPolicy_,+ params: this.params_,+ projection: n,+ serverType: this.serverType_,+ hidpi: this.hidpi_,+ url: this.url_,+ ratio: this.ratio_,+ load: (t, e) => (this.image.setImage(t), this.imageLoadFunction_(this.image, e), js(t))+ }))),+ super.getImageInternal(t, e, i, n))+ }+ getImageLoadFunction() {+ return this.imageLoadFunction_+ }+ getUrl() {+ return this.url_+ }+ setImageLoadFunction(t) {+ ;(this.imageLoadFunction_ = t), this.changed()+ }+ setUrl(t) {+ t != this.url_ && ((this.url_ = t), (this.loader = null), this.changed())+ }+ setParams(t) {+ ;(this.params_ = Object.assign({}, t)), (this.loader = null), this.changed()+ }+ updateParams(t) {+ Object.assign(this.params_, t), this.changed()+ }+ changed() {+ ;(this.image = null), super.changed()+ }+ }),+ (bP.source.OGCMap = class extends Bg {+ constructor(t) {+ super({+ attributions: (t = t || {}).attributions,+ interpolate: t.interpolate,+ projection: t.projection,+ resolutions: t.resolutions+ }),+ (this.crossOrigin_ = void 0 !== t.crossOrigin ? t.crossOrigin : null),+ (this.referrerPolicy_ = t.referrerPolicy),+ (this.url_ = t.url),+ (this.imageLoadFunction_ = void 0 !== t.imageLoadFunction ? t.imageLoadFunction : zg),+ (this.params_ = Object.assign({}, t.params)),+ (this.hidpi_ = void 0 === t.hidpi || t.hidpi),+ (this.renderedRevision_ = 0),+ (this.ratio_ = void 0 !== t.ratio ? t.ratio : 1.5),+ (this.loaderProjection_ = null)+ }+ getParams() {+ return this.params_+ }+ getImageInternal(t, e, i, n) {+ return void 0 === this.url_+ ? null+ : ((this.loader && this.loaderProjection_ === n) ||+ ((this.loaderProjection_ = n),+ (this.loader = a_({+ crossOrigin: this.crossOrigin_,+ referrerPolicy: this.referrerPolicy_,+ params: this.params_,+ projection: n,+ hidpi: this.hidpi_,+ url: this.url_,+ ratio: this.ratio_,+ load: (t, e) => (this.image.setImage(t), this.imageLoadFunction_(this.image, e), js(t))+ }))),+ super.getImageInternal(t, e, i, n))+ }+ getImageLoadFunction() {+ return this.imageLoadFunction_+ }+ getUrl() {+ return this.url_+ }+ setImageLoadFunction(t) {+ ;(this.imageLoadFunction_ = t), this.changed()+ }+ setUrl(t) {+ t != this.url_ && ((this.url_ = t), (this.loader = null), this.changed())+ }+ setParams(t) {+ ;(this.params_ = Object.assign({}, t)), (this.loader = null), this.changed()+ }+ updateParams(t) {+ Object.assign(this.params_, t), this.changed()+ }+ changed() {+ ;(this.image = null), super.changed()+ }+ }),+ (bP.source.OGCMapTile = class extends wd {+ constructor(t) {+ super({+ attributions: t.attributions,+ cacheSize: t.cacheSize,+ crossOrigin: t.crossOrigin,+ referrerPolicy: t.referrerPolicy,+ interpolate: t.interpolate,+ projection: t.projection,+ reprojectionErrorThreshold: t.reprojectionErrorThreshold,+ state: "loading",+ tileLoadFunction: t.tileLoadFunction,+ wrapX: void 0 === t.wrapX || t.wrapX,+ transition: t.transition+ })+ mf({+ url: t.url,+ projection: this.getProjection(),+ mediaType: t.mediaType,+ context: t.context || null,+ collections: t.collections+ })+ .then(this.handleTileSetInfo_.bind(this))+ .catch(this.handleError_.bind(this))+ }+ handleTileSetInfo_(t) {+ ;(this.tileGrid = t.grid),+ (this.projection = t.projection),+ this.setTileUrlFunction(t.urlFunction, t.urlTemplate),+ this.setState("ready")+ }+ handleError_(t) {+ Ke(t), this.setState("error")+ }+ }),+ (bP.source.OGCVectorTile = class extends yf {+ constructor(t) {+ super({+ attributions: t.attributions,+ attributionsCollapsible: t.attributionsCollapsible,+ cacheSize: t.cacheSize,+ format: t.format,+ overlaps: t.overlaps,+ projection: t.projection,+ tileClass: t.tileClass,+ transition: t.transition,+ wrapX: t.wrapX,+ zDirection: t.zDirection,+ state: "loading"+ })+ mf({+ url: t.url,+ projection: this.getProjection(),+ mediaType: t.mediaType,+ supportedMediaTypes: t.format.supportedMediaTypes,+ context: t.context || null,+ collections: t.collections+ })+ .then(this.handleTileSetInfo_.bind(this))+ .catch(this.handleError_.bind(this))+ }+ handleTileSetInfo_(t) {+ ;(this.tileGrid = t.grid),+ (this.projection = t.projection),+ this.setTileUrlFunction(t.urlFunction, t.urlTemplate),+ this.setState("ready")+ }+ handleError_(t) {+ Ke(t), this.setState("error")+ }+ }),+ (bP.source.OSM = class extends bd {+ constructor(t) {+ let e+ e = void 0 !== (t = t || {}).attributions ? t.attributions : [vf]+ 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+ })+ }+ }),+ (bP.source.OSM.ATTRIBUTION = vf),+ (bP.source.Raster = Xf),+ (bP.source.Raster.Processor = jf),+ (bP.source.Raster.RasterSourceEvent = zf),+ (bP.source.SentinelHub = class extends dg {+ constructor(t) {+ const e = t || {}+ super({+ state: "loading",+ projection: e.projection,+ attributionsCollapsible: e.attributionsCollapsible,+ interpolate: e.interpolate,+ tileSize: e.tileSize || l_,+ wrapX: void 0 === e.wrapX || e.wrapX,+ transition: e.transition+ }),+ this.setLoader((t, e, i) => this.loadTile_(t, e, i, 1)),+ (this.error_ = null),+ (this.evalscript_ = ""),+ (this.inputData_ = null),+ (this.processUrl_ = e.url || "https://services.sentinel-hub.com/api/v1/process"),+ (this.token_ = ""),+ this.tokenRenewalId_,+ e.auth && this.setAuth(e.auth),+ e.data && this.setData(e.data),+ e.evalscript && this.setEvalscript(e.evalscript)+ }+ async setAuth(t) {+ if ((clearTimeout(this.tokenRenewalId_), "string" == typeof t))+ return (this.token_ = t), void this.fireWhenReady_()+ let e, i+ try {+ ;(e = await (async function (t) {+ const e = t.tokenUrl || "https://services.sentinel-hub.com/auth/realms/main/protocol/openid-connect/token",+ i = new URLSearchParams()+ i.append("grant_type", "client_credentials"),+ i.append("client_id", t.clientId),+ i.append("client_secret", t.clientSecret)+ const n = { method: "POST", headers: { "Content-Type": "application/x-www-form-urlencoded" }, body: i },+ r = await fetch(e, n)+ if (!r.ok) {+ if (401 === r.status) throw new Error("Bad client id or secret")+ throw new Error("Failed to get token")+ }+ return (await r.json()).access_token+ })(t)),+ (i = h_(e))+ } catch (t) {+ return (this.error_ = t), void this.setState("error")+ }+ this.token_ = e+ const n = 1e3 * i.exp,+ r = Math.max(n - Date.now() - 6e4, 1)+ ;(this.tokenRenewalId_ = setTimeout(() => this.setAuth(t), r)), this.fireWhenReady_()+ }+ setData(t) {+ ;(this.inputData_ = t), this.fireWhenReady_()+ }+ setEvalscript(t) {+ let e+ if ("string" == typeof t) e = t+ else+ try {+ e = (function (t) {+ return `//VERSION=${t.version || "3"}\n ${u_("setup", t.setup)}\n ${u_(+ "evaluatePixel",+ t.evaluatePixel+ )}\n ${u_("updateOutput", t.updateOutput)}\n `+ })(t)+ } catch (t) {+ return (this.error_ = t), void this.setState("error")+ }+ ;(this.evalscript_ = e), this.fireWhenReady_()+ }+ fireWhenReady_() {+ if (!this.token_ || !this.evalscript_ || !this.inputData_) return+ this.setKey(this.getKeyForConfig_())+ "ready" !== this.getState() ? this.setState("ready") : this.changed()+ }+ getKeyForConfig_() {+ return this.token_ + this.evalscript_ + JSON.stringify(this.inputData_)+ }+ async loadTile_(t, e, i, n) {+ const r = this.getTileGrid().getTileCoordExtent([t, e, i]),+ s = this.getTileSize(t),+ o = {+ input: { bounds: { bbox: r, properties: { crs: c_(this.getProjection()) } }, data: this.inputData_ },+ output: { width: s[0], height: s[1] },+ evalscript: this.evalscript_+ },+ a = {+ method: "POST",+ headers: {+ "Content-Type": "application/json",+ "Authorization": `Bearer ${this.token_}`,+ "Access-Control-Request-Headers": "Retry-After"+ },+ body: JSON.stringify(o),+ credentials: "include"+ },+ l = await fetch(this.processUrl_, a)+ if (!l.ok) {+ if (429 === l.status && n < 9) {+ const r = 500 * 2 ** n+ return await ((h = r), new Promise((t) => setTimeout(t, h))), this.loadTile_(e, i, t, n + 1)+ }+ throw new Error(`Failed to get tile: ${l.statusText}`)+ }+ var h+ return (async function (t) {+ const e = await t.blob()+ return new Promise((t, i) => {+ const n = new Image(),+ r = URL.createObjectURL(e)+ ;(n.onload = () => {+ URL.revokeObjectURL(r), t(n)+ }),+ (n.onerror = () => {+ URL.revokeObjectURL(r), i(new Error("Failed to load image"))+ }),+ (n.src = r)+ })+ })(l)+ }+ getError() {+ return this.error_+ }+ disposeInternal() {+ clearTimeout(this.tokenRenewalId_), super.disposeInternal()+ }+ }),+ (bP.source.SentinelHub.getProjectionIdentifier = c_),+ (bP.source.SentinelHub.parseTokenClaims = h_),+ (bP.source.SentinelHub.serializeFunction = u_),+ (bP.source.Source = pd),+ (bP.source.StadiaMaps = class extends bd {+ constructor(t) {+ const e = t.layer.indexOf("-"),+ i = -1 == e ? t.layer : t.layer.slice(0, e),+ n = Yf[i] || { minZoom: 0, maxZoom: 20, retina: !0 },+ r = Zf[t.layer],+ s = t.apiKey ? "?api_key=" + t.apiKey : "",+ o = n.retina && t.retina ? "@2x" : "",+ a =+ void 0 !== t.url+ ? t.url+ : "https://tiles.stadiamaps.com/tiles/" + t.layer + "/{z}/{x}/{y}" + o + "." + r.extension + s,+ l = [+ '© <a href="https://www.stadiamaps.com/" target="_blank">Stadia Maps</a>',+ '© <a href="https://openmaptiles.org/" target="_blank">OpenMapTiles</a>',+ vf+ ]+ t.layer.startsWith("stamen_") &&+ l.splice(1, 0, '© <a href="https://stamen.com/" target="_blank">Stamen Design</a>'),+ super({+ attributions: l,+ cacheSize: t.cacheSize,+ crossOrigin: "anonymous",+ interpolate: t.interpolate,+ maxZoom: void 0 !== t.maxZoom ? t.maxZoom : n.maxZoom,+ minZoom: void 0 !== t.minZoom ? t.minZoom : n.minZoom,+ reprojectionErrorThreshold: t.reprojectionErrorThreshold,+ tileLoadFunction: t.tileLoadFunction,+ transition: t.transition,+ url: a,+ tilePixelRatio: o ? 2 : 1,+ wrapX: t.wrapX,+ zDirection: t.zDirection+ })+ }+ }),+ (bP.source.Tile = md),+ (bP.source.Tile.TileSourceEvent = yd),+ (bP.source.TileArcGISRest = class extends wd {+ constructor(t) {+ super({+ attributions: (t = t || {}).attributions,+ cacheSize: t.cacheSize,+ crossOrigin: t.crossOrigin,+ referrerPolicy: t.referrerPolicy,+ interpolate: t.interpolate,+ projection: t.projection,+ reprojectionErrorThreshold: t.reprojectionErrorThreshold,+ tileGrid: t.tileGrid,+ tileLoadFunction: t.tileLoadFunction,+ url: t.url,+ urls: t.urls,+ wrapX: void 0 === t.wrapX || t.wrapX,+ transition: t.transition,+ zDirection: t.zDirection+ }),+ (this.params_ = Object.assign({}, t.params)),+ (this.hidpi_ = void 0 === t.hidpi || t.hidpi),+ (this.tmpExtent_ = [1 / 0, 1 / 0, -1 / 0, -1 / 0]),+ this.setKey(this.getKeyForParams_())+ }+ getKeyForParams_() {+ let t = 0+ const e = []+ for (const i in this.params_) e[t++] = i + "-" + this.params_[i]+ return e.join("/")+ }+ getParams() {+ return this.params_+ }+ getRequestUrl_(t, e, i, n, r, s) {+ const o = this.urls+ if (!o) return+ let a+ if (1 == o.length) a = o[0]+ else {+ a = o[De(Uu(t), o.length)]+ }+ return Vg(a, i, (this.tileGrid || this.getTileGridForProjection(r)).getResolution(t[0]), n, r, s)+ }+ getTilePixelRatio(t) {+ return this.hidpi_ ? t : 1+ }+ setParams(t) {+ ;(this.params_ = Object.assign({}, t)), this.setKey(this.getKeyForParams_())+ }+ updateParams(t) {+ Object.assign(this.params_, t), this.setKey(this.getKeyForParams_())+ }+ tileUrlFunction(t, e, i) {+ let n = this.getTileGrid()+ if ((n || (n = this.getTileGridForProjection(i)), n.getResolutions().length <= t[0])) return+ 1 == e || this.hidpi_ || (e = 1)+ const r = n.getTileCoordExtent(t, this.tmpExtent_)+ let s = Wl(n.getTileSize(t[0]), this.tmpSize)+ 1 != e && (s = $l(s, e, this.tmpSize))+ const o = { F: "image", FORMAT: "PNG32", TRANSPARENT: !0 }+ return Object.assign(o, this.params_), this.getRequestUrl_(t, s, r, e, i, o)+ }+ }),+ (bP.source.TileDebug = class extends ef {+ constructor(t) {+ const e = (t = t || {}).template || "z:{z} x:{x} y:{y}",+ i = t.source,+ r = t.color || "grey"+ super({ transition: 0, wrapX: void 0 !== t.wrapX ? t.wrapX : void 0 !== i ? i.getWrapX() : void 0 })+ const s = () => {+ ;(this.projection =+ void 0 !== t.projection ? En(t.projection) : void 0 !== i ? i.getProjection() : this.projection),+ (this.tileGrid = void 0 !== t.tileGrid ? t.tileGrid : void 0 !== i ? i.getTileGrid() : this.tileGrid),+ (this.zDirection = void 0 !== t.zDirection ? t.zDirection : void 0 !== i ? i.zDirection : this.zDirection),+ i instanceof dg && (this.transformMatrix = i.transformMatrix?.slice() || null)+ const n = this.tileGrid+ n &&+ this.setTileSizes(+ n.getResolutions().map((t, e) => Wl(n.getTileSize(e)).map((t) => Math.max(Math.floor(t), 1)))+ ),+ this.setLoader((t, i, n, s) => {+ const o = sd(e, t, i, n, s.maxY),+ [a, l] = this.getTileSize(t),+ h = ft(a, l)+ return (+ (h.strokeStyle = r),+ h.strokeRect(0.5, 0.5, a + 0.5, l + 0.5),+ (h.fillStyle = r),+ (h.strokeStyle = "white"),+ (h.textAlign = "center"),+ (h.textBaseline = "middle"),+ (h.font = "24px sans-serif"),+ (h.lineWidth = 4),+ h.strokeText(o, a / 2, l / 2, a),+ h.fillText(o, a / 2, l / 2, a),+ Promise.resolve(h.canvas)+ )+ }),+ this.setState("ready")+ }+ if (void 0 === i || "ready" === i.getState()) s()+ else {+ const t = () => {+ "ready" === i.getState() && (i.removeEventListener(n, t), s())+ }+ i.addEventListener(n, t)+ }+ }+ }),+ (bP.source.TileImage = wd),+ (bP.source.TileImage.defaultTileLoadFunction = Td),+ (bP.source.TileJSON = class extends wd {+ constructor(t) {+ if (+ (super({+ attributions: t.attributions,+ cacheSize: t.cacheSize,+ crossOrigin: t.crossOrigin,+ interpolate: t.interpolate,+ projection: En("EPSG:3857"),+ reprojectionErrorThreshold: t.reprojectionErrorThreshold,+ state: "loading",+ tileLoadFunction: t.tileLoadFunction,+ wrapX: void 0 === t.wrapX || t.wrapX,+ transition: t.transition,+ zDirection: t.zDirection+ }),+ (this.tileJSON_ = null),+ (this.tileSize_ = t.tileSize),+ t.url)+ )+ if (t.jsonp) du(t.url, this.handleTileJSONResponse.bind(this), this.handleTileJSONError.bind(this))+ else {+ const e = new XMLHttpRequest()+ e.addEventListener("load", this.onXHRLoad_.bind(this)),+ e.addEventListener("error", this.onXHRError_.bind(this)),+ e.open("GET", t.url),+ e.send()+ }+ else {+ if (!t.tileJSON) throw new Error("Either `url` or `tileJSON` options must be provided")+ this.handleTileJSONResponse(t.tileJSON)+ }+ }+ onXHRLoad_(t) {+ const e = t.target+ if (!e.status || (e.status >= 200 && e.status < 300)) {+ let t+ try {+ t = JSON.parse(e.responseText)+ } catch {+ return void this.handleTileJSONError()+ }+ this.handleTileJSONResponse(t)+ } else this.handleTileJSONError()+ }+ onXHRError_(t) {+ this.handleTileJSONError()+ }+ getTileJSON() {+ return this.tileJSON_+ }+ handleTileJSONResponse(t) {+ const e = En("EPSG:4326"),+ i = this.getProjection()+ let n+ if (void 0 !== t.bounds) {+ const r = Ln(e, i)+ n = be(t.bounds, r)+ }+ const r = Qu(i),+ s = t.minzoom || 0,+ o = Ku({ extent: r, maxZoom: t.maxzoom || 22, minZoom: s, tileSize: this.tileSize_ })+ if (((this.tileGrid = o), (this.tileUrlFunction = hd(t.tiles, o)), t.attribution && !this.getAttributions())) {+ const e = void 0 !== n ? n : r+ this.setAttributions(function (i) {+ return Se(e, i.extent) ? [t.attribution] : null+ })+ }+ ;(this.tileJSON_ = t), this.setState("ready")+ }+ handleTileJSONError() {+ this.setState("error")+ }+ }),+ (bP.source.TileWMS = class extends wd {+ constructor(t) {+ t = t || {}+ const e = Object.assign({}, t.params)+ super({+ attributions: t.attributions,+ attributionsCollapsible: t.attributionsCollapsible,+ cacheSize: t.cacheSize,+ crossOrigin: t.crossOrigin,+ interpolate: t.interpolate,+ projection: t.projection,+ reprojectionErrorThreshold: t.reprojectionErrorThreshold,+ tileClass: t.tileClass,+ tileGrid: t.tileGrid,+ tileLoadFunction: t.tileLoadFunction,+ url: t.url,+ urls: t.urls,+ wrapX: void 0 === t.wrapX || t.wrapX,+ transition: t.transition,+ zDirection: t.zDirection+ }),+ (this.gutter_ = void 0 !== t.gutter ? t.gutter : 0),+ (this.params_ = e),+ (this.v13_ = !0),+ (this.serverType_ = t.serverType),+ (this.hidpi_ = void 0 === t.hidpi || t.hidpi),+ (this.tmpExtent_ = [1 / 0, 1 / 0, -1 / 0, -1 / 0]),+ this.updateV13_(),+ this.setKey(this.getKeyForParams_())+ }+ getFeatureInfoUrl(t, e, i, n) {+ const r = En(i),+ s = this.getProjection() || r+ let o = this.getTileGrid()+ o || (o = this.getTileGridForProjection(s))+ const a = On(t, r, s),+ l = Lu(s, r, t, e),+ h = o.getZForResolution(l, this.zDirection),+ c = o.getResolution(h),+ u = o.getTileCoordForCoordAndZ(a, h)+ if (o.getResolutions().length <= u[0]) return+ let d = o.getTileCoordExtent(u, this.tmpExtent_)+ const g = this.gutter_+ 0 !== g && (d = zt(d, c * g, d))+ const f = { QUERY_LAYERS: this.params_.LAYERS }+ Object.assign(f, af(this.params_, "GetFeatureInfo"), n)+ const p = Math.floor((a[0] - d[0]) / c),+ _ = Math.floor((d[3] - a[1]) / c)+ return (f[this.v13_ ? "I" : "X"] = p), (f[this.v13_ ? "J" : "Y"] = _), this.getRequestUrl_(u, d, 1, s || r, f)+ }+ getLegendUrl(t, e) {+ if (void 0 === this.urls[0]) return+ const i = { SERVICE: "WMS", VERSION: nf, REQUEST: "GetLegendGraphic", FORMAT: "image/png" }+ if (void 0 === e || void 0 === e.LAYER) {+ const t = this.params_.LAYERS+ if (!(!Array.isArray(t) || 1 === t.length)) return+ i.LAYER = t+ }+ if (void 0 !== t) {+ const e = this.getProjection() ? this.getProjection().getMetersPerUnit() : 1,+ n = 28e-5+ i.SCALE = (t * e) / n+ }+ return Object.assign(i, e), td(this.urls[0], i)+ }+ getGutter() {+ return this.gutter_+ }+ getParams() {+ return this.params_+ }+ getRequestUrl_(t, e, i, n, r) {+ const s = this.urls+ if (!s) return+ let o+ if (1 == s.length) o = s[0]+ else {+ o = s[De(Uu(t), s.length)]+ }+ return of(+ e,+ (this.tileGrid || this.getTileGridForProjection(n)).getResolution(t[0]),+ i,+ n,+ o,+ r,+ this.serverType_+ )+ }+ getTilePixelRatio(t) {+ return this.hidpi_ && void 0 !== this.serverType_ ? t : 1+ }+ getKeyForParams_() {+ let t = 0+ const e = []+ for (const i in this.params_) e[t++] = i + "-" + this.params_[i]+ return e.join("/")+ }+ setParams_(t) {+ ;(this.params_ = t), this.updateV13_(), this.setKey(this.getKeyForParams_())+ }+ setParams(t) {+ this.setParams_(Object.assign({}, t))+ }+ updateParams(t) {+ this.setParams_(Object.assign(this.params_, t))+ }+ updateV13_() {+ const t = this.params_.VERSION || nf+ this.v13_ = Je(t, "1.3") >= 0+ }+ tileUrlFunction(t, e, i) {+ let n = this.getTileGrid()+ if ((n || (n = this.getTileGridForProjection(i)), n.getResolutions().length <= t[0])) return+ 1 == e || (this.hidpi_ && void 0 !== this.serverType_) || (e = 1)+ const r = n.getResolution(t[0])+ let s = n.getTileCoordExtent(t, this.tmpExtent_)+ const o = this.gutter_+ 0 !== o && (s = zt(s, r * o, s))+ const a = Object.assign({}, af(this.params_, "GetMap"))+ return this.getRequestUrl_(t, s, e, i, a)+ }+ }),+ (bP.source.UTFGrid = class extends md {+ constructor(t) {+ if (+ (super({+ projection: En("EPSG:3857"),+ state: "loading",+ wrapX: void 0 === t.wrapX || t.wrapX,+ zDirection: t.zDirection+ }),+ (this.preemptive_ = void 0 === t.preemptive || t.preemptive),+ (this.tileUrlFunction_ = ud),+ (this.template_ = void 0),+ (this.jsonp_ = t.jsonp || !1),+ (this.tileCache_ = new Du(512)),+ t.url)+ )+ if (this.jsonp_) du(t.url, this.handleTileJSONResponse.bind(this), this.handleTileJSONError.bind(this))+ else {+ const e = new XMLHttpRequest()+ e.addEventListener("load", this.onXHRLoad_.bind(this)),+ e.addEventListener("error", this.onXHRError_.bind(this)),+ e.open("GET", t.url),+ e.send()+ }+ else {+ if (!t.tileJSON) throw new Error("Either `url` or `tileJSON` options must be provided")+ this.handleTileJSONResponse(t.tileJSON)+ }+ }+ onXHRLoad_(t) {+ const e = t.target+ if (!e.status || (e.status >= 200 && e.status < 300)) {+ let t+ try {+ t = JSON.parse(e.responseText)+ } catch {+ return void this.handleTileJSONError()+ }+ this.handleTileJSONResponse(t)+ } else this.handleTileJSONError()+ }+ onXHRError_(t) {+ this.handleTileJSONError()+ }+ getTemplate() {+ return this.template_+ }+ forDataAtCoordinateAndResolution(t, e, i, n) {+ if (this.tileGrid) {+ const r = this.tileGrid.getZForResolution(e, this.zDirection),+ s = this.tileGrid.getTileCoordForCoordAndZ(t, r),+ o = this.getTile(s[0], s[1], s[2], 1, this.getProjection())+ o.getState() == Y && o.load(), o.forDataAtCoordinate(t, i, n)+ } else+ !0 === n+ ? setTimeout(function () {+ i(null)+ }, 0)+ : i(null)+ }+ handleTileJSONError() {+ this.setState("error")+ }+ handleTileJSONResponse(t) {+ const e = En("EPSG:4326"),+ i = this.getProjection()+ let n+ if (void 0 !== t.bounds) {+ const r = Ln(e, i)+ n = be(t.bounds, r)+ }+ const r = Qu(i),+ s = t.minzoom || 0,+ o = Ku({ extent: r, maxZoom: t.maxzoom || 22, minZoom: s })+ ;(this.tileGrid = o), (this.template_ = t.template)+ const a = t.grids+ if (a) {+ if (((this.tileUrlFunction_ = hd(a, o)), t.attribution)) {+ const e = void 0 !== n ? n : r+ this.setAttributions(function (i) {+ return Se(e, i.extent) ? [t.attribution] : null+ })+ }+ this.setState("ready")+ } else this.setState("error")+ }+ getTile(t, e, i, n, r) {+ const s = [t, e, i],+ o = this.getTileCoordForTileUrlFunction(s, r),+ a = this.tileUrlFunction_(o, n, r),+ l = `${this.getKey()},${ku(t, e, i)}`+ if (this.tileCache_.containsKey(l)) return this.tileCache_.get(l)+ this.tileCache_.expireCache()+ const h = new Hf(+ s,+ void 0 !== a ? Y : J,+ void 0 !== a ? a : "",+ this.tileGrid.getTileCoordExtent(s),+ this.preemptive_,+ this.jsonp_+ )+ return this.tileCache_.set(l, h), h+ }+ }),+ (bP.source.UTFGrid.CustomTile = Hf),+ (bP.source.UrlTile = Ed),+ (bP.source.Vector = qd),+ (bP.source.Vector.VectorSourceEvent = Kd),+ (bP.source.VectorTile = yf),+ (bP.source.VectorTile.defaultLoadFunction = xf),+ (bP.source.WMTS = class extends wd {+ constructor(t) {+ const e = void 0 !== t.requestEncoding ? t.requestEncoding : "KVP",+ i = t.tileGrid+ let n = t.urls+ void 0 === n && void 0 !== t.url && (n = ad(t.url)),+ super({+ attributions: t.attributions,+ attributionsCollapsible: t.attributionsCollapsible,+ cacheSize: t.cacheSize,+ crossOrigin: t.crossOrigin,+ referrerPolicy: t.referrerPolicy,+ interpolate: t.interpolate,+ projection: t.projection,+ reprojectionErrorThreshold: t.reprojectionErrorThreshold,+ tileClass: t.tileClass,+ tileGrid: i,+ tileLoadFunction: t.tileLoadFunction,+ tilePixelRatio: t.tilePixelRatio,+ urls: n,+ wrapX: void 0 !== t.wrapX && t.wrapX,+ transition: t.transition,+ zDirection: t.zDirection+ }),+ (this.version_ = void 0 !== t.version ? t.version : "1.0.0"),+ (this.format_ = void 0 !== t.format ? t.format : "image/jpeg"),+ (this.dimensions_ = void 0 !== t.dimensions ? t.dimensions : {}),+ (this.layer_ = t.layer),+ (this.matrixSet_ = t.matrixSet),+ (this.style_ = t.style),+ (this.requestEncoding_ = e),+ this.setKey(this.getKeyForDimensions_()),+ n && n.length > 0 && (this.tileUrlFunction = cd(n.map(this.createFromWMTSTemplate.bind(this))))+ }+ setUrls(t) {+ this.urls = t+ const e = t.join("\n")+ this.setTileUrlFunction(cd(t.map(this.createFromWMTSTemplate.bind(this))), e)+ }+ getDimensions() {+ return this.dimensions_+ }+ getFormat() {+ return this.format_+ }+ getLayer() {+ return this.layer_+ }+ getMatrixSet() {+ return this.matrixSet_+ }+ getRequestEncoding() {+ return this.requestEncoding_+ }+ getStyle() {+ return this.style_+ }+ getVersion() {+ return this.version_+ }+ getKeyForDimensions_() {+ const t = this.urls ? this.urls.slice(0) : []+ for (const e in this.dimensions_) t.push(e + "-" + this.dimensions_[e])+ return t.join("/")+ }+ updateDimensions(t) {+ Object.assign(this.dimensions_, t), this.setKey(this.getKeyForDimensions_())+ }+ createFromWMTSTemplate(t) {+ const e = this.requestEncoding_,+ i = { layer: this.layer_, style: this.style_, tilematrixset: this.matrixSet_ }+ "KVP" == e &&+ Object.assign(i, { Service: "WMTS", Request: "GetTile", Version: this.version_, Format: this.format_ }),+ (t =+ "KVP" == e+ ? td(t, i)+ : t.replace(/\{(\w+?)\}/g, function (t, e) {+ return e.toLowerCase() in i ? i[e.toLowerCase()] : t+ }))+ const n = this.tileGrid,+ r = this.dimensions_+ return function (i, s, o) {+ if (!i) return+ const a = { TileMatrix: n.getMatrixId(i[0]), TileCol: i[1], TileRow: i[2] }+ Object.assign(a, r)+ let l = t+ return (+ (l =+ "KVP" == e+ ? td(l, a)+ : l.replace(/\{(\w+?)\}/g, function (t, e) {+ return encodeURIComponent(a[e])+ })),+ l+ )+ }+ }+ }),+ (bP.source.WMTS.optionsFromCapabilities = function (t, e) {+ const i = t.Contents.Layer,+ n = i?.find(function (t) {+ return t.Identifier == e.layer+ })+ if (!n) return null+ const r = t.Contents.TileMatrixSet+ let s+ ;(s =+ n.TileMatrixSetLink.length > 1+ ? "projection" in e+ ? n.TileMatrixSetLink.findIndex(function (t) {+ const i = r.find(function (e) {+ return e.Identifier == t.TileMatrixSet+ }).SupportedCRS,+ n = En(i),+ s = En(e.projection)+ return n && s ? Fn(n, s) : i == e.projection+ })+ : n.TileMatrixSetLink.findIndex(function (t) {+ return t.TileMatrixSet == e.matrixSet+ })+ : 0),+ s < 0 && (s = 0)+ const o = n.TileMatrixSetLink[s].TileMatrixSet,+ a = n.TileMatrixSetLink[s].TileMatrixSetLimits+ let l = n.Format[0]+ "format" in e && (l = e.format),+ (s = n.Style.findIndex(function (t) {+ return "style" in e ? t.Title == e.style : t.isDefault+ })),+ s < 0 && (s = 0)+ const h = n.Style[s].Identifier,+ c = {}+ "Dimension" in n &&+ n.Dimension.forEach(function (t, e, i) {+ const n = t.Identifier+ let r = t.Default+ void 0 === r && (r = t.Value[0]), (c[n] = r)+ })+ const u = t.Contents.TileMatrixSet.find(function (t) {+ return t.Identifier == o+ })+ let d+ const g = u.SupportedCRS+ if ((g && (d = En(g)), "projection" in e)) {+ const t = En(e.projection)+ t && ((d && !Fn(t, d)) || (d = t))+ }+ let f = !1+ const p = d.getAxisOrientation().startsWith("ne")+ let _ = u.TileMatrix[0],+ m = { MinTileCol: 0, MinTileRow: 0, MaxTileCol: _.MatrixWidth - 1, MaxTileRow: _.MatrixHeight - 1 }+ if (a) {+ m = a[a.length - 1]+ const t = u.TileMatrix.find(+ (t) => t.Identifier === m.TileMatrix || u.Identifier + ":" + t.Identifier === m.TileMatrix+ )+ t && (_ = t)+ }+ const y = n.BoundingBox?.find((t) => En(t.crs) && Fn(En(t.crs), d)),+ x = (28e-5 * _.ScaleDenominator) / d.getMetersPerUnit(),+ v = p ? [_.TopLeftCorner[1], _.TopLeftCorner[0]] : _.TopLeftCorner,+ S = _.TileWidth * x,+ E = _.TileHeight * x+ let w = y?.extent ?? u.BoundingBox+ w && p && (w = [w[1], w[0], w[3], w[2]])+ let T = [+ v[0] + S * m.MinTileCol,+ v[1] - E * (1 + m.MaxTileRow),+ v[0] + S * (1 + m.MaxTileCol),+ v[1] - E * m.MinTileRow+ ]+ if (void 0 !== w && !Wt(w, T)) {+ const t = n.WGS84BoundingBox,+ e = En("EPSG:4326").getExtent()+ if (((T = w), t)) f = t[0] === e[0] && t[2] === e[2]+ else {+ const t = Dn(w, u.SupportedCRS, "EPSG:4326")+ f = t[0] - 1e-10 <= e[0] && t[2] + 1e-10 >= e[2]+ }+ }+ const C = Wu(u, T, a),+ b = []+ let R = e.requestEncoding+ if (((R = void 0 !== R ? R : ""), "OperationsMetadata" in t && "GetTile" in t.OperationsMetadata)) {+ const e = t.OperationsMetadata.GetTile.DCP.HTTP.Get+ for (let t = 0, i = e.length; t < i; ++t)+ if (e[t].Constraint) {+ const i = e[t].Constraint.find(function (t) {+ return "GetEncoding" == t.name+ }).AllowedValues.Value+ if (("" === R && (R = i[0]), "KVP" !== R)) break+ i.includes("KVP") && b.push(e[t].href)+ } else e[t].href && ((R = "KVP"), b.push(e[t].href))+ }+ return (+ 0 === b.length &&+ ((R = "REST"),+ n.ResourceURL.forEach(function (t) {+ "tile" === t.resourceType && ((l = t.format), b.push(t.template))+ })),+ {+ urls: b,+ layer: e.layer,+ matrixSet: o,+ format: l,+ projection: d,+ requestEncoding: R,+ tileGrid: C,+ style: h,+ dimensions: c,+ wrapX: f,+ crossOrigin: e.crossOrigin+ }+ )+ }),+ (bP.source.XYZ = bd),+ (bP.source.Zoomify = class extends wd {+ constructor(t) {+ const e = t.size,+ i = void 0 !== t.tierSizeCalculation ? t.tierSizeCalculation : "default",+ n = t.tilePixelRatio || 1,+ r = e[0],+ s = e[1],+ o = [],+ a = t.tileSize || Co+ let l = a * n+ switch (i) {+ case "default":+ for (; r > l || s > l; ) o.push([Math.ceil(r / l), Math.ceil(s / l)]), (l += l)+ break+ case "truncated":+ let t = r,+ e = s+ for (; t > l || e > l; ) o.push([Math.ceil(t / l), Math.ceil(e / l)]), (t >>= 1), (e >>= 1)+ break+ default:+ throw new Error("Unknown `tierSizeCalculation` configured")+ }+ o.push([1, 1]), o.reverse()+ const h = [n],+ c = [0]+ for (let t = 1, e = o.length; t < e; t++) h.push(n << t), c.push(o[t - 1][0] * o[t - 1][1] + c[t - 1])+ h.reverse()+ const u = new Vu({ tileSize: a, extent: t.extent || [0, -s, r, 0], resolutions: h })+ let d = t.url+ !d || d.includes("{TileGroup}") || d.includes("{tileIndex}") || (d += "{TileGroup}/{z}-{x}-{y}.jpg")+ const g = ad(d)+ let f = a * n+ const p = cd(+ g.map(function (t) {+ return function (e, i, n) {+ if (!e) return+ const r = e[0],+ s = e[1],+ a = e[2],+ l = s + a * o[r][0],+ h = { z: r, x: s, y: a, tileIndex: l, TileGroup: "TileGroup" + (((l + c[r]) / f) | 0) }+ return t.replace(/\{(\w+?)\}/g, function (t, e) {+ return h[e]+ })+ }+ })+ ),+ _ = Og.bind(null, Wl(a * n))+ super({+ attributions: t.attributions,+ cacheSize: t.cacheSize,+ crossOrigin: t.crossOrigin,+ referrerPolicy: t.referrerPolicy,+ interpolate: t.interpolate,+ projection: t.projection,+ tilePixelRatio: n,+ reprojectionErrorThreshold: t.reprojectionErrorThreshold,+ tileClass: _,+ tileGrid: u,+ tileUrlFunction: p,+ transition: t.transition+ }),+ (this.zDirection = t.zDirection)+ const m = p(u.getTileCoordForCoordAndResolution(de(u.getExtent()), h[h.length - 1]), 1, null),+ y = new Image()+ y.addEventListener("error", () => {+ ;(f = a), this.changed()+ }),+ (y.src = m)+ }+ }),+ (bP.source.Zoomify.CustomTile = Og),+ (bP.source.arcgisRest = {}),+ (bP.source.arcgisRest.createLoader = $g),+ (bP.source.arcgisRest.getRequestUrl = Vg),+ (bP.source.common = {}),+ (bP.source.common.DECIMALS = 4),+ (bP.source.common.DEFAULT_WMS_VERSION = "1.3.0"),+ (bP.source.mapguide = {}),+ (bP.source.mapguide.createLoader = Zg),+ (bP.source.mapserver = {}),+ (bP.source.mapserver.createLoader = function (t) {+ const e = t.load || js,+ i = t.ratio ?? 1,+ n = t.crossOrigin ?? null+ return function (r, s, o) {+ const a = new Image()+ ;(a.crossOrigin = n), void 0 !== t.referrerPolicy && (a.referrerPolicy = t.referrerPolicy)+ const l = ve((r = Xg(r, s, o, i))) / s,+ h = _e(r) / s,+ c = [l * o, h * o],+ u = (function (t, e, i, n) {+ const r = Math.round(n[0]),+ s = Math.round(n[1]),+ o = `${r} ${s}`,+ a = `${i[0]} ${i[1]} ${i[2]} ${i[3]}`,+ l = {+ mode: "map",+ map_imagetype: "png",+ mapext: a,+ imgext: a,+ map_size: o,+ imgx: r / 2,+ imgy: s / 2,+ imgxy: o+ }+ return Object.assign(l, e), td(t, l)+ })(t.url, t.params, r, c)+ return e(a, u).then((t) => ({ image: t, extent: r, pixelRatio: o }))+ }+ }),+ (bP.source.ogcMapUtil = {}),+ (bP.source.ogcMapUtil.createLoader = a_),+ (bP.source.ogcMapUtil.getImageSrc = o_),+ (bP.source.ogcMapUtil.getRequestUrl = s_),+ (bP.source.ogcTileUtil = {}),+ (bP.source.ogcTileUtil.appendCollectionsQueryParam = gf),+ (bP.source.ogcTileUtil.getMapTileUrlTemplate = ff),+ (bP.source.ogcTileUtil.getTileSetInfo = mf),+ (bP.source.ogcTileUtil.getVectorTileUrlTemplate = pf),+ (bP.source.ogcTileUtil.parseTileMatrixSet = _f),+ (bP.source.sourcesFromTileGrid = function (t, e) {+ const i = new Du(32),+ n = t.getExtent()+ return function (r, s) {+ i.expireCache(), n && (r = me(n, r))+ const o = t.getZForResolution(s),+ a = []+ return (+ t.forEachTileCoord(r, o, (t) => {+ const n = t.toString()+ if (!i.containsKey(n)) {+ const r = e(t)+ i.set(n, r)+ }+ a.push(i.get(n))+ }),+ a+ )+ }+ }),+ (bP.source.static = {}),+ (bP.source.static.createLoader = Yg),+ (bP.source.wms = {}),+ (bP.source.wms.DEFAULT_VERSION = nf),+ (bP.source.wms.createLoader = lf),+ (bP.source.wms.getFeatureInfoUrl = hf),+ (bP.source.wms.getImageSrc = of),+ (bP.source.wms.getLegendUrl = cf),+ (bP.source.wms.getRequestParams = af),+ (bP.source.wms.getRequestUrl = sf),+ (bP.sphere = {}),+ (bP.sphere.DEFAULT_RADIUS = ze),+ (bP.sphere.getArea = function t(e, i) {+ const n = (i = i || {}).radius || ze,+ r = i.projection || "EPSG:3857",+ s = e.getType()+ "GeometryCollection" !== s && (e = e.clone().transform(r, "EPSG:4326"))+ let o,+ a,+ l,+ h,+ c,+ u,+ d = 0+ switch (s) {+ case "Point":+ case "MultiPoint":+ case "LineString":+ case "MultiLineString":+ case "LinearRing":+ break+ case "Polygon":+ for (o = e.getCoordinates(), d = Math.abs($e(o[0], n)), l = 1, h = o.length; l < h; ++l)+ d -= Math.abs($e(o[l], n))+ break+ case "MultiPolygon":+ for (o = e.getCoordinates(), l = 0, h = o.length; l < h; ++l)+ for (a = o[l], d += Math.abs($e(a[0], n)), c = 1, u = a.length; c < u; ++c) d -= Math.abs($e(a[c], n))+ break+ case "GeometryCollection": {+ const n = e.getGeometries()+ for (l = 0, h = n.length; l < h; ++l) d += t(n[l], i)+ break+ }+ default:+ throw new Error("Unsupported geometry type: " + s)+ }+ return d+ }),+ (bP.sphere.getDistance = Xe),+ (bP.sphere.getLength = function t(e, i) {+ const n = (i = i || {}).radius || ze,+ r = i.projection || "EPSG:3857",+ s = e.getType()+ "GeometryCollection" !== s && (e = e.clone().transform(r, "EPSG:4326"))+ let o,+ a,+ l,+ h,+ c,+ u,+ d = 0+ switch (s) {+ case "Point":+ case "MultiPoint":+ break+ case "LineString":+ case "LinearRing":+ ;(o = e.getCoordinates()), (d = Ve(o, n))+ break+ case "MultiLineString":+ case "Polygon":+ for (o = e.getCoordinates(), l = 0, h = o.length; l < h; ++l) d += Ve(o[l], n)+ break+ case "MultiPolygon":+ for (o = e.getCoordinates(), l = 0, h = o.length; l < h; ++l)+ for (a = o[l], c = 0, u = a.length; c < u; ++c) d += Ve(a[c], n)+ break+ case "GeometryCollection": {+ const n = e.getGeometries()+ for (l = 0, h = n.length; l < h; ++l) d += t(n[l], i)+ break+ }+ default:+ throw new Error("Unsupported geometry type: " + s)+ }+ return d+ }),+ (bP.sphere.offset = We),+ (bP.string = {}),+ (bP.string.compareVersions = Je),+ (bP.string.padNumber = qe),+ (bP.structs = {}),+ (bP.structs.LRUCache = Du),+ (bP.structs.PriorityQueue = ao),+ (bP.structs.PriorityQueue.DROP = oo),+ (bP.structs.RBush = zd),+ (bP.style = {}),+ (bP.style.Circle = rc),+ (bP.style.Fill = sc),+ (bP.style.Icon = ac),+ (bP.style.IconImage = Fh),+ (bP.style.IconImage.get = Lh),+ (bP.style.IconImageCache = bh),+ (bP.style.IconImageCache.getCacheKey = Rh),+ (bP.style.IconImageCache.shared = Ph),+ (bP.style.Image = ic),+ (bP.style.RegularShape = nc),+ (bP.style.Stroke = lc),+ (bP.style.Style = hc),+ (bP.style.Style.createDefaultStyle = dc),+ (bP.style.Style.createEditingStyle = gc),+ (bP.style.Style.toFunction = cc),+ (bP.style.Text = pc),+ (bP.style.flat = {}),+ (bP.style.flat.createDefaultStyle = n_),+ (bP.tilecoord = {}),+ (bP.tilecoord.createOrUpdate = Nu),+ (bP.tilecoord.fromKey = function (t) {+ return t.split("/").map(Number)+ }),+ (bP.tilecoord.getCacheKey = ju),+ (bP.tilecoord.getCacheKeyForTileKey = function (t) {+ const [e, i, n] = t+ .substring(t.lastIndexOf("/") + 1, t.length)+ .split(",")+ .map(Number)+ return ku(e, i, n)+ }),+ (bP.tilecoord.getKey = Gu),+ (bP.tilecoord.getKeyZXY = ku),+ (bP.tilecoord.hash = Uu),+ (bP.tilecoord.hashZXY = Bu),+ (bP.tilecoord.withinExtentAndZ = zu),+ (bP.tilegrid = {}),+ (bP.tilegrid.TileGrid = Vu),+ (bP.tilegrid.WMTS = $u),+ (bP.tilegrid.WMTS.createFromCapabilitiesMatrixSet = Wu),+ (bP.tilegrid.common = {}),+ (bP.tilegrid.common.DEFAULT_MAX_ZOOM = 42),+ (bP.tilegrid.common.DEFAULT_TILE_SIZE = Co),+ (bP.tilegrid.createForExtent = Hu),+ (bP.tilegrid.createForProjection = Ju),+ (bP.tilegrid.createXYZ = Ku),+ (bP.tilegrid.extentFromProjection = Qu),+ (bP.tilegrid.getForProjection = Zu),+ (bP.tilegrid.wrapX = Yu),+ (bP.tileurlfunction = {}),+ (bP.tileurlfunction.createFromTemplate = ld),+ (bP.tileurlfunction.createFromTemplates = hd),+ (bP.tileurlfunction.createFromTileUrlFunctions = cd),+ (bP.tileurlfunction.nullTileUrlFunction = ud),+ (bP.transform = {}),+ (bP.transform.apply = Qn),+ (bP.transform.compose = nr),+ (bP.transform.composeCssTransform = function (t, e, i, n, r, s, o) {+ return ar(nr([1, 0, 0, 1, 0, 0], t, e, i, n, r, s, o))+ }),+ (bP.transform.create = Yn),+ (bP.transform.determinant = sr),+ (bP.transform.equivalent = hr),+ (bP.transform.fromString = lr),+ (bP.transform.invert = function (t) {+ return rr(t, t)+ }),+ (bP.transform.makeInverse = rr),+ (bP.transform.makeScale = function (t, e, i) {+ return qn(t, e, 0, 0, i, 0, 0)+ }),+ (bP.transform.multiply = Kn),+ (bP.transform.reset = Hn),+ (bP.transform.rotate = tr),+ (bP.transform.scale = er),+ (bP.transform.set = qn),+ (bP.transform.setFromArray = Jn),+ (bP.transform.toString = ar),+ (bP.transform.translate = ir),+ (bP.uri = {}),+ (bP.uri.appendParams = td),+ (bP.uri.expandUrl = ad),+ (bP.uri.pickUrl = od),+ (bP.uri.renderXYZTemplate = sd),+ (bP.util = {}),+ (bP.util.VERSION = "10.8.0"),+ (bP.util.abstract = U),+ (bP.util.getUid = z),+ (bP.vec = {}),+ (bP.vec.mat4 = {}),+ (bP.vec.mat4.create = Jd),+ (bP.vec.mat4.fromTransform = Qd),+ (bP.vec.mat4.orthographic = tg),+ (bP.vec.mat4.scale = eg),+ (bP.vec.mat4.translate = ig),+ (bP.vec.mat4.translation = ng),+ (bP.webgl = {}),+ (bP.webgl.ARRAY_BUFFER = Kf),+ (bP.webgl.BaseTileRepresentation = Fp),+ (bP.webgl.Buffer = Mp),+ (bP.webgl.Buffer.getArrayClassForType = Ap),+ (bP.webgl.Canvas = {}),+ (bP.webgl.Canvas.Canvas = rg),+ (bP.webgl.Canvas.createProgram = og),+ (bP.webgl.DYNAMIC_DRAW = Qf),+ (bP.webgl.ELEMENT_ARRAY_BUFFER = qf),+ (bP.webgl.FLOAT = tp),+ (bP.webgl.Helper = $p),+ (bP.webgl.Helper.computeAttributesStride = Wp),+ (bP.webgl.PaletteTexture = Yp),+ (bP.webgl.PostProcessingPass = Np),+ (bP.webgl.RenderTarget = Kp),+ (bP.webgl.STATIC_DRAW = Jf),+ (bP.webgl.STREAM_DRAW = 35040),+ (bP.webgl.TileGeometry = Jp),+ (bP.webgl.TileTexture = i_),+ (bP.webgl.UNSIGNED_BYTE = 5121),+ (bP.webgl.UNSIGNED_INT = 5125),+ (bP.webgl.UNSIGNED_SHORT = 5123),+ (bP.webgl.getContext = ip),+ (bP.webgl.getSupportedExtensions = function () {+ if (!np) {+ const t = ip(document.createElement("canvas"))+ t && (np = t.getSupportedExtensions())+ }+ return np+ }),+ (bP.xml = {}),+ (bP.xml.OBJECT_PROPERTY_NODE_FACTORY = xp),+ (bP.xml.XML_SCHEMA_INSTANCE_URI = rp),+ (bP.xml.createElementNS = sp),+ (bP.xml.getAllTextContent = op),+ (bP.xml.getAllTextContent_ = ap),+ (bP.xml.getAttributeNS = hp),+ (bP.xml.getDocument = Ip),+ (bP.xml.getXMLSerializer = Pp),+ (bP.xml.isDocument = lp),+ (bP.xml.makeArrayExtender = up),+ (bP.xml.makeArrayPusher = dp),+ (bP.xml.makeArraySerializer = mp),+ (bP.xml.makeChildAppender = _p),+ (bP.xml.makeObjectPropertyPusher = fp),+ (bP.xml.makeObjectPropertySetter = pp),+ (bP.xml.makeReplacer = gp),+ (bP.xml.makeSequence = vp),+ (bP.xml.makeSimpleNodeFactory = yp),+ (bP.xml.makeStructureNS = Sp),+ (bP.xml.parse = cp),+ (bP.xml.parseNode = Ep),+ (bP.xml.pushParseAndPop = wp),+ (bP.xml.pushSerializeAndPop = Cp),+ (bP.xml.registerDocument = function (t) {+ Rp = t+ }),+ (bP.xml.registerXMLSerializer = function (t) {+ bp = t+ }),+ (bP.xml.serialize = Tp),+ (bP.VERSION = bP.util.VERSION),+ (bP.getUid = bP.util.getUid),+ bP+ )+})()+//# sourceMappingURL=ol.js.mapdiff --git a/android/app/src/main/java/com/colota/BootReceiver.kt b/apps/mobile/android/app/src/main/java/com/colota/BootReceiver.ktsimilarity index 100%rename from android/app/src/main/java/com/colota/BootReceiver.ktrename to apps/mobile/android/app/src/main/java/com/colota/BootReceiver.ktdiff --git a/android/app/src/main/java/com/colota/BuildConfigModule.kt b/apps/mobile/android/app/src/main/java/com/colota/BuildConfigModule.ktsimilarity index 100%rename from android/app/src/main/java/com/colota/BuildConfigModule.ktrename to apps/mobile/android/app/src/main/java/com/colota/BuildConfigModule.ktdiff --git a/android/app/src/main/java/com/colota/DatabaseHelper.kt b/apps/mobile/android/app/src/main/java/com/colota/DatabaseHelper.ktsimilarity index 100%rename from android/app/src/main/java/com/colota/DatabaseHelper.ktrename to apps/mobile/android/app/src/main/java/com/colota/DatabaseHelper.ktdiff --git a/android/app/src/main/java/com/colota/DeviceInfoHelper.kt b/apps/mobile/android/app/src/main/java/com/colota/DeviceInfoHelper.ktsimilarity index 100%rename from android/app/src/main/java/com/colota/DeviceInfoHelper.ktrename to apps/mobile/android/app/src/main/java/com/colota/DeviceInfoHelper.ktdiff --git a/android/app/src/main/java/com/colota/FileOperations.kt b/apps/mobile/android/app/src/main/java/com/colota/FileOperations.ktsimilarity index 100%rename from android/app/src/main/java/com/colota/FileOperations.ktrename to apps/mobile/android/app/src/main/java/com/colota/FileOperations.ktdiff --git a/android/app/src/main/java/com/colota/GeofenceHelper.kt b/apps/mobile/android/app/src/main/java/com/colota/GeofenceHelper.ktsimilarity index 100%rename from android/app/src/main/java/com/colota/GeofenceHelper.ktrename to apps/mobile/android/app/src/main/java/com/colota/GeofenceHelper.ktdiff --git a/android/app/src/main/java/com/colota/LocationForegroundService.kt b/apps/mobile/android/app/src/main/java/com/colota/LocationForegroundService.ktsimilarity index 100%rename from android/app/src/main/java/com/colota/LocationForegroundService.ktrename to apps/mobile/android/app/src/main/java/com/colota/LocationForegroundService.ktdiff --git a/android/app/src/main/java/com/colota/LocationServiceModule.kt b/apps/mobile/android/app/src/main/java/com/colota/LocationServiceModule.ktsimilarity index 100%rename from android/app/src/main/java/com/colota/LocationServiceModule.ktrename to apps/mobile/android/app/src/main/java/com/colota/LocationServiceModule.ktdiff --git a/android/app/src/main/java/com/colota/LocationServicePackage.kt b/apps/mobile/android/app/src/main/java/com/colota/LocationServicePackage.ktsimilarity index 100%rename from android/app/src/main/java/com/colota/LocationServicePackage.ktrename to apps/mobile/android/app/src/main/java/com/colota/LocationServicePackage.ktdiff --git a/android/app/src/main/java/com/colota/LocationUtils.kt b/apps/mobile/android/app/src/main/java/com/colota/LocationUtils.ktsimilarity index 100%rename from android/app/src/main/java/com/colota/LocationUtils.ktrename to apps/mobile/android/app/src/main/java/com/colota/LocationUtils.ktdiff --git a/android/app/src/main/java/com/colota/MainActivity.kt b/apps/mobile/android/app/src/main/java/com/colota/MainActivity.ktsimilarity index 100%rename from android/app/src/main/java/com/colota/MainActivity.ktrename to apps/mobile/android/app/src/main/java/com/colota/MainActivity.ktdiff --git a/android/app/src/main/java/com/colota/MainApplication.kt b/apps/mobile/android/app/src/main/java/com/colota/MainApplication.ktsimilarity index 100%rename from android/app/src/main/java/com/colota/MainApplication.ktrename to apps/mobile/android/app/src/main/java/com/colota/MainApplication.ktdiff --git a/android/app/src/main/java/com/colota/NetworkManager.kt b/apps/mobile/android/app/src/main/java/com/colota/NetworkManager.ktsimilarity index 100%rename from android/app/src/main/java/com/colota/NetworkManager.ktrename to apps/mobile/android/app/src/main/java/com/colota/NetworkManager.ktdiff --git a/android/app/src/main/java/com/colota/SecureStorageHelper.kt b/apps/mobile/android/app/src/main/java/com/colota/SecureStorageHelper.ktsimilarity index 100%rename from android/app/src/main/java/com/colota/SecureStorageHelper.ktrename to apps/mobile/android/app/src/main/java/com/colota/SecureStorageHelper.ktdiff --git a/android/app/src/main/java/com/colota/ServiceConfig.kt b/apps/mobile/android/app/src/main/java/com/colota/ServiceConfig.ktsimilarity index 100%rename from android/app/src/main/java/com/colota/ServiceConfig.ktrename to apps/mobile/android/app/src/main/java/com/colota/ServiceConfig.ktdiff --git a/android/app/src/main/java/com/colota/SyncManager.kt b/apps/mobile/android/app/src/main/java/com/colota/SyncManager.ktsimilarity index 100%rename from android/app/src/main/java/com/colota/SyncManager.ktrename to apps/mobile/android/app/src/main/java/com/colota/SyncManager.ktdiff --git a/android/app/src/main/res/drawable/ic_notification.png b/apps/mobile/android/app/src/main/res/drawable/ic_notification.pngsimilarity index 100%rename from android/app/src/main/res/drawable/ic_notification.pngrename to apps/mobile/android/app/src/main/res/drawable/ic_notification.pngdiff --git a/android/app/src/main/res/drawable/rn_edit_text_material.xml b/apps/mobile/android/app/src/main/res/drawable/rn_edit_text_material.xmlsimilarity index 100%rename from android/app/src/main/res/drawable/rn_edit_text_material.xmlrename to apps/mobile/android/app/src/main/res/drawable/rn_edit_text_material.xmldiff --git a/android/app/src/main/res/ic_launcher-web.png b/apps/mobile/android/app/src/main/res/ic_launcher-web.pngsimilarity index 100%rename from android/app/src/main/res/ic_launcher-web.pngrename to apps/mobile/android/app/src/main/res/ic_launcher-web.pngdiff --git a/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/apps/mobile/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xmlsimilarity index 100%rename from android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xmlrename to apps/mobile/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xmldiff --git a/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/apps/mobile/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xmlsimilarity index 100%rename from android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xmlrename to apps/mobile/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xmldiff --git a/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/apps/mobile/android/app/src/main/res/mipmap-hdpi/ic_launcher.pngsimilarity index 100%rename from android/app/src/main/res/mipmap-hdpi/ic_launcher.pngrename to apps/mobile/android/app/src/main/res/mipmap-hdpi/ic_launcher.pngdiff --git a/android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png b/apps/mobile/android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.pngsimilarity index 100%rename from android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.pngrename to apps/mobile/android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.pngdiff --git a/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png b/apps/mobile/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.pngsimilarity index 100%rename from android/app/src/main/res/mipmap-hdpi/ic_launcher_round.pngrename to apps/mobile/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.pngdiff --git a/android/app/src/main/res/mipmap-ldpi/ic_launcher.png b/apps/mobile/android/app/src/main/res/mipmap-ldpi/ic_launcher.pngsimilarity index 100%rename from android/app/src/main/res/mipmap-ldpi/ic_launcher.pngrename to apps/mobile/android/app/src/main/res/mipmap-ldpi/ic_launcher.pngdiff --git a/android/app/src/main/res/mipmap-ldpi/ic_launcher_round.png b/apps/mobile/android/app/src/main/res/mipmap-ldpi/ic_launcher_round.pngsimilarity index 100%rename from android/app/src/main/res/mipmap-ldpi/ic_launcher_round.pngrename to apps/mobile/android/app/src/main/res/mipmap-ldpi/ic_launcher_round.pngdiff --git a/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/apps/mobile/android/app/src/main/res/mipmap-mdpi/ic_launcher.pngsimilarity index 100%rename from android/app/src/main/res/mipmap-mdpi/ic_launcher.pngrename to apps/mobile/android/app/src/main/res/mipmap-mdpi/ic_launcher.pngdiff --git a/android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png b/apps/mobile/android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.pngsimilarity index 100%rename from android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.pngrename to apps/mobile/android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.pngdiff --git a/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png b/apps/mobile/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.pngsimilarity index 100%rename from android/app/src/main/res/mipmap-mdpi/ic_launcher_round.pngrename to apps/mobile/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.pngdiff --git a/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/apps/mobile/android/app/src/main/res/mipmap-xhdpi/ic_launcher.pngsimilarity index 100%rename from android/app/src/main/res/mipmap-xhdpi/ic_launcher.pngrename to apps/mobile/android/app/src/main/res/mipmap-xhdpi/ic_launcher.pngdiff --git a/android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png b/apps/mobile/android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.pngsimilarity index 100%rename from android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.pngrename to apps/mobile/android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.pngdiff --git a/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/apps/mobile/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.pngsimilarity index 100%rename from android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.pngrename to apps/mobile/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.pngdiff --git a/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/apps/mobile/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.pngsimilarity index 100%rename from android/app/src/main/res/mipmap-xxhdpi/ic_launcher.pngrename to apps/mobile/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.pngdiff --git a/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png b/apps/mobile/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.pngsimilarity index 100%rename from android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.pngrename to apps/mobile/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.pngdiff --git a/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/apps/mobile/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.pngsimilarity index 100%rename from android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.pngrename to apps/mobile/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.pngdiff --git a/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/apps/mobile/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.pngsimilarity index 100%rename from android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.pngrename to apps/mobile/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.pngdiff --git a/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png b/apps/mobile/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.pngsimilarity index 100%rename from android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.pngrename to apps/mobile/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.pngdiff --git a/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/apps/mobile/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.pngsimilarity index 100%rename from android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.pngrename to apps/mobile/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.pngdiff --git a/android/app/src/main/res/playstore-icon-1024-500.png b/apps/mobile/android/app/src/main/res/playstore-icon-1024-500.pngsimilarity index 100%rename from android/app/src/main/res/playstore-icon-1024-500.pngrename to apps/mobile/android/app/src/main/res/playstore-icon-1024-500.pngdiff --git a/android/app/src/main/res/playstore-icon.png b/apps/mobile/android/app/src/main/res/playstore-icon.pngsimilarity index 100%rename from android/app/src/main/res/playstore-icon.pngrename to apps/mobile/android/app/src/main/res/playstore-icon.pngdiff --git a/android/app/src/main/res/values/ic_launcher_background.xml b/apps/mobile/android/app/src/main/res/values/ic_launcher_background.xmlsimilarity index 100%rename from android/app/src/main/res/values/ic_launcher_background.xmlrename to apps/mobile/android/app/src/main/res/values/ic_launcher_background.xmldiff --git a/android/app/src/main/res/values/strings.xml b/apps/mobile/android/app/src/main/res/values/strings.xmlsimilarity index 100%rename from android/app/src/main/res/values/strings.xmlrename to apps/mobile/android/app/src/main/res/values/strings.xmldiff --git a/android/app/src/main/res/values/styles.xml b/apps/mobile/android/app/src/main/res/values/styles.xmlsimilarity index 100%rename from android/app/src/main/res/values/styles.xmlrename to apps/mobile/android/app/src/main/res/values/styles.xmldiff --git a/android/app/src/main/res/xml/file_paths.xml b/apps/mobile/android/app/src/main/res/xml/file_paths.xmlsimilarity index 100%rename from android/app/src/main/res/xml/file_paths.xmlrename to apps/mobile/android/app/src/main/res/xml/file_paths.xmldiff --git a/android/app/src/main/res/xml/network_security_config.xml b/apps/mobile/android/app/src/main/res/xml/network_security_config.xmlsimilarity index 100%rename from android/app/src/main/res/xml/network_security_config.xmlrename to apps/mobile/android/app/src/main/res/xml/network_security_config.xmldiff --git a/android/build.gradle b/apps/mobile/android/build.gradlesimilarity index 100%rename from android/build.gradlerename to apps/mobile/android/build.gradlediff --git a/android/gradle/wrapper/gradle-wrapper.jar b/apps/mobile/android/gradle/wrapper/gradle-wrapper.jarsimilarity index 100%rename from android/gradle/wrapper/gradle-wrapper.jarrename to apps/mobile/android/gradle/wrapper/gradle-wrapper.jardiff --git a/android/gradle/wrapper/gradle-wrapper.properties b/apps/mobile/android/gradle/wrapper/gradle-wrapper.propertiessimilarity index 100%rename from android/gradle/wrapper/gradle-wrapper.propertiesrename to apps/mobile/android/gradle/wrapper/gradle-wrapper.propertiesdiff --git a/android/gradlew b/apps/mobile/android/gradlewsimilarity index 100%rename from android/gradlewrename to apps/mobile/android/gradlewdiff --git a/android/gradlew.bat b/apps/mobile/android/gradlew.batsimilarity index 100%rename from android/gradlew.batrename to apps/mobile/android/gradlew.batdiff --git a/android/settings.gradle b/apps/mobile/android/settings.gradlesimilarity index 100%rename from android/settings.gradlerename to apps/mobile/android/settings.gradlediff --git a/app.json b/apps/mobile/app.jsonsimilarity index 100%rename from app.jsonrename to apps/mobile/app.jsondiff --git a/babel.config.js b/apps/mobile/babel.config.jssimilarity index 100%rename from babel.config.jsrename to apps/mobile/babel.config.jsdiff --git a/index.js b/apps/mobile/index.jssimilarity index 100%rename from index.jsrename to apps/mobile/index.jsdiff --git a/jest.config.js b/apps/mobile/jest.config.jssimilarity index 100%rename from jest.config.jsrename to apps/mobile/jest.config.jsdiff --git a/jest.setup.js b/apps/mobile/jest.setup.jssimilarity index 100%rename from jest.setup.jsrename to apps/mobile/jest.setup.jsdiff --git a/metro.config.js b/apps/mobile/metro.config.jssimilarity index 51%rename from metro.config.jsrename to apps/mobile/metro.config.jsindex 5f62fea0..a75053c1 100644--- a/metro.config.js+++ b/apps/mobile/metro.config.js@@ -1,11 +1,19 @@+const path = require("path")const { getDefaultConfig, mergeConfig } = require("@react-native/metro-config")+const monorepoRoot = path.resolve(__dirname, "../..")+/*** Metro configuration* https://reactnative.dev/docs/metro** @type {import('@react-native/metro-config').MetroConfig}*/-const config = {}+const config = {+ watchFolders: [monorepoRoot],+ resolver: {+ nodeModulesPaths: [path.resolve(__dirname, "node_modules"), path.resolve(monorepoRoot, "node_modules")]+ }+}module.exports = mergeConfig(getDefaultConfig(__dirname), config)diff --git a/apps/mobile/package.json b/apps/mobile/package.jsonnew file mode 100644index 00000000..ca81ae2d--- /dev/null+++ b/apps/mobile/package.json@@ -0,0 +1,51 @@+{+ "name": "@colota/mobile",+ "private": true,+ "scripts": {+ "start": "react-native start",+ "android": "react-native run-android",+ "android:debug": "cd android && ./gradlew assembleDebug",+ "android:release": "cd android && ./gradlew assembleRelease",+ "android:bundle": "cd android && ./gradlew bundleRelease",+ "clean": "cd android && ./gradlew clean",+ "lint": "eslint . --ext .js,.jsx,.ts,.tsx",+ "test": "jest --passWithNoTests",+ "test:coverage": "jest --coverage",+ "deploy-release": "adb install android/app/build/outputs/apk/release/app-release.apk",+ "deploy-bundle": "adb install android/app/build/outputs/bundle/release/app-release.aab"+ },+ "dependencies": {+ "@react-navigation/native": "^7.1.28",+ "@react-navigation/native-stack": "^7.12.0",+ "lucide-react-native": "^0.564.0",+ "react": "19.2.0",+ "react-native": "0.83.1",+ "react-native-safe-area-context": "^5.6.2",+ "react-native-screens": "^4.23.0",+ "react-native-svg": "^15.15.3",+ "react-native-webview": "^13.16.0"+ },+ "devDependencies": {+ "@babel/core": "^7.29.0",+ "@babel/preset-env": "^7.29.0",+ "@babel/runtime": "^7.28.6",+ "@react-native-community/cli": "20.0.0",+ "@react-native-community/cli-platform-android": "20.0.0",+ "@react-native-community/cli-platform-ios": "20.0.0",+ "@react-native/babel-preset": "0.83.1",+ "@react-native/eslint-config": "0.83.1",+ "@react-native/metro-config": "0.83.1",+ "@react-native/typescript-config": "0.83.1",+ "@testing-library/react-native": "^13.3.3",+ "@types/jest": "^29.5.13",+ "@types/react": "^19.2.14",+ "@types/react-test-renderer": "^19.1.0",+ "eslint": "^8.19.0",+ "jest": "^29.6.3",+ "react-test-renderer": "19.2.0",+ "typescript": "^5.8.3"+ },+ "engines": {+ "node": ">=20"+ }+}diff --git a/src/assets/icons/icon.png b/apps/mobile/src/assets/icons/icon.pngsimilarity index 100%rename from src/assets/icons/icon.pngrename to apps/mobile/src/assets/icons/icon.pngdiff --git a/src/components/features/dashboard/CoordinateDisplay.tsx b/apps/mobile/src/components/features/dashboard/CoordinateDisplay.tsxsimilarity index 100%rename from src/components/features/dashboard/CoordinateDisplay.tsxrename to apps/mobile/src/components/features/dashboard/CoordinateDisplay.tsxdiff --git a/src/components/features/dashboard/DashboardMap.tsx b/apps/mobile/src/components/features/dashboard/DashboardMap.tsxsimilarity index 100%rename from src/components/features/dashboard/DashboardMap.tsxrename to apps/mobile/src/components/features/dashboard/DashboardMap.tsxdiff --git a/src/components/features/dashboard/DatabaseStatistics.tsx b/apps/mobile/src/components/features/dashboard/DatabaseStatistics.tsxsimilarity index 100%rename from src/components/features/dashboard/DatabaseStatistics.tsxrename to apps/mobile/src/components/features/dashboard/DatabaseStatistics.tsxdiff --git a/src/components/features/dashboard/QuickAccess.tsx b/apps/mobile/src/components/features/dashboard/QuickAccess.tsxsimilarity index 100%rename from src/components/features/dashboard/QuickAccess.tsxrename to apps/mobile/src/components/features/dashboard/QuickAccess.tsxdiff --git a/src/components/features/dashboard/ServerConnection.tsx b/apps/mobile/src/components/features/dashboard/ServerConnection.tsxsimilarity index 100%rename from src/components/features/dashboard/ServerConnection.tsxrename to apps/mobile/src/components/features/dashboard/ServerConnection.tsxdiff --git a/src/components/features/dashboard/WelcomeCard.tsx b/apps/mobile/src/components/features/dashboard/WelcomeCard.tsxsimilarity index 100%rename from src/components/features/dashboard/WelcomeCard.tsxrename to apps/mobile/src/components/features/dashboard/WelcomeCard.tsxdiff --git a/src/components/features/map/MapCenterButton.tsx b/apps/mobile/src/components/features/map/MapCenterButton.tsxsimilarity index 100%rename from src/components/features/map/MapCenterButton.tsxrename to apps/mobile/src/components/features/map/MapCenterButton.tsxdiff --git a/src/components/features/settings/ConnectionSettings.tsx b/apps/mobile/src/components/features/settings/ConnectionSettings.tsxsimilarity index 100%rename from src/components/features/settings/ConnectionSettings.tsxrename to apps/mobile/src/components/features/settings/ConnectionSettings.tsxdiff --git a/src/components/features/settings/PresetOption.tsx b/apps/mobile/src/components/features/settings/PresetOption.tsxsimilarity index 100%rename from src/components/features/settings/PresetOption.tsxrename to apps/mobile/src/components/features/settings/PresetOption.tsxdiff --git a/src/components/features/settings/StatsCard.tsx b/apps/mobile/src/components/features/settings/StatsCard.tsxsimilarity index 100%rename from src/components/features/settings/StatsCard.tsxrename to apps/mobile/src/components/features/settings/StatsCard.tsxdiff --git a/src/components/features/settings/SyncStrategySettings.tsx b/apps/mobile/src/components/features/settings/SyncStrategySettings.tsxsimilarity index 100%rename from src/components/features/settings/SyncStrategySettings.tsxrename to apps/mobile/src/components/features/settings/SyncStrategySettings.tsxdiff --git a/src/components/index.ts b/apps/mobile/src/components/index.tssimilarity index 100%rename from src/components/index.tsrename to apps/mobile/src/components/index.tsdiff --git a/src/components/ui/Button.tsx b/apps/mobile/src/components/ui/Button.tsxsimilarity index 100%rename from src/components/ui/Button.tsxrename to apps/mobile/src/components/ui/Button.tsxdiff --git a/src/components/ui/Card.tsx b/apps/mobile/src/components/ui/Card.tsxsimilarity index 100%rename from src/components/ui/Card.tsxrename to apps/mobile/src/components/ui/Card.tsxdiff --git a/src/components/ui/Container.tsx b/apps/mobile/src/components/ui/Container.tsxsimilarity index 100%rename from src/components/ui/Container.tsxrename to apps/mobile/src/components/ui/Container.tsxdiff --git a/src/components/ui/Divider.tsx b/apps/mobile/src/components/ui/Divider.tsxsimilarity index 100%rename from src/components/ui/Divider.tsxrename to apps/mobile/src/components/ui/Divider.tsxdiff --git a/src/components/ui/ErrorBoundary.tsx b/apps/mobile/src/components/ui/ErrorBoundary.tsxsimilarity index 100%rename from src/components/ui/ErrorBoundary.tsxrename to apps/mobile/src/components/ui/ErrorBoundary.tsxdiff --git a/src/components/ui/FloatingSaveIndicator.tsx b/apps/mobile/src/components/ui/FloatingSaveIndicator.tsxsimilarity index 100%rename from src/components/ui/FloatingSaveIndicator.tsxrename to apps/mobile/src/components/ui/FloatingSaveIndicator.tsxdiff --git a/src/components/ui/Footer.tsx b/apps/mobile/src/components/ui/Footer.tsxsimilarity index 100%rename from src/components/ui/Footer.tsxrename to apps/mobile/src/components/ui/Footer.tsxdiff --git a/src/components/ui/NumericInput.tsx b/apps/mobile/src/components/ui/NumericInput.tsxsimilarity index 100%rename from src/components/ui/NumericInput.tsxrename to apps/mobile/src/components/ui/NumericInput.tsxdiff --git a/src/components/ui/SectionTitle.tsx b/apps/mobile/src/components/ui/SectionTitle.tsxsimilarity index 100%rename from src/components/ui/SectionTitle.tsxrename to apps/mobile/src/components/ui/SectionTitle.tsxdiff --git a/src/components/ui/SpinningLoader.tsx b/apps/mobile/src/components/ui/SpinningLoader.tsxsimilarity index 100%rename from src/components/ui/SpinningLoader.tsxrename to apps/mobile/src/components/ui/SpinningLoader.tsxdiff --git a/src/constants/index.ts b/apps/mobile/src/constants/index.tssimilarity index 100%rename from src/constants/index.tsrename to apps/mobile/src/constants/index.tsdiff --git a/src/contexts/TrackingProvider.tsx b/apps/mobile/src/contexts/TrackingProvider.tsxsimilarity index 100%rename from src/contexts/TrackingProvider.tsxrename to apps/mobile/src/contexts/TrackingProvider.tsxdiff --git a/src/contexts/__tests__/TrackingProvider.test.tsx b/apps/mobile/src/contexts/__tests__/TrackingProvider.test.tsxsimilarity index 100%rename from src/contexts/__tests__/TrackingProvider.test.tsxrename to apps/mobile/src/contexts/__tests__/TrackingProvider.test.tsxdiff --git a/src/hooks/__tests__/useAutoSave.test.ts b/apps/mobile/src/hooks/__tests__/useAutoSave.test.tssimilarity index 100%rename from src/hooks/__tests__/useAutoSave.test.tsrename to apps/mobile/src/hooks/__tests__/useAutoSave.test.tsdiff --git a/src/hooks/__tests__/useLocationTracking.test.ts b/apps/mobile/src/hooks/__tests__/useLocationTracking.test.tssimilarity index 100%rename from src/hooks/__tests__/useLocationTracking.test.tsrename to apps/mobile/src/hooks/__tests__/useLocationTracking.test.tsdiff --git a/src/hooks/__tests__/useTimeout.test.ts b/apps/mobile/src/hooks/__tests__/useTimeout.test.tssimilarity index 100%rename from src/hooks/__tests__/useTimeout.test.tsrename to apps/mobile/src/hooks/__tests__/useTimeout.test.tsdiff --git a/src/hooks/useAutoSave.ts b/apps/mobile/src/hooks/useAutoSave.tssimilarity index 100%rename from src/hooks/useAutoSave.tsrename to apps/mobile/src/hooks/useAutoSave.tsdiff --git a/src/hooks/useLocationTracking.ts b/apps/mobile/src/hooks/useLocationTracking.tssimilarity index 100%rename from src/hooks/useLocationTracking.tsrename to apps/mobile/src/hooks/useLocationTracking.tsdiff --git a/src/hooks/useTheme.tsx b/apps/mobile/src/hooks/useTheme.tsxsimilarity index 100%rename from src/hooks/useTheme.tsxrename to apps/mobile/src/hooks/useTheme.tsxdiff --git a/src/hooks/useTimeout.ts b/apps/mobile/src/hooks/useTimeout.tssimilarity index 100%rename from src/hooks/useTimeout.tsrename to apps/mobile/src/hooks/useTimeout.tsdiff --git a/src/screens/AboutScreen.tsx b/apps/mobile/src/screens/AboutScreen.tsxsimilarity index 100%rename from src/screens/AboutScreen.tsxrename to apps/mobile/src/screens/AboutScreen.tsxdiff --git a/src/screens/ApiSettingsScreen.tsx b/apps/mobile/src/screens/ApiSettingsScreen.tsxsimilarity index 100%rename from src/screens/ApiSettingsScreen.tsxrename to apps/mobile/src/screens/ApiSettingsScreen.tsxdiff --git a/src/screens/AuthSettingsScreen.tsx b/apps/mobile/src/screens/AuthSettingsScreen.tsxsimilarity index 100%rename from src/screens/AuthSettingsScreen.tsxrename to apps/mobile/src/screens/AuthSettingsScreen.tsxdiff --git a/src/screens/DashboardScreen.tsx b/apps/mobile/src/screens/DashboardScreen.tsxsimilarity index 100%rename from src/screens/DashboardScreen.tsxrename to apps/mobile/src/screens/DashboardScreen.tsxdiff --git a/src/screens/DataManagementScreen.tsx b/apps/mobile/src/screens/DataManagementScreen.tsxsimilarity index 100%rename from src/screens/DataManagementScreen.tsxrename to apps/mobile/src/screens/DataManagementScreen.tsxdiff --git a/src/screens/ExportDataScreen.tsx b/apps/mobile/src/screens/ExportDataScreen.tsxsimilarity index 100%rename from src/screens/ExportDataScreen.tsxrename to apps/mobile/src/screens/ExportDataScreen.tsxdiff --git a/src/screens/GeofenceScreen.tsx b/apps/mobile/src/screens/GeofenceScreen.tsxsimilarity index 100%rename from src/screens/GeofenceScreen.tsxrename to apps/mobile/src/screens/GeofenceScreen.tsxdiff --git a/src/screens/LocationInspectorScreen.tsx b/apps/mobile/src/screens/LocationInspectorScreen.tsxsimilarity index 100%rename from src/screens/LocationInspectorScreen.tsxrename to apps/mobile/src/screens/LocationInspectorScreen.tsxdiff --git a/src/screens/SettingsScreen.tsx b/apps/mobile/src/screens/SettingsScreen.tsxsimilarity index 100%rename from src/screens/SettingsScreen.tsxrename to apps/mobile/src/screens/SettingsScreen.tsxdiff --git a/src/screens/index.ts b/apps/mobile/src/screens/index.tssimilarity index 100%rename from src/screens/index.tsrename to apps/mobile/src/screens/index.tsdiff --git a/src/services/LocationServicePermission.ts b/apps/mobile/src/services/LocationServicePermission.tssimilarity index 100%rename from src/services/LocationServicePermission.tsrename to apps/mobile/src/services/LocationServicePermission.tsdiff --git a/src/services/NativeLocationService.ts b/apps/mobile/src/services/NativeLocationService.tssimilarity index 100%rename from src/services/NativeLocationService.tsrename to apps/mobile/src/services/NativeLocationService.tsdiff --git a/src/services/SettingsService.ts b/apps/mobile/src/services/SettingsService.tssimilarity index 100%rename from src/services/SettingsService.tsrename to apps/mobile/src/services/SettingsService.tsdiff --git a/src/services/__tests__/LocationServicePermission.test.ts b/apps/mobile/src/services/__tests__/LocationServicePermission.test.tssimilarity index 100%rename from src/services/__tests__/LocationServicePermission.test.tsrename to apps/mobile/src/services/__tests__/LocationServicePermission.test.tsdiff --git a/src/services/__tests__/NativeLocationService.test.ts b/apps/mobile/src/services/__tests__/NativeLocationService.test.tssimilarity index 100%rename from src/services/__tests__/NativeLocationService.test.tsrename to apps/mobile/src/services/__tests__/NativeLocationService.test.tsdiff --git a/src/services/__tests__/SettingsService.test.ts b/apps/mobile/src/services/__tests__/SettingsService.test.tssimilarity index 100%rename from src/services/__tests__/SettingsService.test.tsrename to apps/mobile/src/services/__tests__/SettingsService.test.tsdiff --git a/src/styles/colors.ts b/apps/mobile/src/styles/colors.tssimilarity index 100%rename from src/styles/colors.tsrename to apps/mobile/src/styles/colors.tsdiff --git a/src/styles/typography.ts b/apps/mobile/src/styles/typography.tssimilarity index 100%rename from src/styles/typography.tsrename to apps/mobile/src/styles/typography.tsdiff --git a/src/types/__tests__/defaults.test.ts b/apps/mobile/src/types/__tests__/defaults.test.tssimilarity index 100%rename from src/types/__tests__/defaults.test.tsrename to apps/mobile/src/types/__tests__/defaults.test.tsdiff --git a/src/types/assets.d.ts b/apps/mobile/src/types/assets.d.tssimilarity index 100%rename from src/types/assets.d.tsrename to apps/mobile/src/types/assets.d.tsdiff --git a/src/types/global.ts b/apps/mobile/src/types/global.tssimilarity index 100%rename from src/types/global.tsrename to apps/mobile/src/types/global.tsdiff --git a/src/utils/__tests__/exportConverters.test.ts b/apps/mobile/src/utils/__tests__/exportConverters.test.tssimilarity index 100%rename from src/utils/__tests__/exportConverters.test.tsrename to apps/mobile/src/utils/__tests__/exportConverters.test.tsdiff --git a/src/utils/__tests__/queueStatus.test.ts b/apps/mobile/src/utils/__tests__/queueStatus.test.tssimilarity index 100%rename from src/utils/__tests__/queueStatus.test.tsrename to apps/mobile/src/utils/__tests__/queueStatus.test.tsdiff --git a/src/utils/__tests__/settingsValidation.test.ts b/apps/mobile/src/utils/__tests__/settingsValidation.test.tssimilarity index 100%rename from src/utils/__tests__/settingsValidation.test.tsrename to apps/mobile/src/utils/__tests__/settingsValidation.test.tsdiff --git a/src/utils/exportConverters.ts b/apps/mobile/src/utils/exportConverters.tssimilarity index 100%rename from src/utils/exportConverters.tsrename to apps/mobile/src/utils/exportConverters.tsdiff --git a/src/utils/queueStatus.ts b/apps/mobile/src/utils/queueStatus.tssimilarity index 100%rename from src/utils/queueStatus.tsrename to apps/mobile/src/utils/queueStatus.tsdiff --git a/src/utils/settingsValidation.ts b/apps/mobile/src/utils/settingsValidation.tssimilarity index 100%rename from src/utils/settingsValidation.tsrename to apps/mobile/src/utils/settingsValidation.tsdiff --git a/tsconfig.json b/apps/mobile/tsconfig.jsonsimilarity index 62%rename from tsconfig.jsonrename to apps/mobile/tsconfig.jsonindex 266ba9ca..e752f040 100644--- a/tsconfig.json+++ b/apps/mobile/tsconfig.json@@ -1,5 +1,5 @@{- "extends": "@react-native/typescript-config",+ "extends": "../../node_modules/@react-native/typescript-config/tsconfig.json","compilerOptions": {"types": ["jest"]},diff --git a/package-lock.json b/package-lock.jsonindex 27641670..bf3ffef5 100644--- a/package-lock.json+++ b/package-lock.json@@ -1,11 +1,25 @@{- "name": "Colota",+ "name": "colota","version": "1.0.0","lockfileVersion": 3,"requires": true,"packages": {"": {- "name": "Colota",+ "name": "colota",+ "version": "1.0.0",+ "workspaces": [+ "apps/*",+ "packages/*"+ ],+ "devDependencies": {+ "prettier": "^2.8.8"+ },+ "engines": {+ "node": ">=20"+ }+ },+ "apps/mobile": {+ "name": "@colota/mobile","version": "1.0.0","dependencies": {"@react-navigation/native": "^7.1.28",@@ -2005,6 +2019,10 @@"dev": true,"license": "MIT"},+ "node_modules/@colota/mobile": {+ "resolved": "apps/mobile",+ "link": true+ },"node_modules/@eslint-community/eslint-utils": {"version": "4.9.1","resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.9.1.tgz",@@ -3311,6 +3329,29 @@"dev": true,"license": "MIT"},+ "node_modules/@react-native/virtualized-lists": {+ "version": "0.83.1",+ "resolved": "https://registry.npmjs.org/@react-native/virtualized-lists/-/virtualized-lists-0.83.1.tgz",+ "integrity": "sha512-MdmoAbQUTOdicCocm5XAFDJWsswxk7hxa6ALnm6Y88p01HFML0W593hAn6qOt9q6IM1KbAcebtH6oOd4gcQy8w==",+ "license": "MIT",+ "dependencies": {+ "invariant": "^2.2.4",+ "nullthrows": "^1.1.1"+ },+ "engines": {+ "node": ">= 20.19.4"+ },+ "peerDependencies": {+ "@types/react": "^19.2.0",+ "react": "*",+ "react-native": "*"+ },+ "peerDependenciesMeta": {+ "@types/react": {+ "optional": true+ }+ }+ },"node_modules/@react-navigation/core": {"version": "7.14.0","resolved": "https://registry.npmjs.org/@react-navigation/core/-/core-7.14.0.tgz",@@ -10621,29 +10662,6 @@"react-native": "*"}},- "node_modules/react-native/node_modules/@react-native/virtualized-lists": {- "version": "0.83.1",- "resolved": "https://registry.npmjs.org/@react-native/virtualized-lists/-/virtualized-lists-0.83.1.tgz",- "integrity": "sha512-MdmoAbQUTOdicCocm5XAFDJWsswxk7hxa6ALnm6Y88p01HFML0W593hAn6qOt9q6IM1KbAcebtH6oOd4gcQy8w==",- "license": "MIT",- "dependencies": {- "invariant": "^2.2.4",- "nullthrows": "^1.1.1"- },- "engines": {- "node": ">= 20.19.4"- },- "peerDependencies": {- "@types/react": "^19.2.0",- "react": "*",- "react-native": "*"- },- "peerDependenciesMeta": {- "@types/react": {- "optional": true- }- }- },"node_modules/react-native/node_modules/commander": {"version": "12.1.0","resolved": "https://registry.npmjs.org/commander/-/commander-12.1.0.tgz",diff --git a/package.json b/package.jsonindex 8fe6a36f..40f84aed 100644--- a/package.json+++ b/package.json@@ -1,55 +1,20 @@{- "name": "Colota",+ "name": "colota","version": "1.0.0","private": true,+ "workspaces": [+ "apps/*",+ "packages/*"+ ],"scripts": {- "android": "react-native run-android",- "ios": "react-native run-ios",- "lint": "eslint . --ext .js,.jsx,.ts,.tsx",+ "lint": "npm run lint --workspaces --if-present",+ "test": "npm run test --workspaces --if-present",+ "clean": "npm run clean --workspaces --if-present","format": "prettier --write \"**/*.{js,jsx,ts,tsx,json,md}\"",- "format:check": "prettier --check \"**/*.{js,jsx,ts,tsx,json,md}\"",- "test": "jest --passWithNoTests",- "test:coverage": "jest --coverage",- "clean": "cd android && gradlew clean && cd ..",- "dev-android": "npx react-native run-android",- "start": "react-native start",- "android:debug": "cd android && gradlew assembleDebug || gradlew assembleDebug && cd ..",- "android:release": "cd android && gradlew assembleRelease || ./gradlew assembleRelease && cd ..",- "android:bundle": "cd android && gradlew bundleRelease || ./gradlew assembleRelease && cd ..",- "deploy-release": "adb install android/app/build/outputs/apk/release/app-release.apk",- "deploy-bundle": "adb install android/app/build/outputs/apk/bundle/app-release.aab"- },- "dependencies": {- "@react-navigation/native": "^7.1.28",- "@react-navigation/native-stack": "^7.12.0",- "lucide-react-native": "^0.564.0",- "react": "19.2.0",- "react-native": "0.83.1",- "react-native-safe-area-context": "^5.6.2",- "react-native-screens": "^4.23.0",- "react-native-svg": "^15.15.3",- "react-native-webview": "^13.16.0"+ "format:check": "prettier --check \"**/*.{js,jsx,ts,tsx,json,md}\""},"devDependencies": {- "@babel/core": "^7.29.0",- "@babel/preset-env": "^7.29.0",- "@babel/runtime": "^7.28.6",- "@react-native-community/cli": "20.0.0",- "@react-native-community/cli-platform-android": "20.0.0",- "@react-native-community/cli-platform-ios": "20.0.0",- "@react-native/babel-preset": "0.83.1",- "@react-native/eslint-config": "0.83.1",- "@react-native/metro-config": "0.83.1",- "@react-native/typescript-config": "0.83.1",- "@testing-library/react-native": "^13.3.3",- "@types/jest": "^29.5.13",- "@types/react": "^19.2.14",- "@types/react-test-renderer": "^19.1.0",- "eslint": "^8.19.0",- "jest": "^29.6.3",- "prettier": "^2.8.8",- "react-test-renderer": "19.2.0",- "typescript": "^5.8.3"+ "prettier": "^2.8.8"},"engines": {"node": ">=20"