diff --git a/public/assets/index-BRvZR5R_.js b/public/assets/index-BRvZR5R_.js new file mode 100644 index 0000000..51e9cbb --- /dev/null +++ b/public/assets/index-BRvZR5R_.js @@ -0,0 +1,58 @@ +(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var e=`modulepreload`,t=function(e){return`/`+e},n={},r=function(e){return e.pathname.endsWith(`.css`)},i=function(e,t,n){if(t in e)return e[t];let r=n();if(!r){e[t]=void 0;return}let i=r.then(()=>{e[t]=void 0},n=>{throw e[t]=void 0,n});return e[t]=i,i},a=function(a,o,s){let c=Promise.resolve();if(o&&o.length>0){let a,l=document.querySelector(`meta[property=csp-nonce]`),u=l?.nonce||l?.getAttribute(`nonce`);function d(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function f(e){return import.meta.resolve?new URL(import.meta.resolve(e)):new URL(e,import.meta.url)}c=d(o.map(o=>{o=t(o,s);let c=f(o),l=r(c);return i(n,c.href,()=>{if(a===void 0){a={all:new Set,styles:new Set};let e=document.getElementsByTagName(`link`);for(let t=e.length-1;t>=0;t--){let n=e[t];a.all.add(n.href),n.rel===`stylesheet`&&a.styles.add(n.href)}}if((l?a.styles:a.all).has(c.href))return;let t=document.createElement(`link`);if(t.rel=l?`stylesheet`:e,l||(t.as=`script`),t.crossOrigin=``,t.href=c.href,u&&t.setAttribute(`nonce`,u),document.head.appendChild(t),l)return new Promise((e,n)=>{t.addEventListener(`load`,e),t.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${c}`)))})})}).filter(e=>e!==void 0))}function l(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return c.then(e=>{for(let t of e||[])t.status===`rejected`&&l(t.reason);return a().catch(l)})},o=`true`,s=`false`,c=o===`true`,l=s===`true`;function u(e={}){let{immediate:t=!1,onNeedReload:n,onNeedRefresh:r,onOfflineReady:i,onRegistered:o,onRegisteredSW:s,onRegisterError:u}=e,d,f,p,m=async(e=!0)=>{await f,c||p?.()};async function h(){if(`serviceWorker`in navigator){if(d=await a(async()=>{let{Workbox:e}=await import(`./workbox-window.prod.es5-Bd17z0YL.js`);return{Workbox:e}},[]).then(({Workbox:e})=>new e(`/sw.js`,{scope:`/`,type:`classic`})).catch(e=>{u?.(e)}),!d)return;if(p=()=>{d?.messageSkipWaiting()},!l){if(c)d.addEventListener(`activated`,e=>{(e.isUpdate||e.isExternal)&&(n?n():window.location.reload())}),d.addEventListener(`installed`,e=>{e.isUpdate||i?.()});else{let e=!1,t=()=>{e=!0,d?.addEventListener(`controlling`,e=>{e.isUpdate&&(n?n():window.location.reload())}),r?.()};d.addEventListener(`installed`,n=>{n.isUpdate===void 0?n.isExternal===void 0?!e&&i?.():n.isExternal?t():!e&&i?.():n.isUpdate||i?.()}),d.addEventListener(`waiting`,t)}}d.register({immediate:t}).then(e=>{s?s(`/sw.js`,e):o?.(e)}).catch(e=>{u?.(e)})}}return f=h(),m}var d=`kacheln`;function f(e){return`/kacheln/${e}.png`}function p(e){if(!e.startsWith(`/kacheln/`)||!e.endsWith(`.png`))return null;let t=e.slice(9,-4);return t.length>0?t:null}function m(){return{async ids(){let e=await(await caches.open(d)).keys(),t=[];for(let n of e){let e=p(new URL(n.url).pathname);e&&t.push(e)}return t},async put(e,t){let n=await caches.open(d),r=new Uint8Array(t);await n.put(f(e),new Response(r,{headers:{"Content-Type":`image/png`}}))},async delete(e){let t=await caches.open(d);await Promise.all(e.map(e=>t.delete(f(e))))}}}var h=`karte-shell-repaired`;async function g(e){let t=await e.registrations();await Promise.all(t.map(e=>e.unregister()));let n=await e.cacheNames();await Promise.all(n.filter(e=>e!==d).map(t=>e.deleteCache(t)))}async function _(e){await e.deleteCache(d)}function v(e){return e instanceof Error&&e.message.trim()?e.message:`Unbekannter Fehler`}function y(){return{async registrations(){return navigator.serviceWorker?navigator.serviceWorker.getRegistrations():[]},cacheNames:()=>caches.keys(),deleteCache:e=>caches.delete(e)}}function b(e=C()){try{return e?.getItem(h)===`1`}catch{return!1}}function x(e=C()){try{e?.setItem(h,`1`)}catch{}}function S(e=C()){try{e?.removeItem(h)}catch{}}function C(){try{return typeof sessionStorage>`u`?null:sessionStorage}catch{return null}}function w(){return{async fetch(e,t){let n=await fetch(f(e),{signal:t,cache:`no-store`});if(!n.ok)throw Error(`Kachel ${e} konnte nicht geladen werden.`);return new Uint8Array(await n.arrayBuffer())}}}var T=`karte`,E=`marks`,D=`heruntergeladen`;function O(){return new Promise((e,t)=>{let n=indexedDB.open(T,1);n.onupgradeneeded=()=>{let e=n.result;e.objectStoreNames.contains(E)||e.createObjectStore(E)},n.onsuccess=()=>e(n.result),n.onerror=()=>t(n.error??Error(`IndexedDB`))})}function k(e){return Array.isArray(e)?e.filter(e=>typeof e==`string`):[]}function A(e){if(Array.isArray(e))return{heruntergeladen:k(e),ziele:[],downloadKnopf:!1};if(e&&typeof e==`object`){let t=e;return{heruntergeladen:k(t.heruntergeladen),ziele:k(t.ziele),downloadKnopf:t.downloadKnopf===!0}}return{heruntergeladen:[],ziele:[],downloadKnopf:!1}}function ee(e,t){return new Promise((n,r)=>{e.oncomplete=()=>n(t()),e.onerror=()=>r(e.error??Error(`IndexedDB`)),e.onabort=()=>r(e.error??Error(`IndexedDB`))})}function te(){return{async read(){let e=await O();try{let t=e.transaction(E,`readonly`),n=t.objectStore(E).get(D);return A(await ee(t,()=>n.result))}finally{e.close()}},async write(e){let t=await O();try{let n=t.transaction(E,`readwrite`);n.objectStore(E).put({heruntergeladen:e.heruntergeladen,ziele:e.ziele,downloadKnopf:e.downloadKnopf},D),await ee(n,()=>void 0)}finally{t.close()}}}}function ne(e){e(`EPSG:4326`,`+title=WGS 84 (long/lat) +proj=longlat +ellps=WGS84 +datum=WGS84 +units=degrees`),e(`EPSG:4269`,`+title=NAD83 (long/lat) +proj=longlat +a=6378137.0 +b=6356752.31414036 +ellps=GRS80 +datum=NAD83 +units=degrees`),e(`EPSG:3857`,`+title=WGS 84 / Pseudo-Mercator +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs`);for(var t=1;t<=60;++t)e(`EPSG:`+(32600+t),`+proj=utm +zone=`+t+` +datum=WGS84 +units=m`),e(`EPSG:`+(32700+t),`+proj=utm +zone=`+t+` +south +datum=WGS84 +units=m`);e(`EPSG:5041`,`+title=WGS 84 / UPS North (E,N) +proj=stere +lat_0=90 +lon_0=0 +k=0.994 +x_0=2000000 +y_0=2000000 +datum=WGS84 +units=m`),e(`EPSG:5042`,`+title=WGS 84 / UPS South (E,N) +proj=stere +lat_0=-90 +lon_0=0 +k=0.994 +x_0=2000000 +y_0=2000000 +datum=WGS84 +units=m`),e.WGS84=e[`EPSG:4326`],e[`EPSG:3785`]=e[`EPSG:3857`],e.GOOGLE=e[`EPSG:3857`],e[`EPSG:900913`]=e[`EPSG:3857`],e[`EPSG:102113`]=e[`EPSG:3857`]}var re=6378137,j=6356752.314,ie=.0066943799901413165,ae=484813681109536e-20,M=Math.PI/2,oe=.16666666666666666,se=.04722222222222222,ce=.022156084656084655,le=1e-10,N=.017453292519943295,ue=57.29577951308232,P=Math.PI/4,de=Math.PI*2,fe=3.14159265359,pe={};pe.greenwich=0,pe.lisbon=-9.131906111111,pe.paris=2.337229166667,pe.bogota=-74.080916666667,pe.madrid=-3.687938888889,pe.rome=12.452333333333,pe.bern=7.439583333333,pe.jakarta=106.807719444444,pe.ferro=-17.666666666667,pe.brussels=4.367975,pe.stockholm=18.058277777778,pe.athens=23.7163375,pe.oslo=10.722916666667;var me={mm:{to_meter:.001},cm:{to_meter:.01},ft:{to_meter:.3048},"us-ft":{to_meter:1200/3937},fath:{to_meter:1.8288},kmi:{to_meter:1852},"us-ch":{to_meter:20.1168402336805},"us-mi":{to_meter:1609.34721869444},km:{to_meter:1e3},"ind-ft":{to_meter:.30479841},"ind-yd":{to_meter:.91439523},mi:{to_meter:1609.344},yd:{to_meter:.9144},ch:{to_meter:20.1168},link:{to_meter:.201168},dm:{to_meter:.1},in:{to_meter:.0254},"ind-ch":{to_meter:20.11669506},"us-in":{to_meter:.025400050800101},"us-yd":{to_meter:.914401828803658}},he=/[\s_\-\/\(\)]/g;function ge(e,t){if(e[t])return e[t];for(var n=Object.keys(e),r=t.toLowerCase().replace(he,``),i=-1,a,o;++iArray.isArray(e)&&e[0]===`ID`);return t&&t.length>=3?{authority:t[1],code:parseInt(t[2],10)}:null}static convertUnit(e,t=`unit`){if(!e||e.length<3)return{type:t,name:`unknown`,conversion_factor:null};let n=e[1],r=parseFloat(e[2])||null,i=e.find(e=>Array.isArray(e)&&e[0]===`ID`);return{type:t,name:n,conversion_factor:r,id:i?{authority:i[1],code:parseInt(i[2],10)}:null}}static convertAxis(e){let t=e[1]||`Unknown`,n,r=t.match(/^\((.)\)$/);if(r){let t=r[1].toUpperCase();if(t===`E`)n=`east`;else if(t===`N`)n=`north`;else if(t===`U`)n=`up`;else if(e[2])n=e[2];else throw Error(`Unknown axis abbreviation: ${t}`)}else n=e[2]||`unknown`;let i=e.find(e=>Array.isArray(e)&&e[0]===`ORDER`),a=i?parseInt(i[1],10):null,o=e.find(e=>Array.isArray(e)&&(e[0]===`LENGTHUNIT`||e[0]===`ANGLEUNIT`||e[0]===`SCALEUNIT`)),s=this.convertUnit(o);return{name:t,direction:n,unit:s,order:a}}static extractAxes(e){return e.filter(e=>Array.isArray(e)&&e[0]===`AXIS`).map(e=>this.convertAxis(e)).sort((e,t)=>(e.order||0)-(t.order||0))}static convert(e,t={}){switch(e[0]){case`PROJCRS`:t.type=`ProjectedCRS`,t.name=e[1],t.base_crs=e.find(e=>Array.isArray(e)&&e[0]===`BASEGEOGCRS`)?this.convert(e.find(e=>Array.isArray(e)&&e[0]===`BASEGEOGCRS`)):null,t.conversion=e.find(e=>Array.isArray(e)&&e[0]===`CONVERSION`)?this.convert(e.find(e=>Array.isArray(e)&&e[0]===`CONVERSION`)):null;let n=e.find(e=>Array.isArray(e)&&e[0]===`CS`);n&&(t.coordinate_system={subtype:n[1],axis:this.extractAxes(e)});let r=e.find(e=>Array.isArray(e)&&e[0]===`LENGTHUNIT`);if(r){let e=this.convertUnit(r);t.coordinate_system.unit=e}t.id=this.getId(e);break;case`BASEGEOGCRS`:case`GEOGCRS`:case`GEODCRS`:t.type=e[0]===`GEODCRS`?`GeodeticCRS`:`GeographicCRS`,t.name=e[1];let i=e.find(e=>Array.isArray(e)&&(e[0]===`DATUM`||e[0]===`ENSEMBLE`));if(i){let n=this.convert(i);i[0]===`ENSEMBLE`?t.datum_ensemble=n:t.datum=n;let r=e.find(e=>Array.isArray(e)&&e[0]===`PRIMEM`);r&&r[1]!==`Greenwich`&&(n.prime_meridian={name:r[1],longitude:parseFloat(r[2])})}let a=e.find(e=>Array.isArray(e)&&e[0]===`CS`);t.coordinate_system={subtype:a?a[1]:`ellipsoidal`,axis:this.extractAxes(e)},t.id=this.getId(e);break;case`DATUM`:t.type=`GeodeticReferenceFrame`,t.name=e[1],t.ellipsoid=e.find(e=>Array.isArray(e)&&e[0]===`ELLIPSOID`)?this.convert(e.find(e=>Array.isArray(e)&&e[0]===`ELLIPSOID`)):null;break;case`ENSEMBLE`:t.type=`DatumEnsemble`,t.name=e[1],t.members=e.filter(e=>Array.isArray(e)&&e[0]===`MEMBER`).map(e=>({type:`DatumEnsembleMember`,name:e[1],id:this.getId(e)}));let o=e.find(e=>Array.isArray(e)&&e[0]===`ENSEMBLEACCURACY`);o&&(t.accuracy=parseFloat(o[1]));let s=e.find(e=>Array.isArray(e)&&e[0]===`ELLIPSOID`);s&&(t.ellipsoid=this.convert(s)),t.id=this.getId(e);break;case`ELLIPSOID`:t.type=`Ellipsoid`,t.name=e[1],t.semi_major_axis=parseFloat(e[2]),t.inverse_flattening=parseFloat(e[3]),e.find(e=>Array.isArray(e)&&e[0]===`LENGTHUNIT`)&&this.convert(e.find(e=>Array.isArray(e)&&e[0]===`LENGTHUNIT`),t);break;case`CONVERSION`:t.type=`Conversion`,t.name=e[1],t.method=e.find(e=>Array.isArray(e)&&e[0]===`METHOD`)?this.convert(e.find(e=>Array.isArray(e)&&e[0]===`METHOD`)):null,t.parameters=e.filter(e=>Array.isArray(e)&&e[0]===`PARAMETER`).map(e=>this.convert(e));break;case`METHOD`:t.type=`Method`,t.name=e[1],t.id=this.getId(e);break;case`PARAMETER`:t.type=`Parameter`,t.name=e[1],t.value=parseFloat(e[2]),t.unit=this.convertUnit(e.find(e=>Array.isArray(e)&&(e[0]===`LENGTHUNIT`||e[0]===`ANGLEUNIT`||e[0]===`SCALEUNIT`))),t.id=this.getId(e);break;case`BOUNDCRS`:t.type=`BoundCRS`;let c=e.find(e=>Array.isArray(e)&&e[0]===`SOURCECRS`);if(c){let e=c.find(e=>Array.isArray(e));t.source_crs=e?this.convert(e):null}let l=e.find(e=>Array.isArray(e)&&e[0]===`TARGETCRS`);if(l){let e=l.find(e=>Array.isArray(e));t.target_crs=e?this.convert(e):null}let u=e.find(e=>Array.isArray(e)&&e[0]===`ABRIDGEDTRANSFORMATION`);t.transformation=u?this.convert(u):null;break;case`ABRIDGEDTRANSFORMATION`:if(t.type=`Transformation`,t.name=e[1],t.method=e.find(e=>Array.isArray(e)&&e[0]===`METHOD`)?this.convert(e.find(e=>Array.isArray(e)&&e[0]===`METHOD`)):null,t.parameters=e.filter(e=>Array.isArray(e)&&(e[0]===`PARAMETER`||e[0]===`PARAMETERFILE`)).map(e=>{if(e[0]===`PARAMETER`)return this.convert(e);if(e[0]===`PARAMETERFILE`)return{name:e[1],value:e[2],id:{authority:`EPSG`,code:8656}}}),t.parameters.length===7){let e=t.parameters[6];e.name===`Scale difference`&&(e.value=Math.round((e.value-1)*0xe8d4a51000)/1e6)}t.id=this.getId(e);break;case`AXIS`:t.coordinate_system||={type:`unspecified`,axis:[]},t.coordinate_system.axis.push(this.convertAxis(e));break;case`LENGTHUNIT`:let d=this.convertUnit(e,`LinearUnit`);t.coordinate_system&&t.coordinate_system.axis&&t.coordinate_system.axis.forEach(e=>{e.unit||=d}),d.conversion_factor&&d.conversion_factor!==1&&(t.semi_major_axis&&={value:t.semi_major_axis,unit:d});break;default:t.keyword=e[0]}return t}};function ye(e){return ve.convert(e)}function be(e){let t=e.toUpperCase();return t.includes(`PROJCRS`)||t.includes(`GEOGCRS`)||t.includes(`BOUNDCRS`)||t.includes(`VERTCRS`)||t.includes(`LENGTHUNIT`)||t.includes(`ANGLEUNIT`)||t.includes(`SCALEUNIT`)?`WKT2`:(t.includes(`PROJCS`)||t.includes(`GEOGCS`)||t.includes(`LOCAL_CS`)||t.includes(`VERT_CS`)||t.includes(`UNIT`),`WKT1`)}var xe=Pe,Se=1,Ce=2,we=3,Te=4,Ee=5,De=-1,Oe=/\s/,ke=/[A-Za-z]/,Ae=/[A-Za-z84_]/,je=/[,\]]/,Me=/[\d\.E\-\+]/;function Ne(e){if(typeof e!=`string`)throw Error(`not a string`);this.text=e.trim(),this.level=0,this.place=0,this.root=null,this.stack=[],this.currentObject=null,this.state=Se}Ne.prototype.readCharicter=function(){var e=this.text[this.place++];if(this.state!==Te)for(;Oe.test(e);){if(this.place>=this.text.length)return;e=this.text[this.place++]}switch(this.state){case Se:return this.neutral(e);case Ce:return this.keyword(e);case Te:return this.quoted(e);case Ee:return this.afterquote(e);case we:return this.number(e);case De:return}},Ne.prototype.afterquote=function(e){if(e===`"`)this.word+=`"`,this.state=Te;else if(je.test(e))this.word=this.word.trim(),this.afterItem(e);else throw Error(`havn't handled "`+e+`" in afterquote yet, index `+this.place)},Ne.prototype.afterItem=function(e){e===`,`?(this.word!==null&&this.currentObject.push(this.word),this.word=null,this.state=Se):e===`]`&&(this.level--,this.word!==null&&(this.currentObject.push(this.word),this.word=null),this.state=Se,this.currentObject=this.stack.pop(),this.currentObject||(this.state=De))},Ne.prototype.number=function(e){if(Me.test(e))this.word+=e;else if(je.test(e))this.word=parseFloat(this.word),this.afterItem(e);else throw Error(`havn't handled "`+e+`" in number yet, index `+this.place)},Ne.prototype.quoted=function(e){e===`"`?this.state=Ee:this.word+=e},Ne.prototype.keyword=function(e){if(Ae.test(e))this.word+=e;else if(e===`[`){var t=[];t.push(this.word),this.level++,this.root===null?this.root=t:this.currentObject.push(t),this.stack.push(this.currentObject),this.currentObject=t,this.state=Se}else if(je.test(e))this.afterItem(e);else throw Error(`havn't handled "`+e+`" in keyword yet, index `+this.place)},Ne.prototype.neutral=function(e){if(ke.test(e))this.word=e,this.state=Ce;else if(e===`"`)this.word=``,this.state=Te;else if(Me.test(e))this.word=e,this.state=we;else if(je.test(e))this.afterItem(e);else throw Error(`havn't handled "`+e+`" in neutral yet, index `+this.place)},Ne.prototype.output=function(){for(;this.place0?90:-90),e.lat_ts=e.lat1,delete e.lat1):!e.lat_ts&&e.lat0&&(t===`polar stereographic`||t===`polar stereographic (variant a)`)&&(e.lat_ts=e.lat0,e.lat0=Re(e.lat0>0?90:-90),delete e.lat1)}function Be(e){let t={units:null,to_meter:void 0};return typeof e==`string`?(t.units=e.toLowerCase(),t.units===`metre`&&(t.units=`meter`),t.units===`meter`&&(t.to_meter=1)):e&&e.name&&(t.units=e.name.toLowerCase(),t.units===`metre`&&(t.units=`meter`),t.to_meter=e.conversion_factor),t}function Ve(e){return typeof e==`object`?e.value*e.unit.conversion_factor:e}function He(e,t){e.ellipsoid.radius?(t.a=e.ellipsoid.radius,t.rf=0):(t.a=Ve(e.ellipsoid.semi_major_axis),e.ellipsoid.inverse_flattening===void 0?e.ellipsoid.semi_major_axis!==void 0&&e.ellipsoid.semi_minor_axis!==void 0&&(t.rf=t.a/(t.a-Ve(e.ellipsoid.semi_minor_axis))):t.rf=e.ellipsoid.inverse_flattening)}function Ue(e,t={}){return!e||typeof e!=`object`?e:e.type===`BoundCRS`?(Ue(e.source_crs,t),e.transformation&&(e.transformation.method&&e.transformation.method.name===`NTv2`?t.nadgrids=e.transformation.parameters[0].value:t.datum_params=e.transformation.parameters.map(e=>e.value)),t):(Object.keys(e).forEach(n=>{let r=e[n];if(r!==null)switch(n){case`name`:if(t.srsCode)break;t.name=r,t.srsCode=r;break;case`type`:r===`GeographicCRS`?t.projName=`longlat`:r===`GeodeticCRS`?t.projName=e.coordinate_system&&e.coordinate_system.subtype===`Cartesian`?`geocent`:`longlat`:r===`ProjectedCRS`&&e.conversion&&e.conversion.method&&(t.projName=e.conversion.method.name);break;case`datum`:case`datum_ensemble`:r.ellipsoid&&(t.ellps=r.ellipsoid.name,He(r,t)),r.prime_meridian&&(t.from_greenwich=r.prime_meridian.longitude*Math.PI/180);break;case`ellipsoid`:t.ellps=r.name,He(r,t);break;case`prime_meridian`:t.long0=(r.longitude||0)*Math.PI/180;break;case`coordinate_system`:if(r.axis){let e={east:`e`,north:`n`,west:`w`,south:`s`,up:`u`,down:`d`,geocentricx:`e`,geocentricy:`n`,geocentricz:`u`},n=r.axis.map(t=>e[t.direction.toLowerCase()]);if(n.every(Boolean)&&(t.axis=n.join(``),t.axis.length===2&&(t.axis+=`u`)),r.unit){let{units:e,to_meter:n}=Be(r.unit);t.units=e,t.to_meter=n}else if(r.axis[0]&&r.axis[0].unit){let{units:e,to_meter:n}=Be(r.axis[0].unit);t.units=e,t.to_meter=n}}break;case`id`:r.authority&&r.code&&(t.title=r.authority+`:`+r.code);break;case`conversion`:r.method&&r.method.name&&(t.projName=r.method.name),r.parameters&&r.parameters.forEach(e=>{let n=e.name.toLowerCase().replace(/\s+/g,`_`),r=e.value;t[n]=e.unit&&e.unit.conversion_factor?r*e.unit.conversion_factor:e.unit===`degree`?r*Math.PI/180:r});break;case`unit`:r.name&&(t.units=r.name.toLowerCase(),t.units===`metre`&&(t.units=`meter`)),r.conversion_factor&&(t.to_meter=r.conversion_factor);break;case`base_crs`:Ue(r,t),t.datumCode=r.id?r.id.authority+`_`+r.id.code:r.name}}),t.latitude_of_false_origin!==void 0&&(t.lat0=t.latitude_of_false_origin),t.longitude_of_false_origin!==void 0&&(t.long0=t.longitude_of_false_origin),t.latitude_of_standard_parallel!==void 0&&(t.lat0=t.latitude_of_standard_parallel,t.lat1=t.latitude_of_standard_parallel),t.latitude_of_1st_standard_parallel!==void 0&&(t.lat1=t.latitude_of_1st_standard_parallel),t.latitude_of_2nd_standard_parallel!==void 0&&(t.lat2=t.latitude_of_2nd_standard_parallel),t.latitude_of_projection_centre!==void 0&&(t.lat0=t.latitude_of_projection_centre),t.longitude_of_projection_centre!==void 0&&(t.longc=t.longitude_of_projection_centre),t.easting_at_false_origin!==void 0&&(t.x0=t.easting_at_false_origin),t.northing_at_false_origin!==void 0&&(t.y0=t.northing_at_false_origin),t.latitude_of_natural_origin!==void 0&&(t.lat0=t.latitude_of_natural_origin),t.longitude_of_natural_origin!==void 0&&(t.long0=t.longitude_of_natural_origin),t.longitude_of_origin!==void 0&&(t.long0=t.longitude_of_origin),t.false_easting!==void 0&&(t.x0=t.false_easting),t.easting_at_projection_centre&&(t.x0=t.easting_at_projection_centre),t.false_northing!==void 0&&(t.y0=t.false_northing),t.northing_at_projection_centre&&(t.y0=t.northing_at_projection_centre),t.standard_parallel_1!==void 0&&(t.lat1=t.standard_parallel_1),t.standard_parallel_2!==void 0&&(t.lat2=t.standard_parallel_2),t.scale_factor_at_natural_origin!==void 0&&(t.k0=t.scale_factor_at_natural_origin),t.scale_factor_at_projection_centre!==void 0&&(t.k0=t.scale_factor_at_projection_centre),t.scale_factor_on_pseudo_standard_parallel!==void 0&&(t.k0=t.scale_factor_on_pseudo_standard_parallel),t.azimuth!==void 0&&(t.alpha=t.azimuth),t.azimuth_at_projection_centre!==void 0&&(t.alpha=t.azimuth_at_projection_centre),t.angle_from_rectified_to_skew_grid&&(t.rectified_grid_angle=t.angle_from_rectified_to_skew_grid),ze(t),t)}var We=[`PROJECTEDCRS`,`PROJCRS`,`GEOGCS`,`GEOCCS`,`PROJCS`,`LOCAL_CS`,`GEODCRS`,`GEODETICCRS`,`GEODETICDATUM`,`ENGCRS`,`ENGINEERINGCRS`];function Ge(e,t){var n=t[0],r=t[1];!(n in e)&&r in e&&(e[n]=e[r],t.length===3&&(e[n]=t[2](e[n])))}function Ke(e){for(var t=Object.keys(e),n=0,r=t.length;n-1;var t=ge(e,`authority`);if(t){var n=ge(t,`epsg`);return n&&$e.indexOf(n)>-1}}function tt(e){var t=ge(e,`extension`);if(t)return ge(t,`proj4`)}function nt(e){return e[0]===`+`}function rt(e){let t;if(Xe(e)){if(Ze(e))t=Ye[e];else if(Qe(e)){t=Je(e);var n=tt(t);n&&(t=_e(n))}else nt(e)&&(t=_e(e))}else t=`projName`in e?e:Je(e);return t&&et(t)?Ye[`EPSG:3857`]:t}function it(e,t){e||={};var n,r;if(!t)return e;for(r in t)n=t[r],n!==void 0&&(e[r]=n);return e}function at(e,t,n){var r=e*t;return n/Math.sqrt(1-r*r)}function ot(e){return e<0?-1:1}function F(e,t){return t||Math.abs(e)<=3.14159265359?e:e-ot(e)*de}function st(e,t,n){var r=e*n,i=.5*e;return r=((1-r)/(1+r))**i,Math.tan(.5*(M-t))/r}function ct(e,t){for(var n=.5*e,r,i,a=M-2*Math.atan(t),o=0;o<=15;o++)if(r=e*Math.sin(a),i=M-2*Math.atan(t*((1-r)/(1+r))**n)-a,a+=i,Math.abs(i)<=1e-10)return a;return-9999}function lt(){var e=this.b/this.a;this.es=1-e*e,`x0`in this||(this.x0=0),`y0`in this||(this.y0=0),this.long0=this.long0||0,this.e=Math.sqrt(this.es),this.lat_ts?this.k0=this.sphere?Math.cos(this.lat_ts):at(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)):this.k0||=this.k?this.k:1}function ut(e){var t=e.x,n=e.y;if(n*57.29577951308232>90&&n*57.29577951308232<-90&&t*57.29577951308232>180&&t*57.29577951308232<-180)return null;var r,i;if(Math.abs(Math.abs(n)-M)<=1e-10)return null;if(this.sphere)r=this.x0+this.a*this.k0*F(t-this.long0,this.over),i=this.y0+this.a*this.k0*Math.log(Math.tan(P+.5*n));else{var a=Math.sin(n),o=st(this.e,n,a);r=this.x0+this.a*this.k0*F(t-this.long0,this.over),i=this.y0-this.a*this.k0*Math.log(o)}return e.x=r,e.y=i,e}function dt(e){var t=e.x-this.x0,n=e.y-this.y0,r,i;if(this.sphere)i=M-2*Math.atan(Math.exp(-n/(this.a*this.k0)));else{var a=Math.exp(-n/(this.a*this.k0));if(i=ct(this.e,a),i===-9999)return null}return r=F(this.long0+t/(this.a*this.k0),this.over),e.x=r,e.y=i,e}var ft={init:lt,forward:ut,inverse:dt,names:[`Mercator`,`Popular Visualisation Pseudo Mercator`,`Mercator_1SP`,`Mercator_Auxiliary_Sphere`,`Mercator_Variant_A`,`merc`]};function pt(){}function mt(e){return e}var ht=[`longlat`,`identity`,`lonlat`,`latlon`,`latlong`],gt=[ft,{init:pt,forward:mt,inverse:mt,names:ht}],_t={},vt=[];function yt(e,t){var n=vt.length;return e.names?(vt[n]=e,e.names.forEach(function(e){_t[e.toLowerCase()]=n}),this):(console.log(t),!0)}function bt(e){return e.replace(/[-\(\)\s]+/g,` `).trim().replace(/ /g,`_`)}function xt(e){if(!e)return!1;var t=e.toLowerCase();if(_t[t]!==void 0&&vt[_t[t]]||(t=bt(t),t in _t&&vt[_t[t]]))return vt[_t[t]]}function St(){gt.forEach(yt)}var Ct={start:St,add:yt,get:xt},wt={MERIT:{a:6378137,rf:298.257,ellipseName:`MERIT 1983`},SGS85:{a:6378136,rf:298.257,ellipseName:`Soviet Geodetic System 85`},GRS80:{a:6378137,rf:298.257222101,ellipseName:`GRS 1980(IUGG, 1980)`},IAU76:{a:6378140,rf:298.257,ellipseName:`IAU 1976`},airy:{a:6377563.396,b:6356256.91,ellipseName:`Airy 1830`},APL4:{a:6378137,rf:298.25,ellipseName:`Appl. Physics. 1965`},NWL9D:{a:6378145,rf:298.25,ellipseName:`Naval Weapons Lab., 1965`},mod_airy:{a:6377340.189,b:6356034.446,ellipseName:`Modified Airy`},andrae:{a:6377104.43,rf:300,ellipseName:`Andrae 1876 (Den., Iclnd.)`},aust_SA:{a:6378160,rf:298.25,ellipseName:`Australian Natl & S. Amer. 1969`},GRS67:{a:6378160,rf:298.247167427,ellipseName:`GRS 67(IUGG 1967)`},bessel:{a:6377397.155,rf:299.1528128,ellipseName:`Bessel 1841`},bess_nam:{a:6377483.865,rf:299.1528128,ellipseName:`Bessel 1841 (Namibia)`},clrk66:{a:6378206.4,b:6356583.8,ellipseName:`Clarke 1866`},clrk80:{a:6378249.145,rf:293.4663,ellipseName:`Clarke 1880 mod.`},clrk80ign:{a:6378249.2,b:6356515,rf:293.4660213,ellipseName:`Clarke 1880 (IGN)`},clrk58:{a:6378293.645208759,rf:294.2606763692654,ellipseName:`Clarke 1858`},CPM:{a:6375738.7,rf:334.29,ellipseName:`Comm. des Poids et Mesures 1799`},delmbr:{a:6376428,rf:311.5,ellipseName:`Delambre 1810 (Belgium)`},engelis:{a:6378136.05,rf:298.2566,ellipseName:`Engelis 1985`},evrst30:{a:6377276.345,rf:300.8017,ellipseName:`Everest 1830`},evrst48:{a:6377304.063,rf:300.8017,ellipseName:`Everest 1948`},evrst56:{a:6377301.243,rf:300.8017,ellipseName:`Everest 1956`},evrst69:{a:6377295.664,rf:300.8017,ellipseName:`Everest 1969`},evrstSS:{a:6377298.556,rf:300.8017,ellipseName:`Everest (Sabah & Sarawak)`},fschr60:{a:6378166,rf:298.3,ellipseName:`Fischer (Mercury Datum) 1960`},fschr60m:{a:6378155,rf:298.3,ellipseName:`Fischer 1960`},fschr68:{a:6378150,rf:298.3,ellipseName:`Fischer 1968`},helmert:{a:6378200,rf:298.3,ellipseName:`Helmert 1906`},hough:{a:6378270,rf:297,ellipseName:`Hough`},intl:{a:6378388,rf:297,ellipseName:`International 1909 (Hayford)`},kaula:{a:6378163,rf:298.24,ellipseName:`Kaula 1961`},lerch:{a:6378139,rf:298.257,ellipseName:`Lerch 1979`},mprts:{a:6397300,rf:191,ellipseName:`Maupertius 1738`},new_intl:{a:6378157.5,b:6356772.2,ellipseName:`New International 1967`},plessis:{a:6376523,b:6355863,ellipseName:`Plessis 1817 (France)`},krass:{a:6378245,rf:298.3,ellipseName:`Krassovsky, 1942`},SEasia:{a:6378155,b:6356773.3205,ellipseName:`Southeast Asia`},walbeck:{a:6376896,b:6355834.8467,ellipseName:`Walbeck`},WGS60:{a:6378165,rf:298.3,ellipseName:`WGS 60`},WGS66:{a:6378145,rf:298.25,ellipseName:`WGS 66`},WGS7:{a:6378135,rf:298.26,ellipseName:`WGS 72`},WGS84:{a:6378137,rf:298.257223563,ellipseName:`WGS 84`},sphere:{a:6370997,b:6370997,ellipseName:`Normal Sphere (r=6370997)`}},Tt=wt.WGS84;function Et(e,t,n,r){var i=e*e,a=t*t,o=(i-a)/i,s=0;r?(e*=1-o*(oe+o*(se+o*ce)),i=e*e,o=0):s=Math.sqrt(o);var c=(i-a)/a;return{es:o,e:s,ep2:c}}function Dt(e,t,n,r,i){if(!e){var a=ge(wt,r);a||=Tt,e=a.a,t=a.b,n=a.rf}return n&&!t&&(t=(1-1/n)*e),(n===0||Math.abs(e-t)<1e-10)&&(i=!0,t=e),{a:e,b:t,rf:n,sphere:i}}var Ot={wgs84:{towgs84:`0,0,0`,ellipse:`WGS84`,datumName:`WGS84`},ch1903:{towgs84:`674.374,15.056,405.346`,ellipse:`bessel`,datumName:`swiss`},ggrs87:{towgs84:`-199.87,74.79,246.62`,ellipse:`GRS80`,datumName:`Greek_Geodetic_Reference_System_1987`},nad83:{towgs84:`0,0,0`,ellipse:`GRS80`,datumName:`North_American_Datum_1983`},nad27:{nadgrids:`@conus,@alaska,@ntv2_0.gsb,@ntv1_can.dat`,ellipse:`clrk66`,datumName:`North_American_Datum_1927`},potsdam:{towgs84:`598.1,73.7,418.2,0.202,0.045,-2.455,6.7`,ellipse:`bessel`,datumName:`Potsdam Rauenberg 1950 DHDN`},carthage:{towgs84:`-263.0,6.0,431.0`,ellipse:`clrk80ign`,datumName:`Carthage 1934 Tunisia`},hermannskogel:{towgs84:`577.326,90.129,463.919,5.137,1.474,5.297,2.4232`,ellipse:`bessel`,datumName:`Hermannskogel`},mgi:{towgs84:`577.326,90.129,463.919,5.137,1.474,5.297,2.4232`,ellipse:`bessel`,datumName:`Militar-Geographische Institut`},osni52:{towgs84:`482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15`,ellipse:`airy`,datumName:`Irish National`},ire65:{towgs84:`482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15`,ellipse:`mod_airy`,datumName:`Ireland 1965`},rassadiran:{towgs84:`-133.63,-157.5,-158.62`,ellipse:`intl`,datumName:`Rassadiran`},nzgd49:{towgs84:`59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993`,ellipse:`intl`,datumName:`New Zealand Geodetic Datum 1949`},osgb36:{towgs84:`446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894`,ellipse:`airy`,datumName:`Ordnance Survey of Great Britain 1936`},s_jtsk:{towgs84:`589,76,480`,ellipse:`bessel`,datumName:`S-JTSK (Ferro)`},beduaram:{towgs84:`-106,-87,188`,ellipse:`clrk80`,datumName:`Beduaram`},gunung_segara:{towgs84:`-403,684,41`,ellipse:`bessel`,datumName:`Gunung Segara Jakarta`},rnb72:{towgs84:`106.869,-52.2978,103.724,-0.33657,0.456955,-1.84218,1`,ellipse:`intl`,datumName:`Reseau National Belge 1972`},EPSG_5451:{towgs84:`6.41,-49.05,-11.28,1.5657,0.5242,6.9718,-5.7649`},IGNF_LURESG:{towgs84:`-192.986,13.673,-39.309,-0.4099,-2.9332,2.6881,0.43`},EPSG_4614:{towgs84:`-119.4248,-303.65872,-11.00061,1.164298,0.174458,1.096259,3.657065`},EPSG_4615:{towgs84:`-494.088,-312.129,279.877,-1.423,-1.013,1.59,-0.748`},ESRI_37241:{towgs84:`-76.822,257.457,-12.817,2.136,-0.033,-2.392,-0.031`},ESRI_37249:{towgs84:`-440.296,58.548,296.265,1.128,10.202,4.559,-0.438`},ESRI_37245:{towgs84:`-511.151,-181.269,139.609,1.05,2.703,1.798,3.071`},EPSG_4178:{towgs84:`24.9,-126.4,-93.2,-0.063,-0.247,-0.041,1.01`},EPSG_4622:{towgs84:`-472.29,-5.63,-304.12,0.4362,-0.8374,0.2563,1.8984`},EPSG_4625:{towgs84:`126.93,547.94,130.41,-2.7867,5.1612,-0.8584,13.8227`},EPSG_5252:{towgs84:`0.023,0.036,-0.068,0.00176,0.00912,-0.01136,0.00439`},EPSG_4314:{towgs84:`597.1,71.4,412.1,0.894,0.068,-1.563,7.58`},EPSG_4282:{towgs84:`-178.3,-316.7,-131.5,5.278,6.077,10.979,19.166`},EPSG_4231:{towgs84:`-83.11,-97.38,-117.22,0.005693,-0.044698,0.044285,0.1218`},EPSG_4274:{towgs84:`-230.994,102.591,25.199,0.633,-0.239,0.9,1.95`},EPSG_4134:{towgs84:`-180.624,-225.516,173.919,-0.81,-1.898,8.336,16.71006`},EPSG_4254:{towgs84:`18.38,192.45,96.82,0.056,-0.142,-0.2,-0.0013`},EPSG_4159:{towgs84:`-194.513,-63.978,-25.759,-3.4027,3.756,-3.352,-0.9175`},EPSG_4687:{towgs84:`0.072,-0.507,-0.245,0.0183,-0.0003,0.007,-0.0093`},EPSG_4227:{towgs84:`-83.58,-397.54,458.78,-17.595,-2.847,4.256,3.225`},EPSG_4746:{towgs84:`599.4,72.4,419.2,-0.062,-0.022,-2.723,6.46`},EPSG_4745:{towgs84:`612.4,77,440.2,-0.054,0.057,-2.797,2.55`},EPSG_6311:{towgs84:`8.846,-4.394,-1.122,-0.00237,-0.146528,0.130428,0.783926`},EPSG_4289:{towgs84:`565.7381,50.4018,465.2904,-0.395026,0.330772,-1.876073,4.07244`},EPSG_4230:{towgs84:`-68.863,-134.888,-111.49,-0.53,-0.14,0.57,-3.4`},EPSG_4154:{towgs84:`-123.02,-158.95,-168.47`},EPSG_4156:{towgs84:`570.8,85.7,462.8,4.998,1.587,5.261,3.56`},EPSG_4299:{towgs84:`482.5,-130.6,564.6,-1.042,-0.214,-0.631,8.15`},EPSG_4179:{towgs84:`33.4,-146.6,-76.3,-0.359,-0.053,0.844,-0.84`},EPSG_4313:{towgs84:`-106.8686,52.2978,-103.7239,0.3366,-0.457,1.8422,-1.2747`},EPSG_4194:{towgs84:`163.511,127.533,-159.789`},EPSG_4195:{towgs84:`105,326,-102.5`},EPSG_4196:{towgs84:`-45,417,-3.5`},EPSG_4611:{towgs84:`-162.619,-276.959,-161.764,0.067753,-2.243648,-1.158828,-1.094246`},EPSG_4633:{towgs84:`137.092,131.66,91.475,-1.9436,-11.5993,-4.3321,-7.4824`},EPSG_4641:{towgs84:`-408.809,366.856,-412.987,1.8842,-0.5308,2.1655,-121.0993`},EPSG_4643:{towgs84:`-480.26,-438.32,-643.429,16.3119,20.1721,-4.0349,-111.7002`},EPSG_4300:{towgs84:`482.5,-130.6,564.6,-1.042,-0.214,-0.631,8.15`},EPSG_4188:{towgs84:`482.5,-130.6,564.6,-1.042,-0.214,-0.631,8.15`},EPSG_4660:{towgs84:`982.6087,552.753,-540.873,6.681627,-31.611492,-19.848161,16.805`},EPSG_4662:{towgs84:`97.295,-263.247,310.882,-1.5999,0.8386,3.1409,13.3259`},EPSG_3906:{towgs84:`577.88891,165.22205,391.18289,4.9145,-0.94729,-13.05098,7.78664`},EPSG_4307:{towgs84:`-209.3622,-87.8162,404.6198,0.0046,3.4784,0.5805,-1.4547`},EPSG_6892:{towgs84:`-76.269,-16.683,68.562,-6.275,10.536,-4.286,-13.686`},EPSG_4690:{towgs84:`221.597,152.441,176.523,2.403,1.3893,0.884,11.4648`},EPSG_4691:{towgs84:`218.769,150.75,176.75,3.5231,2.0037,1.288,10.9817`},EPSG_4629:{towgs84:`72.51,345.411,79.241,-1.5862,-0.8826,-0.5495,1.3653`},EPSG_4630:{towgs84:`165.804,216.213,180.26,-0.6251,-0.4515,-0.0721,7.4111`},EPSG_4692:{towgs84:`217.109,86.452,23.711,0.0183,-0.0003,0.007,-0.0093`},EPSG_9333:{towgs84:`0,0,0,-0.008393,0.000749,-0.010276,0`},EPSG_9059:{towgs84:`0,0,0`},EPSG_4312:{towgs84:`601.705,84.263,485.227,4.7354,1.3145,5.393,-2.3887`},EPSG_4123:{towgs84:`-96.062,-82.428,-121.753,4.801,0.345,-1.376,1.496`},EPSG_4309:{towgs84:`-124.45,183.74,44.64,-0.4384,0.5446,-0.9706,-2.1365`},ESRI_104106:{towgs84:`-283.088,-70.693,117.445,-1.157,0.059,-0.652,-4.058`},EPSG_4281:{towgs84:`-219.247,-73.802,269.529`},EPSG_4322:{towgs84:`0,0,4.5`},EPSG_4324:{towgs84:`0,0,1.9`},EPSG_4284:{towgs84:`43.822,-108.842,-119.585,1.455,-0.761,0.737,0.549`},EPSG_4277:{towgs84:`446.448,-125.157,542.06,0.15,0.247,0.842,-20.489`},EPSG_4207:{towgs84:`-282.1,-72.2,120,-1.529,0.145,-0.89,-4.46`},EPSG_4688:{towgs84:`347.175,1077.618,2623.677,33.9058,-70.6776,9.4013,186.0647`},EPSG_4689:{towgs84:`410.793,54.542,80.501,-2.5596,-2.3517,-0.6594,17.3218`},EPSG_4720:{towgs84:`0,0,4.5`},EPSG_4273:{towgs84:`278.3,93,474.5,7.889,0.05,-6.61,6.21`},EPSG_4240:{towgs84:`204.64,834.74,293.8`},EPSG_4817:{towgs84:`278.3,93,474.5,7.889,0.05,-6.61,6.21`},ESRI_104131:{towgs84:`426.62,142.62,460.09,4.98,4.49,-12.42,-17.1`},EPSG_4265:{towgs84:`-104.1,-49.1,-9.9,0.971,-2.917,0.714,-11.68`},EPSG_4263:{towgs84:`-111.92,-87.85,114.5,1.875,0.202,0.219,0.032`},EPSG_4298:{towgs84:`-689.5937,623.84046,-65.93566,-0.02331,1.17094,-0.80054,5.88536`},EPSG_4270:{towgs84:`-253.4392,-148.452,386.5267,0.15605,0.43,-0.1013,-0.0424`},EPSG_4229:{towgs84:`-121.8,98.1,-10.7`},EPSG_4220:{towgs84:`-55.5,-348,-229.2`},EPSG_4214:{towgs84:`12.646,-155.176,-80.863`},EPSG_4232:{towgs84:`-345,3,223`},EPSG_4238:{towgs84:`-1.977,-13.06,-9.993,0.364,0.254,0.689,-1.037`},EPSG_4168:{towgs84:`-170,33,326`},EPSG_4131:{towgs84:`199,931,318.9`},EPSG_4152:{towgs84:`-0.9102,2.0141,0.5602,0.029039,0.010065,0.010101,0`},EPSG_5228:{towgs84:`572.213,85.334,461.94,4.9732,1.529,5.2484,3.5378`},EPSG_8351:{towgs84:`485.021,169.465,483.839,7.786342,4.397554,4.102655,0`},EPSG_4683:{towgs84:`-127.62,-67.24,-47.04,-3.068,4.903,1.578,-1.06`},EPSG_4133:{towgs84:`0,0,0`},EPSG_7373:{towgs84:`0.819,-0.5762,-1.6446,-0.00378,-0.03317,0.00318,0.0693`},EPSG_9075:{towgs84:`-0.9102,2.0141,0.5602,0.029039,0.010065,0.010101,0`},EPSG_9072:{towgs84:`-0.9102,2.0141,0.5602,0.029039,0.010065,0.010101,0`},EPSG_9294:{towgs84:`1.16835,-1.42001,-2.24431,-0.00822,-0.05508,0.01818,0.23388`},EPSG_4212:{towgs84:`-267.434,173.496,181.814,-13.4704,8.7154,7.3926,14.7492`},EPSG_4191:{towgs84:`-44.183,-0.58,-38.489,2.3867,2.7072,-3.5196,-8.2703`},EPSG_4237:{towgs84:`52.684,-71.194,-13.975,-0.312,-0.1063,-0.3729,1.0191`},EPSG_4740:{towgs84:`-1.08,-0.27,-0.9`},EPSG_4124:{towgs84:`419.3836,99.3335,591.3451,0.850389,1.817277,-7.862238,-0.99496`},EPSG_5681:{towgs84:`584.9636,107.7175,413.8067,1.1155,0.2824,-3.1384,7.9922`},EPSG_4141:{towgs84:`23.772,17.49,17.859,-0.3132,-1.85274,1.67299,-5.4262`},EPSG_4204:{towgs84:`-85.645,-273.077,-79.708,2.289,-1.421,2.532,3.194`},EPSG_4319:{towgs84:`226.702,-193.337,-35.371,-2.229,-4.391,9.238,0.9798`},EPSG_4200:{towgs84:`24.82,-131.21,-82.66`},EPSG_4130:{towgs84:`0,0,0`},EPSG_4127:{towgs84:`-82.875,-57.097,-156.768,-2.158,1.524,-0.982,-0.359`},EPSG_4149:{towgs84:`674.374,15.056,405.346`},EPSG_4617:{towgs84:`-0.991,1.9072,0.5129,0.02579,0.00965,0.01166,0`},EPSG_4663:{towgs84:`-210.502,-66.902,-48.476,2.094,-15.067,-5.817,0.485`},EPSG_4664:{towgs84:`-211.939,137.626,58.3,-0.089,0.251,0.079,0.384`},EPSG_4665:{towgs84:`-105.854,165.589,-38.312,-0.003,-0.026,0.024,-0.048`},EPSG_4666:{towgs84:`631.392,-66.551,481.442,1.09,-4.445,-4.487,-4.43`},EPSG_4756:{towgs84:`-192.873,-39.382,-111.202,-0.00205,-0.0005,0.00335,0.0188`},EPSG_4723:{towgs84:`-179.483,-69.379,-27.584,-7.862,8.163,6.042,-13.925`},EPSG_4726:{towgs84:`8.853,-52.644,180.304,-0.393,-2.323,2.96,-24.081`},EPSG_4267:{towgs84:`-8.0,160.0,176.0`},EPSG_5365:{towgs84:`-0.16959,0.35312,0.51846,0.03385,-0.16325,0.03446,0.03693`},EPSG_4218:{towgs84:`304.5,306.5,-318.1`},EPSG_4242:{towgs84:`-33.722,153.789,94.959,-8.581,-4.478,4.54,8.95`},EPSG_4216:{towgs84:`-292.295,248.758,429.447,4.9971,2.99,6.6906,1.0289`},ESRI_104105:{towgs84:`631.392,-66.551,481.442,1.09,-4.445,-4.487,-4.43`},ESRI_104129:{towgs84:`0,0,0`},EPSG_4673:{towgs84:`174.05,-25.49,112.57`},EPSG_4202:{towgs84:`-124,-60,154`},EPSG_4203:{towgs84:`-117.763,-51.51,139.061,0.292,0.443,0.277,-0.191`},EPSG_3819:{towgs84:`595.48,121.69,515.35,4.115,-2.9383,0.853,-3.408`},EPSG_8694:{towgs84:`-93.799,-132.737,-219.073,-1.844,0.648,-6.37,-0.169`},EPSG_4145:{towgs84:`275.57,676.78,229.6`},EPSG_4283:{towgs84:`0.06155,-0.01087,-0.04019,0.039492,0.032722,0.032898,-0.009994`},EPSG_4317:{towgs84:`2.3287,-147.0425,-92.0802,-0.309248,0.324822,0.497299,5.689063`},EPSG_4272:{towgs84:`59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993`},EPSG_4248:{towgs84:`-307.7,265.3,-363.5`},EPSG_5561:{towgs84:`24,-121,-76`},EPSG_5233:{towgs84:`-0.293,766.95,87.713,0.195704,1.695068,3.473016,-0.039338`},ESRI_104130:{towgs84:`-86,-98,-119`},ESRI_104102:{towgs84:`682,-203,480`},ESRI_37207:{towgs84:`7,-10,-26`},EPSG_4675:{towgs84:`59.935,118.4,-10.871`},ESRI_104109:{towgs84:`-89.121,-348.182,260.871`},ESRI_104112:{towgs84:`-185.583,-230.096,281.361`},ESRI_104113:{towgs84:`25.1,-275.6,222.6`},IGNF_WGS72G:{towgs84:`0,12,6`},IGNF_NTFG:{towgs84:`-168,-60,320`},IGNF_EFATE57G:{towgs84:`-127,-769,472`},IGNF_PGP50G:{towgs84:`324.8,153.6,172.1`},IGNF_REUN47G:{towgs84:`94,-948,-1262`},IGNF_CSG67G:{towgs84:`-186,230,110`},IGNF_GUAD48G:{towgs84:`-467,-16,-300`},IGNF_TAHI51G:{towgs84:`162,117,154`},IGNF_TAHAAG:{towgs84:`65,342,77`},IGNF_NUKU72G:{towgs84:`84,274,65`},IGNF_PETRELS72G:{towgs84:`365,194,166`},IGNF_WALL78G:{towgs84:`253,-133,-127`},IGNF_MAYO50G:{towgs84:`-382,-59,-262`},IGNF_TANNAG:{towgs84:`-139,-967,436`},IGNF_IGN72G:{towgs84:`-13,-348,292`},IGNF_ATIGG:{towgs84:`1118,23,66`},IGNF_FANGA84G:{towgs84:`150.57,158.33,118.32`},IGNF_RUSAT84G:{towgs84:`202.13,174.6,-15.74`},IGNF_KAUE70G:{towgs84:`126.74,300.1,-75.49`},IGNF_MOP90G:{towgs84:`-10.8,-1.8,12.77`},IGNF_MHPF67G:{towgs84:`338.08,212.58,-296.17`},IGNF_TAHI79G:{towgs84:`160.61,116.05,153.69`},IGNF_ANAA92G:{towgs84:`1.5,3.84,4.81`},IGNF_MARQUI72G:{towgs84:`330.91,-13.92,58.56`},IGNF_APAT86G:{towgs84:`143.6,197.82,74.05`},IGNF_TUBU69G:{towgs84:`237.17,171.61,-77.84`},IGNF_STPM50G:{towgs84:`11.363,424.148,373.13`},EPSG_4150:{towgs84:`674.374,15.056,405.346`},EPSG_4754:{towgs84:`-208.4058,-109.8777,-2.5764`},ESRI_104101:{towgs84:`372.87,149.23,585.29`},EPSG_4693:{towgs84:`0,-0.15,0.68`},EPSG_6207:{towgs84:`293.17,726.18,245.36`},EPSG_4153:{towgs84:`-133.63,-157.5,-158.62`},EPSG_4132:{towgs84:`-241.54,-163.64,396.06`},EPSG_4221:{towgs84:`-154.5,150.7,100.4`},EPSG_4266:{towgs84:`-80.7,-132.5,41.1`},EPSG_4193:{towgs84:`-70.9,-151.8,-41.4`},EPSG_5340:{towgs84:`-0.41,0.46,-0.35`},EPSG_4246:{towgs84:`-294.7,-200.1,525.5`},EPSG_4318:{towgs84:`-3.2,-5.7,2.8`},EPSG_4121:{towgs84:`-199.87,74.79,246.62`},EPSG_4223:{towgs84:`-260.1,5.5,432.2`},EPSG_4158:{towgs84:`-0.465,372.095,171.736`},EPSG_4285:{towgs84:`-128.16,-282.42,21.93`},EPSG_4613:{towgs84:`-404.78,685.68,45.47`},EPSG_4607:{towgs84:`195.671,332.517,274.607`},EPSG_4475:{towgs84:`-381.788,-57.501,-256.673`},EPSG_4208:{towgs84:`-157.84,308.54,-146.6`},EPSG_4743:{towgs84:`70.995,-335.916,262.898`},EPSG_4710:{towgs84:`-323.65,551.39,-491.22`},EPSG_7881:{towgs84:`-0.077,0.079,0.086`},EPSG_4682:{towgs84:`283.729,735.942,261.143`},EPSG_4739:{towgs84:`-156,-271,-189`},EPSG_4679:{towgs84:`-80.01,253.26,291.19`},EPSG_4750:{towgs84:`-56.263,16.136,-22.856`},EPSG_4644:{towgs84:`-10.18,-350.43,291.37`},EPSG_4695:{towgs84:`-103.746,-9.614,-255.95`},EPSG_4292:{towgs84:`-355,21,72`},EPSG_4302:{towgs84:`-61.702,284.488,472.052`},EPSG_4143:{towgs84:`-124.76,53,466.79`},EPSG_4606:{towgs84:`-153,153,307`},EPSG_4699:{towgs84:`-770.1,158.4,-498.2`},EPSG_4247:{towgs84:`-273.5,110.6,-357.9`},EPSG_4160:{towgs84:`8.88,184.86,106.69`},EPSG_4161:{towgs84:`-233.43,6.65,173.64`},EPSG_9251:{towgs84:`-9.5,122.9,138.2`},EPSG_9253:{towgs84:`-78.1,101.6,133.3`},EPSG_4297:{towgs84:`-198.383,-240.517,-107.909`},EPSG_4269:{towgs84:`0,0,0`},EPSG_4301:{towgs84:`-147,506,687`},EPSG_4618:{towgs84:`-59,-11,-52`},EPSG_4612:{towgs84:`0,0,0`},EPSG_4678:{towgs84:`44.585,-131.212,-39.544`},EPSG_4250:{towgs84:`-130,29,364`},EPSG_4144:{towgs84:`214,804,268`},EPSG_4147:{towgs84:`-17.51,-108.32,-62.39`},EPSG_4259:{towgs84:`-254.1,-5.36,-100.29`},EPSG_4164:{towgs84:`-76,-138,67`},EPSG_4211:{towgs84:`-378.873,676.002,-46.255`},EPSG_4182:{towgs84:`-422.651,-172.995,84.02`},EPSG_4224:{towgs84:`-143.87,243.37,-33.52`},EPSG_4225:{towgs84:`-205.57,168.77,-4.12`},EPSG_5527:{towgs84:`-67.35,3.88,-38.22`},EPSG_4752:{towgs84:`98,390,-22`},EPSG_4310:{towgs84:`-30,190,89`},EPSG_9248:{towgs84:`-192.26,65.72,132.08`},EPSG_4680:{towgs84:`124.5,-63.5,-281`},EPSG_4701:{towgs84:`-79.9,-158,-168.9`},EPSG_4706:{towgs84:`-146.21,112.63,4.05`},EPSG_4805:{towgs84:`682,-203,480`},EPSG_4201:{towgs84:`-165,-11,206`},EPSG_4210:{towgs84:`-157,-2,-299`},EPSG_4183:{towgs84:`-104,167,-38`},EPSG_4139:{towgs84:`11,72,-101`},EPSG_4668:{towgs84:`-86,-98,-119`},EPSG_4717:{towgs84:`-2,151,181`},EPSG_4732:{towgs84:`102,52,-38`},EPSG_4280:{towgs84:`-377,681,-50`},EPSG_4209:{towgs84:`-138,-105,-289`},EPSG_4261:{towgs84:`31,146,47`},EPSG_4658:{towgs84:`-73,46,-86`},EPSG_4721:{towgs84:`265.025,384.929,-194.046`},EPSG_4222:{towgs84:`-136,-108,-292`},EPSG_4601:{towgs84:`-255,-15,71`},EPSG_4602:{towgs84:`725,685,536`},EPSG_4603:{towgs84:`72,213.7,93`},EPSG_4605:{towgs84:`9,183,236`},EPSG_4621:{towgs84:`137,248,-430`},EPSG_4657:{towgs84:`-28,199,5`},EPSG_4316:{towgs84:`103.25,-100.4,-307.19`},EPSG_4642:{towgs84:`-13,-348,292`},EPSG_4698:{towgs84:`145,-187,103`},EPSG_4192:{towgs84:`-206.1,-174.7,-87.7`},EPSG_4311:{towgs84:`-265,120,-358`},EPSG_4135:{towgs84:`58,-283,-182`},ESRI_104138:{towgs84:`198,-226,-347`},EPSG_4245:{towgs84:`-11,851,5`},EPSG_4142:{towgs84:`-125,53,467`},EPSG_4213:{towgs84:`-106,-87,188`},EPSG_4253:{towgs84:`-133,-77,-51`},EPSG_4129:{towgs84:`-132,-110,-335`},EPSG_4713:{towgs84:`-77,-128,142`},EPSG_4239:{towgs84:`217,823,299`},EPSG_4146:{towgs84:`295,736,257`},EPSG_4155:{towgs84:`-83,37,124`},EPSG_4165:{towgs84:`-173,253,27`},EPSG_4672:{towgs84:`175,-38,113`},EPSG_4236:{towgs84:`-637,-549,-203`},EPSG_4251:{towgs84:`-90,40,88`},EPSG_4271:{towgs84:`-2,374,172`},EPSG_4175:{towgs84:`-88,4,101`},EPSG_4716:{towgs84:`298,-304,-375`},EPSG_4315:{towgs84:`-23,259,-9`},EPSG_4744:{towgs84:`-242.2,-144.9,370.3`},EPSG_4244:{towgs84:`-97,787,86`},EPSG_4293:{towgs84:`616,97,-251`},EPSG_4714:{towgs84:`-127,-769,472`},EPSG_4736:{towgs84:`260,12,-147`},EPSG_6883:{towgs84:`-235,-110,393`},EPSG_6894:{towgs84:`-63,176,185`},EPSG_4205:{towgs84:`-43,-163,45`},EPSG_4256:{towgs84:`41,-220,-134`},EPSG_4262:{towgs84:`639,405,60`},EPSG_4604:{towgs84:`174,359,365`},EPSG_4169:{towgs84:`-115,118,426`},EPSG_4620:{towgs84:`-106,-129,165`},EPSG_4184:{towgs84:`-203,141,53`},EPSG_4616:{towgs84:`-289,-124,60`},EPSG_9403:{towgs84:`-307,-92,127`},EPSG_4684:{towgs84:`-133,-321,50`},EPSG_4708:{towgs84:`-491,-22,435`},EPSG_4707:{towgs84:`114,-116,-333`},EPSG_4709:{towgs84:`145,75,-272`},EPSG_4712:{towgs84:`-205,107,53`},EPSG_4711:{towgs84:`124,-234,-25`},EPSG_4718:{towgs84:`230,-199,-752`},EPSG_4719:{towgs84:`211,147,111`},EPSG_4724:{towgs84:`208,-435,-229`},EPSG_4725:{towgs84:`189,-79,-202`},EPSG_4735:{towgs84:`647,1777,-1124`},EPSG_4722:{towgs84:`-794,119,-298`},EPSG_4728:{towgs84:`-307,-92,127`},EPSG_4734:{towgs84:`-632,438,-609`},EPSG_4727:{towgs84:`912,-58,1227`},EPSG_4729:{towgs84:`185,165,42`},EPSG_4730:{towgs84:`170,42,84`},EPSG_4733:{towgs84:`276,-57,149`},ESRI_37218:{towgs84:`230,-199,-752`},ESRI_37240:{towgs84:`-7,215,225`},ESRI_37221:{towgs84:`252,-209,-751`},ESRI_4305:{towgs84:`-123,-206,219`},ESRI_104139:{towgs84:`-73,-247,227`},EPSG_4748:{towgs84:`51,391,-36`},EPSG_4219:{towgs84:`-384,664,-48`},EPSG_4255:{towgs84:`-333,-222,114`},EPSG_4257:{towgs84:`-587.8,519.75,145.76`},EPSG_4646:{towgs84:`-963,510,-359`},EPSG_6881:{towgs84:`-24,-203,268`},EPSG_6882:{towgs84:`-183,-15,273`},EPSG_4715:{towgs84:`-104,-129,239`},IGNF_RGF93GDD:{towgs84:`0,0,0`},IGNF_RGM04GDD:{towgs84:`0,0,0`},IGNF_RGSPM06GDD:{towgs84:`0,0,0`},IGNF_RGTAAF07GDD:{towgs84:`0,0,0`},IGNF_RGFG95GDD:{towgs84:`0,0,0`},IGNF_RGNCG:{towgs84:`0,0,0`},IGNF_RGPFGDD:{towgs84:`0,0,0`},IGNF_ETRS89G:{towgs84:`0,0,0`},IGNF_RGR92GDD:{towgs84:`0,0,0`},EPSG_4173:{towgs84:`0,0,0`},EPSG_4180:{towgs84:`0,0,0`},EPSG_4619:{towgs84:`0,0,0`},EPSG_4667:{towgs84:`0,0,0`},EPSG_4075:{towgs84:`0,0,0`},EPSG_6706:{towgs84:`0,0,0`},EPSG_7798:{towgs84:`0,0,0`},EPSG_4661:{towgs84:`0,0,0`},EPSG_4669:{towgs84:`0,0,0`},EPSG_8685:{towgs84:`0,0,0`},EPSG_4151:{towgs84:`0,0,0`},EPSG_9702:{towgs84:`0,0,0`},EPSG_4758:{towgs84:`0,0,0`},EPSG_4761:{towgs84:`0,0,0`},EPSG_4765:{towgs84:`0,0,0`},EPSG_8997:{towgs84:`0,0,0`},EPSG_4023:{towgs84:`0,0,0`},EPSG_4670:{towgs84:`0,0,0`},EPSG_4694:{towgs84:`0,0,0`},EPSG_4148:{towgs84:`0,0,0`},EPSG_4163:{towgs84:`0,0,0`},EPSG_4167:{towgs84:`0,0,0`},EPSG_4189:{towgs84:`0,0,0`},EPSG_4190:{towgs84:`0,0,0`},EPSG_4176:{towgs84:`0,0,0`},EPSG_4659:{towgs84:`0,0,0`},EPSG_3824:{towgs84:`0,0,0`},EPSG_3889:{towgs84:`0,0,0`},EPSG_4046:{towgs84:`0,0,0`},EPSG_4081:{towgs84:`0,0,0`},EPSG_4558:{towgs84:`0,0,0`},EPSG_4483:{towgs84:`0,0,0`},EPSG_5013:{towgs84:`0,0,0`},EPSG_5264:{towgs84:`0,0,0`},EPSG_5324:{towgs84:`0,0,0`},EPSG_5354:{towgs84:`0,0,0`},EPSG_5371:{towgs84:`0,0,0`},EPSG_5373:{towgs84:`0,0,0`},EPSG_5381:{towgs84:`0,0,0`},EPSG_5393:{towgs84:`0,0,0`},EPSG_5489:{towgs84:`0,0,0`},EPSG_5593:{towgs84:`0,0,0`},EPSG_6135:{towgs84:`0,0,0`},EPSG_6365:{towgs84:`0,0,0`},EPSG_5246:{towgs84:`0,0,0`},EPSG_7886:{towgs84:`0,0,0`},EPSG_8431:{towgs84:`0,0,0`},EPSG_8427:{towgs84:`0,0,0`},EPSG_8699:{towgs84:`0,0,0`},EPSG_8818:{towgs84:`0,0,0`},EPSG_4757:{towgs84:`0,0,0`},EPSG_9140:{towgs84:`0,0,0`},EPSG_8086:{towgs84:`0,0,0`},EPSG_4686:{towgs84:`0,0,0`},EPSG_4737:{towgs84:`0,0,0`},EPSG_4702:{towgs84:`0,0,0`},EPSG_4747:{towgs84:`0,0,0`},EPSG_4749:{towgs84:`0,0,0`},EPSG_4674:{towgs84:`0,0,0`},EPSG_4755:{towgs84:`0,0,0`},EPSG_4759:{towgs84:`0,0,0`},EPSG_4762:{towgs84:`0,0,0`},EPSG_4763:{towgs84:`0,0,0`},EPSG_4764:{towgs84:`0,0,0`},EPSG_4166:{towgs84:`0,0,0`},EPSG_4170:{towgs84:`0,0,0`},EPSG_5546:{towgs84:`0,0,0`},EPSG_7844:{towgs84:`0,0,0`},EPSG_4818:{towgs84:`589,76,480`},EPSG_10328:{towgs84:`0,0,0`},EPSG_9782:{towgs84:`0,0,0`},EPSG_9777:{towgs84:`0,0,0`},EPSG_10690:{towgs84:`0,0,0`},EPSG_10639:{towgs84:`0,0,0`},EPSG_10739:{towgs84:`0,0,0`},EPSG_7686:{towgs84:`0,0,0`},EPSG_8900:{towgs84:`0,0,0`},EPSG_5886:{towgs84:`0,0,0`},EPSG_7683:{towgs84:`0,0,0`},EPSG_6668:{towgs84:`0,0,0`},EPSG_20046:{towgs84:`0,0,0`},EPSG_10299:{towgs84:`0,0,0`},EPSG_10310:{towgs84:`0,0,0`},EPSG_10475:{towgs84:`0,0,0`},EPSG_4742:{towgs84:`0,0,0`},EPSG_10671:{towgs84:`0,0,0`},EPSG_10762:{towgs84:`0,0,0`},EPSG_10725:{towgs84:`0,0,0`},EPSG_10791:{towgs84:`0,0,0`},EPSG_10800:{towgs84:`0,0,0`},EPSG_10305:{towgs84:`0,0,0`},EPSG_10941:{towgs84:`0,0,0`},EPSG_10968:{towgs84:`0,0,0`},EPSG_10875:{towgs84:`0,0,0`},EPSG_6318:{towgs84:`0,0,0`},EPSG_10910:{towgs84:`0,0,0`}};for(var kt in Ot){var At=Ot[kt];At.datumName&&(Ot[At.datumName]=At)}function jt(e,t,n,r,i,a,o){var s={};return s.datum_type=5,t&&(s.datum_type=4,s.datum_params=t.map(parseFloat),(s.datum_params[0]!==0||s.datum_params[1]!==0||s.datum_params[2]!==0)&&(s.datum_type=1),s.datum_params.length>3&&(s.datum_params[3]!==0||s.datum_params[4]!==0||s.datum_params[5]!==0||s.datum_params[6]!==0)&&(s.datum_type=2,s.datum_params[3]*=ae,s.datum_params[4]*=ae,s.datum_params[5]*=ae,s.datum_params[6]=s.datum_params[6]/1e6+1)),o&&(s.datum_type=3,s.grids=o),s.a=n,s.b=r,s.es=i,s.ep2=a,s}var Mt={};function Nt(e,t,n){return t instanceof ArrayBuffer?Pt(e,t,n):{ready:Ft(e,t)}}function Pt(e,t,n){var r=!0;n!==void 0&&n.includeErrorFields===!1&&(r=!1);var i=new DataView(t),a=Bt(i),o=Vt(i,a),s={header:o,subgrids:Ut(i,o,a,r)};return Mt[e]=s,s}async function Ft(e,t){for(var n=[],r=await t.getImageCount(),i=r-1;i>=0;i--){var a=await t.getImage(i),o=await a.readRasters(),s=[a.getWidth(),a.getHeight()],c=a.getBoundingBox().map(Rt),l=typeof a.fileDirectory.getValue==`function`?a.fileDirectory.getValue(`ModelPixelScale`):a.fileDirectory.ModelPixelScale,u=[l[0],l[1]].map(Rt),d=c[0]+(s[0]-1)*u[0],f=c[3]-(s[1]-1)*u[1],p=o[0],m=o[1],h=[];for(let e=s[1]-1;e>=0;e--)for(let t=s[0]-1;t>=0;t--){var g=e*s[0]+t;h.push([-zt(m[g]),zt(p[g])])}n.push({del:u,lim:s,ll:[-d,f],cvs:h})}var _={header:{nSubgrids:r},subgrids:n};return Mt[e]=_,_}function It(e){return e===void 0?null:e.split(`,`).map(Lt)}function Lt(e){if(e.length===0)return null;var t=e[0]===`@`;return t&&(e=e.slice(1)),e===`null`?{name:`null`,mandatory:!t,grid:null,isNull:!0}:{name:e,mandatory:!t,grid:Mt[e]||null,isNull:!1}}function Rt(e){return e*Math.PI/180}function zt(e){return e/3600*Math.PI/180}function Bt(e){var t=e.getInt32(8,!1);return t!==11&&(t=e.getInt32(8,!0),t!==11&&console.warn(`Failed to detect nadgrid endian-ness, defaulting to little-endian`),!0)}function Vt(e,t){return{nFields:e.getInt32(8,t),nSubgridFields:e.getInt32(24,t),nSubgrids:e.getInt32(40,t),shiftType:Ht(e,56,64).trim(),fromSemiMajorAxis:e.getFloat64(120,t),fromSemiMinorAxis:e.getFloat64(136,t),toSemiMajorAxis:e.getFloat64(152,t),toSemiMinorAxis:e.getFloat64(168,t)}}function Ht(e,t,n){return String.fromCharCode.apply(null,new Uint8Array(e.buffer.slice(t,n)))}function Ut(e,t,n,r){for(var i=176,a=[],o=0;o5e-11?!1:e.datum_type===1?e.datum_params[0]===t.datum_params[0]&&e.datum_params[1]===t.datum_params[1]&&e.datum_params[2]===t.datum_params[2]:e.datum_type!==2||e.datum_params[0]===t.datum_params[0]&&e.datum_params[1]===t.datum_params[1]&&e.datum_params[2]===t.datum_params[2]&&e.datum_params[3]===t.datum_params[3]&&e.datum_params[4]===t.datum_params[4]&&e.datum_params[5]===t.datum_params[5]&&e.datum_params[6]===t.datum_params[6]}function Yt(e,t,n){var r=e.x,i=e.y,a=e.z?e.z:0,o,s,c,l;if(i<-M&&i>-1.001*M)i=-M;else if(i>M&&i<1.001*M)i=M;else if(i<-M)return{x:-1/0,y:-1/0,z:e.z};else if(i>M)return{x:1/0,y:1/0,z:e.z};return r>Math.PI&&(r-=2*Math.PI),s=Math.sin(i),l=Math.cos(i),c=s*s,o=n/Math.sqrt(1-t*c),{x:(o+a)*l*Math.cos(r),y:(o+a)*l*Math.sin(r),z:(o*(1-t)+a)*s}}function Xt(e,t,n,r){var i=1e-12,a=i*i,o=30,s,c,l,u,d,f,p,m,h,g,_,v,y,b=e.x,x=e.y,S=e.z?e.z:0,C,w,T;if(s=Math.sqrt(b*b+x*x),c=Math.sqrt(b*b+x*x+S*S),s/na&&yr.y||p>r.x||gs&&Math.abs(c.y)>s);if(o<0)return console.log(`Inverse grid shift iterator failed to converge.`),r;r.x=F(a.x+n.ll[0]),r.y=a.y+n.ll[1]}else isNaN(a.x)||(r.x=e.x+a.x,r.y=e.y+a.y);return r}function rn(e,t){var n={x:e.x/t.del[0],y:e.y/t.del[1]},r={x:Math.floor(n.x),y:Math.floor(n.y)},i={x:n.x-1*r.x,y:n.y-1*r.y},a={x:NaN,y:NaN},o;if(r.x<0||r.x>=t.lim[0]||r.y<0||r.y>=t.lim[1])return a;o=r.y*t.lim[0]+r.x;var s={x:t.cvs[o][0],y:t.cvs[o][1]};o++;var c={x:t.cvs[o][0],y:t.cvs[o][1]};o+=t.lim[0];var l={x:t.cvs[o][0],y:t.cvs[o][1]};o--;var u={x:t.cvs[o][0],y:t.cvs[o][1]},d=i.x*i.y,f=i.x*(1-i.y),p=(1-i.x)*(1-i.y),m=(1-i.x)*i.y;return a.x=p*s.x+f*c.x+m*u.x+d*l.x,a.y=p*s.y+f*c.y+m*u.y+d*l.y,a}var an=[`x`,`y`,`z`];function on(e,t){let n={};for(let r=0,i=e.axis.length;r2&&(t.z=e[2]),e.length>3&&(t.m=e[3]),t}function ln(e){un(e.x),un(e.y)}function un(e){if(typeof Number.isFinite==`function`){if(Number.isFinite(e))return;throw TypeError(`coordinates must be finite numbers`)}if(typeof e!=`number`||e!==e||!isFinite(e))throw TypeError(`coordinates must be finite numbers`)}function dn(e,t){return(e.datum.datum_type===1||e.datum.datum_type===2||e.datum.datum_type===3)&&t.datumCode!==`WGS84`||(t.datum.datum_type===1||t.datum.datum_type===2||t.datum.datum_type===3)&&e.datumCode!==`WGS84`}function fn(e,t,n,r){var i,a=n.z!==void 0;if(ln(n),e.datum&&t.datum&&dn(e,t)&&(i=new qt(`WGS84`),n=fn(e,i,n,r),e=i),r&&e.axis!==`enu`&&(n=on(e,n)),e.projName===`longlat`)n={x:n.x*N,y:n.y*N,z:n.z||0};else if(e.to_meter&&(n={x:n.x*e.to_meter,y:n.y*e.to_meter,z:n.z||0}),n=e.inverse(n),!n)return;if(e.from_greenwich&&(n.x+=e.from_greenwich),n=en(e.datum,t.datum,n),n)return n=n,t.from_greenwich&&(n={x:n.x-t.from_greenwich,y:n.y,z:n.z||0}),t.projName===`longlat`?(t.long_wrap!==void 0&&(n.x=t.long_wrap+F(n.x-t.long_wrap)),n={x:n.x*ue,y:n.y*ue,z:n.z||0}):(n=t.forward(n),t.to_meter&&(n={x:n.x/t.to_meter,y:n.y/t.to_meter,z:n.z||0})),r&&t.axis!==`enu`?sn(t,n):(n&&!a&&t.projName!==`geocent`&&delete n.z,n)}function pn(e,t,n,r){return fn(e,t,Array.isArray(n)?cn(n):{x:n.x,y:n.y,z:n.z,m:n.m},r)}var mn=qt(`WGS84`);function hn(e,t,n,r){var i,a,o;return Array.isArray(n)?(i=fn(e,t,cn(n),r)||{x:NaN,y:NaN},n.length>2?(a=e.name!==void 0&&e.name===`geocent`||t.name!==void 0&&t.name===`geocent`,a?typeof i.z==`number`?[i.x,i.y,i.z].concat(n.slice(3)):[i.x,i.y,n[2]].concat(n.slice(3)):r&&typeof i.z==`number`?[i.x,i.y,i.z].concat(n.slice(3)):[i.x,i.y].concat(n.slice(2))):[i.x,i.y]):(i=fn(e,t,{x:n.x,y:n.y,z:n.z,m:n.m},r)||{x:NaN,y:NaN},o=Object.keys(n),o.length===2||(a=e.name!==void 0&&e.name===`geocent`||t.name!==void 0&&t.name===`geocent`,o.forEach(function(e){e!==`x`&&e!==`y`&&(e!==`z`||!a&&!r)&&(i[e]=n[e])})),i)}function gn(e){return e instanceof qt?e:typeof e==`object`&&`oProj`in e?e.oProj:qt(e)}function _n(e,t,n){var r,i,a=!1,o;return t===void 0?(i=gn(e),r=mn,a=!0):(t.x!==void 0||Array.isArray(t))&&(n=t,i=gn(e),r=mn,a=!0),r||=gn(e),i||=gn(t),n?hn(r,i,n):(o={forward:function(e,t){return hn(r,i,e,t)},inverse:function(e,t){return hn(i,r,e,t)}},a&&(o.oProj=i),o)}var vn=6,yn=`AJSAJS`,bn=`AFAFAF`,xn=65,Sn=73,Cn=79,wn=86,Tn=90,En={forward:Dn,inverse:On,toPoint:kn};function Dn(e,t){return t||=5,Fn(Mn({lat:e[1],lon:e[0]}),t)}function On(e){var t=Nn(zn(e.toUpperCase()));return t.lat&&t.lon?[t.lon,t.lat,t.lon,t.lat]:[t.left,t.bottom,t.right,t.top]}function kn(e){var t=Nn(zn(e.toUpperCase()));return t.lat&&t.lon?[t.lon,t.lat]:[(t.left+t.right)/2,(t.top+t.bottom)/2]}function An(e){return Math.PI/180*e}function jn(e){return e/Math.PI*180}function Mn(e){var t=e.lat,n=e.lon,r=6378137,i=.00669438,a=.9996,o,s,c,l,u,d,f,p=An(t),m=An(n),h,g=Math.floor((n+180)/6)+1;n===180&&(g=60),t>=56&&t<64&&n>=3&&n<12&&(g=32),t>=72&&t<84&&(n>=0&&n<9?g=31:n>=9&&n<21?g=33:n>=21&&n<33?g=35:n>=33&&n<42&&(g=37)),o=(g-1)*6-180+3,h=An(o),s=i/(1-i),c=r/Math.sqrt(1-i*Math.sin(p)*Math.sin(p)),l=Math.tan(p)*Math.tan(p),u=s*Math.cos(p)*Math.cos(p),d=Math.cos(p)*(m-h),f=r*((1-i/4-3*i*i/64-5*i*i*i/256)*p-(3*i/8+3*i*i/32+45*i*i*i/1024)*Math.sin(2*p)+(15*i*i/256+45*i*i*i/1024)*Math.sin(4*p)-35*i*i*i/3072*Math.sin(6*p));var _=a*c*(d+(1-l+u)*d*d*d/6+(5-18*l+l*l+72*u-58*s)*d*d*d*d*d/120)+5e5,v=a*(f+c*Math.tan(p)*(d*d/2+(5-l+9*u+4*u*u)*d*d*d*d/24+(61-58*l+l*l+600*u-330*s)*d*d*d*d*d*d/720));return t<0&&(v+=1e7),{northing:Math.round(v),easting:Math.round(_),zoneNumber:g,zoneLetter:Pn(t)}}function Nn(e){var t=e.northing,n=e.easting,r=e.zoneLetter,i=e.zoneNumber;if(i<0||i>60)return null;var a=.9996,o=6378137,s=.00669438,c,l=(1-Math.sqrt(1-s))/(1+Math.sqrt(1-s)),u,d,f,p,m,h,g,_,v,y=n-5e5,b=t;r<`N`&&(b-=1e7),g=(i-1)*6-180+3,c=s/(1-s),h=b/a,_=h/(o*(1-s/4-3*s*s/64-5*s*s*s/256)),v=_+(3*l/2-27*l*l*l/32)*Math.sin(2*_)+(21*l*l/16-55*l*l*l*l/32)*Math.sin(4*_)+151*l*l*l/96*Math.sin(6*_),u=o/Math.sqrt(1-s*Math.sin(v)*Math.sin(v)),d=Math.tan(v)*Math.tan(v),f=c*Math.cos(v)*Math.cos(v),p=o*(1-s)/(1-s*Math.sin(v)*Math.sin(v))**1.5,m=y/(u*a);var x=v-u*Math.tan(v)/p*(m*m/2-(5+3*d+10*f-4*f*f-9*c)*m*m*m*m/24+(61+90*d+298*f+45*d*d-252*c-3*f*f)*m*m*m*m*m*m/720);x=jn(x);var S=(m-(1+2*d+f)*m*m*m/6+(5-2*f+28*d-3*f*f+8*c+24*d*d)*m*m*m*m*m/120)/Math.cos(v);S=g+jn(S);var C;if(e.accuracy){var w=Nn({northing:e.northing+e.accuracy,easting:e.easting+e.accuracy,zoneLetter:e.zoneLetter,zoneNumber:e.zoneNumber});C={top:w.lat,right:w.lon,bottom:x,left:S}}else C={lat:x,lon:S};return C}function Pn(e){var t=`Z`;return 84>=e&&e>=72?t=`X`:72>e&&e>=64?t=`W`:64>e&&e>=56?t=`V`:56>e&&e>=48?t=`U`:48>e&&e>=40?t=`T`:40>e&&e>=32?t=`S`:32>e&&e>=24?t=`R`:24>e&&e>=16?t=`Q`:16>e&&e>=8?t=`P`:8>e&&e>=0?t=`N`:0>e&&e>=-8?t=`M`:-8>e&&e>=-16?t=`L`:-16>e&&e>=-24?t=`K`:-24>e&&e>=-32?t=`J`:-32>e&&e>=-40?t=`H`:-40>e&&e>=-48?t=`G`:-48>e&&e>=-56?t=`F`:-56>e&&e>=-64?t=`E`:-64>e&&e>=-72?t=`D`:-72>e&&e>=-80&&(t=`C`),t}function Fn(e,t){var n=`00000`+e.easting,r=`00000`+e.northing;return e.zoneNumber+e.zoneLetter+In(e.easting,e.northing,e.zoneNumber)+n.substr(n.length-5,t)+r.substr(r.length-5,t)}function In(e,t,n){var r=Ln(n);return Rn(Math.floor(e/1e5),Math.floor(t/1e5)%20,r)}function Ln(e){var t=e%vn;return t===0&&(t=vn),t}function Rn(e,t,n){var r=n-1,i=yn.charCodeAt(r),a=bn.charCodeAt(r),o=i+e-1,s=a+t,c=!1;return o>Tn&&(o=o-Tn+xn-1,c=!0),(o===Sn||iSn||(o>Sn||iCn||(o>Cn||iTn&&(o=o-Tn+xn-1),s>wn?(s=s-wn+xn-1,c=!0):c=!1,(s===Sn||aSn||(s>Sn||aCn||(s>Cn||awn&&(s=s-wn+xn-1),String.fromCharCode(o)+String.fromCharCode(s)}function zn(e){if(e&&e.length===0)throw`MGRSPoint coverting from nothing`;for(var t=e.length,n=null,r=``,i,a=0;!/[A-Z]/.test(i=e.charAt(a));){if(a>=2)throw`MGRSPoint bad conversion from: `+e;r+=i,a++}var o=parseInt(r,10);if(a===0||a+3>t)throw`MGRSPoint bad conversion from: `+e;var s=e.charAt(a++);if(s<=`A`||s===`B`||s===`Y`||s>=`Z`||s===`I`||s===`O`)throw`MGRSPoint zone letter `+s+` not handled: `+e;n=e.substring(a,a+=2);for(var c=Ln(o),l=Bn(n.charAt(0),c),u=Vn(n.charAt(1),c);u0&&(h=1e5/10**f,g=e.substring(a,a+f),p=parseFloat(g)*h,_=e.substring(a+f),m=parseFloat(_)*h),v=p+l,y=m+u,{easting:v,northing:y,zoneLetter:s,zoneNumber:o,accuracy:h}}function Bn(e,t){for(var n=yn.charCodeAt(t-1),r=1e5,i=!1;n!==e.charCodeAt(0);){if(n++,n===Sn&&n++,n===Cn&&n++,n>Tn){if(i)throw`Bad character: `+e;n=xn,i=!0}r+=1e5}return r}function Vn(e,t){if(e>`V`)throw`MGRSPoint given invalid Northing `+e;for(var n=bn.charCodeAt(t-1),r=0,i=!1;n!==e.charCodeAt(0);){if(n++,n===Sn&&n++,n===Cn&&n++,n>wn){if(i)throw`Bad character: `+e;n=xn,i=!0}r+=1e5}return r}function Hn(e){var t;switch(e){case`C`:t=11e5;break;case`D`:t=2e6;break;case`E`:t=28e5;break;case`F`:t=37e5;break;case`G`:t=46e5;break;case`H`:t=55e5;break;case`J`:t=64e5;break;case`K`:t=73e5;break;case`L`:t=82e5;break;case`M`:t=91e5;break;case`N`:t=0;break;case`P`:t=8e5;break;case`Q`:t=17e5;break;case`R`:t=26e5;break;case`S`:t=35e5;break;case`T`:t=44e5;break;case`U`:t=53e5;break;case`V`:t=62e5;break;case`W`:t=7e6;break;case`X`:t=79e5;break;default:t=-1}if(t>=0)return t;throw`Invalid zone letter: `+e}function Un(e,t,n){if(!(this instanceof Un))return new Un(e,t,n);if(Array.isArray(e))this.x=e[0],this.y=e[1],this.z=e[2]||0;else if(typeof e==`object`)this.x=e.x,this.y=e.y,this.z=e.z||0;else if(typeof e==`string`&&t===void 0){var r=e.split(`,`);this.x=parseFloat(r[0]),this.y=parseFloat(r[1]),this.z=parseFloat(r[2])||0}else this.x=e,this.y=t,this.z=n||0;console.warn(`proj4.Point will be removed in version 3, use proj4.toPoint`)}Un.fromMGRS=function(e){return new Un(kn(e))},Un.prototype.toMGRS=function(e){return Dn([this.x,this.y],e)};var Wn=1,Gn=.25,Kn=.046875,qn=.01953125,Jn=.01068115234375,Yn=.75,Xn=.46875,Zn=.013020833333333334,Qn=.007120768229166667,$n=.3645833333333333,er=.005696614583333333,tr=.3076171875;function nr(e){var t=[];t[0]=Wn-e*(Gn+e*(Kn+e*(qn+e*Jn))),t[1]=e*(Yn-e*(Kn+e*(qn+e*Jn)));var n=e*e;return t[2]=n*(Xn-e*(Zn+e*Qn)),n*=e,t[3]=n*($n-e*er),t[4]=n*e*tr,t}function rr(e,t,n,r){return n*=t,t*=t,r[0]*e-n*(r[1]+t*(r[2]+t*(r[3]+t*r[4])))}var ir=20;function ar(e,t,n){for(var r=1/(1-t),i=e,a=ir;a;--a){var o=Math.sin(i),s=1-t*o*o;if(s=(rr(i,o,Math.cos(i),n)-e)*(s*Math.sqrt(s))*r,i-=s,Math.abs(s)<1e-10)return i}return i}function or(){this.x0=this.x0===void 0?0:this.x0,this.y0=this.y0===void 0?0:this.y0,this.long0=this.long0===void 0?0:this.long0,this.lat0=this.lat0===void 0?0:this.lat0,this.es&&(this.en=nr(this.es),this.ml0=rr(this.lat0,Math.sin(this.lat0),Math.cos(this.lat0),this.en))}function sr(e){var t=e.x,n=e.y,r=F(t-this.long0,this.over),i,a,o,s=Math.sin(n),c=Math.cos(n);if(this.es){var l=c*r,u=l**2,d=this.ep2*c**2,f=d**2,p=(Math.abs(c)>1e-10?Math.tan(n):0)**2,m=p**2;i=1-this.es*s**2,l/=Math.sqrt(i);var h=rr(n,s,c,this.en);a=this.a*(this.k0*l*(1+u/6*(1-p+d+u/20*(5-18*p+m+14*d-58*p*d+u/42*(61+179*m-m*p-479*p)))))+this.x0,o=this.a*(this.k0*(h-this.ml0+s*r*l/2*(1+u/12*(5-p+9*d+4*f+u/30*(61+m-58*p+270*d-330*p*d+u/56*(1385+543*m-m*p-3111*p))))))+this.y0}else{var g=c*Math.sin(r);if(Math.abs(Math.abs(g)-1)<1e-10)return 93;if(a=.5*this.a*this.k0*Math.log((1+g)/(1-g))+this.x0,o=c*Math.cos(r)/Math.sqrt(1-g**2),g=Math.abs(o),g>=1){if(g-1>1e-10)return 93;o=0}else o=Math.acos(o);n<0&&(o=-o),o=this.a*this.k0*(o-this.lat0)+this.y0}return e.x=a,e.y=o,e}function cr(e){var t,n,r,i,a=(e.x-this.x0)*(1/this.a),o=(e.y-this.y0)*(1/this.a);if(!this.es){var s=Math.exp(a/this.k0),c=.5*(s-1/s),l=this.lat0+o/this.k0,u=Math.cos(l);t=Math.sqrt((1-u**2)/(1+c**2)),r=Math.asin(t),o<0&&(r=-r),i=c===0&&u===0?0:F(Math.atan2(c,u)+this.long0,this.over)}else if(t=this.ml0+o/this.k0,n=ar(t,this.es,this.en),Math.abs(n)1e-10?Math.tan(n):0,m=this.ep2*f**2,h=m**2,g=p**2,_=g**2;t=1-this.es*d**2;var v=a*Math.sqrt(t)/this.k0,y=v**2;t*=p,r=n-t*y/(1-this.es)*.5*(1-y/12*(5+3*g-9*m*g+m-4*h-y/30*(61+90*g-252*m*g+45*_+46*m-y/56*(1385+3633*g+4095*_+1574*_*g)))),i=F(this.long0+v*(1-y/6*(1+2*g+m-y/20*(5+28*g+24*_+8*m*g+6*m-y/42*(61+662*g+1320*_+720*_*g))))/f,this.over)}else r=M*ot(o),i=0;return e.x=i,e.y=r,e}var lr={init:or,forward:sr,inverse:cr,names:[`Fast_Transverse_Mercator`,`Fast Transverse Mercator`]};function ur(e){var t=Math.exp(e);return t=(t-1/t)/2,t}function dr(e,t){e=Math.abs(e),t=Math.abs(t);var n=Math.max(e,t),r=Math.min(e,t)/(n||1);return n*Math.sqrt(1+r**2)}function fr(e){var t=1+e,n=t-1;return n===0?e:e*Math.log(t)/n}function pr(e){var t=Math.abs(e);return t=fr(t*(1+t/(dr(1,t)+1))),e<0?-t:t}function mr(e,t){for(var n=2*Math.cos(2*t),r=e.length-1,i=e[r],a=0,o;--r>=0;)o=-a+n*i+e[r],a=i,i=o;return t+o*Math.sin(2*t)}function hr(e,t){for(var n=2*Math.cos(t),r=e.length-1,i=e[r],a=0,o;--r>=0;)o=-a+n*i+e[r],a=i,i=o;return Math.sin(t)*o}function gr(e){var t=Math.exp(e);return t=(t+1/t)/2,t}function _r(e,t,n){for(var r=Math.sin(t),i=Math.cos(t),a=ur(n),o=gr(n),s=2*i*o,c=-2*r*a,l=e.length-1,u=e[l],d=0,f=0,p=0,m,h;--l>=0;)m=f,h=d,f=u,d=p,u=-m+s*f-c*d+e[l],p=-h+c*f+s*d;return s=r*o,c=i*a,[s*u-c*p,s*p+c*u]}function vr(){if(!this.approx&&(isNaN(this.es)||this.es<=0))throw Error(`Incorrect elliptical usage. Try using the +approx option in the proj string, or PROJECTION["Fast_Transverse_Mercator"] in the WKT.`);this.approx&&(lr.init.apply(this),this.forward=lr.forward,this.inverse=lr.inverse),this.x0=this.x0===void 0?0:this.x0,this.y0=this.y0===void 0?0:this.y0,this.long0=this.long0===void 0?0:this.long0,this.lat0=this.lat0===void 0?0:this.lat0,this.k0=this.k0===void 0?1:this.k0,this.cgb=[],this.cbg=[],this.utg=[],this.gtu=[];var e=this.es/(1+Math.sqrt(1-this.es)),t=e/(2-e),n=t;this.cgb[0]=t*(2+t*(-2/3+t*(-2+t*(116/45+t*(26/45+-2854/675*t))))),this.cbg[0]=t*(-2+t*(2/3+t*(4/3+t*(-82/45+t*(32/45+4642/4725*t))))),n*=t,this.cgb[1]=n*(7/3+t*(-8/5+t*(-227/45+t*(2704/315+2323/945*t)))),this.cbg[1]=n*(5/3+t*(-16/15+t*(-13/9+t*(904/315+-1522/945*t)))),n*=t,this.cgb[2]=n*(56/15+t*(-136/35+t*(-1262/105+73814/2835*t))),this.cbg[2]=n*(-26/15+t*(34/21+t*(8/5+-12686/2835*t))),n*=t,this.cgb[3]=n*(4279/630+t*(-332/35+-399572/14175*t)),this.cbg[3]=n*(1237/630+t*(-12/5+-24832/14175*t)),n*=t,this.cgb[4]=n*(4174/315+-144838/6237*t),this.cbg[4]=n*(-734/315+109598/31185*t),n*=t,this.cgb[5]=601676/22275*n,this.cbg[5]=444337/155925*n,n=t**2,this.Qn=this.k0/(1+t)*(1+n*(1/4+n*(1/64+n/256))),this.utg[0]=t*(-.5+t*(2/3+t*(-37/96+t*(1/360+t*(81/512+-96199/604800*t))))),this.gtu[0]=t*(.5+t*(-2/3+t*(5/16+t*(41/180+t*(-127/288+7891/37800*t))))),this.utg[1]=n*(-1/48+t*(-1/15+t*(437/1440+t*(-46/105+1118711/3870720*t)))),this.gtu[1]=n*(13/48+t*(-3/5+t*(557/1440+t*(281/630+-1983433/1935360*t)))),n*=t,this.utg[2]=n*(-17/480+t*(37/840+t*(209/4480+-5569/90720*t))),this.gtu[2]=n*(61/240+t*(-103/140+t*(15061/26880+167603/181440*t))),n*=t,this.utg[3]=n*(-4397/161280+t*(11/504+830251/7257600*t)),this.gtu[3]=n*(49561/161280+t*(-179/168+6601661/7257600*t)),n*=t,this.utg[4]=n*(-4583/161280+108847/3991680*t),this.gtu[4]=n*(34729/80640+-3418889/1995840*t),n*=t,this.utg[5]=-20648693/638668800*n,this.gtu[5]=212378941/319334400*n;var r=mr(this.cbg,this.lat0);this.Zb=-this.Qn*(r+hr(this.gtu,2*r))}function yr(e){var t=F(e.x-this.long0,this.over),n=e.y;n=mr(this.cbg,n);var r=Math.sin(n),i=Math.cos(n),a=Math.sin(t),o=Math.cos(t);n=Math.atan2(r,o*i),t=Math.atan2(a*i,dr(r,i*o)),t=pr(Math.tan(t));var s=_r(this.gtu,2*n,2*t);n+=s[0],t+=s[1];var c,l;return Math.abs(t)<=2.623395162778?(c=this.a*(this.Qn*t)+this.x0,l=this.a*(this.Qn*n+this.Zb)+this.y0):(c=1/0,l=1/0),e.x=c,e.y=l,e}function br(e){var t=(e.x-this.x0)*(1/this.a),n=(e.y-this.y0)*(1/this.a);n=(n-this.Zb)/this.Qn,t/=this.Qn;var r,i;if(Math.abs(t)<=2.623395162778){var a=_r(this.utg,2*n,2*t);n+=a[0],t+=a[1],t=Math.atan(ur(t));var o=Math.sin(n),s=Math.cos(n),c=Math.sin(t),l=Math.cos(t);n=Math.atan2(o*l,dr(c,l*s)),t=Math.atan2(c,l*s),r=F(t+this.long0,this.over),i=mr(this.cgb,n)}else r=1/0,i=1/0;return e.x=r,e.y=i,e}var xr={init:vr,forward:yr,inverse:br,names:[`Extended_Transverse_Mercator`,`Extended Transverse Mercator`,`etmerc`,`Transverse_Mercator`,`Transverse Mercator`,`Gauss Kruger`,`Gauss_Kruger`,`tmerc`]};function Sr(e,t){if(e===void 0){if(e=Math.floor((F(t)+Math.PI)*30/Math.PI)+1,e<0)return 0;if(e>60)return 60}return e}var Cr=`etmerc`;function wr(){var e=Sr(this.zone,this.long0);if(e===void 0)throw Error(`unknown utm zone`);this.lat0=0,this.long0=(6*Math.abs(e)-183)*N,this.x0=5e5,this.y0=this.utmSouth?1e7:0,this.k0=.9996,xr.init.apply(this),this.forward=xr.forward,this.inverse=xr.inverse}var Tr={init:wr,names:[`Universal Transverse Mercator System`,`utm`],dependsOn:Cr};function Er(e,t){return((1-e)/(1+e))**t}var Dr=20;function Or(){var e=Math.sin(this.lat0),t=Math.cos(this.lat0);t*=t,this.rc=Math.sqrt(1-this.es)/(1-this.es*e*e),this.C=Math.sqrt(1+this.es*t*t/(1-this.es)),this.phic0=Math.asin(e/this.C),this.ratexp=.5*this.C*this.e,this.K=Math.tan(.5*this.phic0+P)/(Math.tan(.5*this.lat0+P)**+this.C*Er(this.e*e,this.ratexp))}function kr(e){var t=e.x,n=e.y;return e.y=2*Math.atan(this.K*Math.tan(.5*n+P)**+this.C*Er(this.e*Math.sin(n),this.ratexp))-M,e.x=this.C*t,e}function Ar(e){for(var t=1e-14,n=e.x/this.C,r=e.y,i=(Math.tan(.5*r+P)/this.K)**(1/this.C),a=Dr;a>0&&(r=2*Math.atan(i*Er(this.e*Math.sin(e.y),-.5*this.e))-M,!(Math.abs(r-e.y)0?1:-1),this.cons=Math.sqrt((1+this.e)**+(1+this.e)*(1-this.e)**(1-this.e)),!isNaN(this.lat_ts)&&Math.abs(this.coslat0)<=1e-10&&Math.abs(Math.cos(this.lat_ts))>1e-10&&(this.k0=.5*this.cons*at(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts))/st(this.e,this.con*this.lat_ts,this.con*Math.sin(this.lat_ts))),this.ms1=at(this.e,this.sinlat0,this.coslat0),this.X0=2*Math.atan(Ir(this.lat0,this.sinlat0,this.e))-M,this.cosX0=Math.cos(this.X0),this.sinX0=Math.sin(this.X0))}function Rr(e){var t=e.x,n=e.y,r=Math.sin(n),i=Math.cos(n),a,o,s,c,l,u,d=F(t-this.long0,this.over);return Math.abs(Math.abs(t-this.long0)-Math.PI)<=1e-10&&Math.abs(n+this.lat0)<=1e-10?(e.x=NaN,e.y=NaN,e):this.sphere?(a=2*this.k0/(1+this.sinlat0*r+this.coslat0*i*Math.cos(d)),e.x=this.a*a*i*Math.sin(d)+this.x0,e.y=this.a*a*(this.coslat0*r-this.sinlat0*i*Math.cos(d))+this.y0,e):(o=2*Math.atan(Ir(n,r,this.e))-M,c=Math.cos(o),s=Math.sin(o),Math.abs(this.coslat0)<=1e-10?(l=st(this.e,n*this.con,this.con*r),u=2*this.a*this.k0*l/this.cons,e.x=this.x0+u*Math.sin(t-this.long0),e.y=this.y0-this.con*u*Math.cos(t-this.long0),e):(Math.abs(this.sinlat0)<1e-10?(a=2*this.a*this.k0/(1+c*Math.cos(d)),e.y=a*s):(a=2*this.a*this.k0*this.ms1/(this.cosX0*(1+this.sinX0*s+this.cosX0*c*Math.cos(d))),e.y=a*(this.cosX0*s-this.sinX0*c*Math.cos(d))+this.y0),e.x=a*c*Math.sin(d)+this.x0,e))}function zr(e){e.x-=this.x0,e.y-=this.y0;var t,n,r,i,a,o=Math.sqrt(e.x*e.x+e.y*e.y);if(this.sphere){var s=2*Math.atan(o/(2*this.a*this.k0));return t=this.long0,n=this.lat0,o<=1e-10?(e.x=t,e.y=n,e):(n=Math.asin(Math.cos(s)*this.sinlat0+e.y*Math.sin(s)*this.coslat0/o),t=Math.abs(this.coslat0)<1e-10?this.lat0>0?F(this.long0+Math.atan2(e.x,-1*e.y),this.over):F(this.long0+Math.atan2(e.x,e.y),this.over):F(this.long0+Math.atan2(e.x*Math.sin(s),o*this.coslat0*Math.cos(s)-e.y*this.sinlat0*Math.sin(s)),this.over),e.x=t,e.y=n,e)}if(Math.abs(this.coslat0)<=1e-10){if(o<=1e-10)return n=this.lat0,t=this.long0,e.x=t,e.y=n,e;e.x*=this.con,e.y*=this.con,r=o*this.cons/(2*this.a*this.k0),n=this.con*ct(this.e,r),t=this.con*F(this.con*this.long0+Math.atan2(e.x,-1*e.y),this.over)}else i=2*Math.atan(o*this.cosX0/(2*this.a*this.k0*this.ms1)),t=this.long0,o<=1e-10?a=this.X0:(a=Math.asin(Math.cos(i)*this.sinX0+e.y*Math.sin(i)*this.cosX0/o),t=F(this.long0+Math.atan2(e.x*Math.sin(i),o*this.cosX0*Math.cos(i)-e.y*this.sinX0*Math.sin(i)),this.over)),n=-1*ct(this.e,Math.tan(.5*(M+a)));return e.x=t,e.y=n,e}var Br={init:Lr,forward:Rr,inverse:zr,names:[`stere`,`Stereographic_South_Pole`,`Polar_Stereographic_variant_A`,`Polar_Stereographic_variant_B`,`Polar_Stereographic`],ssfn_:Ir};function Vr(){this.k0||=1;var e=this.lat0;this.lambda0=this.long0;var t=Math.sin(e),n=this.a,r=1/this.rf,i=2*r-r**2,a=this.e=Math.sqrt(i);this.R=this.k0*n*Math.sqrt(1-i)/(1-i*t**2),this.alpha=Math.sqrt(1+i/(1-i)*Math.cos(e)**4),this.b0=Math.asin(t/this.alpha);var o=Math.log(Math.tan(Math.PI/4+this.b0/2)),s=Math.log(Math.tan(Math.PI/4+e/2)),c=Math.log((1+a*t)/(1-a*t));this.K=o-this.alpha*s+this.alpha*a/2*c}function Hr(e){var t=Math.log(Math.tan(Math.PI/4-e.y/2)),n=this.e/2*Math.log((1+this.e*Math.sin(e.y))/(1-this.e*Math.sin(e.y))),r=-this.alpha*(t+n)+this.K,i=2*(Math.atan(Math.exp(r))-Math.PI/4),a=this.alpha*(e.x-this.lambda0),o=Math.atan(Math.sin(a)/(Math.sin(this.b0)*Math.tan(i)+Math.cos(this.b0)*Math.cos(a))),s=Math.asin(Math.cos(this.b0)*Math.sin(i)-Math.sin(this.b0)*Math.cos(i)*Math.cos(a));return e.y=this.R/2*Math.log((1+Math.sin(s))/(1-Math.sin(s)))+this.y0,e.x=this.R*o+this.x0,e}function Ur(e){for(var t=e.x-this.x0,n=e.y-this.y0,r=t/this.R,i=2*(Math.atan(Math.exp(n/this.R))-Math.PI/4),a=Math.asin(Math.cos(this.b0)*Math.sin(i)+Math.sin(this.b0)*Math.cos(i)*Math.cos(r)),o=Math.atan(Math.sin(r)/(Math.cos(this.b0)*Math.cos(r)-Math.sin(this.b0)*Math.tan(i))),s=this.lambda0+o/this.alpha,c=0,l=a,u=-1e3,d=0;Math.abs(l-u)>1e-7;){if(++d>20)return;c=1/this.alpha*(Math.log(Math.tan(Math.PI/4+a/2))-this.K)+this.e*Math.log(Math.tan(Math.PI/4+Math.asin(this.e*Math.sin(l))/2)),u=l,l=2*Math.atan(Math.exp(c))-Math.PI/2}return e.x=s,e.y=l,e}var Wr={init:Vr,forward:Hr,inverse:Ur,names:[`somerc`]},Gr=1e-7;function Kr(e){var t=[`Hotine_Oblique_Mercator`,`Hotine_Oblique_Mercator_variant_A`,`Hotine_Oblique_Mercator_Azimuth_Natural_Origin`],n=typeof e.projName==`object`?Object.keys(e.projName)[0]:e.projName;return`no_uoff`in e||`no_off`in e||t.indexOf(n)!==-1||t.indexOf(bt(n))!==-1}function qr(){var e,t,n,r,i,a,o,s,c,l,u=0,d,f=0,p=0,m=0,h=0,g=0,_=0;this.k0||=1,this.no_off=Kr(this),this.no_rot=`no_rot`in this;var v=!1;`alpha`in this&&(v=!0);var y=!1;if(`rectified_grid_angle`in this&&(y=!0),v&&(_=this.alpha),y&&(u=this.rectified_grid_angle,v||=(_=0,!0)),v||y)f=this.longc;else if(p=this.long1,h=this.lat1,m=this.long2,g=this.lat2,Math.abs(h-g)<=Gr||(e=Math.abs(h))<=Gr||Math.abs(e-M)<=Gr||Math.abs(Math.abs(this.lat0)-M)<=Gr||Math.abs(Math.abs(g)-M)<=Gr)throw Error();var b=1-this.es;t=Math.sqrt(b),Math.abs(this.lat0)>1e-10?(s=Math.sin(this.lat0),n=Math.cos(this.lat0),e=1-this.es*s*s,this.B=n*n,this.B=Math.sqrt(1+this.es*this.B*this.B/b),this.A=this.B*this.k0*t/e,r=this.B*t/(n*Math.sqrt(e)),i=r*r-1,i<=0?i=0:(i=Math.sqrt(i),this.lat0<0&&(i=-i)),this.E=i+=r,this.E*=st(this.e,this.lat0,s)**+this.B):(this.B=1/t,this.A=this.k0,this.E=r=i=1),v||y?(v?(d=Math.asin(Math.sin(_)/r),y||(u=_)):(d=u,_=Math.asin(r*Math.sin(d))),this.lam0=f-Math.asin(.5*(i-1/i)*Math.tan(d))/this.B):(a=st(this.e,h,Math.sin(h))**+this.B,o=st(this.e,g,Math.sin(g))**+this.B,i=this.E/a,c=(o-a)/(o+a),l=this.E*this.E,l=(l-o*a)/(l+o*a),e=p-m,e<-Math.PI?m-=de:e>Math.PI&&(m+=de),this.lam0=F(.5*(p+m)-Math.atan(l*Math.tan(.5*this.B*(p-m))/c)/this.B,this.over),d=Math.atan(2*Math.sin(this.B*F(p-this.lam0,this.over))/(i-1/i)),u=_=Math.asin(r*Math.sin(d))),this.singam=Math.sin(d),this.cosgam=Math.cos(d),this.sinrot=Math.sin(u),this.cosrot=Math.cos(u),this.rB=1/this.B,this.ArB=this.A*this.rB,this.BrA=1/this.ArB,this.no_off?this.u_0=0:(this.u_0=Math.abs(this.ArB*Math.atan(Math.sqrt(r*r-1)/Math.cos(_))),this.lat0<0&&(this.u_0=-this.u_0)),i=.5*d,this.v_pole_n=this.ArB*Math.log(Math.tan(P-i)),this.v_pole_s=this.ArB*Math.log(Math.tan(P+i))}function Jr(e){var t={},n,r,i,a,o,s,c,l;if(e.x-=this.lam0,Math.abs(Math.abs(e.y)-M)>1e-10){if(o=this.E/st(this.e,e.y,Math.sin(e.y))**+this.B,s=1/o,n=.5*(o-s),r=.5*(o+s),a=Math.sin(this.B*e.x),i=(n*this.singam-a*this.cosgam)/r,Math.abs(Math.abs(i)-1)<1e-10)throw Error();l=.5*this.ArB*Math.log((1-i)/(1+i)),s=Math.cos(this.B*e.x),c=Math.abs(s)0?this.v_pole_n:this.v_pole_s,c=this.ArB*e.y;return this.no_rot?(t.x=c,t.y=l):(c-=this.u_0,t.x=l*this.cosrot+c*this.sinrot,t.y=c*this.cosrot-l*this.sinrot),t.x=this.a*t.x+this.x0,t.y=this.a*t.y+this.y0,e.z!==void 0&&(t.z=e.z),e.m!==void 0&&(t.m=e.m),t}function Yr(e){var t,n,r,i,a,o,s,c={};if(e.x=(e.x-this.x0)*(1/this.a),e.y=(e.y-this.y0)*(1/this.a),this.no_rot?(n=e.y,t=e.x):(n=e.x*this.cosrot-e.y*this.sinrot,t=e.y*this.cosrot+e.x*this.sinrot+this.u_0),r=Math.exp(-this.BrA*n),i=.5*(r-1/r),a=.5*(r+1/r),o=Math.sin(this.BrA*t),s=(o*this.cosgam+i*this.singam)/a,Math.abs(Math.abs(s)-1)<1e-10)c.x=0,c.y=s<0?-M:M;else{if(c.y=this.E/Math.sqrt((1+s)/(1-s)),c.y=ct(this.e,c.y**(1/this.B)),c.y===1/0)throw Error();c.x=-this.rB*Math.atan2(i*this.cosgam-o*this.singam,Math.cos(this.BrA*t))}return c.x+=this.lam0,e.z!==void 0&&(c.z=e.z),e.m!==void 0&&(c.m=e.m),c}var Xr={init:qr,forward:Jr,inverse:Yr,names:[`Hotine_Oblique_Mercator`,`Hotine Oblique Mercator`,`Hotine_Oblique_Mercator_variant_A`,`Hotine_Oblique_Mercator_Variant_B`,`Hotine_Oblique_Mercator_Azimuth_Natural_Origin`,`Hotine_Oblique_Mercator_Two_Point_Natural_Origin`,`Hotine_Oblique_Mercator_Azimuth_Center`,`Oblique_Mercator`,`omerc`]};function Zr(){if(this.lat2||=this.lat1,this.k0||=1,this.x0=this.x0||0,this.y0=this.y0||0,this.long0=this.long0||0,!(Math.abs(this.lat1+this.lat2)<1e-10)){var e=this.b/this.a;this.e=Math.sqrt(1-e*e);var t=Math.sin(this.lat1),n=Math.cos(this.lat1),r=at(this.e,t,n),i=st(this.e,this.lat1,t),a=Math.sin(this.lat2),o=Math.cos(this.lat2),s=at(this.e,a,o),c=st(this.e,this.lat2,a),l=st(this.e,this.lat0,Math.sin(this.lat0));this.ns=Math.abs(this.lat1-this.lat2)>1e-10?Math.log(r/s)/Math.log(i/c):t,isNaN(this.ns)&&(this.ns=t),this.f0=r/(this.ns*i**+this.ns),this.rh=Math.abs(Math.abs(this.lat0)-M)<1e-10?0:this.a*this.f0*l**+this.ns,this.title||=`Lambert Conformal Conic`}}function Qr(e){var t=e.x,n=e.y;Math.abs(2*Math.abs(n)-Math.PI)<=1e-10&&(n=ot(n)*(M-2*le));var r=Math.abs(Math.abs(n)-M),i,a;if(r>1e-10)i=st(this.e,n,Math.sin(n)),a=this.a*this.f0*i**+this.ns;else{if(r=n*this.ns,r<=0)return null;a=0}var o=this.ns*F(t-this.long0,this.over);return e.x=this.k0*(a*Math.sin(o))+this.x0,e.y=this.k0*(this.rh-a*Math.cos(o))+this.y0,e}function $r(e){var t,n,r,i,a,o=(e.x-this.x0)/this.k0,s=this.rh-(e.y-this.y0)/this.k0;this.ns>0?(t=Math.sqrt(o*o+s*s),n=1):(t=-Math.sqrt(o*o+s*s),n=-1);var c=0;if(t!==0&&(c=Math.atan2(n*o,n*s)),t!==0||this.ns>0){if(n=1/this.ns,r=(t/(this.a*this.f0))**+n,i=ct(this.e,r),i===-9999)return null}else i=-M;return a=F(c/this.ns+this.long0,this.over),e.x=a,e.y=i,e}var ei={init:Zr,forward:Qr,inverse:$r,names:[`Lambert Tangential Conformal Conic Projection`,`Lambert_Conformal_Conic`,`Lambert_Conformal_Conic_1SP`,`Lambert_Conformal_Conic_2SP`,`lcc`,`Lambert Conic Conformal (1SP)`,`Lambert Conic Conformal (2SP)`]};function ti(){this.a=6377397.155,this.es=.006674372230614,this.e=Math.sqrt(this.es),this.lat0||=.863937979737193,this.long0||=.4334234309119251,this.k0||=.9999,this.s45=.785398163397448,this.s90=2*this.s45,this.fi0=this.lat0,this.e2=this.es,this.e=Math.sqrt(this.e2),this.alfa=Math.sqrt(1+this.e2*Math.cos(this.fi0)**4/(1-this.e2)),this.uq=1.04216856380474,this.u0=Math.asin(Math.sin(this.fi0)/this.alfa),this.g=((1+this.e*Math.sin(this.fi0))/(1-this.e*Math.sin(this.fi0)))**(this.alfa*this.e/2),this.k=Math.tan(this.u0/2+this.s45)/Math.tan(this.fi0/2+this.s45)**+this.alfa*this.g,this.k1=this.k0,this.n0=this.a*Math.sqrt(1-this.e2)/(1-this.e2*Math.sin(this.fi0)**2),this.s0=1.37008346281555,this.n=Math.sin(this.s0),this.ro0=this.k1*this.n0/Math.tan(this.s0),this.ad=this.s90-this.uq}function ni(e){var t,n,r,i,a,o,s,c=e.x,l=e.y,u=F(c-this.long0,this.over);return t=((1+this.e*Math.sin(l))/(1-this.e*Math.sin(l)))**(this.alfa*this.e/2),n=2*(Math.atan(this.k*Math.tan(l/2+this.s45)**+this.alfa/t)-this.s45),r=-u*this.alfa,i=Math.asin(Math.cos(this.ad)*Math.sin(n)+Math.sin(this.ad)*Math.cos(n)*Math.cos(r)),a=Math.asin(Math.cos(n)*Math.sin(r)/Math.cos(i)),o=this.n*a,s=this.ro0*Math.tan(this.s0/2+this.s45)**+this.n/Math.tan(i/2+this.s45)**+this.n,e.y=s*Math.cos(o)/1,e.x=s*Math.sin(o)/1,this.czech||(e.y*=-1,e.x*=-1),e}function ri(e){var t,n,r,i,a,o,s,c,l=e.x;e.x=e.y,e.y=l,this.czech||(e.y*=-1,e.x*=-1),o=Math.sqrt(e.x*e.x+e.y*e.y),a=Math.atan2(e.y,e.x),i=a/Math.sin(this.s0),r=2*(Math.atan((this.ro0/o)**(1/this.n)*Math.tan(this.s0/2+this.s45))-this.s45),t=Math.asin(Math.cos(this.ad)*Math.sin(r)-Math.sin(this.ad)*Math.cos(r)*Math.cos(i)),n=Math.asin(Math.cos(r)*Math.sin(i)/Math.cos(t)),e.x=this.long0-n/this.alfa,s=t,c=0;var u=0;do e.y=2*(Math.atan(this.k**(-1/this.alfa)*Math.tan(t/2+this.s45)**(1/this.alfa)*((1+this.e*Math.sin(s))/(1-this.e*Math.sin(s)))**(this.e/2))-this.s45),Math.abs(s-e.y)<1e-10&&(c=1),s=e.y,u+=1;while(c===0&&u<15);return u>=15?null:e}var ii={init:ti,forward:ni,inverse:ri,names:[`Krovak`,`Krovak Modified`,`Krovak (North Orientated)`,`Krovak Modified (North Orientated)`,`krovak`]};function ai(e,t,n,r,i){return e*i-t*Math.sin(2*i)+n*Math.sin(4*i)-r*Math.sin(6*i)}function oi(e){return 1-.25*e*(1+e/16*(3+1.25*e))}function si(e){return .375*e*(1+.25*e*(1+.46875*e))}function ci(e){return .05859375*e*e*(1+.75*e)}function li(e){return e*e*e*(35/3072)}function ui(e,t,n){var r=t*n;return e/Math.sqrt(1-r*r)}function di(e){return Math.abs(e)1e-7?(n=e*t,(1-e*e)*(t/(1-n*n)-.5/e*Math.log((1-n)/(1+n)))):2*t}var vi=.3333333333333333,yi=.17222222222222222,bi=.10257936507936508,xi=.06388888888888888,Si=.0664021164021164,Ci=.016415012942191543;function wi(e){var t,n=[];return n[0]=e*vi,t=e*e,n[0]+=t*yi,n[1]=t*xi,t*=e,n[0]+=t*bi,n[1]+=t*Si,n[2]=t*Ci,n}function Ti(e,t){var n=e+e;return e+t[0]*Math.sin(n)+t[1]*Math.sin(n+n)+t[2]*Math.sin(n+n+n)}function Ei(){var e=Math.abs(this.lat0);if(this.mode=Math.abs(e-M)<1e-10?this.lat0<0?1:2:Math.abs(e)<1e-10?3:4,this.es>0){var t;switch(this.qp=_i(this.e,1),this.mmf=.5/(1-this.es),this.apa=wi(this.es),this.mode){case 2:this.dd=1;break;case 1:this.dd=1;break;case 3:this.rq=Math.sqrt(.5*this.qp),this.dd=1/this.rq,this.xmf=1,this.ymf=.5*this.qp;break;case 4:this.rq=Math.sqrt(.5*this.qp),t=Math.sin(this.lat0),this.sinb1=_i(this.e,t)/this.qp,this.cosb1=Math.sqrt(1-this.sinb1*this.sinb1),this.dd=Math.cos(this.lat0)/(Math.sqrt(1-this.es*t*t)*this.rq*this.cosb1),this.ymf=(this.xmf=this.rq)/this.dd,this.xmf*=this.dd}}else this.mode===4&&(this.sinph0=Math.sin(this.lat0),this.cosph0=Math.cos(this.lat0))}function Di(e){var t,n,r,i,a,o,s,c,l,u,d=e.x,f=e.y;if(d=F(d-this.long0,this.over),this.sphere){if(a=Math.sin(f),u=Math.cos(f),r=Math.cos(d),this.mode===this.OBLIQ||this.mode===this.EQUIT){if(n=this.mode===this.EQUIT?1+u*r:1+this.sinph0*a+this.cosph0*u*r,n<=1e-10)return null;n=Math.sqrt(2/n),t=n*u*Math.sin(d),n*=this.mode===this.EQUIT?a:this.cosph0*a-this.sinph0*u*r}else if(this.mode===this.N_POLE||this.mode===this.S_POLE){if(this.mode===this.N_POLE&&(r=-r),Math.abs(f+this.lat0)<1e-10)return null;n=P-f*.5,n=2*(this.mode===this.S_POLE?Math.cos(n):Math.sin(n)),t=n*Math.sin(d),n*=r}}else{switch(s=0,c=0,l=0,r=Math.cos(d),i=Math.sin(d),a=Math.sin(f),o=_i(this.e,a),(this.mode===this.OBLIQ||this.mode===this.EQUIT)&&(s=o/this.qp,c=Math.sqrt(1-s*s)),this.mode){case this.OBLIQ:l=1+this.sinb1*s+this.cosb1*c*r;break;case this.EQUIT:l=1+c*r;break;case this.N_POLE:l=M+f,o=this.qp-o;break;case this.S_POLE:l=f-M,o=this.qp+o}if(Math.abs(l)<1e-10)return null;switch(this.mode){case this.OBLIQ:case this.EQUIT:l=Math.sqrt(2/l),n=this.mode===this.OBLIQ?this.ymf*l*(this.cosb1*s-this.sinb1*c*r):(l=Math.sqrt(2/(1+c*r)))*s*this.ymf,t=this.xmf*l*c*i;break;case this.N_POLE:case this.S_POLE:o>=0?(t=(l=Math.sqrt(o))*i,n=r*(this.mode===this.S_POLE?l:-l)):t=n=0}}return e.x=this.a*t+this.x0,e.y=this.a*n+this.y0,e}function Oi(e){e.x-=this.x0,e.y-=this.y0;var t=e.x/this.a,n=e.y/this.a,r,i,a,o,s,c,l;if(this.sphere){var u=0,d,f=0;if(d=Math.sqrt(t*t+n*n),i=d*.5,i>1)return null;switch(i=2*Math.asin(i),(this.mode===this.OBLIQ||this.mode===this.EQUIT)&&(f=Math.sin(i),u=Math.cos(i)),this.mode){case this.EQUIT:i=Math.abs(d)<=1e-10?0:Math.asin(n*f/d),t*=f,n=u*d;break;case this.OBLIQ:i=Math.abs(d)<=1e-10?this.lat0:Math.asin(u*this.sinph0+n*f*this.cosph0/d),t*=f*this.cosph0,n=(u-Math.sin(i)*this.sinph0)*d;break;case this.N_POLE:n=-n,i=M-i;break;case this.S_POLE:i-=M}r=n===0&&(this.mode===this.EQUIT||this.mode===this.OBLIQ)?0:Math.atan2(t,n)}else{if(l=0,this.mode===this.OBLIQ||this.mode===this.EQUIT){if(t/=this.dd,n*=this.dd,c=Math.sqrt(t*t+n*n),c<1e-10)return e.x=this.long0,e.y=this.lat0,e;o=2*Math.asin(.5*c/this.rq),a=Math.cos(o),t*=o=Math.sin(o),this.mode===this.OBLIQ?(l=a*this.sinb1+n*o*this.cosb1/c,s=this.qp*l,n=c*this.cosb1*a-n*this.sinb1*o):(l=n*o/c,s=this.qp*l,n=c*a)}else if(this.mode===this.N_POLE||this.mode===this.S_POLE){if(this.mode===this.N_POLE&&(n=-n),s=t*t+n*n,!s)return e.x=this.long0,e.y=this.lat0,e;l=1-s/this.qp,this.mode===this.S_POLE&&(l=-l)}r=Math.atan2(t,n),i=Ti(Math.asin(l),this.apa)}return e.x=F(this.long0+r,this.over),e.y=i,e}var ki={init:Ei,forward:Di,inverse:Oi,names:[`Lambert Azimuthal Equal Area`,`Lambert_Azimuthal_Equal_Area`,`laea`],S_POLE:1,N_POLE:2,EQUIT:3,OBLIQ:4};function Ai(e){return Math.abs(e)>1&&(e=e>1?1:-1),Math.asin(e)}function ji(){Math.abs(this.lat1+this.lat2)<1e-10||(this.temp=this.b/this.a,this.es=1-this.temp**2,this.e3=Math.sqrt(this.es),this.sin_po=Math.sin(this.lat1),this.cos_po=Math.cos(this.lat1),this.t1=this.sin_po,this.con=this.sin_po,this.ms1=at(this.e3,this.sin_po,this.cos_po),this.qs1=_i(this.e3,this.sin_po),this.sin_po=Math.sin(this.lat2),this.cos_po=Math.cos(this.lat2),this.t2=this.sin_po,this.ms2=at(this.e3,this.sin_po,this.cos_po),this.qs2=_i(this.e3,this.sin_po),this.sin_po=Math.sin(this.lat0),this.cos_po=Math.cos(this.lat0),this.t3=this.sin_po,this.qs0=_i(this.e3,this.sin_po),this.ns0=Math.abs(this.lat1-this.lat2)>1e-10?(this.ms1*this.ms1-this.ms2*this.ms2)/(this.qs2-this.qs1):this.con,this.c=this.ms1*this.ms1+this.ns0*this.qs1,this.rh=this.a*Math.sqrt(this.c-this.ns0*this.qs0)/this.ns0)}function Mi(e){var t=e.x,n=e.y;this.sin_phi=Math.sin(n),this.cos_phi=Math.cos(n);var r=_i(this.e3,this.sin_phi),i=this.a*Math.sqrt(this.c-this.ns0*r)/this.ns0,a=this.ns0*F(t-this.long0,this.over),o=i*Math.sin(a)+this.x0,s=this.rh-i*Math.cos(a)+this.y0;return e.x=o,e.y=s,e}function Ni(e){var t,n,r,i,a,o;return e.x-=this.x0,e.y=this.rh-e.y+this.y0,this.ns0>=0?(t=Math.sqrt(e.x*e.x+e.y*e.y),r=1):(t=-Math.sqrt(e.x*e.x+e.y*e.y),r=-1),i=0,t!==0&&(i=Math.atan2(r*e.x,r*e.y)),r=t*this.ns0/this.a,this.sphere?o=Math.asin((this.c-r*r)/(2*this.ns0)):(n=(this.c-r*r)/this.ns0,o=this.phi1z(this.e3,n)),a=F(i/this.ns0+this.long0,this.over),e.x=a,e.y=o,e}function Pi(e,t){var n,r,i,a,o,s=Ai(.5*t);if(e<1e-10)return s;for(var c=e*e,l=1;l<=25;l++)if(n=Math.sin(s),r=Math.cos(s),i=e*n,a=1-i*i,o=.5*a*a/r*(t/(1-c)-n/a+.5/e*Math.log((1-i)/(1+i))),s+=o,Math.abs(o)<=1e-7)return s;return null}var Fi={init:ji,forward:Mi,inverse:Ni,names:[`Albers_Conic_Equal_Area`,`Albers_Equal_Area`,`Albers`,`aea`],phi1z:Pi};function Ii(){this.sin_p14=Math.sin(this.lat0),this.cos_p14=Math.cos(this.lat0),this.infinity_dist=1e3*this.a,this.rc=1}function Li(e){var t,n,r,i,a,o,s,c,l=e.x,u=e.y;return r=F(l-this.long0,this.over),t=Math.sin(u),n=Math.cos(u),i=Math.cos(r),o=this.sin_p14*t+this.cos_p14*n*i,a=1,o>0||Math.abs(o)<=1e-10?(s=this.x0+this.a*a*n*Math.sin(r)/o,c=this.y0+this.a*a*(this.cos_p14*t-this.sin_p14*n*i)/o):(s=this.x0+this.infinity_dist*n*Math.sin(r),c=this.y0+this.infinity_dist*(this.cos_p14*t-this.sin_p14*n*i)),e.x=s,e.y=c,e}function Ri(e){var t,n,r,i,a,o;return e.x=(e.x-this.x0)/this.a,e.y=(e.y-this.y0)/this.a,e.x/=this.k0,e.y/=this.k0,(t=Math.sqrt(e.x*e.x+e.y*e.y))?(i=Math.atan2(t,this.rc),n=Math.sin(i),r=Math.cos(i),o=Ai(r*this.sin_p14+e.y*n*this.cos_p14/t),a=Math.atan2(e.x*n,t*this.cos_p14*r-e.y*this.sin_p14*n),a=F(this.long0+a,this.over)):(o=this.phic0,a=0),e.x=a,e.y=o,e}var zi={init:Ii,forward:Li,inverse:Ri,names:[`gnom`]};function Bi(e,t){var n=1-(1-e*e)/(2*e)*Math.log((1-e)/(1+e));if(Math.abs(Math.abs(t)-n)<1e-6)return t<0?-1*M:M;for(var r=Math.asin(.5*t),i,a,o,s,c=0;c<30;c++)if(a=Math.sin(r),o=Math.cos(r),s=e*a,i=(1-s*s)**2/(2*o)*(t/(1-e*e)-a/(1-s*s)+.5/e*Math.log((1-s)/(1+s))),r+=i,Math.abs(i)<=1e-10)return r;return NaN}function Vi(){this.sphere||(this.k0=at(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)))}function Hi(e){var t=e.x,n=e.y,r,i,a=F(t-this.long0,this.over);if(this.sphere)r=this.x0+this.a*a*Math.cos(this.lat_ts),i=this.y0+this.a*Math.sin(n)/Math.cos(this.lat_ts);else{var o=_i(this.e,Math.sin(n));r=this.x0+this.a*this.k0*a,i=this.y0+this.a*o*.5/this.k0}return e.x=r,e.y=i,e}function Ui(e){e.x-=this.x0,e.y-=this.y0;var t,n;return this.sphere?(t=F(this.long0+e.x/this.a/Math.cos(this.lat_ts),this.over),n=Math.asin(e.y/this.a*Math.cos(this.lat_ts))):(n=Bi(this.e,2*e.y*this.k0/this.a),t=F(this.long0+e.x/(this.a*this.k0),this.over)),e.x=t,e.y=n,e}var Wi={init:Vi,forward:Hi,inverse:Ui,names:[`cea`]};function Gi(){this.x0=this.x0||0,this.y0=this.y0||0,this.lat0=this.lat0||0,this.long0=this.long0||0,this.lat_ts=this.lat_ts||0,this.title=this.title||`Equidistant Cylindrical (Plate Carre)`,this.rc=Math.cos(this.lat_ts)}function Ki(e){var t=e.x,n=e.y,r=F(t-this.long0,this.over),i=di(n-this.lat0);return e.x=this.x0+this.a*r*this.rc,e.y=this.y0+this.a*i,e}function qi(e){var t=e.x,n=e.y;return e.x=F(this.long0+(t-this.x0)/(this.a*this.rc),this.over),e.y=di(this.lat0+(n-this.y0)/this.a),e}var Ji={init:Gi,forward:Ki,inverse:qi,names:[`Equirectangular`,`Equidistant_Cylindrical`,`Equidistant_Cylindrical_Spherical`,`eqc`]},Yi=20;function Xi(){this.temp=this.b/this.a,this.es=1-this.temp**2,this.e=Math.sqrt(this.es),this.e0=oi(this.es),this.e1=si(this.es),this.e2=ci(this.es),this.e3=li(this.es),this.ml0=this.a*ai(this.e0,this.e1,this.e2,this.e3,this.lat0)}function Zi(e){var t=e.x,n=e.y,r,i,a,o=F(t-this.long0,this.over);if(a=o*Math.sin(n),this.sphere)Math.abs(n)<=1e-10?(r=this.a*o,i=-1*this.a*this.lat0):(r=this.a*Math.sin(a)/Math.tan(n),i=this.a*(di(n-this.lat0)+(1-Math.cos(a))/Math.tan(n)));else if(Math.abs(n)<=1e-10)r=this.a*o,i=-1*this.ml0;else{var s=ui(this.a,this.e,Math.sin(n))/Math.tan(n);r=s*Math.sin(a),i=this.a*ai(this.e0,this.e1,this.e2,this.e3,n)-this.ml0+s*(1-Math.cos(a))}return e.x=r+this.x0,e.y=i+this.y0,e}function Qi(e){var t,n,r=e.x-this.x0,i=e.y-this.y0,a,o,s,c,l;if(this.sphere){if(Math.abs(i+this.a*this.lat0)<=1e-10)t=F(r/this.a+this.long0,this.over),n=0;else{o=this.lat0+i/this.a,s=r*r/this.a/this.a+o*o,c=o;var u;for(a=Yi;a;--a)if(u=Math.tan(c),l=-1*(o*(c*u+1)-c-.5*(c*c+s)*u)/((c-o)/u-1),c+=l,Math.abs(l)<=1e-10){n=c;break}t=F(this.long0+Math.asin(r*Math.tan(c)/this.a)/Math.sin(n),this.over)}}else if(Math.abs(i+this.ml0)<=1e-10)n=0,t=F(this.long0+r/this.a,this.over);else{o=(this.ml0+i)/this.a,s=r*r/this.a/this.a+o*o,c=o;var d,f,p,m,h;for(a=Yi;a;--a)if(h=this.e*Math.sin(c),d=Math.sqrt(1-h*h)*Math.tan(c),f=this.a*ai(this.e0,this.e1,this.e2,this.e3,c),p=this.e0-2*this.e1*Math.cos(2*c)+4*this.e2*Math.cos(4*c)-6*this.e3*Math.cos(6*c),m=f/this.a,l=(o*(d*m+1)-m-.5*d*(m*m+s))/(this.es*Math.sin(2*c)*(m*m+s-2*o*m)/(4*d)+(o-m)*(d*p-2/Math.sin(2*c))-p),c-=l,Math.abs(l)<=1e-10){n=c;break}d=Math.sqrt(1-this.es*Math.sin(n)**2)*Math.tan(n),t=F(this.long0+Math.asin(r*d/this.a)/Math.sin(n),this.over)}return e.x=t,e.y=n,e}var $i={init:Xi,forward:Zi,inverse:Qi,names:[`Polyconic`,`American_Polyconic`,`poly`]};function ea(){this.A=[],this.A[1]=.6399175073,this.A[2]=-.1358797613,this.A[3]=.063294409,this.A[4]=-.02526853,this.A[5]=.0117879,this.A[6]=-.0055161,this.A[7]=.0026906,this.A[8]=-.001333,this.A[9]=67e-5,this.A[10]=-34e-5,this.B_re=[],this.B_im=[],this.B_re[1]=.7557853228,this.B_im[1]=0,this.B_re[2]=.249204646,this.B_im[2]=.003371507,this.B_re[3]=-.001541739,this.B_im[3]=.04105856,this.B_re[4]=-.10162907,this.B_im[4]=.01727609,this.B_re[5]=-.26623489,this.B_im[5]=-.36249218,this.B_re[6]=-.6870983,this.B_im[6]=-1.1651967,this.C_re=[],this.C_im=[],this.C_re[1]=1.3231270439,this.C_im[1]=0,this.C_re[2]=-.577245789,this.C_im[2]=-.007809598,this.C_re[3]=.508307513,this.C_im[3]=-.112208952,this.C_re[4]=-.15094762,this.C_im[4]=.18200602,this.C_re[5]=1.01418179,this.C_im[5]=1.64497696,this.C_re[6]=1.9660549,this.C_im[6]=2.5127645,this.D=[],this.D[1]=1.5627014243,this.D[2]=.5185406398,this.D[3]=-.03333098,this.D[4]=-.1052906,this.D[5]=-.0368594,this.D[6]=.007317,this.D[7]=.0122,this.D[8]=.00394,this.D[9]=-.0013}function ta(e){var t,n=e.x,r=e.y-this.lat0,i=n-this.long0,a=r/ae*1e-5,o=i,s=1,c=0;for(t=1;t<=10;t++)s*=a,c+=this.A[t]*s;var l=c,u=o,d=1,f=0,p,m,h=0,g=0;for(t=1;t<=6;t++)p=d*l-f*u,m=f*l+d*u,d=p,f=m,h=h+this.B_re[t]*d-this.B_im[t]*f,g=g+this.B_im[t]*d+this.B_re[t]*f;return e.x=g*this.a+this.x0,e.y=h*this.a+this.y0,e}function na(e){var t,n=e.x,r=e.y,i=n-this.x0,a=(r-this.y0)/this.a,o=i/this.a,s=1,c=0,l,u,d=0,f=0;for(t=1;t<=6;t++)l=s*a-c*o,u=c*a+s*o,s=l,c=u,d=d+this.C_re[t]*s-this.C_im[t]*c,f=f+this.C_im[t]*s+this.C_re[t]*c;for(var p=0;p.999999999999&&(n=.999999999999),t=Math.asin(n);var r=F(this.long0+e.x/(.900316316158*this.a*Math.cos(t)),this.over);r<-Math.PI&&(r=-Math.PI),r>Math.PI&&(r=Math.PI),n=(2*t+Math.sin(2*t))/Math.PI,Math.abs(n)>1&&(n=1);var i=Math.asin(n);return e.x=r,e.y=i,e}var va={init:ha,forward:ga,inverse:_a,names:[`Mollweide`,`moll`]};function ya(){Math.abs(this.lat1+this.lat2)<1e-10||(this.lat2=this.lat2||this.lat1,this.temp=this.b/this.a,this.es=1-this.temp**2,this.e=Math.sqrt(this.es),this.e0=oi(this.es),this.e1=si(this.es),this.e2=ci(this.es),this.e3=li(this.es),this.sin_phi=Math.sin(this.lat1),this.cos_phi=Math.cos(this.lat1),this.ms1=at(this.e,this.sin_phi,this.cos_phi),this.ml1=ai(this.e0,this.e1,this.e2,this.e3,this.lat1),Math.abs(this.lat1-this.lat2)<1e-10?this.ns=this.sin_phi:(this.sin_phi=Math.sin(this.lat2),this.cos_phi=Math.cos(this.lat2),this.ms2=at(this.e,this.sin_phi,this.cos_phi),this.ml2=ai(this.e0,this.e1,this.e2,this.e3,this.lat2),this.ns=(this.ms1-this.ms2)/(this.ml2-this.ml1)),this.g=this.ml1+this.ms1/this.ns,this.ml0=ai(this.e0,this.e1,this.e2,this.e3,this.lat0),this.rh=this.a*(this.g-this.ml0))}function ba(e){var t=e.x,n=e.y,r;if(this.sphere)r=this.a*(this.g-n);else{var i=ai(this.e0,this.e1,this.e2,this.e3,n);r=this.a*(this.g-i)}var a=this.ns*F(t-this.long0,this.over),o=this.x0+r*Math.sin(a),s=this.y0+this.rh-r*Math.cos(a);return e.x=o,e.y=s,e}function xa(e){e.x-=this.x0,e.y=this.rh-e.y+this.y0;var t,n,r,i;this.ns>=0?(n=Math.sqrt(e.x*e.x+e.y*e.y),t=1):(n=-Math.sqrt(e.x*e.x+e.y*e.y),t=-1);var a=0;return n!==0&&(a=Math.atan2(t*e.x,t*e.y)),this.sphere?(i=F(this.long0+a/this.ns,this.over),r=di(this.g-n/this.a),e.x=i,e.y=r,e):(r=fi(this.g-n/this.a,this.e0,this.e1,this.e2,this.e3),i=F(this.long0+a/this.ns,this.over),e.x=i,e.y=r,e)}var Sa={init:ya,forward:ba,inverse:xa,names:[`Equidistant_Conic`,`eqdc`]};function Ca(){this.R=this.a}function wa(e){var t=e.x,n=e.y,r=F(t-this.long0,this.over),i,a;if(Math.abs(n)<=1e-10)return i=this.x0+this.R*r,a=this.y0,e.x=i,e.y=a,e;var o=Ai(2*Math.abs(n/Math.PI));if(Math.abs(r)<=1e-10||Math.abs(Math.abs(n)-M)<=1e-10)return i=this.x0,a=n>=0?this.y0+Math.PI*this.R*Math.tan(.5*o):this.y0+Math.PI*this.R*-Math.tan(.5*o),e.x=i,e.y=a,e;var s=.5*Math.abs(Math.PI/r-r/Math.PI),c=s*s,l=Math.sin(o),u=Math.cos(o),d=u/(l+u-1),f=d*d,p=d*(2/l-1),m=p*p,h=Math.PI*this.R*(s*(d-m)+Math.sqrt(c*(d-m)*(d-m)-(m+c)*(f-m)))/(m+c);r<0&&(h=-h),i=this.x0+h;var g=c+d;return h=Math.PI*this.R*(p*g-s*Math.sqrt((m+c)*(c+1)-g*g))/(m+c),a=n>=0?this.y0+h:this.y0-h,e.x=i,e.y=a,e}function Ta(e){var t,n,r,i,a,o,s,c,l,u,d,f,p;return e.x-=this.x0,e.y-=this.y0,d=Math.PI*this.R,r=e.x/d,i=e.y/d,a=r*r+i*i,o=-Math.abs(i)*(1+a),s=o-2*i*i+r*r,c=-2*o+1+2*i*i+a*a,p=i*i/c+(2*s*s*s/c/c/c-9*o*s/c/c)/27,l=(o-s*s/3/c)/c,u=2*Math.sqrt(-l/3),d=3*p/l/u,Math.abs(d)>1&&(d=d>=0?1:-1),f=Math.acos(d)/3,n=e.y>=0?(-u*Math.cos(f+Math.PI/3)-s/3/c)*Math.PI:-(-u*Math.cos(f+Math.PI/3)-s/3/c)*Math.PI,t=Math.abs(r)<1e-10?this.long0:F(this.long0+Math.PI*(a-1+Math.sqrt(1+2*(r*r-i*i)+a*a))/2/r,this.over),e.x=t,e.y=n,e}var Ea={init:Ca,forward:wa,inverse:Ta,names:[`Van_der_Grinten_I`,`VanDerGrinten`,`Van_der_Grinten`,`vandg`]};function Da(e,t,n,r,i,a){let o=r-t,s=Math.atan((1-a)*Math.tan(e)),c=Math.atan((1-a)*Math.tan(n)),l=Math.sin(s),u=Math.cos(s),d=Math.sin(c),f=Math.cos(c),p=o,m,h=100,g,_,v,y,b,x,S,C,w,T,E,D,O,k;do{if(g=Math.sin(p),_=Math.cos(p),v=Math.sqrt(f*g*(f*g)+(u*d-l*f*_)*(u*d-l*f*_)),v===0)return{azi1:0,s12:0};y=l*d+u*f*_,b=Math.atan2(v,y),x=u*f*g/v,S=1-x*x,C=S===0?0:y-2*l*d/S,w=a/16*S*(4+a*(4-3*S)),m=p,p=o+(1-w)*a*x*(b+w*v*(C+w*y*(-1+2*C*C)))}while(Math.abs(p-m)>1e-12&&--h>0);return h===0?{azi1:NaN,s12:NaN}:(T=S*(i*i-i*(1-a)*(i*(1-a)))/(i*(1-a)*(i*(1-a))),E=1+T/16384*(4096+T*(-768+T*(320-175*T))),D=T/1024*(256+T*(-128+T*(74-47*T))),O=D*v*(C+D/4*(y*(-1+2*C*C)-D/6*C*(-3+4*v*v)*(-3+4*C*C))),k=i*(1-a)*E*(b-O),{azi1:Math.atan2(f*g,u*d-l*f*_),s12:k})}function Oa(e,t,n,r,i,a){let o=Math.atan((1-a)*Math.tan(e)),s=Math.sin(o),c=Math.cos(o),l=Math.sin(n),u=Math.cos(n),d=Math.atan2(s,c*u),f=c*l,p=1-f*f,m=p*(i*i-i*(1-a)*(i*(1-a)))/(i*(1-a)*(i*(1-a))),h=1+m/16384*(4096+m*(-768+m*(320-175*m))),g=m/1024*(256+m*(-128+m*(74-47*m))),_=r/(i*(1-a)*h),v,y=100,b,x,S,C;do b=Math.cos(2*d+_),x=Math.sin(_),S=Math.cos(_),C=g*x*(b+g/4*(S*(-1+2*b*b)-g/6*b*(-3+4*x*x)*(-3+4*b*b))),v=_,_=r/(i*(1-a)*h)+C;while(Math.abs(_-v)>1e-12&&--y>0);if(y===0)return{lat2:NaN,lon2:NaN};let w=s*x-c*S*u,T=Math.atan2(s*S+c*x*u,(1-a)*Math.sqrt(f*f+w*w)),E=Math.atan2(x*l,c*S-s*x*u),D=a/16*p*(4+a*(4-3*p));return{lat2:T,lon2:t+(E-(1-D)*a*f*(_+D*x*(b+D*S*(-1+2*b*b))))}}function ka(){this.sin_p12=Math.sin(this.lat0),this.cos_p12=Math.cos(this.lat0),this.x0=this.x0||0,this.y0=this.y0||0,this.long0=this.long0||0,this.f=this.es/(1+Math.sqrt(1-this.es))}function Aa(e){var t=e.x,n=e.y,r=Math.sin(e.y),i=Math.cos(e.y),a=F(t-this.long0,this.over),o,s,c,l,u,d,f,p,m,h,g;return this.sphere?Math.abs(this.sin_p12-1)<=1e-10?(e.x=this.x0+this.a*(M-n)*Math.sin(a),e.y=this.y0-this.a*(M-n)*Math.cos(a),e):Math.abs(this.sin_p12+1)<=1e-10?(e.x=this.x0+this.a*(M+n)*Math.sin(a),e.y=this.y0+this.a*(M+n)*Math.cos(a),e):(m=this.sin_p12*r+this.cos_p12*i*Math.cos(a),f=Math.acos(m),p=f?f/Math.sin(f):1,e.x=this.x0+this.a*p*i*Math.sin(a),e.y=this.y0+this.a*p*(this.cos_p12*r-this.sin_p12*i*Math.cos(a)),e):(o=oi(this.es),s=si(this.es),c=ci(this.es),l=li(this.es),Math.abs(this.sin_p12-1)<=1e-10?(u=this.a*ai(o,s,c,l,M),d=this.a*ai(o,s,c,l,n),e.x=this.x0+(u-d)*Math.sin(a),e.y=this.y0-(u-d)*Math.cos(a),e):Math.abs(this.sin_p12+1)<=1e-10?(u=this.a*ai(o,s,c,l,M),d=this.a*ai(o,s,c,l,n),e.x=this.x0+(u+d)*Math.sin(a),e.y=this.y0+(u+d)*Math.cos(a),e):Math.abs(t)<1e-10&&Math.abs(n-this.lat0)<1e-10?(e.x=this.x0,e.y=this.y0,e):(h=Da(this.lat0,this.long0,n,t,this.a,this.f),g=h.azi1,e.x=this.x0+h.s12*Math.sin(g),e.y=this.y0+h.s12*Math.cos(g),e))}function ja(e){e.x-=this.x0,e.y-=this.y0;var t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g;return this.sphere?(t=Math.sqrt(e.x*e.x+e.y*e.y),t>2*M*this.a?void 0:(n=t/this.a,r=Math.sin(n),i=Math.cos(n),a=this.long0,Math.abs(t)<=1e-10?o=this.lat0:(o=Ai(i*this.sin_p12+e.y*r*this.cos_p12/t),s=Math.abs(this.lat0)-M,a=Math.abs(s)<=1e-10?this.lat0>=0?F(this.long0+Math.atan2(e.x,-e.y),this.over):F(this.long0-Math.atan2(-e.x,e.y),this.over):F(this.long0+Math.atan2(e.x*r,t*this.cos_p12*i-e.y*this.sin_p12*r),this.over)),e.x=a,e.y=o,e)):(c=oi(this.es),l=si(this.es),u=ci(this.es),d=li(this.es),Math.abs(this.sin_p12-1)<=1e-10?(f=this.a*ai(c,l,u,d,M),t=Math.sqrt(e.x*e.x+e.y*e.y),p=f-t,o=fi(p/this.a,c,l,u,d),a=F(this.long0+Math.atan2(e.x,-1*e.y),this.over),e.x=a,e.y=o,e):Math.abs(this.sin_p12+1)<=1e-10?(f=this.a*ai(c,l,u,d,M),t=Math.sqrt(e.x*e.x+e.y*e.y),p=t-f,o=fi(p/this.a,c,l,u,d),a=F(this.long0+Math.atan2(e.x,e.y),this.over),e.x=a,e.y=o,e):(m=Math.atan2(e.x,e.y),h=Math.sqrt(e.x*e.x+e.y*e.y),g=Oa(this.lat0,this.long0,m,h,this.a,this.f),e.x=g.lon2,e.y=g.lat2,e))}var Ma={init:ka,forward:Aa,inverse:ja,names:[`Azimuthal_Equidistant`,`aeqd`]};function Na(){this.sin_p14=Math.sin(this.lat0||0),this.cos_p14=Math.cos(this.lat0||0)}function Pa(e){var t,n,r,i,a,o,s,c,l=e.x,u=e.y;return r=F(l-(this.long0||0),this.over),t=Math.sin(u),n=Math.cos(u),i=Math.cos(r),o=this.sin_p14*t+this.cos_p14*n*i,a=1,(o>0||Math.abs(o)<=1e-10)&&(s=(this.x0||0)+this.a*a*n*Math.sin(r),c=(this.y0||0)+this.a*a*(this.cos_p14*t-this.sin_p14*n*i)),e.x=s,e.y=c,e}function Fa(e){var t,n,r,i,a,o,s,c,l;return e.x-=this.x0||0,e.y-=this.y0||0,t=Math.sqrt(e.x*e.x+e.y*e.y),n=Ai(t/this.a),r=Math.sin(n),i=Math.cos(n),c=this.long0||0,l=this.lat0||0,o=c,Math.abs(t)<=1e-10?(s=l,e.x=o,e.y=s,e):(s=Ai(i*this.sin_p14+e.y*r*this.cos_p14/t),a=Math.abs(l)-M,Math.abs(a)<=1e-10?(o=F(l>=0?c+Math.atan2(e.x,-e.y):c-Math.atan2(-e.x,e.y),this.over),e.x=o,e.y=s,e):(o=F(c+Math.atan2(e.x*r,t*this.cos_p14*i-e.y*this.sin_p14*r),this.over),e.x=o,e.y=s,e))}var Ia={init:Na,forward:Pa,inverse:Fa,names:[`ortho`]},La={FRONT:1,RIGHT:2,BACK:3,LEFT:4,TOP:5,BOTTOM:6},I={AREA_0:1,AREA_1:2,AREA_2:3,AREA_3:4};function Ra(){this.x0=this.x0||0,this.y0=this.y0||0,this.lat0=this.lat0||0,this.long0=this.long0||0,this.lat_ts=this.lat_ts||0,this.title=this.title||`Quadrilateralized Spherical Cube`,this.face=this.lat0>=M-P/2?La.TOP:this.lat0<=-(M-P/2)?La.BOTTOM:Math.abs(this.long0)<=P?La.FRONT:Math.abs(this.long0)<=M+P?this.long0>0?La.RIGHT:La.LEFT:La.BACK,this.es!==0&&(this.one_minus_f=1-(this.a-this.b)/this.a,this.one_minus_f_squared=this.one_minus_f*this.one_minus_f)}function za(e){var t={x:0,y:0},n,r,i,a,o,s,c={value:0};if(e.x-=this.long0,n=this.es===0?e.y:Math.atan(this.one_minus_f_squared*Math.tan(e.y)),r=e.x,this.face===La.TOP)a=M-n,r>=P&&r<=M+P?(c.value=I.AREA_0,i=r-M):r>M+P||r<=-(M+P)?(c.value=I.AREA_1,i=r>0?r-fe:r+fe):r>-(M+P)&&r<=-P?(c.value=I.AREA_2,i=r+M):(c.value=I.AREA_3,i=r);else if(this.face===La.BOTTOM)a=M+n,r>=P&&r<=M+P?(c.value=I.AREA_0,i=-r+M):r=-P?(c.value=I.AREA_1,i=-r):r<-P&&r>=-(M+P)?(c.value=I.AREA_2,i=-r-M):(c.value=I.AREA_3,i=r>0?-r+fe:-r-fe);else{var l,u,d,f,p,m,h;this.face===La.RIGHT?r=Ha(r,+M):this.face===La.BACK?r=Ha(r,+fe):this.face===La.LEFT&&(r=Ha(r,-M)),f=Math.sin(n),p=Math.cos(n),m=Math.sin(r),h=Math.cos(r),l=p*h,u=p*m,d=f,this.face===La.FRONT?(a=Math.acos(l),i=Va(a,d,u,c)):this.face===La.RIGHT?(a=Math.acos(u),i=Va(a,d,-l,c)):this.face===La.BACK?(a=Math.acos(-l),i=Va(a,d,-u,c)):this.face===La.LEFT?(a=Math.acos(-u),i=Va(a,d,l,c)):(a=i=0,c.value=I.AREA_0)}return s=Math.atan(12/fe*(i+Math.acos(Math.sin(i)*Math.cos(P))-M)),o=Math.sqrt((1-Math.cos(a))/(Math.cos(s)*Math.cos(s))/(1-Math.cos(Math.atan(1/Math.cos(i))))),c.value===I.AREA_1?s+=M:c.value===I.AREA_2?s+=fe:c.value===I.AREA_3&&(s+=1.5*fe),t.x=o*Math.cos(s),t.y=o*Math.sin(s),t.x=t.x*this.a+this.x0,t.y=t.y*this.a+this.y0,e.x=t.x,e.y=t.y,e}function Ba(e){var t={lam:0,phi:0},n,r,i,a,o,s,c,l,u,d={value:0};if(e.x=(e.x-this.x0)/this.a,e.y=(e.y-this.y0)/this.a,r=Math.atan(Math.sqrt(e.x*e.x+e.y*e.y)),n=Math.atan2(e.y,e.x),e.x>=0&&e.x>=Math.abs(e.y)?d.value=I.AREA_0:e.y>=0&&e.y>=Math.abs(e.x)?(d.value=I.AREA_1,n-=M):e.x<0&&-e.x>=Math.abs(e.y)?(d.value=I.AREA_2,n=n<0?n+fe:n-fe):(d.value=I.AREA_3,n+=M),u=fe/12*Math.tan(n),o=Math.sin(u)/(Math.cos(u)-1/Math.sqrt(2)),s=Math.atan(o),i=Math.cos(n),a=Math.tan(r),c=1-i*i*a*a*(1-Math.cos(Math.atan(1/Math.cos(s)))),c<-1?c=-1:c>1&&(c=1),this.face===La.TOP)l=Math.acos(c),t.phi=M-l,t.lam=d.value===I.AREA_0?s+M:d.value===I.AREA_1?s<0?s+fe:s-fe:d.value===I.AREA_2?s-M:s;else if(this.face===La.BOTTOM)l=Math.acos(c),t.phi=l-M,t.lam=d.value===I.AREA_0?-s+M:d.value===I.AREA_1?-s:d.value===I.AREA_2?-s-M:s<0?-s-fe:-s+fe;else{var f=c,p,m;u=f*f,m=u>=1?0:Math.sqrt(1-u)*Math.sin(s),u+=m*m,p=u>=1?0:Math.sqrt(1-u),d.value===I.AREA_1?(u=p,p=-m,m=u):d.value===I.AREA_2?(p=-p,m=-m):d.value===I.AREA_3&&(u=p,p=m,m=-u),this.face===La.RIGHT?(u=f,f=-p,p=u):this.face===La.BACK?(f=-f,p=-p):this.face===La.LEFT&&(u=f,f=p,p=-u),t.phi=Math.acos(-m)-M,t.lam=Math.atan2(p,f),this.face===La.RIGHT?t.lam=Ha(t.lam,-M):this.face===La.BACK?t.lam=Ha(t.lam,-fe):this.face===La.LEFT&&(t.lam=Ha(t.lam,+M))}if(this.es!==0){var h=+(t.phi<0),g=Math.tan(t.phi),_=this.b/Math.sqrt(g*g+this.one_minus_f_squared);t.phi=Math.atan(Math.sqrt(this.a*this.a-_*_)/(this.one_minus_f*_)),h&&(t.phi=-t.phi)}return t.lam+=this.long0,e.x=t.lam,e.y=t.phi,e}function Va(e,t,n,r){var i;return e<1e-10?(r.value=I.AREA_0,i=0):(i=Math.atan2(t,n),Math.abs(i)<=P?r.value=I.AREA_0:i>P&&i<=M+P?(r.value=I.AREA_1,i-=M):i>M+P||i<=-(M+P)?(r.value=I.AREA_2,i=i>=0?i-fe:i+fe):(r.value=I.AREA_3,i+=M)),i}function Ha(e,t){var n=e+t;return n<-3.14159265359?n+=de:n>3.14159265359&&(n-=de),n}var Ua={init:Ra,forward:za,inverse:Ba,names:[`Quadrilateralized Spherical Cube`,`Quadrilateralized_Spherical_Cube`,`qsc`]},Wa=[[1,22199e-21,-715515e-10,31103e-10],[.9986,-482243e-9,-24897e-9,-13309e-10],[.9954,-83103e-8,-448605e-10,-9.86701e-7],[.99,-.00135364,-59661e-9,36777e-10],[.9822,-.00167442,-449547e-11,-572411e-11],[.973,-.00214868,-903571e-10,1.8736e-8],[.96,-.00305085,-900761e-10,164917e-11],[.9427,-.00382792,-653386e-10,-26154e-10],[.9216,-.00467746,-10457e-8,481243e-11],[.8962,-.00536223,-323831e-10,-543432e-11],[.8679,-.00609363,-113898e-9,332484e-11],[.835,-.00698325,-640253e-10,9.34959e-7],[.7986,-.00755338,-500009e-10,9.35324e-7],[.7597,-.00798324,-35971e-9,-227626e-11],[.7186,-.00851367,-701149e-10,-86303e-10],[.6732,-.00986209,-199569e-9,191974e-10],[.6213,-.010418,883923e-10,624051e-11],[.5722,-.00906601,182e-6,624051e-11],[.5322,-.00677797,275608e-9,624051e-11]],Ga=[[-520417e-23,.0124,121431e-23,-845284e-16],[.062,.0124,-1.26793e-9,422642e-15],[.124,.0124,5.07171e-9,-1.60604e-9],[.186,.0123999,-1.90189e-8,6.00152e-9],[.248,.0124002,7.10039e-8,-2.24e-8],[.31,.0123992,-2.64997e-7,8.35986e-8],[.372,.0124029,9.88983e-7,-3.11994e-7],[.434,.0123893,-369093e-11,-4.35621e-7],[.4958,.0123198,-102252e-10,-3.45523e-7],[.5571,.0121916,-154081e-10,-5.82288e-7],[.6176,.0119938,-241424e-10,-5.25327e-7],[.6769,.011713,-320223e-10,-5.16405e-7],[.7346,.0113541,-397684e-10,-6.09052e-7],[.7903,.0109107,-489042e-10,-104739e-11],[.8435,.0103431,-64615e-9,-1.40374e-9],[.8936,.00969686,-64636e-9,-8547e-9],[.9394,.00840947,-192841e-9,-42106e-10],[.9761,.00616527,-256e-6,-42106e-10],[1,.00328947,-319159e-9,-42106e-10]],Ka=.8487,qa=1.3523,Ja=ue/5,Ya=1/Ja,Xa=18,Za=function(e,t){return e[0]+t*(e[1]+t*(e[2]+t*e[3]))},Qa=function(e,t){return e[1]+t*(2*e[2]+t*3*e[3])};function $a(e,t,n,r){for(var i=t;r;--r){var a=e(i);if(i-=a,Math.abs(a)=Xa&&(r=Xa-1),n=ue*(n-Ya*r);var i={x:Za(Wa[r],n)*t,y:Za(Ga[r],n)};return e.y<0&&(i.y=-i.y),i.x=i.x*this.a*Ka+this.x0,i.y=i.y*this.a*qa+this.y0,e.z!==void 0&&(i.z=e.z),e.m!==void 0&&(i.m=e.m),i}function no(e){var t={x:(e.x-this.x0)/(this.a*Ka),y:Math.abs(e.y-this.y0)/(this.a*qa)};if(t.y>=1)t.x/=Wa[Xa][0],t.y=e.y<0?-M:M;else{var n=Math.floor(t.y*Xa);for(n<0?n=0:n>=Xa&&(n=Xa-1);;)if(Ga[n][0]>t.y)--n;else if(Ga[n+1][0]<=t.y)++n;else break;var r=Ga[n],i=5*(t.y-r[0])/(Ga[n+1][0]-r[0]);i=$a(function(e){return(Za(r,e)-t.y)/Qa(r,e)},i,le,100),t.x/=Za(Wa[n],i),t.y=(5*n+i)*N,e.y<0&&(t.y=-t.y)}return t.x=F(t.x+this.long0,this.over),e.z!==void 0&&(t.z=e.z),e.m!==void 0&&(t.m=e.m),t}var ro={init:eo,forward:to,inverse:no,names:[`Robinson`,`robin`]};function io(){this.name=`geocent`}function ao(e){return Yt(e,this.es,this.a)}function oo(e){return Xt(e,this.es,this.a,this.b)}var so={init:io,forward:ao,inverse:oo,names:[`Geocentric`,`geocentric`,`geocent`,`Geocent`]},co={N_POLE:0,S_POLE:1,EQUIT:2,OBLIQ:3},lo={h:{def:1e5,num:!0},azi:{def:0,num:!0,degrees:!0},tilt:{def:0,num:!0,degrees:!0},long0:{def:0,num:!0},lat0:{def:0,num:!0}};function uo(){if(Object.keys(lo).forEach(function(e){if(this[e]===void 0)this[e]=lo[e].def;else if(lo[e].num&&isNaN(this[e]))throw Error(`Invalid parameter value, must be numeric `+e+` = `+this[e]);else lo[e].num&&(this[e]=parseFloat(this[e]));lo[e].degrees&&(this[e]=this[e]*N)}.bind(this)),Math.abs(Math.abs(this.lat0)-M)<1e-10?this.mode=this.lat0<0?co.S_POLE:co.N_POLE:Math.abs(this.lat0)<1e-10?this.mode=co.EQUIT:(this.mode=co.OBLIQ,this.sinph0=Math.sin(this.lat0),this.cosph0=Math.cos(this.lat0)),this.pn1=this.h/this.a,this.pn1<=0||this.pn1>1e10)throw Error(`Invalid height`);this.p=1+this.pn1,this.rp=1/this.p,this.h1=1/this.pn1,this.pfact=(this.p+1)*this.h1,this.es=0;var e=this.tilt,t=this.azi;this.cg=Math.cos(t),this.sg=Math.sin(t),this.cw=Math.cos(e),this.sw=Math.sin(e)}function fo(e){e.x-=this.long0;var t=Math.sin(e.y),n=Math.cos(e.y),r=Math.cos(e.x),i,a;switch(this.mode){case co.OBLIQ:a=this.sinph0*t+this.cosph0*n*r;break;case co.EQUIT:a=n*r;break;case co.S_POLE:a=-t;break;case co.N_POLE:a=t}switch(a=this.pn1/(this.p-a),i=a*n*Math.sin(e.x),this.mode){case co.OBLIQ:a*=this.cosph0*t-this.sinph0*n*r;break;case co.EQUIT:a*=t;break;case co.N_POLE:a*=-(n*r);break;case co.S_POLE:a*=n*r}var o=a*this.cg+i*this.sg,s=1/(o*this.sw*this.h1+this.cw);return i=(i*this.cg-a*this.sg)*this.cw*s,a=o*s,e.x=i*this.a,e.y=a*this.a,e}function po(e){e.x/=this.a,e.y/=this.a;var t={x:e.x,y:e.y},n,r,i=1/(this.pn1-e.y*this.sw);n=this.pn1*e.x*i,r=this.pn1*e.y*this.cw*i,e.x=n*this.cg+r*this.sg,e.y=r*this.cg-n*this.sg;var a=dr(e.x,e.y);if(Math.abs(a)<1e-10)t.x=0,t.y=e.y;else{var o,s=1-a*a*this.pfact;switch(s=(this.p-Math.sqrt(s))/(this.pn1/a+a/this.pn1),o=Math.sqrt(1-s*s),this.mode){case co.OBLIQ:t.y=Math.asin(o*this.sinph0+e.y*s*this.cosph0/a),e.y=(o-this.sinph0*Math.sin(t.y))*a,e.x*=s*this.cosph0;break;case co.EQUIT:t.y=Math.asin(e.y*s/a),e.y=o*a,e.x*=s;break;case co.N_POLE:t.y=Math.asin(o),e.y=-e.y;break;case co.S_POLE:t.y=-Math.asin(o)}t.x=Math.atan2(e.x,e.y)}return e.x=t.x+this.long0,e.y=t.y,e}var mo={init:uo,forward:fo,inverse:po,names:[`Tilted_Perspective`,`tpers`]};function ho(){if(this.flip_axis=+(this.sweep===`x`),this.h=Number(this.h),this.radius_g_1=this.h/this.a,this.radius_g_1<=0||this.radius_g_1>1e10)throw Error();if(this.radius_g=1+this.radius_g_1,this.C=this.radius_g*this.radius_g-1,this.es!==0){var e=1-this.es,t=1/e;this.radius_p=Math.sqrt(e),this.radius_p2=e,this.radius_p_inv2=t,this.shape=`ellipse`}else this.radius_p=1,this.radius_p2=1,this.radius_p_inv2=1,this.shape=`sphere`;this.title||=`Geostationary Satellite View`}function go(e){var t=e.x,n=e.y,r,i,a,o;if(t-=this.long0,this.shape===`ellipse`){n=Math.atan(this.radius_p2*Math.tan(n));var s=this.radius_p/dr(this.radius_p*Math.cos(n),Math.sin(n));if(i=s*Math.cos(t)*Math.cos(n),a=s*Math.sin(t)*Math.cos(n),o=s*Math.sin(n),(this.radius_g-i)*i-a*a-o*o*this.radius_p_inv2<0)return e.x=NaN,e.y=NaN,e;r=this.radius_g-i,this.flip_axis?(e.x=this.radius_g_1*Math.atan(a/dr(o,r)),e.y=this.radius_g_1*Math.atan(o/r)):(e.x=this.radius_g_1*Math.atan(a/r),e.y=this.radius_g_1*Math.atan(o/dr(a,r)))}else this.shape===`sphere`&&(r=Math.cos(n),i=Math.cos(t)*r,a=Math.sin(t)*r,o=Math.sin(n),r=this.radius_g-i,this.flip_axis?(e.x=this.radius_g_1*Math.atan(a/dr(o,r)),e.y=this.radius_g_1*Math.atan(o/r)):(e.x=this.radius_g_1*Math.atan(a/r),e.y=this.radius_g_1*Math.atan(o/dr(a,r))));return e.x*=this.a,e.y*=this.a,e}function _o(e){var t=-1,n=0,r=0,i,a,o,s;if(e.x/=this.a,e.y/=this.a,this.shape===`ellipse`){this.flip_axis?(r=Math.tan(e.y/this.radius_g_1),n=Math.tan(e.x/this.radius_g_1)*dr(1,r)):(n=Math.tan(e.x/this.radius_g_1),r=Math.tan(e.y/this.radius_g_1)*dr(1,n));var c=r/this.radius_p;if(i=n*n+c*c+t*t,a=2*this.radius_g*t,o=a*a-4*i*this.C,o<0)return e.x=NaN,e.y=NaN,e;s=(-a-Math.sqrt(o))/(2*i),t=this.radius_g+s*t,n*=s,r*=s,e.x=Math.atan2(n,t),e.y=Math.atan(r*Math.cos(e.x)/t),e.y=Math.atan(this.radius_p_inv2*Math.tan(e.y))}else if(this.shape===`sphere`){if(this.flip_axis?(r=Math.tan(e.y/this.radius_g_1),n=Math.tan(e.x/this.radius_g_1)*Math.sqrt(1+r*r)):(n=Math.tan(e.x/this.radius_g_1),r=Math.tan(e.y/this.radius_g_1)*Math.sqrt(1+n*n)),i=n*n+r*r+t*t,a=2*this.radius_g*t,o=a*a-4*i*this.C,o<0)return e.x=NaN,e.y=NaN,e;s=(-a-Math.sqrt(o))/(2*i),t=this.radius_g+s*t,n*=s,r*=s,e.x=Math.atan2(n,t),e.y=Math.atan(r*Math.cos(e.x)/t)}return e.x+=this.long0,e}var vo={init:ho,forward:go,inverse:_o,names:[`Geostationary Satellite View`,`Geostationary_Satellite`,`geos`]},yo=1.340264,bo=-.081106,xo=893e-6,So=.003796,Co=Math.sqrt(3)/2;function wo(){this.long0=this.long0===void 0?0:this.long0,this.x0=this.x0===void 0?0:this.x0,this.y0=this.y0===void 0?0:this.y0,this.es!==0&&(this.apa=wi(this.es),this.qp=_i(this.e,1),this.rqda=Math.sqrt(.5*this.qp))}function To(e){var t=F(e.x-this.long0,this.over),n=e.y,r=Math.sin(n);this.es!==0&&(r=_i(this.e,r)/this.qp);var i=Math.asin(Co*r),a=i*i,o=a*a*a;return e.x=t*Math.cos(i)/(Co*(yo+3*bo*a+o*(7*xo+9*So*a))),e.y=i*(yo+bo*a+o*(xo+So*a)),this.es!==0&&(e.x*=this.rqda,e.y*=this.rqda),e.x=this.a*e.x+this.x0,e.y=this.a*e.y+this.y0,e}function Eo(e){e.x=(e.x-this.x0)/this.a,e.y=(e.y-this.y0)/this.a,this.es!==0&&(e.x/=this.rqda,e.y/=this.rqda);for(var t=1e-9,n=12,r=e.y,i,a,o,s,c,l=0;l=M?0:1/Math.tan(this.phi1),this.inverse=No,this.forward=Mo)}function Ao(e){var t=F(e.x-(this.long0||0),this.over),n=e.y,r=this.am1+this.m1-rr(n,i=Math.sin(n),a=Math.cos(n),this.en),i=a*t/(r*Math.sqrt(1-this.es*i*i)),a;return e.x=r*Math.sin(i),e.y=this.am1-r*Math.cos(i),e.x=this.a*e.x+(this.x0||0),e.y=this.a*e.y+(this.y0||0),e}function jo(e){e.x=(e.x-(this.x0||0))/this.a,e.y=(e.y-(this.y0||0))/this.a;var t,n=dr(e.x,e.y=this.am1-e.y),r,i=ar(this.am1+this.m1-n,this.es,this.en);if((t=Math.abs(i))Oo?(e.x=i*Math.sin(r=t*Math.cos(n)/i),e.y=this.cphi1-i*Math.cos(r)):e.x=e.y=0,e.x=this.a*e.x+(this.x0||0),e.y=this.a*e.y+(this.y0||0),e}function No(e){e.x=(e.x-(this.x0||0))/this.a,e.y=(e.y-(this.y0||0))/this.a;var t,n,r=dr(e.x,e.y=this.cphi1-e.y);if(n=this.cphi1+this.phi1-r,Math.abs(n)>M)throw Error();return t=Math.abs(Math.abs(n)-M)<=Oo?0:r*Math.atan2(e.x,e.y)/Math.cos(n),e.x=F(t+(this.long0||0),this.over),e.y=di(n),e}var Po={init:ko,names:[`bonne`,`Bonne (Werner lat_1=90)`]},Fo={OBLIQUE:{forward:Vo,inverse:Uo},TRANSVERSE:{forward:Ho,inverse:Wo}},Io={ROTATE:{o_alpha:`oAlpha`,o_lon_c:`oLongC`,o_lat_c:`oLatC`},NEW_POLE:{o_lat_p:`oLatP`,o_lon_p:`oLongP`},NEW_EQUATOR:{o_lon_1:`oLong1`,o_lat_1:`oLat1`,o_lon_2:`oLong2`,o_lat_2:`oLat2`}};function Lo(){if(this.x0=this.x0||0,this.y0=this.y0||0,this.long0=this.long0||0,this.title=this.title||`General Oblique Transformation`,this.isIdentity=ht.includes(this.o_proj),!this.o_proj)throw Error(`Missing parameter: o_proj`);if(this.o_proj===`ob_tran`)throw Error(`Invalid value for o_proj: `+this.o_proj);let e=qt(this.projStr.replace(`+proj=ob_tran`,``).replace(`+o_proj=`,`+proj=`).trim());if(!e)throw Error(`Invalid parameter: o_proj. Unknown projection `+this.o_proj);e.long0=0,this.obliqueProjection=e;let t,n=Object.keys(Io),r=e=>{if(this[e]===void 0)return;let t=parseFloat(this[e])*N;if(isNaN(t))throw Error(`Invalid value for `+e+`: `+this[e]);return t};for(let e=0;ethis[e]!==void 0)){t=i;for(let e=0;e1e-10?(this.cphip=Math.cos(a),this.sphip=Math.sin(a),this.projectionType=Fo.OBLIQUE):this.projectionType=Fo.TRANSVERSE}function Ro(e){return this.projectionType.forward(this,e)}function zo(e){return this.projectionType.inverse(this,e)}function Bo(e,t){let n,r;if(t===Io.ROTATE){let t=e.oLongC,i=e.oLatC,a=e.oAlpha;if(Math.abs(Math.abs(i)-M)<=1e-10)throw Error(`Invalid value for o_lat_c: `+e.o_lat_c+` should be < 90°`);r=t+Math.atan2(-1*Math.cos(a),-1*Math.sin(a)*Math.sin(i)),n=Math.asin(Math.cos(i)*Math.sin(a))}else if(t===Io.NEW_POLE)r=e.oLongP,n=e.oLatP;else{let t=e.oLong1,i=e.oLat1,a=e.oLong2,o=e.oLat2,s=Math.abs(i);if(Math.abs(i)>M-1e-10)throw Error(`Invalid value for o_lat_1: `+e.o_lat_1+` should be < 90°`);if(Math.abs(o)>M-1e-10)throw Error(`Invalid value for o_lat_2: `+e.o_lat_2+` should be < 90°`);if(Math.abs(i-o)<1e-10)throw Error(`Invalid value for o_lat_1 and o_lat_2: o_lat_1 should be different from o_lat_2`);if(s<1e-10)throw Error(`Invalid value for o_lat_1: o_lat_1 should be different from zero`);r=Math.atan2(Math.cos(i)*Math.sin(o)*Math.cos(t)-Math.sin(i)*Math.cos(o)*Math.cos(a),Math.sin(i)*Math.cos(o)*Math.sin(a)-Math.cos(i)*Math.sin(o)*Math.sin(t)),n=Math.atan(-1*Math.cos(r-t)/Math.tan(i))}return{lamp:r,phip:n}}function Vo(e,t){let{x:n,y:r}=t;n=F(n-e.long0,e.over);let i=Math.cos(n),a=Math.sin(r),o=Math.cos(r);t.x=F(Math.atan2(o*Math.sin(n),e.sphip*o*i+e.cphip*a)+e.lamp),t.y=Math.asin(e.sphip*a-e.cphip*o*i);let s=e.obliqueProjection.forward(t);return e.isIdentity&&(s.x*=ue,s.y*=ue),s}function Ho(e,t){let{x:n,y:r}=t;n=F(n-e.long0,e.over);let i=Math.cos(r),a=Math.cos(n);t.x=F(Math.atan2(i*Math.sin(n),Math.sin(r))+e.lamp),t.y=Math.asin(-1*i*a);let o=e.obliqueProjection.forward(t);return e.isIdentity&&(o.x*=ue,o.y*=ue),o}function Uo(e,t){e.isIdentity&&(t.x*=N,t.y*=N);let{x:n,y:r}=e.obliqueProjection.inverse(t);if(n{};let t=navigator.geolocation.watchPosition(t=>{e(Jo(t.coords.longitude,t.coords.latitude))},t=>{t.code===t.PERMISSION_DENIED&&e(`denied`)},{enableHighAccuracy:!0});return()=>navigator.geolocation.clearWatch(t)}var Xo={maxSpanMeters:36e3,minResolutionMeters:1.25,openResolutionMeters:7};function Zo(e,t=Xo){return Math.min(t.maxSpanMeters/e.widthPx,t.maxSpanMeters/e.heightPx)}var Qo=65,$o=73,es=79;function ts(e,t){if(t=typeof t==`number`?t:5,!Array.isArray(e))throw TypeError(`forward did not receive an array`);if(typeof e[0]==`string`||typeof e[1]==`string`)throw TypeError(`forward received an array of strings, but it only accepts an array of numbers.`);let[n,r]=e;if(n<-180||n>180)throw TypeError(`forward received an invalid longitude of `+n);if(r<-90||r>90)throw TypeError(`forward received an invalid latitude of `+r);if(r<-80||r>84)throw TypeError(`forward received a latitude of ${r}, but this library does not support conversions of points in polar regions below 80°S and above 84°N`);return function(e,t){let n=`00000`+e.easting,r=`00000`+e.northing;return e.zoneNumber+e.zoneLetter+function(e,t,n){let r=ss(n);return function(e,t,n){let r=n-1,i=`AJSAJS`.charCodeAt(r),a=`AFAFAF`.charCodeAt(r),o=i+e-1,s=a+t,c=!1;return o>90&&(o=o-90+Qo-1,c=!0),(o===$o||i<$o&&o>$o||(o>$o||i<$o)&&c)&&o++,(o===es||ies||(o>es||i90&&(o=o-90+Qo-1),s>86?(s=s-86+Qo-1,c=!0):c=!1,(s===$o||a<$o&&s>$o||(s>$o||a<$o)&&c)&&s++,(s===es||aes||(s>es||a86&&(s=s-86+Qo-1),String.fromCharCode(o)+String.fromCharCode(s)}(Math.floor(e/1e5),Math.floor(t/1e5)%20,r)}(e.easting,e.northing,e.zoneNumber)+n.substr(n.length-5,t)+r.substr(r.length-5,t)}(function(e){let t=e.lat,n=e.lon,r=6378137,i=rs(t),a=rs(n),o;o=Math.floor((n+180)/6)+1,n===180&&(o=60),t>=56&&t<64&&n>=3&&n<12&&(o=32),t>=72&&t<84&&(n>=0&&n<9?o=31:n>=9&&n<21?o=33:n>=21&&n<33?o=35:n>=33&&n<42&&(o=37));let s=rs(6*(o-1)-180+3),c=r/Math.sqrt(1-.00669438*Math.sin(i)*Math.sin(i)),l=Math.tan(i)*Math.tan(i),u=.006739496752268451*Math.cos(i)*Math.cos(i),d=Math.cos(i)*(a-s),f=r*(.9983242984503243*i-.002514607064228144*Math.sin(2*i)+2639046602129982e-21*Math.sin(4*i)-3.418046101696858e-9*Math.sin(6*i)),p=.9996*c*(d+(1-l+u)*d*d*d/6+(5-18*l+l*l+72*u-.39089081163157013)*d*d*d*d*d/120)+5e5,m=.9996*(f+c*Math.tan(i)*(d*d/2+(5-l+9*u+4*u*u)*d*d*d*d/24+(61-58*l+l*l+600*u-2.2240339282485886)*d*d*d*d*d*d/720));return t<0&&(m+=1e7),{northing:Math.trunc(m),easting:Math.trunc(p),zoneNumber:o,zoneLetter:os(t)}}({lat:r,lon:n}),t)}function ns(e){if(e===``)throw TypeError(`toPoint received a blank string`);let t=as(cs(e.toUpperCase()));return typeof t.lat==`number`&&typeof t.lon==`number`?[t.lon,t.lat]:[(t.left+t.right)/2,(t.top+t.bottom)/2]}function rs(e){return Math.PI/180*e}function is(e){return e/Math.PI*180}function as(e){let t=e.northing,n=e.easting,{zoneLetter:r,zoneNumber:i}=e;if(i<0||i>60)return null;let a=6378137,o=(1-Math.sqrt(.99330562))/(1+Math.sqrt(.99330562)),s=n-5e5,c=t;r<`N`&&(c-=1e7);let l=6*(i-1)-180+3,u=c/.9996/6367449.145945056,d=u+(3*o/2-27*o*o*o/32)*Math.sin(2*u)+(21*o*o/16-55*o*o*o*o/32)*Math.sin(4*u)+151*o*o*o/96*Math.sin(6*u),f=a/Math.sqrt(1-.00669438*Math.sin(d)*Math.sin(d)),p=Math.tan(d)*Math.tan(d),m=.006739496752268451*Math.cos(d)*Math.cos(d),h=.99330562*a/(1-.00669438*Math.sin(d)*Math.sin(d))**1.5,g=s/(.9996*f),_=d-f*Math.tan(d)/h*(g*g/2-(5+3*p+10*m-4*m*m-.06065547077041606)*g*g*g*g/24+(61+90*p+298*m+45*p*p-1.6983531815716497-3*m*m)*g*g*g*g*g*g/720);_=is(_);let v,y=(g-(1+2*p+m)*g*g*g/6+(5-2*m+28*p-3*m*m+.05391597401814761+24*p*p)*g*g*g*g*g/120)/Math.cos(d);if(y=l+is(y),typeof e.accuracy==`number`){let t=as({northing:e.northing+e.accuracy,easting:e.easting+e.accuracy,zoneLetter:e.zoneLetter,zoneNumber:e.zoneNumber});v={top:t.lat,right:t.lon,bottom:_,left:y}}else v={lat:_,lon:y};return v}function os(e){return e<=84&&e>=72?`X`:e<72&&e>=-80?`CDEFGHJKLMNPQRSTUVWX`[Math.floor((e- -80)/8)]:e>84||e<-80?`Z`:void 0}function ss(e){let t=e%6;return t===0&&(t=6),t}function cs(e){if(e&&e.length===0)throw TypeError(`MGRSPoint coverting from nothing`);e=e.replace(/ /g,``);let{length:t}=e,n,r=null,i=``,a=0;for(;!/[A-Z]/.test(n=e.charAt(a));){if(a>=2)throw Error(`MGRSPoint bad conversion from: `+e);i+=n,a++}let o=parseInt(i,10);if(a===0||a+3>t)throw Error(`MGRSPoint bad conversion from `+e);let s=e.charAt(a++);if(s<=`A`||s===`B`||s===`Y`||s>=`Z`||s===`I`||s===`O`)throw Error(`MGRSPoint zone letter ${s} not handled: ${e}`);r=e.substring(a,a+=2);let c=ss(o),l=function(e,t){let n=`AJSAJS`.charCodeAt(t-1),r=1e5,i=!1;for(;n!==e.charCodeAt(0);){if(n++,n===$o&&n++,n===es&&n++,n>90){if(i)throw Error(`Bad character: `+e);n=Qo,i=!0}r+=1e5}return r}(r.charAt(0),c),u=function(e,t){if(e>`V`)throw TypeError(`MGRSPoint given invalid Northing `+e);let n=`AFAFAF`.charCodeAt(t-1),r=0,i=!1;for(;n!==e.charCodeAt(0);){if(n++,n===$o&&n++,n===es&&n++,n>86){if(i)throw Error(`Bad character: `+e);n=Qo,i=!0}r+=1e5}return r}(r.charAt(1),c);for(;u0){let t=e.substring(a,a+f);p=parseFloat(t)*h;let n=e.substring(a+f);m=parseFloat(n)*h}return{easting:p+l,northing:m+u,zoneLetter:s,zoneNumber:o,accuracy:h}}function ls(e){let t;switch(e){case`C`:t=11e5;break;case`D`:t=2e6;break;case`E`:t=28e5;break;case`F`:t=37e5;break;case`G`:t=46e5;break;case`H`:t=55e5;break;case`J`:t=64e5;break;case`K`:t=73e5;break;case`L`:t=82e5;break;case`M`:t=91e5;break;case`N`:t=0;break;case`P`:t=8e5;break;case`Q`:t=17e5;break;case`R`:t=26e5;break;case`S`:t=35e5;break;case`T`:t=44e5;break;case`U`:t=53e5;break;case`V`:t=62e5;break;case`W`:t=7e6;break;case`X`:t=79e5;break;default:t=-1}if(t>=0)return t;throw TypeError(`Invalid zone letter: `+e)}qo.defs(`EPSG:25832`,`+proj=utm +zone=32 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs +type=crs`);var us=`Rechtswert und Hochwert müssen genau fünf Ziffern haben.`,ds=`Dieses Gitter ist keine gültige Koordinate.`,fs=`Kein Blatt deckt diese Koordinate.`,ps=/^(\d{1,2}[C-HJ-NP-X])([A-HJ-NP-Z]{2})(\d{5})(\d{5})$/,ms=/^(\d{1,2})([C-HJ-NP-X])([A-HJ-NP-Z]{2})$/;function hs(e){let t=qo(`EPSG:25832`,`EPSG:4326`,[Math.round(e.easting),Math.round(e.northing)]),n;try{n=ts([t[0],t[1]],5)}catch{return null}let r=ps.exec(n);return r?{gitter:`${r[1]} ${r[2]}`,rechtswert:r[3],hochwert:r[4]}:null}function gs(e,t){if(!/^\d{5}$/.test(e.rechtswert)||!/^\d{5}$/.test(e.hochwert))return{ok:!1,notice:us};let n=e.gitter.trim().toUpperCase().replace(/\s+/g,``),r=ms.exec(n);if(!r)return{ok:!1,notice:ds};let i;try{i=ns(`${n}${e.rechtswert}${e.hochwert}`)}catch{return{ok:!1,notice:ds}}let a=qo(`EPSG:4326`,`EPSG:25832`,i),o={easting:a[0],northing:a[1]};return t(o)?{ok:!0,point:o,koordinate:`${`${r[1]}${r[2]} ${r[3]}`} ${e.rechtswert} ${e.hochwert}`}:{ok:!1,notice:fs}}var _s=`Nicht auf dem Gerät.`;function vs(e,t){return e.minEt.minE&&e.minNt.minN}function ys(e,t){return t.easting>=e.minE&&t.easting=e.minN&&t.northinge.covers===`all`||e.covers.some(e=>vs(s,e))).map(e=>e.name);t.set(i,{extent:s,gebiete:c})}}}return t}function Ss(e,t){for(let n=e.length-1;n>=0;--n)if(e[n]<=t+1e-9)return n;return 0}function Cs(e,t,n){let r=n.widthPx*t/2,i=n.heightPx*t/2;return{minE:e.easting-r,maxE:e.easting+r,minN:e.northing-i,maxN:e.northing+i}}function ws(e,t,n,r){let i=n[e]*r,a=Math.floor(t.minE/i),o=Math.ceil(t.maxE/i)-1,s=Math.floor(t.minN/i),c=Math.ceil(t.maxN/i)-1,l=[];for(let t=a;t<=o;t+=1)for(let n=s;n<=c;n+=1)l.push({id:`${e}/${t}/${n}`});return l}function Ts(e){if(e<1e3)return`${Math.round(e)} m`;let t=Math.round(e/1e3*10)/10;return Number.isInteger(t)?`${t} km`:`${t.toFixed(1).replace(`.`,`,`)} km`}function Es(e,t){if(!e)return null;let n=Math.hypot(t.easting-e.easting,t.northing-e.northing);return{metres:n,text:Ts(n)}}function Ds(e){return e instanceof DOMException&&e.name===`AbortError`}function Os(e){return typeof e==`object`&&!!e}async function ks(e){let{uebersicht:t,cache:n,marks:r,kacheln:i,config:a}=e,o=xs(t),s=await n.ids(),c=new Set(s),l=new Set(s.filter(e=>o.has(e))),u=await r.read(),d=[];for(let[e,t]of o)t.gebiete.includes(`Hessen`)&&d.push(e);function f(){let e=0;for(let t of d)l.has(t)&&(e+=1);return e}let p={...e.viewport},m=e.online??!1,h=e.appOpen??!0,g=Os(e.standort)?{...e.standort}:null,_=g!==null,v=!1,y=!1,b=ae(u.ziele),x=u.downloadKnopf===!0,S=null,C={gitter:`32U MA`,rechtswert:``,hochwert:``},w=[],T=null,E=null,D=!1,O=new Map,k=new Set,A=new Set;function ee(e){let t=Zo(p,a);return Math.min(Math.max(e,a.minResolutionMeters),t)}function te(){let e=1/0,t=1/0,n=-1/0,r=-1/0,i=!1;for(let a of l){let s=o.get(a);s&&(i=!0,e=Math.min(e,s.extent.minE),t=Math.min(t,s.extent.minN),n=Math.max(n,s.extent.maxE),r=Math.max(r,s.extent.maxN))}return i?{easting:(e+n)/2,northing:(t+r)/2}:null}let ne=g?{...g}:te()??bs(t.blaetter),re=ee(a.openResolutionMeters);function j(){for(let e of A)e()}function ie(){r.write({heruntergeladen:[],ziele:b.map(e=>e.koordinate),downloadKnopf:x})}function ae(e){let n=[];for(let r of e){let e=/^(\d{1,2}[C-HJ-NP-X] [A-HJ-NP-Z]{2}) (\d{5}) (\d{5})$/.exec(r);if(!e)continue;let i=gs({gitter:e[1],rechtswert:e[2],hochwert:e[3]},e=>t.blaetter.some(t=>ys(t,e)));i.ok&&i.koordinate===r&&n.push({koordinate:r,point:i.point})}return n}function M(){let e=Cs(ne,re,p),n=Ss(t.resolutions,re),r=[];for(let i of ws(n,e,t.resolutions,t.tileSizePx)){if(!o.has(i.id)){r.push({id:i.id,appearance:`blank-unknown`});continue}if(l.has(i.id)){r.push({id:i.id,appearance:`drawn`});continue}let e=h&&m&&!k.has(i.id)&&(w.includes(i.id)||O.has(i.id));r.push({id:i.id,appearance:e?`blank-downloading`:`blank-not-on-device`})}return r.sort((e,t)=>e.id.localeCompare(t.id,`en`)),r}function oe(){D=!1}function se(){if(D){w=[];return}let e=Cs(ne,re,p),n=ws(Ss(t.resolutions,re),e,t.resolutions,t.tileSizePx).map(e=>e.id).filter(e=>o.has(e));for(let e of k)n.includes(e)||k.delete(e);let r=[],i=new Set,a=e=>{i.has(e)||l.has(e)||(i.add(e),r.push(e))};for(let e of n)a(e);if(T)for(let e of T)a(e);if(E)for(let e of E)a(e);w=r,ce()}function ce(){if(!h||!m||O.size>=1)return;let e=w.find(e=>!l.has(e)&&!k.has(e)&&!O.has(e));e&&le(e)}async function le(e){let t=new AbortController;O.set(e,t),j();try{let r=await i.fetch(e,t.signal);if(t.signal.aborted)return;l.add(e),c.add(e),await n.put(e,r),T?.every(e=>l.has(e))&&(T=null),E?.every(e=>l.has(e))&&(E=null)}catch(t){Ds(t)||k.add(e)}finally{O.get(e)===t&&O.delete(e),se(),j()}}function N(e){for(let[t,n]of O)e(t)&&(O.delete(t),n.abort())}function ue(){let e=M(),t=!m&&e.some(e=>e.appearance===`blank-not-on-device`),n=S??(t?_s:null);return{center:{...ne},resolution:re,northUp:!0,ziele:b.map(e=>({koordinate:e.koordinate,point:{...e.point},entfernung:Es(g,e.point)})),standort:g?{...g}:null,notice:n,koordinate:{...C},downloadKnopf:x,hessen:{arrived:f(),total:d.length},visit:de(),kacheln:e}}function P(){let e=[],t=new Set;for(let n of T??[])t.has(n)||(t.add(n),e.push(n));for(let n of E??[])t.has(n)||(t.add(n),e.push(n));return e}function de(){let e=P();if(e.length===0)return null;let t=0;for(let n of e)l.has(n)&&(t+=1);return{arrived:t,total:e.length}}function fe(e){let n=[],r=new Set;for(let i=0;iA.delete(e)},setViewport(e){oe(),p={...e},re=ee(re),se(),j()},panTo(e){oe(),v=!0,ne={...e},se(),j()},zoomTo(e){oe(),re=ee(e),se(),j()},reportStandort(e){h&&(e===`denied`?(g=null,j()):(g={...e},!_&&!v&&!y&&(oe(),ne={...e},re=ee(a.openResolutionMeters),se()),_=!0,j()))},setAppOpen(e){h=e,e?(oe(),k.clear(),se()):(T=null,E=null,N(()=>!0)),j()},setOnline(e){m=e,e?(oe(),k.clear(),se()):N(()=>!0),j()},tap(e){let n=44*re,r=-1,i=1/0;for(let t=0;t=0){b=b.filter((e,t)=>t!==r),ie(),j();return}let a=hs(e);if(!a)return;let o=gs(a,e=>t.blaetter.some(t=>ys(t,e)));o.ok&&(b.some(e=>e.koordinate===o.koordinate)?(S=`Diese Koordinate ist schon ein Ziel.`,j()):(S=null,b=[{koordinate:o.koordinate,point:o.point},...b],y=!0,ie(),j()))},enterKoordinate(e){let n=gs(e,e=>t.blaetter.some(t=>ys(t,e)));n.ok?b.some(e=>e.koordinate===n.koordinate)?(S=`Diese Koordinate ist schon ein Ziel.`,j()):(S=null,C={gitter:e.gitter,rechtswert:e.rechtswert,hochwert:e.hochwert},b=[{koordinate:n.koordinate,point:n.point},...b],y=!0,oe(),ne={...n.point},re=ee(a.openResolutionMeters),ie(),se(),j()):(S=n.notice,j())},deleteZiel(e){let t=b.filter(t=>t.koordinate!==e);t.length!==b.length&&(b=t,ie(),j())},setDownloadKnopf(e){x=e,ie(),j()},centerOnStandort(){g&&(oe(),v=!0,ne={...g},re=ee(a.openResolutionMeters),se(),j())},centerOnZiel(e){let t=b.find(t=>t.koordinate===e);t&&(oe(),v=!0,ne={...t.point},re=ee(a.openResolutionMeters),se(),j())},startHessen(){if(T)return;let e=d.filter(e=>!l.has(e));e.length!==0&&(oe(),T=e,se(),j())},downloadView(){if(E)return;let e=fe(Cs(ne,re,p)).filter(e=>!l.has(e));e.length!==0&&(oe(),E=e,se(),j())},deleteCache(){D=!0,T=null,E=null,N(()=>!0);let e=[...c];l.clear(),c.clear(),k.clear(),w=[],n.delete(e),j()}};return h&&m&&se(),pe}function As(e,t){e.replaceChildren();let n=document.createElement(`div`);n.className=`boot-failure`,n.setAttribute(`role`,`alert`);let r=document.createElement(`p`);r.className=`boot-error`,r.textContent=`Die Karte konnte nicht geöffnet werden.`;let i=document.createElement(`p`);i.className=`boot-detail`,i.textContent=v(t);let a=document.createElement(`p`);a.textContent=`Die gespeicherten Kacheln bleiben auf dem Gerät.`;let o=document.createElement(`button`);o.type=`button`,o.className=`secondary`,o.textContent=`Karte neu starten`,n.append(r,i,a,o);let s=null;b()&&(s=document.createElement(`button`),s.type=`button`,s.className=`secondary`,s.textContent=`Gespeicherte Kacheln löschen`,n.append(s)),e.append(n);let c=y(),l=()=>[o,s].filter(e=>e!==null);o.addEventListener(`click`,()=>{u(async()=>{x(),await g(c),location.reload()})}),s?.addEventListener(`click`,()=>{u(async()=>{await g(c),await _(c),location.reload()})});async function u(e){for(let e of l())e.disabled=!0;try{await e()}catch(e){i.textContent=v(e);for(let e of l())e.disabled=!1}}}var js={ADD:`add`,REMOVE:`remove`},Ms={PROPERTYCHANGE:`propertychange`};function Ns(e){for(let t in e)delete e[t]}function Ps(e){let t;for(t in e)return!1;return!t}function L(e,t,n,r,i){if(i){let i=n;n=function(a){return e.removeEventListener(t,n),i.call(r??this,a)}}else r&&r!==e&&(n=n.bind(r));let a={target:e,type:t,listener:n};return e.addEventListener(t,n),a}function Fs(e,t,n,r){return L(e,t,n,r,!0)}function R(e){e&&e.target&&(e.target.removeEventListener(e.type,e.listener),Ns(e))}var z={CHANGE:`change`,ERROR:`error`,BLUR:`blur`,CLEAR:`clear`,CONTEXTMENU:`contextmenu`,CLICK:`click`,DBLCLICK:`dblclick`,DRAGENTER:`dragenter`,DRAGOVER:`dragover`,DROP:`drop`,FOCUS:`focus`,KEYDOWN:`keydown`,KEYPRESS:`keypress`,KEYUP:`keyup`,LOAD:`load`,RESIZE:`resize`,TOUCHMOVE:`touchmove`,WHEEL:`wheel`},Is=class{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}};function Ls(e,t,n){let r,i;n||=Rs;let a=0,o=e.length,s=!1;for(;a>1),i=+n(e[r],t),i<0?a=r+1:(o=r,s=!i);return s?a:~a}function Rs(e,t){return e>t?1:et?-1:0}function Bs(e,t,n){if(e[0]<=t)return 0;let r=e.length;if(t<=e[r-1])return r-1;if(typeof n==`function`){for(let i=1;i0?i-1:i}return r-1}if(n>0){for(let n=1;n0||n&&a===0)})}function B(){throw Error(`Unimplemented abstract method.`)}var Gs=0;function V(e){let t=e;return t.ol_uid||=String(++Gs)}function Ks(e){return!!e&&typeof e.then==`function`&&typeof e.catch==`function`}function qs(){return!0}function Js(){return!1}function Ys(){}function Xs(e){let t,n,r;return function(){let i=Array.prototype.slice.call(arguments);return(!n||this!==r||!Us(i,n))&&(r=this,n=i,t=e.apply(this,i)),t}}function Zs(e){function t(){let t;try{t=e()}catch(e){return Promise.reject(e)}return Ks(t)?t:Promise.resolve(t)}return t()}var Qs=class{constructor(e){this.propagationStopped,this.defaultPrevented,this.type=e,this.target=null}preventDefault(){this.defaultPrevented=!0}stopPropagation(){this.propagationStopped=!0}},$s=class extends Is{constructor(e){super(),this.eventTarget_=e,this.pendingRemovals_=null,this.dispatching_=null,this.listeners_=null}addEventListener(e,t){if(!e||!t)return;let n=this.listeners_||={},r=n[e]||(n[e]=[]);r.includes(t)||r.push(t)}dispatchEvent(e){let t=typeof e==`string`,n=t?e:e.type,r=this.listeners_&&this.listeners_[n];if(!r)return;let i=t?new Qs(e):e;i.target||=this.eventTarget_||this;let a=this.dispatching_||={},o=this.pendingRemovals_||={};n in a||(a[n]=0,o[n]=0),++a[n];let s;for(let e=0,t=r.length;e0:!1}removeEventListener(e,t){if(!this.listeners_)return;let n=this.listeners_[e];if(!n)return;let r=n.indexOf(t);r!==-1&&(this.pendingRemovals_&&e in this.pendingRemovals_?(n[r]=Ys,++this.pendingRemovals_[e]):(n.splice(r,1),n.length===0&&delete this.listeners_[e]))}},ec=class extends $s{constructor(){super(),this.on=this.onInternal,this.once=this.onceInternal,this.un=this.unInternal,this.revision_=0}changed(){++this.revision_,this.dispatchEvent(z.CHANGE)}getRevision(){return this.revision_}onInternal(e,t){if(Array.isArray(e)){let n=e.length,r=Array(n);for(let i=0;i0;)this.pop()}extend(e){for(let t=0,n=e.length;tthis.getLength())throw Error(`Index out of bounds: `+e);this.unique_&&this.assertUnique_(t),this.array_.splice(e,0,t),this.updateLength_(),this.dispatchEvent(new ac(js.ADD,t,e))}pop(){return this.removeAt(this.getLength()-1)}push(e){let t=this.getLength();return this.insertAt(t,e),this.getLength()}remove(e){let t=this.array_;for(let n=0,r=t.length;n=this.getLength())return;let t=this.array_[e];return this.array_.splice(e,1),this.updateLength_(),this.dispatchEvent(new ac(js.REMOVE,t,e)),t}setAt(e,t){if(e>=this.getLength()){this.insertAt(e,t);return}if(e<0)throw Error(`Index out of bounds: `+e);this.unique_&&this.assertUnique_(t,e);let n=this.array_[e];this.array_[e]=t,this.dispatchEvent(new ac(js.REMOVE,n,e)),this.dispatchEvent(new ac(js.ADD,t,e))}updateLength_(){this.set(ic.LENGTH,this.array_.length)}assertUnique_(e,t){let n=this.array_;for(let r=0,i=n.length;r{this.clickTimeoutId_=void 0;let t=new cc(lc.SINGLECLICK,this.map_,e);this.dispatchEvent(t)},250):(clearTimeout(this.clickTimeoutId_),this.clickTimeoutId_=void 0,t=new cc(lc.DBLCLICK,this.map_,e),this.dispatchEvent(t))}updateActivePointers_(e){let t=e,n=t.pointerId;if(t.type==lc.POINTERUP||t.type==lc.POINTERCANCEL){delete this.trackedTouches_[n];for(let e in this.trackedTouches_)if(this.trackedTouches_[e].target!==t.target){delete this.trackedTouches_[e];break}}else(t.type==lc.POINTERDOWN||t.type==lc.POINTERMOVE)&&(this.trackedTouches_[n]=t);this.activePointers_=Object.values(this.trackedTouches_)}handlePointerUp_(e){this.updateActivePointers_(e);let t=new cc(lc.POINTERUP,this.map_,e,void 0,void 0,this.activePointers_);this.dispatchEvent(t),this.emulateClicks_&&!t.defaultPrevented&&!this.dragging_&&this.isMouseActionButton_(e)&&this.down_&&this.emulateClick_(this.down_),this.activePointers_.length===0&&(this.dragListenerKeys_.forEach(R),this.dragListenerKeys_.length=0,this.dragging_=!1,this.down_=null)}isMouseActionButton_(e){return e.button===0}handlePointerDown_(e){this.emulateClicks_=this.activePointers_.length===0,this.updateActivePointers_(e);let t=new cc(lc.POINTERDOWN,this.map_,e,void 0,void 0,this.activePointers_);if(this.dispatchEvent(t),this.down_=new PointerEvent(e.type,e),Object.defineProperty(this.down_,"target",{writable:!1,value:e.target}),this.dragListenerKeys_.length===0){let e=this.map_.getOwnerDocument(),t=this.element_;if(!t)return;if(this.dragListenerKeys_.push(L(e,lc.POINTERMOVE,this.handlePointerMove_,this),L(e,lc.POINTERUP,this.handlePointerUp_,this),L(t,lc.POINTERCANCEL,this.handlePointerUp_,this)),t.getRootNode&&t.getRootNode()!==e){let e=t.getRootNode();this.dragListenerKeys_.push(L(e,lc.POINTERUP,this.handlePointerUp_,this))}}}handlePointerMove_(e){if(this.isMoving_(e)){this.updateActivePointers_(e),this.dragging_=!0;let t=new cc(lc.POINTERDRAG,this.map_,e,this.dragging_,void 0,this.activePointers_);this.dispatchEvent(t)}}relayMoveEvent_(e){this.originalPointerMoveEvent_=e;let t=!!(this.down_&&this.isMoving_(e));this.dispatchEvent(new cc(lc.POINTERMOVE,this.map_,e,t))}handleTouchMove_(e){let t=this.originalPointerMoveEvent_;(!t||t.defaultPrevented)&&(typeof e.cancelable!=`boolean`||e.cancelable===!0)&&e.preventDefault()}isMoving_(e){let t=this.down_;return this.dragging_||t!==null&&(Math.abs(e.clientX-t.clientX)>this.moveTolerance_||Math.abs(e.clientY-t.clientY)>this.moveTolerance_)}disposeInternal(){let e=this.element_;this.relayedListenerKey_&&=(R(this.relayedListenerKey_),void 0),e&&e.removeEventListener(z.TOUCHMOVE,this.boundHandleTouchMove_),this.pointerdownListenerKey_&&=(R(this.pointerdownListenerKey_),void 0),this.dragListenerKeys_.forEach(R),this.dragListenerKeys_.length=0,this.element_=void 0,super.disposeInternal()}},yc={POSTRENDER:`postrender`,MOVESTART:`movestart`,MOVEEND:`moveend`,LOADSTART:`loadstart`,LOADEND:`loadend`},bc={LAYERGROUP:`layergroup`,SIZE:`size`,TARGET:`target`,VIEW:`view`},H={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};function U(e,t){if(!e)throw Error(t)}var xc=1/0,Sc=class{constructor(e,t){this.priorityFunction_=e,this.keyFunction_=t,this.elements_=[],this.priorities_=[],this.queuedElements_={}}clear(){this.elements_.length=0,this.priorities_.length=0,Ns(this.queuedElements_)}dequeue(){let e=this.elements_,t=this.priorities_,n=e[0];e.length==1?(e.length=0,t.length=0):(e[0]=e.pop(),t[0]=t.pop(),this.siftUp_(0));let r=this.keyFunction_(n);return delete this.queuedElements_[r],n}enqueue(e){U(!(this.keyFunction_(e)in this.queuedElements_),"Tried to enqueue an `element` that was already added to the queue");let t=this.priorityFunction_(e);return t!=1/0&&(this.elements_.push(e),this.priorities_.push(t),this.queuedElements_[this.keyFunction_(e)]=!0,this.siftDown_(0,this.elements_.length-1),!0)}getCount(){return this.elements_.length}getLeftChildIndex_(e){return e*2+1}getRightChildIndex_(e){return e*2+2}getParentIndex_(e){return e-1>>1}heapify_(){let e;for(e=(this.elements_.length>>1)-1;e>=0;e--)this.siftUp_(e)}isEmpty(){return this.elements_.length===0}isKeyQueued(e){return e in this.queuedElements_}isQueued(e){return this.isKeyQueued(this.keyFunction_(e))}siftUp_(e){let t=this.elements_,n=this.priorities_,r=t.length,i=t[e],a=n[e],o=e;for(;e>1;){let i=this.getLeftChildIndex_(e),a=this.getRightChildIndex_(e),o=ae;){let e=this.getParentIndex_(t);if(r[e]>a)n[t]=n[e],r[t]=r[e],t=e;else break}n[t]=i,r[t]=a}reprioritize(){let e=this.priorityFunction_,t=this.elements_,n=this.priorities_,r=0,i=t.length,a,o,s;for(o=0;oe.apply(null,t),e=>e[0].getKey()),this.boundHandleTileChange_=this.handleTileChange.bind(this),this.tileChangeCallback_=t,this.tilesLoading_=0,this.tilesLoadingKeys_={}}enqueue(e){let t=super.enqueue(e);return t&&e[0].addEventListener(z.CHANGE,this.boundHandleTileChange_),t}getTilesLoading(){return this.tilesLoading_}handleTileChange(e){let t=e.target,n=t.getState();if(n===H.LOADED||n===H.ERROR||n===H.EMPTY){n!==H.ERROR&&t.removeEventListener(z.CHANGE,this.boundHandleTileChange_);let e=t.getKey();e in this.tilesLoadingKeys_&&(delete this.tilesLoadingKeys_[e],--this.tilesLoading_),this.tileChangeCallback_()}}loadMoreTiles(e,t){let n=0;for(;this.tilesLoading_0;){let e=this.dequeue()[0],t=e.getKey();e.getState()===H.IDLE&&!(t in this.tilesLoadingKeys_)&&(this.tilesLoadingKeys_[t]=!0,++this.tilesLoading_,++n,e.load())}}};function wc(e,t,n,r,i){if(!e||!(n in e.wantedTiles)||!e.wantedTiles[n][t.getKey()])return xc;let a=e.viewState.center,o=r[0]-a[0],s=r[1]-a[1];return 65536*Math.log(i)+Math.sqrt(o*o+s*s)/i}var Tc={ANIMATING:0,INTERACTING:1},Ec={CENTER:`center`,RESOLUTION:`resolution`,ROTATION:`rotation`};function W(e,t,n){return Math.min(Math.max(e,t),n)}function Dc(e,t,n,r,i,a){let o=i-n,s=a-r;if(o!==0||s!==0){let c=((e-n)*o+(t-r)*s)/(o*o+s*s);c>1?(n=i,r=a):c>0&&(n+=o*c,r+=s*c)}return Oc(e,t,n,r)}function Oc(e,t,n,r){let i=n-e,a=r-t;return i*i+a*a}function kc(e){let t=e.length;for(let n=0;ni&&(i=t,r=a)}if(i===0)return null;let a=e[r];e[r]=e[n],e[n]=a;for(let r=n+1;r=0;r--){n[r]=e[r][t]/e[r][r];for(let i=r-1;i>=0;i--)e[i][t]-=e[i][r]*n[r]}return n}function Ac(e){return e*180/Math.PI}function jc(e){return e*Math.PI/180}function Mc(e,t){let n=e%t;return n*t<0?n+t:n}function Nc(e,t,n){return e+n*(t-e)}function Pc(e,t){let n=10**t;return Math.round(e*n)/n}function Fc(e,t){return Math.floor(Pc(e,t))}function Ic(e,t){return Math.ceil(Pc(e,t))}function Lc(e,t,n){if(e>=t&&ep&&(f=(p+f)/2,p=f),m>h&&(m=(h+m)/2,h=m);let g=W(r[0],f,p),_=W(r[1],m,h);if(o&&n&&i){let e=30*i;g+=-e*Math.log(1+Math.max(0,f-r[0])/e)+e*Math.log(1+Math.max(0,r[0]-p)/e),_+=-e*Math.log(1+Math.max(0,m-r[1])/e)+e*Math.log(1+Math.max(0,r[1]-h)/e)}return[g,_]})}function zc(e){return e}var Bc={UNKNOWN:0,INTERSECTING:1,ABOVE:2,RIGHT:4,BELOW:8,LEFT:16};function Vc(e){let t=Yc();for(let n=0,r=e.length;ni&&(c|=Bc.RIGHT),sa&&(c|=Bc.ABOVE),c===Bc.UNKNOWN&&(c=Bc.INTERSECTING),c}function Yc(){return[1/0,1/0,-1/0,-1/0]}function Xc(e,t,n,r,i){return i?(i[0]=e,i[1]=t,i[2]=n,i[3]=r,i):[e,t,n,r]}function Zc(e){return Xc(1/0,1/0,-1/0,-1/0,e)}function Qc(e,t){let n=e[0],r=e[1];return Xc(n,r,n,r,t)}function $c(e,t,n,r,i){return rl(Zc(i),e,t,n,r)}function el(e,t){return e[0]==t[0]&&e[2]==t[2]&&e[1]==t[1]&&e[3]==t[3]}function tl(e,t){return t[0]e[2]&&(e[2]=t[2]),t[1]e[3]&&(e[3]=t[3]),e}function nl(e,t){t[0]e[2]&&(e[2]=t[0]),t[1]e[3]&&(e[3]=t[1])}function rl(e,t,n,r,i){for(;nt[0]?e[0]:t[0],r[1]=e[1]>t[1]?e[1]:t[1],r[2]=e[2]n&&u.push([n,r,o,a]),cr&&u.push([o,r,c,s]),l=t[0]&&e[1]<=t[3]&&e[3]>=t[1]}function yl(e){return e[2]=o&&h<=c),!r&&a&Bc.RIGHT&&!(i&Bc.RIGHT)&&(g=p-(f-c)*m,r=g>=s&&g<=l),!r&&a&Bc.BELOW&&!(i&Bc.BELOW)&&(h=f-(p-s)/m,r=h>=o&&h<=c),!r&&a&Bc.LEFT&&!(i&Bc.LEFT)&&(g=p-(f-o)*m,r=g>=s&&g<=l)}return r}function Sl(e,t){let n=t.getExtent(),r=ll(e);if(t.canWrapX()&&(r[0]=n[2])){let t=G(n),i=Math.floor((r[0]-n[0])/t)*t;e[0]-=i,e[2]-=i}return e}function Cl(e,t,n){if(t.canWrapX()){let r=t.getExtent();if(!isFinite(e[0])||!isFinite(e[2]))return[[r[0],e[1],r[2],e[3]]];Sl(e,t);let i=G(r);if(G(e)>i&&!n)return[[r[0],e[1],r[2],e[3]]];if(e[0]r[2])return[[e[0],e[1],r[2],e[3]],[r[0],e[1],e[2]-i,e[3]]]}return[e]}function wl(e,t){let n=[e];for(let e=0,r=t.length;e0;++e){let r=[];for(let i=0,a=n.length;i=0;--r)if(e[r]!=t[r]){n=!1;break}return n}function Dl(e,t){let n=Math.cos(t),r=Math.sin(t),i=e[0]*n-e[1]*r,a=e[1]*n+e[0]*r;return e[0]=i,e[1]=a,e}function Ol(e,t){return e[0]*=t,e[1]*=t,e}function kl(e,t){if(t.canWrapX()){let n=G(t.getExtent()),r=jl(e,t,n);r&&(e[0]-=r*n)}return e}function Al(e,t,n){if(t.canWrapX()){let r=G(t.getExtent()),i=Math.round((n-e[0])/r);i!==0&&(e[0]+=i*r)}return e}function jl(e,t,n){let r=t.getExtent(),i=0;return t.canWrapX()&&(e[0]r[2])&&(n||=G(r),i=Math.floor((e[0]-r[0])/n)),i}function Ml(e,t,n){let r=Math.sqrt((t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])),i=[(t[0]-e[0])/r,(t[1]-e[1])/r],a=[-i[1],i[0]],o=Math.sqrt((n[0]-e[0])*(n[0]-e[0])+(n[1]-e[1])*(n[1]-e[1])),s=[(n[0]-e[0])/o,(n[1]-e[1])/o],c=r===0||o===0?0:Math.acos(W(s[0]*i[0]+s[1]*i[1],-1,1));return c=Math.max(c,1e-5),s[0]*a[0]+s[1]*a[1]>0?c:Math.PI*2-c}function Nl(e){return e**3}function Pl(e){return 1-Nl(1-e)}function Fl(e){return 3*e*e-2*e*e*e}function Il(e){return e}function Ll(e,t,n){n||=6371008.8;let r=jc(e[1]),i=jc(t[1]),a=(i-r)/2,o=jc(t[0]-e[0])/2,s=Math.sin(a)*Math.sin(a)+Math.sin(o)*Math.sin(o)*Math.cos(r)*Math.cos(i);return 2*n*Math.atan2(Math.sqrt(s),Math.sqrt(1-s))}var Rl={info:1,warn:2,error:3,none:4},zl=Rl.info;function Bl(...e){zl>Rl.warn||console.warn(...e)}var Vl={radians:6370997/(2*Math.PI),degrees:2*Math.PI*6370997/360,ft:.3048,m:1,"us-ft":1200/3937},Hl=class{constructor(e){this.code_=e.code,this.units_=e.units,this.extent_=e.extent===void 0?null:e.extent,this.worldExtent_=e.worldExtent===void 0?null:e.worldExtent,this.axisOrientation_=e.axisOrientation===void 0?`enu`:e.axisOrientation,this.global_=e.global!==void 0&&e.global,this.canWrapX_=!!(this.global_&&this.extent_),this.getPointResolutionFunc_=e.getPointResolution,this.defaultTileGrid_=null,this.metersPerUnit_=e.metersPerUnit}canWrapX(){return this.canWrapX_}getCode(){return this.code_}getExtent(){return this.extent_}getUnits(){return this.units_}getMetersPerUnit(){return this.metersPerUnit_||Vl[this.units_]}getWorldExtent(){return this.worldExtent_}getAxisOrientation(){return this.axisOrientation_}isGlobal(){return this.global_}setGlobal(e){this.global_=e,this.canWrapX_=!!(e&&this.extent_)}getDefaultTileGrid(){return this.defaultTileGrid_}setDefaultTileGrid(e){this.defaultTileGrid_=e}setExtent(e){this.extent_=e,this.canWrapX_=!!(this.global_&&e)}setWorldExtent(e){this.worldExtent_=e}setGetPointResolution(e){this.getPointResolutionFunc_=e}getPointResolutionFunc(){return this.getPointResolutionFunc_}},Ul=6378137,Wl=Math.PI*Ul,Gl=[-Wl,-Wl,Wl,Wl],Kl=[-180,-85,180,85],ql=Ul*Math.log(Math.tan(Math.PI/2)),Jl=class extends Hl{constructor(e){super({code:e,units:`m`,extent:Gl,global:!0,worldExtent:Kl,getPointResolution:function(e,t){return e/Math.cosh(t[1]/Ul)}})}},Yl=[new Jl(`EPSG:3857`),new Jl(`EPSG:102100`),new Jl(`EPSG:102113`),new Jl(`EPSG:900913`),new Jl(`http://www.opengis.net/def/crs/EPSG/0/3857`),new Jl(`http://www.opengis.net/gml/srs/epsg.xml#3857`)];function Xl(e,t,n,r){let i=e.length;n=n!==void 0&&n>1?n:2,r??=n,t===void 0&&(t=n>2?e.slice():Array(i));for(let n=0;nql?r=ql:r<-ql&&(r=-ql),t[n+1]=r}return t}function Zl(e,t,n,r){let i=e.length;n=n!==void 0&&n>1?n:2,r??=n,t===void 0&&(t=n>2?e.slice():Array(i));for(let n=0;nju&&(t=ju);let r=jc(t),i=Math.sin(r),a=Math.cos(r),o=i/a,s=o*o,c=s*s,l=jc(e),u=jc(Fu(n.number)),d=Ou/Math.sqrt(1-uu*i**2),f=pu*a**2,p=a*Lc(l-u,-Math.PI,Math.PI),m=p*p,h=m*p,g=h*p,_=g*p,v=_*p,y=Ou*(bu*r-xu*Math.sin(2*r)+Su*Math.sin(4*r)-Cu*Math.sin(6*r)),b=lu*d*(p+h/6*(1-s+f)+_/120*(5-18*s+c+72*f-58*pu))+5e5,x=lu*(y+d*o*(m/2+g/24*(5-s+9*f+4*f**2)+v/720*(61-58*s+c+600*f-330*pu)));return n.north||(x+=1e7),[b,x]}function Fu(e){return(e-1)*6-180+3}var Iu=[/^EPSG:(\d+)$/,/^urn:ogc:def:crs:EPSG::(\d+)$/,/^http:\/\/www\.opengis\.net\/def\/crs\/EPSG\/0\/(\d+)$/];function Lu(e){let t=0;for(let n of Iu){let r=e.match(n);if(r){t=parseInt(r[1]);break}}if(!t)return null;let n=0,r=!1;return t>32700&&t<32761?n=t-32700:t>32600&&t<32661&&(r=!0,n=t-32600),n?{number:n,north:r}:null}function Ru(e,t){return function(n,r,i,a){let o=n.length;i=i!==void 0&&i>1?i:2,a??=i,r||=i>2?n.slice():Array(o);for(let i=0;i=s?t[o+e]:a[e]}return n})}function ed(e,t,n,r){let i=Ju(e),a=Ju(t);i&&a&&(su(i,a,$u(n)),su(a,i,$u(r)))}function td(e,t){if(e===t)return!0;let n=e.getUnits()===t.getUnits();return(e.getCode()===t.getCode()||nd(e,t)===Gu)&&n}function nd(e,t){if(!e||!t)return null;let n=e.getCode(),r=t.getCode(),i=cu(n,r);if(i)return i;let a=null,o=null;for(let n of Vu)a||=n(e),o||=n(t);if(!a&&!o)return null;let s=`EPSG:4326`;if(!o&&a){let e=cu(s,r);e&&(i=rd(a.inverse,e))}else if(!a&&o){let e=cu(n,s);e&&(i=rd(e,o.forward))}else a&&o&&(i=rd(a.inverse,o.forward));return i&&(Ku(e),Ku(t),su(e,t,i)),i}function rd(e,t){return function(n,r,i,a){return r=e(n,r,i,a),t(r,r,i,a)}}function id(e,t){return nd(Ju(e),Ju(t))}function ad(e,t,n){let r=id(t,n);if(!r){let e=Ju(t)?.getCode()??String(t),r=Ju(n)?.getCode()??String(n);throw Error(`No transform available between ${e} and ${r}`)}return r(e,void 0,e.length)}var od=null;function sd(){return od}function cd(e,t){return e}function ld(e,t){return Uu&&!El(e,[0,0])&&e[0]>=-180&&e[0]<=180&&e[1]>=-90&&e[1]<=90&&(Uu=!1,Bl(`Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.`)),e}function ud(e,t){return e}function dd(e,t){return e}function fd(e,t){return e}function pd(e,t,n){return function(r){let i,a;if(e.canWrapX()){let t=e.getExtent(),o=G(t);r=r.slice(0),a=jl(r,e,o),a&&(r[0]-=a*o),r[0]=W(r[0],t[0],t[2]),r[1]=W(r[1],t[1],t[3]),i=n(r)}else i=n(r);return a&&t.canWrapX()&&(i[0]+=a*G(t.getExtent())),i}}function md(){Xu(Yl),Xu(nu),Zu(nu,Yl,Xl,Zl)}md();var hd=[1,0,0,1,0,0];function gd(){return hd.slice(0)}function _d(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e}function vd(e,t){let n=t[0],r=t[1];return t[0]=e[0]*n+e[2]*r+e[4],t[1]=e[1]*n+e[3]*r+e[5],t}function yd(e,t,n,r,i,a,o,s){let c=Math.sin(a),l=Math.cos(a);return e[0]=r*l,e[1]=i*c,e[2]=-r*c,e[3]=i*l,e[4]=o*r*l-s*r*c+t,e[5]=o*i*c+s*i*l+n,e}function bd(e,t){let n=xd(t);U(n!==0,`Transformation matrix cannot be inverted`);let r=t[0],i=t[1],a=t[2],o=t[3],s=t[4],c=t[5];return e[0]=o/n,e[1]=-i/n,e[2]=-a/n,e[3]=r/n,e[4]=(a*c-o*s)/n,e[5]=-(r*c-i*s)/n,e}function xd(e){return e[0]*e[3]-e[1]*e[2]}var Sd=[1e5,1e5,1e5,1e5,2,2];function Cd(e){return`matrix(`+e.join(`, `)+`)`}function wd(e){return e.substring(7,e.length-1).split(`,`).map(parseFloat)}function Td(e,t){let n=wd(e),r=wd(t);for(let e=0;e<6;++e)if(Math.round((n[e]-r[e])*Sd[e])!==0)return!1;return!0}function Ed(e,t,n,r,i,a,o){a||=[],o||=2;let s=0;for(let c=t;c{if(!n)return this.getSimplifiedGeometry(t);let r=this.clone();return r.applyTransform(n),r.getSimplifiedGeometry(t)})}simplifyTransformed(e,t){return this.simplifyTransformedInternal(this.getRevision(),e,t)}clone(){return B()}closestPointXY(e,t,n,r){return B()}containsXY(e,t){return this.closestPointXY(e,t,jd,Number.MIN_VALUE)===0}getClosestPoint(e,t){return t||=[NaN,NaN],this.closestPointXY(e[0],e[1],t,1/0),t}intersectsCoordinate(e){return this.containsXY(e[0],e[1])}computeExtent(e){return B()}getExtent(e){if(this.extentRevision_!=this.getRevision()){let e=this.computeExtent(this.extent_);(isNaN(e[0])||isNaN(e[1]))&&Zc(e),this.extentRevision_=this.getRevision()}return bl(this.extent_,e)}rotate(e,t){B()}scale(e,t,n){B()}simplify(e){return this.getSimplifiedGeometry(e*e)}getSimplifiedGeometry(e){return B()}getType(){return B()}applyTransform(e){B()}intersectsExtent(e){return B()}translate(e,t){B()}transform(e,t){let n=Ju(e);if(!n)return this;let r=n.getUnits()==`tile-pixels`?function(e,r,i){let a=n.getExtent(),o=n.getWorldExtent(),s=pl(o)/pl(a);yd(Ad,o[0],o[3],s,-s,0,0,0);let c=Ed(e,0,e.length,i,Ad,r),l=id(n,t);return l?l(c,c,i):c}:id(n,t);return r&&this.applyTransform(r),this}},Nd=class extends Md{constructor(){super(),this.layout=`XY`,this.stride=2,this.flatCoordinates}computeExtent(e){return $c(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e)}getCoordinates(){return B()}getFirstCoordinate(){return this.flatCoordinates.slice(0,this.stride)}getFlatCoordinates(){return this.flatCoordinates}getLastCoordinate(){return this.flatCoordinates.slice(this.flatCoordinates.length-this.stride)}getLayout(){return this.layout}getSimplifiedGeometry(e){if(this.simplifiedGeometryRevision!==this.getRevision()&&(this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=this.getRevision()),e<0||this.simplifiedGeometryMaxMinSquaredTolerance!==0&&e<=this.simplifiedGeometryMaxMinSquaredTolerance)return this;let t=this.getSimplifiedGeometryInternal(e);return t.getFlatCoordinates().length1)d=n;else if(f>0){for(let i=0;ii&&(i=s),a=n,o=r}return i}function Vd(e,t,n,r,i){for(let a=0,o=n.length;aa&&(n-s)*(a-c)-(i-s)*(r-c)>0&&o++:r<=a&&(n-s)*(a-c)-(i-s)*(r-c)<0&&o--,s=n,c=r}return o!==0}function Qd(e,t,n,r,i,a){if(n.length===0||!Zd(e,t,n[0],r,i,a))return!1;for(let t=1,o=n.length;t=i[0]&&a[2]<=i[2]||a[1]>=i[1]&&a[3]<=i[3]||$d(e,t,n,r,function(e,t){return xl(i,e,t)}):!1}function tf(e,t,n,r,i){return!!(ef(e,t,n,r,i)||Zd(e,t,n,r,i[0],i[1])||Zd(e,t,n,r,i[0],i[3])||Zd(e,t,n,r,i[2],i[1])||Zd(e,t,n,r,i[2],i[3]))}function nf(e,t,n,r,i){if(!tf(e,t,n[0],r,i))return!1;if(n.length===1)return!0;for(let t=1,a=n.length;t0;){let n=l.pop(),a=l.pop(),o=0,s=e[a],d=e[a+1],f=e[n],p=e[n+1];for(let t=a+r;to&&(u=t,o=i)}o>i&&(c[(u-t)/r]=1,a+r0&&m>f)&&(p<0&&h0&&h>p)?(l=n,u=d):(a[o++]=l,a[o++]=u,s=l,c=u,l=n,u=d)}return a[o++]=l,a[o++]=u,o}function cf(e,t,n,r,i,a,o,s){for(let c=0,l=n.length;c_&&(l=(u+d)/2,Qd(e,t,n,r,l,m)&&(g=l,_=i)),u=d}return isNaN(g)&&(g=i[a]),o?(o.push(g,m,_),o):[g,m,_]}function ff(e,t,n,r,i){let a=[];for(let o=0,s=n.length;o0}function hf(e,t,n,r,i){i=i!==void 0&&i;for(let a=0,o=n.length;au&&d1&&typeof arguments[t-1]==`function`&&(n=arguments[t-1],--t);let r=0;for(;r0}getInteracting(){return this.hints_[Tc.INTERACTING]>0}cancelAnimations(){this.setHint(Tc.ANIMATING,-this.hints_[Tc.ANIMATING]);let e;for(let t=0,n=this.animations_.length;t=0;--n){let r=this.animations_[n],i=!0;for(let n=0,a=r.length;n0?o/a.duration:1;s>=1?(a.complete=!0,s=1):i=!1;let c=a.easing(s);if(a.sourceCenter){let e=a.sourceCenter[0],t=a.sourceCenter[1],n=a.targetCenter[0],r=a.targetCenter[1];this.nextCenter_=a.targetCenter;let i=e+c*(n-e),o=t+c*(r-t);this.targetCenter_=[i,o]}if(a.sourceResolution&&a.targetResolution){let e=c===1?a.targetResolution:a.sourceResolution+c*(a.targetResolution-a.sourceResolution);if(a.anchor){let t=this.getViewportSize_(this.getRotation()),n=this.constraints_.resolution(e,0,t,!0);this.targetCenter_=this.calculateCenterZoom(n,a.anchor)}this.nextResolution_=a.targetResolution,this.targetResolution_=e,this.applyTargetState_(!0)}if(a.sourceRotation!==void 0&&a.targetRotation!==void 0){let e=c===1?Mc(a.targetRotation+Math.PI,2*Math.PI)-Math.PI:a.sourceRotation+c*(a.targetRotation-a.sourceRotation);if(a.anchor){let t=this.constraints_.rotation(e,!0);this.targetCenter_=this.calculateCenterRotate(t,a.anchor)}this.nextRotation_=a.targetRotation,this.targetRotation_=e}if(this.applyTargetState_(!0),t=!0,!a.complete)break}if(i){this.animations_[n]=null,this.setHint(Tc.ANIMATING,-1),this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN;let e=r[0].callback;e&&jf(e,!0)}}this.animations_=this.animations_.filter(Boolean),t&&this.updateAnimationKey_===void 0&&(this.updateAnimationKey_=requestAnimationFrame(this.updateAnimations_.bind(this)))}calculateCenterRotate(e,t){let n,r=this.getCenterInternal();return r!==void 0&&(n=[r[0]-t[0],r[1]-t[1]],Dl(n,e-this.getRotation()),Tl(n,t)),n}calculateCenterZoom(e,t){let n,r=this.getCenterInternal(),i=this.getResolution();return r!==void 0&&i!==void 0&&(n=[t[0]-e*(t[0]-r[0])/i,t[1]-e*(t[1]-r[1])/i]),n}getViewportSize_(e){let t=this.viewportSize_;if(e){let n=t[0],r=t[1];return[Math.abs(n*Math.cos(e))+Math.abs(r*Math.sin(e)),Math.abs(n*Math.sin(e))+Math.abs(r*Math.cos(e))]}return t}setViewportSize(e){this.viewportSize_=Array.isArray(e)?e.slice():[100,100],this.getAnimating()||this.resolveConstraints(0)}getCenter(){let e=this.getCenterInternal();return e&&cd(e,this.getProjection())}getCenterInternal(){return this.get(Ec.CENTER)}getConstraints(){return this.constraints_}getConstrainResolution(){return this.get(`constrainResolution`)}getHints(e){return e===void 0?this.hints_.slice():(e[0]=this.hints_[0],e[1]=this.hints_[1],e)}calculateExtent(e){return ud(this.calculateExtentInternal(e),this.getProjection())}calculateExtentInternal(e){e||=this.getViewportSizeMinusPadding_();let t=this.getCenterInternal();U(t,`The view center is not defined`);let n=this.getResolution();U(n!==void 0,`The view resolution is not defined`);let r=this.getRotation();return U(r!==void 0,`The view rotation is not defined`),dl(t,n,r,e)}getMaxResolution(){return this.maxResolution_}getMinResolution(){return this.minResolution_}getMaxZoom(){return this.getZoomForResolution(this.minResolution_)}setMaxZoom(e){this.applyOptions_(this.getUpdatedOptions_({maxZoom:e}))}getMinZoom(){return this.getZoomForResolution(this.maxResolution_)}setMinZoom(e){this.applyOptions_(this.getUpdatedOptions_({minZoom:e}))}setConstrainResolution(e){this.applyOptions_(this.getUpdatedOptions_({constrainResolution:e}))}getProjection(){return this.projection_}getResolution(){return this.get(Ec.RESOLUTION)}getResolutions(){return this.resolutions_}getResolutionForExtent(e,t){return this.getResolutionForExtentInternal(dd(e,this.getProjection()),t)}getResolutionForExtentInternal(e,t){t||=this.getViewportSizeMinusPadding_();let n=G(e)/t[0],r=pl(e)/t[1];return Math.max(n,r)}getResolutionForValueFunction(e){e||=2;let t=this.getConstrainedResolution(this.maxResolution_),n=this.minResolution_,r=Math.log(t/n)/Math.log(e);return(function(n){return t/e**+(n*r)})}getRotation(){return this.get(Ec.ROTATION)}getValueForResolutionFunction(e){let t=Math.log(e||2),n=this.getConstrainedResolution(this.maxResolution_),r=this.minResolution_,i=Math.log(n/r)/t;return(function(e){return Math.log(n/e)/t/i})}getViewportSizeMinusPadding_(e){let t=this.getViewportSize_(e),n=this.padding_;return n&&(t=[t[0]-n[1]-n[3],t[1]-n[0]-n[2]]),t}getState(){let e=this.getProjection(),t=this.getResolution(),n=this.getRotation(),r=this.getCenterInternal(),i=this.padding_;if(i){let e=this.getViewportSizeMinusPadding_();r=If(r,this.getViewportSize_(),[e[0]/2+i[3],e[1]/2+i[0]],t,n)}return{center:r.slice(0),projection:e===void 0?null:e,resolution:t,nextCenter:this.nextCenter_,nextResolution:this.nextResolution_,nextRotation:this.nextRotation_,rotation:n,zoom:this.getZoom()}}getViewStateAndExtent(){return{viewState:this.getState(),extent:this.calculateExtent()}}getZoom(){let e,t=this.getResolution();return t!==void 0&&(e=this.getZoomForResolution(t)),e}getZoomForResolution(e){let t=this.minZoom_||0,n,r;if(this.resolutions_){let i=Bs(this.resolutions_,e,1);t=i,n=this.resolutions_[i],r=i==this.resolutions_.length-1?2:n/this.resolutions_[i+1]}else n=this.maxResolution_,r=this.zoomFactor_;return t+Math.log(n/e)/Math.log(r)}getResolutionForZoom(e){if(this.resolutions_?.length){if(this.resolutions_.length===1)return this.resolutions_[0];let t=W(Math.floor(e),0,this.resolutions_.length-2),n=this.resolutions_[t]/this.resolutions_[t+1];return this.resolutions_[t]/n**+W(e-t,0,1)}return this.maxResolution_/this.zoomFactor_**+(e-this.minZoom_)}fit(e,t){let n;if(U(Array.isArray(e)||typeof e.getSimplifiedGeometry==`function`,"Invalid extent or geometry provided as `geometry`"),Array.isArray(e))U(!yl(e),"Cannot fit empty extent provided as `geometry`"),n=yf(dd(e,this.getProjection()));else if(e.getType()===`Circle`){let t=dd(e.getExtent(),this.getProjection());n=yf(t),n.rotate(this.getRotation(),ll(t))}else{let t=sd();n=t?e.clone().transform(t,this.getProjection()):e}this.fitInternal(n,t)}rotatedExtentForGeometry(e){let t=this.getRotation(),n=Math.cos(t),r=Math.sin(-t),i=e.getFlatCoordinates(),a=e.getStride(),o=1/0,s=1/0,c=-1/0,l=-1/0;for(let e=0,t=i.length;ee.trim().replace(/^['"]|['"]$/g,``)),n};function Gf(e,t,n,r){let i;return i=n&&n.length?n.shift():mc?new class extends OffscreenCanvas{style={}}(e??300,t??150):document.createElement(`canvas`),e&&(i.width=e),t&&(i.height=t),i.getContext(`2d`,r)}var Kf;function qf(){return Kf||=Gf(1,1),Kf}function Jf(e){let t=e.canvas;t.width=1,t.height=1,e.clearRect(0,0,1,1)}function Yf(e,t){let n=t.parentNode;n&&n.replaceChild(e,t)}function Xf(e){for(;e.lastChild;)e.lastChild.remove()}function Zf(e,t){let n=e.childNodes;for(let r=0;;++r){let i=n[r],a=t[r];if(!i&&!a)break;i!==a&&(i?a?e.insertBefore(a,i):(e.removeChild(i),--r):e.appendChild(a))}}function Qf(){return new Proxy({childNodes:[],appendChild:function(e){return this.childNodes.push(e),e},remove:function(){},removeChild:function(e){let t=this.childNodes.indexOf(e);if(t===-1)throw Error(`Node to remove was not found`);return this.childNodes.splice(t,1),e},insertBefore:function(e,t){let n=this.childNodes.indexOf(t);if(n===-1)throw Error(`Reference node not found`);return this.childNodes.splice(n,0,e),e},style:{}},{get(e,t,n){return t===`firstElementChild`?e.childNodes.length>0?e.childNodes[0]:null:Reflect.get(e,t,n)}})}function $f(e){return typeof HTMLCanvasElement<`u`&&e instanceof HTMLCanvasElement||typeof OffscreenCanvas<`u`&&e instanceof OffscreenCanvas}var ep=class extends rc{constructor(e){super();let t=e.element;t&&!e.target&&!t.style.pointerEvents&&(t.style.pointerEvents=`auto`),this.element=t||null,this.target_=null,this.map_=null,this.listenerKeys=[],e.render&&(this.render=e.render),e.target&&this.setTarget(e.target)}disposeInternal(){this.element?.remove(),super.disposeInternal()}getMap(){return this.map_}setMap(e){this.map_&&this.element?.remove();for(let e=0,t=this.listenerKeys.length;et.getAttributions(e)));if(this.attributions_!==void 0&&(Array.isArray(this.attributions_)?this.attributions_.forEach(e=>r.add(e)):r.add(this.attributions_)),!this.overrideCollapsible_){let e=!n.some(e=>e.getSource()?.getAttributionsCollapsible()===!1);this.setCollapsible(e)}return Array.from(r)}async updateElement_(e){let t=this.element;if(!t)return;if(!e){this.renderedVisible_&&=(t.style.display=`none`,!1);return}let n=await Promise.all(this.collectSourceAttributions_(e).map(e=>Zs(()=>e))),r=n.length>0;if(this.renderedVisible_!=r&&(t.style.display=r?``:`none`,this.renderedVisible_=r),!Us(n,this.renderedAttributions_)){Xf(this.ulElement_);for(let e=0,t=n.length;e0&&n%(2*Math.PI)!=0?t.animate({rotation:0,duration:this.duration_,easing:Pl}):t.setRotation(0))}render(e){let t=e.frameState;if(!t)return;let n=t.viewState.rotation;if(n!=this.rotation_){let e=`rotate(`+n+`rad)`,t=this.element;if(this.autoHide_&&t){let e=t.classList.contains(Lf);!e&&n===0?t.classList.add(Lf):e&&n!==0&&t.classList.remove(Lf)}this.label_.style.transform=e}this.rotation_=n}},rp=class extends ep{constructor(e){e||={},super({element:document.createElement(`div`),target:e.target});let t=e.className===void 0?`ol-zoom`:e.className,n=e.delta===void 0?1:e.delta,r=e.zoomInClassName===void 0?t+`-in`:e.zoomInClassName,i=e.zoomOutClassName===void 0?t+`-out`:e.zoomOutClassName,a=e.zoomInLabel===void 0?`+`:e.zoomInLabel,o=e.zoomOutLabel===void 0?`–`:e.zoomOutLabel,s=e.zoomInTipLabel===void 0?`Zoom in`:e.zoomInTipLabel,c=e.zoomOutTipLabel===void 0?`Zoom out`:e.zoomOutTipLabel,l=document.createElement(`button`);l.className=r,l.setAttribute(`type`,`button`),l.title=s,l.appendChild(typeof a==`string`?document.createTextNode(a):a),l.addEventListener(z.CLICK,this.handleClick_.bind(this,n),!1);let u=document.createElement(`button`);u.className=i,u.setAttribute(`type`,`button`),u.title=c,u.appendChild(typeof o==`string`?document.createTextNode(o):o),u.addEventListener(z.CLICK,this.handleClick_.bind(this,-n),!1);let d=t+` `+Rf+` `+zf,f=this.element;f.className=d,f.appendChild(l),f.appendChild(u),this.duration_=e.duration===void 0?250:e.duration}handleClick_(e,t){t.preventDefault(),this.zoomByDelta_(e)}zoomByDelta_(e){let t=this.getMap();if(!t)return;let n=t.getView();if(!n)return;let r=n.getZoom();if(r!==void 0){let t=n.getConstrainedZoom(r+e);if(t===void 0)return;this.duration_>0?(n.getAnimating()&&n.cancelAnimations(),n.animate({zoom:t,duration:this.duration_,easing:Pl})):n.setZoom(t)}}};function ip(e){e||={};let t=new oc;return(e.zoom===void 0||e.zoom)&&t.push(new rp(e.zoomOptions)),(e.rotate===void 0||e.rotate)&&t.push(new np(e.rotateOptions)),(e.attribution===void 0||e.attribution)&&t.push(new tp(e.attributionOptions)),t}var ap=class{constructor(e,t,n){this.decay_=e,this.minVelocity_=t,this.delay_=n,this.points_=[],this.angle_=0,this.initialVelocity_=0}begin(){this.points_.length=0,this.angle_=0,this.initialVelocity_=0}update(e,t){this.points_.push(e,t,Date.now())}end(){if(this.points_.length<6)return!1;let e=Date.now()-this.delay_,t=this.points_.length-3;if(this.points_[t+2]0&&this.points_[n+2]>e;)n-=3;let r=this.points_[t+2]-this.points_[n+2];if(r<1e3/60)return!1;let i=this.points_[t]-this.points_[n],a=this.points_[t+1]-this.points_[n+1];return this.angle_=Math.atan2(a,i),this.initialVelocity_=Math.sqrt(i*i+a*a)/r,this.initialVelocity_>this.minVelocity_}getDistance(){return(this.minVelocity_-this.initialVelocity_)/this.decay_}getAngle(){return this.angle_}},op={ACTIVE:`active`},sp=class extends rc{constructor(e){super(),this.on,this.once,this.un,e&&e.handleEvent&&(this.handleEvent=e.handleEvent),this.map_=null,this.setActive(!0)}getActive(){return this.get(op.ACTIVE)}getMap(){return this.map_}handleEvent(e){return!0}setActive(e){this.set(op.ACTIVE,e)}setMap(e){this.map_=e}};function cp(e,t,n){let r=e.getCenterInternal();if(r){let i=[r[0]+t[0],r[1]+t[1]];e.animateInternal({duration:n===void 0?250:n,easing:Il,center:e.getConstrainedCenter(i)})}}function lp(e,t,n,r){let i=e.getZoom();if(i===void 0)return;let a=e.getConstrainedZoom(i+t);if(a===void 0)return;let o=e.getResolutionForZoom(a);o!==void 0&&(e.getAnimating()&&e.cancelAnimations(),e.animate({resolution:o,anchor:n,duration:r===void 0?250:r,easing:Pl}))}var up=class extends sp{constructor(e){super(),e||={},this.delta_=e.delta?e.delta:1,this.duration_=e.duration===void 0?250:e.duration}handleEvent(e){let t=!1;if(e.type==lc.DBLCLICK){let n=e.originalEvent,r=e.map,i=e.coordinate,a=n.shiftKey?-this.delta_:this.delta_;lp(r.getView(),a,i,this.duration_),n.preventDefault(),t=!0}return!t}};function dp(e){let t=arguments;return function(e){let n=!0;for(let r=0,i=t.length;r0}}else if(e.type==lc.POINTERDOWN){let n=this.handleDownEvent(e);this.handlingDownUpSequence=n,t=this.stopDown(n)}else e.type==lc.POINTERMOVE&&this.handleMoveEvent(e);return!t}handleMoveEvent(e){}handleUpEvent(e){return!1}stopDown(e){return e}updateTrackedPointers_(e){e.activePointers&&(this.targetPointers=e.activePointers)}};function wp(e){let t=e.length,n=0,r=0;for(let i=0;i0&&this.condition_(e)){let t=e.map.getView();return this.lastCentroid=null,t.getAnimating()&&t.cancelAnimations(),this.kinetic_&&this.kinetic_.begin(),this.noKinetic_=this.targetPointers.length>1,!0}return!1}},Ep=class extends Cp{constructor(e){e||={},super({stopDown:Js}),this.condition_=e.condition?e.condition:fp,this.lastAngle_=void 0,this.duration_=e.duration===void 0?250:e.duration}handleDragEvent(e){if(!xp(e))return;let t=e.map,n=t.getView();if(n.getConstraints().rotation===Tf)return;let r=t.getSize();if(!r)return;let i=e.pixel,a=Math.atan2(r[1]/2-i[1],i[0]-r[0]/2);if(this.lastAngle_!==void 0){let e=a-this.lastAngle_;n.adjustRotationInternal(-e)}this.lastAngle_=a}handleUpEvent(e){return!xp(e)||(e.map.getView().endInteraction(this.duration_),!1)}handleDownEvent(e){return xp(e)&&gp(e)&&this.condition_(e)?(e.map.getView().beginInteraction(),this.lastAngle_=void 0,!0):!1}},Dp=class extends Is{constructor(e){super(),this.geometry_=null,this.element_=document.createElement(`div`),this.element_.style.position=`absolute`,this.element_.style.pointerEvents=`auto`,this.element_.className=`ol-box `+e,this.map_=null,this.startPixel_=null,this.endPixel_=null}disposeInternal(){this.setMap(null)}render_(){let e=this.startPixel_,t=this.endPixel_;if(!e||!t)return;let n=this.element_.style;n.left=Math.min(e[0],t[0])+`px`,n.top=Math.min(e[1],t[1])+`px`,n.width=Math.abs(t[0]-e[0])+`px`,n.height=Math.abs(t[1]-e[1])+`px`}setMap(e){if(this.map_){let e=this.map_.getOverlayContainer();e&&e.removeChild(this.element_);let t=this.element_.style;t.left=`inherit`,t.top=`inherit`,t.width=`inherit`,t.height=`inherit`}if(this.map_=e,this.map_){let e=this.map_.getOverlayContainer();e&&e.appendChild(this.element_)}}setPixels(e,t){this.startPixel_=e,this.endPixel_=t,this.createOrUpdateGeometry(),this.render_()}createOrUpdateGeometry(){if(!this.map_)return;let e=this.startPixel_,t=this.endPixel_;if(!e||!t)return;let n=[e,[e[0],t[1]],t,[t[0],e[1]]],r=this.map_,i=n.map(e=>r.getCoordinateFromPixelInternal(e)),a=i[0];if(!a)return;i[4]=a.slice();let o=i;this.geometry_?this.geometry_.setCoordinates([o]):this.geometry_=new vf([o])}getGeometry(){return this.geometry_}},Op={BOXSTART:`boxstart`,BOXDRAG:`boxdrag`,BOXEND:`boxend`,BOXCANCEL:`boxcancel`},kp=class extends Qs{constructor(e,t,n){super(e),this.coordinate=t,this.mapBrowserEvent=n}},Ap=class extends Cp{constructor(e){super(),this.on,this.once,this.un,e??={},this.box_=new Dp(e.className||`ol-dragbox`),this.minArea_=e.minArea??64,e.onBoxEnd&&(this.onBoxEnd=e.onBoxEnd),this.startPixel_=null,this.condition_=e.condition??gp,this.boxEndCondition_=e.boxEndCondition??this.defaultBoxEndCondition}defaultBoxEndCondition(e,t,n){let r=n[0]-t[0],i=n[1]-t[1];return r*r+i*i>=this.minArea_}getGeometry(){return this.box_.getGeometry()}handleDragEvent(e){this.startPixel_&&(this.box_.setPixels(this.startPixel_,e.pixel),this.dispatchEvent(new kp(Op.BOXDRAG,e.coordinate,e)))}handleUpEvent(e){if(!this.startPixel_)return!1;let t=this.boxEndCondition_(e,this.startPixel_,e.pixel);return t&&this.onBoxEnd(e),this.dispatchEvent(new kp(t?Op.BOXEND:Op.BOXCANCEL,e.coordinate,e)),this.box_.setMap(null),this.startPixel_=null,!1}handleDownEvent(e){return this.condition_(e)?(this.startPixel_=e.pixel,this.box_.setMap(e.map),this.box_.setPixels(this.startPixel_,this.startPixel_),this.dispatchEvent(new kp(Op.BOXSTART,e.coordinate,e)),!0):!1}onBoxEnd(e){}setActive(e){e||(this.box_.setMap(null),this.startPixel_&&=(this.dispatchEvent(new kp(Op.BOXCANCEL,this.startPixel_,null)),null)),super.setActive(e)}setMap(e){this.getMap()&&(this.box_.setMap(null),this.startPixel_&&=(this.dispatchEvent(new kp(Op.BOXCANCEL,this.startPixel_,null)),null)),super.setMap(e)}},jp=class extends Ap{constructor(e){e||={};let t=e.condition?e.condition:yp;super({condition:t,className:e.className||`ol-dragzoom`,minArea:e.minArea}),this.duration_=e.duration===void 0?200:e.duration,this.out_=e.out!==void 0&&e.out}onBoxEnd(e){let t=this.getMap();if(!t)return;let n=t.getView(),r=this.getGeometry();if(this.out_){let e=n.rotatedExtentForGeometry(r),t=n.getResolutionForExtentInternal(e),i=n.getResolution();if(t===void 0||i===void 0)return;let a=i/t;r=r.clone(),r.scale(a*a)}n.fitInternal(r,{duration:this.duration_,easing:Pl})}},Mp={LEFT:`ArrowLeft`,UP:`ArrowUp`,RIGHT:`ArrowRight`,DOWN:`ArrowDown`},Np=class extends sp{constructor(e){super(),e||={},this.defaultCondition_=function(e){return _p(e)&&bp(e)},this.condition_=e.condition===void 0?this.defaultCondition_:e.condition,this.duration_=e.duration===void 0?100:e.duration,this.pixelDelta_=e.pixelDelta===void 0?128:e.pixelDelta}handleEvent(e){let t=!1;if(e.type==z.KEYDOWN){let n=e.originalEvent,r=n.key;if(this.condition_(e)&&(r==Mp.DOWN||r==Mp.LEFT||r==Mp.RIGHT||r==Mp.UP)){let i=e.map.getView(),a=i.getResolution();if(a===void 0)return!0;let o=a*this.pixelDelta_,s=0,c=0;r==Mp.DOWN?c=-o:r==Mp.LEFT?s=-o:r==Mp.RIGHT?s=o:c=o;let l=[s,c];Dl(l,i.getRotation()),cp(i,l,this.duration_),n.preventDefault(),t=!0}}return!t}},Pp=class extends sp{constructor(e){super(),e||={},this.condition_=e.condition?e.condition:function(e){return!vp(e)&&bp(e)},this.delta_=e.delta?e.delta:1,this.duration_=e.duration===void 0?100:e.duration}handleEvent(e){let t=!1;if(e.type==z.KEYDOWN||e.type==z.KEYPRESS){let n=e.originalEvent,r=n.key;if(this.condition_(e)&&(r===`+`||r===`-`)){let i=e.map,a=r===`+`?this.delta_:-this.delta_;lp(i.getView(),a,void 0,this.duration_),n.preventDefault(),t=!0}}return!t}},Fp=40,Ip=300,Lp=3,Rp=class extends sp{constructor(e){e||={},super(e),this.totalDelta_=0,this.lastDelta_=0,this.maxDelta_=e.maxDelta===void 0?1:e.maxDelta,this.duration_=e.duration===void 0?250:e.duration,this.timeout_=e.timeout===void 0?80:e.timeout,this.useAnchor_=e.useAnchor===void 0||e.useAnchor,this.constrainResolution_=e.constrainResolution!==void 0&&e.constrainResolution;let t=e.condition?e.condition:hp;this.condition_=e.onFocusOnly?dp(mp,t):t,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_,this.mode_=void 0,this.trackpadEventGap_=400,this.trackpadTimeoutId_,this.deltaPerZoom_=300}endInteraction_(){this.trackpadTimeoutId_=void 0;let e=this.getMap();if(!e)return;let t=e.getView(),n=this.lastDelta_?this.lastDelta_>0?1:-1:0;t.endInteraction(this.constrainResolution_||t.getConstrainResolution()?100:void 0,n,this.lastAnchor_?e.getCoordinateFromPixel(this.lastAnchor_):void 0)}handleEvent(e){if(!this.condition_(e)||e.type!==z.WHEEL)return!0;let t=e.map,n=e.originalEvent;n.preventDefault();let r=n.ctrlKey&&!e.ctrlKey;this.useAnchor_&&(this.lastAnchor_=e.pixel);let i=n.deltaY;switch(n.deltaMode){case WheelEvent.DOM_DELTA_LINE:i*=Fp;break;case WheelEvent.DOM_DELTA_PAGE:i*=Ip}if(i===0)return!1;this.lastDelta_=i;let a=Date.now();this.startTime_===void 0&&(this.startTime_=a),(!this.mode_||a-this.startTime_>this.trackpadEventGap_)&&(this.mode_=Math.abs(i)<4?`trackpad`:`wheel`);let o=t.getView();if(this.mode_===`trackpad`)return this.trackpadTimeoutId_?clearTimeout(this.trackpadTimeoutId_):(o.getAnimating()&&o.cancelAnimations(),o.beginInteraction()),this.trackpadTimeoutId_=setTimeout(this.endInteraction_.bind(this),this.timeout_),r&&(i*=Lp),o.adjustZoom(-i/this.deltaPerZoom_,this.lastAnchor_?t.getCoordinateFromPixel(this.lastAnchor_):void 0),this.startTime_=a,!1;this.totalDelta_+=i;let s=Math.max(this.timeout_-(a-this.startTime_),0);return clearTimeout(this.timeoutId_),this.timeoutId_=setTimeout(this.handleWheelZoom_.bind(this,t),s),!1}handleWheelZoom_(e){let t=e.getView();t.getAnimating()&&t.cancelAnimations();let n=-W(this.totalDelta_,-this.maxDelta_*this.deltaPerZoom_,this.maxDelta_*this.deltaPerZoom_)/this.deltaPerZoom_;(t.getConstrainResolution()||this.constrainResolution_)&&(n=n?n>0?1:-1:0),lp(t,n,this.lastAnchor_?e.getCoordinateFromPixel(this.lastAnchor_):void 0,this.duration_),this.mode_=void 0,this.totalDelta_=0,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_=void 0}setMouseAnchor(e){this.useAnchor_=e,e||(this.lastAnchor_=null)}},zp=class extends Cp{constructor(e){e||={};let t=e;t.stopDown||=Js,super(t),this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.threshold_=e.threshold===void 0?.3:e.threshold,this.duration_=e.duration===void 0?250:e.duration}handleDragEvent(e){let t=0,n=this.targetPointers[0],r=this.targetPointers[1],i=Math.atan2(r.clientY-n.clientY,r.clientX-n.clientX);if(this.lastAngle_!==void 0){let e=i-this.lastAngle_;this.rotationDelta_+=e,!this.rotating_&&Math.abs(this.rotationDelta_)>this.threshold_&&(this.rotating_=!0),t=e}this.lastAngle_=i;let a=e.map,o=a.getView();o.getConstraints().rotation!==Tf&&(this.anchor_=a.getCoordinateFromPixelInternal(a.getEventPixel(wp(this.targetPointers)))??null,this.rotating_&&(a.render(),o.adjustRotationInternal(t,this.anchor_??void 0)))}handleUpEvent(e){return this.targetPointers.length<2?(e.map.getView().endInteraction(this.duration_),!1):!0}handleDownEvent(e){if(this.targetPointers.length>=2){let t=e.map;return this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.handlingDownUpSequence||t.getView().beginInteraction(),!0}return!1}},Bp=class extends Cp{constructor(e){e||={};let t=e;t.stopDown||=Js,super(t),this.anchor_=null,this.duration_=e.duration===void 0?400:e.duration,this.lastDistance_=void 0,this.lastScaleDelta_=1}handleDragEvent(e){let t=1,n=this.targetPointers[0],r=this.targetPointers[1],i=n.clientX-r.clientX,a=n.clientY-r.clientY,o=Math.sqrt(i*i+a*a);this.lastDistance_!==void 0&&(t=this.lastDistance_/o),this.lastDistance_=o;let s=e.map,c=s.getView();t!=1&&(this.lastScaleDelta_=t),this.anchor_=s.getCoordinateFromPixelInternal(s.getEventPixel(wp(this.targetPointers)))??null,s.render(),c.adjustResolutionInternal(t,this.anchor_??void 0)}handleUpEvent(e){if(this.targetPointers.length<2){let t=e.map.getView(),n=this.lastScaleDelta_>1?1:-1;return t.endInteraction(this.duration_,n),!1}return!0}handleDownEvent(e){if(this.targetPointers.length>=2){let t=e.map;return this.anchor_=null,this.lastDistance_=void 0,this.lastScaleDelta_=1,this.handlingDownUpSequence||t.getView().beginInteraction(),!0}return!1}};function Vp(e){e||={};let t=new oc,n=new ap(-.005,.05,100);return(e.altShiftDragRotate===void 0||e.altShiftDragRotate)&&t.push(new Ep),(e.doubleClickZoom===void 0||e.doubleClickZoom)&&t.push(new up({delta:e.zoomDelta,duration:e.zoomDuration})),(e.dragPan===void 0||e.dragPan)&&t.push(new Tp({onFocusOnly:e.onFocusOnly,kinetic:n})),(e.pinchRotate===void 0||e.pinchRotate)&&t.push(new zp),(e.pinchZoom===void 0||e.pinchZoom)&&t.push(new Bp({duration:e.zoomDuration})),(e.keyboard===void 0||e.keyboard)&&(t.push(new Np),t.push(new Pp({delta:e.zoomDelta,duration:e.zoomDuration}))),(e.mouseWheelZoom===void 0||e.mouseWheelZoom)&&t.push(new Rp({onFocusOnly:e.onFocusOnly,duration:e.zoomDuration})),(e.shiftDragZoom===void 0||e.shiftDragZoom)&&t.push(new jp({duration:e.zoomDuration})),t}var K={OPACITY:`opacity`,VISIBLE:`visible`,EXTENT:`extent`,Z_INDEX:`zIndex`,MAX_RESOLUTION:`maxResolution`,MIN_RESOLUTION:`minResolution`,MAX_ZOOM:`maxZoom`,MIN_ZOOM:`minZoom`,SOURCE:`source`,MAP:`map`},Hp=class extends rc{constructor(e){super(),this.on,this.once,this.un,this.background_=e.background;let t=Object.assign({},e);typeof e.properties==`object`&&(delete t.properties,Object.assign(t,e.properties)),t[K.OPACITY]=e.opacity===void 0?1:e.opacity,U(typeof t[K.OPACITY]==`number`,`Layer opacity must be a number`),t[K.VISIBLE]=e.visible===void 0||e.visible,t[K.Z_INDEX]=e.zIndex,t[K.MAX_RESOLUTION]=e.maxResolution===void 0?1/0:e.maxResolution,t[K.MIN_RESOLUTION]=e.minResolution===void 0?0:e.minResolution,t[K.MIN_ZOOM]=e.minZoom===void 0?-1/0:e.minZoom,t[K.MAX_ZOOM]=e.maxZoom===void 0?1/0:e.maxZoom,this.className_=t.className===void 0?`ol-layer`:t.className,delete t.className,this.setProperties(t),this.state_=null}getBackground(){return this.background_}getClassName(){return this.className_}getLayerState(e){let t=this.state_||{layer:this,managed:e===void 0||e},n=this.getZIndex();return t.opacity=W(Math.round(this.getOpacity()*100)/100,0,1),t.visible=this.getVisible(),t.extent=this.getExtent(),t.zIndex=n===void 0&&!t.managed?1/0:n,t.maxResolution=this.getMaxResolution(),t.minResolution=Math.max(this.getMinResolution(),0),t.minZoom=this.getMinZoom(),t.maxZoom=this.getMaxZoom(),this.state_=t,t}getLayersArray(e){return B()}getLayerStatesArray(e){return B()}getExtent(){return this.get(K.EXTENT)}getMaxResolution(){return this.get(K.MAX_RESOLUTION)}getMinResolution(){return this.get(K.MIN_RESOLUTION)}getMinZoom(){return this.get(K.MIN_ZOOM)}getMaxZoom(){return this.get(K.MAX_ZOOM)}getOpacity(){return this.get(K.OPACITY)}getSourceState(){return B()}getVisible(){return this.get(K.VISIBLE)}getZIndex(){return this.get(K.Z_INDEX)}setBackground(e){this.background_=e,this.changed()}setExtent(e){this.set(K.EXTENT,e)}setMaxResolution(e){this.set(K.MAX_RESOLUTION,e)}setMinResolution(e){this.set(K.MIN_RESOLUTION,e)}setMaxZoom(e){this.set(K.MAX_ZOOM,e)}setMinZoom(e){this.set(K.MIN_ZOOM,e)}setOpacity(e){U(typeof e==`number`,`Layer opacity must be a number`),this.set(K.OPACITY,e)}setVisible(e){this.set(K.VISIBLE,e)}setZIndex(e){this.set(K.Z_INDEX,e)}disposeInternal(){this.state_&&=(this.state_.layer=null,null),super.disposeInternal()}},Up={ADDLAYER:`addlayer`,REMOVELAYER:`removelayer`},Wp=class extends Qs{constructor(e,t){super(e),this.layer=t}},Gp={LAYERS:`layers`},Kp=class e extends Hp{constructor(e){e||={};let t=Object.assign({},e);delete t.layers;let n=e.layers;super(t),this.on,this.once,this.un,this.layersListenerKeys_=[],this.listenerKeys_={},this.addChangeListener(Gp.LAYERS,this.handleLayersChanged_),n?Array.isArray(n)?n=new oc(n.slice(),{unique:!0}):U(typeof n.getArray==`function`,"Expected `layers` to be an array or a `Collection`"):n=new oc(void 0,{unique:!0}),this.setLayers(n)}handleLayerChange_(){this.changed()}handleLayersChanged_(){this.layersListenerKeys_.forEach(R),this.layersListenerKeys_.length=0;let e=this.getLayers();this.layersListenerKeys_.push(L(e,js.ADD,this.handleLayersAdd_,this),L(e,js.REMOVE,this.handleLayersRemove_,this));for(let e in this.listenerKeys_)this.listenerKeys_[e].forEach(R);Ns(this.listenerKeys_);let t=e.getArray();for(let e=0,n=t.length;e{this.dispatchEvent(`sourceready`)},0))),this.changed()}getFeatures(e){return this.renderer_?this.renderer_.getFeatures(e):Promise.resolve([])}getData(e){return!this.renderer_||!this.rendered?null:this.renderer_.getData(e)}isVisible(e){let t,n=this.getMapInternal();!e&&n&&(e=n.getView()),t=e instanceof Af?{viewState:e.getState(),extent:e.calculateExtent()}:e;let r=t;!r.layerStatesArray&&n&&(r.layerStatesArray=n.getLayerGroup().getLayerStatesArray());let i;if(r.layerStatesArray){if(i=r.layerStatesArray.find(e=>e.layer===this),!i)return!1}else i=this.getLayerState();let a=this.getExtent();return Yp(i,r.viewState)&&(!a||vl(a,r.extent))}getAttributions(e){if(!this.isVisible(e))return[];let t=this.getSource()?.getAttributions();if(!t)return[];let n=t(e instanceof Af?e.getViewStateAndExtent():e);return Array.isArray(n)||(n=[n]),n}render(e,t){let n=this.getRenderer();return n.prepareFrame(e)?(this.rendered=!0,n.renderFrame(e,t)):null}unrender(){this.rendered=!1}getDeclutter(){}renderDeclutter(e,t){}renderDeferred(e){let t=this.getRenderer();t&&t.renderDeferred(e)}setMapInternal(e){e||this.unrender(),this.set(K.MAP,e)}getMapInternal(){return this.get(K.MAP)}setMap(e){this.mapPrecomposeKey_&&=(R(this.mapPrecomposeKey_),null),e||this.changed(),this.mapRenderKey_&&=(R(this.mapRenderKey_),null),e&&(this.mapPrecomposeKey_=L(e,qp.PRECOMPOSE,this.handlePrecompose_,this),this.mapRenderKey_=L(this,z.CHANGE,e.render,e),this.changed())}handlePrecompose_(e){let t=e.frameState?.layerStatesArray;if(!t)return;let n=this.getLayerState(!1);U(!t.some(e=>e.layer===n.layer),"A layer can only be added to the map once. Use either `layer.setMap()` or `map.addLayer()`, not both."),t.push(n)}setSource(e){this.set(K.SOURCE,e)}getRenderer(){return 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 Yp(e,t){if(!e.visible)return!1;let n=t.resolution;if(n=e.maxResolution)return!1;let r=t.zoom;return r>e.minZoom&&r<=e.maxZoom}function Xp(e,t,n=0,r=e.length-1,i=Qp){for(;r>n;){if(r-n>600){let a=r-n+1,o=t-n+1,s=Math.log(a),c=.5*Math.exp(2*s/3),l=.5*Math.sqrt(s*c*(a-c)/a)*(o-a/2<0?-1:1);Xp(e,t,Math.max(n,Math.floor(t-o*c/a+l)),Math.min(r,Math.floor(t+(a-o)*c/a+l)),i)}let a=e[t],o=n,s=r;for(Zp(e,n,t),i(e[r],a)>0&&Zp(e,n,r);o0;)s--}i(e[n],a)===0?Zp(e,n,s):(s++,Zp(e,s,r)),s<=t&&(n=s+1),t<=s&&(r=s-1)}}function Zp(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}function Qp(e,t){return et)}var $p=class{constructor(e=9){this._maxEntries=Math.max(4,e),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4)),this.clear()}all(){return this._all(this.data,[])}search(e){let t=this.data,n=[];if(!dm(e,t))return n;let r=this.toBBox,i=[];for(;t;){for(let a=0;a=0&&i[t].children.length>this._maxEntries;)this._split(i,t),t--;this._adjustParentBBoxes(r,i,t)}_split(e,t){let n=e[t],r=n.children.length,i=this._minEntries;this._chooseSplitAxis(n,i,r);let a=this._chooseSplitIndex(n,i,r),o=fm(n.children.splice(a,n.children.length-a));o.height=n.height,o.leaf=n.leaf,tm(n,this.toBBox),tm(o,this.toBBox),t?e[t-1].children.push(o):this._splitRoot(n,o)}_splitRoot(e,t){this.data=fm([e,t]),this.data.height=e.height+1,this.data.leaf=!1,tm(this.data,this.toBBox)}_chooseSplitIndex(e,t,n){let r,i=1/0,a=1/0;for(let o=t;o<=n-t;o++){let t=nm(e,0,o,this.toBBox),s=nm(e,o,n,this.toBBox),c=lm(t,s),l=om(t)+om(s);c=t;r--){let t=e.children[r];rm(o,e.leaf?i(t):t),s+=sm(o)}return s}_adjustParentBBoxes(e,t,n){for(let r=n;r>=0;r--)rm(t[r],e)}_condense(e){for(let t=e.length-1,n;t>=0;t--)e[t].children.length===0?t>0?(n=e[t-1].children,n.splice(n.indexOf(e[t]),1)):this.clear():tm(e[t],this.toBBox)}};function em(e,t,n){if(!n)return t.indexOf(e);for(let r=0;r=e.minX&&t.maxY>=e.minY}function fm(e){return{children:e,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function pm(e,t,n,r,i){let a=[t,n];for(;a.length;){if(n=a.pop(),t=a.pop(),n-t<=r)continue;let o=t+Math.ceil((n-t)/r/2)*r;Xp(e,o,t,n,i),a.push(t,o,o,n)}}var mm=[NaN,NaN,NaN,0],hm;function gm(){return hm||=Gf(1,1,void 0,{willReadFrequently:!0,desynchronized:!0}),hm}var _m=/^rgba?\(\s*(\d+%?)\s+(\d+%?)\s+(\d+%?)(?:\s*\/\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,vm=/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,ym=/^rgba?\(\s*(\d+%)\s*,\s*(\d+%)\s*,\s*(\d+%)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,bm=/^#([\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$/i;function xm(e,t){return e.endsWith(`%`)?Number(e.substring(0,e.length-1))/t:Number(e)}function Sm(e){throw Error(`failed to parse "`+e+`" as color`)}function Cm(e){if(e.toLowerCase().startsWith(`rgb`)){let t=e.match(vm)||e.match(_m)||e.match(ym);if(t){let e=t[4],n=100/255;return[W(xm(t[1],n)+.5|0,0,255),W(xm(t[2],n)+.5|0,0,255),W(xm(t[3],n)+.5|0,0,255),e===void 0?1:W(xm(e,100),0,1)]}Sm(e)}if(e.startsWith(`#`)){if(bm.test(e)){let t=e.substring(1),n=t.length<=4?1:2,r=[0,0,0,255];for(let e=0,i=t.length;e.0031308?e**(1/2.4)*269.025-14.025:e*3294.6}function Am(e){return e>.2068965?e**3:(e-4/29)*(108/841)}function jm(e){return e>10.314724?((e+14.025)/269.025)**2.4:e/3294.6}function Mm(e){return e>.0088564?e**(1/3):e/(108/841)+4/29}function Nm(e){let t=jm(e[0]),n=jm(e[1]),r=jm(e[2]),i=Mm(t*.222488403+n*.716873169+r*.06060791),a=500*(Mm(t*.452247074+n*.399439023+r*.148375274)-i),o=200*(i-Mm(t*.016863605+n*.117638439+r*.865350722)),s=180/Math.PI*Math.atan2(o,a);return[116*i-16,Math.sqrt(a*a+o*o),s<0?s+360:s,e[3]]}function Pm(e){let t=(e[0]+16)/116,n=e[1],r=e[2]*Math.PI/180,i=Am(t),a=Am(t+n/500*Math.cos(r)),o=Am(t-n/200*Math.sin(r)),s=km(a*3.021973625-i*1.617392459-o*.404875592),c=km(a*-.943766287+i*1.916279586+o*.027607165),l=km(a*.069407491-i*.22898585+o*1.159737864);return[W(s+.5|0,0,255),W(c+.5|0,0,255),W(l+.5|0,0,255),e[3]]}function Fm(e){if(e===`none`)return mm;if(Em.hasOwnProperty(e))return Em[e];if(Dm>=Tm){let e=0;for(let t in Em)e++&3||(delete Em[t],--Dm)}let t=Cm(e);t.length!==4&&Sm(e);for(let n of t)isNaN(n)&&Sm(e);return Em[e]=t,++Dm,t}function Im(e){return Array.isArray(e)?e:Fm(e)}function Lm(e){let t=e[0];t!=(t|0)&&(t=t+.5|0);let n=e[1];n!=(n|0)&&(n=n+.5|0);let r=e[2];r!=(r|0)&&(r=r+.5|0);let i=e[3]===void 0?1:Math.round(e[3]*1e3)/1e3;return`rgba(`+t+`,`+n+`,`+r+`,`+i+`)`}function Rm(e){return e[0]>0&&e[1]>0}function zm(e,t,n){return n===void 0&&(n=[0,0]),n[0]=e[0]*t+.5|0,n[1]=e[1]*t+.5|0,n}function Bm(e,t){return Array.isArray(e)?e:(t===void 0?t=[e,e]:(t[0]=e,t[1]=e),t)}var Vm=0,Hm=1<`,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`,InterpolateHcl:`interpolate-hcl`,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`},oh={[J.Get]:Z(Y(1,1/0),sh),[J.Var]:ch(),[J.Has]:Z(Y(1,1/0),sh),[J.Id]:Z(lh,ph),[J.Concat]:Z(Y(2,1/0),X(Um)),[J.GeometryType]:Z(uh,ph),[J.LineMetric]:Z(dh,ph),[J.Resolution]:Z(fh,ph),[J.Zoom]:Z(fh,ph),[J.Time]:Z(fh,ph),[J.Any]:Z(Y(2,1/0),X(Hm)),[J.All]:Z(Y(2,1/0),X(Hm)),[J.Not]:Z(Y(1,1),X(Hm)),[J.Equal]:Z(Y(2,2),hh()),[J.NotEqual]:Z(Y(2,2),hh()),[J.GreaterThan]:Z(Y(2,2),X(q)),[J.GreaterThanOrEqualTo]:Z(Y(2,2),X(q)),[J.LessThan]:Z(Y(2,2),X(q)),[J.LessThanOrEqualTo]:Z(Y(2,2),X(q)),[J.Multiply]:Z(Y(2,1/0),mh),[J.Coalesce]:Z(Y(2,1/0),mh),[J.Divide]:Z(Y(2,2),X(q)),[J.Add]:Z(Y(2,1/0),X(q)),[J.Subtract]:Z(Y(2,2),X(q)),[J.Clamp]:Z(Y(3,3),X(q)),[J.Mod]:Z(Y(2,2),X(q)),[J.Pow]:Z(Y(2,2),X(q)),[J.Abs]:Z(Y(1,1),X(q)),[J.Floor]:Z(Y(1,1),X(q)),[J.Ceil]:Z(Y(1,1),X(q)),[J.Round]:Z(Y(1,1),X(q)),[J.Sin]:Z(Y(1,1),X(q)),[J.Cos]:Z(Y(1,1),X(q)),[J.Atan]:Z(Y(1,2),X(q)),[J.Sqrt]:Z(Y(1,1),X(q)),[J.Match]:Z(Y(4,1/0),_h,vh),[J.Between]:Z(Y(3,3),X(q)),[J.Interpolate]:Z(Y(6,1/0),_h,bh),[J.InterpolateHcl]:Z(Y(6,1/0),_h,yh,bh),[J.Case]:Z(Y(3,1/0),gh,xh),[J.In]:Z(Y(2,2),Sh),[J.Number]:Z(Y(1,1/0),X(qm)),[J.String]:Z(Y(1,1/0),X(qm)),[J.Array]:Z(Y(1,1/0),X(q)),[J.Color]:Z(Y(1,4),X(q)),[J.Band]:Z(Y(1,3),X(q)),[J.Palette]:Z(Y(2,2),Ch),[J.ToString]:Z(Y(1,1),X(Hm|q|Um|Wm))};function sh(e,t,n){let r=e.length-1,i=Array(r);for(let a=0;at){let n=t===1/0?`${e} or more`:`${e} to ${t}`;throw Error(`expected ${n} arguments for ${a}, got ${o}`)}}}function mh(e,t,n){let r=e.length-1,i=Array(r);for(let a=0;ae.featureId??``;case J.GeometryType:return e=>e.geometryType;case J.Concat:{let n=e.args.map(e=>Oh(e,t));return e=>``.concat(...n.map(t=>(t(e)??``).toString()))}case J.Resolution:return e=>e.resolution;case J.Any:case J.All:case J.Between:case J.In:case J.Not:return Ph(e,t);case J.Equal:case J.NotEqual:case J.LessThan:case J.LessThanOrEqualTo:case J.GreaterThan:case J.GreaterThanOrEqualTo:return Nh(e,t);case J.Multiply:case J.Divide:case J.Add:case J.Subtract:case J.Clamp:case J.Mod:case J.Pow:case J.Abs:case J.Floor:case J.Ceil:case J.Round:case J.Sin:case J.Cos:case J.Atan:case J.Sqrt:return Fh(e,t);case J.Case:return Ih(e,t);case J.Match:return Lh(e,t);case J.Interpolate:case J.InterpolateHcl:return Rh(e,t);case J.ToString:return zh(e,t);case J.Array:return kh(e,t);case J.Color:return Ah(e,t);default:throw Error(`Unsupported operator ${n}`)}}function kh(e,t){let n=e.args.length,r=Array(n);for(let i=0;i[r[0](t)*255,r[1](t)*255,r[2](t)*255,e?e(t):1]}return e=>{let t=Array(n);for(let i=0;i{let n=r[0](t);return[n,n,n,e?e(t):1]}}let i=n===4?r[3]:null;return e=>[r[0](e),r[1](e),r[2](e),i?i(e):1]}function jh(e,t){let n=e.operator,r=e.args.length,i=Array(r);for(let n=0;n{for(let t=0;t{for(let t=0;t{let r=e.args,i=t.properties[n];for(let e=1,t=r.length;ee.variables[n];case J.Has:return t=>{let r=e.args;if(!(n in t.properties))return!1;let i=t.properties[n];for(let e=1,t=r.length;er(e)===i(e);case J.NotEqual:return e=>r(e)!==i(e);case J.LessThan:return e=>r(e)r(e)<=i(e);case J.GreaterThan:return e=>r(e)>i(e);case J.GreaterThanOrEqualTo:return e=>r(e)>=i(e);default:throw Error(`Unsupported comparison operator ${n}`)}}function Ph(e,t){let n=e.operator,r=e.args.length,i=Array(r);for(let n=0;n{for(let t=0;t{for(let t=0;t{let t=i[0](e),n=i[1](e),r=i[2](e);return t>=n&&t<=r};case J.In:return e=>{let t=i[0](e);for(let n=1;n!i[0](e);default:throw Error(`Unsupported logical operator ${n}`)}}function Fh(e,t){let n=e.operator,r=e.args.length,i=Array(r);for(let n=0;n{let t=1;for(let n=0;ni[0](e)/i[1](e);case J.Add:return e=>{let t=0;for(let n=0;ni[0](e)-i[1](e);case J.Clamp:return e=>{let t=i[0](e),n=i[1](e);if(tr?r:t};case J.Mod:return e=>i[0](e)%i[1](e);case J.Pow:return e=>i[0](e)**+i[1](e);case J.Abs:return e=>Math.abs(i[0](e));case J.Floor:return e=>Math.floor(i[0](e));case J.Ceil:return e=>Math.ceil(i[0](e));case J.Round:return e=>Math.round(i[0](e));case J.Sin:return e=>Math.sin(i[0](e));case J.Cos:return e=>Math.cos(i[0](e));case J.Atan:return r===2?e=>Math.atan2(i[0](e),i[1](e)):e=>Math.atan(i[0](e));case J.Sqrt:return e=>Math.sqrt(i[0](e));default:throw Error(`Unsupported numeric operator ${n}`)}}function Ih(e,t){let n=e.args.length,r=Array(n);for(let i=0;i{for(let t=0;t{let t=r[0](e);for(let i=1;i{let t=r[0](e),a=r[1](e),o,s;for(let c=2;c=a)return c===2?l:u?i(t,a,o,s,n,l):Bh(t,a,o,s,n,l);o=n,s=l}return s}}function zh(e,t){let n=e.operator,r=e.args.length,i=Array(r);for(let n=0;n{let n=i[0](t);return e.args[0].type===Wm?Lm(n):n.toString()};default:throw Error(`Unsupported convert operator ${n}`)}}function Bh(e,t,n,r,i,a){let o=i-n;if(o===0)return r;let s=t-n;return r+(e===1?s/o:(e**+s-1)/(e**+o-1))*(a-r)}function Vh(e,t,n,r,i,a){return i-n===0?r:[Bh(e,t,n,r[0],i,a[0]),Bh(e,t,n,r[1],i,a[1]),Bh(e,t,n,r[2],i,a[2]),Bh(e,t,n,r[3],i,a[3])]}function Hh(e,t,n,r,i,a){if(i-n===0)return r;let o=Nm(r),s=Nm(a),c=s[2]-o[2];return c>180?c-=360:c<-180&&(c+=360),Pm([Bh(e,t,n,o[0],i,s[0]),Bh(e,t,n,o[1],i,s[1]),o[2]+Bh(e,t,n,0,i,c),Bh(e,t,n,r[3],i,a[3])])}var Q={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};function Uh(e,t,n){let r=e,i=!0,a=!1,o=!1,s=[Fs(r,z.LOAD,function(){o=!0,a||t()})];return r.src&&hc?(a=!0,r.decode().then(function(){i&&t()}).catch(function(e){i&&(o?t():n())})):s.push(Fs(r,z.ERROR,n)),function(){i=!1,s.forEach(R)}}function Wh(e,t){return new Promise((n,r)=>{function i(){o(),n(e)}function a(){o(),r(Error(`Image load error`))}function o(){e.removeEventListener(`load`,i),e.removeEventListener(`error`,a)}e.addEventListener(`load`,i),e.addEventListener(`error`,a),t&&(e.src=t)})}function Gh(e,t){return t&&(e.src=t),e.src&&hc?new Promise((t,n)=>e.decode().then(()=>t(e)).catch(r=>e.complete&&e.width?t(e):n(r))):Wh(e)}var Kh=class{constructor(){this.cache_={},this.patternCache_={},this.cacheSize_=0,this.maxCacheSize_=1024}clear(){this.cache_={},this.patternCache_={},this.cacheSize_=0}canExpireCache(){return this.cacheSize_>this.maxCacheSize_}expire(){if(this.canExpireCache()){let e=0;for(let t in this.cache_){let n=this.cache_[t];!(e++&3)&&!n.hasListener()&&(delete this.cache_[t],delete this.patternCache_[t],--this.cacheSize_)}}}get(e,t){let n=qh(e,t);return n in this.cache_?this.cache_[n]:null}getPattern(e,t){let n=qh(e,t);return n in this.patternCache_?this.patternCache_[n]:null}set(e,t,n,r){let i=qh(e,t),a=i in this.cache_;if(n&&(this.cache_[i]=n),r&&n){if(n.getImageState()===Q.IDLE&&n.load(),n.getImageState()===Q.LOADING)n.ready().then(()=>{let e=qf().createPattern(n.getImage(1),`repeat`);e&&(this.patternCache_[i]=e)});else{let e=qf().createPattern(n.getImage(1),`repeat`);e&&(this.patternCache_[i]=e)}}a||++this.cacheSize_}setSize(e){this.maxCacheSize_=e,this.expire()}};function qh(e,t){let n=t?Im(t):`null`;return e+`:`+n}var Jh=new Kh,Yh=null,Xh=class extends $s{constructor(e,t,n,r,i){super(),this.hitDetectionImage_=null,this.image_=e,this.crossOrigin_=n?.crossOrigin??null,this.referrerPolicy_=n?.referrerPolicy,this.canvas_={},this.color_=i,this.imageState_=r===void 0?Q.IDLE:r,this.size_=e&&e.width&&e.height?[e.width,e.height]:null,this.src_=t,this.tainted_,this.ready_=null}initializeImage_(){this.image_=new Image,this.crossOrigin_!==null&&(this.image_.crossOrigin=this.crossOrigin_),this.referrerPolicy_!==void 0&&(this.image_.referrerPolicy=this.referrerPolicy_)}isTainted_(){if(this.tainted_===void 0&&this.imageState_===Q.LOADED){let e=this.image_;if(!e)return!1;Yh||=Gf(1,1,void 0,{willReadFrequently:!0}),Yh.drawImage(e,0,0);try{Yh.getImageData(0,0,1,1),this.tainted_=!1}catch{Yh=null,this.tainted_=!0}}return this.tainted_===!0}dispatchChangeEvent_(){this.dispatchEvent(z.CHANGE)}handleImageError_(){this.imageState_=Q.ERROR,this.dispatchChangeEvent_()}handleImageLoad_(){this.imageState_=Q.LOADED;let e=this.image_;e&&`width`in e&&`height`in e&&(this.size_=[e.width,e.height]),this.dispatchChangeEvent_()}getImage(e){this.image_||this.initializeImage_(),this.replaceColor_(e);let t=this.image_;return this.canvas_[e]?this.canvas_[e]:t}setImage(e){this.image_=e}getPixelRatio(e){return this.replaceColor_(e),this.canvas_[e]?e:1}getImageState(){return this.imageState_}getHitDetectionImage(){if(this.image_||this.initializeImage_(),!this.hitDetectionImage_){if(this.isTainted_()){let e=this.size_;if(!e)return this.image_;let t=e[0],n=e[1],r=Gf(t,n);r.fillRect(0,0,t,n),this.hitDetectionImage_=r.canvas}else this.hitDetectionImage_=this.image_}return this.hitDetectionImage_}getSize(){return this.size_}getSrc(){return this.src_}load(){if(this.imageState_===Q.IDLE){this.image_||this.initializeImage_(),this.imageState_=Q.LOADING;try{this.src_!==void 0&&(this.image_.src=this.src_)}catch{this.handleImageError_()}this.image_ instanceof HTMLImageElement&&Gh(this.image_,this.src_).then(e=>{this.image_=e,this.handleImageLoad_()}).catch(this.handleImageError_.bind(this))}}replaceColor_(e){if(!this.color_||this.canvas_[e]||this.imageState_!==Q.LOADED)return;let t=this.image_;if(!t)return;let n=Gf(Math.ceil(t.width*e),Math.ceil(t.height*e)),r=n.canvas;n.scale(e,e),n.drawImage(t,0,0),n.globalCompositeOperation=`multiply`,n.fillStyle=wm(this.color_),n.fillRect(0,0,r.width/e,r.height/e),n.globalCompositeOperation=`destination-in`,n.drawImage(t,0,0),this.canvas_[e]=r}ready(){return this.ready_||=new Promise(e=>{if(this.imageState_===Q.LOADED||this.imageState_===Q.ERROR)e();else{let t=()=>{(this.imageState_===Q.LOADED||this.imageState_===Q.ERROR)&&(this.removeEventListener(z.CHANGE,t),e())};this.addEventListener(z.CHANGE,t)}}),this.ready_}};function Zh(e,t,n,r,i,a){let o=t===void 0?void 0:Jh.get(t,i);return o||(o=new Xh(e,e&&`src`in e?e.src||void 0:t,n,r,i),t!==void 0&&Jh.set(t,i,o,a)),a&&o&&t!==void 0&&!Jh.getPattern(t,i)&&Jh.set(t,i,o,a),o}function Qh(e){return e?Array.isArray(e)?Lm(e):typeof e==`object`&&`src`in e?$h(e):e:null}function $h(e){if(!e.offset||!e.size)return Jh.getPattern(e.src,e.color??null);let t=e.src+`:`+e.offset,n=Jh.getPattern(t,e.color??null);if(n)return n;let r=Jh.get(e.src,null);if(!r||r.getImageState()!==Q.LOADED)return null;let i=Gf(e.size[0],e.size[1]);return i.drawImage(r.getImage(1),e.offset[0],e.offset[1],e.size[0],e.size[1],0,0,e.size[0],e.size[1]),Zh(i.canvas,t,{},Q.LOADED,e.color??null,!0),Jh.getPattern(t,e.color??null)}var eg=`10px sans-serif`,tg=`#000`,ng=`round`,rg=[],ig=`round`,ag=`#000`,og=`center`,sg=`middle`,cg=[0,0,0,0],lg=new rc,ug=null,dg,fg={},pg=new Set([`serif`,`sans-serif`,`monospace`,`cursive`,`fantasy`,`system-ui`,`ui-serif`,`ui-sans-serif`,`ui-monospace`,`ui-rounded`,`emoji`,`math`,`fangsong`]);function mg(e,t,n){return`${e} ${t} 16px "${n}"`}var hg=(function(){let e,t;async function n(e){await t.ready;let n=Wf(e);if(!n)return!1;let r=n.families[0].toLowerCase(),i=n.weight,a=[];return t.forEach(e=>{let t=e.family.replace(/^['"]|['"]$/g,``).toLowerCase(),o=Uf[e.weight]||e.weight;t===r&&e.style===n.style&&o==i&&a.push(e)}),a.length!==0&&(await Promise.all(a.map(e=>e.load().then(()=>!0,()=>!1)))).some(e=>e)}async function r(){await t.ready;let i=!0,a=lg.getProperties(),o=Object.keys(a).filter(e=>a[e]<100);for(let e=o.length-1;e>=0;--e){let t=o[e],r=a[t];r<100&&(await n(t)?(Ns(fg),lg.set(t,100)):(r+=10,lg.set(t,r,!0),r<100&&(i=!1)))}e=void 0,i||(e=setTimeout(r,100))}return async function(n){t||=mc?self.fonts:document.fonts;let i=Wf(n);if(!i)return;let a=i.families,o=!1;for(let e of a){if(pg.has(e))continue;let t=mg(i.style,i.weight,e);lg.get(t)===void 0&&(lg.set(t,0,!0),o=!0)}o&&(clearTimeout(e),e=setTimeout(r,100))}})(),gg=(function(){let e;return function(t){let n=fg[t];if(n==null){if(mc){let e=Wf(t),r=_g(t,`Žg`);n=(!e||isNaN(Number(e.lineHeight))?1.2:Number(e.lineHeight))*(r.actualBoundingBoxAscent+r.actualBoundingBoxDescent)}else e||(e=document.createElement(`div`),e.innerHTML=`M`,e.style.minHeight=`0`,e.style.maxHeight=`none`,e.style.height=`auto`,e.style.padding=`0`,e.style.border=`none`,e.style.position=`absolute`,e.style.display=`block`,e.style.left=`-99999px`),e.style.font=t,document.body.appendChild(e),n=e.offsetHeight,document.body.removeChild(e);fg[t]=n}return n}})();function _g(e,t){return ug||=Gf(1,1),e!=dg&&(ug.font=e,dg=ug.font),ug.measureText(t)}function vg(e,t){return _g(e,t).width}function yg(e,t,n){if(t in n)return n[t];let r=t.split(` +`).reduce((t,n)=>Math.max(t,vg(e,n)),0);return n[t]=r,r}function bg(e,t){let n=[],r=[],i=[],a=0,o=0,s=0,c=0;for(let l=0,u=t.length;l<=u;l+=2){let d=t[l];if(d===` +`||l===u){a=Math.max(a,o),i.push(o),o=0,s+=c,c=0;continue}let f=t[l+1]||e.font,p=vg(f,d);n.push(p),o+=p;let m=gg(f);r.push(m),c=Math.max(c,m)}return{width:a,height:s,widths:n,heights:r,lineWidths:i}}function xg(e,t,n,r,i,a,o,s,c,l,u){e.save(),n!==1&&(e.globalAlpha===void 0?e.globalAlpha=function(e){return e.globalAlpha*=n}:e.globalAlpha*=n),t&&e.transform.apply(e,t),r.contextInstructions?(e.translate(c,l),e.scale(u[0],u[1]),Sg(r,e)):u[0]<0||u[1]<0?(e.translate(c,l),e.scale(u[0],u[1]),e.drawImage(r,i,a,o,s,0,0,o,s)):e.drawImage(r,i,a,o,s,c,l,o*u[0],s*u[1]),e.restore()}function Sg(e,t){let n=t,r=e.contextInstructions;for(let e=0,t=r.length;ethis.imageState_=Q.LOADED),this.render()}clone(){let t=this.getScale(),n=new e({fill:this.getFill()?.clone(),points:this.getPoints(),radius:this.getRadius(),radius2:this.getRadius2(),angle:this.getAngle(),stroke:this.getStroke()?.clone(),rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),scale:Array.isArray(t)?t.slice():t,displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()});return n.setOpacity(this.getOpacity()),n}getAnchor(){let e=this.size_,t=this.getDisplacement(),n=this.getScaleArray();return[e[0]/2-t[0]/n[0],e[1]/2+t[1]/n[1]]}getAngle(){return this.angle_}getFill(){return this.fill_}setFill(e){this.fill_=e,this.render()}getHitDetectionImage(){return this.hitDetectionCanvas_||=this.createHitDetectionCanvas_(this.renderOptions_),this.hitDetectionCanvas_}getImage(e){let t=this.fill_?.getKey(),n=`${e},${this.angle_},${this.radius},${this.radius2_},${this.points_},${t}`+Object.values(this.renderOptions_).join(`,`),r=Jh.get(n,null)?.getImage(1);if(!r){let t=this.renderOptions_,i=Math.ceil(t.size*e),a=Gf(i,i);this.draw_(t,a,e),r=a.canvas;let o=new Xh(r,void 0,{},Q.LOADED,null);Jh.set(n,null,o),createImageBitmap(r).then(e=>{o.setImage(e)})}return r}getPixelRatio(e){return e}getImageSize(){return this.size_}getImageState(){return this.imageState_}getOrigin(){return this.origin_}getPoints(){return this.points_}getRadius(){return this.radius}setRadius(e){this.radius!==e&&(this.radius=e,this.render())}getRadius2(){return this.radius2_}setRadius2(e){this.radius2_!==e&&(this.radius2_=e,this.render())}getSize(){return this.size_}getStroke(){return this.stroke_}setStroke(e){this.stroke_=e,this.render()}listenImageChange(e){}load(){}unlistenImageChange(e){}calculateLineJoinSize_(e,t,n){if(t===0||this.points_===1/0||e!==`bevel`&&e!==`miter`)return t;let r=this.radius,i=this.radius2_===void 0?r:this.radius2_;if(r{this.patternImage_=null}),t.getImageState()===Q.IDLE&&t.load(),t.getImageState()===Q.LOADING&&(this.patternImage_=t)}this.color_=e}getKey(){let e=this.getColor();return e?e instanceof CanvasPattern||e instanceof CanvasGradient?V(e):typeof e==`object`&&`src`in e?e.src+`:`+e.offset:Im(e).toString():``}loading(){return!!this.patternImage_}ready(){return this.patternImage_?this.patternImage_.ready():Promise.resolve()}};function Dg(e,t,n,r){return n!==void 0&&r!==void 0?[n/e,r/t]:n===void 0?r===void 0?1:r/t:n/e}var Og=class e extends Cg{constructor(e){e||={};let t=e.opacity===void 0?1:e.opacity,n=e.rotation===void 0?0:e.rotation,r=e.scale===void 0?1:e.scale,i=e.rotateWithView!==void 0&&e.rotateWithView;super({opacity:t,rotation:n,scale:r,displacement:e.displacement===void 0?[0,0]:e.displacement,rotateWithView:i,declutterMode:e.declutterMode}),this.anchor_=e.anchor===void 0?[.5,.5]:e.anchor,this.normalizedAnchor_=null,this.anchorOrigin_=e.anchorOrigin===void 0?`top-left`:e.anchorOrigin,this.anchorXUnits_=e.anchorXUnits===void 0?`fraction`:e.anchorXUnits,this.anchorYUnits_=e.anchorYUnits===void 0?`fraction`:e.anchorYUnits,this.crossOrigin_=e.crossOrigin===void 0?null:e.crossOrigin,this.referrerPolicy_=e.referrerPolicy;let a=e.img===void 0?null:e.img,o=e.src;U(!(o!==void 0&&a),"`image` and `src` cannot be provided at the same time"),(o===void 0||o.length===0)&&a&&(o=a.src||V(a)),U(o!==void 0&&o.length>0,"A defined and non-empty `src` or `image` must be provided"),U(e.width===void 0&&e.height===void 0||e.scale===void 0,"`width` or `height` cannot be provided together with `scale`");let s;if(e.src===void 0?a!==void 0&&(s=`complete`in a?a.complete?a.src?Q.LOADED:Q.IDLE:Q.LOADING:Q.LOADED):s=Q.IDLE,this.color_=e.color===void 0?null:Im(e.color),this.iconImage_=Zh(a,o,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},s,this.color_),this.offset_=e.offset===void 0?[0,0]:e.offset,this.offsetOrigin_=e.offsetOrigin===void 0?`top-left`:e.offsetOrigin,this.origin_=null,this.size_=e.size===void 0?null:e.size,this.initialOptions_,e.width!==void 0||e.height!==void 0){let t,n;if(e.size)[t,n]=e.size;else{let r=this.getImage(1);if(r.width&&r.height)t=r.width,n=r.height;else if(r instanceof HTMLImageElement){this.initialOptions_=e;let t=()=>{if(this.unlistenImageChange(t),!this.initialOptions_)return;let n=this.iconImage_.getSize();n&&this.setScale(Dg(n[0],n[1],e.width,e.height))};this.listenImageChange(t);return}}t!==void 0&&this.setScale(Dg(t,n,e.width,e.height))}}clone(){let t,n,r;return this.initialOptions_?(n=this.initialOptions_.width,r=this.initialOptions_.height):(t=this.getScale(),t=Array.isArray(t)?t.slice():t),new e({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:n,height:r,size:this.size_===null?void 0:this.size_.slice(),src:this.getSrc(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()})}getAnchor(){let e=this.normalizedAnchor_;if(!e){e=this.anchor_;let t=this.getSize();if(this.anchorXUnits_==`fraction`||this.anchorYUnits_==`fraction`){if(!t)return null;e=this.anchor_.slice(),this.anchorXUnits_==`fraction`&&(e[0]*=t[0]),this.anchorYUnits_==`fraction`&&(e[1]*=t[1])}if(this.anchorOrigin_!=`top-left`){if(!t)return null;e===this.anchor_&&(e=this.anchor_.slice()),(this.anchorOrigin_==`top-right`||this.anchorOrigin_==`bottom-right`)&&(e[0]=-e[0]+t[0]),(this.anchorOrigin_==`bottom-left`||this.anchorOrigin_==`bottom-right`)&&(e[1]=-e[1]+t[1])}this.normalizedAnchor_=e}let t=this.getDisplacement(),n=this.getScaleArray();return[e[0]-t[0]/n[0],e[1]+t[1]/n[1]]}setAnchor(e){this.anchor_=e,this.normalizedAnchor_=null}getColor(){return this.color_}setColor(e){let t=e?Im(e):null;if(this.color_===t||this.color_&&t&&this.color_.length===t.length&&this.color_.every((e,n)=>e===t[n]))return;this.color_=t;let n=this.getSrc(),r=n===void 0?this.getHitDetectionImage():null,i=n===void 0?this.iconImage_.getImageState():Q.IDLE;this.iconImage_=Zh(r,n,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},i,this.color_)}getImage(e){return this.iconImage_.getImage(e)}getPixelRatio(e){return this.iconImage_.getPixelRatio(e)}getImageSize(){return this.iconImage_.getSize()}getImageState(){return this.iconImage_.getImageState()}getHitDetectionImage(){return this.iconImage_.getHitDetectionImage()}getOrigin(){if(this.origin_)return this.origin_;let e=this.offset_;if(this.offsetOrigin_!=`top-left`){let t=this.getSize(),n=this.iconImage_.getSize();if(!t||!n)return null;e=e.slice(),(this.offsetOrigin_==`top-right`||this.offsetOrigin_==`bottom-right`)&&(e[0]=n[0]-t[0]-e[0]),(this.offsetOrigin_==`bottom-left`||this.offsetOrigin_==`bottom-right`)&&(e[1]=n[1]-t[1]-e[1])}return this.origin_=e,this.origin_}getSrc(){return this.iconImage_.getSrc()}setSrc(e){this.iconImage_=Zh(null,e,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},Q.IDLE,this.color_)}getSize(){return this.size_?this.size_:this.iconImage_.getSize()}getWidth(){let e=this.getScaleArray();if(this.size_)return this.size_[0]*e[0];if(this.iconImage_.getImageState()==Q.LOADED){let t=this.iconImage_.getSize();if(t)return t[0]*e[0]}}getHeight(){let e=this.getScaleArray();if(this.size_)return this.size_[1]*e[1];if(this.iconImage_.getImageState()==Q.LOADED){let t=this.iconImage_.getSize();if(t)return t[1]*e[1]}}setScale(e){delete this.initialOptions_,super.setScale(e)}listenImageChange(e){this.iconImage_.addEventListener(z.CHANGE,e)}load(){this.iconImage_.load()}unlistenImageChange(e){this.iconImage_.removeEventListener(z.CHANGE,e)}ready(){return this.iconImage_.ready()}},kg=class e{constructor(e){e||={},this.color_=e.color===void 0?null:e.color,this.lineCap_=e.lineCap,this.lineDash_=e.lineDash===void 0?null:e.lineDash,this.lineDashOffset_=e.lineDashOffset,this.lineJoin_=e.lineJoin,this.miterLimit_=e.miterLimit,this.offset_=e.offset,this.width_=e.width}clone(){let t=this.getColor();return new e({color:Array.isArray(t)?t.slice():t||void 0,lineCap:this.getLineCap(),lineDash:this.getLineDash()?.slice(),lineDashOffset:this.getLineDashOffset(),lineJoin:this.getLineJoin(),miterLimit:this.getMiterLimit(),offset:this.getOffset(),width:this.getWidth()})}getColor(){return this.color_}getLineCap(){return this.lineCap_}getLineDash(){return this.lineDash_}getLineDashOffset(){return this.lineDashOffset_}getLineJoin(){return this.lineJoin_}getMiterLimit(){return this.miterLimit_}getOffset(){return this.offset_}getWidth(){return this.width_}setColor(e){this.color_=e}setLineCap(e){this.lineCap_=e}setLineDash(e){this.lineDash_=e}setLineDashOffset(e){this.lineDashOffset_=e}setLineJoin(e){this.lineJoin_=e}setMiterLimit(e){this.miterLimit_=e}setOffset(e){this.offset_=e}setWidth(e){this.width_=e}},Ag=class e{constructor(e){e||={},this.geometry_=null,this.geometryFunction_=Pg,e.geometry!==void 0&&this.setGeometry(e.geometry),this.fill_=e.fill===void 0?null:e.fill,this.image_=e.image===void 0?null:e.image,this.renderer_=e.renderer===void 0?null:e.renderer,this.hitDetectionRenderer_=e.hitDetectionRenderer===void 0?null:e.hitDetectionRenderer,this.stroke_=e.stroke===void 0?null:e.stroke,this.text_=e.text===void 0?null:e.text,this.zIndex_=e.zIndex}clone(){let t=this.getGeometry();return t&&typeof t==`object`&&(t=t.clone()),new e({geometry:t??void 0,fill:this.getFill()?.clone(),image:this.getImage()?.clone(),renderer:this.getRenderer()??void 0,stroke:this.getStroke()?.clone(),text:this.getText()?.clone(),zIndex:this.getZIndex()})}getRenderer(){return this.renderer_}setRenderer(e){this.renderer_=e}setHitDetectionRenderer(e){this.hitDetectionRenderer_=e}getHitDetectionRenderer(){return this.hitDetectionRenderer_}getGeometry(){return this.geometry_}getGeometryFunction(){return this.geometryFunction_}getFill(){return this.fill_}setFill(e){this.fill_=e}getImage(){return this.image_}setImage(e){this.image_=e}getStroke(){return this.stroke_}setStroke(e){this.stroke_=e}getText(){return this.text_}setText(e){this.text_=e}getZIndex(){return this.zIndex_}setGeometry(e){typeof e==`function`?this.geometryFunction_=e:typeof e==`string`?this.geometryFunction_=function(t){return t.get(e)}:e?e!==void 0&&(this.geometryFunction_=function(){return e}):this.geometryFunction_=Pg,this.geometry_=e}setZIndex(e){this.zIndex_=e}};function jg(e){let t;if(typeof e==`function`)t=e;else{let n;Array.isArray(e)?n=e:(U(typeof e.getZIndex==`function`,"Expected an `Style` or an array of `Style`"),n=[e]),t=function(){return n}}return t}var Mg=null;function Ng(e,t){if(!Mg){let e=new Eg({color:`rgba(255,255,255,0.4)`}),t=new kg({color:`#3399CC`,width:1.25});Mg=[new Ag({image:new Tg({fill:e,stroke:t,radius:5}),fill:e,stroke:t})]}return Mg}function Pg(e){return e.getGeometry()}var Fg=`#333`,Ig=class e{constructor(e){e||={},this.font_=e.font,this.rotation_=e.rotation,this.rotateWithView_=e.rotateWithView,this.keepUpright_=e.keepUpright,this.scale_=e.scale,this.scaleArray_=Bm(e.scale===void 0?1:e.scale),this.text_=e.text,this.textAlign_=e.textAlign,this.justify_=e.justify,this.repeat_=e.repeat,this.textBaseline_=e.textBaseline,this.fill_=e.fill===void 0?new Eg({color:Fg}):e.fill,this.maxAngle_=e.maxAngle===void 0?Math.PI/4:e.maxAngle,this.placement_=e.placement===void 0?`point`:e.placement,this.overflow_=!!e.overflow,this.stroke_=e.stroke===void 0?null:e.stroke,this.offsetX_=e.offsetX===void 0?0:e.offsetX,this.offsetY_=e.offsetY===void 0?0:e.offsetY,this.backgroundFill_=e.backgroundFill?e.backgroundFill:null,this.backgroundStroke_=e.backgroundStroke?e.backgroundStroke:null,this.padding_=e.padding===void 0?null:e.padding,this.declutterMode_=e.declutterMode}clone(){let t=this.getScale();return new e({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 Eg?this.getFill().clone():this.getFill(),stroke:this.getStroke()?.clone(),offsetX:this.getOffsetX(),offsetY:this.getOffsetY(),backgroundFill:this.getBackgroundFill()?.clone(),backgroundStroke:this.getBackgroundStroke()?.clone(),padding:this.getPadding()||void 0,declutterMode:this.getDeclutterMode()})}getOverflow(){return this.overflow_}getFont(){return this.font_}getMaxAngle(){return this.maxAngle_}getPlacement(){return this.placement_}getRepeat(){return this.repeat_}getOffsetX(){return this.offsetX_}getOffsetY(){return this.offsetY_}getFill(){return this.fill_}getRotateWithView(){return this.rotateWithView_}getKeepUpright(){return this.keepUpright_}getRotation(){return this.rotation_}getScale(){return this.scale_}getScaleArray(){return this.scaleArray_}getStroke(){return this.stroke_}getText(){return this.text_}getTextAlign(){return this.textAlign_}getJustify(){return this.justify_}getTextBaseline(){return this.textBaseline_}getBackgroundFill(){return this.backgroundFill_}getBackgroundStroke(){return this.backgroundStroke_}getPadding(){return this.padding_}getDeclutterMode(){return this.declutterMode_}setOverflow(e){this.overflow_=e}setFont(e){this.font_=e}setMaxAngle(e){this.maxAngle_=e}setOffsetX(e){this.offsetX_=e}setOffsetY(e){this.offsetY_=e}setPlacement(e){this.placement_=e}setRepeat(e){this.repeat_=e}setRotateWithView(e){this.rotateWithView_=e}setKeepUpright(e){this.keepUpright_=e}setFill(e){this.fill_=e}setRotation(e){this.rotation_=e}setScale(e){this.scale_=e,this.scaleArray_=Bm(e===void 0?1:e)}setStroke(e){this.stroke_=e}setText(e){this.text_=e}setTextAlign(e){this.textAlign_=e}setJustify(e){this.justify_=e}setTextBaseline(e){this.textBaseline_=e}setBackgroundFill(e){this.backgroundFill_=e}setBackgroundStroke(e){this.backgroundStroke_=e}setPadding(e){this.padding_=e}};function Lg(e){return!0}function Rg(e,t){t??=ih();let n=Vg(e,t),r=Eh();return function(e,i){if(r.properties=e.getPropertiesInternal()??{},r.resolution=i,t.featureId){let t=e.getId();t===void 0?r.featureId=null:r.featureId=t}if(t.geometryType){let t=e.getGeometry();t&&(r.geometryType=Th(t))}return n(r)}}function zg(e,t){t??=ih();let n=e.length,r=Array(n);for(let i=0;inull;r=t_(e,t+`fill-color`,n)}if(!r)return null;let i=new Eg;return function(e){let t=r(e);return t===mm?null:(i.setColor(t),i)}}function Wg(e,t,n){let r=Zg(e,t+`stroke-width`,n),i=t_(e,t+`stroke-color`,n);if(!r&&!i)return null;let a=Qg(e,t+`stroke-line-cap`,n),o=Qg(e,t+`stroke-line-join`,n),s=n_(e,t+`stroke-line-dash`,n),c=Zg(e,t+`stroke-line-dash-offset`,n),l=Zg(e,t+`stroke-miter-limit`,n),u=Zg(e,t+`stroke-offset`,n),d=new kg;return function(e){if(i){let t=i(e);if(t===mm)return null;d.setColor(t)}if(r&&d.setWidth(r(e)),a){let t=a(e);if(t!==`butt`&&t!==`round`&&t!==`square`)throw Error(`Expected butt, round, or square line cap`);d.setLineCap(t)}if(o){let t=o(e);if(t!==`bevel`&&t!==`round`&&t!==`miter`)throw Error(`Expected bevel, round, or miter line join`);d.setLineJoin(t)}return s&&d.setLineDash(s(e)),c&&d.setLineDashOffset(c(e)),l&&d.setMiterLimit(l(e)),u&&d.setOffset(u(e)),d}}function Gg(e,t){let n=`text-`,r=Qg(e,`text-value`,t);if(!r)return null;let i=Ug(e,n,t),a=Ug(e,`text-background-`,t),o=Wg(e,n,t),s=Wg(e,`text-background-`,t),c=Qg(e,`text-font`,t),l=Zg(e,`text-max-angle`,t),u=Zg(e,`text-offset-x`,t),d=Zg(e,`text-offset-y`,t),f=e_(e,`text-overflow`,t),p=Qg(e,`text-placement`,t),m=Zg(e,`text-repeat`,t),h=a_(e,`text-scale`,t),g=e_(e,`text-rotate-with-view`,t),_=Zg(e,`text-rotation`,t),v=Qg(e,`text-align`,t),y=Qg(e,`text-justify`,t),b=Qg(e,`text-baseline`,t),x=e_(e,`text-keep-upright`,t),S=n_(e,`text-padding`,t),C=new Ig({declutterMode:f_(e,`text-declutter-mode`)});return function(e){if(C.setText(r(e)),i&&C.setFill(i(e)),a&&C.setBackgroundFill(a(e)),o&&C.setStroke(o(e)),s&&C.setBackgroundStroke(s(e)),c&&C.setFont(c(e)),l&&C.setMaxAngle(l(e)),u&&C.setOffsetX(u(e)),d&&C.setOffsetY(d(e)),f&&C.setOverflow(f(e)),p){let t=p(e);if(t!==`point`&&t!==`line`)throw Error(`Expected point or line for text-placement`);C.setPlacement(t)}if(m&&C.setRepeat(m(e)),h&&C.setScale(h(e)),g&&C.setRotateWithView(g(e)),_&&C.setRotation(_(e)),v){let t=v(e);if(t!==`left`&&t!==`center`&&t!==`right`&&t!==`end`&&t!==`start`)throw Error(`Expected left, right, center, start, or end for text-align`);C.setTextAlign(t)}if(y){let t=y(e);if(t!==`left`&&t!==`right`&&t!==`center`)throw Error(`Expected left, right, or center for text-justify`);C.setJustify(t)}if(b){let t=b(e);if(t!==`bottom`&&t!==`top`&&t!==`middle`&&t!==`alphabetic`&&t!==`hanging`)throw Error(`Expected bottom, top, middle, alphabetic, or hanging for text-baseline`);C.setTextBaseline(t)}return S&&C.setPadding(S(e)),x&&C.setKeepUpright(x(e)),C}}function Kg(e,t){return`icon-src`in e?qg(e,t):`shape-points`in e?Jg(e,t):`circle-radius`in e?Yg(e,t):null}function qg(e,t){let n=`icon-src`,r=m_(Xg(e,n),n),i=r_(e,`icon-anchor`,t),a=a_(e,`icon-scale`,t),o=Zg(e,`icon-opacity`,t),s=r_(e,`icon-displacement`,t),c=Zg(e,`icon-rotation`,t),l=e_(e,`icon-rotate-with-view`,t),u=l_(e,`icon-anchor-origin`),d=u_(e,`icon-anchor-x-units`),f=u_(e,`icon-anchor-y-units`),p=Xg(e,`icon-color`),m,h=null;p!==void 0&&(Array.isArray(p)&&p.length>0&&typeof p[0]==`string`?h=t_(e,`icon-color`,t):m=g_(p,`icon-color`));let g=c_(e,`icon-cross-origin`),_=d_(e,`icon-offset`),v=l_(e,`icon-offset-origin`),y=o_(e,`icon-width`),b={src:r,anchorOrigin:u,anchorXUnits:d,anchorYUnits:f,crossOrigin:g,offset:_,offsetOrigin:v,height:o_(e,`icon-height`),width:y,size:s_(e,`icon-size`),declutterMode:f_(e,`icon-declutter-mode`)},x=null;return function(e){if(x)h&&x.setColor(h(e));else{let t=h?h(e):m;x=new Og(t===void 0?Object.assign({},b):Object.assign({},b,{color:t}))}return o&&x.setOpacity(o(e)),s&&x.setDisplacement(s(e)),c&&x.setRotation(c(e)),l&&x.setRotateWithView(l(e)),a&&x.setScale(a(e)),i&&x.setAnchor(i(e)),x}}function Jg(e,t){let n=`shape-`,r=`shape-points`,i=`shape-radius`,a=h_(Xg(e,r),r);if(!(i in e))throw Error(`Expected a number for ${i}`);let o=Zg(e,i,t),s=Xg(e,i),c=typeof s==`number`?s:5,l=`shape-radius2`,u=Zg(e,l,t),d=Xg(e,l),f=typeof d==`number`?d:void 0,p=Ug(e,n,t),m=Wg(e,n,t),h=a_(e,`shape-scale`,t),g=r_(e,`shape-displacement`,t),_=Zg(e,`shape-rotation`,t),v=e_(e,`shape-rotate-with-view`,t),y=new wg({points:a,radius:c,radius2:f,angle:o_(e,`shape-angle`),declutterMode:f_(e,`shape-declutter-mode`)});return function(e){return o&&y.setRadius(o(e)),u&&y.setRadius2(u(e)),p&&y.setFill(p(e)),m&&y.setStroke(m(e)),g&&y.setDisplacement(g(e)),_&&y.setRotation(_(e)),v&&y.setRotateWithView(v(e)),h&&y.setScale(h(e)),y}}function Yg(e,t){let n=`circle-`,r=Ug(e,n,t),i=Wg(e,n,t),a=Zg(e,`circle-radius`,t),o=a_(e,`circle-scale`,t),s=r_(e,`circle-displacement`,t),c=Zg(e,`circle-rotation`,t),l=e_(e,`circle-rotate-with-view`,t),u=new Tg({radius:5,declutterMode:f_(e,`circle-declutter-mode`)});return function(e){return a&&u.setRadius(a(e)),r&&u.setFill(r(e)),i&&u.setStroke(i(e)),s&&u.setDisplacement(s(e)),c&&u.setRotation(c(e)),l&&u.setRotateWithView(l(e)),o&&u.setScale(o(e)),u}}function Xg(e,t){if(!(t in e))return;let n=e[t];return n===void 0?void 0:n}function Zg(e,t,n){let r=Xg(e,t);if(r===void 0)return;let i=Dh(r,q,n);return function(e){return h_(i(e),t)}}function Qg(e,t,n){let r=Xg(e,t);if(r===void 0)return null;let i=Dh(r,Um,n);return function(e){return m_(i(e),t)}}function $g(e,t,n){let r=Qg(e,t+`pattern-src`,n),i=i_(e,t+`pattern-offset`,n),a=i_(e,t+`pattern-size`,n),o=t_(e,t+`color`,n);return function(e){return r?{src:r(e),offset:i?i(e):null,size:a?a(e):null,color:o?o(e):null}:null}}function e_(e,t,n){let r=Xg(e,t);if(r===void 0)return null;let i=Dh(r,Hm,n);return function(e){let n=i(e);if(typeof n!=`boolean`)throw Error(`Expected a boolean for ${t}`);return n}}function t_(e,t,n){let r=Xg(e,t);if(r===void 0)return null;let i=Dh(r,Wm,n);return function(e){return g_(i(e),t)}}function n_(e,t,n){let r=Xg(e,t);if(r===void 0)return null;if(Array.isArray(r)&&(r.length===0||typeof r[0]!=`string`)){let e=r.map((e,r)=>{if(typeof e==`number`)return()=>e;let i=Dh(e,q,n);return function(e){return h_(i(e),`${t}[${r}]`)}});return function(t){let n=Array(e.length);for(let r=0;r4)throw Error(`Expected a color with 3 or 4 values for ${t}`);return n}function __(e,t){let n=p_(e,t);if(n.length!==2)throw Error(`Expected an array of two numbers for ${t}`);return n}function v_(e,t){return typeof e==`number`?e:__(e,t)}var y_={RENDER_ORDER:`renderOrder`},b_=class extends Jp{constructor(e){e||={};let t=Object.assign({},e);delete t.style,delete t.renderBuffer,delete t.updateWhileAnimating,delete t.updateWhileInteracting,super(t),this.declutter_=e.declutter?String(e.declutter):void 0,this.renderBuffer_=e.renderBuffer===void 0?100:e.renderBuffer,this.style_=null,this.styleFunction_=void 0,this.setStyle(e.style),this.updateWhileAnimating_=e.updateWhileAnimating!==void 0&&e.updateWhileAnimating,this.updateWhileInteracting_=e.updateWhileInteracting!==void 0&&e.updateWhileInteracting}getDeclutter(){return this.declutter_}getFeatures(e){return super.getFeatures(e)}getRenderBuffer(){return this.renderBuffer_}getRenderOrder(){return this.get(y_.RENDER_ORDER)}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}getUpdateWhileAnimating(){return this.updateWhileAnimating_}getUpdateWhileInteracting(){return this.updateWhileInteracting_}renderDeclutter(e,t){let n=this.getDeclutter();if(!n)return;e.declutter||={},n in e.declutter||(e.declutter[n]=new $p(9));let r=this.getRenderer();r&&r.renderDeclutter(e,t)}setRenderOrder(e){this.set(y_.RENDER_ORDER,e)}setStyle(e){this.style_=e===void 0?Ng:e??null;let t=x_(e);this.styleFunction_=e===null||t===null?void 0:jg(t),this.changed()}setDeclutter(e){this.declutter_=e?String(e):void 0,this.changed()}};function x_(e){if(e===void 0)return Ng;if(!e)return null;if(typeof e==`function`||e instanceof Ag)return e;if(Array.isArray(e)&&e.length===0)return[];if(Array.isArray(e)&&e[0]instanceof Ag){let t=e.length,n=Array(t);for(let r=0;r=0;--i){let a=m[i],d=a.layer;if(d.hasRenderer()&&Yp(a,l)&&o.call(s,d)){let i=d.getRenderer(),o=d.getSource();if(i&&o){let s=o.getWrapX()?f:e,l=u.bind(null,a.managed);_[0]=s[0]+p[r][0],_[1]=s[1]+p[r][1],c=i.forEachFeatureAtCoordinate(_,t,n,l,g)}if(c)return c}}if(g.length===0)return;let v=1/g.length;return g.forEach((e,t)=>e.distanceSq+=t*v),g.sort((e,t)=>e.distanceSq-t.distanceSq),g.some(e=>c=e.callback(e.feature,e.layer,e.geometry)),c}hasFeatureAtCoordinate(e,t,n,r,i,a){return this.forEachFeatureAtCoordinate(e,t,n,r,qs,this,i,a)!==void 0}getMap(){return this.map_}renderFrame(e){B()}scheduleExpireIconCache(e){Jh.canExpireCache()&&e.postRenderFunctions.push(w_)}};function w_(e,t){Jh.expire()}var T_=class extends C_{constructor(e){super(e),this.fontChangeListenerKey_=L(lg,Ms.PROPERTYCHANGE,e.redrawText,e),this.element_=mc?Qf():document.createElement(`div`);let t=this.element_.style;t.position=`absolute`,t.width=`100%`,t.height=`100%`,t.zIndex=`0`,this.element_.className=Rf+` ol-layers`;let n=e.getViewport();n&&n.insertBefore(this.element_,n.firstChild||null),this.children_=[],this.renderedVisible_=!0}dispatchRenderEvent(e,t){let n=this.getMap();if(n.hasListener(e)){let r=new S_(e,void 0,t);n.dispatchEvent(r)}}disposeInternal(){R(this.fontChangeListenerKey_),this.element_.remove(),super.disposeInternal()}renderFrame(e){if(!e){this.renderedVisible_&&=(this.element_.style.display=`none`,!1);return}this.calculateMatrices2D(e),this.dispatchRenderEvent(qp.PRECOMPOSE,e);let t=e.layerStatesArray.sort((e,t)=>e.zIndex-t.zIndex);t.some(e=>e.layer instanceof b_&&e.layer.getDeclutter())&&(e.declutter={});let n=e.viewState;this.children_.length=0;let r=this.getMap().getTargetElement(),i;$f(r)&&(i=r.getContext(`2d`),i.setTransform(1,0,0,1,0,0),i.clearRect(0,0,r.width,r.height));let a=[],o=i?r:null;for(let r=0,i=t.length;r0)&&(i.fillStyle=n,i.fillRect(0,0,i.canvas.width,i.canvas.height)),!$f(t)||t.width===0)continue;i.save();let r=e.style.opacity||t.style.opacity;i.globalAlpha=r===``?1:Number(r);let a=t.style.transform;if(a)i.transform(...wd(a));else{let e=parseFloat(t.style.width)/t.width,n=parseFloat(t.style.height)/t.height;i.transform(e,0,0,n,0,0)}i.drawImage(t,0,0),i.restore()}this.dispatchRenderEvent(qp.POSTCOMPOSE,e),this.renderedVisible_||=(this.element_.style.display=``,!0),this.scheduleExpireIconCache(e)}declutter(e,t){if(e.declutter){for(let n=t.length-1;n>=0;--n){let r=t[n],i=r.layer;i.getDeclutter()&&i.renderDeclutter(e,r)}t.forEach(t=>t.layer?.renderDeferred(e))}}};function E_(e){e instanceof Jp?e.setMapInternal(null):e instanceof Kp&&e.getLayers().forEach(E_)}function D_(e,t){if(e instanceof Jp)e.setMapInternal(t);else if(e instanceof Kp){let n=e.getLayers().getArray();for(let e=0,r=n.length;ethis.updateSize())),this.controls=t.controls||(mc?new oc:ip()),this.interactions=t.interactions||(mc?new oc:Vp({onFocusOnly:!0})),this.overlays_=t.overlays,this.overlayIdIndex_={},this.renderer_=null,this.postRenderFunctions_=[],this.tileQueue_=new Cc(this.getTilePriority.bind(this),this.handleTileChange_.bind(this)),this.addChangeListener(bc.LAYERGROUP,this.handleLayerGroupChanged_),this.addChangeListener(bc.VIEW,this.handleViewChanged_),this.addChangeListener(bc.SIZE,this.handleSizeChanged_),this.addChangeListener(bc.TARGET,this.handleTargetChanged_),this.setProperties(t.values);let n=this;e.view&&!(e.view instanceof Af)&&e.view.then(function(e){n.setView(new Af(e))}),this.controls.addEventListener(js.ADD,(e=>{e.element.setMap(this)})),this.controls.addEventListener(js.REMOVE,(e=>{e.element.setMap(null)})),this.interactions.addEventListener(js.ADD,(e=>{e.element.setMap(this)})),this.interactions.addEventListener(js.REMOVE,(e=>{e.element.setMap(null)})),this.overlays_.addEventListener(js.ADD,(e=>{this.addOverlayInternal_(e.element)})),this.overlays_.addEventListener(js.REMOVE,(e=>{let t=e.element.getId();t!==void 0&&delete this.overlayIdIndex_[t.toString()],e.element.setMap(null)})),this.controls.forEach(e=>{e.setMap(this)}),this.interactions.forEach(e=>{e.setMap(this)}),this.overlays_.forEach(this.addOverlayInternal_.bind(this))}addControl(e){this.getControls().push(e)}addInteraction(e){this.getInteractions().push(e)}addLayer(e){this.getLayerGroup().getLayers().push(e)}handleLayerAdd_(e){D_(e.layer,this)}addOverlay(e){this.getOverlays().push(e)}addOverlayInternal_(e){let t=e.getId();t!==void 0&&(this.overlayIdIndex_[t.toString()]=e),e.setMap(this)}disposeInternal(){this.controls.clear(),this.interactions.clear(),this.overlays_.clear(),this.resizeObserver_?.disconnect(),this.setTarget(null),super.disposeInternal()}forEachFeatureAtPixel(e,t,n){if(!this.frameState_||!this.renderer_)return;let r=this.getCoordinateFromPixelInternal(e);n=n===void 0?{}:n;let i=n.hitTolerance===void 0?0:n.hitTolerance,a=n.layerFilter===void 0?qs:n.layerFilter,o=n.checkWrapped!==!1;return this.renderer_.forEachFeatureAtCoordinate(r,this.frameState_,i,o,t,null,a,null)}getFeaturesAtPixel(e,t){let n=[];return this.forEachFeatureAtPixel(e,function(e){n.push(e)},t),n}getAllLayers(){let e=[];function t(n){n.forEach(function(n){n instanceof Kp?t(n.getLayers()):e.push(n)})}return t(this.getLayers()),e}hasFeatureAtPixel(e,t){if(!this.frameState_||!this.renderer_)return!1;let n=this.getCoordinateFromPixelInternal(e);t=t===void 0?{}:t;let r=t.layerFilter===void 0?qs:t.layerFilter,i=t.hitTolerance===void 0?0:t.hitTolerance,a=t.checkWrapped!==!1;return this.renderer_.hasFeatureAtCoordinate(n,this.frameState_,i,a,r,null)}getEventCoordinate(e){return this.getCoordinateFromPixel(this.getEventPixel(e))}getEventCoordinateInternal(e){return this.getCoordinateFromPixelInternal(this.getEventPixel(e))}getEventPixel(e){let t=this.viewport_.getBoundingClientRect(),n=this.getSize(),r=t.width/n[0],i=t.height/n[1],a=`changedTouches`in e?e.changedTouches[0]:e;return[(a.clientX-t.left)/r,(a.clientY-t.top)/i]}getTarget(){return this.get(bc.TARGET)}getTargetElement(){return this.targetElement_}getCoordinateFromPixel(e,t){let n=cd(this.getCoordinateFromPixelInternal(e),this.getView().getProjection());return t?.wrapX&&n&&kl(n,sd()||this.getView().getProjection()),n}getCoordinateFromPixelInternal(e){let t=this.frameState_;return t?vd(t.pixelToCoordinateTransform,e.slice()):null}getControls(){return this.controls}getOverlays(){return this.overlays_}getOverlayById(e){let t=this.overlayIdIndex_[e.toString()];return t===void 0?null:t}getInteractions(){return this.interactions}getLayerGroup(){return this.get(bc.LAYERGROUP)}setLayers(e){let t=this.getLayerGroup();if(e instanceof oc){t.setLayers(e);return}let n=t.getLayers();n.clear(),n.extend(e)}getLayers(){return this.getLayerGroup().getLayers()}updateRenderComplete_(){this.renderComplete_=(this.hasListener(yc.LOADSTART)||this.hasListener(yc.LOADEND)||this.hasListener(qp.RENDERCOMPLETE))&&!this.tileQueue_.getTilesLoading()&&!this.tileQueue_.getCount()&&!this.getLoadingOrNotReady()}getLoadingOrNotReady(){let e=this.getLayerGroup().getLayerStatesArray();for(let t=0,n=e.length;t=0;n--){let r=t[n];if(r.getMap()===this&&r.getActive()&&this.getTargetElement()&&(!r.handleEvent(e)||e.propagationStopped))break}}}handlePostRender(){let e=this.frameState_,t=this.tileQueue_;if(!t.isEmpty()){let n=this.maxTilesLoading_,r=n,i=e?e.viewHints:void 0;if(i&&(i[Tc.ANIMATING]||i[Tc.INTERACTING])){let t=Date.now()-e.time>8;n=t?0:8,r=t?0:2}if(t.getTilesLoading(){this.postRenderTimeoutHandle_=void 0,this.handlePostRender()},0)}setLayerGroup(e){let t=this.getLayerGroup();t&&this.handleLayerRemove_(new Wp(`removelayer`,t)),this.set(bc.LAYERGROUP,e)}setSize(e){this.set(bc.SIZE,e)}setTarget(e){this.set(bc.TARGET,e)}setView(e){if(!e||e instanceof Af){this.set(bc.VIEW,e);return}this.set(bc.VIEW,new Af);let t=this;e.then(function(e){t.setView(new Af(e))})}updateSize(){let e=this.getTargetElement(),t;if(e){let n,r;if($f(e)){let t=e.getContext(`2d`).getTransform();n=e.width/t.a,r=e.height/t.d}else{let t=getComputedStyle(e);n=e.offsetWidth-parseFloat(t.borderLeftWidth)-parseFloat(t.paddingLeft)-parseFloat(t.paddingRight)-parseFloat(t.borderRightWidth),r=e.offsetHeight-parseFloat(t.borderTopWidth)-parseFloat(t.paddingTop)-parseFloat(t.paddingBottom)-parseFloat(t.borderBottomWidth)}!isNaN(n)&&!isNaN(r)&&(t=[Math.max(0,n),Math.max(0,r)],!Rm(t)&&(e.offsetWidth||e.offsetHeight||e.getClientRects().length)&&Bl(`No map visible because the map container's width or height are 0.`))}let n=this.getSize();t&&(!n||!Us(t,n))&&(this.updateViewportSize_(t),this.setSize(t))}updateViewportSize_(e){let t=this.getView();t&&t.setViewportSize(e)}};function k_(e){let t=null;e.keyboardEventTarget!==void 0&&(t=typeof e.keyboardEventTarget==`string`?document.getElementById(e.keyboardEventTarget):e.keyboardEventTarget);let n={},r=e.layers&&typeof e.layers.getLayers==`function`?e.layers:new Kp({layers:e.layers});n[bc.LAYERGROUP]=r,n[bc.TARGET]=e.target,n[bc.VIEW]=e.view instanceof Af?e.view:new Af;let i;e.controls!==void 0&&(Array.isArray(e.controls)?i=new oc(e.controls.slice()):(U(typeof e.controls.getArray==`function`,"Expected `controls` to be an array or an `ol/Collection.js`"),i=e.controls));let a;e.interactions!==void 0&&(Array.isArray(e.interactions)?a=new oc(e.interactions.slice()):(U(typeof e.interactions.getArray==`function`,"Expected `interactions` to be an array or an `ol/Collection.js`"),a=e.interactions));let o;return e.overlays===void 0?o=new oc:Array.isArray(e.overlays)?o=new oc(e.overlays.slice()):(U(typeof e.overlays.getArray==`function`,"Expected `overlays` to be an array or an `ol/Collection.js`"),o=e.overlays),{controls:i,interactions:a,keyboardEventTarget:t,overlays:o,values:n}}var A_=class e extends rc{constructor(e){if(super(),this.on,this.once,this.un,this.id_=void 0,this.geometryName_=`geometry`,this.style_=null,this.styleFunction_=void 0,this.geometryChangeKey_=null,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),e){if(typeof e.getSimplifiedGeometry==`function`){let t=e;this.setGeometry(t)}else{let t=e;this.setProperties(t)}}}clone(){let t=new e,n=this.geometryName_;t.setGeometryName(n);let r=this.getPropertiesInternal();if(r){let e=this.getGeometry();for(let i in r)i===n&&e?t.set(i,e.clone()):t.set(i,r[i],!0)}let 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_&&=(R(this.geometryChangeKey_),null);let e=this.getGeometry();e&&(this.geometryChangeKey_=L(e,z.CHANGE,this.handleGeometryChange_,this)),this.changed()}setGeometry(e){this.set(this.geometryName_,e)}setStyle(e){this.style_=e??null,this.styleFunction_=e?j_(e):void 0,this.changed()}setId(e){this.id_=e,this.changed()}setGeometryName(e){e!==this.geometryName_&&(this.removeChangeListener(this.geometryName_,this.handleGeometryChanged_),this.geometryName_=e,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),this.handleGeometryChanged_())}};function j_(e){if(typeof e==`function`)return e;let t;return Array.isArray(e)?t=e:(U(typeof e.getZIndex==`function`,"Expected an `ol/style/Style` or an array of `ol/style/Style.js`"),t=[e]),function(){return t}}var M_=class extends $s{constructor(e,t,n){super(),n||={},this.tileCoord=e,this.state=t,this.key=``,this.transition_=n.transition===void 0?250:n.transition,this.transitionStarts_={},this.interpolate=!!n.interpolate}changed(){this.dispatchEvent(z.CHANGE)}release(){this.setState(H.EMPTY)}getKey(){return this.key+`/`+this.tileCoord}getTileCoord(){return this.tileCoord}getState(){return this.state}setState(e){if(this.state!==H.EMPTY){if(this.state!==H.ERROR&&this.state>e)throw Error(`Tile load sequence violation`);this.state=e,this.changed()}}load(){B()}getAlpha(e,t){if(!this.transition_)return 1;let n=this.transitionStarts_[e];if(!n)n=t,this.transitionStarts_[e]=n;else if(n===-1)return 1;let r=t-n+1e3/60;return r>=this.transition_?1:Nl(r/this.transition_)}inTransition(e){return this.transition_?this.transitionStarts_[e]!==-1:!1}endTransition(e){this.transition_&&(this.transitionStarts_[e]=-1)}disposeInternal(){this.release(),super.disposeInternal()}};function N_(e){return e instanceof Image||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageBitmap?e:null}function P_(e){return e instanceof Uint8Array||e instanceof Uint8ClampedArray||e instanceof Float32Array||e instanceof DataView?e:null}var F_=Error(`disposed`),I_=[256,256],L_=class extends M_{constructor(e){let t=H.IDLE;super(e.tileCoord,t,{transition:e.transition,interpolate:e.interpolate}),this.loader_=e.loader,this.data_=null,this.error_=null,this.size_=e.size||null,this.controller_=e.controller||null}getSize(){if(this.size_)return this.size_;let e=N_(this.data_);return e?[e.width,e.height]:I_}getData(){return this.data_}getError(){return this.error_}load(){if(this.state!==H.IDLE&&this.state!==H.ERROR)return;this.state=H.LOADING,this.changed();let e=this;this.loader_().then(function(t){e.data_=t,e.state=H.LOADED,e.changed()}).catch(function(t){e.error_=t,e.state=H.ERROR,e.changed()})}disposeInternal(){this.controller_&&=(this.controller_.abort(F_),null),super.disposeInternal()}},R_=class extends M_{constructor(e,t,n,r,i,a){super(e,t,a),this.crossOrigin_=r?.crossOrigin,this.referrerPolicy_=r?.referrerPolicy,this.src_=n,this.key=n,this.image_,mc?this.image_=new OffscreenCanvas(1,1):(this.image_=new Image,this.crossOrigin_!==null&&this.crossOrigin_!==void 0&&(this.image_.crossOrigin=this.crossOrigin_),this.referrerPolicy_!==void 0&&(this.image_.referrerPolicy=this.referrerPolicy_)),this.unlisten_=null,this.tileLoadFunction_=i}getImage(){return this.image_}setImage(e){this.image_=e,this.state=H.LOADED,this.unlistenImage_(),this.changed()}getCrossOrigin(){return this.crossOrigin_??null}getReferrerPolicy(){return this.referrerPolicy_}handleImageError_(){this.state=H.ERROR,this.unlistenImage_(),this.image_=z_(),this.changed()}handleImageLoad_(){if(mc)this.state=H.LOADED;else{let e=this.image_;this.state=e.naturalWidth&&e.naturalHeight?H.LOADED:H.EMPTY}this.unlistenImage_(),this.changed()}load(){if(this.state==H.ERROR&&(this.state=H.IDLE,this.image_=new Image,this.crossOrigin_!==null&&this.crossOrigin_!==void 0&&(this.image_.crossOrigin=this.crossOrigin_),this.referrerPolicy_!==void 0&&(this.image_.referrerPolicy=this.referrerPolicy_)),this.state==H.IDLE){this.state=H.LOADING,this.changed(),this.tileLoadFunction_(this,this.src_);let e=this.image_;e&&(this.unlisten_=Uh(e,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this)))}}unlistenImage_(){this.unlisten_&&=(this.unlisten_(),null)}disposeInternal(){this.unlistenImage_(),this.image_=null,super.disposeInternal()}};function z_(){let e=Gf(1,1);return e.fillStyle=`rgba(0,0,0,0)`,e.fillRect(0,0,1,1),e.canvas}var B_=class{constructor(e,t,n,r){this.minX=e,this.maxX=t,this.minY=n,this.maxY=r}contains(e){return this.containsXY(e[1],e[2])}containsTileRange(e){return this.minX<=e.minX&&e.maxX<=this.maxX&&this.minY<=e.minY&&e.maxY<=this.maxY}containsXY(e,t){return this.minX<=e&&e<=this.maxX&&this.minY<=t&&t<=this.maxY}equals(e){return this.minX==e.minX&&this.minY==e.minY&&this.maxX==e.maxX&&this.maxY==e.maxY}extend(e){e.minXthis.maxX&&(this.maxX=e.maxX),e.minYthis.maxY&&(this.maxY=e.maxY)}getHeight(){return this.maxY-this.minY+1}getSize(){return[this.getWidth(),this.getHeight()]}getWidth(){return this.maxX-this.minX+1}intersects(e){return this.minX<=e.maxX&&this.maxX>=e.minX&&this.minY<=e.maxY&&this.maxY>=e.minY}};function V_(e,t,n,r,i){return i===void 0?new B_(e,t,n,r):(i.minX=e,i.maxX=t,i.minY=n,i.maxY=r,i)}var H_,U_=[];function W_(e,t,n,r,i){e.beginPath(),e.moveTo(0,0),e.lineTo(t,n),e.lineTo(r,i),e.closePath(),e.save(),e.clip(),e.fillRect(0,0,Math.max(t,r)+1,Math.max(n,i)),e.restore()}function G_(e,t){return Math.abs(e[t*4]-210)>2||Math.abs(e[t*4+3]-191.25)>2}function K_(){if(H_===void 0){let e=Gf(6,6,U_);e.globalCompositeOperation=`lighter`,e.fillStyle=`rgba(210, 0, 0, 0.75)`,W_(e,4,5,4,0),W_(e,4,5,0,5);let t=e.getImageData(0,0,3,3).data;H_=G_(t,0)||G_(t,4)||G_(t,8),Jf(e),U_.push(e.canvas)}return H_}function q_(e,t,n,r){let i=ad(n,t,e),a=Yu(t,r,n),o=t.getMetersPerUnit();o!==void 0&&(a*=o);let s=e.getMetersPerUnit();s!==void 0&&(a/=s);let c=e.getExtent();if(!c||Gc(c,i)){let t=Yu(e,a,i)/a;isFinite(t)&&t>0&&(a/=t)}return a}function J_(e,t,n,r){let i=q_(e,t,ll(n),r);return(!isFinite(i)||i<=0)&&al(n,function(n){return i=q_(e,t,n,r),isFinite(i)&&i>0}),i}function Y_(e,t,n,r,i,a,o,s,c,l,u,d,f,p){let m=Gf(Math.round(n*e),Math.round(n*t),U_);if(d||(m.imageSmoothingEnabled=!1),c.length===0)return m.canvas;m.scale(n,n);function h(e){return Math.round(e*n)/n}m.globalCompositeOperation=`lighter`;let g=Yc();c.forEach(function(e,t,n){tl(g,e.extent)});let _,v=n/r,y=(d?1:1+2**-24)/v;if(!f||c.length!==1||l!==0){let e=Gf(Math.round(G(g)*v),Math.round(pl(g)*v),U_);if(_=e,d||(e.imageSmoothingEnabled=!1),i&&p){let t=(i[0]-g[0])*v,n=-(i[3]-g[3])*v,r=G(i)*v,a=pl(i)*v;e.rect(t,n,r,a),e.clip()}c.forEach(function(t,n,r){if(t.image.width>0&&t.image.height>0){if(t.clipExtent){e.save();let n=(t.clipExtent[0]-g[0])*v,r=-(t.clipExtent[3]-g[3])*v,i=G(t.clipExtent)*v,a=pl(t.clipExtent)*v;e.rect(d?n:Math.round(n),d?r:Math.round(r),d?i:Math.round(n+i)-Math.round(n),d?a:Math.round(r+a)-Math.round(r)),e.clip()}let n=(t.extent[0]-g[0])*v,r=-(t.extent[3]-g[3])*v,i=G(t.extent)*v,a=pl(t.extent)*v;e.drawImage(t.image,l,l,t.image.width-2*l,t.image.height-2*l,d?n:Math.round(n),d?r:Math.round(r),d?i:Math.round(n+i)-Math.round(n),d?a:Math.round(r+a)-Math.round(r)),t.clipExtent&&e.restore()}})}let b=gl(o);return s.getTriangles().forEach(function(e,t,n){let r=e.source,i=e.target,o=r[0][0],s=r[0][1],l=r[1][0],u=r[1][1],f=r[2][0],p=r[2][1],v=h((i[0][0]-b[0])/a),x=h(-(i[0][1]-b[1])/a),S=h((i[1][0]-b[0])/a),C=h(-(i[1][1]-b[1])/a),w=h((i[2][0]-b[0])/a),T=h(-(i[2][1]-b[1])/a),E=o,D=s;o=0,s=0,l-=E,u-=D,f-=E,p-=D;let O=kc([[l,u,0,0,S-v],[f,p,0,0,w-v],[0,0,l,u,C-x],[0,0,f,p,T-x]]);if(!O)return;if(m.save(),m.beginPath(),K_()||!d){m.moveTo(S,C);let e=v-S,t=x-C;for(let n=0;n<4;n++)m.lineTo(S+h((n+1)*e/4),C+h(n*t/3)),n!=3&&m.lineTo(S+h((n+1)*e/4),C+h((n+1)*t/3));m.lineTo(w,T)}else m.moveTo(S,C),m.lineTo(v,x),m.lineTo(w,T);m.clip(),m.transform(O[0],O[2],O[1],O[3],v,x),m.translate(g[0]-E,g[3]-D);let k;if(_)k=_.canvas,m.scale(y,-y);else{let e=c[0],t=e.extent;k=e.image,m.scale(G(t)/k.width,-pl(t)/k.height)}m.drawImage(k,0,0),m.restore()}),_&&(Jf(_),U_.push(_.canvas)),u&&(m.save(),m.globalCompositeOperation=`source-over`,m.strokeStyle=`black`,m.lineWidth=1,s.getTriangles().forEach(function(e,t,n){let r=e.target,i=(r[0][0]-b[0])/a,o=-(r[0][1]-b[1])/a,s=(r[1][0]-b[0])/a,c=-(r[1][1]-b[1])/a,l=(r[2][0]-b[0])/a,u=-(r[2][1]-b[1])/a;m.beginPath(),m.moveTo(s,c),m.lineTo(i,o),m.lineTo(l,u),m.closePath(),m.stroke()}),m.restore()),m.canvas}var X_=10,Z_=.25,Q_=class{constructor(e,t,n,r,i,a,o){this.sourceProj_=e,this.targetProj_=t;let s={},c=o?$u(e=>vd(o,ad(e,this.targetProj_,this.sourceProj_))):id(this.targetProj_,this.sourceProj_);this.transformInv_=function(e){let t=e[0]+`/`+e[1];return s[t]||(s[t]=c(e)),s[t]},this.maxSourceExtent_=r,this.errorThresholdSquared_=i*i,this.triangles_=[],this.wrapsXInSource_=!1,this.canWrapXInSource_=this.sourceProj_.canWrapX()&&!!r&&!!this.sourceProj_.getExtent()&&G(r)>=G(this.sourceProj_.getExtent()),this.sourceWorldWidth_=this.sourceProj_.getExtent()?G(this.sourceProj_.getExtent()):void 0,this.targetWorldWidth_=this.targetProj_.getExtent()?G(this.targetProj_.getExtent()):void 0;let l=gl(n),u=_l(n),d=cl(n),f=sl(n),p=this.transformInv_(l),m=this.transformInv_(u),h=this.transformInv_(d),g=this.transformInv_(f),_=X_+(a?Math.max(0,Math.ceil(Math.log2(ol(n)/(a*a*256*256)))):0);if(this.addQuad_(l,u,d,f,p,m,h,g,_),this.wrapsXInSource_){let e=this.sourceWorldWidth_;if(!e)return;let t=1/0;this.triangles_.forEach(function(e,n,r){t=Math.min(t,e.source[0][0],e.source[1][0],e.source[2][0])}),this.triangles_.forEach(n=>{if(Math.max(n.source[0][0],n.source[1][0],n.source[2][0])-t>e/2){let r=[[n.source[0][0],n.source[0][1]],[n.source[1][0],n.source[1][1]],[n.source[2][0],n.source[2][1]]];r[0][0]-t>e/2&&(r[0][0]-=e),r[1][0]-t>e/2&&(r[1][0]-=e),r[2][0]-t>e/2&&(r[2][0]-=e);let i=Math.min(r[0][0],r[1][0],r[2][0]);Math.max(r[0][0],r[1][0],r[2][0])-i.5&&d<1,p=!1;if(c>0&&(this.targetProj_.isGlobal()&&this.targetWorldWidth_&&(p=G(Vc([e,t,n,r]))/this.targetWorldWidth_>Z_||p),!f&&this.sourceProj_.isGlobal()&&d&&(p=d>Z_||p)),!p&&this.maxSourceExtent_&&isFinite(l[0])&&isFinite(l[1])&&isFinite(l[2])&&isFinite(l[3])&&!vl(l,this.maxSourceExtent_))return;let m=0;if(!p&&(!isFinite(i[0])||!isFinite(i[1])||!isFinite(a[0])||!isFinite(a[1])||!isFinite(o[0])||!isFinite(o[1])||!isFinite(s[0])||!isFinite(s[1]))){if(c>0)p=!0;else if(m=(!isFinite(i[0])||!isFinite(i[1])?8:0)+(!isFinite(a[0])||!isFinite(a[1])?4:0)+(!isFinite(o[0])||!isFinite(o[1])?2:0)+ +(!isFinite(s[0])||!isFinite(s[1])),m!=1&&m!=2&&m!=4&&m!=8)return}if(c>0){if(!p){let t=[(e[0]+n[0])/2,(e[1]+n[1])/2],r=this.transformInv_(t),a;if(f){let e=u;a=(Mc(i[0],e)+Mc(o[0],e))/2-Mc(r[0],e)}else a=(i[0]+o[0])/2-r[0];let s=(i[1]+o[1])/2-r[1];p=a*a+s*s>this.errorThresholdSquared_}if(p){if(Math.abs(e[0]-n[0])<=Math.abs(e[1]-n[1])){let l=[(t[0]+n[0])/2,(t[1]+n[1])/2],u=this.transformInv_(l),d=[(r[0]+e[0])/2,(r[1]+e[1])/2],f=this.transformInv_(d);this.addQuad_(e,t,l,d,i,a,u,f,c-1),this.addQuad_(d,l,n,r,f,u,o,s,c-1)}else{let l=[(e[0]+t[0])/2,(e[1]+t[1])/2],u=this.transformInv_(l),d=[(n[0]+r[0])/2,(n[1]+r[1])/2],f=this.transformInv_(d);this.addQuad_(e,l,d,r,i,u,f,s,c-1),this.addQuad_(l,t,n,d,u,a,o,f,c-1)}return}}if(f){if(!this.canWrapXInSource_)return;this.wrapsXInSource_=!0}m&11||this.addTriangle_(e,n,r,i,o,s),m&14||this.addTriangle_(e,n,t,i,o,a),m&&(m&13||this.addTriangle_(t,r,e,a,s,i),m&7||this.addTriangle_(t,r,n,a,s,o))}calculateSourceExtent(){let e=Yc();return this.triangles_.forEach(function(t,n,r){let i=t.source;nl(e,i[0]),nl(e,i[1]),nl(e,i[2])}),e}getTriangles(){return this.triangles_}},$_=.5,ev=class extends M_{constructor(e,t,n,r,i,a,o,s,c,l,u,d){super(i,H.IDLE,d),this.renderEdges_=u!==void 0&&u,this.pixelRatio_=o,this.gutter_=s,this.canvas_=null,this.sourceTileGrid_=t,this.targetTileGrid_=r,this.wrappedTileCoord_=a||i,this.sourceTiles_=[],this.sourcesListenerKeys_=null,this.sourceZ_=0,this.clipExtent_=e.canWrapX()&&e.getExtent()||void 0;let f=r.getTileCoordExtent(this.wrappedTileCoord_),p=this.targetTileGrid_.getExtent(),m=this.sourceTileGrid_.getExtent(),h=p?ml(f,p):f;if(ol(h)===0){this.state=H.EMPTY;return}let g=e.getExtent();g&&(m=m?ml(m,g):g);let _=r.getResolution(this.wrappedTileCoord_[0]),v=J_(e,n,h,_);if(!isFinite(v)||v<=0){this.state=H.EMPTY;return}let y=l===void 0?$_:l;if(this.triangulation_=new Q_(e,n,h,m||void 0,v*y,_),this.triangulation_.getTriangles().length===0){this.state=H.EMPTY;return}this.sourceZ_=t.getZForResolution(v);let b=this.triangulation_.calculateSourceExtent();if(m&&(e.canWrapX()?(b[1]=W(b[1],m[1],m[3]),b[3]=W(b[3],m[1],m[3])):b=ml(b,m)),!ol(b))this.state=H.EMPTY;else{let n=0,r=0;e.canWrapX()&&(n=G(g),r=Math.floor((b[0]-g[0])/n)),Cl(b.slice(),e,!0).forEach(e=>{let i=t.getTileRangeForExtentAndZ(e,this.sourceZ_);for(let e=i.minX;e<=i.maxX;e++)for(let t=i.minY;t<=i.maxY;t++){let i=r*n;this.sourceTiles_.push({getTile:()=>c(this.sourceZ_,e,t,o),offset:i})}++r}),this.sourceTiles_.length===0&&(this.state=H.EMPTY)}}getImage(){return this.canvas_}reproject_(){let e=[];if(this.sourceTiles_.forEach(t=>{let n=t.tile;if(n&&n.getState()==H.LOADED){let r=this.sourceTileGrid_.getTileCoordExtent(n.tileCoord);r[0]+=t.offset,r[2]+=t.offset;let i=this.clipExtent_?.slice();i&&(i[0]+=t.offset,i[2]+=t.offset);let a=n.getImage();if(!a)return;e.push({extent:r,clipExtent:i,image:a})}}),this.sourceTiles_.length=0,e.length===0)this.state=H.ERROR;else{let t=this.wrappedTileCoord_[0],n=this.targetTileGrid_.getTileSize(t),r=typeof n==`number`?n:n[0],i=typeof n==`number`?n:n[1],a=this.targetTileGrid_.getResolution(t),o=this.sourceTileGrid_.getResolution(this.sourceZ_),s=this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_);this.canvas_=Y_(r,i,this.pixelRatio_,o,this.sourceTileGrid_.getExtent()??s,a,s,this.triangulation_,e,this.gutter_,this.renderEdges_,this.interpolate),this.state=H.LOADED}this.changed()}load(){for(let e of this.sourceTiles_)e.tile=e.getTile();if(this.state==H.IDLE){this.state=H.LOADING,this.changed();let e=0;this.sourcesListenerKeys_=[],this.sourceTiles_.forEach(t=>{let n=t.tile;if(!n)return;let r=n.getState();if(r==H.IDLE||r==H.LOADING){e++;let t=L(n,z.CHANGE,()=>{let r=n.getState();(r==H.LOADED||r==H.ERROR||r==H.EMPTY)&&(R(t),e--,e===0&&(this.unlistenSources_(),this.reproject_()))});this.sourcesListenerKeys_.push(t)}}),e===0?setTimeout(this.reproject_.bind(this),0):this.sourceTiles_.forEach(function(e){let t=e.tile;t&&t.getState()==H.IDLE&&t.load()})}}unlistenSources_(){this.sourcesListenerKeys_&&=(this.sourcesListenerKeys_.forEach(R),null)}release(){this.canvas_&&=(Jf(this.canvas_.getContext(`2d`)),U_.push(this.canvas_),null),this.sourceTiles_.length=0,super.release()}},tv=class{constructor(e){this.highWaterMark=e===void 0?2048:e,this.count_=0,this.entries_={},this.oldest_=null,this.newest_=null}deleteOldest(){let e=this.pop();e instanceof Is&&e.dispose()}canExpireCache(){return this.highWaterMark>0&&this.getCount()>this.highWaterMark}expireCache(e){for(;this.canExpireCache();)this.deleteOldest()}clear(){for(;this.oldest_;)this.deleteOldest()}containsKey(e){return this.entries_.hasOwnProperty(e)}forEach(e){let t=this.oldest_;for(;t;)e(t.value_,t.key_,this),t=t.newer}get(e,t){let n=this.entries_[e];return U(n!==void 0,`Tried to get a value for a key that does not exist in the cache`),n===this.newest_||(n===this.oldest_?(this.oldest_=this.oldest_.newer,this.oldest_.older=null):(n.newer.older=n.older,n.older.newer=n.newer),n.newer=null,n.older=this.newest_,this.newest_.newer=n,this.newest_=n),n.value_}remove(e){let t=this.entries_[e];return U(t!==void 0,`Tried to get a value for a key that does not exist in the cache`),t===this.newest_?(this.newest_=t.older,this.newest_&&(this.newest_.newer=null)):t===this.oldest_?(this.oldest_=t.newer,this.oldest_&&(this.oldest_.older=null)):(t.newer.older=t.older,t.older.newer=t.newer),delete this.entries_[e],--this.count_,t.value_}getCount(){return this.count_}getKeys(){let e=Array(this.count_),t=0,n;for(n=this.newest_;n;n=n.older)e[t++]=n.key_;return e}getValues(){let e=Array(this.count_),t=0,n;for(n=this.newest_;n;n=n.older)e[t++]=n.value_;return e}peekLast(){return this.oldest_.value_}peekLastKey(){return this.oldest_.key_}peekFirstKey(){return this.newest_.key_}peek(e){return this.entries_[e]?.value_}pop(){let e=this.oldest_;return delete this.entries_[e.key_],e.newer&&(e.newer.older=null),this.oldest_=e.newer,this.oldest_||(this.newest_=null),--this.count_,e.value_}replace(e,t){this.get(e),this.entries_[e].value_=t}set(e,t){U(!(e in this.entries_),`Tried to set a value for a key that is used already`);let n={key_:e,newer:null,older:this.newest_,value_:t};this.newest_?this.newest_.newer=n:this.oldest_=n,this.newest_=n,this.entries_[e]=n,++this.count_}setSize(e){this.highWaterMark=e}};function nv(e,t,n,r){return r===void 0?[e,t,n]:(r[0]=e,r[1]=t,r[2]=n,r)}function rv(e,t,n){return e+`/`+t+`/`+n}function iv(e,t,n,r,i){return`${V(e)},${t},${rv(n,r,i)}`}function av(e){return ov(e[0],e[1],e[2])}function ov(e,t,n){return(t<n||n>t.getMaxZoom())return!1;let a=t.getFullTileRange(n);return!a||a.containsXY(r,i)}var cv=class{constructor(){this.instructions_=[],this.zIndex=0,this.offset_=0,this.pendingMethod_,this.context_=new Proxy(qf(),{get:(e,t)=>{if(typeof e[t]==`function`)return this.pendingMethod_=t,this.pushMethodArgs_},set:(e,t,n)=>(this.push_(t,n),!0)})}push_(...e){let t=this.instructions_,n=this.zIndex+this.offset_;t[n]||(t[n]=[]),t[n].push(...e)}pushMethodArgs_=(...e)=>{this.push_(this.pendingMethod_,e)};pushFunction(e){this.push_(e)}getContext(){return this.context_}draw(e){this.instructions_.forEach(t=>{for(let n=0,r=t.length;nthis.maxStaleKeys&&(this.staleKeys_.length=this.maxStaleKeys)}updateStaleKeys(e){this.renderedSourceKey_?this.renderedSourceKey_!==e&&(this.prependStaleKey(this.renderedSourceKey_),this.renderedSourceKey_=e):this.renderedSourceKey_=e}getFeatures(e){return B()}getData(e){return null}prepareFrame(e){return B()}renderFrame(e,t){return B()}forEachFeatureAtCoordinate(e,t,n,r,i){}getLayer(){return this.layer_}handleFontsChanged(){}handleImageChange_(e){let t=e.target;(t.getState()===Q.LOADED||t.getState()===Q.ERROR)&&this.renderIfReadyAndVisible()}loadImage(e){let t=e.getState();return t!=Q.LOADED&&t!=Q.ERROR&&e.addEventListener(z.CHANGE,this.boundHandleImageChange_),t==Q.IDLE&&(e.load(),t=e.getState()),t==Q.LOADED}renderIfReadyAndVisible(){let e=this.getLayer();e&&e.getVisible()&&e.getSourceState()===`ready`&&e.changed()}renderDeferred(e){}disposeInternal(){this.layer_=void 0,super.disposeInternal()}},dv=[],fv=null;function pv(){fv=Gf(1,1,void 0,{willReadFrequently:!0})}var mv=class extends uv{constructor(e){super(e),this.wantRotation=!1,this.container=null,this.renderedResolution,this.tempTransform=gd(),this.pixelTransform=gd(),this.inversePixelTransform=gd(),this.context=null,this.deferredContext_=null,this.containerReused=!1,this.frameState=null}getImageData(e,t,n){fv||pv();let r=fv;if(!r)return null;r.clearRect(0,0,1,1);let i;try{r.drawImage(e,t,n,1,1,0,0,1,1),i=r.getImageData(0,0,1,1).data}catch{return fv=null,null}return i}getBackground(e){let t=this.getLayer().getBackground();return typeof t==`function`&&(t=t(e.viewState.resolution)),t||void 0}useContainer(e,t,n,r,i){if($f(e)&&this.pixelTransform[1]===0&&this.pixelTransform[2]===0&&this.pixelTransform[4]===0&&this.pixelTransform[5]===0&&e.width===r&&e.height===i){let t=e,r=t.getContext(`2d`);if(r){this.container=e,this.context=r,this.containerReused=!0,n&&(r.fillStyle=n,r.fillRect(0,0,t.width,t.height));return}}let a=this.getLayer().getClassName(),o,s;if(e&&e.className===a&&(!n||e&&e.style.backgroundColor&&Us(Im(e.style.backgroundColor),Im(n)))){let t=e.firstElementChild;$f(t)&&(s=t.getContext(`2d`))}if(s&&Td(s.canvas.style.transform,t)?(this.container=e,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){o=mc?Qf():document.createElement(`div`),o.className=a;let e=o.style;e.position=`absolute`,e.width=`100%`,e.height=`100%`,s=Gf();let t=s.canvas;o.appendChild(t),e=t.style,e.position=`absolute`,e.left=`0`,e.transformOrigin=`top left`,this.container=o,this.context=s}!this.containerReused&&n&&!this.container.style.backgroundColor&&(this.container.style.backgroundColor=n)}clipUnrotated(e,t,n){let r=gl(n),i=_l(n),a=cl(n),o=sl(n);vd(t.coordinateToPixelTransform,r),vd(t.coordinateToPixelTransform,i),vd(t.coordinateToPixelTransform,a),vd(t.coordinateToPixelTransform,o);let s=this.inversePixelTransform;vd(s,r),vd(s,i),vd(s,a),vd(s,o),e.save(),e.beginPath(),e.moveTo(Math.round(r[0]),Math.round(r[1])),e.lineTo(Math.round(i[0]),Math.round(i[1])),e.lineTo(Math.round(a[0]),Math.round(a[1])),e.lineTo(Math.round(o[0]),Math.round(o[1])),e.clip()}prepareContainer(e,t){let n=e.extent,r=e.viewState.resolution,i=this.sourceRotates(),a=i?0:e.viewState.rotation,o=e.pixelRatio,s=Math.round(i?e.size[0]*o:G(n)/r*o),c=Math.round(i?e.size[1]*o:pl(n)/r*o);yd(this.pixelTransform,e.size[0]/2,e.size[1]/2,1/o,1/o,a,-s/2,-c/2),bd(this.inversePixelTransform,this.pixelTransform);let l=Cd(this.pixelTransform),u=this.getBackground(e);if(this.useContainer(t,l,u,s,c),!this.containerReused){let e=this.context.canvas;e.width!=s||e.height!=c?(e.width=s,e.height=c):this.context.clearRect(0,0,s,c),l!==e.style.transform&&(e.style.transform=l)}}dispatchRenderEvent_(e,t,n){let r=this.getLayer();if(r.hasListener(e)){let i=new S_(e,this.inversePixelTransform,n,t);r.dispatchEvent(i)}}preRender(e,t){this.frameState=t,!t.declutter&&this.dispatchRenderEvent_(qp.PRERENDER,e,t)}postRender(e,t){t.declutter||this.dispatchRenderEvent_(qp.POSTRENDER,e,t)}renderDeferredInternal(e){}getRenderContext(e){return e.declutter&&!this.deferredContext_&&(this.deferredContext_=new cv),e.declutter?this.deferredContext_.getContext():this.context}getCanvasContext(){let e=this.context;if(!e)throw Error(`Canvas context not initialized`);return e}getContainerElement(){let e=this.container;if(!e)throw Error(`Canvas container not initialized`);return e}renderDeferred(e){e.declutter&&(this.dispatchRenderEvent_(qp.PRERENDER,this.context,e),e.declutter&&this.deferredContext_&&(this.deferredContext_.draw(this.context),this.deferredContext_.clear()),this.renderDeferredInternal(e),this.dispatchRenderEvent_(qp.POSTRENDER,this.context,e))}getRenderTransform(e,t,n,r,i,a,o){let s=i/2,c=a/2,l=r/t,u=-l,d=-e[0]+o,f=-e[1];return yd(this.tempTransform,s,c,l,u,-n,d,f)}sourceRotates(){return this.wantRotation&&!!this.getLayer().getSource()?.canRotate}disposeInternal(){delete this.frameState,super.disposeInternal()}};function hv(e,t,n){if(!(n in e))return e[n]=new Set([t]),!0;let r=e[n],i=r.has(t);return i||r.add(t),!i}function gv(e,t,n){let r=e[n];return r?r.delete(t):!1}function _v(e,t){let n=e.layerStatesArray[e.layerIndex];if(n.extent&&(t=ml(t,dd(n.extent,e.viewState.projection))),!n.layer)return t;let r=n.layer.getRenderSource();if(!r.getWrapX()){let n=r.getTileGridForProjection(e.viewState.projection).getExtent();n&&(t=ml(t,n))}return t}var vv=class extends mv{constructor(e,t){super(e),t||={},this.extentChanged=!0,this.renderComplete=!1,this.renderedExtent_=null,this.renderedPixelRatio,this.renderedProjection=null,this.renderedTiles=[],this.renderedSourceRevision_,this.tempExtent=Yc(),this.tempTileRange_=new B_(0,0,0,0),this.tempTileCoord_=nv(0,0,0);let n=t.cacheSize===void 0?512:t.cacheSize;this.tileCache_=new tv(n),this.sourceTileCache_=null,this.layerExtent=null,this.maxStaleKeys=n*.5}getTileCache(){return this.tileCache_}getSourceTileCache(){return this.sourceTileCache_||=new tv(512),this.sourceTileCache_}getOrCreateTile(e,t,n,r){let i=this.tileCache_,a=this.getLayer().getSource();if(!a)return null;let o=iv(a,a.getKey(),e,t,n),s;if(i.containsKey(o)){if(s=i.get(o),!s)return null}else{let c=r.viewState.projection,l=a.getProjection();if(s=a.getTile(e,t,n,r.pixelRatio,c,!l||td(l,c)?void 0:this.getSourceTileCache()),!s)return null;i.set(o,s)}return s}getTile(e,t,n,r){return this.getOrCreateTile(e,t,n,r)||null}getData(e){let t=this.frameState;if(!t)return null;let n=this.getLayer(),r=vd(t.pixelToCoordinateTransform,e.slice()),i=n.getExtent();if(i&&!Gc(i,r))return null;let a=t.viewState,o=n.getRenderSource();if(!o)return null;let s=o.getTileGridForProjection(a.projection),c=o.getTilePixelRatio(t.pixelRatio);for(let e=s.getZForResolution(a.resolution);e>=s.getMinZoom();--e){let n=s.getTileCoordForCoordAndZ(r,e),i=this.getTile(e,n[1],n[2],t);if(!i||i.getState()!==H.LOADED)continue;let l=s.getOrigin(e),u=Bm(s.getTileSize(e)),d=s.getResolution(e),f=null;if(i instanceof R_||i instanceof ev)f=i.getImage();else if(i instanceof L_){let e=i.getData();e&&(f=N_(e))}if(!f)continue;let p=Math.floor(c*((r[0]-l[0])/d-n[1]*u[0])),m=Math.floor(c*((l[1]-r[1])/d-n[2]*u[1])),h=Math.round(c*o.getGutterForProjection(a.projection));return this.getImageData(f,p+h,m+h)}return null}readData(e){let t=this.getLayer().getRenderSource();if(!t)return null;let n=e.viewState,r=n.projection;if(t.getGutterForProjection(r))throw Error(`readData() does not support sources with a gutter`);let i=t.getTileGridForProjection(r),a=n.resolution,o=e.extent,s=i.getZForResolution(a),c={};this.enqueueTiles(e,o,s,c,0);let l=c[s];if(!l)return null;let u=[],d=!0;if(l.forEach(e=>{let t=e,n=t.getState();n===H.LOADED?u.push(t):n!==H.ERROR&&n!==H.EMPTY&&(d=!1)}),!d||u.length===0)return null;let f=e.size[0],p=e.size[1],m=u[0],h=P_(m.getData());if(!h||h instanceof DataView)throw Error(`ol/renderer/canvas/TileLayer#readData only supports typed array tile data`);let g=m.getSize(),_=Math.round(h.length/(g[0]*g[1])),v=h.constructor,y=new v(f*p*_);for(let e of u){let t=i.getTileCoordExtent(e.tileCoord,this.tempExtent),n=e.getSize(),r=P_(e.getData()),s=(t[0]-o[0])/a-.5,c=(o[3]-t[3])/a-.5,l=G(t)/a,u=pl(t)/a,d=n[0]/l,m=n[1]/u,h=Math.max(0,Math.ceil(s)),g=Math.min(f,Math.ceil(s+l)),v=Math.max(0,Math.ceil(c)),b=Math.min(p,Math.ceil(c+u));for(let e=v;e=f;--i){let n=c.getTileRangeForExtentAndZ(t,i,this.tempTileRange_),a=c.getResolution(i);for(let t=n.minX;t<=n.maxX;++t)for(let o=n.minY;o<=n.maxY;++o){if(p&&m&&!c.tileCoordIntersectsViewport([i,t,o],m))continue;let n=this.getTile(i,t,o,e);if(!n||!hv(r,n,i))continue;let s=n.getKey();if(u[s]=!0,n.getState()===H.IDLE&&!e.tileQueue.isKeyQueued(s)){let r=nv(i,t,o,this.tempTileCoord_);e.tileQueue.enqueue([n,l,c.getTileCoordCenter(r),a])}}}}findStaleTile_(e,t){let n=this.tileCache_,r=e[0],i=e[1],a=e[2],o=this.getStaleKeys(),s=this.getLayer().getSource();if(!s)return!1;for(let e=0;e0&&setTimeout(()=>{this.enqueueTiles(e,S,d-1,b,x-1)},0),!(d in b))return this.getContainerElement();let C=V(this),w=e.time;for(let t of b[d]){let n=t.getState();if(n===H.EMPTY)continue;let r=t.tileCoord;if(n===H.LOADED&&t.getAlpha(C,w)===1){t.endTransition(C);continue}if(n!==H.ERROR&&(this.renderComplete=!1),this.findStaleTile_(r,b)){gv(b,t,d),e.animate=!0;continue}if(this.findAltTiles_(u,r,d+1,b))continue;let i=u.getMinZoom();for(let e=d-1;e>=i&&!this.findAltTiles_(u,r,e,b);--e);}let T=f/a*s/m,E=this.getRenderContext(e);yd(this.tempTransform,h/2,g/2,T,T,0,-h/2,-g/2),this.layerExtent&&this.clipUnrotated(E,e,this.layerExtent),l.getInterpolate()||(E.imageSmoothingEnabled=!1),this.preRender(E,e);let D=Object.keys(b).map(Number);D.sort(Rs);let O=[],k=[],A=[];for(let t=D.length-1;t>=0;--t){let n=D[t],r=l.getTilePixelSize(n,s,i),a=u.getResolution(n)/f,o=r[0]*a*T,c=r[1]*a*T,p=u.getTileCoordForCoordAndZ(gl(y),n),h=u.getTileCoordExtent(p),g=vd(this.tempTransform,[m*(h[0]-y[0])/f,m*(y[3]-h[3])/f]),_=m*l.getGutterForProjection(i);for(let t of b[n]){if(t.getState()!==H.LOADED)continue;let r=t.tileCoord,i=p[1]-r[1],a=Math.round(g[0]-(i-1)*o),s=p[2]-r[2],u=Math.round(g[1]-(s-1)*c),f=Math.round(g[0]-i*o),m=Math.round(g[1]-s*c),h=a-f,v=u-m,y=n===d;if(y&&t.inTransition(C)){A.push({tile:t,x:f,y:m,w:h,h:v,gutter:_}),this.renderedTiles.unshift(t),this.updateUsedTiles(e.usedTiles,l,t);continue}let b=[f,m,f+h,m+v],x=[];for(let e=0,t=O.length;e0&&(S=wl(b,x)),O.push(b),k.push(n),this.drawTile(t,e,f,m,h,v,_,y,S),this.renderedTiles.unshift(t),this.updateUsedTiles(e.usedTiles,l,t)}}for(let t=0,n=A.length;t{let n=V(l),r=t.wantedTiles[n],i=r?Object.keys(r).length:0;this.updateCacheSize(i),this.tileCache_.expireCache(),this.sourceTileCache_?.expireCache()}),this.getContainerElement()}updateCacheSize(e){this.tileCache_.highWaterMark=Math.max(this.tileCache_.highWaterMark,e*2)}drawTile(e,t,n,r,i,a,o,s,c){let l;if(e instanceof L_){let t=e.getData();if(!t)return;if(l=N_(t),!l)throw Error(`Rendering array data is not yet supported`)}else l=this.getTileImage(e);if(!l)return;let u=this.getRenderContext(t),d=V(this),f=t.layerStatesArray[t.layerIndex],p=f.opacity*(s?e.getAlpha(d,t.time):1),m=p!==u.globalAlpha;m&&(u.save(),u.globalAlpha=p);let h=l.width-2*o,g=l.height-2*o;if(c){let e=h/i,t=g/a;for(let i=0,a=c.length;is&&(this.instructions.push([$.CUSTOM,s,l,e,n,qd,i]),this.hitDetectionInstructions.push([$.CUSTOM,s,l,e,r||n,qd,i]));break;case`Point`:c=e.getFlatCoordinates(),this.coordinates.push(c[0],c[1]),l=this.coordinates.length,this.instructions.push([$.CUSTOM,s,l,e,n,void 0,i]),this.hitDetectionInstructions.push([$.CUSTOM,s,l,e,r||n,void 0,i])}this.endGeometry(t)}beginGeometry(e,t,n){this.beginGeometryInstruction1_=[$.BEGIN_GEOMETRY,t,0,e,n],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[$.BEGIN_GEOMETRY,t,0,e,n],this.hitDetectionInstructions.push(this.beginGeometryInstruction2_)}finish(){return{instructions:this.instructions,hitDetectionInstructions:this.hitDetectionInstructions,coordinates:this.coordinates}}reverseHitDetectionInstructions(){let e=this.hitDetectionInstructions;e.reverse();let t,n=e.length,r,i,a=-1;for(t=0;tthis.maxLineWidth&&(this.maxLineWidth=t.lineWidth,this.bufferedMaxExtent_=null)}else t.strokeStyle=void 0,t.lineCap=void 0,t.lineDash=null,t.lineDashOffset=void 0,t.lineJoin=void 0,t.lineWidth=void 0,t.miterLimit=void 0,t.strokeOffset=void 0;return t}setFillStrokeStyle(e,t){let n=this.state;this.fillStyleToState(e,n),this.strokeStyleToState(t,n)}createFill(e){let t=e.fillStyle,n=[$.SET_FILL_STYLE,t];return typeof t!=`string`&&n.push(e.fillPatternScale),n}applyStroke(e){this.instructions.push(this.createStroke(e))}createStroke(e){return[$.SET_STROKE_STYLE,e.strokeStyle,e.lineWidth*this.pixelRatio,e.lineCap,e.lineJoin,e.miterLimit,e.lineDash?this.applyPixelRatio(e.lineDash):null,e.lineDashOffset*this.pixelRatio]}updateFillStyle(e,t){let n=e.fillStyle;(n!==void 0&&typeof n!=`string`||e.currentFillStyle!=n)&&(this.instructions.push(t.call(this,e)),e.currentFillStyle=n)}updateStrokeStyle(e,t){let n=e.strokeStyle,r=e.lineCap,i=e.lineDash,a=e.lineDashOffset,o=e.lineJoin,s=e.lineWidth,c=e.miterLimit,l=e.strokeOffset;(e.currentStrokeStyle!=n||e.currentLineCap!=r||i!=e.currentLineDash&&(!i||!e.currentLineDash||!Us(e.currentLineDash,i))||e.currentLineDashOffset!=a||e.currentLineJoin!=o||e.currentLineWidth!=s||e.currentMiterLimit!=c||e.currentStrokeOffset!=l)&&(t.call(this,e),e.currentStrokeStyle=n,e.currentLineCap=r,e.currentLineDash=i,e.currentLineDashOffset=a,e.currentLineJoin=o,e.currentLineWidth=s,e.currentMiterLimit=c,e.currentStrokeOffset=l)}endGeometry(e){this.beginGeometryInstruction1_[2]=this.instructions.length,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_[2]=this.hitDetectionInstructions.length,this.beginGeometryInstruction2_=null;let t=[$.END_GEOMETRY,e];this.instructions.push(t),this.hitDetectionInstructions.push(t)}getBufferedMaxExtent(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=Uc(this.maxExtent),this.maxLineWidth>0)){let e=this.resolution*(this.maxLineWidth+1)/2;Hc(this.bufferedMaxExtent_,e,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_}},Ov=class extends Dv{constructor(e,t,n,r){super(e,t,n,r),this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.anchorX_=void 0,this.anchorY_=void 0,this.height_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.scale_=void 0,this.width_=void 0,this.declutterMode_=void 0,this.declutterImageWithText_=void 0}drawPoint(e,t,n){if(!this.image_||this.maxExtent&&!Gc(this.maxExtent,e.getFlatCoordinates()))return;this.beginGeometry(e,t,n??0);let r=e.getFlatCoordinates(),i=e.getStride(),a=this.coordinates.length,o=this.appendFlatPointCoordinates(r,i),s=this.imagePixelRatio_??1,c=this.anchorX_??0,l=this.anchorY_??0,u=this.height_??0,d=this.originX_??0,f=this.originY_??0,p=this.scale_??[1,1],m=this.width_??0;this.instructions.push([$.DRAW_IMAGE,a,o,this.image_,c*s,l*s,Math.ceil(u*s),this.opacity_,d*s,f*s,this.rotateWithView_,this.rotation_,[p[0]*this.pixelRatio/s,p[1]*this.pixelRatio/s],Math.ceil(m*s),this.declutterMode_,this.declutterImageWithText_]),this.hitDetectionInstructions.push([$.DRAW_IMAGE,a,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(t)}drawMultiPoint(e,t,n){if(!this.image_)return;this.beginGeometry(e,t,n??0);let r=e.getFlatCoordinates(),i=[];for(let t=0,n=r.length;tthis.drawCircle(e,t,n)))return;this.setFillStrokeStyles_(),this.beginGeometry(e,t,n??0),r.fillStyle!==void 0&&this.hitDetectionInstructions.push([$.SET_FILL_STYLE,tg]),r.strokeStyle!==void 0&&this.hitDetectionInstructions.push([$.SET_STROKE_STYLE,ag,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,rg,0]);let s=e.getFlatCoordinates(),c=e.getStride(),l=this.coordinates.length;this.appendFlatLineCoordinates(s,0,s.length,c,!1,!1);let u=[$.CIRCLE,l,o];this.instructions.push(Tv,u),this.hitDetectionInstructions.push(Tv,u),r.fillStyle!==void 0&&(this.instructions.push(Cv),this.hitDetectionInstructions.push(Cv)),r.strokeStyle!==void 0&&(this.instructions.push(wv),this.hitDetectionInstructions.push(wv)),this.endGeometry(t)}drawPolygon(e,t,n){let r=this.state;if(!r)return;let i=r.fillStyle,a=r.strokeStyle,o=r.strokeOffset;if(i===void 0&&a===void 0||this.handleStrokeOffset_(()=>this.drawPolygon(e,t,n)))return;this.setFillStrokeStyles_(),this.beginGeometry(e,t,n??0),r.fillStyle!==void 0&&this.hitDetectionInstructions.push([$.SET_FILL_STYLE,tg]),r.strokeStyle!==void 0&&this.hitDetectionInstructions.push([$.SET_STROKE_STYLE,ag,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,rg,0]);let s=e.getEnds(),c=e.getOrientedFlatCoordinates(),l=e.getStride();this.drawFlatCoordinatess_(c,0,s,l,o),this.endGeometry(t)}drawMultiPolygon(e,t,n){let r=this.state;if(!r)return;let i=r.fillStyle,a=r.strokeStyle,o=r.strokeOffset;if(i===void 0&&a===void 0||this.handleStrokeOffset_(()=>this.drawMultiPolygon(e,t,n)))return;this.setFillStrokeStyles_(),this.beginGeometry(e,t,n??0),r.fillStyle!==void 0&&this.hitDetectionInstructions.push([$.SET_FILL_STYLE,tg]),r.strokeStyle!==void 0&&this.hitDetectionInstructions.push([$.SET_STROKE_STYLE,ag,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,rg,0]);let s=e.getEndss(),c=e.getOrientedFlatCoordinates(),l=e.getStride(),u=0;for(let e=0,t=s.length;e0&&n!==void 0&&r!==void 0&&(t.strokeStyle=void 0,t.strokeOffset=0,e(),t.fillStyle=void 0,t.strokeStyle=r,t.strokeOffset=i,e(),t.fillStyle=n,!0)}},jv=0,Mv=1;function Nv(e,t,n,r,i,a,o,s){let c=o-i,l=s-a,u=0,d=1;if(c===0){if(in)return!1}else{let t=(e-i)/c,r=(n-i)/c;if(t>r){let e=t;t=r,r=e}if(t>u&&(u=t),rd)return!1}if(l===0){if(ar)return!1}else{let e=(t-a)/l,n=(r-a)/l;if(e>n){let t=e;e=n,n=t}if(e>u&&(u=e),nd)return!1}return jv=u,Mv=d,!0}function Pv(e,t,n,r){let i=r[0],a=r[1],o=r[2],s=r[3],c=[],l=[],u=!1,d,f,p=0;for(let r=0,m=t.length;r=e){let t=(e-s+d)/d,f=Nc(n,l,t),p=Nc(r,u,t);c.push(f,p),a.push(c),c=[f,p],s==e&&(o+=i),s=0}else if(s0&&a.push(c),a}function Iv(e,t,n,r,i){let a=n,o=n,s=0,c=0,l=n,u,d,f,p,m,h,g,_,v,y;for(d=n;de&&(c>s&&(s=c,a=l,o=d),c=0,l=d-i)),f=p,g=v,_=y),m=n,h=r}return c+=p||0,c>s?[l,d]:[a,o]}var Lv={left:0,center:.5,right:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1},Rv={Circle:Av,Default:Dv,Image:Ov,LineString:kv,Polygon:Av,Text:class extends Dv{constructor(e,t,n,r){super(e,t,n,r),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[tg]={fillStyle:tg},this.textStrokeState_=null,this.strokeStates={},this.textState_={},this.textStates={},this.textKey_=``,this.fillKey_=``,this.strokeKey_=``,this.declutterMode_=void 0,this.declutterImageWithText_=void 0}finish(){let e=super.finish();return e.textStates=this.textStates,e.fillStates=this.fillStates,e.strokeStates=this.strokeStates,e}drawText(e,t,n){let r=this.textFillState_,i=this.textStrokeState_,a=this.textState_;if(this.text_===``||!a||!r&&!i)return;let o=this.coordinates,s=o.length,c=e.getType(),l=null,u=e.getStride();if(a.placement===`line`&&(c==`LineString`||c==`MultiLineString`||c==`Polygon`||c==`MultiPolygon`)){let r=e.getExtent();if(!vl(this.maxExtent,r))return;let i=[];if(l=e.getFlatCoordinates(),c==`LineString`)i=[l.length];else if(c==`MultiLineString`)i=e.getEnds();else if(c==`Polygon`)i=e.getEnds().slice(0,1);else if(c==`MultiPolygon`){let t=e.getEndss();i=[];for(let e=0,n=t.length;e{let i=o[(t+r)*2]===e[r*u]&&o[(t+r)*2+1]===e[r*u+1];return i||--t,i})}this.saveTextStates_();let d=a.backgroundFill?this.createFill(this.fillStyleToState(a.backgroundFill)):null,f=a.backgroundStroke?this.createStroke(this.strokeStyleToState(a.backgroundStroke)):null;this.beginGeometry(e,t,n??0);let p=a.scale??[1,1],m=a.padding??cg;if(m!=cg&&(p[0]<0||p[1]<0)){let e=m[0],t=m[1],n=m[2],r=m[3];p[0]<0&&(t=-t,r=-r),p[1]<0&&(e=-e,n=-n),m=[e,t,n,r]}let h=this.pixelRatio;this.instructions.push([$.DRAW_IMAGE,s,i,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[1,1],NaN,this.declutterMode_,this.declutterImageWithText_,m==cg?cg:m.map(function(e){return e*h}),d,f,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,r]);let g=1/h,_=d?d.slice(0):null;_&&(_[1]=tg),this.hitDetectionInstructions.push([$.DRAW_IMAGE,s,i,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[g,g],NaN,this.declutterMode_,this.declutterImageWithText_,m,_,f,this.text_,this.textKey_,this.strokeKey_,this.fillKey_?tg:this.fillKey_,this.textOffsetX_,this.textOffsetY_,r]),this.endGeometry(t)}}saveTextStates_(){let e=this.textStrokeState_,t=this.textState_,n=this.textFillState_,r=this.strokeKey_;e&&(r in this.strokeStates||(this.strokeStates[r]={strokeStyle:e.strokeStyle,lineCap:e.lineCap,lineDashOffset:e.lineDashOffset,lineWidth:e.lineWidth,lineJoin:e.lineJoin,miterLimit:e.miterLimit,lineDash:e.lineDash}));let i=this.textKey_;i in this.textStates||(this.textStates[i]={font:t.font,textAlign:t.textAlign||`center`,justify:t.justify,textBaseline:t.textBaseline||`middle`,scale:t.scale});let a=this.fillKey_;n&&(a in this.fillStates||(this.fillStates[a]={fillStyle:n.fillStyle}))}drawChars_(e,t){let n=this.textStrokeState_,r=this.textState_,i=this.strokeKey_,a=this.textKey_,o=this.fillKey_;this.saveTextStates_();let s=this.pixelRatio,c=Lv[r.textBaseline||`middle`],l=this.textOffsetX_*s,u=this.textOffsetY_*s,d=this.text_,f=r.scale??[1,1],p=n?n.lineWidth*Math.abs(f[0])/2:0;this.instructions.push([$.DRAW_CHARS,e,t,c,r.overflow,o,r.maxAngle,s,u,i,p*s,d,a,1,this.declutterMode_,this.textKeepUpright_,l]),this.hitDetectionInstructions.push([$.DRAW_CHARS,e,t,c,r.overflow,o&&tg,r.maxAngle,s,u,i,p*s,d,a,1/s,this.declutterMode_,this.textKeepUpright_,l])}setTextStyle(e,t){let n,r,i;if(!e)this.text_=``;else{let t=e.getFill();t?(r=this.textFillState_,r||(r={},this.textFillState_=r),r.fillStyle=Qh(t.getColor()||`#000`)||`#000`):(r=null,this.textFillState_=r);let a=e.getStroke();if(!a)i=null,this.textStrokeState_=i;else{i=this.textStrokeState_,i||(i={},this.textStrokeState_=i);let e=a.getLineDash(),t=a.getLineDashOffset(),n=a.getWidth(),r=a.getMiterLimit();i.lineCap=a.getLineCap()||`round`,i.lineDash=e?e.slice():rg,i.lineDashOffset=t===void 0?0:t,i.lineJoin=a.getLineJoin()||`round`,i.lineWidth=n===void 0?1:n,i.miterLimit=r===void 0?10:r,i.strokeStyle=Qh(a.getColor()||`#000`)||`#000`}n=this.textState_;let o=e.getFont()||`10px sans-serif`;hg(o);let s=e.getScaleArray();n.overflow=e.getOverflow(),n.font=o,n.maxAngle=e.getMaxAngle(),n.placement=e.getPlacement(),n.textAlign=e.getTextAlign(),n.repeat=e.getRepeat(),n.justify=e.getJustify(),n.textBaseline=e.getTextBaseline()||`middle`,n.backgroundFill=e.getBackgroundFill()??void 0,n.backgroundStroke=e.getBackgroundStroke()??void 0,n.padding=e.getPadding()||cg,n.scale=s===void 0?[1,1]:s;let c=e.getOffsetX(),l=e.getOffsetY(),u=e.getRotateWithView(),d=e.getKeepUpright(),f=e.getRotation();this.text_=e.getText()||``,this.textOffsetX_=c===void 0?0:c,this.textOffsetY_=l===void 0?0:l,this.textRotateWithView_=u!==void 0&&u,this.textKeepUpright_=d===void 0||d,this.textRotation_=f===void 0?0:f,this.strokeKey_=i?(typeof i.strokeStyle==`string`?i.strokeStyle:V(i.strokeStyle))+i.lineCap+i.lineDashOffset+`|`+i.lineWidth+i.lineJoin+i.miterLimit+`[`+i.lineDash.join()+`]`:``,this.textKey_=n.font+n.scale+(n.textAlign||`?`)+(n.repeat||`?`)+(n.justify||`?`)+(n.textBaseline||`?`),this.fillKey_=r&&r.fillStyle?typeof r.fillStyle==`string`?r.fillStyle:`|`+V(r.fillStyle):``}this.declutterMode_=e?e.getDeclutterMode():void 0,this.declutterImageWithText_=t}}},zv=class{constructor(e,t,n,r){this.tolerance_=e,this.maxExtent_=t,this.pixelRatio_=r,this.resolution_=n,this.buildersByZIndex_={}}finish(){let e={};for(let t in this.buildersByZIndex_){e[t]=e[t]||{};let n=this.buildersByZIndex_[t];for(let r in n){let i=n[r].finish();e[t][r]=i}}return e}getBuilder(e,t){let n=e===void 0?`0`:e.toString(),r=this.buildersByZIndex_[n];r===void 0&&(r={},this.buildersByZIndex_[n]=r);let i=r[t];if(i===void 0){let e=Rv[t];i=new e(this.tolerance_,this.maxExtent_,this.resolution_,this.pixelRatio_),r[t]=i}return i}};function Bv(e,t,n,r){let i=e[t],a=e[t+1],o=0;for(let s=t+r;s.998)return[e+u*o,t+d*o];let p=Math.cos(f/2),m=Math.sin(f/2),h=m*s+p*c,g=-p*s+m*c,_=1/m*h,v=1/m*g;return[e+_*o,t+v*o]}function Uv(e,t,n=!1){for(let r=0,i=e.length-2;rr+t;n-=t){let i=e[r],a=e[r+1],o=e[r+t],s=e[r+t+1],c=e[n],l=e[n+1],u=e[n+t],d=e[n+t+1],f=(d-l)*(o-i)-(u-c)*(s-a);if(f===0)continue;let p=((u-c)*(a-l)-(d-l)*(i-c))/f,m=((o-i)*(a-l)-(s-a)*(i-c))/f;if(p>0&&p<1&&m>0&&m<1){let c=i+p*(o-i),l=a+p*(s-a);e[r+t]=c,e[r+t+1]=l,e.splice(r+2*t,n-r-t);break}}}return e}var Wv,Gv=RegExp(`[֑-ࣿיִ-﷿ﹰ-ﻼࠀ-࿿-]`);function Kv(){return Wv||=new Intl.Segmenter(void 0,{granularity:`grapheme`}),Wv}function qv(e,t,n,r,i,a,o,s,c,l,u,d,f=!0){let p=e[t],m=e[t+1],h=0,g=0,_=0,v=0;function y(){h=p,g=m,t+=r,p=e[t],m=e[t+1],v+=_,_=Math.sqrt((p-h)*(p-h)+(m-g)*(m-g))}do y();while(te[2]}else O=x>E}let k=Math.PI,A=[],ee=C+r===t;t=C,_=0,v=w,p=e[t],m=e[t+1];let te;if(ee)return y(),te=Math.atan2(m-g,p-h),O&&(te+=te>0?-k:k),A[0]=[(E+x)/2,(D+S)/2,(T-a)/2,te,i],A;i=i.replace(/\n/g,` `);let ne=Array.from(Kv().segment(i),e=>e.segment),re=O!==Gv.test(i);for(let e=0,i=ne.length;e0?-k:k),te!==void 0){let e=d-te;if(e+=e>k?-2*k:e<-k?2*k:0,Math.abs(e)>o)return null}te=d;let f=e,x=0;for(;e0&&e.push(` +`,``),e.push(t,``),e}function ny(e,t,n){return n%2==0&&(e+=t),e}var ry=class{constructor(e,t,n,r,i){this.overlaps=n,this.pixelRatio=t,this.resolution=e,this.alignAndScaleFill_,this.instructions=r.instructions,this.coordinates=r.coordinates,this.coordinateCache_={},this.renderedTransform_=gd(),this.hitDetectionInstructions=r.hitDetectionInstructions,this.pixelCoordinates_=null,this.viewRotation_=0,this.fillStates=r.fillStates||{},this.strokeStates=r.strokeStates||{},this.textStates=r.textStates||{},this.widths_={},this.labels_={},this.zIndexContext_=i?new cv:null}getZIndexContext(){return this.zIndexContext_}createLabel(e,t,n,r){let i=e+t+n+r;if(this.labels_[i])return this.labels_[i];let a=r?this.strokeStates[r]:null,o=n?this.fillStates[n]:null,s=this.textStates[t],c=this.pixelRatio,l=[s.scale[0]*c,s.scale[1]*c],u=s.justify?Lv[s.justify]:ey(Array.isArray(e)?e[0]:e,s.textAlign||`center`),d=r&&a.lineWidth?a.lineWidth:0,f=Array.isArray(e)?e:String(e).split(` +`).reduce(ty,[]),{width:p,height:m,widths:h,heights:g,lineWidths:_}=bg(s,f),v=p+d,y=[],b=(v+2)*l[0],x=(m+d)*l[1],S={width:b<0?Math.floor(b):Math.ceil(b),height:x<0?Math.floor(x):Math.ceil(x),contextInstructions:y};(l[0]!=1||l[1]!=1)&&y.push(`scale`,l),r&&a&&(y.push(`strokeStyle`,a.strokeStyle),y.push(`lineWidth`,d),y.push(`lineCap`,a.lineCap),y.push(`lineJoin`,a.lineJoin),y.push(`miterLimit`,a.miterLimit),y.push(`setLineDash`,[a.lineDash]),y.push(`lineDashOffset`,a.lineDashOffset)),n&&o&&y.push(`fillStyle`,o.fillStyle),y.push(`textBaseline`,`middle`),y.push(`textAlign`,`center`);let C=.5-u,w=u*v+C*d,T=[],E=[],D=0,O=0,k=0,A=0,ee;for(let e=0,t=f.length;ee?e-c:i,y=a+l>t?t-l:a,b=p[3]+v*d[0]+p[1],x=p[0]+y*d[1]+p[2],S=g-p[3],C=_-p[0];(m||u!==0)&&(Yv[0]=S,Qv[0]=S,Yv[1]=C,Xv[1]=C,Xv[0]=S+b,Zv[0]=Xv[0],Zv[1]=C+x,Qv[1]=Zv[1]);let w;return u===0?Xc(Math.min(S,S+b),Math.min(C,C+x),Math.max(S,S+b),Math.max(C,C+x),Jv):(w=yd(gd(),n,r,1,1,u,-n,-r),vd(w,Yv),vd(w,Xv),vd(w,Zv),vd(w,Qv),Xc(Math.min(Yv[0],Xv[0],Zv[0],Qv[0]),Math.min(Yv[1],Xv[1],Zv[1],Qv[1]),Math.max(Yv[0],Xv[0],Zv[0],Qv[0]),Math.max(Yv[1],Xv[1],Zv[1],Qv[1]),Jv)),f&&(g=Math.round(g),_=Math.round(_)),{drawImageX:g,drawImageY:_,drawImageW:v,drawImageH:y,originX:c,originY:l,declutterBox:{minX:Jv[0],minY:Jv[1],maxX:Jv[2],maxY:Jv[3],value:h},canvasTransform:w,scale:d}}replayImageOrLabelArgs_(e){return this.replayImageOrLabel_(e[0],e[1],e[2],e[3],e[4],e[5],e[6])}replayImageOrLabel_(e,t,n,r,i,a,o){let s=!!(a||o),c=r.declutterBox,l=o?o[2]*r.scale[0]/2:0;return c.minX-l<=t[0]&&c.maxX+l>=0&&c.minY-l<=t[1]&&c.maxY+l>=0&&(s&&this.replayTextBackground_(e,Yv,Xv,Zv,Qv,a,o),xg(e,r.canvasTransform,i,n,r.originX,r.originY,r.drawImageW,r.drawImageH,r.drawImageX,r.drawImageY,r.scale)),!0}fill_(e){let t=this.alignAndScaleFill_;if(t){let n=vd(this.renderedTransform_,[0,0]),r=512*this.pixelRatio;e.save(),e.translate(n[0]%r,n[1]%r),t!==1&&e.scale(t,t)}e.fill(),t&&e.restore()}setStrokeStyle_(e,t){e.strokeStyle=t[1],t[1]&&(e.lineWidth=t[2],e.lineCap=t[3],e.lineJoin=t[4],e.miterLimit=t[5],e.lineDashOffset=t[7],e.setLineDash(t[6]))}drawLabelWithPointPlacement_(e,t,n,r){let i=this.textStates[t],a=this.createLabel(e,t,r,n),o=this.strokeStates[n],s=this.pixelRatio,c=ey(Array.isArray(e)?e[0]:e,i.textAlign||`center`),l=Lv[i.textBaseline||`middle`],u=o&&o.lineWidth?o.lineWidth:0;return{label:a,anchorX:c*(a.width/s-2*i.scale[0])+2*(.5-c)*u,anchorY:l*a.height/s+2*(.5-l)*u}}execute_(e,t,n,r,i,a,o,s){let c=this.zIndexContext_,l;this.pixelCoordinates_&&Us(n,this.renderedTransform_)?l=this.pixelCoordinates_:(this.pixelCoordinates_||=[],l=Ed(this.coordinates,0,this.coordinates.length,2,n,this.pixelCoordinates_),_d(this.renderedTransform_,n));let u=0,d=r.length,f=0,p,m=[],h,g,_,v,y,b,x,S,C,w,T,E,D,O=0,k=0,A=this.coordinateCache_,ee=this.viewRotation_,te=Math.round(Math.atan2(-n[1],n[0])*0xe8d4a51000)/0xe8d4a51000,ne={context:e,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:ee},re=this.instructions!=r||this.overlaps?0:200,j,ie,ae,M;for(;ure&&(this.fill_(e),O=0),k>re&&(e.stroke(),k=0),!O&&!k&&(e.beginPath(),y=NaN,b=NaN),++u;break;case $.CIRCLE:f=n[1],_=n[2]??0;let r=l[f],d=l[f+1],oe=l[f+2]-_,se=l[f+3]-_,ce=oe-r,le=se-d,N=Math.sqrt(ce*ce+le*le);e.moveTo(r+N,d),e.arc(r,d,N,0,2*Math.PI,!0),++u;break;case $.CLOSE_PATH:e.closePath(),++u;break;case $.CUSTOM:f=n[1],p=n[2];let ue=n[3],P=n[4],de=n[5];ne.geometry=ue,ne.feature=j,u in A||(A[u]=[]);let fe=A[u];de?de(l,f,p,2,fe):(fe[0]=l[f],fe[1]=l[f+1],fe.length=2),c&&(c.zIndex=n[6]),P(fe,ne),++u;break;case $.DRAW_IMAGE:f=n[1],p=n[2],C=n[3],h=n[4],g=n[5];let pe=n[6],me=n[7],he=n[8],ge=n[9],_e=n[10],ve=n[11],ye=n[12],be=n[13];v=n[14]||`declutter`;let xe=n[15];if(!C&&n.length>=20){w=n[19],T=n[20],E=n[21],D=n[22];let e=this.drawLabelWithPointPlacement_(w,T,E,D);C=e.label,n[3]=C;let t=n[23];h=(e.anchorX-t)*this.pixelRatio,n[4]=h;let r=n[24];g=(e.anchorY-r)*this.pixelRatio,n[5]=g,pe=C.height,n[6]=pe,be=C.width,n[13]=be}let Se;n.length>25&&(Se=n[25]);let Ce,we,Te;n.length>17?(Ce=n[16],we=n[17],Te=n[18]):(Ce=cg,we=null,Te=null),_e&&te?ve+=ee:!_e&&!te&&(ve-=ee);let Ee=0;for(;f!ay.includes(e)),sy=!1,cy=!1;function ly(){let e=0,t=t=>{let n=Gf(1,1,null,{willReadFrequently:t}),r=0,i=performance.now();for(;performance.now()-i<50;++r)n.fillStyle=`rgba(255,0,${r%256},1)`,n.fillRect(0,0,1,1),n.getImageData(0,0,1,1);return e=r>e?r:e,r};sy={[t(!0)]:!0,[t(!1)]:!1,[t(void 0)]:void 0}[e],cy=!0}var uy=class{constructor(e,t,n,r,i,a,o){this.maxExtent_=e,this.overlaps_=r,this.pixelRatio_=n,this.resolution_=t,this.renderBuffer_=a,this.executorsByZIndex_={},this.hitDetectionContext_=null,this.hitDetectionTransform_=gd(),this.renderedContext_=null,this.deferredZIndexContexts_={},this.createExecutors_(i,!!o)}clip(e,t){let n=this.getClipCoords(t);e.beginPath(),e.moveTo(n[0],n[1]),e.lineTo(n[2],n[3]),e.lineTo(n[4],n[5]),e.lineTo(n[6],n[7]),e.clip()}createExecutors_(e,t){for(let n in e){let r=this.executorsByZIndex_[n];r===void 0&&(r={},this.executorsByZIndex_[n]=r);let i=e[n];for(let e in i){let n=i[e];r[e]=new ry(this.resolution_,this.pixelRatio_,this.overlaps_,n,t)}}}hasExecutors(e){for(let t in this.executorsByZIndex_){let n=this.executorsByZIndex_[t];for(let t=0,r=e.length;t0){if(!a||n===`none`||f!==`Image`&&f!==`Text`||a.includes(e)){let n=(d[c]-3)/4,a=r-n%o,s=r-(n/o|0),l=i(e,t,a*a+s*s);if(l)return l}p.clearRect(0,0,o,o);break}}let h=Object.keys(this.executorsByZIndex_).map(Number);h.sort(Rs);let g,_,v,y,b;for(g=h.length-1;g>=0;--g){let e=h[g].toString();for(v=this.executorsByZIndex_[e],_=iy.length-1;_>=0;--_)if(f=iy[_],y=v[f],y!==void 0&&(b=y.executeHitDetection(l,s,n,m,u),b))return b}}getClipCoords(e){let t=this.maxExtent_;if(!t)return null;let n=t[0],r=t[1],i=t[2],a=t[3],o=[n,r,n,a,i,a,i,r];return Ed(o,0,8,2,e,o),o}isEmpty(){return Ps(this.executorsByZIndex_)}execute(e,t,n,r,i,a,o){let s=Object.keys(this.executorsByZIndex_).map(Number);s.sort(o?zs:Rs),a||=iy;let c=iy.length;for(let l=0,u=s.length;lp.execute(e,t,n,r,i,o)),d&&u.restore(),a){a.offset();let e=s[l]*c+iy.indexOf(f);this.deferredZIndexContexts_[e]||(this.deferredZIndexContexts_[e]=[]),this.deferredZIndexContexts_[e].push(a)}}}}this.renderedContext_=e}getDeferredZIndexContexts(){return this.deferredZIndexContexts_}getRenderedContext(){return this.renderedContext_}renderDeferred(){let e=this.deferredZIndexContexts_,t=Object.keys(e).map(Number).sort(Rs);for(let n=0,r=t.length;n{e.draw(this.renderedContext_),e.clear()}),e[t[n]].length=0}},dy={};function fy(e){if(dy[e]!==void 0)return dy[e];let t=e*2+1,n=e*e,r=Array(n+1);for(let i=0;i<=e;++i)for(let a=0;a<=e;++a){let o=i*i+a*a;if(o>n)break;let s=r[o];s||(s=[],r[o]=s),s.push(((e+i)*t+(e+a))*4+3),i>0&&s.push(((e-i)*t+(e+a))*4+3),a>0&&(s.push(((e+i)*t+(e-a))*4+3),i>0&&s.push(((e-i)*t+(e-a))*4+3))}let i=[];for(let e=0,t=r.length;e0){let e=c.length,t=i||Math.abs(c[0]-c[e-2])<1e-6&&Math.abs(c[1]-c[e-1])<1e-6;c=Vv(c,0,e,2,s,t,c),Uv(c,2,t)}o.moveTo(c[0],c[1]);let l=c.length;i&&(l-=2);for(let e=2;ee*this.pixelRatio_),lineDashOffset:(i||0)*this.pixelRatio_,lineJoin:a===void 0?ig:a,lineWidth:(o===void 0?1:o)*this.pixelRatio_,miterLimit:s===void 0?10:s,strokeStyle:Qh(e||`#000`)||`#000`,strokeOffset:(l??0)*this.pixelRatio_}}}setImageStyle(e){let t;if(!e||!(t=e.getSize())){this.image_=null;return}let n=e.getPixelRatio(this.pixelRatio_),r=e.getAnchor(),i=e.getOrigin();if(!r||!i){this.image_=null;return}this.image_=e.getImage(this.pixelRatio_),this.imageAnchorX_=r[0]*n,this.imageAnchorY_=r[1]*n,this.imageHeight_=t[1]*n,this.imageOpacity_=e.getOpacity(),this.imageOriginX_=i[0],this.imageOriginY_=i[1],this.imageRotateWithView_=e.getRotateWithView(),this.imageRotation_=e.getRotation();let a=e.getScaleArray();this.imageScale_=[a[0]*this.pixelRatio_/n,a[1]*this.pixelRatio_/n],this.imageWidth_=t[0]*n}setTextStyle(e){if(!e)this.text_=``;else{let t=e.getFill();if(!t)this.textFillState_=null;else{let e=t.getColor();this.textFillState_={fillStyle:Qh(e||`#000`)||`#000`}}let n=e.getStroke();if(!n)this.textStrokeState_=null;else{let e=n.getColor(),t=n.getLineCap(),r=n.getLineDash(),i=n.getLineDashOffset(),a=n.getLineJoin(),o=n.getWidth(),s=n.getMiterLimit();this.textStrokeState_={lineCap:t===void 0?ng:t,lineDash:r||rg,lineDashOffset:i||0,lineJoin:a===void 0?ig:a,lineWidth:o===void 0?1:o,miterLimit:s===void 0?10:s,strokeStyle:Qh(e||`#000`)||`#000`}}let r=e.getFont(),i=e.getOffsetX(),a=e.getOffsetY(),o=e.getRotateWithView(),s=e.getRotation(),c=e.getScaleArray(),l=e.getText(),u=e.getTextAlign(),d=e.getTextBaseline();this.textState_={font:r===void 0?eg:r,textAlign:u===void 0?og:u,textBaseline:d===void 0?sg:d},this.text_=l===void 0?``:Array.isArray(l)?l.reduce((e,t,n)=>e+=n%2?` `:t,``):l,this.textOffsetX_=i===void 0?0:this.pixelRatio_*i,this.textOffsetY_=a===void 0?0:this.pixelRatio_*a,this.textRotateWithView_=o!==void 0&&o,this.textRotation_=s===void 0?0:s,this.textScale_=[this.pixelRatio_*c[0],this.pixelRatio_*c[1]]}}},my=.5;function hy(e,t,n,r,i,a,o,s,c){let l=c?ud(i,c):i,u=Gf(e[0]*my,e[1]*my);u.imageSmoothingEnabled=!1;let d=u.canvas,f=new py(u,my,i,[1,0,0,1,0,0],o,s??0,c?nd(sd(),c)??void 0:void 0),p=n.length,m=Math.floor(16777215/p),h={};for(let e=1;e<=p;++e){let t=n[e-1],i=t.getStyleFunction()||r;if(!i)continue;let o=i(t,a);if(!o)continue;Array.isArray(o)||(o=[o]);let s=(e*m).toString(16).padStart(7,`#00000`);for(let e=0,n=o.length;e0;return d&&Promise.all(c).then(()=>i(null)),wy(e,t,n,r,a,o,s),d}function wy(e,t,n,r,i,a,o){let s=n.getGeometryFunction()(t);if(!s)return;let c=s.simplifyTransformed(r,i);if(n.getRenderer())Ty(e,c,n,t,o);else{let r=vy[c.getType()];r(e,c,n,t,o,a)}}function Ty(e,t,n,r,i){if(t.getType()==`GeometryCollection`){let a=t.getGeometries();for(let t=0,o=a.length;t{if(this.frameState&&!this.hitDetectionImageData_&&!this.animatingOrInteracting_){let e=this.frameState.size.slice(),t=this.renderedCenter_,n=this.renderedResolution_,r=this.renderedRotation_,i=this.renderedProjection_,a=this.wrappedRenderedExtent_,o=this.getLayer(),s=[],c=e[0]*my,l=e[1]*my;s.push(this.getRenderTransform(t,n,r,my,c,l,0).slice());let u=o.getSource(),d=i.getExtent();if(u.getWrapX()&&i.canWrapX()&&!Kc(d,a)){let e=a[0],i=G(d),o=0,u;for(;ed[2];)++o,u=i*o,s.push(this.getRenderTransform(t,n,r,my,c,l,u).slice()),e-=i}let f=sd();this.hitDetectionImageData_=hy(e,s,this.renderedFeatures_,o.getStyleFunction(),a,n,r,by(n,this.renderedPixelRatio_),f?i:null)}t(gy(e,this.renderedFeatures_,this.hitDetectionImageData_))})}forEachFeatureAtCoordinate(e,t,n,r,i){if(!this.replayGroup_)return;let a=t.viewState.resolution,o=t.viewState.rotation,s=this.getLayer(),c={},l=function(e,t,n){let a=V(e),o=c[a];if(!o){if(n===0)return c[a]=!0,r(e,s,t);i.push(c[a]={feature:e,layer:s,geometry:t,distanceSq:n,callback:r})}else if(o!==!0&&ne.value):null)}handleFontsChanged(){let e=this.getLayer();e.getVisible()&&this.replayGroup_&&e.changed()}handleStyleImageChange_(e){this.renderIfReadyAndVisible()}prepareFrame(e){let t=this.getLayer(),n=t.getSource();if(!n)return!1;let r=e.viewHints[Tc.ANIMATING],i=e.viewHints[Tc.INTERACTING],a=t.getUpdateWhileAnimating(),o=t.getUpdateWhileInteracting();if(this.ready&&!a&&r||!o&&i)return this.animatingOrInteracting_=!0,!0;this.animatingOrInteracting_=!1;let s=e.extent,c=e.viewState,l=c.projection,u=c.resolution,d=e.pixelRatio,f=t.getRevision(),p=t.getRenderBuffer(),m=t.getRenderOrder();m===void 0&&(m=yy);let h=c.center.slice(),g=Hc(s,p*u),_=g.slice(),v=[g.slice()],y=l.getExtent(),b=n.getWrapX()&&l.canWrapX();if(this.extendX_=!1,b){let e=n.getExtent();e&&!yl(e)&&(this.extendX_=e[0]y[2])}if(b&&(!Kc(y,e.extent)||this.extendX_)){let e=G(y),t=Math.max(G(g)/2,e),n=y[0],r=y[2];this.extendX_&&(n-=e,r+=e),g[0]=n-t,g[2]=r+t,kl(h,l);let i=Sl(v[0],l);i[0]y[0]&&i[2]>y[2]&&v.push([i[0]-e,i[1],i[2]-e,i[3]])}if(this.ready&&this.renderedResolution_==u&&this.renderedPixelRatio_===d&&this.renderedRevision_==f&&this.renderedRenderOrder_==m&&this.renderedFrameDeclutter_===!!e.declutter&&Kc(this.wrappedRenderedExtent_,g))return Us(this.renderedExtent_,_)||(this.hitDetectionImageData_=null,this.renderedExtent_=_),this.renderedCenter_=h,this.replayGroupChanged=!1,!0;this.replayGroup_=null;let x=new zv(xy(u,d),g,u,d),S=sd(),C;if(S){for(let e=0,t=v.length;e{let r,i=e.getStyleFunction()||t.getStyleFunction();if(i&&(r=i(e,u)),r){let t=this.renderFeature(e,w,r,x,C,this.getLayer().getDeclutter(),n);T&&=!t}},D=ud(g,l),O=n.getFeaturesInExtent(D);m&&O.sort(m);for(let e=0,t=O.length;ee!==void 0)),this.minZoom=t===void 0?0:t,this.resolutions_=n,U(Ws(this.resolutions_,(e,t)=>t-e,!0),"`resolutions` must be sorted in descending order");let r;if(!e.origins){for(let e=0,t=this.resolutions_.length-1;e{let n=new B_(Math.min(0,e[0]),Math.max(e[0]-1,-1),Math.min(0,e[1]),Math.max(e[1]-1,-1));if(i){let e=this.getTileRangeForExtentAndZ(i,t);n.minX=Math.max(e.minX,n.minX),n.maxX=Math.min(e.maxX,n.maxX),n.minY=Math.max(e.minY,n.minY),n.maxY=Math.min(e.maxY,n.maxY)}return n}):this.fullTileRanges_=e.tileRanges}forEachTileCoord(e,t,n){let r=this.getTileRangeForExtentAndZ(e,t);for(let e=r.minX,i=r.maxX;e<=i;++e)for(let i=r.minY,a=r.maxY;i<=a;++i)n([t,e,i])}forEachTileCoordParentTileRange(e,t,n,r){let i,a,o,s=null,c=e[0]-1;for(this.zoomFactor_===2?(a=e[1],o=e[2]):s=this.getTileCoordExtent(e,r);c>=this.minZoom;){if(a!==void 0&&o!==void 0?(a=Math.floor(a/2),o=Math.floor(o/2),i=V_(a,a,o,o,n)):i=this.getTileRangeForExtentAndZ(s,c,n),t(c,i))return!0;--c}return!1}getExtent(){return this.extent_}getMaxZoom(){return this.maxZoom}getMinZoom(){return this.minZoom}getOrigin(e){return this.origin_?this.origin_:this.origins_?this.origins_[e]:[0,0]}getOrigins(){return this.origins_}getResolution(e){return this.resolutions_[e]}getResolutions(){return this.resolutions_}getTileCoordChildTileRange(e,t,n){if(e[0]this.maxZoom||t0?r:Math.max(a/n[0],i/n[1]);let o=t+1,s=Array(o);for(let e=0;e{let n=()=>{let r=this.getState();r===`ready`?(this.un(`change`,n),e()):r===`error`&&(this.un(`change`,n),t(Error(`Source failed to load`)))};this.on(`change`,n)})}getState(){return this.state_}getWrapX(){return this.wrapX_}getInterpolate(){return this.interpolate_}refresh(){this.changed()}setAttributions(e){this.attributions_=nb(e),this.changed()}setState(e){this.state_=e,this.changed()}};function nb(e){return e?typeof e==`function`?e:(Array.isArray(e)||(e=[e]),t=>e):null}var rb=class extends tb{constructor(e){super({attributions:e.attributions,attributionsCollapsible:e.attributionsCollapsible,projection:e.projection,state:e.state,wrapX:e.wrapX,interpolate:e.interpolate}),this.on,this.once,this.un,this.tilePixelRatio_=e.tilePixelRatio===void 0?1:e.tilePixelRatio,this.tileGrid=e.tileGrid===void 0?null:e.tileGrid,this.tileGrid&&Bm(this.tileGrid.getTileSize(this.tileGrid.getMinZoom()),[256,256]),this.tmpSize=[0,0],this.key_=e.key||V(this),this.tileOptions={transition:e.transition,interpolate:e.interpolate},this.zDirection=e.zDirection?e.zDirection:0}getGutterForProjection(e){return 0}getKey(){return this.key_}setKey(e){this.key_!==e&&(this.key_=e,this.changed())}getResolutions(e){let t=e?this.getTileGridForProjection(e):this.tileGrid;return t?t.getResolutions():null}getTile(e,t,n,r,i,a){return B()}getTileGrid(){return this.tileGrid}getTileGridForProjection(e){return this.tileGrid?this.tileGrid:zy(e)}getTilePixelRatio(e){return this.tilePixelRatio_}getTilePixelSize(e,t,n){let r=this.getTileGridForProjection(n),i=this.getTilePixelRatio(t),a=Bm(r.getTileSize(e),this.tmpSize);return i==1?a:zm(a,i,this.tmpSize)}getTileCoordForTileUrlFunction(e,t){let n=t===void 0?this.getProjection():t,r=t===void 0&&this.tileGrid||this.getTileGridForProjection(n);return this.getWrapX()&&n.isGlobal()&&(e=By(r,e,n)),sv(e,r)?e:null}clear(){}refresh(){this.clear(),super.refresh()}},ib=class extends Qs{constructor(e,t){super(e),this.tile=t}},ab={TILELOADSTART:`tileloadstart`,TILELOADEND:`tileloadend`,TILELOADERROR:`tileloaderror`},ob=class e extends rb{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===e.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(e){let t=e.target,n=V(t),r=t.getState(),i;r==H.LOADING?(this.tileLoadingKeys_[n]=!0,i=ab.TILELOADSTART):n in this.tileLoadingKeys_&&(delete this.tileLoadingKeys_[n],i=r==H.ERROR?ab.TILELOADERROR:r==H.LOADED?ab.TILELOADEND:void 0),i!=null&&this.dispatchEvent(new ib(i,t))}setTileLoadFunction(e){this.tileLoadFunction=e,this.changed()}setTileUrlFunction(e,t){this.tileUrlFunction=e,t===void 0?this.changed():this.setKey(t)}setUrl(e){let t=Zy(e);this.urls=t,this.setUrls(t)}setUrls(e){this.urls=e;let t=e.join(` +`);this.generateTileUrlFunction_?this.setTileUrlFunction($y(e,this.tileGrid),t):this.setKey(t)}tileUrlFunction(e,t,n){}},sb=class extends ob{constructor(e){super({attributions:e.attributions,cacheSize:e.cacheSize,projection:e.projection,state:e.state,tileGrid:e.tileGrid,tileLoadFunction:e.tileLoadFunction?e.tileLoadFunction:cb,tilePixelRatio:e.tilePixelRatio,tileUrlFunction:e.tileUrlFunction,url:e.url,urls:e.urls,wrapX:e.wrapX,transition:e.transition,interpolate:e.interpolate===void 0||e.interpolate,key:e.key,attributionsCollapsible:e.attributionsCollapsible,zDirection:e.zDirection}),this.crossOrigin=e.crossOrigin===void 0?null:e.crossOrigin,this.referrerPolicy=e.referrerPolicy,this.tileClass=e.tileClass===void 0?R_:e.tileClass,this.tileGridForProjection={},this.reprojectionErrorThreshold_=e.reprojectionErrorThreshold,this.renderReprojectionEdges_=!1}getGutterForProjection(e){let t=this.getProjection();return t&&e&&!td(t,e)?0:this.getGutter()}getGutter(){return 0}getKey(){let e=super.getKey();return this.getInterpolate()||(e+=`:disable-interpolation`),e}getTileGridForProjection(e){let t=this.getProjection();if(this.tileGrid&&(!t||td(t,e)))return this.tileGrid;let n=V(e);return n in this.tileGridForProjection||(this.tileGridForProjection[n]=zy(e)),this.tileGridForProjection[n]}createTile_(e,t,n,r,i,a){let o=[e,t,n],s=this.getTileCoordForTileUrlFunction(o,i),c=s?this.tileUrlFunction(s,r,i):void 0,l=new this.tileClass(o,c===void 0?H.EMPTY:H.IDLE,c===void 0?``:c,{crossOrigin:this.crossOrigin,referrerPolicy:this.referrerPolicy},this.tileLoadFunction,this.tileOptions);return l.key=a,l.addEventListener(z.CHANGE,this.handleTileChange.bind(this)),l}getTile(e,t,n,r,i,a){let o=this.getProjection();if(!o||!i||td(o,i))return this.getTileInternal(e,t,n,r,o||i);let s=[e,t,n],c=this.getKey(),l=new ev(o,this.getTileGridForProjection(o),i,this.getTileGridForProjection(i),s,this.getTileCoordForTileUrlFunction(s,i)||s,this.getTilePixelRatio(r),this.getGutter(),(e,t,n,r)=>this.getTileInternal(e,t,n,r,o,a),this.reprojectionErrorThreshold_,this.renderReprojectionEdges_,this.tileOptions);return l.key=c,l}getTileInternal(e,t,n,r,i,a){let o=this.getKey(),s=iv(this,o,e,t,n);if(a&&a.containsKey(s))return a.get(s);let c=this.createTile_(e,t,n,r,i,o);return a?.set(s,c),c}setRenderReprojectionEdges(e){this.renderReprojectionEdges_!=e&&(this.renderReprojectionEdges_=e,this.changed())}setTileGridForProjection(e,t){let n=Ju(e);if(n){let e=V(n);e in this.tileGridForProjection||(this.tileGridForProjection[e]=t)}}};function cb(e,t){if(mc){let n=e.getCrossOrigin(),r=`same-origin`,i=`same-origin`;n===`anonymous`||n===``?(r=`cors`,i=`omit`):n===`use-credentials`&&(r=`cors`,i=`include`);let a={mode:r,credentials:i,referrerPolicy:e.getReferrerPolicy()};fetch(t,a).then(e=>{if(!e.ok)throw Error(`HTTP ${e.status}`);return e.blob()}).then(e=>createImageBitmap(e)).then(t=>{let n=e.getImage();if(!n)return;n.width=t.width,n.height=t.height;let r=n.getContext(`2d`);r&&(r.drawImage(t,0,0),t.close?.(),n.dispatchEvent(new Event(`load`)))}).catch(()=>{e.getImage()?.dispatchEvent(new Event(`error`))})}else e.getImage().src=t}var lb=class extends sb{constructor(e){e||={};let t=e.projection===void 0?`EPSG:3857`:e.projection,n=e.tileGrid===void 0?Hy({extent:Gy(t),maxResolution:e.maxResolution,maxZoom:e.maxZoom,minZoom:e.minZoom,tileSize:e.tileSize}):e.tileGrid;super({attributions:e.attributions,cacheSize:e.cacheSize,crossOrigin:e.crossOrigin,referrerPolicy:e.referrerPolicy,interpolate:e.interpolate,projection:t,reprojectionErrorThreshold:e.reprojectionErrorThreshold,tileGrid:n,tileLoadFunction:e.tileLoadFunction,tilePixelRatio:e.tilePixelRatio,tileUrlFunction:e.tileUrlFunction,url:e.url,urls:e.urls,wrapX:e.wrapX===void 0||e.wrapX,transition:e.transition,attributionsCollapsible:e.attributionsCollapsible,zDirection:e.zDirection}),this.gutter_=e.gutter===void 0?0:e.gutter}getGutter(){return this.gutter_}},ub=!1;function db(e,t,n,r,i,a,o){let s=new XMLHttpRequest;s.open(`GET`,typeof e==`function`?e(n,r,i):e,!0),t.getType()==`arraybuffer`&&(s.responseType=`arraybuffer`),s.withCredentials=ub,s.onload=function(e){if(!s.status||s.status>=200&&s.status<300){let e=t.getType();try{let r;e==`text`||e==`json`?r=s.responseText:e==`xml`?r=s.responseXML||s.responseText:e==`arraybuffer`&&(r=s.response),r?a(t.readFeatures(r,{extent:n,featureProjection:i}),t.readProjection(r)):o()}catch{o()}}else o()},s.onerror=o,s.send()}function fb(e,t){return function(n,r,i,a,o){db(e,t,n,r,i,(e,t)=>{this.addFeatures(e),a!==void 0&&a(e)},()=>{this.changed(),o!==void 0&&o()})}}function pb(e,t){return[[-1/0,-1/0,1/0,1/0]]}function mb(e,t,n,r,i,a,o){let s,c,l=(n-t)/r;if(l===1)s=t;else if(l===2)s=t,c=i;else if(l!==0){let a=e[t],o=e[t+1],l=0,u=[0];for(let i=t+r;i1?o:2,a||=Array(o);for(let t=0;t{if(t===this.squaredTolerance_)return this.simplifiedGeometry_;this.simplifiedGeometry_=this.clone(),n&&this.simplifiedGeometry_.applyTransform(n);let r=this.simplifiedGeometry_.getFlatCoordinates(),i;switch(this.type_){case`LineString`:r.length=rf(r,0,this.simplifiedGeometry_.flatCoordinates_.length,this.simplifiedGeometry_.stride_,t,r,0),i=[r.length];break;case`MultiLineString`:i=[],r.length=af(r,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,t,r,0,i);break;case`Polygon`:i=[],r.length=cf(r,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,Math.sqrt(t),r,0,i)}return i&&(this.simplifiedGeometry_=new e(this.type_,r,i,this.stride_,this.properties_,this.id_)),this.squaredTolerance_=t,this.simplifiedGeometry_}),this}};_b.prototype.getFlatCoordinates=_b.prototype.getOrientedFlatCoordinates;var vb=class{constructor(e){this.rbush_=new $p(e),this.items_={}}insert(e,t){let n={minX:e[0],minY:e[1],maxX:e[2],maxY:e[3],value:t};this.rbush_.insert(n),this.items_[V(t)]=n}load(e,t){let n=Array(t.length);for(let r=0,i=t.length;r{t||=(t=!0,this.addFeature(e.element),!1)})),e.addEventListener(js.REMOVE,(e=>{t||=(t=!0,this.removeFeature(e.element),!1)})),this.featuresCollection_=e}clear(e){if(e){for(let e in this.featureChangeKeys_)this.featureChangeKeys_[e].forEach(R);this.featuresCollection_||(this.featureChangeKeys_={},this.idIndex_={},this.uidIndex_={})}else if(this.featuresRtree_){this.featuresRtree_.forEach(e=>{this.removeFeatureInternal(e)});for(let e in this.nullGeometryFeatures_)this.removeFeatureInternal(this.nullGeometryFeatures_[e])}this.featuresCollection_&&this.featuresCollection_.clear(),this.featuresRtree_&&this.featuresRtree_.clear(),this.nullGeometryFeatures_={};let t=new bb(yb.CLEAR);this.dispatchEvent(t),this.changed()}forEachFeature(e){if(this.featuresRtree_)return this.featuresRtree_.forEach(e);this.featuresCollection_&&this.featuresCollection_.forEach(e)}forEachFeatureAtCoordinateDirect(e,t){let n=[e[0],e[1],e[0],e[1]];return this.forEachFeatureInExtent(n,function(n){let r=n.getGeometry();if(r instanceof _b||r&&r.intersectsCoordinate(e))return t(n)})}forEachFeatureInExtent(e,t){if(this.featuresRtree_)return this.featuresRtree_.forEachInExtent(e,t);this.featuresCollection_&&this.featuresCollection_.forEach(t)}forEachFeatureIntersectingExtent(e,t){return this.forEachFeatureInExtent(e,function(n){let r=n.getGeometry();if(r instanceof _b||r&&r.intersectsExtent(e)){let e=t(n);if(e)return e}})}getFeaturesCollection(){return this.featuresCollection_}getFeatures(){let e;return this.featuresCollection_?e=this.featuresCollection_.getArray().slice(0):this.featuresRtree_&&(e=this.featuresRtree_.getAll(),Ps(this.nullGeometryFeatures_)||Hs(e,Object.values(this.nullGeometryFeatures_))),e||[]}getFeaturesAtCoordinate(e){let t=[];return this.forEachFeatureAtCoordinateDirect(e,function(e){t.push(e)}),t}getFeaturesInExtent(e,t){if(this.featuresRtree_){if(!(t&&t.canWrapX()&&this.getWrapX()))return this.featuresRtree_.getInExtent(e);let n=this.featuresRtree_;return Cl(e,t).flatMap(e=>n.getInExtent(e))}return this.featuresCollection_?this.featuresCollection_.getArray().slice(0):[]}getClosestFeatureToCoordinate(e,t){let n=e[0],r=e[1],i=null,a=[NaN,NaN],o=1/0,s=[-1/0,-1/0,1/0,1/0];t||=qs;let c=this.featuresRtree_;return c?(c.forEachInExtent(s,function(e){if(t(e)){let t=e.getGeometry();if(!t)return;let c=o;if(o=t instanceof _b?0:t.closestPointXY(n,r,a,o),o{this.loading=Number(this.loading)-1,this.dispatchEvent(new bb(yb.FEATURESLOADEND,void 0,e))},i=()=>{this.changed(),this.loading=Number(this.loading)-1,this.dispatchEvent(new bb(yb.FEATURESLOADERROR))},o=!1,s=this.loader_.call(this,a,t,n,t=>o||e(t),()=>o||i());Ks(s)?(o=!0,s.then(t=>{let n=t;this.addFeatures(n),e(n)}).catch(i)):this.loader_.length<4&&(this.loading=!1),r.insert(a,{extent:a.slice()})}}}refresh(){this.clear(!0),this.loadedExtentsRtree_.clear(),super.refresh()}removeLoadedExtent(e){let t=this.loadedExtentsRtree_,n=[];t.forEachInExtent(e,function(e){n.push(e)}),n.forEach(n=>{t.remove(n);let r=hl(n.extent,e);for(let e of r)t.insert(e,{extent:e})})}removeFeatures(e){let t=!1;for(let n=0,r=e.length;n{n.src=Cb};caches.open(d).then(async e=>{let i=await e.match(t);if(!i){r();return}let a=await i.blob(),o=URL.createObjectURL(a),s=()=>URL.revokeObjectURL(o);n.addEventListener(`load`,s,{once:!0}),n.addEventListener(`error`,()=>{s(),r()},{once:!0}),n.src=o}).catch(r)}function jb(e,t,n){n?(t.getGeometry()?.setCoordinates([n.easting,n.northing]),e.hasFeature(t)||e.addFeature(t)):e.hasFeature(t)&&e.removeFeature(t)}function Mb(e,t,n){e.style.background=wb;let r=Ju(`EPSG:25832`);if(!r)throw Error(`EPSG:25832 ist nicht registriert.`);let i=Ob(t);r.setExtent(i);let a=t.tileSizePx,o=new Ry({origin:[0,1024e4],resolutions:[...t.resolutions].reverse(),tileSize:a,extent:i}),s=new Db({projection:r,tileGrid:o,zDirection:-1,wrapX:!1,transition:0,tileUrlFunction(e){let n=t.resolutions.length-1-e[0];if(n<0||n>=t.resolutions.length)return;let r=o.getResolution(e[0]),i=o.getTileCoordExtent(e),s=r*a;return f(`${n}/${Math.floor(i[0]/s+1e-9)}/${Math.floor(i[1]/s+1e-9)}`)},tileLoadFunction:Ab}),c=new xb,l=kb(Tb),u=new A_({geometry:new uf([0,0])});u.setStyle(kb(Eb));let d=n.snapshot(),p=Nb(e),m=Pb(r,[d.center.easting,d.center.northing],d.resolution,Zo(p,Xo)),h=new O_({target:e,layers:[new xv({source:s}),new Py({source:c,updateWhileAnimating:!0,updateWhileInteracting:!0})],view:m,controls:[],interactions:Vp({altShiftDragRotate:!1,pinchRotate:!1,doubleClickZoom:!1,keyboard:!1,shiftDragZoom:!1})}),g=!1,_=!1,v=0,y=0,b=()=>{let e=h.getView(),t=e.getCenter(),r=e.getResolution();t&&r!==void 0&&(n.panTo({easting:t[0],northing:t[1]}),n.zoomTo(r))},x=()=>{_||(_=!0,b())};h.on(`singleclick`,e=>{let[t,r]=e.coordinate;n.tap({easting:t,northing:r})}),h.on(`pointerdrag`,x),h.getViewport()?.addEventListener(`wheel`,x,{passive:!0}),h.on(`moveend`,()=>{if(g)return;let e=h.getView();!_||e.getInteracting()||e.getAnimating()||(_=!1,b())});let S=e=>{let t=Zo(e,Xo),n=h.getView();if(Math.abs(n.getMaxResolution()-t)<1e-9)return;let i=n.getCenter(),a=n.getResolution();i&&a!==void 0&&(g=!0,m=Pb(r,[i[0],i[1]],Math.min(Math.max(a,Xo.minResolutionMeters),t),t),h.setView(m),requestAnimationFrame(()=>{g=!1}))},C=()=>{let e=h.getSize();if(!e)return;let t=Math.round(e[0]),r=Math.round(e[1]);if(t<1||r<1||t===v&&r===y)return;v=t,y=r;let i={widthPx:t,heightPx:r},a=h.getView();!a.getInteracting()&&!a.getAnimating()&&S(i),n.setViewport(i)};return h.on(`change:size`,C),C(),{apply(e){let t=new Set(e.ziele.map(e=>e.koordinate));for(let e of[...c.getFeatures()]){if(e===u)continue;let n=e.getId();(typeof n!=`string`||!t.has(n))&&c.removeFeature(e)}for(let t of e.ziele){let e=c.getFeatureById(t.koordinate)?.getGeometry();if(e instanceof uf){e.setCoordinates([t.point.easting,t.point.northing]);continue}let n=new A_({geometry:new uf([t.point.easting,t.point.northing])});n.setId(t.koordinate),n.setStyle(l),c.addFeature(n)}jb(c,u,e.standort);let n=h.getView();if(n.getInteracting()||n.getAnimating())return;let r=h.getSize();r&&r[0]>=1&&r[1]>=1&&S({widthPx:Math.round(r[0]),heightPx:Math.round(r[1])});let i=h.getView(),a=i.getCenter(),o=i.getResolution(),s=[e.center.easting,e.center.northing],d=a!==void 0&&Math.abs(a[0]-s[0])<.01&&Math.abs(a[1]-s[1])<.01,f=o!==void 0&&Math.abs(o-e.resolution)<1e-6;d&&f||(g=!0,i.setCenter(s),i.setResolution(e.resolution),i.setRotation(0),requestAnimationFrame(()=>{g=!1}))},refreshTiles(){s.reload()}}}function Nb(e){let t=Math.round(e.clientWidth)||window.innerWidth,n=Math.round(e.clientHeight)||window.innerHeight;return{widthPx:Math.max(t,1),heightPx:Math.max(n,1)}}function Pb(e,t,n,r){let i=Xo.minResolutionMeters,a=Math.max(r,i);return new Af({projection:e,center:t,resolution:Math.min(Math.max(n,i),a),rotation:0,enableRotation:!1,resolutions:[a,i],constrainResolution:!1,smoothResolutionConstraint:!1,multiWorld:!1})}function Fb(e,t,n){e.replaceChildren();let r=document.createElement(`div`);r.className=`map`;let i=document.createElement(`section`);i.className=`panel`,i.innerHTML=` +
+

Karte

+
+ + + +
+
+ + + + + `;let a=document.createElement(`dialog`);a.innerHTML=` +

+

+
+ + +
+ `,e.append(i,r,a);let o=i.querySelector(`#ziele`),s=i.querySelector(`.fold-toggle`),c=i.querySelector(`#einstellungen`),l=i.querySelector(`.einstellungen-toggle`),u=i.querySelector(`#info`),d=i.querySelector(`.info-toggle`),f=i.querySelector(`form`),p=i.querySelector(`input[name="gitter"]`),m=i.querySelector(`input[name="rechtswert"]`),h=i.querySelector(`input[name="hochwert"]`),g=i.querySelector(`.ziel-list`),_=i.querySelector(`.actions button`),v=i.querySelector(`.download-knopf input`),y=i.querySelector(`.gebiet`),b=i.querySelector(`.gebiet p`),x=i.querySelector(`.gebiet button`),S=i.querySelector(`.wipe`),C=i.querySelector(`.notice`),w=a.querySelector(`.ask`),T=a.querySelector(`.explain`),E=a.querySelector(`.confirm`),D=a.querySelector(`.cancel`);if(!o||!s||!c||!l||!u||!d||!f||!p||!m||!h||!g||!_||!v||!y||!b||!x||!S||!C||!w||!T||!E||!D)return;let O=t.snapshot();p.value=O.koordinate.gitter,m.value=O.koordinate.rechtswert,h.value=O.koordinate.hochwert;let k=Mb(r,n,t),A=document.createElement(`button`);A.type=`button`,A.className=`map-download icon-button`,A.setAttribute(`aria-label`,`Diese Ansicht herunterladen`),A.title=`Diese Ansicht herunterladen`,A.innerHTML=zb,A.addEventListener(`click`,()=>t.downloadView());let ee=!1,te=Ib(t.snapshot());f.addEventListener(`submit`,e=>{e.preventDefault(),t.enterKoordinate({gitter:p.value,rechtswert:m.value,hochwert:h.value})}),s.addEventListener(`click`,()=>{let e=o.hasAttribute(`hidden`);o.toggleAttribute(`hidden`,!e),s.setAttribute(`aria-expanded`,e?`true`:`false`)}),l.addEventListener(`click`,()=>{let e=c.hasAttribute(`hidden`);c.toggleAttribute(`hidden`,!e),l.setAttribute(`aria-expanded`,e?`true`:`false`)}),d.addEventListener(`click`,()=>{let e=u.hasAttribute(`hidden`);u.toggleAttribute(`hidden`,!e),d.setAttribute(`aria-expanded`,e?`true`:`false`)}),_.addEventListener(`click`,()=>t.centerOnStandort()),v.addEventListener(`change`,()=>{t.setDownloadKnopf(v.checked)}),x.addEventListener(`click`,()=>{x.disabled||t.startHessen()}),S.addEventListener(`click`,()=>j()),E.addEventListener(`click`,()=>{let e=ee;ee=!1,a.close(),e&&t.deleteCache()}),D.addEventListener(`click`,()=>{ee=!1,a.open&&a.close()}),a.addEventListener(`cancel`,()=>{ee=!1});let ne=()=>{let e=t.snapshot();k.apply(e);let n=Ib(e);n!==te&&(te=n,k.refreshTiles()),re(e)},re=e=>{g.replaceChildren();for(let n of e.ziele){let e=document.createElement(`li`),r=document.createElement(`button`);r.type=`button`,r.className=`secondary ziel-open`,r.textContent=n.entfernung?`${n.koordinate} ${n.entfernung.text}`:n.koordinate,r.addEventListener(`click`,()=>t.centerOnZiel(n.koordinate));let i=document.createElement(`button`);i.type=`button`,i.className=`secondary`,i.textContent=`Löschen`,i.addEventListener(`click`,()=>t.deleteZiel(n.koordinate)),e.append(r,i),g.append(e)}e.notice?(C.hidden=!1,C.textContent=e.notice):(C.hidden=!0,C.textContent=``),v.checked=e.downloadKnopf,e.downloadKnopf?r.append(A):A.remove();let n=e.hessen.arrived{a.open||(ee=!0,w.textContent=`Den ganzen Cache löschen?`,T.textContent=`Alle Kacheln werden gelöscht.`,E.textContent=`Löschen`,a.showModal())};t.subscribe(ne),ne()}function Ib(e){return e.kacheln.map(e=>`${e.id}:${e.appearance}`).join(` +`)}var Lb=``,Rb=``,zb=``,Bb=``,Vb=``;Hb();async function Hb(){let e=document.querySelector(`#app`);if(e instanceof HTMLElement){navigator.storage?.persist&&navigator.storage.persist(),u({immediate:!0});try{let[t,n]=await Promise.all([Ub(),Wb()]),r=await ks({uebersicht:t,cache:m(),marks:te(),kacheln:w(),config:Xo,viewport:{widthPx:window.innerWidth,heightPx:window.innerHeight},...n===void 0?{}:{standort:n},online:navigator.onLine,appOpen:document.visibilityState===`visible`});Fb(e,r,t),S(),Gb(r)}catch(t){As(e,t)}}}async function Ub(){let e=await fetch(`/uebersicht.json`);if(!e.ok)throw Error(`Übersicht fehlt`);return await e.json()}function Wb(){return navigator.geolocation?new Promise(e=>{navigator.geolocation.getCurrentPosition(t=>{e(Jo(t.coords.longitude,t.coords.latitude))},t=>{t.code===t.TIMEOUT?e(void 0):e(`denied`)},{maximumAge:3e4,timeout:2e3})}):Promise.resolve(`denied`)}function Gb(e){let t=null,n=n=>{t?.(),t=null,n&&(t=Yo(t=>e.reportStandort(t)))};document.addEventListener(`visibilitychange`,()=>{document.visibilityState===`visible`?(e.setAppOpen(!0),n(!0)):(n(!1),e.setAppOpen(!1))}),window.addEventListener(`online`,()=>e.setOnline(!0)),window.addEventListener(`offline`,()=>e.setOnline(!1)),n(document.visibilityState===`visible`)} \ No newline at end of file diff --git a/public/assets/index-BIwdVEBe.css b/public/assets/index-BfT1SDCl.css similarity index 75% rename from public/assets/index-BIwdVEBe.css rename to public/assets/index-BfT1SDCl.css index 5d5d665..9b03c7f 100644 --- a/public/assets/index-BIwdVEBe.css +++ b/public/assets/index-BfT1SDCl.css @@ -1 +1 @@ -:root,:host{--ol-background-color:white;--ol-accent-background-color:#f5f5f5;--ol-subtle-background-color:#80808040;--ol-partial-background-color:#ffffffbf;--ol-foreground-color:#333;--ol-subtle-foreground-color:#666;--ol-brand-color:#0af}.ol-box{box-sizing:border-box;border:1.5px solid var(--ol-background-color);background-color:var(--ol-partial-background-color);border-radius:2px}.ol-mouse-position{position:absolute;top:8px;right:8px}.ol-scale-line{background:var(--ol-partial-background-color);border-radius:4px;padding:2px;position:absolute;bottom:8px;left:8px}.ol-scale-line-inner{border:1px solid var(--ol-subtle-foreground-color);color:var(--ol-foreground-color);text-align:center;will-change:contents, width;border-top:none;margin:1px;font-size:10px;transition:all .25s}.ol-scale-bar{position:absolute;bottom:8px;left:8px}.ol-scale-bar-inner{display:flex}.ol-scale-step-marker{background-color:var(--ol-foreground-color);float:right;z-index:10;width:1px;height:15px}.ol-scale-step-text{z-index:11;color:var(--ol-foreground-color);text-shadow:-1.5px 0 var(--ol-partial-background-color), 0 1.5px var(--ol-partial-background-color), 1.5px 0 var(--ol-partial-background-color), 0 -1.5px var(--ol-partial-background-color);font-size:10px;position:absolute;bottom:-5px}.ol-scale-text{text-align:center;color:var(--ol-foreground-color);text-shadow:-1.5px 0 var(--ol-partial-background-color), 0 1.5px var(--ol-partial-background-color), 1.5px 0 var(--ol-partial-background-color), 0 -1.5px var(--ol-partial-background-color);font-size:12px;position:absolute;bottom:25px}.ol-scale-singlebar{z-index:9;box-sizing:border-box;border:1px solid var(--ol-foreground-color);height:10px;position:relative}.ol-scale-singlebar-even{background-color:var(--ol-subtle-foreground-color)}.ol-scale-singlebar-odd{background-color:var(--ol-background-color)}.ol-unsupported{display:none}.ol-viewport,.ol-unselectable{-webkit-touch-callout:none;-webkit-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent}.ol-viewport canvas{all:unset;overflow:hidden}.ol-viewport{touch-action:pan-x pan-y}.ol-selectable{-webkit-touch-callout:default;-webkit-user-select:text;user-select:text}.ol-grabbing{cursor:-webkit-grabbing;cursor:-moz-grabbing;cursor:grabbing}.ol-grab{cursor:move;cursor:-webkit-grab;cursor:-moz-grab;cursor:grab}.ol-control{background-color:var(--ol-subtle-background-color);border-radius:4px;position:absolute}.ol-zoom{top:.5em;left:.5em}.ol-rotate{transition:opacity .25s linear,visibility linear;top:.5em;right:.5em}.ol-rotate.ol-hidden{opacity:0;visibility:hidden;transition:opacity .25s linear,visibility 0s linear .25s}.ol-zoom-extent{top:4.643em;left:.5em}.ol-full-screen{top:.5em;right:.5em}.ol-control button{color:var(--ol-subtle-foreground-color);font-weight:700;font-size:inherit;text-align:center;background-color:var(--ol-background-color);border:none;border-radius:2px;width:1.375em;height:1.375em;margin:1px;padding:0;line-height:.4em;text-decoration:none;display:block}.ol-control button::-moz-focus-inner{border:none;padding:0}.ol-zoom-extent button{line-height:1.4em}.ol-compass{will-change:transform;font-weight:400;display:block}.ol-touch .ol-control button{font-size:1.5em}.ol-touch .ol-zoom-extent{top:5.5em}.ol-control button:hover,.ol-control button:focus{outline:1px solid var(--ol-subtle-foreground-color);color:var(--ol-foreground-color);text-decoration:none}.ol-zoom .ol-zoom-in{border-radius:2px 2px 0 0}.ol-zoom .ol-zoom-out{border-radius:0 0 2px 2px}.ol-attribution{text-align:right;flex-flow:row-reverse;align-items:center;max-width:calc(100% - 1.3em);display:flex;bottom:.5em;right:.5em}.ol-attribution a{color:var(--ol-subtle-foreground-color);text-decoration:none}.ol-attribution ul{color:var(--ol-foreground-color);text-shadow:0 0 2px var(--ol-background-color);margin:0;padding:1px .5em;font-size:12px}.ol-attribution li{list-style:none;display:inline}.ol-attribution li:not(:last-child):after{content:" "}.ol-attribution img{max-height:2em;max-width:inherit;vertical-align:middle}.ol-attribution button{flex-shrink:0}.ol-attribution.ol-collapsed ul{display:none}.ol-attribution:not(.ol-collapsed){background:var(--ol-partial-background-color)}.ol-attribution.ol-uncollapsible{border-radius:4px 0 0;bottom:0;right:0}.ol-attribution.ol-uncollapsible img{max-height:1.6em;margin-top:-.2em}.ol-attribution.ol-uncollapsible button{display:none}.ol-zoomslider{height:200px;top:4.5em;left:.5em}.ol-zoomslider button{height:10px;position:relative}.ol-touch .ol-zoomslider{top:5.5em}.ol-overviewmap{bottom:.5em;left:.5em}.ol-overviewmap.ol-uncollapsible{border-radius:0 4px 0 0;bottom:0;left:0}.ol-overviewmap .ol-overviewmap-map,.ol-overviewmap button{display:block}.ol-overviewmap .ol-overviewmap-map{border:1px solid var(--ol-subtle-foreground-color);width:150px;height:150px}.ol-overviewmap:not(.ol-collapsed) button{position:absolute;bottom:0;left:0}.ol-overviewmap.ol-collapsed .ol-overviewmap-map,.ol-overviewmap.ol-uncollapsible button{display:none}.ol-overviewmap:not(.ol-collapsed){background:var(--ol-subtle-background-color)}.ol-overviewmap-box{border:1.5px dotted var(--ol-subtle-foreground-color)}.ol-overviewmap .ol-overviewmap-box:hover{cursor:move}.ol-overviewmap .ol-viewport:hover{cursor:pointer}:root{color:#1c1915;background:#1e3328;font-family:system-ui,sans-serif;font-size:16px;line-height:1.35}*,:before,:after{box-sizing:border-box}html,body{background:#1e3328;height:100%;margin:0;overflow:hidden}button,input{font:inherit;font-size:16px}#app{height:100dvh;max-height:100dvh;padding-top:env(safe-area-inset-top);padding-bottom:env(safe-area-inset-bottom);background:#1e3328;flex-direction:column;display:flex}.map{background:#e7e1d4;flex:auto;min-height:40dvh;position:relative}.map-download{z-index:2;right:max(12px, env(safe-area-inset-right));bottom:max(12px, env(safe-area-inset-bottom));position:absolute;box-shadow:0 1px 3px #1c191566}.map .ol-viewport{background:#e7e1d4}.panel{color:#1c1915;max-height:52dvh;padding:8px max(16px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left));background:#e7e1d4;border-bottom:4px solid #1e3328;flex-direction:column;flex:0 auto;gap:10px;display:flex;overflow:auto}.panel-head{justify-content:space-between;align-items:center;gap:8px;display:flex}.panel-head h1{flex:auto}.head-actions{flex:none;gap:8px;display:flex}.head-actions .icon-button{flex:none}button.icon-button{color:#1e3328;background:#e7e1d4;border-color:#1e3328;border-radius:50%;justify-content:center;align-items:center;width:44px;min-width:44px;height:44px;min-height:44px;padding:0;display:inline-flex;position:relative}.map-download.icon-button{position:absolute}button.icon-button .glyph,button.icon-button .strike{width:22px;height:22px;display:block}button.icon-button .strike{width:26px;height:26px;display:none;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}button.icon-button[aria-expanded=true] .strike{display:block}.fold{flex-direction:column;gap:8px;display:flex}h1{letter-spacing:.06em;color:#1e3328;margin:0;font-size:20px;font-weight:700}form,.actions,.gebiet{flex-direction:column;gap:8px;display:flex}.fields{grid-template-columns:1fr;gap:8px;display:grid}label{flex-direction:column;gap:4px;font-size:16px;font-weight:600;display:flex}.download-knopf{flex-direction:row;align-items:center;gap:10px;min-height:44px}.download-knopf input{accent-color:#1e3328;flex:none;width:1.25rem;height:1.25rem;min-height:0;margin:0;padding:0}.download-knopf span{flex:auto;min-width:0}input{color:#1c1915;background:#f4f0e6;border:1px solid #1e3328;border-radius:2px;width:100%;min-height:44px;padding:8px 10px}.fields input{width:33%;min-width:6.5rem}button{color:#e7e1d4;background:#1e3328;border:1px solid #1e3328;border-radius:2px;min-height:44px;padding:10px 14px;font-weight:600}button.secondary{color:#1e3328;background:#e7e1d4}button.hessen-download{color:#e7e1d4;background:#b42318;border-color:#b42318}button:disabled{color:#6f675c;background:#e7e1d4;border-color:#c4bbaa}.actions{flex-direction:row}.actions button{flex:1 1 0}.gebiet p,.notice,.boot-error{margin:0;font-size:16px}.ziel-list{flex-direction:column;gap:8px;margin:0;padding:0;list-style:none;display:flex}.ziel-list li{align-items:stretch;gap:8px;display:flex}.ziel-list .ziel-open{text-align:left;flex:auto}.notice{color:#e7e1d4;background:#1e3328;padding:10px 12px}.boot-failure{color:#e7e1d4;flex-direction:column;align-items:stretch;gap:12px;max-width:28rem;margin:24px 16px;display:flex}.boot-failure .boot-error,.boot-failure p{margin:0}.boot-detail{overflow-wrap:anywhere;font-family:ui-monospace,SFMono-Regular,monospace;font-size:14px}[hidden]{display:none!important}dialog{max-width:min(22rem,100vw - 32px);padding:20px 16px max(16px, env(safe-area-inset-bottom));color:#1c1915;background:#e7e1d4;border:none}dialog::backdrop{background:#1c191580}.ask{margin:0 0 8px;font-size:20px;font-weight:700}.explain{margin:0 0 16px;font-size:16px}.dialog-actions{gap:8px;display:flex}.dialog-actions button{flex:1 1 0}button:focus-visible,input:focus-visible{outline-offset:2px;outline:2px solid #1d4e89}@media (width>=520px){.fields{grid-template-columns:repeat(3,max-content);justify-content:start;column-gap:16px}.fields input{width:8.5rem}} +:root,:host{--ol-background-color:white;--ol-accent-background-color:#f5f5f5;--ol-subtle-background-color:#80808040;--ol-partial-background-color:#ffffffbf;--ol-foreground-color:#333;--ol-subtle-foreground-color:#666;--ol-brand-color:#0af}.ol-box{box-sizing:border-box;border:1.5px solid var(--ol-background-color);background-color:var(--ol-partial-background-color);border-radius:2px}.ol-mouse-position{position:absolute;top:8px;right:8px}.ol-scale-line{background:var(--ol-partial-background-color);border-radius:4px;padding:2px;position:absolute;bottom:8px;left:8px}.ol-scale-line-inner{border:1px solid var(--ol-subtle-foreground-color);color:var(--ol-foreground-color);text-align:center;will-change:contents, width;border-top:none;margin:1px;font-size:10px;transition:all .25s}.ol-scale-bar{position:absolute;bottom:8px;left:8px}.ol-scale-bar-inner{display:flex}.ol-scale-step-marker{background-color:var(--ol-foreground-color);float:right;z-index:10;width:1px;height:15px}.ol-scale-step-text{z-index:11;color:var(--ol-foreground-color);text-shadow:-1.5px 0 var(--ol-partial-background-color), 0 1.5px var(--ol-partial-background-color), 1.5px 0 var(--ol-partial-background-color), 0 -1.5px var(--ol-partial-background-color);font-size:10px;position:absolute;bottom:-5px}.ol-scale-text{text-align:center;color:var(--ol-foreground-color);text-shadow:-1.5px 0 var(--ol-partial-background-color), 0 1.5px var(--ol-partial-background-color), 1.5px 0 var(--ol-partial-background-color), 0 -1.5px var(--ol-partial-background-color);font-size:12px;position:absolute;bottom:25px}.ol-scale-singlebar{z-index:9;box-sizing:border-box;border:1px solid var(--ol-foreground-color);height:10px;position:relative}.ol-scale-singlebar-even{background-color:var(--ol-subtle-foreground-color)}.ol-scale-singlebar-odd{background-color:var(--ol-background-color)}.ol-unsupported{display:none}.ol-viewport,.ol-unselectable{-webkit-touch-callout:none;-webkit-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent}.ol-viewport canvas{all:unset;overflow:hidden}.ol-viewport{touch-action:pan-x pan-y}.ol-selectable{-webkit-touch-callout:default;-webkit-user-select:text;user-select:text}.ol-grabbing{cursor:-webkit-grabbing;cursor:-moz-grabbing;cursor:grabbing}.ol-grab{cursor:move;cursor:-webkit-grab;cursor:-moz-grab;cursor:grab}.ol-control{background-color:var(--ol-subtle-background-color);border-radius:4px;position:absolute}.ol-zoom{top:.5em;left:.5em}.ol-rotate{transition:opacity .25s linear,visibility linear;top:.5em;right:.5em}.ol-rotate.ol-hidden{opacity:0;visibility:hidden;transition:opacity .25s linear,visibility 0s linear .25s}.ol-zoom-extent{top:4.643em;left:.5em}.ol-full-screen{top:.5em;right:.5em}.ol-control button{color:var(--ol-subtle-foreground-color);font-weight:700;font-size:inherit;text-align:center;background-color:var(--ol-background-color);border:none;border-radius:2px;width:1.375em;height:1.375em;margin:1px;padding:0;line-height:.4em;text-decoration:none;display:block}.ol-control button::-moz-focus-inner{border:none;padding:0}.ol-zoom-extent button{line-height:1.4em}.ol-compass{will-change:transform;font-weight:400;display:block}.ol-touch .ol-control button{font-size:1.5em}.ol-touch .ol-zoom-extent{top:5.5em}.ol-control button:hover,.ol-control button:focus{outline:1px solid var(--ol-subtle-foreground-color);color:var(--ol-foreground-color);text-decoration:none}.ol-zoom .ol-zoom-in{border-radius:2px 2px 0 0}.ol-zoom .ol-zoom-out{border-radius:0 0 2px 2px}.ol-attribution{text-align:right;flex-flow:row-reverse;align-items:center;max-width:calc(100% - 1.3em);display:flex;bottom:.5em;right:.5em}.ol-attribution a{color:var(--ol-subtle-foreground-color);text-decoration:none}.ol-attribution ul{color:var(--ol-foreground-color);text-shadow:0 0 2px var(--ol-background-color);margin:0;padding:1px .5em;font-size:12px}.ol-attribution li{list-style:none;display:inline}.ol-attribution li:not(:last-child):after{content:" "}.ol-attribution img{max-height:2em;max-width:inherit;vertical-align:middle}.ol-attribution button{flex-shrink:0}.ol-attribution.ol-collapsed ul{display:none}.ol-attribution:not(.ol-collapsed){background:var(--ol-partial-background-color)}.ol-attribution.ol-uncollapsible{border-radius:4px 0 0;bottom:0;right:0}.ol-attribution.ol-uncollapsible img{max-height:1.6em;margin-top:-.2em}.ol-attribution.ol-uncollapsible button{display:none}.ol-zoomslider{height:200px;top:4.5em;left:.5em}.ol-zoomslider button{height:10px;position:relative}.ol-touch .ol-zoomslider{top:5.5em}.ol-overviewmap{bottom:.5em;left:.5em}.ol-overviewmap.ol-uncollapsible{border-radius:0 4px 0 0;bottom:0;left:0}.ol-overviewmap .ol-overviewmap-map,.ol-overviewmap button{display:block}.ol-overviewmap .ol-overviewmap-map{border:1px solid var(--ol-subtle-foreground-color);width:150px;height:150px}.ol-overviewmap:not(.ol-collapsed) button{position:absolute;bottom:0;left:0}.ol-overviewmap.ol-collapsed .ol-overviewmap-map,.ol-overviewmap.ol-uncollapsible button{display:none}.ol-overviewmap:not(.ol-collapsed){background:var(--ol-subtle-background-color)}.ol-overviewmap-box{border:1.5px dotted var(--ol-subtle-foreground-color)}.ol-overviewmap .ol-overviewmap-box:hover{cursor:move}.ol-overviewmap .ol-viewport:hover{cursor:pointer}:root{color:#1c1915;background:#1e3328;font-family:system-ui,sans-serif;font-size:16px;line-height:1.35}*,:before,:after{box-sizing:border-box}html,body{background:#1e3328;height:100%;margin:0;overflow:hidden}button,input{font:inherit;font-size:16px}#app{height:100dvh;max-height:100dvh;padding-top:env(safe-area-inset-top);padding-bottom:env(safe-area-inset-bottom);background:#1e3328;flex-direction:column;display:flex}.map{background:#e7e1d4;flex:auto;min-height:40dvh;position:relative}.map-download{z-index:2;right:max(12px, env(safe-area-inset-right));bottom:max(12px, env(safe-area-inset-bottom));position:absolute;box-shadow:0 1px 3px #1c191566}.map .ol-viewport{background:#e7e1d4}.panel{color:#1c1915;max-height:52dvh;padding:8px max(16px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left));background:#e7e1d4;border-bottom:4px solid #1e3328;flex-direction:column;flex:0 auto;gap:10px;display:flex;overflow:auto}.panel-head{justify-content:space-between;align-items:center;gap:8px;display:flex}.panel-head h1{flex:auto}.head-actions{flex:none;gap:8px;display:flex}.head-actions .icon-button{flex:none}button.icon-button{color:#1e3328;background:#e7e1d4;border-color:#1e3328;border-radius:50%;justify-content:center;align-items:center;width:44px;min-width:44px;height:44px;min-height:44px;padding:0;display:inline-flex;position:relative}.map-download.icon-button{position:absolute}button.icon-button .glyph,button.icon-button .strike{width:22px;height:22px;display:block}button.icon-button .strike{width:26px;height:26px;display:none;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}button.icon-button[aria-expanded=true] .strike{display:block}.fold{flex-direction:column;gap:8px;display:flex}.info p{margin:0}.info a{color:#1d4e89}h1{letter-spacing:.06em;color:#1e3328;margin:0;font-size:20px;font-weight:700}form,.actions,.gebiet{flex-direction:column;gap:8px;display:flex}.fields{grid-template-columns:1fr;gap:8px;display:grid}label{flex-direction:column;gap:4px;font-size:16px;font-weight:600;display:flex}.download-knopf{flex-direction:row;align-items:center;gap:10px;min-height:44px}.download-knopf input{accent-color:#1e3328;flex:none;width:1.25rem;height:1.25rem;min-height:0;margin:0;padding:0}.download-knopf span{flex:auto;min-width:0}input{color:#1c1915;background:#f4f0e6;border:1px solid #1e3328;border-radius:2px;width:100%;min-height:44px;padding:8px 10px}.fields input{width:33%;min-width:6.5rem}button{color:#e7e1d4;background:#1e3328;border:1px solid #1e3328;border-radius:2px;min-height:44px;padding:10px 14px;font-weight:600}button.secondary{color:#1e3328;background:#e7e1d4}button.hessen-download{color:#e7e1d4;background:#b42318;border-color:#b42318}button:disabled{color:#6f675c;background:#e7e1d4;border-color:#c4bbaa}.actions{flex-direction:row}.actions button{flex:1 1 0}.gebiet p,.notice,.boot-error{margin:0;font-size:16px}.ziel-list{flex-direction:column;gap:8px;margin:0;padding:0;list-style:none;display:flex}.ziel-list li{align-items:stretch;gap:8px;display:flex}.ziel-list .ziel-open{text-align:left;flex:auto}.notice{color:#e7e1d4;background:#1e3328;padding:10px 12px}.boot-failure{color:#e7e1d4;flex-direction:column;align-items:stretch;gap:12px;max-width:28rem;margin:24px 16px;display:flex}.boot-failure .boot-error,.boot-failure p{margin:0}.boot-detail{overflow-wrap:anywhere;font-family:ui-monospace,SFMono-Regular,monospace;font-size:14px}[hidden]{display:none!important}dialog{max-width:min(22rem,100vw - 32px);padding:20px 16px max(16px, env(safe-area-inset-bottom));color:#1c1915;background:#e7e1d4;border:none}dialog::backdrop{background:#1c191580}.ask{margin:0 0 8px;font-size:20px;font-weight:700}.explain{margin:0 0 16px;font-size:16px}.dialog-actions{gap:8px;display:flex}.dialog-actions button{flex:1 1 0}button:focus-visible,input:focus-visible{outline-offset:2px;outline:2px solid #1d4e89}@media (width>=520px){.fields{grid-template-columns:repeat(3,max-content);justify-content:start;column-gap:16px}.fields input{width:8.5rem}} diff --git a/public/assets/index-DjxrnCdH.js b/public/assets/index-DjxrnCdH.js deleted file mode 100644 index c36bd77..0000000 --- a/public/assets/index-DjxrnCdH.js +++ /dev/null @@ -1,52 +0,0 @@ -(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var e=`modulepreload`,t=function(e){return`/`+e},n={},r=function(e){return e.pathname.endsWith(`.css`)},i=function(e,t,n){if(t in e)return e[t];let r=n();if(!r){e[t]=void 0;return}let i=r.then(()=>{e[t]=void 0},n=>{throw e[t]=void 0,n});return e[t]=i,i},a=function(a,o,s){let c=Promise.resolve();if(o&&o.length>0){let a,l=document.querySelector(`meta[property=csp-nonce]`),u=l?.nonce||l?.getAttribute(`nonce`);function d(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function f(e){return import.meta.resolve?new URL(import.meta.resolve(e)):new URL(e,import.meta.url)}c=d(o.map(o=>{o=t(o,s);let c=f(o),l=r(c);return i(n,c.href,()=>{if(a===void 0){a={all:new Set,styles:new Set};let e=document.getElementsByTagName(`link`);for(let t=e.length-1;t>=0;t--){let n=e[t];a.all.add(n.href),n.rel===`stylesheet`&&a.styles.add(n.href)}}if((l?a.styles:a.all).has(c.href))return;let t=document.createElement(`link`);if(t.rel=l?`stylesheet`:e,l||(t.as=`script`),t.crossOrigin=``,t.href=c.href,u&&t.setAttribute(`nonce`,u),document.head.appendChild(t),l)return new Promise((e,n)=>{t.addEventListener(`load`,e),t.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${c}`)))})})}).filter(e=>e!==void 0))}function l(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return c.then(e=>{for(let t of e||[])t.status===`rejected`&&l(t.reason);return a().catch(l)})},o=`true`,s=`false`,c=o===`true`,l=s===`true`;function u(e={}){let{immediate:t=!1,onNeedReload:n,onNeedRefresh:r,onOfflineReady:i,onRegistered:o,onRegisteredSW:s,onRegisterError:u}=e,d,f,p,m=async(e=!0)=>{await f,c||p?.()};async function h(){if(`serviceWorker`in navigator){if(d=await a(async()=>{let{Workbox:e}=await import(`./workbox-window.prod.es5-Bd17z0YL.js`);return{Workbox:e}},[]).then(({Workbox:e})=>new e(`/sw.js`,{scope:`/`,type:`classic`})).catch(e=>{u?.(e)}),!d)return;if(p=()=>{d?.messageSkipWaiting()},!l){if(c)d.addEventListener(`activated`,e=>{(e.isUpdate||e.isExternal)&&(n?n():window.location.reload())}),d.addEventListener(`installed`,e=>{e.isUpdate||i?.()});else{let e=!1,t=()=>{e=!0,d?.addEventListener(`controlling`,e=>{e.isUpdate&&(n?n():window.location.reload())}),r?.()};d.addEventListener(`installed`,n=>{n.isUpdate===void 0?n.isExternal===void 0?!e&&i?.():n.isExternal?t():!e&&i?.():n.isUpdate||i?.()}),d.addEventListener(`waiting`,t)}}d.register({immediate:t}).then(e=>{s?s(`/sw.js`,e):o?.(e)}).catch(e=>{u?.(e)})}}return f=h(),m}var d=`kacheln`;function f(e){return`/kacheln/${e}.png`}function p(e){if(!e.startsWith(`/kacheln/`)||!e.endsWith(`.png`))return null;let t=e.slice(9,-4);return t.length>0?t:null}function m(){return{async ids(){let e=await(await caches.open(d)).keys(),t=[];for(let n of e){let e=p(new URL(n.url).pathname);e&&t.push(e)}return t},async put(e,t){let n=await caches.open(d),r=new Uint8Array(t);await n.put(f(e),new Response(r,{headers:{"Content-Type":`image/png`}}))},async delete(e){let t=await caches.open(d);await Promise.all(e.map(e=>t.delete(f(e))))}}}var h=`karte-shell-repaired`;async function g(e){let t=await e.registrations();await Promise.all(t.map(e=>e.unregister()));let n=await e.cacheNames();await Promise.all(n.filter(e=>e!==d).map(t=>e.deleteCache(t)))}async function _(e){await e.deleteCache(d)}function v(e){return e instanceof Error&&e.message.trim()?e.message:`Unbekannter Fehler`}function y(){return{async registrations(){return navigator.serviceWorker?navigator.serviceWorker.getRegistrations():[]},cacheNames:()=>caches.keys(),deleteCache:e=>caches.delete(e)}}function b(e=C()){try{return e?.getItem(h)===`1`}catch{return!1}}function x(e=C()){try{e?.setItem(h,`1`)}catch{}}function S(e=C()){try{e?.removeItem(h)}catch{}}function C(){try{return typeof sessionStorage>`u`?null:sessionStorage}catch{return null}}function w(){return{async fetch(e,t){let n=await fetch(f(e),{signal:t,cache:`no-store`});if(!n.ok)throw Error(`Kachel ${e} konnte nicht geladen werden.`);return new Uint8Array(await n.arrayBuffer())}}}var T=`karte`,E=`marks`,D=`heruntergeladen`;function O(){return new Promise((e,t)=>{let n=indexedDB.open(T,1);n.onupgradeneeded=()=>{let e=n.result;e.objectStoreNames.contains(E)||e.createObjectStore(E)},n.onsuccess=()=>e(n.result),n.onerror=()=>t(n.error??Error(`IndexedDB`))})}function k(e){return Array.isArray(e)?e.filter(e=>typeof e==`string`):[]}function ee(e){if(Array.isArray(e))return{heruntergeladen:k(e),ziele:[],downloadKnopf:!1};if(e&&typeof e==`object`){let t=e;return{heruntergeladen:k(t.heruntergeladen),ziele:k(t.ziele),downloadKnopf:t.downloadKnopf===!0}}return{heruntergeladen:[],ziele:[],downloadKnopf:!1}}function te(e,t){return new Promise((n,r)=>{e.oncomplete=()=>n(t()),e.onerror=()=>r(e.error??Error(`IndexedDB`)),e.onabort=()=>r(e.error??Error(`IndexedDB`))})}function ne(){return{async read(){let e=await O();try{let t=e.transaction(E,`readonly`),n=t.objectStore(E).get(D);return ee(await te(t,()=>n.result))}finally{e.close()}},async write(e){let t=await O();try{let n=t.transaction(E,`readwrite`);n.objectStore(E).put({heruntergeladen:e.heruntergeladen,ziele:e.ziele,downloadKnopf:e.downloadKnopf},D),await te(n,()=>void 0)}finally{t.close()}}}}function re(e){e(`EPSG:4326`,`+title=WGS 84 (long/lat) +proj=longlat +ellps=WGS84 +datum=WGS84 +units=degrees`),e(`EPSG:4269`,`+title=NAD83 (long/lat) +proj=longlat +a=6378137.0 +b=6356752.31414036 +ellps=GRS80 +datum=NAD83 +units=degrees`),e(`EPSG:3857`,`+title=WGS 84 / Pseudo-Mercator +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs`);for(var t=1;t<=60;++t)e(`EPSG:`+(32600+t),`+proj=utm +zone=`+t+` +datum=WGS84 +units=m`),e(`EPSG:`+(32700+t),`+proj=utm +zone=`+t+` +south +datum=WGS84 +units=m`);e(`EPSG:5041`,`+title=WGS 84 / UPS North (E,N) +proj=stere +lat_0=90 +lon_0=0 +k=0.994 +x_0=2000000 +y_0=2000000 +datum=WGS84 +units=m`),e(`EPSG:5042`,`+title=WGS 84 / UPS South (E,N) +proj=stere +lat_0=-90 +lon_0=0 +k=0.994 +x_0=2000000 +y_0=2000000 +datum=WGS84 +units=m`),e.WGS84=e[`EPSG:4326`],e[`EPSG:3785`]=e[`EPSG:3857`],e.GOOGLE=e[`EPSG:3857`],e[`EPSG:900913`]=e[`EPSG:3857`],e[`EPSG:102113`]=e[`EPSG:3857`]}var ie=6378137,A=6356752.314,ae=.0066943799901413165,oe=484813681109536e-20,j=Math.PI/2,se=.16666666666666666,ce=.04722222222222222,le=.022156084656084655,ue=1e-10,M=.017453292519943295,de=57.29577951308232,N=Math.PI/4,fe=Math.PI*2,P=3.14159265359,pe={};pe.greenwich=0,pe.lisbon=-9.131906111111,pe.paris=2.337229166667,pe.bogota=-74.080916666667,pe.madrid=-3.687938888889,pe.rome=12.452333333333,pe.bern=7.439583333333,pe.jakarta=106.807719444444,pe.ferro=-17.666666666667,pe.brussels=4.367975,pe.stockholm=18.058277777778,pe.athens=23.7163375,pe.oslo=10.722916666667;var me={mm:{to_meter:.001},cm:{to_meter:.01},ft:{to_meter:.3048},"us-ft":{to_meter:1200/3937},fath:{to_meter:1.8288},kmi:{to_meter:1852},"us-ch":{to_meter:20.1168402336805},"us-mi":{to_meter:1609.34721869444},km:{to_meter:1e3},"ind-ft":{to_meter:.30479841},"ind-yd":{to_meter:.91439523},mi:{to_meter:1609.344},yd:{to_meter:.9144},ch:{to_meter:20.1168},link:{to_meter:.201168},dm:{to_meter:.1},in:{to_meter:.0254},"ind-ch":{to_meter:20.11669506},"us-in":{to_meter:.025400050800101},"us-yd":{to_meter:.914401828803658}},he=/[\s_\-\/\(\)]/g;function ge(e,t){if(e[t])return e[t];for(var n=Object.keys(e),r=t.toLowerCase().replace(he,``),i=-1,a,o;++iArray.isArray(e)&&e[0]===`ID`);return t&&t.length>=3?{authority:t[1],code:parseInt(t[2],10)}:null}static convertUnit(e,t=`unit`){if(!e||e.length<3)return{type:t,name:`unknown`,conversion_factor:null};let n=e[1],r=parseFloat(e[2])||null,i=e.find(e=>Array.isArray(e)&&e[0]===`ID`);return{type:t,name:n,conversion_factor:r,id:i?{authority:i[1],code:parseInt(i[2],10)}:null}}static convertAxis(e){let t=e[1]||`Unknown`,n,r=t.match(/^\((.)\)$/);if(r){let t=r[1].toUpperCase();if(t===`E`)n=`east`;else if(t===`N`)n=`north`;else if(t===`U`)n=`up`;else if(e[2])n=e[2];else throw Error(`Unknown axis abbreviation: ${t}`)}else n=e[2]||`unknown`;let i=e.find(e=>Array.isArray(e)&&e[0]===`ORDER`),a=i?parseInt(i[1],10):null,o=e.find(e=>Array.isArray(e)&&(e[0]===`LENGTHUNIT`||e[0]===`ANGLEUNIT`||e[0]===`SCALEUNIT`)),s=this.convertUnit(o);return{name:t,direction:n,unit:s,order:a}}static extractAxes(e){return e.filter(e=>Array.isArray(e)&&e[0]===`AXIS`).map(e=>this.convertAxis(e)).sort((e,t)=>(e.order||0)-(t.order||0))}static convert(e,t={}){switch(e[0]){case`PROJCRS`:t.type=`ProjectedCRS`,t.name=e[1],t.base_crs=e.find(e=>Array.isArray(e)&&e[0]===`BASEGEOGCRS`)?this.convert(e.find(e=>Array.isArray(e)&&e[0]===`BASEGEOGCRS`)):null,t.conversion=e.find(e=>Array.isArray(e)&&e[0]===`CONVERSION`)?this.convert(e.find(e=>Array.isArray(e)&&e[0]===`CONVERSION`)):null;let n=e.find(e=>Array.isArray(e)&&e[0]===`CS`);n&&(t.coordinate_system={subtype:n[1],axis:this.extractAxes(e)});let r=e.find(e=>Array.isArray(e)&&e[0]===`LENGTHUNIT`);if(r){let e=this.convertUnit(r);t.coordinate_system.unit=e}t.id=this.getId(e);break;case`BASEGEOGCRS`:case`GEOGCRS`:case`GEODCRS`:t.type=e[0]===`GEODCRS`?`GeodeticCRS`:`GeographicCRS`,t.name=e[1];let i=e.find(e=>Array.isArray(e)&&(e[0]===`DATUM`||e[0]===`ENSEMBLE`));if(i){let n=this.convert(i);i[0]===`ENSEMBLE`?t.datum_ensemble=n:t.datum=n;let r=e.find(e=>Array.isArray(e)&&e[0]===`PRIMEM`);r&&r[1]!==`Greenwich`&&(n.prime_meridian={name:r[1],longitude:parseFloat(r[2])})}let a=e.find(e=>Array.isArray(e)&&e[0]===`CS`);t.coordinate_system={subtype:a?a[1]:`ellipsoidal`,axis:this.extractAxes(e)},t.id=this.getId(e);break;case`DATUM`:t.type=`GeodeticReferenceFrame`,t.name=e[1],t.ellipsoid=e.find(e=>Array.isArray(e)&&e[0]===`ELLIPSOID`)?this.convert(e.find(e=>Array.isArray(e)&&e[0]===`ELLIPSOID`)):null;break;case`ENSEMBLE`:t.type=`DatumEnsemble`,t.name=e[1],t.members=e.filter(e=>Array.isArray(e)&&e[0]===`MEMBER`).map(e=>({type:`DatumEnsembleMember`,name:e[1],id:this.getId(e)}));let o=e.find(e=>Array.isArray(e)&&e[0]===`ENSEMBLEACCURACY`);o&&(t.accuracy=parseFloat(o[1]));let s=e.find(e=>Array.isArray(e)&&e[0]===`ELLIPSOID`);s&&(t.ellipsoid=this.convert(s)),t.id=this.getId(e);break;case`ELLIPSOID`:t.type=`Ellipsoid`,t.name=e[1],t.semi_major_axis=parseFloat(e[2]),t.inverse_flattening=parseFloat(e[3]),e.find(e=>Array.isArray(e)&&e[0]===`LENGTHUNIT`)&&this.convert(e.find(e=>Array.isArray(e)&&e[0]===`LENGTHUNIT`),t);break;case`CONVERSION`:t.type=`Conversion`,t.name=e[1],t.method=e.find(e=>Array.isArray(e)&&e[0]===`METHOD`)?this.convert(e.find(e=>Array.isArray(e)&&e[0]===`METHOD`)):null,t.parameters=e.filter(e=>Array.isArray(e)&&e[0]===`PARAMETER`).map(e=>this.convert(e));break;case`METHOD`:t.type=`Method`,t.name=e[1],t.id=this.getId(e);break;case`PARAMETER`:t.type=`Parameter`,t.name=e[1],t.value=parseFloat(e[2]),t.unit=this.convertUnit(e.find(e=>Array.isArray(e)&&(e[0]===`LENGTHUNIT`||e[0]===`ANGLEUNIT`||e[0]===`SCALEUNIT`))),t.id=this.getId(e);break;case`BOUNDCRS`:t.type=`BoundCRS`;let c=e.find(e=>Array.isArray(e)&&e[0]===`SOURCECRS`);if(c){let e=c.find(e=>Array.isArray(e));t.source_crs=e?this.convert(e):null}let l=e.find(e=>Array.isArray(e)&&e[0]===`TARGETCRS`);if(l){let e=l.find(e=>Array.isArray(e));t.target_crs=e?this.convert(e):null}let u=e.find(e=>Array.isArray(e)&&e[0]===`ABRIDGEDTRANSFORMATION`);t.transformation=u?this.convert(u):null;break;case`ABRIDGEDTRANSFORMATION`:if(t.type=`Transformation`,t.name=e[1],t.method=e.find(e=>Array.isArray(e)&&e[0]===`METHOD`)?this.convert(e.find(e=>Array.isArray(e)&&e[0]===`METHOD`)):null,t.parameters=e.filter(e=>Array.isArray(e)&&(e[0]===`PARAMETER`||e[0]===`PARAMETERFILE`)).map(e=>{if(e[0]===`PARAMETER`)return this.convert(e);if(e[0]===`PARAMETERFILE`)return{name:e[1],value:e[2],id:{authority:`EPSG`,code:8656}}}),t.parameters.length===7){let e=t.parameters[6];e.name===`Scale difference`&&(e.value=Math.round((e.value-1)*0xe8d4a51000)/1e6)}t.id=this.getId(e);break;case`AXIS`:t.coordinate_system||={type:`unspecified`,axis:[]},t.coordinate_system.axis.push(this.convertAxis(e));break;case`LENGTHUNIT`:let d=this.convertUnit(e,`LinearUnit`);t.coordinate_system&&t.coordinate_system.axis&&t.coordinate_system.axis.forEach(e=>{e.unit||=d}),d.conversion_factor&&d.conversion_factor!==1&&(t.semi_major_axis&&={value:t.semi_major_axis,unit:d});break;default:t.keyword=e[0]}return t}};function ye(e){return ve.convert(e)}function be(e){let t=e.toUpperCase();return t.includes(`PROJCRS`)||t.includes(`GEOGCRS`)||t.includes(`BOUNDCRS`)||t.includes(`VERTCRS`)||t.includes(`LENGTHUNIT`)||t.includes(`ANGLEUNIT`)||t.includes(`SCALEUNIT`)?`WKT2`:(t.includes(`PROJCS`)||t.includes(`GEOGCS`)||t.includes(`LOCAL_CS`)||t.includes(`VERT_CS`)||t.includes(`UNIT`),`WKT1`)}var xe=Pe,Se=1,Ce=2,we=3,Te=4,Ee=5,De=-1,Oe=/\s/,ke=/[A-Za-z]/,Ae=/[A-Za-z84_]/,je=/[,\]]/,Me=/[\d\.E\-\+]/;function Ne(e){if(typeof e!=`string`)throw Error(`not a string`);this.text=e.trim(),this.level=0,this.place=0,this.root=null,this.stack=[],this.currentObject=null,this.state=Se}Ne.prototype.readCharicter=function(){var e=this.text[this.place++];if(this.state!==Te)for(;Oe.test(e);){if(this.place>=this.text.length)return;e=this.text[this.place++]}switch(this.state){case Se:return this.neutral(e);case Ce:return this.keyword(e);case Te:return this.quoted(e);case Ee:return this.afterquote(e);case we:return this.number(e);case De:return}},Ne.prototype.afterquote=function(e){if(e===`"`)this.word+=`"`,this.state=Te;else if(je.test(e))this.word=this.word.trim(),this.afterItem(e);else throw Error(`havn't handled "`+e+`" in afterquote yet, index `+this.place)},Ne.prototype.afterItem=function(e){e===`,`?(this.word!==null&&this.currentObject.push(this.word),this.word=null,this.state=Se):e===`]`&&(this.level--,this.word!==null&&(this.currentObject.push(this.word),this.word=null),this.state=Se,this.currentObject=this.stack.pop(),this.currentObject||(this.state=De))},Ne.prototype.number=function(e){if(Me.test(e))this.word+=e;else if(je.test(e))this.word=parseFloat(this.word),this.afterItem(e);else throw Error(`havn't handled "`+e+`" in number yet, index `+this.place)},Ne.prototype.quoted=function(e){e===`"`?this.state=Ee:this.word+=e},Ne.prototype.keyword=function(e){if(Ae.test(e))this.word+=e;else if(e===`[`){var t=[];t.push(this.word),this.level++,this.root===null?this.root=t:this.currentObject.push(t),this.stack.push(this.currentObject),this.currentObject=t,this.state=Se}else if(je.test(e))this.afterItem(e);else throw Error(`havn't handled "`+e+`" in keyword yet, index `+this.place)},Ne.prototype.neutral=function(e){if(ke.test(e))this.word=e,this.state=Ce;else if(e===`"`)this.word=``,this.state=Te;else if(Me.test(e))this.word=e,this.state=we;else if(je.test(e))this.afterItem(e);else throw Error(`havn't handled "`+e+`" in neutral yet, index `+this.place)},Ne.prototype.output=function(){for(;this.place0?90:-90),e.lat_ts=e.lat1,delete e.lat1):!e.lat_ts&&e.lat0&&(t===`polar stereographic`||t===`polar stereographic (variant a)`)&&(e.lat_ts=e.lat0,e.lat0=Re(e.lat0>0?90:-90),delete e.lat1)}function Be(e){let t={units:null,to_meter:void 0};return typeof e==`string`?(t.units=e.toLowerCase(),t.units===`metre`&&(t.units=`meter`),t.units===`meter`&&(t.to_meter=1)):e&&e.name&&(t.units=e.name.toLowerCase(),t.units===`metre`&&(t.units=`meter`),t.to_meter=e.conversion_factor),t}function Ve(e){return typeof e==`object`?e.value*e.unit.conversion_factor:e}function He(e,t){e.ellipsoid.radius?(t.a=e.ellipsoid.radius,t.rf=0):(t.a=Ve(e.ellipsoid.semi_major_axis),e.ellipsoid.inverse_flattening===void 0?e.ellipsoid.semi_major_axis!==void 0&&e.ellipsoid.semi_minor_axis!==void 0&&(t.rf=t.a/(t.a-Ve(e.ellipsoid.semi_minor_axis))):t.rf=e.ellipsoid.inverse_flattening)}function Ue(e,t={}){return!e||typeof e!=`object`?e:e.type===`BoundCRS`?(Ue(e.source_crs,t),e.transformation&&(e.transformation.method&&e.transformation.method.name===`NTv2`?t.nadgrids=e.transformation.parameters[0].value:t.datum_params=e.transformation.parameters.map(e=>e.value)),t):(Object.keys(e).forEach(n=>{let r=e[n];if(r!==null)switch(n){case`name`:if(t.srsCode)break;t.name=r,t.srsCode=r;break;case`type`:r===`GeographicCRS`?t.projName=`longlat`:r===`GeodeticCRS`?t.projName=e.coordinate_system&&e.coordinate_system.subtype===`Cartesian`?`geocent`:`longlat`:r===`ProjectedCRS`&&e.conversion&&e.conversion.method&&(t.projName=e.conversion.method.name);break;case`datum`:case`datum_ensemble`:r.ellipsoid&&(t.ellps=r.ellipsoid.name,He(r,t)),r.prime_meridian&&(t.from_greenwich=r.prime_meridian.longitude*Math.PI/180);break;case`ellipsoid`:t.ellps=r.name,He(r,t);break;case`prime_meridian`:t.long0=(r.longitude||0)*Math.PI/180;break;case`coordinate_system`:if(r.axis){let e={east:`e`,north:`n`,west:`w`,south:`s`,up:`u`,down:`d`,geocentricx:`e`,geocentricy:`n`,geocentricz:`u`},n=r.axis.map(t=>e[t.direction.toLowerCase()]);if(n.every(Boolean)&&(t.axis=n.join(``),t.axis.length===2&&(t.axis+=`u`)),r.unit){let{units:e,to_meter:n}=Be(r.unit);t.units=e,t.to_meter=n}else if(r.axis[0]&&r.axis[0].unit){let{units:e,to_meter:n}=Be(r.axis[0].unit);t.units=e,t.to_meter=n}}break;case`id`:r.authority&&r.code&&(t.title=r.authority+`:`+r.code);break;case`conversion`:r.method&&r.method.name&&(t.projName=r.method.name),r.parameters&&r.parameters.forEach(e=>{let n=e.name.toLowerCase().replace(/\s+/g,`_`),r=e.value;t[n]=e.unit&&e.unit.conversion_factor?r*e.unit.conversion_factor:e.unit===`degree`?r*Math.PI/180:r});break;case`unit`:r.name&&(t.units=r.name.toLowerCase(),t.units===`metre`&&(t.units=`meter`)),r.conversion_factor&&(t.to_meter=r.conversion_factor);break;case`base_crs`:Ue(r,t),t.datumCode=r.id?r.id.authority+`_`+r.id.code:r.name}}),t.latitude_of_false_origin!==void 0&&(t.lat0=t.latitude_of_false_origin),t.longitude_of_false_origin!==void 0&&(t.long0=t.longitude_of_false_origin),t.latitude_of_standard_parallel!==void 0&&(t.lat0=t.latitude_of_standard_parallel,t.lat1=t.latitude_of_standard_parallel),t.latitude_of_1st_standard_parallel!==void 0&&(t.lat1=t.latitude_of_1st_standard_parallel),t.latitude_of_2nd_standard_parallel!==void 0&&(t.lat2=t.latitude_of_2nd_standard_parallel),t.latitude_of_projection_centre!==void 0&&(t.lat0=t.latitude_of_projection_centre),t.longitude_of_projection_centre!==void 0&&(t.longc=t.longitude_of_projection_centre),t.easting_at_false_origin!==void 0&&(t.x0=t.easting_at_false_origin),t.northing_at_false_origin!==void 0&&(t.y0=t.northing_at_false_origin),t.latitude_of_natural_origin!==void 0&&(t.lat0=t.latitude_of_natural_origin),t.longitude_of_natural_origin!==void 0&&(t.long0=t.longitude_of_natural_origin),t.longitude_of_origin!==void 0&&(t.long0=t.longitude_of_origin),t.false_easting!==void 0&&(t.x0=t.false_easting),t.easting_at_projection_centre&&(t.x0=t.easting_at_projection_centre),t.false_northing!==void 0&&(t.y0=t.false_northing),t.northing_at_projection_centre&&(t.y0=t.northing_at_projection_centre),t.standard_parallel_1!==void 0&&(t.lat1=t.standard_parallel_1),t.standard_parallel_2!==void 0&&(t.lat2=t.standard_parallel_2),t.scale_factor_at_natural_origin!==void 0&&(t.k0=t.scale_factor_at_natural_origin),t.scale_factor_at_projection_centre!==void 0&&(t.k0=t.scale_factor_at_projection_centre),t.scale_factor_on_pseudo_standard_parallel!==void 0&&(t.k0=t.scale_factor_on_pseudo_standard_parallel),t.azimuth!==void 0&&(t.alpha=t.azimuth),t.azimuth_at_projection_centre!==void 0&&(t.alpha=t.azimuth_at_projection_centre),t.angle_from_rectified_to_skew_grid&&(t.rectified_grid_angle=t.angle_from_rectified_to_skew_grid),ze(t),t)}var We=[`PROJECTEDCRS`,`PROJCRS`,`GEOGCS`,`GEOCCS`,`PROJCS`,`LOCAL_CS`,`GEODCRS`,`GEODETICCRS`,`GEODETICDATUM`,`ENGCRS`,`ENGINEERINGCRS`];function Ge(e,t){var n=t[0],r=t[1];!(n in e)&&r in e&&(e[n]=e[r],t.length===3&&(e[n]=t[2](e[n])))}function Ke(e){for(var t=Object.keys(e),n=0,r=t.length;n-1;var t=ge(e,`authority`);if(t){var n=ge(t,`epsg`);return n&&$e.indexOf(n)>-1}}function tt(e){var t=ge(e,`extension`);if(t)return ge(t,`proj4`)}function nt(e){return e[0]===`+`}function rt(e){let t;if(Xe(e)){if(Ze(e))t=Ye[e];else if(Qe(e)){t=Je(e);var n=tt(t);n&&(t=_e(n))}else nt(e)&&(t=_e(e))}else t=`projName`in e?e:Je(e);return t&&et(t)?Ye[`EPSG:3857`]:t}function it(e,t){e||={};var n,r;if(!t)return e;for(r in t)n=t[r],n!==void 0&&(e[r]=n);return e}function at(e,t,n){var r=e*t;return n/Math.sqrt(1-r*r)}function ot(e){return e<0?-1:1}function F(e,t){return t||Math.abs(e)<=3.14159265359?e:e-ot(e)*fe}function st(e,t,n){var r=e*n,i=.5*e;return r=((1-r)/(1+r))**i,Math.tan(.5*(j-t))/r}function ct(e,t){for(var n=.5*e,r,i,a=j-2*Math.atan(t),o=0;o<=15;o++)if(r=e*Math.sin(a),i=j-2*Math.atan(t*((1-r)/(1+r))**n)-a,a+=i,Math.abs(i)<=1e-10)return a;return-9999}function lt(){var e=this.b/this.a;this.es=1-e*e,`x0`in this||(this.x0=0),`y0`in this||(this.y0=0),this.long0=this.long0||0,this.e=Math.sqrt(this.es),this.lat_ts?this.k0=this.sphere?Math.cos(this.lat_ts):at(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)):this.k0||=this.k?this.k:1}function ut(e){var t=e.x,n=e.y;if(n*57.29577951308232>90&&n*57.29577951308232<-90&&t*57.29577951308232>180&&t*57.29577951308232<-180)return null;var r,i;if(Math.abs(Math.abs(n)-j)<=1e-10)return null;if(this.sphere)r=this.x0+this.a*this.k0*F(t-this.long0,this.over),i=this.y0+this.a*this.k0*Math.log(Math.tan(N+.5*n));else{var a=Math.sin(n),o=st(this.e,n,a);r=this.x0+this.a*this.k0*F(t-this.long0,this.over),i=this.y0-this.a*this.k0*Math.log(o)}return e.x=r,e.y=i,e}function dt(e){var t=e.x-this.x0,n=e.y-this.y0,r,i;if(this.sphere)i=j-2*Math.atan(Math.exp(-n/(this.a*this.k0)));else{var a=Math.exp(-n/(this.a*this.k0));if(i=ct(this.e,a),i===-9999)return null}return r=F(this.long0+t/(this.a*this.k0),this.over),e.x=r,e.y=i,e}var ft={init:lt,forward:ut,inverse:dt,names:[`Mercator`,`Popular Visualisation Pseudo Mercator`,`Mercator_1SP`,`Mercator_Auxiliary_Sphere`,`Mercator_Variant_A`,`merc`]};function pt(){}function mt(e){return e}var ht=[`longlat`,`identity`,`lonlat`,`latlon`,`latlong`],gt=[ft,{init:pt,forward:mt,inverse:mt,names:ht}],_t={},vt=[];function yt(e,t){var n=vt.length;return e.names?(vt[n]=e,e.names.forEach(function(e){_t[e.toLowerCase()]=n}),this):(console.log(t),!0)}function bt(e){return e.replace(/[-\(\)\s]+/g,` `).trim().replace(/ /g,`_`)}function xt(e){if(!e)return!1;var t=e.toLowerCase();if(_t[t]!==void 0&&vt[_t[t]]||(t=bt(t),t in _t&&vt[_t[t]]))return vt[_t[t]]}function St(){gt.forEach(yt)}var Ct={start:St,add:yt,get:xt},wt={MERIT:{a:6378137,rf:298.257,ellipseName:`MERIT 1983`},SGS85:{a:6378136,rf:298.257,ellipseName:`Soviet Geodetic System 85`},GRS80:{a:6378137,rf:298.257222101,ellipseName:`GRS 1980(IUGG, 1980)`},IAU76:{a:6378140,rf:298.257,ellipseName:`IAU 1976`},airy:{a:6377563.396,b:6356256.91,ellipseName:`Airy 1830`},APL4:{a:6378137,rf:298.25,ellipseName:`Appl. Physics. 1965`},NWL9D:{a:6378145,rf:298.25,ellipseName:`Naval Weapons Lab., 1965`},mod_airy:{a:6377340.189,b:6356034.446,ellipseName:`Modified Airy`},andrae:{a:6377104.43,rf:300,ellipseName:`Andrae 1876 (Den., Iclnd.)`},aust_SA:{a:6378160,rf:298.25,ellipseName:`Australian Natl & S. Amer. 1969`},GRS67:{a:6378160,rf:298.247167427,ellipseName:`GRS 67(IUGG 1967)`},bessel:{a:6377397.155,rf:299.1528128,ellipseName:`Bessel 1841`},bess_nam:{a:6377483.865,rf:299.1528128,ellipseName:`Bessel 1841 (Namibia)`},clrk66:{a:6378206.4,b:6356583.8,ellipseName:`Clarke 1866`},clrk80:{a:6378249.145,rf:293.4663,ellipseName:`Clarke 1880 mod.`},clrk80ign:{a:6378249.2,b:6356515,rf:293.4660213,ellipseName:`Clarke 1880 (IGN)`},clrk58:{a:6378293.645208759,rf:294.2606763692654,ellipseName:`Clarke 1858`},CPM:{a:6375738.7,rf:334.29,ellipseName:`Comm. des Poids et Mesures 1799`},delmbr:{a:6376428,rf:311.5,ellipseName:`Delambre 1810 (Belgium)`},engelis:{a:6378136.05,rf:298.2566,ellipseName:`Engelis 1985`},evrst30:{a:6377276.345,rf:300.8017,ellipseName:`Everest 1830`},evrst48:{a:6377304.063,rf:300.8017,ellipseName:`Everest 1948`},evrst56:{a:6377301.243,rf:300.8017,ellipseName:`Everest 1956`},evrst69:{a:6377295.664,rf:300.8017,ellipseName:`Everest 1969`},evrstSS:{a:6377298.556,rf:300.8017,ellipseName:`Everest (Sabah & Sarawak)`},fschr60:{a:6378166,rf:298.3,ellipseName:`Fischer (Mercury Datum) 1960`},fschr60m:{a:6378155,rf:298.3,ellipseName:`Fischer 1960`},fschr68:{a:6378150,rf:298.3,ellipseName:`Fischer 1968`},helmert:{a:6378200,rf:298.3,ellipseName:`Helmert 1906`},hough:{a:6378270,rf:297,ellipseName:`Hough`},intl:{a:6378388,rf:297,ellipseName:`International 1909 (Hayford)`},kaula:{a:6378163,rf:298.24,ellipseName:`Kaula 1961`},lerch:{a:6378139,rf:298.257,ellipseName:`Lerch 1979`},mprts:{a:6397300,rf:191,ellipseName:`Maupertius 1738`},new_intl:{a:6378157.5,b:6356772.2,ellipseName:`New International 1967`},plessis:{a:6376523,b:6355863,ellipseName:`Plessis 1817 (France)`},krass:{a:6378245,rf:298.3,ellipseName:`Krassovsky, 1942`},SEasia:{a:6378155,b:6356773.3205,ellipseName:`Southeast Asia`},walbeck:{a:6376896,b:6355834.8467,ellipseName:`Walbeck`},WGS60:{a:6378165,rf:298.3,ellipseName:`WGS 60`},WGS66:{a:6378145,rf:298.25,ellipseName:`WGS 66`},WGS7:{a:6378135,rf:298.26,ellipseName:`WGS 72`},WGS84:{a:6378137,rf:298.257223563,ellipseName:`WGS 84`},sphere:{a:6370997,b:6370997,ellipseName:`Normal Sphere (r=6370997)`}},Tt=wt.WGS84;function Et(e,t,n,r){var i=e*e,a=t*t,o=(i-a)/i,s=0;r?(e*=1-o*(se+o*(ce+o*le)),i=e*e,o=0):s=Math.sqrt(o);var c=(i-a)/a;return{es:o,e:s,ep2:c}}function Dt(e,t,n,r,i){if(!e){var a=ge(wt,r);a||=Tt,e=a.a,t=a.b,n=a.rf}return n&&!t&&(t=(1-1/n)*e),(n===0||Math.abs(e-t)<1e-10)&&(i=!0,t=e),{a:e,b:t,rf:n,sphere:i}}var Ot={wgs84:{towgs84:`0,0,0`,ellipse:`WGS84`,datumName:`WGS84`},ch1903:{towgs84:`674.374,15.056,405.346`,ellipse:`bessel`,datumName:`swiss`},ggrs87:{towgs84:`-199.87,74.79,246.62`,ellipse:`GRS80`,datumName:`Greek_Geodetic_Reference_System_1987`},nad83:{towgs84:`0,0,0`,ellipse:`GRS80`,datumName:`North_American_Datum_1983`},nad27:{nadgrids:`@conus,@alaska,@ntv2_0.gsb,@ntv1_can.dat`,ellipse:`clrk66`,datumName:`North_American_Datum_1927`},potsdam:{towgs84:`598.1,73.7,418.2,0.202,0.045,-2.455,6.7`,ellipse:`bessel`,datumName:`Potsdam Rauenberg 1950 DHDN`},carthage:{towgs84:`-263.0,6.0,431.0`,ellipse:`clrk80ign`,datumName:`Carthage 1934 Tunisia`},hermannskogel:{towgs84:`577.326,90.129,463.919,5.137,1.474,5.297,2.4232`,ellipse:`bessel`,datumName:`Hermannskogel`},mgi:{towgs84:`577.326,90.129,463.919,5.137,1.474,5.297,2.4232`,ellipse:`bessel`,datumName:`Militar-Geographische Institut`},osni52:{towgs84:`482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15`,ellipse:`airy`,datumName:`Irish National`},ire65:{towgs84:`482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15`,ellipse:`mod_airy`,datumName:`Ireland 1965`},rassadiran:{towgs84:`-133.63,-157.5,-158.62`,ellipse:`intl`,datumName:`Rassadiran`},nzgd49:{towgs84:`59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993`,ellipse:`intl`,datumName:`New Zealand Geodetic Datum 1949`},osgb36:{towgs84:`446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894`,ellipse:`airy`,datumName:`Ordnance Survey of Great Britain 1936`},s_jtsk:{towgs84:`589,76,480`,ellipse:`bessel`,datumName:`S-JTSK (Ferro)`},beduaram:{towgs84:`-106,-87,188`,ellipse:`clrk80`,datumName:`Beduaram`},gunung_segara:{towgs84:`-403,684,41`,ellipse:`bessel`,datumName:`Gunung Segara Jakarta`},rnb72:{towgs84:`106.869,-52.2978,103.724,-0.33657,0.456955,-1.84218,1`,ellipse:`intl`,datumName:`Reseau National Belge 1972`},EPSG_5451:{towgs84:`6.41,-49.05,-11.28,1.5657,0.5242,6.9718,-5.7649`},IGNF_LURESG:{towgs84:`-192.986,13.673,-39.309,-0.4099,-2.9332,2.6881,0.43`},EPSG_4614:{towgs84:`-119.4248,-303.65872,-11.00061,1.164298,0.174458,1.096259,3.657065`},EPSG_4615:{towgs84:`-494.088,-312.129,279.877,-1.423,-1.013,1.59,-0.748`},ESRI_37241:{towgs84:`-76.822,257.457,-12.817,2.136,-0.033,-2.392,-0.031`},ESRI_37249:{towgs84:`-440.296,58.548,296.265,1.128,10.202,4.559,-0.438`},ESRI_37245:{towgs84:`-511.151,-181.269,139.609,1.05,2.703,1.798,3.071`},EPSG_4178:{towgs84:`24.9,-126.4,-93.2,-0.063,-0.247,-0.041,1.01`},EPSG_4622:{towgs84:`-472.29,-5.63,-304.12,0.4362,-0.8374,0.2563,1.8984`},EPSG_4625:{towgs84:`126.93,547.94,130.41,-2.7867,5.1612,-0.8584,13.8227`},EPSG_5252:{towgs84:`0.023,0.036,-0.068,0.00176,0.00912,-0.01136,0.00439`},EPSG_4314:{towgs84:`597.1,71.4,412.1,0.894,0.068,-1.563,7.58`},EPSG_4282:{towgs84:`-178.3,-316.7,-131.5,5.278,6.077,10.979,19.166`},EPSG_4231:{towgs84:`-83.11,-97.38,-117.22,0.005693,-0.044698,0.044285,0.1218`},EPSG_4274:{towgs84:`-230.994,102.591,25.199,0.633,-0.239,0.9,1.95`},EPSG_4134:{towgs84:`-180.624,-225.516,173.919,-0.81,-1.898,8.336,16.71006`},EPSG_4254:{towgs84:`18.38,192.45,96.82,0.056,-0.142,-0.2,-0.0013`},EPSG_4159:{towgs84:`-194.513,-63.978,-25.759,-3.4027,3.756,-3.352,-0.9175`},EPSG_4687:{towgs84:`0.072,-0.507,-0.245,0.0183,-0.0003,0.007,-0.0093`},EPSG_4227:{towgs84:`-83.58,-397.54,458.78,-17.595,-2.847,4.256,3.225`},EPSG_4746:{towgs84:`599.4,72.4,419.2,-0.062,-0.022,-2.723,6.46`},EPSG_4745:{towgs84:`612.4,77,440.2,-0.054,0.057,-2.797,2.55`},EPSG_6311:{towgs84:`8.846,-4.394,-1.122,-0.00237,-0.146528,0.130428,0.783926`},EPSG_4289:{towgs84:`565.7381,50.4018,465.2904,-0.395026,0.330772,-1.876073,4.07244`},EPSG_4230:{towgs84:`-68.863,-134.888,-111.49,-0.53,-0.14,0.57,-3.4`},EPSG_4154:{towgs84:`-123.02,-158.95,-168.47`},EPSG_4156:{towgs84:`570.8,85.7,462.8,4.998,1.587,5.261,3.56`},EPSG_4299:{towgs84:`482.5,-130.6,564.6,-1.042,-0.214,-0.631,8.15`},EPSG_4179:{towgs84:`33.4,-146.6,-76.3,-0.359,-0.053,0.844,-0.84`},EPSG_4313:{towgs84:`-106.8686,52.2978,-103.7239,0.3366,-0.457,1.8422,-1.2747`},EPSG_4194:{towgs84:`163.511,127.533,-159.789`},EPSG_4195:{towgs84:`105,326,-102.5`},EPSG_4196:{towgs84:`-45,417,-3.5`},EPSG_4611:{towgs84:`-162.619,-276.959,-161.764,0.067753,-2.243648,-1.158828,-1.094246`},EPSG_4633:{towgs84:`137.092,131.66,91.475,-1.9436,-11.5993,-4.3321,-7.4824`},EPSG_4641:{towgs84:`-408.809,366.856,-412.987,1.8842,-0.5308,2.1655,-121.0993`},EPSG_4643:{towgs84:`-480.26,-438.32,-643.429,16.3119,20.1721,-4.0349,-111.7002`},EPSG_4300:{towgs84:`482.5,-130.6,564.6,-1.042,-0.214,-0.631,8.15`},EPSG_4188:{towgs84:`482.5,-130.6,564.6,-1.042,-0.214,-0.631,8.15`},EPSG_4660:{towgs84:`982.6087,552.753,-540.873,6.681627,-31.611492,-19.848161,16.805`},EPSG_4662:{towgs84:`97.295,-263.247,310.882,-1.5999,0.8386,3.1409,13.3259`},EPSG_3906:{towgs84:`577.88891,165.22205,391.18289,4.9145,-0.94729,-13.05098,7.78664`},EPSG_4307:{towgs84:`-209.3622,-87.8162,404.6198,0.0046,3.4784,0.5805,-1.4547`},EPSG_6892:{towgs84:`-76.269,-16.683,68.562,-6.275,10.536,-4.286,-13.686`},EPSG_4690:{towgs84:`221.597,152.441,176.523,2.403,1.3893,0.884,11.4648`},EPSG_4691:{towgs84:`218.769,150.75,176.75,3.5231,2.0037,1.288,10.9817`},EPSG_4629:{towgs84:`72.51,345.411,79.241,-1.5862,-0.8826,-0.5495,1.3653`},EPSG_4630:{towgs84:`165.804,216.213,180.26,-0.6251,-0.4515,-0.0721,7.4111`},EPSG_4692:{towgs84:`217.109,86.452,23.711,0.0183,-0.0003,0.007,-0.0093`},EPSG_9333:{towgs84:`0,0,0,-0.008393,0.000749,-0.010276,0`},EPSG_9059:{towgs84:`0,0,0`},EPSG_4312:{towgs84:`601.705,84.263,485.227,4.7354,1.3145,5.393,-2.3887`},EPSG_4123:{towgs84:`-96.062,-82.428,-121.753,4.801,0.345,-1.376,1.496`},EPSG_4309:{towgs84:`-124.45,183.74,44.64,-0.4384,0.5446,-0.9706,-2.1365`},ESRI_104106:{towgs84:`-283.088,-70.693,117.445,-1.157,0.059,-0.652,-4.058`},EPSG_4281:{towgs84:`-219.247,-73.802,269.529`},EPSG_4322:{towgs84:`0,0,4.5`},EPSG_4324:{towgs84:`0,0,1.9`},EPSG_4284:{towgs84:`43.822,-108.842,-119.585,1.455,-0.761,0.737,0.549`},EPSG_4277:{towgs84:`446.448,-125.157,542.06,0.15,0.247,0.842,-20.489`},EPSG_4207:{towgs84:`-282.1,-72.2,120,-1.529,0.145,-0.89,-4.46`},EPSG_4688:{towgs84:`347.175,1077.618,2623.677,33.9058,-70.6776,9.4013,186.0647`},EPSG_4689:{towgs84:`410.793,54.542,80.501,-2.5596,-2.3517,-0.6594,17.3218`},EPSG_4720:{towgs84:`0,0,4.5`},EPSG_4273:{towgs84:`278.3,93,474.5,7.889,0.05,-6.61,6.21`},EPSG_4240:{towgs84:`204.64,834.74,293.8`},EPSG_4817:{towgs84:`278.3,93,474.5,7.889,0.05,-6.61,6.21`},ESRI_104131:{towgs84:`426.62,142.62,460.09,4.98,4.49,-12.42,-17.1`},EPSG_4265:{towgs84:`-104.1,-49.1,-9.9,0.971,-2.917,0.714,-11.68`},EPSG_4263:{towgs84:`-111.92,-87.85,114.5,1.875,0.202,0.219,0.032`},EPSG_4298:{towgs84:`-689.5937,623.84046,-65.93566,-0.02331,1.17094,-0.80054,5.88536`},EPSG_4270:{towgs84:`-253.4392,-148.452,386.5267,0.15605,0.43,-0.1013,-0.0424`},EPSG_4229:{towgs84:`-121.8,98.1,-10.7`},EPSG_4220:{towgs84:`-55.5,-348,-229.2`},EPSG_4214:{towgs84:`12.646,-155.176,-80.863`},EPSG_4232:{towgs84:`-345,3,223`},EPSG_4238:{towgs84:`-1.977,-13.06,-9.993,0.364,0.254,0.689,-1.037`},EPSG_4168:{towgs84:`-170,33,326`},EPSG_4131:{towgs84:`199,931,318.9`},EPSG_4152:{towgs84:`-0.9102,2.0141,0.5602,0.029039,0.010065,0.010101,0`},EPSG_5228:{towgs84:`572.213,85.334,461.94,4.9732,1.529,5.2484,3.5378`},EPSG_8351:{towgs84:`485.021,169.465,483.839,7.786342,4.397554,4.102655,0`},EPSG_4683:{towgs84:`-127.62,-67.24,-47.04,-3.068,4.903,1.578,-1.06`},EPSG_4133:{towgs84:`0,0,0`},EPSG_7373:{towgs84:`0.819,-0.5762,-1.6446,-0.00378,-0.03317,0.00318,0.0693`},EPSG_9075:{towgs84:`-0.9102,2.0141,0.5602,0.029039,0.010065,0.010101,0`},EPSG_9072:{towgs84:`-0.9102,2.0141,0.5602,0.029039,0.010065,0.010101,0`},EPSG_9294:{towgs84:`1.16835,-1.42001,-2.24431,-0.00822,-0.05508,0.01818,0.23388`},EPSG_4212:{towgs84:`-267.434,173.496,181.814,-13.4704,8.7154,7.3926,14.7492`},EPSG_4191:{towgs84:`-44.183,-0.58,-38.489,2.3867,2.7072,-3.5196,-8.2703`},EPSG_4237:{towgs84:`52.684,-71.194,-13.975,-0.312,-0.1063,-0.3729,1.0191`},EPSG_4740:{towgs84:`-1.08,-0.27,-0.9`},EPSG_4124:{towgs84:`419.3836,99.3335,591.3451,0.850389,1.817277,-7.862238,-0.99496`},EPSG_5681:{towgs84:`584.9636,107.7175,413.8067,1.1155,0.2824,-3.1384,7.9922`},EPSG_4141:{towgs84:`23.772,17.49,17.859,-0.3132,-1.85274,1.67299,-5.4262`},EPSG_4204:{towgs84:`-85.645,-273.077,-79.708,2.289,-1.421,2.532,3.194`},EPSG_4319:{towgs84:`226.702,-193.337,-35.371,-2.229,-4.391,9.238,0.9798`},EPSG_4200:{towgs84:`24.82,-131.21,-82.66`},EPSG_4130:{towgs84:`0,0,0`},EPSG_4127:{towgs84:`-82.875,-57.097,-156.768,-2.158,1.524,-0.982,-0.359`},EPSG_4149:{towgs84:`674.374,15.056,405.346`},EPSG_4617:{towgs84:`-0.991,1.9072,0.5129,0.02579,0.00965,0.01166,0`},EPSG_4663:{towgs84:`-210.502,-66.902,-48.476,2.094,-15.067,-5.817,0.485`},EPSG_4664:{towgs84:`-211.939,137.626,58.3,-0.089,0.251,0.079,0.384`},EPSG_4665:{towgs84:`-105.854,165.589,-38.312,-0.003,-0.026,0.024,-0.048`},EPSG_4666:{towgs84:`631.392,-66.551,481.442,1.09,-4.445,-4.487,-4.43`},EPSG_4756:{towgs84:`-192.873,-39.382,-111.202,-0.00205,-0.0005,0.00335,0.0188`},EPSG_4723:{towgs84:`-179.483,-69.379,-27.584,-7.862,8.163,6.042,-13.925`},EPSG_4726:{towgs84:`8.853,-52.644,180.304,-0.393,-2.323,2.96,-24.081`},EPSG_4267:{towgs84:`-8.0,160.0,176.0`},EPSG_5365:{towgs84:`-0.16959,0.35312,0.51846,0.03385,-0.16325,0.03446,0.03693`},EPSG_4218:{towgs84:`304.5,306.5,-318.1`},EPSG_4242:{towgs84:`-33.722,153.789,94.959,-8.581,-4.478,4.54,8.95`},EPSG_4216:{towgs84:`-292.295,248.758,429.447,4.9971,2.99,6.6906,1.0289`},ESRI_104105:{towgs84:`631.392,-66.551,481.442,1.09,-4.445,-4.487,-4.43`},ESRI_104129:{towgs84:`0,0,0`},EPSG_4673:{towgs84:`174.05,-25.49,112.57`},EPSG_4202:{towgs84:`-124,-60,154`},EPSG_4203:{towgs84:`-117.763,-51.51,139.061,0.292,0.443,0.277,-0.191`},EPSG_3819:{towgs84:`595.48,121.69,515.35,4.115,-2.9383,0.853,-3.408`},EPSG_8694:{towgs84:`-93.799,-132.737,-219.073,-1.844,0.648,-6.37,-0.169`},EPSG_4145:{towgs84:`275.57,676.78,229.6`},EPSG_4283:{towgs84:`0.06155,-0.01087,-0.04019,0.039492,0.032722,0.032898,-0.009994`},EPSG_4317:{towgs84:`2.3287,-147.0425,-92.0802,-0.309248,0.324822,0.497299,5.689063`},EPSG_4272:{towgs84:`59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993`},EPSG_4248:{towgs84:`-307.7,265.3,-363.5`},EPSG_5561:{towgs84:`24,-121,-76`},EPSG_5233:{towgs84:`-0.293,766.95,87.713,0.195704,1.695068,3.473016,-0.039338`},ESRI_104130:{towgs84:`-86,-98,-119`},ESRI_104102:{towgs84:`682,-203,480`},ESRI_37207:{towgs84:`7,-10,-26`},EPSG_4675:{towgs84:`59.935,118.4,-10.871`},ESRI_104109:{towgs84:`-89.121,-348.182,260.871`},ESRI_104112:{towgs84:`-185.583,-230.096,281.361`},ESRI_104113:{towgs84:`25.1,-275.6,222.6`},IGNF_WGS72G:{towgs84:`0,12,6`},IGNF_NTFG:{towgs84:`-168,-60,320`},IGNF_EFATE57G:{towgs84:`-127,-769,472`},IGNF_PGP50G:{towgs84:`324.8,153.6,172.1`},IGNF_REUN47G:{towgs84:`94,-948,-1262`},IGNF_CSG67G:{towgs84:`-186,230,110`},IGNF_GUAD48G:{towgs84:`-467,-16,-300`},IGNF_TAHI51G:{towgs84:`162,117,154`},IGNF_TAHAAG:{towgs84:`65,342,77`},IGNF_NUKU72G:{towgs84:`84,274,65`},IGNF_PETRELS72G:{towgs84:`365,194,166`},IGNF_WALL78G:{towgs84:`253,-133,-127`},IGNF_MAYO50G:{towgs84:`-382,-59,-262`},IGNF_TANNAG:{towgs84:`-139,-967,436`},IGNF_IGN72G:{towgs84:`-13,-348,292`},IGNF_ATIGG:{towgs84:`1118,23,66`},IGNF_FANGA84G:{towgs84:`150.57,158.33,118.32`},IGNF_RUSAT84G:{towgs84:`202.13,174.6,-15.74`},IGNF_KAUE70G:{towgs84:`126.74,300.1,-75.49`},IGNF_MOP90G:{towgs84:`-10.8,-1.8,12.77`},IGNF_MHPF67G:{towgs84:`338.08,212.58,-296.17`},IGNF_TAHI79G:{towgs84:`160.61,116.05,153.69`},IGNF_ANAA92G:{towgs84:`1.5,3.84,4.81`},IGNF_MARQUI72G:{towgs84:`330.91,-13.92,58.56`},IGNF_APAT86G:{towgs84:`143.6,197.82,74.05`},IGNF_TUBU69G:{towgs84:`237.17,171.61,-77.84`},IGNF_STPM50G:{towgs84:`11.363,424.148,373.13`},EPSG_4150:{towgs84:`674.374,15.056,405.346`},EPSG_4754:{towgs84:`-208.4058,-109.8777,-2.5764`},ESRI_104101:{towgs84:`372.87,149.23,585.29`},EPSG_4693:{towgs84:`0,-0.15,0.68`},EPSG_6207:{towgs84:`293.17,726.18,245.36`},EPSG_4153:{towgs84:`-133.63,-157.5,-158.62`},EPSG_4132:{towgs84:`-241.54,-163.64,396.06`},EPSG_4221:{towgs84:`-154.5,150.7,100.4`},EPSG_4266:{towgs84:`-80.7,-132.5,41.1`},EPSG_4193:{towgs84:`-70.9,-151.8,-41.4`},EPSG_5340:{towgs84:`-0.41,0.46,-0.35`},EPSG_4246:{towgs84:`-294.7,-200.1,525.5`},EPSG_4318:{towgs84:`-3.2,-5.7,2.8`},EPSG_4121:{towgs84:`-199.87,74.79,246.62`},EPSG_4223:{towgs84:`-260.1,5.5,432.2`},EPSG_4158:{towgs84:`-0.465,372.095,171.736`},EPSG_4285:{towgs84:`-128.16,-282.42,21.93`},EPSG_4613:{towgs84:`-404.78,685.68,45.47`},EPSG_4607:{towgs84:`195.671,332.517,274.607`},EPSG_4475:{towgs84:`-381.788,-57.501,-256.673`},EPSG_4208:{towgs84:`-157.84,308.54,-146.6`},EPSG_4743:{towgs84:`70.995,-335.916,262.898`},EPSG_4710:{towgs84:`-323.65,551.39,-491.22`},EPSG_7881:{towgs84:`-0.077,0.079,0.086`},EPSG_4682:{towgs84:`283.729,735.942,261.143`},EPSG_4739:{towgs84:`-156,-271,-189`},EPSG_4679:{towgs84:`-80.01,253.26,291.19`},EPSG_4750:{towgs84:`-56.263,16.136,-22.856`},EPSG_4644:{towgs84:`-10.18,-350.43,291.37`},EPSG_4695:{towgs84:`-103.746,-9.614,-255.95`},EPSG_4292:{towgs84:`-355,21,72`},EPSG_4302:{towgs84:`-61.702,284.488,472.052`},EPSG_4143:{towgs84:`-124.76,53,466.79`},EPSG_4606:{towgs84:`-153,153,307`},EPSG_4699:{towgs84:`-770.1,158.4,-498.2`},EPSG_4247:{towgs84:`-273.5,110.6,-357.9`},EPSG_4160:{towgs84:`8.88,184.86,106.69`},EPSG_4161:{towgs84:`-233.43,6.65,173.64`},EPSG_9251:{towgs84:`-9.5,122.9,138.2`},EPSG_9253:{towgs84:`-78.1,101.6,133.3`},EPSG_4297:{towgs84:`-198.383,-240.517,-107.909`},EPSG_4269:{towgs84:`0,0,0`},EPSG_4301:{towgs84:`-147,506,687`},EPSG_4618:{towgs84:`-59,-11,-52`},EPSG_4612:{towgs84:`0,0,0`},EPSG_4678:{towgs84:`44.585,-131.212,-39.544`},EPSG_4250:{towgs84:`-130,29,364`},EPSG_4144:{towgs84:`214,804,268`},EPSG_4147:{towgs84:`-17.51,-108.32,-62.39`},EPSG_4259:{towgs84:`-254.1,-5.36,-100.29`},EPSG_4164:{towgs84:`-76,-138,67`},EPSG_4211:{towgs84:`-378.873,676.002,-46.255`},EPSG_4182:{towgs84:`-422.651,-172.995,84.02`},EPSG_4224:{towgs84:`-143.87,243.37,-33.52`},EPSG_4225:{towgs84:`-205.57,168.77,-4.12`},EPSG_5527:{towgs84:`-67.35,3.88,-38.22`},EPSG_4752:{towgs84:`98,390,-22`},EPSG_4310:{towgs84:`-30,190,89`},EPSG_9248:{towgs84:`-192.26,65.72,132.08`},EPSG_4680:{towgs84:`124.5,-63.5,-281`},EPSG_4701:{towgs84:`-79.9,-158,-168.9`},EPSG_4706:{towgs84:`-146.21,112.63,4.05`},EPSG_4805:{towgs84:`682,-203,480`},EPSG_4201:{towgs84:`-165,-11,206`},EPSG_4210:{towgs84:`-157,-2,-299`},EPSG_4183:{towgs84:`-104,167,-38`},EPSG_4139:{towgs84:`11,72,-101`},EPSG_4668:{towgs84:`-86,-98,-119`},EPSG_4717:{towgs84:`-2,151,181`},EPSG_4732:{towgs84:`102,52,-38`},EPSG_4280:{towgs84:`-377,681,-50`},EPSG_4209:{towgs84:`-138,-105,-289`},EPSG_4261:{towgs84:`31,146,47`},EPSG_4658:{towgs84:`-73,46,-86`},EPSG_4721:{towgs84:`265.025,384.929,-194.046`},EPSG_4222:{towgs84:`-136,-108,-292`},EPSG_4601:{towgs84:`-255,-15,71`},EPSG_4602:{towgs84:`725,685,536`},EPSG_4603:{towgs84:`72,213.7,93`},EPSG_4605:{towgs84:`9,183,236`},EPSG_4621:{towgs84:`137,248,-430`},EPSG_4657:{towgs84:`-28,199,5`},EPSG_4316:{towgs84:`103.25,-100.4,-307.19`},EPSG_4642:{towgs84:`-13,-348,292`},EPSG_4698:{towgs84:`145,-187,103`},EPSG_4192:{towgs84:`-206.1,-174.7,-87.7`},EPSG_4311:{towgs84:`-265,120,-358`},EPSG_4135:{towgs84:`58,-283,-182`},ESRI_104138:{towgs84:`198,-226,-347`},EPSG_4245:{towgs84:`-11,851,5`},EPSG_4142:{towgs84:`-125,53,467`},EPSG_4213:{towgs84:`-106,-87,188`},EPSG_4253:{towgs84:`-133,-77,-51`},EPSG_4129:{towgs84:`-132,-110,-335`},EPSG_4713:{towgs84:`-77,-128,142`},EPSG_4239:{towgs84:`217,823,299`},EPSG_4146:{towgs84:`295,736,257`},EPSG_4155:{towgs84:`-83,37,124`},EPSG_4165:{towgs84:`-173,253,27`},EPSG_4672:{towgs84:`175,-38,113`},EPSG_4236:{towgs84:`-637,-549,-203`},EPSG_4251:{towgs84:`-90,40,88`},EPSG_4271:{towgs84:`-2,374,172`},EPSG_4175:{towgs84:`-88,4,101`},EPSG_4716:{towgs84:`298,-304,-375`},EPSG_4315:{towgs84:`-23,259,-9`},EPSG_4744:{towgs84:`-242.2,-144.9,370.3`},EPSG_4244:{towgs84:`-97,787,86`},EPSG_4293:{towgs84:`616,97,-251`},EPSG_4714:{towgs84:`-127,-769,472`},EPSG_4736:{towgs84:`260,12,-147`},EPSG_6883:{towgs84:`-235,-110,393`},EPSG_6894:{towgs84:`-63,176,185`},EPSG_4205:{towgs84:`-43,-163,45`},EPSG_4256:{towgs84:`41,-220,-134`},EPSG_4262:{towgs84:`639,405,60`},EPSG_4604:{towgs84:`174,359,365`},EPSG_4169:{towgs84:`-115,118,426`},EPSG_4620:{towgs84:`-106,-129,165`},EPSG_4184:{towgs84:`-203,141,53`},EPSG_4616:{towgs84:`-289,-124,60`},EPSG_9403:{towgs84:`-307,-92,127`},EPSG_4684:{towgs84:`-133,-321,50`},EPSG_4708:{towgs84:`-491,-22,435`},EPSG_4707:{towgs84:`114,-116,-333`},EPSG_4709:{towgs84:`145,75,-272`},EPSG_4712:{towgs84:`-205,107,53`},EPSG_4711:{towgs84:`124,-234,-25`},EPSG_4718:{towgs84:`230,-199,-752`},EPSG_4719:{towgs84:`211,147,111`},EPSG_4724:{towgs84:`208,-435,-229`},EPSG_4725:{towgs84:`189,-79,-202`},EPSG_4735:{towgs84:`647,1777,-1124`},EPSG_4722:{towgs84:`-794,119,-298`},EPSG_4728:{towgs84:`-307,-92,127`},EPSG_4734:{towgs84:`-632,438,-609`},EPSG_4727:{towgs84:`912,-58,1227`},EPSG_4729:{towgs84:`185,165,42`},EPSG_4730:{towgs84:`170,42,84`},EPSG_4733:{towgs84:`276,-57,149`},ESRI_37218:{towgs84:`230,-199,-752`},ESRI_37240:{towgs84:`-7,215,225`},ESRI_37221:{towgs84:`252,-209,-751`},ESRI_4305:{towgs84:`-123,-206,219`},ESRI_104139:{towgs84:`-73,-247,227`},EPSG_4748:{towgs84:`51,391,-36`},EPSG_4219:{towgs84:`-384,664,-48`},EPSG_4255:{towgs84:`-333,-222,114`},EPSG_4257:{towgs84:`-587.8,519.75,145.76`},EPSG_4646:{towgs84:`-963,510,-359`},EPSG_6881:{towgs84:`-24,-203,268`},EPSG_6882:{towgs84:`-183,-15,273`},EPSG_4715:{towgs84:`-104,-129,239`},IGNF_RGF93GDD:{towgs84:`0,0,0`},IGNF_RGM04GDD:{towgs84:`0,0,0`},IGNF_RGSPM06GDD:{towgs84:`0,0,0`},IGNF_RGTAAF07GDD:{towgs84:`0,0,0`},IGNF_RGFG95GDD:{towgs84:`0,0,0`},IGNF_RGNCG:{towgs84:`0,0,0`},IGNF_RGPFGDD:{towgs84:`0,0,0`},IGNF_ETRS89G:{towgs84:`0,0,0`},IGNF_RGR92GDD:{towgs84:`0,0,0`},EPSG_4173:{towgs84:`0,0,0`},EPSG_4180:{towgs84:`0,0,0`},EPSG_4619:{towgs84:`0,0,0`},EPSG_4667:{towgs84:`0,0,0`},EPSG_4075:{towgs84:`0,0,0`},EPSG_6706:{towgs84:`0,0,0`},EPSG_7798:{towgs84:`0,0,0`},EPSG_4661:{towgs84:`0,0,0`},EPSG_4669:{towgs84:`0,0,0`},EPSG_8685:{towgs84:`0,0,0`},EPSG_4151:{towgs84:`0,0,0`},EPSG_9702:{towgs84:`0,0,0`},EPSG_4758:{towgs84:`0,0,0`},EPSG_4761:{towgs84:`0,0,0`},EPSG_4765:{towgs84:`0,0,0`},EPSG_8997:{towgs84:`0,0,0`},EPSG_4023:{towgs84:`0,0,0`},EPSG_4670:{towgs84:`0,0,0`},EPSG_4694:{towgs84:`0,0,0`},EPSG_4148:{towgs84:`0,0,0`},EPSG_4163:{towgs84:`0,0,0`},EPSG_4167:{towgs84:`0,0,0`},EPSG_4189:{towgs84:`0,0,0`},EPSG_4190:{towgs84:`0,0,0`},EPSG_4176:{towgs84:`0,0,0`},EPSG_4659:{towgs84:`0,0,0`},EPSG_3824:{towgs84:`0,0,0`},EPSG_3889:{towgs84:`0,0,0`},EPSG_4046:{towgs84:`0,0,0`},EPSG_4081:{towgs84:`0,0,0`},EPSG_4558:{towgs84:`0,0,0`},EPSG_4483:{towgs84:`0,0,0`},EPSG_5013:{towgs84:`0,0,0`},EPSG_5264:{towgs84:`0,0,0`},EPSG_5324:{towgs84:`0,0,0`},EPSG_5354:{towgs84:`0,0,0`},EPSG_5371:{towgs84:`0,0,0`},EPSG_5373:{towgs84:`0,0,0`},EPSG_5381:{towgs84:`0,0,0`},EPSG_5393:{towgs84:`0,0,0`},EPSG_5489:{towgs84:`0,0,0`},EPSG_5593:{towgs84:`0,0,0`},EPSG_6135:{towgs84:`0,0,0`},EPSG_6365:{towgs84:`0,0,0`},EPSG_5246:{towgs84:`0,0,0`},EPSG_7886:{towgs84:`0,0,0`},EPSG_8431:{towgs84:`0,0,0`},EPSG_8427:{towgs84:`0,0,0`},EPSG_8699:{towgs84:`0,0,0`},EPSG_8818:{towgs84:`0,0,0`},EPSG_4757:{towgs84:`0,0,0`},EPSG_9140:{towgs84:`0,0,0`},EPSG_8086:{towgs84:`0,0,0`},EPSG_4686:{towgs84:`0,0,0`},EPSG_4737:{towgs84:`0,0,0`},EPSG_4702:{towgs84:`0,0,0`},EPSG_4747:{towgs84:`0,0,0`},EPSG_4749:{towgs84:`0,0,0`},EPSG_4674:{towgs84:`0,0,0`},EPSG_4755:{towgs84:`0,0,0`},EPSG_4759:{towgs84:`0,0,0`},EPSG_4762:{towgs84:`0,0,0`},EPSG_4763:{towgs84:`0,0,0`},EPSG_4764:{towgs84:`0,0,0`},EPSG_4166:{towgs84:`0,0,0`},EPSG_4170:{towgs84:`0,0,0`},EPSG_5546:{towgs84:`0,0,0`},EPSG_7844:{towgs84:`0,0,0`},EPSG_4818:{towgs84:`589,76,480`},EPSG_10328:{towgs84:`0,0,0`},EPSG_9782:{towgs84:`0,0,0`},EPSG_9777:{towgs84:`0,0,0`},EPSG_10690:{towgs84:`0,0,0`},EPSG_10639:{towgs84:`0,0,0`},EPSG_10739:{towgs84:`0,0,0`},EPSG_7686:{towgs84:`0,0,0`},EPSG_8900:{towgs84:`0,0,0`},EPSG_5886:{towgs84:`0,0,0`},EPSG_7683:{towgs84:`0,0,0`},EPSG_6668:{towgs84:`0,0,0`},EPSG_20046:{towgs84:`0,0,0`},EPSG_10299:{towgs84:`0,0,0`},EPSG_10310:{towgs84:`0,0,0`},EPSG_10475:{towgs84:`0,0,0`},EPSG_4742:{towgs84:`0,0,0`},EPSG_10671:{towgs84:`0,0,0`},EPSG_10762:{towgs84:`0,0,0`},EPSG_10725:{towgs84:`0,0,0`},EPSG_10791:{towgs84:`0,0,0`},EPSG_10800:{towgs84:`0,0,0`},EPSG_10305:{towgs84:`0,0,0`},EPSG_10941:{towgs84:`0,0,0`},EPSG_10968:{towgs84:`0,0,0`},EPSG_10875:{towgs84:`0,0,0`},EPSG_6318:{towgs84:`0,0,0`},EPSG_10910:{towgs84:`0,0,0`}};for(var kt in Ot){var At=Ot[kt];At.datumName&&(Ot[At.datumName]=At)}function jt(e,t,n,r,i,a,o){var s={};return s.datum_type=5,t&&(s.datum_type=4,s.datum_params=t.map(parseFloat),(s.datum_params[0]!==0||s.datum_params[1]!==0||s.datum_params[2]!==0)&&(s.datum_type=1),s.datum_params.length>3&&(s.datum_params[3]!==0||s.datum_params[4]!==0||s.datum_params[5]!==0||s.datum_params[6]!==0)&&(s.datum_type=2,s.datum_params[3]*=oe,s.datum_params[4]*=oe,s.datum_params[5]*=oe,s.datum_params[6]=s.datum_params[6]/1e6+1)),o&&(s.datum_type=3,s.grids=o),s.a=n,s.b=r,s.es=i,s.ep2=a,s}var Mt={};function Nt(e,t,n){return t instanceof ArrayBuffer?Pt(e,t,n):{ready:Ft(e,t)}}function Pt(e,t,n){var r=!0;n!==void 0&&n.includeErrorFields===!1&&(r=!1);var i=new DataView(t),a=Bt(i),o=Vt(i,a),s={header:o,subgrids:Ut(i,o,a,r)};return Mt[e]=s,s}async function Ft(e,t){for(var n=[],r=await t.getImageCount(),i=r-1;i>=0;i--){var a=await t.getImage(i),o=await a.readRasters(),s=[a.getWidth(),a.getHeight()],c=a.getBoundingBox().map(Rt),l=typeof a.fileDirectory.getValue==`function`?a.fileDirectory.getValue(`ModelPixelScale`):a.fileDirectory.ModelPixelScale,u=[l[0],l[1]].map(Rt),d=c[0]+(s[0]-1)*u[0],f=c[3]-(s[1]-1)*u[1],p=o[0],m=o[1],h=[];for(let e=s[1]-1;e>=0;e--)for(let t=s[0]-1;t>=0;t--){var g=e*s[0]+t;h.push([-zt(m[g]),zt(p[g])])}n.push({del:u,lim:s,ll:[-d,f],cvs:h})}var _={header:{nSubgrids:r},subgrids:n};return Mt[e]=_,_}function It(e){return e===void 0?null:e.split(`,`).map(Lt)}function Lt(e){if(e.length===0)return null;var t=e[0]===`@`;return t&&(e=e.slice(1)),e===`null`?{name:`null`,mandatory:!t,grid:null,isNull:!0}:{name:e,mandatory:!t,grid:Mt[e]||null,isNull:!1}}function Rt(e){return e*Math.PI/180}function zt(e){return e/3600*Math.PI/180}function Bt(e){var t=e.getInt32(8,!1);return t!==11&&(t=e.getInt32(8,!0),t!==11&&console.warn(`Failed to detect nadgrid endian-ness, defaulting to little-endian`),!0)}function Vt(e,t){return{nFields:e.getInt32(8,t),nSubgridFields:e.getInt32(24,t),nSubgrids:e.getInt32(40,t),shiftType:Ht(e,56,64).trim(),fromSemiMajorAxis:e.getFloat64(120,t),fromSemiMinorAxis:e.getFloat64(136,t),toSemiMajorAxis:e.getFloat64(152,t),toSemiMinorAxis:e.getFloat64(168,t)}}function Ht(e,t,n){return String.fromCharCode.apply(null,new Uint8Array(e.buffer.slice(t,n)))}function Ut(e,t,n,r){for(var i=176,a=[],o=0;o5e-11?!1:e.datum_type===1?e.datum_params[0]===t.datum_params[0]&&e.datum_params[1]===t.datum_params[1]&&e.datum_params[2]===t.datum_params[2]:e.datum_type!==2||e.datum_params[0]===t.datum_params[0]&&e.datum_params[1]===t.datum_params[1]&&e.datum_params[2]===t.datum_params[2]&&e.datum_params[3]===t.datum_params[3]&&e.datum_params[4]===t.datum_params[4]&&e.datum_params[5]===t.datum_params[5]&&e.datum_params[6]===t.datum_params[6]}function Yt(e,t,n){var r=e.x,i=e.y,a=e.z?e.z:0,o,s,c,l;if(i<-j&&i>-1.001*j)i=-j;else if(i>j&&i<1.001*j)i=j;else if(i<-j)return{x:-1/0,y:-1/0,z:e.z};else if(i>j)return{x:1/0,y:1/0,z:e.z};return r>Math.PI&&(r-=2*Math.PI),s=Math.sin(i),l=Math.cos(i),c=s*s,o=n/Math.sqrt(1-t*c),{x:(o+a)*l*Math.cos(r),y:(o+a)*l*Math.sin(r),z:(o*(1-t)+a)*s}}function Xt(e,t,n,r){var i=1e-12,a=i*i,o=30,s,c,l,u,d,f,p,m,h,g,_,v,y,b=e.x,x=e.y,S=e.z?e.z:0,C,w,T;if(s=Math.sqrt(b*b+x*x),c=Math.sqrt(b*b+x*x+S*S),s/na&&yr.y||p>r.x||gs&&Math.abs(c.y)>s);if(o<0)return console.log(`Inverse grid shift iterator failed to converge.`),r;r.x=F(a.x+n.ll[0]),r.y=a.y+n.ll[1]}else isNaN(a.x)||(r.x=e.x+a.x,r.y=e.y+a.y);return r}function rn(e,t){var n={x:e.x/t.del[0],y:e.y/t.del[1]},r={x:Math.floor(n.x),y:Math.floor(n.y)},i={x:n.x-1*r.x,y:n.y-1*r.y},a={x:NaN,y:NaN},o;if(r.x<0||r.x>=t.lim[0]||r.y<0||r.y>=t.lim[1])return a;o=r.y*t.lim[0]+r.x;var s={x:t.cvs[o][0],y:t.cvs[o][1]};o++;var c={x:t.cvs[o][0],y:t.cvs[o][1]};o+=t.lim[0];var l={x:t.cvs[o][0],y:t.cvs[o][1]};o--;var u={x:t.cvs[o][0],y:t.cvs[o][1]},d=i.x*i.y,f=i.x*(1-i.y),p=(1-i.x)*(1-i.y),m=(1-i.x)*i.y;return a.x=p*s.x+f*c.x+m*u.x+d*l.x,a.y=p*s.y+f*c.y+m*u.y+d*l.y,a}var an=[`x`,`y`,`z`];function on(e,t){let n={};for(let r=0,i=e.axis.length;r2&&(t.z=e[2]),e.length>3&&(t.m=e[3]),t}function ln(e){un(e.x),un(e.y)}function un(e){if(typeof Number.isFinite==`function`){if(Number.isFinite(e))return;throw TypeError(`coordinates must be finite numbers`)}if(typeof e!=`number`||e!==e||!isFinite(e))throw TypeError(`coordinates must be finite numbers`)}function dn(e,t){return(e.datum.datum_type===1||e.datum.datum_type===2||e.datum.datum_type===3)&&t.datumCode!==`WGS84`||(t.datum.datum_type===1||t.datum.datum_type===2||t.datum.datum_type===3)&&e.datumCode!==`WGS84`}function fn(e,t,n,r){var i,a=n.z!==void 0;if(ln(n),e.datum&&t.datum&&dn(e,t)&&(i=new qt(`WGS84`),n=fn(e,i,n,r),e=i),r&&e.axis!==`enu`&&(n=on(e,n)),e.projName===`longlat`)n={x:n.x*M,y:n.y*M,z:n.z||0};else if(e.to_meter&&(n={x:n.x*e.to_meter,y:n.y*e.to_meter,z:n.z||0}),n=e.inverse(n),!n)return;if(e.from_greenwich&&(n.x+=e.from_greenwich),n=en(e.datum,t.datum,n),n)return n=n,t.from_greenwich&&(n={x:n.x-t.from_greenwich,y:n.y,z:n.z||0}),t.projName===`longlat`?(t.long_wrap!==void 0&&(n.x=t.long_wrap+F(n.x-t.long_wrap)),n={x:n.x*de,y:n.y*de,z:n.z||0}):(n=t.forward(n),t.to_meter&&(n={x:n.x/t.to_meter,y:n.y/t.to_meter,z:n.z||0})),r&&t.axis!==`enu`?sn(t,n):(n&&!a&&t.projName!==`geocent`&&delete n.z,n)}function pn(e,t,n,r){return fn(e,t,Array.isArray(n)?cn(n):{x:n.x,y:n.y,z:n.z,m:n.m},r)}var mn=qt(`WGS84`);function hn(e,t,n,r){var i,a,o;return Array.isArray(n)?(i=fn(e,t,cn(n),r)||{x:NaN,y:NaN},n.length>2?(a=e.name!==void 0&&e.name===`geocent`||t.name!==void 0&&t.name===`geocent`,a?typeof i.z==`number`?[i.x,i.y,i.z].concat(n.slice(3)):[i.x,i.y,n[2]].concat(n.slice(3)):r&&typeof i.z==`number`?[i.x,i.y,i.z].concat(n.slice(3)):[i.x,i.y].concat(n.slice(2))):[i.x,i.y]):(i=fn(e,t,{x:n.x,y:n.y,z:n.z,m:n.m},r)||{x:NaN,y:NaN},o=Object.keys(n),o.length===2||(a=e.name!==void 0&&e.name===`geocent`||t.name!==void 0&&t.name===`geocent`,o.forEach(function(e){e!==`x`&&e!==`y`&&(e!==`z`||!a&&!r)&&(i[e]=n[e])})),i)}function gn(e){return e instanceof qt?e:typeof e==`object`&&`oProj`in e?e.oProj:qt(e)}function _n(e,t,n){var r,i,a=!1,o;return t===void 0?(i=gn(e),r=mn,a=!0):(t.x!==void 0||Array.isArray(t))&&(n=t,i=gn(e),r=mn,a=!0),r||=gn(e),i||=gn(t),n?hn(r,i,n):(o={forward:function(e,t){return hn(r,i,e,t)},inverse:function(e,t){return hn(i,r,e,t)}},a&&(o.oProj=i),o)}var vn=6,yn=`AJSAJS`,bn=`AFAFAF`,xn=65,Sn=73,Cn=79,wn=86,Tn=90,En={forward:Dn,inverse:On,toPoint:kn};function Dn(e,t){return t||=5,Fn(Mn({lat:e[1],lon:e[0]}),t)}function On(e){var t=Nn(zn(e.toUpperCase()));return t.lat&&t.lon?[t.lon,t.lat,t.lon,t.lat]:[t.left,t.bottom,t.right,t.top]}function kn(e){var t=Nn(zn(e.toUpperCase()));return t.lat&&t.lon?[t.lon,t.lat]:[(t.left+t.right)/2,(t.top+t.bottom)/2]}function An(e){return Math.PI/180*e}function jn(e){return e/Math.PI*180}function Mn(e){var t=e.lat,n=e.lon,r=6378137,i=.00669438,a=.9996,o,s,c,l,u,d,f,p=An(t),m=An(n),h,g=Math.floor((n+180)/6)+1;n===180&&(g=60),t>=56&&t<64&&n>=3&&n<12&&(g=32),t>=72&&t<84&&(n>=0&&n<9?g=31:n>=9&&n<21?g=33:n>=21&&n<33?g=35:n>=33&&n<42&&(g=37)),o=(g-1)*6-180+3,h=An(o),s=i/(1-i),c=r/Math.sqrt(1-i*Math.sin(p)*Math.sin(p)),l=Math.tan(p)*Math.tan(p),u=s*Math.cos(p)*Math.cos(p),d=Math.cos(p)*(m-h),f=r*((1-i/4-3*i*i/64-5*i*i*i/256)*p-(3*i/8+3*i*i/32+45*i*i*i/1024)*Math.sin(2*p)+(15*i*i/256+45*i*i*i/1024)*Math.sin(4*p)-35*i*i*i/3072*Math.sin(6*p));var _=a*c*(d+(1-l+u)*d*d*d/6+(5-18*l+l*l+72*u-58*s)*d*d*d*d*d/120)+5e5,v=a*(f+c*Math.tan(p)*(d*d/2+(5-l+9*u+4*u*u)*d*d*d*d/24+(61-58*l+l*l+600*u-330*s)*d*d*d*d*d*d/720));return t<0&&(v+=1e7),{northing:Math.round(v),easting:Math.round(_),zoneNumber:g,zoneLetter:Pn(t)}}function Nn(e){var t=e.northing,n=e.easting,r=e.zoneLetter,i=e.zoneNumber;if(i<0||i>60)return null;var a=.9996,o=6378137,s=.00669438,c,l=(1-Math.sqrt(1-s))/(1+Math.sqrt(1-s)),u,d,f,p,m,h,g,_,v,y=n-5e5,b=t;r<`N`&&(b-=1e7),g=(i-1)*6-180+3,c=s/(1-s),h=b/a,_=h/(o*(1-s/4-3*s*s/64-5*s*s*s/256)),v=_+(3*l/2-27*l*l*l/32)*Math.sin(2*_)+(21*l*l/16-55*l*l*l*l/32)*Math.sin(4*_)+151*l*l*l/96*Math.sin(6*_),u=o/Math.sqrt(1-s*Math.sin(v)*Math.sin(v)),d=Math.tan(v)*Math.tan(v),f=c*Math.cos(v)*Math.cos(v),p=o*(1-s)/(1-s*Math.sin(v)*Math.sin(v))**1.5,m=y/(u*a);var x=v-u*Math.tan(v)/p*(m*m/2-(5+3*d+10*f-4*f*f-9*c)*m*m*m*m/24+(61+90*d+298*f+45*d*d-252*c-3*f*f)*m*m*m*m*m*m/720);x=jn(x);var S=(m-(1+2*d+f)*m*m*m/6+(5-2*f+28*d-3*f*f+8*c+24*d*d)*m*m*m*m*m/120)/Math.cos(v);S=g+jn(S);var C;if(e.accuracy){var w=Nn({northing:e.northing+e.accuracy,easting:e.easting+e.accuracy,zoneLetter:e.zoneLetter,zoneNumber:e.zoneNumber});C={top:w.lat,right:w.lon,bottom:x,left:S}}else C={lat:x,lon:S};return C}function Pn(e){var t=`Z`;return 84>=e&&e>=72?t=`X`:72>e&&e>=64?t=`W`:64>e&&e>=56?t=`V`:56>e&&e>=48?t=`U`:48>e&&e>=40?t=`T`:40>e&&e>=32?t=`S`:32>e&&e>=24?t=`R`:24>e&&e>=16?t=`Q`:16>e&&e>=8?t=`P`:8>e&&e>=0?t=`N`:0>e&&e>=-8?t=`M`:-8>e&&e>=-16?t=`L`:-16>e&&e>=-24?t=`K`:-24>e&&e>=-32?t=`J`:-32>e&&e>=-40?t=`H`:-40>e&&e>=-48?t=`G`:-48>e&&e>=-56?t=`F`:-56>e&&e>=-64?t=`E`:-64>e&&e>=-72?t=`D`:-72>e&&e>=-80&&(t=`C`),t}function Fn(e,t){var n=`00000`+e.easting,r=`00000`+e.northing;return e.zoneNumber+e.zoneLetter+In(e.easting,e.northing,e.zoneNumber)+n.substr(n.length-5,t)+r.substr(r.length-5,t)}function In(e,t,n){var r=Ln(n);return Rn(Math.floor(e/1e5),Math.floor(t/1e5)%20,r)}function Ln(e){var t=e%vn;return t===0&&(t=vn),t}function Rn(e,t,n){var r=n-1,i=yn.charCodeAt(r),a=bn.charCodeAt(r),o=i+e-1,s=a+t,c=!1;return o>Tn&&(o=o-Tn+xn-1,c=!0),(o===Sn||iSn||(o>Sn||iCn||(o>Cn||iTn&&(o=o-Tn+xn-1),s>wn?(s=s-wn+xn-1,c=!0):c=!1,(s===Sn||aSn||(s>Sn||aCn||(s>Cn||awn&&(s=s-wn+xn-1),String.fromCharCode(o)+String.fromCharCode(s)}function zn(e){if(e&&e.length===0)throw`MGRSPoint coverting from nothing`;for(var t=e.length,n=null,r=``,i,a=0;!/[A-Z]/.test(i=e.charAt(a));){if(a>=2)throw`MGRSPoint bad conversion from: `+e;r+=i,a++}var o=parseInt(r,10);if(a===0||a+3>t)throw`MGRSPoint bad conversion from: `+e;var s=e.charAt(a++);if(s<=`A`||s===`B`||s===`Y`||s>=`Z`||s===`I`||s===`O`)throw`MGRSPoint zone letter `+s+` not handled: `+e;n=e.substring(a,a+=2);for(var c=Ln(o),l=Bn(n.charAt(0),c),u=Vn(n.charAt(1),c);u0&&(h=1e5/10**f,g=e.substring(a,a+f),p=parseFloat(g)*h,_=e.substring(a+f),m=parseFloat(_)*h),v=p+l,y=m+u,{easting:v,northing:y,zoneLetter:s,zoneNumber:o,accuracy:h}}function Bn(e,t){for(var n=yn.charCodeAt(t-1),r=1e5,i=!1;n!==e.charCodeAt(0);){if(n++,n===Sn&&n++,n===Cn&&n++,n>Tn){if(i)throw`Bad character: `+e;n=xn,i=!0}r+=1e5}return r}function Vn(e,t){if(e>`V`)throw`MGRSPoint given invalid Northing `+e;for(var n=bn.charCodeAt(t-1),r=0,i=!1;n!==e.charCodeAt(0);){if(n++,n===Sn&&n++,n===Cn&&n++,n>wn){if(i)throw`Bad character: `+e;n=xn,i=!0}r+=1e5}return r}function Hn(e){var t;switch(e){case`C`:t=11e5;break;case`D`:t=2e6;break;case`E`:t=28e5;break;case`F`:t=37e5;break;case`G`:t=46e5;break;case`H`:t=55e5;break;case`J`:t=64e5;break;case`K`:t=73e5;break;case`L`:t=82e5;break;case`M`:t=91e5;break;case`N`:t=0;break;case`P`:t=8e5;break;case`Q`:t=17e5;break;case`R`:t=26e5;break;case`S`:t=35e5;break;case`T`:t=44e5;break;case`U`:t=53e5;break;case`V`:t=62e5;break;case`W`:t=7e6;break;case`X`:t=79e5;break;default:t=-1}if(t>=0)return t;throw`Invalid zone letter: `+e}function Un(e,t,n){if(!(this instanceof Un))return new Un(e,t,n);if(Array.isArray(e))this.x=e[0],this.y=e[1],this.z=e[2]||0;else if(typeof e==`object`)this.x=e.x,this.y=e.y,this.z=e.z||0;else if(typeof e==`string`&&t===void 0){var r=e.split(`,`);this.x=parseFloat(r[0]),this.y=parseFloat(r[1]),this.z=parseFloat(r[2])||0}else this.x=e,this.y=t,this.z=n||0;console.warn(`proj4.Point will be removed in version 3, use proj4.toPoint`)}Un.fromMGRS=function(e){return new Un(kn(e))},Un.prototype.toMGRS=function(e){return Dn([this.x,this.y],e)};var Wn=1,Gn=.25,Kn=.046875,qn=.01953125,Jn=.01068115234375,Yn=.75,Xn=.46875,Zn=.013020833333333334,Qn=.007120768229166667,$n=.3645833333333333,er=.005696614583333333,tr=.3076171875;function nr(e){var t=[];t[0]=Wn-e*(Gn+e*(Kn+e*(qn+e*Jn))),t[1]=e*(Yn-e*(Kn+e*(qn+e*Jn)));var n=e*e;return t[2]=n*(Xn-e*(Zn+e*Qn)),n*=e,t[3]=n*($n-e*er),t[4]=n*e*tr,t}function rr(e,t,n,r){return n*=t,t*=t,r[0]*e-n*(r[1]+t*(r[2]+t*(r[3]+t*r[4])))}var ir=20;function ar(e,t,n){for(var r=1/(1-t),i=e,a=ir;a;--a){var o=Math.sin(i),s=1-t*o*o;if(s=(rr(i,o,Math.cos(i),n)-e)*(s*Math.sqrt(s))*r,i-=s,Math.abs(s)<1e-10)return i}return i}function or(){this.x0=this.x0===void 0?0:this.x0,this.y0=this.y0===void 0?0:this.y0,this.long0=this.long0===void 0?0:this.long0,this.lat0=this.lat0===void 0?0:this.lat0,this.es&&(this.en=nr(this.es),this.ml0=rr(this.lat0,Math.sin(this.lat0),Math.cos(this.lat0),this.en))}function sr(e){var t=e.x,n=e.y,r=F(t-this.long0,this.over),i,a,o,s=Math.sin(n),c=Math.cos(n);if(this.es){var l=c*r,u=l**2,d=this.ep2*c**2,f=d**2,p=(Math.abs(c)>1e-10?Math.tan(n):0)**2,m=p**2;i=1-this.es*s**2,l/=Math.sqrt(i);var h=rr(n,s,c,this.en);a=this.a*(this.k0*l*(1+u/6*(1-p+d+u/20*(5-18*p+m+14*d-58*p*d+u/42*(61+179*m-m*p-479*p)))))+this.x0,o=this.a*(this.k0*(h-this.ml0+s*r*l/2*(1+u/12*(5-p+9*d+4*f+u/30*(61+m-58*p+270*d-330*p*d+u/56*(1385+543*m-m*p-3111*p))))))+this.y0}else{var g=c*Math.sin(r);if(Math.abs(Math.abs(g)-1)<1e-10)return 93;if(a=.5*this.a*this.k0*Math.log((1+g)/(1-g))+this.x0,o=c*Math.cos(r)/Math.sqrt(1-g**2),g=Math.abs(o),g>=1){if(g-1>1e-10)return 93;o=0}else o=Math.acos(o);n<0&&(o=-o),o=this.a*this.k0*(o-this.lat0)+this.y0}return e.x=a,e.y=o,e}function cr(e){var t,n,r,i,a=(e.x-this.x0)*(1/this.a),o=(e.y-this.y0)*(1/this.a);if(!this.es){var s=Math.exp(a/this.k0),c=.5*(s-1/s),l=this.lat0+o/this.k0,u=Math.cos(l);t=Math.sqrt((1-u**2)/(1+c**2)),r=Math.asin(t),o<0&&(r=-r),i=c===0&&u===0?0:F(Math.atan2(c,u)+this.long0,this.over)}else if(t=this.ml0+o/this.k0,n=ar(t,this.es,this.en),Math.abs(n)1e-10?Math.tan(n):0,m=this.ep2*f**2,h=m**2,g=p**2,_=g**2;t=1-this.es*d**2;var v=a*Math.sqrt(t)/this.k0,y=v**2;t*=p,r=n-t*y/(1-this.es)*.5*(1-y/12*(5+3*g-9*m*g+m-4*h-y/30*(61+90*g-252*m*g+45*_+46*m-y/56*(1385+3633*g+4095*_+1574*_*g)))),i=F(this.long0+v*(1-y/6*(1+2*g+m-y/20*(5+28*g+24*_+8*m*g+6*m-y/42*(61+662*g+1320*_+720*_*g))))/f,this.over)}else r=j*ot(o),i=0;return e.x=i,e.y=r,e}var lr={init:or,forward:sr,inverse:cr,names:[`Fast_Transverse_Mercator`,`Fast Transverse Mercator`]};function ur(e){var t=Math.exp(e);return t=(t-1/t)/2,t}function dr(e,t){e=Math.abs(e),t=Math.abs(t);var n=Math.max(e,t),r=Math.min(e,t)/(n||1);return n*Math.sqrt(1+r**2)}function fr(e){var t=1+e,n=t-1;return n===0?e:e*Math.log(t)/n}function pr(e){var t=Math.abs(e);return t=fr(t*(1+t/(dr(1,t)+1))),e<0?-t:t}function mr(e,t){for(var n=2*Math.cos(2*t),r=e.length-1,i=e[r],a=0,o;--r>=0;)o=-a+n*i+e[r],a=i,i=o;return t+o*Math.sin(2*t)}function hr(e,t){for(var n=2*Math.cos(t),r=e.length-1,i=e[r],a=0,o;--r>=0;)o=-a+n*i+e[r],a=i,i=o;return Math.sin(t)*o}function gr(e){var t=Math.exp(e);return t=(t+1/t)/2,t}function _r(e,t,n){for(var r=Math.sin(t),i=Math.cos(t),a=ur(n),o=gr(n),s=2*i*o,c=-2*r*a,l=e.length-1,u=e[l],d=0,f=0,p=0,m,h;--l>=0;)m=f,h=d,f=u,d=p,u=-m+s*f-c*d+e[l],p=-h+c*f+s*d;return s=r*o,c=i*a,[s*u-c*p,s*p+c*u]}function vr(){if(!this.approx&&(isNaN(this.es)||this.es<=0))throw Error(`Incorrect elliptical usage. Try using the +approx option in the proj string, or PROJECTION["Fast_Transverse_Mercator"] in the WKT.`);this.approx&&(lr.init.apply(this),this.forward=lr.forward,this.inverse=lr.inverse),this.x0=this.x0===void 0?0:this.x0,this.y0=this.y0===void 0?0:this.y0,this.long0=this.long0===void 0?0:this.long0,this.lat0=this.lat0===void 0?0:this.lat0,this.k0=this.k0===void 0?1:this.k0,this.cgb=[],this.cbg=[],this.utg=[],this.gtu=[];var e=this.es/(1+Math.sqrt(1-this.es)),t=e/(2-e),n=t;this.cgb[0]=t*(2+t*(-2/3+t*(-2+t*(116/45+t*(26/45+-2854/675*t))))),this.cbg[0]=t*(-2+t*(2/3+t*(4/3+t*(-82/45+t*(32/45+4642/4725*t))))),n*=t,this.cgb[1]=n*(7/3+t*(-8/5+t*(-227/45+t*(2704/315+2323/945*t)))),this.cbg[1]=n*(5/3+t*(-16/15+t*(-13/9+t*(904/315+-1522/945*t)))),n*=t,this.cgb[2]=n*(56/15+t*(-136/35+t*(-1262/105+73814/2835*t))),this.cbg[2]=n*(-26/15+t*(34/21+t*(8/5+-12686/2835*t))),n*=t,this.cgb[3]=n*(4279/630+t*(-332/35+-399572/14175*t)),this.cbg[3]=n*(1237/630+t*(-12/5+-24832/14175*t)),n*=t,this.cgb[4]=n*(4174/315+-144838/6237*t),this.cbg[4]=n*(-734/315+109598/31185*t),n*=t,this.cgb[5]=601676/22275*n,this.cbg[5]=444337/155925*n,n=t**2,this.Qn=this.k0/(1+t)*(1+n*(1/4+n*(1/64+n/256))),this.utg[0]=t*(-.5+t*(2/3+t*(-37/96+t*(1/360+t*(81/512+-96199/604800*t))))),this.gtu[0]=t*(.5+t*(-2/3+t*(5/16+t*(41/180+t*(-127/288+7891/37800*t))))),this.utg[1]=n*(-1/48+t*(-1/15+t*(437/1440+t*(-46/105+1118711/3870720*t)))),this.gtu[1]=n*(13/48+t*(-3/5+t*(557/1440+t*(281/630+-1983433/1935360*t)))),n*=t,this.utg[2]=n*(-17/480+t*(37/840+t*(209/4480+-5569/90720*t))),this.gtu[2]=n*(61/240+t*(-103/140+t*(15061/26880+167603/181440*t))),n*=t,this.utg[3]=n*(-4397/161280+t*(11/504+830251/7257600*t)),this.gtu[3]=n*(49561/161280+t*(-179/168+6601661/7257600*t)),n*=t,this.utg[4]=n*(-4583/161280+108847/3991680*t),this.gtu[4]=n*(34729/80640+-3418889/1995840*t),n*=t,this.utg[5]=-20648693/638668800*n,this.gtu[5]=212378941/319334400*n;var r=mr(this.cbg,this.lat0);this.Zb=-this.Qn*(r+hr(this.gtu,2*r))}function yr(e){var t=F(e.x-this.long0,this.over),n=e.y;n=mr(this.cbg,n);var r=Math.sin(n),i=Math.cos(n),a=Math.sin(t),o=Math.cos(t);n=Math.atan2(r,o*i),t=Math.atan2(a*i,dr(r,i*o)),t=pr(Math.tan(t));var s=_r(this.gtu,2*n,2*t);n+=s[0],t+=s[1];var c,l;return Math.abs(t)<=2.623395162778?(c=this.a*(this.Qn*t)+this.x0,l=this.a*(this.Qn*n+this.Zb)+this.y0):(c=1/0,l=1/0),e.x=c,e.y=l,e}function br(e){var t=(e.x-this.x0)*(1/this.a),n=(e.y-this.y0)*(1/this.a);n=(n-this.Zb)/this.Qn,t/=this.Qn;var r,i;if(Math.abs(t)<=2.623395162778){var a=_r(this.utg,2*n,2*t);n+=a[0],t+=a[1],t=Math.atan(ur(t));var o=Math.sin(n),s=Math.cos(n),c=Math.sin(t),l=Math.cos(t);n=Math.atan2(o*l,dr(c,l*s)),t=Math.atan2(c,l*s),r=F(t+this.long0,this.over),i=mr(this.cgb,n)}else r=1/0,i=1/0;return e.x=r,e.y=i,e}var xr={init:vr,forward:yr,inverse:br,names:[`Extended_Transverse_Mercator`,`Extended Transverse Mercator`,`etmerc`,`Transverse_Mercator`,`Transverse Mercator`,`Gauss Kruger`,`Gauss_Kruger`,`tmerc`]};function Sr(e,t){if(e===void 0){if(e=Math.floor((F(t)+Math.PI)*30/Math.PI)+1,e<0)return 0;if(e>60)return 60}return e}var Cr=`etmerc`;function wr(){var e=Sr(this.zone,this.long0);if(e===void 0)throw Error(`unknown utm zone`);this.lat0=0,this.long0=(6*Math.abs(e)-183)*M,this.x0=5e5,this.y0=this.utmSouth?1e7:0,this.k0=.9996,xr.init.apply(this),this.forward=xr.forward,this.inverse=xr.inverse}var Tr={init:wr,names:[`Universal Transverse Mercator System`,`utm`],dependsOn:Cr};function Er(e,t){return((1-e)/(1+e))**t}var Dr=20;function Or(){var e=Math.sin(this.lat0),t=Math.cos(this.lat0);t*=t,this.rc=Math.sqrt(1-this.es)/(1-this.es*e*e),this.C=Math.sqrt(1+this.es*t*t/(1-this.es)),this.phic0=Math.asin(e/this.C),this.ratexp=.5*this.C*this.e,this.K=Math.tan(.5*this.phic0+N)/(Math.tan(.5*this.lat0+N)**+this.C*Er(this.e*e,this.ratexp))}function kr(e){var t=e.x,n=e.y;return e.y=2*Math.atan(this.K*Math.tan(.5*n+N)**+this.C*Er(this.e*Math.sin(n),this.ratexp))-j,e.x=this.C*t,e}function Ar(e){for(var t=1e-14,n=e.x/this.C,r=e.y,i=(Math.tan(.5*r+N)/this.K)**(1/this.C),a=Dr;a>0&&(r=2*Math.atan(i*Er(this.e*Math.sin(e.y),-.5*this.e))-j,!(Math.abs(r-e.y)0?1:-1),this.cons=Math.sqrt((1+this.e)**+(1+this.e)*(1-this.e)**(1-this.e)),!isNaN(this.lat_ts)&&Math.abs(this.coslat0)<=1e-10&&Math.abs(Math.cos(this.lat_ts))>1e-10&&(this.k0=.5*this.cons*at(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts))/st(this.e,this.con*this.lat_ts,this.con*Math.sin(this.lat_ts))),this.ms1=at(this.e,this.sinlat0,this.coslat0),this.X0=2*Math.atan(Ir(this.lat0,this.sinlat0,this.e))-j,this.cosX0=Math.cos(this.X0),this.sinX0=Math.sin(this.X0))}function Rr(e){var t=e.x,n=e.y,r=Math.sin(n),i=Math.cos(n),a,o,s,c,l,u,d=F(t-this.long0,this.over);return Math.abs(Math.abs(t-this.long0)-Math.PI)<=1e-10&&Math.abs(n+this.lat0)<=1e-10?(e.x=NaN,e.y=NaN,e):this.sphere?(a=2*this.k0/(1+this.sinlat0*r+this.coslat0*i*Math.cos(d)),e.x=this.a*a*i*Math.sin(d)+this.x0,e.y=this.a*a*(this.coslat0*r-this.sinlat0*i*Math.cos(d))+this.y0,e):(o=2*Math.atan(Ir(n,r,this.e))-j,c=Math.cos(o),s=Math.sin(o),Math.abs(this.coslat0)<=1e-10?(l=st(this.e,n*this.con,this.con*r),u=2*this.a*this.k0*l/this.cons,e.x=this.x0+u*Math.sin(t-this.long0),e.y=this.y0-this.con*u*Math.cos(t-this.long0),e):(Math.abs(this.sinlat0)<1e-10?(a=2*this.a*this.k0/(1+c*Math.cos(d)),e.y=a*s):(a=2*this.a*this.k0*this.ms1/(this.cosX0*(1+this.sinX0*s+this.cosX0*c*Math.cos(d))),e.y=a*(this.cosX0*s-this.sinX0*c*Math.cos(d))+this.y0),e.x=a*c*Math.sin(d)+this.x0,e))}function zr(e){e.x-=this.x0,e.y-=this.y0;var t,n,r,i,a,o=Math.sqrt(e.x*e.x+e.y*e.y);if(this.sphere){var s=2*Math.atan(o/(2*this.a*this.k0));return t=this.long0,n=this.lat0,o<=1e-10?(e.x=t,e.y=n,e):(n=Math.asin(Math.cos(s)*this.sinlat0+e.y*Math.sin(s)*this.coslat0/o),t=Math.abs(this.coslat0)<1e-10?this.lat0>0?F(this.long0+Math.atan2(e.x,-1*e.y),this.over):F(this.long0+Math.atan2(e.x,e.y),this.over):F(this.long0+Math.atan2(e.x*Math.sin(s),o*this.coslat0*Math.cos(s)-e.y*this.sinlat0*Math.sin(s)),this.over),e.x=t,e.y=n,e)}if(Math.abs(this.coslat0)<=1e-10){if(o<=1e-10)return n=this.lat0,t=this.long0,e.x=t,e.y=n,e;e.x*=this.con,e.y*=this.con,r=o*this.cons/(2*this.a*this.k0),n=this.con*ct(this.e,r),t=this.con*F(this.con*this.long0+Math.atan2(e.x,-1*e.y),this.over)}else i=2*Math.atan(o*this.cosX0/(2*this.a*this.k0*this.ms1)),t=this.long0,o<=1e-10?a=this.X0:(a=Math.asin(Math.cos(i)*this.sinX0+e.y*Math.sin(i)*this.cosX0/o),t=F(this.long0+Math.atan2(e.x*Math.sin(i),o*this.cosX0*Math.cos(i)-e.y*this.sinX0*Math.sin(i)),this.over)),n=-1*ct(this.e,Math.tan(.5*(j+a)));return e.x=t,e.y=n,e}var Br={init:Lr,forward:Rr,inverse:zr,names:[`stere`,`Stereographic_South_Pole`,`Polar_Stereographic_variant_A`,`Polar_Stereographic_variant_B`,`Polar_Stereographic`],ssfn_:Ir};function Vr(){this.k0||=1;var e=this.lat0;this.lambda0=this.long0;var t=Math.sin(e),n=this.a,r=1/this.rf,i=2*r-r**2,a=this.e=Math.sqrt(i);this.R=this.k0*n*Math.sqrt(1-i)/(1-i*t**2),this.alpha=Math.sqrt(1+i/(1-i)*Math.cos(e)**4),this.b0=Math.asin(t/this.alpha);var o=Math.log(Math.tan(Math.PI/4+this.b0/2)),s=Math.log(Math.tan(Math.PI/4+e/2)),c=Math.log((1+a*t)/(1-a*t));this.K=o-this.alpha*s+this.alpha*a/2*c}function Hr(e){var t=Math.log(Math.tan(Math.PI/4-e.y/2)),n=this.e/2*Math.log((1+this.e*Math.sin(e.y))/(1-this.e*Math.sin(e.y))),r=-this.alpha*(t+n)+this.K,i=2*(Math.atan(Math.exp(r))-Math.PI/4),a=this.alpha*(e.x-this.lambda0),o=Math.atan(Math.sin(a)/(Math.sin(this.b0)*Math.tan(i)+Math.cos(this.b0)*Math.cos(a))),s=Math.asin(Math.cos(this.b0)*Math.sin(i)-Math.sin(this.b0)*Math.cos(i)*Math.cos(a));return e.y=this.R/2*Math.log((1+Math.sin(s))/(1-Math.sin(s)))+this.y0,e.x=this.R*o+this.x0,e}function Ur(e){for(var t=e.x-this.x0,n=e.y-this.y0,r=t/this.R,i=2*(Math.atan(Math.exp(n/this.R))-Math.PI/4),a=Math.asin(Math.cos(this.b0)*Math.sin(i)+Math.sin(this.b0)*Math.cos(i)*Math.cos(r)),o=Math.atan(Math.sin(r)/(Math.cos(this.b0)*Math.cos(r)-Math.sin(this.b0)*Math.tan(i))),s=this.lambda0+o/this.alpha,c=0,l=a,u=-1e3,d=0;Math.abs(l-u)>1e-7;){if(++d>20)return;c=1/this.alpha*(Math.log(Math.tan(Math.PI/4+a/2))-this.K)+this.e*Math.log(Math.tan(Math.PI/4+Math.asin(this.e*Math.sin(l))/2)),u=l,l=2*Math.atan(Math.exp(c))-Math.PI/2}return e.x=s,e.y=l,e}var Wr={init:Vr,forward:Hr,inverse:Ur,names:[`somerc`]},Gr=1e-7;function Kr(e){var t=[`Hotine_Oblique_Mercator`,`Hotine_Oblique_Mercator_variant_A`,`Hotine_Oblique_Mercator_Azimuth_Natural_Origin`],n=typeof e.projName==`object`?Object.keys(e.projName)[0]:e.projName;return`no_uoff`in e||`no_off`in e||t.indexOf(n)!==-1||t.indexOf(bt(n))!==-1}function qr(){var e,t,n,r,i,a,o,s,c,l,u=0,d,f=0,p=0,m=0,h=0,g=0,_=0;this.k0||=1,this.no_off=Kr(this),this.no_rot=`no_rot`in this;var v=!1;`alpha`in this&&(v=!0);var y=!1;if(`rectified_grid_angle`in this&&(y=!0),v&&(_=this.alpha),y&&(u=this.rectified_grid_angle,v||=(_=0,!0)),v||y)f=this.longc;else if(p=this.long1,h=this.lat1,m=this.long2,g=this.lat2,Math.abs(h-g)<=Gr||(e=Math.abs(h))<=Gr||Math.abs(e-j)<=Gr||Math.abs(Math.abs(this.lat0)-j)<=Gr||Math.abs(Math.abs(g)-j)<=Gr)throw Error();var b=1-this.es;t=Math.sqrt(b),Math.abs(this.lat0)>1e-10?(s=Math.sin(this.lat0),n=Math.cos(this.lat0),e=1-this.es*s*s,this.B=n*n,this.B=Math.sqrt(1+this.es*this.B*this.B/b),this.A=this.B*this.k0*t/e,r=this.B*t/(n*Math.sqrt(e)),i=r*r-1,i<=0?i=0:(i=Math.sqrt(i),this.lat0<0&&(i=-i)),this.E=i+=r,this.E*=st(this.e,this.lat0,s)**+this.B):(this.B=1/t,this.A=this.k0,this.E=r=i=1),v||y?(v?(d=Math.asin(Math.sin(_)/r),y||(u=_)):(d=u,_=Math.asin(r*Math.sin(d))),this.lam0=f-Math.asin(.5*(i-1/i)*Math.tan(d))/this.B):(a=st(this.e,h,Math.sin(h))**+this.B,o=st(this.e,g,Math.sin(g))**+this.B,i=this.E/a,c=(o-a)/(o+a),l=this.E*this.E,l=(l-o*a)/(l+o*a),e=p-m,e<-Math.PI?m-=fe:e>Math.PI&&(m+=fe),this.lam0=F(.5*(p+m)-Math.atan(l*Math.tan(.5*this.B*(p-m))/c)/this.B,this.over),d=Math.atan(2*Math.sin(this.B*F(p-this.lam0,this.over))/(i-1/i)),u=_=Math.asin(r*Math.sin(d))),this.singam=Math.sin(d),this.cosgam=Math.cos(d),this.sinrot=Math.sin(u),this.cosrot=Math.cos(u),this.rB=1/this.B,this.ArB=this.A*this.rB,this.BrA=1/this.ArB,this.no_off?this.u_0=0:(this.u_0=Math.abs(this.ArB*Math.atan(Math.sqrt(r*r-1)/Math.cos(_))),this.lat0<0&&(this.u_0=-this.u_0)),i=.5*d,this.v_pole_n=this.ArB*Math.log(Math.tan(N-i)),this.v_pole_s=this.ArB*Math.log(Math.tan(N+i))}function Jr(e){var t={},n,r,i,a,o,s,c,l;if(e.x-=this.lam0,Math.abs(Math.abs(e.y)-j)>1e-10){if(o=this.E/st(this.e,e.y,Math.sin(e.y))**+this.B,s=1/o,n=.5*(o-s),r=.5*(o+s),a=Math.sin(this.B*e.x),i=(n*this.singam-a*this.cosgam)/r,Math.abs(Math.abs(i)-1)<1e-10)throw Error();l=.5*this.ArB*Math.log((1-i)/(1+i)),s=Math.cos(this.B*e.x),c=Math.abs(s)0?this.v_pole_n:this.v_pole_s,c=this.ArB*e.y;return this.no_rot?(t.x=c,t.y=l):(c-=this.u_0,t.x=l*this.cosrot+c*this.sinrot,t.y=c*this.cosrot-l*this.sinrot),t.x=this.a*t.x+this.x0,t.y=this.a*t.y+this.y0,e.z!==void 0&&(t.z=e.z),e.m!==void 0&&(t.m=e.m),t}function Yr(e){var t,n,r,i,a,o,s,c={};if(e.x=(e.x-this.x0)*(1/this.a),e.y=(e.y-this.y0)*(1/this.a),this.no_rot?(n=e.y,t=e.x):(n=e.x*this.cosrot-e.y*this.sinrot,t=e.y*this.cosrot+e.x*this.sinrot+this.u_0),r=Math.exp(-this.BrA*n),i=.5*(r-1/r),a=.5*(r+1/r),o=Math.sin(this.BrA*t),s=(o*this.cosgam+i*this.singam)/a,Math.abs(Math.abs(s)-1)<1e-10)c.x=0,c.y=s<0?-j:j;else{if(c.y=this.E/Math.sqrt((1+s)/(1-s)),c.y=ct(this.e,c.y**(1/this.B)),c.y===1/0)throw Error();c.x=-this.rB*Math.atan2(i*this.cosgam-o*this.singam,Math.cos(this.BrA*t))}return c.x+=this.lam0,e.z!==void 0&&(c.z=e.z),e.m!==void 0&&(c.m=e.m),c}var Xr={init:qr,forward:Jr,inverse:Yr,names:[`Hotine_Oblique_Mercator`,`Hotine Oblique Mercator`,`Hotine_Oblique_Mercator_variant_A`,`Hotine_Oblique_Mercator_Variant_B`,`Hotine_Oblique_Mercator_Azimuth_Natural_Origin`,`Hotine_Oblique_Mercator_Two_Point_Natural_Origin`,`Hotine_Oblique_Mercator_Azimuth_Center`,`Oblique_Mercator`,`omerc`]};function Zr(){if(this.lat2||=this.lat1,this.k0||=1,this.x0=this.x0||0,this.y0=this.y0||0,this.long0=this.long0||0,!(Math.abs(this.lat1+this.lat2)<1e-10)){var e=this.b/this.a;this.e=Math.sqrt(1-e*e);var t=Math.sin(this.lat1),n=Math.cos(this.lat1),r=at(this.e,t,n),i=st(this.e,this.lat1,t),a=Math.sin(this.lat2),o=Math.cos(this.lat2),s=at(this.e,a,o),c=st(this.e,this.lat2,a),l=st(this.e,this.lat0,Math.sin(this.lat0));this.ns=Math.abs(this.lat1-this.lat2)>1e-10?Math.log(r/s)/Math.log(i/c):t,isNaN(this.ns)&&(this.ns=t),this.f0=r/(this.ns*i**+this.ns),this.rh=Math.abs(Math.abs(this.lat0)-j)<1e-10?0:this.a*this.f0*l**+this.ns,this.title||=`Lambert Conformal Conic`}}function Qr(e){var t=e.x,n=e.y;Math.abs(2*Math.abs(n)-Math.PI)<=1e-10&&(n=ot(n)*(j-2*ue));var r=Math.abs(Math.abs(n)-j),i,a;if(r>1e-10)i=st(this.e,n,Math.sin(n)),a=this.a*this.f0*i**+this.ns;else{if(r=n*this.ns,r<=0)return null;a=0}var o=this.ns*F(t-this.long0,this.over);return e.x=this.k0*(a*Math.sin(o))+this.x0,e.y=this.k0*(this.rh-a*Math.cos(o))+this.y0,e}function $r(e){var t,n,r,i,a,o=(e.x-this.x0)/this.k0,s=this.rh-(e.y-this.y0)/this.k0;this.ns>0?(t=Math.sqrt(o*o+s*s),n=1):(t=-Math.sqrt(o*o+s*s),n=-1);var c=0;if(t!==0&&(c=Math.atan2(n*o,n*s)),t!==0||this.ns>0){if(n=1/this.ns,r=(t/(this.a*this.f0))**+n,i=ct(this.e,r),i===-9999)return null}else i=-j;return a=F(c/this.ns+this.long0,this.over),e.x=a,e.y=i,e}var ei={init:Zr,forward:Qr,inverse:$r,names:[`Lambert Tangential Conformal Conic Projection`,`Lambert_Conformal_Conic`,`Lambert_Conformal_Conic_1SP`,`Lambert_Conformal_Conic_2SP`,`lcc`,`Lambert Conic Conformal (1SP)`,`Lambert Conic Conformal (2SP)`]};function ti(){this.a=6377397.155,this.es=.006674372230614,this.e=Math.sqrt(this.es),this.lat0||=.863937979737193,this.long0||=.4334234309119251,this.k0||=.9999,this.s45=.785398163397448,this.s90=2*this.s45,this.fi0=this.lat0,this.e2=this.es,this.e=Math.sqrt(this.e2),this.alfa=Math.sqrt(1+this.e2*Math.cos(this.fi0)**4/(1-this.e2)),this.uq=1.04216856380474,this.u0=Math.asin(Math.sin(this.fi0)/this.alfa),this.g=((1+this.e*Math.sin(this.fi0))/(1-this.e*Math.sin(this.fi0)))**(this.alfa*this.e/2),this.k=Math.tan(this.u0/2+this.s45)/Math.tan(this.fi0/2+this.s45)**+this.alfa*this.g,this.k1=this.k0,this.n0=this.a*Math.sqrt(1-this.e2)/(1-this.e2*Math.sin(this.fi0)**2),this.s0=1.37008346281555,this.n=Math.sin(this.s0),this.ro0=this.k1*this.n0/Math.tan(this.s0),this.ad=this.s90-this.uq}function ni(e){var t,n,r,i,a,o,s,c=e.x,l=e.y,u=F(c-this.long0,this.over);return t=((1+this.e*Math.sin(l))/(1-this.e*Math.sin(l)))**(this.alfa*this.e/2),n=2*(Math.atan(this.k*Math.tan(l/2+this.s45)**+this.alfa/t)-this.s45),r=-u*this.alfa,i=Math.asin(Math.cos(this.ad)*Math.sin(n)+Math.sin(this.ad)*Math.cos(n)*Math.cos(r)),a=Math.asin(Math.cos(n)*Math.sin(r)/Math.cos(i)),o=this.n*a,s=this.ro0*Math.tan(this.s0/2+this.s45)**+this.n/Math.tan(i/2+this.s45)**+this.n,e.y=s*Math.cos(o)/1,e.x=s*Math.sin(o)/1,this.czech||(e.y*=-1,e.x*=-1),e}function ri(e){var t,n,r,i,a,o,s,c,l=e.x;e.x=e.y,e.y=l,this.czech||(e.y*=-1,e.x*=-1),o=Math.sqrt(e.x*e.x+e.y*e.y),a=Math.atan2(e.y,e.x),i=a/Math.sin(this.s0),r=2*(Math.atan((this.ro0/o)**(1/this.n)*Math.tan(this.s0/2+this.s45))-this.s45),t=Math.asin(Math.cos(this.ad)*Math.sin(r)-Math.sin(this.ad)*Math.cos(r)*Math.cos(i)),n=Math.asin(Math.cos(r)*Math.sin(i)/Math.cos(t)),e.x=this.long0-n/this.alfa,s=t,c=0;var u=0;do e.y=2*(Math.atan(this.k**(-1/this.alfa)*Math.tan(t/2+this.s45)**(1/this.alfa)*((1+this.e*Math.sin(s))/(1-this.e*Math.sin(s)))**(this.e/2))-this.s45),Math.abs(s-e.y)<1e-10&&(c=1),s=e.y,u+=1;while(c===0&&u<15);return u>=15?null:e}var ii={init:ti,forward:ni,inverse:ri,names:[`Krovak`,`Krovak Modified`,`Krovak (North Orientated)`,`Krovak Modified (North Orientated)`,`krovak`]};function ai(e,t,n,r,i){return e*i-t*Math.sin(2*i)+n*Math.sin(4*i)-r*Math.sin(6*i)}function oi(e){return 1-.25*e*(1+e/16*(3+1.25*e))}function si(e){return .375*e*(1+.25*e*(1+.46875*e))}function ci(e){return .05859375*e*e*(1+.75*e)}function li(e){return e*e*e*(35/3072)}function ui(e,t,n){var r=t*n;return e/Math.sqrt(1-r*r)}function di(e){return Math.abs(e)1e-7?(n=e*t,(1-e*e)*(t/(1-n*n)-.5/e*Math.log((1-n)/(1+n)))):2*t}var vi=.3333333333333333,yi=.17222222222222222,bi=.10257936507936508,xi=.06388888888888888,Si=.0664021164021164,Ci=.016415012942191543;function wi(e){var t,n=[];return n[0]=e*vi,t=e*e,n[0]+=t*yi,n[1]=t*xi,t*=e,n[0]+=t*bi,n[1]+=t*Si,n[2]=t*Ci,n}function Ti(e,t){var n=e+e;return e+t[0]*Math.sin(n)+t[1]*Math.sin(n+n)+t[2]*Math.sin(n+n+n)}function Ei(){var e=Math.abs(this.lat0);if(this.mode=Math.abs(e-j)<1e-10?this.lat0<0?1:2:Math.abs(e)<1e-10?3:4,this.es>0){var t;switch(this.qp=_i(this.e,1),this.mmf=.5/(1-this.es),this.apa=wi(this.es),this.mode){case 2:this.dd=1;break;case 1:this.dd=1;break;case 3:this.rq=Math.sqrt(.5*this.qp),this.dd=1/this.rq,this.xmf=1,this.ymf=.5*this.qp;break;case 4:this.rq=Math.sqrt(.5*this.qp),t=Math.sin(this.lat0),this.sinb1=_i(this.e,t)/this.qp,this.cosb1=Math.sqrt(1-this.sinb1*this.sinb1),this.dd=Math.cos(this.lat0)/(Math.sqrt(1-this.es*t*t)*this.rq*this.cosb1),this.ymf=(this.xmf=this.rq)/this.dd,this.xmf*=this.dd}}else this.mode===4&&(this.sinph0=Math.sin(this.lat0),this.cosph0=Math.cos(this.lat0))}function Di(e){var t,n,r,i,a,o,s,c,l,u,d=e.x,f=e.y;if(d=F(d-this.long0,this.over),this.sphere){if(a=Math.sin(f),u=Math.cos(f),r=Math.cos(d),this.mode===this.OBLIQ||this.mode===this.EQUIT){if(n=this.mode===this.EQUIT?1+u*r:1+this.sinph0*a+this.cosph0*u*r,n<=1e-10)return null;n=Math.sqrt(2/n),t=n*u*Math.sin(d),n*=this.mode===this.EQUIT?a:this.cosph0*a-this.sinph0*u*r}else if(this.mode===this.N_POLE||this.mode===this.S_POLE){if(this.mode===this.N_POLE&&(r=-r),Math.abs(f+this.lat0)<1e-10)return null;n=N-f*.5,n=2*(this.mode===this.S_POLE?Math.cos(n):Math.sin(n)),t=n*Math.sin(d),n*=r}}else{switch(s=0,c=0,l=0,r=Math.cos(d),i=Math.sin(d),a=Math.sin(f),o=_i(this.e,a),(this.mode===this.OBLIQ||this.mode===this.EQUIT)&&(s=o/this.qp,c=Math.sqrt(1-s*s)),this.mode){case this.OBLIQ:l=1+this.sinb1*s+this.cosb1*c*r;break;case this.EQUIT:l=1+c*r;break;case this.N_POLE:l=j+f,o=this.qp-o;break;case this.S_POLE:l=f-j,o=this.qp+o}if(Math.abs(l)<1e-10)return null;switch(this.mode){case this.OBLIQ:case this.EQUIT:l=Math.sqrt(2/l),n=this.mode===this.OBLIQ?this.ymf*l*(this.cosb1*s-this.sinb1*c*r):(l=Math.sqrt(2/(1+c*r)))*s*this.ymf,t=this.xmf*l*c*i;break;case this.N_POLE:case this.S_POLE:o>=0?(t=(l=Math.sqrt(o))*i,n=r*(this.mode===this.S_POLE?l:-l)):t=n=0}}return e.x=this.a*t+this.x0,e.y=this.a*n+this.y0,e}function Oi(e){e.x-=this.x0,e.y-=this.y0;var t=e.x/this.a,n=e.y/this.a,r,i,a,o,s,c,l;if(this.sphere){var u=0,d,f=0;if(d=Math.sqrt(t*t+n*n),i=d*.5,i>1)return null;switch(i=2*Math.asin(i),(this.mode===this.OBLIQ||this.mode===this.EQUIT)&&(f=Math.sin(i),u=Math.cos(i)),this.mode){case this.EQUIT:i=Math.abs(d)<=1e-10?0:Math.asin(n*f/d),t*=f,n=u*d;break;case this.OBLIQ:i=Math.abs(d)<=1e-10?this.lat0:Math.asin(u*this.sinph0+n*f*this.cosph0/d),t*=f*this.cosph0,n=(u-Math.sin(i)*this.sinph0)*d;break;case this.N_POLE:n=-n,i=j-i;break;case this.S_POLE:i-=j}r=n===0&&(this.mode===this.EQUIT||this.mode===this.OBLIQ)?0:Math.atan2(t,n)}else{if(l=0,this.mode===this.OBLIQ||this.mode===this.EQUIT){if(t/=this.dd,n*=this.dd,c=Math.sqrt(t*t+n*n),c<1e-10)return e.x=this.long0,e.y=this.lat0,e;o=2*Math.asin(.5*c/this.rq),a=Math.cos(o),t*=o=Math.sin(o),this.mode===this.OBLIQ?(l=a*this.sinb1+n*o*this.cosb1/c,s=this.qp*l,n=c*this.cosb1*a-n*this.sinb1*o):(l=n*o/c,s=this.qp*l,n=c*a)}else if(this.mode===this.N_POLE||this.mode===this.S_POLE){if(this.mode===this.N_POLE&&(n=-n),s=t*t+n*n,!s)return e.x=this.long0,e.y=this.lat0,e;l=1-s/this.qp,this.mode===this.S_POLE&&(l=-l)}r=Math.atan2(t,n),i=Ti(Math.asin(l),this.apa)}return e.x=F(this.long0+r,this.over),e.y=i,e}var ki={init:Ei,forward:Di,inverse:Oi,names:[`Lambert Azimuthal Equal Area`,`Lambert_Azimuthal_Equal_Area`,`laea`],S_POLE:1,N_POLE:2,EQUIT:3,OBLIQ:4};function Ai(e){return Math.abs(e)>1&&(e=e>1?1:-1),Math.asin(e)}function ji(){Math.abs(this.lat1+this.lat2)<1e-10||(this.temp=this.b/this.a,this.es=1-this.temp**2,this.e3=Math.sqrt(this.es),this.sin_po=Math.sin(this.lat1),this.cos_po=Math.cos(this.lat1),this.t1=this.sin_po,this.con=this.sin_po,this.ms1=at(this.e3,this.sin_po,this.cos_po),this.qs1=_i(this.e3,this.sin_po),this.sin_po=Math.sin(this.lat2),this.cos_po=Math.cos(this.lat2),this.t2=this.sin_po,this.ms2=at(this.e3,this.sin_po,this.cos_po),this.qs2=_i(this.e3,this.sin_po),this.sin_po=Math.sin(this.lat0),this.cos_po=Math.cos(this.lat0),this.t3=this.sin_po,this.qs0=_i(this.e3,this.sin_po),this.ns0=Math.abs(this.lat1-this.lat2)>1e-10?(this.ms1*this.ms1-this.ms2*this.ms2)/(this.qs2-this.qs1):this.con,this.c=this.ms1*this.ms1+this.ns0*this.qs1,this.rh=this.a*Math.sqrt(this.c-this.ns0*this.qs0)/this.ns0)}function Mi(e){var t=e.x,n=e.y;this.sin_phi=Math.sin(n),this.cos_phi=Math.cos(n);var r=_i(this.e3,this.sin_phi),i=this.a*Math.sqrt(this.c-this.ns0*r)/this.ns0,a=this.ns0*F(t-this.long0,this.over),o=i*Math.sin(a)+this.x0,s=this.rh-i*Math.cos(a)+this.y0;return e.x=o,e.y=s,e}function Ni(e){var t,n,r,i,a,o;return e.x-=this.x0,e.y=this.rh-e.y+this.y0,this.ns0>=0?(t=Math.sqrt(e.x*e.x+e.y*e.y),r=1):(t=-Math.sqrt(e.x*e.x+e.y*e.y),r=-1),i=0,t!==0&&(i=Math.atan2(r*e.x,r*e.y)),r=t*this.ns0/this.a,this.sphere?o=Math.asin((this.c-r*r)/(2*this.ns0)):(n=(this.c-r*r)/this.ns0,o=this.phi1z(this.e3,n)),a=F(i/this.ns0+this.long0,this.over),e.x=a,e.y=o,e}function Pi(e,t){var n,r,i,a,o,s=Ai(.5*t);if(e<1e-10)return s;for(var c=e*e,l=1;l<=25;l++)if(n=Math.sin(s),r=Math.cos(s),i=e*n,a=1-i*i,o=.5*a*a/r*(t/(1-c)-n/a+.5/e*Math.log((1-i)/(1+i))),s+=o,Math.abs(o)<=1e-7)return s;return null}var Fi={init:ji,forward:Mi,inverse:Ni,names:[`Albers_Conic_Equal_Area`,`Albers_Equal_Area`,`Albers`,`aea`],phi1z:Pi};function Ii(){this.sin_p14=Math.sin(this.lat0),this.cos_p14=Math.cos(this.lat0),this.infinity_dist=1e3*this.a,this.rc=1}function Li(e){var t,n,r,i,a,o,s,c,l=e.x,u=e.y;return r=F(l-this.long0,this.over),t=Math.sin(u),n=Math.cos(u),i=Math.cos(r),o=this.sin_p14*t+this.cos_p14*n*i,a=1,o>0||Math.abs(o)<=1e-10?(s=this.x0+this.a*a*n*Math.sin(r)/o,c=this.y0+this.a*a*(this.cos_p14*t-this.sin_p14*n*i)/o):(s=this.x0+this.infinity_dist*n*Math.sin(r),c=this.y0+this.infinity_dist*(this.cos_p14*t-this.sin_p14*n*i)),e.x=s,e.y=c,e}function Ri(e){var t,n,r,i,a,o;return e.x=(e.x-this.x0)/this.a,e.y=(e.y-this.y0)/this.a,e.x/=this.k0,e.y/=this.k0,(t=Math.sqrt(e.x*e.x+e.y*e.y))?(i=Math.atan2(t,this.rc),n=Math.sin(i),r=Math.cos(i),o=Ai(r*this.sin_p14+e.y*n*this.cos_p14/t),a=Math.atan2(e.x*n,t*this.cos_p14*r-e.y*this.sin_p14*n),a=F(this.long0+a,this.over)):(o=this.phic0,a=0),e.x=a,e.y=o,e}var zi={init:Ii,forward:Li,inverse:Ri,names:[`gnom`]};function Bi(e,t){var n=1-(1-e*e)/(2*e)*Math.log((1-e)/(1+e));if(Math.abs(Math.abs(t)-n)<1e-6)return t<0?-1*j:j;for(var r=Math.asin(.5*t),i,a,o,s,c=0;c<30;c++)if(a=Math.sin(r),o=Math.cos(r),s=e*a,i=(1-s*s)**2/(2*o)*(t/(1-e*e)-a/(1-s*s)+.5/e*Math.log((1-s)/(1+s))),r+=i,Math.abs(i)<=1e-10)return r;return NaN}function Vi(){this.sphere||(this.k0=at(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)))}function Hi(e){var t=e.x,n=e.y,r,i,a=F(t-this.long0,this.over);if(this.sphere)r=this.x0+this.a*a*Math.cos(this.lat_ts),i=this.y0+this.a*Math.sin(n)/Math.cos(this.lat_ts);else{var o=_i(this.e,Math.sin(n));r=this.x0+this.a*this.k0*a,i=this.y0+this.a*o*.5/this.k0}return e.x=r,e.y=i,e}function Ui(e){e.x-=this.x0,e.y-=this.y0;var t,n;return this.sphere?(t=F(this.long0+e.x/this.a/Math.cos(this.lat_ts),this.over),n=Math.asin(e.y/this.a*Math.cos(this.lat_ts))):(n=Bi(this.e,2*e.y*this.k0/this.a),t=F(this.long0+e.x/(this.a*this.k0),this.over)),e.x=t,e.y=n,e}var Wi={init:Vi,forward:Hi,inverse:Ui,names:[`cea`]};function Gi(){this.x0=this.x0||0,this.y0=this.y0||0,this.lat0=this.lat0||0,this.long0=this.long0||0,this.lat_ts=this.lat_ts||0,this.title=this.title||`Equidistant Cylindrical (Plate Carre)`,this.rc=Math.cos(this.lat_ts)}function Ki(e){var t=e.x,n=e.y,r=F(t-this.long0,this.over),i=di(n-this.lat0);return e.x=this.x0+this.a*r*this.rc,e.y=this.y0+this.a*i,e}function qi(e){var t=e.x,n=e.y;return e.x=F(this.long0+(t-this.x0)/(this.a*this.rc),this.over),e.y=di(this.lat0+(n-this.y0)/this.a),e}var Ji={init:Gi,forward:Ki,inverse:qi,names:[`Equirectangular`,`Equidistant_Cylindrical`,`Equidistant_Cylindrical_Spherical`,`eqc`]},Yi=20;function Xi(){this.temp=this.b/this.a,this.es=1-this.temp**2,this.e=Math.sqrt(this.es),this.e0=oi(this.es),this.e1=si(this.es),this.e2=ci(this.es),this.e3=li(this.es),this.ml0=this.a*ai(this.e0,this.e1,this.e2,this.e3,this.lat0)}function Zi(e){var t=e.x,n=e.y,r,i,a,o=F(t-this.long0,this.over);if(a=o*Math.sin(n),this.sphere)Math.abs(n)<=1e-10?(r=this.a*o,i=-1*this.a*this.lat0):(r=this.a*Math.sin(a)/Math.tan(n),i=this.a*(di(n-this.lat0)+(1-Math.cos(a))/Math.tan(n)));else if(Math.abs(n)<=1e-10)r=this.a*o,i=-1*this.ml0;else{var s=ui(this.a,this.e,Math.sin(n))/Math.tan(n);r=s*Math.sin(a),i=this.a*ai(this.e0,this.e1,this.e2,this.e3,n)-this.ml0+s*(1-Math.cos(a))}return e.x=r+this.x0,e.y=i+this.y0,e}function Qi(e){var t,n,r=e.x-this.x0,i=e.y-this.y0,a,o,s,c,l;if(this.sphere){if(Math.abs(i+this.a*this.lat0)<=1e-10)t=F(r/this.a+this.long0,this.over),n=0;else{o=this.lat0+i/this.a,s=r*r/this.a/this.a+o*o,c=o;var u;for(a=Yi;a;--a)if(u=Math.tan(c),l=-1*(o*(c*u+1)-c-.5*(c*c+s)*u)/((c-o)/u-1),c+=l,Math.abs(l)<=1e-10){n=c;break}t=F(this.long0+Math.asin(r*Math.tan(c)/this.a)/Math.sin(n),this.over)}}else if(Math.abs(i+this.ml0)<=1e-10)n=0,t=F(this.long0+r/this.a,this.over);else{o=(this.ml0+i)/this.a,s=r*r/this.a/this.a+o*o,c=o;var d,f,p,m,h;for(a=Yi;a;--a)if(h=this.e*Math.sin(c),d=Math.sqrt(1-h*h)*Math.tan(c),f=this.a*ai(this.e0,this.e1,this.e2,this.e3,c),p=this.e0-2*this.e1*Math.cos(2*c)+4*this.e2*Math.cos(4*c)-6*this.e3*Math.cos(6*c),m=f/this.a,l=(o*(d*m+1)-m-.5*d*(m*m+s))/(this.es*Math.sin(2*c)*(m*m+s-2*o*m)/(4*d)+(o-m)*(d*p-2/Math.sin(2*c))-p),c-=l,Math.abs(l)<=1e-10){n=c;break}d=Math.sqrt(1-this.es*Math.sin(n)**2)*Math.tan(n),t=F(this.long0+Math.asin(r*d/this.a)/Math.sin(n),this.over)}return e.x=t,e.y=n,e}var $i={init:Xi,forward:Zi,inverse:Qi,names:[`Polyconic`,`American_Polyconic`,`poly`]};function ea(){this.A=[],this.A[1]=.6399175073,this.A[2]=-.1358797613,this.A[3]=.063294409,this.A[4]=-.02526853,this.A[5]=.0117879,this.A[6]=-.0055161,this.A[7]=.0026906,this.A[8]=-.001333,this.A[9]=67e-5,this.A[10]=-34e-5,this.B_re=[],this.B_im=[],this.B_re[1]=.7557853228,this.B_im[1]=0,this.B_re[2]=.249204646,this.B_im[2]=.003371507,this.B_re[3]=-.001541739,this.B_im[3]=.04105856,this.B_re[4]=-.10162907,this.B_im[4]=.01727609,this.B_re[5]=-.26623489,this.B_im[5]=-.36249218,this.B_re[6]=-.6870983,this.B_im[6]=-1.1651967,this.C_re=[],this.C_im=[],this.C_re[1]=1.3231270439,this.C_im[1]=0,this.C_re[2]=-.577245789,this.C_im[2]=-.007809598,this.C_re[3]=.508307513,this.C_im[3]=-.112208952,this.C_re[4]=-.15094762,this.C_im[4]=.18200602,this.C_re[5]=1.01418179,this.C_im[5]=1.64497696,this.C_re[6]=1.9660549,this.C_im[6]=2.5127645,this.D=[],this.D[1]=1.5627014243,this.D[2]=.5185406398,this.D[3]=-.03333098,this.D[4]=-.1052906,this.D[5]=-.0368594,this.D[6]=.007317,this.D[7]=.0122,this.D[8]=.00394,this.D[9]=-.0013}function ta(e){var t,n=e.x,r=e.y-this.lat0,i=n-this.long0,a=r/oe*1e-5,o=i,s=1,c=0;for(t=1;t<=10;t++)s*=a,c+=this.A[t]*s;var l=c,u=o,d=1,f=0,p,m,h=0,g=0;for(t=1;t<=6;t++)p=d*l-f*u,m=f*l+d*u,d=p,f=m,h=h+this.B_re[t]*d-this.B_im[t]*f,g=g+this.B_im[t]*d+this.B_re[t]*f;return e.x=g*this.a+this.x0,e.y=h*this.a+this.y0,e}function na(e){var t,n=e.x,r=e.y,i=n-this.x0,a=(r-this.y0)/this.a,o=i/this.a,s=1,c=0,l,u,d=0,f=0;for(t=1;t<=6;t++)l=s*a-c*o,u=c*a+s*o,s=l,c=u,d=d+this.C_re[t]*s-this.C_im[t]*c,f=f+this.C_im[t]*s+this.C_re[t]*c;for(var p=0;p.999999999999&&(n=.999999999999),t=Math.asin(n);var r=F(this.long0+e.x/(.900316316158*this.a*Math.cos(t)),this.over);r<-Math.PI&&(r=-Math.PI),r>Math.PI&&(r=Math.PI),n=(2*t+Math.sin(2*t))/Math.PI,Math.abs(n)>1&&(n=1);var i=Math.asin(n);return e.x=r,e.y=i,e}var va={init:ha,forward:ga,inverse:_a,names:[`Mollweide`,`moll`]};function ya(){Math.abs(this.lat1+this.lat2)<1e-10||(this.lat2=this.lat2||this.lat1,this.temp=this.b/this.a,this.es=1-this.temp**2,this.e=Math.sqrt(this.es),this.e0=oi(this.es),this.e1=si(this.es),this.e2=ci(this.es),this.e3=li(this.es),this.sin_phi=Math.sin(this.lat1),this.cos_phi=Math.cos(this.lat1),this.ms1=at(this.e,this.sin_phi,this.cos_phi),this.ml1=ai(this.e0,this.e1,this.e2,this.e3,this.lat1),Math.abs(this.lat1-this.lat2)<1e-10?this.ns=this.sin_phi:(this.sin_phi=Math.sin(this.lat2),this.cos_phi=Math.cos(this.lat2),this.ms2=at(this.e,this.sin_phi,this.cos_phi),this.ml2=ai(this.e0,this.e1,this.e2,this.e3,this.lat2),this.ns=(this.ms1-this.ms2)/(this.ml2-this.ml1)),this.g=this.ml1+this.ms1/this.ns,this.ml0=ai(this.e0,this.e1,this.e2,this.e3,this.lat0),this.rh=this.a*(this.g-this.ml0))}function ba(e){var t=e.x,n=e.y,r;if(this.sphere)r=this.a*(this.g-n);else{var i=ai(this.e0,this.e1,this.e2,this.e3,n);r=this.a*(this.g-i)}var a=this.ns*F(t-this.long0,this.over),o=this.x0+r*Math.sin(a),s=this.y0+this.rh-r*Math.cos(a);return e.x=o,e.y=s,e}function xa(e){e.x-=this.x0,e.y=this.rh-e.y+this.y0;var t,n,r,i;this.ns>=0?(n=Math.sqrt(e.x*e.x+e.y*e.y),t=1):(n=-Math.sqrt(e.x*e.x+e.y*e.y),t=-1);var a=0;return n!==0&&(a=Math.atan2(t*e.x,t*e.y)),this.sphere?(i=F(this.long0+a/this.ns,this.over),r=di(this.g-n/this.a),e.x=i,e.y=r,e):(r=fi(this.g-n/this.a,this.e0,this.e1,this.e2,this.e3),i=F(this.long0+a/this.ns,this.over),e.x=i,e.y=r,e)}var Sa={init:ya,forward:ba,inverse:xa,names:[`Equidistant_Conic`,`eqdc`]};function Ca(){this.R=this.a}function wa(e){var t=e.x,n=e.y,r=F(t-this.long0,this.over),i,a;if(Math.abs(n)<=1e-10)return i=this.x0+this.R*r,a=this.y0,e.x=i,e.y=a,e;var o=Ai(2*Math.abs(n/Math.PI));if(Math.abs(r)<=1e-10||Math.abs(Math.abs(n)-j)<=1e-10)return i=this.x0,a=n>=0?this.y0+Math.PI*this.R*Math.tan(.5*o):this.y0+Math.PI*this.R*-Math.tan(.5*o),e.x=i,e.y=a,e;var s=.5*Math.abs(Math.PI/r-r/Math.PI),c=s*s,l=Math.sin(o),u=Math.cos(o),d=u/(l+u-1),f=d*d,p=d*(2/l-1),m=p*p,h=Math.PI*this.R*(s*(d-m)+Math.sqrt(c*(d-m)*(d-m)-(m+c)*(f-m)))/(m+c);r<0&&(h=-h),i=this.x0+h;var g=c+d;return h=Math.PI*this.R*(p*g-s*Math.sqrt((m+c)*(c+1)-g*g))/(m+c),a=n>=0?this.y0+h:this.y0-h,e.x=i,e.y=a,e}function Ta(e){var t,n,r,i,a,o,s,c,l,u,d,f,p;return e.x-=this.x0,e.y-=this.y0,d=Math.PI*this.R,r=e.x/d,i=e.y/d,a=r*r+i*i,o=-Math.abs(i)*(1+a),s=o-2*i*i+r*r,c=-2*o+1+2*i*i+a*a,p=i*i/c+(2*s*s*s/c/c/c-9*o*s/c/c)/27,l=(o-s*s/3/c)/c,u=2*Math.sqrt(-l/3),d=3*p/l/u,Math.abs(d)>1&&(d=d>=0?1:-1),f=Math.acos(d)/3,n=e.y>=0?(-u*Math.cos(f+Math.PI/3)-s/3/c)*Math.PI:-(-u*Math.cos(f+Math.PI/3)-s/3/c)*Math.PI,t=Math.abs(r)<1e-10?this.long0:F(this.long0+Math.PI*(a-1+Math.sqrt(1+2*(r*r-i*i)+a*a))/2/r,this.over),e.x=t,e.y=n,e}var Ea={init:Ca,forward:wa,inverse:Ta,names:[`Van_der_Grinten_I`,`VanDerGrinten`,`Van_der_Grinten`,`vandg`]};function Da(e,t,n,r,i,a){let o=r-t,s=Math.atan((1-a)*Math.tan(e)),c=Math.atan((1-a)*Math.tan(n)),l=Math.sin(s),u=Math.cos(s),d=Math.sin(c),f=Math.cos(c),p=o,m,h=100,g,_,v,y,b,x,S,C,w,T,E,D,O,k;do{if(g=Math.sin(p),_=Math.cos(p),v=Math.sqrt(f*g*(f*g)+(u*d-l*f*_)*(u*d-l*f*_)),v===0)return{azi1:0,s12:0};y=l*d+u*f*_,b=Math.atan2(v,y),x=u*f*g/v,S=1-x*x,C=S===0?0:y-2*l*d/S,w=a/16*S*(4+a*(4-3*S)),m=p,p=o+(1-w)*a*x*(b+w*v*(C+w*y*(-1+2*C*C)))}while(Math.abs(p-m)>1e-12&&--h>0);return h===0?{azi1:NaN,s12:NaN}:(T=S*(i*i-i*(1-a)*(i*(1-a)))/(i*(1-a)*(i*(1-a))),E=1+T/16384*(4096+T*(-768+T*(320-175*T))),D=T/1024*(256+T*(-128+T*(74-47*T))),O=D*v*(C+D/4*(y*(-1+2*C*C)-D/6*C*(-3+4*v*v)*(-3+4*C*C))),k=i*(1-a)*E*(b-O),{azi1:Math.atan2(f*g,u*d-l*f*_),s12:k})}function Oa(e,t,n,r,i,a){let o=Math.atan((1-a)*Math.tan(e)),s=Math.sin(o),c=Math.cos(o),l=Math.sin(n),u=Math.cos(n),d=Math.atan2(s,c*u),f=c*l,p=1-f*f,m=p*(i*i-i*(1-a)*(i*(1-a)))/(i*(1-a)*(i*(1-a))),h=1+m/16384*(4096+m*(-768+m*(320-175*m))),g=m/1024*(256+m*(-128+m*(74-47*m))),_=r/(i*(1-a)*h),v,y=100,b,x,S,C;do b=Math.cos(2*d+_),x=Math.sin(_),S=Math.cos(_),C=g*x*(b+g/4*(S*(-1+2*b*b)-g/6*b*(-3+4*x*x)*(-3+4*b*b))),v=_,_=r/(i*(1-a)*h)+C;while(Math.abs(_-v)>1e-12&&--y>0);if(y===0)return{lat2:NaN,lon2:NaN};let w=s*x-c*S*u,T=Math.atan2(s*S+c*x*u,(1-a)*Math.sqrt(f*f+w*w)),E=Math.atan2(x*l,c*S-s*x*u),D=a/16*p*(4+a*(4-3*p));return{lat2:T,lon2:t+(E-(1-D)*a*f*(_+D*x*(b+D*S*(-1+2*b*b))))}}function ka(){this.sin_p12=Math.sin(this.lat0),this.cos_p12=Math.cos(this.lat0),this.x0=this.x0||0,this.y0=this.y0||0,this.long0=this.long0||0,this.f=this.es/(1+Math.sqrt(1-this.es))}function Aa(e){var t=e.x,n=e.y,r=Math.sin(e.y),i=Math.cos(e.y),a=F(t-this.long0,this.over),o,s,c,l,u,d,f,p,m,h,g;return this.sphere?Math.abs(this.sin_p12-1)<=1e-10?(e.x=this.x0+this.a*(j-n)*Math.sin(a),e.y=this.y0-this.a*(j-n)*Math.cos(a),e):Math.abs(this.sin_p12+1)<=1e-10?(e.x=this.x0+this.a*(j+n)*Math.sin(a),e.y=this.y0+this.a*(j+n)*Math.cos(a),e):(m=this.sin_p12*r+this.cos_p12*i*Math.cos(a),f=Math.acos(m),p=f?f/Math.sin(f):1,e.x=this.x0+this.a*p*i*Math.sin(a),e.y=this.y0+this.a*p*(this.cos_p12*r-this.sin_p12*i*Math.cos(a)),e):(o=oi(this.es),s=si(this.es),c=ci(this.es),l=li(this.es),Math.abs(this.sin_p12-1)<=1e-10?(u=this.a*ai(o,s,c,l,j),d=this.a*ai(o,s,c,l,n),e.x=this.x0+(u-d)*Math.sin(a),e.y=this.y0-(u-d)*Math.cos(a),e):Math.abs(this.sin_p12+1)<=1e-10?(u=this.a*ai(o,s,c,l,j),d=this.a*ai(o,s,c,l,n),e.x=this.x0+(u+d)*Math.sin(a),e.y=this.y0+(u+d)*Math.cos(a),e):Math.abs(t)<1e-10&&Math.abs(n-this.lat0)<1e-10?(e.x=this.x0,e.y=this.y0,e):(h=Da(this.lat0,this.long0,n,t,this.a,this.f),g=h.azi1,e.x=this.x0+h.s12*Math.sin(g),e.y=this.y0+h.s12*Math.cos(g),e))}function ja(e){e.x-=this.x0,e.y-=this.y0;var t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g;return this.sphere?(t=Math.sqrt(e.x*e.x+e.y*e.y),t>2*j*this.a?void 0:(n=t/this.a,r=Math.sin(n),i=Math.cos(n),a=this.long0,Math.abs(t)<=1e-10?o=this.lat0:(o=Ai(i*this.sin_p12+e.y*r*this.cos_p12/t),s=Math.abs(this.lat0)-j,a=Math.abs(s)<=1e-10?this.lat0>=0?F(this.long0+Math.atan2(e.x,-e.y),this.over):F(this.long0-Math.atan2(-e.x,e.y),this.over):F(this.long0+Math.atan2(e.x*r,t*this.cos_p12*i-e.y*this.sin_p12*r),this.over)),e.x=a,e.y=o,e)):(c=oi(this.es),l=si(this.es),u=ci(this.es),d=li(this.es),Math.abs(this.sin_p12-1)<=1e-10?(f=this.a*ai(c,l,u,d,j),t=Math.sqrt(e.x*e.x+e.y*e.y),p=f-t,o=fi(p/this.a,c,l,u,d),a=F(this.long0+Math.atan2(e.x,-1*e.y),this.over),e.x=a,e.y=o,e):Math.abs(this.sin_p12+1)<=1e-10?(f=this.a*ai(c,l,u,d,j),t=Math.sqrt(e.x*e.x+e.y*e.y),p=t-f,o=fi(p/this.a,c,l,u,d),a=F(this.long0+Math.atan2(e.x,e.y),this.over),e.x=a,e.y=o,e):(m=Math.atan2(e.x,e.y),h=Math.sqrt(e.x*e.x+e.y*e.y),g=Oa(this.lat0,this.long0,m,h,this.a,this.f),e.x=g.lon2,e.y=g.lat2,e))}var Ma={init:ka,forward:Aa,inverse:ja,names:[`Azimuthal_Equidistant`,`aeqd`]};function Na(){this.sin_p14=Math.sin(this.lat0||0),this.cos_p14=Math.cos(this.lat0||0)}function Pa(e){var t,n,r,i,a,o,s,c,l=e.x,u=e.y;return r=F(l-(this.long0||0),this.over),t=Math.sin(u),n=Math.cos(u),i=Math.cos(r),o=this.sin_p14*t+this.cos_p14*n*i,a=1,(o>0||Math.abs(o)<=1e-10)&&(s=(this.x0||0)+this.a*a*n*Math.sin(r),c=(this.y0||0)+this.a*a*(this.cos_p14*t-this.sin_p14*n*i)),e.x=s,e.y=c,e}function Fa(e){var t,n,r,i,a,o,s,c,l;return e.x-=this.x0||0,e.y-=this.y0||0,t=Math.sqrt(e.x*e.x+e.y*e.y),n=Ai(t/this.a),r=Math.sin(n),i=Math.cos(n),c=this.long0||0,l=this.lat0||0,o=c,Math.abs(t)<=1e-10?(s=l,e.x=o,e.y=s,e):(s=Ai(i*this.sin_p14+e.y*r*this.cos_p14/t),a=Math.abs(l)-j,Math.abs(a)<=1e-10?(o=F(l>=0?c+Math.atan2(e.x,-e.y):c-Math.atan2(-e.x,e.y),this.over),e.x=o,e.y=s,e):(o=F(c+Math.atan2(e.x*r,t*this.cos_p14*i-e.y*this.sin_p14*r),this.over),e.x=o,e.y=s,e))}var Ia={init:Na,forward:Pa,inverse:Fa,names:[`ortho`]},La={FRONT:1,RIGHT:2,BACK:3,LEFT:4,TOP:5,BOTTOM:6},I={AREA_0:1,AREA_1:2,AREA_2:3,AREA_3:4};function Ra(){this.x0=this.x0||0,this.y0=this.y0||0,this.lat0=this.lat0||0,this.long0=this.long0||0,this.lat_ts=this.lat_ts||0,this.title=this.title||`Quadrilateralized Spherical Cube`,this.face=this.lat0>=j-N/2?La.TOP:this.lat0<=-(j-N/2)?La.BOTTOM:Math.abs(this.long0)<=N?La.FRONT:Math.abs(this.long0)<=j+N?this.long0>0?La.RIGHT:La.LEFT:La.BACK,this.es!==0&&(this.one_minus_f=1-(this.a-this.b)/this.a,this.one_minus_f_squared=this.one_minus_f*this.one_minus_f)}function za(e){var t={x:0,y:0},n,r,i,a,o,s,c={value:0};if(e.x-=this.long0,n=this.es===0?e.y:Math.atan(this.one_minus_f_squared*Math.tan(e.y)),r=e.x,this.face===La.TOP)a=j-n,r>=N&&r<=j+N?(c.value=I.AREA_0,i=r-j):r>j+N||r<=-(j+N)?(c.value=I.AREA_1,i=r>0?r-P:r+P):r>-(j+N)&&r<=-N?(c.value=I.AREA_2,i=r+j):(c.value=I.AREA_3,i=r);else if(this.face===La.BOTTOM)a=j+n,r>=N&&r<=j+N?(c.value=I.AREA_0,i=-r+j):r=-N?(c.value=I.AREA_1,i=-r):r<-N&&r>=-(j+N)?(c.value=I.AREA_2,i=-r-j):(c.value=I.AREA_3,i=r>0?-r+P:-r-P);else{var l,u,d,f,p,m,h;this.face===La.RIGHT?r=Ha(r,+j):this.face===La.BACK?r=Ha(r,+P):this.face===La.LEFT&&(r=Ha(r,-j)),f=Math.sin(n),p=Math.cos(n),m=Math.sin(r),h=Math.cos(r),l=p*h,u=p*m,d=f,this.face===La.FRONT?(a=Math.acos(l),i=Va(a,d,u,c)):this.face===La.RIGHT?(a=Math.acos(u),i=Va(a,d,-l,c)):this.face===La.BACK?(a=Math.acos(-l),i=Va(a,d,-u,c)):this.face===La.LEFT?(a=Math.acos(-u),i=Va(a,d,l,c)):(a=i=0,c.value=I.AREA_0)}return s=Math.atan(12/P*(i+Math.acos(Math.sin(i)*Math.cos(N))-j)),o=Math.sqrt((1-Math.cos(a))/(Math.cos(s)*Math.cos(s))/(1-Math.cos(Math.atan(1/Math.cos(i))))),c.value===I.AREA_1?s+=j:c.value===I.AREA_2?s+=P:c.value===I.AREA_3&&(s+=1.5*P),t.x=o*Math.cos(s),t.y=o*Math.sin(s),t.x=t.x*this.a+this.x0,t.y=t.y*this.a+this.y0,e.x=t.x,e.y=t.y,e}function Ba(e){var t={lam:0,phi:0},n,r,i,a,o,s,c,l,u,d={value:0};if(e.x=(e.x-this.x0)/this.a,e.y=(e.y-this.y0)/this.a,r=Math.atan(Math.sqrt(e.x*e.x+e.y*e.y)),n=Math.atan2(e.y,e.x),e.x>=0&&e.x>=Math.abs(e.y)?d.value=I.AREA_0:e.y>=0&&e.y>=Math.abs(e.x)?(d.value=I.AREA_1,n-=j):e.x<0&&-e.x>=Math.abs(e.y)?(d.value=I.AREA_2,n=n<0?n+P:n-P):(d.value=I.AREA_3,n+=j),u=P/12*Math.tan(n),o=Math.sin(u)/(Math.cos(u)-1/Math.sqrt(2)),s=Math.atan(o),i=Math.cos(n),a=Math.tan(r),c=1-i*i*a*a*(1-Math.cos(Math.atan(1/Math.cos(s)))),c<-1?c=-1:c>1&&(c=1),this.face===La.TOP)l=Math.acos(c),t.phi=j-l,t.lam=d.value===I.AREA_0?s+j:d.value===I.AREA_1?s<0?s+P:s-P:d.value===I.AREA_2?s-j:s;else if(this.face===La.BOTTOM)l=Math.acos(c),t.phi=l-j,t.lam=d.value===I.AREA_0?-s+j:d.value===I.AREA_1?-s:d.value===I.AREA_2?-s-j:s<0?-s-P:-s+P;else{var f=c,p,m;u=f*f,m=u>=1?0:Math.sqrt(1-u)*Math.sin(s),u+=m*m,p=u>=1?0:Math.sqrt(1-u),d.value===I.AREA_1?(u=p,p=-m,m=u):d.value===I.AREA_2?(p=-p,m=-m):d.value===I.AREA_3&&(u=p,p=m,m=-u),this.face===La.RIGHT?(u=f,f=-p,p=u):this.face===La.BACK?(f=-f,p=-p):this.face===La.LEFT&&(u=f,f=p,p=-u),t.phi=Math.acos(-m)-j,t.lam=Math.atan2(p,f),this.face===La.RIGHT?t.lam=Ha(t.lam,-j):this.face===La.BACK?t.lam=Ha(t.lam,-P):this.face===La.LEFT&&(t.lam=Ha(t.lam,+j))}if(this.es!==0){var h=+(t.phi<0),g=Math.tan(t.phi),_=this.b/Math.sqrt(g*g+this.one_minus_f_squared);t.phi=Math.atan(Math.sqrt(this.a*this.a-_*_)/(this.one_minus_f*_)),h&&(t.phi=-t.phi)}return t.lam+=this.long0,e.x=t.lam,e.y=t.phi,e}function Va(e,t,n,r){var i;return e<1e-10?(r.value=I.AREA_0,i=0):(i=Math.atan2(t,n),Math.abs(i)<=N?r.value=I.AREA_0:i>N&&i<=j+N?(r.value=I.AREA_1,i-=j):i>j+N||i<=-(j+N)?(r.value=I.AREA_2,i=i>=0?i-P:i+P):(r.value=I.AREA_3,i+=j)),i}function Ha(e,t){var n=e+t;return n<-3.14159265359?n+=fe:n>3.14159265359&&(n-=fe),n}var Ua={init:Ra,forward:za,inverse:Ba,names:[`Quadrilateralized Spherical Cube`,`Quadrilateralized_Spherical_Cube`,`qsc`]},Wa=[[1,22199e-21,-715515e-10,31103e-10],[.9986,-482243e-9,-24897e-9,-13309e-10],[.9954,-83103e-8,-448605e-10,-9.86701e-7],[.99,-.00135364,-59661e-9,36777e-10],[.9822,-.00167442,-449547e-11,-572411e-11],[.973,-.00214868,-903571e-10,1.8736e-8],[.96,-.00305085,-900761e-10,164917e-11],[.9427,-.00382792,-653386e-10,-26154e-10],[.9216,-.00467746,-10457e-8,481243e-11],[.8962,-.00536223,-323831e-10,-543432e-11],[.8679,-.00609363,-113898e-9,332484e-11],[.835,-.00698325,-640253e-10,9.34959e-7],[.7986,-.00755338,-500009e-10,9.35324e-7],[.7597,-.00798324,-35971e-9,-227626e-11],[.7186,-.00851367,-701149e-10,-86303e-10],[.6732,-.00986209,-199569e-9,191974e-10],[.6213,-.010418,883923e-10,624051e-11],[.5722,-.00906601,182e-6,624051e-11],[.5322,-.00677797,275608e-9,624051e-11]],Ga=[[-520417e-23,.0124,121431e-23,-845284e-16],[.062,.0124,-1.26793e-9,422642e-15],[.124,.0124,5.07171e-9,-1.60604e-9],[.186,.0123999,-1.90189e-8,6.00152e-9],[.248,.0124002,7.10039e-8,-2.24e-8],[.31,.0123992,-2.64997e-7,8.35986e-8],[.372,.0124029,9.88983e-7,-3.11994e-7],[.434,.0123893,-369093e-11,-4.35621e-7],[.4958,.0123198,-102252e-10,-3.45523e-7],[.5571,.0121916,-154081e-10,-5.82288e-7],[.6176,.0119938,-241424e-10,-5.25327e-7],[.6769,.011713,-320223e-10,-5.16405e-7],[.7346,.0113541,-397684e-10,-6.09052e-7],[.7903,.0109107,-489042e-10,-104739e-11],[.8435,.0103431,-64615e-9,-1.40374e-9],[.8936,.00969686,-64636e-9,-8547e-9],[.9394,.00840947,-192841e-9,-42106e-10],[.9761,.00616527,-256e-6,-42106e-10],[1,.00328947,-319159e-9,-42106e-10]],Ka=.8487,qa=1.3523,Ja=de/5,Ya=1/Ja,Xa=18,Za=function(e,t){return e[0]+t*(e[1]+t*(e[2]+t*e[3]))},Qa=function(e,t){return e[1]+t*(2*e[2]+t*3*e[3])};function $a(e,t,n,r){for(var i=t;r;--r){var a=e(i);if(i-=a,Math.abs(a)=Xa&&(r=Xa-1),n=de*(n-Ya*r);var i={x:Za(Wa[r],n)*t,y:Za(Ga[r],n)};return e.y<0&&(i.y=-i.y),i.x=i.x*this.a*Ka+this.x0,i.y=i.y*this.a*qa+this.y0,e.z!==void 0&&(i.z=e.z),e.m!==void 0&&(i.m=e.m),i}function no(e){var t={x:(e.x-this.x0)/(this.a*Ka),y:Math.abs(e.y-this.y0)/(this.a*qa)};if(t.y>=1)t.x/=Wa[Xa][0],t.y=e.y<0?-j:j;else{var n=Math.floor(t.y*Xa);for(n<0?n=0:n>=Xa&&(n=Xa-1);;)if(Ga[n][0]>t.y)--n;else if(Ga[n+1][0]<=t.y)++n;else break;var r=Ga[n],i=5*(t.y-r[0])/(Ga[n+1][0]-r[0]);i=$a(function(e){return(Za(r,e)-t.y)/Qa(r,e)},i,ue,100),t.x/=Za(Wa[n],i),t.y=(5*n+i)*M,e.y<0&&(t.y=-t.y)}return t.x=F(t.x+this.long0,this.over),e.z!==void 0&&(t.z=e.z),e.m!==void 0&&(t.m=e.m),t}var ro={init:eo,forward:to,inverse:no,names:[`Robinson`,`robin`]};function io(){this.name=`geocent`}function ao(e){return Yt(e,this.es,this.a)}function oo(e){return Xt(e,this.es,this.a,this.b)}var so={init:io,forward:ao,inverse:oo,names:[`Geocentric`,`geocentric`,`geocent`,`Geocent`]},co={N_POLE:0,S_POLE:1,EQUIT:2,OBLIQ:3},lo={h:{def:1e5,num:!0},azi:{def:0,num:!0,degrees:!0},tilt:{def:0,num:!0,degrees:!0},long0:{def:0,num:!0},lat0:{def:0,num:!0}};function uo(){if(Object.keys(lo).forEach(function(e){if(this[e]===void 0)this[e]=lo[e].def;else if(lo[e].num&&isNaN(this[e]))throw Error(`Invalid parameter value, must be numeric `+e+` = `+this[e]);else lo[e].num&&(this[e]=parseFloat(this[e]));lo[e].degrees&&(this[e]=this[e]*M)}.bind(this)),Math.abs(Math.abs(this.lat0)-j)<1e-10?this.mode=this.lat0<0?co.S_POLE:co.N_POLE:Math.abs(this.lat0)<1e-10?this.mode=co.EQUIT:(this.mode=co.OBLIQ,this.sinph0=Math.sin(this.lat0),this.cosph0=Math.cos(this.lat0)),this.pn1=this.h/this.a,this.pn1<=0||this.pn1>1e10)throw Error(`Invalid height`);this.p=1+this.pn1,this.rp=1/this.p,this.h1=1/this.pn1,this.pfact=(this.p+1)*this.h1,this.es=0;var e=this.tilt,t=this.azi;this.cg=Math.cos(t),this.sg=Math.sin(t),this.cw=Math.cos(e),this.sw=Math.sin(e)}function fo(e){e.x-=this.long0;var t=Math.sin(e.y),n=Math.cos(e.y),r=Math.cos(e.x),i,a;switch(this.mode){case co.OBLIQ:a=this.sinph0*t+this.cosph0*n*r;break;case co.EQUIT:a=n*r;break;case co.S_POLE:a=-t;break;case co.N_POLE:a=t}switch(a=this.pn1/(this.p-a),i=a*n*Math.sin(e.x),this.mode){case co.OBLIQ:a*=this.cosph0*t-this.sinph0*n*r;break;case co.EQUIT:a*=t;break;case co.N_POLE:a*=-(n*r);break;case co.S_POLE:a*=n*r}var o=a*this.cg+i*this.sg,s=1/(o*this.sw*this.h1+this.cw);return i=(i*this.cg-a*this.sg)*this.cw*s,a=o*s,e.x=i*this.a,e.y=a*this.a,e}function po(e){e.x/=this.a,e.y/=this.a;var t={x:e.x,y:e.y},n,r,i=1/(this.pn1-e.y*this.sw);n=this.pn1*e.x*i,r=this.pn1*e.y*this.cw*i,e.x=n*this.cg+r*this.sg,e.y=r*this.cg-n*this.sg;var a=dr(e.x,e.y);if(Math.abs(a)<1e-10)t.x=0,t.y=e.y;else{var o,s=1-a*a*this.pfact;switch(s=(this.p-Math.sqrt(s))/(this.pn1/a+a/this.pn1),o=Math.sqrt(1-s*s),this.mode){case co.OBLIQ:t.y=Math.asin(o*this.sinph0+e.y*s*this.cosph0/a),e.y=(o-this.sinph0*Math.sin(t.y))*a,e.x*=s*this.cosph0;break;case co.EQUIT:t.y=Math.asin(e.y*s/a),e.y=o*a,e.x*=s;break;case co.N_POLE:t.y=Math.asin(o),e.y=-e.y;break;case co.S_POLE:t.y=-Math.asin(o)}t.x=Math.atan2(e.x,e.y)}return e.x=t.x+this.long0,e.y=t.y,e}var mo={init:uo,forward:fo,inverse:po,names:[`Tilted_Perspective`,`tpers`]};function ho(){if(this.flip_axis=+(this.sweep===`x`),this.h=Number(this.h),this.radius_g_1=this.h/this.a,this.radius_g_1<=0||this.radius_g_1>1e10)throw Error();if(this.radius_g=1+this.radius_g_1,this.C=this.radius_g*this.radius_g-1,this.es!==0){var e=1-this.es,t=1/e;this.radius_p=Math.sqrt(e),this.radius_p2=e,this.radius_p_inv2=t,this.shape=`ellipse`}else this.radius_p=1,this.radius_p2=1,this.radius_p_inv2=1,this.shape=`sphere`;this.title||=`Geostationary Satellite View`}function go(e){var t=e.x,n=e.y,r,i,a,o;if(t-=this.long0,this.shape===`ellipse`){n=Math.atan(this.radius_p2*Math.tan(n));var s=this.radius_p/dr(this.radius_p*Math.cos(n),Math.sin(n));if(i=s*Math.cos(t)*Math.cos(n),a=s*Math.sin(t)*Math.cos(n),o=s*Math.sin(n),(this.radius_g-i)*i-a*a-o*o*this.radius_p_inv2<0)return e.x=NaN,e.y=NaN,e;r=this.radius_g-i,this.flip_axis?(e.x=this.radius_g_1*Math.atan(a/dr(o,r)),e.y=this.radius_g_1*Math.atan(o/r)):(e.x=this.radius_g_1*Math.atan(a/r),e.y=this.radius_g_1*Math.atan(o/dr(a,r)))}else this.shape===`sphere`&&(r=Math.cos(n),i=Math.cos(t)*r,a=Math.sin(t)*r,o=Math.sin(n),r=this.radius_g-i,this.flip_axis?(e.x=this.radius_g_1*Math.atan(a/dr(o,r)),e.y=this.radius_g_1*Math.atan(o/r)):(e.x=this.radius_g_1*Math.atan(a/r),e.y=this.radius_g_1*Math.atan(o/dr(a,r))));return e.x*=this.a,e.y*=this.a,e}function _o(e){var t=-1,n=0,r=0,i,a,o,s;if(e.x/=this.a,e.y/=this.a,this.shape===`ellipse`){this.flip_axis?(r=Math.tan(e.y/this.radius_g_1),n=Math.tan(e.x/this.radius_g_1)*dr(1,r)):(n=Math.tan(e.x/this.radius_g_1),r=Math.tan(e.y/this.radius_g_1)*dr(1,n));var c=r/this.radius_p;if(i=n*n+c*c+t*t,a=2*this.radius_g*t,o=a*a-4*i*this.C,o<0)return e.x=NaN,e.y=NaN,e;s=(-a-Math.sqrt(o))/(2*i),t=this.radius_g+s*t,n*=s,r*=s,e.x=Math.atan2(n,t),e.y=Math.atan(r*Math.cos(e.x)/t),e.y=Math.atan(this.radius_p_inv2*Math.tan(e.y))}else if(this.shape===`sphere`){if(this.flip_axis?(r=Math.tan(e.y/this.radius_g_1),n=Math.tan(e.x/this.radius_g_1)*Math.sqrt(1+r*r)):(n=Math.tan(e.x/this.radius_g_1),r=Math.tan(e.y/this.radius_g_1)*Math.sqrt(1+n*n)),i=n*n+r*r+t*t,a=2*this.radius_g*t,o=a*a-4*i*this.C,o<0)return e.x=NaN,e.y=NaN,e;s=(-a-Math.sqrt(o))/(2*i),t=this.radius_g+s*t,n*=s,r*=s,e.x=Math.atan2(n,t),e.y=Math.atan(r*Math.cos(e.x)/t)}return e.x+=this.long0,e}var vo={init:ho,forward:go,inverse:_o,names:[`Geostationary Satellite View`,`Geostationary_Satellite`,`geos`]},yo=1.340264,bo=-.081106,xo=893e-6,So=.003796,Co=Math.sqrt(3)/2;function wo(){this.long0=this.long0===void 0?0:this.long0,this.x0=this.x0===void 0?0:this.x0,this.y0=this.y0===void 0?0:this.y0,this.es!==0&&(this.apa=wi(this.es),this.qp=_i(this.e,1),this.rqda=Math.sqrt(.5*this.qp))}function To(e){var t=F(e.x-this.long0,this.over),n=e.y,r=Math.sin(n);this.es!==0&&(r=_i(this.e,r)/this.qp);var i=Math.asin(Co*r),a=i*i,o=a*a*a;return e.x=t*Math.cos(i)/(Co*(yo+3*bo*a+o*(7*xo+9*So*a))),e.y=i*(yo+bo*a+o*(xo+So*a)),this.es!==0&&(e.x*=this.rqda,e.y*=this.rqda),e.x=this.a*e.x+this.x0,e.y=this.a*e.y+this.y0,e}function Eo(e){e.x=(e.x-this.x0)/this.a,e.y=(e.y-this.y0)/this.a,this.es!==0&&(e.x/=this.rqda,e.y/=this.rqda);for(var t=1e-9,n=12,r=e.y,i,a,o,s,c,l=0;l=j?0:1/Math.tan(this.phi1),this.inverse=No,this.forward=Mo)}function Ao(e){var t=F(e.x-(this.long0||0),this.over),n=e.y,r=this.am1+this.m1-rr(n,i=Math.sin(n),a=Math.cos(n),this.en),i=a*t/(r*Math.sqrt(1-this.es*i*i)),a;return e.x=r*Math.sin(i),e.y=this.am1-r*Math.cos(i),e.x=this.a*e.x+(this.x0||0),e.y=this.a*e.y+(this.y0||0),e}function jo(e){e.x=(e.x-(this.x0||0))/this.a,e.y=(e.y-(this.y0||0))/this.a;var t,n=dr(e.x,e.y=this.am1-e.y),r,i=ar(this.am1+this.m1-n,this.es,this.en);if((t=Math.abs(i))Oo?(e.x=i*Math.sin(r=t*Math.cos(n)/i),e.y=this.cphi1-i*Math.cos(r)):e.x=e.y=0,e.x=this.a*e.x+(this.x0||0),e.y=this.a*e.y+(this.y0||0),e}function No(e){e.x=(e.x-(this.x0||0))/this.a,e.y=(e.y-(this.y0||0))/this.a;var t,n,r=dr(e.x,e.y=this.cphi1-e.y);if(n=this.cphi1+this.phi1-r,Math.abs(n)>j)throw Error();return t=Math.abs(Math.abs(n)-j)<=Oo?0:r*Math.atan2(e.x,e.y)/Math.cos(n),e.x=F(t+(this.long0||0),this.over),e.y=di(n),e}var Po={init:ko,names:[`bonne`,`Bonne (Werner lat_1=90)`]},Fo={OBLIQUE:{forward:Vo,inverse:Uo},TRANSVERSE:{forward:Ho,inverse:Wo}},Io={ROTATE:{o_alpha:`oAlpha`,o_lon_c:`oLongC`,o_lat_c:`oLatC`},NEW_POLE:{o_lat_p:`oLatP`,o_lon_p:`oLongP`},NEW_EQUATOR:{o_lon_1:`oLong1`,o_lat_1:`oLat1`,o_lon_2:`oLong2`,o_lat_2:`oLat2`}};function Lo(){if(this.x0=this.x0||0,this.y0=this.y0||0,this.long0=this.long0||0,this.title=this.title||`General Oblique Transformation`,this.isIdentity=ht.includes(this.o_proj),!this.o_proj)throw Error(`Missing parameter: o_proj`);if(this.o_proj===`ob_tran`)throw Error(`Invalid value for o_proj: `+this.o_proj);let e=qt(this.projStr.replace(`+proj=ob_tran`,``).replace(`+o_proj=`,`+proj=`).trim());if(!e)throw Error(`Invalid parameter: o_proj. Unknown projection `+this.o_proj);e.long0=0,this.obliqueProjection=e;let t,n=Object.keys(Io),r=e=>{if(this[e]===void 0)return;let t=parseFloat(this[e])*M;if(isNaN(t))throw Error(`Invalid value for `+e+`: `+this[e]);return t};for(let e=0;ethis[e]!==void 0)){t=i;for(let e=0;e1e-10?(this.cphip=Math.cos(a),this.sphip=Math.sin(a),this.projectionType=Fo.OBLIQUE):this.projectionType=Fo.TRANSVERSE}function Ro(e){return this.projectionType.forward(this,e)}function zo(e){return this.projectionType.inverse(this,e)}function Bo(e,t){let n,r;if(t===Io.ROTATE){let t=e.oLongC,i=e.oLatC,a=e.oAlpha;if(Math.abs(Math.abs(i)-j)<=1e-10)throw Error(`Invalid value for o_lat_c: `+e.o_lat_c+` should be < 90°`);r=t+Math.atan2(-1*Math.cos(a),-1*Math.sin(a)*Math.sin(i)),n=Math.asin(Math.cos(i)*Math.sin(a))}else if(t===Io.NEW_POLE)r=e.oLongP,n=e.oLatP;else{let t=e.oLong1,i=e.oLat1,a=e.oLong2,o=e.oLat2,s=Math.abs(i);if(Math.abs(i)>j-1e-10)throw Error(`Invalid value for o_lat_1: `+e.o_lat_1+` should be < 90°`);if(Math.abs(o)>j-1e-10)throw Error(`Invalid value for o_lat_2: `+e.o_lat_2+` should be < 90°`);if(Math.abs(i-o)<1e-10)throw Error(`Invalid value for o_lat_1 and o_lat_2: o_lat_1 should be different from o_lat_2`);if(s<1e-10)throw Error(`Invalid value for o_lat_1: o_lat_1 should be different from zero`);r=Math.atan2(Math.cos(i)*Math.sin(o)*Math.cos(t)-Math.sin(i)*Math.cos(o)*Math.cos(a),Math.sin(i)*Math.cos(o)*Math.sin(a)-Math.cos(i)*Math.sin(o)*Math.sin(t)),n=Math.atan(-1*Math.cos(r-t)/Math.tan(i))}return{lamp:r,phip:n}}function Vo(e,t){let{x:n,y:r}=t;n=F(n-e.long0,e.over);let i=Math.cos(n),a=Math.sin(r),o=Math.cos(r);t.x=F(Math.atan2(o*Math.sin(n),e.sphip*o*i+e.cphip*a)+e.lamp),t.y=Math.asin(e.sphip*a-e.cphip*o*i);let s=e.obliqueProjection.forward(t);return e.isIdentity&&(s.x*=de,s.y*=de),s}function Ho(e,t){let{x:n,y:r}=t;n=F(n-e.long0,e.over);let i=Math.cos(r),a=Math.cos(n);t.x=F(Math.atan2(i*Math.sin(n),Math.sin(r))+e.lamp),t.y=Math.asin(-1*i*a);let o=e.obliqueProjection.forward(t);return e.isIdentity&&(o.x*=de,o.y*=de),o}function Uo(e,t){e.isIdentity&&(t.x*=M,t.y*=M);let{x:n,y:r}=e.obliqueProjection.inverse(t);if(n{};let t=navigator.geolocation.watchPosition(t=>{e(Jo(t.coords.longitude,t.coords.latitude))},t=>{t.code===t.PERMISSION_DENIED&&e(`denied`)},{enableHighAccuracy:!0});return()=>navigator.geolocation.clearWatch(t)}var Xo={maxSpanMeters:36e3,minResolutionMeters:1.25,openResolutionMeters:7};function Zo(e,t=Xo){return Math.min(t.maxSpanMeters/e.widthPx,t.maxSpanMeters/e.heightPx)}var Qo=65,$o=73,es=79;function ts(e,t){if(t=typeof t==`number`?t:5,!Array.isArray(e))throw TypeError(`forward did not receive an array`);if(typeof e[0]==`string`||typeof e[1]==`string`)throw TypeError(`forward received an array of strings, but it only accepts an array of numbers.`);let[n,r]=e;if(n<-180||n>180)throw TypeError(`forward received an invalid longitude of `+n);if(r<-90||r>90)throw TypeError(`forward received an invalid latitude of `+r);if(r<-80||r>84)throw TypeError(`forward received a latitude of ${r}, but this library does not support conversions of points in polar regions below 80°S and above 84°N`);return function(e,t){let n=`00000`+e.easting,r=`00000`+e.northing;return e.zoneNumber+e.zoneLetter+function(e,t,n){let r=ss(n);return function(e,t,n){let r=n-1,i=`AJSAJS`.charCodeAt(r),a=`AFAFAF`.charCodeAt(r),o=i+e-1,s=a+t,c=!1;return o>90&&(o=o-90+Qo-1,c=!0),(o===$o||i<$o&&o>$o||(o>$o||i<$o)&&c)&&o++,(o===es||ies||(o>es||i90&&(o=o-90+Qo-1),s>86?(s=s-86+Qo-1,c=!0):c=!1,(s===$o||a<$o&&s>$o||(s>$o||a<$o)&&c)&&s++,(s===es||aes||(s>es||a86&&(s=s-86+Qo-1),String.fromCharCode(o)+String.fromCharCode(s)}(Math.floor(e/1e5),Math.floor(t/1e5)%20,r)}(e.easting,e.northing,e.zoneNumber)+n.substr(n.length-5,t)+r.substr(r.length-5,t)}(function(e){let t=e.lat,n=e.lon,r=6378137,i=rs(t),a=rs(n),o;o=Math.floor((n+180)/6)+1,n===180&&(o=60),t>=56&&t<64&&n>=3&&n<12&&(o=32),t>=72&&t<84&&(n>=0&&n<9?o=31:n>=9&&n<21?o=33:n>=21&&n<33?o=35:n>=33&&n<42&&(o=37));let s=rs(6*(o-1)-180+3),c=r/Math.sqrt(1-.00669438*Math.sin(i)*Math.sin(i)),l=Math.tan(i)*Math.tan(i),u=.006739496752268451*Math.cos(i)*Math.cos(i),d=Math.cos(i)*(a-s),f=r*(.9983242984503243*i-.002514607064228144*Math.sin(2*i)+2639046602129982e-21*Math.sin(4*i)-3.418046101696858e-9*Math.sin(6*i)),p=.9996*c*(d+(1-l+u)*d*d*d/6+(5-18*l+l*l+72*u-.39089081163157013)*d*d*d*d*d/120)+5e5,m=.9996*(f+c*Math.tan(i)*(d*d/2+(5-l+9*u+4*u*u)*d*d*d*d/24+(61-58*l+l*l+600*u-2.2240339282485886)*d*d*d*d*d*d/720));return t<0&&(m+=1e7),{northing:Math.trunc(m),easting:Math.trunc(p),zoneNumber:o,zoneLetter:os(t)}}({lat:r,lon:n}),t)}function ns(e){if(e===``)throw TypeError(`toPoint received a blank string`);let t=as(cs(e.toUpperCase()));return typeof t.lat==`number`&&typeof t.lon==`number`?[t.lon,t.lat]:[(t.left+t.right)/2,(t.top+t.bottom)/2]}function rs(e){return Math.PI/180*e}function is(e){return e/Math.PI*180}function as(e){let t=e.northing,n=e.easting,{zoneLetter:r,zoneNumber:i}=e;if(i<0||i>60)return null;let a=6378137,o=(1-Math.sqrt(.99330562))/(1+Math.sqrt(.99330562)),s=n-5e5,c=t;r<`N`&&(c-=1e7);let l=6*(i-1)-180+3,u=c/.9996/6367449.145945056,d=u+(3*o/2-27*o*o*o/32)*Math.sin(2*u)+(21*o*o/16-55*o*o*o*o/32)*Math.sin(4*u)+151*o*o*o/96*Math.sin(6*u),f=a/Math.sqrt(1-.00669438*Math.sin(d)*Math.sin(d)),p=Math.tan(d)*Math.tan(d),m=.006739496752268451*Math.cos(d)*Math.cos(d),h=.99330562*a/(1-.00669438*Math.sin(d)*Math.sin(d))**1.5,g=s/(.9996*f),_=d-f*Math.tan(d)/h*(g*g/2-(5+3*p+10*m-4*m*m-.06065547077041606)*g*g*g*g/24+(61+90*p+298*m+45*p*p-1.6983531815716497-3*m*m)*g*g*g*g*g*g/720);_=is(_);let v,y=(g-(1+2*p+m)*g*g*g/6+(5-2*m+28*p-3*m*m+.05391597401814761+24*p*p)*g*g*g*g*g/120)/Math.cos(d);if(y=l+is(y),typeof e.accuracy==`number`){let t=as({northing:e.northing+e.accuracy,easting:e.easting+e.accuracy,zoneLetter:e.zoneLetter,zoneNumber:e.zoneNumber});v={top:t.lat,right:t.lon,bottom:_,left:y}}else v={lat:_,lon:y};return v}function os(e){return e<=84&&e>=72?`X`:e<72&&e>=-80?`CDEFGHJKLMNPQRSTUVWX`[Math.floor((e- -80)/8)]:e>84||e<-80?`Z`:void 0}function ss(e){let t=e%6;return t===0&&(t=6),t}function cs(e){if(e&&e.length===0)throw TypeError(`MGRSPoint coverting from nothing`);e=e.replace(/ /g,``);let{length:t}=e,n,r=null,i=``,a=0;for(;!/[A-Z]/.test(n=e.charAt(a));){if(a>=2)throw Error(`MGRSPoint bad conversion from: `+e);i+=n,a++}let o=parseInt(i,10);if(a===0||a+3>t)throw Error(`MGRSPoint bad conversion from `+e);let s=e.charAt(a++);if(s<=`A`||s===`B`||s===`Y`||s>=`Z`||s===`I`||s===`O`)throw Error(`MGRSPoint zone letter ${s} not handled: ${e}`);r=e.substring(a,a+=2);let c=ss(o),l=function(e,t){let n=`AJSAJS`.charCodeAt(t-1),r=1e5,i=!1;for(;n!==e.charCodeAt(0);){if(n++,n===$o&&n++,n===es&&n++,n>90){if(i)throw Error(`Bad character: `+e);n=Qo,i=!0}r+=1e5}return r}(r.charAt(0),c),u=function(e,t){if(e>`V`)throw TypeError(`MGRSPoint given invalid Northing `+e);let n=`AFAFAF`.charCodeAt(t-1),r=0,i=!1;for(;n!==e.charCodeAt(0);){if(n++,n===$o&&n++,n===es&&n++,n>86){if(i)throw Error(`Bad character: `+e);n=Qo,i=!0}r+=1e5}return r}(r.charAt(1),c);for(;u0){let t=e.substring(a,a+f);p=parseFloat(t)*h;let n=e.substring(a+f);m=parseFloat(n)*h}return{easting:p+l,northing:m+u,zoneLetter:s,zoneNumber:o,accuracy:h}}function ls(e){let t;switch(e){case`C`:t=11e5;break;case`D`:t=2e6;break;case`E`:t=28e5;break;case`F`:t=37e5;break;case`G`:t=46e5;break;case`H`:t=55e5;break;case`J`:t=64e5;break;case`K`:t=73e5;break;case`L`:t=82e5;break;case`M`:t=91e5;break;case`N`:t=0;break;case`P`:t=8e5;break;case`Q`:t=17e5;break;case`R`:t=26e5;break;case`S`:t=35e5;break;case`T`:t=44e5;break;case`U`:t=53e5;break;case`V`:t=62e5;break;case`W`:t=7e6;break;case`X`:t=79e5;break;default:t=-1}if(t>=0)return t;throw TypeError(`Invalid zone letter: `+e)}qo.defs(`EPSG:25832`,`+proj=utm +zone=32 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs +type=crs`);var us=`Rechtswert und Hochwert müssen genau fünf Ziffern haben.`,ds=`Dieses Gitter ist keine gültige Koordinate.`,fs=`Kein Blatt deckt diese Koordinate.`,ps=/^(\d{1,2}[C-HJ-NP-X])([A-HJ-NP-Z]{2})(\d{5})(\d{5})$/,ms=/^(\d{1,2})([C-HJ-NP-X])([A-HJ-NP-Z]{2})$/;function hs(e){let t=qo(`EPSG:25832`,`EPSG:4326`,[Math.round(e.easting),Math.round(e.northing)]),n;try{n=ts([t[0],t[1]],5)}catch{return null}let r=ps.exec(n);return r?{gitter:`${r[1]} ${r[2]}`,rechtswert:r[3],hochwert:r[4]}:null}function gs(e,t){if(!/^\d{5}$/.test(e.rechtswert)||!/^\d{5}$/.test(e.hochwert))return{ok:!1,notice:us};let n=e.gitter.trim().toUpperCase().replace(/\s+/g,``),r=ms.exec(n);if(!r)return{ok:!1,notice:ds};let i;try{i=ns(`${n}${e.rechtswert}${e.hochwert}`)}catch{return{ok:!1,notice:ds}}let a=qo(`EPSG:4326`,`EPSG:25832`,i),o={easting:a[0],northing:a[1]};return t(o)?{ok:!0,point:o,koordinate:`${`${r[1]}${r[2]} ${r[3]}`} ${e.rechtswert} ${e.hochwert}`}:{ok:!1,notice:fs}}var _s=`Nicht auf dem Gerät.`;function vs(e,t){return e.minEt.minE&&e.minNt.minN}function ys(e,t){return t.easting>=e.minE&&t.easting=e.minN&&t.northinge.covers===`all`||e.covers.some(e=>vs(s,e))).map(e=>e.name);t.set(i,{extent:s,gebiete:c})}}}return t}function Ss(e,t){for(let n=e.length-1;n>=0;--n)if(e[n]<=t+1e-9)return n;return 0}function Cs(e,t,n){let r=n.widthPx*t/2,i=n.heightPx*t/2;return{minE:e.easting-r,maxE:e.easting+r,minN:e.northing-i,maxN:e.northing+i}}function ws(e,t,n,r){let i=n[e]*r,a=Math.floor(t.minE/i),o=Math.ceil(t.maxE/i)-1,s=Math.floor(t.minN/i),c=Math.ceil(t.maxN/i)-1,l=[];for(let t=a;t<=o;t+=1)for(let n=s;n<=c;n+=1)l.push({id:`${e}/${t}/${n}`});return l}function Ts(e){if(e<1e3)return`${Math.round(e)} m`;let t=Math.round(e/1e3*10)/10;return Number.isInteger(t)?`${t} km`:`${t.toFixed(1).replace(`.`,`,`)} km`}function Es(e,t){if(!e)return null;let n=Math.hypot(t.easting-e.easting,t.northing-e.northing);return{metres:n,text:Ts(n)}}function Ds(e){return e instanceof DOMException&&e.name===`AbortError`}function Os(e){return typeof e==`object`&&!!e}async function ks(e){let{uebersicht:t,cache:n,marks:r,kacheln:i,config:a}=e,o=xs(t),s=await n.ids(),c=new Set(s),l=new Set(s.filter(e=>o.has(e))),u=await r.read(),d=[];for(let[e,t]of o)t.gebiete.includes(`Hessen`)&&d.push(e);function f(){let e=0;for(let t of d)l.has(t)&&(e+=1);return e}let p={...e.viewport},m=e.online??!1,h=e.appOpen??!0,g=Os(e.standort)?{...e.standort}:null,_=g!==null,v=!1,y=!1,b=oe(u.ziele),x=u.downloadKnopf===!0,S=null,C={gitter:`32U MA`,rechtswert:``,hochwert:``},w=[],T=null,E=null,D=!1,O=new Map,k=new Set,ee=new Set;function te(e){let t=Zo(p,a);return Math.min(Math.max(e,a.minResolutionMeters),t)}function ne(){let e=1/0,t=1/0,n=-1/0,r=-1/0,i=!1;for(let a of l){let s=o.get(a);s&&(i=!0,e=Math.min(e,s.extent.minE),t=Math.min(t,s.extent.minN),n=Math.max(n,s.extent.maxE),r=Math.max(r,s.extent.maxN))}return i?{easting:(e+n)/2,northing:(t+r)/2}:null}let re=g?{...g}:ne()??bs(t.blaetter),ie=te(a.openResolutionMeters);function A(){for(let e of ee)e()}function ae(){r.write({heruntergeladen:[],ziele:b.map(e=>e.koordinate),downloadKnopf:x})}function oe(e){let n=[];for(let r of e){let e=/^(\d{1,2}[C-HJ-NP-X] [A-HJ-NP-Z]{2}) (\d{5}) (\d{5})$/.exec(r);if(!e)continue;let i=gs({gitter:e[1],rechtswert:e[2],hochwert:e[3]},e=>t.blaetter.some(t=>ys(t,e)));i.ok&&i.koordinate===r&&n.push({koordinate:r,point:i.point})}return n}function j(){let e=Cs(re,ie,p),n=Ss(t.resolutions,ie),r=[];for(let i of ws(n,e,t.resolutions,t.tileSizePx)){if(!o.has(i.id)){r.push({id:i.id,appearance:`blank-unknown`});continue}if(l.has(i.id)){r.push({id:i.id,appearance:`drawn`});continue}let e=h&&m&&!k.has(i.id)&&(w.includes(i.id)||O.has(i.id));r.push({id:i.id,appearance:e?`blank-downloading`:`blank-not-on-device`})}return r.sort((e,t)=>e.id.localeCompare(t.id,`en`)),r}function se(){D=!1}function ce(){if(D){w=[];return}let e=Cs(re,ie,p),n=ws(Ss(t.resolutions,ie),e,t.resolutions,t.tileSizePx).map(e=>e.id).filter(e=>o.has(e));for(let e of k)n.includes(e)||k.delete(e);let r=[],i=new Set,a=e=>{i.has(e)||l.has(e)||(i.add(e),r.push(e))};for(let e of n)a(e);if(T)for(let e of T)a(e);if(E)for(let e of E)a(e);w=r,le()}function le(){if(!h||!m||O.size>=1)return;let e=w.find(e=>!l.has(e)&&!k.has(e)&&!O.has(e));e&&ue(e)}async function ue(e){let t=new AbortController;O.set(e,t),A();try{let r=await i.fetch(e,t.signal);if(t.signal.aborted)return;l.add(e),c.add(e),await n.put(e,r),T?.every(e=>l.has(e))&&(T=null),E?.every(e=>l.has(e))&&(E=null)}catch(t){Ds(t)||k.add(e)}finally{O.get(e)===t&&O.delete(e),ce(),A()}}function M(e){for(let[t,n]of O)e(t)&&(O.delete(t),n.abort())}function de(){let e=j(),t=!m&&e.some(e=>e.appearance===`blank-not-on-device`),n=S??(t?_s:null);return{center:{...re},resolution:ie,northUp:!0,ziele:b.map(e=>({koordinate:e.koordinate,point:{...e.point},entfernung:Es(g,e.point)})),standort:g?{...g}:null,notice:n,koordinate:{...C},downloadKnopf:x,hessen:{arrived:f(),total:d.length},visit:fe(),kacheln:e}}function N(){let e=[],t=new Set;for(let n of T??[])t.has(n)||(t.add(n),e.push(n));for(let n of E??[])t.has(n)||(t.add(n),e.push(n));return e}function fe(){let e=N();if(e.length===0)return null;let t=0;for(let n of e)l.has(n)&&(t+=1);return{arrived:t,total:e.length}}function P(e){let n=[],r=new Set;for(let i=0;iee.delete(e)},setViewport(e){se(),p={...e},ie=te(ie),ce(),A()},panTo(e){se(),v=!0,re={...e},ce(),A()},zoomTo(e){se(),ie=te(e),ce(),A()},reportStandort(e){h&&(e===`denied`?(g=null,A()):(g={...e},!_&&!v&&!y&&(se(),re={...e},ie=te(a.openResolutionMeters),ce()),_=!0,A()))},setAppOpen(e){h=e,e?(se(),k.clear(),ce()):(T=null,E=null,M(()=>!0)),A()},setOnline(e){m=e,e?(se(),k.clear(),ce()):M(()=>!0),A()},tap(e){let n=44*ie,r=-1,i=1/0;for(let t=0;t=0){b=b.filter((e,t)=>t!==r),ae(),A();return}let a=hs(e);if(!a)return;let o=gs(a,e=>t.blaetter.some(t=>ys(t,e)));o.ok&&(b.some(e=>e.koordinate===o.koordinate)?(S=`Diese Koordinate ist schon ein Ziel.`,A()):(S=null,b=[{koordinate:o.koordinate,point:o.point},...b],y=!0,ae(),A()))},enterKoordinate(e){let n=gs(e,e=>t.blaetter.some(t=>ys(t,e)));n.ok?b.some(e=>e.koordinate===n.koordinate)?(S=`Diese Koordinate ist schon ein Ziel.`,A()):(S=null,C={gitter:e.gitter,rechtswert:e.rechtswert,hochwert:e.hochwert},b=[{koordinate:n.koordinate,point:n.point},...b],y=!0,se(),re={...n.point},ie=te(a.openResolutionMeters),ae(),ce(),A()):(S=n.notice,A())},deleteZiel(e){let t=b.filter(t=>t.koordinate!==e);t.length!==b.length&&(b=t,ae(),A())},setDownloadKnopf(e){x=e,ae(),A()},centerOnStandort(){g&&(se(),v=!0,re={...g},ie=te(a.openResolutionMeters),ce(),A())},centerOnZiel(e){let t=b.find(t=>t.koordinate===e);t&&(se(),v=!0,re={...t.point},ie=te(a.openResolutionMeters),ce(),A())},startHessen(){if(T)return;let e=d.filter(e=>!l.has(e));e.length!==0&&(se(),T=e,ce(),A())},downloadView(){if(E)return;let e=P(Cs(re,ie,p)).filter(e=>!l.has(e));e.length!==0&&(se(),E=e,ce(),A())},deleteCache(){D=!0,T=null,E=null,M(()=>!0);let e=[...c];l.clear(),c.clear(),k.clear(),w=[],n.delete(e),A()}};return h&&m&&ce(),pe}function As(e,t){e.replaceChildren();let n=document.createElement(`div`);n.className=`boot-failure`,n.setAttribute(`role`,`alert`);let r=document.createElement(`p`);r.className=`boot-error`,r.textContent=`Die Karte konnte nicht geöffnet werden.`;let i=document.createElement(`p`);i.className=`boot-detail`,i.textContent=v(t);let a=document.createElement(`p`);a.textContent=`Die gespeicherten Kacheln bleiben auf dem Gerät.`;let o=document.createElement(`button`);o.type=`button`,o.className=`secondary`,o.textContent=`Karte neu starten`,n.append(r,i,a,o);let s=null;b()&&(s=document.createElement(`button`),s.type=`button`,s.className=`secondary`,s.textContent=`Gespeicherte Kacheln löschen`,n.append(s)),e.append(n);let c=y(),l=()=>[o,s].filter(e=>e!==null);o.addEventListener(`click`,()=>{u(async()=>{x(),await g(c),location.reload()})}),s?.addEventListener(`click`,()=>{u(async()=>{await g(c),await _(c),location.reload()})});async function u(e){for(let e of l())e.disabled=!0;try{await e()}catch(e){i.textContent=v(e);for(let e of l())e.disabled=!1}}}var js={ADD:`add`,REMOVE:`remove`},Ms={PROPERTYCHANGE:`propertychange`};function Ns(e){for(let t in e)delete e[t]}function Ps(e){let t;for(t in e)return!1;return!t}function L(e,t,n,r,i){if(i){let i=n;n=function(a){return e.removeEventListener(t,n),i.call(r??this,a)}}else r&&r!==e&&(n=n.bind(r));let a={target:e,type:t,listener:n};return e.addEventListener(t,n),a}function Fs(e,t,n,r){return L(e,t,n,r,!0)}function R(e){e&&e.target&&(e.target.removeEventListener(e.type,e.listener),Ns(e))}var z={CHANGE:`change`,ERROR:`error`,BLUR:`blur`,CLEAR:`clear`,CONTEXTMENU:`contextmenu`,CLICK:`click`,DBLCLICK:`dblclick`,DRAGENTER:`dragenter`,DRAGOVER:`dragover`,DROP:`drop`,FOCUS:`focus`,KEYDOWN:`keydown`,KEYPRESS:`keypress`,KEYUP:`keyup`,LOAD:`load`,RESIZE:`resize`,TOUCHMOVE:`touchmove`,WHEEL:`wheel`},Is=class{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}};function Ls(e,t,n){let r,i;n||=Rs;let a=0,o=e.length,s=!1;for(;a>1),i=+n(e[r],t),i<0?a=r+1:(o=r,s=!i);return s?a:~a}function Rs(e,t){return e>t?1:et?-1:0}function Bs(e,t,n){if(e[0]<=t)return 0;let r=e.length;if(t<=e[r-1])return r-1;if(typeof n==`function`){for(let i=1;i0?i-1:i}return r-1}if(n>0){for(let n=1;n0||n&&a===0)})}function B(){throw Error(`Unimplemented abstract method.`)}var Gs=0;function V(e){let t=e;return t.ol_uid||=String(++Gs)}function Ks(e){return!!e&&typeof e.then==`function`&&typeof e.catch==`function`}function qs(){return!0}function Js(){return!1}function Ys(){}function Xs(e){let t,n,r;return function(){let i=Array.prototype.slice.call(arguments);return(!n||this!==r||!Us(i,n))&&(r=this,n=i,t=e.apply(this,i)),t}}function Zs(e){function t(){let t;try{t=e()}catch(e){return Promise.reject(e)}return Ks(t)?t:Promise.resolve(t)}return t()}var Qs=class{constructor(e){this.propagationStopped,this.defaultPrevented,this.type=e,this.target=null}preventDefault(){this.defaultPrevented=!0}stopPropagation(){this.propagationStopped=!0}},$s=class extends Is{constructor(e){super(),this.eventTarget_=e,this.pendingRemovals_=null,this.dispatching_=null,this.listeners_=null}addEventListener(e,t){if(!e||!t)return;let n=this.listeners_||={},r=n[e]||(n[e]=[]);r.includes(t)||r.push(t)}dispatchEvent(e){let t=typeof e==`string`,n=t?e:e.type,r=this.listeners_&&this.listeners_[n];if(!r)return;let i=t?new Qs(e):e;i.target||=this.eventTarget_||this;let a=this.dispatching_||={},o=this.pendingRemovals_||={};n in a||(a[n]=0,o[n]=0),++a[n];let s;for(let e=0,t=r.length;e0:!1}removeEventListener(e,t){if(!this.listeners_)return;let n=this.listeners_[e];if(!n)return;let r=n.indexOf(t);r!==-1&&(this.pendingRemovals_&&e in this.pendingRemovals_?(n[r]=Ys,++this.pendingRemovals_[e]):(n.splice(r,1),n.length===0&&delete this.listeners_[e]))}},ec=class extends $s{constructor(){super(),this.on=this.onInternal,this.once=this.onceInternal,this.un=this.unInternal,this.revision_=0}changed(){++this.revision_,this.dispatchEvent(z.CHANGE)}getRevision(){return this.revision_}onInternal(e,t){if(Array.isArray(e)){let n=e.length,r=Array(n);for(let i=0;i0;)this.pop()}extend(e){for(let t=0,n=e.length;tthis.getLength())throw Error(`Index out of bounds: `+e);this.unique_&&this.assertUnique_(t),this.array_.splice(e,0,t),this.updateLength_(),this.dispatchEvent(new ac(js.ADD,t,e))}pop(){return this.removeAt(this.getLength()-1)}push(e){let t=this.getLength();return this.insertAt(t,e),this.getLength()}remove(e){let t=this.array_;for(let n=0,r=t.length;n=this.getLength())return;let t=this.array_[e];return this.array_.splice(e,1),this.updateLength_(),this.dispatchEvent(new ac(js.REMOVE,t,e)),t}setAt(e,t){if(e>=this.getLength()){this.insertAt(e,t);return}if(e<0)throw Error(`Index out of bounds: `+e);this.unique_&&this.assertUnique_(t,e);let n=this.array_[e];this.array_[e]=t,this.dispatchEvent(new ac(js.REMOVE,n,e)),this.dispatchEvent(new ac(js.ADD,t,e))}updateLength_(){this.set(ic.LENGTH,this.array_.length)}assertUnique_(e,t){let n=this.array_;for(let r=0,i=n.length;r{this.clickTimeoutId_=void 0;let t=new cc(lc.SINGLECLICK,this.map_,e);this.dispatchEvent(t)},250):(clearTimeout(this.clickTimeoutId_),this.clickTimeoutId_=void 0,t=new cc(lc.DBLCLICK,this.map_,e),this.dispatchEvent(t))}updateActivePointers_(e){let t=e,n=t.pointerId;if(t.type==lc.POINTERUP||t.type==lc.POINTERCANCEL){delete this.trackedTouches_[n];for(let e in this.trackedTouches_)if(this.trackedTouches_[e].target!==t.target){delete this.trackedTouches_[e];break}}else(t.type==lc.POINTERDOWN||t.type==lc.POINTERMOVE)&&(this.trackedTouches_[n]=t);this.activePointers_=Object.values(this.trackedTouches_)}handlePointerUp_(e){this.updateActivePointers_(e);let t=new cc(lc.POINTERUP,this.map_,e,void 0,void 0,this.activePointers_);this.dispatchEvent(t),this.emulateClicks_&&!t.defaultPrevented&&!this.dragging_&&this.isMouseActionButton_(e)&&this.down_&&this.emulateClick_(this.down_),this.activePointers_.length===0&&(this.dragListenerKeys_.forEach(R),this.dragListenerKeys_.length=0,this.dragging_=!1,this.down_=null)}isMouseActionButton_(e){return e.button===0}handlePointerDown_(e){this.emulateClicks_=this.activePointers_.length===0,this.updateActivePointers_(e);let t=new cc(lc.POINTERDOWN,this.map_,e,void 0,void 0,this.activePointers_);if(this.dispatchEvent(t),this.down_=new PointerEvent(e.type,e),Object.defineProperty(this.down_,"target",{writable:!1,value:e.target}),this.dragListenerKeys_.length===0){let e=this.map_.getOwnerDocument(),t=this.element_;if(!t)return;if(this.dragListenerKeys_.push(L(e,lc.POINTERMOVE,this.handlePointerMove_,this),L(e,lc.POINTERUP,this.handlePointerUp_,this),L(t,lc.POINTERCANCEL,this.handlePointerUp_,this)),t.getRootNode&&t.getRootNode()!==e){let e=t.getRootNode();this.dragListenerKeys_.push(L(e,lc.POINTERUP,this.handlePointerUp_,this))}}}handlePointerMove_(e){if(this.isMoving_(e)){this.updateActivePointers_(e),this.dragging_=!0;let t=new cc(lc.POINTERDRAG,this.map_,e,this.dragging_,void 0,this.activePointers_);this.dispatchEvent(t)}}relayMoveEvent_(e){this.originalPointerMoveEvent_=e;let t=!!(this.down_&&this.isMoving_(e));this.dispatchEvent(new cc(lc.POINTERMOVE,this.map_,e,t))}handleTouchMove_(e){let t=this.originalPointerMoveEvent_;(!t||t.defaultPrevented)&&(typeof e.cancelable!=`boolean`||e.cancelable===!0)&&e.preventDefault()}isMoving_(e){let t=this.down_;return this.dragging_||t!==null&&(Math.abs(e.clientX-t.clientX)>this.moveTolerance_||Math.abs(e.clientY-t.clientY)>this.moveTolerance_)}disposeInternal(){let e=this.element_;this.relayedListenerKey_&&=(R(this.relayedListenerKey_),void 0),e&&e.removeEventListener(z.TOUCHMOVE,this.boundHandleTouchMove_),this.pointerdownListenerKey_&&=(R(this.pointerdownListenerKey_),void 0),this.dragListenerKeys_.forEach(R),this.dragListenerKeys_.length=0,this.element_=void 0,super.disposeInternal()}},yc={POSTRENDER:`postrender`,MOVESTART:`movestart`,MOVEEND:`moveend`,LOADSTART:`loadstart`,LOADEND:`loadend`},bc={LAYERGROUP:`layergroup`,SIZE:`size`,TARGET:`target`,VIEW:`view`},H={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};function U(e,t){if(!e)throw Error(t)}var xc=1/0,Sc=class{constructor(e,t){this.priorityFunction_=e,this.keyFunction_=t,this.elements_=[],this.priorities_=[],this.queuedElements_={}}clear(){this.elements_.length=0,this.priorities_.length=0,Ns(this.queuedElements_)}dequeue(){let e=this.elements_,t=this.priorities_,n=e[0];e.length==1?(e.length=0,t.length=0):(e[0]=e.pop(),t[0]=t.pop(),this.siftUp_(0));let r=this.keyFunction_(n);return delete this.queuedElements_[r],n}enqueue(e){U(!(this.keyFunction_(e)in this.queuedElements_),"Tried to enqueue an `element` that was already added to the queue");let t=this.priorityFunction_(e);return t!=1/0&&(this.elements_.push(e),this.priorities_.push(t),this.queuedElements_[this.keyFunction_(e)]=!0,this.siftDown_(0,this.elements_.length-1),!0)}getCount(){return this.elements_.length}getLeftChildIndex_(e){return e*2+1}getRightChildIndex_(e){return e*2+2}getParentIndex_(e){return e-1>>1}heapify_(){let e;for(e=(this.elements_.length>>1)-1;e>=0;e--)this.siftUp_(e)}isEmpty(){return this.elements_.length===0}isKeyQueued(e){return e in this.queuedElements_}isQueued(e){return this.isKeyQueued(this.keyFunction_(e))}siftUp_(e){let t=this.elements_,n=this.priorities_,r=t.length,i=t[e],a=n[e],o=e;for(;e>1;){let i=this.getLeftChildIndex_(e),a=this.getRightChildIndex_(e),o=ae;){let e=this.getParentIndex_(t);if(r[e]>a)n[t]=n[e],r[t]=r[e],t=e;else break}n[t]=i,r[t]=a}reprioritize(){let e=this.priorityFunction_,t=this.elements_,n=this.priorities_,r=0,i=t.length,a,o,s;for(o=0;oe.apply(null,t),e=>e[0].getKey()),this.boundHandleTileChange_=this.handleTileChange.bind(this),this.tileChangeCallback_=t,this.tilesLoading_=0,this.tilesLoadingKeys_={}}enqueue(e){let t=super.enqueue(e);return t&&e[0].addEventListener(z.CHANGE,this.boundHandleTileChange_),t}getTilesLoading(){return this.tilesLoading_}handleTileChange(e){let t=e.target,n=t.getState();if(n===H.LOADED||n===H.ERROR||n===H.EMPTY){n!==H.ERROR&&t.removeEventListener(z.CHANGE,this.boundHandleTileChange_);let e=t.getKey();e in this.tilesLoadingKeys_&&(delete this.tilesLoadingKeys_[e],--this.tilesLoading_),this.tileChangeCallback_()}}loadMoreTiles(e,t){let n=0;for(;this.tilesLoading_0;){let e=this.dequeue()[0],t=e.getKey();e.getState()===H.IDLE&&!(t in this.tilesLoadingKeys_)&&(this.tilesLoadingKeys_[t]=!0,++this.tilesLoading_,++n,e.load())}}};function wc(e,t,n,r,i){if(!e||!(n in e.wantedTiles)||!e.wantedTiles[n][t.getKey()])return xc;let a=e.viewState.center,o=r[0]-a[0],s=r[1]-a[1];return 65536*Math.log(i)+Math.sqrt(o*o+s*s)/i}var Tc={ANIMATING:0,INTERACTING:1},Ec={CENTER:`center`,RESOLUTION:`resolution`,ROTATION:`rotation`};function W(e,t,n){return Math.min(Math.max(e,t),n)}function Dc(e,t,n,r,i,a){let o=i-n,s=a-r;if(o!==0||s!==0){let c=((e-n)*o+(t-r)*s)/(o*o+s*s);c>1?(n=i,r=a):c>0&&(n+=o*c,r+=s*c)}return Oc(e,t,n,r)}function Oc(e,t,n,r){let i=n-e,a=r-t;return i*i+a*a}function kc(e){let t=e.length;for(let n=0;ni&&(i=t,r=a)}if(i===0)return null;let a=e[r];e[r]=e[n],e[n]=a;for(let r=n+1;r=0;r--){n[r]=e[r][t]/e[r][r];for(let i=r-1;i>=0;i--)e[i][t]-=e[i][r]*n[r]}return n}function Ac(e){return e*180/Math.PI}function jc(e){return e*Math.PI/180}function Mc(e,t){let n=e%t;return n*t<0?n+t:n}function Nc(e,t,n){return e+n*(t-e)}function Pc(e,t){let n=10**t;return Math.round(e*n)/n}function Fc(e,t){return Math.floor(Pc(e,t))}function Ic(e,t){return Math.ceil(Pc(e,t))}function Lc(e,t,n){if(e>=t&&ep&&(f=(p+f)/2,p=f),m>h&&(m=(h+m)/2,h=m);let g=W(r[0],f,p),_=W(r[1],m,h);if(o&&n&&i){let e=30*i;g+=-e*Math.log(1+Math.max(0,f-r[0])/e)+e*Math.log(1+Math.max(0,r[0]-p)/e),_+=-e*Math.log(1+Math.max(0,m-r[1])/e)+e*Math.log(1+Math.max(0,r[1]-h)/e)}return[g,_]})}function zc(e){return e}var Bc={UNKNOWN:0,INTERSECTING:1,ABOVE:2,RIGHT:4,BELOW:8,LEFT:16};function Vc(e){let t=Yc();for(let n=0,r=e.length;ni&&(c|=Bc.RIGHT),sa&&(c|=Bc.ABOVE),c===Bc.UNKNOWN&&(c=Bc.INTERSECTING),c}function Yc(){return[1/0,1/0,-1/0,-1/0]}function Xc(e,t,n,r,i){return i?(i[0]=e,i[1]=t,i[2]=n,i[3]=r,i):[e,t,n,r]}function Zc(e){return Xc(1/0,1/0,-1/0,-1/0,e)}function Qc(e,t){let n=e[0],r=e[1];return Xc(n,r,n,r,t)}function $c(e,t,n,r,i){return rl(Zc(i),e,t,n,r)}function el(e,t){return e[0]==t[0]&&e[2]==t[2]&&e[1]==t[1]&&e[3]==t[3]}function tl(e,t){return t[0]e[2]&&(e[2]=t[2]),t[1]e[3]&&(e[3]=t[3]),e}function nl(e,t){t[0]e[2]&&(e[2]=t[0]),t[1]e[3]&&(e[3]=t[1])}function rl(e,t,n,r,i){for(;nt[0]?e[0]:t[0],r[1]=e[1]>t[1]?e[1]:t[1],r[2]=e[2]n&&u.push([n,r,o,a]),cr&&u.push([o,r,c,s]),l=t[0]&&e[1]<=t[3]&&e[3]>=t[1]}function yl(e){return e[2]=o&&h<=c),!r&&a&Bc.RIGHT&&!(i&Bc.RIGHT)&&(g=p-(f-c)*m,r=g>=s&&g<=l),!r&&a&Bc.BELOW&&!(i&Bc.BELOW)&&(h=f-(p-s)/m,r=h>=o&&h<=c),!r&&a&Bc.LEFT&&!(i&Bc.LEFT)&&(g=p-(f-o)*m,r=g>=s&&g<=l)}return r}function Sl(e,t){let n=t.getExtent(),r=ll(e);if(t.canWrapX()&&(r[0]=n[2])){let t=G(n),i=Math.floor((r[0]-n[0])/t)*t;e[0]-=i,e[2]-=i}return e}function Cl(e,t,n){if(t.canWrapX()){let r=t.getExtent();if(!isFinite(e[0])||!isFinite(e[2]))return[[r[0],e[1],r[2],e[3]]];Sl(e,t);let i=G(r);if(G(e)>i&&!n)return[[r[0],e[1],r[2],e[3]]];if(e[0]r[2])return[[e[0],e[1],r[2],e[3]],[r[0],e[1],e[2]-i,e[3]]]}return[e]}function wl(e,t){let n=[e];for(let e=0,r=t.length;e0;++e){let r=[];for(let i=0,a=n.length;i=0;--r)if(e[r]!=t[r]){n=!1;break}return n}function Dl(e,t){let n=Math.cos(t),r=Math.sin(t),i=e[0]*n-e[1]*r,a=e[1]*n+e[0]*r;return e[0]=i,e[1]=a,e}function Ol(e,t){return e[0]*=t,e[1]*=t,e}function kl(e,t){if(t.canWrapX()){let n=G(t.getExtent()),r=jl(e,t,n);r&&(e[0]-=r*n)}return e}function Al(e,t,n){if(t.canWrapX()){let r=G(t.getExtent()),i=Math.round((n-e[0])/r);i!==0&&(e[0]+=i*r)}return e}function jl(e,t,n){let r=t.getExtent(),i=0;return t.canWrapX()&&(e[0]r[2])&&(n||=G(r),i=Math.floor((e[0]-r[0])/n)),i}function Ml(e,t,n){let r=Math.sqrt((t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])),i=[(t[0]-e[0])/r,(t[1]-e[1])/r],a=[-i[1],i[0]],o=Math.sqrt((n[0]-e[0])*(n[0]-e[0])+(n[1]-e[1])*(n[1]-e[1])),s=[(n[0]-e[0])/o,(n[1]-e[1])/o],c=r===0||o===0?0:Math.acos(W(s[0]*i[0]+s[1]*i[1],-1,1));return c=Math.max(c,1e-5),s[0]*a[0]+s[1]*a[1]>0?c:Math.PI*2-c}function Nl(e){return e**3}function Pl(e){return 1-Nl(1-e)}function Fl(e){return 3*e*e-2*e*e*e}function Il(e){return e}function Ll(e,t,n){n||=6371008.8;let r=jc(e[1]),i=jc(t[1]),a=(i-r)/2,o=jc(t[0]-e[0])/2,s=Math.sin(a)*Math.sin(a)+Math.sin(o)*Math.sin(o)*Math.cos(r)*Math.cos(i);return 2*n*Math.atan2(Math.sqrt(s),Math.sqrt(1-s))}var Rl={info:1,warn:2,error:3,none:4},zl=Rl.info;function Bl(...e){zl>Rl.warn||console.warn(...e)}var Vl={radians:6370997/(2*Math.PI),degrees:2*Math.PI*6370997/360,ft:.3048,m:1,"us-ft":1200/3937},Hl=class{constructor(e){this.code_=e.code,this.units_=e.units,this.extent_=e.extent===void 0?null:e.extent,this.worldExtent_=e.worldExtent===void 0?null:e.worldExtent,this.axisOrientation_=e.axisOrientation===void 0?`enu`:e.axisOrientation,this.global_=e.global!==void 0&&e.global,this.canWrapX_=!!(this.global_&&this.extent_),this.getPointResolutionFunc_=e.getPointResolution,this.defaultTileGrid_=null,this.metersPerUnit_=e.metersPerUnit}canWrapX(){return this.canWrapX_}getCode(){return this.code_}getExtent(){return this.extent_}getUnits(){return this.units_}getMetersPerUnit(){return this.metersPerUnit_||Vl[this.units_]}getWorldExtent(){return this.worldExtent_}getAxisOrientation(){return this.axisOrientation_}isGlobal(){return this.global_}setGlobal(e){this.global_=e,this.canWrapX_=!!(e&&this.extent_)}getDefaultTileGrid(){return this.defaultTileGrid_}setDefaultTileGrid(e){this.defaultTileGrid_=e}setExtent(e){this.extent_=e,this.canWrapX_=!!(this.global_&&e)}setWorldExtent(e){this.worldExtent_=e}setGetPointResolution(e){this.getPointResolutionFunc_=e}getPointResolutionFunc(){return this.getPointResolutionFunc_}},Ul=6378137,Wl=Math.PI*Ul,Gl=[-Wl,-Wl,Wl,Wl],Kl=[-180,-85,180,85],ql=Ul*Math.log(Math.tan(Math.PI/2)),Jl=class extends Hl{constructor(e){super({code:e,units:`m`,extent:Gl,global:!0,worldExtent:Kl,getPointResolution:function(e,t){return e/Math.cosh(t[1]/Ul)}})}},Yl=[new Jl(`EPSG:3857`),new Jl(`EPSG:102100`),new Jl(`EPSG:102113`),new Jl(`EPSG:900913`),new Jl(`http://www.opengis.net/def/crs/EPSG/0/3857`),new Jl(`http://www.opengis.net/gml/srs/epsg.xml#3857`)];function Xl(e,t,n,r){let i=e.length;n=n!==void 0&&n>1?n:2,r??=n,t===void 0&&(t=n>2?e.slice():Array(i));for(let n=0;nql?r=ql:r<-ql&&(r=-ql),t[n+1]=r}return t}function Zl(e,t,n,r){let i=e.length;n=n!==void 0&&n>1?n:2,r??=n,t===void 0&&(t=n>2?e.slice():Array(i));for(let n=0;nju&&(t=ju);let r=jc(t),i=Math.sin(r),a=Math.cos(r),o=i/a,s=o*o,c=s*s,l=jc(e),u=jc(Fu(n.number)),d=Ou/Math.sqrt(1-uu*i**2),f=pu*a**2,p=a*Lc(l-u,-Math.PI,Math.PI),m=p*p,h=m*p,g=h*p,_=g*p,v=_*p,y=Ou*(bu*r-xu*Math.sin(2*r)+Su*Math.sin(4*r)-Cu*Math.sin(6*r)),b=lu*d*(p+h/6*(1-s+f)+_/120*(5-18*s+c+72*f-58*pu))+5e5,x=lu*(y+d*o*(m/2+g/24*(5-s+9*f+4*f**2)+v/720*(61-58*s+c+600*f-330*pu)));return n.north||(x+=1e7),[b,x]}function Fu(e){return(e-1)*6-180+3}var Iu=[/^EPSG:(\d+)$/,/^urn:ogc:def:crs:EPSG::(\d+)$/,/^http:\/\/www\.opengis\.net\/def\/crs\/EPSG\/0\/(\d+)$/];function Lu(e){let t=0;for(let n of Iu){let r=e.match(n);if(r){t=parseInt(r[1]);break}}if(!t)return null;let n=0,r=!1;return t>32700&&t<32761?n=t-32700:t>32600&&t<32661&&(r=!0,n=t-32600),n?{number:n,north:r}:null}function Ru(e,t){return function(n,r,i,a){let o=n.length;i=i!==void 0&&i>1?i:2,a??=i,r||=i>2?n.slice():Array(o);for(let i=0;i=s?t[o+e]:a[e]}return n})}function ed(e,t,n,r){let i=Ju(e),a=Ju(t);i&&a&&(su(i,a,$u(n)),su(a,i,$u(r)))}function td(e,t){if(e===t)return!0;let n=e.getUnits()===t.getUnits();return(e.getCode()===t.getCode()||nd(e,t)===Gu)&&n}function nd(e,t){if(!e||!t)return null;let n=e.getCode(),r=t.getCode(),i=cu(n,r);if(i)return i;let a=null,o=null;for(let n of Vu)a||=n(e),o||=n(t);if(!a&&!o)return null;let s=`EPSG:4326`;if(!o&&a){let e=cu(s,r);e&&(i=rd(a.inverse,e))}else if(!a&&o){let e=cu(n,s);e&&(i=rd(e,o.forward))}else a&&o&&(i=rd(a.inverse,o.forward));return i&&(Ku(e),Ku(t),su(e,t,i)),i}function rd(e,t){return function(n,r,i,a){return r=e(n,r,i,a),t(r,r,i,a)}}function id(e,t){return nd(Ju(e),Ju(t))}function ad(e,t,n){let r=id(t,n);if(!r){let e=Ju(t)?.getCode()??String(t),r=Ju(n)?.getCode()??String(n);throw Error(`No transform available between ${e} and ${r}`)}return r(e,void 0,e.length)}var od=null;function sd(){return od}function cd(e,t){return e}function ld(e,t){return Uu&&!El(e,[0,0])&&e[0]>=-180&&e[0]<=180&&e[1]>=-90&&e[1]<=90&&(Uu=!1,Bl(`Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.`)),e}function ud(e,t){return e}function dd(e,t){return e}function fd(e,t){return e}function pd(e,t,n){return function(r){let i,a;if(e.canWrapX()){let t=e.getExtent(),o=G(t);r=r.slice(0),a=jl(r,e,o),a&&(r[0]-=a*o),r[0]=W(r[0],t[0],t[2]),r[1]=W(r[1],t[1],t[3]),i=n(r)}else i=n(r);return a&&t.canWrapX()&&(i[0]+=a*G(t.getExtent())),i}}function md(){Xu(Yl),Xu(nu),Zu(nu,Yl,Xl,Zl)}md();var hd=[1,0,0,1,0,0];function gd(){return hd.slice(0)}function _d(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e}function vd(e,t){let n=t[0],r=t[1];return t[0]=e[0]*n+e[2]*r+e[4],t[1]=e[1]*n+e[3]*r+e[5],t}function yd(e,t,n,r,i,a,o,s){let c=Math.sin(a),l=Math.cos(a);return e[0]=r*l,e[1]=i*c,e[2]=-r*c,e[3]=i*l,e[4]=o*r*l-s*r*c+t,e[5]=o*i*c+s*i*l+n,e}function bd(e,t){let n=xd(t);U(n!==0,`Transformation matrix cannot be inverted`);let r=t[0],i=t[1],a=t[2],o=t[3],s=t[4],c=t[5];return e[0]=o/n,e[1]=-i/n,e[2]=-a/n,e[3]=r/n,e[4]=(a*c-o*s)/n,e[5]=-(r*c-i*s)/n,e}function xd(e){return e[0]*e[3]-e[1]*e[2]}var Sd=[1e5,1e5,1e5,1e5,2,2];function Cd(e){return`matrix(`+e.join(`, `)+`)`}function wd(e){return e.substring(7,e.length-1).split(`,`).map(parseFloat)}function Td(e,t){let n=wd(e),r=wd(t);for(let e=0;e<6;++e)if(Math.round((n[e]-r[e])*Sd[e])!==0)return!1;return!0}function Ed(e,t,n,r,i,a,o){a||=[],o||=2;let s=0;for(let c=t;c{if(!n)return this.getSimplifiedGeometry(t);let r=this.clone();return r.applyTransform(n),r.getSimplifiedGeometry(t)})}simplifyTransformed(e,t){return this.simplifyTransformedInternal(this.getRevision(),e,t)}clone(){return B()}closestPointXY(e,t,n,r){return B()}containsXY(e,t){return this.closestPointXY(e,t,jd,Number.MIN_VALUE)===0}getClosestPoint(e,t){return t||=[NaN,NaN],this.closestPointXY(e[0],e[1],t,1/0),t}intersectsCoordinate(e){return this.containsXY(e[0],e[1])}computeExtent(e){return B()}getExtent(e){if(this.extentRevision_!=this.getRevision()){let e=this.computeExtent(this.extent_);(isNaN(e[0])||isNaN(e[1]))&&Zc(e),this.extentRevision_=this.getRevision()}return bl(this.extent_,e)}rotate(e,t){B()}scale(e,t,n){B()}simplify(e){return this.getSimplifiedGeometry(e*e)}getSimplifiedGeometry(e){return B()}getType(){return B()}applyTransform(e){B()}intersectsExtent(e){return B()}translate(e,t){B()}transform(e,t){let n=Ju(e);if(!n)return this;let r=n.getUnits()==`tile-pixels`?function(e,r,i){let a=n.getExtent(),o=n.getWorldExtent(),s=pl(o)/pl(a);yd(Ad,o[0],o[3],s,-s,0,0,0);let c=Ed(e,0,e.length,i,Ad,r),l=id(n,t);return l?l(c,c,i):c}:id(n,t);return r&&this.applyTransform(r),this}},Nd=class extends Md{constructor(){super(),this.layout=`XY`,this.stride=2,this.flatCoordinates}computeExtent(e){return $c(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e)}getCoordinates(){return B()}getFirstCoordinate(){return this.flatCoordinates.slice(0,this.stride)}getFlatCoordinates(){return this.flatCoordinates}getLastCoordinate(){return this.flatCoordinates.slice(this.flatCoordinates.length-this.stride)}getLayout(){return this.layout}getSimplifiedGeometry(e){if(this.simplifiedGeometryRevision!==this.getRevision()&&(this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=this.getRevision()),e<0||this.simplifiedGeometryMaxMinSquaredTolerance!==0&&e<=this.simplifiedGeometryMaxMinSquaredTolerance)return this;let t=this.getSimplifiedGeometryInternal(e);return t.getFlatCoordinates().length1)d=n;else if(f>0){for(let i=0;ii&&(i=s),a=n,o=r}return i}function Vd(e,t,n,r,i){for(let a=0,o=n.length;aa&&(n-s)*(a-c)-(i-s)*(r-c)>0&&o++:r<=a&&(n-s)*(a-c)-(i-s)*(r-c)<0&&o--,s=n,c=r}return o!==0}function Qd(e,t,n,r,i,a){if(n.length===0||!Zd(e,t,n[0],r,i,a))return!1;for(let t=1,o=n.length;t=i[0]&&a[2]<=i[2]||a[1]>=i[1]&&a[3]<=i[3]||$d(e,t,n,r,function(e,t){return xl(i,e,t)}):!1}function tf(e,t,n,r,i){return!!(ef(e,t,n,r,i)||Zd(e,t,n,r,i[0],i[1])||Zd(e,t,n,r,i[0],i[3])||Zd(e,t,n,r,i[2],i[1])||Zd(e,t,n,r,i[2],i[3]))}function nf(e,t,n,r,i){if(!tf(e,t,n[0],r,i))return!1;if(n.length===1)return!0;for(let t=1,a=n.length;t0;){let n=l.pop(),a=l.pop(),o=0,s=e[a],d=e[a+1],f=e[n],p=e[n+1];for(let t=a+r;to&&(u=t,o=i)}o>i&&(c[(u-t)/r]=1,a+r0&&m>f)&&(p<0&&h0&&h>p)?(l=n,u=d):(a[o++]=l,a[o++]=u,s=l,c=u,l=n,u=d)}return a[o++]=l,a[o++]=u,o}function cf(e,t,n,r,i,a,o,s){for(let c=0,l=n.length;c_&&(l=(u+d)/2,Qd(e,t,n,r,l,m)&&(g=l,_=i)),u=d}return isNaN(g)&&(g=i[a]),o?(o.push(g,m,_),o):[g,m,_]}function ff(e,t,n,r,i){let a=[];for(let o=0,s=n.length;o0}function hf(e,t,n,r,i){i=i!==void 0&&i;for(let a=0,o=n.length;au&&d1&&typeof arguments[t-1]==`function`&&(n=arguments[t-1],--t);let r=0;for(;r0}getInteracting(){return this.hints_[Tc.INTERACTING]>0}cancelAnimations(){this.setHint(Tc.ANIMATING,-this.hints_[Tc.ANIMATING]);let e;for(let t=0,n=this.animations_.length;t=0;--n){let r=this.animations_[n],i=!0;for(let n=0,a=r.length;n0?o/a.duration:1;s>=1?(a.complete=!0,s=1):i=!1;let c=a.easing(s);if(a.sourceCenter){let e=a.sourceCenter[0],t=a.sourceCenter[1],n=a.targetCenter[0],r=a.targetCenter[1];this.nextCenter_=a.targetCenter;let i=e+c*(n-e),o=t+c*(r-t);this.targetCenter_=[i,o]}if(a.sourceResolution&&a.targetResolution){let e=c===1?a.targetResolution:a.sourceResolution+c*(a.targetResolution-a.sourceResolution);if(a.anchor){let t=this.getViewportSize_(this.getRotation()),n=this.constraints_.resolution(e,0,t,!0);this.targetCenter_=this.calculateCenterZoom(n,a.anchor)}this.nextResolution_=a.targetResolution,this.targetResolution_=e,this.applyTargetState_(!0)}if(a.sourceRotation!==void 0&&a.targetRotation!==void 0){let e=c===1?Mc(a.targetRotation+Math.PI,2*Math.PI)-Math.PI:a.sourceRotation+c*(a.targetRotation-a.sourceRotation);if(a.anchor){let t=this.constraints_.rotation(e,!0);this.targetCenter_=this.calculateCenterRotate(t,a.anchor)}this.nextRotation_=a.targetRotation,this.targetRotation_=e}if(this.applyTargetState_(!0),t=!0,!a.complete)break}if(i){this.animations_[n]=null,this.setHint(Tc.ANIMATING,-1),this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN;let e=r[0].callback;e&&jf(e,!0)}}this.animations_=this.animations_.filter(Boolean),t&&this.updateAnimationKey_===void 0&&(this.updateAnimationKey_=requestAnimationFrame(this.updateAnimations_.bind(this)))}calculateCenterRotate(e,t){let n,r=this.getCenterInternal();return r!==void 0&&(n=[r[0]-t[0],r[1]-t[1]],Dl(n,e-this.getRotation()),Tl(n,t)),n}calculateCenterZoom(e,t){let n,r=this.getCenterInternal(),i=this.getResolution();return r!==void 0&&i!==void 0&&(n=[t[0]-e*(t[0]-r[0])/i,t[1]-e*(t[1]-r[1])/i]),n}getViewportSize_(e){let t=this.viewportSize_;if(e){let n=t[0],r=t[1];return[Math.abs(n*Math.cos(e))+Math.abs(r*Math.sin(e)),Math.abs(n*Math.sin(e))+Math.abs(r*Math.cos(e))]}return t}setViewportSize(e){this.viewportSize_=Array.isArray(e)?e.slice():[100,100],this.getAnimating()||this.resolveConstraints(0)}getCenter(){let e=this.getCenterInternal();return e&&cd(e,this.getProjection())}getCenterInternal(){return this.get(Ec.CENTER)}getConstraints(){return this.constraints_}getConstrainResolution(){return this.get(`constrainResolution`)}getHints(e){return e===void 0?this.hints_.slice():(e[0]=this.hints_[0],e[1]=this.hints_[1],e)}calculateExtent(e){return ud(this.calculateExtentInternal(e),this.getProjection())}calculateExtentInternal(e){e||=this.getViewportSizeMinusPadding_();let t=this.getCenterInternal();U(t,`The view center is not defined`);let n=this.getResolution();U(n!==void 0,`The view resolution is not defined`);let r=this.getRotation();return U(r!==void 0,`The view rotation is not defined`),dl(t,n,r,e)}getMaxResolution(){return this.maxResolution_}getMinResolution(){return this.minResolution_}getMaxZoom(){return this.getZoomForResolution(this.minResolution_)}setMaxZoom(e){this.applyOptions_(this.getUpdatedOptions_({maxZoom:e}))}getMinZoom(){return this.getZoomForResolution(this.maxResolution_)}setMinZoom(e){this.applyOptions_(this.getUpdatedOptions_({minZoom:e}))}setConstrainResolution(e){this.applyOptions_(this.getUpdatedOptions_({constrainResolution:e}))}getProjection(){return this.projection_}getResolution(){return this.get(Ec.RESOLUTION)}getResolutions(){return this.resolutions_}getResolutionForExtent(e,t){return this.getResolutionForExtentInternal(dd(e,this.getProjection()),t)}getResolutionForExtentInternal(e,t){t||=this.getViewportSizeMinusPadding_();let n=G(e)/t[0],r=pl(e)/t[1];return Math.max(n,r)}getResolutionForValueFunction(e){e||=2;let t=this.getConstrainedResolution(this.maxResolution_),n=this.minResolution_,r=Math.log(t/n)/Math.log(e);return(function(n){return t/e**+(n*r)})}getRotation(){return this.get(Ec.ROTATION)}getValueForResolutionFunction(e){let t=Math.log(e||2),n=this.getConstrainedResolution(this.maxResolution_),r=this.minResolution_,i=Math.log(n/r)/t;return(function(e){return Math.log(n/e)/t/i})}getViewportSizeMinusPadding_(e){let t=this.getViewportSize_(e),n=this.padding_;return n&&(t=[t[0]-n[1]-n[3],t[1]-n[0]-n[2]]),t}getState(){let e=this.getProjection(),t=this.getResolution(),n=this.getRotation(),r=this.getCenterInternal(),i=this.padding_;if(i){let e=this.getViewportSizeMinusPadding_();r=If(r,this.getViewportSize_(),[e[0]/2+i[3],e[1]/2+i[0]],t,n)}return{center:r.slice(0),projection:e===void 0?null:e,resolution:t,nextCenter:this.nextCenter_,nextResolution:this.nextResolution_,nextRotation:this.nextRotation_,rotation:n,zoom:this.getZoom()}}getViewStateAndExtent(){return{viewState:this.getState(),extent:this.calculateExtent()}}getZoom(){let e,t=this.getResolution();return t!==void 0&&(e=this.getZoomForResolution(t)),e}getZoomForResolution(e){let t=this.minZoom_||0,n,r;if(this.resolutions_){let i=Bs(this.resolutions_,e,1);t=i,n=this.resolutions_[i],r=i==this.resolutions_.length-1?2:n/this.resolutions_[i+1]}else n=this.maxResolution_,r=this.zoomFactor_;return t+Math.log(n/e)/Math.log(r)}getResolutionForZoom(e){if(this.resolutions_?.length){if(this.resolutions_.length===1)return this.resolutions_[0];let t=W(Math.floor(e),0,this.resolutions_.length-2),n=this.resolutions_[t]/this.resolutions_[t+1];return this.resolutions_[t]/n**+W(e-t,0,1)}return this.maxResolution_/this.zoomFactor_**+(e-this.minZoom_)}fit(e,t){let n;if(U(Array.isArray(e)||typeof e.getSimplifiedGeometry==`function`,"Invalid extent or geometry provided as `geometry`"),Array.isArray(e))U(!yl(e),"Cannot fit empty extent provided as `geometry`"),n=yf(dd(e,this.getProjection()));else if(e.getType()===`Circle`){let t=dd(e.getExtent(),this.getProjection());n=yf(t),n.rotate(this.getRotation(),ll(t))}else{let t=sd();n=t?e.clone().transform(t,this.getProjection()):e}this.fitInternal(n,t)}rotatedExtentForGeometry(e){let t=this.getRotation(),n=Math.cos(t),r=Math.sin(-t),i=e.getFlatCoordinates(),a=e.getStride(),o=1/0,s=1/0,c=-1/0,l=-1/0;for(let e=0,t=i.length;ee.trim().replace(/^['"]|['"]$/g,``)),n};function Gf(e,t,n,r){let i;return i=n&&n.length?n.shift():mc?new class extends OffscreenCanvas{style={}}(e??300,t??150):document.createElement(`canvas`),e&&(i.width=e),t&&(i.height=t),i.getContext(`2d`,r)}var Kf;function qf(){return Kf||=Gf(1,1),Kf}function Jf(e){let t=e.canvas;t.width=1,t.height=1,e.clearRect(0,0,1,1)}function Yf(e,t){let n=t.parentNode;n&&n.replaceChild(e,t)}function Xf(e){for(;e.lastChild;)e.lastChild.remove()}function Zf(e,t){let n=e.childNodes;for(let r=0;;++r){let i=n[r],a=t[r];if(!i&&!a)break;i!==a&&(i?a?e.insertBefore(a,i):(e.removeChild(i),--r):e.appendChild(a))}}function Qf(){return new Proxy({childNodes:[],appendChild:function(e){return this.childNodes.push(e),e},remove:function(){},removeChild:function(e){let t=this.childNodes.indexOf(e);if(t===-1)throw Error(`Node to remove was not found`);return this.childNodes.splice(t,1),e},insertBefore:function(e,t){let n=this.childNodes.indexOf(t);if(n===-1)throw Error(`Reference node not found`);return this.childNodes.splice(n,0,e),e},style:{}},{get(e,t,n){return t===`firstElementChild`?e.childNodes.length>0?e.childNodes[0]:null:Reflect.get(e,t,n)}})}function $f(e){return typeof HTMLCanvasElement<`u`&&e instanceof HTMLCanvasElement||typeof OffscreenCanvas<`u`&&e instanceof OffscreenCanvas}var ep=class extends rc{constructor(e){super();let t=e.element;t&&!e.target&&!t.style.pointerEvents&&(t.style.pointerEvents=`auto`),this.element=t||null,this.target_=null,this.map_=null,this.listenerKeys=[],e.render&&(this.render=e.render),e.target&&this.setTarget(e.target)}disposeInternal(){this.element?.remove(),super.disposeInternal()}getMap(){return this.map_}setMap(e){this.map_&&this.element?.remove();for(let e=0,t=this.listenerKeys.length;et.getAttributions(e)));if(this.attributions_!==void 0&&(Array.isArray(this.attributions_)?this.attributions_.forEach(e=>r.add(e)):r.add(this.attributions_)),!this.overrideCollapsible_){let e=!n.some(e=>e.getSource()?.getAttributionsCollapsible()===!1);this.setCollapsible(e)}return Array.from(r)}async updateElement_(e){let t=this.element;if(!t)return;if(!e){this.renderedVisible_&&=(t.style.display=`none`,!1);return}let n=await Promise.all(this.collectSourceAttributions_(e).map(e=>Zs(()=>e))),r=n.length>0;if(this.renderedVisible_!=r&&(t.style.display=r?``:`none`,this.renderedVisible_=r),!Us(n,this.renderedAttributions_)){Xf(this.ulElement_);for(let e=0,t=n.length;e0&&n%(2*Math.PI)!=0?t.animate({rotation:0,duration:this.duration_,easing:Pl}):t.setRotation(0))}render(e){let t=e.frameState;if(!t)return;let n=t.viewState.rotation;if(n!=this.rotation_){let e=`rotate(`+n+`rad)`,t=this.element;if(this.autoHide_&&t){let e=t.classList.contains(Lf);!e&&n===0?t.classList.add(Lf):e&&n!==0&&t.classList.remove(Lf)}this.label_.style.transform=e}this.rotation_=n}},rp=class extends ep{constructor(e){e||={},super({element:document.createElement(`div`),target:e.target});let t=e.className===void 0?`ol-zoom`:e.className,n=e.delta===void 0?1:e.delta,r=e.zoomInClassName===void 0?t+`-in`:e.zoomInClassName,i=e.zoomOutClassName===void 0?t+`-out`:e.zoomOutClassName,a=e.zoomInLabel===void 0?`+`:e.zoomInLabel,o=e.zoomOutLabel===void 0?`–`:e.zoomOutLabel,s=e.zoomInTipLabel===void 0?`Zoom in`:e.zoomInTipLabel,c=e.zoomOutTipLabel===void 0?`Zoom out`:e.zoomOutTipLabel,l=document.createElement(`button`);l.className=r,l.setAttribute(`type`,`button`),l.title=s,l.appendChild(typeof a==`string`?document.createTextNode(a):a),l.addEventListener(z.CLICK,this.handleClick_.bind(this,n),!1);let u=document.createElement(`button`);u.className=i,u.setAttribute(`type`,`button`),u.title=c,u.appendChild(typeof o==`string`?document.createTextNode(o):o),u.addEventListener(z.CLICK,this.handleClick_.bind(this,-n),!1);let d=t+` `+Rf+` `+zf,f=this.element;f.className=d,f.appendChild(l),f.appendChild(u),this.duration_=e.duration===void 0?250:e.duration}handleClick_(e,t){t.preventDefault(),this.zoomByDelta_(e)}zoomByDelta_(e){let t=this.getMap();if(!t)return;let n=t.getView();if(!n)return;let r=n.getZoom();if(r!==void 0){let t=n.getConstrainedZoom(r+e);if(t===void 0)return;this.duration_>0?(n.getAnimating()&&n.cancelAnimations(),n.animate({zoom:t,duration:this.duration_,easing:Pl})):n.setZoom(t)}}};function ip(e){e||={};let t=new oc;return(e.zoom===void 0||e.zoom)&&t.push(new rp(e.zoomOptions)),(e.rotate===void 0||e.rotate)&&t.push(new np(e.rotateOptions)),(e.attribution===void 0||e.attribution)&&t.push(new tp(e.attributionOptions)),t}var ap=class{constructor(e,t,n){this.decay_=e,this.minVelocity_=t,this.delay_=n,this.points_=[],this.angle_=0,this.initialVelocity_=0}begin(){this.points_.length=0,this.angle_=0,this.initialVelocity_=0}update(e,t){this.points_.push(e,t,Date.now())}end(){if(this.points_.length<6)return!1;let e=Date.now()-this.delay_,t=this.points_.length-3;if(this.points_[t+2]0&&this.points_[n+2]>e;)n-=3;let r=this.points_[t+2]-this.points_[n+2];if(r<1e3/60)return!1;let i=this.points_[t]-this.points_[n],a=this.points_[t+1]-this.points_[n+1];return this.angle_=Math.atan2(a,i),this.initialVelocity_=Math.sqrt(i*i+a*a)/r,this.initialVelocity_>this.minVelocity_}getDistance(){return(this.minVelocity_-this.initialVelocity_)/this.decay_}getAngle(){return this.angle_}},op={ACTIVE:`active`},sp=class extends rc{constructor(e){super(),this.on,this.once,this.un,e&&e.handleEvent&&(this.handleEvent=e.handleEvent),this.map_=null,this.setActive(!0)}getActive(){return this.get(op.ACTIVE)}getMap(){return this.map_}handleEvent(e){return!0}setActive(e){this.set(op.ACTIVE,e)}setMap(e){this.map_=e}};function cp(e,t,n){let r=e.getCenterInternal();if(r){let i=[r[0]+t[0],r[1]+t[1]];e.animateInternal({duration:n===void 0?250:n,easing:Il,center:e.getConstrainedCenter(i)})}}function lp(e,t,n,r){let i=e.getZoom();if(i===void 0)return;let a=e.getConstrainedZoom(i+t);if(a===void 0)return;let o=e.getResolutionForZoom(a);o!==void 0&&(e.getAnimating()&&e.cancelAnimations(),e.animate({resolution:o,anchor:n,duration:r===void 0?250:r,easing:Pl}))}var up=class extends sp{constructor(e){super(),e||={},this.delta_=e.delta?e.delta:1,this.duration_=e.duration===void 0?250:e.duration}handleEvent(e){let t=!1;if(e.type==lc.DBLCLICK){let n=e.originalEvent,r=e.map,i=e.coordinate,a=n.shiftKey?-this.delta_:this.delta_;lp(r.getView(),a,i,this.duration_),n.preventDefault(),t=!0}return!t}};function dp(e){let t=arguments;return function(e){let n=!0;for(let r=0,i=t.length;r0}}else if(e.type==lc.POINTERDOWN){let n=this.handleDownEvent(e);this.handlingDownUpSequence=n,t=this.stopDown(n)}else e.type==lc.POINTERMOVE&&this.handleMoveEvent(e);return!t}handleMoveEvent(e){}handleUpEvent(e){return!1}stopDown(e){return e}updateTrackedPointers_(e){e.activePointers&&(this.targetPointers=e.activePointers)}};function wp(e){let t=e.length,n=0,r=0;for(let i=0;i0&&this.condition_(e)){let t=e.map.getView();return this.lastCentroid=null,t.getAnimating()&&t.cancelAnimations(),this.kinetic_&&this.kinetic_.begin(),this.noKinetic_=this.targetPointers.length>1,!0}return!1}},Ep=class extends Cp{constructor(e){e||={},super({stopDown:Js}),this.condition_=e.condition?e.condition:fp,this.lastAngle_=void 0,this.duration_=e.duration===void 0?250:e.duration}handleDragEvent(e){if(!xp(e))return;let t=e.map,n=t.getView();if(n.getConstraints().rotation===Tf)return;let r=t.getSize();if(!r)return;let i=e.pixel,a=Math.atan2(r[1]/2-i[1],i[0]-r[0]/2);if(this.lastAngle_!==void 0){let e=a-this.lastAngle_;n.adjustRotationInternal(-e)}this.lastAngle_=a}handleUpEvent(e){return!xp(e)||(e.map.getView().endInteraction(this.duration_),!1)}handleDownEvent(e){return xp(e)&&gp(e)&&this.condition_(e)?(e.map.getView().beginInteraction(),this.lastAngle_=void 0,!0):!1}},Dp=class extends Is{constructor(e){super(),this.geometry_=null,this.element_=document.createElement(`div`),this.element_.style.position=`absolute`,this.element_.style.pointerEvents=`auto`,this.element_.className=`ol-box `+e,this.map_=null,this.startPixel_=null,this.endPixel_=null}disposeInternal(){this.setMap(null)}render_(){let e=this.startPixel_,t=this.endPixel_;if(!e||!t)return;let n=this.element_.style;n.left=Math.min(e[0],t[0])+`px`,n.top=Math.min(e[1],t[1])+`px`,n.width=Math.abs(t[0]-e[0])+`px`,n.height=Math.abs(t[1]-e[1])+`px`}setMap(e){if(this.map_){let e=this.map_.getOverlayContainer();e&&e.removeChild(this.element_);let t=this.element_.style;t.left=`inherit`,t.top=`inherit`,t.width=`inherit`,t.height=`inherit`}if(this.map_=e,this.map_){let e=this.map_.getOverlayContainer();e&&e.appendChild(this.element_)}}setPixels(e,t){this.startPixel_=e,this.endPixel_=t,this.createOrUpdateGeometry(),this.render_()}createOrUpdateGeometry(){if(!this.map_)return;let e=this.startPixel_,t=this.endPixel_;if(!e||!t)return;let n=[e,[e[0],t[1]],t,[t[0],e[1]]],r=this.map_,i=n.map(e=>r.getCoordinateFromPixelInternal(e)),a=i[0];if(!a)return;i[4]=a.slice();let o=i;this.geometry_?this.geometry_.setCoordinates([o]):this.geometry_=new vf([o])}getGeometry(){return this.geometry_}},Op={BOXSTART:`boxstart`,BOXDRAG:`boxdrag`,BOXEND:`boxend`,BOXCANCEL:`boxcancel`},kp=class extends Qs{constructor(e,t,n){super(e),this.coordinate=t,this.mapBrowserEvent=n}},Ap=class extends Cp{constructor(e){super(),this.on,this.once,this.un,e??={},this.box_=new Dp(e.className||`ol-dragbox`),this.minArea_=e.minArea??64,e.onBoxEnd&&(this.onBoxEnd=e.onBoxEnd),this.startPixel_=null,this.condition_=e.condition??gp,this.boxEndCondition_=e.boxEndCondition??this.defaultBoxEndCondition}defaultBoxEndCondition(e,t,n){let r=n[0]-t[0],i=n[1]-t[1];return r*r+i*i>=this.minArea_}getGeometry(){return this.box_.getGeometry()}handleDragEvent(e){this.startPixel_&&(this.box_.setPixels(this.startPixel_,e.pixel),this.dispatchEvent(new kp(Op.BOXDRAG,e.coordinate,e)))}handleUpEvent(e){if(!this.startPixel_)return!1;let t=this.boxEndCondition_(e,this.startPixel_,e.pixel);return t&&this.onBoxEnd(e),this.dispatchEvent(new kp(t?Op.BOXEND:Op.BOXCANCEL,e.coordinate,e)),this.box_.setMap(null),this.startPixel_=null,!1}handleDownEvent(e){return this.condition_(e)?(this.startPixel_=e.pixel,this.box_.setMap(e.map),this.box_.setPixels(this.startPixel_,this.startPixel_),this.dispatchEvent(new kp(Op.BOXSTART,e.coordinate,e)),!0):!1}onBoxEnd(e){}setActive(e){e||(this.box_.setMap(null),this.startPixel_&&=(this.dispatchEvent(new kp(Op.BOXCANCEL,this.startPixel_,null)),null)),super.setActive(e)}setMap(e){this.getMap()&&(this.box_.setMap(null),this.startPixel_&&=(this.dispatchEvent(new kp(Op.BOXCANCEL,this.startPixel_,null)),null)),super.setMap(e)}},jp=class extends Ap{constructor(e){e||={};let t=e.condition?e.condition:yp;super({condition:t,className:e.className||`ol-dragzoom`,minArea:e.minArea}),this.duration_=e.duration===void 0?200:e.duration,this.out_=e.out!==void 0&&e.out}onBoxEnd(e){let t=this.getMap();if(!t)return;let n=t.getView(),r=this.getGeometry();if(this.out_){let e=n.rotatedExtentForGeometry(r),t=n.getResolutionForExtentInternal(e),i=n.getResolution();if(t===void 0||i===void 0)return;let a=i/t;r=r.clone(),r.scale(a*a)}n.fitInternal(r,{duration:this.duration_,easing:Pl})}},Mp={LEFT:`ArrowLeft`,UP:`ArrowUp`,RIGHT:`ArrowRight`,DOWN:`ArrowDown`},Np=class extends sp{constructor(e){super(),e||={},this.defaultCondition_=function(e){return _p(e)&&bp(e)},this.condition_=e.condition===void 0?this.defaultCondition_:e.condition,this.duration_=e.duration===void 0?100:e.duration,this.pixelDelta_=e.pixelDelta===void 0?128:e.pixelDelta}handleEvent(e){let t=!1;if(e.type==z.KEYDOWN){let n=e.originalEvent,r=n.key;if(this.condition_(e)&&(r==Mp.DOWN||r==Mp.LEFT||r==Mp.RIGHT||r==Mp.UP)){let i=e.map.getView(),a=i.getResolution();if(a===void 0)return!0;let o=a*this.pixelDelta_,s=0,c=0;r==Mp.DOWN?c=-o:r==Mp.LEFT?s=-o:r==Mp.RIGHT?s=o:c=o;let l=[s,c];Dl(l,i.getRotation()),cp(i,l,this.duration_),n.preventDefault(),t=!0}}return!t}},Pp=class extends sp{constructor(e){super(),e||={},this.condition_=e.condition?e.condition:function(e){return!vp(e)&&bp(e)},this.delta_=e.delta?e.delta:1,this.duration_=e.duration===void 0?100:e.duration}handleEvent(e){let t=!1;if(e.type==z.KEYDOWN||e.type==z.KEYPRESS){let n=e.originalEvent,r=n.key;if(this.condition_(e)&&(r===`+`||r===`-`)){let i=e.map,a=r===`+`?this.delta_:-this.delta_;lp(i.getView(),a,void 0,this.duration_),n.preventDefault(),t=!0}}return!t}},Fp=40,Ip=300,Lp=3,Rp=class extends sp{constructor(e){e||={},super(e),this.totalDelta_=0,this.lastDelta_=0,this.maxDelta_=e.maxDelta===void 0?1:e.maxDelta,this.duration_=e.duration===void 0?250:e.duration,this.timeout_=e.timeout===void 0?80:e.timeout,this.useAnchor_=e.useAnchor===void 0||e.useAnchor,this.constrainResolution_=e.constrainResolution!==void 0&&e.constrainResolution;let t=e.condition?e.condition:hp;this.condition_=e.onFocusOnly?dp(mp,t):t,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_,this.mode_=void 0,this.trackpadEventGap_=400,this.trackpadTimeoutId_,this.deltaPerZoom_=300}endInteraction_(){this.trackpadTimeoutId_=void 0;let e=this.getMap();if(!e)return;let t=e.getView(),n=this.lastDelta_?this.lastDelta_>0?1:-1:0;t.endInteraction(this.constrainResolution_||t.getConstrainResolution()?100:void 0,n,this.lastAnchor_?e.getCoordinateFromPixel(this.lastAnchor_):void 0)}handleEvent(e){if(!this.condition_(e)||e.type!==z.WHEEL)return!0;let t=e.map,n=e.originalEvent;n.preventDefault();let r=n.ctrlKey&&!e.ctrlKey;this.useAnchor_&&(this.lastAnchor_=e.pixel);let i=n.deltaY;switch(n.deltaMode){case WheelEvent.DOM_DELTA_LINE:i*=Fp;break;case WheelEvent.DOM_DELTA_PAGE:i*=Ip}if(i===0)return!1;this.lastDelta_=i;let a=Date.now();this.startTime_===void 0&&(this.startTime_=a),(!this.mode_||a-this.startTime_>this.trackpadEventGap_)&&(this.mode_=Math.abs(i)<4?`trackpad`:`wheel`);let o=t.getView();if(this.mode_===`trackpad`)return this.trackpadTimeoutId_?clearTimeout(this.trackpadTimeoutId_):(o.getAnimating()&&o.cancelAnimations(),o.beginInteraction()),this.trackpadTimeoutId_=setTimeout(this.endInteraction_.bind(this),this.timeout_),r&&(i*=Lp),o.adjustZoom(-i/this.deltaPerZoom_,this.lastAnchor_?t.getCoordinateFromPixel(this.lastAnchor_):void 0),this.startTime_=a,!1;this.totalDelta_+=i;let s=Math.max(this.timeout_-(a-this.startTime_),0);return clearTimeout(this.timeoutId_),this.timeoutId_=setTimeout(this.handleWheelZoom_.bind(this,t),s),!1}handleWheelZoom_(e){let t=e.getView();t.getAnimating()&&t.cancelAnimations();let n=-W(this.totalDelta_,-this.maxDelta_*this.deltaPerZoom_,this.maxDelta_*this.deltaPerZoom_)/this.deltaPerZoom_;(t.getConstrainResolution()||this.constrainResolution_)&&(n=n?n>0?1:-1:0),lp(t,n,this.lastAnchor_?e.getCoordinateFromPixel(this.lastAnchor_):void 0,this.duration_),this.mode_=void 0,this.totalDelta_=0,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_=void 0}setMouseAnchor(e){this.useAnchor_=e,e||(this.lastAnchor_=null)}},zp=class extends Cp{constructor(e){e||={};let t=e;t.stopDown||=Js,super(t),this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.threshold_=e.threshold===void 0?.3:e.threshold,this.duration_=e.duration===void 0?250:e.duration}handleDragEvent(e){let t=0,n=this.targetPointers[0],r=this.targetPointers[1],i=Math.atan2(r.clientY-n.clientY,r.clientX-n.clientX);if(this.lastAngle_!==void 0){let e=i-this.lastAngle_;this.rotationDelta_+=e,!this.rotating_&&Math.abs(this.rotationDelta_)>this.threshold_&&(this.rotating_=!0),t=e}this.lastAngle_=i;let a=e.map,o=a.getView();o.getConstraints().rotation!==Tf&&(this.anchor_=a.getCoordinateFromPixelInternal(a.getEventPixel(wp(this.targetPointers)))??null,this.rotating_&&(a.render(),o.adjustRotationInternal(t,this.anchor_??void 0)))}handleUpEvent(e){return this.targetPointers.length<2?(e.map.getView().endInteraction(this.duration_),!1):!0}handleDownEvent(e){if(this.targetPointers.length>=2){let t=e.map;return this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.handlingDownUpSequence||t.getView().beginInteraction(),!0}return!1}},Bp=class extends Cp{constructor(e){e||={};let t=e;t.stopDown||=Js,super(t),this.anchor_=null,this.duration_=e.duration===void 0?400:e.duration,this.lastDistance_=void 0,this.lastScaleDelta_=1}handleDragEvent(e){let t=1,n=this.targetPointers[0],r=this.targetPointers[1],i=n.clientX-r.clientX,a=n.clientY-r.clientY,o=Math.sqrt(i*i+a*a);this.lastDistance_!==void 0&&(t=this.lastDistance_/o),this.lastDistance_=o;let s=e.map,c=s.getView();t!=1&&(this.lastScaleDelta_=t),this.anchor_=s.getCoordinateFromPixelInternal(s.getEventPixel(wp(this.targetPointers)))??null,s.render(),c.adjustResolutionInternal(t,this.anchor_??void 0)}handleUpEvent(e){if(this.targetPointers.length<2){let t=e.map.getView(),n=this.lastScaleDelta_>1?1:-1;return t.endInteraction(this.duration_,n),!1}return!0}handleDownEvent(e){if(this.targetPointers.length>=2){let t=e.map;return this.anchor_=null,this.lastDistance_=void 0,this.lastScaleDelta_=1,this.handlingDownUpSequence||t.getView().beginInteraction(),!0}return!1}};function Vp(e){e||={};let t=new oc,n=new ap(-.005,.05,100);return(e.altShiftDragRotate===void 0||e.altShiftDragRotate)&&t.push(new Ep),(e.doubleClickZoom===void 0||e.doubleClickZoom)&&t.push(new up({delta:e.zoomDelta,duration:e.zoomDuration})),(e.dragPan===void 0||e.dragPan)&&t.push(new Tp({onFocusOnly:e.onFocusOnly,kinetic:n})),(e.pinchRotate===void 0||e.pinchRotate)&&t.push(new zp),(e.pinchZoom===void 0||e.pinchZoom)&&t.push(new Bp({duration:e.zoomDuration})),(e.keyboard===void 0||e.keyboard)&&(t.push(new Np),t.push(new Pp({delta:e.zoomDelta,duration:e.zoomDuration}))),(e.mouseWheelZoom===void 0||e.mouseWheelZoom)&&t.push(new Rp({onFocusOnly:e.onFocusOnly,duration:e.zoomDuration})),(e.shiftDragZoom===void 0||e.shiftDragZoom)&&t.push(new jp({duration:e.zoomDuration})),t}var K={OPACITY:`opacity`,VISIBLE:`visible`,EXTENT:`extent`,Z_INDEX:`zIndex`,MAX_RESOLUTION:`maxResolution`,MIN_RESOLUTION:`minResolution`,MAX_ZOOM:`maxZoom`,MIN_ZOOM:`minZoom`,SOURCE:`source`,MAP:`map`},Hp=class extends rc{constructor(e){super(),this.on,this.once,this.un,this.background_=e.background;let t=Object.assign({},e);typeof e.properties==`object`&&(delete t.properties,Object.assign(t,e.properties)),t[K.OPACITY]=e.opacity===void 0?1:e.opacity,U(typeof t[K.OPACITY]==`number`,`Layer opacity must be a number`),t[K.VISIBLE]=e.visible===void 0||e.visible,t[K.Z_INDEX]=e.zIndex,t[K.MAX_RESOLUTION]=e.maxResolution===void 0?1/0:e.maxResolution,t[K.MIN_RESOLUTION]=e.minResolution===void 0?0:e.minResolution,t[K.MIN_ZOOM]=e.minZoom===void 0?-1/0:e.minZoom,t[K.MAX_ZOOM]=e.maxZoom===void 0?1/0:e.maxZoom,this.className_=t.className===void 0?`ol-layer`:t.className,delete t.className,this.setProperties(t),this.state_=null}getBackground(){return this.background_}getClassName(){return this.className_}getLayerState(e){let t=this.state_||{layer:this,managed:e===void 0||e},n=this.getZIndex();return t.opacity=W(Math.round(this.getOpacity()*100)/100,0,1),t.visible=this.getVisible(),t.extent=this.getExtent(),t.zIndex=n===void 0&&!t.managed?1/0:n,t.maxResolution=this.getMaxResolution(),t.minResolution=Math.max(this.getMinResolution(),0),t.minZoom=this.getMinZoom(),t.maxZoom=this.getMaxZoom(),this.state_=t,t}getLayersArray(e){return B()}getLayerStatesArray(e){return B()}getExtent(){return this.get(K.EXTENT)}getMaxResolution(){return this.get(K.MAX_RESOLUTION)}getMinResolution(){return this.get(K.MIN_RESOLUTION)}getMinZoom(){return this.get(K.MIN_ZOOM)}getMaxZoom(){return this.get(K.MAX_ZOOM)}getOpacity(){return this.get(K.OPACITY)}getSourceState(){return B()}getVisible(){return this.get(K.VISIBLE)}getZIndex(){return this.get(K.Z_INDEX)}setBackground(e){this.background_=e,this.changed()}setExtent(e){this.set(K.EXTENT,e)}setMaxResolution(e){this.set(K.MAX_RESOLUTION,e)}setMinResolution(e){this.set(K.MIN_RESOLUTION,e)}setMaxZoom(e){this.set(K.MAX_ZOOM,e)}setMinZoom(e){this.set(K.MIN_ZOOM,e)}setOpacity(e){U(typeof e==`number`,`Layer opacity must be a number`),this.set(K.OPACITY,e)}setVisible(e){this.set(K.VISIBLE,e)}setZIndex(e){this.set(K.Z_INDEX,e)}disposeInternal(){this.state_&&=(this.state_.layer=null,null),super.disposeInternal()}},Up={ADDLAYER:`addlayer`,REMOVELAYER:`removelayer`},Wp=class extends Qs{constructor(e,t){super(e),this.layer=t}},Gp={LAYERS:`layers`},Kp=class e extends Hp{constructor(e){e||={};let t=Object.assign({},e);delete t.layers;let n=e.layers;super(t),this.on,this.once,this.un,this.layersListenerKeys_=[],this.listenerKeys_={},this.addChangeListener(Gp.LAYERS,this.handleLayersChanged_),n?Array.isArray(n)?n=new oc(n.slice(),{unique:!0}):U(typeof n.getArray==`function`,"Expected `layers` to be an array or a `Collection`"):n=new oc(void 0,{unique:!0}),this.setLayers(n)}handleLayerChange_(){this.changed()}handleLayersChanged_(){this.layersListenerKeys_.forEach(R),this.layersListenerKeys_.length=0;let e=this.getLayers();this.layersListenerKeys_.push(L(e,js.ADD,this.handleLayersAdd_,this),L(e,js.REMOVE,this.handleLayersRemove_,this));for(let e in this.listenerKeys_)this.listenerKeys_[e].forEach(R);Ns(this.listenerKeys_);let t=e.getArray();for(let e=0,n=t.length;e{this.dispatchEvent(`sourceready`)},0))),this.changed()}getFeatures(e){return this.renderer_?this.renderer_.getFeatures(e):Promise.resolve([])}getData(e){return!this.renderer_||!this.rendered?null:this.renderer_.getData(e)}isVisible(e){let t,n=this.getMapInternal();!e&&n&&(e=n.getView()),t=e instanceof Af?{viewState:e.getState(),extent:e.calculateExtent()}:e;let r=t;!r.layerStatesArray&&n&&(r.layerStatesArray=n.getLayerGroup().getLayerStatesArray());let i;if(r.layerStatesArray){if(i=r.layerStatesArray.find(e=>e.layer===this),!i)return!1}else i=this.getLayerState();let a=this.getExtent();return Yp(i,r.viewState)&&(!a||vl(a,r.extent))}getAttributions(e){if(!this.isVisible(e))return[];let t=this.getSource()?.getAttributions();if(!t)return[];let n=t(e instanceof Af?e.getViewStateAndExtent():e);return Array.isArray(n)||(n=[n]),n}render(e,t){let n=this.getRenderer();return n.prepareFrame(e)?(this.rendered=!0,n.renderFrame(e,t)):null}unrender(){this.rendered=!1}getDeclutter(){}renderDeclutter(e,t){}renderDeferred(e){let t=this.getRenderer();t&&t.renderDeferred(e)}setMapInternal(e){e||this.unrender(),this.set(K.MAP,e)}getMapInternal(){return this.get(K.MAP)}setMap(e){this.mapPrecomposeKey_&&=(R(this.mapPrecomposeKey_),null),e||this.changed(),this.mapRenderKey_&&=(R(this.mapRenderKey_),null),e&&(this.mapPrecomposeKey_=L(e,qp.PRECOMPOSE,this.handlePrecompose_,this),this.mapRenderKey_=L(this,z.CHANGE,e.render,e),this.changed())}handlePrecompose_(e){let t=e.frameState?.layerStatesArray;if(!t)return;let n=this.getLayerState(!1);U(!t.some(e=>e.layer===n.layer),"A layer can only be added to the map once. Use either `layer.setMap()` or `map.addLayer()`, not both."),t.push(n)}setSource(e){this.set(K.SOURCE,e)}getRenderer(){return 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 Yp(e,t){if(!e.visible)return!1;let n=t.resolution;if(n=e.maxResolution)return!1;let r=t.zoom;return r>e.minZoom&&r<=e.maxZoom}function Xp(e,t,n=0,r=e.length-1,i=Qp){for(;r>n;){if(r-n>600){let a=r-n+1,o=t-n+1,s=Math.log(a),c=.5*Math.exp(2*s/3),l=.5*Math.sqrt(s*c*(a-c)/a)*(o-a/2<0?-1:1);Xp(e,t,Math.max(n,Math.floor(t-o*c/a+l)),Math.min(r,Math.floor(t+(a-o)*c/a+l)),i)}let a=e[t],o=n,s=r;for(Zp(e,n,t),i(e[r],a)>0&&Zp(e,n,r);o0;)s--}i(e[n],a)===0?Zp(e,n,s):(s++,Zp(e,s,r)),s<=t&&(n=s+1),t<=s&&(r=s-1)}}function Zp(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}function Qp(e,t){return et)}var $p=class{constructor(e=9){this._maxEntries=Math.max(4,e),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4)),this.clear()}all(){return this._all(this.data,[])}search(e){let t=this.data,n=[];if(!dm(e,t))return n;let r=this.toBBox,i=[];for(;t;){for(let a=0;a=0&&i[t].children.length>this._maxEntries;)this._split(i,t),t--;this._adjustParentBBoxes(r,i,t)}_split(e,t){let n=e[t],r=n.children.length,i=this._minEntries;this._chooseSplitAxis(n,i,r);let a=this._chooseSplitIndex(n,i,r),o=fm(n.children.splice(a,n.children.length-a));o.height=n.height,o.leaf=n.leaf,tm(n,this.toBBox),tm(o,this.toBBox),t?e[t-1].children.push(o):this._splitRoot(n,o)}_splitRoot(e,t){this.data=fm([e,t]),this.data.height=e.height+1,this.data.leaf=!1,tm(this.data,this.toBBox)}_chooseSplitIndex(e,t,n){let r,i=1/0,a=1/0;for(let o=t;o<=n-t;o++){let t=nm(e,0,o,this.toBBox),s=nm(e,o,n,this.toBBox),c=lm(t,s),l=om(t)+om(s);c=t;r--){let t=e.children[r];rm(o,e.leaf?i(t):t),s+=sm(o)}return s}_adjustParentBBoxes(e,t,n){for(let r=n;r>=0;r--)rm(t[r],e)}_condense(e){for(let t=e.length-1,n;t>=0;t--)e[t].children.length===0?t>0?(n=e[t-1].children,n.splice(n.indexOf(e[t]),1)):this.clear():tm(e[t],this.toBBox)}};function em(e,t,n){if(!n)return t.indexOf(e);for(let r=0;r=e.minX&&t.maxY>=e.minY}function fm(e){return{children:e,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function pm(e,t,n,r,i){let a=[t,n];for(;a.length;){if(n=a.pop(),t=a.pop(),n-t<=r)continue;let o=t+Math.ceil((n-t)/r/2)*r;Xp(e,o,t,n,i),a.push(t,o,o,n)}}var mm=[NaN,NaN,NaN,0],hm;function gm(){return hm||=Gf(1,1,void 0,{willReadFrequently:!0,desynchronized:!0}),hm}var _m=/^rgba?\(\s*(\d+%?)\s+(\d+%?)\s+(\d+%?)(?:\s*\/\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,vm=/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,ym=/^rgba?\(\s*(\d+%)\s*,\s*(\d+%)\s*,\s*(\d+%)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,bm=/^#([\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$/i;function xm(e,t){return e.endsWith(`%`)?Number(e.substring(0,e.length-1))/t:Number(e)}function Sm(e){throw Error(`failed to parse "`+e+`" as color`)}function Cm(e){if(e.toLowerCase().startsWith(`rgb`)){let t=e.match(vm)||e.match(_m)||e.match(ym);if(t){let e=t[4],n=100/255;return[W(xm(t[1],n)+.5|0,0,255),W(xm(t[2],n)+.5|0,0,255),W(xm(t[3],n)+.5|0,0,255),e===void 0?1:W(xm(e,100),0,1)]}Sm(e)}if(e.startsWith(`#`)){if(bm.test(e)){let t=e.substring(1),n=t.length<=4?1:2,r=[0,0,0,255];for(let e=0,i=t.length;e.0031308?e**(1/2.4)*269.025-14.025:e*3294.6}function Am(e){return e>.2068965?e**3:(e-4/29)*(108/841)}function jm(e){return e>10.314724?((e+14.025)/269.025)**2.4:e/3294.6}function Mm(e){return e>.0088564?e**(1/3):e/(108/841)+4/29}function Nm(e){let t=jm(e[0]),n=jm(e[1]),r=jm(e[2]),i=Mm(t*.222488403+n*.716873169+r*.06060791),a=500*(Mm(t*.452247074+n*.399439023+r*.148375274)-i),o=200*(i-Mm(t*.016863605+n*.117638439+r*.865350722)),s=180/Math.PI*Math.atan2(o,a);return[116*i-16,Math.sqrt(a*a+o*o),s<0?s+360:s,e[3]]}function Pm(e){let t=(e[0]+16)/116,n=e[1],r=e[2]*Math.PI/180,i=Am(t),a=Am(t+n/500*Math.cos(r)),o=Am(t-n/200*Math.sin(r)),s=km(a*3.021973625-i*1.617392459-o*.404875592),c=km(a*-.943766287+i*1.916279586+o*.027607165),l=km(a*.069407491-i*.22898585+o*1.159737864);return[W(s+.5|0,0,255),W(c+.5|0,0,255),W(l+.5|0,0,255),e[3]]}function Fm(e){if(e===`none`)return mm;if(Em.hasOwnProperty(e))return Em[e];if(Dm>=Tm){let e=0;for(let t in Em)e++&3||(delete Em[t],--Dm)}let t=Cm(e);t.length!==4&&Sm(e);for(let n of t)isNaN(n)&&Sm(e);return Em[e]=t,++Dm,t}function Im(e){return Array.isArray(e)?e:Fm(e)}function Lm(e){let t=e[0];t!=(t|0)&&(t=t+.5|0);let n=e[1];n!=(n|0)&&(n=n+.5|0);let r=e[2];r!=(r|0)&&(r=r+.5|0);let i=e[3]===void 0?1:Math.round(e[3]*1e3)/1e3;return`rgba(`+t+`,`+n+`,`+r+`,`+i+`)`}function Rm(e){return e[0]>0&&e[1]>0}function zm(e,t,n){return n===void 0&&(n=[0,0]),n[0]=e[0]*t+.5|0,n[1]=e[1]*t+.5|0,n}function Bm(e,t){return Array.isArray(e)?e:(t===void 0?t=[e,e]:(t[0]=e,t[1]=e),t)}var Vm=0,Hm=1<`,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`,InterpolateHcl:`interpolate-hcl`,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`},oh={[J.Get]:Z(Y(1,1/0),sh),[J.Var]:ch(),[J.Has]:Z(Y(1,1/0),sh),[J.Id]:Z(lh,ph),[J.Concat]:Z(Y(2,1/0),X(Um)),[J.GeometryType]:Z(uh,ph),[J.LineMetric]:Z(dh,ph),[J.Resolution]:Z(fh,ph),[J.Zoom]:Z(fh,ph),[J.Time]:Z(fh,ph),[J.Any]:Z(Y(2,1/0),X(Hm)),[J.All]:Z(Y(2,1/0),X(Hm)),[J.Not]:Z(Y(1,1),X(Hm)),[J.Equal]:Z(Y(2,2),hh()),[J.NotEqual]:Z(Y(2,2),hh()),[J.GreaterThan]:Z(Y(2,2),X(q)),[J.GreaterThanOrEqualTo]:Z(Y(2,2),X(q)),[J.LessThan]:Z(Y(2,2),X(q)),[J.LessThanOrEqualTo]:Z(Y(2,2),X(q)),[J.Multiply]:Z(Y(2,1/0),mh),[J.Coalesce]:Z(Y(2,1/0),mh),[J.Divide]:Z(Y(2,2),X(q)),[J.Add]:Z(Y(2,1/0),X(q)),[J.Subtract]:Z(Y(2,2),X(q)),[J.Clamp]:Z(Y(3,3),X(q)),[J.Mod]:Z(Y(2,2),X(q)),[J.Pow]:Z(Y(2,2),X(q)),[J.Abs]:Z(Y(1,1),X(q)),[J.Floor]:Z(Y(1,1),X(q)),[J.Ceil]:Z(Y(1,1),X(q)),[J.Round]:Z(Y(1,1),X(q)),[J.Sin]:Z(Y(1,1),X(q)),[J.Cos]:Z(Y(1,1),X(q)),[J.Atan]:Z(Y(1,2),X(q)),[J.Sqrt]:Z(Y(1,1),X(q)),[J.Match]:Z(Y(4,1/0),_h,vh),[J.Between]:Z(Y(3,3),X(q)),[J.Interpolate]:Z(Y(6,1/0),_h,bh),[J.InterpolateHcl]:Z(Y(6,1/0),_h,yh,bh),[J.Case]:Z(Y(3,1/0),gh,xh),[J.In]:Z(Y(2,2),Sh),[J.Number]:Z(Y(1,1/0),X(qm)),[J.String]:Z(Y(1,1/0),X(qm)),[J.Array]:Z(Y(1,1/0),X(q)),[J.Color]:Z(Y(1,4),X(q)),[J.Band]:Z(Y(1,3),X(q)),[J.Palette]:Z(Y(2,2),Ch),[J.ToString]:Z(Y(1,1),X(Hm|q|Um|Wm))};function sh(e,t,n){let r=e.length-1,i=Array(r);for(let a=0;at){let n=t===1/0?`${e} or more`:`${e} to ${t}`;throw Error(`expected ${n} arguments for ${a}, got ${o}`)}}}function mh(e,t,n){let r=e.length-1,i=Array(r);for(let a=0;ae.featureId??``;case J.GeometryType:return e=>e.geometryType;case J.Concat:{let n=e.args.map(e=>Oh(e,t));return e=>``.concat(...n.map(t=>(t(e)??``).toString()))}case J.Resolution:return e=>e.resolution;case J.Any:case J.All:case J.Between:case J.In:case J.Not:return Ph(e,t);case J.Equal:case J.NotEqual:case J.LessThan:case J.LessThanOrEqualTo:case J.GreaterThan:case J.GreaterThanOrEqualTo:return Nh(e,t);case J.Multiply:case J.Divide:case J.Add:case J.Subtract:case J.Clamp:case J.Mod:case J.Pow:case J.Abs:case J.Floor:case J.Ceil:case J.Round:case J.Sin:case J.Cos:case J.Atan:case J.Sqrt:return Fh(e,t);case J.Case:return Ih(e,t);case J.Match:return Lh(e,t);case J.Interpolate:case J.InterpolateHcl:return Rh(e,t);case J.ToString:return zh(e,t);case J.Array:return kh(e,t);case J.Color:return Ah(e,t);default:throw Error(`Unsupported operator ${n}`)}}function kh(e,t){let n=e.args.length,r=Array(n);for(let i=0;i[r[0](t)*255,r[1](t)*255,r[2](t)*255,e?e(t):1]}return e=>{let t=Array(n);for(let i=0;i{let n=r[0](t);return[n,n,n,e?e(t):1]}}let i=n===4?r[3]:null;return e=>[r[0](e),r[1](e),r[2](e),i?i(e):1]}function jh(e,t){let n=e.operator,r=e.args.length,i=Array(r);for(let n=0;n{for(let t=0;t{for(let t=0;t{let r=e.args,i=t.properties[n];for(let e=1,t=r.length;ee.variables[n];case J.Has:return t=>{let r=e.args;if(!(n in t.properties))return!1;let i=t.properties[n];for(let e=1,t=r.length;er(e)===i(e);case J.NotEqual:return e=>r(e)!==i(e);case J.LessThan:return e=>r(e)r(e)<=i(e);case J.GreaterThan:return e=>r(e)>i(e);case J.GreaterThanOrEqualTo:return e=>r(e)>=i(e);default:throw Error(`Unsupported comparison operator ${n}`)}}function Ph(e,t){let n=e.operator,r=e.args.length,i=Array(r);for(let n=0;n{for(let t=0;t{for(let t=0;t{let t=i[0](e),n=i[1](e),r=i[2](e);return t>=n&&t<=r};case J.In:return e=>{let t=i[0](e);for(let n=1;n!i[0](e);default:throw Error(`Unsupported logical operator ${n}`)}}function Fh(e,t){let n=e.operator,r=e.args.length,i=Array(r);for(let n=0;n{let t=1;for(let n=0;ni[0](e)/i[1](e);case J.Add:return e=>{let t=0;for(let n=0;ni[0](e)-i[1](e);case J.Clamp:return e=>{let t=i[0](e),n=i[1](e);if(tr?r:t};case J.Mod:return e=>i[0](e)%i[1](e);case J.Pow:return e=>i[0](e)**+i[1](e);case J.Abs:return e=>Math.abs(i[0](e));case J.Floor:return e=>Math.floor(i[0](e));case J.Ceil:return e=>Math.ceil(i[0](e));case J.Round:return e=>Math.round(i[0](e));case J.Sin:return e=>Math.sin(i[0](e));case J.Cos:return e=>Math.cos(i[0](e));case J.Atan:return r===2?e=>Math.atan2(i[0](e),i[1](e)):e=>Math.atan(i[0](e));case J.Sqrt:return e=>Math.sqrt(i[0](e));default:throw Error(`Unsupported numeric operator ${n}`)}}function Ih(e,t){let n=e.args.length,r=Array(n);for(let i=0;i{for(let t=0;t{let t=r[0](e);for(let i=1;i{let t=r[0](e),a=r[1](e),o,s;for(let c=2;c=a)return c===2?l:u?i(t,a,o,s,n,l):Bh(t,a,o,s,n,l);o=n,s=l}return s}}function zh(e,t){let n=e.operator,r=e.args.length,i=Array(r);for(let n=0;n{let n=i[0](t);return e.args[0].type===Wm?Lm(n):n.toString()};default:throw Error(`Unsupported convert operator ${n}`)}}function Bh(e,t,n,r,i,a){let o=i-n;if(o===0)return r;let s=t-n;return r+(e===1?s/o:(e**+s-1)/(e**+o-1))*(a-r)}function Vh(e,t,n,r,i,a){return i-n===0?r:[Bh(e,t,n,r[0],i,a[0]),Bh(e,t,n,r[1],i,a[1]),Bh(e,t,n,r[2],i,a[2]),Bh(e,t,n,r[3],i,a[3])]}function Hh(e,t,n,r,i,a){if(i-n===0)return r;let o=Nm(r),s=Nm(a),c=s[2]-o[2];return c>180?c-=360:c<-180&&(c+=360),Pm([Bh(e,t,n,o[0],i,s[0]),Bh(e,t,n,o[1],i,s[1]),o[2]+Bh(e,t,n,0,i,c),Bh(e,t,n,r[3],i,a[3])])}var Q={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};function Uh(e,t,n){let r=e,i=!0,a=!1,o=!1,s=[Fs(r,z.LOAD,function(){o=!0,a||t()})];return r.src&&hc?(a=!0,r.decode().then(function(){i&&t()}).catch(function(e){i&&(o?t():n())})):s.push(Fs(r,z.ERROR,n)),function(){i=!1,s.forEach(R)}}function Wh(e,t){return new Promise((n,r)=>{function i(){o(),n(e)}function a(){o(),r(Error(`Image load error`))}function o(){e.removeEventListener(`load`,i),e.removeEventListener(`error`,a)}e.addEventListener(`load`,i),e.addEventListener(`error`,a),t&&(e.src=t)})}function Gh(e,t){return t&&(e.src=t),e.src&&hc?new Promise((t,n)=>e.decode().then(()=>t(e)).catch(r=>e.complete&&e.width?t(e):n(r))):Wh(e)}var Kh=class{constructor(){this.cache_={},this.patternCache_={},this.cacheSize_=0,this.maxCacheSize_=1024}clear(){this.cache_={},this.patternCache_={},this.cacheSize_=0}canExpireCache(){return this.cacheSize_>this.maxCacheSize_}expire(){if(this.canExpireCache()){let e=0;for(let t in this.cache_){let n=this.cache_[t];!(e++&3)&&!n.hasListener()&&(delete this.cache_[t],delete this.patternCache_[t],--this.cacheSize_)}}}get(e,t){let n=qh(e,t);return n in this.cache_?this.cache_[n]:null}getPattern(e,t){let n=qh(e,t);return n in this.patternCache_?this.patternCache_[n]:null}set(e,t,n,r){let i=qh(e,t),a=i in this.cache_;if(n&&(this.cache_[i]=n),r&&n){if(n.getImageState()===Q.IDLE&&n.load(),n.getImageState()===Q.LOADING)n.ready().then(()=>{let e=qf().createPattern(n.getImage(1),`repeat`);e&&(this.patternCache_[i]=e)});else{let e=qf().createPattern(n.getImage(1),`repeat`);e&&(this.patternCache_[i]=e)}}a||++this.cacheSize_}setSize(e){this.maxCacheSize_=e,this.expire()}};function qh(e,t){let n=t?Im(t):`null`;return e+`:`+n}var Jh=new Kh,Yh=null,Xh=class extends $s{constructor(e,t,n,r,i){super(),this.hitDetectionImage_=null,this.image_=e,this.crossOrigin_=n?.crossOrigin??null,this.referrerPolicy_=n?.referrerPolicy,this.canvas_={},this.color_=i,this.imageState_=r===void 0?Q.IDLE:r,this.size_=e&&e.width&&e.height?[e.width,e.height]:null,this.src_=t,this.tainted_,this.ready_=null}initializeImage_(){this.image_=new Image,this.crossOrigin_!==null&&(this.image_.crossOrigin=this.crossOrigin_),this.referrerPolicy_!==void 0&&(this.image_.referrerPolicy=this.referrerPolicy_)}isTainted_(){if(this.tainted_===void 0&&this.imageState_===Q.LOADED){let e=this.image_;if(!e)return!1;Yh||=Gf(1,1,void 0,{willReadFrequently:!0}),Yh.drawImage(e,0,0);try{Yh.getImageData(0,0,1,1),this.tainted_=!1}catch{Yh=null,this.tainted_=!0}}return this.tainted_===!0}dispatchChangeEvent_(){this.dispatchEvent(z.CHANGE)}handleImageError_(){this.imageState_=Q.ERROR,this.dispatchChangeEvent_()}handleImageLoad_(){this.imageState_=Q.LOADED;let e=this.image_;e&&`width`in e&&`height`in e&&(this.size_=[e.width,e.height]),this.dispatchChangeEvent_()}getImage(e){this.image_||this.initializeImage_(),this.replaceColor_(e);let t=this.image_;return this.canvas_[e]?this.canvas_[e]:t}setImage(e){this.image_=e}getPixelRatio(e){return this.replaceColor_(e),this.canvas_[e]?e:1}getImageState(){return this.imageState_}getHitDetectionImage(){if(this.image_||this.initializeImage_(),!this.hitDetectionImage_){if(this.isTainted_()){let e=this.size_;if(!e)return this.image_;let t=e[0],n=e[1],r=Gf(t,n);r.fillRect(0,0,t,n),this.hitDetectionImage_=r.canvas}else this.hitDetectionImage_=this.image_}return this.hitDetectionImage_}getSize(){return this.size_}getSrc(){return this.src_}load(){if(this.imageState_===Q.IDLE){this.image_||this.initializeImage_(),this.imageState_=Q.LOADING;try{this.src_!==void 0&&(this.image_.src=this.src_)}catch{this.handleImageError_()}this.image_ instanceof HTMLImageElement&&Gh(this.image_,this.src_).then(e=>{this.image_=e,this.handleImageLoad_()}).catch(this.handleImageError_.bind(this))}}replaceColor_(e){if(!this.color_||this.canvas_[e]||this.imageState_!==Q.LOADED)return;let t=this.image_;if(!t)return;let n=Gf(Math.ceil(t.width*e),Math.ceil(t.height*e)),r=n.canvas;n.scale(e,e),n.drawImage(t,0,0),n.globalCompositeOperation=`multiply`,n.fillStyle=wm(this.color_),n.fillRect(0,0,r.width/e,r.height/e),n.globalCompositeOperation=`destination-in`,n.drawImage(t,0,0),this.canvas_[e]=r}ready(){return this.ready_||=new Promise(e=>{if(this.imageState_===Q.LOADED||this.imageState_===Q.ERROR)e();else{let t=()=>{(this.imageState_===Q.LOADED||this.imageState_===Q.ERROR)&&(this.removeEventListener(z.CHANGE,t),e())};this.addEventListener(z.CHANGE,t)}}),this.ready_}};function Zh(e,t,n,r,i,a){let o=t===void 0?void 0:Jh.get(t,i);return o||(o=new Xh(e,e&&`src`in e?e.src||void 0:t,n,r,i),t!==void 0&&Jh.set(t,i,o,a)),a&&o&&t!==void 0&&!Jh.getPattern(t,i)&&Jh.set(t,i,o,a),o}function Qh(e){return e?Array.isArray(e)?Lm(e):typeof e==`object`&&`src`in e?$h(e):e:null}function $h(e){if(!e.offset||!e.size)return Jh.getPattern(e.src,e.color??null);let t=e.src+`:`+e.offset,n=Jh.getPattern(t,e.color??null);if(n)return n;let r=Jh.get(e.src,null);if(!r||r.getImageState()!==Q.LOADED)return null;let i=Gf(e.size[0],e.size[1]);return i.drawImage(r.getImage(1),e.offset[0],e.offset[1],e.size[0],e.size[1],0,0,e.size[0],e.size[1]),Zh(i.canvas,t,{},Q.LOADED,e.color??null,!0),Jh.getPattern(t,e.color??null)}var eg=`10px sans-serif`,tg=`#000`,ng=`round`,rg=[],ig=`round`,ag=`#000`,og=`center`,sg=`middle`,cg=[0,0,0,0],lg=new rc,ug=null,dg,fg={},pg=new Set([`serif`,`sans-serif`,`monospace`,`cursive`,`fantasy`,`system-ui`,`ui-serif`,`ui-sans-serif`,`ui-monospace`,`ui-rounded`,`emoji`,`math`,`fangsong`]);function mg(e,t,n){return`${e} ${t} 16px "${n}"`}var hg=(function(){let e,t;async function n(e){await t.ready;let n=Wf(e);if(!n)return!1;let r=n.families[0].toLowerCase(),i=n.weight,a=[];return t.forEach(e=>{let t=e.family.replace(/^['"]|['"]$/g,``).toLowerCase(),o=Uf[e.weight]||e.weight;t===r&&e.style===n.style&&o==i&&a.push(e)}),a.length!==0&&(await Promise.all(a.map(e=>e.load().then(()=>!0,()=>!1)))).some(e=>e)}async function r(){await t.ready;let i=!0,a=lg.getProperties(),o=Object.keys(a).filter(e=>a[e]<100);for(let e=o.length-1;e>=0;--e){let t=o[e],r=a[t];r<100&&(await n(t)?(Ns(fg),lg.set(t,100)):(r+=10,lg.set(t,r,!0),r<100&&(i=!1)))}e=void 0,i||(e=setTimeout(r,100))}return async function(n){t||=mc?self.fonts:document.fonts;let i=Wf(n);if(!i)return;let a=i.families,o=!1;for(let e of a){if(pg.has(e))continue;let t=mg(i.style,i.weight,e);lg.get(t)===void 0&&(lg.set(t,0,!0),o=!0)}o&&(clearTimeout(e),e=setTimeout(r,100))}})(),gg=(function(){let e;return function(t){let n=fg[t];if(n==null){if(mc){let e=Wf(t),r=_g(t,`Žg`);n=(!e||isNaN(Number(e.lineHeight))?1.2:Number(e.lineHeight))*(r.actualBoundingBoxAscent+r.actualBoundingBoxDescent)}else e||(e=document.createElement(`div`),e.innerHTML=`M`,e.style.minHeight=`0`,e.style.maxHeight=`none`,e.style.height=`auto`,e.style.padding=`0`,e.style.border=`none`,e.style.position=`absolute`,e.style.display=`block`,e.style.left=`-99999px`),e.style.font=t,document.body.appendChild(e),n=e.offsetHeight,document.body.removeChild(e);fg[t]=n}return n}})();function _g(e,t){return ug||=Gf(1,1),e!=dg&&(ug.font=e,dg=ug.font),ug.measureText(t)}function vg(e,t){return _g(e,t).width}function yg(e,t,n){if(t in n)return n[t];let r=t.split(` -`).reduce((t,n)=>Math.max(t,vg(e,n)),0);return n[t]=r,r}function bg(e,t){let n=[],r=[],i=[],a=0,o=0,s=0,c=0;for(let l=0,u=t.length;l<=u;l+=2){let d=t[l];if(d===` -`||l===u){a=Math.max(a,o),i.push(o),o=0,s+=c,c=0;continue}let f=t[l+1]||e.font,p=vg(f,d);n.push(p),o+=p;let m=gg(f);r.push(m),c=Math.max(c,m)}return{width:a,height:s,widths:n,heights:r,lineWidths:i}}function xg(e,t,n,r,i,a,o,s,c,l,u){e.save(),n!==1&&(e.globalAlpha===void 0?e.globalAlpha=function(e){return e.globalAlpha*=n}:e.globalAlpha*=n),t&&e.transform.apply(e,t),r.contextInstructions?(e.translate(c,l),e.scale(u[0],u[1]),Sg(r,e)):u[0]<0||u[1]<0?(e.translate(c,l),e.scale(u[0],u[1]),e.drawImage(r,i,a,o,s,0,0,o,s)):e.drawImage(r,i,a,o,s,c,l,o*u[0],s*u[1]),e.restore()}function Sg(e,t){let n=t,r=e.contextInstructions;for(let e=0,t=r.length;ethis.imageState_=Q.LOADED),this.render()}clone(){let t=this.getScale(),n=new e({fill:this.getFill()?.clone(),points:this.getPoints(),radius:this.getRadius(),radius2:this.getRadius2(),angle:this.getAngle(),stroke:this.getStroke()?.clone(),rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),scale:Array.isArray(t)?t.slice():t,displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()});return n.setOpacity(this.getOpacity()),n}getAnchor(){let e=this.size_,t=this.getDisplacement(),n=this.getScaleArray();return[e[0]/2-t[0]/n[0],e[1]/2+t[1]/n[1]]}getAngle(){return this.angle_}getFill(){return this.fill_}setFill(e){this.fill_=e,this.render()}getHitDetectionImage(){return this.hitDetectionCanvas_||=this.createHitDetectionCanvas_(this.renderOptions_),this.hitDetectionCanvas_}getImage(e){let t=this.fill_?.getKey(),n=`${e},${this.angle_},${this.radius},${this.radius2_},${this.points_},${t}`+Object.values(this.renderOptions_).join(`,`),r=Jh.get(n,null)?.getImage(1);if(!r){let t=this.renderOptions_,i=Math.ceil(t.size*e),a=Gf(i,i);this.draw_(t,a,e),r=a.canvas;let o=new Xh(r,void 0,{},Q.LOADED,null);Jh.set(n,null,o),createImageBitmap(r).then(e=>{o.setImage(e)})}return r}getPixelRatio(e){return e}getImageSize(){return this.size_}getImageState(){return this.imageState_}getOrigin(){return this.origin_}getPoints(){return this.points_}getRadius(){return this.radius}setRadius(e){this.radius!==e&&(this.radius=e,this.render())}getRadius2(){return this.radius2_}setRadius2(e){this.radius2_!==e&&(this.radius2_=e,this.render())}getSize(){return this.size_}getStroke(){return this.stroke_}setStroke(e){this.stroke_=e,this.render()}listenImageChange(e){}load(){}unlistenImageChange(e){}calculateLineJoinSize_(e,t,n){if(t===0||this.points_===1/0||e!==`bevel`&&e!==`miter`)return t;let r=this.radius,i=this.radius2_===void 0?r:this.radius2_;if(r{this.patternImage_=null}),t.getImageState()===Q.IDLE&&t.load(),t.getImageState()===Q.LOADING&&(this.patternImage_=t)}this.color_=e}getKey(){let e=this.getColor();return e?e instanceof CanvasPattern||e instanceof CanvasGradient?V(e):typeof e==`object`&&`src`in e?e.src+`:`+e.offset:Im(e).toString():``}loading(){return!!this.patternImage_}ready(){return this.patternImage_?this.patternImage_.ready():Promise.resolve()}};function Dg(e,t,n,r){return n!==void 0&&r!==void 0?[n/e,r/t]:n===void 0?r===void 0?1:r/t:n/e}var Og=class e extends Cg{constructor(e){e||={};let t=e.opacity===void 0?1:e.opacity,n=e.rotation===void 0?0:e.rotation,r=e.scale===void 0?1:e.scale,i=e.rotateWithView!==void 0&&e.rotateWithView;super({opacity:t,rotation:n,scale:r,displacement:e.displacement===void 0?[0,0]:e.displacement,rotateWithView:i,declutterMode:e.declutterMode}),this.anchor_=e.anchor===void 0?[.5,.5]:e.anchor,this.normalizedAnchor_=null,this.anchorOrigin_=e.anchorOrigin===void 0?`top-left`:e.anchorOrigin,this.anchorXUnits_=e.anchorXUnits===void 0?`fraction`:e.anchorXUnits,this.anchorYUnits_=e.anchorYUnits===void 0?`fraction`:e.anchorYUnits,this.crossOrigin_=e.crossOrigin===void 0?null:e.crossOrigin,this.referrerPolicy_=e.referrerPolicy;let a=e.img===void 0?null:e.img,o=e.src;U(!(o!==void 0&&a),"`image` and `src` cannot be provided at the same time"),(o===void 0||o.length===0)&&a&&(o=a.src||V(a)),U(o!==void 0&&o.length>0,"A defined and non-empty `src` or `image` must be provided"),U(e.width===void 0&&e.height===void 0||e.scale===void 0,"`width` or `height` cannot be provided together with `scale`");let s;if(e.src===void 0?a!==void 0&&(s=`complete`in a?a.complete?a.src?Q.LOADED:Q.IDLE:Q.LOADING:Q.LOADED):s=Q.IDLE,this.color_=e.color===void 0?null:Im(e.color),this.iconImage_=Zh(a,o,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},s,this.color_),this.offset_=e.offset===void 0?[0,0]:e.offset,this.offsetOrigin_=e.offsetOrigin===void 0?`top-left`:e.offsetOrigin,this.origin_=null,this.size_=e.size===void 0?null:e.size,this.initialOptions_,e.width!==void 0||e.height!==void 0){let t,n;if(e.size)[t,n]=e.size;else{let r=this.getImage(1);if(r.width&&r.height)t=r.width,n=r.height;else if(r instanceof HTMLImageElement){this.initialOptions_=e;let t=()=>{if(this.unlistenImageChange(t),!this.initialOptions_)return;let n=this.iconImage_.getSize();n&&this.setScale(Dg(n[0],n[1],e.width,e.height))};this.listenImageChange(t);return}}t!==void 0&&this.setScale(Dg(t,n,e.width,e.height))}}clone(){let t,n,r;return this.initialOptions_?(n=this.initialOptions_.width,r=this.initialOptions_.height):(t=this.getScale(),t=Array.isArray(t)?t.slice():t),new e({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:n,height:r,size:this.size_===null?void 0:this.size_.slice(),src:this.getSrc(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()})}getAnchor(){let e=this.normalizedAnchor_;if(!e){e=this.anchor_;let t=this.getSize();if(this.anchorXUnits_==`fraction`||this.anchorYUnits_==`fraction`){if(!t)return null;e=this.anchor_.slice(),this.anchorXUnits_==`fraction`&&(e[0]*=t[0]),this.anchorYUnits_==`fraction`&&(e[1]*=t[1])}if(this.anchorOrigin_!=`top-left`){if(!t)return null;e===this.anchor_&&(e=this.anchor_.slice()),(this.anchorOrigin_==`top-right`||this.anchorOrigin_==`bottom-right`)&&(e[0]=-e[0]+t[0]),(this.anchorOrigin_==`bottom-left`||this.anchorOrigin_==`bottom-right`)&&(e[1]=-e[1]+t[1])}this.normalizedAnchor_=e}let t=this.getDisplacement(),n=this.getScaleArray();return[e[0]-t[0]/n[0],e[1]+t[1]/n[1]]}setAnchor(e){this.anchor_=e,this.normalizedAnchor_=null}getColor(){return this.color_}setColor(e){let t=e?Im(e):null;if(this.color_===t||this.color_&&t&&this.color_.length===t.length&&this.color_.every((e,n)=>e===t[n]))return;this.color_=t;let n=this.getSrc(),r=n===void 0?this.getHitDetectionImage():null,i=n===void 0?this.iconImage_.getImageState():Q.IDLE;this.iconImage_=Zh(r,n,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},i,this.color_)}getImage(e){return this.iconImage_.getImage(e)}getPixelRatio(e){return this.iconImage_.getPixelRatio(e)}getImageSize(){return this.iconImage_.getSize()}getImageState(){return this.iconImage_.getImageState()}getHitDetectionImage(){return this.iconImage_.getHitDetectionImage()}getOrigin(){if(this.origin_)return this.origin_;let e=this.offset_;if(this.offsetOrigin_!=`top-left`){let t=this.getSize(),n=this.iconImage_.getSize();if(!t||!n)return null;e=e.slice(),(this.offsetOrigin_==`top-right`||this.offsetOrigin_==`bottom-right`)&&(e[0]=n[0]-t[0]-e[0]),(this.offsetOrigin_==`bottom-left`||this.offsetOrigin_==`bottom-right`)&&(e[1]=n[1]-t[1]-e[1])}return this.origin_=e,this.origin_}getSrc(){return this.iconImage_.getSrc()}setSrc(e){this.iconImage_=Zh(null,e,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},Q.IDLE,this.color_)}getSize(){return this.size_?this.size_:this.iconImage_.getSize()}getWidth(){let e=this.getScaleArray();if(this.size_)return this.size_[0]*e[0];if(this.iconImage_.getImageState()==Q.LOADED){let t=this.iconImage_.getSize();if(t)return t[0]*e[0]}}getHeight(){let e=this.getScaleArray();if(this.size_)return this.size_[1]*e[1];if(this.iconImage_.getImageState()==Q.LOADED){let t=this.iconImage_.getSize();if(t)return t[1]*e[1]}}setScale(e){delete this.initialOptions_,super.setScale(e)}listenImageChange(e){this.iconImage_.addEventListener(z.CHANGE,e)}load(){this.iconImage_.load()}unlistenImageChange(e){this.iconImage_.removeEventListener(z.CHANGE,e)}ready(){return this.iconImage_.ready()}},kg=class e{constructor(e){e||={},this.color_=e.color===void 0?null:e.color,this.lineCap_=e.lineCap,this.lineDash_=e.lineDash===void 0?null:e.lineDash,this.lineDashOffset_=e.lineDashOffset,this.lineJoin_=e.lineJoin,this.miterLimit_=e.miterLimit,this.offset_=e.offset,this.width_=e.width}clone(){let t=this.getColor();return new e({color:Array.isArray(t)?t.slice():t||void 0,lineCap:this.getLineCap(),lineDash:this.getLineDash()?.slice(),lineDashOffset:this.getLineDashOffset(),lineJoin:this.getLineJoin(),miterLimit:this.getMiterLimit(),offset:this.getOffset(),width:this.getWidth()})}getColor(){return this.color_}getLineCap(){return this.lineCap_}getLineDash(){return this.lineDash_}getLineDashOffset(){return this.lineDashOffset_}getLineJoin(){return this.lineJoin_}getMiterLimit(){return this.miterLimit_}getOffset(){return this.offset_}getWidth(){return this.width_}setColor(e){this.color_=e}setLineCap(e){this.lineCap_=e}setLineDash(e){this.lineDash_=e}setLineDashOffset(e){this.lineDashOffset_=e}setLineJoin(e){this.lineJoin_=e}setMiterLimit(e){this.miterLimit_=e}setOffset(e){this.offset_=e}setWidth(e){this.width_=e}},Ag=class e{constructor(e){e||={},this.geometry_=null,this.geometryFunction_=Pg,e.geometry!==void 0&&this.setGeometry(e.geometry),this.fill_=e.fill===void 0?null:e.fill,this.image_=e.image===void 0?null:e.image,this.renderer_=e.renderer===void 0?null:e.renderer,this.hitDetectionRenderer_=e.hitDetectionRenderer===void 0?null:e.hitDetectionRenderer,this.stroke_=e.stroke===void 0?null:e.stroke,this.text_=e.text===void 0?null:e.text,this.zIndex_=e.zIndex}clone(){let t=this.getGeometry();return t&&typeof t==`object`&&(t=t.clone()),new e({geometry:t??void 0,fill:this.getFill()?.clone(),image:this.getImage()?.clone(),renderer:this.getRenderer()??void 0,stroke:this.getStroke()?.clone(),text:this.getText()?.clone(),zIndex:this.getZIndex()})}getRenderer(){return this.renderer_}setRenderer(e){this.renderer_=e}setHitDetectionRenderer(e){this.hitDetectionRenderer_=e}getHitDetectionRenderer(){return this.hitDetectionRenderer_}getGeometry(){return this.geometry_}getGeometryFunction(){return this.geometryFunction_}getFill(){return this.fill_}setFill(e){this.fill_=e}getImage(){return this.image_}setImage(e){this.image_=e}getStroke(){return this.stroke_}setStroke(e){this.stroke_=e}getText(){return this.text_}setText(e){this.text_=e}getZIndex(){return this.zIndex_}setGeometry(e){typeof e==`function`?this.geometryFunction_=e:typeof e==`string`?this.geometryFunction_=function(t){return t.get(e)}:e?e!==void 0&&(this.geometryFunction_=function(){return e}):this.geometryFunction_=Pg,this.geometry_=e}setZIndex(e){this.zIndex_=e}};function jg(e){let t;if(typeof e==`function`)t=e;else{let n;Array.isArray(e)?n=e:(U(typeof e.getZIndex==`function`,"Expected an `Style` or an array of `Style`"),n=[e]),t=function(){return n}}return t}var Mg=null;function Ng(e,t){if(!Mg){let e=new Eg({color:`rgba(255,255,255,0.4)`}),t=new kg({color:`#3399CC`,width:1.25});Mg=[new Ag({image:new Tg({fill:e,stroke:t,radius:5}),fill:e,stroke:t})]}return Mg}function Pg(e){return e.getGeometry()}var Fg=`#333`,Ig=class e{constructor(e){e||={},this.font_=e.font,this.rotation_=e.rotation,this.rotateWithView_=e.rotateWithView,this.keepUpright_=e.keepUpright,this.scale_=e.scale,this.scaleArray_=Bm(e.scale===void 0?1:e.scale),this.text_=e.text,this.textAlign_=e.textAlign,this.justify_=e.justify,this.repeat_=e.repeat,this.textBaseline_=e.textBaseline,this.fill_=e.fill===void 0?new Eg({color:Fg}):e.fill,this.maxAngle_=e.maxAngle===void 0?Math.PI/4:e.maxAngle,this.placement_=e.placement===void 0?`point`:e.placement,this.overflow_=!!e.overflow,this.stroke_=e.stroke===void 0?null:e.stroke,this.offsetX_=e.offsetX===void 0?0:e.offsetX,this.offsetY_=e.offsetY===void 0?0:e.offsetY,this.backgroundFill_=e.backgroundFill?e.backgroundFill:null,this.backgroundStroke_=e.backgroundStroke?e.backgroundStroke:null,this.padding_=e.padding===void 0?null:e.padding,this.declutterMode_=e.declutterMode}clone(){let t=this.getScale();return new e({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 Eg?this.getFill().clone():this.getFill(),stroke:this.getStroke()?.clone(),offsetX:this.getOffsetX(),offsetY:this.getOffsetY(),backgroundFill:this.getBackgroundFill()?.clone(),backgroundStroke:this.getBackgroundStroke()?.clone(),padding:this.getPadding()||void 0,declutterMode:this.getDeclutterMode()})}getOverflow(){return this.overflow_}getFont(){return this.font_}getMaxAngle(){return this.maxAngle_}getPlacement(){return this.placement_}getRepeat(){return this.repeat_}getOffsetX(){return this.offsetX_}getOffsetY(){return this.offsetY_}getFill(){return this.fill_}getRotateWithView(){return this.rotateWithView_}getKeepUpright(){return this.keepUpright_}getRotation(){return this.rotation_}getScale(){return this.scale_}getScaleArray(){return this.scaleArray_}getStroke(){return this.stroke_}getText(){return this.text_}getTextAlign(){return this.textAlign_}getJustify(){return this.justify_}getTextBaseline(){return this.textBaseline_}getBackgroundFill(){return this.backgroundFill_}getBackgroundStroke(){return this.backgroundStroke_}getPadding(){return this.padding_}getDeclutterMode(){return this.declutterMode_}setOverflow(e){this.overflow_=e}setFont(e){this.font_=e}setMaxAngle(e){this.maxAngle_=e}setOffsetX(e){this.offsetX_=e}setOffsetY(e){this.offsetY_=e}setPlacement(e){this.placement_=e}setRepeat(e){this.repeat_=e}setRotateWithView(e){this.rotateWithView_=e}setKeepUpright(e){this.keepUpright_=e}setFill(e){this.fill_=e}setRotation(e){this.rotation_=e}setScale(e){this.scale_=e,this.scaleArray_=Bm(e===void 0?1:e)}setStroke(e){this.stroke_=e}setText(e){this.text_=e}setTextAlign(e){this.textAlign_=e}setJustify(e){this.justify_=e}setTextBaseline(e){this.textBaseline_=e}setBackgroundFill(e){this.backgroundFill_=e}setBackgroundStroke(e){this.backgroundStroke_=e}setPadding(e){this.padding_=e}};function Lg(e){return!0}function Rg(e,t){t??=ih();let n=Vg(e,t),r=Eh();return function(e,i){if(r.properties=e.getPropertiesInternal()??{},r.resolution=i,t.featureId){let t=e.getId();t===void 0?r.featureId=null:r.featureId=t}if(t.geometryType){let t=e.getGeometry();t&&(r.geometryType=Th(t))}return n(r)}}function zg(e,t){t??=ih();let n=e.length,r=Array(n);for(let i=0;inull;r=t_(e,t+`fill-color`,n)}if(!r)return null;let i=new Eg;return function(e){let t=r(e);return t===mm?null:(i.setColor(t),i)}}function Wg(e,t,n){let r=Zg(e,t+`stroke-width`,n),i=t_(e,t+`stroke-color`,n);if(!r&&!i)return null;let a=Qg(e,t+`stroke-line-cap`,n),o=Qg(e,t+`stroke-line-join`,n),s=n_(e,t+`stroke-line-dash`,n),c=Zg(e,t+`stroke-line-dash-offset`,n),l=Zg(e,t+`stroke-miter-limit`,n),u=Zg(e,t+`stroke-offset`,n),d=new kg;return function(e){if(i){let t=i(e);if(t===mm)return null;d.setColor(t)}if(r&&d.setWidth(r(e)),a){let t=a(e);if(t!==`butt`&&t!==`round`&&t!==`square`)throw Error(`Expected butt, round, or square line cap`);d.setLineCap(t)}if(o){let t=o(e);if(t!==`bevel`&&t!==`round`&&t!==`miter`)throw Error(`Expected bevel, round, or miter line join`);d.setLineJoin(t)}return s&&d.setLineDash(s(e)),c&&d.setLineDashOffset(c(e)),l&&d.setMiterLimit(l(e)),u&&d.setOffset(u(e)),d}}function Gg(e,t){let n=`text-`,r=Qg(e,`text-value`,t);if(!r)return null;let i=Ug(e,n,t),a=Ug(e,`text-background-`,t),o=Wg(e,n,t),s=Wg(e,`text-background-`,t),c=Qg(e,`text-font`,t),l=Zg(e,`text-max-angle`,t),u=Zg(e,`text-offset-x`,t),d=Zg(e,`text-offset-y`,t),f=e_(e,`text-overflow`,t),p=Qg(e,`text-placement`,t),m=Zg(e,`text-repeat`,t),h=a_(e,`text-scale`,t),g=e_(e,`text-rotate-with-view`,t),_=Zg(e,`text-rotation`,t),v=Qg(e,`text-align`,t),y=Qg(e,`text-justify`,t),b=Qg(e,`text-baseline`,t),x=e_(e,`text-keep-upright`,t),S=n_(e,`text-padding`,t),C=new Ig({declutterMode:f_(e,`text-declutter-mode`)});return function(e){if(C.setText(r(e)),i&&C.setFill(i(e)),a&&C.setBackgroundFill(a(e)),o&&C.setStroke(o(e)),s&&C.setBackgroundStroke(s(e)),c&&C.setFont(c(e)),l&&C.setMaxAngle(l(e)),u&&C.setOffsetX(u(e)),d&&C.setOffsetY(d(e)),f&&C.setOverflow(f(e)),p){let t=p(e);if(t!==`point`&&t!==`line`)throw Error(`Expected point or line for text-placement`);C.setPlacement(t)}if(m&&C.setRepeat(m(e)),h&&C.setScale(h(e)),g&&C.setRotateWithView(g(e)),_&&C.setRotation(_(e)),v){let t=v(e);if(t!==`left`&&t!==`center`&&t!==`right`&&t!==`end`&&t!==`start`)throw Error(`Expected left, right, center, start, or end for text-align`);C.setTextAlign(t)}if(y){let t=y(e);if(t!==`left`&&t!==`right`&&t!==`center`)throw Error(`Expected left, right, or center for text-justify`);C.setJustify(t)}if(b){let t=b(e);if(t!==`bottom`&&t!==`top`&&t!==`middle`&&t!==`alphabetic`&&t!==`hanging`)throw Error(`Expected bottom, top, middle, alphabetic, or hanging for text-baseline`);C.setTextBaseline(t)}return S&&C.setPadding(S(e)),x&&C.setKeepUpright(x(e)),C}}function Kg(e,t){return`icon-src`in e?qg(e,t):`shape-points`in e?Jg(e,t):`circle-radius`in e?Yg(e,t):null}function qg(e,t){let n=`icon-src`,r=m_(Xg(e,n),n),i=r_(e,`icon-anchor`,t),a=a_(e,`icon-scale`,t),o=Zg(e,`icon-opacity`,t),s=r_(e,`icon-displacement`,t),c=Zg(e,`icon-rotation`,t),l=e_(e,`icon-rotate-with-view`,t),u=l_(e,`icon-anchor-origin`),d=u_(e,`icon-anchor-x-units`),f=u_(e,`icon-anchor-y-units`),p=Xg(e,`icon-color`),m,h=null;p!==void 0&&(Array.isArray(p)&&p.length>0&&typeof p[0]==`string`?h=t_(e,`icon-color`,t):m=g_(p,`icon-color`));let g=c_(e,`icon-cross-origin`),_=d_(e,`icon-offset`),v=l_(e,`icon-offset-origin`),y=o_(e,`icon-width`),b={src:r,anchorOrigin:u,anchorXUnits:d,anchorYUnits:f,crossOrigin:g,offset:_,offsetOrigin:v,height:o_(e,`icon-height`),width:y,size:s_(e,`icon-size`),declutterMode:f_(e,`icon-declutter-mode`)},x=null;return function(e){if(x)h&&x.setColor(h(e));else{let t=h?h(e):m;x=new Og(t===void 0?Object.assign({},b):Object.assign({},b,{color:t}))}return o&&x.setOpacity(o(e)),s&&x.setDisplacement(s(e)),c&&x.setRotation(c(e)),l&&x.setRotateWithView(l(e)),a&&x.setScale(a(e)),i&&x.setAnchor(i(e)),x}}function Jg(e,t){let n=`shape-`,r=`shape-points`,i=`shape-radius`,a=h_(Xg(e,r),r);if(!(i in e))throw Error(`Expected a number for ${i}`);let o=Zg(e,i,t),s=Xg(e,i),c=typeof s==`number`?s:5,l=`shape-radius2`,u=Zg(e,l,t),d=Xg(e,l),f=typeof d==`number`?d:void 0,p=Ug(e,n,t),m=Wg(e,n,t),h=a_(e,`shape-scale`,t),g=r_(e,`shape-displacement`,t),_=Zg(e,`shape-rotation`,t),v=e_(e,`shape-rotate-with-view`,t),y=new wg({points:a,radius:c,radius2:f,angle:o_(e,`shape-angle`),declutterMode:f_(e,`shape-declutter-mode`)});return function(e){return o&&y.setRadius(o(e)),u&&y.setRadius2(u(e)),p&&y.setFill(p(e)),m&&y.setStroke(m(e)),g&&y.setDisplacement(g(e)),_&&y.setRotation(_(e)),v&&y.setRotateWithView(v(e)),h&&y.setScale(h(e)),y}}function Yg(e,t){let n=`circle-`,r=Ug(e,n,t),i=Wg(e,n,t),a=Zg(e,`circle-radius`,t),o=a_(e,`circle-scale`,t),s=r_(e,`circle-displacement`,t),c=Zg(e,`circle-rotation`,t),l=e_(e,`circle-rotate-with-view`,t),u=new Tg({radius:5,declutterMode:f_(e,`circle-declutter-mode`)});return function(e){return a&&u.setRadius(a(e)),r&&u.setFill(r(e)),i&&u.setStroke(i(e)),s&&u.setDisplacement(s(e)),c&&u.setRotation(c(e)),l&&u.setRotateWithView(l(e)),o&&u.setScale(o(e)),u}}function Xg(e,t){if(!(t in e))return;let n=e[t];return n===void 0?void 0:n}function Zg(e,t,n){let r=Xg(e,t);if(r===void 0)return;let i=Dh(r,q,n);return function(e){return h_(i(e),t)}}function Qg(e,t,n){let r=Xg(e,t);if(r===void 0)return null;let i=Dh(r,Um,n);return function(e){return m_(i(e),t)}}function $g(e,t,n){let r=Qg(e,t+`pattern-src`,n),i=i_(e,t+`pattern-offset`,n),a=i_(e,t+`pattern-size`,n),o=t_(e,t+`color`,n);return function(e){return r?{src:r(e),offset:i?i(e):null,size:a?a(e):null,color:o?o(e):null}:null}}function e_(e,t,n){let r=Xg(e,t);if(r===void 0)return null;let i=Dh(r,Hm,n);return function(e){let n=i(e);if(typeof n!=`boolean`)throw Error(`Expected a boolean for ${t}`);return n}}function t_(e,t,n){let r=Xg(e,t);if(r===void 0)return null;let i=Dh(r,Wm,n);return function(e){return g_(i(e),t)}}function n_(e,t,n){let r=Xg(e,t);if(r===void 0)return null;if(Array.isArray(r)&&(r.length===0||typeof r[0]!=`string`)){let e=r.map((e,r)=>{if(typeof e==`number`)return()=>e;let i=Dh(e,q,n);return function(e){return h_(i(e),`${t}[${r}]`)}});return function(t){let n=Array(e.length);for(let r=0;r4)throw Error(`Expected a color with 3 or 4 values for ${t}`);return n}function __(e,t){let n=p_(e,t);if(n.length!==2)throw Error(`Expected an array of two numbers for ${t}`);return n}function v_(e,t){return typeof e==`number`?e:__(e,t)}var y_={RENDER_ORDER:`renderOrder`},b_=class extends Jp{constructor(e){e||={};let t=Object.assign({},e);delete t.style,delete t.renderBuffer,delete t.updateWhileAnimating,delete t.updateWhileInteracting,super(t),this.declutter_=e.declutter?String(e.declutter):void 0,this.renderBuffer_=e.renderBuffer===void 0?100:e.renderBuffer,this.style_=null,this.styleFunction_=void 0,this.setStyle(e.style),this.updateWhileAnimating_=e.updateWhileAnimating!==void 0&&e.updateWhileAnimating,this.updateWhileInteracting_=e.updateWhileInteracting!==void 0&&e.updateWhileInteracting}getDeclutter(){return this.declutter_}getFeatures(e){return super.getFeatures(e)}getRenderBuffer(){return this.renderBuffer_}getRenderOrder(){return this.get(y_.RENDER_ORDER)}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}getUpdateWhileAnimating(){return this.updateWhileAnimating_}getUpdateWhileInteracting(){return this.updateWhileInteracting_}renderDeclutter(e,t){let n=this.getDeclutter();if(!n)return;e.declutter||={},n in e.declutter||(e.declutter[n]=new $p(9));let r=this.getRenderer();r&&r.renderDeclutter(e,t)}setRenderOrder(e){this.set(y_.RENDER_ORDER,e)}setStyle(e){this.style_=e===void 0?Ng:e??null;let t=x_(e);this.styleFunction_=e===null||t===null?void 0:jg(t),this.changed()}setDeclutter(e){this.declutter_=e?String(e):void 0,this.changed()}};function x_(e){if(e===void 0)return Ng;if(!e)return null;if(typeof e==`function`||e instanceof Ag)return e;if(Array.isArray(e)&&e.length===0)return[];if(Array.isArray(e)&&e[0]instanceof Ag){let t=e.length,n=Array(t);for(let r=0;r=0;--i){let a=m[i],d=a.layer;if(d.hasRenderer()&&Yp(a,l)&&o.call(s,d)){let i=d.getRenderer(),o=d.getSource();if(i&&o){let s=o.getWrapX()?f:e,l=u.bind(null,a.managed);_[0]=s[0]+p[r][0],_[1]=s[1]+p[r][1],c=i.forEachFeatureAtCoordinate(_,t,n,l,g)}if(c)return c}}if(g.length===0)return;let v=1/g.length;return g.forEach((e,t)=>e.distanceSq+=t*v),g.sort((e,t)=>e.distanceSq-t.distanceSq),g.some(e=>c=e.callback(e.feature,e.layer,e.geometry)),c}hasFeatureAtCoordinate(e,t,n,r,i,a){return this.forEachFeatureAtCoordinate(e,t,n,r,qs,this,i,a)!==void 0}getMap(){return this.map_}renderFrame(e){B()}scheduleExpireIconCache(e){Jh.canExpireCache()&&e.postRenderFunctions.push(w_)}};function w_(e,t){Jh.expire()}var T_=class extends C_{constructor(e){super(e),this.fontChangeListenerKey_=L(lg,Ms.PROPERTYCHANGE,e.redrawText,e),this.element_=mc?Qf():document.createElement(`div`);let t=this.element_.style;t.position=`absolute`,t.width=`100%`,t.height=`100%`,t.zIndex=`0`,this.element_.className=Rf+` ol-layers`;let n=e.getViewport();n&&n.insertBefore(this.element_,n.firstChild||null),this.children_=[],this.renderedVisible_=!0}dispatchRenderEvent(e,t){let n=this.getMap();if(n.hasListener(e)){let r=new S_(e,void 0,t);n.dispatchEvent(r)}}disposeInternal(){R(this.fontChangeListenerKey_),this.element_.remove(),super.disposeInternal()}renderFrame(e){if(!e){this.renderedVisible_&&=(this.element_.style.display=`none`,!1);return}this.calculateMatrices2D(e),this.dispatchRenderEvent(qp.PRECOMPOSE,e);let t=e.layerStatesArray.sort((e,t)=>e.zIndex-t.zIndex);t.some(e=>e.layer instanceof b_&&e.layer.getDeclutter())&&(e.declutter={});let n=e.viewState;this.children_.length=0;let r=this.getMap().getTargetElement(),i;$f(r)&&(i=r.getContext(`2d`),i.setTransform(1,0,0,1,0,0),i.clearRect(0,0,r.width,r.height));let a=[],o=i?r:null;for(let r=0,i=t.length;r0)&&(i.fillStyle=n,i.fillRect(0,0,i.canvas.width,i.canvas.height)),!$f(t)||t.width===0)continue;i.save();let r=e.style.opacity||t.style.opacity;i.globalAlpha=r===``?1:Number(r);let a=t.style.transform;if(a)i.transform(...wd(a));else{let e=parseFloat(t.style.width)/t.width,n=parseFloat(t.style.height)/t.height;i.transform(e,0,0,n,0,0)}i.drawImage(t,0,0),i.restore()}this.dispatchRenderEvent(qp.POSTCOMPOSE,e),this.renderedVisible_||=(this.element_.style.display=``,!0),this.scheduleExpireIconCache(e)}declutter(e,t){if(e.declutter){for(let n=t.length-1;n>=0;--n){let r=t[n],i=r.layer;i.getDeclutter()&&i.renderDeclutter(e,r)}t.forEach(t=>t.layer?.renderDeferred(e))}}};function E_(e){e instanceof Jp?e.setMapInternal(null):e instanceof Kp&&e.getLayers().forEach(E_)}function D_(e,t){if(e instanceof Jp)e.setMapInternal(t);else if(e instanceof Kp){let n=e.getLayers().getArray();for(let e=0,r=n.length;ethis.updateSize())),this.controls=t.controls||(mc?new oc:ip()),this.interactions=t.interactions||(mc?new oc:Vp({onFocusOnly:!0})),this.overlays_=t.overlays,this.overlayIdIndex_={},this.renderer_=null,this.postRenderFunctions_=[],this.tileQueue_=new Cc(this.getTilePriority.bind(this),this.handleTileChange_.bind(this)),this.addChangeListener(bc.LAYERGROUP,this.handleLayerGroupChanged_),this.addChangeListener(bc.VIEW,this.handleViewChanged_),this.addChangeListener(bc.SIZE,this.handleSizeChanged_),this.addChangeListener(bc.TARGET,this.handleTargetChanged_),this.setProperties(t.values);let n=this;e.view&&!(e.view instanceof Af)&&e.view.then(function(e){n.setView(new Af(e))}),this.controls.addEventListener(js.ADD,(e=>{e.element.setMap(this)})),this.controls.addEventListener(js.REMOVE,(e=>{e.element.setMap(null)})),this.interactions.addEventListener(js.ADD,(e=>{e.element.setMap(this)})),this.interactions.addEventListener(js.REMOVE,(e=>{e.element.setMap(null)})),this.overlays_.addEventListener(js.ADD,(e=>{this.addOverlayInternal_(e.element)})),this.overlays_.addEventListener(js.REMOVE,(e=>{let t=e.element.getId();t!==void 0&&delete this.overlayIdIndex_[t.toString()],e.element.setMap(null)})),this.controls.forEach(e=>{e.setMap(this)}),this.interactions.forEach(e=>{e.setMap(this)}),this.overlays_.forEach(this.addOverlayInternal_.bind(this))}addControl(e){this.getControls().push(e)}addInteraction(e){this.getInteractions().push(e)}addLayer(e){this.getLayerGroup().getLayers().push(e)}handleLayerAdd_(e){D_(e.layer,this)}addOverlay(e){this.getOverlays().push(e)}addOverlayInternal_(e){let t=e.getId();t!==void 0&&(this.overlayIdIndex_[t.toString()]=e),e.setMap(this)}disposeInternal(){this.controls.clear(),this.interactions.clear(),this.overlays_.clear(),this.resizeObserver_?.disconnect(),this.setTarget(null),super.disposeInternal()}forEachFeatureAtPixel(e,t,n){if(!this.frameState_||!this.renderer_)return;let r=this.getCoordinateFromPixelInternal(e);n=n===void 0?{}:n;let i=n.hitTolerance===void 0?0:n.hitTolerance,a=n.layerFilter===void 0?qs:n.layerFilter,o=n.checkWrapped!==!1;return this.renderer_.forEachFeatureAtCoordinate(r,this.frameState_,i,o,t,null,a,null)}getFeaturesAtPixel(e,t){let n=[];return this.forEachFeatureAtPixel(e,function(e){n.push(e)},t),n}getAllLayers(){let e=[];function t(n){n.forEach(function(n){n instanceof Kp?t(n.getLayers()):e.push(n)})}return t(this.getLayers()),e}hasFeatureAtPixel(e,t){if(!this.frameState_||!this.renderer_)return!1;let n=this.getCoordinateFromPixelInternal(e);t=t===void 0?{}:t;let r=t.layerFilter===void 0?qs:t.layerFilter,i=t.hitTolerance===void 0?0:t.hitTolerance,a=t.checkWrapped!==!1;return this.renderer_.hasFeatureAtCoordinate(n,this.frameState_,i,a,r,null)}getEventCoordinate(e){return this.getCoordinateFromPixel(this.getEventPixel(e))}getEventCoordinateInternal(e){return this.getCoordinateFromPixelInternal(this.getEventPixel(e))}getEventPixel(e){let t=this.viewport_.getBoundingClientRect(),n=this.getSize(),r=t.width/n[0],i=t.height/n[1],a=`changedTouches`in e?e.changedTouches[0]:e;return[(a.clientX-t.left)/r,(a.clientY-t.top)/i]}getTarget(){return this.get(bc.TARGET)}getTargetElement(){return this.targetElement_}getCoordinateFromPixel(e,t){let n=cd(this.getCoordinateFromPixelInternal(e),this.getView().getProjection());return t?.wrapX&&n&&kl(n,sd()||this.getView().getProjection()),n}getCoordinateFromPixelInternal(e){let t=this.frameState_;return t?vd(t.pixelToCoordinateTransform,e.slice()):null}getControls(){return this.controls}getOverlays(){return this.overlays_}getOverlayById(e){let t=this.overlayIdIndex_[e.toString()];return t===void 0?null:t}getInteractions(){return this.interactions}getLayerGroup(){return this.get(bc.LAYERGROUP)}setLayers(e){let t=this.getLayerGroup();if(e instanceof oc){t.setLayers(e);return}let n=t.getLayers();n.clear(),n.extend(e)}getLayers(){return this.getLayerGroup().getLayers()}updateRenderComplete_(){this.renderComplete_=(this.hasListener(yc.LOADSTART)||this.hasListener(yc.LOADEND)||this.hasListener(qp.RENDERCOMPLETE))&&!this.tileQueue_.getTilesLoading()&&!this.tileQueue_.getCount()&&!this.getLoadingOrNotReady()}getLoadingOrNotReady(){let e=this.getLayerGroup().getLayerStatesArray();for(let t=0,n=e.length;t=0;n--){let r=t[n];if(r.getMap()===this&&r.getActive()&&this.getTargetElement()&&(!r.handleEvent(e)||e.propagationStopped))break}}}handlePostRender(){let e=this.frameState_,t=this.tileQueue_;if(!t.isEmpty()){let n=this.maxTilesLoading_,r=n,i=e?e.viewHints:void 0;if(i&&(i[Tc.ANIMATING]||i[Tc.INTERACTING])){let t=Date.now()-e.time>8;n=t?0:8,r=t?0:2}if(t.getTilesLoading(){this.postRenderTimeoutHandle_=void 0,this.handlePostRender()},0)}setLayerGroup(e){let t=this.getLayerGroup();t&&this.handleLayerRemove_(new Wp(`removelayer`,t)),this.set(bc.LAYERGROUP,e)}setSize(e){this.set(bc.SIZE,e)}setTarget(e){this.set(bc.TARGET,e)}setView(e){if(!e||e instanceof Af){this.set(bc.VIEW,e);return}this.set(bc.VIEW,new Af);let t=this;e.then(function(e){t.setView(new Af(e))})}updateSize(){let e=this.getTargetElement(),t;if(e){let n,r;if($f(e)){let t=e.getContext(`2d`).getTransform();n=e.width/t.a,r=e.height/t.d}else{let t=getComputedStyle(e);n=e.offsetWidth-parseFloat(t.borderLeftWidth)-parseFloat(t.paddingLeft)-parseFloat(t.paddingRight)-parseFloat(t.borderRightWidth),r=e.offsetHeight-parseFloat(t.borderTopWidth)-parseFloat(t.paddingTop)-parseFloat(t.paddingBottom)-parseFloat(t.borderBottomWidth)}!isNaN(n)&&!isNaN(r)&&(t=[Math.max(0,n),Math.max(0,r)],!Rm(t)&&(e.offsetWidth||e.offsetHeight||e.getClientRects().length)&&Bl(`No map visible because the map container's width or height are 0.`))}let n=this.getSize();t&&(!n||!Us(t,n))&&(this.updateViewportSize_(t),this.setSize(t))}updateViewportSize_(e){let t=this.getView();t&&t.setViewportSize(e)}};function k_(e){let t=null;e.keyboardEventTarget!==void 0&&(t=typeof e.keyboardEventTarget==`string`?document.getElementById(e.keyboardEventTarget):e.keyboardEventTarget);let n={},r=e.layers&&typeof e.layers.getLayers==`function`?e.layers:new Kp({layers:e.layers});n[bc.LAYERGROUP]=r,n[bc.TARGET]=e.target,n[bc.VIEW]=e.view instanceof Af?e.view:new Af;let i;e.controls!==void 0&&(Array.isArray(e.controls)?i=new oc(e.controls.slice()):(U(typeof e.controls.getArray==`function`,"Expected `controls` to be an array or an `ol/Collection.js`"),i=e.controls));let a;e.interactions!==void 0&&(Array.isArray(e.interactions)?a=new oc(e.interactions.slice()):(U(typeof e.interactions.getArray==`function`,"Expected `interactions` to be an array or an `ol/Collection.js`"),a=e.interactions));let o;return e.overlays===void 0?o=new oc:Array.isArray(e.overlays)?o=new oc(e.overlays.slice()):(U(typeof e.overlays.getArray==`function`,"Expected `overlays` to be an array or an `ol/Collection.js`"),o=e.overlays),{controls:i,interactions:a,keyboardEventTarget:t,overlays:o,values:n}}var A_=class e extends rc{constructor(e){if(super(),this.on,this.once,this.un,this.id_=void 0,this.geometryName_=`geometry`,this.style_=null,this.styleFunction_=void 0,this.geometryChangeKey_=null,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),e){if(typeof e.getSimplifiedGeometry==`function`){let t=e;this.setGeometry(t)}else{let t=e;this.setProperties(t)}}}clone(){let t=new e,n=this.geometryName_;t.setGeometryName(n);let r=this.getPropertiesInternal();if(r){let e=this.getGeometry();for(let i in r)i===n&&e?t.set(i,e.clone()):t.set(i,r[i],!0)}let 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_&&=(R(this.geometryChangeKey_),null);let e=this.getGeometry();e&&(this.geometryChangeKey_=L(e,z.CHANGE,this.handleGeometryChange_,this)),this.changed()}setGeometry(e){this.set(this.geometryName_,e)}setStyle(e){this.style_=e??null,this.styleFunction_=e?j_(e):void 0,this.changed()}setId(e){this.id_=e,this.changed()}setGeometryName(e){e!==this.geometryName_&&(this.removeChangeListener(this.geometryName_,this.handleGeometryChanged_),this.geometryName_=e,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),this.handleGeometryChanged_())}};function j_(e){if(typeof e==`function`)return e;let t;return Array.isArray(e)?t=e:(U(typeof e.getZIndex==`function`,"Expected an `ol/style/Style` or an array of `ol/style/Style.js`"),t=[e]),function(){return t}}var M_=class extends $s{constructor(e,t,n){super(),n||={},this.tileCoord=e,this.state=t,this.key=``,this.transition_=n.transition===void 0?250:n.transition,this.transitionStarts_={},this.interpolate=!!n.interpolate}changed(){this.dispatchEvent(z.CHANGE)}release(){this.setState(H.EMPTY)}getKey(){return this.key+`/`+this.tileCoord}getTileCoord(){return this.tileCoord}getState(){return this.state}setState(e){if(this.state!==H.EMPTY){if(this.state!==H.ERROR&&this.state>e)throw Error(`Tile load sequence violation`);this.state=e,this.changed()}}load(){B()}getAlpha(e,t){if(!this.transition_)return 1;let n=this.transitionStarts_[e];if(!n)n=t,this.transitionStarts_[e]=n;else if(n===-1)return 1;let r=t-n+1e3/60;return r>=this.transition_?1:Nl(r/this.transition_)}inTransition(e){return this.transition_?this.transitionStarts_[e]!==-1:!1}endTransition(e){this.transition_&&(this.transitionStarts_[e]=-1)}disposeInternal(){this.release(),super.disposeInternal()}};function N_(e){return e instanceof Image||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageBitmap?e:null}function P_(e){return e instanceof Uint8Array||e instanceof Uint8ClampedArray||e instanceof Float32Array||e instanceof DataView?e:null}var F_=Error(`disposed`),I_=[256,256],L_=class extends M_{constructor(e){let t=H.IDLE;super(e.tileCoord,t,{transition:e.transition,interpolate:e.interpolate}),this.loader_=e.loader,this.data_=null,this.error_=null,this.size_=e.size||null,this.controller_=e.controller||null}getSize(){if(this.size_)return this.size_;let e=N_(this.data_);return e?[e.width,e.height]:I_}getData(){return this.data_}getError(){return this.error_}load(){if(this.state!==H.IDLE&&this.state!==H.ERROR)return;this.state=H.LOADING,this.changed();let e=this;this.loader_().then(function(t){e.data_=t,e.state=H.LOADED,e.changed()}).catch(function(t){e.error_=t,e.state=H.ERROR,e.changed()})}disposeInternal(){this.controller_&&=(this.controller_.abort(F_),null),super.disposeInternal()}},R_=class extends M_{constructor(e,t,n,r,i,a){super(e,t,a),this.crossOrigin_=r?.crossOrigin,this.referrerPolicy_=r?.referrerPolicy,this.src_=n,this.key=n,this.image_,mc?this.image_=new OffscreenCanvas(1,1):(this.image_=new Image,this.crossOrigin_!==null&&this.crossOrigin_!==void 0&&(this.image_.crossOrigin=this.crossOrigin_),this.referrerPolicy_!==void 0&&(this.image_.referrerPolicy=this.referrerPolicy_)),this.unlisten_=null,this.tileLoadFunction_=i}getImage(){return this.image_}setImage(e){this.image_=e,this.state=H.LOADED,this.unlistenImage_(),this.changed()}getCrossOrigin(){return this.crossOrigin_??null}getReferrerPolicy(){return this.referrerPolicy_}handleImageError_(){this.state=H.ERROR,this.unlistenImage_(),this.image_=z_(),this.changed()}handleImageLoad_(){if(mc)this.state=H.LOADED;else{let e=this.image_;this.state=e.naturalWidth&&e.naturalHeight?H.LOADED:H.EMPTY}this.unlistenImage_(),this.changed()}load(){if(this.state==H.ERROR&&(this.state=H.IDLE,this.image_=new Image,this.crossOrigin_!==null&&this.crossOrigin_!==void 0&&(this.image_.crossOrigin=this.crossOrigin_),this.referrerPolicy_!==void 0&&(this.image_.referrerPolicy=this.referrerPolicy_)),this.state==H.IDLE){this.state=H.LOADING,this.changed(),this.tileLoadFunction_(this,this.src_);let e=this.image_;e&&(this.unlisten_=Uh(e,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this)))}}unlistenImage_(){this.unlisten_&&=(this.unlisten_(),null)}disposeInternal(){this.unlistenImage_(),this.image_=null,super.disposeInternal()}};function z_(){let e=Gf(1,1);return e.fillStyle=`rgba(0,0,0,0)`,e.fillRect(0,0,1,1),e.canvas}var B_=class{constructor(e,t,n,r){this.minX=e,this.maxX=t,this.minY=n,this.maxY=r}contains(e){return this.containsXY(e[1],e[2])}containsTileRange(e){return this.minX<=e.minX&&e.maxX<=this.maxX&&this.minY<=e.minY&&e.maxY<=this.maxY}containsXY(e,t){return this.minX<=e&&e<=this.maxX&&this.minY<=t&&t<=this.maxY}equals(e){return this.minX==e.minX&&this.minY==e.minY&&this.maxX==e.maxX&&this.maxY==e.maxY}extend(e){e.minXthis.maxX&&(this.maxX=e.maxX),e.minYthis.maxY&&(this.maxY=e.maxY)}getHeight(){return this.maxY-this.minY+1}getSize(){return[this.getWidth(),this.getHeight()]}getWidth(){return this.maxX-this.minX+1}intersects(e){return this.minX<=e.maxX&&this.maxX>=e.minX&&this.minY<=e.maxY&&this.maxY>=e.minY}};function V_(e,t,n,r,i){return i===void 0?new B_(e,t,n,r):(i.minX=e,i.maxX=t,i.minY=n,i.maxY=r,i)}var H_,U_=[];function W_(e,t,n,r,i){e.beginPath(),e.moveTo(0,0),e.lineTo(t,n),e.lineTo(r,i),e.closePath(),e.save(),e.clip(),e.fillRect(0,0,Math.max(t,r)+1,Math.max(n,i)),e.restore()}function G_(e,t){return Math.abs(e[t*4]-210)>2||Math.abs(e[t*4+3]-191.25)>2}function K_(){if(H_===void 0){let e=Gf(6,6,U_);e.globalCompositeOperation=`lighter`,e.fillStyle=`rgba(210, 0, 0, 0.75)`,W_(e,4,5,4,0),W_(e,4,5,0,5);let t=e.getImageData(0,0,3,3).data;H_=G_(t,0)||G_(t,4)||G_(t,8),Jf(e),U_.push(e.canvas)}return H_}function q_(e,t,n,r){let i=ad(n,t,e),a=Yu(t,r,n),o=t.getMetersPerUnit();o!==void 0&&(a*=o);let s=e.getMetersPerUnit();s!==void 0&&(a/=s);let c=e.getExtent();if(!c||Gc(c,i)){let t=Yu(e,a,i)/a;isFinite(t)&&t>0&&(a/=t)}return a}function J_(e,t,n,r){let i=q_(e,t,ll(n),r);return(!isFinite(i)||i<=0)&&al(n,function(n){return i=q_(e,t,n,r),isFinite(i)&&i>0}),i}function Y_(e,t,n,r,i,a,o,s,c,l,u,d,f,p){let m=Gf(Math.round(n*e),Math.round(n*t),U_);if(d||(m.imageSmoothingEnabled=!1),c.length===0)return m.canvas;m.scale(n,n);function h(e){return Math.round(e*n)/n}m.globalCompositeOperation=`lighter`;let g=Yc();c.forEach(function(e,t,n){tl(g,e.extent)});let _,v=n/r,y=(d?1:1+2**-24)/v;if(!f||c.length!==1||l!==0){let e=Gf(Math.round(G(g)*v),Math.round(pl(g)*v),U_);if(_=e,d||(e.imageSmoothingEnabled=!1),i&&p){let t=(i[0]-g[0])*v,n=-(i[3]-g[3])*v,r=G(i)*v,a=pl(i)*v;e.rect(t,n,r,a),e.clip()}c.forEach(function(t,n,r){if(t.image.width>0&&t.image.height>0){if(t.clipExtent){e.save();let n=(t.clipExtent[0]-g[0])*v,r=-(t.clipExtent[3]-g[3])*v,i=G(t.clipExtent)*v,a=pl(t.clipExtent)*v;e.rect(d?n:Math.round(n),d?r:Math.round(r),d?i:Math.round(n+i)-Math.round(n),d?a:Math.round(r+a)-Math.round(r)),e.clip()}let n=(t.extent[0]-g[0])*v,r=-(t.extent[3]-g[3])*v,i=G(t.extent)*v,a=pl(t.extent)*v;e.drawImage(t.image,l,l,t.image.width-2*l,t.image.height-2*l,d?n:Math.round(n),d?r:Math.round(r),d?i:Math.round(n+i)-Math.round(n),d?a:Math.round(r+a)-Math.round(r)),t.clipExtent&&e.restore()}})}let b=gl(o);return s.getTriangles().forEach(function(e,t,n){let r=e.source,i=e.target,o=r[0][0],s=r[0][1],l=r[1][0],u=r[1][1],f=r[2][0],p=r[2][1],v=h((i[0][0]-b[0])/a),x=h(-(i[0][1]-b[1])/a),S=h((i[1][0]-b[0])/a),C=h(-(i[1][1]-b[1])/a),w=h((i[2][0]-b[0])/a),T=h(-(i[2][1]-b[1])/a),E=o,D=s;o=0,s=0,l-=E,u-=D,f-=E,p-=D;let O=kc([[l,u,0,0,S-v],[f,p,0,0,w-v],[0,0,l,u,C-x],[0,0,f,p,T-x]]);if(!O)return;if(m.save(),m.beginPath(),K_()||!d){m.moveTo(S,C);let e=v-S,t=x-C;for(let n=0;n<4;n++)m.lineTo(S+h((n+1)*e/4),C+h(n*t/3)),n!=3&&m.lineTo(S+h((n+1)*e/4),C+h((n+1)*t/3));m.lineTo(w,T)}else m.moveTo(S,C),m.lineTo(v,x),m.lineTo(w,T);m.clip(),m.transform(O[0],O[2],O[1],O[3],v,x),m.translate(g[0]-E,g[3]-D);let k;if(_)k=_.canvas,m.scale(y,-y);else{let e=c[0],t=e.extent;k=e.image,m.scale(G(t)/k.width,-pl(t)/k.height)}m.drawImage(k,0,0),m.restore()}),_&&(Jf(_),U_.push(_.canvas)),u&&(m.save(),m.globalCompositeOperation=`source-over`,m.strokeStyle=`black`,m.lineWidth=1,s.getTriangles().forEach(function(e,t,n){let r=e.target,i=(r[0][0]-b[0])/a,o=-(r[0][1]-b[1])/a,s=(r[1][0]-b[0])/a,c=-(r[1][1]-b[1])/a,l=(r[2][0]-b[0])/a,u=-(r[2][1]-b[1])/a;m.beginPath(),m.moveTo(s,c),m.lineTo(i,o),m.lineTo(l,u),m.closePath(),m.stroke()}),m.restore()),m.canvas}var X_=10,Z_=.25,Q_=class{constructor(e,t,n,r,i,a,o){this.sourceProj_=e,this.targetProj_=t;let s={},c=o?$u(e=>vd(o,ad(e,this.targetProj_,this.sourceProj_))):id(this.targetProj_,this.sourceProj_);this.transformInv_=function(e){let t=e[0]+`/`+e[1];return s[t]||(s[t]=c(e)),s[t]},this.maxSourceExtent_=r,this.errorThresholdSquared_=i*i,this.triangles_=[],this.wrapsXInSource_=!1,this.canWrapXInSource_=this.sourceProj_.canWrapX()&&!!r&&!!this.sourceProj_.getExtent()&&G(r)>=G(this.sourceProj_.getExtent()),this.sourceWorldWidth_=this.sourceProj_.getExtent()?G(this.sourceProj_.getExtent()):void 0,this.targetWorldWidth_=this.targetProj_.getExtent()?G(this.targetProj_.getExtent()):void 0;let l=gl(n),u=_l(n),d=cl(n),f=sl(n),p=this.transformInv_(l),m=this.transformInv_(u),h=this.transformInv_(d),g=this.transformInv_(f),_=X_+(a?Math.max(0,Math.ceil(Math.log2(ol(n)/(a*a*256*256)))):0);if(this.addQuad_(l,u,d,f,p,m,h,g,_),this.wrapsXInSource_){let e=this.sourceWorldWidth_;if(!e)return;let t=1/0;this.triangles_.forEach(function(e,n,r){t=Math.min(t,e.source[0][0],e.source[1][0],e.source[2][0])}),this.triangles_.forEach(n=>{if(Math.max(n.source[0][0],n.source[1][0],n.source[2][0])-t>e/2){let r=[[n.source[0][0],n.source[0][1]],[n.source[1][0],n.source[1][1]],[n.source[2][0],n.source[2][1]]];r[0][0]-t>e/2&&(r[0][0]-=e),r[1][0]-t>e/2&&(r[1][0]-=e),r[2][0]-t>e/2&&(r[2][0]-=e);let i=Math.min(r[0][0],r[1][0],r[2][0]);Math.max(r[0][0],r[1][0],r[2][0])-i.5&&d<1,p=!1;if(c>0&&(this.targetProj_.isGlobal()&&this.targetWorldWidth_&&(p=G(Vc([e,t,n,r]))/this.targetWorldWidth_>Z_||p),!f&&this.sourceProj_.isGlobal()&&d&&(p=d>Z_||p)),!p&&this.maxSourceExtent_&&isFinite(l[0])&&isFinite(l[1])&&isFinite(l[2])&&isFinite(l[3])&&!vl(l,this.maxSourceExtent_))return;let m=0;if(!p&&(!isFinite(i[0])||!isFinite(i[1])||!isFinite(a[0])||!isFinite(a[1])||!isFinite(o[0])||!isFinite(o[1])||!isFinite(s[0])||!isFinite(s[1]))){if(c>0)p=!0;else if(m=(!isFinite(i[0])||!isFinite(i[1])?8:0)+(!isFinite(a[0])||!isFinite(a[1])?4:0)+(!isFinite(o[0])||!isFinite(o[1])?2:0)+ +(!isFinite(s[0])||!isFinite(s[1])),m!=1&&m!=2&&m!=4&&m!=8)return}if(c>0){if(!p){let t=[(e[0]+n[0])/2,(e[1]+n[1])/2],r=this.transformInv_(t),a;if(f){let e=u;a=(Mc(i[0],e)+Mc(o[0],e))/2-Mc(r[0],e)}else a=(i[0]+o[0])/2-r[0];let s=(i[1]+o[1])/2-r[1];p=a*a+s*s>this.errorThresholdSquared_}if(p){if(Math.abs(e[0]-n[0])<=Math.abs(e[1]-n[1])){let l=[(t[0]+n[0])/2,(t[1]+n[1])/2],u=this.transformInv_(l),d=[(r[0]+e[0])/2,(r[1]+e[1])/2],f=this.transformInv_(d);this.addQuad_(e,t,l,d,i,a,u,f,c-1),this.addQuad_(d,l,n,r,f,u,o,s,c-1)}else{let l=[(e[0]+t[0])/2,(e[1]+t[1])/2],u=this.transformInv_(l),d=[(n[0]+r[0])/2,(n[1]+r[1])/2],f=this.transformInv_(d);this.addQuad_(e,l,d,r,i,u,f,s,c-1),this.addQuad_(l,t,n,d,u,a,o,f,c-1)}return}}if(f){if(!this.canWrapXInSource_)return;this.wrapsXInSource_=!0}m&11||this.addTriangle_(e,n,r,i,o,s),m&14||this.addTriangle_(e,n,t,i,o,a),m&&(m&13||this.addTriangle_(t,r,e,a,s,i),m&7||this.addTriangle_(t,r,n,a,s,o))}calculateSourceExtent(){let e=Yc();return this.triangles_.forEach(function(t,n,r){let i=t.source;nl(e,i[0]),nl(e,i[1]),nl(e,i[2])}),e}getTriangles(){return this.triangles_}},$_=.5,ev=class extends M_{constructor(e,t,n,r,i,a,o,s,c,l,u,d){super(i,H.IDLE,d),this.renderEdges_=u!==void 0&&u,this.pixelRatio_=o,this.gutter_=s,this.canvas_=null,this.sourceTileGrid_=t,this.targetTileGrid_=r,this.wrappedTileCoord_=a||i,this.sourceTiles_=[],this.sourcesListenerKeys_=null,this.sourceZ_=0,this.clipExtent_=e.canWrapX()&&e.getExtent()||void 0;let f=r.getTileCoordExtent(this.wrappedTileCoord_),p=this.targetTileGrid_.getExtent(),m=this.sourceTileGrid_.getExtent(),h=p?ml(f,p):f;if(ol(h)===0){this.state=H.EMPTY;return}let g=e.getExtent();g&&(m=m?ml(m,g):g);let _=r.getResolution(this.wrappedTileCoord_[0]),v=J_(e,n,h,_);if(!isFinite(v)||v<=0){this.state=H.EMPTY;return}let y=l===void 0?$_:l;if(this.triangulation_=new Q_(e,n,h,m||void 0,v*y,_),this.triangulation_.getTriangles().length===0){this.state=H.EMPTY;return}this.sourceZ_=t.getZForResolution(v);let b=this.triangulation_.calculateSourceExtent();if(m&&(e.canWrapX()?(b[1]=W(b[1],m[1],m[3]),b[3]=W(b[3],m[1],m[3])):b=ml(b,m)),!ol(b))this.state=H.EMPTY;else{let n=0,r=0;e.canWrapX()&&(n=G(g),r=Math.floor((b[0]-g[0])/n)),Cl(b.slice(),e,!0).forEach(e=>{let i=t.getTileRangeForExtentAndZ(e,this.sourceZ_);for(let e=i.minX;e<=i.maxX;e++)for(let t=i.minY;t<=i.maxY;t++){let i=r*n;this.sourceTiles_.push({getTile:()=>c(this.sourceZ_,e,t,o),offset:i})}++r}),this.sourceTiles_.length===0&&(this.state=H.EMPTY)}}getImage(){return this.canvas_}reproject_(){let e=[];if(this.sourceTiles_.forEach(t=>{let n=t.tile;if(n&&n.getState()==H.LOADED){let r=this.sourceTileGrid_.getTileCoordExtent(n.tileCoord);r[0]+=t.offset,r[2]+=t.offset;let i=this.clipExtent_?.slice();i&&(i[0]+=t.offset,i[2]+=t.offset);let a=n.getImage();if(!a)return;e.push({extent:r,clipExtent:i,image:a})}}),this.sourceTiles_.length=0,e.length===0)this.state=H.ERROR;else{let t=this.wrappedTileCoord_[0],n=this.targetTileGrid_.getTileSize(t),r=typeof n==`number`?n:n[0],i=typeof n==`number`?n:n[1],a=this.targetTileGrid_.getResolution(t),o=this.sourceTileGrid_.getResolution(this.sourceZ_),s=this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_);this.canvas_=Y_(r,i,this.pixelRatio_,o,this.sourceTileGrid_.getExtent()??s,a,s,this.triangulation_,e,this.gutter_,this.renderEdges_,this.interpolate),this.state=H.LOADED}this.changed()}load(){for(let e of this.sourceTiles_)e.tile=e.getTile();if(this.state==H.IDLE){this.state=H.LOADING,this.changed();let e=0;this.sourcesListenerKeys_=[],this.sourceTiles_.forEach(t=>{let n=t.tile;if(!n)return;let r=n.getState();if(r==H.IDLE||r==H.LOADING){e++;let t=L(n,z.CHANGE,()=>{let r=n.getState();(r==H.LOADED||r==H.ERROR||r==H.EMPTY)&&(R(t),e--,e===0&&(this.unlistenSources_(),this.reproject_()))});this.sourcesListenerKeys_.push(t)}}),e===0?setTimeout(this.reproject_.bind(this),0):this.sourceTiles_.forEach(function(e){let t=e.tile;t&&t.getState()==H.IDLE&&t.load()})}}unlistenSources_(){this.sourcesListenerKeys_&&=(this.sourcesListenerKeys_.forEach(R),null)}release(){this.canvas_&&=(Jf(this.canvas_.getContext(`2d`)),U_.push(this.canvas_),null),this.sourceTiles_.length=0,super.release()}},tv=class{constructor(e){this.highWaterMark=e===void 0?2048:e,this.count_=0,this.entries_={},this.oldest_=null,this.newest_=null}deleteOldest(){let e=this.pop();e instanceof Is&&e.dispose()}canExpireCache(){return this.highWaterMark>0&&this.getCount()>this.highWaterMark}expireCache(e){for(;this.canExpireCache();)this.deleteOldest()}clear(){for(;this.oldest_;)this.deleteOldest()}containsKey(e){return this.entries_.hasOwnProperty(e)}forEach(e){let t=this.oldest_;for(;t;)e(t.value_,t.key_,this),t=t.newer}get(e,t){let n=this.entries_[e];return U(n!==void 0,`Tried to get a value for a key that does not exist in the cache`),n===this.newest_||(n===this.oldest_?(this.oldest_=this.oldest_.newer,this.oldest_.older=null):(n.newer.older=n.older,n.older.newer=n.newer),n.newer=null,n.older=this.newest_,this.newest_.newer=n,this.newest_=n),n.value_}remove(e){let t=this.entries_[e];return U(t!==void 0,`Tried to get a value for a key that does not exist in the cache`),t===this.newest_?(this.newest_=t.older,this.newest_&&(this.newest_.newer=null)):t===this.oldest_?(this.oldest_=t.newer,this.oldest_&&(this.oldest_.older=null)):(t.newer.older=t.older,t.older.newer=t.newer),delete this.entries_[e],--this.count_,t.value_}getCount(){return this.count_}getKeys(){let e=Array(this.count_),t=0,n;for(n=this.newest_;n;n=n.older)e[t++]=n.key_;return e}getValues(){let e=Array(this.count_),t=0,n;for(n=this.newest_;n;n=n.older)e[t++]=n.value_;return e}peekLast(){return this.oldest_.value_}peekLastKey(){return this.oldest_.key_}peekFirstKey(){return this.newest_.key_}peek(e){return this.entries_[e]?.value_}pop(){let e=this.oldest_;return delete this.entries_[e.key_],e.newer&&(e.newer.older=null),this.oldest_=e.newer,this.oldest_||(this.newest_=null),--this.count_,e.value_}replace(e,t){this.get(e),this.entries_[e].value_=t}set(e,t){U(!(e in this.entries_),`Tried to set a value for a key that is used already`);let n={key_:e,newer:null,older:this.newest_,value_:t};this.newest_?this.newest_.newer=n:this.oldest_=n,this.newest_=n,this.entries_[e]=n,++this.count_}setSize(e){this.highWaterMark=e}};function nv(e,t,n,r){return r===void 0?[e,t,n]:(r[0]=e,r[1]=t,r[2]=n,r)}function rv(e,t,n){return e+`/`+t+`/`+n}function iv(e,t,n,r,i){return`${V(e)},${t},${rv(n,r,i)}`}function av(e){return ov(e[0],e[1],e[2])}function ov(e,t,n){return(t<n||n>t.getMaxZoom())return!1;let a=t.getFullTileRange(n);return!a||a.containsXY(r,i)}var cv=class{constructor(){this.instructions_=[],this.zIndex=0,this.offset_=0,this.pendingMethod_,this.context_=new Proxy(qf(),{get:(e,t)=>{if(typeof e[t]==`function`)return this.pendingMethod_=t,this.pushMethodArgs_},set:(e,t,n)=>(this.push_(t,n),!0)})}push_(...e){let t=this.instructions_,n=this.zIndex+this.offset_;t[n]||(t[n]=[]),t[n].push(...e)}pushMethodArgs_=(...e)=>{this.push_(this.pendingMethod_,e)};pushFunction(e){this.push_(e)}getContext(){return this.context_}draw(e){this.instructions_.forEach(t=>{for(let n=0,r=t.length;nthis.maxStaleKeys&&(this.staleKeys_.length=this.maxStaleKeys)}updateStaleKeys(e){this.renderedSourceKey_?this.renderedSourceKey_!==e&&(this.prependStaleKey(this.renderedSourceKey_),this.renderedSourceKey_=e):this.renderedSourceKey_=e}getFeatures(e){return B()}getData(e){return null}prepareFrame(e){return B()}renderFrame(e,t){return B()}forEachFeatureAtCoordinate(e,t,n,r,i){}getLayer(){return this.layer_}handleFontsChanged(){}handleImageChange_(e){let t=e.target;(t.getState()===Q.LOADED||t.getState()===Q.ERROR)&&this.renderIfReadyAndVisible()}loadImage(e){let t=e.getState();return t!=Q.LOADED&&t!=Q.ERROR&&e.addEventListener(z.CHANGE,this.boundHandleImageChange_),t==Q.IDLE&&(e.load(),t=e.getState()),t==Q.LOADED}renderIfReadyAndVisible(){let e=this.getLayer();e&&e.getVisible()&&e.getSourceState()===`ready`&&e.changed()}renderDeferred(e){}disposeInternal(){this.layer_=void 0,super.disposeInternal()}},dv=[],fv=null;function pv(){fv=Gf(1,1,void 0,{willReadFrequently:!0})}var mv=class extends uv{constructor(e){super(e),this.wantRotation=!1,this.container=null,this.renderedResolution,this.tempTransform=gd(),this.pixelTransform=gd(),this.inversePixelTransform=gd(),this.context=null,this.deferredContext_=null,this.containerReused=!1,this.frameState=null}getImageData(e,t,n){fv||pv();let r=fv;if(!r)return null;r.clearRect(0,0,1,1);let i;try{r.drawImage(e,t,n,1,1,0,0,1,1),i=r.getImageData(0,0,1,1).data}catch{return fv=null,null}return i}getBackground(e){let t=this.getLayer().getBackground();return typeof t==`function`&&(t=t(e.viewState.resolution)),t||void 0}useContainer(e,t,n,r,i){if($f(e)&&this.pixelTransform[1]===0&&this.pixelTransform[2]===0&&this.pixelTransform[4]===0&&this.pixelTransform[5]===0&&e.width===r&&e.height===i){let t=e,r=t.getContext(`2d`);if(r){this.container=e,this.context=r,this.containerReused=!0,n&&(r.fillStyle=n,r.fillRect(0,0,t.width,t.height));return}}let a=this.getLayer().getClassName(),o,s;if(e&&e.className===a&&(!n||e&&e.style.backgroundColor&&Us(Im(e.style.backgroundColor),Im(n)))){let t=e.firstElementChild;$f(t)&&(s=t.getContext(`2d`))}if(s&&Td(s.canvas.style.transform,t)?(this.container=e,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){o=mc?Qf():document.createElement(`div`),o.className=a;let e=o.style;e.position=`absolute`,e.width=`100%`,e.height=`100%`,s=Gf();let t=s.canvas;o.appendChild(t),e=t.style,e.position=`absolute`,e.left=`0`,e.transformOrigin=`top left`,this.container=o,this.context=s}!this.containerReused&&n&&!this.container.style.backgroundColor&&(this.container.style.backgroundColor=n)}clipUnrotated(e,t,n){let r=gl(n),i=_l(n),a=cl(n),o=sl(n);vd(t.coordinateToPixelTransform,r),vd(t.coordinateToPixelTransform,i),vd(t.coordinateToPixelTransform,a),vd(t.coordinateToPixelTransform,o);let s=this.inversePixelTransform;vd(s,r),vd(s,i),vd(s,a),vd(s,o),e.save(),e.beginPath(),e.moveTo(Math.round(r[0]),Math.round(r[1])),e.lineTo(Math.round(i[0]),Math.round(i[1])),e.lineTo(Math.round(a[0]),Math.round(a[1])),e.lineTo(Math.round(o[0]),Math.round(o[1])),e.clip()}prepareContainer(e,t){let n=e.extent,r=e.viewState.resolution,i=this.sourceRotates(),a=i?0:e.viewState.rotation,o=e.pixelRatio,s=Math.round(i?e.size[0]*o:G(n)/r*o),c=Math.round(i?e.size[1]*o:pl(n)/r*o);yd(this.pixelTransform,e.size[0]/2,e.size[1]/2,1/o,1/o,a,-s/2,-c/2),bd(this.inversePixelTransform,this.pixelTransform);let l=Cd(this.pixelTransform),u=this.getBackground(e);if(this.useContainer(t,l,u,s,c),!this.containerReused){let e=this.context.canvas;e.width!=s||e.height!=c?(e.width=s,e.height=c):this.context.clearRect(0,0,s,c),l!==e.style.transform&&(e.style.transform=l)}}dispatchRenderEvent_(e,t,n){let r=this.getLayer();if(r.hasListener(e)){let i=new S_(e,this.inversePixelTransform,n,t);r.dispatchEvent(i)}}preRender(e,t){this.frameState=t,!t.declutter&&this.dispatchRenderEvent_(qp.PRERENDER,e,t)}postRender(e,t){t.declutter||this.dispatchRenderEvent_(qp.POSTRENDER,e,t)}renderDeferredInternal(e){}getRenderContext(e){return e.declutter&&!this.deferredContext_&&(this.deferredContext_=new cv),e.declutter?this.deferredContext_.getContext():this.context}getCanvasContext(){let e=this.context;if(!e)throw Error(`Canvas context not initialized`);return e}getContainerElement(){let e=this.container;if(!e)throw Error(`Canvas container not initialized`);return e}renderDeferred(e){e.declutter&&(this.dispatchRenderEvent_(qp.PRERENDER,this.context,e),e.declutter&&this.deferredContext_&&(this.deferredContext_.draw(this.context),this.deferredContext_.clear()),this.renderDeferredInternal(e),this.dispatchRenderEvent_(qp.POSTRENDER,this.context,e))}getRenderTransform(e,t,n,r,i,a,o){let s=i/2,c=a/2,l=r/t,u=-l,d=-e[0]+o,f=-e[1];return yd(this.tempTransform,s,c,l,u,-n,d,f)}sourceRotates(){return this.wantRotation&&!!this.getLayer().getSource()?.canRotate}disposeInternal(){delete this.frameState,super.disposeInternal()}};function hv(e,t,n){if(!(n in e))return e[n]=new Set([t]),!0;let r=e[n],i=r.has(t);return i||r.add(t),!i}function gv(e,t,n){let r=e[n];return r?r.delete(t):!1}function _v(e,t){let n=e.layerStatesArray[e.layerIndex];if(n.extent&&(t=ml(t,dd(n.extent,e.viewState.projection))),!n.layer)return t;let r=n.layer.getRenderSource();if(!r.getWrapX()){let n=r.getTileGridForProjection(e.viewState.projection).getExtent();n&&(t=ml(t,n))}return t}var vv=class extends mv{constructor(e,t){super(e),t||={},this.extentChanged=!0,this.renderComplete=!1,this.renderedExtent_=null,this.renderedPixelRatio,this.renderedProjection=null,this.renderedTiles=[],this.renderedSourceRevision_,this.tempExtent=Yc(),this.tempTileRange_=new B_(0,0,0,0),this.tempTileCoord_=nv(0,0,0);let n=t.cacheSize===void 0?512:t.cacheSize;this.tileCache_=new tv(n),this.sourceTileCache_=null,this.layerExtent=null,this.maxStaleKeys=n*.5}getTileCache(){return this.tileCache_}getSourceTileCache(){return this.sourceTileCache_||=new tv(512),this.sourceTileCache_}getOrCreateTile(e,t,n,r){let i=this.tileCache_,a=this.getLayer().getSource();if(!a)return null;let o=iv(a,a.getKey(),e,t,n),s;if(i.containsKey(o)){if(s=i.get(o),!s)return null}else{let c=r.viewState.projection,l=a.getProjection();if(s=a.getTile(e,t,n,r.pixelRatio,c,!l||td(l,c)?void 0:this.getSourceTileCache()),!s)return null;i.set(o,s)}return s}getTile(e,t,n,r){return this.getOrCreateTile(e,t,n,r)||null}getData(e){let t=this.frameState;if(!t)return null;let n=this.getLayer(),r=vd(t.pixelToCoordinateTransform,e.slice()),i=n.getExtent();if(i&&!Gc(i,r))return null;let a=t.viewState,o=n.getRenderSource();if(!o)return null;let s=o.getTileGridForProjection(a.projection),c=o.getTilePixelRatio(t.pixelRatio);for(let e=s.getZForResolution(a.resolution);e>=s.getMinZoom();--e){let n=s.getTileCoordForCoordAndZ(r,e),i=this.getTile(e,n[1],n[2],t);if(!i||i.getState()!==H.LOADED)continue;let l=s.getOrigin(e),u=Bm(s.getTileSize(e)),d=s.getResolution(e),f=null;if(i instanceof R_||i instanceof ev)f=i.getImage();else if(i instanceof L_){let e=i.getData();e&&(f=N_(e))}if(!f)continue;let p=Math.floor(c*((r[0]-l[0])/d-n[1]*u[0])),m=Math.floor(c*((l[1]-r[1])/d-n[2]*u[1])),h=Math.round(c*o.getGutterForProjection(a.projection));return this.getImageData(f,p+h,m+h)}return null}readData(e){let t=this.getLayer().getRenderSource();if(!t)return null;let n=e.viewState,r=n.projection;if(t.getGutterForProjection(r))throw Error(`readData() does not support sources with a gutter`);let i=t.getTileGridForProjection(r),a=n.resolution,o=e.extent,s=i.getZForResolution(a),c={};this.enqueueTiles(e,o,s,c,0);let l=c[s];if(!l)return null;let u=[],d=!0;if(l.forEach(e=>{let t=e,n=t.getState();n===H.LOADED?u.push(t):n!==H.ERROR&&n!==H.EMPTY&&(d=!1)}),!d||u.length===0)return null;let f=e.size[0],p=e.size[1],m=u[0],h=P_(m.getData());if(!h||h instanceof DataView)throw Error(`ol/renderer/canvas/TileLayer#readData only supports typed array tile data`);let g=m.getSize(),_=Math.round(h.length/(g[0]*g[1])),v=h.constructor,y=new v(f*p*_);for(let e of u){let t=i.getTileCoordExtent(e.tileCoord,this.tempExtent),n=e.getSize(),r=P_(e.getData()),s=(t[0]-o[0])/a-.5,c=(o[3]-t[3])/a-.5,l=G(t)/a,u=pl(t)/a,d=n[0]/l,m=n[1]/u,h=Math.max(0,Math.ceil(s)),g=Math.min(f,Math.ceil(s+l)),v=Math.max(0,Math.ceil(c)),b=Math.min(p,Math.ceil(c+u));for(let e=v;e=f;--i){let n=c.getTileRangeForExtentAndZ(t,i,this.tempTileRange_),a=c.getResolution(i);for(let t=n.minX;t<=n.maxX;++t)for(let o=n.minY;o<=n.maxY;++o){if(p&&m&&!c.tileCoordIntersectsViewport([i,t,o],m))continue;let n=this.getTile(i,t,o,e);if(!n||!hv(r,n,i))continue;let s=n.getKey();if(u[s]=!0,n.getState()===H.IDLE&&!e.tileQueue.isKeyQueued(s)){let r=nv(i,t,o,this.tempTileCoord_);e.tileQueue.enqueue([n,l,c.getTileCoordCenter(r),a])}}}}findStaleTile_(e,t){let n=this.tileCache_,r=e[0],i=e[1],a=e[2],o=this.getStaleKeys(),s=this.getLayer().getSource();if(!s)return!1;for(let e=0;e0&&setTimeout(()=>{this.enqueueTiles(e,S,d-1,b,x-1)},0),!(d in b))return this.getContainerElement();let C=V(this),w=e.time;for(let t of b[d]){let n=t.getState();if(n===H.EMPTY)continue;let r=t.tileCoord;if(n===H.LOADED&&t.getAlpha(C,w)===1){t.endTransition(C);continue}if(n!==H.ERROR&&(this.renderComplete=!1),this.findStaleTile_(r,b)){gv(b,t,d),e.animate=!0;continue}if(this.findAltTiles_(u,r,d+1,b))continue;let i=u.getMinZoom();for(let e=d-1;e>=i&&!this.findAltTiles_(u,r,e,b);--e);}let T=f/a*s/m,E=this.getRenderContext(e);yd(this.tempTransform,h/2,g/2,T,T,0,-h/2,-g/2),this.layerExtent&&this.clipUnrotated(E,e,this.layerExtent),l.getInterpolate()||(E.imageSmoothingEnabled=!1),this.preRender(E,e);let D=Object.keys(b).map(Number);D.sort(Rs);let O=[],k=[],ee=[];for(let t=D.length-1;t>=0;--t){let n=D[t],r=l.getTilePixelSize(n,s,i),a=u.getResolution(n)/f,o=r[0]*a*T,c=r[1]*a*T,p=u.getTileCoordForCoordAndZ(gl(y),n),h=u.getTileCoordExtent(p),g=vd(this.tempTransform,[m*(h[0]-y[0])/f,m*(y[3]-h[3])/f]),_=m*l.getGutterForProjection(i);for(let t of b[n]){if(t.getState()!==H.LOADED)continue;let r=t.tileCoord,i=p[1]-r[1],a=Math.round(g[0]-(i-1)*o),s=p[2]-r[2],u=Math.round(g[1]-(s-1)*c),f=Math.round(g[0]-i*o),m=Math.round(g[1]-s*c),h=a-f,v=u-m,y=n===d;if(y&&t.inTransition(C)){ee.push({tile:t,x:f,y:m,w:h,h:v,gutter:_}),this.renderedTiles.unshift(t),this.updateUsedTiles(e.usedTiles,l,t);continue}let b=[f,m,f+h,m+v],x=[];for(let e=0,t=O.length;e0&&(S=wl(b,x)),O.push(b),k.push(n),this.drawTile(t,e,f,m,h,v,_,y,S),this.renderedTiles.unshift(t),this.updateUsedTiles(e.usedTiles,l,t)}}for(let t=0,n=ee.length;t{let n=V(l),r=t.wantedTiles[n],i=r?Object.keys(r).length:0;this.updateCacheSize(i),this.tileCache_.expireCache(),this.sourceTileCache_?.expireCache()}),this.getContainerElement()}updateCacheSize(e){this.tileCache_.highWaterMark=Math.max(this.tileCache_.highWaterMark,e*2)}drawTile(e,t,n,r,i,a,o,s,c){let l;if(e instanceof L_){let t=e.getData();if(!t)return;if(l=N_(t),!l)throw Error(`Rendering array data is not yet supported`)}else l=this.getTileImage(e);if(!l)return;let u=this.getRenderContext(t),d=V(this),f=t.layerStatesArray[t.layerIndex],p=f.opacity*(s?e.getAlpha(d,t.time):1),m=p!==u.globalAlpha;m&&(u.save(),u.globalAlpha=p);let h=l.width-2*o,g=l.height-2*o;if(c){let e=h/i,t=g/a;for(let i=0,a=c.length;is&&(this.instructions.push([$.CUSTOM,s,l,e,n,qd,i]),this.hitDetectionInstructions.push([$.CUSTOM,s,l,e,r||n,qd,i]));break;case`Point`:c=e.getFlatCoordinates(),this.coordinates.push(c[0],c[1]),l=this.coordinates.length,this.instructions.push([$.CUSTOM,s,l,e,n,void 0,i]),this.hitDetectionInstructions.push([$.CUSTOM,s,l,e,r||n,void 0,i])}this.endGeometry(t)}beginGeometry(e,t,n){this.beginGeometryInstruction1_=[$.BEGIN_GEOMETRY,t,0,e,n],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[$.BEGIN_GEOMETRY,t,0,e,n],this.hitDetectionInstructions.push(this.beginGeometryInstruction2_)}finish(){return{instructions:this.instructions,hitDetectionInstructions:this.hitDetectionInstructions,coordinates:this.coordinates}}reverseHitDetectionInstructions(){let e=this.hitDetectionInstructions;e.reverse();let t,n=e.length,r,i,a=-1;for(t=0;tthis.maxLineWidth&&(this.maxLineWidth=t.lineWidth,this.bufferedMaxExtent_=null)}else t.strokeStyle=void 0,t.lineCap=void 0,t.lineDash=null,t.lineDashOffset=void 0,t.lineJoin=void 0,t.lineWidth=void 0,t.miterLimit=void 0,t.strokeOffset=void 0;return t}setFillStrokeStyle(e,t){let n=this.state;this.fillStyleToState(e,n),this.strokeStyleToState(t,n)}createFill(e){let t=e.fillStyle,n=[$.SET_FILL_STYLE,t];return typeof t!=`string`&&n.push(e.fillPatternScale),n}applyStroke(e){this.instructions.push(this.createStroke(e))}createStroke(e){return[$.SET_STROKE_STYLE,e.strokeStyle,e.lineWidth*this.pixelRatio,e.lineCap,e.lineJoin,e.miterLimit,e.lineDash?this.applyPixelRatio(e.lineDash):null,e.lineDashOffset*this.pixelRatio]}updateFillStyle(e,t){let n=e.fillStyle;(n!==void 0&&typeof n!=`string`||e.currentFillStyle!=n)&&(this.instructions.push(t.call(this,e)),e.currentFillStyle=n)}updateStrokeStyle(e,t){let n=e.strokeStyle,r=e.lineCap,i=e.lineDash,a=e.lineDashOffset,o=e.lineJoin,s=e.lineWidth,c=e.miterLimit,l=e.strokeOffset;(e.currentStrokeStyle!=n||e.currentLineCap!=r||i!=e.currentLineDash&&(!i||!e.currentLineDash||!Us(e.currentLineDash,i))||e.currentLineDashOffset!=a||e.currentLineJoin!=o||e.currentLineWidth!=s||e.currentMiterLimit!=c||e.currentStrokeOffset!=l)&&(t.call(this,e),e.currentStrokeStyle=n,e.currentLineCap=r,e.currentLineDash=i,e.currentLineDashOffset=a,e.currentLineJoin=o,e.currentLineWidth=s,e.currentMiterLimit=c,e.currentStrokeOffset=l)}endGeometry(e){this.beginGeometryInstruction1_[2]=this.instructions.length,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_[2]=this.hitDetectionInstructions.length,this.beginGeometryInstruction2_=null;let t=[$.END_GEOMETRY,e];this.instructions.push(t),this.hitDetectionInstructions.push(t)}getBufferedMaxExtent(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=Uc(this.maxExtent),this.maxLineWidth>0)){let e=this.resolution*(this.maxLineWidth+1)/2;Hc(this.bufferedMaxExtent_,e,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_}},Ov=class extends Dv{constructor(e,t,n,r){super(e,t,n,r),this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.anchorX_=void 0,this.anchorY_=void 0,this.height_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.scale_=void 0,this.width_=void 0,this.declutterMode_=void 0,this.declutterImageWithText_=void 0}drawPoint(e,t,n){if(!this.image_||this.maxExtent&&!Gc(this.maxExtent,e.getFlatCoordinates()))return;this.beginGeometry(e,t,n??0);let r=e.getFlatCoordinates(),i=e.getStride(),a=this.coordinates.length,o=this.appendFlatPointCoordinates(r,i),s=this.imagePixelRatio_??1,c=this.anchorX_??0,l=this.anchorY_??0,u=this.height_??0,d=this.originX_??0,f=this.originY_??0,p=this.scale_??[1,1],m=this.width_??0;this.instructions.push([$.DRAW_IMAGE,a,o,this.image_,c*s,l*s,Math.ceil(u*s),this.opacity_,d*s,f*s,this.rotateWithView_,this.rotation_,[p[0]*this.pixelRatio/s,p[1]*this.pixelRatio/s],Math.ceil(m*s),this.declutterMode_,this.declutterImageWithText_]),this.hitDetectionInstructions.push([$.DRAW_IMAGE,a,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(t)}drawMultiPoint(e,t,n){if(!this.image_)return;this.beginGeometry(e,t,n??0);let r=e.getFlatCoordinates(),i=[];for(let t=0,n=r.length;tthis.drawCircle(e,t,n)))return;this.setFillStrokeStyles_(),this.beginGeometry(e,t,n??0),r.fillStyle!==void 0&&this.hitDetectionInstructions.push([$.SET_FILL_STYLE,tg]),r.strokeStyle!==void 0&&this.hitDetectionInstructions.push([$.SET_STROKE_STYLE,ag,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,rg,0]);let s=e.getFlatCoordinates(),c=e.getStride(),l=this.coordinates.length;this.appendFlatLineCoordinates(s,0,s.length,c,!1,!1);let u=[$.CIRCLE,l,o];this.instructions.push(Tv,u),this.hitDetectionInstructions.push(Tv,u),r.fillStyle!==void 0&&(this.instructions.push(Cv),this.hitDetectionInstructions.push(Cv)),r.strokeStyle!==void 0&&(this.instructions.push(wv),this.hitDetectionInstructions.push(wv)),this.endGeometry(t)}drawPolygon(e,t,n){let r=this.state;if(!r)return;let i=r.fillStyle,a=r.strokeStyle,o=r.strokeOffset;if(i===void 0&&a===void 0||this.handleStrokeOffset_(()=>this.drawPolygon(e,t,n)))return;this.setFillStrokeStyles_(),this.beginGeometry(e,t,n??0),r.fillStyle!==void 0&&this.hitDetectionInstructions.push([$.SET_FILL_STYLE,tg]),r.strokeStyle!==void 0&&this.hitDetectionInstructions.push([$.SET_STROKE_STYLE,ag,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,rg,0]);let s=e.getEnds(),c=e.getOrientedFlatCoordinates(),l=e.getStride();this.drawFlatCoordinatess_(c,0,s,l,o),this.endGeometry(t)}drawMultiPolygon(e,t,n){let r=this.state;if(!r)return;let i=r.fillStyle,a=r.strokeStyle,o=r.strokeOffset;if(i===void 0&&a===void 0||this.handleStrokeOffset_(()=>this.drawMultiPolygon(e,t,n)))return;this.setFillStrokeStyles_(),this.beginGeometry(e,t,n??0),r.fillStyle!==void 0&&this.hitDetectionInstructions.push([$.SET_FILL_STYLE,tg]),r.strokeStyle!==void 0&&this.hitDetectionInstructions.push([$.SET_STROKE_STYLE,ag,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,rg,0]);let s=e.getEndss(),c=e.getOrientedFlatCoordinates(),l=e.getStride(),u=0;for(let e=0,t=s.length;e0&&n!==void 0&&r!==void 0&&(t.strokeStyle=void 0,t.strokeOffset=0,e(),t.fillStyle=void 0,t.strokeStyle=r,t.strokeOffset=i,e(),t.fillStyle=n,!0)}},jv=0,Mv=1;function Nv(e,t,n,r,i,a,o,s){let c=o-i,l=s-a,u=0,d=1;if(c===0){if(in)return!1}else{let t=(e-i)/c,r=(n-i)/c;if(t>r){let e=t;t=r,r=e}if(t>u&&(u=t),rd)return!1}if(l===0){if(ar)return!1}else{let e=(t-a)/l,n=(r-a)/l;if(e>n){let t=e;e=n,n=t}if(e>u&&(u=e),nd)return!1}return jv=u,Mv=d,!0}function Pv(e,t,n,r){let i=r[0],a=r[1],o=r[2],s=r[3],c=[],l=[],u=!1,d,f,p=0;for(let r=0,m=t.length;r=e){let t=(e-s+d)/d,f=Nc(n,l,t),p=Nc(r,u,t);c.push(f,p),a.push(c),c=[f,p],s==e&&(o+=i),s=0}else if(s0&&a.push(c),a}function Iv(e,t,n,r,i){let a=n,o=n,s=0,c=0,l=n,u,d,f,p,m,h,g,_,v,y;for(d=n;de&&(c>s&&(s=c,a=l,o=d),c=0,l=d-i)),f=p,g=v,_=y),m=n,h=r}return c+=p||0,c>s?[l,d]:[a,o]}var Lv={left:0,center:.5,right:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1},Rv={Circle:Av,Default:Dv,Image:Ov,LineString:kv,Polygon:Av,Text:class extends Dv{constructor(e,t,n,r){super(e,t,n,r),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[tg]={fillStyle:tg},this.textStrokeState_=null,this.strokeStates={},this.textState_={},this.textStates={},this.textKey_=``,this.fillKey_=``,this.strokeKey_=``,this.declutterMode_=void 0,this.declutterImageWithText_=void 0}finish(){let e=super.finish();return e.textStates=this.textStates,e.fillStates=this.fillStates,e.strokeStates=this.strokeStates,e}drawText(e,t,n){let r=this.textFillState_,i=this.textStrokeState_,a=this.textState_;if(this.text_===``||!a||!r&&!i)return;let o=this.coordinates,s=o.length,c=e.getType(),l=null,u=e.getStride();if(a.placement===`line`&&(c==`LineString`||c==`MultiLineString`||c==`Polygon`||c==`MultiPolygon`)){let r=e.getExtent();if(!vl(this.maxExtent,r))return;let i=[];if(l=e.getFlatCoordinates(),c==`LineString`)i=[l.length];else if(c==`MultiLineString`)i=e.getEnds();else if(c==`Polygon`)i=e.getEnds().slice(0,1);else if(c==`MultiPolygon`){let t=e.getEndss();i=[];for(let e=0,n=t.length;e{let i=o[(t+r)*2]===e[r*u]&&o[(t+r)*2+1]===e[r*u+1];return i||--t,i})}this.saveTextStates_();let d=a.backgroundFill?this.createFill(this.fillStyleToState(a.backgroundFill)):null,f=a.backgroundStroke?this.createStroke(this.strokeStyleToState(a.backgroundStroke)):null;this.beginGeometry(e,t,n??0);let p=a.scale??[1,1],m=a.padding??cg;if(m!=cg&&(p[0]<0||p[1]<0)){let e=m[0],t=m[1],n=m[2],r=m[3];p[0]<0&&(t=-t,r=-r),p[1]<0&&(e=-e,n=-n),m=[e,t,n,r]}let h=this.pixelRatio;this.instructions.push([$.DRAW_IMAGE,s,i,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[1,1],NaN,this.declutterMode_,this.declutterImageWithText_,m==cg?cg:m.map(function(e){return e*h}),d,f,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,r]);let g=1/h,_=d?d.slice(0):null;_&&(_[1]=tg),this.hitDetectionInstructions.push([$.DRAW_IMAGE,s,i,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[g,g],NaN,this.declutterMode_,this.declutterImageWithText_,m,_,f,this.text_,this.textKey_,this.strokeKey_,this.fillKey_?tg:this.fillKey_,this.textOffsetX_,this.textOffsetY_,r]),this.endGeometry(t)}}saveTextStates_(){let e=this.textStrokeState_,t=this.textState_,n=this.textFillState_,r=this.strokeKey_;e&&(r in this.strokeStates||(this.strokeStates[r]={strokeStyle:e.strokeStyle,lineCap:e.lineCap,lineDashOffset:e.lineDashOffset,lineWidth:e.lineWidth,lineJoin:e.lineJoin,miterLimit:e.miterLimit,lineDash:e.lineDash}));let i=this.textKey_;i in this.textStates||(this.textStates[i]={font:t.font,textAlign:t.textAlign||`center`,justify:t.justify,textBaseline:t.textBaseline||`middle`,scale:t.scale});let a=this.fillKey_;n&&(a in this.fillStates||(this.fillStates[a]={fillStyle:n.fillStyle}))}drawChars_(e,t){let n=this.textStrokeState_,r=this.textState_,i=this.strokeKey_,a=this.textKey_,o=this.fillKey_;this.saveTextStates_();let s=this.pixelRatio,c=Lv[r.textBaseline||`middle`],l=this.textOffsetX_*s,u=this.textOffsetY_*s,d=this.text_,f=r.scale??[1,1],p=n?n.lineWidth*Math.abs(f[0])/2:0;this.instructions.push([$.DRAW_CHARS,e,t,c,r.overflow,o,r.maxAngle,s,u,i,p*s,d,a,1,this.declutterMode_,this.textKeepUpright_,l]),this.hitDetectionInstructions.push([$.DRAW_CHARS,e,t,c,r.overflow,o&&tg,r.maxAngle,s,u,i,p*s,d,a,1/s,this.declutterMode_,this.textKeepUpright_,l])}setTextStyle(e,t){let n,r,i;if(!e)this.text_=``;else{let t=e.getFill();t?(r=this.textFillState_,r||(r={},this.textFillState_=r),r.fillStyle=Qh(t.getColor()||`#000`)||`#000`):(r=null,this.textFillState_=r);let a=e.getStroke();if(!a)i=null,this.textStrokeState_=i;else{i=this.textStrokeState_,i||(i={},this.textStrokeState_=i);let e=a.getLineDash(),t=a.getLineDashOffset(),n=a.getWidth(),r=a.getMiterLimit();i.lineCap=a.getLineCap()||`round`,i.lineDash=e?e.slice():rg,i.lineDashOffset=t===void 0?0:t,i.lineJoin=a.getLineJoin()||`round`,i.lineWidth=n===void 0?1:n,i.miterLimit=r===void 0?10:r,i.strokeStyle=Qh(a.getColor()||`#000`)||`#000`}n=this.textState_;let o=e.getFont()||`10px sans-serif`;hg(o);let s=e.getScaleArray();n.overflow=e.getOverflow(),n.font=o,n.maxAngle=e.getMaxAngle(),n.placement=e.getPlacement(),n.textAlign=e.getTextAlign(),n.repeat=e.getRepeat(),n.justify=e.getJustify(),n.textBaseline=e.getTextBaseline()||`middle`,n.backgroundFill=e.getBackgroundFill()??void 0,n.backgroundStroke=e.getBackgroundStroke()??void 0,n.padding=e.getPadding()||cg,n.scale=s===void 0?[1,1]:s;let c=e.getOffsetX(),l=e.getOffsetY(),u=e.getRotateWithView(),d=e.getKeepUpright(),f=e.getRotation();this.text_=e.getText()||``,this.textOffsetX_=c===void 0?0:c,this.textOffsetY_=l===void 0?0:l,this.textRotateWithView_=u!==void 0&&u,this.textKeepUpright_=d===void 0||d,this.textRotation_=f===void 0?0:f,this.strokeKey_=i?(typeof i.strokeStyle==`string`?i.strokeStyle:V(i.strokeStyle))+i.lineCap+i.lineDashOffset+`|`+i.lineWidth+i.lineJoin+i.miterLimit+`[`+i.lineDash.join()+`]`:``,this.textKey_=n.font+n.scale+(n.textAlign||`?`)+(n.repeat||`?`)+(n.justify||`?`)+(n.textBaseline||`?`),this.fillKey_=r&&r.fillStyle?typeof r.fillStyle==`string`?r.fillStyle:`|`+V(r.fillStyle):``}this.declutterMode_=e?e.getDeclutterMode():void 0,this.declutterImageWithText_=t}}},zv=class{constructor(e,t,n,r){this.tolerance_=e,this.maxExtent_=t,this.pixelRatio_=r,this.resolution_=n,this.buildersByZIndex_={}}finish(){let e={};for(let t in this.buildersByZIndex_){e[t]=e[t]||{};let n=this.buildersByZIndex_[t];for(let r in n){let i=n[r].finish();e[t][r]=i}}return e}getBuilder(e,t){let n=e===void 0?`0`:e.toString(),r=this.buildersByZIndex_[n];r===void 0&&(r={},this.buildersByZIndex_[n]=r);let i=r[t];if(i===void 0){let e=Rv[t];i=new e(this.tolerance_,this.maxExtent_,this.resolution_,this.pixelRatio_),r[t]=i}return i}};function Bv(e,t,n,r){let i=e[t],a=e[t+1],o=0;for(let s=t+r;s.998)return[e+u*o,t+d*o];let p=Math.cos(f/2),m=Math.sin(f/2),h=m*s+p*c,g=-p*s+m*c,_=1/m*h,v=1/m*g;return[e+_*o,t+v*o]}function Uv(e,t,n=!1){for(let r=0,i=e.length-2;rr+t;n-=t){let i=e[r],a=e[r+1],o=e[r+t],s=e[r+t+1],c=e[n],l=e[n+1],u=e[n+t],d=e[n+t+1],f=(d-l)*(o-i)-(u-c)*(s-a);if(f===0)continue;let p=((u-c)*(a-l)-(d-l)*(i-c))/f,m=((o-i)*(a-l)-(s-a)*(i-c))/f;if(p>0&&p<1&&m>0&&m<1){let c=i+p*(o-i),l=a+p*(s-a);e[r+t]=c,e[r+t+1]=l,e.splice(r+2*t,n-r-t);break}}}return e}var Wv,Gv=RegExp(`[֑-ࣿיִ-﷿ﹰ-ﻼࠀ-࿿-]`);function Kv(){return Wv||=new Intl.Segmenter(void 0,{granularity:`grapheme`}),Wv}function qv(e,t,n,r,i,a,o,s,c,l,u,d,f=!0){let p=e[t],m=e[t+1],h=0,g=0,_=0,v=0;function y(){h=p,g=m,t+=r,p=e[t],m=e[t+1],v+=_,_=Math.sqrt((p-h)*(p-h)+(m-g)*(m-g))}do y();while(te[2]}else O=x>E}let k=Math.PI,ee=[],te=C+r===t;t=C,_=0,v=w,p=e[t],m=e[t+1];let ne;if(te)return y(),ne=Math.atan2(m-g,p-h),O&&(ne+=ne>0?-k:k),ee[0]=[(E+x)/2,(D+S)/2,(T-a)/2,ne,i],ee;i=i.replace(/\n/g,` `);let re=Array.from(Kv().segment(i),e=>e.segment),ie=O!==Gv.test(i);for(let e=0,i=re.length;e0?-k:k),ne!==void 0){let e=d-ne;if(e+=e>k?-2*k:e<-k?2*k:0,Math.abs(e)>o)return null}ne=d;let f=e,x=0;for(;e0&&e.push(` -`,``),e.push(t,``),e}function ny(e,t,n){return n%2==0&&(e+=t),e}var ry=class{constructor(e,t,n,r,i){this.overlaps=n,this.pixelRatio=t,this.resolution=e,this.alignAndScaleFill_,this.instructions=r.instructions,this.coordinates=r.coordinates,this.coordinateCache_={},this.renderedTransform_=gd(),this.hitDetectionInstructions=r.hitDetectionInstructions,this.pixelCoordinates_=null,this.viewRotation_=0,this.fillStates=r.fillStates||{},this.strokeStates=r.strokeStates||{},this.textStates=r.textStates||{},this.widths_={},this.labels_={},this.zIndexContext_=i?new cv:null}getZIndexContext(){return this.zIndexContext_}createLabel(e,t,n,r){let i=e+t+n+r;if(this.labels_[i])return this.labels_[i];let a=r?this.strokeStates[r]:null,o=n?this.fillStates[n]:null,s=this.textStates[t],c=this.pixelRatio,l=[s.scale[0]*c,s.scale[1]*c],u=s.justify?Lv[s.justify]:ey(Array.isArray(e)?e[0]:e,s.textAlign||`center`),d=r&&a.lineWidth?a.lineWidth:0,f=Array.isArray(e)?e:String(e).split(` -`).reduce(ty,[]),{width:p,height:m,widths:h,heights:g,lineWidths:_}=bg(s,f),v=p+d,y=[],b=(v+2)*l[0],x=(m+d)*l[1],S={width:b<0?Math.floor(b):Math.ceil(b),height:x<0?Math.floor(x):Math.ceil(x),contextInstructions:y};(l[0]!=1||l[1]!=1)&&y.push(`scale`,l),r&&a&&(y.push(`strokeStyle`,a.strokeStyle),y.push(`lineWidth`,d),y.push(`lineCap`,a.lineCap),y.push(`lineJoin`,a.lineJoin),y.push(`miterLimit`,a.miterLimit),y.push(`setLineDash`,[a.lineDash]),y.push(`lineDashOffset`,a.lineDashOffset)),n&&o&&y.push(`fillStyle`,o.fillStyle),y.push(`textBaseline`,`middle`),y.push(`textAlign`,`center`);let C=.5-u,w=u*v+C*d,T=[],E=[],D=0,O=0,k=0,ee=0,te;for(let e=0,t=f.length;ee?e-c:i,y=a+l>t?t-l:a,b=p[3]+v*d[0]+p[1],x=p[0]+y*d[1]+p[2],S=g-p[3],C=_-p[0];(m||u!==0)&&(Yv[0]=S,Qv[0]=S,Yv[1]=C,Xv[1]=C,Xv[0]=S+b,Zv[0]=Xv[0],Zv[1]=C+x,Qv[1]=Zv[1]);let w;return u===0?Xc(Math.min(S,S+b),Math.min(C,C+x),Math.max(S,S+b),Math.max(C,C+x),Jv):(w=yd(gd(),n,r,1,1,u,-n,-r),vd(w,Yv),vd(w,Xv),vd(w,Zv),vd(w,Qv),Xc(Math.min(Yv[0],Xv[0],Zv[0],Qv[0]),Math.min(Yv[1],Xv[1],Zv[1],Qv[1]),Math.max(Yv[0],Xv[0],Zv[0],Qv[0]),Math.max(Yv[1],Xv[1],Zv[1],Qv[1]),Jv)),f&&(g=Math.round(g),_=Math.round(_)),{drawImageX:g,drawImageY:_,drawImageW:v,drawImageH:y,originX:c,originY:l,declutterBox:{minX:Jv[0],minY:Jv[1],maxX:Jv[2],maxY:Jv[3],value:h},canvasTransform:w,scale:d}}replayImageOrLabelArgs_(e){return this.replayImageOrLabel_(e[0],e[1],e[2],e[3],e[4],e[5],e[6])}replayImageOrLabel_(e,t,n,r,i,a,o){let s=!!(a||o),c=r.declutterBox,l=o?o[2]*r.scale[0]/2:0;return c.minX-l<=t[0]&&c.maxX+l>=0&&c.minY-l<=t[1]&&c.maxY+l>=0&&(s&&this.replayTextBackground_(e,Yv,Xv,Zv,Qv,a,o),xg(e,r.canvasTransform,i,n,r.originX,r.originY,r.drawImageW,r.drawImageH,r.drawImageX,r.drawImageY,r.scale)),!0}fill_(e){let t=this.alignAndScaleFill_;if(t){let n=vd(this.renderedTransform_,[0,0]),r=512*this.pixelRatio;e.save(),e.translate(n[0]%r,n[1]%r),t!==1&&e.scale(t,t)}e.fill(),t&&e.restore()}setStrokeStyle_(e,t){e.strokeStyle=t[1],t[1]&&(e.lineWidth=t[2],e.lineCap=t[3],e.lineJoin=t[4],e.miterLimit=t[5],e.lineDashOffset=t[7],e.setLineDash(t[6]))}drawLabelWithPointPlacement_(e,t,n,r){let i=this.textStates[t],a=this.createLabel(e,t,r,n),o=this.strokeStates[n],s=this.pixelRatio,c=ey(Array.isArray(e)?e[0]:e,i.textAlign||`center`),l=Lv[i.textBaseline||`middle`],u=o&&o.lineWidth?o.lineWidth:0;return{label:a,anchorX:c*(a.width/s-2*i.scale[0])+2*(.5-c)*u,anchorY:l*a.height/s+2*(.5-l)*u}}execute_(e,t,n,r,i,a,o,s){let c=this.zIndexContext_,l;this.pixelCoordinates_&&Us(n,this.renderedTransform_)?l=this.pixelCoordinates_:(this.pixelCoordinates_||=[],l=Ed(this.coordinates,0,this.coordinates.length,2,n,this.pixelCoordinates_),_d(this.renderedTransform_,n));let u=0,d=r.length,f=0,p,m=[],h,g,_,v,y,b,x,S,C,w,T,E,D,O=0,k=0,ee=this.coordinateCache_,te=this.viewRotation_,ne=Math.round(Math.atan2(-n[1],n[0])*0xe8d4a51000)/0xe8d4a51000,re={context:e,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:te},ie=this.instructions!=r||this.overlaps?0:200,A,ae,oe,j;for(;uie&&(this.fill_(e),O=0),k>ie&&(e.stroke(),k=0),!O&&!k&&(e.beginPath(),y=NaN,b=NaN),++u;break;case $.CIRCLE:f=n[1],_=n[2]??0;let r=l[f],d=l[f+1],se=l[f+2]-_,ce=l[f+3]-_,le=se-r,ue=ce-d,M=Math.sqrt(le*le+ue*ue);e.moveTo(r+M,d),e.arc(r,d,M,0,2*Math.PI,!0),++u;break;case $.CLOSE_PATH:e.closePath(),++u;break;case $.CUSTOM:f=n[1],p=n[2];let de=n[3],N=n[4],fe=n[5];re.geometry=de,re.feature=A,u in ee||(ee[u]=[]);let P=ee[u];fe?fe(l,f,p,2,P):(P[0]=l[f],P[1]=l[f+1],P.length=2),c&&(c.zIndex=n[6]),N(P,re),++u;break;case $.DRAW_IMAGE:f=n[1],p=n[2],C=n[3],h=n[4],g=n[5];let pe=n[6],me=n[7],he=n[8],ge=n[9],_e=n[10],ve=n[11],ye=n[12],be=n[13];v=n[14]||`declutter`;let xe=n[15];if(!C&&n.length>=20){w=n[19],T=n[20],E=n[21],D=n[22];let e=this.drawLabelWithPointPlacement_(w,T,E,D);C=e.label,n[3]=C;let t=n[23];h=(e.anchorX-t)*this.pixelRatio,n[4]=h;let r=n[24];g=(e.anchorY-r)*this.pixelRatio,n[5]=g,pe=C.height,n[6]=pe,be=C.width,n[13]=be}let Se;n.length>25&&(Se=n[25]);let Ce,we,Te;n.length>17?(Ce=n[16],we=n[17],Te=n[18]):(Ce=cg,we=null,Te=null),_e&&ne?ve+=te:!_e&&!ne&&(ve-=te);let Ee=0;for(;f!ay.includes(e)),sy=!1,cy=!1;function ly(){let e=0,t=t=>{let n=Gf(1,1,null,{willReadFrequently:t}),r=0,i=performance.now();for(;performance.now()-i<50;++r)n.fillStyle=`rgba(255,0,${r%256},1)`,n.fillRect(0,0,1,1),n.getImageData(0,0,1,1);return e=r>e?r:e,r};sy={[t(!0)]:!0,[t(!1)]:!1,[t(void 0)]:void 0}[e],cy=!0}var uy=class{constructor(e,t,n,r,i,a,o){this.maxExtent_=e,this.overlaps_=r,this.pixelRatio_=n,this.resolution_=t,this.renderBuffer_=a,this.executorsByZIndex_={},this.hitDetectionContext_=null,this.hitDetectionTransform_=gd(),this.renderedContext_=null,this.deferredZIndexContexts_={},this.createExecutors_(i,!!o)}clip(e,t){let n=this.getClipCoords(t);e.beginPath(),e.moveTo(n[0],n[1]),e.lineTo(n[2],n[3]),e.lineTo(n[4],n[5]),e.lineTo(n[6],n[7]),e.clip()}createExecutors_(e,t){for(let n in e){let r=this.executorsByZIndex_[n];r===void 0&&(r={},this.executorsByZIndex_[n]=r);let i=e[n];for(let e in i){let n=i[e];r[e]=new ry(this.resolution_,this.pixelRatio_,this.overlaps_,n,t)}}}hasExecutors(e){for(let t in this.executorsByZIndex_){let n=this.executorsByZIndex_[t];for(let t=0,r=e.length;t0){if(!a||n===`none`||f!==`Image`&&f!==`Text`||a.includes(e)){let n=(d[c]-3)/4,a=r-n%o,s=r-(n/o|0),l=i(e,t,a*a+s*s);if(l)return l}p.clearRect(0,0,o,o);break}}let h=Object.keys(this.executorsByZIndex_).map(Number);h.sort(Rs);let g,_,v,y,b;for(g=h.length-1;g>=0;--g){let e=h[g].toString();for(v=this.executorsByZIndex_[e],_=iy.length-1;_>=0;--_)if(f=iy[_],y=v[f],y!==void 0&&(b=y.executeHitDetection(l,s,n,m,u),b))return b}}getClipCoords(e){let t=this.maxExtent_;if(!t)return null;let n=t[0],r=t[1],i=t[2],a=t[3],o=[n,r,n,a,i,a,i,r];return Ed(o,0,8,2,e,o),o}isEmpty(){return Ps(this.executorsByZIndex_)}execute(e,t,n,r,i,a,o){let s=Object.keys(this.executorsByZIndex_).map(Number);s.sort(o?zs:Rs),a||=iy;let c=iy.length;for(let l=0,u=s.length;lp.execute(e,t,n,r,i,o)),d&&u.restore(),a){a.offset();let e=s[l]*c+iy.indexOf(f);this.deferredZIndexContexts_[e]||(this.deferredZIndexContexts_[e]=[]),this.deferredZIndexContexts_[e].push(a)}}}}this.renderedContext_=e}getDeferredZIndexContexts(){return this.deferredZIndexContexts_}getRenderedContext(){return this.renderedContext_}renderDeferred(){let e=this.deferredZIndexContexts_,t=Object.keys(e).map(Number).sort(Rs);for(let n=0,r=t.length;n{e.draw(this.renderedContext_),e.clear()}),e[t[n]].length=0}},dy={};function fy(e){if(dy[e]!==void 0)return dy[e];let t=e*2+1,n=e*e,r=Array(n+1);for(let i=0;i<=e;++i)for(let a=0;a<=e;++a){let o=i*i+a*a;if(o>n)break;let s=r[o];s||(s=[],r[o]=s),s.push(((e+i)*t+(e+a))*4+3),i>0&&s.push(((e-i)*t+(e+a))*4+3),a>0&&(s.push(((e+i)*t+(e-a))*4+3),i>0&&s.push(((e-i)*t+(e-a))*4+3))}let i=[];for(let e=0,t=r.length;e0){let e=c.length,t=i||Math.abs(c[0]-c[e-2])<1e-6&&Math.abs(c[1]-c[e-1])<1e-6;c=Vv(c,0,e,2,s,t,c),Uv(c,2,t)}o.moveTo(c[0],c[1]);let l=c.length;i&&(l-=2);for(let e=2;ee*this.pixelRatio_),lineDashOffset:(i||0)*this.pixelRatio_,lineJoin:a===void 0?ig:a,lineWidth:(o===void 0?1:o)*this.pixelRatio_,miterLimit:s===void 0?10:s,strokeStyle:Qh(e||`#000`)||`#000`,strokeOffset:(l??0)*this.pixelRatio_}}}setImageStyle(e){let t;if(!e||!(t=e.getSize())){this.image_=null;return}let n=e.getPixelRatio(this.pixelRatio_),r=e.getAnchor(),i=e.getOrigin();if(!r||!i){this.image_=null;return}this.image_=e.getImage(this.pixelRatio_),this.imageAnchorX_=r[0]*n,this.imageAnchorY_=r[1]*n,this.imageHeight_=t[1]*n,this.imageOpacity_=e.getOpacity(),this.imageOriginX_=i[0],this.imageOriginY_=i[1],this.imageRotateWithView_=e.getRotateWithView(),this.imageRotation_=e.getRotation();let a=e.getScaleArray();this.imageScale_=[a[0]*this.pixelRatio_/n,a[1]*this.pixelRatio_/n],this.imageWidth_=t[0]*n}setTextStyle(e){if(!e)this.text_=``;else{let t=e.getFill();if(!t)this.textFillState_=null;else{let e=t.getColor();this.textFillState_={fillStyle:Qh(e||`#000`)||`#000`}}let n=e.getStroke();if(!n)this.textStrokeState_=null;else{let e=n.getColor(),t=n.getLineCap(),r=n.getLineDash(),i=n.getLineDashOffset(),a=n.getLineJoin(),o=n.getWidth(),s=n.getMiterLimit();this.textStrokeState_={lineCap:t===void 0?ng:t,lineDash:r||rg,lineDashOffset:i||0,lineJoin:a===void 0?ig:a,lineWidth:o===void 0?1:o,miterLimit:s===void 0?10:s,strokeStyle:Qh(e||`#000`)||`#000`}}let r=e.getFont(),i=e.getOffsetX(),a=e.getOffsetY(),o=e.getRotateWithView(),s=e.getRotation(),c=e.getScaleArray(),l=e.getText(),u=e.getTextAlign(),d=e.getTextBaseline();this.textState_={font:r===void 0?eg:r,textAlign:u===void 0?og:u,textBaseline:d===void 0?sg:d},this.text_=l===void 0?``:Array.isArray(l)?l.reduce((e,t,n)=>e+=n%2?` `:t,``):l,this.textOffsetX_=i===void 0?0:this.pixelRatio_*i,this.textOffsetY_=a===void 0?0:this.pixelRatio_*a,this.textRotateWithView_=o!==void 0&&o,this.textRotation_=s===void 0?0:s,this.textScale_=[this.pixelRatio_*c[0],this.pixelRatio_*c[1]]}}},my=.5;function hy(e,t,n,r,i,a,o,s,c){let l=c?ud(i,c):i,u=Gf(e[0]*my,e[1]*my);u.imageSmoothingEnabled=!1;let d=u.canvas,f=new py(u,my,i,[1,0,0,1,0,0],o,s??0,c?nd(sd(),c)??void 0:void 0),p=n.length,m=Math.floor(16777215/p),h={};for(let e=1;e<=p;++e){let t=n[e-1],i=t.getStyleFunction()||r;if(!i)continue;let o=i(t,a);if(!o)continue;Array.isArray(o)||(o=[o]);let s=(e*m).toString(16).padStart(7,`#00000`);for(let e=0,n=o.length;e0;return d&&Promise.all(c).then(()=>i(null)),wy(e,t,n,r,a,o,s),d}function wy(e,t,n,r,i,a,o){let s=n.getGeometryFunction()(t);if(!s)return;let c=s.simplifyTransformed(r,i);if(n.getRenderer())Ty(e,c,n,t,o);else{let r=vy[c.getType()];r(e,c,n,t,o,a)}}function Ty(e,t,n,r,i){if(t.getType()==`GeometryCollection`){let a=t.getGeometries();for(let t=0,o=a.length;t{if(this.frameState&&!this.hitDetectionImageData_&&!this.animatingOrInteracting_){let e=this.frameState.size.slice(),t=this.renderedCenter_,n=this.renderedResolution_,r=this.renderedRotation_,i=this.renderedProjection_,a=this.wrappedRenderedExtent_,o=this.getLayer(),s=[],c=e[0]*my,l=e[1]*my;s.push(this.getRenderTransform(t,n,r,my,c,l,0).slice());let u=o.getSource(),d=i.getExtent();if(u.getWrapX()&&i.canWrapX()&&!Kc(d,a)){let e=a[0],i=G(d),o=0,u;for(;ed[2];)++o,u=i*o,s.push(this.getRenderTransform(t,n,r,my,c,l,u).slice()),e-=i}let f=sd();this.hitDetectionImageData_=hy(e,s,this.renderedFeatures_,o.getStyleFunction(),a,n,r,by(n,this.renderedPixelRatio_),f?i:null)}t(gy(e,this.renderedFeatures_,this.hitDetectionImageData_))})}forEachFeatureAtCoordinate(e,t,n,r,i){if(!this.replayGroup_)return;let a=t.viewState.resolution,o=t.viewState.rotation,s=this.getLayer(),c={},l=function(e,t,n){let a=V(e),o=c[a];if(!o){if(n===0)return c[a]=!0,r(e,s,t);i.push(c[a]={feature:e,layer:s,geometry:t,distanceSq:n,callback:r})}else if(o!==!0&&ne.value):null)}handleFontsChanged(){let e=this.getLayer();e.getVisible()&&this.replayGroup_&&e.changed()}handleStyleImageChange_(e){this.renderIfReadyAndVisible()}prepareFrame(e){let t=this.getLayer(),n=t.getSource();if(!n)return!1;let r=e.viewHints[Tc.ANIMATING],i=e.viewHints[Tc.INTERACTING],a=t.getUpdateWhileAnimating(),o=t.getUpdateWhileInteracting();if(this.ready&&!a&&r||!o&&i)return this.animatingOrInteracting_=!0,!0;this.animatingOrInteracting_=!1;let s=e.extent,c=e.viewState,l=c.projection,u=c.resolution,d=e.pixelRatio,f=t.getRevision(),p=t.getRenderBuffer(),m=t.getRenderOrder();m===void 0&&(m=yy);let h=c.center.slice(),g=Hc(s,p*u),_=g.slice(),v=[g.slice()],y=l.getExtent(),b=n.getWrapX()&&l.canWrapX();if(this.extendX_=!1,b){let e=n.getExtent();e&&!yl(e)&&(this.extendX_=e[0]y[2])}if(b&&(!Kc(y,e.extent)||this.extendX_)){let e=G(y),t=Math.max(G(g)/2,e),n=y[0],r=y[2];this.extendX_&&(n-=e,r+=e),g[0]=n-t,g[2]=r+t,kl(h,l);let i=Sl(v[0],l);i[0]y[0]&&i[2]>y[2]&&v.push([i[0]-e,i[1],i[2]-e,i[3]])}if(this.ready&&this.renderedResolution_==u&&this.renderedPixelRatio_===d&&this.renderedRevision_==f&&this.renderedRenderOrder_==m&&this.renderedFrameDeclutter_===!!e.declutter&&Kc(this.wrappedRenderedExtent_,g))return Us(this.renderedExtent_,_)||(this.hitDetectionImageData_=null,this.renderedExtent_=_),this.renderedCenter_=h,this.replayGroupChanged=!1,!0;this.replayGroup_=null;let x=new zv(xy(u,d),g,u,d),S=sd(),C;if(S){for(let e=0,t=v.length;e{let r,i=e.getStyleFunction()||t.getStyleFunction();if(i&&(r=i(e,u)),r){let t=this.renderFeature(e,w,r,x,C,this.getLayer().getDeclutter(),n);T&&=!t}},D=ud(g,l),O=n.getFeaturesInExtent(D);m&&O.sort(m);for(let e=0,t=O.length;ee!==void 0)),this.minZoom=t===void 0?0:t,this.resolutions_=n,U(Ws(this.resolutions_,(e,t)=>t-e,!0),"`resolutions` must be sorted in descending order");let r;if(!e.origins){for(let e=0,t=this.resolutions_.length-1;e{let n=new B_(Math.min(0,e[0]),Math.max(e[0]-1,-1),Math.min(0,e[1]),Math.max(e[1]-1,-1));if(i){let e=this.getTileRangeForExtentAndZ(i,t);n.minX=Math.max(e.minX,n.minX),n.maxX=Math.min(e.maxX,n.maxX),n.minY=Math.max(e.minY,n.minY),n.maxY=Math.min(e.maxY,n.maxY)}return n}):this.fullTileRanges_=e.tileRanges}forEachTileCoord(e,t,n){let r=this.getTileRangeForExtentAndZ(e,t);for(let e=r.minX,i=r.maxX;e<=i;++e)for(let i=r.minY,a=r.maxY;i<=a;++i)n([t,e,i])}forEachTileCoordParentTileRange(e,t,n,r){let i,a,o,s=null,c=e[0]-1;for(this.zoomFactor_===2?(a=e[1],o=e[2]):s=this.getTileCoordExtent(e,r);c>=this.minZoom;){if(a!==void 0&&o!==void 0?(a=Math.floor(a/2),o=Math.floor(o/2),i=V_(a,a,o,o,n)):i=this.getTileRangeForExtentAndZ(s,c,n),t(c,i))return!0;--c}return!1}getExtent(){return this.extent_}getMaxZoom(){return this.maxZoom}getMinZoom(){return this.minZoom}getOrigin(e){return this.origin_?this.origin_:this.origins_?this.origins_[e]:[0,0]}getOrigins(){return this.origins_}getResolution(e){return this.resolutions_[e]}getResolutions(){return this.resolutions_}getTileCoordChildTileRange(e,t,n){if(e[0]this.maxZoom||t0?r:Math.max(a/n[0],i/n[1]);let o=t+1,s=Array(o);for(let e=0;e{let n=()=>{let r=this.getState();r===`ready`?(this.un(`change`,n),e()):r===`error`&&(this.un(`change`,n),t(Error(`Source failed to load`)))};this.on(`change`,n)})}getState(){return this.state_}getWrapX(){return this.wrapX_}getInterpolate(){return this.interpolate_}refresh(){this.changed()}setAttributions(e){this.attributions_=nb(e),this.changed()}setState(e){this.state_=e,this.changed()}};function nb(e){return e?typeof e==`function`?e:(Array.isArray(e)||(e=[e]),t=>e):null}var rb=class extends tb{constructor(e){super({attributions:e.attributions,attributionsCollapsible:e.attributionsCollapsible,projection:e.projection,state:e.state,wrapX:e.wrapX,interpolate:e.interpolate}),this.on,this.once,this.un,this.tilePixelRatio_=e.tilePixelRatio===void 0?1:e.tilePixelRatio,this.tileGrid=e.tileGrid===void 0?null:e.tileGrid,this.tileGrid&&Bm(this.tileGrid.getTileSize(this.tileGrid.getMinZoom()),[256,256]),this.tmpSize=[0,0],this.key_=e.key||V(this),this.tileOptions={transition:e.transition,interpolate:e.interpolate},this.zDirection=e.zDirection?e.zDirection:0}getGutterForProjection(e){return 0}getKey(){return this.key_}setKey(e){this.key_!==e&&(this.key_=e,this.changed())}getResolutions(e){let t=e?this.getTileGridForProjection(e):this.tileGrid;return t?t.getResolutions():null}getTile(e,t,n,r,i,a){return B()}getTileGrid(){return this.tileGrid}getTileGridForProjection(e){return this.tileGrid?this.tileGrid:zy(e)}getTilePixelRatio(e){return this.tilePixelRatio_}getTilePixelSize(e,t,n){let r=this.getTileGridForProjection(n),i=this.getTilePixelRatio(t),a=Bm(r.getTileSize(e),this.tmpSize);return i==1?a:zm(a,i,this.tmpSize)}getTileCoordForTileUrlFunction(e,t){let n=t===void 0?this.getProjection():t,r=t===void 0&&this.tileGrid||this.getTileGridForProjection(n);return this.getWrapX()&&n.isGlobal()&&(e=By(r,e,n)),sv(e,r)?e:null}clear(){}refresh(){this.clear(),super.refresh()}},ib=class extends Qs{constructor(e,t){super(e),this.tile=t}},ab={TILELOADSTART:`tileloadstart`,TILELOADEND:`tileloadend`,TILELOADERROR:`tileloaderror`},ob=class e extends rb{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===e.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(e){let t=e.target,n=V(t),r=t.getState(),i;r==H.LOADING?(this.tileLoadingKeys_[n]=!0,i=ab.TILELOADSTART):n in this.tileLoadingKeys_&&(delete this.tileLoadingKeys_[n],i=r==H.ERROR?ab.TILELOADERROR:r==H.LOADED?ab.TILELOADEND:void 0),i!=null&&this.dispatchEvent(new ib(i,t))}setTileLoadFunction(e){this.tileLoadFunction=e,this.changed()}setTileUrlFunction(e,t){this.tileUrlFunction=e,t===void 0?this.changed():this.setKey(t)}setUrl(e){let t=Zy(e);this.urls=t,this.setUrls(t)}setUrls(e){this.urls=e;let t=e.join(` -`);this.generateTileUrlFunction_?this.setTileUrlFunction($y(e,this.tileGrid),t):this.setKey(t)}tileUrlFunction(e,t,n){}},sb=class extends ob{constructor(e){super({attributions:e.attributions,cacheSize:e.cacheSize,projection:e.projection,state:e.state,tileGrid:e.tileGrid,tileLoadFunction:e.tileLoadFunction?e.tileLoadFunction:cb,tilePixelRatio:e.tilePixelRatio,tileUrlFunction:e.tileUrlFunction,url:e.url,urls:e.urls,wrapX:e.wrapX,transition:e.transition,interpolate:e.interpolate===void 0||e.interpolate,key:e.key,attributionsCollapsible:e.attributionsCollapsible,zDirection:e.zDirection}),this.crossOrigin=e.crossOrigin===void 0?null:e.crossOrigin,this.referrerPolicy=e.referrerPolicy,this.tileClass=e.tileClass===void 0?R_:e.tileClass,this.tileGridForProjection={},this.reprojectionErrorThreshold_=e.reprojectionErrorThreshold,this.renderReprojectionEdges_=!1}getGutterForProjection(e){let t=this.getProjection();return t&&e&&!td(t,e)?0:this.getGutter()}getGutter(){return 0}getKey(){let e=super.getKey();return this.getInterpolate()||(e+=`:disable-interpolation`),e}getTileGridForProjection(e){let t=this.getProjection();if(this.tileGrid&&(!t||td(t,e)))return this.tileGrid;let n=V(e);return n in this.tileGridForProjection||(this.tileGridForProjection[n]=zy(e)),this.tileGridForProjection[n]}createTile_(e,t,n,r,i,a){let o=[e,t,n],s=this.getTileCoordForTileUrlFunction(o,i),c=s?this.tileUrlFunction(s,r,i):void 0,l=new this.tileClass(o,c===void 0?H.EMPTY:H.IDLE,c===void 0?``:c,{crossOrigin:this.crossOrigin,referrerPolicy:this.referrerPolicy},this.tileLoadFunction,this.tileOptions);return l.key=a,l.addEventListener(z.CHANGE,this.handleTileChange.bind(this)),l}getTile(e,t,n,r,i,a){let o=this.getProjection();if(!o||!i||td(o,i))return this.getTileInternal(e,t,n,r,o||i);let s=[e,t,n],c=this.getKey(),l=new ev(o,this.getTileGridForProjection(o),i,this.getTileGridForProjection(i),s,this.getTileCoordForTileUrlFunction(s,i)||s,this.getTilePixelRatio(r),this.getGutter(),(e,t,n,r)=>this.getTileInternal(e,t,n,r,o,a),this.reprojectionErrorThreshold_,this.renderReprojectionEdges_,this.tileOptions);return l.key=c,l}getTileInternal(e,t,n,r,i,a){let o=this.getKey(),s=iv(this,o,e,t,n);if(a&&a.containsKey(s))return a.get(s);let c=this.createTile_(e,t,n,r,i,o);return a?.set(s,c),c}setRenderReprojectionEdges(e){this.renderReprojectionEdges_!=e&&(this.renderReprojectionEdges_=e,this.changed())}setTileGridForProjection(e,t){let n=Ju(e);if(n){let e=V(n);e in this.tileGridForProjection||(this.tileGridForProjection[e]=t)}}};function cb(e,t){if(mc){let n=e.getCrossOrigin(),r=`same-origin`,i=`same-origin`;n===`anonymous`||n===``?(r=`cors`,i=`omit`):n===`use-credentials`&&(r=`cors`,i=`include`);let a={mode:r,credentials:i,referrerPolicy:e.getReferrerPolicy()};fetch(t,a).then(e=>{if(!e.ok)throw Error(`HTTP ${e.status}`);return e.blob()}).then(e=>createImageBitmap(e)).then(t=>{let n=e.getImage();if(!n)return;n.width=t.width,n.height=t.height;let r=n.getContext(`2d`);r&&(r.drawImage(t,0,0),t.close?.(),n.dispatchEvent(new Event(`load`)))}).catch(()=>{e.getImage()?.dispatchEvent(new Event(`error`))})}else e.getImage().src=t}var lb=class extends sb{constructor(e){e||={};let t=e.projection===void 0?`EPSG:3857`:e.projection,n=e.tileGrid===void 0?Hy({extent:Gy(t),maxResolution:e.maxResolution,maxZoom:e.maxZoom,minZoom:e.minZoom,tileSize:e.tileSize}):e.tileGrid;super({attributions:e.attributions,cacheSize:e.cacheSize,crossOrigin:e.crossOrigin,referrerPolicy:e.referrerPolicy,interpolate:e.interpolate,projection:t,reprojectionErrorThreshold:e.reprojectionErrorThreshold,tileGrid:n,tileLoadFunction:e.tileLoadFunction,tilePixelRatio:e.tilePixelRatio,tileUrlFunction:e.tileUrlFunction,url:e.url,urls:e.urls,wrapX:e.wrapX===void 0||e.wrapX,transition:e.transition,attributionsCollapsible:e.attributionsCollapsible,zDirection:e.zDirection}),this.gutter_=e.gutter===void 0?0:e.gutter}getGutter(){return this.gutter_}},ub=!1;function db(e,t,n,r,i,a,o){let s=new XMLHttpRequest;s.open(`GET`,typeof e==`function`?e(n,r,i):e,!0),t.getType()==`arraybuffer`&&(s.responseType=`arraybuffer`),s.withCredentials=ub,s.onload=function(e){if(!s.status||s.status>=200&&s.status<300){let e=t.getType();try{let r;e==`text`||e==`json`?r=s.responseText:e==`xml`?r=s.responseXML||s.responseText:e==`arraybuffer`&&(r=s.response),r?a(t.readFeatures(r,{extent:n,featureProjection:i}),t.readProjection(r)):o()}catch{o()}}else o()},s.onerror=o,s.send()}function fb(e,t){return function(n,r,i,a,o){db(e,t,n,r,i,(e,t)=>{this.addFeatures(e),a!==void 0&&a(e)},()=>{this.changed(),o!==void 0&&o()})}}function pb(e,t){return[[-1/0,-1/0,1/0,1/0]]}function mb(e,t,n,r,i,a,o){let s,c,l=(n-t)/r;if(l===1)s=t;else if(l===2)s=t,c=i;else if(l!==0){let a=e[t],o=e[t+1],l=0,u=[0];for(let i=t+r;i1?o:2,a||=Array(o);for(let t=0;t{if(t===this.squaredTolerance_)return this.simplifiedGeometry_;this.simplifiedGeometry_=this.clone(),n&&this.simplifiedGeometry_.applyTransform(n);let r=this.simplifiedGeometry_.getFlatCoordinates(),i;switch(this.type_){case`LineString`:r.length=rf(r,0,this.simplifiedGeometry_.flatCoordinates_.length,this.simplifiedGeometry_.stride_,t,r,0),i=[r.length];break;case`MultiLineString`:i=[],r.length=af(r,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,t,r,0,i);break;case`Polygon`:i=[],r.length=cf(r,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,Math.sqrt(t),r,0,i)}return i&&(this.simplifiedGeometry_=new e(this.type_,r,i,this.stride_,this.properties_,this.id_)),this.squaredTolerance_=t,this.simplifiedGeometry_}),this}};_b.prototype.getFlatCoordinates=_b.prototype.getOrientedFlatCoordinates;var vb=class{constructor(e){this.rbush_=new $p(e),this.items_={}}insert(e,t){let n={minX:e[0],minY:e[1],maxX:e[2],maxY:e[3],value:t};this.rbush_.insert(n),this.items_[V(t)]=n}load(e,t){let n=Array(t.length);for(let r=0,i=t.length;r{t||=(t=!0,this.addFeature(e.element),!1)})),e.addEventListener(js.REMOVE,(e=>{t||=(t=!0,this.removeFeature(e.element),!1)})),this.featuresCollection_=e}clear(e){if(e){for(let e in this.featureChangeKeys_)this.featureChangeKeys_[e].forEach(R);this.featuresCollection_||(this.featureChangeKeys_={},this.idIndex_={},this.uidIndex_={})}else if(this.featuresRtree_){this.featuresRtree_.forEach(e=>{this.removeFeatureInternal(e)});for(let e in this.nullGeometryFeatures_)this.removeFeatureInternal(this.nullGeometryFeatures_[e])}this.featuresCollection_&&this.featuresCollection_.clear(),this.featuresRtree_&&this.featuresRtree_.clear(),this.nullGeometryFeatures_={};let t=new bb(yb.CLEAR);this.dispatchEvent(t),this.changed()}forEachFeature(e){if(this.featuresRtree_)return this.featuresRtree_.forEach(e);this.featuresCollection_&&this.featuresCollection_.forEach(e)}forEachFeatureAtCoordinateDirect(e,t){let n=[e[0],e[1],e[0],e[1]];return this.forEachFeatureInExtent(n,function(n){let r=n.getGeometry();if(r instanceof _b||r&&r.intersectsCoordinate(e))return t(n)})}forEachFeatureInExtent(e,t){if(this.featuresRtree_)return this.featuresRtree_.forEachInExtent(e,t);this.featuresCollection_&&this.featuresCollection_.forEach(t)}forEachFeatureIntersectingExtent(e,t){return this.forEachFeatureInExtent(e,function(n){let r=n.getGeometry();if(r instanceof _b||r&&r.intersectsExtent(e)){let e=t(n);if(e)return e}})}getFeaturesCollection(){return this.featuresCollection_}getFeatures(){let e;return this.featuresCollection_?e=this.featuresCollection_.getArray().slice(0):this.featuresRtree_&&(e=this.featuresRtree_.getAll(),Ps(this.nullGeometryFeatures_)||Hs(e,Object.values(this.nullGeometryFeatures_))),e||[]}getFeaturesAtCoordinate(e){let t=[];return this.forEachFeatureAtCoordinateDirect(e,function(e){t.push(e)}),t}getFeaturesInExtent(e,t){if(this.featuresRtree_){if(!(t&&t.canWrapX()&&this.getWrapX()))return this.featuresRtree_.getInExtent(e);let n=this.featuresRtree_;return Cl(e,t).flatMap(e=>n.getInExtent(e))}return this.featuresCollection_?this.featuresCollection_.getArray().slice(0):[]}getClosestFeatureToCoordinate(e,t){let n=e[0],r=e[1],i=null,a=[NaN,NaN],o=1/0,s=[-1/0,-1/0,1/0,1/0];t||=qs;let c=this.featuresRtree_;return c?(c.forEachInExtent(s,function(e){if(t(e)){let t=e.getGeometry();if(!t)return;let c=o;if(o=t instanceof _b?0:t.closestPointXY(n,r,a,o),o{this.loading=Number(this.loading)-1,this.dispatchEvent(new bb(yb.FEATURESLOADEND,void 0,e))},i=()=>{this.changed(),this.loading=Number(this.loading)-1,this.dispatchEvent(new bb(yb.FEATURESLOADERROR))},o=!1,s=this.loader_.call(this,a,t,n,t=>o||e(t),()=>o||i());Ks(s)?(o=!0,s.then(t=>{let n=t;this.addFeatures(n),e(n)}).catch(i)):this.loader_.length<4&&(this.loading=!1),r.insert(a,{extent:a.slice()})}}}refresh(){this.clear(!0),this.loadedExtentsRtree_.clear(),super.refresh()}removeLoadedExtent(e){let t=this.loadedExtentsRtree_,n=[];t.forEachInExtent(e,function(e){n.push(e)}),n.forEach(n=>{t.remove(n);let r=hl(n.extent,e);for(let e of r)t.insert(e,{extent:e})})}removeFeatures(e){let t=!1;for(let n=0,r=e.length;n{n.src=Cb};caches.open(d).then(async e=>{let i=await e.match(t);if(!i){r();return}let a=await i.blob(),o=URL.createObjectURL(a),s=()=>URL.revokeObjectURL(o);n.addEventListener(`load`,s,{once:!0}),n.addEventListener(`error`,()=>{s(),r()},{once:!0}),n.src=o}).catch(r)}function jb(e,t,n){n?(t.getGeometry()?.setCoordinates([n.easting,n.northing]),e.hasFeature(t)||e.addFeature(t)):e.hasFeature(t)&&e.removeFeature(t)}function Mb(e,t,n){e.style.background=wb;let r=Ju(`EPSG:25832`);if(!r)throw Error(`EPSG:25832 ist nicht registriert.`);let i=Ob(t);r.setExtent(i);let a=t.tileSizePx,o=new Ry({origin:[0,1024e4],resolutions:[...t.resolutions].reverse(),tileSize:a,extent:i}),s=new Db({projection:r,tileGrid:o,zDirection:-1,wrapX:!1,transition:0,tileUrlFunction(e){let n=t.resolutions.length-1-e[0];if(n<0||n>=t.resolutions.length)return;let r=o.getResolution(e[0]),i=o.getTileCoordExtent(e),s=r*a;return f(`${n}/${Math.floor(i[0]/s+1e-9)}/${Math.floor(i[1]/s+1e-9)}`)},tileLoadFunction:Ab}),c=new xb,l=kb(Tb),u=new A_({geometry:new uf([0,0])});u.setStyle(kb(Eb));let d=n.snapshot(),p=Nb(e),m=Pb(r,[d.center.easting,d.center.northing],d.resolution,Zo(p,Xo)),h=new O_({target:e,layers:[new xv({source:s}),new Py({source:c,updateWhileAnimating:!0,updateWhileInteracting:!0})],view:m,controls:[],interactions:Vp({altShiftDragRotate:!1,pinchRotate:!1,doubleClickZoom:!1,keyboard:!1,shiftDragZoom:!1})}),g=!1,_=!1,v=0,y=0,b=()=>{let e=h.getView(),t=e.getCenter(),r=e.getResolution();t&&r!==void 0&&(n.panTo({easting:t[0],northing:t[1]}),n.zoomTo(r))},x=()=>{_||(_=!0,b())};h.on(`singleclick`,e=>{let[t,r]=e.coordinate;n.tap({easting:t,northing:r})}),h.on(`pointerdrag`,x),h.getViewport()?.addEventListener(`wheel`,x,{passive:!0}),h.on(`moveend`,()=>{if(g)return;let e=h.getView();!_||e.getInteracting()||e.getAnimating()||(_=!1,b())});let S=e=>{let t=Zo(e,Xo),n=h.getView();if(Math.abs(n.getMaxResolution()-t)<1e-9)return;let i=n.getCenter(),a=n.getResolution();i&&a!==void 0&&(g=!0,m=Pb(r,[i[0],i[1]],Math.min(Math.max(a,Xo.minResolutionMeters),t),t),h.setView(m),requestAnimationFrame(()=>{g=!1}))},C=()=>{let e=h.getSize();if(!e)return;let t=Math.round(e[0]),r=Math.round(e[1]);if(t<1||r<1||t===v&&r===y)return;v=t,y=r;let i={widthPx:t,heightPx:r},a=h.getView();!a.getInteracting()&&!a.getAnimating()&&S(i),n.setViewport(i)};return h.on(`change:size`,C),C(),{apply(e){let t=new Set(e.ziele.map(e=>e.koordinate));for(let e of[...c.getFeatures()]){if(e===u)continue;let n=e.getId();(typeof n!=`string`||!t.has(n))&&c.removeFeature(e)}for(let t of e.ziele){let e=c.getFeatureById(t.koordinate)?.getGeometry();if(e instanceof uf){e.setCoordinates([t.point.easting,t.point.northing]);continue}let n=new A_({geometry:new uf([t.point.easting,t.point.northing])});n.setId(t.koordinate),n.setStyle(l),c.addFeature(n)}jb(c,u,e.standort);let n=h.getView();if(n.getInteracting()||n.getAnimating())return;let r=h.getSize();r&&r[0]>=1&&r[1]>=1&&S({widthPx:Math.round(r[0]),heightPx:Math.round(r[1])});let i=h.getView(),a=i.getCenter(),o=i.getResolution(),s=[e.center.easting,e.center.northing],d=a!==void 0&&Math.abs(a[0]-s[0])<.01&&Math.abs(a[1]-s[1])<.01,f=o!==void 0&&Math.abs(o-e.resolution)<1e-6;d&&f||(g=!0,i.setCenter(s),i.setResolution(e.resolution),i.setRotation(0),requestAnimationFrame(()=>{g=!1}))},refreshTiles(){s.reload()}}}function Nb(e){let t=Math.round(e.clientWidth)||window.innerWidth,n=Math.round(e.clientHeight)||window.innerHeight;return{widthPx:Math.max(t,1),heightPx:Math.max(n,1)}}function Pb(e,t,n,r){let i=Xo.minResolutionMeters,a=Math.max(r,i);return new Af({projection:e,center:t,resolution:Math.min(Math.max(n,i),a),rotation:0,enableRotation:!1,resolutions:[a,i],constrainResolution:!1,smoothResolutionConstraint:!1,multiWorld:!1})}function Fb(e,t,n){e.replaceChildren();let r=document.createElement(`div`);r.className=`map`;let i=document.createElement(`section`);i.className=`panel`,i.innerHTML=` -
-

Karte

-
- - -
-
- - - - `;let a=document.createElement(`dialog`);a.innerHTML=` -

-

-
- - -
- `,e.append(i,r,a);let o=i.querySelector(`#ziele`),s=i.querySelector(`.fold-toggle`),c=i.querySelector(`#einstellungen`),l=i.querySelector(`.einstellungen-toggle`),u=i.querySelector(`form`),d=i.querySelector(`input[name="gitter"]`),f=i.querySelector(`input[name="rechtswert"]`),p=i.querySelector(`input[name="hochwert"]`),m=i.querySelector(`.ziel-list`),h=i.querySelector(`.actions button`),g=i.querySelector(`.download-knopf input`),_=i.querySelector(`.gebiet`),v=i.querySelector(`.gebiet p`),y=i.querySelector(`.gebiet button`),b=i.querySelector(`.wipe`),x=i.querySelector(`.notice`),S=a.querySelector(`.ask`),C=a.querySelector(`.explain`),w=a.querySelector(`.confirm`),T=a.querySelector(`.cancel`);if(!o||!s||!c||!l||!u||!d||!f||!p||!m||!h||!g||!_||!v||!y||!b||!x||!S||!C||!w||!T)return;let E=t.snapshot();d.value=E.koordinate.gitter,f.value=E.koordinate.rechtswert,p.value=E.koordinate.hochwert;let D=Mb(r,n,t),O=document.createElement(`button`);O.type=`button`,O.className=`map-download icon-button`,O.setAttribute(`aria-label`,`Diese Ansicht herunterladen`),O.title=`Diese Ansicht herunterladen`,O.innerHTML=zb,O.addEventListener(`click`,()=>t.downloadView());let k=!1,ee=Ib(t.snapshot());u.addEventListener(`submit`,e=>{e.preventDefault(),t.enterKoordinate({gitter:d.value,rechtswert:f.value,hochwert:p.value})}),s.addEventListener(`click`,()=>{let e=o.hasAttribute(`hidden`);o.toggleAttribute(`hidden`,!e),s.setAttribute(`aria-expanded`,e?`true`:`false`)}),l.addEventListener(`click`,()=>{let e=c.hasAttribute(`hidden`);c.toggleAttribute(`hidden`,!e),l.setAttribute(`aria-expanded`,e?`true`:`false`)}),h.addEventListener(`click`,()=>t.centerOnStandort()),g.addEventListener(`change`,()=>{t.setDownloadKnopf(g.checked)}),y.addEventListener(`click`,()=>{y.disabled||t.startHessen()}),b.addEventListener(`click`,()=>re()),w.addEventListener(`click`,()=>{let e=k;k=!1,a.close(),e&&t.deleteCache()}),T.addEventListener(`click`,()=>{k=!1,a.open&&a.close()}),a.addEventListener(`cancel`,()=>{k=!1});let te=()=>{let e=t.snapshot();D.apply(e);let n=Ib(e);n!==ee&&(ee=n,D.refreshTiles()),ne(e)},ne=e=>{m.replaceChildren();for(let n of e.ziele){let e=document.createElement(`li`),r=document.createElement(`button`);r.type=`button`,r.className=`secondary ziel-open`,r.textContent=n.entfernung?`${n.koordinate} ${n.entfernung.text}`:n.koordinate,r.addEventListener(`click`,()=>t.centerOnZiel(n.koordinate));let i=document.createElement(`button`);i.type=`button`,i.className=`secondary`,i.textContent=`Löschen`,i.addEventListener(`click`,()=>t.deleteZiel(n.koordinate)),e.append(r,i),m.append(e)}e.notice?(x.hidden=!1,x.textContent=e.notice):(x.hidden=!0,x.textContent=``),g.checked=e.downloadKnopf,e.downloadKnopf?r.append(O):O.remove();let n=e.hessen.arrived{a.open||(k=!0,S.textContent=`Den ganzen Cache löschen?`,C.textContent=`Alle Kacheln werden gelöscht.`,w.textContent=`Löschen`,a.showModal())};t.subscribe(te),te()}function Ib(e){return e.kacheln.map(e=>`${e.id}:${e.appearance}`).join(` -`)}var Lb=``,Rb=``,zb=``,Bb=``;Vb();async function Vb(){let e=document.querySelector(`#app`);if(e instanceof HTMLElement){navigator.storage?.persist&&navigator.storage.persist(),u({immediate:!0});try{let[t,n]=await Promise.all([Hb(),Ub()]),r=await ks({uebersicht:t,cache:m(),marks:ne(),kacheln:w(),config:Xo,viewport:{widthPx:window.innerWidth,heightPx:window.innerHeight},...n===void 0?{}:{standort:n},online:navigator.onLine,appOpen:document.visibilityState===`visible`});Fb(e,r,t),S(),Wb(r)}catch(t){As(e,t)}}}async function Hb(){let e=await fetch(`/uebersicht.json`);if(!e.ok)throw Error(`Übersicht fehlt`);return await e.json()}function Ub(){return navigator.geolocation?new Promise(e=>{navigator.geolocation.getCurrentPosition(t=>{e(Jo(t.coords.longitude,t.coords.latitude))},t=>{t.code===t.TIMEOUT?e(void 0):e(`denied`)},{maximumAge:3e4,timeout:2e3})}):Promise.resolve(`denied`)}function Wb(e){let t=null,n=n=>{t?.(),t=null,n&&(t=Yo(t=>e.reportStandort(t)))};document.addEventListener(`visibilitychange`,()=>{document.visibilityState===`visible`?(e.setAppOpen(!0),n(!0)):(n(!1),e.setAppOpen(!1))}),window.addEventListener(`online`,()=>e.setOnline(!0)),window.addEventListener(`offline`,()=>e.setOnline(!1)),n(document.visibilityState===`visible`)} \ No newline at end of file diff --git a/public/index.html b/public/index.html index 343d0c8..af95019 100644 --- a/public/index.html +++ b/public/index.html @@ -5,8 +5,8 @@ Karte - - + +
diff --git a/public/sw.js b/public/sw.js index 23798ad..1eaa3a8 100644 --- a/public/sw.js +++ b/public/sw.js @@ -1 +1 @@ -if(!self.define){let e,i={};const n=(n,s)=>(n=new URL(n+".js",s).href,i[n]||new Promise(i=>{if("document"in self){const e=document.createElement("script");e.src=n,e.onload=i,document.head.appendChild(e)}else e=n,importScripts(n),i()}).then(()=>{let e=i[n];if(!e)throw new Error(`Module ${n} didn’t register its module`);return e}));self.define=(s,r)=>{const o=e||("document"in self?document.currentScript.src:"")||location.href;if(i[o])return;let t={};const c=e=>n(e,o),l={module:{uri:o},exports:t,require:c};i[o]=Promise.all(s.map(e=>l[e]||c(e))).then(e=>(r(...e),t))}}define(["./workbox-9c191d2f"],function(e){"use strict";self.skipWaiting(),e.clientsClaim(),e.precacheAndRoute([{url:"index.html",revision:"c7a61eb7e4c6389e27e974a5f79dc66e"},{url:"assets/workbox-window.prod.es5-Bd17z0YL.js",revision:null},{url:"assets/index-DjxrnCdH.js",revision:null},{url:"assets/index-BIwdVEBe.css",revision:null},{url:"icon-192.png",revision:"b9806dfbc0396e0ce5c1934273075639"},{url:"icon-512.png",revision:"847487db4af2d4a5e51e9b3e1fdcb649"},{url:"uebersicht.json",revision:"04c71c9ace32f1fbd7eaf16a9b5c8512"},{url:"manifest.webmanifest",revision:"2a757cea886716141758fc7b936d45c2"}],{}),e.cleanupOutdatedCaches(),e.registerRoute(new e.NavigationRoute(e.createHandlerBoundToURL("index.html")))}); +if(!self.define){let e,i={};const s=(s,n)=>(s=new URL(s+".js",n).href,i[s]||new Promise(i=>{if("document"in self){const e=document.createElement("script");e.src=s,e.onload=i,document.head.appendChild(e)}else e=s,importScripts(s),i()}).then(()=>{let e=i[s];if(!e)throw new Error(`Module ${s} didn’t register its module`);return e}));self.define=(n,r)=>{const o=e||("document"in self?document.currentScript.src:"")||location.href;if(i[o])return;let t={};const c=e=>s(e,o),l={module:{uri:o},exports:t,require:c};i[o]=Promise.all(n.map(e=>l[e]||c(e))).then(e=>(r(...e),t))}}define(["./workbox-9c191d2f"],function(e){"use strict";self.skipWaiting(),e.clientsClaim(),e.precacheAndRoute([{url:"index.html",revision:"70dde2d51ee41730c4cb9750452d07a3"},{url:"assets/workbox-window.prod.es5-Bd17z0YL.js",revision:null},{url:"assets/index-BfT1SDCl.css",revision:null},{url:"assets/index-BRvZR5R_.js",revision:null},{url:"icon-192.png",revision:"b9806dfbc0396e0ce5c1934273075639"},{url:"icon-512.png",revision:"847487db4af2d4a5e51e9b3e1fdcb649"},{url:"uebersicht.json",revision:"04c71c9ace32f1fbd7eaf16a9b5c8512"},{url:"manifest.webmanifest",revision:"2a757cea886716141758fc7b936d45c2"}],{}),e.cleanupOutdatedCaches(),e.registerRoute(new e.NavigationRoute(e.createHandlerBoundToURL("index.html")))}); diff --git a/src/style.css b/src/style.css index 180464f..9d987b6 100644 --- a/src/style.css +++ b/src/style.css @@ -136,6 +136,14 @@ button.icon-button[aria-expanded="true"] .strike { gap: 8px; } +.info p { + margin: 0; +} + +.info a { + color: #1d4e89; +} + h1 { margin: 0; font-size: 20px; diff --git a/src/ui/screen.ts b/src/ui/screen.ts index 01abc06..99431b3 100644 --- a/src/ui/screen.ts +++ b/src/ui/screen.ts @@ -19,6 +19,7 @@ export function mountScreen(
+
+ `; @@ -62,6 +68,8 @@ export function mountScreen( const foldToggle = panel.querySelector(".fold-toggle"); const einstellungenFold = panel.querySelector("#einstellungen"); const einstellungenToggle = panel.querySelector(".einstellungen-toggle"); + const infoFold = panel.querySelector("#info"); + const infoToggle = panel.querySelector(".info-toggle"); const form = panel.querySelector("form"); const gitter = panel.querySelector('input[name="gitter"]'); const rechtswert = panel.querySelector('input[name="rechtswert"]'); @@ -84,6 +92,8 @@ export function mountScreen( !foldToggle || !einstellungenFold || !einstellungenToggle || + !infoFold || + !infoToggle || !form || !gitter || !rechtswert || @@ -141,6 +151,12 @@ export function mountScreen( einstellungenToggle.setAttribute("aria-expanded", open ? "true" : "false"); }); + infoToggle.addEventListener("click", () => { + const open = infoFold.hasAttribute("hidden"); + infoFold.toggleAttribute("hidden", !open); + infoToggle.setAttribute("aria-expanded", open ? "true" : "false"); + }); + standortButton.addEventListener("click", () => session.centerOnStandort()); downloadKnopf.addEventListener("change", () => { session.setDownloadKnopf(downloadKnopf.checked); @@ -245,4 +261,6 @@ const gearIcon = ``; +const infoIcon = ``; + const strikeIcon = ``;