@htmlbricks/hb-map 0.61.51 → 0.61.53
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/main.iife.js +9 -9
- package/main.iife.js.map +1 -1
- package/manifest.json +1 -1
- package/package.json +1 -1
package/main.iife.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
(function(fa){"use strict";typeof window<"u"&&((window.__svelte??={}).v??=new Set).add("5");const qc=1,Jc=4,Qc=8,tu=16,eu=2,iu="[",nu="]",mn={},Et=Symbol(),ga=!1;var _a=Array.isArray,su=Array.prototype.indexOf,ru=Array.from,hs=Object.keys,Ii=Object.defineProperty,ti=Object.getOwnPropertyDescriptor,ou=Object.prototype,au=Array.prototype,lu=Object.getPrototypeOf,ma=Object.isExtensible;function pa(n){for(var t=0;t<n.length;t++)n[t]()}function hu(){var n,t,e=new Promise((i,s)=>{n=i,t=s});return{promise:e,resolve:n,reject:t}}const Ft=2,pr=4,ya=8,pn=16,De=32,Fe=64,xa=128,Yt=256,cs=512,wt=1024,ee=2048,ke=4096,Si=8192,bi=16384,yr=32768,cu=65536,Ea=1<<17,uu=1<<18,yn=1<<19,du=1<<20,xr=1<<21,wa=1<<22,us=1<<23,ds=Symbol("$state"),va=Symbol("legacy props"),Ca=new class extends Error{name="StaleReactionError";message="The reaction that called `getAbortSignal()` was re-run or destroyed"},fu=3,Ra=8;function gu(n){throw new Error("https://svelte.dev/e/lifecycle_outside_component")}function _u(n){throw new Error("https://svelte.dev/e/effect_in_teardown")}function mu(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function pu(n){throw new Error("https://svelte.dev/e/effect_orphan")}function yu(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function xu(){throw new Error("https://svelte.dev/e/hydration_failed")}function Eu(n){throw new Error("https://svelte.dev/e/props_invalid_value")}function wu(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function vu(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function Cu(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}function Er(n){console.warn("https://svelte.dev/e/hydration_mismatch")}let $t=!1;function fs(n){$t=n}let ct;function Li(n){if(n===null)throw Er(),mn;return ct=n}function Ta(){return Li(ri(ct))}function Ru(n){if($t){if(ri(ct)!==null)throw Er(),mn;ct=n}}function Tu(n=1){if($t){for(var t=n,e=ct;t--;)e=ri(e);ct=e}}function Ia(n){return n===this.v}function Iu(n,t){return n!=n?t==t:n!==t||n!==null&&typeof n=="object"||typeof n=="function"}function Sa(n){return!Iu(n,this.v)}let Su=!1,ie=null;function ba(n){ie=n}function La(n,t=!1,e){ie={p:ie,c:null,e:null,s:n,x:null,l:null}}function Aa(n){var t=ie,e=t.e;if(e!==null){t.e=null;for(var i of e)Ua(i)}return n!==void 0&&(t.x=n),ie=t.p,n??{}}function Ma(){return!0}const bu=new WeakMap;function Lu(n){var t=q;if(t===null)return j.f|=us,n;if((t.f&yr)===0){if((t.f&xa)===0)throw!t.parent&&n instanceof Error&&Oa(n),n;t.b.error(n)}else Pa(n,t)}function Pa(n,t){for(;t!==null;){if((t.f&xa)!==0)try{t.b.error(n);return}catch(e){n=e}t=t.parent}throw n instanceof Error&&Oa(n),n}function Oa(n){const t=bu.get(n);t&&(Ii(n,"message",{value:t.message}),Ii(n,"stack",{value:t.stack}))}let xn=[],wr=[];function Da(){var n=xn;xn=[],pa(n)}function Au(){var n=wr;wr=[],pa(n)}function Mu(n){xn.length===0&&queueMicrotask(Da),xn.push(n)}function Pu(){xn.length>0&&Da(),wr.length>0&&Au()}function vr(n){var t=Ft|ee,e=j!==null&&(j.f&Ft)!==0?j:null;return q===null||e!==null&&(e.f&Yt)!==0?t|=Yt:q.f|=yn,{ctx:ie,deps:null,effects:null,equals:Ia,f:t,fn:n,reactions:null,rv:0,v:Et,wv:0,parent:e??q,ac:null}}function Ou(n){const t=vr(n);return tl(t),t}function Du(n){const t=vr(n);return t.equals=Sa,t}function Fa(n){var t=n.effects;if(t!==null){n.effects=null;for(var e=0;e<t.length;e+=1)Ge(t[e])}}function Fu(n){for(var t=n.parent;t!==null;){if((t.f&Ft)===0)return t;t=t.parent}return null}function Cr(n){var t,e=q;Pi(Fu(n));try{Fa(n),t=rl(n)}finally{Pi(e)}return t}function ka(n){var t=Cr(n);if(n.equals(t)||(n.v=t,n.wv=nl()),!ai){var e=(We||(n.f&Yt)!==0)&&n.deps!==null?ke:wt;Gt(n,e)}}const Rr=new Set;let kt=null,Na=new Set,gs=[];function Ga(){const n=gs.shift();gs.length>0&&queueMicrotask(Ga),n()}let ei=[],_s=null,Tr=!1,ms=!1;class ii{current=new Map;#e=new Map;#t=new Set;#i=0;#h=null;#c=!1;#s=[];#o=[];#r=[];#n=[];#a=[];#u=[];#d=[];skipped_effects=new Set;process(t){ei=[];for(const s of t)this.#g(s);if(this.#s.length===0&&this.#i===0){this.#f();var e=this.#r,i=this.#n;this.#r=[],this.#n=[],this.#a=[],kt=null,Wa(e),Wa(i),kt===null?kt=this:Rr.delete(this),this.#h?.resolve()}else this.#l(this.#r),this.#l(this.#n),this.#l(this.#a);for(const s of this.#s)Oi(s);for(const s of this.#o)Oi(s);this.#s=[],this.#o=[]}#g(t){t.f^=wt;for(var e=t.first;e!==null;){var i=e.f,s=(i&(De|Fe))!==0,r=s&&(i&wt)!==0,o=r||(i&Si)!==0||this.skipped_effects.has(e);if(!o&&e.fn!==null){if(s)e.f^=wt;else if((i&pr)!==0)this.#n.push(e);else if((i&wt)===0)if((i&wa)!==0){var a=e.b?.is_pending()?this.#o:this.#s;a.push(e)}else ps(e)&&((e.f&pn)!==0&&this.#a.push(e),Oi(e));var l=e.first;if(l!==null){e=l;continue}}var h=e.parent;for(e=e.next;e===null&&h!==null;)e=h.next,h=h.parent}}#l(t){for(const e of t)((e.f&ee)!==0?this.#u:this.#d).push(e),Gt(e,wt);t.length=0}capture(t,e){this.#e.has(t)||this.#e.set(t,e),this.current.set(t,t.v)}activate(){kt=this}deactivate(){kt=null;for(const t of Na)if(Na.delete(t),t(),kt!==null)break}neuter(){this.#c=!0}flush(){ei.length>0?za():this.#f(),kt===this&&(this.#i===0&&Rr.delete(this),this.deactivate())}#f(){if(!this.#c)for(const t of this.#t)t();this.#t.clear()}increment(){this.#i+=1}decrement(){if(this.#i-=1,this.#i===0){for(const t of this.#u)Gt(t,ee),En(t);for(const t of this.#d)Gt(t,ke),En(t);this.#r=[],this.#n=[],this.flush()}else this.deactivate()}add_callback(t){this.#t.add(t)}settled(){return(this.#h??=hu()).promise}static ensure(){if(kt===null){const t=kt=new ii;Rr.add(kt),ms||ii.enqueue(()=>{kt===t&&t.flush()})}return kt}static enqueue(t){gs.length===0&&queueMicrotask(Ga),gs.unshift(t)}}function ni(n){var t=ms;ms=!0;try{for(var e;;){if(Pu(),ei.length===0&&(kt?.flush(),ei.length===0))return _s=null,e;za()}}finally{ms=t}}function za(){var n=Mi;Tr=!0;try{var t=0;for(Ja(!0);ei.length>0;){var e=ii.ensure();if(t++>1e3){var i,s;ku()}e.process(ei),Ne.clear()}}finally{Tr=!1,Ja(n),_s=null}}function ku(){try{yu()}catch(n){Pa(n,_s)}}let si=null;function Wa(n){var t=n.length;if(t!==0){for(var e=0;e<t;){var i=n[e++];if((i.f&(bi|Si))===0&&ps(i)&&(si=[],Oi(i),i.deps===null&&i.first===null&&i.nodes_start===null&&(i.teardown===null&&i.ac===null?Ha(i):i.fn=null),si?.length>0)){Ne.clear();for(const s of si)Oi(s);si=[]}}si=null}}function En(n){for(var t=_s=n;t.parent!==null;){t=t.parent;var e=t.f;if(Tr&&t===q&&(e&pn)!==0)return;if((e&(Fe|De))!==0){if((e&wt)===0)return;t.f^=wt}}ei.push(t)}const Ne=new Map;function Xa(n,t){var e={f:0,v:n,reactions:null,equals:Ia,rv:0,wv:0};return e}function Kt(n,t){const e=Xa(n);return tl(e),e}function Nu(n,t=!1,e=!0){const i=Xa(n);return t||(i.equals=Sa),i}function St(n,t,e=!1){j!==null&&(!ce||(j.f&Ea)!==0)&&Ma()&&(j.f&(Ft|pn|wa|Ea))!==0&&!ye?.includes(n)&&Cu();let i=e?Ai(t):t;return Gu(n,i)}function Gu(n,t){if(!n.equals(t)){var e=n.v;ai?Ne.set(n,t):Ne.set(n,e),n.v=t;var i=ii.ensure();i.capture(n,e),(n.f&Ft)!==0&&((n.f&ee)!==0&&Cr(n),Gt(n,(n.f&Yt)===0?wt:ke)),n.wv=nl(),Ya(n,ee),q!==null&&(q.f&wt)!==0&&(q.f&(De|Fe))===0&&(Bt===null?ed([n]):Bt.push(n))}return t}function Ir(n){St(n,n.v+1)}function Ya(n,t){var e=n.reactions;if(e!==null)for(var i=e.length,s=0;s<i;s++){var r=e[s],o=r.f,a=(o&ee)===0;a&&Gt(r,t),(o&Ft)!==0?Ya(r,ke):a&&((o&pn)!==0&&si!==null&&si.push(r),En(r))}}function Ai(n){if(typeof n!="object"||n===null||ds in n)return n;const t=lu(n);if(t!==ou&&t!==au)return n;var e=new Map,i=_a(n),s=Kt(0),r=li,o=a=>{if(li===r)return a();var l=j,h=li;ze(null),il(r);var c=a();return ze(l),il(h),c};return i&&e.set("length",Kt(n.length)),new Proxy(n,{defineProperty(a,l,h){(!("value"in h)||h.configurable===!1||h.enumerable===!1||h.writable===!1)&&wu();var c=e.get(l);return c===void 0?c=o(()=>{var u=Kt(h.value);return e.set(l,u),u}):St(c,h.value,!0),!0},deleteProperty(a,l){var h=e.get(l);if(h===void 0){if(l in a){const c=o(()=>Kt(Et));e.set(l,c),Ir(s)}}else St(h,Et),Ir(s);return!0},get(a,l,h){if(l===ds)return n;var c=e.get(l),u=l in a;if(c===void 0&&(!u||ti(a,l)?.writable)&&(c=o(()=>{var f=Ai(u?a[l]:Et),g=Kt(f);return g}),e.set(l,c)),c!==void 0){var d=it(c);return d===Et?void 0:d}return Reflect.get(a,l,h)},getOwnPropertyDescriptor(a,l){var h=Reflect.getOwnPropertyDescriptor(a,l);if(h&&"value"in h){var c=e.get(l);c&&(h.value=it(c))}else if(h===void 0){var u=e.get(l),d=u?.v;if(u!==void 0&&d!==Et)return{enumerable:!0,configurable:!0,value:d,writable:!0}}return h},has(a,l){if(l===ds)return!0;var h=e.get(l),c=h!==void 0&&h.v!==Et||Reflect.has(a,l);if(h!==void 0||q!==null&&(!c||ti(a,l)?.writable)){h===void 0&&(h=o(()=>{var d=c?Ai(a[l]):Et,f=Kt(d);return f}),e.set(l,h));var u=it(h);if(u===Et)return!1}return c},set(a,l,h,c){var u=e.get(l),d=l in a;if(i&&l==="length")for(var f=h;f<u.v;f+=1){var g=e.get(f+"");g!==void 0?St(g,Et):f in a&&(g=o(()=>Kt(Et)),e.set(f+"",g))}if(u===void 0)(!d||ti(a,l)?.writable)&&(u=o(()=>Kt(void 0)),St(u,Ai(h)),e.set(l,u));else{d=u.v!==Et;var m=o(()=>Ai(h));St(u,m)}var _=Reflect.getOwnPropertyDescriptor(a,l);if(_?.set&&_.set.call(c,h),!d){if(i&&typeof l=="string"){var p=e.get("length"),y=Number(l);Number.isInteger(y)&&y>=p.v&&St(p,y+1)}Ir(s)}return!0},ownKeys(a){it(s);var l=Reflect.ownKeys(a).filter(u=>{var d=e.get(u);return d===void 0||d.v!==Et});for(var[h,c]of e)c.v!==Et&&!(h in a)&&l.push(h);return l},setPrototypeOf(){vu()}})}var Sr,$a,Ka,Ba;function br(){if(Sr===void 0){Sr=window,$a=/Firefox/.test(navigator.userAgent);var n=Element.prototype,t=Node.prototype,e=Text.prototype;Ka=ti(t,"firstChild").get,Ba=ti(t,"nextSibling").get,ma(n)&&(n.__click=void 0,n.__className=void 0,n.__attributes=null,n.__style=void 0,n.__e=void 0),ma(e)&&(e.__t=void 0)}}function Lr(n=""){return document.createTextNode(n)}function wn(n){return Ka.call(n)}function ri(n){return Ba.call(n)}function zu(n,t){if(!$t)return wn(n);var e=wn(ct);return e===null&&(e=ct.appendChild(Lr())),Li(e),e}function Wu(n,t){if(!$t){var e=wn(n);return e instanceof Comment&&e.data===""?ri(e):e}return ct}function Xu(n,t=1,e=!1){let i=$t?ct:n;for(var s;t--;)s=i,i=ri(i);if(!$t)return i;if(e&&i?.nodeType!==fu){var r=Lr();return i===null?s?.after(r):i.before(r),Li(r),r}return Li(i),i}function Yu(n){n.textContent=""}function Ar(n){var t=j,e=q;ze(null),Pi(null);try{return n()}finally{ze(t),Pi(e)}}function $u(n){q===null&&j===null&&pu(),j!==null&&(j.f&Yt)!==0&&q===null&&mu(),ai&&_u()}function Ku(n,t){var e=t.last;e===null?t.last=t.first=n:(e.next=n,n.prev=e,t.last=n)}function oi(n,t,e,i=!0){var s=q;s!==null&&(s.f&Si)!==0&&(n|=Si);var r={ctx:ie,deps:null,nodes_start:null,nodes_end:null,f:n|ee,first:null,fn:t,last:null,next:null,parent:s,b:s&&s.b,prev:null,teardown:null,transitions:null,wv:0,ac:null};if(e)try{Oi(r),r.f|=yr}catch(l){throw Ge(r),l}else t!==null&&En(r);if(i){var o=r;if(e&&o.deps===null&&o.teardown===null&&o.nodes_start===null&&o.first===o.last&&(o.f&yn)===0&&(o=o.first),o!==null&&(o.parent=s,s!==null&&Ku(o,s),j!==null&&(j.f&Ft)!==0&&(n&Fe)===0)){var a=j;(a.effects??=[]).push(o)}}return r}function Bu(n){const t=oi(ya,null,!1);return Gt(t,wt),t.teardown=n,t}function Za(n){$u();var t=q.f,e=!j&&(t&De)!==0&&(t&yr)===0;if(e){var i=ie;(i.e??=[]).push(n)}else return Ua(n)}function Ua(n){return oi(pr|du,n,!1)}function Zu(n){ii.ensure();const t=oi(Fe|yn,n,!0);return()=>{Ge(t)}}function Uu(n){ii.ensure();const t=oi(Fe|yn,n,!0);return(e={})=>new Promise(i=>{e.outro?Qu(t,()=>{Ge(t),i(void 0)}):(Ge(t),i(void 0))})}function Vu(n){return oi(pr,n,!1)}function ju(n,t=0){return oi(ya|t,n,!0)}function Hu(n,t=!0){return oi(De|yn,n,!0,t)}function Va(n){var t=n.teardown;if(t!==null){const e=ai,i=j;Qa(!0),ze(null);try{t.call(null)}finally{Qa(e),ze(i)}}}function ja(n,t=!1){var e=n.first;for(n.first=n.last=null;e!==null;){const s=e.ac;s!==null&&Ar(()=>{s.abort(Ca)});var i=e.next;(e.f&Fe)!==0?e.parent=null:Ge(e,t),e=i}}function qu(n){for(var t=n.first;t!==null;){var e=t.next;(t.f&De)===0&&Ge(t),t=e}}function Ge(n,t=!0){var e=!1;(t||(n.f&uu)!==0)&&n.nodes_start!==null&&n.nodes_end!==null&&(Ju(n.nodes_start,n.nodes_end),e=!0),ja(n,t&&!e),ys(n,0),Gt(n,bi);var i=n.transitions;if(i!==null)for(const r of i)r.stop();Va(n);var s=n.parent;s!==null&&s.first!==null&&Ha(n),n.next=n.prev=n.teardown=n.ctx=n.deps=n.fn=n.nodes_start=n.nodes_end=n.ac=null}function Ju(n,t){for(;n!==null;){var e=n===t?null:ri(n);n.remove(),n=e}}function Ha(n){var t=n.parent,e=n.prev,i=n.next;e!==null&&(e.next=i),i!==null&&(i.prev=e),t!==null&&(t.first===n&&(t.first=i),t.last===n&&(t.last=e))}function Qu(n,t){var e=[];qa(n,e,!0),td(e,()=>{Ge(n),t&&t()})}function td(n,t){var e=n.length;if(e>0){var i=()=>--e||t();for(var s of n)s.out(i)}else t()}function qa(n,t,e){if((n.f&Si)===0){if(n.f^=Si,n.transitions!==null)for(const o of n.transitions)(o.is_global||e)&&t.push(o);for(var i=n.first;i!==null;){var s=i.next,r=(i.f&cu)!==0||(i.f&De)!==0;qa(i,t,r?e:!1),i=s}}}let Mi=!1;function Ja(n){Mi=n}let ai=!1;function Qa(n){ai=n}let j=null,ce=!1;function ze(n){j=n}let q=null;function Pi(n){q=n}let ye=null;function tl(n){j!==null&&(ye===null?ye=[n]:ye.push(n))}let vt=null,Nt=0,Bt=null;function ed(n){Bt=n}let el=1,vn=0,li=vn;function il(n){li=n}let We=!1;function nl(){return++el}function ps(n){var t=n.f;if((t&ee)!==0)return!0;if((t&ke)!==0){var e=n.deps,i=(t&Yt)!==0;if(e!==null){var s,r,o=(t&cs)!==0,a=i&&q!==null&&!We,l=e.length;if((o||a)&&(q===null||(q.f&bi)===0)){var h=n,c=h.parent;for(s=0;s<l;s++)r=e[s],(o||!r?.reactions?.includes(h))&&(r.reactions??=[]).push(h);o&&(h.f^=cs),a&&c!==null&&(c.f&Yt)===0&&(h.f^=Yt)}for(s=0;s<l;s++)if(r=e[s],ps(r)&&ka(r),r.wv>n.wv)return!0}(!i||q!==null&&!We)&&Gt(n,wt)}return!1}function sl(n,t,e=!0){var i=n.reactions;if(i!==null&&!ye?.includes(n))for(var s=0;s<i.length;s++){var r=i[s];(r.f&Ft)!==0?sl(r,t,!1):t===r&&(e?Gt(r,ee):(r.f&wt)!==0&&Gt(r,ke),En(r))}}function rl(n){var t=vt,e=Nt,i=Bt,s=j,r=We,o=ye,a=ie,l=ce,h=li,c=n.f;vt=null,Nt=0,Bt=null,We=(c&Yt)!==0&&(ce||!Mi||j===null),j=(c&(De|Fe))===0?n:null,ye=null,ba(n.ctx),ce=!1,li=++vn,n.ac!==null&&(Ar(()=>{n.ac.abort(Ca)}),n.ac=null);try{n.f|=xr;var u=n.fn,d=u(),f=n.deps;if(vt!==null){var g;if(ys(n,Nt),f!==null&&Nt>0)for(f.length=Nt+vt.length,g=0;g<vt.length;g++)f[Nt+g]=vt[g];else n.deps=f=vt;if(!We||(c&Ft)!==0&&n.reactions!==null)for(g=Nt;g<f.length;g++)(f[g].reactions??=[]).push(n)}else f!==null&&Nt<f.length&&(ys(n,Nt),f.length=Nt);if(Ma()&&Bt!==null&&!ce&&f!==null&&(n.f&(Ft|ke|ee))===0)for(g=0;g<Bt.length;g++)sl(Bt[g],n);return s!==null&&s!==n&&(vn++,Bt!==null&&(i===null?i=Bt:i.push(...Bt))),(n.f&us)!==0&&(n.f^=us),d}catch(m){return Lu(m)}finally{n.f^=xr,vt=t,Nt=e,Bt=i,j=s,We=r,ye=o,ba(a),ce=l,li=h}}function id(n,t){let e=t.reactions;if(e!==null){var i=su.call(e,n);if(i!==-1){var s=e.length-1;s===0?e=t.reactions=null:(e[i]=e[s],e.pop())}}e===null&&(t.f&Ft)!==0&&(vt===null||!vt.includes(t))&&(Gt(t,ke),(t.f&(Yt|cs))===0&&(t.f^=cs),Fa(t),ys(t,0))}function ys(n,t){var e=n.deps;if(e!==null)for(var i=t;i<e.length;i++)id(n,e[i])}function Oi(n){var t=n.f;if((t&bi)===0){Gt(n,wt);var e=q,i=Mi;q=n,Mi=!0;try{(t&pn)!==0?qu(n):ja(n),Va(n);var s=rl(n);n.teardown=typeof s=="function"?s:null,n.wv=el;var r;ga&&Su&&(n.f&ee)!==0&&n.deps}finally{Mi=i,q=e}}}function it(n){var t=n.f,e=(t&Ft)!==0;if(j!==null&&!ce){var i=q!==null&&(q.f&bi)!==0;if(!i&&!ye?.includes(n)){var s=j.deps;if((j.f&xr)!==0)n.rv<vn&&(n.rv=vn,vt===null&&s!==null&&s[Nt]===n?Nt++:vt===null?vt=[n]:(!We||!vt.includes(n))&&vt.push(n));else{(j.deps??=[]).push(n);var r=n.reactions;r===null?n.reactions=[j]:r.includes(j)||r.push(j)}}}else if(e&&n.deps===null&&n.effects===null){var o=n,a=o.parent;a!==null&&(a.f&Yt)===0&&(o.f^=Yt)}if(ai){if(Ne.has(n))return Ne.get(n);if(e){o=n;var l=o.v;return((o.f&wt)===0&&o.reactions!==null||ol(o))&&(l=Cr(o)),Ne.set(o,l),l}}else e&&(o=n,ps(o)&&ka(o));if((n.f&us)!==0)throw n.v;return n.v}function ol(n){if(n.v===Et)return!0;if(n.deps===null)return!1;for(const t of n.deps)if(Ne.has(t)||(t.f&Ft)!==0&&ol(t))return!0;return!1}function al(n){var t=ce;try{return ce=!0,n()}finally{ce=t}}const nd=-7169;function Gt(n,t){n.f=n.f&nd|t}const ll=new Set,Mr=new Set;function sd(n,t,e,i={}){function s(r){if(i.capture||Cn.call(t,r),!r.cancelBubble)return Ar(()=>e?.call(this,r))}return n.startsWith("pointer")||n.startsWith("touch")||n==="wheel"?Mu(()=>{t.addEventListener(n,s,i)}):t.addEventListener(n,s,i),s}function rd(n,t,e,i,s){var r={capture:i,passive:s},o=sd(n,t,e,r);(t===document.body||t===window||t===document||t instanceof HTMLMediaElement)&&Bu(()=>{t.removeEventListener(n,o,r)})}function od(n){for(var t=0;t<n.length;t++)ll.add(n[t]);for(var e of Mr)e(n)}let hl=null;function Cn(n){var t=this,e=t.ownerDocument,i=n.type,s=n.composedPath?.()||[],r=s[0]||n.target;hl=n;var o=0,a=hl===n&&n.__root;if(a){var l=s.indexOf(a);if(l!==-1&&(t===document||t===window)){n.__root=t;return}var h=s.indexOf(t);if(h===-1)return;l<=h&&(o=l)}if(r=s[o]||n.target,r!==t){Ii(n,"currentTarget",{configurable:!0,get(){return r||e}});var c=j,u=q;ze(null),Pi(null);try{for(var d,f=[];r!==null;){var g=r.assignedSlot||r.parentNode||r.host||null;try{var m=r["__"+i];if(m!=null&&(!r.disabled||n.target===r))if(_a(m)){var[_,...p]=m;_.apply(r,[n,...p])}else m.call(r,n)}catch(y){d?f.push(y):d=y}if(n.cancelBubble||g===t||g===null)break;r=g}if(d){for(let y of f)queueMicrotask(()=>{throw y});throw d}}finally{n.__root=t,delete n.currentTarget,ze(c),Pi(u)}}}function ad(n){var t=document.createElement("template");return t.innerHTML=n.replaceAll("<!>","<!---->"),t.content}function Pr(n,t){var e=q;e.nodes_start===null&&(e.nodes_start=n,e.nodes_end=t)}function ld(n,t){var e=(t&eu)!==0,i,s=!n.startsWith("<!>");return()=>{if($t)return Pr(ct,null),ct;i===void 0&&(i=ad(s?n:"<!>"+n));var r=e||$a?document.importNode(i,!0):i.cloneNode(!0);{var o=wn(r),a=r.lastChild;Pr(o,a)}return r}}function cl(n,t){if($t){q.nodes_end=ct,Ta();return}n!==null&&n.before(t)}const hd=["touchstart","touchmove"];function cd(n){return hd.includes(n)}function ul(n,t){return dl(n,t)}function ud(n,t){br(),t.intro=t.intro??!1;const e=t.target,i=$t,s=ct;try{for(var r=wn(e);r&&(r.nodeType!==Ra||r.data!==iu);)r=ri(r);if(!r)throw mn;fs(!0),Li(r),Ta();const o=dl(n,{...t,anchor:r});if(ct===null||ct.nodeType!==Ra||ct.data!==nu)throw Er(),mn;return fs(!1),o}catch(o){if(o instanceof Error&&o.message.split(`
|
|
2
|
-
`).some(a=>a.startsWith("https://svelte.dev/e/")))throw o;return o!==mn&&console.warn("Failed to hydrate: ",o),t.recover===!1&&xu(),br(),Yu(e),fs(!1),ul(n,t)}finally{fs(i),Li(s)}}const Di=new Map;function dl(n,{target:t,anchor:e,props:i={},events:s,context:r,intro:o=!0}){br();var a=new Set,l=u=>{for(var d=0;d<u.length;d++){var f=u[d];if(!a.has(f)){a.add(f);var g=cd(f);t.addEventListener(f,Cn,{passive:g});var m=Di.get(f);m===void 0?(document.addEventListener(f,Cn,{passive:g}),Di.set(f,1)):Di.set(f,m+1)}}};l(ru(ll)),Mr.add(l);var h=void 0,c=Uu(()=>{var u=e??t.appendChild(Lr());return Hu(()=>{if(r){La({});var d=ie;d.c=r}s&&(i.$$events=s),$t&&Pr(u,null),h=n(u,i)||{},$t&&(q.nodes_end=ct),r&&Aa()}),()=>{for(var d of a){t.removeEventListener(d,Cn);var f=Di.get(d);--f===0?(document.removeEventListener(d,Cn),Di.delete(d)):Di.set(d,f)}Mr.delete(l),u!==e&&u.parentNode?.removeChild(u)}});return Or.set(h,c),h}let Or=new WeakMap;function dd(n,t){const e=Or.get(n);return e?(Or.delete(n),e(t)):Promise.resolve()}function fd(n){ie===null&&gu(),Za(()=>{const t=al(n);if(typeof t=="function")return t})}function gd(n,t){Vu(()=>{var e=n.getRootNode(),i=e.host?e:e.head??e.ownerDocument.head;if(!i.querySelector("#"+t.hash)){const s=document.createElement("style");s.id=t.hash,s.textContent=t.code,i.appendChild(s)}})}let xs=!1;function _d(n){var t=xs;try{return xs=!1,[n(),xs]}finally{xs=t}}function Fi(n,t,e,i){var s=(e&Qc)!==0,r=(e&tu)!==0,o=i,a=!0,l=()=>(a&&(a=!1,o=r?al(i):i),o),h;if(s){var c=ds in n||va in n;h=ti(n,t)?.set??(c&&t in n?y=>n[t]=y:void 0)}var u,d=!1;s?[u,d]=_d(()=>n[t]):u=n[t],u===void 0&&i!==void 0&&(u=l(),h&&(Eu(),h(u)));var f;if(f=()=>{var y=n[t];return y===void 0?l():(a=!0,y)},(e&Jc)===0)return f;if(h){var g=n.$$legacy;return(function(y,v){return arguments.length>0?((!v||g||d)&&h(v?f():y),y):f()})}var m=!1,_=((e&qc)!==0?vr:Du)(()=>(m=!1,f()));s&&it(_);var p=q;return(function(y,v){if(arguments.length>0){const x=v?it(_):s?Ai(y):y;return St(_,x),m=!0,o!==void 0&&(o=x),y}return ai&&m||(p.f&bi)!==0?_.v:it(_)})}function md(n){return new pd(n)}class pd{#e;#t;constructor(t){var e=new Map,i=(r,o)=>{var a=Nu(o,!1,!1);return e.set(r,a),a};const s=new Proxy({...t.props||{},$$events:{}},{get(r,o){return it(e.get(o)??i(o,Reflect.get(r,o)))},has(r,o){return o===va?!0:(it(e.get(o)??i(o,Reflect.get(r,o))),Reflect.has(r,o))},set(r,o,a){return St(e.get(o)??i(o,a),a),Reflect.set(r,o,a)}});this.#t=(t.hydrate?ud:ul)(t.component,{target:t.target,anchor:t.anchor,props:s,context:t.context,intro:t.intro??!1,recover:t.recover}),(!t?.props?.$$host||t.sync===!1)&&ni(),this.#e=s.$$events;for(const r of Object.keys(this.#t))r==="$set"||r==="$destroy"||r==="$on"||Ii(this,r,{get(){return this.#t[r]},set(o){this.#t[r]=o},enumerable:!0});this.#t.$set=r=>{Object.assign(s,r)},this.#t.$destroy=()=>{dd(this.#t)}}$set(t){this.#t.$set(t)}$on(t,e){this.#e[t]=this.#e[t]||[];const i=(...s)=>e.call(this,...s);return this.#e[t].push(i),()=>{this.#e[t]=this.#e[t].filter(s=>s!==i)}}$destroy(){this.#t.$destroy()}}let fl;typeof HTMLElement=="function"&&(fl=class extends HTMLElement{$$ctor;$$s;$$c;$$cn=!1;$$d={};$$r=!1;$$p_d={};$$l={};$$l_u=new Map;$$me;constructor(n,t,e){super(),this.$$ctor=n,this.$$s=t,e&&this.attachShadow({mode:"open"})}addEventListener(n,t,e){if(this.$$l[n]=this.$$l[n]||[],this.$$l[n].push(t),this.$$c){const i=this.$$c.$on(n,t);this.$$l_u.set(t,i)}super.addEventListener(n,t,e)}removeEventListener(n,t,e){if(super.removeEventListener(n,t,e),this.$$c){const i=this.$$l_u.get(t);i&&(i(),this.$$l_u.delete(t))}}async connectedCallback(){if(this.$$cn=!0,!this.$$c){let n=function(i){return s=>{const r=document.createElement("slot");i!=="default"&&(r.name=i),cl(s,r)}};if(await Promise.resolve(),!this.$$cn||this.$$c)return;const t={},e=yd(this);for(const i of this.$$s)i in e&&(i==="default"&&!this.$$d.children?(this.$$d.children=n(i),t.default=!0):t[i]=n(i));for(const i of this.attributes){const s=this.$$g_p(i.name);s in this.$$d||(this.$$d[s]=Es(s,i.value,this.$$p_d,"toProp"))}for(const i in this.$$p_d)!(i in this.$$d)&&this[i]!==void 0&&(this.$$d[i]=this[i],delete this[i]);this.$$c=md({component:this.$$ctor,target:this.shadowRoot||this,props:{...this.$$d,$$slots:t,$$host:this}}),this.$$me=Zu(()=>{ju(()=>{this.$$r=!0;for(const i of hs(this.$$c)){if(!this.$$p_d[i]?.reflect)continue;this.$$d[i]=this.$$c[i];const s=Es(i,this.$$d[i],this.$$p_d,"toAttribute");s==null?this.removeAttribute(this.$$p_d[i].attribute||i):this.setAttribute(this.$$p_d[i].attribute||i,s)}this.$$r=!1})});for(const i in this.$$l)for(const s of this.$$l[i]){const r=this.$$c.$on(i,s);this.$$l_u.set(s,r)}this.$$l={}}}attributeChangedCallback(n,t,e){this.$$r||(n=this.$$g_p(n),this.$$d[n]=Es(n,e,this.$$p_d,"toProp"),this.$$c?.$set({[n]:this.$$d[n]}))}disconnectedCallback(){this.$$cn=!1,Promise.resolve().then(()=>{!this.$$cn&&this.$$c&&(this.$$c.$destroy(),this.$$me(),this.$$c=void 0)})}$$g_p(n){return hs(this.$$p_d).find(t=>this.$$p_d[t].attribute===n||!this.$$p_d[t].attribute&&t.toLowerCase()===n)||n}});function Es(n,t,e,i){const s=e[n]?.type;if(t=s==="Boolean"&&typeof t!="boolean"?t!=null:t,!i||!e[n])return t;if(i==="toAttribute")switch(s){case"Object":case"Array":return t==null?null:JSON.stringify(t);case"Boolean":return t?"":null;case"Number":return t??null;default:return t}else switch(s){case"Object":case"Array":return t&&JSON.parse(t);case"Boolean":return t;case"Number":return t!=null?+t:t;default:return t}}function yd(n){const t={};return n.childNodes.forEach(e=>{t[e.slot||"default"]=!0}),t}function xd(n,t,e,i,s,r){let o=class extends fl{constructor(){super(n,e,s),this.$$p_d=t}static get observedAttributes(){return hs(t).map(a=>(t[a].attribute||a).toLowerCase())}};return hs(t).forEach(a=>{Ii(o.prototype,a,{get(){return this.$$c&&a in this.$$c?this.$$c[a]:this.$$d[a]},set(l){l=Es(a,l,t),this.$$d[a]=l;var h=this.$$c;if(h){var c=ti(h,a)?.get;c?h[a]=l:h.$set({[a]:l})}}})}),i.forEach(a=>{Ii(o.prototype,a,{get(){return this.$$c?.[a]}})}),n.element=o,o}const bt={ADD:"add",REMOVE:"remove"},ki={PROPERTYCHANGE:"propertychange"},z={CHANGE:"change",ERROR:"error",CONTEXTMENU:"contextmenu",CLICK:"click",DBLCLICK:"dblclick",KEYDOWN:"keydown",KEYPRESS:"keypress",LOAD:"load",TOUCHMOVE:"touchmove",WHEEL:"wheel"};class ws{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}}function Ed(n,t,e){let i,s;e=e||xe;let r=0,o=n.length,a=!1;for(;r<o;)i=r+(o-r>>1),s=+e(n[i],t),s<0?r=i+1:(o=i,a=!s);return a?r:~r}function xe(n,t){return n>t?1:n<t?-1:0}function wd(n,t){return n<t?1:n>t?-1:0}function Dr(n,t,e){if(n[0]<=t)return 0;const i=n.length;if(t<=n[i-1])return i-1;if(typeof e=="function"){for(let s=1;s<i;++s){const r=n[s];if(r===t)return s;if(r<t)return e(t,n[s-1],r)>0?s-1:s}return i-1}if(e>0){for(let s=1;s<i;++s)if(n[s]<t)return s-1;return i-1}if(e<0){for(let s=1;s<i;++s)if(n[s]<=t)return s;return i-1}for(let s=1;s<i;++s){if(n[s]==t)return s;if(n[s]<t)return n[s-1]-t<t-n[s]?s-1:s}return i-1}function vd(n,t,e){for(;t<e;){const i=n[t];n[t]=n[e],n[e]=i,++t,--e}}function Fr(n,t){const e=Array.isArray(t)?t:[t],i=e.length;for(let s=0;s<i;s++)n[n.length]=e[s]}function Xe(n,t){const e=n.length;if(e!==t.length)return!1;for(let i=0;i<e;i++)if(n[i]!==t[i])return!1;return!0}function Cd(n,t,e){const i=t||xe;return n.every(function(s,r){if(r===0)return!0;const o=i(n[r-1],s);return!(o>0||o===0)})}function Rn(){return!0}function vs(){return!1}function Tn(){}function gl(n){let t,e,i;return function(){const s=Array.prototype.slice.call(arguments);return(!e||this!==i||!Xe(s,e))&&(i=this,e=s,t=n.apply(this,arguments)),t}}function Rd(n){function t(){let e;try{e=n()}catch(i){return Promise.reject(i)}return e instanceof Promise?e:Promise.resolve(e)}return t()}function In(n){for(const t in n)delete n[t]}function Ni(n){let t;for(t in n)return!1;return!t}class Ee{constructor(t){this.propagationStopped,this.defaultPrevented,this.type=t,this.target=null}preventDefault(){this.defaultPrevented=!0}stopPropagation(){this.propagationStopped=!0}}class Cs extends ws{constructor(t){super(),this.eventTarget_=t,this.pendingRemovals_=null,this.dispatching_=null,this.listeners_=null}addEventListener(t,e){if(!t||!e)return;const i=this.listeners_||(this.listeners_={}),s=i[t]||(i[t]=[]);s.includes(e)||s.push(e)}dispatchEvent(t){const e=typeof t=="string",i=e?t:t.type,s=this.listeners_&&this.listeners_[i];if(!s)return;const r=e?new Ee(t):t;r.target||(r.target=this.eventTarget_||this);const o=this.dispatching_||(this.dispatching_={}),a=this.pendingRemovals_||(this.pendingRemovals_={});i in o||(o[i]=0,a[i]=0),++o[i];let l;for(let h=0,c=s.length;h<c;++h)if("handleEvent"in s[h]?l=s[h].handleEvent(r):l=s[h].call(this,r),l===!1||r.propagationStopped){l=!1;break}if(--o[i]===0){let h=a[i];for(delete a[i];h--;)this.removeEventListener(i,Tn);delete o[i]}return l}disposeInternal(){this.listeners_&&In(this.listeners_)}getListeners(t){return this.listeners_&&this.listeners_[t]||void 0}hasListener(t){return this.listeners_?t?t in this.listeners_:Object.keys(this.listeners_).length>0:!1}removeEventListener(t,e){if(!this.listeners_)return;const i=this.listeners_[t];if(!i)return;const s=i.indexOf(e);s!==-1&&(this.pendingRemovals_&&t in this.pendingRemovals_?(i[s]=Tn,++this.pendingRemovals_[t]):(i.splice(s,1),i.length===0&&delete this.listeners_[t]))}}function Z(n,t,e,i,s){if(s){const o=e;e=function(a){return n.removeEventListener(t,e),o.call(i??this,a)}}else i&&i!==n&&(e=e.bind(i));const r={target:n,type:t,listener:e};return n.addEventListener(t,e),r}function Rs(n,t,e,i){return Z(n,t,e,i,!0)}function nt(n){n&&n.target&&(n.target.removeEventListener(n.type,n.listener),In(n))}class Sn extends Cs{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(t,e){if(Array.isArray(t)){const i=t.length,s=new Array(i);for(let r=0;r<i;++r)s[r]=Z(this,t[r],e);return s}return Z(this,t,e)}onceInternal(t,e){let i;if(Array.isArray(t)){const s=t.length;i=new Array(s);for(let r=0;r<s;++r)i[r]=Rs(this,t[r],e)}else i=Rs(this,t,e);return e.ol_key=i,i}unInternal(t,e){const i=e.ol_key;if(i)Td(i);else if(Array.isArray(t))for(let s=0,r=t.length;s<r;++s)this.removeEventListener(t[s],e);else this.removeEventListener(t,e)}}Sn.prototype.on,Sn.prototype.once,Sn.prototype.un;function Td(n){if(Array.isArray(n))for(let t=0,e=n.length;t<e;++t)nt(n[t]);else nt(n)}function U(){throw new Error("Unimplemented abstract method.")}let Id=0;function V(n){return n.ol_uid||(n.ol_uid=String(++Id))}class _l extends Ee{constructor(t,e,i){super(t),this.key=e,this.oldValue=i}}class ne extends Sn{constructor(t){super(),this.on,this.once,this.un,V(this),this.values_=null,t!==void 0&&this.setProperties(t)}get(t){let e;return this.values_&&this.values_.hasOwnProperty(t)&&(e=this.values_[t]),e}getKeys(){return this.values_&&Object.keys(this.values_)||[]}getProperties(){return this.values_&&Object.assign({},this.values_)||{}}getPropertiesInternal(){return this.values_}hasProperties(){return!!this.values_}notify(t,e){let i;i=`change:${t}`,this.hasListener(i)&&this.dispatchEvent(new _l(i,t,e)),i=ki.PROPERTYCHANGE,this.hasListener(i)&&this.dispatchEvent(new _l(i,t,e))}addChangeListener(t,e){this.addEventListener(`change:${t}`,e)}removeChangeListener(t,e){this.removeEventListener(`change:${t}`,e)}set(t,e,i){const s=this.values_||(this.values_={});if(i)s[t]=e;else{const r=s[t];s[t]=e,r!==e&&this.notify(t,r)}}setProperties(t,e){for(const i in t)this.set(i,t[i],e)}applyProperties(t){t.values_&&Object.assign(this.values_||(this.values_={}),t.values_)}unset(t,e){if(this.values_&&t in this.values_){const i=this.values_[t];delete this.values_[t],Ni(this.values_)&&(this.values_=null),e||this.notify(t,i)}}}const ml={LENGTH:"length"};class Ts extends Ee{constructor(t,e,i){super(t),this.element=e,this.index=i}}class ue extends ne{constructor(t,e){if(super(),this.on,this.once,this.un,e=e||{},this.unique_=!!e.unique,this.array_=t||[],this.unique_)for(let i=0,s=this.array_.length;i<s;++i)this.assertUnique_(this.array_[i],i);this.updateLength_()}clear(){for(;this.getLength()>0;)this.pop()}extend(t){for(let e=0,i=t.length;e<i;++e)this.push(t[e]);return this}forEach(t){const e=this.array_;for(let i=0,s=e.length;i<s;++i)t(e[i],i,e)}getArray(){return this.array_}item(t){return this.array_[t]}getLength(){return this.get(ml.LENGTH)}insertAt(t,e){if(t<0||t>this.getLength())throw new Error("Index out of bounds: "+t);this.unique_&&this.assertUnique_(e),this.array_.splice(t,0,e),this.updateLength_(),this.dispatchEvent(new Ts(bt.ADD,e,t))}pop(){return this.removeAt(this.getLength()-1)}push(t){this.unique_&&this.assertUnique_(t);const e=this.getLength();return this.insertAt(e,t),this.getLength()}remove(t){const e=this.array_;for(let i=0,s=e.length;i<s;++i)if(e[i]===t)return this.removeAt(i)}removeAt(t){if(t<0||t>=this.getLength())return;const e=this.array_[t];return this.array_.splice(t,1),this.updateLength_(),this.dispatchEvent(new Ts(bt.REMOVE,e,t)),e}setAt(t,e){const i=this.getLength();if(t>=i){this.insertAt(t,e);return}if(t<0)throw new Error("Index out of bounds: "+t);this.unique_&&this.assertUnique_(e,t);const s=this.array_[t];this.array_[t]=e,this.dispatchEvent(new Ts(bt.REMOVE,s,t)),this.dispatchEvent(new Ts(bt.ADD,e,t))}updateLength_(){this.set(ml.LENGTH,this.array_.length)}assertUnique_(t,e){for(let i=0,s=this.array_.length;i<s;++i)if(this.array_[i]===t&&i!==e)throw new Error("Duplicate item added to a unique collection")}}function J(n,t){if(!n)throw new Error(t)}class kr extends ne{constructor(t){if(super(),this.on,this.once,this.un,this.id_=void 0,this.geometryName_="geometry",this.style_=null,this.styleFunction_=void 0,this.geometryChangeKey_=null,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),t)if(typeof t.getSimplifiedGeometry=="function"){const e=t;this.setGeometry(e)}else{const e=t;this.setProperties(e)}}clone(){const t=new kr(this.hasProperties()?this.getProperties():null);t.setGeometryName(this.getGeometryName());const e=this.getGeometry();e&&t.setGeometry(e.clone());const i=this.getStyle();return i&&t.setStyle(i),t}getGeometry(){return this.get(this.geometryName_)}getId(){return this.id_}getGeometryName(){return this.geometryName_}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}handleGeometryChange_(){this.changed()}handleGeometryChanged_(){this.geometryChangeKey_&&(nt(this.geometryChangeKey_),this.geometryChangeKey_=null);const t=this.getGeometry();t&&(this.geometryChangeKey_=Z(t,z.CHANGE,this.handleGeometryChange_,this)),this.changed()}setGeometry(t){this.set(this.geometryName_,t)}setStyle(t){this.style_=t,this.styleFunction_=t?Sd(t):void 0,this.changed()}setId(t){this.id_=t,this.changed()}setGeometryName(t){this.removeChangeListener(this.geometryName_,this.handleGeometryChanged_),this.geometryName_=t,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),this.handleGeometryChanged_()}}function Sd(n){if(typeof n=="function")return n;let t;return Array.isArray(n)?t=n:(J(typeof n.getZIndex=="function","Expected an `ol/style/Style` or an array of `ol/style/Style.js`"),t=[n]),function(){return t}}const ut={UNKNOWN:0,INTERSECTING:1,ABOVE:2,RIGHT:4,BELOW:8,LEFT:16};function pl(n){const t=zt();for(let e=0,i=n.length;e<i;++e)Ln(t,n[e]);return t}function Nr(n,t,e){return e?(e[0]=n[0]-t,e[1]=n[1]-t,e[2]=n[2]+t,e[3]=n[3]+t,e):[n[0]-t,n[1]-t,n[2]+t,n[3]+t]}function yl(n,t){return t?(t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t):n.slice()}function xl(n,t,e){let i,s;return t<n[0]?i=n[0]-t:n[2]<t?i=t-n[2]:i=0,e<n[1]?s=n[1]-e:n[3]<e?s=e-n[3]:s=0,i*i+s*s}function Gi(n,t){return El(n,t[0],t[1])}function zi(n,t){return n[0]<=t[0]&&t[2]<=n[2]&&n[1]<=t[1]&&t[3]<=n[3]}function El(n,t,e){return n[0]<=t&&t<=n[2]&&n[1]<=e&&e<=n[3]}function Gr(n,t){const e=n[0],i=n[1],s=n[2],r=n[3],o=t[0],a=t[1];let l=ut.UNKNOWN;return o<e?l=l|ut.LEFT:o>s&&(l=l|ut.RIGHT),a<i?l=l|ut.BELOW:a>r&&(l=l|ut.ABOVE),l===ut.UNKNOWN&&(l=ut.INTERSECTING),l}function zt(){return[1/0,1/0,-1/0,-1/0]}function Ye(n,t,e,i,s){return s?(s[0]=n,s[1]=t,s[2]=e,s[3]=i,s):[n,t,e,i]}function Is(n){return Ye(1/0,1/0,-1/0,-1/0,n)}function wl(n,t){const e=n[0],i=n[1];return Ye(e,i,e,i,t)}function zr(n,t,e,i,s){const r=Is(s);return Cl(r,n,t,e,i)}function bn(n,t){return n[0]==t[0]&&n[2]==t[2]&&n[1]==t[1]&&n[3]==t[3]}function vl(n,t){return t[0]<n[0]&&(n[0]=t[0]),t[2]>n[2]&&(n[2]=t[2]),t[1]<n[1]&&(n[1]=t[1]),t[3]>n[3]&&(n[3]=t[3]),n}function Ln(n,t){t[0]<n[0]&&(n[0]=t[0]),t[0]>n[2]&&(n[2]=t[0]),t[1]<n[1]&&(n[1]=t[1]),t[1]>n[3]&&(n[3]=t[1])}function Cl(n,t,e,i,s){for(;e<i;e+=s)bd(n,t[e],t[e+1]);return n}function bd(n,t,e){n[0]=Math.min(n[0],t),n[1]=Math.min(n[1],e),n[2]=Math.max(n[2],t),n[3]=Math.max(n[3],e)}function Rl(n,t){let e;return e=t(Ss(n)),e||(e=t(bs(n)),e)||(e=t(Ls(n)),e)||(e=t(ui(n)),e)?e:!1}function Wr(n){let t=0;return As(n)||(t=Q(n)*Ct(n)),t}function Ss(n){return[n[0],n[1]]}function bs(n){return[n[2],n[1]]}function hi(n){return[(n[0]+n[2])/2,(n[1]+n[3])/2]}function Ld(n,t){let e;if(t==="bottom-left")e=Ss(n);else if(t==="bottom-right")e=bs(n);else if(t==="top-left")e=ui(n);else if(t==="top-right")e=Ls(n);else throw new Error("Invalid corner");return e}function Xr(n,t,e,i,s){const[r,o,a,l,h,c,u,d]=Tl(n,t,e,i);return Ye(Math.min(r,a,h,u),Math.min(o,l,c,d),Math.max(r,a,h,u),Math.max(o,l,c,d),s)}function Tl(n,t,e,i){const s=t*i[0]/2,r=t*i[1]/2,o=Math.cos(e),a=Math.sin(e),l=s*o,h=s*a,c=r*o,u=r*a,d=n[0],f=n[1];return[d-l+u,f-h-c,d-l-u,f-h+c,d+l-u,f+h+c,d+l+u,f+h-c,d-l+u,f-h-c]}function Ct(n){return n[3]-n[1]}function ci(n,t,e){const i=e||zt();return Lt(n,t)?(n[0]>t[0]?i[0]=n[0]:i[0]=t[0],n[1]>t[1]?i[1]=n[1]:i[1]=t[1],n[2]<t[2]?i[2]=n[2]:i[2]=t[2],n[3]<t[3]?i[3]=n[3]:i[3]=t[3]):Is(i),i}function ui(n){return[n[0],n[3]]}function Ls(n){return[n[2],n[3]]}function Q(n){return n[2]-n[0]}function Lt(n,t){return n[0]<=t[2]&&n[2]>=t[0]&&n[1]<=t[3]&&n[3]>=t[1]}function As(n){return n[2]<n[0]||n[3]<n[1]}function Ad(n,t){return t?(t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t):n}function Md(n,t,e){let i=!1;const s=Gr(n,t),r=Gr(n,e);if(s===ut.INTERSECTING||r===ut.INTERSECTING)i=!0;else{const o=n[0],a=n[1],l=n[2],h=n[3],c=t[0],u=t[1],d=e[0],f=e[1],g=(f-u)/(d-c);let m,_;r&ut.ABOVE&&!(s&ut.ABOVE)&&(m=d-(f-h)/g,i=m>=o&&m<=l),!i&&r&ut.RIGHT&&!(s&ut.RIGHT)&&(_=f-(d-l)*g,i=_>=a&&_<=h),!i&&r&ut.BELOW&&!(s&ut.BELOW)&&(m=d-(f-a)/g,i=m>=o&&m<=l),!i&&r&ut.LEFT&&!(s&ut.LEFT)&&(_=f-(d-o)*g,i=_>=a&&_<=h)}return i}function Il(n,t){const e=t.getExtent(),i=hi(n);if(t.canWrapX()&&(i[0]<e[0]||i[0]>=e[2])){const s=Q(e),o=Math.floor((i[0]-e[0])/s)*s;n[0]-=o,n[2]-=o}return n}function Sl(n,t,e){if(t.canWrapX()){const i=t.getExtent();if(!isFinite(n[0])||!isFinite(n[2]))return[[i[0],n[1],i[2],n[3]]];Il(n,t);const s=Q(i);if(Q(n)>s&&!e)return[[i[0],n[1],i[2],n[3]]];if(n[0]<i[0])return[[n[0]+s,n[1],i[2],n[3]],[i[0],n[1],n[2],n[3]]];if(n[2]>i[2])return[[n[0],n[1],i[2],n[3]],[i[0],n[1],n[2]-s,n[3]]]}return[n]}function st(n,t,e){return Math.min(Math.max(n,t),e)}function Pd(n,t,e,i,s,r){const o=s-e,a=r-i;if(o!==0||a!==0){const l=((n-e)*o+(t-i)*a)/(o*o+a*a);l>1?(e=s,i=r):l>0&&(e+=o*l,i+=a*l)}return Wi(n,t,e,i)}function Wi(n,t,e,i){const s=e-n,r=i-t;return s*s+r*r}function Od(n){const t=n.length;for(let i=0;i<t;i++){let s=i,r=Math.abs(n[i][i]);for(let a=i+1;a<t;a++){const l=Math.abs(n[a][i]);l>r&&(r=l,s=a)}if(r===0)return null;const o=n[s];n[s]=n[i],n[i]=o;for(let a=i+1;a<t;a++){const l=-n[a][i]/n[i][i];for(let h=i;h<t+1;h++)i==h?n[a][h]=0:n[a][h]+=l*n[i][h]}}const e=new Array(t);for(let i=t-1;i>=0;i--){e[i]=n[i][t]/n[i][i];for(let s=i-1;s>=0;s--)n[s][t]-=n[s][i]*e[i]}return e}function bl(n){return n*180/Math.PI}function $e(n){return n*Math.PI/180}function Xi(n,t){const e=n%t;return e*t<0?e+t:e}function Zt(n,t,e){return n+e*(t-n)}function Ms(n,t){const e=Math.pow(10,t);return Math.round(n*e)/e}function Ps(n,t){return Math.floor(Ms(n,t))}function Os(n,t){return Math.ceil(Ms(n,t))}function Yr(n,t,e){if(n>=t&&n<e)return n;const i=e-t;return((n-t)%i+i)%i+t}const Dd=63710088e-1;function Ll(n,t,e){e=e||Dd;const i=$e(n[1]),s=$e(t[1]),r=(s-i)/2,o=$e(t[0]-n[0])/2,a=Math.sin(r)*Math.sin(r)+Math.sin(o)*Math.sin(o)*Math.cos(i)*Math.cos(s);return 2*e*Math.atan2(Math.sqrt(a),Math.sqrt(1-a))}function Al(...n){console.warn(...n)}function Fd(n,t){return n[0]+=+t[0],n[1]+=+t[1],n}function Ds(n,t){let e=!0;for(let i=n.length-1;i>=0;--i)if(n[i]!=t[i]){e=!1;break}return e}function $r(n,t){const e=Math.cos(t),i=Math.sin(t),s=n[0]*e-n[1]*i,r=n[1]*e+n[0]*i;return n[0]=s,n[1]=r,n}function kd(n,t){return n[0]*=t,n[1]*=t,n}function Ml(n,t){if(t.canWrapX()){const e=Q(t.getExtent()),i=Nd(n,t,e);i&&(n[0]-=i*e)}return n}function Nd(n,t,e){const i=t.getExtent();let s=0;return t.canWrapX()&&(n[0]<i[0]||n[0]>i[2])&&(e=e||Q(i),s=Math.floor((n[0]-i[0])/e)),s}const Kr={radians:6370997/(2*Math.PI),degrees:2*Math.PI*6370997/360,ft:.3048,m:1,"us-ft":1200/3937};class Br{constructor(t){this.code_=t.code,this.units_=t.units,this.extent_=t.extent!==void 0?t.extent:null,this.worldExtent_=t.worldExtent!==void 0?t.worldExtent:null,this.axisOrientation_=t.axisOrientation!==void 0?t.axisOrientation:"enu",this.global_=t.global!==void 0?t.global:!1,this.canWrapX_=!!(this.global_&&this.extent_),this.getPointResolutionFunc_=t.getPointResolution,this.defaultTileGrid_=null,this.metersPerUnit_=t.metersPerUnit}canWrapX(){return this.canWrapX_}getCode(){return this.code_}getExtent(){return this.extent_}getUnits(){return this.units_}getMetersPerUnit(){return this.metersPerUnit_||Kr[this.units_]}getWorldExtent(){return this.worldExtent_}getAxisOrientation(){return this.axisOrientation_}isGlobal(){return this.global_}setGlobal(t){this.global_=t,this.canWrapX_=!!(t&&this.extent_)}getDefaultTileGrid(){return this.defaultTileGrid_}setDefaultTileGrid(t){this.defaultTileGrid_=t}setExtent(t){this.extent_=t,this.canWrapX_=!!(this.global_&&t)}setWorldExtent(t){this.worldExtent_=t}setGetPointResolution(t){this.getPointResolutionFunc_=t}getPointResolutionFunc(){return this.getPointResolutionFunc_}}const An=6378137,Yi=Math.PI*An,Gd=[-Yi,-Yi,Yi,Yi],zd=[-180,-85,180,85],Fs=An*Math.log(Math.tan(Math.PI/2));class $i extends Br{constructor(t){super({code:t,units:"m",extent:Gd,global:!0,worldExtent:zd,getPointResolution:function(e,i){return e/Math.cosh(i[1]/An)}})}}const Pl=[new $i("EPSG:3857"),new $i("EPSG:102100"),new $i("EPSG:102113"),new $i("EPSG:900913"),new $i("http://www.opengis.net/def/crs/EPSG/0/3857"),new $i("http://www.opengis.net/gml/srs/epsg.xml#3857")];function Wd(n,t,e,i){const s=n.length;e=e>1?e:2,i=i??e,t===void 0&&(e>2?t=n.slice():t=new Array(s));for(let r=0;r<s;r+=i){t[r]=Yi*n[r]/180;let o=An*Math.log(Math.tan(Math.PI*(+n[r+1]+90)/360));o>Fs?o=Fs:o<-Fs&&(o=-Fs),t[r+1]=o}return t}function Xd(n,t,e,i){const s=n.length;e=e>1?e:2,i=i??e,t===void 0&&(e>2?t=n.slice():t=new Array(s));for(let r=0;r<s;r+=i)t[r]=180*n[r]/Yi,t[r+1]=360*Math.atan(Math.exp(n[r+1]/An))/Math.PI-90;return t}const Yd=6378137,Ol=[-180,-90,180,90],$d=Math.PI*Yd/180;class di extends Br{constructor(t,e){super({code:t,units:"degrees",extent:Ol,axisOrientation:e,global:!0,metersPerUnit:$d,worldExtent:Ol})}}const Dl=[new di("CRS:84"),new di("EPSG:4326","neu"),new di("urn:ogc:def:crs:OGC:1.3:CRS84"),new di("urn:ogc:def:crs:OGC:2:84"),new di("http://www.opengis.net/def/crs/OGC/1.3/CRS84"),new di("http://www.opengis.net/gml/srs/epsg.xml#4326","neu"),new di("http://www.opengis.net/def/crs/EPSG/0/4326","neu")];let Zr={};function Kd(n){return Zr[n]||Zr[n.replace(/urn:(x-)?ogc:def:crs:EPSG:(.*:)?(\w+)$/,"EPSG:$3")]||null}function Bd(n,t){Zr[n]=t}let Ki={};function Mn(n,t,e){const i=n.getCode(),s=t.getCode();i in Ki||(Ki[i]={}),Ki[i][s]=e}function Ur(n,t){return n in Ki&&t in Ki[n]?Ki[n][t]:null}const ks=.9996,Ut=.00669438,Ns=Ut*Ut,Gs=Ns*Ut,fi=Ut/(1-Ut),Fl=Math.sqrt(1-Ut),Bi=(1-Fl)/(1+Fl),kl=Bi*Bi,Vr=kl*Bi,jr=Vr*Bi,Nl=jr*Bi,Gl=1-Ut/4-3*Ns/64-5*Gs/256,Zd=3*Ut/8+3*Ns/32+45*Gs/1024,Ud=15*Ns/256+45*Gs/1024,Vd=35*Gs/3072,jd=3/2*Bi-27/32*Vr+269/512*Nl,Hd=21/16*kl-55/32*jr,qd=151/96*Vr-417/128*Nl,Jd=1097/512*jr,zs=6378137;function Qd(n,t,e){const i=n-5e5,o=(e.north?t:t-1e7)/ks/(zs*Gl),a=o+jd*Math.sin(2*o)+Hd*Math.sin(4*o)+qd*Math.sin(6*o)+Jd*Math.sin(8*o),l=Math.sin(a),h=l*l,c=Math.cos(a),u=l/c,d=u*u,f=d*d,g=1-Ut*h,m=Math.sqrt(1-Ut*h),_=zs/m,p=(1-Ut)/g,y=fi*c**2,v=y*y,x=i/(_*ks),E=x*x,w=E*x,T=w*x,R=T*x,I=R*x,L=a-u/p*(E/2-T/24*(5+3*d+10*y-4*v-9*fi))+I/720*(61+90*d+298*y+45*f-252*fi-3*v);let P=(x-w/6*(1+2*d+y)+R/120*(5-2*y+28*d-3*v+8*fi+24*f))/c;return P=Yr(P+$e(Xl(e.number)),-Math.PI,Math.PI),[bl(P),bl(L)]}const zl=-80,Wl=84,tf=-180,ef=180;function nf(n,t,e){n=Yr(n,tf,ef),t<zl?t=zl:t>Wl&&(t=Wl);const i=$e(t),s=Math.sin(i),r=Math.cos(i),o=s/r,a=o*o,l=a*a,h=$e(n),c=Xl(e.number),u=$e(c),d=zs/Math.sqrt(1-Ut*s**2),f=fi*r**2,g=r*Yr(h-u,-Math.PI,Math.PI),m=g*g,_=m*g,p=_*g,y=p*g,v=y*g,x=zs*(Gl*i-Zd*Math.sin(2*i)+Ud*Math.sin(4*i)-Vd*Math.sin(6*i)),E=ks*d*(g+_/6*(1-a+f)+y/120*(5-18*a+l+72*f-58*fi))+5e5;let w=ks*(x+d*o*(m/2+p/24*(5-a+9*f+4*f**2)+v/720*(61-58*a+l+600*f-330*fi)));return e.north||(w+=1e7),[E,w]}function Xl(n){return(n-1)*6-180+3}const sf=[/^EPSG:(\d+)$/,/^urn:ogc:def:crs:EPSG::(\d+)$/,/^http:\/\/www\.opengis\.net\/def\/crs\/EPSG\/0\/(\d+)$/];function Yl(n){let t=0;for(const s of sf){const r=n.match(s);if(r){t=parseInt(r[1]);break}}if(!t)return null;let e=0,i=!1;return t>32700&&t<32761?e=t-32700:t>32600&&t<32661&&(i=!0,e=t-32600),e?{number:e,north:i}:null}function $l(n,t){return function(e,i,s,r){const o=e.length;s=s>1?s:2,r=r??s,i||(s>2?i=e.slice():i=new Array(o));for(let a=0;a<o;a+=r){const l=e[a],h=e[a+1],c=n(l,h,t);i[a]=c[0],i[a+1]=c[1]}return i}}function rf(n){return Yl(n)?new Br({code:n,units:"m"}):null}function of(n){const t=Yl(n.getCode());return t?{forward:$l(nf,t),inverse:$l(Qd,t)}:null}const af=[of],lf=[rf];let Hr=!0;function Kl(n){Hr=!1}function qr(n,t){if(t!==void 0){for(let e=0,i=n.length;e<i;++e)t[e]=n[e];t=t}else t=n.slice();return t}function Jr(n){Bd(n.getCode(),n),Mn(n,n,qr)}function hf(n){n.forEach(Jr)}function At(n){if(typeof n!="string")return n;const t=Kd(n);if(t)return t;for(const e of lf){const i=e(n);if(i)return i}return null}function Bl(n,t,e,i){n=At(n);let s;const r=n.getPointResolutionFunc();if(r)s=r(t,e);else{const o=n.getUnits();if(o=="degrees"&&!i||i=="degrees")s=t;else{const a=io(n,At("EPSG:4326"));if(!a&&o!=="degrees")s=t*n.getMetersPerUnit();else{let h=[e[0]-t/2,e[1],e[0]+t/2,e[1],e[0],e[1]-t/2,e[0],e[1]+t/2];h=a(h,h,2);const c=Ll(h.slice(0,2),h.slice(2,4)),u=Ll(h.slice(4,6),h.slice(6,8));s=(c+u)/2}const l=n.getMetersPerUnit();l!==void 0&&(s/=l)}}return s}function Zl(n){hf(n),n.forEach(function(t){n.forEach(function(e){t!==e&&Mn(t,e,qr)})})}function cf(n,t,e,i){n.forEach(function(s){t.forEach(function(r){Mn(s,r,e),Mn(r,s,i)})})}function Qr(n,t){return n?typeof n=="string"?At(n):n:At(t)}function uf(n){return(function(t,e,i,s){const r=t.length;i=i!==void 0?i:2,s=s??i,e=e!==void 0?e:new Array(r);for(let o=0;o<r;o+=s){const a=n(t.slice(o,o+i)),l=a.length;for(let h=0,c=s;h<c;++h)e[o+h]=h>=l?t[o+h]:a[h]}return e})}function to(n,t){return Kl(),Pn(n,"EPSG:4326","EPSG:3857")}function eo(n,t){if(n===t)return!0;const e=n.getUnits()===t.getUnits();return(n.getCode()===t.getCode()||io(n,t)===qr)&&e}function io(n,t){const e=n.getCode(),i=t.getCode();let s=Ur(e,i);if(s)return s;let r=null,o=null;for(const l of af)r||(r=l(n)),o||(o=l(t));if(!r&&!o)return null;const a="EPSG:4326";if(o)if(r)s=no(r.inverse,o.forward);else{const l=Ur(e,a);l&&(s=no(l,o.forward))}else{const l=Ur(a,i);l&&(s=no(r.inverse,l))}return s&&(Jr(n),Jr(t),Mn(n,t,s)),s}function no(n,t){return function(e,i,s,r){return i=n(e,i,s,r),t(i,i,s,r)}}function Ws(n,t){const e=At(n),i=At(t);return io(e,i)}function Pn(n,t,e){const i=Ws(t,e);if(!i){const s=At(t).getCode(),r=At(e).getCode();throw new Error(`No transform available between ${s} and ${r}`)}return i(n,void 0,n.length)}function so(n,t){return n}function we(n,t){return Hr&&!Ds(n,[0,0])&&n[0]>=-180&&n[0]<=180&&n[1]>=-90&&n[1]<=90&&(Hr=!1,Al("Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.")),n}function Ul(n,t){return n}function Ke(n,t){return n}function df(){Zl(Pl),Zl(Dl),cf(Dl,Pl,Wd,Xd)}df(),new Array(6);function se(){return[1,0,0,1,0,0]}function ff(n,t){return n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=t[3],n[4]=t[4],n[5]=t[5],n}function dt(n,t){const e=t[0],i=t[1];return t[0]=n[0]*e+n[2]*i+n[4],t[1]=n[1]*e+n[3]*i+n[5],t}function ve(n,t,e,i,s,r,o,a){const l=Math.sin(r),h=Math.cos(r);return n[0]=i*h,n[1]=s*l,n[2]=-i*l,n[3]=s*h,n[4]=o*i*h-a*i*l+t,n[5]=o*s*l+a*s*h+e,n}function Vl(n,t){const e=gf(t);J(e!==0,"Transformation matrix cannot be inverted");const i=t[0],s=t[1],r=t[2],o=t[3],a=t[4],l=t[5];return n[0]=o/e,n[1]=-s/e,n[2]=-r/e,n[3]=i/e,n[4]=(r*l-o*a)/e,n[5]=-(i*l-s*a)/e,n}function gf(n){return n[0]*n[3]-n[1]*n[2]}const _f=[1e5,1e5,1e5,1e5,2,2];function mf(n){return"matrix("+n.join(", ")+")"}function jl(n){return n.substring(7,n.length-1).split(",").map(parseFloat)}function pf(n,t){const e=jl(n),i=jl(t);for(let s=0;s<6;++s)if(Math.round((e[s]-i[s])*_f[s])!==0)return!1;return!0}function Be(n,t,e,i,s,r,o){r=r||[],o=o||2;let a=0;for(let l=t;l<e;l+=i){const h=n[l],c=n[l+1];r[a++]=s[0]*h+s[2]*c+s[4],r[a++]=s[1]*h+s[3]*c+s[5];for(let u=2;u<o;u++)r[a++]=n[l+u]}return r&&r.length!=a&&(r.length=a),r}function Hl(n,t,e,i,s,r,o){o=o||[];const a=Math.cos(s),l=Math.sin(s),h=r[0],c=r[1];let u=0;for(let d=t;d<e;d+=i){const f=n[d]-h,g=n[d+1]-c;o[u++]=h+f*a-g*l,o[u++]=c+f*l+g*a;for(let m=d+2;m<d+i;++m)o[u++]=n[m]}return o&&o.length!=u&&(o.length=u),o}function yf(n,t,e,i,s,r,o,a){a=a||[];const l=o[0],h=o[1];let c=0;for(let u=t;u<e;u+=i){const d=n[u]-l,f=n[u+1]-h;a[c++]=l+s*d,a[c++]=h+r*f;for(let g=u+2;g<u+i;++g)a[c++]=n[g]}return a&&a.length!=c&&(a.length=c),a}function xf(n,t,e,i,s,r,o){o=o||[];let a=0;for(let l=t;l<e;l+=i){o[a++]=n[l]+s,o[a++]=n[l+1]+r;for(let h=l+2;h<l+i;++h)o[a++]=n[h]}return o&&o.length!=a&&(o.length=a),o}const ql=se(),Ef=[NaN,NaN];class wf extends ne{constructor(){super(),this.extent_=zt(),this.extentRevision_=-1,this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=0,this.simplifyTransformedInternal=gl((t,e,i)=>{if(!i)return this.getSimplifiedGeometry(e);const s=this.clone();return s.applyTransform(i),s.getSimplifiedGeometry(e)})}simplifyTransformed(t,e){return this.simplifyTransformedInternal(this.getRevision(),t,e)}clone(){return U()}closestPointXY(t,e,i,s){return U()}containsXY(t,e){return this.closestPointXY(t,e,Ef,Number.MIN_VALUE)===0}getClosestPoint(t,e){return e=e||[NaN,NaN],this.closestPointXY(t[0],t[1],e,1/0),e}intersectsCoordinate(t){return this.containsXY(t[0],t[1])}computeExtent(t){return U()}getExtent(t){if(this.extentRevision_!=this.getRevision()){const e=this.computeExtent(this.extent_);(isNaN(e[0])||isNaN(e[1]))&&Is(e),this.extentRevision_=this.getRevision()}return Ad(this.extent_,t)}rotate(t,e){U()}scale(t,e,i){U()}simplify(t){return this.getSimplifiedGeometry(t*t)}getSimplifiedGeometry(t){return U()}getType(){return U()}applyTransform(t){U()}intersectsExtent(t){return U()}translate(t,e){U()}transform(t,e){const i=At(t),s=i.getUnits()=="tile-pixels"?function(r,o,a){const l=i.getExtent(),h=i.getWorldExtent(),c=Ct(h)/Ct(l);ve(ql,h[0],h[3],c,-c,0,0,0);const u=Be(r,0,r.length,a,ql,o),d=Ws(i,e);return d?d(u,u,a):u}:Ws(i,e);return this.applyTransform(s),this}}class ro extends wf{constructor(){super(),this.layout="XY",this.stride=2,this.flatCoordinates}computeExtent(t){return zr(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t)}getCoordinates(){return U()}getFirstCoordinate(){return this.flatCoordinates.slice(0,this.stride)}getFlatCoordinates(){return this.flatCoordinates}getLastCoordinate(){return this.flatCoordinates.slice(this.flatCoordinates.length-this.stride)}getLayout(){return this.layout}getSimplifiedGeometry(t){if(this.simplifiedGeometryRevision!==this.getRevision()&&(this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=this.getRevision()),t<0||this.simplifiedGeometryMaxMinSquaredTolerance!==0&&t<=this.simplifiedGeometryMaxMinSquaredTolerance)return this;const e=this.getSimplifiedGeometryInternal(t);return e.getFlatCoordinates().length<this.flatCoordinates.length?e:(this.simplifiedGeometryMaxMinSquaredTolerance=t,this)}getSimplifiedGeometryInternal(t){return this}getStride(){return this.stride}setFlatCoordinates(t,e){this.stride=Jl(t),this.layout=t,this.flatCoordinates=e}setCoordinates(t,e){U()}setLayout(t,e,i){let s;if(t)s=Jl(t);else{for(let r=0;r<i;++r){if(e.length===0){this.layout="XY",this.stride=2;return}e=e[0]}s=e.length,t=vf(s)}this.layout=t,this.stride=s}applyTransform(t){this.flatCoordinates&&(t(this.flatCoordinates,this.flatCoordinates,this.layout.startsWith("XYZ")?3:2,this.stride),this.changed())}rotate(t,e){const i=this.getFlatCoordinates();if(i){const s=this.getStride();Hl(i,0,i.length,s,t,e,i),this.changed()}}scale(t,e,i){e===void 0&&(e=t),i||(i=hi(this.getExtent()));const s=this.getFlatCoordinates();if(s){const r=this.getStride();yf(s,0,s.length,r,t,e,i,s),this.changed()}}translate(t,e){const i=this.getFlatCoordinates();if(i){const s=this.getStride();xf(i,0,i.length,s,t,e,i),this.changed()}}}function vf(n){let t;return n==2?t="XY":n==3?t="XYZ":n==4&&(t="XYZM"),t}function Jl(n){let t;return n=="XY"?t=2:n=="XYZ"||n=="XYM"?t=3:n=="XYZM"&&(t=4),t}function Cf(n,t,e){const i=n.getFlatCoordinates();if(!i)return null;const s=n.getStride();return Be(i,0,i.length,s,t,e)}function Ql(n,t,e,i){let s=0;const r=n[e-i],o=n[e-i+1];let a=0,l=0;for(;t<e;t+=i){const h=n[t]-r,c=n[t+1]-o;s+=l*h-a*c,a=h,l=c}return s/2}function Rf(n,t,e,i){let s=0;for(let r=0,o=e.length;r<o;++r){const a=e[r];s+=Ql(n,t,a,i),t=a}return s}function th(n,t,e,i,s,r,o){const a=n[t],l=n[t+1],h=n[e]-a,c=n[e+1]-l;let u;if(h===0&&c===0)u=t;else{const d=((s-a)*h+(r-l)*c)/(h*h+c*c);if(d>1)u=e;else if(d>0){for(let f=0;f<i;++f)o[f]=Zt(n[t+f],n[e+f],d);o.length=i;return}else u=t}for(let d=0;d<i;++d)o[d]=n[u+d];o.length=i}function eh(n,t,e,i,s){let r=n[t],o=n[t+1];for(t+=i;t<e;t+=i){const a=n[t],l=n[t+1],h=Wi(r,o,a,l);h>s&&(s=h),r=a,o=l}return s}function Tf(n,t,e,i,s){for(let r=0,o=e.length;r<o;++r){const a=e[r];s=eh(n,t,a,i,s),t=a}return s}function ih(n,t,e,i,s,r,o,a,l,h,c){if(t==e)return h;let u,d;if(s===0){if(d=Wi(o,a,n[t],n[t+1]),d<h){for(u=0;u<i;++u)l[u]=n[t+u];return l.length=i,d}return h}c=c||[NaN,NaN];let f=t+i;for(;f<e;)if(th(n,f-i,f,i,o,a,c),d=Wi(o,a,c[0],c[1]),d<h){for(h=d,u=0;u<i;++u)l[u]=c[u];l.length=i,f+=i}else f+=i*Math.max((Math.sqrt(d)-Math.sqrt(h))/s|0,1);if(th(n,e-i,t,i,o,a,c),d=Wi(o,a,c[0],c[1]),d<h){for(h=d,u=0;u<i;++u)l[u]=c[u];l.length=i}return h}function If(n,t,e,i,s,r,o,a,l,h,c){c=c||[NaN,NaN];for(let u=0,d=e.length;u<d;++u){const f=e[u];h=ih(n,t,f,i,s,r,o,a,l,h,c),t=f}return h}function Sf(n,t,e,i){for(let s=0,r=e.length;s<r;++s)n[t++]=e[s];return t}function nh(n,t,e,i){for(let s=0,r=e.length;s<r;++s){const o=e[s];for(let a=0;a<i;++a)n[t++]=o[a]}return t}function bf(n,t,e,i,s){s=s||[];let r=0;for(let o=0,a=e.length;o<a;++o){const l=nh(n,t,e[o],i);s[r++]=l,t=l}return s.length=r,s}function Zi(n,t,e,i,s){s=s!==void 0?s:[];let r=0;for(let o=t;o<e;o+=i)s[r++]=n.slice(o,o+i);return s.length=r,s}function Xs(n,t,e,i,s){s=s!==void 0?s:[];let r=0;for(let o=0,a=e.length;o<a;++o){const l=e[o];s[r++]=Zi(n,t,l,i,s[r]),t=l}return s.length=r,s}function sh(n,t,e,i,s){s=s!==void 0?s:[];let r=0;for(let o=0,a=e.length;o<a;++o){const l=e[o];s[r++]=l.length===1&&l[0]===t?[]:Xs(n,t,l,i,s[r]),t=l[l.length-1]}return s.length=r,s}function oo(n,t,e,i,s,r,o){const a=(e-t)/i;if(a<3){for(;t<e;t+=i)r[o++]=n[t],r[o++]=n[t+1];return o}const l=new Array(a);l[0]=1,l[a-1]=1;const h=[t,e-i];let c=0;for(;h.length>0;){const u=h.pop(),d=h.pop();let f=0;const g=n[d],m=n[d+1],_=n[u],p=n[u+1];for(let y=d+i;y<u;y+=i){const v=n[y],x=n[y+1],E=Pd(v,x,g,m,_,p);E>f&&(c=y,f=E)}f>s&&(l[(c-t)/i]=1,d+i<c&&h.push(d,c),c+i<u&&h.push(c,u))}for(let u=0;u<a;++u)l[u]&&(r[o++]=n[t+u*i],r[o++]=n[t+u*i+1]);return o}function Lf(n,t,e,i,s,r,o,a){for(let l=0,h=e.length;l<h;++l){const c=e[l];o=oo(n,t,c,i,s,r,o),a.push(o),t=c}return o}function gi(n,t){return t*Math.round(n/t)}function Af(n,t,e,i,s,r,o){if(t==e)return o;let a=gi(n[t],s),l=gi(n[t+1],s);t+=i,r[o++]=a,r[o++]=l;let h,c;do if(h=gi(n[t],s),c=gi(n[t+1],s),t+=i,t==e)return r[o++]=h,r[o++]=c,o;while(h==a&&c==l);for(;t<e;){const u=gi(n[t],s),d=gi(n[t+1],s);if(t+=i,u==h&&d==c)continue;const f=h-a,g=c-l,m=u-a,_=d-l;if(f*_==g*m&&(f<0&&m<f||f==m||f>0&&m>f)&&(g<0&&_<g||g==_||g>0&&_>g)){h=u,c=d;continue}r[o++]=h,r[o++]=c,a=h,l=c,h=u,c=d}return r[o++]=h,r[o++]=c,o}function rh(n,t,e,i,s,r,o,a){for(let l=0,h=e.length;l<h;++l){const c=e[l];o=Af(n,t,c,i,s,r,o),a.push(o),t=c}return o}class On extends ro{constructor(t,e){super(),this.maxDelta_=-1,this.maxDeltaRevision_=-1,e!==void 0&&!Array.isArray(t[0])?this.setFlatCoordinates(e,t):this.setCoordinates(t,e)}clone(){return new On(this.flatCoordinates.slice(),this.layout)}closestPointXY(t,e,i,s){return s<xl(this.getExtent(),t,e)?s:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(eh(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),ih(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!0,t,e,i,s))}getArea(){return Ql(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinates(){return Zi(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getSimplifiedGeometryInternal(t){const e=[];return e.length=oo(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e,0),new On(e,"XY")}getType(){return"LinearRing"}intersectsExtent(t){return!1}setCoordinates(t,e){this.setLayout(e,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=nh(this.flatCoordinates,0,t,this.stride),this.changed()}}class Ys extends ro{constructor(t,e){super(),this.setCoordinates(t,e)}clone(){const t=new Ys(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(t,e,i,s){const r=this.flatCoordinates,o=Wi(t,e,r[0],r[1]);if(o<s){const a=this.stride;for(let l=0;l<a;++l)i[l]=r[l];return i.length=a,o}return s}getCoordinates(){return this.flatCoordinates.slice()}computeExtent(t){return wl(this.flatCoordinates,t)}getType(){return"Point"}intersectsExtent(t){return El(t,this.flatCoordinates[0],this.flatCoordinates[1])}setCoordinates(t,e){this.setLayout(e,t,0),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Sf(this.flatCoordinates,0,t,this.stride),this.changed()}}function Mf(n,t,e,i,s){return!Rl(s,function(o){return!_i(n,t,e,i,o[0],o[1])})}function _i(n,t,e,i,s,r){let o=0,a=n[e-i],l=n[e-i+1];for(;t<e;t+=i){const h=n[t],c=n[t+1];l<=r?c>r&&(h-a)*(r-l)-(s-a)*(c-l)>0&&o++:c<=r&&(h-a)*(r-l)-(s-a)*(c-l)<0&&o--,a=h,l=c}return o!==0}function oh(n,t,e,i,s,r){if(e.length===0||!_i(n,t,e[0],i,s,r))return!1;for(let o=1,a=e.length;o<a;++o)if(_i(n,e[o-1],e[o],i,s,r))return!1;return!0}function ao(n,t,e,i,s,r,o){let a,l,h,c,u,d,f;const g=s[r+1],m=[];for(let y=0,v=e.length;y<v;++y){const x=e[y];for(c=n[x-i],d=n[x-i+1],a=t;a<x;a+=i)u=n[a],f=n[a+1],(g<=d&&f<=g||d<=g&&g<=f)&&(h=(g-d)/(f-d)*(u-c)+c,m.push(h)),c=u,d=f}let _=NaN,p=-1/0;for(m.sort(xe),c=m[0],a=1,l=m.length;a<l;++a){u=m[a];const y=Math.abs(u-c);y>p&&(h=(c+u)/2,oh(n,t,e,i,h,g)&&(_=h,p=y)),c=u}return isNaN(_)&&(_=s[r]),o?(o.push(_,g,p),o):[_,g,p]}function Pf(n,t,e,i,s){let r=[];for(let o=0,a=e.length;o<a;++o){const l=e[o];r=ao(n,t,l,i,s,2*o,r),t=l[l.length-1]}return r}function Of(n,t,e,i,s){let r;for(t+=i;t<e;t+=i)if(r=s(n.slice(t-i,t),n.slice(t,t+i)),r)return r;return!1}function ah(n,t,e,i,s,r){return r=r??Cl(zt(),n,t,e,i),Lt(s,r)?r[0]>=s[0]&&r[2]<=s[2]||r[1]>=s[1]&&r[3]<=s[3]?!0:Of(n,t,e,i,function(o,a){return Md(s,o,a)}):!1}function lh(n,t,e,i,s){return!!(ah(n,t,e,i,s)||_i(n,t,e,i,s[0],s[1])||_i(n,t,e,i,s[0],s[3])||_i(n,t,e,i,s[2],s[1])||_i(n,t,e,i,s[2],s[3]))}function Df(n,t,e,i,s){if(!lh(n,t,e[0],i,s))return!1;if(e.length===1)return!0;for(let r=1,o=e.length;r<o;++r)if(Mf(n,e[r-1],e[r],i,s)&&!ah(n,e[r-1],e[r],i,s))return!1;return!0}function Ff(n,t,e,i){for(;t<e-i;){for(let s=0;s<i;++s){const r=n[t+s];n[t+s]=n[e-i+s],n[e-i+s]=r}t+=i,e-=i}}function lo(n,t,e,i){let s=0,r=n[e-i],o=n[e-i+1];for(;t<e;t+=i){const a=n[t],l=n[t+1];s+=(a-r)*(l+o),r=a,o=l}return s===0?void 0:s>0}function kf(n,t,e,i,s){s=s!==void 0?s:!1;for(let r=0,o=e.length;r<o;++r){const a=e[r],l=lo(n,t,a,i);if(r===0){if(s&&l||!s&&!l)return!1}else if(s&&!l||!s&&l)return!1;t=a}return!0}function hh(n,t,e,i,s){s=s!==void 0?s:!1;for(let r=0,o=e.length;r<o;++r){const a=e[r],l=lo(n,t,a,i);(r===0?s&&l||!s&&!l:s&&!l||!s&&l)&&Ff(n,t,a,i),t=a}return t}function Nf(n,t){const e=[];let i=0,s=0,r;for(let o=0,a=t.length;o<a;++o){const l=t[o],h=lo(n,i,l,2);if(r===void 0&&(r=h),h===r)e.push(t.slice(s,o+1));else{if(e.length===0)continue;e[e.length-1].push(t[s])}s=o+1,i=l}return e}class Dn extends ro{constructor(t,e,i){super(),this.ends_=[],this.flatInteriorPointRevision_=-1,this.flatInteriorPoint_=null,this.maxDelta_=-1,this.maxDeltaRevision_=-1,this.orientedRevision_=-1,this.orientedFlatCoordinates_=null,e!==void 0&&i?(this.setFlatCoordinates(e,t),this.ends_=i):this.setCoordinates(t,e)}appendLinearRing(t){this.flatCoordinates?Fr(this.flatCoordinates,t.getFlatCoordinates()):this.flatCoordinates=t.getFlatCoordinates().slice(),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){const t=new Dn(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return t.applyProperties(this),t}closestPointXY(t,e,i,s){return s<xl(this.getExtent(),t,e)?s:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Tf(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),If(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!0,t,e,i,s))}containsXY(t,e){return oh(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,e)}getArea(){return Rf(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride)}getCoordinates(t){let e;return t!==void 0?(e=this.getOrientedFlatCoordinates().slice(),hh(e,0,this.ends_,this.stride,t)):e=this.flatCoordinates,Xs(e,0,this.ends_,this.stride)}getEnds(){return this.ends_}getFlatInteriorPoint(){if(this.flatInteriorPointRevision_!=this.getRevision()){const t=hi(this.getExtent());this.flatInteriorPoint_=ao(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,0),this.flatInteriorPointRevision_=this.getRevision()}return this.flatInteriorPoint_}getInteriorPoint(){return new Ys(this.getFlatInteriorPoint(),"XYM")}getLinearRingCount(){return this.ends_.length}getLinearRing(t){return t<0||this.ends_.length<=t?null:new On(this.flatCoordinates.slice(t===0?0:this.ends_[t-1],this.ends_[t]),this.layout)}getLinearRings(){const t=this.layout,e=this.flatCoordinates,i=this.ends_,s=[];let r=0;for(let o=0,a=i.length;o<a;++o){const l=i[o],h=new On(e.slice(r,l),t);s.push(h),r=l}return s}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){const t=this.flatCoordinates;kf(t,0,this.ends_,this.stride)?this.orientedFlatCoordinates_=t:(this.orientedFlatCoordinates_=t.slice(),this.orientedFlatCoordinates_.length=hh(this.orientedFlatCoordinates_,0,this.ends_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(t){const e=[],i=[];return e.length=rh(this.flatCoordinates,0,this.ends_,this.stride,Math.sqrt(t),e,0,i),new Dn(e,"XY",i)}getType(){return"Polygon"}intersectsExtent(t){return Df(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,2),this.flatCoordinates||(this.flatCoordinates=[]);const i=bf(this.flatCoordinates,0,t,this.stride,this.ends_);this.flatCoordinates.length=i.length===0?0:i[i.length-1],this.changed()}}function ch(n){if(As(n))throw new Error("Cannot create polygon from empty extent");const t=n[0],e=n[1],i=n[2],s=n[3],r=[t,e,t,s,i,s,i,e,t,e];return new Dn(r,"XY",[r.length])}function uh(n,t,e,i,s,r,o){let a,l;const h=(e-t)/i;if(h===1)a=t;else if(h===2)a=t,l=s;else if(h!==0){let c=n[t],u=n[t+1],d=0;const f=[0];for(let _=t+i;_<e;_+=i){const p=n[_],y=n[_+1];d+=Math.sqrt((p-c)*(p-c)+(y-u)*(y-u)),f.push(d),c=p,u=y}const g=s*d,m=Ed(f,g);m<0?(l=(g-f[-m-2])/(f[-m-1]-f[-m-2]),a=t+(-m-2)*i):a=t+m*i}o=o>1?o:2,r=r||new Array(o);for(let c=0;c<o;++c)r[c]=a===void 0?NaN:l===void 0?n[a+c]:Zt(n[a+c],n[a+i+c],l);return r}function Gf(n,t,e,i){let s=n[t],r=n[t+1],o=0;for(let a=t+i;a<e;a+=i){const l=n[a],h=n[a+1];o+=Math.sqrt((l-s)*(l-s)+(h-r)*(h-r)),s=l,r=h}return o}const Vt={PRERENDER:"prerender",POSTRENDER:"postrender",PRECOMPOSE:"precompose",POSTCOMPOSE:"postcompose",RENDERCOMPLETE:"rendercomplete"},mi=typeof navigator<"u"&&typeof navigator.userAgent<"u"?navigator.userAgent.toLowerCase():"";mi.includes("safari")&&!mi.includes("chrom")&&(mi.includes("version/15.4")||/cpu (os|iphone os) 15_4 like mac os x/.test(mi));const zf=mi.includes("webkit")&&!mi.includes("edge"),dh=mi.includes("macintosh"),Wf=typeof devicePixelRatio<"u"?devicePixelRatio:1,ho=typeof WorkerGlobalScope<"u"&&typeof OffscreenCanvas<"u"&&self instanceof WorkerGlobalScope,fh=typeof Image<"u"&&Image.prototype.decode,gh=(function(){let n=!1;try{const t=Object.defineProperty({},"passive",{get:function(){n=!0}});window.addEventListener("_",null,t),window.removeEventListener("_",null,t)}catch{}return n})(),X={IDLE:0,LOADING:1,LOADED:2,ERROR:3};function lt(n,t,e,i){let s;return e&&e.length?s=e.shift():ho?s=new OffscreenCanvas(n||300,t||300):s=document.createElement("canvas"),n&&(s.width=n),t&&(s.height=t),s.getContext("2d",i)}let co;function $s(){return co||(co=lt(1,1)),co}function Ks(n){const t=n.canvas;t.width=1,t.height=1,n.clearRect(0,0,1,1)}function Xf(n){let t=n.offsetWidth;const e=getComputedStyle(n);return t+=parseInt(e.marginLeft,10)+parseInt(e.marginRight,10),t}function Yf(n){let t=n.offsetHeight;const e=getComputedStyle(n);return t+=parseInt(e.marginTop,10)+parseInt(e.marginBottom,10),t}function _h(n,t){const e=t.parentNode;e&&e.replaceChild(n,t)}function mh(n){for(;n.lastChild;)n.lastChild.remove()}function $f(n,t){const e=n.childNodes;for(let i=0;;++i){const s=e[i],r=t[i];if(!s&&!r)break;if(s!==r){if(!s){n.appendChild(r);continue}if(!r){n.removeChild(s),--i;continue}n.insertBefore(r,s)}}}const uo=[NaN,NaN,NaN,0];let fo;function Kf(){return fo||(fo=lt(1,1,void 0,{willReadFrequently:!0,desynchronized:!0})),fo}const Bf=/^rgba?\(\s*(\d+%?)\s+(\d+%?)\s+(\d+%?)(?:\s*\/\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,Zf=/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,Uf=/^rgba?\(\s*(\d+%)\s*,\s*(\d+%)\s*,\s*(\d+%)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,Vf=/^#([\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$/i;function Bs(n,t){return n.endsWith("%")?Number(n.substring(0,n.length-1))/t:Number(n)}function Fn(n){throw new Error('failed to parse "'+n+'" as color')}function ph(n){if(n.toLowerCase().startsWith("rgb")){const r=n.match(Zf)||n.match(Bf)||n.match(Uf);if(r){const o=r[4],a=100/255;return[st(Bs(r[1],a)+.5|0,0,255),st(Bs(r[2],a)+.5|0,0,255),st(Bs(r[3],a)+.5|0,0,255),o!==void 0?st(Bs(o,100),0,1):1]}Fn(n)}if(n.startsWith("#")){if(Vf.test(n)){const r=n.substring(1),o=r.length<=4?1:2,a=[0,0,0,255];for(let l=0,h=r.length;l<h;l+=o){let c=parseInt(r.substring(l,l+o),16);o===1&&(c+=c<<4),a[l/o]=c}return a[3]=a[3]/255,a}Fn(n)}const t=Kf();t.fillStyle="#abcdef";let e=t.fillStyle;t.fillStyle=n,t.fillStyle===e&&(t.fillStyle="#fedcba",e=t.fillStyle,t.fillStyle=n,t.fillStyle===e&&Fn(n));const i=t.fillStyle;if(i.startsWith("#")||i.startsWith("rgba"))return ph(i);t.clearRect(0,0,1,1),t.fillRect(0,0,1,1);const s=Array.from(t.getImageData(0,0,1,1).data);return s[3]=Ms(s[3]/255,3),s}function jf(n){return typeof n=="string"?n:Eo(n)}const Hf=1024,kn={};let go=0;function qf(n){if(n.length===4)return n;const t=n.slice();return t[3]=1,t}function _o(n){return n>.0031308?Math.pow(n,1/2.4)*269.025-14.025:n*3294.6}function mo(n){return n>.2068965?Math.pow(n,3):(n-4/29)*(108/841)}function po(n){return n>10.314724?Math.pow((n+14.025)/269.025,2.4):n/3294.6}function yo(n){return n>.0088564?Math.pow(n,1/3):n/(108/841)+4/29}function yh(n){const t=po(n[0]),e=po(n[1]),i=po(n[2]),s=yo(t*.222488403+e*.716873169+i*.06060791),r=500*(yo(t*.452247074+e*.399439023+i*.148375274)-s),o=200*(s-yo(t*.016863605+e*.117638439+i*.865350722)),a=Math.atan2(o,r)*(180/Math.PI);return[116*s-16,Math.sqrt(r*r+o*o),a<0?a+360:a,n[3]]}function Jf(n){const t=(n[0]+16)/116,e=n[1],i=n[2]*Math.PI/180,s=mo(t),r=mo(t+e/500*Math.cos(i)),o=mo(t-e/200*Math.sin(i)),a=_o(r*3.021973625-s*1.617392459-o*.404875592),l=_o(r*-.943766287+s*1.916279586+o*.027607165),h=_o(r*.069407491-s*.22898585+o*1.159737864);return[st(a+.5|0,0,255),st(l+.5|0,0,255),st(h+.5|0,0,255),n[3]]}function xo(n){if(n==="none")return uo;if(kn.hasOwnProperty(n))return kn[n];if(go>=Hf){let e=0;for(const i in kn)(e++&3)===0&&(delete kn[i],--go)}const t=ph(n);t.length!==4&&Fn(n);for(const e of t)isNaN(e)&&Fn(n);return kn[n]=t,++go,t}function Ui(n){return Array.isArray(n)?n:xo(n)}function Eo(n){let t=n[0];t!=(t|0)&&(t=t+.5|0);let e=n[1];e!=(e|0)&&(e=e+.5|0);let i=n[2];i!=(i|0)&&(i=i+.5|0);const s=n[3]===void 0?1:Math.round(n[3]*1e3)/1e3;return"rgba("+t+","+e+","+i+","+s+")"}function Qf(n,t,e){const i=n;let s=!0,r=!1,o=!1;const a=[Rs(i,z.LOAD,function(){o=!0,r||t()})];return i.src&&fh?(r=!0,i.decode().then(function(){s&&t()}).catch(function(l){s&&(o?t():e())})):a.push(Rs(i,z.ERROR,e)),function(){s=!1,a.forEach(nt)}}function tg(n,t){return new Promise((e,i)=>{function s(){o(),e(n)}function r(){o(),i(new Error("Image load error"))}function o(){n.removeEventListener("load",s),n.removeEventListener("error",r)}n.addEventListener("load",s),n.addEventListener("error",r)})}function eg(n,t){return t&&(n.src=t),n.src&&fh?new Promise((e,i)=>n.decode().then(()=>e(n)).catch(s=>n.complete&&n.width?e(n):i(s))):tg(n)}class ig{constructor(){this.cache_={},this.patternCache_={},this.cacheSize_=0,this.maxCacheSize_=1024}clear(){this.cache_={},this.patternCache_={},this.cacheSize_=0}canExpireCache(){return this.cacheSize_>this.maxCacheSize_}expire(){if(this.canExpireCache()){let t=0;for(const e in this.cache_){const i=this.cache_[e];(t++&3)===0&&!i.hasListener()&&(delete this.cache_[e],delete this.patternCache_[e],--this.cacheSize_)}}}get(t,e,i){const s=wo(t,e,i);return s in this.cache_?this.cache_[s]:null}getPattern(t,e,i){const s=wo(t,e,i);return s in this.patternCache_?this.patternCache_[s]:null}set(t,e,i,s,r){const o=wo(t,e,i),a=o in this.cache_;this.cache_[o]=s,r&&(s.getImageState()===X.IDLE&&s.load(),s.getImageState()===X.LOADING?s.ready().then(()=>{this.patternCache_[o]=$s().createPattern(s.getImage(1),"repeat")}):this.patternCache_[o]=$s().createPattern(s.getImage(1),"repeat")),a||++this.cacheSize_}setSize(t){this.maxCacheSize_=t,this.expire()}}function wo(n,t,e){const i=e?Ui(e):"null";return t+":"+n+":"+i}const jt=new ig;let Nn=null;class xh extends Cs{constructor(t,e,i,s,r){super(),this.hitDetectionImage_=null,this.image_=t,this.crossOrigin_=i,this.canvas_={},this.color_=r,this.imageState_=s===void 0?X.IDLE:s,this.size_=t&&t.width&&t.height?[t.width,t.height]:null,this.src_=e,this.tainted_,this.ready_=null}initializeImage_(){this.image_=new Image,this.crossOrigin_!==null&&(this.image_.crossOrigin=this.crossOrigin_)}isTainted_(){if(this.tainted_===void 0&&this.imageState_===X.LOADED){Nn||(Nn=lt(1,1,void 0,{willReadFrequently:!0})),Nn.drawImage(this.image_,0,0);try{Nn.getImageData(0,0,1,1),this.tainted_=!1}catch{Nn=null,this.tainted_=!0}}return this.tainted_===!0}dispatchChangeEvent_(){this.dispatchEvent(z.CHANGE)}handleImageError_(){this.imageState_=X.ERROR,this.dispatchChangeEvent_()}handleImageLoad_(){this.imageState_=X.LOADED,this.size_=[this.image_.width,this.image_.height],this.dispatchChangeEvent_()}getImage(t){return this.image_||this.initializeImage_(),this.replaceColor_(t),this.canvas_[t]?this.canvas_[t]:this.image_}getPixelRatio(t){return this.replaceColor_(t),this.canvas_[t]?t:1}getImageState(){return this.imageState_}getHitDetectionImage(){if(this.image_||this.initializeImage_(),!this.hitDetectionImage_)if(this.isTainted_()){const t=this.size_[0],e=this.size_[1],i=lt(t,e);i.fillRect(0,0,t,e),this.hitDetectionImage_=i.canvas}else this.hitDetectionImage_=this.image_;return this.hitDetectionImage_}getSize(){return this.size_}getSrc(){return this.src_}load(){if(this.imageState_===X.IDLE){this.image_||this.initializeImage_(),this.imageState_=X.LOADING;try{this.src_!==void 0&&(this.image_.src=this.src_)}catch{this.handleImageError_()}this.image_ instanceof HTMLImageElement&&eg(this.image_,this.src_).then(t=>{this.image_=t,this.handleImageLoad_()}).catch(this.handleImageError_.bind(this))}}replaceColor_(t){if(!this.color_||this.canvas_[t]||this.imageState_!==X.LOADED)return;const e=this.image_,i=lt(Math.ceil(e.width*t),Math.ceil(e.height*t)),s=i.canvas;i.scale(t,t),i.drawImage(e,0,0),i.globalCompositeOperation="multiply",i.fillStyle=jf(this.color_),i.fillRect(0,0,s.width/t,s.height/t),i.globalCompositeOperation="destination-in",i.drawImage(e,0,0),this.canvas_[t]=s}ready(){return this.ready_||(this.ready_=new Promise(t=>{if(this.imageState_===X.LOADED||this.imageState_===X.ERROR)t();else{const e=()=>{(this.imageState_===X.LOADED||this.imageState_===X.ERROR)&&(this.removeEventListener(z.CHANGE,e),t())};this.addEventListener(z.CHANGE,e)}})),this.ready_}}function vo(n,t,e,i,s,r){let o=t===void 0?void 0:jt.get(t,e,s);return o||(o=new xh(n,n&&"src"in n?n.src||void 0:t,e,i,s),jt.set(t,e,s,o,r)),r&&o&&!jt.getPattern(t,e,s)&&jt.set(t,e,s,o,r),o}function de(n){return n?Array.isArray(n)?Eo(n):typeof n=="object"&&"src"in n?ng(n):n:null}function ng(n){if(!n.offset||!n.size)return jt.getPattern(n.src,"anonymous",n.color);const t=n.src+":"+n.offset,e=jt.getPattern(t,void 0,n.color);if(e)return e;const i=jt.get(n.src,"anonymous",null);if(i.getImageState()!==X.LOADED)return null;const s=lt(n.size[0],n.size[1]);return s.drawImage(i.getImage(1),n.offset[0],n.offset[1],n.size[0],n.size[1],0,0,n.size[0],n.size[1]),vo(s.canvas,t,void 0,X.LOADED,n.color,!0),jt.getPattern(t,void 0,n.color)}class Eh{drawCustom(t,e,i,s,r){}drawGeometry(t){}setStyle(t){}drawCircle(t,e,i){}drawFeature(t,e,i){}drawGeometryCollection(t,e,i){}drawLineString(t,e,i){}drawMultiLineString(t,e,i){}drawMultiPoint(t,e,i){}drawMultiPolygon(t,e,i){}drawPoint(t,e,i){}drawPolygon(t,e,i){}drawText(t,e,i){}setFillStrokeStyle(t,e){}setImageStyle(t,e){}setTextStyle(t,e){}}const Zs="ol-hidden",sg="ol-selectable",Us="ol-unselectable",Co="ol-control",wh="ol-collapsed",rg=new RegExp(["^\\s*(?=(?:(?:[-a-z]+\\s*){0,2}(italic|oblique))?)","(?=(?:(?:[-a-z]+\\s*){0,2}(small-caps))?)","(?=(?:(?:[-a-z]+\\s*){0,2}(bold(?:er)?|lighter|[1-9]00 ))?)","(?:(?:normal|\\1|\\2|\\3)\\s*){0,3}((?:xx?-)?","(?:small|large)|medium|smaller|larger|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx]))","(?:\\s*\\/\\s*(normal|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx])?))",`?\\s*([-,\\"\\'\\sa-z0-9]+?)\\s*$`].join(""),"i"),vh=["style","variant","weight","size","lineHeight","family"],Ro={normal:400,bold:700},To=function(n){const t=n.match(rg);if(!t)return null;const e={lineHeight:"normal",size:"1.2em",style:"normal",weight:"400",variant:"normal"};for(let i=0,s=vh.length;i<s;++i){const r=t[i+1];r!==void 0&&(e[vh[i]]=typeof r=="string"?r.trim():r)}return isNaN(Number(e.weight))&&e.weight in Ro&&(e.weight=Ro[e.weight]),e.families=e.family.split(/,\s?/).map(i=>i.trim().replace(/^['"]|['"]$/g,"")),e},Ch="10px sans-serif",Mt="#000",Vi="round",Ce=[],Re=0,ji="round",Gn=10,zn="#000",Wn="center",Vs="middle",pi=[0,0,0,0],Xn=1,Hi=new ne;let Yn=null,Rh;const Io={},og=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace","ui-rounded","emoji","math","fangsong"]);function ag(n,t,e){return`${n} ${t} 16px "${e}"`}const lg=(function(){let t,e;async function i(r){await e.ready;const o=await e.load(r);if(o.length===0)return!1;const a=To(r),l=a.families[0].toLowerCase(),h=a.weight;return o.some(c=>{const u=c.family.replace(/^['"]|['"]$/g,"").toLowerCase(),d=Ro[c.weight]||c.weight;return u===l&&c.style===a.style&&d==h})}async function s(){await e.ready;let r=!0;const o=Hi.getProperties(),a=Object.keys(o).filter(l=>o[l]<100);for(let l=a.length-1;l>=0;--l){const h=a[l];let c=o[h];c<100&&(await i(h)?(In(Io),Hi.set(h,100)):(c+=10,Hi.set(h,c,!0),c<100&&(r=!1)))}t=void 0,r||(t=setTimeout(s,100))}return async function(r){e||(e=ho?self.fonts:document.fonts);const o=To(r);if(!o)return;const a=o.families;let l=!1;for(const h of a){if(og.has(h))continue;const c=ag(o.style,o.weight,h);Hi.get(c)===void 0&&(Hi.set(c,0,!0),l=!0)}l&&(clearTimeout(t),t=setTimeout(s,100))}})(),hg=(function(){let n;return function(t){let e=Io[t];if(e==null){if(ho){const i=To(t),s=Th(t,"Žg");e=(isNaN(Number(i.lineHeight))?1.2:Number(i.lineHeight))*(s.actualBoundingBoxAscent+s.actualBoundingBoxDescent)}else n||(n=document.createElement("div"),n.innerHTML="M",n.style.minHeight="0",n.style.maxHeight="none",n.style.height="auto",n.style.padding="0",n.style.border="none",n.style.position="absolute",n.style.display="block",n.style.left="-99999px"),n.style.font=t,document.body.appendChild(n),e=n.offsetHeight,document.body.removeChild(n);Io[t]=e}return e}})();function Th(n,t){return Yn||(Yn=lt(1,1)),n!=Rh&&(Yn.font=n,Rh=Yn.font),Yn.measureText(t)}function Ih(n,t){return Th(n,t).width}function Sh(n,t,e){if(t in e)return e[t];const i=t.split(`
|
|
3
|
-
`).reduce((s,r)=>Math.max(s,
|
|
4
|
-
`||h===c){r=Math.max(r,o),s.push(o),o=0,a+=l,l=0;continue}const d=t[h+1]||n.font,f=Ih(d,u);e.push(f),o+=f;const g=hg(d);i.push(g),l=Math.max(l,g)}return{width:r,height:a,widths:e,heights:i,lineWidths:s}}function ug(n,t,e,i,s,r,o,a,l,h,c){n.save(),e!==1&&(n.globalAlpha===void 0?n.globalAlpha=u=>u.globalAlpha*=e:n.globalAlpha*=e),t&&n.transform.apply(n,t),i.contextInstructions?(n.translate(l,h),n.scale(c[0],c[1]),dg(i,n)):c[0]<0||c[1]<0?(n.translate(l,h),n.scale(c[0],c[1]),n.drawImage(i,s,r,o,a,0,0,o,a)):n.drawImage(i,s,r,o,a,l,h,o*c[0],a*c[1]),n.restore()}function dg(n,t){const e=n.contextInstructions;for(let i=0,s=e.length;i<s;i+=2)Array.isArray(e[i+1])?t[e[i]].apply(t,e[i+1]):t[e[i]]=e[i+1]}class fg extends Eh{constructor(t,e,i,s,r,o,a){super(),this.context_=t,this.pixelRatio_=e,this.extent_=i,this.transform_=s,this.transformRotation_=s?Ms(Math.atan2(s[1],s[0]),10):0,this.viewRotation_=r,this.squaredTolerance_=o,this.userTransform_=a,this.contextFillState_=null,this.contextStrokeState_=null,this.contextTextState_=null,this.fillState_=null,this.strokeState_=null,this.image_=null,this.imageAnchorX_=0,this.imageAnchorY_=0,this.imageHeight_=0,this.imageOpacity_=0,this.imageOriginX_=0,this.imageOriginY_=0,this.imageRotateWithView_=!1,this.imageRotation_=0,this.imageScale_=[0,0],this.imageWidth_=0,this.text_="",this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=!1,this.textRotation_=0,this.textScale_=[0,0],this.textFillState_=null,this.textStrokeState_=null,this.textState_=null,this.pixelCoordinates_=[],this.tmpLocalTransform_=se()}drawImages_(t,e,i,s){if(!this.image_)return;const r=Be(t,e,i,s,this.transform_,this.pixelCoordinates_),o=this.context_,a=this.tmpLocalTransform_,l=o.globalAlpha;this.imageOpacity_!=1&&(o.globalAlpha=l*this.imageOpacity_);let h=this.imageRotation_;this.transformRotation_===0&&(h-=this.viewRotation_),this.imageRotateWithView_&&(h+=this.viewRotation_);for(let c=0,u=r.length;c<u;c+=2){const d=r[c]-this.imageAnchorX_,f=r[c+1]-this.imageAnchorY_;if(h!==0||this.imageScale_[0]!=1||this.imageScale_[1]!=1){const g=d+this.imageAnchorX_,m=f+this.imageAnchorY_;ve(a,g,m,1,1,h,-g,-m),o.save(),o.transform.apply(o,a),o.translate(g,m),o.scale(this.imageScale_[0],this.imageScale_[1]),o.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,-this.imageAnchorX_,-this.imageAnchorY_,this.imageWidth_,this.imageHeight_),o.restore()}else o.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,d,f,this.imageWidth_,this.imageHeight_)}this.imageOpacity_!=1&&(o.globalAlpha=l)}drawText_(t,e,i,s){if(!this.textState_||this.text_==="")return;this.textFillState_&&this.setContextFillState_(this.textFillState_),this.textStrokeState_&&this.setContextStrokeState_(this.textStrokeState_),this.setContextTextState_(this.textState_);const r=Be(t,e,i,s,this.transform_,this.pixelCoordinates_),o=this.context_;let a=this.textRotation_;for(this.transformRotation_===0&&(a-=this.viewRotation_),this.textRotateWithView_&&(a+=this.viewRotation_);e<i;e+=s){const l=r[e]+this.textOffsetX_,h=r[e+1]+this.textOffsetY_;a!==0||this.textScale_[0]!=1||this.textScale_[1]!=1?(o.save(),o.translate(l-this.textOffsetX_,h-this.textOffsetY_),o.rotate(a),o.translate(this.textOffsetX_,this.textOffsetY_),o.scale(this.textScale_[0],this.textScale_[1]),this.textStrokeState_&&o.strokeText(this.text_,0,0),this.textFillState_&&o.fillText(this.text_,0,0),o.restore()):(this.textStrokeState_&&o.strokeText(this.text_,l,h),this.textFillState_&&o.fillText(this.text_,l,h))}}moveToLineTo_(t,e,i,s,r){const o=this.context_,a=Be(t,e,i,s,this.transform_,this.pixelCoordinates_);o.moveTo(a[0],a[1]);let l=a.length;r&&(l-=2);for(let h=2;h<l;h+=2)o.lineTo(a[h],a[h+1]);return r&&o.closePath(),i}drawRings_(t,e,i,s){for(let r=0,o=i.length;r<o;++r)e=this.moveToLineTo_(t,e,i[r],s,!0);return e}drawCircle(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!Lt(this.extent_,t.getExtent())){if(this.fillState_||this.strokeState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const e=Cf(t,this.transform_,this.pixelCoordinates_),i=e[2]-e[0],s=e[3]-e[1],r=Math.sqrt(i*i+s*s),o=this.context_;o.beginPath(),o.arc(e[0],e[1],r,0,2*Math.PI),this.fillState_&&o.fill(),this.strokeState_&&o.stroke()}this.text_!==""&&this.drawText_(t.getCenter(),0,2,2)}}setStyle(t){this.setFillStrokeStyle(t.getFill(),t.getStroke()),this.setImageStyle(t.getImage()),this.setTextStyle(t.getText())}setTransform(t){this.transform_=t}drawGeometry(t){switch(t.getType()){case"Point":this.drawPoint(t);break;case"LineString":this.drawLineString(t);break;case"Polygon":this.drawPolygon(t);break;case"MultiPoint":this.drawMultiPoint(t);break;case"MultiLineString":this.drawMultiLineString(t);break;case"MultiPolygon":this.drawMultiPolygon(t);break;case"GeometryCollection":this.drawGeometryCollection(t);break;case"Circle":this.drawCircle(t);break}}drawFeature(t,e){const i=e.getGeometryFunction()(t);i&&(this.setStyle(e),this.drawGeometry(i))}drawGeometryCollection(t){const e=t.getGeometriesArray();for(let i=0,s=e.length;i<s;++i)this.drawGeometry(e[i])}drawPoint(t){this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_));const e=t.getFlatCoordinates(),i=t.getStride();this.image_&&this.drawImages_(e,0,e.length,i),this.text_!==""&&this.drawText_(e,0,e.length,i)}drawMultiPoint(t){this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_));const e=t.getFlatCoordinates(),i=t.getStride();this.image_&&this.drawImages_(e,0,e.length,i),this.text_!==""&&this.drawText_(e,0,e.length,i)}drawLineString(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!Lt(this.extent_,t.getExtent())){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);const e=this.context_,i=t.getFlatCoordinates();e.beginPath(),this.moveToLineTo_(i,0,i.length,t.getStride(),!1),e.stroke()}if(this.text_!==""){const e=t.getFlatMidpoint();this.drawText_(e,0,2,2)}}}drawMultiLineString(t){this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_));const e=t.getExtent();if(Lt(this.extent_,e)){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);const i=this.context_,s=t.getFlatCoordinates();let r=0;const o=t.getEnds(),a=t.getStride();i.beginPath();for(let l=0,h=o.length;l<h;++l)r=this.moveToLineTo_(s,r,o[l],a,!1);i.stroke()}if(this.text_!==""){const i=t.getFlatMidpoints();this.drawText_(i,0,i.length,2)}}}drawPolygon(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!Lt(this.extent_,t.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const e=this.context_;e.beginPath(),this.drawRings_(t.getOrientedFlatCoordinates(),0,t.getEnds(),t.getStride()),this.fillState_&&e.fill(),this.strokeState_&&e.stroke()}if(this.text_!==""){const e=t.getFlatInteriorPoint();this.drawText_(e,0,2,2)}}}drawMultiPolygon(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!Lt(this.extent_,t.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const e=this.context_,i=t.getOrientedFlatCoordinates();let s=0;const r=t.getEndss(),o=t.getStride();e.beginPath();for(let a=0,l=r.length;a<l;++a){const h=r[a];s=this.drawRings_(i,s,h,o)}this.fillState_&&e.fill(),this.strokeState_&&e.stroke()}if(this.text_!==""){const e=t.getFlatInteriorPoints();this.drawText_(e,0,e.length,2)}}}setContextFillState_(t){const e=this.context_,i=this.contextFillState_;i?i.fillStyle!=t.fillStyle&&(i.fillStyle=t.fillStyle,e.fillStyle=t.fillStyle):(e.fillStyle=t.fillStyle,this.contextFillState_={fillStyle:t.fillStyle})}setContextStrokeState_(t){const e=this.context_,i=this.contextStrokeState_;i?(i.lineCap!=t.lineCap&&(i.lineCap=t.lineCap,e.lineCap=t.lineCap),Xe(i.lineDash,t.lineDash)||e.setLineDash(i.lineDash=t.lineDash),i.lineDashOffset!=t.lineDashOffset&&(i.lineDashOffset=t.lineDashOffset,e.lineDashOffset=t.lineDashOffset),i.lineJoin!=t.lineJoin&&(i.lineJoin=t.lineJoin,e.lineJoin=t.lineJoin),i.lineWidth!=t.lineWidth&&(i.lineWidth=t.lineWidth,e.lineWidth=t.lineWidth),i.miterLimit!=t.miterLimit&&(i.miterLimit=t.miterLimit,e.miterLimit=t.miterLimit),i.strokeStyle!=t.strokeStyle&&(i.strokeStyle=t.strokeStyle,e.strokeStyle=t.strokeStyle)):(e.lineCap=t.lineCap,e.setLineDash(t.lineDash),e.lineDashOffset=t.lineDashOffset,e.lineJoin=t.lineJoin,e.lineWidth=t.lineWidth,e.miterLimit=t.miterLimit,e.strokeStyle=t.strokeStyle,this.contextStrokeState_={lineCap:t.lineCap,lineDash:t.lineDash,lineDashOffset:t.lineDashOffset,lineJoin:t.lineJoin,lineWidth:t.lineWidth,miterLimit:t.miterLimit,strokeStyle:t.strokeStyle})}setContextTextState_(t){const e=this.context_,i=this.contextTextState_,s=t.textAlign?t.textAlign:Wn;i?(i.font!=t.font&&(i.font=t.font,e.font=t.font),i.textAlign!=s&&(i.textAlign=s,e.textAlign=s),i.textBaseline!=t.textBaseline&&(i.textBaseline=t.textBaseline,e.textBaseline=t.textBaseline)):(e.font=t.font,e.textAlign=s,e.textBaseline=t.textBaseline,this.contextTextState_={font:t.font,textAlign:s,textBaseline:t.textBaseline})}setFillStrokeStyle(t,e){if(!t)this.fillState_=null;else{const i=t.getColor();this.fillState_={fillStyle:de(i||Mt)}}if(!e)this.strokeState_=null;else{const i=e.getColor(),s=e.getLineCap(),r=e.getLineDash(),o=e.getLineDashOffset(),a=e.getLineJoin(),l=e.getWidth(),h=e.getMiterLimit(),c=r||Ce;this.strokeState_={lineCap:s!==void 0?s:Vi,lineDash:this.pixelRatio_===1?c:c.map(u=>u*this.pixelRatio_),lineDashOffset:(o||Re)*this.pixelRatio_,lineJoin:a!==void 0?a:ji,lineWidth:(l!==void 0?l:Xn)*this.pixelRatio_,miterLimit:h!==void 0?h:Gn,strokeStyle:de(i||zn)}}}setImageStyle(t){let e;if(!t||!(e=t.getSize())){this.image_=null;return}const i=t.getPixelRatio(this.pixelRatio_),s=t.getAnchor(),r=t.getOrigin();this.image_=t.getImage(this.pixelRatio_),this.imageAnchorX_=s[0]*i,this.imageAnchorY_=s[1]*i,this.imageHeight_=e[1]*i,this.imageOpacity_=t.getOpacity(),this.imageOriginX_=r[0],this.imageOriginY_=r[1],this.imageRotateWithView_=t.getRotateWithView(),this.imageRotation_=t.getRotation();const o=t.getScaleArray();this.imageScale_=[o[0]*this.pixelRatio_/i,o[1]*this.pixelRatio_/i],this.imageWidth_=e[0]*i}setTextStyle(t){if(!t)this.text_="";else{const e=t.getFill();if(!e)this.textFillState_=null;else{const f=e.getColor();this.textFillState_={fillStyle:de(f||Mt)}}const i=t.getStroke();if(!i)this.textStrokeState_=null;else{const f=i.getColor(),g=i.getLineCap(),m=i.getLineDash(),_=i.getLineDashOffset(),p=i.getLineJoin(),y=i.getWidth(),v=i.getMiterLimit();this.textStrokeState_={lineCap:g!==void 0?g:Vi,lineDash:m||Ce,lineDashOffset:_||Re,lineJoin:p!==void 0?p:ji,lineWidth:y!==void 0?y:Xn,miterLimit:v!==void 0?v:Gn,strokeStyle:de(f||zn)}}const s=t.getFont(),r=t.getOffsetX(),o=t.getOffsetY(),a=t.getRotateWithView(),l=t.getRotation(),h=t.getScaleArray(),c=t.getText(),u=t.getTextAlign(),d=t.getTextBaseline();this.textState_={font:s!==void 0?s:Ch,textAlign:u!==void 0?u:Wn,textBaseline:d!==void 0?d:Vs},this.text_=c!==void 0?Array.isArray(c)?c.reduce((f,g,m)=>f+=m%2?" ":g,""):c:"",this.textOffsetX_=r!==void 0?this.pixelRatio_*r:0,this.textOffsetY_=o!==void 0?this.pixelRatio_*o:0,this.textRotateWithView_=a!==void 0?a:!1,this.textRotation_=l!==void 0?l:0,this.textScale_=[this.pixelRatio_*h[0],this.pixelRatio_*h[1]]}}}const gg=.5,bh={Point:vg,LineString:xg,Polygon:Rg,MultiPoint:Cg,MultiLineString:Eg,MultiPolygon:wg,GeometryCollection:yg,Circle:mg};function _g(n,t){return parseInt(V(n),10)-parseInt(V(t),10)}function Lh(n,t){const e=Ah(n,t);return e*e}function Ah(n,t){return gg*n/t}function mg(n,t,e,i,s){const r=e.getFill(),o=e.getStroke();if(r||o){const l=n.getBuilder(e.getZIndex(),"Circle");l.setFillStrokeStyle(r,o),l.drawCircle(t,i,s)}const a=e.getText();if(a&&a.getText()){const l=n.getBuilder(e.getZIndex(),"Text");l.setTextStyle(a),l.drawText(t,i)}}function Mh(n,t,e,i,s,r,o,a){const l=[],h=e.getImage();if(h){let d=!0;const f=h.getImageState();f==X.LOADED||f==X.ERROR?d=!1:f==X.IDLE&&h.load(),d&&l.push(h.ready())}const c=e.getFill();c&&c.loading()&&l.push(c.ready());const u=l.length>0;return u&&Promise.all(l).then(()=>s(null)),pg(n,t,e,i,r,o,a),u}function pg(n,t,e,i,s,r,o){const a=e.getGeometryFunction()(t);if(!a)return;const l=a.simplifyTransformed(i,s);if(e.getRenderer())Ph(n,l,e,t,o);else{const c=bh[l.getType()];c(n,l,e,t,o,r)}}function Ph(n,t,e,i,s){if(t.getType()=="GeometryCollection"){const o=t.getGeometries();for(let a=0,l=o.length;a<l;++a)Ph(n,o[a],e,i,s);return}n.getBuilder(e.getZIndex(),"Default").drawCustom(t,i,e.getRenderer(),e.getHitDetectionRenderer(),s)}function yg(n,t,e,i,s,r){const o=t.getGeometriesArray();let a,l;for(a=0,l=o.length;a<l;++a){const h=bh[o[a].getType()];h(n,o[a],e,i,s,r)}}function xg(n,t,e,i,s){const r=e.getStroke();if(r){const a=n.getBuilder(e.getZIndex(),"LineString");a.setFillStrokeStyle(null,r),a.drawLineString(t,i,s)}const o=e.getText();if(o&&o.getText()){const a=n.getBuilder(e.getZIndex(),"Text");a.setTextStyle(o),a.drawText(t,i,s)}}function Eg(n,t,e,i,s){const r=e.getStroke();if(r){const a=n.getBuilder(e.getZIndex(),"LineString");a.setFillStrokeStyle(null,r),a.drawMultiLineString(t,i,s)}const o=e.getText();if(o&&o.getText()){const a=n.getBuilder(e.getZIndex(),"Text");a.setTextStyle(o),a.drawText(t,i,s)}}function wg(n,t,e,i,s){const r=e.getFill(),o=e.getStroke();if(o||r){const l=n.getBuilder(e.getZIndex(),"Polygon");l.setFillStrokeStyle(r,o),l.drawMultiPolygon(t,i,s)}const a=e.getText();if(a&&a.getText()){const l=n.getBuilder(e.getZIndex(),"Text");l.setTextStyle(a),l.drawText(t,i,s)}}function vg(n,t,e,i,s,r){const o=e.getImage(),a=e.getText(),l=a&&a.getText(),h=r&&o&&l?{}:void 0;if(o){if(o.getImageState()!=X.LOADED)return;const c=n.getBuilder(e.getZIndex(),"Image");c.setImageStyle(o,h),c.drawPoint(t,i,s)}if(l){const c=n.getBuilder(e.getZIndex(),"Text");c.setTextStyle(a,h),c.drawText(t,i,s)}}function Cg(n,t,e,i,s,r){const o=e.getImage(),a=o&&o.getOpacity()!==0,l=e.getText(),h=l&&l.getText(),c=r&&a&&h?{}:void 0;if(a){if(o.getImageState()!=X.LOADED)return;const u=n.getBuilder(e.getZIndex(),"Image");u.setImageStyle(o,c),u.drawMultiPoint(t,i,s)}if(h){const u=n.getBuilder(e.getZIndex(),"Text");u.setTextStyle(l,c),u.drawText(t,i,s)}}function Rg(n,t,e,i,s){const r=e.getFill(),o=e.getStroke();if(r||o){const l=n.getBuilder(e.getZIndex(),"Polygon");l.setFillStrokeStyle(r,o),l.drawPolygon(t,i,s)}const a=e.getText();if(a&&a.getText()){const l=n.getBuilder(e.getZIndex(),"Text");l.setTextStyle(a),l.drawText(t,i,s)}}let Tg=!1;function Ig(n,t,e,i,s,r,o){const a=new XMLHttpRequest;a.open("GET",typeof n=="function"?n(e,i,s):n,!0),t.getType()=="arraybuffer"&&(a.responseType="arraybuffer"),a.withCredentials=Tg,a.onload=function(l){if(!a.status||a.status>=200&&a.status<300){const h=t.getType();try{let c;h=="text"||h=="json"?c=a.responseText:h=="xml"?c=a.responseXML||a.responseText:h=="arraybuffer"&&(c=a.response),c?r(t.readFeatures(c,{extent:e,featureProjection:s}),t.readProjection(c)):o()}catch{o()}}else o()},a.onerror=o,a.send()}function Oh(n,t){return function(e,i,s,r,o){Ig(n,t,e,i,s,(a,l)=>{this.addFeatures(a),r!==void 0&&r(a)},()=>{this.changed(),o!==void 0&&o()})}}function Sg(n,t){return[[-1/0,-1/0,1/0,1/0]]}function bg(n,t,e,i){const s=[];let r=zt();for(let o=0,a=e.length;o<a;++o){const l=e[o];r=zr(n,t,l[0],i),s.push((r[0]+r[2])/2,(r[1]+r[3])/2),t=l[l.length-1]}return s}const Dh=se();class re{constructor(t,e,i,s,r,o){this.styleFunction,this.extent_,this.id_=o,this.type_=t,this.flatCoordinates_=e,this.flatInteriorPoints_=null,this.flatMidpoints_=null,this.ends_=i||null,this.properties_=r,this.squaredTolerance_,this.stride_=s,this.simplifiedGeometry_}get(t){return this.properties_[t]}getExtent(){return this.extent_||(this.extent_=this.type_==="Point"?wl(this.flatCoordinates_):zr(this.flatCoordinates_,0,this.flatCoordinates_.length,2)),this.extent_}getFlatInteriorPoint(){if(!this.flatInteriorPoints_){const t=hi(this.getExtent());this.flatInteriorPoints_=ao(this.flatCoordinates_,0,this.ends_,2,t,0)}return this.flatInteriorPoints_}getFlatInteriorPoints(){if(!this.flatInteriorPoints_){const t=Nf(this.flatCoordinates_,this.ends_),e=bg(this.flatCoordinates_,0,t,2);this.flatInteriorPoints_=Pf(this.flatCoordinates_,0,t,2,e)}return this.flatInteriorPoints_}getFlatMidpoint(){return this.flatMidpoints_||(this.flatMidpoints_=uh(this.flatCoordinates_,0,this.flatCoordinates_.length,2,.5)),this.flatMidpoints_}getFlatMidpoints(){if(!this.flatMidpoints_){this.flatMidpoints_=[];const t=this.flatCoordinates_;let e=0;const i=this.ends_;for(let s=0,r=i.length;s<r;++s){const o=i[s],a=uh(t,e,o,2,.5);Fr(this.flatMidpoints_,a),e=o}}return this.flatMidpoints_}getId(){return this.id_}getOrientedFlatCoordinates(){return this.flatCoordinates_}getGeometry(){return this}getSimplifiedGeometry(t){return this}simplifyTransformed(t,e){return this}getProperties(){return this.properties_}getPropertiesInternal(){return this.properties_}getStride(){return this.stride_}getStyleFunction(){return this.styleFunction}getType(){return this.type_}transform(t){t=At(t);const e=t.getExtent(),i=t.getWorldExtent();if(e&&i){const s=Ct(i)/Ct(e);ve(Dh,i[0],i[3],s,-s,0,0,0),Be(this.flatCoordinates_,0,this.flatCoordinates_.length,2,Dh,this.flatCoordinates_)}}applyTransform(t){t(this.flatCoordinates_,this.flatCoordinates_,this.stride_)}clone(){return new re(this.type_,this.flatCoordinates_.slice(),this.ends_?.slice(),this.stride_,Object.assign({},this.properties_),this.id_)}getEnds(){return this.ends_}enableSimplifyTransformed(){return this.simplifyTransformed=gl((t,e)=>{if(t===this.squaredTolerance_)return this.simplifiedGeometry_;this.simplifiedGeometry_=this.clone(),e&&this.simplifiedGeometry_.applyTransform(e);const i=this.simplifiedGeometry_.getFlatCoordinates();let s;switch(this.type_){case"LineString":i.length=oo(i,0,this.simplifiedGeometry_.flatCoordinates_.length,this.simplifiedGeometry_.stride_,t,i,0),s=[i.length];break;case"MultiLineString":s=[],i.length=Lf(i,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,t,i,0,s);break;case"Polygon":s=[],i.length=rh(i,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,Math.sqrt(t),i,0,s);break}return s&&(this.simplifiedGeometry_=new re(this.type_,i,s,2,this.properties_,this.id_)),this.squaredTolerance_=t,this.simplifiedGeometry_}),this}}re.prototype.getFlatCoordinates=re.prototype.getOrientedFlatCoordinates;function Fh(n,t,e=0,i=n.length-1,s=Lg){for(;i>e;){if(i-e>600){const l=i-e+1,h=t-e+1,c=Math.log(l),u=.5*Math.exp(2*c/3),d=.5*Math.sqrt(c*u*(l-u)/l)*(h-l/2<0?-1:1),f=Math.max(e,Math.floor(t-h*u/l+d)),g=Math.min(i,Math.floor(t+(l-h)*u/l+d));Fh(n,t,f,g,s)}const r=n[t];let o=e,a=i;for($n(n,e,t),s(n[i],r)>0&&$n(n,e,i);o<a;){for($n(n,o,a),o++,a--;s(n[o],r)<0;)o++;for(;s(n[a],r)>0;)a--}s(n[e],r)===0?$n(n,e,a):(a++,$n(n,a,i)),a<=t&&(e=a+1),t<=a&&(i=a-1)}}function $n(n,t,e){const i=n[t];n[t]=n[e],n[e]=i}function Lg(n,t){return n<t?-1:n>t?1:0}let kh=class{constructor(t=9){this._maxEntries=Math.max(4,t),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4)),this.clear()}all(){return this._all(this.data,[])}search(t){let e=this.data;const i=[];if(!Hs(t,e))return i;const s=this.toBBox,r=[];for(;e;){for(let o=0;o<e.children.length;o++){const a=e.children[o],l=e.leaf?s(a):a;Hs(t,l)&&(e.leaf?i.push(a):bo(t,l)?this._all(a,i):r.push(a))}e=r.pop()}return i}collides(t){let e=this.data;if(!Hs(t,e))return!1;const i=[];for(;e;){for(let s=0;s<e.children.length;s++){const r=e.children[s],o=e.leaf?this.toBBox(r):r;if(Hs(t,o)){if(e.leaf||bo(t,o))return!0;i.push(r)}}e=i.pop()}return!1}load(t){if(!(t&&t.length))return this;if(t.length<this._minEntries){for(let i=0;i<t.length;i++)this.insert(t[i]);return this}let e=this._build(t.slice(),0,t.length-1,0);if(!this.data.children.length)this.data=e;else if(this.data.height===e.height)this._splitRoot(this.data,e);else{if(this.data.height<e.height){const i=this.data;this.data=e,e=i}this._insert(e,this.data.height-e.height-1,!0)}return this}insert(t){return t&&this._insert(t,this.data.height-1),this}clear(){return this.data=Ji([]),this}remove(t,e){if(!t)return this;let i=this.data;const s=this.toBBox(t),r=[],o=[];let a,l,h;for(;i||r.length;){if(i||(i=r.pop(),l=r[r.length-1],a=o.pop(),h=!0),i.leaf){const c=Ag(t,i.children,e);if(c!==-1)return i.children.splice(c,1),r.push(i),this._condense(r),this}!h&&!i.leaf&&bo(i,s)?(r.push(i),o.push(a),a=0,l=i,i=i.children[0]):l?(a++,i=l.children[a],h=!1):i=null}return this}toBBox(t){return t}compareMinX(t,e){return t.minX-e.minX}compareMinY(t,e){return t.minY-e.minY}toJSON(){return this.data}fromJSON(t){return this.data=t,this}_all(t,e){const i=[];for(;t;)t.leaf?e.push(...t.children):i.push(...t.children),t=i.pop();return e}_build(t,e,i,s){const r=i-e+1;let o=this._maxEntries,a;if(r<=o)return a=Ji(t.slice(e,i+1)),qi(a,this.toBBox),a;s||(s=Math.ceil(Math.log(r)/Math.log(o)),o=Math.ceil(r/Math.pow(o,s-1))),a=Ji([]),a.leaf=!1,a.height=s;const l=Math.ceil(r/o),h=l*Math.ceil(Math.sqrt(o));Nh(t,e,i,h,this.compareMinX);for(let c=e;c<=i;c+=h){const u=Math.min(c+h-1,i);Nh(t,c,u,l,this.compareMinY);for(let d=c;d<=u;d+=l){const f=Math.min(d+l-1,u);a.children.push(this._build(t,d,f,s-1))}}return qi(a,this.toBBox),a}_chooseSubtree(t,e,i,s){for(;s.push(e),!(e.leaf||s.length-1===i);){let r=1/0,o=1/0,a;for(let l=0;l<e.children.length;l++){const h=e.children[l],c=So(h),u=Og(t,h)-c;u<o?(o=u,r=c<r?c:r,a=h):u===o&&c<r&&(r=c,a=h)}e=a||e.children[0]}return e}_insert(t,e,i){const s=i?t:this.toBBox(t),r=[],o=this._chooseSubtree(s,this.data,e,r);for(o.children.push(t),Bn(o,s);e>=0&&r[e].children.length>this._maxEntries;)this._split(r,e),e--;this._adjustParentBBoxes(s,r,e)}_split(t,e){const i=t[e],s=i.children.length,r=this._minEntries;this._chooseSplitAxis(i,r,s);const o=this._chooseSplitIndex(i,r,s),a=Ji(i.children.splice(o,i.children.length-o));a.height=i.height,a.leaf=i.leaf,qi(i,this.toBBox),qi(a,this.toBBox),e?t[e-1].children.push(a):this._splitRoot(i,a)}_splitRoot(t,e){this.data=Ji([t,e]),this.data.height=t.height+1,this.data.leaf=!1,qi(this.data,this.toBBox)}_chooseSplitIndex(t,e,i){let s,r=1/0,o=1/0;for(let a=e;a<=i-e;a++){const l=Kn(t,0,a,this.toBBox),h=Kn(t,a,i,this.toBBox),c=Dg(l,h),u=So(l)+So(h);c<r?(r=c,s=a,o=u<o?u:o):c===r&&u<o&&(o=u,s=a)}return s||i-e}_chooseSplitAxis(t,e,i){const s=t.leaf?this.compareMinX:Mg,r=t.leaf?this.compareMinY:Pg,o=this._allDistMargin(t,e,i,s),a=this._allDistMargin(t,e,i,r);o<a&&t.children.sort(s)}_allDistMargin(t,e,i,s){t.children.sort(s);const r=this.toBBox,o=Kn(t,0,e,r),a=Kn(t,i-e,i,r);let l=js(o)+js(a);for(let h=e;h<i-e;h++){const c=t.children[h];Bn(o,t.leaf?r(c):c),l+=js(o)}for(let h=i-e-1;h>=e;h--){const c=t.children[h];Bn(a,t.leaf?r(c):c),l+=js(a)}return l}_adjustParentBBoxes(t,e,i){for(let s=i;s>=0;s--)Bn(e[s],t)}_condense(t){for(let e=t.length-1,i;e>=0;e--)t[e].children.length===0?e>0?(i=t[e-1].children,i.splice(i.indexOf(t[e]),1)):this.clear():qi(t[e],this.toBBox)}};function Ag(n,t,e){if(!e)return t.indexOf(n);for(let i=0;i<t.length;i++)if(e(n,t[i]))return i;return-1}function qi(n,t){Kn(n,0,n.children.length,t,n)}function Kn(n,t,e,i,s){s||(s=Ji(null)),s.minX=1/0,s.minY=1/0,s.maxX=-1/0,s.maxY=-1/0;for(let r=t;r<e;r++){const o=n.children[r];Bn(s,n.leaf?i(o):o)}return s}function Bn(n,t){return n.minX=Math.min(n.minX,t.minX),n.minY=Math.min(n.minY,t.minY),n.maxX=Math.max(n.maxX,t.maxX),n.maxY=Math.max(n.maxY,t.maxY),n}function Mg(n,t){return n.minX-t.minX}function Pg(n,t){return n.minY-t.minY}function So(n){return(n.maxX-n.minX)*(n.maxY-n.minY)}function js(n){return n.maxX-n.minX+(n.maxY-n.minY)}function Og(n,t){return(Math.max(t.maxX,n.maxX)-Math.min(t.minX,n.minX))*(Math.max(t.maxY,n.maxY)-Math.min(t.minY,n.minY))}function Dg(n,t){const e=Math.max(n.minX,t.minX),i=Math.max(n.minY,t.minY),s=Math.min(n.maxX,t.maxX),r=Math.min(n.maxY,t.maxY);return Math.max(0,s-e)*Math.max(0,r-i)}function bo(n,t){return n.minX<=t.minX&&n.minY<=t.minY&&t.maxX<=n.maxX&&t.maxY<=n.maxY}function Hs(n,t){return t.minX<=n.maxX&&t.minY<=n.maxY&&t.maxX>=n.minX&&t.maxY>=n.minY}function Ji(n){return{children:n,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function Nh(n,t,e,i,s){const r=[t,e];for(;r.length;){if(e=r.pop(),t=r.pop(),e-t<=i)continue;const o=t+Math.ceil((e-t)/i/2)*i;Fh(n,o,t,e,s),r.push(t,o,o,e)}}class Gh{constructor(t){this.rbush_=new kh(t),this.items_={}}insert(t,e){const i={minX:t[0],minY:t[1],maxX:t[2],maxY:t[3],value:e};this.rbush_.insert(i),this.items_[V(e)]=i}load(t,e){const i=new Array(e.length);for(let s=0,r=e.length;s<r;s++){const o=t[s],a=e[s],l={minX:o[0],minY:o[1],maxX:o[2],maxY:o[3],value:a};i[s]=l,this.items_[V(a)]=l}this.rbush_.load(i)}remove(t){const e=V(t),i=this.items_[e];return delete this.items_[e],this.rbush_.remove(i)!==null}update(t,e){const i=this.items_[V(e)],s=[i.minX,i.minY,i.maxX,i.maxY];bn(s,t)||(this.remove(e),this.insert(t,e))}getAll(){return this.rbush_.all().map(function(e){return e.value})}getInExtent(t){const e={minX:t[0],minY:t[1],maxX:t[2],maxY:t[3]};return this.rbush_.search(e).map(function(s){return s.value})}forEach(t){return this.forEach_(this.getAll(),t)}forEachInExtent(t,e){return this.forEach_(this.getInExtent(t),e)}forEach_(t,e){let i;for(let s=0,r=t.length;s<r;s++)if(i=e(t[s]),i)return i;return i}isEmpty(){return Ni(this.items_)}clear(){this.rbush_.clear(),this.items_={}}getExtent(t){const e=this.rbush_.toJSON();return Ye(e.minX,e.minY,e.maxX,e.maxY,t)}concat(t){this.rbush_.load(t.rbush_.all());for(const e in t.items_)this.items_[e]=t.items_[e]}}class zh extends ne{constructor(t){super(),this.projection=At(t.projection),this.attributions_=Wh(t.attributions),this.attributionsCollapsible_=t.attributionsCollapsible??!0,this.loading=!1,this.state_=t.state!==void 0?t.state:"ready",this.wrapX_=t.wrapX!==void 0?t.wrapX:!1,this.interpolate_=!!t.interpolate,this.viewResolver=null,this.viewRejector=null;const e=this;this.viewPromise_=new Promise(function(i,s){e.viewResolver=i,e.viewRejector=s})}getAttributions(){return this.attributions_}getAttributionsCollapsible(){return this.attributionsCollapsible_}getProjection(){return this.projection}getResolutions(t){return null}getView(){return this.viewPromise_}getState(){return this.state_}getWrapX(){return this.wrapX_}getInterpolate(){return this.interpolate_}refresh(){this.changed()}setAttributions(t){this.attributions_=Wh(t),this.changed()}setState(t){this.state_=t,this.changed()}}function Wh(n){return n?typeof n=="function"?n:(Array.isArray(n)||(n=[n]),t=>n):null}const Ht={ADDFEATURE:"addfeature",CHANGEFEATURE:"changefeature",CLEAR:"clear",REMOVEFEATURE:"removefeature",FEATURESLOADSTART:"featuresloadstart",FEATURESLOADEND:"featuresloadend",FEATURESLOADERROR:"featuresloaderror"};class Ze extends Ee{constructor(t,e,i){super(t),this.feature=e,this.features=i}}class Fg extends zh{constructor(t){t=t||{},super({attributions:t.attributions,interpolate:!0,projection:void 0,state:"ready",wrapX:t.wrapX!==void 0?t.wrapX:!0}),this.on,this.once,this.un,this.loader_=Tn,this.format_=t.format||null,this.overlaps_=t.overlaps===void 0?!0:t.overlaps,this.url_=t.url,t.loader!==void 0?this.loader_=t.loader:this.url_!==void 0&&(J(this.format_,"`format` must be set when `url` is set"),this.loader_=Oh(this.url_,this.format_)),this.strategy_=t.strategy!==void 0?t.strategy:Sg;const e=t.useSpatialIndex!==void 0?t.useSpatialIndex:!0;this.featuresRtree_=e?new Gh:null,this.loadedExtentsRtree_=new Gh,this.loadingExtentsCount_=0,this.nullGeometryFeatures_={},this.idIndex_={},this.uidIndex_={},this.featureChangeKeys_={},this.featuresCollection_=null;let i,s;Array.isArray(t.features)?s=t.features:t.features&&(i=t.features,s=i.getArray()),!e&&i===void 0&&(i=new ue(s)),s!==void 0&&this.addFeaturesInternal(s),i!==void 0&&this.bindFeaturesCollection_(i)}addFeature(t){this.addFeatureInternal(t),this.changed()}addFeatureInternal(t){const e=V(t);if(!this.addToIndex_(e,t)){this.featuresCollection_&&this.featuresCollection_.remove(t);return}this.setupChangeEvents_(e,t);const i=t.getGeometry();if(i){const s=i.getExtent();this.featuresRtree_&&this.featuresRtree_.insert(s,t)}else this.nullGeometryFeatures_[e]=t;this.dispatchEvent(new Ze(Ht.ADDFEATURE,t))}setupChangeEvents_(t,e){e instanceof re||(this.featureChangeKeys_[t]=[Z(e,z.CHANGE,this.handleFeatureChange_,this),Z(e,ki.PROPERTYCHANGE,this.handleFeatureChange_,this)])}addToIndex_(t,e){let i=!0;if(e.getId()!==void 0){const s=String(e.getId());if(!(s in this.idIndex_))this.idIndex_[s]=e;else if(e instanceof re){const r=this.idIndex_[s];r instanceof re?Array.isArray(r)?r.push(e):this.idIndex_[s]=[r,e]:i=!1}else i=!1}return i&&(J(!(t in this.uidIndex_),"The passed `feature` was already added to the source"),this.uidIndex_[t]=e),i}addFeatures(t){this.addFeaturesInternal(t),this.changed()}addFeaturesInternal(t){const e=[],i=[],s=[];for(let r=0,o=t.length;r<o;r++){const a=t[r],l=V(a);this.addToIndex_(l,a)&&i.push(a)}for(let r=0,o=i.length;r<o;r++){const a=i[r],l=V(a);this.setupChangeEvents_(l,a);const h=a.getGeometry();if(h){const c=h.getExtent();e.push(c),s.push(a)}else this.nullGeometryFeatures_[l]=a}if(this.featuresRtree_&&this.featuresRtree_.load(e,s),this.hasListener(Ht.ADDFEATURE))for(let r=0,o=i.length;r<o;r++)this.dispatchEvent(new Ze(Ht.ADDFEATURE,i[r]))}bindFeaturesCollection_(t){let e=!1;this.addEventListener(Ht.ADDFEATURE,function(i){e||(e=!0,t.push(i.feature),e=!1)}),this.addEventListener(Ht.REMOVEFEATURE,function(i){e||(e=!0,t.remove(i.feature),e=!1)}),t.addEventListener(bt.ADD,i=>{e||(e=!0,this.addFeature(i.element),e=!1)}),t.addEventListener(bt.REMOVE,i=>{e||(e=!0,this.removeFeature(i.element),e=!1)}),this.featuresCollection_=t}clear(t){if(t){for(const i in this.featureChangeKeys_)this.featureChangeKeys_[i].forEach(nt);this.featuresCollection_||(this.featureChangeKeys_={},this.idIndex_={},this.uidIndex_={})}else if(this.featuresRtree_){this.featuresRtree_.forEach(i=>{this.removeFeatureInternal(i)});for(const i in this.nullGeometryFeatures_)this.removeFeatureInternal(this.nullGeometryFeatures_[i])}this.featuresCollection_&&this.featuresCollection_.clear(),this.featuresRtree_&&this.featuresRtree_.clear(),this.nullGeometryFeatures_={};const e=new Ze(Ht.CLEAR);this.dispatchEvent(e),this.changed()}forEachFeature(t){if(this.featuresRtree_)return this.featuresRtree_.forEach(t);this.featuresCollection_&&this.featuresCollection_.forEach(t)}forEachFeatureAtCoordinateDirect(t,e){const i=[t[0],t[1],t[0],t[1]];return this.forEachFeatureInExtent(i,function(s){const r=s.getGeometry();if(r instanceof re||r.intersectsCoordinate(t))return e(s)})}forEachFeatureInExtent(t,e){if(this.featuresRtree_)return this.featuresRtree_.forEachInExtent(t,e);this.featuresCollection_&&this.featuresCollection_.forEach(e)}forEachFeatureIntersectingExtent(t,e){return this.forEachFeatureInExtent(t,function(i){const s=i.getGeometry();if(s instanceof re||s.intersectsExtent(t)){const r=e(i);if(r)return r}})}getFeaturesCollection(){return this.featuresCollection_}getFeatures(){let t;return this.featuresCollection_?t=this.featuresCollection_.getArray().slice(0):this.featuresRtree_&&(t=this.featuresRtree_.getAll(),Ni(this.nullGeometryFeatures_)||Fr(t,Object.values(this.nullGeometryFeatures_))),t}getFeaturesAtCoordinate(t){const e=[];return this.forEachFeatureAtCoordinateDirect(t,function(i){e.push(i)}),e}getFeaturesInExtent(t,e){if(this.featuresRtree_){if(!(e&&e.canWrapX()&&this.getWrapX()))return this.featuresRtree_.getInExtent(t);const s=Sl(t,e);return[].concat(...s.map(r=>this.featuresRtree_.getInExtent(r)))}return this.featuresCollection_?this.featuresCollection_.getArray().slice(0):[]}getClosestFeatureToCoordinate(t,e){const i=t[0],s=t[1];let r=null;const o=[NaN,NaN];let a=1/0;const l=[-1/0,-1/0,1/0,1/0];return e=e||Rn,this.featuresRtree_.forEachInExtent(l,function(h){if(e(h)){const c=h.getGeometry(),u=a;if(a=c instanceof re?0:c.closestPointXY(i,s,o,a),a<u){r=h;const d=Math.sqrt(a);l[0]=i-d,l[1]=s-d,l[2]=i+d,l[3]=s+d}}}),r}getExtent(t){return this.featuresRtree_.getExtent(t)}getFeatureById(t){const e=this.idIndex_[t.toString()];return e!==void 0?e:null}getFeatureByUid(t){const e=this.uidIndex_[t];return e!==void 0?e:null}getFormat(){return this.format_}getOverlaps(){return this.overlaps_}getUrl(){return this.url_}handleFeatureChange_(t){const e=t.target,i=V(e),s=e.getGeometry();if(!s)i in this.nullGeometryFeatures_||(this.featuresRtree_&&this.featuresRtree_.remove(e),this.nullGeometryFeatures_[i]=e);else{const o=s.getExtent();i in this.nullGeometryFeatures_?(delete this.nullGeometryFeatures_[i],this.featuresRtree_&&this.featuresRtree_.insert(o,e)):this.featuresRtree_&&this.featuresRtree_.update(o,e)}const r=e.getId();if(r!==void 0){const o=r.toString();this.idIndex_[o]!==e&&(this.removeFromIdIndex_(e),this.idIndex_[o]=e)}else this.removeFromIdIndex_(e),this.uidIndex_[i]=e;this.changed(),this.dispatchEvent(new Ze(Ht.CHANGEFEATURE,e))}hasFeature(t){const e=t.getId();return e!==void 0?e in this.idIndex_:V(t)in this.uidIndex_}isEmpty(){return this.featuresRtree_?this.featuresRtree_.isEmpty()&&Ni(this.nullGeometryFeatures_):this.featuresCollection_?this.featuresCollection_.getLength()===0:!0}loadFeatures(t,e,i){const s=this.loadedExtentsRtree_,r=this.strategy_(t,e,i);for(let o=0,a=r.length;o<a;++o){const l=r[o];s.forEachInExtent(l,function(c){return zi(c.extent,l)})||(++this.loadingExtentsCount_,this.dispatchEvent(new Ze(Ht.FEATURESLOADSTART)),this.loader_.call(this,l,e,i,c=>{--this.loadingExtentsCount_,this.dispatchEvent(new Ze(Ht.FEATURESLOADEND,void 0,c))},()=>{--this.loadingExtentsCount_,this.dispatchEvent(new Ze(Ht.FEATURESLOADERROR))}),s.insert(l,{extent:l.slice()}))}this.loading=this.loader_.length<4?!1:this.loadingExtentsCount_>0}refresh(){this.clear(!0),this.loadedExtentsRtree_.clear(),super.refresh()}removeLoadedExtent(t){const e=this.loadedExtentsRtree_,i=e.forEachInExtent(t,function(s){if(bn(s.extent,t))return s});i&&e.remove(i)}removeFeatures(t){let e=!1;for(let i=0,s=t.length;i<s;++i)e=this.removeFeatureInternal(t[i])||e;e&&this.changed()}removeFeature(t){if(!t)return;this.removeFeatureInternal(t)&&this.changed()}removeFeatureInternal(t){const e=V(t);if(!(e in this.uidIndex_))return!1;e in this.nullGeometryFeatures_?delete this.nullGeometryFeatures_[e]:this.featuresRtree_&&this.featuresRtree_.remove(t),this.featureChangeKeys_[e]?.forEach(nt),delete this.featureChangeKeys_[e];const s=t.getId();if(s!==void 0){const r=s.toString(),o=this.idIndex_[r];o===t?delete this.idIndex_[r]:Array.isArray(o)&&(o.splice(o.indexOf(t),1),o.length===1&&(this.idIndex_[r]=o[0]))}return delete this.uidIndex_[e],this.hasListener(Ht.REMOVEFEATURE)&&this.dispatchEvent(new Ze(Ht.REMOVEFEATURE,t)),!0}removeFromIdIndex_(t){for(const e in this.idIndex_)if(this.idIndex_[e]===t){delete this.idIndex_[e];break}}setLoader(t){this.loader_=t}setUrl(t){J(this.format_,"`format` must be set when `url` is set"),this.url_=t,this.setLoader(Oh(t,this.format_))}setOverlaps(t){this.overlaps_=t,this.changed()}}class Zn{constructor(t){t=t||{},this.patternImage_=null,this.color_=null,t.color!==void 0&&this.setColor(t.color)}clone(){const t=this.getColor();return new Zn({color:Array.isArray(t)?t.slice():t||void 0})}getColor(){return this.color_}setColor(t){if(t!==null&&typeof t=="object"&&"src"in t){const e=vo(null,t.src,"anonymous",void 0,t.offset?null:t.color?t.color:null,!(t.offset&&t.size));e.ready().then(()=>{this.patternImage_=null}),e.getImageState()===X.IDLE&&e.load(),e.getImageState()===X.LOADING&&(this.patternImage_=e)}this.color_=t}getKey(){const t=this.getColor();return t?t instanceof CanvasPattern||t instanceof CanvasGradient?V(t):typeof t=="object"&&"src"in t?t.src+":"+t.offset:Ui(t).toString():""}loading(){return!!this.patternImage_}ready(){return this.patternImage_?this.patternImage_.ready():Promise.resolve()}}class qs{constructor(t){t=t||{},this.color_=t.color!==void 0?t.color:null,this.lineCap_=t.lineCap,this.lineDash_=t.lineDash!==void 0?t.lineDash:null,this.lineDashOffset_=t.lineDashOffset,this.lineJoin_=t.lineJoin,this.miterLimit_=t.miterLimit,this.width_=t.width}clone(){const t=this.getColor();return new qs({color:Array.isArray(t)?t.slice():t||void 0,lineCap:this.getLineCap(),lineDash:this.getLineDash()?this.getLineDash().slice():void 0,lineDashOffset:this.getLineDashOffset(),lineJoin:this.getLineJoin(),miterLimit:this.getMiterLimit(),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_}getWidth(){return this.width_}setColor(t){this.color_=t}setLineCap(t){this.lineCap_=t}setLineDash(t){this.lineDash_=t}setLineDashOffset(t){this.lineDashOffset_=t}setLineJoin(t){this.lineJoin_=t}setMiterLimit(t){this.miterLimit_=t}setWidth(t){this.width_=t}}function Xh(n){return n[0]>0&&n[1]>0}function kg(n,t,e){return e===void 0&&(e=[0,0]),e[0]=n[0]*t+.5|0,e[1]=n[1]*t+.5|0,e}function Pt(n,t){return Array.isArray(n)?n:(t===void 0?t=[n,n]:(t[0]=n,t[1]=n),t)}class Js{constructor(t){this.opacity_=t.opacity,this.rotateWithView_=t.rotateWithView,this.rotation_=t.rotation,this.scale_=t.scale,this.scaleArray_=Pt(t.scale),this.displacement_=t.displacement,this.declutterMode_=t.declutterMode}clone(){const t=this.getScale();return new Js({opacity:this.getOpacity(),scale:Array.isArray(t)?t.slice():t,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()})}getOpacity(){return this.opacity_}getRotateWithView(){return this.rotateWithView_}getRotation(){return this.rotation_}getScale(){return this.scale_}getScaleArray(){return this.scaleArray_}getDisplacement(){return this.displacement_}getDeclutterMode(){return this.declutterMode_}getAnchor(){return U()}getImage(t){return U()}getHitDetectionImage(){return U()}getPixelRatio(t){return 1}getImageState(){return U()}getImageSize(){return U()}getOrigin(){return U()}getSize(){return U()}setDisplacement(t){this.displacement_=t}setOpacity(t){this.opacity_=t}setRotateWithView(t){this.rotateWithView_=t}setRotation(t){this.rotation_=t}setScale(t){this.scale_=t,this.scaleArray_=Pt(t)}listenImageChange(t){U()}load(){U()}unlistenImageChange(t){U()}ready(){return Promise.resolve()}}class Qs extends Js{constructor(t){super({opacity:1,rotateWithView:t.rotateWithView!==void 0?t.rotateWithView:!1,rotation:t.rotation!==void 0?t.rotation:0,scale:t.scale!==void 0?t.scale:1,displacement:t.displacement!==void 0?t.displacement:[0,0],declutterMode:t.declutterMode}),this.hitDetectionCanvas_=null,this.fill_=t.fill!==void 0?t.fill:null,this.origin_=[0,0],this.points_=t.points,this.radius=t.radius,this.radius2_=t.radius2,this.angle_=t.angle!==void 0?t.angle:0,this.stroke_=t.stroke!==void 0?t.stroke:null,this.size_,this.renderOptions_,this.imageState_=this.fill_&&this.fill_.loading()?X.LOADING:X.LOADED,this.imageState_===X.LOADING&&this.ready().then(()=>this.imageState_=X.LOADED),this.render()}clone(){const t=this.getScale(),e=new Qs({fill:this.getFill()?this.getFill().clone():void 0,points:this.getPoints(),radius:this.getRadius(),radius2:this.getRadius2(),angle:this.getAngle(),stroke:this.getStroke()?this.getStroke().clone():void 0,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),scale:Array.isArray(t)?t.slice():t,displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()});return e.setOpacity(this.getOpacity()),e}getAnchor(){const t=this.size_,e=this.getDisplacement(),i=this.getScaleArray();return[t[0]/2-e[0]/i[0],t[1]/2+e[1]/i[1]]}getAngle(){return this.angle_}getFill(){return this.fill_}setFill(t){this.fill_=t,this.render()}getHitDetectionImage(){return this.hitDetectionCanvas_||(this.hitDetectionCanvas_=this.createHitDetectionCanvas_(this.renderOptions_)),this.hitDetectionCanvas_}getImage(t){const e=this.fill_?.getKey(),i=`${t},${this.angle_},${this.radius},${this.radius2_},${this.points_},${e}`+Object.values(this.renderOptions_).join(",");let s=jt.get(i,null,null)?.getImage(1);if(!s){const r=this.renderOptions_,o=Math.ceil(r.size*t),a=lt(o,o);this.draw_(r,a,t),s=a.canvas,jt.set(i,null,null,new xh(s,void 0,null,X.LOADED,null))}return s}getPixelRatio(t){return t}getImageSize(){return this.size_}getImageState(){return this.imageState_}getOrigin(){return this.origin_}getPoints(){return this.points_}getRadius(){return this.radius}getRadius2(){return this.radius2_}getSize(){return this.size_}getStroke(){return this.stroke_}setStroke(t){this.stroke_=t,this.render()}listenImageChange(t){}load(){}unlistenImageChange(t){}calculateLineJoinSize_(t,e,i){if(e===0||this.points_===1/0||t!=="bevel"&&t!=="miter")return e;let s=this.radius,r=this.radius2_===void 0?s:this.radius2_;if(s<r){const w=s;s=r,r=w}const o=this.radius2_===void 0?this.points_:this.points_*2,a=2*Math.PI/o,l=r*Math.sin(a),h=Math.sqrt(r*r-l*l),c=s-h,u=Math.sqrt(l*l+c*c),d=u/l;if(t==="miter"&&d<=i)return d*e;const f=e/2/d,g=e/2*(c/u),_=Math.sqrt((s+f)*(s+f)+g*g)-s;if(this.radius2_===void 0||t==="bevel")return _*2;const p=s*Math.sin(a),y=Math.sqrt(s*s-p*p),v=r-y,E=Math.sqrt(p*p+v*v)/p;if(E<=i){const w=E*e/2-r-s;return 2*Math.max(_,w)}return _*2}createRenderOptions(){let t=Vi,e=ji,i=0,s=null,r=0,o,a=0;this.stroke_&&(o=de(this.stroke_.getColor()??zn),a=this.stroke_.getWidth()??Xn,s=this.stroke_.getLineDash(),r=this.stroke_.getLineDashOffset()??0,e=this.stroke_.getLineJoin()??ji,t=this.stroke_.getLineCap()??Vi,i=this.stroke_.getMiterLimit()??Gn);const l=this.calculateLineJoinSize_(e,a,i),h=Math.max(this.radius,this.radius2_||0),c=Math.ceil(2*h+l);return{strokeStyle:o,strokeWidth:a,size:c,lineCap:t,lineDash:s,lineDashOffset:r,lineJoin:e,miterLimit:i}}render(){this.renderOptions_=this.createRenderOptions();const t=this.renderOptions_.size;this.hitDetectionCanvas_=null,this.size_=[t,t]}draw_(t,e,i){if(e.scale(i,i),e.translate(t.size/2,t.size/2),this.createPath_(e),this.fill_){let s=this.fill_.getColor();s===null&&(s=Mt),e.fillStyle=de(s),e.fill()}t.strokeStyle&&(e.strokeStyle=t.strokeStyle,e.lineWidth=t.strokeWidth,t.lineDash&&(e.setLineDash(t.lineDash),e.lineDashOffset=t.lineDashOffset),e.lineCap=t.lineCap,e.lineJoin=t.lineJoin,e.miterLimit=t.miterLimit,e.stroke())}createHitDetectionCanvas_(t){let e;if(this.fill_){let i=this.fill_.getColor(),s=0;typeof i=="string"&&(i=Ui(i)),i===null?s=1:Array.isArray(i)&&(s=i.length===4?i[3]:1),s===0&&(e=lt(t.size,t.size),this.drawHitDetectionCanvas_(t,e))}return e?e.canvas:this.getImage(1)}createPath_(t){let e=this.points_;const i=this.radius;if(e===1/0)t.arc(0,0,i,0,2*Math.PI);else{const s=this.radius2_===void 0?i:this.radius2_;this.radius2_!==void 0&&(e*=2);const r=this.angle_-Math.PI/2,o=2*Math.PI/e;for(let a=0;a<e;a++){const l=r+a*o,h=a%2===0?i:s;t.lineTo(h*Math.cos(l),h*Math.sin(l))}t.closePath()}}drawHitDetectionCanvas_(t,e){e.translate(t.size/2,t.size/2),this.createPath_(e),e.fillStyle=Mt,e.fill(),t.strokeStyle&&(e.strokeStyle=t.strokeStyle,e.lineWidth=t.strokeWidth,t.lineDash&&(e.setLineDash(t.lineDash),e.lineDashOffset=t.lineDashOffset),e.lineJoin=t.lineJoin,e.miterLimit=t.miterLimit,e.stroke())}ready(){return this.fill_?this.fill_.ready():Promise.resolve()}}class tr extends Qs{constructor(t){t=t||{radius:5},super({points:1/0,fill:t.fill,radius:t.radius,stroke:t.stroke,scale:t.scale!==void 0?t.scale:1,rotation:t.rotation!==void 0?t.rotation:0,rotateWithView:t.rotateWithView!==void 0?t.rotateWithView:!1,displacement:t.displacement!==void 0?t.displacement:[0,0],declutterMode:t.declutterMode})}clone(){const t=this.getScale(),e=new tr({fill:this.getFill()?this.getFill().clone():void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,radius:this.getRadius(),scale:Array.isArray(t)?t.slice():t,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()});return e.setOpacity(this.getOpacity()),e}setRadius(t){this.radius=t,this.render()}}class Te{constructor(t){t=t||{},this.geometry_=null,this.geometryFunction_=$h,t.geometry!==void 0&&this.setGeometry(t.geometry),this.fill_=t.fill!==void 0?t.fill:null,this.image_=t.image!==void 0?t.image:null,this.renderer_=t.renderer!==void 0?t.renderer:null,this.hitDetectionRenderer_=t.hitDetectionRenderer!==void 0?t.hitDetectionRenderer:null,this.stroke_=t.stroke!==void 0?t.stroke:null,this.text_=t.text!==void 0?t.text:null,this.zIndex_=t.zIndex}clone(){let t=this.getGeometry();return t&&typeof t=="object"&&(t=t.clone()),new Te({geometry:t??void 0,fill:this.getFill()?this.getFill().clone():void 0,image:this.getImage()?this.getImage().clone():void 0,renderer:this.getRenderer()??void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,text:this.getText()?this.getText().clone():void 0,zIndex:this.getZIndex()})}getRenderer(){return this.renderer_}setRenderer(t){this.renderer_=t}setHitDetectionRenderer(t){this.hitDetectionRenderer_=t}getHitDetectionRenderer(){return this.hitDetectionRenderer_}getGeometry(){return this.geometry_}getGeometryFunction(){return this.geometryFunction_}getFill(){return this.fill_}setFill(t){this.fill_=t}getImage(){return this.image_}setImage(t){this.image_=t}getStroke(){return this.stroke_}setStroke(t){this.stroke_=t}getText(){return this.text_}setText(t){this.text_=t}getZIndex(){return this.zIndex_}setGeometry(t){typeof t=="function"?this.geometryFunction_=t:typeof t=="string"?this.geometryFunction_=function(e){return e.get(t)}:t?t!==void 0&&(this.geometryFunction_=function(){return t}):this.geometryFunction_=$h,this.geometry_=t}setZIndex(t){this.zIndex_=t}}function Ng(n){let t;if(typeof n=="function")t=n;else{let e;Array.isArray(n)?e=n:(J(typeof n.getZIndex=="function","Expected an `Style` or an array of `Style`"),e=[n]),t=function(){return e}}return t}let Lo=null;function Yh(n,t){if(!Lo){const e=new Zn({color:"rgba(255,255,255,0.4)"}),i=new qs({color:"#3399CC",width:1.25});Lo=[new Te({image:new tr({fill:e,stroke:i,radius:5}),fill:e,stroke:i})]}return Lo}function $h(n){return n.getGeometry()}const Gg="#333";let zg=class Hc{constructor(t){t=t||{},this.font_=t.font,this.rotation_=t.rotation,this.rotateWithView_=t.rotateWithView,this.keepUpright_=t.keepUpright,this.scale_=t.scale,this.scaleArray_=Pt(t.scale!==void 0?t.scale:1),this.text_=t.text,this.textAlign_=t.textAlign,this.justify_=t.justify,this.repeat_=t.repeat,this.textBaseline_=t.textBaseline,this.fill_=t.fill!==void 0?t.fill:new Zn({color:Gg}),this.maxAngle_=t.maxAngle!==void 0?t.maxAngle:Math.PI/4,this.placement_=t.placement!==void 0?t.placement:"point",this.overflow_=!!t.overflow,this.stroke_=t.stroke!==void 0?t.stroke:null,this.offsetX_=t.offsetX!==void 0?t.offsetX:0,this.offsetY_=t.offsetY!==void 0?t.offsetY:0,this.backgroundFill_=t.backgroundFill?t.backgroundFill:null,this.backgroundStroke_=t.backgroundStroke?t.backgroundStroke:null,this.padding_=t.padding===void 0?null:t.padding,this.declutterMode_=t.declutterMode}clone(){const t=this.getScale();return new Hc({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()?this.getFill().clone():void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,offsetX:this.getOffsetX(),offsetY:this.getOffsetY(),backgroundFill:this.getBackgroundFill()?this.getBackgroundFill().clone():void 0,backgroundStroke:this.getBackgroundStroke()?this.getBackgroundStroke().clone():void 0,padding:this.getPadding()||void 0,declutterMode:this.getDeclutterMode()})}getOverflow(){return this.overflow_}getFont(){return this.font_}getMaxAngle(){return this.maxAngle_}getPlacement(){return this.placement_}getRepeat(){return this.repeat_}getOffsetX(){return this.offsetX_}getOffsetY(){return this.offsetY_}getFill(){return this.fill_}getRotateWithView(){return this.rotateWithView_}getKeepUpright(){return this.keepUpright_}getRotation(){return this.rotation_}getScale(){return this.scale_}getScaleArray(){return this.scaleArray_}getStroke(){return this.stroke_}getText(){return this.text_}getTextAlign(){return this.textAlign_}getJustify(){return this.justify_}getTextBaseline(){return this.textBaseline_}getBackgroundFill(){return this.backgroundFill_}getBackgroundStroke(){return this.backgroundStroke_}getPadding(){return this.padding_}getDeclutterMode(){return this.declutterMode_}setOverflow(t){this.overflow_=t}setFont(t){this.font_=t}setMaxAngle(t){this.maxAngle_=t}setOffsetX(t){this.offsetX_=t}setOffsetY(t){this.offsetY_=t}setPlacement(t){this.placement_=t}setRepeat(t){this.repeat_=t}setRotateWithView(t){this.rotateWithView_=t}setKeepUpright(t){this.keepUpright_=t}setFill(t){this.fill_=t}setRotation(t){this.rotation_=t}setScale(t){this.scale_=t,this.scaleArray_=Pt(t!==void 0?t:1)}setStroke(t){this.stroke_=t}setText(t){this.text_=t}setTextAlign(t){this.textAlign_=t}setJustify(t){this.justify_=t}setTextBaseline(t){this.textBaseline_=t}setBackgroundFill(t){this.backgroundFill_=t}setBackgroundStroke(t){this.backgroundStroke_=t}setPadding(t){this.padding_=t}};const _t={ANIMATING:0,INTERACTING:1},O={BEGIN_GEOMETRY:0,BEGIN_PATH:1,CIRCLE:2,CLOSE_PATH:3,CUSTOM:4,DRAW_CHARS:5,DRAW_IMAGE:6,END_GEOMETRY:7,FILL:8,MOVE_TO_LINE_TO:9,SET_FILL_STYLE:10,SET_STROKE_STYLE:11,STROKE:12},er=[O.FILL],Ue=[O.STROKE],yi=[O.BEGIN_PATH],Kh=[O.CLOSE_PATH];class Un extends Eh{constructor(t,e,i,s){super(),this.tolerance=t,this.maxExtent=e,this.pixelRatio=s,this.maxLineWidth=0,this.resolution=i,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_=null,this.bufferedMaxExtent_=null,this.instructions=[],this.coordinates=[],this.tmpCoordinate_=[],this.hitDetectionInstructions=[],this.state={}}applyPixelRatio(t){const e=this.pixelRatio;return e==1?t:t.map(function(i){return i*e})}appendFlatPointCoordinates(t,e){const i=this.getBufferedMaxExtent(),s=this.tmpCoordinate_,r=this.coordinates;let o=r.length;for(let a=0,l=t.length;a<l;a+=e)s[0]=t[a],s[1]=t[a+1],Gi(i,s)&&(r[o++]=s[0],r[o++]=s[1]);return o}appendFlatLineCoordinates(t,e,i,s,r,o){const a=this.coordinates;let l=a.length;const h=this.getBufferedMaxExtent();o&&(e+=s);let c=t[e],u=t[e+1];const d=this.tmpCoordinate_;let f=!0,g,m,_;for(g=e+s;g<i;g+=s)d[0]=t[g],d[1]=t[g+1],_=Gr(h,d),_!==m?(f&&(a[l++]=c,a[l++]=u,f=!1),a[l++]=d[0],a[l++]=d[1]):_===ut.INTERSECTING?(a[l++]=d[0],a[l++]=d[1],f=!1):f=!0,c=d[0],u=d[1],m=_;return(r&&f||g===e+s)&&(a[l++]=c,a[l++]=u),l}drawCustomCoordinates_(t,e,i,s,r){for(let o=0,a=i.length;o<a;++o){const l=i[o],h=this.appendFlatLineCoordinates(t,e,l,s,!1,!1);r.push(h),e=l}return e}drawCustom(t,e,i,s,r){this.beginGeometry(t,e,r);const o=t.getType(),a=t.getStride(),l=this.coordinates.length;let h,c,u,d,f;switch(o){case"MultiPolygon":h=t.getOrientedFlatCoordinates(),d=[];const g=t.getEndss();f=0;for(let m=0,_=g.length;m<_;++m){const p=[];f=this.drawCustomCoordinates_(h,f,g[m],a,p),d.push(p)}this.instructions.push([O.CUSTOM,l,d,t,i,sh,r]),this.hitDetectionInstructions.push([O.CUSTOM,l,d,t,s||i,sh,r]);break;case"Polygon":case"MultiLineString":u=[],h=o=="Polygon"?t.getOrientedFlatCoordinates():t.getFlatCoordinates(),f=this.drawCustomCoordinates_(h,0,t.getEnds(),a,u),this.instructions.push([O.CUSTOM,l,u,t,i,Xs,r]),this.hitDetectionInstructions.push([O.CUSTOM,l,u,t,s||i,Xs,r]);break;case"LineString":case"Circle":h=t.getFlatCoordinates(),c=this.appendFlatLineCoordinates(h,0,h.length,a,!1,!1),this.instructions.push([O.CUSTOM,l,c,t,i,Zi,r]),this.hitDetectionInstructions.push([O.CUSTOM,l,c,t,s||i,Zi,r]);break;case"MultiPoint":h=t.getFlatCoordinates(),c=this.appendFlatPointCoordinates(h,a),c>l&&(this.instructions.push([O.CUSTOM,l,c,t,i,Zi,r]),this.hitDetectionInstructions.push([O.CUSTOM,l,c,t,s||i,Zi,r]));break;case"Point":h=t.getFlatCoordinates(),this.coordinates.push(h[0],h[1]),c=this.coordinates.length,this.instructions.push([O.CUSTOM,l,c,t,i,void 0,r]),this.hitDetectionInstructions.push([O.CUSTOM,l,c,t,s||i,void 0,r]);break}this.endGeometry(e)}beginGeometry(t,e,i){this.beginGeometryInstruction1_=[O.BEGIN_GEOMETRY,e,0,t,i],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[O.BEGIN_GEOMETRY,e,0,t,i],this.hitDetectionInstructions.push(this.beginGeometryInstruction2_)}finish(){return{instructions:this.instructions,hitDetectionInstructions:this.hitDetectionInstructions,coordinates:this.coordinates}}reverseHitDetectionInstructions(){const t=this.hitDetectionInstructions;t.reverse();let e;const i=t.length;let s,r,o=-1;for(e=0;e<i;++e)s=t[e],r=s[0],r==O.END_GEOMETRY?o=e:r==O.BEGIN_GEOMETRY&&(s[2]=e,vd(this.hitDetectionInstructions,o,e),o=-1)}fillStyleToState(t,e={}){if(t){const i=t.getColor();e.fillPatternScale=i&&typeof i=="object"&&"src"in i?this.pixelRatio:1,e.fillStyle=de(i||Mt)}else e.fillStyle=void 0;return e}strokeStyleToState(t,e={}){if(t){const i=t.getColor();e.strokeStyle=de(i||zn);const s=t.getLineCap();e.lineCap=s!==void 0?s:Vi;const r=t.getLineDash();e.lineDash=r?r.slice():Ce;const o=t.getLineDashOffset();e.lineDashOffset=o||Re;const a=t.getLineJoin();e.lineJoin=a!==void 0?a:ji;const l=t.getWidth();e.lineWidth=l!==void 0?l:Xn;const h=t.getMiterLimit();e.miterLimit=h!==void 0?h:Gn,e.lineWidth>this.maxLineWidth&&(this.maxLineWidth=e.lineWidth,this.bufferedMaxExtent_=null)}else e.strokeStyle=void 0,e.lineCap=void 0,e.lineDash=null,e.lineDashOffset=void 0,e.lineJoin=void 0,e.lineWidth=void 0,e.miterLimit=void 0;return e}setFillStrokeStyle(t,e){const i=this.state;this.fillStyleToState(t,i),this.strokeStyleToState(e,i)}createFill(t){const e=t.fillStyle,i=[O.SET_FILL_STYLE,e];return typeof e!="string"&&i.push(t.fillPatternScale),i}applyStroke(t){this.instructions.push(this.createStroke(t))}createStroke(t){return[O.SET_STROKE_STYLE,t.strokeStyle,t.lineWidth*this.pixelRatio,t.lineCap,t.lineJoin,t.miterLimit,t.lineDash?this.applyPixelRatio(t.lineDash):null,t.lineDashOffset*this.pixelRatio]}updateFillStyle(t,e){const i=t.fillStyle;(typeof i!="string"||t.currentFillStyle!=i)&&(this.instructions.push(e.call(this,t)),t.currentFillStyle=i)}updateStrokeStyle(t,e){const i=t.strokeStyle,s=t.lineCap,r=t.lineDash,o=t.lineDashOffset,a=t.lineJoin,l=t.lineWidth,h=t.miterLimit;(t.currentStrokeStyle!=i||t.currentLineCap!=s||r!=t.currentLineDash&&!Xe(t.currentLineDash,r)||t.currentLineDashOffset!=o||t.currentLineJoin!=a||t.currentLineWidth!=l||t.currentMiterLimit!=h)&&(e.call(this,t),t.currentStrokeStyle=i,t.currentLineCap=s,t.currentLineDash=r,t.currentLineDashOffset=o,t.currentLineJoin=a,t.currentLineWidth=l,t.currentMiterLimit=h)}endGeometry(t){this.beginGeometryInstruction1_[2]=this.instructions.length,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_[2]=this.hitDetectionInstructions.length,this.beginGeometryInstruction2_=null;const e=[O.END_GEOMETRY,t];this.instructions.push(e),this.hitDetectionInstructions.push(e)}getBufferedMaxExtent(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=yl(this.maxExtent),this.maxLineWidth>0)){const t=this.resolution*(this.maxLineWidth+1)/2;Nr(this.bufferedMaxExtent_,t,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_}}class Wg extends Un{constructor(t,e,i,s){super(t,e,i,s),this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.anchorX_=void 0,this.anchorY_=void 0,this.height_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.scale_=void 0,this.width_=void 0,this.declutterMode_=void 0,this.declutterImageWithText_=void 0}drawPoint(t,e,i){if(!this.image_||this.maxExtent&&!Gi(this.maxExtent,t.getFlatCoordinates()))return;this.beginGeometry(t,e,i);const s=t.getFlatCoordinates(),r=t.getStride(),o=this.coordinates.length,a=this.appendFlatPointCoordinates(s,r);this.instructions.push([O.DRAW_IMAGE,o,a,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_*this.imagePixelRatio_,this.originY_*this.imagePixelRatio_,this.rotateWithView_,this.rotation_,[this.scale_[0]*this.pixelRatio/this.imagePixelRatio_,this.scale_[1]*this.pixelRatio/this.imagePixelRatio_],Math.ceil(this.width_*this.imagePixelRatio_),this.declutterMode_,this.declutterImageWithText_]),this.hitDetectionInstructions.push([O.DRAW_IMAGE,o,a,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,1,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(e)}drawMultiPoint(t,e,i){if(!this.image_)return;this.beginGeometry(t,e,i);const s=t.getFlatCoordinates(),r=[];for(let l=0,h=s.length;l<h;l+=t.getStride())(!this.maxExtent||Gi(this.maxExtent,s.slice(l,l+2)))&&r.push(s[l],s[l+1]);const o=this.coordinates.length,a=this.appendFlatPointCoordinates(r,2);this.instructions.push([O.DRAW_IMAGE,o,a,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_*this.imagePixelRatio_,this.originY_*this.imagePixelRatio_,this.rotateWithView_,this.rotation_,[this.scale_[0]*this.pixelRatio/this.imagePixelRatio_,this.scale_[1]*this.pixelRatio/this.imagePixelRatio_],Math.ceil(this.width_*this.imagePixelRatio_),this.declutterMode_,this.declutterImageWithText_]),this.hitDetectionInstructions.push([O.DRAW_IMAGE,o,a,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,1,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(e)}finish(){return this.reverseHitDetectionInstructions(),this.anchorX_=void 0,this.anchorY_=void 0,this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.height_=void 0,this.scale_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.width_=void 0,super.finish()}setImageStyle(t,e){const i=t.getAnchor(),s=t.getSize(),r=t.getOrigin();this.imagePixelRatio_=t.getPixelRatio(this.pixelRatio),this.anchorX_=i[0],this.anchorY_=i[1],this.hitDetectionImage_=t.getHitDetectionImage(),this.image_=t.getImage(this.pixelRatio),this.height_=s[1],this.opacity_=t.getOpacity(),this.originX_=r[0],this.originY_=r[1],this.rotateWithView_=t.getRotateWithView(),this.rotation_=t.getRotation(),this.scale_=t.getScaleArray(),this.width_=s[0],this.declutterMode_=t.getDeclutterMode(),this.declutterImageWithText_=e}}class Xg extends Un{constructor(t,e,i,s){super(t,e,i,s)}drawFlatCoordinates_(t,e,i,s){const r=this.coordinates.length,o=this.appendFlatLineCoordinates(t,e,i,s,!1,!1),a=[O.MOVE_TO_LINE_TO,r,o];return this.instructions.push(a),this.hitDetectionInstructions.push(a),i}drawLineString(t,e,i){const s=this.state,r=s.strokeStyle,o=s.lineWidth;if(r===void 0||o===void 0)return;this.updateStrokeStyle(s,this.applyStroke),this.beginGeometry(t,e,i),this.hitDetectionInstructions.push([O.SET_STROKE_STYLE,s.strokeStyle,s.lineWidth,s.lineCap,s.lineJoin,s.miterLimit,Ce,Re],yi);const a=t.getFlatCoordinates(),l=t.getStride();this.drawFlatCoordinates_(a,0,a.length,l),this.hitDetectionInstructions.push(Ue),this.endGeometry(e)}drawMultiLineString(t,e,i){const s=this.state,r=s.strokeStyle,o=s.lineWidth;if(r===void 0||o===void 0)return;this.updateStrokeStyle(s,this.applyStroke),this.beginGeometry(t,e,i),this.hitDetectionInstructions.push([O.SET_STROKE_STYLE,s.strokeStyle,s.lineWidth,s.lineCap,s.lineJoin,s.miterLimit,Ce,Re],yi);const a=t.getEnds(),l=t.getFlatCoordinates(),h=t.getStride();let c=0;for(let u=0,d=a.length;u<d;++u)c=this.drawFlatCoordinates_(l,c,a[u],h);this.hitDetectionInstructions.push(Ue),this.endGeometry(e)}finish(){const t=this.state;return t.lastStroke!=null&&t.lastStroke!=this.coordinates.length&&this.instructions.push(Ue),this.reverseHitDetectionInstructions(),this.state=null,super.finish()}applyStroke(t){t.lastStroke!=null&&t.lastStroke!=this.coordinates.length&&(this.instructions.push(Ue),t.lastStroke=this.coordinates.length),t.lastStroke=0,super.applyStroke(t),this.instructions.push(yi)}}class Bh extends Un{constructor(t,e,i,s){super(t,e,i,s)}drawFlatCoordinatess_(t,e,i,s){const r=this.state,o=r.fillStyle!==void 0,a=r.strokeStyle!==void 0,l=i.length;this.instructions.push(yi),this.hitDetectionInstructions.push(yi);for(let h=0;h<l;++h){const c=i[h],u=this.coordinates.length,d=this.appendFlatLineCoordinates(t,e,c,s,!0,!a),f=[O.MOVE_TO_LINE_TO,u,d];this.instructions.push(f),this.hitDetectionInstructions.push(f),a&&(this.instructions.push(Kh),this.hitDetectionInstructions.push(Kh)),e=c}return o&&(this.instructions.push(er),this.hitDetectionInstructions.push(er)),a&&(this.instructions.push(Ue),this.hitDetectionInstructions.push(Ue)),e}drawCircle(t,e,i){const s=this.state,r=s.fillStyle,o=s.strokeStyle;if(r===void 0&&o===void 0)return;this.setFillStrokeStyles_(),this.beginGeometry(t,e,i),s.fillStyle!==void 0&&this.hitDetectionInstructions.push([O.SET_FILL_STYLE,Mt]),s.strokeStyle!==void 0&&this.hitDetectionInstructions.push([O.SET_STROKE_STYLE,s.strokeStyle,s.lineWidth,s.lineCap,s.lineJoin,s.miterLimit,Ce,Re]);const a=t.getFlatCoordinates(),l=t.getStride(),h=this.coordinates.length;this.appendFlatLineCoordinates(a,0,a.length,l,!1,!1);const c=[O.CIRCLE,h];this.instructions.push(yi,c),this.hitDetectionInstructions.push(yi,c),s.fillStyle!==void 0&&(this.instructions.push(er),this.hitDetectionInstructions.push(er)),s.strokeStyle!==void 0&&(this.instructions.push(Ue),this.hitDetectionInstructions.push(Ue)),this.endGeometry(e)}drawPolygon(t,e,i){const s=this.state,r=s.fillStyle,o=s.strokeStyle;if(r===void 0&&o===void 0)return;this.setFillStrokeStyles_(),this.beginGeometry(t,e,i),s.fillStyle!==void 0&&this.hitDetectionInstructions.push([O.SET_FILL_STYLE,Mt]),s.strokeStyle!==void 0&&this.hitDetectionInstructions.push([O.SET_STROKE_STYLE,s.strokeStyle,s.lineWidth,s.lineCap,s.lineJoin,s.miterLimit,Ce,Re]);const a=t.getEnds(),l=t.getOrientedFlatCoordinates(),h=t.getStride();this.drawFlatCoordinatess_(l,0,a,h),this.endGeometry(e)}drawMultiPolygon(t,e,i){const s=this.state,r=s.fillStyle,o=s.strokeStyle;if(r===void 0&&o===void 0)return;this.setFillStrokeStyles_(),this.beginGeometry(t,e,i),s.fillStyle!==void 0&&this.hitDetectionInstructions.push([O.SET_FILL_STYLE,Mt]),s.strokeStyle!==void 0&&this.hitDetectionInstructions.push([O.SET_STROKE_STYLE,s.strokeStyle,s.lineWidth,s.lineCap,s.lineJoin,s.miterLimit,Ce,Re]);const a=t.getEndss(),l=t.getOrientedFlatCoordinates(),h=t.getStride();let c=0;for(let u=0,d=a.length;u<d;++u)c=this.drawFlatCoordinatess_(l,c,a[u],h);this.endGeometry(e)}finish(){this.reverseHitDetectionInstructions(),this.state=null;const t=this.tolerance;if(t!==0){const e=this.coordinates;for(let i=0,s=e.length;i<s;++i)e[i]=gi(e[i],t)}return super.finish()}setFillStrokeStyles_(){const t=this.state;this.updateFillStyle(t,this.createFill),this.updateStrokeStyle(t,this.applyStroke)}}function Yg(n,t,e,i,s){const r=[];let o=e,a=0,l=t.slice(e,2);for(;a<n&&o+s<i;){const[h,c]=l.slice(-2),u=t[o+s],d=t[o+s+1],f=Math.sqrt((u-h)*(u-h)+(d-c)*(d-c));if(a+=f,a>=n){const g=(n-a+f)/f,m=Zt(h,u,g),_=Zt(c,d,g);l.push(m,_),r.push(l),l=[m,_],a==n&&(o+=s),a=0}else if(a<n)l.push(t[o+s],t[o+s+1]),o+=s;else{const g=f-a,m=Zt(h,u,g/f),_=Zt(c,d,g/f);l.push(m,_),r.push(l),l=[m,_],a=0,o+=s}}return a>0&&r.push(l),r}function $g(n,t,e,i,s){let r=e,o=e,a=0,l=0,h=e,c,u,d,f,g,m,_,p,y,v;for(u=e;u<i;u+=s){const x=t[u],E=t[u+1];g!==void 0&&(y=x-g,v=E-m,f=Math.sqrt(y*y+v*v),_!==void 0&&(l+=d,c=Math.acos((_*y+p*v)/(d*f)),c>n&&(l>a&&(a=l,r=h,o=u),l=0,h=u-s)),d=f,_=y,p=v),g=x,m=E}return l+=f,l>a?[h,u]:[r,o]}const ir={left:0,center:.5,right:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1};class Kg extends Un{constructor(t,e,i,s){super(t,e,i,s),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[Mt]={fillStyle:Mt},this.textStrokeState_=null,this.strokeStates={},this.textState_={},this.textStates={},this.textKey_="",this.fillKey_="",this.strokeKey_="",this.declutterMode_=void 0,this.declutterImageWithText_=void 0}finish(){const t=super.finish();return t.textStates=this.textStates,t.fillStates=this.fillStates,t.strokeStates=this.strokeStates,t}drawText(t,e,i){const s=this.textFillState_,r=this.textStrokeState_,o=this.textState_;if(this.text_===""||!o||!s&&!r)return;const a=this.coordinates;let l=a.length;const h=t.getType();let c=null,u=t.getStride();if(o.placement==="line"&&(h=="LineString"||h=="MultiLineString"||h=="Polygon"||h=="MultiPolygon")){if(!Lt(this.maxExtent,t.getExtent()))return;let d;if(c=t.getFlatCoordinates(),h=="LineString")d=[c.length];else if(h=="MultiLineString")d=t.getEnds();else if(h=="Polygon")d=t.getEnds().slice(0,1);else if(h=="MultiPolygon"){const _=t.getEndss();d=[];for(let p=0,y=_.length;p<y;++p)d.push(_[p][0])}this.beginGeometry(t,e,i);const f=o.repeat,g=f?void 0:o.textAlign;let m=0;for(let _=0,p=d.length;_<p;++_){let y;f?y=Yg(f*this.resolution,c,m,d[_],u):y=[c.slice(m,d[_])];for(let v=0,x=y.length;v<x;++v){const E=y[v];let w=0,T=E.length;if(g==null){const I=$g(o.maxAngle,E,0,E.length,2);w=I[0],T=I[1]}for(let I=w;I<T;I+=u)a.push(E[I],E[I+1]);const R=a.length;m=d[_],this.drawChars_(l,R),l=R}}this.endGeometry(e)}else{let d=o.overflow?null:[];switch(h){case"Point":case"MultiPoint":c=t.getFlatCoordinates();break;case"LineString":c=t.getFlatMidpoint();break;case"Circle":c=t.getCenter();break;case"MultiLineString":c=t.getFlatMidpoints(),u=2;break;case"Polygon":c=t.getFlatInteriorPoint(),o.overflow||d.push(c[2]/this.resolution),u=3;break;case"MultiPolygon":const x=t.getFlatInteriorPoints();c=[];for(let E=0,w=x.length;E<w;E+=3)o.overflow||d.push(x[E+2]/this.resolution),c.push(x[E],x[E+1]);if(c.length===0)return;u=2;break}const f=this.appendFlatPointCoordinates(c,u);if(f===l)return;if(d&&(f-l)/2!==c.length/u){let x=l/2;d=d.filter((E,w)=>{const T=a[(x+w)*2]===c[w*u]&&a[(x+w)*2+1]===c[w*u+1];return T||--x,T})}this.saveTextStates_();const g=o.backgroundFill?this.createFill(this.fillStyleToState(o.backgroundFill)):null,m=o.backgroundStroke?this.createStroke(this.strokeStyleToState(o.backgroundStroke)):null;this.beginGeometry(t,e,i);let _=o.padding;if(_!=pi&&(o.scale[0]<0||o.scale[1]<0)){let x=o.padding[0],E=o.padding[1],w=o.padding[2],T=o.padding[3];o.scale[0]<0&&(E=-E,T=-T),o.scale[1]<0&&(x=-x,w=-w),_=[x,E,w,T]}const p=this.pixelRatio;this.instructions.push([O.DRAW_IMAGE,l,f,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[1,1],NaN,this.declutterMode_,this.declutterImageWithText_,_==pi?pi:_.map(function(x){return x*p}),g,m,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,d]);const y=1/p,v=g?g.slice(0):null;v&&(v[1]=Mt),this.hitDetectionInstructions.push([O.DRAW_IMAGE,l,f,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[y,y],NaN,this.declutterMode_,this.declutterImageWithText_,_,v,m,this.text_,this.textKey_,this.strokeKey_,this.fillKey_?Mt:this.fillKey_,this.textOffsetX_,this.textOffsetY_,d]),this.endGeometry(e)}}saveTextStates_(){const t=this.textStrokeState_,e=this.textState_,i=this.textFillState_,s=this.strokeKey_;t&&(s in this.strokeStates||(this.strokeStates[s]={strokeStyle:t.strokeStyle,lineCap:t.lineCap,lineDashOffset:t.lineDashOffset,lineWidth:t.lineWidth,lineJoin:t.lineJoin,miterLimit:t.miterLimit,lineDash:t.lineDash}));const r=this.textKey_;r in this.textStates||(this.textStates[r]={font:e.font,textAlign:e.textAlign||Wn,justify:e.justify,textBaseline:e.textBaseline||Vs,scale:e.scale});const o=this.fillKey_;i&&(o in this.fillStates||(this.fillStates[o]={fillStyle:i.fillStyle}))}drawChars_(t,e){const i=this.textStrokeState_,s=this.textState_,r=this.strokeKey_,o=this.textKey_,a=this.fillKey_;this.saveTextStates_();const l=this.pixelRatio,h=ir[s.textBaseline],c=this.textOffsetY_*l,u=this.text_,d=i?i.lineWidth*Math.abs(s.scale[0])/2:0;this.instructions.push([O.DRAW_CHARS,t,e,h,s.overflow,a,s.maxAngle,l,c,r,d*l,u,o,1,this.declutterMode_,this.textKeepUpright_]),this.hitDetectionInstructions.push([O.DRAW_CHARS,t,e,h,s.overflow,a&&Mt,s.maxAngle,l,c,r,d*l,u,o,1/l,this.declutterMode_,this.textKeepUpright_])}setTextStyle(t,e){let i,s,r;if(!t)this.text_="";else{const o=t.getFill();o?(s=this.textFillState_,s||(s={},this.textFillState_=s),s.fillStyle=de(o.getColor()||Mt)):(s=null,this.textFillState_=s);const a=t.getStroke();if(!a)r=null,this.textStrokeState_=r;else{r=this.textStrokeState_,r||(r={},this.textStrokeState_=r);const m=a.getLineDash(),_=a.getLineDashOffset(),p=a.getWidth(),y=a.getMiterLimit();r.lineCap=a.getLineCap()||Vi,r.lineDash=m?m.slice():Ce,r.lineDashOffset=_===void 0?Re:_,r.lineJoin=a.getLineJoin()||ji,r.lineWidth=p===void 0?Xn:p,r.miterLimit=y===void 0?Gn:y,r.strokeStyle=de(a.getColor()||zn)}i=this.textState_;const l=t.getFont()||Ch;lg(l);const h=t.getScaleArray();i.overflow=t.getOverflow(),i.font=l,i.maxAngle=t.getMaxAngle(),i.placement=t.getPlacement(),i.textAlign=t.getTextAlign(),i.repeat=t.getRepeat(),i.justify=t.getJustify(),i.textBaseline=t.getTextBaseline()||Vs,i.backgroundFill=t.getBackgroundFill(),i.backgroundStroke=t.getBackgroundStroke(),i.padding=t.getPadding()||pi,i.scale=h===void 0?[1,1]:h;const c=t.getOffsetX(),u=t.getOffsetY(),d=t.getRotateWithView(),f=t.getKeepUpright(),g=t.getRotation();this.text_=t.getText()||"",this.textOffsetX_=c===void 0?0:c,this.textOffsetY_=u===void 0?0:u,this.textRotateWithView_=d===void 0?!1:d,this.textKeepUpright_=f===void 0?!0:f,this.textRotation_=g===void 0?0:g,this.strokeKey_=r?(typeof r.strokeStyle=="string"?r.strokeStyle:V(r.strokeStyle))+r.lineCap+r.lineDashOffset+"|"+r.lineWidth+r.lineJoin+r.miterLimit+"["+r.lineDash.join()+"]":"",this.textKey_=i.font+i.scale+(i.textAlign||"?")+(i.repeat||"?")+(i.justify||"?")+(i.textBaseline||"?"),this.fillKey_=s&&s.fillStyle?typeof s.fillStyle=="string"?s.fillStyle:"|"+V(s.fillStyle):""}this.declutterMode_=t.getDeclutterMode(),this.declutterImageWithText_=e}}const Bg={Circle:Bh,Default:Un,Image:Wg,LineString:Xg,Polygon:Bh,Text:Kg};class Zg{constructor(t,e,i,s){this.tolerance_=t,this.maxExtent_=e,this.pixelRatio_=s,this.resolution_=i,this.buildersByZIndex_={}}finish(){const t={};for(const e in this.buildersByZIndex_){t[e]=t[e]||{};const i=this.buildersByZIndex_[e];for(const s in i){const r=i[s].finish();t[e][s]=r}}return t}getBuilder(t,e){const i=t!==void 0?t.toString():"0";let s=this.buildersByZIndex_[i];s===void 0&&(s={},this.buildersByZIndex_[i]=s);let r=s[e];if(r===void 0){const o=Bg[e];r=new o(this.tolerance_,this.maxExtent_,this.resolution_,this.pixelRatio_),s[e]=r}return r}}function Ug(n,t,e,i,s,r,o,a,l,h,c,u,d=!0){let f=n[t],g=n[t+1],m=0,_=0,p=0,y=0;function v(){m=f,_=g,t+=i,f=n[t],g=n[t+1],y+=p,p=Math.sqrt((f-m)*(f-m)+(g-_)*(g-_))}do v();while(t<e-i&&y+p<r);let x=p===0?0:(r-y)/p;const E=Zt(m,f,x),w=Zt(_,g,x),T=t-i,R=y,I=r+a*l(h,s,c);for(;t<e-i&&y+p<I;)v();x=p===0?0:(I-y)/p;const L=Zt(m,f,x),P=Zt(_,g,x);let A=!1;if(d)if(u){const G=[E,w,L,P];Hl(G,0,4,2,u,G,G),A=G[0]>G[2]}else A=E>L;const b=Math.PI,M=[],Y=T+i===t;t=T,p=0,y=R,f=n[t],g=n[t+1];let k;if(Y){v(),k=Math.atan2(g-_,f-m),A&&(k+=k>0?-b:b);const G=(L+E)/2,F=(P+w)/2;return M[0]=[G,F,(I-r)/2,k,s],M}s=s.replace(/\n/g," ");for(let G=0,F=s.length;G<F;){v();let $=Math.atan2(g-_,f-m);if(A&&($+=$>0?-b:b),k!==void 0){let at=$-k;if(at+=at>b?-2*b:at<-b?2*b:0,Math.abs(at)>o)return null}k=$;const B=G;let et=0;for(;G<F;++G){const at=A?F-G-1:G,Wt=a*l(h,s[at],c);if(t+i<e&&y+p<r+et+Wt/2)break;et+=Wt}if(G===B)continue;const S=A?s.substring(F-B,F-G):s.substring(B,G);x=p===0?0:(r+et/2-y)/p;const yt=Zt(m,f,x),Tt=Zt(_,g,x);M.push([yt,Tt,et/2,$,S]),r+=et}return M}class Zh{constructor(){this.instructions_=[],this.zIndex=0,this.offset_=0,this.context_=new Proxy($s(),{get:(t,e)=>{if(typeof $s()[e]=="function")return this.push_(e),this.pushMethodArgs_},set:(t,e,i)=>(this.push_(e,i),!0)})}push_(...t){const e=this.instructions_,i=this.zIndex+this.offset_;e[i]||(e[i]=[]),e[i].push(...t)}pushMethodArgs_=(...t)=>(this.push_(t),this);pushFunction(t){this.push_(t)}getContext(){return this.context_}draw(t){this.instructions_.forEach(e=>{for(let i=0,s=e.length;i<s;++i){const r=e[i];if(typeof r=="function"){r(t);continue}const o=e[++i];if(typeof t[r]=="function")t[r](...o);else{if(typeof o=="function"){t[r]=o(t);continue}t[r]=o}}})}clear(){this.instructions_.length=0,this.zIndex=0,this.offset_=0}offset(){this.offset_=this.instructions_.length,this.zIndex=0}}const Qi=zt(),Ve=[],Ie=[],Se=[],je=[];function Uh(n){return n[3].declutterBox}const Vh=new RegExp("[֑-ࣿיִ-﷿ﹰ-ﻼࠀ--]");function Ao(n,t){return t==="start"?t=Vh.test(n)?"right":"left":t==="end"&&(t=Vh.test(n)?"left":"right"),ir[t]}function Vg(n,t,e){return e>0&&n.push(`
|
|
5
|
-
`,""),n.push(t,""),n}function
|
|
6
|
-
`).reduce(
|
|
7
|
-
`){b+=A,A=0,I=u*v+R*d,++Y;continue}const B=f[G+1]||l.font;B!==k&&(s&&L.push("font",B),i&&P.push("font",B),k=B),A=Math.max(A,p[M]);const et=[$,I+R*_[M]+u*(_[M]-y[Y]),.5*(d+A)+b];I+=_[M],s&&L.push("strokeText",et),i&&P.push("fillText",et),++M}return Array.prototype.push.apply(x,L),Array.prototype.push.apply(x,P),this.labels_[r]=T,T}replayTextBackground_(t,e,i,s,r,o,a){t.beginPath(),t.moveTo.apply(t,e),t.lineTo.apply(t,i),t.lineTo.apply(t,s),t.lineTo.apply(t,r),t.lineTo.apply(t,e),o&&(this.alignAndScaleFill_=o[2],t.fillStyle=o[1],this.fill_(t)),a&&(this.setStrokeStyle_(t,a),t.stroke())}calculateImageOrLabelDimensions_(t,e,i,s,r,o,a,l,h,c,u,d,f,g,m,_){a*=d[0],l*=d[1];let p=i-a,y=s-l;const v=r+h>t?t-h:r,x=o+c>e?e-c:o,E=g[3]+v*d[0]+g[1],w=g[0]+x*d[1]+g[2],T=p-g[3],R=y-g[0];(m||u!==0)&&(Ve[0]=T,je[0]=T,Ve[1]=R,Ie[1]=R,Ie[0]=T+E,Se[0]=Ie[0],Se[1]=R+w,je[1]=Se[1]);let I;return u!==0?(I=ve(se(),i,s,1,1,u,-i,-s),dt(I,Ve),dt(I,Ie),dt(I,Se),dt(I,je),Ye(Math.min(Ve[0],Ie[0],Se[0],je[0]),Math.min(Ve[1],Ie[1],Se[1],je[1]),Math.max(Ve[0],Ie[0],Se[0],je[0]),Math.max(Ve[1],Ie[1],Se[1],je[1]),Qi)):Ye(Math.min(T,T+E),Math.min(R,R+w),Math.max(T,T+E),Math.max(R,R+w),Qi),f&&(p=Math.round(p),y=Math.round(y)),{drawImageX:p,drawImageY:y,drawImageW:v,drawImageH:x,originX:h,originY:c,declutterBox:{minX:Qi[0],minY:Qi[1],maxX:Qi[2],maxY:Qi[3],value:_},canvasTransform:I,scale:d}}replayImageOrLabel_(t,e,i,s,r,o,a){const l=!!(o||a),h=s.declutterBox,c=a?a[2]*s.scale[0]/2:0;return h.minX-c<=e[0]&&h.maxX+c>=0&&h.minY-c<=e[1]&&h.maxY+c>=0&&(l&&this.replayTextBackground_(t,Ve,Ie,Se,je,o,a),ug(t,s.canvasTransform,r,i,s.originX,s.originY,s.drawImageW,s.drawImageH,s.drawImageX,s.drawImageY,s.scale)),!0}fill_(t){const e=this.alignAndScaleFill_;if(e){const i=dt(this.renderedTransform_,[0,0]),s=512*this.pixelRatio;t.save(),t.translate(i[0]%s,i[1]%s),e!==1&&t.scale(e,e),t.rotate(this.viewRotation_)}t.fill(),e&&t.restore()}setStrokeStyle_(t,e){t.strokeStyle=e[1],e[1]&&(t.lineWidth=e[2],t.lineCap=e[3],t.lineJoin=e[4],t.miterLimit=e[5],t.lineDashOffset=e[7],t.setLineDash(e[6]))}drawLabelWithPointPlacement_(t,e,i,s){const r=this.textStates[e],o=this.createLabel(t,e,s,i),a=this.strokeStates[i],l=this.pixelRatio,h=Ao(Array.isArray(t)?t[0]:t,r.textAlign||Wn),c=ir[r.textBaseline||Vs],u=a&&a.lineWidth?a.lineWidth:0,d=o.width/l-2*r.scale[0],f=h*d+2*(.5-h)*u,g=c*o.height/l+2*(.5-c)*u;return{label:o,anchorX:f,anchorY:g}}execute_(t,e,i,s,r,o,a,l){const h=this.zIndexContext_;let c;this.pixelCoordinates_&&Xe(i,this.renderedTransform_)?c=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),c=Be(this.coordinates,0,this.coordinates.length,2,i,this.pixelCoordinates_),ff(this.renderedTransform_,i));let u=0;const d=s.length;let f=0,g,m,_,p,y,v,x,E,w,T,R,I,L,P=0,A=0;const b=this.coordinateCache_,M=this.viewRotation_,Y=Math.round(Math.atan2(-i[1],i[0])*1e12)/1e12,k={context:t,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:M},G=this.instructions!=s||this.overlaps?0:200;let F,$,B,et;for(;u<d;){const S=s[u];switch(S[0]){case O.BEGIN_GEOMETRY:F=S[1],et=S[3],F.getGeometry()?a!==void 0&&!Lt(a,et.getExtent())?u=S[2]+1:++u:u=S[2],h&&(h.zIndex=S[4]);break;case O.BEGIN_PATH:P>G&&(this.fill_(t),P=0),A>G&&(t.stroke(),A=0),!P&&!A&&(t.beginPath(),y=NaN,v=NaN),++u;break;case O.CIRCLE:f=S[1];const Tt=c[f],at=c[f+1],Wt=c[f+2],xt=c[f+3],_e=Wt-Tt,he=xt-at,Xt=Math.sqrt(_e*_e+he*he);t.moveTo(Tt+Xt,at),t.arc(Tt,at,Xt,0,2*Math.PI,!0),++u;break;case O.CLOSE_PATH:t.closePath(),++u;break;case O.CUSTOM:f=S[1],g=S[2];const gr=S[3],aa=S[4],ss=S[5];k.geometry=gr,k.feature=F,u in b||(b[u]=[]);const Ci=b[u];ss?ss(c,f,g,2,Ci):(Ci[0]=c[f],Ci[1]=c[f+1],Ci.length=2),h&&(h.zIndex=S[6]),aa(Ci,k),++u;break;case O.DRAW_IMAGE:f=S[1],g=S[2],w=S[3],m=S[4],_=S[5];let qt=S[6];const me=S[7],dn=S[8],fn=S[9],rs=S[10];let Ri=S[11];const gn=S[12];let _n=S[13];p=S[14]||"declutter";const ft=S[15];if(!w&&S.length>=20){T=S[19],R=S[20],I=S[21],L=S[22];const Jt=this.drawLabelWithPointPlacement_(T,R,I,L);w=Jt.label,S[3]=w;const Ti=S[23];m=(Jt.anchorX-Ti)*this.pixelRatio,S[4]=m;const Qt=S[24];_=(Jt.anchorY-Qt)*this.pixelRatio,S[5]=_,qt=w.height,S[6]=qt,_n=w.width,S[13]=_n}let la;S.length>25&&(la=S[25]);let ha,_r,mr;S.length>17?(ha=S[16],_r=S[17],mr=S[18]):(ha=pi,_r=null,mr=null),rs&&Y?Ri+=M:!rs&&!Y&&(Ri-=M);let Lp=0;for(;f<g;f+=2){if(la&&la[Lp++]<_n/this.pixelRatio)continue;const Jt=this.calculateImageOrLabelDimensions_(w.width,w.height,c[f],c[f+1],_n,qt,m,_,dn,fn,Ri,gn,r,ha,!!_r||!!mr,F),Ti=[t,e,w,Jt,me,_r,mr];if(l){let Qt,pe,te;if(ft){const ot=g-f;if(!ft[ot]){ft[ot]={args:Ti,declutterMode:p};continue}const It=ft[ot];Qt=It.args,pe=It.declutterMode,delete ft[ot],te=Uh(Qt)}let Me,Pe;if(Qt&&(pe!=="declutter"||!l.collides(te))&&(Me=!0),(p!=="declutter"||!l.collides(Jt.declutterBox))&&(Pe=!0),pe==="declutter"&&p==="declutter"){const ot=Me&&Pe;Me=ot,Pe=ot}Me&&(pe!=="none"&&l.insert(te),this.replayImageOrLabel_.apply(this,Qt)),Pe&&(p!=="none"&&l.insert(Jt.declutterBox),this.replayImageOrLabel_.apply(this,Ti))}else this.replayImageOrLabel_.apply(this,Ti)}++u;break;case O.DRAW_CHARS:const $c=S[1],Kc=S[2],ca=S[3],Ap=S[4];L=S[5];const Mp=S[6],Bc=S[7],Zc=S[8];I=S[9];const ua=S[10];T=S[11],Array.isArray(T)&&(T=T.reduce(jg,"")),R=S[12];const Uc=[S[13],S[13]];p=S[14]||"declutter";const Pp=S[15],da=this.textStates[R],os=da.font,as=[da.scale[0]*Bc,da.scale[1]*Bc];let ls;os in this.widths_?ls=this.widths_[os]:(ls={},this.widths_[os]=ls);const Vc=Gf(c,$c,Kc,2),jc=Math.abs(as[0])*Sh(os,T,ls);if(Ap||jc<=Vc){const Jt=this.textStates[R].textAlign,Ti=(Vc-jc)*Ao(T,Jt),Qt=Ug(c,$c,Kc,2,T,Ti,Mp,Math.abs(as[0]),Sh,os,ls,Y?0:this.viewRotation_,Pp);t:if(Qt){const pe=[];let te,Me,Pe,ot,It;if(I)for(te=0,Me=Qt.length;te<Me;++te){It=Qt[te],Pe=It[4],ot=this.createLabel(Pe,R,"",I),m=It[2]+(as[0]<0?-ua:ua),_=ca*ot.height+(.5-ca)*2*ua*as[1]/as[0]-Zc;const Oe=this.calculateImageOrLabelDimensions_(ot.width,ot.height,It[0],It[1],ot.width,ot.height,m,_,0,0,It[3],Uc,!1,pi,!1,F);if(l&&p==="declutter"&&l.collides(Oe.declutterBox))break t;pe.push([t,e,ot,Oe,1,null,null])}if(L)for(te=0,Me=Qt.length;te<Me;++te){It=Qt[te],Pe=It[4],ot=this.createLabel(Pe,R,L,""),m=It[2],_=ca*ot.height-Zc;const Oe=this.calculateImageOrLabelDimensions_(ot.width,ot.height,It[0],It[1],ot.width,ot.height,m,_,0,0,It[3],Uc,!1,pi,!1,F);if(l&&p==="declutter"&&l.collides(Oe.declutterBox))break t;pe.push([t,e,ot,Oe,1,null,null])}l&&p!=="none"&&l.load(pe.map(Uh));for(let Oe=0,Op=pe.length;Oe<Op;++Oe)this.replayImageOrLabel_.apply(this,pe[Oe])}}++u;break;case O.END_GEOMETRY:if(o!==void 0){F=S[1];const Jt=o(F,et,p);if(Jt)return Jt}++u;break;case O.FILL:G?P++:this.fill_(t),++u;break;case O.MOVE_TO_LINE_TO:for(f=S[1],g=S[2],$=c[f],B=c[f+1],t.moveTo($,B),y=$+.5|0,v=B+.5|0,f+=2;f<g;f+=2)$=c[f],B=c[f+1],x=$+.5|0,E=B+.5|0,(f==g-2||x!==y||E!==v)&&(t.lineTo($,B),y=x,v=E);++u;break;case O.SET_FILL_STYLE:this.alignAndScaleFill_=S[2],P&&(this.fill_(t),P=0,A&&(t.stroke(),A=0)),t.fillStyle=S[1],++u;break;case O.SET_STROKE_STYLE:A&&(t.stroke(),A=0),this.setStrokeStyle_(t,S),++u;break;case O.STROKE:G?A++:t.stroke(),++u;break;default:++u;break}}P&&this.fill_(t),A&&t.stroke()}execute(t,e,i,s,r,o){this.viewRotation_=s,this.execute_(t,e,i,this.instructions,r,void 0,void 0,o)}executeHitDetection(t,e,i,s,r){return this.viewRotation_=i,this.execute_(t,[t.canvas.width,t.canvas.height],e,this.hitDetectionInstructions,!0,s,r)}}const xi=["Polygon","Circle","LineString","Image","Text","Default"],jh=["Image","Text"],qg=xi.filter(n=>!jh.includes(n));class Jg{constructor(t,e,i,s,r,o,a){this.maxExtent_=t,this.overlaps_=s,this.pixelRatio_=i,this.resolution_=e,this.renderBuffer_=o,this.executorsByZIndex_={},this.hitDetectionContext_=null,this.hitDetectionTransform_=se(),this.renderedContext_=null,this.deferredZIndexContexts_={},this.createExecutors_(r,a)}clip(t,e){const i=this.getClipCoords(e);t.beginPath(),t.moveTo(i[0],i[1]),t.lineTo(i[2],i[3]),t.lineTo(i[4],i[5]),t.lineTo(i[6],i[7]),t.clip()}createExecutors_(t,e){for(const i in t){let s=this.executorsByZIndex_[i];s===void 0&&(s={},this.executorsByZIndex_[i]=s);const r=t[i];for(const o in r){const a=r[o];s[o]=new Hg(this.resolution_,this.pixelRatio_,this.overlaps_,a,e)}}}hasExecutors(t){for(const e in this.executorsByZIndex_){const i=this.executorsByZIndex_[e];for(let s=0,r=t.length;s<r;++s)if(t[s]in i)return!0}return!1}forEachFeatureAtCoordinate(t,e,i,s,r,o){s=Math.round(s);const a=s*2+1,l=ve(this.hitDetectionTransform_,s+.5,s+.5,1/e,-1/e,-i,-t[0],-t[1]),h=!this.hitDetectionContext_;h&&(this.hitDetectionContext_=lt(a,a));const c=this.hitDetectionContext_;c.canvas.width!==a||c.canvas.height!==a?(c.canvas.width=a,c.canvas.height=a):h||c.clearRect(0,0,a,a);let u;this.renderBuffer_!==void 0&&(u=zt(),Ln(u,t),Nr(u,e*(this.renderBuffer_+s),u));const d=Qg(s);let f;function g(E,w,T){const R=c.getImageData(0,0,a,a).data;for(let I=0,L=d.length;I<L;I++)if(R[d[I]]>0){if(!o||T==="none"||f!=="Image"&&f!=="Text"||o.includes(E)){const P=(d[I]-3)/4,A=s-P%a,b=s-(P/a|0),M=r(E,w,A*A+b*b);if(M)return M}c.clearRect(0,0,a,a);break}}const m=Object.keys(this.executorsByZIndex_).map(Number);m.sort(xe);let _,p,y,v,x;for(_=m.length-1;_>=0;--_){const E=m[_].toString();for(y=this.executorsByZIndex_[E],p=xi.length-1;p>=0;--p)if(f=xi[p],v=y[f],v!==void 0&&(x=v.executeHitDetection(c,l,i,g,u),x))return x}}getClipCoords(t){const e=this.maxExtent_;if(!e)return null;const i=e[0],s=e[1],r=e[2],o=e[3],a=[i,s,i,o,r,o,r,s];return Be(a,0,8,2,t,a),a}isEmpty(){return Ni(this.executorsByZIndex_)}execute(t,e,i,s,r,o,a){const l=Object.keys(this.executorsByZIndex_).map(Number);l.sort(a?wd:xe),o=o||xi;const h=xi.length;for(let c=0,u=l.length;c<u;++c){const d=l[c].toString(),f=this.executorsByZIndex_[d];for(let g=0,m=o.length;g<m;++g){const _=o[g],p=f[_];if(p!==void 0){const y=a===null?void 0:p.getZIndexContext(),v=y?y.getContext():t,x=this.maxExtent_&&_!=="Image"&&_!=="Text";if(x&&(v.save(),this.clip(v,i)),!y||_==="Text"||_==="Image"?p.execute(v,e,i,s,r,a):y.pushFunction(E=>p.execute(E,e,i,s,r,a)),x&&v.restore(),y){y.offset();const E=l[c]*h+xi.indexOf(_);this.deferredZIndexContexts_[E]||(this.deferredZIndexContexts_[E]=[]),this.deferredZIndexContexts_[E].push(y)}}}}this.renderedContext_=t}getDeferredZIndexContexts(){return this.deferredZIndexContexts_}getRenderedContext(){return this.renderedContext_}renderDeferred(){const t=this.deferredZIndexContexts_,e=Object.keys(t).map(Number).sort(xe);for(let i=0,s=e.length;i<s;++i)t[e[i]].forEach(r=>{r.draw(this.renderedContext_),r.clear()}),t[e[i]].length=0}}const Mo={};function Qg(n){if(Mo[n]!==void 0)return Mo[n];const t=n*2+1,e=n*n,i=new Array(e+1);for(let r=0;r<=n;++r)for(let o=0;o<=n;++o){const a=r*r+o*o;if(a>e)break;let l=i[a];l||(l=[],i[a]=l),l.push(((n+r)*t+(n+o))*4+3),r>0&&l.push(((n-r)*t+(n+o))*4+3),o>0&&(l.push(((n+r)*t+(n-o))*4+3),r>0&&l.push(((n-r)*t+(n-o))*4+3))}const s=[];for(let r=0,o=i.length;r<o;++r)i[r]&&s.push(...i[r]);return Mo[n]=s,s}function Hh(n,t,e,i){return e!==void 0&&i!==void 0?[e/n,i/t]:e!==void 0?e/n:i!==void 0?i/t:1}class tn extends Js{constructor(t){t=t||{};const e=t.opacity!==void 0?t.opacity:1,i=t.rotation!==void 0?t.rotation:0,s=t.scale!==void 0?t.scale:1,r=t.rotateWithView!==void 0?t.rotateWithView:!1;super({opacity:e,rotation:i,scale:s,displacement:t.displacement!==void 0?t.displacement:[0,0],rotateWithView:r,declutterMode:t.declutterMode}),this.anchor_=t.anchor!==void 0?t.anchor:[.5,.5],this.normalizedAnchor_=null,this.anchorOrigin_=t.anchorOrigin!==void 0?t.anchorOrigin:"top-left",this.anchorXUnits_=t.anchorXUnits!==void 0?t.anchorXUnits:"fraction",this.anchorYUnits_=t.anchorYUnits!==void 0?t.anchorYUnits:"fraction",this.crossOrigin_=t.crossOrigin!==void 0?t.crossOrigin:null;const o=t.img!==void 0?t.img:null;let a=t.src;J(!(a!==void 0&&o),"`image` and `src` cannot be provided at the same time"),(a===void 0||a.length===0)&&o&&(a=o.src||V(o)),J(a!==void 0&&a.length>0,"A defined and non-empty `src` or `image` must be provided"),J(!((t.width!==void 0||t.height!==void 0)&&t.scale!==void 0),"`width` or `height` cannot be provided together with `scale`");let l;if(t.src!==void 0?l=X.IDLE:o!==void 0&&("complete"in o?o.complete?l=o.src?X.LOADED:X.IDLE:l=X.LOADING:l=X.LOADED),this.color_=t.color!==void 0?Ui(t.color):null,this.iconImage_=vo(o,a,this.crossOrigin_,l,this.color_),this.offset_=t.offset!==void 0?t.offset:[0,0],this.offsetOrigin_=t.offsetOrigin!==void 0?t.offsetOrigin:"top-left",this.origin_=null,this.size_=t.size!==void 0?t.size:null,this.initialOptions_,t.width!==void 0||t.height!==void 0){let h,c;if(t.size)[h,c]=t.size;else{const u=this.getImage(1);if(u.width&&u.height)h=u.width,c=u.height;else if(u instanceof HTMLImageElement){this.initialOptions_=t;const d=()=>{if(this.unlistenImageChange(d),!this.initialOptions_)return;const f=this.iconImage_.getSize();this.setScale(Hh(f[0],f[1],t.width,t.height))};this.listenImageChange(d);return}}h!==void 0&&this.setScale(Hh(h,c,t.width,t.height))}}clone(){let t,e,i;return this.initialOptions_?(e=this.initialOptions_.width,i=this.initialOptions_.height):(t=this.getScale(),t=Array.isArray(t)?t.slice():t),new tn({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_,offset:this.offset_.slice(),offsetOrigin:this.offsetOrigin_,opacity:this.getOpacity(),rotateWithView:this.getRotateWithView(),rotation:this.getRotation(),scale:t,width:e,height:i,size:this.size_!==null?this.size_.slice():void 0,src:this.getSrc(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()})}getAnchor(){let t=this.normalizedAnchor_;if(!t){t=this.anchor_;const s=this.getSize();if(this.anchorXUnits_=="fraction"||this.anchorYUnits_=="fraction"){if(!s)return null;t=this.anchor_.slice(),this.anchorXUnits_=="fraction"&&(t[0]*=s[0]),this.anchorYUnits_=="fraction"&&(t[1]*=s[1])}if(this.anchorOrigin_!="top-left"){if(!s)return null;t===this.anchor_&&(t=this.anchor_.slice()),(this.anchorOrigin_=="top-right"||this.anchorOrigin_=="bottom-right")&&(t[0]=-t[0]+s[0]),(this.anchorOrigin_=="bottom-left"||this.anchorOrigin_=="bottom-right")&&(t[1]=-t[1]+s[1])}this.normalizedAnchor_=t}const e=this.getDisplacement(),i=this.getScaleArray();return[t[0]-e[0]/i[0],t[1]+e[1]/i[1]]}setAnchor(t){this.anchor_=t,this.normalizedAnchor_=null}getColor(){return this.color_}getImage(t){return this.iconImage_.getImage(t)}getPixelRatio(t){return this.iconImage_.getPixelRatio(t)}getImageSize(){return this.iconImage_.getSize()}getImageState(){return this.iconImage_.getImageState()}getHitDetectionImage(){return this.iconImage_.getHitDetectionImage()}getOrigin(){if(this.origin_)return this.origin_;let t=this.offset_;if(this.offsetOrigin_!="top-left"){const e=this.getSize(),i=this.iconImage_.getSize();if(!e||!i)return null;t=t.slice(),(this.offsetOrigin_=="top-right"||this.offsetOrigin_=="bottom-right")&&(t[0]=i[0]-e[0]-t[0]),(this.offsetOrigin_=="bottom-left"||this.offsetOrigin_=="bottom-right")&&(t[1]=i[1]-e[1]-t[1])}return this.origin_=t,this.origin_}getSrc(){return this.iconImage_.getSrc()}getSize(){return this.size_?this.size_:this.iconImage_.getSize()}getWidth(){const t=this.getScaleArray();if(this.size_)return this.size_[0]*t[0];if(this.iconImage_.getImageState()==X.LOADED)return this.iconImage_.getSize()[0]*t[0]}getHeight(){const t=this.getScaleArray();if(this.size_)return this.size_[1]*t[1];if(this.iconImage_.getImageState()==X.LOADED)return this.iconImage_.getSize()[1]*t[1]}setScale(t){delete this.initialOptions_,super.setScale(t)}listenImageChange(t){this.iconImage_.addEventListener(z.CHANGE,t)}load(){this.iconImage_.load()}unlistenImageChange(t){this.iconImage_.removeEventListener(z.CHANGE,t)}ready(){return this.iconImage_.ready()}}const fe=.5;function t_(n,t,e,i,s,r,o,a,l){const h=s,c=n[0]*fe,u=n[1]*fe,d=lt(c,u);d.imageSmoothingEnabled=!1;const f=d.canvas,g=new fg(d,fe,s,null,o,a,null),m=e.length,_=Math.floor((256*256*256-1)/m),p={};for(let v=1;v<=m;++v){const x=e[v-1],E=x.getStyleFunction()||i;if(!E)continue;let w=E(x,r);if(!w)continue;Array.isArray(w)||(w=[w]);const R=(v*_).toString(16).padStart(7,"#00000");for(let I=0,L=w.length;I<L;++I){const P=w[I],A=P.getGeometryFunction()(x);if(!A||!Lt(h,A.getExtent()))continue;const b=P.clone(),M=b.getFill();M&&M.setColor(R);const Y=b.getStroke();Y&&(Y.setColor(R),Y.setLineDash(null)),b.setText(void 0);const k=P.getImage();if(k){const B=k.getImageSize();if(!B)continue;const et=lt(B[0],B[1],void 0,{alpha:!1}),S=et.canvas;et.fillStyle=R,et.fillRect(0,0,S.width,S.height),b.setImage(new tn({img:S,anchor:k.getAnchor(),anchorXUnits:"pixels",anchorYUnits:"pixels",offset:k.getOrigin(),opacity:1,size:k.getSize(),scale:k.getScale(),rotation:k.getRotation(),rotateWithView:k.getRotateWithView()}))}const G=b.getZIndex()||0;let F=p[G];F||(F={},p[G]=F,F.Polygon=[],F.Circle=[],F.LineString=[],F.Point=[]);const $=A.getType();if($==="GeometryCollection"){const B=A.getGeometriesArrayRecursive();for(let et=0,S=B.length;et<S;++et){const yt=B[et];F[yt.getType().replace("Multi","")].push(yt,b)}}else F[$.replace("Multi","")].push(A,b)}}const y=Object.keys(p).map(Number).sort(xe);for(let v=0,x=y.length;v<x;++v){const E=p[y[v]];for(const w in E){const T=E[w];for(let R=0,I=T.length;R<I;R+=2){g.setStyle(T[R+1]);for(let L=0,P=t.length;L<P;++L)g.setTransform(t[L]),g.drawGeometry(T[R])}}}return d.getImageData(0,0,f.width,f.height)}function e_(n,t,e){const i=[];if(e){const s=Math.floor(Math.round(n[0])*fe),r=Math.floor(Math.round(n[1])*fe),o=(st(s,0,e.width-1)+st(r,0,e.height-1)*e.width)*4,a=e.data[o],l=e.data[o+1],c=e.data[o+2]+256*(l+256*a),u=Math.floor((256*256*256-1)/t.length);c&&c%u===0&&i.push(t[c/u-1])}return i}class qh extends Ee{constructor(t,e,i,s){super(t),this.inversePixelTransform=e,this.frameState=i,this.context=s}}const i_=5;class n_ extends Sn{constructor(t){super(),this.ready=!0,this.boundHandleImageChange_=this.handleImageChange_.bind(this),this.layer_=t,this.staleKeys_=new Array,this.maxStaleKeys=i_}getStaleKeys(){return this.staleKeys_}prependStaleKey(t){this.staleKeys_.unshift(t),this.staleKeys_.length>this.maxStaleKeys&&(this.staleKeys_.length=this.maxStaleKeys)}getFeatures(t){return U()}getData(t){return null}prepareFrame(t){return U()}renderFrame(t,e){return U()}forEachFeatureAtCoordinate(t,e,i,s,r){}getLayer(){return this.layer_}handleFontsChanged(){}handleImageChange_(t){const e=t.target;(e.getState()===X.LOADED||e.getState()===X.ERROR)&&this.renderIfReadyAndVisible()}loadImage(t){let e=t.getState();return e!=X.LOADED&&e!=X.ERROR&&t.addEventListener(z.CHANGE,this.boundHandleImageChange_),e==X.IDLE&&(t.load(),e=t.getState()),e==X.LOADED}renderIfReadyAndVisible(){const t=this.getLayer();t&&t.getVisible()&&t.getSourceState()==="ready"&&t.changed()}renderDeferred(t){}disposeInternal(){delete this.layer_,super.disposeInternal()}}const Jh=[];let en=null;function s_(){en=lt(1,1,void 0,{willReadFrequently:!0})}class Qh extends n_{constructor(t){super(t),this.container=null,this.renderedResolution,this.tempTransform=se(),this.pixelTransform=se(),this.inversePixelTransform=se(),this.context=null,this.deferredContext_=null,this.containerReused=!1,this.frameState=null}getImageData(t,e,i){en||s_(),en.clearRect(0,0,1,1);let s;try{en.drawImage(t,e,i,1,1,0,0,1,1),s=en.getImageData(0,0,1,1).data}catch{return en=null,null}return s}getBackground(t){let i=this.getLayer().getBackground();return typeof i=="function"&&(i=i(t.viewState.resolution)),i||void 0}useContainer(t,e,i){const s=this.getLayer().getClassName();let r,o;if(t&&t.className===s&&(!i||t&&t.style.backgroundColor&&Xe(Ui(t.style.backgroundColor),Ui(i)))){const a=t.firstElementChild;a instanceof HTMLCanvasElement&&(o=a.getContext("2d"))}if(o&&pf(o.canvas.style.transform,e)?(this.container=t,this.context=o,this.containerReused=!0):this.containerReused?(this.container=null,this.context=null,this.containerReused=!1):this.container&&(this.container.style.backgroundColor=null),!this.container){r=document.createElement("div"),r.className=s;let a=r.style;a.position="absolute",a.width="100%",a.height="100%",o=lt();const l=o.canvas;r.appendChild(l),a=l.style,a.position="absolute",a.left="0",a.transformOrigin="top left",this.container=r,this.context=o}!this.containerReused&&i&&!this.container.style.backgroundColor&&(this.container.style.backgroundColor=i)}clipUnrotated(t,e,i){const s=ui(i),r=Ls(i),o=bs(i),a=Ss(i);dt(e.coordinateToPixelTransform,s),dt(e.coordinateToPixelTransform,r),dt(e.coordinateToPixelTransform,o),dt(e.coordinateToPixelTransform,a);const l=this.inversePixelTransform;dt(l,s),dt(l,r),dt(l,o),dt(l,a),t.save(),t.beginPath(),t.moveTo(Math.round(s[0]),Math.round(s[1])),t.lineTo(Math.round(r[0]),Math.round(r[1])),t.lineTo(Math.round(o[0]),Math.round(o[1])),t.lineTo(Math.round(a[0]),Math.round(a[1])),t.clip()}prepareContainer(t,e){const i=t.extent,s=t.viewState.resolution,r=t.viewState.rotation,o=t.pixelRatio,a=Math.round(Q(i)/s*o),l=Math.round(Ct(i)/s*o);ve(this.pixelTransform,t.size[0]/2,t.size[1]/2,1/o,1/o,r,-a/2,-l/2),Vl(this.inversePixelTransform,this.pixelTransform);const h=mf(this.pixelTransform);if(this.useContainer(e,h,this.getBackground(t)),!this.containerReused){const c=this.context.canvas;c.width!=a||c.height!=l?(c.width=a,c.height=l):this.context.clearRect(0,0,a,l),h!==c.style.transform&&(c.style.transform=h)}}dispatchRenderEvent_(t,e,i){const s=this.getLayer();if(s.hasListener(t)){const r=new qh(t,this.inversePixelTransform,i,e);s.dispatchEvent(r)}}preRender(t,e){this.frameState=e,!e.declutter&&this.dispatchRenderEvent_(Vt.PRERENDER,t,e)}postRender(t,e){e.declutter||this.dispatchRenderEvent_(Vt.POSTRENDER,t,e)}renderDeferredInternal(t){}getRenderContext(t){return t.declutter&&!this.deferredContext_&&(this.deferredContext_=new Zh),t.declutter?this.deferredContext_.getContext():this.context}renderDeferred(t){t.declutter&&(this.dispatchRenderEvent_(Vt.PRERENDER,this.context,t),t.declutter&&this.deferredContext_&&(this.deferredContext_.draw(this.context),this.deferredContext_.clear()),this.renderDeferredInternal(t),this.dispatchRenderEvent_(Vt.POSTRENDER,this.context,t))}getRenderTransform(t,e,i,s,r,o,a){const l=r/2,h=o/2,c=s/e,u=-c,d=-t[0]+a,f=-t[1];return ve(this.tempTransform,l,h,c,u,-i,d,f)}disposeInternal(){delete this.frameState,super.disposeInternal()}}class r_ extends Qh{constructor(t){super(t),this.boundHandleStyleImageChange_=this.handleStyleImageChange_.bind(this),this.animatingOrInteracting_,this.hitDetectionImageData_=null,this.clipped_=!1,this.renderedFeatures_=null,this.renderedRevision_=-1,this.renderedResolution_=NaN,this.renderedExtent_=zt(),this.wrappedRenderedExtent_=zt(),this.renderedRotation_,this.renderedCenter_=null,this.renderedProjection_=null,this.renderedPixelRatio_=1,this.renderedRenderOrder_=null,this.renderedFrameDeclutter_,this.replayGroup_=null,this.replayGroupChanged=!0,this.clipping=!0,this.targetContext_=null,this.opacity_=1}renderWorlds(t,e,i){const s=e.extent,r=e.viewState,o=r.center,a=r.resolution,l=r.projection,h=r.rotation,c=l.getExtent(),u=this.getLayer().getSource(),d=this.getLayer().getDeclutter(),f=e.pixelRatio,g=e.viewHints,m=!(g[_t.ANIMATING]||g[_t.INTERACTING]),_=this.context,p=Math.round(Q(s)/a*f),y=Math.round(Ct(s)/a*f),v=u.getWrapX()&&l.canWrapX(),x=v?Q(c):null,E=v?Math.ceil((s[2]-c[2])/x)+1:1;let w=v?Math.floor((s[0]-c[0])/x):0;do{let T=this.getRenderTransform(o,a,0,f,p,y,w*x);e.declutter&&(T=T.slice(0)),t.execute(_,[_.canvas.width,_.canvas.height],T,h,m,i===void 0?xi:i?jh:qg,i?d&&e.declutter[d]:void 0)}while(++w<E)}setDrawContext_(){this.opacity_!==1&&(this.targetContext_=this.context,this.context=lt(this.context.canvas.width,this.context.canvas.height,Jh))}resetDrawContext_(){if(this.opacity_!==1&&this.targetContext_){const t=this.targetContext_.globalAlpha;this.targetContext_.globalAlpha=this.opacity_,this.targetContext_.drawImage(this.context.canvas,0,0),this.targetContext_.globalAlpha=t,Ks(this.context),Jh.push(this.context.canvas),this.context=this.targetContext_,this.targetContext_=null}}renderDeclutter(t){!this.replayGroup_||!this.getLayer().getDeclutter()||this.renderWorlds(this.replayGroup_,t,!0)}renderDeferredInternal(t){this.replayGroup_&&(this.replayGroup_.renderDeferred(),this.clipped_&&this.context.restore(),this.resetDrawContext_())}renderFrame(t,e){const i=t.layerStatesArray[t.layerIndex];this.opacity_=i.opacity;const s=t.viewState;this.prepareContainer(t,e);const r=this.context,o=this.replayGroup_;let a=o&&!o.isEmpty();if(!a&&!(this.getLayer().hasListener(Vt.PRERENDER)||this.getLayer().hasListener(Vt.POSTRENDER)))return this.container;if(this.setDrawContext_(),this.preRender(r,t),s.projection,this.clipped_=!1,a&&i.extent&&this.clipping){const l=Ke(i.extent);a=Lt(l,t.extent),this.clipped_=a&&!zi(l,t.extent),this.clipped_&&this.clipUnrotated(r,t,l)}return a&&this.renderWorlds(o,t,this.getLayer().getDeclutter()?!1:void 0),!t.declutter&&this.clipped_&&r.restore(),this.postRender(r,t),this.renderedRotation_!==s.rotation&&(this.renderedRotation_=s.rotation,this.hitDetectionImageData_=null),t.declutter||this.resetDrawContext_(),this.container}getFeatures(t){return new Promise(e=>{if(this.frameState&&!this.hitDetectionImageData_&&!this.animatingOrInteracting_){const i=this.frameState.size.slice(),s=this.renderedCenter_,r=this.renderedResolution_,o=this.renderedRotation_,a=this.renderedProjection_,l=this.wrappedRenderedExtent_,h=this.getLayer(),c=[],u=i[0]*fe,d=i[1]*fe;c.push(this.getRenderTransform(s,r,o,fe,u,d,0).slice());const f=h.getSource(),g=a.getExtent();if(f.getWrapX()&&a.canWrapX()&&!zi(g,l)){let m=l[0];const _=Q(g);let p=0,y;for(;m<g[0];)--p,y=_*p,c.push(this.getRenderTransform(s,r,o,fe,u,d,y).slice()),m+=_;for(p=0,m=l[2];m>g[2];)++p,y=_*p,c.push(this.getRenderTransform(s,r,o,fe,u,d,y).slice()),m-=_}this.hitDetectionImageData_=t_(i,c,this.renderedFeatures_,h.getStyleFunction(),l,r,o,Lh(r,this.renderedPixelRatio_))}e(e_(t,this.renderedFeatures_,this.hitDetectionImageData_))})}forEachFeatureAtCoordinate(t,e,i,s,r){if(!this.replayGroup_)return;const o=e.viewState.resolution,a=e.viewState.rotation,l=this.getLayer(),h={},c=function(d,f,g){const m=V(d),_=h[m];if(_){if(_!==!0&&g<_.distanceSq){if(g===0)return h[m]=!0,r.splice(r.lastIndexOf(_),1),s(d,l,f);_.geometry=f,_.distanceSq=g}}else{if(g===0)return h[m]=!0,s(d,l,f);r.push(h[m]={feature:d,layer:l,geometry:f,distanceSq:g,callback:s})}},u=this.getLayer().getDeclutter();return this.replayGroup_.forEachFeatureAtCoordinate(t,o,a,i,c,u?e.declutter?.[u]?.all().map(d=>d.value):null)}handleFontsChanged(){const t=this.getLayer();t.getVisible()&&this.replayGroup_&&t.changed()}handleStyleImageChange_(t){this.renderIfReadyAndVisible()}prepareFrame(t){const e=this.getLayer(),i=e.getSource();if(!i)return!1;const s=t.viewHints[_t.ANIMATING],r=t.viewHints[_t.INTERACTING],o=e.getUpdateWhileAnimating(),a=e.getUpdateWhileInteracting();if(this.ready&&!o&&s||!a&&r)return this.animatingOrInteracting_=!0,!0;this.animatingOrInteracting_=!1;const l=t.extent,h=t.viewState,c=h.projection,u=h.resolution,d=t.pixelRatio,f=e.getRevision(),g=e.getRenderBuffer();let m=e.getRenderOrder();m===void 0&&(m=_g);const _=h.center.slice(),p=Nr(l,g*u),y=p.slice(),v=[p.slice()],x=c.getExtent();if(i.getWrapX()&&c.canWrapX()&&!zi(x,t.extent)){const M=Q(x),Y=Math.max(Q(p)/2,M);p[0]=x[0]-Y,p[2]=x[2]+Y,Ml(_,c);const k=Il(v[0],c);k[0]<x[0]&&k[2]<x[2]?v.push([k[0]+M,k[1],k[2]+M,k[3]]):k[0]>x[0]&&k[2]>x[2]&&v.push([k[0]-M,k[1],k[2]-M,k[3]])}if(this.ready&&this.renderedResolution_==u&&this.renderedRevision_==f&&this.renderedRenderOrder_==m&&this.renderedFrameDeclutter_===!!t.declutter&&zi(this.wrappedRenderedExtent_,p))return Xe(this.renderedExtent_,y)||(this.hitDetectionImageData_=null,this.renderedExtent_=y),this.renderedCenter_=_,this.replayGroupChanged=!1,!0;this.replayGroup_=null;const E=new Zg(Ah(u,d),p,u,d);let w;for(let M=0,Y=v.length;M<Y;++M)i.loadFeatures(v[M],u,c);const T=Lh(u,d);let R=!0;const I=(M,Y)=>{let k;const G=M.getStyleFunction()||e.getStyleFunction();if(G&&(k=G(M,u)),k){const F=this.renderFeature(M,T,k,E,w,this.getLayer().getDeclutter(),Y);R=R&&!F}},L=Ul(p),P=i.getFeaturesInExtent(L);m&&P.sort(m);for(let M=0,Y=P.length;M<Y;++M)I(P[M],M);this.renderedFeatures_=P,this.ready=R;const A=E.finish(),b=new Jg(p,u,d,i.getOverlaps(),A,e.getRenderBuffer(),!!t.declutter);return this.renderedResolution_=u,this.renderedRevision_=f,this.renderedRenderOrder_=m,this.renderedFrameDeclutter_=!!t.declutter,this.renderedExtent_=y,this.wrappedRenderedExtent_=p,this.renderedCenter_=_,this.renderedProjection_=c,this.renderedPixelRatio_=d,this.replayGroup_=b,this.hitDetectionImageData_=null,this.replayGroupChanged=!0,!0}renderFeature(t,e,i,s,r,o,a){if(!i)return!1;let l=!1;if(Array.isArray(i))for(let h=0,c=i.length;h<c;++h)l=Mh(s,t,i[h],e,this.boundHandleStyleImageChange_,r,o,a)||l;else l=Mh(s,t,i,e,this.boundHandleStyleImageChange_,r,o,a);return l}}let Ei=0;const Rt=1<<Ei++,K=1<<Ei++,Ot=1<<Ei++,oe=1<<Ei++,wi=1<<Ei++,Vn=1<<Ei++,nr=Math.pow(2,Ei)-1,Po={[Rt]:"boolean",[K]:"number",[Ot]:"string",[oe]:"color",[wi]:"number[]",[Vn]:"size"},o_=Object.keys(Po).map(Number).sort(xe);function a_(n){return n in Po}function jn(n){const t=[];for(const e of o_)Hn(n,e)&&t.push(Po[e]);return t.length===0?"untyped":t.length<3?t.join(" or "):t.slice(0,-1).join(", ")+", or "+t[t.length-1]}function Hn(n,t){return(n&t)===t}function He(n,t){return n===t}class ht{constructor(t,e){if(!a_(t))throw new Error(`literal expressions must have a specific type, got ${jn(t)}`);this.type=t,this.value=e}}class l_{constructor(t,e,...i){this.type=t,this.operator=e,this.args=i}}function tc(){return{variables:new Set,properties:new Set,featureId:!1,geometryType:!1,mapState:!1}}function gt(n,t,e){switch(typeof n){case"boolean":{if(He(t,Ot))return new ht(Ot,n?"true":"false");if(!Hn(t,Rt))throw new Error(`got a boolean, but expected ${jn(t)}`);return new ht(Rt,n)}case"number":{if(He(t,Vn))return new ht(Vn,Pt(n));if(He(t,Rt))return new ht(Rt,!!n);if(He(t,Ot))return new ht(Ot,n.toString());if(!Hn(t,K))throw new Error(`got a number, but expected ${jn(t)}`);return new ht(K,n)}case"string":{if(He(t,oe))return new ht(oe,xo(n));if(He(t,Rt))return new ht(Rt,!!n);if(!Hn(t,Ot))throw new Error(`got a string, but expected ${jn(t)}`);return new ht(Ot,n)}}if(!Array.isArray(n))throw new Error("expression must be an array or a primitive value");if(n.length===0)throw new Error("empty expression");if(typeof n[0]=="string")return x_(n,t,e);for(const i of n)if(typeof i!="number")throw new Error("expected an array of numbers");if(He(t,Vn)){if(n.length!==2)throw new Error(`expected an array of two values for a size, got ${n.length}`);return new ht(Vn,n)}if(He(t,oe)){if(n.length===3)return new ht(oe,[...n,1]);if(n.length===4)return new ht(oe,n);throw new Error(`expected an array of 3 or 4 values for a color, got ${n.length}`)}if(!Hn(t,wi))throw new Error(`got an array of numbers, but expected ${jn(t)}`);return new ht(wi,n)}const C={Get:"get",Var:"var",Concat:"concat",GeometryType:"geometry-type",LineMetric:"line-metric",Any:"any",All:"all",Not:"!",Resolution:"resolution",Zoom:"zoom",Time:"time",Equal:"==",NotEqual:"!=",GreaterThan:">",GreaterThanOrEqualTo:">=",LessThan:"<",LessThanOrEqualTo:"<=",Multiply:"*",Divide:"/",Add:"+",Subtract:"-",Clamp:"clamp",Mod:"%",Pow:"^",Abs:"abs",Floor:"floor",Ceil:"ceil",Round:"round",Sin:"sin",Cos:"cos",Atan:"atan",Sqrt:"sqrt",Match:"match",Between:"between",Interpolate:"interpolate",Coalesce:"coalesce",Case:"case",In:"in",Number:"number",String:"string",Array:"array",Color:"color",Id:"id",Band:"band",Palette:"palette",ToString:"to-string",Has:"has"},h_={[C.Get]:N(W(1,1/0),ec),[C.Var]:N(W(1,1),c_),[C.Has]:N(W(1,1/0),ec),[C.Id]:N(u_,nn),[C.Concat]:N(W(2,1/0),H(Ot)),[C.GeometryType]:N(d_,nn),[C.LineMetric]:N(nn),[C.Resolution]:N(Oo,nn),[C.Zoom]:N(Oo,nn),[C.Time]:N(Oo,nn),[C.Any]:N(W(2,1/0),H(Rt)),[C.All]:N(W(2,1/0),H(Rt)),[C.Not]:N(W(1,1),H(Rt)),[C.Equal]:N(W(2,2),H(nr)),[C.NotEqual]:N(W(2,2),H(nr)),[C.GreaterThan]:N(W(2,2),H(K)),[C.GreaterThanOrEqualTo]:N(W(2,2),H(K)),[C.LessThan]:N(W(2,2),H(K)),[C.LessThanOrEqualTo]:N(W(2,2),H(K)),[C.Multiply]:N(W(2,1/0),ic),[C.Coalesce]:N(W(2,1/0),ic),[C.Divide]:N(W(2,2),H(K)),[C.Add]:N(W(2,1/0),H(K)),[C.Subtract]:N(W(2,2),H(K)),[C.Clamp]:N(W(3,3),H(K)),[C.Mod]:N(W(2,2),H(K)),[C.Pow]:N(W(2,2),H(K)),[C.Abs]:N(W(1,1),H(K)),[C.Floor]:N(W(1,1),H(K)),[C.Ceil]:N(W(1,1),H(K)),[C.Round]:N(W(1,1),H(K)),[C.Sin]:N(W(1,1),H(K)),[C.Cos]:N(W(1,1),H(K)),[C.Atan]:N(W(1,2),H(K)),[C.Sqrt]:N(W(1,1),H(K)),[C.Match]:N(W(4,1/0),nc,g_),[C.Between]:N(W(3,3),H(K)),[C.Interpolate]:N(W(6,1/0),nc,__),[C.Case]:N(W(3,1/0),f_,m_),[C.In]:N(W(2,2),p_),[C.Number]:N(W(1,1/0),H(nr)),[C.String]:N(W(1,1/0),H(nr)),[C.Array]:N(W(1,1/0),H(K)),[C.Color]:N(W(1,4),H(K)),[C.Band]:N(W(1,3),H(K)),[C.Palette]:N(W(2,2),y_),[C.ToString]:N(W(1,1),H(Rt|K|Ot|oe))};function ec(n,t,e){const i=n.length-1,s=new Array(i);for(let r=0;r<i;++r){const o=n[r+1];switch(typeof o){case"number":{s[r]=new ht(K,o);break}case"string":{s[r]=new ht(Ot,o);break}default:throw new Error(`expected a string key or numeric array index for a get operation, got ${o}`)}r===0&&e.properties.add(String(o))}return s}function c_(n,t,e){const i=n[1];if(typeof i!="string")throw new Error("expected a string argument for var operation");return e.variables.add(i),[new ht(Ot,i)]}function u_(n,t,e){e.featureId=!0}function d_(n,t,e){e.geometryType=!0}function Oo(n,t,e){e.mapState=!0}function nn(n,t,e){const i=n[0];if(n.length!==1)throw new Error(`expected no arguments for ${i} operation`);return[]}function W(n,t){return function(e,i,s){const r=e[0],o=e.length-1;if(n===t){if(o!==n){const a=n===1?"":"s";throw new Error(`expected ${n} argument${a} for ${r}, got ${o}`)}}else if(o<n||o>t){const a=t===1/0?`${n} or more`:`${n} to ${t}`;throw new Error(`expected ${a} arguments for ${r}, got ${o}`)}}}function ic(n,t,e){const i=n.length-1,s=new Array(i);for(let r=0;r<i;++r){const o=gt(n[r+1],t,e);s[r]=o}return s}function H(n){return function(t,e,i){const s=t.length-1,r=new Array(s);for(let o=0;o<s;++o){const a=gt(t[o+1],n,i);r[o]=a}return r}}function f_(n,t,e){const i=n[0],s=n.length-1;if(s%2===0)throw new Error(`expected an odd number of arguments for ${i}, got ${s} instead`)}function nc(n,t,e){const i=n[0],s=n.length-1;if(s%2===1)throw new Error(`expected an even number of arguments for operation ${i}, got ${s} instead`)}function g_(n,t,e){const i=n.length-1,s=Ot|K|Rt,r=gt(n[1],s,e),o=gt(n[n.length-1],t,e),a=new Array(i-2);for(let l=0;l<i-2;l+=2){try{const h=gt(n[l+2],r.type,e);a[l]=h}catch(h){throw new Error(`failed to parse argument ${l+1} of match expression: ${h.message}`)}try{const h=gt(n[l+3],o.type,e);a[l+1]=h}catch(h){throw new Error(`failed to parse argument ${l+2} of match expression: ${h.message}`)}}return[r,...a,o]}function __(n,t,e){const i=n[1];let s;switch(i[0]){case"linear":s=1;break;case"exponential":const l=i[1];if(typeof l!="number"||l<=0)throw new Error(`expected a number base for exponential interpolation, got ${JSON.stringify(l)} instead`);s=l;break;default:throw new Error(`invalid interpolation type: ${JSON.stringify(i)}`)}const r=new ht(K,s);let o;try{o=gt(n[2],K,e)}catch(l){throw new Error(`failed to parse argument 1 in interpolate expression: ${l.message}`)}const a=new Array(n.length-3);for(let l=0;l<a.length;l+=2){try{const h=gt(n[l+3],K,e);a[l]=h}catch(h){throw new Error(`failed to parse argument ${l+2} for interpolate expression: ${h.message}`)}try{const h=gt(n[l+4],t,e);a[l+1]=h}catch(h){throw new Error(`failed to parse argument ${l+3} for interpolate expression: ${h.message}`)}}return[r,o,...a]}function m_(n,t,e){const i=gt(n[n.length-1],t,e),s=new Array(n.length-1);for(let r=0;r<s.length-1;r+=2){try{const o=gt(n[r+1],Rt,e);s[r]=o}catch(o){throw new Error(`failed to parse argument ${r} of case expression: ${o.message}`)}try{const o=gt(n[r+2],i.type,e);s[r+1]=o}catch(o){throw new Error(`failed to parse argument ${r+1} of case expression: ${o.message}`)}}return s[s.length-1]=i,s}function p_(n,t,e){let i=n[2];if(!Array.isArray(i))throw new Error('the second argument for the "in" operator must be an array');let s;if(typeof i[0]=="string"){if(i[0]!=="literal")throw new Error('for the "in" operator, a string array should be wrapped in a "literal" operator to disambiguate from expressions');if(!Array.isArray(i[1]))throw new Error('failed to parse "in" expression: the literal operator must be followed by an array');i=i[1],s=Ot}else s=K;const r=new Array(i.length);for(let a=0;a<r.length;a++)try{const l=gt(i[a],s,e);r[a]=l}catch(l){throw new Error(`failed to parse haystack item ${a} for "in" expression: ${l.message}`)}return[gt(n[1],s,e),...r]}function y_(n,t,e){let i;try{i=gt(n[1],K,e)}catch(o){throw new Error(`failed to parse first argument in palette expression: ${o.message}`)}const s=n[2];if(!Array.isArray(s))throw new Error("the second argument of palette must be an array");const r=new Array(s.length);for(let o=0;o<r.length;o++){let a;try{a=gt(s[o],oe,e)}catch(l){throw new Error(`failed to parse color at index ${o} in palette expression: ${l.message}`)}if(!(a instanceof ht))throw new Error(`the palette color at index ${o} must be a literal value`);r[o]=a}return[i,...r]}function N(...n){return function(t,e,i){const s=t[0];let r;for(let o=0;o<n.length;o++){const a=n[o](t,e,i);if(o==n.length-1){if(!a)throw new Error("expected last argument validator to return the parsed args");r=a}}return new l_(e,s,...r)}}function x_(n,t,e){const i=n[0],s=h_[i];if(!s)throw new Error(`unknown operator: ${i}`);return s(n,t,e)}function sc(n){if(!n)return"";const t=n.getType();switch(t){case"Point":case"LineString":case"Polygon":return t;case"MultiPoint":case"MultiLineString":case"MultiPolygon":return t.substring(5);case"Circle":return"Polygon";case"GeometryCollection":return sc(n.getGeometries()[0]);default:return""}}function rc(){return{variables:{},properties:{},resolution:NaN,featureId:null,geometryType:""}}function be(n,t,e){const i=gt(n,t,e);return ae(i)}function ae(n,t){if(n instanceof ht){if(n.type===oe&&typeof n.value=="string"){const i=xo(n.value);return function(){return i}}return function(){return n.value}}const e=n.operator;switch(e){case C.Number:case C.String:case C.Coalesce:return E_(n);case C.Get:case C.Var:case C.Has:return w_(n);case C.Id:return i=>i.featureId;case C.GeometryType:return i=>i.geometryType;case C.Concat:{const i=n.args.map(s=>ae(s));return s=>"".concat(...i.map(r=>r(s).toString()))}case C.Resolution:return i=>i.resolution;case C.Any:case C.All:case C.Between:case C.In:case C.Not:return C_(n);case C.Equal:case C.NotEqual:case C.LessThan:case C.LessThanOrEqualTo:case C.GreaterThan:case C.GreaterThanOrEqualTo:return v_(n);case C.Multiply:case C.Divide:case C.Add:case C.Subtract:case C.Clamp:case C.Mod:case C.Pow:case C.Abs:case C.Floor:case C.Ceil:case C.Round:case C.Sin:case C.Cos:case C.Atan:case C.Sqrt:return R_(n);case C.Case:return T_(n);case C.Match:return I_(n);case C.Interpolate:return S_(n);case C.ToString:return b_(n);default:throw new Error(`Unsupported operator ${e}`)}}function E_(n,t){const e=n.operator,i=n.args.length,s=new Array(i);for(let r=0;r<i;++r)s[r]=ae(n.args[r]);switch(e){case C.Coalesce:return r=>{for(let o=0;o<i;++o){const a=s[o](r);if(typeof a<"u"&&a!==null)return a}throw new Error("Expected one of the values to be non-null")};case C.Number:case C.String:return r=>{for(let o=0;o<i;++o){const a=s[o](r);if(typeof a===e)return a}throw new Error(`Expected one of the values to be a ${e}`)};default:throw new Error(`Unsupported assertion operator ${e}`)}}function w_(n,t){const i=n.args[0].value;switch(n.operator){case C.Get:return s=>{const r=n.args;let o=s.properties[i];for(let a=1,l=r.length;a<l;++a){const c=r[a].value;o=o[c]}return o};case C.Var:return s=>s.variables[i];case C.Has:return s=>{const r=n.args;if(!(i in s.properties))return!1;let o=s.properties[i];for(let a=1,l=r.length;a<l;++a){const c=r[a].value;if(!o||!Object.hasOwn(o,c))return!1;o=o[c]}return!0};default:throw new Error(`Unsupported accessor operator ${n.operator}`)}}function v_(n,t){const e=n.operator,i=ae(n.args[0]),s=ae(n.args[1]);switch(e){case C.Equal:return r=>i(r)===s(r);case C.NotEqual:return r=>i(r)!==s(r);case C.LessThan:return r=>i(r)<s(r);case C.LessThanOrEqualTo:return r=>i(r)<=s(r);case C.GreaterThan:return r=>i(r)>s(r);case C.GreaterThanOrEqualTo:return r=>i(r)>=s(r);default:throw new Error(`Unsupported comparison operator ${e}`)}}function C_(n,t){const e=n.operator,i=n.args.length,s=new Array(i);for(let r=0;r<i;++r)s[r]=ae(n.args[r]);switch(e){case C.Any:return r=>{for(let o=0;o<i;++o)if(s[o](r))return!0;return!1};case C.All:return r=>{for(let o=0;o<i;++o)if(!s[o](r))return!1;return!0};case C.Between:return r=>{const o=s[0](r),a=s[1](r),l=s[2](r);return o>=a&&o<=l};case C.In:return r=>{const o=s[0](r);for(let a=1;a<i;++a)if(o===s[a](r))return!0;return!1};case C.Not:return r=>!s[0](r);default:throw new Error(`Unsupported logical operator ${e}`)}}function R_(n,t){const e=n.operator,i=n.args.length,s=new Array(i);for(let r=0;r<i;++r)s[r]=ae(n.args[r]);switch(e){case C.Multiply:return r=>{let o=1;for(let a=0;a<i;++a)o*=s[a](r);return o};case C.Divide:return r=>s[0](r)/s[1](r);case C.Add:return r=>{let o=0;for(let a=0;a<i;++a)o+=s[a](r);return o};case C.Subtract:return r=>s[0](r)-s[1](r);case C.Clamp:return r=>{const o=s[0](r),a=s[1](r);if(o<a)return a;const l=s[2](r);return o>l?l:o};case C.Mod:return r=>s[0](r)%s[1](r);case C.Pow:return r=>Math.pow(s[0](r),s[1](r));case C.Abs:return r=>Math.abs(s[0](r));case C.Floor:return r=>Math.floor(s[0](r));case C.Ceil:return r=>Math.ceil(s[0](r));case C.Round:return r=>Math.round(s[0](r));case C.Sin:return r=>Math.sin(s[0](r));case C.Cos:return r=>Math.cos(s[0](r));case C.Atan:return i===2?r=>Math.atan2(s[0](r),s[1](r)):r=>Math.atan(s[0](r));case C.Sqrt:return r=>Math.sqrt(s[0](r));default:throw new Error(`Unsupported numeric operator ${e}`)}}function T_(n,t){const e=n.args.length,i=new Array(e);for(let s=0;s<e;++s)i[s]=ae(n.args[s]);return s=>{for(let r=0;r<e-1;r+=2)if(i[r](s))return i[r+1](s);return i[e-1](s)}}function I_(n,t){const e=n.args.length,i=new Array(e);for(let s=0;s<e;++s)i[s]=ae(n.args[s]);return s=>{const r=i[0](s);for(let o=1;o<e-1;o+=2)if(r===i[o](s))return i[o+1](s);return i[e-1](s)}}function S_(n,t){const e=n.args.length,i=new Array(e);for(let s=0;s<e;++s)i[s]=ae(n.args[s]);return s=>{const r=i[0](s),o=i[1](s);let a,l;for(let h=2;h<e;h+=2){const c=i[h](s);let u=i[h+1](s);const d=Array.isArray(u);if(d&&(u=qf(u)),c>=o)return h===2?u:d?L_(r,o,a,l,c,u):qn(r,o,a,l,c,u);a=c,l=u}return l}}function b_(n,t){const e=n.operator,i=n.args.length,s=new Array(i);for(let r=0;r<i;++r)s[r]=ae(n.args[r]);switch(e){case C.ToString:return r=>{const o=s[0](r);return n.args[0].type===oe?Eo(o):o.toString()};default:throw new Error(`Unsupported convert operator ${e}`)}}function qn(n,t,e,i,s,r){const o=s-e;if(o===0)return i;const a=t-e,l=n===1?a/o:(Math.pow(n,a)-1)/(Math.pow(n,o)-1);return i+l*(r-i)}function L_(n,t,e,i,s,r){if(s-e===0)return i;const a=yh(i),l=yh(r);let h=l[2]-a[2];h>180?h-=360:h<-180&&(h+=360);const c=[qn(n,t,e,a[0],s,l[0]),qn(n,t,e,a[1],s,l[1]),a[2]+qn(n,t,e,0,s,h),qn(n,t,e,i[3],s,r[3])];return Jf(c)}function A_(n){return!0}function M_(n){const t=tc(),e=P_(n,t),i=rc();return function(s,r){if(i.properties=s.getPropertiesInternal(),i.resolution=r,t.featureId){const o=s.getId();o!==void 0?i.featureId=o:i.featureId=null}return t.geometryType&&(i.geometryType=sc(s.getGeometry())),e(i)}}function oc(n){const t=tc(),e=n.length,i=new Array(e);for(let o=0;o<e;++o)i[o]=Do(n[o],t);const s=rc(),r=new Array(e);return function(o,a){if(s.properties=o.getPropertiesInternal(),s.resolution=a,t.featureId){const h=o.getId();h!==void 0?s.featureId=h:s.featureId=null}let l=0;for(let h=0;h<e;++h){const c=i[h](s);c&&(r[l]=c,l+=1)}return r.length=l,r}}function P_(n,t){const e=n.length,i=new Array(e);for(let s=0;s<e;++s){const r=n[s],o="filter"in r?be(r.filter,Rt,t):A_;let a;if(Array.isArray(r.style)){const l=r.style.length;a=new Array(l);for(let h=0;h<l;++h)a[h]=Do(r.style[h],t)}else a=[Do(r.style,t)];i[s]={filter:o,styles:a}}return function(s){const r=[];let o=!1;for(let a=0;a<e;++a){const l=i[a].filter;if(l(s)&&!(n[a].else&&o)){o=!0;for(const h of i[a].styles){const c=h(s);c&&r.push(c)}}}return r}}function Do(n,t){const e=Jn(n,"",t),i=Qn(n,"",t),s=O_(n,t),r=D_(n,t),o=Dt(n,"z-index",t);if(!e&&!i&&!s&&!r&&!Ni(n))throw new Error("No fill, stroke, point, or text symbolizer properties in style: "+JSON.stringify(n));const a=new Te;return function(l){let h=!0;if(e){const c=e(l);c&&(h=!1),a.setFill(c)}if(i){const c=i(l);c&&(h=!1),a.setStroke(c)}if(s){const c=s(l);c&&(h=!1),a.setText(c)}if(r){const c=r(l);c&&(h=!1),a.setImage(c)}return o&&a.setZIndex(o(l)),h?null:a}}function Jn(n,t,e){let i;if(t+"fill-pattern-src"in n)i=G_(n,t+"fill-",e);else{if(n[t+"fill-color"]==="none")return r=>null;i=Fo(n,t+"fill-color",e)}if(!i)return null;const s=new Zn;return function(r){const o=i(r);return o===uo?null:(s.setColor(o),s)}}function Qn(n,t,e){const i=Dt(n,t+"stroke-width",e),s=Fo(n,t+"stroke-color",e);if(!i&&!s)return null;const r=Le(n,t+"stroke-line-cap",e),o=Le(n,t+"stroke-line-join",e),a=ac(n,t+"stroke-line-dash",e),l=Dt(n,t+"stroke-line-dash-offset",e),h=Dt(n,t+"stroke-miter-limit",e),c=new qs;return function(u){if(s){const d=s(u);if(d===uo)return null;c.setColor(d)}if(i&&c.setWidth(i(u)),r){const d=r(u);if(d!=="butt"&&d!=="round"&&d!=="square")throw new Error("Expected butt, round, or square line cap");c.setLineCap(d)}if(o){const d=o(u);if(d!=="bevel"&&d!=="round"&&d!=="miter")throw new Error("Expected bevel, round, or miter line join");c.setLineJoin(d)}return a&&c.setLineDash(a(u)),l&&c.setLineDashOffset(l(u)),h&&c.setMiterLimit(h(u)),c}}function O_(n,t){const e="text-",i=Le(n,e+"value",t);if(!i)return null;const s=Jn(n,e,t),r=Jn(n,e+"background-",t),o=Qn(n,e,t),a=Qn(n,e+"background-",t),l=Le(n,e+"font",t),h=Dt(n,e+"max-angle",t),c=Dt(n,e+"offset-x",t),u=Dt(n,e+"offset-y",t),d=sn(n,e+"overflow",t),f=Le(n,e+"placement",t),g=Dt(n,e+"repeat",t),m=rr(n,e+"scale",t),_=sn(n,e+"rotate-with-view",t),p=Dt(n,e+"rotation",t),y=Le(n,e+"align",t),v=Le(n,e+"justify",t),x=Le(n,e+"baseline",t),E=sn(n,e+"keep-upright",t),w=ac(n,e+"padding",t),T=ar(n,e+"declutter-mode"),R=new zg({declutterMode:T});return function(I){if(R.setText(i(I)),s&&R.setFill(s(I)),r&&R.setBackgroundFill(r(I)),o&&R.setStroke(o(I)),a&&R.setBackgroundStroke(a(I)),l&&R.setFont(l(I)),h&&R.setMaxAngle(h(I)),c&&R.setOffsetX(c(I)),u&&R.setOffsetY(u(I)),d&&R.setOverflow(d(I)),f){const L=f(I);if(L!=="point"&&L!=="line")throw new Error("Expected point or line for text-placement");R.setPlacement(L)}if(g&&R.setRepeat(g(I)),m&&R.setScale(m(I)),_&&R.setRotateWithView(_(I)),p&&R.setRotation(p(I)),y){const L=y(I);if(L!=="left"&&L!=="center"&&L!=="right"&&L!=="end"&&L!=="start")throw new Error("Expected left, right, center, start, or end for text-align");R.setTextAlign(L)}if(v){const L=v(I);if(L!=="left"&&L!=="right"&&L!=="center")throw new Error("Expected left, right, or center for text-justify");R.setJustify(L)}if(x){const L=x(I);if(L!=="bottom"&&L!=="top"&&L!=="middle"&&L!=="alphabetic"&&L!=="hanging")throw new Error("Expected bottom, top, middle, alphabetic, or hanging for text-baseline");R.setTextBaseline(L)}return w&&R.setPadding(w(I)),E&&R.setKeepUpright(E(I)),R}}function D_(n,t){return"icon-src"in n?F_(n,t):"shape-points"in n?k_(n,t):"circle-radius"in n?N_(n,t):null}function F_(n,t){const e="icon-",i=e+"src",s=uc(n[i],i),r=sr(n,e+"anchor",t),o=rr(n,e+"scale",t),a=Dt(n,e+"opacity",t),l=sr(n,e+"displacement",t),h=Dt(n,e+"rotation",t),c=sn(n,e+"rotate-with-view",t),u=hc(n,e+"anchor-origin"),d=cc(n,e+"anchor-x-units"),f=cc(n,e+"anchor-y-units"),g=Y_(n,e+"color"),m=W_(n,e+"cross-origin"),_=X_(n,e+"offset"),p=hc(n,e+"offset-origin"),y=or(n,e+"width"),v=or(n,e+"height"),x=z_(n,e+"size"),E=ar(n,e+"declutter-mode"),w=new tn({src:s,anchorOrigin:u,anchorXUnits:d,anchorYUnits:f,color:g,crossOrigin:m,offset:_,offsetOrigin:p,height:v,width:y,size:x,declutterMode:E});return function(T){return a&&w.setOpacity(a(T)),l&&w.setDisplacement(l(T)),h&&w.setRotation(h(T)),c&&w.setRotateWithView(c(T)),o&&w.setScale(o(T)),r&&w.setAnchor(r(T)),w}}function k_(n,t){const e="shape-",i=e+"points",s=e+"radius",r=ko(n[i],i),o=ko(n[s],s),a=Jn(n,e,t),l=Qn(n,e,t),h=rr(n,e+"scale",t),c=sr(n,e+"displacement",t),u=Dt(n,e+"rotation",t),d=sn(n,e+"rotate-with-view",t),f=or(n,e+"radius2"),g=or(n,e+"angle"),m=ar(n,e+"declutter-mode"),_=new Qs({points:r,radius:o,radius2:f,angle:g,declutterMode:m});return function(p){return a&&_.setFill(a(p)),l&&_.setStroke(l(p)),c&&_.setDisplacement(c(p)),u&&_.setRotation(u(p)),d&&_.setRotateWithView(d(p)),h&&_.setScale(h(p)),_}}function N_(n,t){const e="circle-",i=Jn(n,e,t),s=Qn(n,e,t),r=Dt(n,e+"radius",t),o=rr(n,e+"scale",t),a=sr(n,e+"displacement",t),l=Dt(n,e+"rotation",t),h=sn(n,e+"rotate-with-view",t),c=ar(n,e+"declutter-mode"),u=new tr({radius:5,declutterMode:c});return function(d){return r&&u.setRadius(r(d)),i&&u.setFill(i(d)),s&&u.setStroke(s(d)),a&&u.setDisplacement(a(d)),l&&u.setRotation(l(d)),h&&u.setRotateWithView(h(d)),o&&u.setScale(o(d)),u}}function Dt(n,t,e){if(!(t in n))return;const i=be(n[t],K,e);return function(s){return ko(i(s),t)}}function Le(n,t,e){if(!(t in n))return null;const i=be(n[t],Ot,e);return function(s){return uc(i(s),t)}}function G_(n,t,e){const i=Le(n,t+"pattern-src",e),s=lc(n,t+"pattern-offset",e),r=lc(n,t+"pattern-size",e),o=Fo(n,t+"color",e);return function(a){return{src:i(a),offset:s&&s(a),size:r&&r(a),color:o&&o(a)}}}function sn(n,t,e){if(!(t in n))return null;const i=be(n[t],Rt,e);return function(s){const r=i(s);if(typeof r!="boolean")throw new Error(`Expected a boolean for ${t}`);return r}}function Fo(n,t,e){if(!(t in n))return null;const i=be(n[t],oe,e);return function(s){return dc(i(s),t)}}function ac(n,t,e){if(!(t in n))return null;const i=be(n[t],wi,e);return function(s){return ts(i(s),t)}}function sr(n,t,e){if(!(t in n))return null;const i=be(n[t],wi,e);return function(s){const r=ts(i(s),t);if(r.length!==2)throw new Error(`Expected two numbers for ${t}`);return r}}function lc(n,t,e){if(!(t in n))return null;const i=be(n[t],wi,e);return function(s){return fc(i(s),t)}}function rr(n,t,e){if(!(t in n))return null;const i=be(n[t],wi|K,e);return function(s){return $_(i(s),t)}}function or(n,t){const e=n[t];if(e!==void 0){if(typeof e!="number")throw new Error(`Expected a number for ${t}`);return e}}function z_(n,t){const e=n[t];if(e!==void 0){if(typeof e=="number")return Pt(e);if(!Array.isArray(e))throw new Error(`Expected a number or size array for ${t}`);if(e.length!==2||typeof e[0]!="number"||typeof e[1]!="number")throw new Error(`Expected a number or size array for ${t}`);return e}}function W_(n,t){const e=n[t];if(e!==void 0){if(typeof e!="string")throw new Error(`Expected a string for ${t}`);return e}}function hc(n,t){const e=n[t];if(e!==void 0){if(e!=="bottom-left"&&e!=="bottom-right"&&e!=="top-left"&&e!=="top-right")throw new Error(`Expected bottom-left, bottom-right, top-left, or top-right for ${t}`);return e}}function cc(n,t){const e=n[t];if(e!==void 0){if(e!=="pixels"&&e!=="fraction")throw new Error(`Expected pixels or fraction for ${t}`);return e}}function X_(n,t){const e=n[t];if(e!==void 0)return ts(e,t)}function ar(n,t){const e=n[t];if(e!==void 0){if(typeof e!="string")throw new Error(`Expected a string for ${t}`);if(e!=="declutter"&&e!=="obstacle"&&e!=="none")throw new Error(`Expected declutter, obstacle, or none for ${t}`);return e}}function Y_(n,t){const e=n[t];if(e!==void 0)return dc(e,t)}function ts(n,t){if(!Array.isArray(n))throw new Error(`Expected an array for ${t}`);const e=n.length;for(let i=0;i<e;++i)if(typeof n[i]!="number")throw new Error(`Expected an array of numbers for ${t}`);return n}function uc(n,t){if(typeof n!="string")throw new Error(`Expected a string for ${t}`);return n}function ko(n,t){if(typeof n!="number")throw new Error(`Expected a number for ${t}`);return n}function dc(n,t){if(typeof n=="string")return n;const e=ts(n,t),i=e.length;if(i<3||i>4)throw new Error(`Expected a color with 3 or 4 values for ${t}`);return e}function fc(n,t){const e=ts(n,t);if(e.length!==2)throw new Error(`Expected an array of two numbers for ${t}`);return e}function $_(n,t){return typeof n=="number"?n:fc(n,t)}const le={CENTER:"center",RESOLUTION:"resolution",ROTATION:"rotation"};function gc(n,t,e){return(function(i,s,r,o,a){if(!i)return;if(!s&&!t)return i;const l=t?0:r[0]*s,h=t?0:r[1]*s,c=a?a[0]:0,u=a?a[1]:0;let d=n[0]+l/2+c,f=n[2]-l/2+c,g=n[1]+h/2+u,m=n[3]-h/2+u;d>f&&(d=(f+d)/2,f=d),g>m&&(g=(m+g)/2,m=g);let _=st(i[0],d,f),p=st(i[1],g,m);if(o&&e&&s){const y=30*s;_+=-y*Math.log(1+Math.max(0,d-i[0])/y)+y*Math.log(1+Math.max(0,i[0]-f)/y),p+=-y*Math.log(1+Math.max(0,g-i[1])/y)+y*Math.log(1+Math.max(0,i[1]-m)/y)}return[_,p]})}function K_(n){return n}function _c(n){return Math.pow(n,3)}function rn(n){return 1-_c(1-n)}function B_(n){return 3*n*n-2*n*n*n}function Z_(n){return n}function No(n,t,e,i){const s=Q(t)/e[0],r=Ct(t)/e[1];return i?Math.min(n,Math.max(s,r)):Math.min(n,Math.min(s,r))}function Go(n,t,e){let i=Math.min(n,t);const s=50;return i*=Math.log(1+s*Math.max(0,n/t-1))/s+1,e&&(i=Math.max(i,e),i/=Math.log(1+s*Math.max(0,e/n-1))/s+1),st(i,e/2,t*2)}function U_(n,t,e,i){return t=t!==void 0?t:!0,(function(s,r,o,a){if(s!==void 0){const l=n[0],h=n[n.length-1],c=e?No(l,e,o,i):l;if(a)return t?Go(s,c,h):st(s,h,c);const u=Math.min(c,s),d=Math.floor(Dr(n,u,r));return n[d]>c&&d<n.length-1?n[d+1]:n[d]}})}function V_(n,t,e,i,s,r){return i=i!==void 0?i:!0,e=e!==void 0?e:0,(function(o,a,l,h){if(o!==void 0){const c=s?No(t,s,l,r):t;if(h)return i?Go(o,c,e):st(o,e,c);const u=1e-9,d=Math.ceil(Math.log(t/c)/Math.log(n)-u),f=-a*(.5-u)+.5,g=Math.min(c,o),m=Math.floor(Math.log(t/g)/Math.log(n)+f),_=Math.max(d,m),p=t/Math.pow(n,_);return st(p,e,c)}})}function mc(n,t,e,i,s){return e=e!==void 0?e:!0,(function(r,o,a,l){if(r!==void 0){const h=i?No(n,i,a,s):n;return!e||!l?st(r,t,h):Go(r,h,t)}})}function zo(n){if(n!==void 0)return 0}function pc(n){if(n!==void 0)return n}function j_(n){const t=2*Math.PI/n;return(function(e,i){if(i)return e;if(e!==void 0)return e=Math.floor(e/t+.5)*t,e})}function H_(n){const t=$e(5);return(function(e,i){return i||e===void 0?e:Math.abs(e)<=t?0:e})}const q_=42,Wo=256,Xo=0;class ge extends ne{constructor(t){super(),this.on,this.once,this.un,t=Object.assign({},t),this.hints_=[0,0],this.animations_=[],this.updateAnimationKey_,this.projection_=Qr(t.projection,"EPSG:3857"),this.viewportSize_=[100,100],this.targetCenter_=null,this.targetResolution_,this.targetRotation_,this.nextCenter_=null,this.nextResolution_,this.nextRotation_,this.cancelAnchor_=void 0,t.projection&&Kl(),t.center&&(t.center=we(t.center,this.projection_)),t.extent&&(t.extent=Ke(t.extent,this.projection_)),this.applyOptions_(t)}applyOptions_(t){const e=Object.assign({},t);for(const a in le)delete e[a];this.setProperties(e,!0);const i=Q_(t);this.maxResolution_=i.maxResolution,this.minResolution_=i.minResolution,this.zoomFactor_=i.zoomFactor,this.resolutions_=t.resolutions,this.padding_=t.padding,this.minZoom_=i.minZoom;const s=J_(t),r=i.constraint,o=tm(t);this.constraints_={center:s,resolution:r,rotation:o},this.setRotation(t.rotation!==void 0?t.rotation:0),this.setCenterInternal(t.center!==void 0?t.center:null),t.resolution!==void 0?this.setResolution(t.resolution):t.zoom!==void 0&&this.setZoom(t.zoom)}get padding(){return this.padding_}set padding(t){let e=this.padding_;this.padding_=t;const i=this.getCenterInternal();if(i){const s=t||[0,0,0,0];e=e||[0,0,0,0];const r=this.getResolution(),o=r/2*(s[3]-e[3]+e[1]-s[1]),a=r/2*(s[0]-e[0]+e[2]-s[2]);this.setCenterInternal([i[0]+o,i[1]-a])}}getUpdatedOptions_(t){const e=this.getProperties();return e.resolution!==void 0?e.resolution=this.getResolution():e.zoom=this.getZoom(),e.center=this.getCenterInternal(),e.rotation=this.getRotation(),Object.assign({},e,t)}animate(t){this.isDef()&&!this.getAnimating()&&this.resolveConstraints(0);const e=new Array(arguments.length);for(let i=0;i<e.length;++i){let s=arguments[i];s.center&&(s=Object.assign({},s),s.center=we(s.center,this.getProjection())),s.anchor&&(s=Object.assign({},s),s.anchor=we(s.anchor,this.getProjection())),e[i]=s}this.animateInternal.apply(this,e)}animateInternal(t){let e=arguments.length,i;e>1&&typeof arguments[e-1]=="function"&&(i=arguments[e-1],--e);let s=0;for(;s<e&&!this.isDef();++s){const c=arguments[s];c.center&&this.setCenterInternal(c.center),c.zoom!==void 0?this.setZoom(c.zoom):c.resolution&&this.setResolution(c.resolution),c.rotation!==void 0&&this.setRotation(c.rotation)}if(s===e){i&&lr(i,!0);return}let r=Date.now(),o=this.targetCenter_.slice(),a=this.targetResolution_,l=this.targetRotation_;const h=[];for(;s<e;++s){const c=arguments[s],u={start:r,complete:!1,anchor:c.anchor,duration:c.duration!==void 0?c.duration:1e3,easing:c.easing||B_,callback:i};if(c.center&&(u.sourceCenter=o,u.targetCenter=c.center.slice(),o=u.targetCenter),c.zoom!==void 0?(u.sourceResolution=a,u.targetResolution=this.getResolutionForZoom(c.zoom),a=u.targetResolution):c.resolution&&(u.sourceResolution=a,u.targetResolution=c.resolution,a=u.targetResolution),c.rotation!==void 0){u.sourceRotation=l;const d=Xi(c.rotation-l+Math.PI,2*Math.PI)-Math.PI;u.targetRotation=l+d,l=u.targetRotation}em(u)?u.complete=!0:r+=u.duration,h.push(u)}this.animations_.push(h),this.setHint(_t.ANIMATING,1),this.updateAnimations_()}getAnimating(){return this.hints_[_t.ANIMATING]>0}getInteracting(){return this.hints_[_t.INTERACTING]>0}cancelAnimations(){this.setHint(_t.ANIMATING,-this.hints_[_t.ANIMATING]);let t;for(let e=0,i=this.animations_.length;e<i;++e){const s=this.animations_[e];if(s[0].callback&&lr(s[0].callback,!1),!t)for(let r=0,o=s.length;r<o;++r){const a=s[r];if(!a.complete){t=a.anchor;break}}}this.animations_.length=0,this.cancelAnchor_=t,this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN}updateAnimations_(){if(this.updateAnimationKey_!==void 0&&(cancelAnimationFrame(this.updateAnimationKey_),this.updateAnimationKey_=void 0),!this.getAnimating())return;const t=Date.now();let e=!1;for(let i=this.animations_.length-1;i>=0;--i){const s=this.animations_[i];let r=!0;for(let o=0,a=s.length;o<a;++o){const l=s[o];if(l.complete)continue;const h=t-l.start;let c=l.duration>0?h/l.duration:1;c>=1?(l.complete=!0,c=1):r=!1;const u=l.easing(c);if(l.sourceCenter){const d=l.sourceCenter[0],f=l.sourceCenter[1],g=l.targetCenter[0],m=l.targetCenter[1];this.nextCenter_=l.targetCenter;const _=d+u*(g-d),p=f+u*(m-f);this.targetCenter_=[_,p]}if(l.sourceResolution&&l.targetResolution){const d=u===1?l.targetResolution:l.sourceResolution+u*(l.targetResolution-l.sourceResolution);if(l.anchor){const f=this.getViewportSize_(this.getRotation()),g=this.constraints_.resolution(d,0,f,!0);this.targetCenter_=this.calculateCenterZoom(g,l.anchor)}this.nextResolution_=l.targetResolution,this.targetResolution_=d,this.applyTargetState_(!0)}if(l.sourceRotation!==void 0&&l.targetRotation!==void 0){const d=u===1?Xi(l.targetRotation+Math.PI,2*Math.PI)-Math.PI:l.sourceRotation+u*(l.targetRotation-l.sourceRotation);if(l.anchor){const f=this.constraints_.rotation(d,!0);this.targetCenter_=this.calculateCenterRotate(f,l.anchor)}this.nextRotation_=l.targetRotation,this.targetRotation_=d}if(this.applyTargetState_(!0),e=!0,!l.complete)break}if(r){this.animations_[i]=null,this.setHint(_t.ANIMATING,-1),this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN;const o=s[0].callback;o&&lr(o,!0)}}this.animations_=this.animations_.filter(Boolean),e&&this.updateAnimationKey_===void 0&&(this.updateAnimationKey_=requestAnimationFrame(this.updateAnimations_.bind(this)))}calculateCenterRotate(t,e){let i;const s=this.getCenterInternal();return s!==void 0&&(i=[s[0]-e[0],s[1]-e[1]],$r(i,t-this.getRotation()),Fd(i,e)),i}calculateCenterZoom(t,e){let i;const s=this.getCenterInternal(),r=this.getResolution();if(s!==void 0&&r!==void 0){const o=e[0]-t*(e[0]-s[0])/r,a=e[1]-t*(e[1]-s[1])/r;i=[o,a]}return i}getViewportSize_(t){const e=this.viewportSize_;if(t){const i=e[0],s=e[1];return[Math.abs(i*Math.cos(t))+Math.abs(s*Math.sin(t)),Math.abs(i*Math.sin(t))+Math.abs(s*Math.cos(t))]}return e}setViewportSize(t){this.viewportSize_=Array.isArray(t)?t.slice():[100,100],this.getAnimating()||this.resolveConstraints(0)}getCenter(){const t=this.getCenterInternal();return t&&so(t,this.getProjection())}getCenterInternal(){return this.get(le.CENTER)}getConstraints(){return this.constraints_}getConstrainResolution(){return this.get("constrainResolution")}getHints(t){return t!==void 0?(t[0]=this.hints_[0],t[1]=this.hints_[1],t):this.hints_.slice()}calculateExtent(t){const e=this.calculateExtentInternal(t);return Ul(e,this.getProjection())}calculateExtentInternal(t){t=t||this.getViewportSizeMinusPadding_();const e=this.getCenterInternal();J(e,"The view center is not defined");const i=this.getResolution();J(i!==void 0,"The view resolution is not defined");const s=this.getRotation();return J(s!==void 0,"The view rotation is not defined"),Xr(e,i,s,t)}getMaxResolution(){return this.maxResolution_}getMinResolution(){return this.minResolution_}getMaxZoom(){return this.getZoomForResolution(this.minResolution_)}setMaxZoom(t){this.applyOptions_(this.getUpdatedOptions_({maxZoom:t}))}getMinZoom(){return this.getZoomForResolution(this.maxResolution_)}setMinZoom(t){this.applyOptions_(this.getUpdatedOptions_({minZoom:t}))}setConstrainResolution(t){this.applyOptions_(this.getUpdatedOptions_({constrainResolution:t}))}getProjection(){return this.projection_}getResolution(){return this.get(le.RESOLUTION)}getResolutions(){return this.resolutions_}getResolutionForExtent(t,e){return this.getResolutionForExtentInternal(Ke(t,this.getProjection()),e)}getResolutionForExtentInternal(t,e){e=e||this.getViewportSizeMinusPadding_();const i=Q(t)/e[0],s=Ct(t)/e[1];return Math.max(i,s)}getResolutionForValueFunction(t){t=t||2;const e=this.getConstrainedResolution(this.maxResolution_),i=this.minResolution_,s=Math.log(e/i)/Math.log(t);return(function(r){return e/Math.pow(t,r*s)})}getRotation(){return this.get(le.ROTATION)}getValueForResolutionFunction(t){const e=Math.log(t||2),i=this.getConstrainedResolution(this.maxResolution_),s=this.minResolution_,r=Math.log(i/s)/e;return(function(o){return Math.log(i/o)/e/r})}getViewportSizeMinusPadding_(t){let e=this.getViewportSize_(t);const i=this.padding_;return i&&(e=[e[0]-i[1]-i[3],e[1]-i[0]-i[2]]),e}getState(){const t=this.getProjection(),e=this.getResolution(),i=this.getRotation();let s=this.getCenterInternal();const r=this.padding_;if(r){const o=this.getViewportSizeMinusPadding_();s=Yo(s,this.getViewportSize_(),[o[0]/2+r[3],o[1]/2+r[0]],e,i)}return{center:s.slice(0),projection:t!==void 0?t:null,resolution:e,nextCenter:this.nextCenter_,nextResolution:this.nextResolution_,nextRotation:this.nextRotation_,rotation:i,zoom:this.getZoom()}}getViewStateAndExtent(){return{viewState:this.getState(),extent:this.calculateExtent()}}getZoom(){let t;const e=this.getResolution();return e!==void 0&&(t=this.getZoomForResolution(e)),t}getZoomForResolution(t){let e=this.minZoom_||0,i,s;if(this.resolutions_){const r=Dr(this.resolutions_,t,1);e=r,i=this.resolutions_[r],r==this.resolutions_.length-1?s=2:s=i/this.resolutions_[r+1]}else i=this.maxResolution_,s=this.zoomFactor_;return e+Math.log(i/t)/Math.log(s)}getResolutionForZoom(t){if(this.resolutions_?.length){if(this.resolutions_.length===1)return this.resolutions_[0];const e=st(Math.floor(t),0,this.resolutions_.length-2),i=this.resolutions_[e]/this.resolutions_[e+1];return this.resolutions_[e]/Math.pow(i,st(t-e,0,1))}return this.maxResolution_/Math.pow(this.zoomFactor_,t-this.minZoom_)}fit(t,e){let i;if(J(Array.isArray(t)||typeof t.getSimplifiedGeometry=="function","Invalid extent or geometry provided as `geometry`"),Array.isArray(t)){J(!As(t),"Cannot fit empty extent provided as `geometry`");const s=Ke(t,this.getProjection());i=ch(s)}else if(t.getType()==="Circle"){const s=Ke(t.getExtent(),this.getProjection());i=ch(s),i.rotate(this.getRotation(),hi(s))}else i=t;this.fitInternal(i,e)}rotatedExtentForGeometry(t){const e=this.getRotation(),i=Math.cos(e),s=Math.sin(-e),r=t.getFlatCoordinates(),o=t.getStride();let a=1/0,l=1/0,h=-1/0,c=-1/0;for(let u=0,d=r.length;u<d;u+=o){const f=r[u]*i-r[u+1]*s,g=r[u]*s+r[u+1]*i;a=Math.min(a,f),l=Math.min(l,g),h=Math.max(h,f),c=Math.max(c,g)}return[a,l,h,c]}fitInternal(t,e){e=e||{};let i=e.size;i||(i=this.getViewportSizeMinusPadding_());const s=e.padding!==void 0?e.padding:[0,0,0,0],r=e.nearest!==void 0?e.nearest:!1;let o;e.minResolution!==void 0?o=e.minResolution:e.maxZoom!==void 0?o=this.getResolutionForZoom(e.maxZoom):o=0;const a=this.rotatedExtentForGeometry(t);let l=this.getResolutionForExtentInternal(a,[i[0]-s[1]-s[3],i[1]-s[0]-s[2]]);l=isNaN(l)?o:Math.max(l,o),l=this.getConstrainedResolution(l,r?0:1);const h=this.getRotation(),c=Math.sin(h),u=Math.cos(h),d=hi(a);d[0]+=(s[1]-s[3])/2*l,d[1]+=(s[0]-s[2])/2*l;const f=d[0]*u-d[1]*c,g=d[1]*u+d[0]*c,m=this.getConstrainedCenter([f,g],l),_=e.callback?e.callback:Tn;e.duration!==void 0?this.animateInternal({resolution:l,center:m,duration:e.duration,easing:e.easing},_):(this.targetResolution_=l,this.targetCenter_=m,this.applyTargetState_(!1,!0),lr(_,!0))}centerOn(t,e,i){this.centerOnInternal(we(t,this.getProjection()),e,i)}centerOnInternal(t,e,i){this.setCenterInternal(Yo(t,e,i,this.getResolution(),this.getRotation()))}calculateCenterShift(t,e,i,s){let r;const o=this.padding_;if(o&&t){const a=this.getViewportSizeMinusPadding_(-i),l=Yo(t,s,[a[0]/2+o[3],a[1]/2+o[0]],e,i);r=[t[0]-l[0],t[1]-l[1]]}return r}isDef(){return!!this.getCenterInternal()&&this.getResolution()!==void 0}adjustCenter(t){const e=so(this.targetCenter_,this.getProjection());this.setCenter([e[0]+t[0],e[1]+t[1]])}adjustCenterInternal(t){const e=this.targetCenter_;this.setCenterInternal([e[0]+t[0],e[1]+t[1]])}adjustResolution(t,e){e=e&&we(e,this.getProjection()),this.adjustResolutionInternal(t,e)}adjustResolutionInternal(t,e){const i=this.getAnimating()||this.getInteracting(),s=this.getViewportSize_(this.getRotation()),r=this.constraints_.resolution(this.targetResolution_*t,0,s,i);e&&(this.targetCenter_=this.calculateCenterZoom(r,e)),this.targetResolution_*=t,this.applyTargetState_()}adjustZoom(t,e){this.adjustResolution(Math.pow(this.zoomFactor_,-t),e)}adjustRotation(t,e){e&&(e=we(e,this.getProjection())),this.adjustRotationInternal(t,e)}adjustRotationInternal(t,e){const i=this.getAnimating()||this.getInteracting(),s=this.constraints_.rotation(this.targetRotation_+t,i);e&&(this.targetCenter_=this.calculateCenterRotate(s,e)),this.targetRotation_+=t,this.applyTargetState_()}setCenter(t){this.setCenterInternal(t&&we(t,this.getProjection()))}setCenterInternal(t){this.targetCenter_=t,this.applyTargetState_()}setHint(t,e){return this.hints_[t]+=e,this.changed(),this.hints_[t]}setResolution(t){this.targetResolution_=t,this.applyTargetState_()}setRotation(t){this.targetRotation_=t,this.applyTargetState_()}setZoom(t){this.setResolution(this.getResolutionForZoom(t))}applyTargetState_(t,e){const i=this.getAnimating()||this.getInteracting()||e,s=this.constraints_.rotation(this.targetRotation_,i),r=this.getViewportSize_(s),o=this.constraints_.resolution(this.targetResolution_,0,r,i),a=this.constraints_.center(this.targetCenter_,o,r,i,this.calculateCenterShift(this.targetCenter_,o,s,r));this.get(le.ROTATION)!==s&&this.set(le.ROTATION,s),this.get(le.RESOLUTION)!==o&&(this.set(le.RESOLUTION,o),this.set("zoom",this.getZoom(),!0)),(!a||!this.get(le.CENTER)||!Ds(this.get(le.CENTER),a))&&this.set(le.CENTER,a),this.getAnimating()&&!t&&this.cancelAnimations(),this.cancelAnchor_=void 0}resolveConstraints(t,e,i){t=t!==void 0?t:200;const s=e||0,r=this.constraints_.rotation(this.targetRotation_),o=this.getViewportSize_(r),a=this.constraints_.resolution(this.targetResolution_,s,o),l=this.constraints_.center(this.targetCenter_,a,o,!1,this.calculateCenterShift(this.targetCenter_,a,r,o));if(t===0&&!this.cancelAnchor_){this.targetResolution_=a,this.targetRotation_=r,this.targetCenter_=l,this.applyTargetState_();return}i=i||(t===0?this.cancelAnchor_:void 0),this.cancelAnchor_=void 0,(this.getResolution()!==a||this.getRotation()!==r||!this.getCenterInternal()||!Ds(this.getCenterInternal(),l))&&(this.getAnimating()&&this.cancelAnimations(),this.animateInternal({rotation:r,center:l,resolution:a,duration:t,easing:rn,anchor:i}))}beginInteraction(){this.resolveConstraints(0),this.setHint(_t.INTERACTING,1)}endInteraction(t,e,i){i=i&&we(i,this.getProjection()),this.endInteractionInternal(t,e,i)}endInteractionInternal(t,e,i){this.getInteracting()&&(this.setHint(_t.INTERACTING,-1),this.resolveConstraints(t,e,i))}getConstrainedCenter(t,e){const i=this.getViewportSize_(this.getRotation());return this.constraints_.center(t,e||this.getResolution(),i)}getConstrainedZoom(t,e){const i=this.getResolutionForZoom(t);return this.getZoomForResolution(this.getConstrainedResolution(i,e))}getConstrainedResolution(t,e){e=e||0;const i=this.getViewportSize_(this.getRotation());return this.constraints_.resolution(t,e,i)}}function lr(n,t){setTimeout(function(){n(t)},0)}function J_(n){if(n.extent!==void 0){const e=n.smoothExtentConstraint!==void 0?n.smoothExtentConstraint:!0;return gc(n.extent,n.constrainOnlyCenter,e)}const t=Qr(n.projection,"EPSG:3857");if(n.multiWorld!==!0&&t.isGlobal()){const e=t.getExtent().slice();return e[0]=-1/0,e[2]=1/0,gc(e,!1,!1)}return K_}function Q_(n){let t,e,i,o=n.minZoom!==void 0?n.minZoom:Xo,a=n.maxZoom!==void 0?n.maxZoom:28;const l=n.zoomFactor!==void 0?n.zoomFactor:2,h=n.multiWorld!==void 0?n.multiWorld:!1,c=n.smoothResolutionConstraint!==void 0?n.smoothResolutionConstraint:!0,u=n.showFullExtent!==void 0?n.showFullExtent:!1,d=Qr(n.projection,"EPSG:3857"),f=d.getExtent();let g=n.constrainOnlyCenter,m=n.extent;if(!h&&!m&&d.isGlobal()&&(g=!1,m=f),n.resolutions!==void 0){const _=n.resolutions;e=_[o],i=_[a]!==void 0?_[a]:_[_.length-1],n.constrainResolution?t=U_(_,c,!g&&m,u):t=mc(e,i,c,!g&&m,u)}else{const p=(f?Math.max(Q(f),Ct(f)):360*Kr.degrees/d.getMetersPerUnit())/Wo/Math.pow(2,Xo),y=p/Math.pow(2,28-Xo);e=n.maxResolution,e!==void 0?o=0:e=p/Math.pow(l,o),i=n.minResolution,i===void 0&&(n.maxZoom!==void 0?n.maxResolution!==void 0?i=e/Math.pow(l,a):i=p/Math.pow(l,a):i=y),a=o+Math.floor(Math.log(e/i)/Math.log(l)),i=e/Math.pow(l,a-o),n.constrainResolution?t=V_(l,e,i,c,!g&&m,u):t=mc(e,i,c,!g&&m,u)}return{constraint:t,maxResolution:e,minResolution:i,minZoom:o,zoomFactor:l}}function tm(n){if(n.enableRotation!==void 0?n.enableRotation:!0){const e=n.constrainRotation;return e===void 0||e===!0?H_():e===!1?pc:typeof e=="number"?j_(e):pc}return zo}function em(n){return!(n.sourceCenter&&n.targetCenter&&!Ds(n.sourceCenter,n.targetCenter)||n.sourceResolution!==n.targetResolution||n.sourceRotation!==n.targetRotation)}function Yo(n,t,e,i,s){const r=Math.cos(-s);let o=Math.sin(-s),a=n[0]*r-n[1]*o,l=n[1]*r+n[0]*o;a+=(t[0]/2-e[0])*i,l+=(e[1]-t[1]/2)*i,o=-o;const h=a*r-l*o,c=l*r+a*o;return[h,c]}const tt={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"};class yc extends ne{constructor(t){super(),this.on,this.once,this.un,this.background_=t.background;const e=Object.assign({},t);typeof t.properties=="object"&&(delete e.properties,Object.assign(e,t.properties)),e[tt.OPACITY]=t.opacity!==void 0?t.opacity:1,J(typeof e[tt.OPACITY]=="number","Layer opacity must be a number"),e[tt.VISIBLE]=t.visible!==void 0?t.visible:!0,e[tt.Z_INDEX]=t.zIndex,e[tt.MAX_RESOLUTION]=t.maxResolution!==void 0?t.maxResolution:1/0,e[tt.MIN_RESOLUTION]=t.minResolution!==void 0?t.minResolution:0,e[tt.MIN_ZOOM]=t.minZoom!==void 0?t.minZoom:-1/0,e[tt.MAX_ZOOM]=t.maxZoom!==void 0?t.maxZoom:1/0,this.className_=e.className!==void 0?e.className:"ol-layer",delete e.className,this.setProperties(e),this.state_=null}getBackground(){return this.background_}getClassName(){return this.className_}getLayerState(t){const e=this.state_||{layer:this,managed:t===void 0?!0:t},i=this.getZIndex();return e.opacity=st(Math.round(this.getOpacity()*100)/100,0,1),e.visible=this.getVisible(),e.extent=this.getExtent(),e.zIndex=i===void 0&&!e.managed?1/0:i,e.maxResolution=this.getMaxResolution(),e.minResolution=Math.max(this.getMinResolution(),0),e.minZoom=this.getMinZoom(),e.maxZoom=this.getMaxZoom(),this.state_=e,e}getLayersArray(t){return U()}getLayerStatesArray(t){return U()}getExtent(){return this.get(tt.EXTENT)}getMaxResolution(){return this.get(tt.MAX_RESOLUTION)}getMinResolution(){return this.get(tt.MIN_RESOLUTION)}getMinZoom(){return this.get(tt.MIN_ZOOM)}getMaxZoom(){return this.get(tt.MAX_ZOOM)}getOpacity(){return this.get(tt.OPACITY)}getSourceState(){return U()}getVisible(){return this.get(tt.VISIBLE)}getZIndex(){return this.get(tt.Z_INDEX)}setBackground(t){this.background_=t,this.changed()}setExtent(t){this.set(tt.EXTENT,t)}setMaxResolution(t){this.set(tt.MAX_RESOLUTION,t)}setMinResolution(t){this.set(tt.MIN_RESOLUTION,t)}setMaxZoom(t){this.set(tt.MAX_ZOOM,t)}setMinZoom(t){this.set(tt.MIN_ZOOM,t)}setOpacity(t){J(typeof t=="number","Layer opacity must be a number"),this.set(tt.OPACITY,t)}setVisible(t){this.set(tt.VISIBLE,t)}setZIndex(t){this.set(tt.Z_INDEX,t)}disposeInternal(){this.state_&&(this.state_.layer=null,this.state_=null),super.disposeInternal()}}class hr extends yc{constructor(t){const e=Object.assign({},t);delete e.source,super(e),this.on,this.once,this.un,this.mapPrecomposeKey_=null,this.mapRenderKey_=null,this.sourceChangeKey_=null,this.renderer_=null,this.sourceReady_=!1,this.rendered=!1,t.render&&(this.render=t.render),t.map&&this.setMap(t.map),this.addChangeListener(tt.SOURCE,this.handleSourcePropertyChange_);const i=t.source?t.source:null;this.setSource(i)}getLayersArray(t){return t=t||[],t.push(this),t}getLayerStatesArray(t){return t=t||[],t.push(this.getLayerState()),t}getSource(){return this.get(tt.SOURCE)||null}getRenderSource(){return this.getSource()}getSourceState(){const t=this.getSource();return t?t.getState():"undefined"}handleSourceChange_(){this.changed(),!(this.sourceReady_||this.getSource().getState()!=="ready")&&(this.sourceReady_=!0,this.dispatchEvent("sourceready"))}handleSourcePropertyChange_(){this.sourceChangeKey_&&(nt(this.sourceChangeKey_),this.sourceChangeKey_=null),this.sourceReady_=!1;const t=this.getSource();t&&(this.sourceChangeKey_=Z(t,z.CHANGE,this.handleSourceChange_,this),t.getState()==="ready"&&(this.sourceReady_=!0,setTimeout(()=>{this.dispatchEvent("sourceready")},0))),this.changed()}getFeatures(t){return this.renderer_?this.renderer_.getFeatures(t):Promise.resolve([])}getData(t){return!this.renderer_||!this.rendered?null:this.renderer_.getData(t)}isVisible(t){let e;const i=this.getMapInternal();!t&&i&&(t=i.getView()),t instanceof ge?e={viewState:t.getState(),extent:t.calculateExtent()}:e=t,!e.layerStatesArray&&i&&(e.layerStatesArray=i.getLayerGroup().getLayerStatesArray());let s;if(e.layerStatesArray){if(s=e.layerStatesArray.find(o=>o.layer===this),!s)return!1}else s=this.getLayerState();const r=this.getExtent();return $o(s,e.viewState)&&(!r||Lt(r,e.extent))}getAttributions(t){if(!this.isVisible(t))return[];const e=this.getSource()?.getAttributions();if(!e)return[];const i=t instanceof ge?t.getViewStateAndExtent():t;let s=e(i);return Array.isArray(s)||(s=[s]),s}render(t,e){const i=this.getRenderer();return i.prepareFrame(t)?(this.rendered=!0,i.renderFrame(t,e)):null}unrender(){this.rendered=!1}getDeclutter(){}renderDeclutter(t,e){}renderDeferred(t){const e=this.getRenderer();e&&e.renderDeferred(t)}setMapInternal(t){t||this.unrender(),this.set(tt.MAP,t)}getMapInternal(){return this.get(tt.MAP)}setMap(t){this.mapPrecomposeKey_&&(nt(this.mapPrecomposeKey_),this.mapPrecomposeKey_=null),t||this.changed(),this.mapRenderKey_&&(nt(this.mapRenderKey_),this.mapRenderKey_=null),t&&(this.mapPrecomposeKey_=Z(t,Vt.PRECOMPOSE,this.handlePrecompose_,this),this.mapRenderKey_=Z(this,z.CHANGE,t.render,t),this.changed())}handlePrecompose_(t){const e=t.frameState.layerStatesArray,i=this.getLayerState(!1);J(!e.some(s=>s.layer===i.layer),"A layer can only be added to the map once. Use either `layer.setMap()` or `map.addLayer()`, not both."),e.push(i)}setSource(t){this.set(tt.SOURCE,t)}getRenderer(){return this.renderer_||(this.renderer_=this.createRenderer()),this.renderer_}hasRenderer(){return!!this.renderer_}createRenderer(){return null}clearRenderer(){this.renderer_&&(this.renderer_.dispose(),delete this.renderer_)}disposeInternal(){this.clearRenderer(),this.setSource(null),super.disposeInternal()}}function $o(n,t){if(!n.visible)return!1;const e=t.resolution;if(e<n.minResolution||e>=n.maxResolution)return!1;const i=t.zoom;return i>n.minZoom&&i<=n.maxZoom}const xc={RENDER_ORDER:"renderOrder"};class Ec extends hr{constructor(t){t=t||{};const e=Object.assign({},t);delete e.style,delete e.renderBuffer,delete e.updateWhileAnimating,delete e.updateWhileInteracting,super(e),this.declutter_=t.declutter?String(t.declutter):void 0,this.renderBuffer_=t.renderBuffer!==void 0?t.renderBuffer:100,this.style_=null,this.styleFunction_=void 0,this.setStyle(t.style),this.updateWhileAnimating_=t.updateWhileAnimating!==void 0?t.updateWhileAnimating:!1,this.updateWhileInteracting_=t.updateWhileInteracting!==void 0?t.updateWhileInteracting:!1}getDeclutter(){return this.declutter_}getFeatures(t){return super.getFeatures(t)}getRenderBuffer(){return this.renderBuffer_}getRenderOrder(){return this.get(xc.RENDER_ORDER)}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}getUpdateWhileAnimating(){return this.updateWhileAnimating_}getUpdateWhileInteracting(){return this.updateWhileInteracting_}renderDeclutter(t,e){const i=this.getDeclutter();i in t.declutter||(t.declutter[i]=new kh(9)),this.getRenderer().renderDeclutter(t,e)}setRenderOrder(t){this.set(xc.RENDER_ORDER,t)}setStyle(t){this.style_=t===void 0?Yh:t;const e=im(t);this.styleFunction_=t===null?void 0:Ng(e),this.changed()}setDeclutter(t){this.declutter_=t?String(t):void 0,this.changed()}}function im(n){if(n===void 0)return Yh;if(!n)return null;if(typeof n=="function"||n instanceof Te)return n;if(!Array.isArray(n))return oc([n]);if(n.length===0)return[];const t=n.length,e=n[0];if(e instanceof Te){const s=new Array(t);for(let r=0;r<t;++r){const o=n[r];if(!(o instanceof Te))throw new Error("Expected a list of style instances");s[r]=o}return s}if("style"in e){const s=new Array(t);for(let r=0;r<t;++r){const o=n[r];if(!("style"in o))throw new Error("Expected a list of rules with a style property");s[r]=o}return M_(s)}return oc(n)}class nm extends Ec{constructor(t){super(t)}createRenderer(){return new r_(this)}}const D={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};class Ko extends Cs{constructor(t,e,i){super(),i=i||{},this.tileCoord=t,this.state=e,this.key="",this.transition_=i.transition===void 0?250:i.transition,this.transitionStarts_={},this.interpolate=!!i.interpolate}changed(){this.dispatchEvent(z.CHANGE)}release(){this.setState(D.EMPTY)}getKey(){return this.key+"/"+this.tileCoord}getTileCoord(){return this.tileCoord}getState(){return this.state}setState(t){if(this.state!==D.EMPTY){if(this.state!==D.ERROR&&this.state>t)throw new Error("Tile load sequence violation");this.state=t,this.changed()}}load(){U()}getAlpha(t,e){if(!this.transition_)return 1;let i=this.transitionStarts_[t];if(!i)i=e,this.transitionStarts_[t]=i;else if(i===-1)return 1;const s=e-i+1e3/60;return s>=this.transition_?1:_c(s/this.transition_)}inTransition(t){return this.transition_?this.transitionStarts_[t]!==-1:!1}endTransition(t){this.transition_&&(this.transitionStarts_[t]=-1)}disposeInternal(){this.release(),super.disposeInternal()}}class wc extends Ko{constructor(t,e,i,s,r,o){super(t,e,o),this.crossOrigin_=s,this.src_=i,this.key=i,this.image_=new Image,s!==null&&(this.image_.crossOrigin=s),this.unlisten_=null,this.tileLoadFunction_=r}getImage(){return this.image_}setImage(t){this.image_=t,this.state=D.LOADED,this.unlistenImage_(),this.changed()}handleImageError_(){this.state=D.ERROR,this.unlistenImage_(),this.image_=sm(),this.changed()}handleImageLoad_(){const t=this.image_;t.naturalWidth&&t.naturalHeight?this.state=D.LOADED:this.state=D.EMPTY,this.unlistenImage_(),this.changed()}load(){this.state==D.ERROR&&(this.state=D.IDLE,this.image_=new Image,this.crossOrigin_!==null&&(this.image_.crossOrigin=this.crossOrigin_)),this.state==D.IDLE&&(this.state=D.LOADING,this.changed(),this.tileLoadFunction_(this,this.src_),this.unlisten_=Qf(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this)))}unlistenImage_(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)}disposeInternal(){this.unlistenImage_(),this.image_=null,super.disposeInternal()}}function sm(){const n=lt(1,1);return n.fillStyle="rgba(0,0,0,0)",n.fillRect(0,0,1,1),n.canvas}class rm{constructor(t,e,i){this.decay_=t,this.minVelocity_=e,this.delay_=i,this.points_=[],this.angle_=0,this.initialVelocity_=0}begin(){this.points_.length=0,this.angle_=0,this.initialVelocity_=0}update(t,e){this.points_.push(t,e,Date.now())}end(){if(this.points_.length<6)return!1;const t=Date.now()-this.delay_,e=this.points_.length-3;if(this.points_[e+2]<t)return!1;let i=e-3;for(;i>0&&this.points_[i+2]>t;)i-=3;const s=this.points_[e+2]-this.points_[i+2];if(s<1e3/60)return!1;const r=this.points_[e]-this.points_[i],o=this.points_[e+1]-this.points_[i+1];return this.angle_=Math.atan2(o,r),this.initialVelocity_=Math.sqrt(r*r+o*o)/s,this.initialVelocity_>this.minVelocity_}getDistance(){return(this.minVelocity_-this.initialVelocity_)/this.decay_}getAngle(){return this.angle_}}class on extends Ee{constructor(t,e,i){super(t),this.map=e,this.frameState=i!==void 0?i:null}}class qe extends on{constructor(t,e,i,s,r,o){super(t,e,r),this.originalEvent=i,this.pixel_=null,this.coordinate_=null,this.dragging=s!==void 0?s:!1,this.activePointers=o}get pixel(){return this.pixel_||(this.pixel_=this.map.getEventPixel(this.originalEvent)),this.pixel_}set pixel(t){this.pixel_=t}get coordinate(){return this.coordinate_||(this.coordinate_=this.map.getCoordinateFromPixel(this.pixel)),this.coordinate_}set coordinate(t){this.coordinate_=t}preventDefault(){super.preventDefault(),"preventDefault"in this.originalEvent&&this.originalEvent.preventDefault()}stopPropagation(){super.stopPropagation(),"stopPropagation"in this.originalEvent&&this.originalEvent.stopPropagation()}}const rt={SINGLECLICK:"singleclick",CLICK:z.CLICK,DBLCLICK:z.DBLCLICK,POINTERDRAG:"pointerdrag",POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"},Bo={POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown"};class om extends Cs{constructor(t,e){super(t),this.map_=t,this.clickTimeoutId_,this.emulateClicks_=!1,this.dragging_=!1,this.dragListenerKeys_=[],this.moveTolerance_=e===void 0?1:e,this.down_=null;const i=this.map_.getViewport();this.activePointers_=[],this.trackedTouches_={},this.element_=i,this.pointerdownListenerKey_=Z(i,Bo.POINTERDOWN,this.handlePointerDown_,this),this.originalPointerMoveEvent_,this.relayedListenerKey_=Z(i,Bo.POINTERMOVE,this.relayMoveEvent_,this),this.boundHandleTouchMove_=this.handleTouchMove_.bind(this),this.element_.addEventListener(z.TOUCHMOVE,this.boundHandleTouchMove_,gh?{passive:!1}:!1)}emulateClick_(t){let e=new qe(rt.CLICK,this.map_,t);this.dispatchEvent(e),this.clickTimeoutId_!==void 0?(clearTimeout(this.clickTimeoutId_),this.clickTimeoutId_=void 0,e=new qe(rt.DBLCLICK,this.map_,t),this.dispatchEvent(e)):this.clickTimeoutId_=setTimeout(()=>{this.clickTimeoutId_=void 0;const i=new qe(rt.SINGLECLICK,this.map_,t);this.dispatchEvent(i)},250)}updateActivePointers_(t){const e=t,i=e.pointerId;if(e.type==rt.POINTERUP||e.type==rt.POINTERCANCEL){delete this.trackedTouches_[i];for(const s in this.trackedTouches_)if(this.trackedTouches_[s].target!==e.target){delete this.trackedTouches_[s];break}}else(e.type==rt.POINTERDOWN||e.type==rt.POINTERMOVE)&&(this.trackedTouches_[i]=e);this.activePointers_=Object.values(this.trackedTouches_)}handlePointerUp_(t){this.updateActivePointers_(t);const e=new qe(rt.POINTERUP,this.map_,t,void 0,void 0,this.activePointers_);this.dispatchEvent(e),this.emulateClicks_&&!e.defaultPrevented&&!this.dragging_&&this.isMouseActionButton_(t)&&this.emulateClick_(this.down_),this.activePointers_.length===0&&(this.dragListenerKeys_.forEach(nt),this.dragListenerKeys_.length=0,this.dragging_=!1,this.down_=null)}isMouseActionButton_(t){return t.button===0}handlePointerDown_(t){this.emulateClicks_=this.activePointers_.length===0,this.updateActivePointers_(t);const e=new qe(rt.POINTERDOWN,this.map_,t,void 0,void 0,this.activePointers_);if(this.dispatchEvent(e),this.down_=new PointerEvent(t.type,t),Object.defineProperty(this.down_,"target",{writable:!1,value:t.target}),this.dragListenerKeys_.length===0){const i=this.map_.getOwnerDocument();this.dragListenerKeys_.push(Z(i,rt.POINTERMOVE,this.handlePointerMove_,this),Z(i,rt.POINTERUP,this.handlePointerUp_,this),Z(this.element_,rt.POINTERCANCEL,this.handlePointerUp_,this)),this.element_.getRootNode&&this.element_.getRootNode()!==i&&this.dragListenerKeys_.push(Z(this.element_.getRootNode(),rt.POINTERUP,this.handlePointerUp_,this))}}handlePointerMove_(t){if(this.isMoving_(t)){this.updateActivePointers_(t),this.dragging_=!0;const e=new qe(rt.POINTERDRAG,this.map_,t,this.dragging_,void 0,this.activePointers_);this.dispatchEvent(e)}}relayMoveEvent_(t){this.originalPointerMoveEvent_=t;const e=!!(this.down_&&this.isMoving_(t));this.dispatchEvent(new qe(rt.POINTERMOVE,this.map_,t,e))}handleTouchMove_(t){const e=this.originalPointerMoveEvent_;(!e||e.defaultPrevented)&&(typeof t.cancelable!="boolean"||t.cancelable===!0)&&t.preventDefault()}isMoving_(t){return this.dragging_||Math.abs(t.clientX-this.down_.clientX)>this.moveTolerance_||Math.abs(t.clientY-this.down_.clientY)>this.moveTolerance_}disposeInternal(){this.relayedListenerKey_&&(nt(this.relayedListenerKey_),this.relayedListenerKey_=null),this.element_.removeEventListener(z.TOUCHMOVE,this.boundHandleTouchMove_),this.pointerdownListenerKey_&&(nt(this.pointerdownListenerKey_),this.pointerdownListenerKey_=null),this.dragListenerKeys_.forEach(nt),this.dragListenerKeys_.length=0,this.element_=null,super.disposeInternal()}}const Ae={POSTRENDER:"postrender",MOVESTART:"movestart",MOVEEND:"moveend",LOADSTART:"loadstart",LOADEND:"loadend"},mt={LAYERGROUP:"layergroup",SIZE:"size",TARGET:"target",VIEW:"view"},cr=1/0;class am{constructor(t,e){this.priorityFunction_=t,this.keyFunction_=e,this.elements_=[],this.priorities_=[],this.queuedElements_={}}clear(){this.elements_.length=0,this.priorities_.length=0,In(this.queuedElements_)}dequeue(){const t=this.elements_,e=this.priorities_,i=t[0];t.length==1?(t.length=0,e.length=0):(t[0]=t.pop(),e[0]=e.pop(),this.siftUp_(0));const s=this.keyFunction_(i);return delete this.queuedElements_[s],i}enqueue(t){J(!(this.keyFunction_(t)in this.queuedElements_),"Tried to enqueue an `element` that was already added to the queue");const e=this.priorityFunction_(t);return e!=cr?(this.elements_.push(t),this.priorities_.push(e),this.queuedElements_[this.keyFunction_(t)]=!0,this.siftDown_(0,this.elements_.length-1),!0):!1}getCount(){return this.elements_.length}getLeftChildIndex_(t){return t*2+1}getRightChildIndex_(t){return t*2+2}getParentIndex_(t){return t-1>>1}heapify_(){let t;for(t=(this.elements_.length>>1)-1;t>=0;t--)this.siftUp_(t)}isEmpty(){return this.elements_.length===0}isKeyQueued(t){return t in this.queuedElements_}isQueued(t){return this.isKeyQueued(this.keyFunction_(t))}siftUp_(t){const e=this.elements_,i=this.priorities_,s=e.length,r=e[t],o=i[t],a=t;for(;t<s>>1;){const l=this.getLeftChildIndex_(t),h=this.getRightChildIndex_(t),c=h<s&&i[h]<i[l]?h:l;e[t]=e[c],i[t]=i[c],t=c}e[t]=r,i[t]=o,this.siftDown_(a,t)}siftDown_(t,e){const i=this.elements_,s=this.priorities_,r=i[e],o=s[e];for(;e>t;){const a=this.getParentIndex_(e);if(s[a]>o)i[e]=i[a],s[e]=s[a],e=a;else break}i[e]=r,s[e]=o}reprioritize(){const t=this.priorityFunction_,e=this.elements_,i=this.priorities_;let s=0;const r=e.length;let o,a,l;for(a=0;a<r;++a)o=e[a],l=t(o),l==cr?delete this.queuedElements_[this.keyFunction_(o)]:(i[s]=l,e[s++]=o);e.length=s,i.length=s,this.heapify_()}}class lm extends am{constructor(t,e){super(i=>t.apply(null,i),i=>i[0].getKey()),this.boundHandleTileChange_=this.handleTileChange.bind(this),this.tileChangeCallback_=e,this.tilesLoading_=0,this.tilesLoadingKeys_={}}enqueue(t){const e=super.enqueue(t);return e&&t[0].addEventListener(z.CHANGE,this.boundHandleTileChange_),e}getTilesLoading(){return this.tilesLoading_}handleTileChange(t){const e=t.target,i=e.getState();if(i===D.LOADED||i===D.ERROR||i===D.EMPTY){i!==D.ERROR&&e.removeEventListener(z.CHANGE,this.boundHandleTileChange_);const s=e.getKey();s in this.tilesLoadingKeys_&&(delete this.tilesLoadingKeys_[s],--this.tilesLoading_),this.tileChangeCallback_()}}loadMoreTiles(t,e){let i=0;for(;this.tilesLoading_<t&&i<e&&this.getCount()>0;){const s=this.dequeue()[0],r=s.getKey();s.getState()===D.IDLE&&!(r in this.tilesLoadingKeys_)&&(this.tilesLoadingKeys_[r]=!0,++this.tilesLoading_,++i,s.load())}}}function hm(n,t,e,i,s){if(!n||!(e in n.wantedTiles)||!n.wantedTiles[e][t.getKey()])return cr;const r=n.viewState.center,o=i[0]-r[0],a=i[1]-r[1];return 65536*Math.log(s)+Math.sqrt(o*o+a*a)/s}class Zo extends ne{constructor(t){super();const e=t.element;e&&!t.target&&!e.style.pointerEvents&&(e.style.pointerEvents="auto"),this.element=e||null,this.target_=null,this.map_=null,this.listenerKeys=[],t.render&&(this.render=t.render),t.target&&this.setTarget(t.target)}disposeInternal(){this.element?.remove(),super.disposeInternal()}getMap(){return this.map_}setMap(t){this.map_&&this.element?.remove();for(let e=0,i=this.listenerKeys.length;e<i;++e)nt(this.listenerKeys[e]);if(this.listenerKeys.length=0,this.map_=t,t){const e=this.target_??t.getOverlayContainerStopEvent();this.element&&e.appendChild(this.element),this.render!==Tn&&this.listenerKeys.push(Z(t,Ae.POSTRENDER,this.render,this)),t.render()}}render(t){}setTarget(t){this.target_=typeof t=="string"?document.getElementById(t):t}}class cm extends Zo{constructor(t){t=t||{},super({element:document.createElement("div"),render:t.render,target:t.target}),this.ulElement_=document.createElement("ul"),this.collapsed_=t.collapsed!==void 0?t.collapsed:!0,this.userCollapsed_=this.collapsed_,this.overrideCollapsible_=t.collapsible!==void 0,this.collapsible_=t.collapsible!==void 0?t.collapsible:!0,this.collapsible_||(this.collapsed_=!1),this.attributions_=t.attributions;const e=t.className!==void 0?t.className:"ol-attribution",i=t.tipLabel!==void 0?t.tipLabel:"Attributions",s=t.expandClassName!==void 0?t.expandClassName:e+"-expand",r=t.collapseLabel!==void 0?t.collapseLabel:"›",o=t.collapseClassName!==void 0?t.collapseClassName:e+"-collapse";typeof r=="string"?(this.collapseLabel_=document.createElement("span"),this.collapseLabel_.textContent=r,this.collapseLabel_.className=o):this.collapseLabel_=r;const a=t.label!==void 0?t.label:"i";typeof a=="string"?(this.label_=document.createElement("span"),this.label_.textContent=a,this.label_.className=s):this.label_=a;const l=this.collapsible_&&!this.collapsed_?this.collapseLabel_:this.label_;this.toggleButton_=document.createElement("button"),this.toggleButton_.setAttribute("type","button"),this.toggleButton_.setAttribute("aria-expanded",String(!this.collapsed_)),this.toggleButton_.title=i,this.toggleButton_.appendChild(l),this.toggleButton_.addEventListener(z.CLICK,this.handleClick_.bind(this),!1);const h=e+" "+Us+" "+Co+(this.collapsed_&&this.collapsible_?" "+wh:"")+(this.collapsible_?"":" ol-uncollapsible"),c=this.element;c.className=h,c.appendChild(this.toggleButton_),c.appendChild(this.ulElement_),this.renderedAttributions_=[],this.renderedVisible_=!0}collectSourceAttributions_(t){const e=this.getMap().getAllLayers(),i=new Set(e.flatMap(s=>s.getAttributions(t)));if(this.attributions_!==void 0&&(Array.isArray(this.attributions_)?this.attributions_.forEach(s=>i.add(s)):i.add(this.attributions_)),!this.overrideCollapsible_){const s=!e.some(r=>r.getSource()?.getAttributionsCollapsible()===!1);this.setCollapsible(s)}return Array.from(i)}async updateElement_(t){if(!t){this.renderedVisible_&&(this.element.style.display="none",this.renderedVisible_=!1);return}const e=await Promise.all(this.collectSourceAttributions_(t).map(s=>Rd(()=>s))),i=e.length>0;if(this.renderedVisible_!=i&&(this.element.style.display=i?"":"none",this.renderedVisible_=i),!Xe(e,this.renderedAttributions_)){mh(this.ulElement_);for(let s=0,r=e.length;s<r;++s){const o=document.createElement("li");o.innerHTML=e[s],this.ulElement_.appendChild(o)}this.renderedAttributions_=e}}handleClick_(t){t.preventDefault(),this.handleToggle_(),this.userCollapsed_=this.collapsed_}handleToggle_(){this.element.classList.toggle(wh),this.collapsed_?_h(this.collapseLabel_,this.label_):_h(this.label_,this.collapseLabel_),this.collapsed_=!this.collapsed_,this.toggleButton_.setAttribute("aria-expanded",String(!this.collapsed_))}getCollapsible(){return this.collapsible_}setCollapsible(t){this.collapsible_!==t&&(this.collapsible_=t,this.element.classList.toggle("ol-uncollapsible"),this.userCollapsed_&&this.handleToggle_())}setCollapsed(t){this.userCollapsed_=t,!(!this.collapsible_||this.collapsed_===t)&&this.handleToggle_()}getCollapsed(){return this.collapsed_}render(t){this.updateElement_(t.frameState)}}class um extends Zo{constructor(t){t=t||{},super({element:document.createElement("div"),render:t.render,target:t.target});const e=t.className!==void 0?t.className:"ol-rotate",i=t.label!==void 0?t.label:"⇧",s=t.compassClassName!==void 0?t.compassClassName:"ol-compass";this.label_=null,typeof i=="string"?(this.label_=document.createElement("span"),this.label_.className=s,this.label_.textContent=i):(this.label_=i,this.label_.classList.add(s));const r=t.tipLabel?t.tipLabel:"Reset rotation",o=document.createElement("button");o.className=e+"-reset",o.setAttribute("type","button"),o.title=r,o.appendChild(this.label_),o.addEventListener(z.CLICK,this.handleClick_.bind(this),!1);const a=e+" "+Us+" "+Co,l=this.element;l.className=a,l.appendChild(o),this.callResetNorth_=t.resetNorth?t.resetNorth:void 0,this.duration_=t.duration!==void 0?t.duration:250,this.autoHide_=t.autoHide!==void 0?t.autoHide:!0,this.rotation_=void 0,this.autoHide_&&this.element.classList.add(Zs)}handleClick_(t){t.preventDefault(),this.callResetNorth_!==void 0?this.callResetNorth_():this.resetNorth_()}resetNorth_(){const e=this.getMap().getView();if(!e)return;const i=e.getRotation();i!==void 0&&(this.duration_>0&&i%(2*Math.PI)!==0?e.animate({rotation:0,duration:this.duration_,easing:rn}):e.setRotation(0))}render(t){const e=t.frameState;if(!e)return;const i=e.viewState.rotation;if(i!=this.rotation_){const s="rotate("+i+"rad)";if(this.autoHide_){const r=this.element.classList.contains(Zs);!r&&i===0?this.element.classList.add(Zs):r&&i!==0&&this.element.classList.remove(Zs)}this.label_.style.transform=s}this.rotation_=i}}class dm extends Zo{constructor(t){t=t||{},super({element:document.createElement("div"),target:t.target});const e=t.className!==void 0?t.className:"ol-zoom",i=t.delta!==void 0?t.delta:1,s=t.zoomInClassName!==void 0?t.zoomInClassName:e+"-in",r=t.zoomOutClassName!==void 0?t.zoomOutClassName:e+"-out",o=t.zoomInLabel!==void 0?t.zoomInLabel:"+",a=t.zoomOutLabel!==void 0?t.zoomOutLabel:"–",l=t.zoomInTipLabel!==void 0?t.zoomInTipLabel:"Zoom in",h=t.zoomOutTipLabel!==void 0?t.zoomOutTipLabel:"Zoom out",c=document.createElement("button");c.className=s,c.setAttribute("type","button"),c.title=l,c.appendChild(typeof o=="string"?document.createTextNode(o):o),c.addEventListener(z.CLICK,this.handleClick_.bind(this,i),!1);const u=document.createElement("button");u.className=r,u.setAttribute("type","button"),u.title=h,u.appendChild(typeof a=="string"?document.createTextNode(a):a),u.addEventListener(z.CLICK,this.handleClick_.bind(this,-i),!1);const d=e+" "+Us+" "+Co,f=this.element;f.className=d,f.appendChild(c),f.appendChild(u),this.duration_=t.duration!==void 0?t.duration:250}handleClick_(t,e){e.preventDefault(),this.zoomByDelta_(t)}zoomByDelta_(t){const i=this.getMap().getView();if(!i)return;const s=i.getZoom();if(s!==void 0){const r=i.getConstrainedZoom(s+t);this.duration_>0?(i.getAnimating()&&i.cancelAnimations(),i.animate({zoom:r,duration:this.duration_,easing:rn})):i.setZoom(r)}}}function fm(n){n=n||{};const t=new ue;return(n.zoom!==void 0?n.zoom:!0)&&t.push(new dm(n.zoomOptions)),(n.rotate!==void 0?n.rotate:!0)&&t.push(new um(n.rotateOptions)),(n.attribution!==void 0?n.attribution:!0)&&t.push(new cm(n.attributionOptions)),t}const vc={ACTIVE:"active"};class es extends ne{constructor(t){super(),this.on,this.once,this.un,t&&t.handleEvent&&(this.handleEvent=t.handleEvent),this.map_=null,this.setActive(!0)}getActive(){return this.get(vc.ACTIVE)}getMap(){return this.map_}handleEvent(t){return!0}setActive(t){this.set(vc.ACTIVE,t)}setMap(t){this.map_=t}}function gm(n,t,e){const i=n.getCenterInternal();if(i){const s=[i[0]+t[0],i[1]+t[1]];n.animateInternal({duration:e!==void 0?e:250,easing:Z_,center:n.getConstrainedCenter(s)})}}function Uo(n,t,e,i){const s=n.getZoom();if(s===void 0)return;const r=n.getConstrainedZoom(s+t),o=n.getResolutionForZoom(r);n.getAnimating()&&n.cancelAnimations(),n.animate({resolution:o,anchor:e,duration:i!==void 0?i:250,easing:rn})}class _m extends es{constructor(t){super(),t=t||{},this.delta_=t.delta?t.delta:1,this.duration_=t.duration!==void 0?t.duration:250}handleEvent(t){let e=!1;if(t.type==rt.DBLCLICK){const i=t.originalEvent,s=t.map,r=t.coordinate,o=i.shiftKey?-this.delta_:this.delta_,a=s.getView();Uo(a,o,r,this.duration_),i.preventDefault(),e=!0}return!e}}function Vo(n){const t=arguments;return function(e){let i=!0;for(let s=0,r=t.length;s<r&&(i=i&&t[s](e),!!i);++s);return i}}const mm=function(n){const t=n.originalEvent;return t.altKey&&!(t.metaKey||t.ctrlKey)&&t.shiftKey},pm=function(n){const t=n.map.getTargetElement(),e=t.getRootNode(),i=n.map.getOwnerDocument().activeElement;return e instanceof ShadowRoot?e.host.contains(i):t.contains(i)},Cc=function(n){const t=n.map.getTargetElement(),e=t.getRootNode();return(e instanceof ShadowRoot?e.host:t).hasAttribute("tabindex")?pm(n):!0},ym=Rn,Rc=function(n){const t=n.originalEvent;return"pointerId"in t&&t.button==0&&!(zf&&dh&&t.ctrlKey)},Tc=function(n){const t=n.originalEvent;return!t.altKey&&!(t.metaKey||t.ctrlKey)&&!t.shiftKey},xm=function(n){const t=n.originalEvent;return dh?t.metaKey:t.ctrlKey},Em=function(n){const t=n.originalEvent;return!t.altKey&&!(t.metaKey||t.ctrlKey)&&t.shiftKey},Ic=function(n){const t=n.originalEvent,e=t.target.tagName;return e!=="INPUT"&&e!=="SELECT"&&e!=="TEXTAREA"&&!t.target.isContentEditable},jo=function(n){const t=n.originalEvent;return"pointerId"in t&&t.pointerType=="mouse"},wm=function(n){const t=n.originalEvent;return"pointerId"in t&&t.isPrimary&&t.button===0};class is extends es{constructor(t){t=t||{},super(t),t.handleDownEvent&&(this.handleDownEvent=t.handleDownEvent),t.handleDragEvent&&(this.handleDragEvent=t.handleDragEvent),t.handleMoveEvent&&(this.handleMoveEvent=t.handleMoveEvent),t.handleUpEvent&&(this.handleUpEvent=t.handleUpEvent),t.stopDown&&(this.stopDown=t.stopDown),this.handlingDownUpSequence=!1,this.targetPointers=[]}getPointerCount(){return this.targetPointers.length}handleDownEvent(t){return!1}handleDragEvent(t){}handleEvent(t){if(!t.originalEvent)return!0;let e=!1;if(this.updateTrackedPointers_(t),this.handlingDownUpSequence){if(t.type==rt.POINTERDRAG)this.handleDragEvent(t),t.originalEvent.preventDefault();else if(t.type==rt.POINTERUP){const i=this.handleUpEvent(t);this.handlingDownUpSequence=i&&this.targetPointers.length>0}}else if(t.type==rt.POINTERDOWN){const i=this.handleDownEvent(t);this.handlingDownUpSequence=i,e=this.stopDown(i)}else t.type==rt.POINTERMOVE&&this.handleMoveEvent(t);return!e}handleMoveEvent(t){}handleUpEvent(t){return!1}stopDown(t){return t}updateTrackedPointers_(t){t.activePointers&&(this.targetPointers=t.activePointers)}}function Ho(n){const t=n.length;let e=0,i=0;for(let s=0;s<t;s++)e+=n[s].clientX,i+=n[s].clientY;return{clientX:e/t,clientY:i/t}}class vm extends is{constructor(t){super({stopDown:vs}),t=t||{},this.kinetic_=t.kinetic,this.lastCentroid=null,this.lastPointersCount_,this.panning_=!1;const e=t.condition?t.condition:Vo(Tc,wm);this.condition_=t.onFocusOnly?Vo(Cc,e):e,this.noKinetic_=!1}handleDragEvent(t){const e=t.map;this.panning_||(this.panning_=!0,e.getView().beginInteraction());const i=this.targetPointers,s=e.getEventPixel(Ho(i));if(i.length==this.lastPointersCount_){if(this.kinetic_&&this.kinetic_.update(s[0],s[1]),this.lastCentroid){const r=[this.lastCentroid[0]-s[0],s[1]-this.lastCentroid[1]],a=t.map.getView();kd(r,a.getResolution()),$r(r,a.getRotation()),a.adjustCenterInternal(r)}}else this.kinetic_&&this.kinetic_.begin();this.lastCentroid=s,this.lastPointersCount_=i.length,t.originalEvent.preventDefault()}handleUpEvent(t){const e=t.map,i=e.getView();if(this.targetPointers.length===0){if(!this.noKinetic_&&this.kinetic_&&this.kinetic_.end()){const s=this.kinetic_.getDistance(),r=this.kinetic_.getAngle(),o=i.getCenterInternal(),a=e.getPixelFromCoordinateInternal(o),l=e.getCoordinateFromPixelInternal([a[0]-s*Math.cos(r),a[1]-s*Math.sin(r)]);i.animateInternal({center:i.getConstrainedCenter(l),duration:500,easing:rn})}return this.panning_&&(this.panning_=!1,i.endInteraction()),!1}return this.kinetic_&&this.kinetic_.begin(),this.lastCentroid=null,!0}handleDownEvent(t){if(this.targetPointers.length>0&&this.condition_(t)){const i=t.map.getView();return this.lastCentroid=null,i.getAnimating()&&i.cancelAnimations(),this.kinetic_&&this.kinetic_.begin(),this.noKinetic_=this.targetPointers.length>1,!0}return!1}}class Cm extends is{constructor(t){t=t||{},super({stopDown:vs}),this.condition_=t.condition?t.condition:mm,this.lastAngle_=void 0,this.duration_=t.duration!==void 0?t.duration:250}handleDragEvent(t){if(!jo(t))return;const e=t.map,i=e.getView();if(i.getConstraints().rotation===zo)return;const s=e.getSize(),r=t.pixel,o=Math.atan2(s[1]/2-r[1],r[0]-s[0]/2);if(this.lastAngle_!==void 0){const a=o-this.lastAngle_;i.adjustRotationInternal(-a)}this.lastAngle_=o}handleUpEvent(t){return jo(t)?(t.map.getView().endInteraction(this.duration_),!1):!0}handleDownEvent(t){return jo(t)&&Rc(t)&&this.condition_(t)?(t.map.getView().beginInteraction(),this.lastAngle_=void 0,!0):!1}}class Rm extends ws{constructor(t){super(),this.geometry_=null,this.element_=document.createElement("div"),this.element_.style.position="absolute",this.element_.style.pointerEvents="auto",this.element_.className="ol-box "+t,this.map_=null,this.startPixel_=null,this.endPixel_=null}disposeInternal(){this.setMap(null)}render_(){const t=this.startPixel_,e=this.endPixel_,i="px",s=this.element_.style;s.left=Math.min(t[0],e[0])+i,s.top=Math.min(t[1],e[1])+i,s.width=Math.abs(e[0]-t[0])+i,s.height=Math.abs(e[1]-t[1])+i}setMap(t){if(this.map_){this.map_.getOverlayContainer().removeChild(this.element_);const e=this.element_.style;e.left="inherit",e.top="inherit",e.width="inherit",e.height="inherit"}this.map_=t,this.map_&&this.map_.getOverlayContainer().appendChild(this.element_)}setPixels(t,e){this.startPixel_=t,this.endPixel_=e,this.createOrUpdateGeometry(),this.render_()}createOrUpdateGeometry(){if(!this.map_)return;const t=this.startPixel_,e=this.endPixel_,s=[t,[t[0],e[1]],e,[e[0],t[1]]].map(this.map_.getCoordinateFromPixelInternal,this.map_);s[4]=s[0].slice(),this.geometry_?this.geometry_.setCoordinates([s]):this.geometry_=new Dn([s])}getGeometry(){return this.geometry_}}const an={BOXSTART:"boxstart",BOXDRAG:"boxdrag",BOXEND:"boxend",BOXCANCEL:"boxcancel"};class ns extends Ee{constructor(t,e,i){super(t),this.coordinate=e,this.mapBrowserEvent=i}}class Tm extends is{constructor(t){super(),this.on,this.once,this.un,t=t??{},this.box_=new Rm(t.className||"ol-dragbox"),this.minArea_=t.minArea??64,t.onBoxEnd&&(this.onBoxEnd=t.onBoxEnd),this.startPixel_=null,this.condition_=t.condition??Rc,this.boxEndCondition_=t.boxEndCondition??this.defaultBoxEndCondition}defaultBoxEndCondition(t,e,i){const s=i[0]-e[0],r=i[1]-e[1];return s*s+r*r>=this.minArea_}getGeometry(){return this.box_.getGeometry()}handleDragEvent(t){this.startPixel_&&(this.box_.setPixels(this.startPixel_,t.pixel),this.dispatchEvent(new ns(an.BOXDRAG,t.coordinate,t)))}handleUpEvent(t){if(!this.startPixel_)return!1;const e=this.boxEndCondition_(t,this.startPixel_,t.pixel);return e&&this.onBoxEnd(t),this.dispatchEvent(new ns(e?an.BOXEND:an.BOXCANCEL,t.coordinate,t)),this.box_.setMap(null),this.startPixel_=null,!1}handleDownEvent(t){return this.condition_(t)?(this.startPixel_=t.pixel,this.box_.setMap(t.map),this.box_.setPixels(this.startPixel_,this.startPixel_),this.dispatchEvent(new ns(an.BOXSTART,t.coordinate,t)),!0):!1}onBoxEnd(t){}setActive(t){t||(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new ns(an.BOXCANCEL,this.startPixel_,null)),this.startPixel_=null)),super.setActive(t)}setMap(t){this.getMap()&&(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new ns(an.BOXCANCEL,this.startPixel_,null)),this.startPixel_=null)),super.setMap(t)}}class Im extends Tm{constructor(t){t=t||{};const e=t.condition?t.condition:Em;super({condition:e,className:t.className||"ol-dragzoom",minArea:t.minArea}),this.duration_=t.duration!==void 0?t.duration:200,this.out_=t.out!==void 0?t.out:!1}onBoxEnd(t){const i=this.getMap().getView();let s=this.getGeometry();if(this.out_){const r=i.rotatedExtentForGeometry(s),o=i.getResolutionForExtentInternal(r),a=i.getResolution()/o;s=s.clone(),s.scale(a*a)}i.fitInternal(s,{duration:this.duration_,easing:rn})}}const vi={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",DOWN:"ArrowDown"};class Sm extends es{constructor(t){super(),t=t||{},this.defaultCondition_=function(e){return Tc(e)&&Ic(e)},this.condition_=t.condition!==void 0?t.condition:this.defaultCondition_,this.duration_=t.duration!==void 0?t.duration:100,this.pixelDelta_=t.pixelDelta!==void 0?t.pixelDelta:128}handleEvent(t){let e=!1;if(t.type==z.KEYDOWN){const i=t.originalEvent,s=i.key;if(this.condition_(t)&&(s==vi.DOWN||s==vi.LEFT||s==vi.RIGHT||s==vi.UP)){const o=t.map.getView(),a=o.getResolution()*this.pixelDelta_;let l=0,h=0;s==vi.DOWN?h=-a:s==vi.LEFT?l=-a:s==vi.RIGHT?l=a:h=a;const c=[l,h];$r(c,o.getRotation()),gm(o,c,this.duration_),i.preventDefault(),e=!0}}return!e}}class bm extends es{constructor(t){super(),t=t||{},this.condition_=t.condition?t.condition:function(e){return!xm(e)&&Ic(e)},this.delta_=t.delta?t.delta:1,this.duration_=t.duration!==void 0?t.duration:100}handleEvent(t){let e=!1;if(t.type==z.KEYDOWN||t.type==z.KEYPRESS){const i=t.originalEvent,s=i.key;if(this.condition_(t)&&(s==="+"||s==="-")){const r=t.map,o=s==="+"?this.delta_:-this.delta_,a=r.getView();Uo(a,o,void 0,this.duration_),i.preventDefault(),e=!0}}return!e}}const Lm=40,Am=300;class Mm extends es{constructor(t){t=t||{},super(t),this.totalDelta_=0,this.lastDelta_=0,this.maxDelta_=t.maxDelta!==void 0?t.maxDelta:1,this.duration_=t.duration!==void 0?t.duration:250,this.timeout_=t.timeout!==void 0?t.timeout:80,this.useAnchor_=t.useAnchor!==void 0?t.useAnchor:!0,this.constrainResolution_=t.constrainResolution!==void 0?t.constrainResolution:!1;const e=t.condition?t.condition:ym;this.condition_=t.onFocusOnly?Vo(Cc,e):e,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_,this.mode_=void 0,this.trackpadEventGap_=400,this.trackpadTimeoutId_,this.deltaPerZoom_=300}endInteraction_(){this.trackpadTimeoutId_=void 0;const t=this.getMap();if(!t)return;t.getView().endInteraction(void 0,this.lastDelta_?this.lastDelta_>0?1:-1:0,this.lastAnchor_?t.getCoordinateFromPixel(this.lastAnchor_):null)}handleEvent(t){if(!this.condition_(t)||t.type!==z.WHEEL)return!0;const i=t.map,s=t.originalEvent;s.preventDefault(),this.useAnchor_&&(this.lastAnchor_=t.pixel);let r=s.deltaY;switch(s.deltaMode){case WheelEvent.DOM_DELTA_LINE:r*=Lm;break;case WheelEvent.DOM_DELTA_PAGE:r*=Am;break}if(r===0)return!1;this.lastDelta_=r;const o=Date.now();this.startTime_===void 0&&(this.startTime_=o),(!this.mode_||o-this.startTime_>this.trackpadEventGap_)&&(this.mode_=Math.abs(r)<4?"trackpad":"wheel");const a=i.getView();if(this.mode_==="trackpad"&&!(a.getConstrainResolution()||this.constrainResolution_))return this.trackpadTimeoutId_?clearTimeout(this.trackpadTimeoutId_):(a.getAnimating()&&a.cancelAnimations(),a.beginInteraction()),this.trackpadTimeoutId_=setTimeout(this.endInteraction_.bind(this),this.timeout_),a.adjustZoom(-r/this.deltaPerZoom_,this.lastAnchor_?i.getCoordinateFromPixel(this.lastAnchor_):null),this.startTime_=o,!1;this.totalDelta_+=r;const l=Math.max(this.timeout_-(o-this.startTime_),0);return clearTimeout(this.timeoutId_),this.timeoutId_=setTimeout(this.handleWheelZoom_.bind(this,i),l),!1}handleWheelZoom_(t){const e=t.getView();e.getAnimating()&&e.cancelAnimations();let i=-st(this.totalDelta_,-this.maxDelta_*this.deltaPerZoom_,this.maxDelta_*this.deltaPerZoom_)/this.deltaPerZoom_;(e.getConstrainResolution()||this.constrainResolution_)&&(i=i?i>0?1:-1:0),Uo(e,i,this.lastAnchor_?t.getCoordinateFromPixel(this.lastAnchor_):null,this.duration_),this.mode_=void 0,this.totalDelta_=0,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_=void 0}setMouseAnchor(t){this.useAnchor_=t,t||(this.lastAnchor_=null)}}class Pm extends is{constructor(t){t=t||{};const e=t;e.stopDown||(e.stopDown=vs),super(e),this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.threshold_=t.threshold!==void 0?t.threshold:.3,this.duration_=t.duration!==void 0?t.duration:250}handleDragEvent(t){let e=0;const i=this.targetPointers[0],s=this.targetPointers[1],r=Math.atan2(s.clientY-i.clientY,s.clientX-i.clientX);if(this.lastAngle_!==void 0){const l=r-this.lastAngle_;this.rotationDelta_+=l,!this.rotating_&&Math.abs(this.rotationDelta_)>this.threshold_&&(this.rotating_=!0),e=l}this.lastAngle_=r;const o=t.map,a=o.getView();a.getConstraints().rotation!==zo&&(this.anchor_=o.getCoordinateFromPixelInternal(o.getEventPixel(Ho(this.targetPointers))),this.rotating_&&(o.render(),a.adjustRotationInternal(e,this.anchor_)))}handleUpEvent(t){return this.targetPointers.length<2?(t.map.getView().endInteraction(this.duration_),!1):!0}handleDownEvent(t){if(this.targetPointers.length>=2){const e=t.map;return this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.handlingDownUpSequence||e.getView().beginInteraction(),!0}return!1}}class Om extends is{constructor(t){t=t||{};const e=t;e.stopDown||(e.stopDown=vs),super(e),this.anchor_=null,this.duration_=t.duration!==void 0?t.duration:400,this.lastDistance_=void 0,this.lastScaleDelta_=1}handleDragEvent(t){let e=1;const i=this.targetPointers[0],s=this.targetPointers[1],r=i.clientX-s.clientX,o=i.clientY-s.clientY,a=Math.sqrt(r*r+o*o);this.lastDistance_!==void 0&&(e=this.lastDistance_/a),this.lastDistance_=a;const l=t.map,h=l.getView();e!=1&&(this.lastScaleDelta_=e),this.anchor_=l.getCoordinateFromPixelInternal(l.getEventPixel(Ho(this.targetPointers))),l.render(),h.adjustResolutionInternal(e,this.anchor_)}handleUpEvent(t){if(this.targetPointers.length<2){const i=t.map.getView(),s=this.lastScaleDelta_>1?1:-1;return i.endInteraction(this.duration_,s),!1}return!0}handleDownEvent(t){if(this.targetPointers.length>=2){const e=t.map;return this.anchor_=null,this.lastDistance_=void 0,this.lastScaleDelta_=1,this.handlingDownUpSequence||e.getView().beginInteraction(),!0}return!1}}function Dm(n){n=n||{};const t=new ue,e=new rm(-.005,.05,100);return(n.altShiftDragRotate!==void 0?n.altShiftDragRotate:!0)&&t.push(new Cm),(n.doubleClickZoom!==void 0?n.doubleClickZoom:!0)&&t.push(new _m({delta:n.zoomDelta,duration:n.zoomDuration})),(n.dragPan!==void 0?n.dragPan:!0)&&t.push(new vm({onFocusOnly:n.onFocusOnly,kinetic:e})),(n.pinchRotate!==void 0?n.pinchRotate:!0)&&t.push(new Pm),(n.pinchZoom!==void 0?n.pinchZoom:!0)&&t.push(new Om({duration:n.zoomDuration})),(n.keyboard!==void 0?n.keyboard:!0)&&(t.push(new Sm),t.push(new bm({delta:n.zoomDelta,duration:n.zoomDuration}))),(n.mouseWheelZoom!==void 0?n.mouseWheelZoom:!0)&&t.push(new Mm({onFocusOnly:n.onFocusOnly,duration:n.zoomDuration})),(n.shiftDragZoom!==void 0?n.shiftDragZoom:!0)&&t.push(new Im({duration:n.zoomDuration})),t}class Je extends Ee{constructor(t,e){super(t),this.layer=e}}const qo={LAYERS:"layers"};class ln extends yc{constructor(t){t=t||{};const e=Object.assign({},t);delete e.layers;let i=t.layers;super(e),this.on,this.once,this.un,this.layersListenerKeys_=[],this.listenerKeys_={},this.addChangeListener(qo.LAYERS,this.handleLayersChanged_),i?Array.isArray(i)?i=new ue(i.slice(),{unique:!0}):J(typeof i.getArray=="function","Expected `layers` to be an array or a `Collection`"):i=new ue(void 0,{unique:!0}),this.setLayers(i)}handleLayerChange_(){this.changed()}handleLayersChanged_(){this.layersListenerKeys_.forEach(nt),this.layersListenerKeys_.length=0;const t=this.getLayers();this.layersListenerKeys_.push(Z(t,bt.ADD,this.handleLayersAdd_,this),Z(t,bt.REMOVE,this.handleLayersRemove_,this));for(const i in this.listenerKeys_)this.listenerKeys_[i].forEach(nt);In(this.listenerKeys_);const e=t.getArray();for(let i=0,s=e.length;i<s;i++){const r=e[i];this.registerLayerListeners_(r),this.dispatchEvent(new Je("addlayer",r))}this.changed()}registerLayerListeners_(t){const e=[Z(t,ki.PROPERTYCHANGE,this.handleLayerChange_,this),Z(t,z.CHANGE,this.handleLayerChange_,this)];t instanceof ln&&e.push(Z(t,"addlayer",this.handleLayerGroupAdd_,this),Z(t,"removelayer",this.handleLayerGroupRemove_,this)),this.listenerKeys_[V(t)]=e}handleLayerGroupAdd_(t){this.dispatchEvent(new Je("addlayer",t.layer))}handleLayerGroupRemove_(t){this.dispatchEvent(new Je("removelayer",t.layer))}handleLayersAdd_(t){const e=t.element;this.registerLayerListeners_(e),this.dispatchEvent(new Je("addlayer",e)),this.changed()}handleLayersRemove_(t){const e=t.element,i=V(e);this.listenerKeys_[i].forEach(nt),delete this.listenerKeys_[i],this.dispatchEvent(new Je("removelayer",e)),this.changed()}getLayers(){return this.get(qo.LAYERS)}setLayers(t){const e=this.getLayers();if(e){const i=e.getArray();for(let s=0,r=i.length;s<r;++s)this.dispatchEvent(new Je("removelayer",i[s]))}this.set(qo.LAYERS,t)}getLayersArray(t){return t=t!==void 0?t:[],this.getLayers().forEach(function(e){e.getLayersArray(t)}),t}getLayerStatesArray(t){const e=t!==void 0?t:[],i=e.length;this.getLayers().forEach(function(o){o.getLayerStatesArray(e)});const s=this.getLayerState();let r=s.zIndex;!t&&s.zIndex===void 0&&(r=0);for(let o=i,a=e.length;o<a;o++){const l=e[o];l.opacity*=s.opacity,l.visible=l.visible&&s.visible,l.maxResolution=Math.min(l.maxResolution,s.maxResolution),l.minResolution=Math.max(l.minResolution,s.minResolution),l.minZoom=Math.max(l.minZoom,s.minZoom),l.maxZoom=Math.min(l.maxZoom,s.maxZoom),s.extent!==void 0&&(l.extent!==void 0?l.extent=ci(l.extent,s.extent):l.extent=s.extent),l.zIndex===void 0&&(l.zIndex=r)}return e}getSourceState(){return"ready"}}class Fm extends ws{constructor(t){super(),this.map_=t}dispatchRenderEvent(t,e){U()}calculateMatrices2D(t){const e=t.viewState,i=t.coordinateToPixelTransform,s=t.pixelToCoordinateTransform;ve(i,t.size[0]/2,t.size[1]/2,1/e.resolution,-1/e.resolution,-e.rotation,-e.center[0],-e.center[1]),Vl(s,i)}forEachFeatureAtCoordinate(t,e,i,s,r,o,a,l){let h;const c=e.viewState;function u(x,E,w,T){return r.call(o,E,x?w:null,T)}const d=c.projection,f=Ml(t.slice(),d),g=[[0,0]];if(d.canWrapX()&&s){const x=d.getExtent(),E=Q(x);g.push([-E,0],[E,0])}const m=e.layerStatesArray,_=m.length,p=[],y=[];for(let x=0;x<g.length;x++)for(let E=_-1;E>=0;--E){const w=m[E],T=w.layer;if(T.hasRenderer()&&$o(w,c)&&a.call(l,T)){const R=T.getRenderer(),I=T.getSource();if(R&&I){const L=I.getWrapX()?f:t,P=u.bind(null,w.managed);y[0]=L[0]+g[x][0],y[1]=L[1]+g[x][1],h=R.forEachFeatureAtCoordinate(y,e,i,P,p)}if(h)return h}}if(p.length===0)return;const v=1/p.length;return p.forEach((x,E)=>x.distanceSq+=E*v),p.sort((x,E)=>x.distanceSq-E.distanceSq),p.some(x=>h=x.callback(x.feature,x.layer,x.geometry)),h}hasFeatureAtCoordinate(t,e,i,s,r,o){return this.forEachFeatureAtCoordinate(t,e,i,s,Rn,this,r,o)!==void 0}getMap(){return this.map_}renderFrame(t){U()}scheduleExpireIconCache(t){jt.canExpireCache()&&t.postRenderFunctions.push(km)}}function km(n,t){jt.expire()}class Nm extends Fm{constructor(t){super(t),this.fontChangeListenerKey_=Z(Hi,ki.PROPERTYCHANGE,t.redrawText,t),this.element_=document.createElement("div");const e=this.element_.style;e.position="absolute",e.width="100%",e.height="100%",e.zIndex="0",this.element_.className=Us+" ol-layers";const i=t.getViewport();i.insertBefore(this.element_,i.firstChild||null),this.children_=[],this.renderedVisible_=!0}dispatchRenderEvent(t,e){const i=this.getMap();if(i.hasListener(t)){const s=new qh(t,void 0,e);i.dispatchEvent(s)}}disposeInternal(){nt(this.fontChangeListenerKey_),this.element_.remove(),super.disposeInternal()}renderFrame(t){if(!t){this.renderedVisible_&&(this.element_.style.display="none",this.renderedVisible_=!1);return}this.calculateMatrices2D(t),this.dispatchRenderEvent(Vt.PRECOMPOSE,t);const e=t.layerStatesArray.sort((a,l)=>a.zIndex-l.zIndex);e.some(a=>a.layer instanceof Ec&&a.layer.getDeclutter())&&(t.declutter={});const s=t.viewState;this.children_.length=0;const r=[];let o=null;for(let a=0,l=e.length;a<l;++a){const h=e[a];t.layerIndex=a;const c=h.layer,u=c.getSourceState();if(!$o(h,s)||u!="ready"&&u!="undefined"){c.unrender();continue}const d=c.render(t,o);d&&(d!==o&&(this.children_.push(d),o=d),r.push(h))}this.declutter(t,r),$f(this.element_,this.children_),this.dispatchRenderEvent(Vt.POSTCOMPOSE,t),this.renderedVisible_||(this.element_.style.display="",this.renderedVisible_=!0),this.scheduleExpireIconCache(t)}declutter(t,e){if(t.declutter){for(let i=e.length-1;i>=0;--i){const s=e[i],r=s.layer;r.getDeclutter()&&r.renderDeclutter(t,s)}e.forEach(i=>i.layer.renderDeferred(t))}}}function Sc(n){if(n instanceof hr){n.setMapInternal(null);return}n instanceof ln&&n.getLayers().forEach(Sc)}function bc(n,t){if(n instanceof hr){n.setMapInternal(t);return}if(n instanceof ln){const e=n.getLayers().getArray();for(let i=0,s=e.length;i<s;++i)bc(e[i],t)}}let Gm=class extends ne{constructor(t){super(),t=t||{},this.on,this.once,this.un;const e=zm(t);this.renderComplete_=!1,this.loaded_=!0,this.boundHandleBrowserEvent_=this.handleBrowserEvent.bind(this),this.maxTilesLoading_=t.maxTilesLoading!==void 0?t.maxTilesLoading:16,this.pixelRatio_=t.pixelRatio!==void 0?t.pixelRatio:Wf,this.postRenderTimeoutHandle_,this.animationDelayKey_,this.animationDelay_=this.animationDelay_.bind(this),this.coordinateToPixelTransform_=se(),this.pixelToCoordinateTransform_=se(),this.frameIndex_=0,this.frameState_=null,this.previousExtent_=null,this.viewPropertyListenerKey_=null,this.viewChangeListenerKey_=null,this.layerGroupPropertyListenerKeys_=null,this.viewport_=document.createElement("div"),this.viewport_.className="ol-viewport"+("ontouchstart"in window?" ol-touch":""),this.viewport_.style.position="relative",this.viewport_.style.overflow="hidden",this.viewport_.style.width="100%",this.viewport_.style.height="100%",this.overlayContainer_=document.createElement("div"),this.overlayContainer_.style.position="absolute",this.overlayContainer_.style.zIndex="0",this.overlayContainer_.style.width="100%",this.overlayContainer_.style.height="100%",this.overlayContainer_.style.pointerEvents="none",this.overlayContainer_.className="ol-overlaycontainer",this.viewport_.appendChild(this.overlayContainer_),this.overlayContainerStopEvent_=document.createElement("div"),this.overlayContainerStopEvent_.style.position="absolute",this.overlayContainerStopEvent_.style.zIndex="0",this.overlayContainerStopEvent_.style.width="100%",this.overlayContainerStopEvent_.style.height="100%",this.overlayContainerStopEvent_.style.pointerEvents="none",this.overlayContainerStopEvent_.className="ol-overlaycontainer-stopevent",this.viewport_.appendChild(this.overlayContainerStopEvent_),this.mapBrowserEventHandler_=null,this.moveTolerance_=t.moveTolerance,this.keyboardEventTarget_=e.keyboardEventTarget,this.targetChangeHandlerKeys_=null,this.targetElement_=null,this.resizeObserver_=new ResizeObserver(()=>this.updateSize()),this.controls=e.controls||fm(),this.interactions=e.interactions||Dm({onFocusOnly:!0}),this.overlays_=e.overlays,this.overlayIdIndex_={},this.renderer_=null,this.postRenderFunctions_=[],this.tileQueue_=new lm(this.getTilePriority.bind(this),this.handleTileChange_.bind(this)),this.addChangeListener(mt.LAYERGROUP,this.handleLayerGroupChanged_),this.addChangeListener(mt.VIEW,this.handleViewChanged_),this.addChangeListener(mt.SIZE,this.handleSizeChanged_),this.addChangeListener(mt.TARGET,this.handleTargetChanged_),this.setProperties(e.values);const i=this;t.view&&!(t.view instanceof ge)&&t.view.then(function(s){i.setView(new ge(s))}),this.controls.addEventListener(bt.ADD,s=>{s.element.setMap(this)}),this.controls.addEventListener(bt.REMOVE,s=>{s.element.setMap(null)}),this.interactions.addEventListener(bt.ADD,s=>{s.element.setMap(this)}),this.interactions.addEventListener(bt.REMOVE,s=>{s.element.setMap(null)}),this.overlays_.addEventListener(bt.ADD,s=>{this.addOverlayInternal_(s.element)}),this.overlays_.addEventListener(bt.REMOVE,s=>{const r=s.element.getId();r!==void 0&&delete this.overlayIdIndex_[r.toString()],s.element.setMap(null)}),this.controls.forEach(s=>{s.setMap(this)}),this.interactions.forEach(s=>{s.setMap(this)}),this.overlays_.forEach(this.addOverlayInternal_.bind(this))}addControl(t){this.getControls().push(t)}addInteraction(t){this.getInteractions().push(t)}addLayer(t){this.getLayerGroup().getLayers().push(t)}handleLayerAdd_(t){bc(t.layer,this)}addOverlay(t){this.getOverlays().push(t)}addOverlayInternal_(t){const e=t.getId();e!==void 0&&(this.overlayIdIndex_[e.toString()]=t),t.setMap(this)}disposeInternal(){this.controls.clear(),this.interactions.clear(),this.overlays_.clear(),this.resizeObserver_.disconnect(),this.setTarget(null),super.disposeInternal()}forEachFeatureAtPixel(t,e,i){if(!this.frameState_||!this.renderer_)return;const s=this.getCoordinateFromPixelInternal(t);i=i!==void 0?i:{};const r=i.hitTolerance!==void 0?i.hitTolerance:0,o=i.layerFilter!==void 0?i.layerFilter:Rn,a=i.checkWrapped!==!1;return this.renderer_.forEachFeatureAtCoordinate(s,this.frameState_,r,a,e,null,o,null)}getFeaturesAtPixel(t,e){const i=[];return this.forEachFeatureAtPixel(t,function(s){i.push(s)},e),i}getAllLayers(){const t=[];function e(i){i.forEach(function(s){s instanceof ln?e(s.getLayers()):t.push(s)})}return e(this.getLayers()),t}hasFeatureAtPixel(t,e){if(!this.frameState_||!this.renderer_)return!1;const i=this.getCoordinateFromPixelInternal(t);e=e!==void 0?e:{};const s=e.layerFilter!==void 0?e.layerFilter:Rn,r=e.hitTolerance!==void 0?e.hitTolerance:0,o=e.checkWrapped!==!1;return this.renderer_.hasFeatureAtCoordinate(i,this.frameState_,r,o,s,null)}getEventCoordinate(t){return this.getCoordinateFromPixel(this.getEventPixel(t))}getEventCoordinateInternal(t){return this.getCoordinateFromPixelInternal(this.getEventPixel(t))}getEventPixel(t){const i=this.viewport_.getBoundingClientRect(),s=this.getSize(),r=i.width/s[0],o=i.height/s[1],a="changedTouches"in t?t.changedTouches[0]:t;return[(a.clientX-i.left)/r,(a.clientY-i.top)/o]}getTarget(){return this.get(mt.TARGET)}getTargetElement(){return this.targetElement_}getCoordinateFromPixel(t){return so(this.getCoordinateFromPixelInternal(t),this.getView().getProjection())}getCoordinateFromPixelInternal(t){const e=this.frameState_;return e?dt(e.pixelToCoordinateTransform,t.slice()):null}getControls(){return this.controls}getOverlays(){return this.overlays_}getOverlayById(t){const e=this.overlayIdIndex_[t.toString()];return e!==void 0?e:null}getInteractions(){return this.interactions}getLayerGroup(){return this.get(mt.LAYERGROUP)}setLayers(t){const e=this.getLayerGroup();if(t instanceof ue){e.setLayers(t);return}const i=e.getLayers();i.clear(),i.extend(t)}getLayers(){return this.getLayerGroup().getLayers()}getLoadingOrNotReady(){const t=this.getLayerGroup().getLayerStatesArray();for(let e=0,i=t.length;e<i;++e){const s=t[e];if(!s.visible)continue;const r=s.layer.getRenderer();if(r&&!r.ready)return!0;const o=s.layer.getSource();if(o&&o.loading)return!0}return!1}getPixelFromCoordinate(t){const e=we(t,this.getView().getProjection());return this.getPixelFromCoordinateInternal(e)}getPixelFromCoordinateInternal(t){const e=this.frameState_;return e?dt(e.coordinateToPixelTransform,t.slice(0,2)):null}getRenderer(){return this.renderer_}getSize(){return this.get(mt.SIZE)}getView(){return this.get(mt.VIEW)}getViewport(){return this.viewport_}getOverlayContainer(){return this.overlayContainer_}getOverlayContainerStopEvent(){return this.overlayContainerStopEvent_}getOwnerDocument(){const t=this.getTargetElement();return t?t.ownerDocument:document}getTilePriority(t,e,i,s){return hm(this.frameState_,t,e,i,s)}handleBrowserEvent(t,e){e=e||t.type;const i=new qe(e,this,t);this.handleMapBrowserEvent(i)}handleMapBrowserEvent(t){if(!this.frameState_)return;const e=t.originalEvent,i=e.type;if(i===Bo.POINTERDOWN||i===z.WHEEL||i===z.KEYDOWN){const s=this.getOwnerDocument(),r=this.viewport_.getRootNode?this.viewport_.getRootNode():s,o=e.target,a=r instanceof ShadowRoot?r.host===o?r.host.ownerDocument:r:r===s?s.documentElement:r;if(this.overlayContainerStopEvent_.contains(o)||!a.contains(o))return}if(t.frameState=this.frameState_,this.dispatchEvent(t)!==!1){const s=this.getInteractions().getArray().slice();for(let r=s.length-1;r>=0;r--){const o=s[r];if(o.getMap()!==this||!o.getActive()||!this.getTargetElement())continue;if(!o.handleEvent(t)||t.propagationStopped)break}}}handlePostRender(){const t=this.frameState_,e=this.tileQueue_;if(!e.isEmpty()){let s=this.maxTilesLoading_,r=s;if(t){const o=t.viewHints;if(o[_t.ANIMATING]||o[_t.INTERACTING]){const a=Date.now()-t.time>8;s=a?0:8,r=a?0:2}}e.getTilesLoading()<s&&(e.reprioritize(),e.loadMoreTiles(s,r))}t&&this.renderer_&&!t.animate&&(this.renderComplete_?(this.hasListener(Vt.RENDERCOMPLETE)&&this.renderer_.dispatchRenderEvent(Vt.RENDERCOMPLETE,t),this.loaded_===!1&&(this.loaded_=!0,this.dispatchEvent(new on(Ae.LOADEND,this,t)))):this.loaded_===!0&&(this.loaded_=!1,this.dispatchEvent(new on(Ae.LOADSTART,this,t))));const i=this.postRenderFunctions_;if(t)for(let s=0,r=i.length;s<r;++s)i[s](this,t);i.length=0}handleSizeChanged_(){this.getView()&&!this.getView().getAnimating()&&this.getView().resolveConstraints(0),this.render()}handleTargetChanged_(){if(this.mapBrowserEventHandler_){for(let i=0,s=this.targetChangeHandlerKeys_.length;i<s;++i)nt(this.targetChangeHandlerKeys_[i]);this.targetChangeHandlerKeys_=null,this.viewport_.removeEventListener(z.CONTEXTMENU,this.boundHandleBrowserEvent_),this.viewport_.removeEventListener(z.WHEEL,this.boundHandleBrowserEvent_),this.mapBrowserEventHandler_.dispose(),this.mapBrowserEventHandler_=null,this.viewport_.remove()}if(this.targetElement_){this.resizeObserver_.unobserve(this.targetElement_);const i=this.targetElement_.getRootNode();i instanceof ShadowRoot&&this.resizeObserver_.unobserve(i.host),this.setSize(void 0)}const t=this.getTarget(),e=typeof t=="string"?document.getElementById(t):t;if(this.targetElement_=e,!e)this.renderer_&&(clearTimeout(this.postRenderTimeoutHandle_),this.postRenderTimeoutHandle_=void 0,this.postRenderFunctions_.length=0,this.renderer_.dispose(),this.renderer_=null),this.animationDelayKey_&&(cancelAnimationFrame(this.animationDelayKey_),this.animationDelayKey_=void 0);else{e.appendChild(this.viewport_),this.renderer_||(this.renderer_=new Nm(this)),this.mapBrowserEventHandler_=new om(this,this.moveTolerance_);for(const r in rt)this.mapBrowserEventHandler_.addEventListener(rt[r],this.handleMapBrowserEvent.bind(this));this.viewport_.addEventListener(z.CONTEXTMENU,this.boundHandleBrowserEvent_,!1),this.viewport_.addEventListener(z.WHEEL,this.boundHandleBrowserEvent_,gh?{passive:!1}:!1);let i;if(this.keyboardEventTarget_)i=this.keyboardEventTarget_;else{const r=e.getRootNode();i=r instanceof ShadowRoot?r.host:e}this.targetChangeHandlerKeys_=[Z(i,z.KEYDOWN,this.handleBrowserEvent,this),Z(i,z.KEYPRESS,this.handleBrowserEvent,this)];const s=e.getRootNode();s instanceof ShadowRoot&&this.resizeObserver_.observe(s.host),this.resizeObserver_.observe(e)}this.updateSize()}handleTileChange_(){this.render()}handleViewPropertyChanged_(){this.render()}handleViewChanged_(){this.viewPropertyListenerKey_&&(nt(this.viewPropertyListenerKey_),this.viewPropertyListenerKey_=null),this.viewChangeListenerKey_&&(nt(this.viewChangeListenerKey_),this.viewChangeListenerKey_=null);const t=this.getView();t&&(this.updateViewportSize_(this.getSize()),this.viewPropertyListenerKey_=Z(t,ki.PROPERTYCHANGE,this.handleViewPropertyChanged_,this),this.viewChangeListenerKey_=Z(t,z.CHANGE,this.handleViewPropertyChanged_,this),t.resolveConstraints(0)),this.render()}handleLayerGroupChanged_(){this.layerGroupPropertyListenerKeys_&&(this.layerGroupPropertyListenerKeys_.forEach(nt),this.layerGroupPropertyListenerKeys_=null);const t=this.getLayerGroup();t&&(this.handleLayerAdd_(new Je("addlayer",t)),this.layerGroupPropertyListenerKeys_=[Z(t,ki.PROPERTYCHANGE,this.render,this),Z(t,z.CHANGE,this.render,this),Z(t,"addlayer",this.handleLayerAdd_,this),Z(t,"removelayer",this.handleLayerRemove_,this)]),this.render()}isRendered(){return!!this.frameState_}animationDelay_(){this.animationDelayKey_=void 0,this.renderFrame_(Date.now())}renderSync(){this.animationDelayKey_&&cancelAnimationFrame(this.animationDelayKey_),this.animationDelay_()}redrawText(){if(!this.frameState_)return;const t=this.frameState_.layerStatesArray;for(let e=0,i=t.length;e<i;++e){const s=t[e].layer;s.hasRenderer()&&s.getRenderer().handleFontsChanged()}}render(){this.renderer_&&this.animationDelayKey_===void 0&&(this.animationDelayKey_=requestAnimationFrame(this.animationDelay_))}removeControl(t){return this.getControls().remove(t)}removeInteraction(t){return this.getInteractions().remove(t)}removeLayer(t){return this.getLayerGroup().getLayers().remove(t)}handleLayerRemove_(t){Sc(t.layer)}removeOverlay(t){return this.getOverlays().remove(t)}renderFrame_(t){const e=this.getSize(),i=this.getView(),s=this.frameState_;let r=null;if(e!==void 0&&Xh(e)&&i&&i.isDef()){const o=i.getHints(this.frameState_?this.frameState_.viewHints:void 0),a=i.getState();if(r={animate:!1,coordinateToPixelTransform:this.coordinateToPixelTransform_,declutter:null,extent:Xr(a.center,a.resolution,a.rotation,e),index:this.frameIndex_++,layerIndex:0,layerStatesArray:this.getLayerGroup().getLayerStatesArray(),pixelRatio:this.pixelRatio_,pixelToCoordinateTransform:this.pixelToCoordinateTransform_,postRenderFunctions:[],size:e,tileQueue:this.tileQueue_,time:t,usedTiles:{},viewState:a,viewHints:o,wantedTiles:{},mapId:V(this),renderTargets:{}},a.nextCenter&&a.nextResolution){const l=isNaN(a.nextRotation)?a.rotation:a.nextRotation;r.nextExtent=Xr(a.nextCenter,a.nextResolution,l,e)}}this.frameState_=r,this.renderer_.renderFrame(r),r&&(r.animate&&this.render(),Array.prototype.push.apply(this.postRenderFunctions_,r.postRenderFunctions),s&&(!this.previousExtent_||!As(this.previousExtent_)&&!bn(r.extent,this.previousExtent_))&&(this.dispatchEvent(new on(Ae.MOVESTART,this,s)),this.previousExtent_=Is(this.previousExtent_)),this.previousExtent_&&!r.viewHints[_t.ANIMATING]&&!r.viewHints[_t.INTERACTING]&&!bn(r.extent,this.previousExtent_)&&(this.dispatchEvent(new on(Ae.MOVEEND,this,r)),yl(r.extent,this.previousExtent_))),this.dispatchEvent(new on(Ae.POSTRENDER,this,r)),this.renderComplete_=(this.hasListener(Ae.LOADSTART)||this.hasListener(Ae.LOADEND)||this.hasListener(Vt.RENDERCOMPLETE))&&!this.tileQueue_.getTilesLoading()&&!this.tileQueue_.getCount()&&!this.getLoadingOrNotReady(),this.postRenderTimeoutHandle_||(this.postRenderTimeoutHandle_=setTimeout(()=>{this.postRenderTimeoutHandle_=void 0,this.handlePostRender()},0))}setLayerGroup(t){const e=this.getLayerGroup();e&&this.handleLayerRemove_(new Je("removelayer",e)),this.set(mt.LAYERGROUP,t)}setSize(t){this.set(mt.SIZE,t)}setTarget(t){this.set(mt.TARGET,t)}setView(t){if(!t||t instanceof ge){this.set(mt.VIEW,t);return}this.set(mt.VIEW,new ge);const e=this;t.then(function(i){e.setView(new ge(i))})}updateSize(){const t=this.getTargetElement();let e;if(t){const s=getComputedStyle(t),r=t.offsetWidth-parseFloat(s.borderLeftWidth)-parseFloat(s.paddingLeft)-parseFloat(s.paddingRight)-parseFloat(s.borderRightWidth),o=t.offsetHeight-parseFloat(s.borderTopWidth)-parseFloat(s.paddingTop)-parseFloat(s.paddingBottom)-parseFloat(s.borderBottomWidth);!isNaN(r)&&!isNaN(o)&&(e=[Math.max(0,r),Math.max(0,o)],!Xh(e)&&(t.offsetWidth||t.offsetHeight||t.getClientRects().length)&&Al("No map visible because the map container's width or height are 0."))}const i=this.getSize();e&&(!i||!Xe(e,i))&&(this.setSize(e),this.updateViewportSize_(e))}updateViewportSize_(t){const e=this.getView();e&&e.setViewportSize(t)}};function zm(n){let t=null;n.keyboardEventTarget!==void 0&&(t=typeof n.keyboardEventTarget=="string"?document.getElementById(n.keyboardEventTarget):n.keyboardEventTarget);const e={},i=n.layers&&typeof n.layers.getLayers=="function"?n.layers:new ln({layers:n.layers});e[mt.LAYERGROUP]=i,e[mt.TARGET]=n.target,e[mt.VIEW]=n.view instanceof ge?n.view:new ge;let s;n.controls!==void 0&&(Array.isArray(n.controls)?s=new ue(n.controls.slice()):(J(typeof n.controls.getArray=="function","Expected `controls` to be an array or an `ol/Collection.js`"),s=n.controls));let r;n.interactions!==void 0&&(Array.isArray(n.interactions)?r=new ue(n.interactions.slice()):(J(typeof n.interactions.getArray=="function","Expected `interactions` to be an array or an `ol/Collection.js`"),r=n.interactions));let o;return n.overlays!==void 0?Array.isArray(n.overlays)?o=new ue(n.overlays.slice()):(J(typeof n.overlays.getArray=="function","Expected `overlays` to be an array or an `ol/Collection.js`"),o=n.overlays):o=new ue,{controls:s,interactions:r,keyboardEventTarget:t,overlays:o,values:e}}const pt={ELEMENT:"element",MAP:"map",OFFSET:"offset",POSITION:"position",POSITIONING:"positioning"};class Wm extends ne{constructor(t){super(),this.on,this.once,this.un,this.options=t,this.id=t.id,this.insertFirst=t.insertFirst!==void 0?t.insertFirst:!0,this.stopEvent=t.stopEvent!==void 0?t.stopEvent:!0,this.element=document.createElement("div"),this.element.className=t.className!==void 0?t.className:"ol-overlay-container "+sg,this.element.style.position="absolute",this.element.style.pointerEvents="auto",this.autoPan=t.autoPan===!0?{}:t.autoPan||void 0,this.rendered={transform_:"",visible:!0},this.mapPostrenderListenerKey=null,this.addChangeListener(pt.ELEMENT,this.handleElementChanged),this.addChangeListener(pt.MAP,this.handleMapChanged),this.addChangeListener(pt.OFFSET,this.handleOffsetChanged),this.addChangeListener(pt.POSITION,this.handlePositionChanged),this.addChangeListener(pt.POSITIONING,this.handlePositioningChanged),t.element!==void 0&&this.setElement(t.element),this.setOffset(t.offset!==void 0?t.offset:[0,0]),this.setPositioning(t.positioning||"top-left"),t.position!==void 0&&this.setPosition(t.position)}getElement(){return this.get(pt.ELEMENT)}getId(){return this.id}getMap(){return this.get(pt.MAP)||null}getOffset(){return this.get(pt.OFFSET)}getPosition(){return this.get(pt.POSITION)}getPositioning(){return this.get(pt.POSITIONING)}handleElementChanged(){mh(this.element);const t=this.getElement();t&&this.element.appendChild(t)}handleMapChanged(){this.mapPostrenderListenerKey&&(this.element?.remove(),nt(this.mapPostrenderListenerKey),this.mapPostrenderListenerKey=null);const t=this.getMap();if(t){this.mapPostrenderListenerKey=Z(t,Ae.POSTRENDER,this.render,this),this.updatePixelPosition();const e=this.stopEvent?t.getOverlayContainerStopEvent():t.getOverlayContainer();this.insertFirst?e.insertBefore(this.element,e.childNodes[0]||null):e.appendChild(this.element),this.performAutoPan()}}render(){this.updatePixelPosition()}handleOffsetChanged(){this.updatePixelPosition()}handlePositionChanged(){this.updatePixelPosition(),this.performAutoPan()}handlePositioningChanged(){this.updatePixelPosition()}setElement(t){this.set(pt.ELEMENT,t)}setMap(t){this.set(pt.MAP,t)}setOffset(t){this.set(pt.OFFSET,t)}setPosition(t){this.set(pt.POSITION,t)}performAutoPan(){this.autoPan&&this.panIntoView(this.autoPan)}panIntoView(t){const e=this.getMap();if(!e||!e.getTargetElement()||!this.get(pt.POSITION))return;const i=this.getRect(e.getTargetElement(),e.getSize()),s=this.getElement(),r=this.getRect(s,[Xf(s),Yf(s)]);t=t||{};const o=t.margin===void 0?20:t.margin;if(!zi(i,r)){const a=r[0]-i[0],l=i[2]-r[2],h=r[1]-i[1],c=i[3]-r[3],u=[0,0];if(a<0?u[0]=a-o:l<0&&(u[0]=Math.abs(l)+o),h<0?u[1]=h-o:c<0&&(u[1]=Math.abs(c)+o),u[0]!==0||u[1]!==0){const d=e.getView().getCenterInternal(),f=e.getPixelFromCoordinateInternal(d);if(!f)return;const g=[f[0]+u[0],f[1]+u[1]],m=t.animation||{};e.getView().animateInternal({center:e.getCoordinateFromPixelInternal(g),duration:m.duration,easing:m.easing})}}}getRect(t,e){const i=t.getBoundingClientRect(),s=i.left+window.pageXOffset,r=i.top+window.pageYOffset;return[s,r,s+e[0],r+e[1]]}setPositioning(t){this.set(pt.POSITIONING,t)}setVisible(t){this.rendered.visible!==t&&(this.element.style.display=t?"":"none",this.rendered.visible=t)}updatePixelPosition(){const t=this.getMap(),e=this.getPosition();if(!t||!t.isRendered()||!e){this.setVisible(!1);return}const i=t.getPixelFromCoordinate(e),s=t.getSize();this.updateRenderedPosition(i,s)}updateRenderedPosition(t,e){const i=this.element.style,s=this.getOffset(),r=this.getPositioning();this.setVisible(!0);const o=`${t[0]+s[0]}px`,a=`${t[1]+s[1]}px`;let l="0%",h="0%";r=="bottom-right"||r=="center-right"||r=="top-right"?l="-100%":(r=="bottom-center"||r=="center-center"||r=="top-center")&&(l="-50%"),r=="bottom-left"||r=="bottom-center"||r=="bottom-right"?h="-100%":(r=="center-left"||r=="center-center"||r=="center-right")&&(h="-50%");const c=`translate(${l}, ${h}) translate(${o}, ${a})`;this.rendered.transform_!=c&&(this.rendered.transform_=c,i.transform=c)}getOptions(){return this.options}}class Jo{constructor(t,e,i,s){this.minX=t,this.maxX=e,this.minY=i,this.maxY=s}contains(t){return this.containsXY(t[1],t[2])}containsTileRange(t){return this.minX<=t.minX&&t.maxX<=this.maxX&&this.minY<=t.minY&&t.maxY<=this.maxY}containsXY(t,e){return this.minX<=t&&t<=this.maxX&&this.minY<=e&&e<=this.maxY}equals(t){return this.minX==t.minX&&this.minY==t.minY&&this.maxX==t.maxX&&this.maxY==t.maxY}extend(t){t.minX<this.minX&&(this.minX=t.minX),t.maxX>this.maxX&&(this.maxX=t.maxX),t.minY<this.minY&&(this.minY=t.minY),t.maxY>this.maxY&&(this.maxY=t.maxY)}getHeight(){return this.maxY-this.minY+1}getSize(){return[this.getWidth(),this.getHeight()]}getWidth(){return this.maxX-this.minX+1}intersects(t){return this.minX<=t.maxX&&this.maxX>=t.minX&&this.minY<=t.maxY&&this.maxY>=t.minY}}function hn(n,t,e,i,s){return s!==void 0?(s.minX=n,s.maxX=t,s.minY=e,s.maxY=i,s):new Jo(n,t,e,i)}function ur(n,t,e,i){return i!==void 0?(i[0]=n,i[1]=t,i[2]=e,i):[n,t,e]}function Xm(n,t,e){return n+"/"+t+"/"+e}function Ym(n){return $m(n[0],n[1],n[2])}function $m(n,t,e){return(t<<n)+e}function Km(n,t){const e=n[0],i=n[1],s=n[2];if(t.getMinZoom()>e||e>t.getMaxZoom())return!1;const r=t.getFullTileRange(e);return r?r.containsXY(i,s):!0}const cn=[0,0,0],Qe=5;class Lc{constructor(t){this.minZoom=t.minZoom!==void 0?t.minZoom:0,this.resolutions_=t.resolutions,J(Cd(this.resolutions_,(s,r)=>r-s),"`resolutions` must be sorted in descending order");let e;if(!t.origins){for(let s=0,r=this.resolutions_.length-1;s<r;++s)if(!e)e=this.resolutions_[s]/this.resolutions_[s+1];else if(this.resolutions_[s]/this.resolutions_[s+1]!==e){e=void 0;break}}this.zoomFactor_=e,this.maxZoom=this.resolutions_.length-1,this.origin_=t.origin!==void 0?t.origin:null,this.origins_=null,t.origins!==void 0&&(this.origins_=t.origins,J(this.origins_.length==this.resolutions_.length,"Number of `origins` and `resolutions` must be equal"));const i=t.extent;i!==void 0&&!this.origin_&&!this.origins_&&(this.origin_=ui(i)),J(!this.origin_&&this.origins_||this.origin_&&!this.origins_,"Either `origin` or `origins` must be configured, never both"),this.tileSizes_=null,t.tileSizes!==void 0&&(this.tileSizes_=t.tileSizes,J(this.tileSizes_.length==this.resolutions_.length,"Number of `tileSizes` and `resolutions` must be equal")),this.tileSize_=t.tileSize!==void 0?t.tileSize:this.tileSizes_?null:Wo,J(!this.tileSize_&&this.tileSizes_||this.tileSize_&&!this.tileSizes_,"Either `tileSize` or `tileSizes` must be configured, never both"),this.extent_=i!==void 0?i:null,this.fullTileRanges_=null,this.tmpSize_=[0,0],this.tmpExtent_=[0,0,0,0],t.sizes!==void 0?this.fullTileRanges_=t.sizes.map((s,r)=>{const o=new Jo(Math.min(0,s[0]),Math.max(s[0]-1,-1),Math.min(0,s[1]),Math.max(s[1]-1,-1));if(i){const a=this.getTileRangeForExtentAndZ(i,r);o.minX=Math.max(a.minX,o.minX),o.maxX=Math.min(a.maxX,o.maxX),o.minY=Math.max(a.minY,o.minY),o.maxY=Math.min(a.maxY,o.maxY)}return o}):i&&this.calculateTileRanges_(i)}forEachTileCoord(t,e,i){const s=this.getTileRangeForExtentAndZ(t,e);for(let r=s.minX,o=s.maxX;r<=o;++r)for(let a=s.minY,l=s.maxY;a<=l;++a)i([e,r,a])}forEachTileCoordParentTileRange(t,e,i,s){let r,o,a,l=null,h=t[0]-1;for(this.zoomFactor_===2?(o=t[1],a=t[2]):l=this.getTileCoordExtent(t,s);h>=this.minZoom;){if(o!==void 0&&a!==void 0?(o=Math.floor(o/2),a=Math.floor(a/2),r=hn(o,o,a,a,i)):r=this.getTileRangeForExtentAndZ(l,h,i),e(h,r))return!0;--h}return!1}getExtent(){return this.extent_}getMaxZoom(){return this.maxZoom}getMinZoom(){return this.minZoom}getOrigin(t){return this.origin_?this.origin_:this.origins_[t]}getResolution(t){return this.resolutions_[t]}getResolutions(){return this.resolutions_}getTileCoordChildTileRange(t,e,i){if(t[0]<this.maxZoom){if(this.zoomFactor_===2){const r=t[1]*2,o=t[2]*2;return hn(r,r+1,o,o+1,e)}const s=this.getTileCoordExtent(t,i||this.tmpExtent_);return this.getTileRangeForExtentAndZ(s,t[0]+1,e)}return null}getTileRangeForTileCoordAndZ(t,e,i){if(e>this.maxZoom||e<this.minZoom)return null;const s=t[0],r=t[1],o=t[2];if(e===s)return hn(r,o,r,o,i);if(this.zoomFactor_){const l=Math.pow(this.zoomFactor_,e-s),h=Math.floor(r*l),c=Math.floor(o*l);if(e<s)return hn(h,h,c,c,i);const u=Math.floor(l*(r+1))-1,d=Math.floor(l*(o+1))-1;return hn(h,u,c,d,i)}const a=this.getTileCoordExtent(t,this.tmpExtent_);return this.getTileRangeForExtentAndZ(a,e,i)}getTileRangeForExtentAndZ(t,e,i){this.getTileCoordForXYAndZ_(t[0],t[3],e,!1,cn);const s=cn[1],r=cn[2];this.getTileCoordForXYAndZ_(t[2],t[1],e,!0,cn);const o=cn[1],a=cn[2];return hn(s,o,r,a,i)}getTileCoordCenter(t){const e=this.getOrigin(t[0]),i=this.getResolution(t[0]),s=Pt(this.getTileSize(t[0]),this.tmpSize_);return[e[0]+(t[1]+.5)*s[0]*i,e[1]-(t[2]+.5)*s[1]*i]}getTileCoordExtent(t,e){const i=this.getOrigin(t[0]),s=this.getResolution(t[0]),r=Pt(this.getTileSize(t[0]),this.tmpSize_),o=i[0]+t[1]*r[0]*s,a=i[1]-(t[2]+1)*r[1]*s,l=o+r[0]*s,h=a+r[1]*s;return Ye(o,a,l,h,e)}getTileCoordForCoordAndResolution(t,e,i){return this.getTileCoordForXYAndResolution_(t[0],t[1],e,!1,i)}getTileCoordForXYAndResolution_(t,e,i,s,r){const o=this.getZForResolution(i),a=i/this.getResolution(o),l=this.getOrigin(o),h=Pt(this.getTileSize(o),this.tmpSize_);let c=a*(t-l[0])/i/h[0],u=a*(l[1]-e)/i/h[1];return s?(c=Os(c,Qe)-1,u=Os(u,Qe)-1):(c=Ps(c,Qe),u=Ps(u,Qe)),ur(o,c,u,r)}getTileCoordForXYAndZ_(t,e,i,s,r){const o=this.getOrigin(i),a=this.getResolution(i),l=Pt(this.getTileSize(i),this.tmpSize_);let h=(t-o[0])/a/l[0],c=(o[1]-e)/a/l[1];return s?(h=Os(h,Qe)-1,c=Os(c,Qe)-1):(h=Ps(h,Qe),c=Ps(c,Qe)),ur(i,h,c,r)}getTileCoordForCoordAndZ(t,e,i){return this.getTileCoordForXYAndZ_(t[0],t[1],e,!1,i)}getTileCoordResolution(t){return this.resolutions_[t[0]]}getTileSize(t){return this.tileSize_?this.tileSize_:this.tileSizes_[t]}getFullTileRange(t){return this.fullTileRanges_?this.fullTileRanges_[t]:this.extent_?this.getTileRangeForExtentAndZ(this.extent_,t):null}getZForResolution(t,e){const i=Dr(this.resolutions_,t,e||0);return st(i,this.minZoom,this.maxZoom)}tileCoordIntersectsViewport(t,e){return lh(e,0,e.length,2,this.getTileCoordExtent(t))}calculateTileRanges_(t){const e=this.resolutions_.length,i=new Array(e);for(let s=this.minZoom;s<e;++s)i[s]=this.getTileRangeForExtentAndZ(t,s);this.fullTileRanges_=i}}function Ac(n){let t=n.getDefaultTileGrid();return t||(t=Vm(n),n.setDefaultTileGrid(t)),t}function Bm(n,t,e){const i=t[0],s=n.getTileCoordCenter(t),r=Qo(e);if(!Gi(r,s)){const o=Q(r),a=Math.ceil((r[0]-s[0])/o);return s[0]+=o*a,n.getTileCoordForCoordAndZ(s,i)}return t}function Zm(n,t,e,i){i=i!==void 0?i:"top-left";const s=Mc(n,t,e);return new Lc({extent:n,origin:Ld(n,i),resolutions:s,tileSize:e})}function Um(n){const t=n||{},e=t.extent||At("EPSG:3857").getExtent(),i={extent:e,minZoom:t.minZoom,tileSize:t.tileSize,resolutions:Mc(e,t.maxZoom,t.tileSize,t.maxResolution)};return new Lc(i)}function Mc(n,t,e,i){t=t!==void 0?t:q_,e=Pt(e!==void 0?e:Wo);const s=Ct(n),r=Q(n);i=i>0?i:Math.max(r/e[0],s/e[1]);const o=t+1,a=new Array(o);for(let l=0;l<o;++l)a[l]=i/Math.pow(2,l);return a}function Vm(n,t,e,i){const s=Qo(n);return Zm(s,t,e,i)}function Qo(n){n=At(n);let t=n.getExtent();if(!t){const e=180*Kr.degrees/n.getMetersPerUnit();t=Ye(-e,-e,e,e)}return t}let ta;const un=[];function Pc(n,t,e,i,s){n.beginPath(),n.moveTo(0,0),n.lineTo(t,e),n.lineTo(i,s),n.closePath(),n.save(),n.clip(),n.fillRect(0,0,Math.max(t,i)+1,Math.max(e,s)),n.restore()}function ea(n,t){return Math.abs(n[t*4]-210)>2||Math.abs(n[t*4+3]-.75*255)>2}function jm(){if(ta===void 0){const n=lt(6,6,un);n.globalCompositeOperation="lighter",n.fillStyle="rgba(210, 0, 0, 0.75)",Pc(n,4,5,4,0),Pc(n,4,5,0,5);const t=n.getImageData(0,0,3,3).data;ta=ea(t,0)||ea(t,4)||ea(t,8),Ks(n),un.push(n.canvas)}return ta}function Oc(n,t,e,i){const s=Pn(e,t,n);let r=Bl(t,i,e);const o=t.getMetersPerUnit();o!==void 0&&(r*=o);const a=n.getMetersPerUnit();a!==void 0&&(r/=a);const l=n.getExtent();if(!l||Gi(l,s)){const h=Bl(n,r,s)/r;isFinite(h)&&h>0&&(r/=h)}return r}function Hm(n,t,e,i){const s=hi(e);let r=Oc(n,t,s,i);return(!isFinite(r)||r<=0)&&Rl(e,function(o){return r=Oc(n,t,o,i),isFinite(r)&&r>0}),r}function qm(n,t,e,i,s,r,o,a,l,h,c,u,d,f){const g=lt(Math.round(e*n),Math.round(e*t),un);if(u||(g.imageSmoothingEnabled=!1),l.length===0)return g.canvas;g.scale(e,e);function m(E){return Math.round(E*e)/e}g.globalCompositeOperation="lighter";const _=zt();l.forEach(function(E,w,T){vl(_,E.extent)});let p;const y=e/i,v=(u?1:1+Math.pow(2,-24))/y;p=lt(Math.round(Q(_)*y),Math.round(Ct(_)*y),un),u||(p.imageSmoothingEnabled=!1),l.forEach(function(E,w,T){if(E.image.width>0&&E.image.height>0){if(E.clipExtent){p.save();const A=(E.clipExtent[0]-_[0])*y,b=-(E.clipExtent[3]-_[3])*y,M=Q(E.clipExtent)*y,Y=Ct(E.clipExtent)*y;p.rect(u?A:Math.round(A),u?b:Math.round(b),u?M:Math.round(A+M)-Math.round(A),u?Y:Math.round(b+Y)-Math.round(b)),p.clip()}const R=(E.extent[0]-_[0])*y,I=-(E.extent[3]-_[3])*y,L=Q(E.extent)*y,P=Ct(E.extent)*y;p.drawImage(E.image,h,h,E.image.width-2*h,E.image.height-2*h,u?R:Math.round(R),u?I:Math.round(I),u?L:Math.round(R+L)-Math.round(R),u?P:Math.round(I+P)-Math.round(I)),E.clipExtent&&p.restore()}});const x=ui(o);return a.getTriangles().forEach(function(E,w,T){const R=E.source,I=E.target;let L=R[0][0],P=R[0][1],A=R[1][0],b=R[1][1],M=R[2][0],Y=R[2][1];const k=m((I[0][0]-x[0])/r),G=m(-(I[0][1]-x[1])/r),F=m((I[1][0]-x[0])/r),$=m(-(I[1][1]-x[1])/r),B=m((I[2][0]-x[0])/r),et=m(-(I[2][1]-x[1])/r),S=L,yt=P;L=0,P=0,A-=S,b-=yt,M-=S,Y-=yt;const Tt=[[A,b,0,0,F-k],[M,Y,0,0,B-k],[0,0,A,b,$-G],[0,0,M,Y,et-G]],at=Od(Tt);if(!at)return;if(g.save(),g.beginPath(),jm()||!u){g.moveTo(F,$);const xt=4,_e=k-F,he=G-$;for(let Xt=0;Xt<xt;Xt++)g.lineTo(F+m((Xt+1)*_e/xt),$+m(Xt*he/(xt-1))),Xt!=xt-1&&g.lineTo(F+m((Xt+1)*_e/xt),$+m((Xt+1)*he/(xt-1)));g.lineTo(B,et)}else g.moveTo(F,$),g.lineTo(k,G),g.lineTo(B,et);g.clip(),g.transform(at[0],at[2],at[1],at[3],k,G),g.translate(_[0]-S,_[3]-yt);let Wt;if(p)Wt=p.canvas,g.scale(v,-v);else{const xt=l[0],_e=xt.extent;Wt=xt.image,g.scale(Q(_e)/Wt.width,-Ct(_e)/Wt.height)}g.drawImage(Wt,0,0),g.restore()}),p&&(Ks(p),un.push(p.canvas)),c&&(g.save(),g.globalCompositeOperation="source-over",g.strokeStyle="black",g.lineWidth=1,a.getTriangles().forEach(function(E,w,T){const R=E.target,I=(R[0][0]-x[0])/r,L=-(R[0][1]-x[1])/r,P=(R[1][0]-x[0])/r,A=-(R[1][1]-x[1])/r,b=(R[2][0]-x[0])/r,M=-(R[2][1]-x[1])/r;g.beginPath(),g.moveTo(P,A),g.lineTo(I,L),g.lineTo(b,M),g.closePath(),g.stroke()}),g.restore()),g.canvas}const Jm=10,Dc=.25;class Qm{constructor(t,e,i,s,r,o,a){this.sourceProj_=t,this.targetProj_=e;let l={};const h=a?uf(v=>dt(a,Pn(v,this.targetProj_,this.sourceProj_))):Ws(this.targetProj_,this.sourceProj_);this.transformInv_=function(v){const x=v[0]+"/"+v[1];return l[x]||(l[x]=h(v)),l[x]},this.maxSourceExtent_=s,this.errorThresholdSquared_=r*r,this.triangles_=[],this.wrapsXInSource_=!1,this.canWrapXInSource_=this.sourceProj_.canWrapX()&&!!s&&!!this.sourceProj_.getExtent()&&Q(s)>=Q(this.sourceProj_.getExtent()),this.sourceWorldWidth_=this.sourceProj_.getExtent()?Q(this.sourceProj_.getExtent()):null,this.targetWorldWidth_=this.targetProj_.getExtent()?Q(this.targetProj_.getExtent()):null;const c=ui(i),u=Ls(i),d=bs(i),f=Ss(i),g=this.transformInv_(c),m=this.transformInv_(u),_=this.transformInv_(d),p=this.transformInv_(f),y=Jm+(o?Math.max(0,Math.ceil(Math.log2(Wr(i)/(o*o*256*256)))):0);if(this.addQuad_(c,u,d,f,g,m,_,p,y),this.wrapsXInSource_){let v=1/0;this.triangles_.forEach(function(x,E,w){v=Math.min(v,x.source[0][0],x.source[1][0],x.source[2][0])}),this.triangles_.forEach(x=>{if(Math.max(x.source[0][0],x.source[1][0],x.source[2][0])-v>this.sourceWorldWidth_/2){const E=[[x.source[0][0],x.source[0][1]],[x.source[1][0],x.source[1][1]],[x.source[2][0],x.source[2][1]]];E[0][0]-v>this.sourceWorldWidth_/2&&(E[0][0]-=this.sourceWorldWidth_),E[1][0]-v>this.sourceWorldWidth_/2&&(E[1][0]-=this.sourceWorldWidth_),E[2][0]-v>this.sourceWorldWidth_/2&&(E[2][0]-=this.sourceWorldWidth_);const w=Math.min(E[0][0],E[1][0],E[2][0]);Math.max(E[0][0],E[1][0],E[2][0])-w<this.sourceWorldWidth_/2&&(x.source=E)}})}l={}}addTriangle_(t,e,i,s,r,o){this.triangles_.push({source:[s,r,o],target:[t,e,i]})}addQuad_(t,e,i,s,r,o,a,l,h){const c=pl([r,o,a,l]),u=this.sourceWorldWidth_?Q(c)/this.sourceWorldWidth_:null,d=this.sourceWorldWidth_,f=this.sourceProj_.canWrapX()&&u>.5&&u<1;let g=!1;if(h>0){if(this.targetProj_.isGlobal()&&this.targetWorldWidth_){const _=pl([t,e,i,s]);g=Q(_)/this.targetWorldWidth_>Dc||g}!f&&this.sourceProj_.isGlobal()&&u&&(g=u>Dc||g)}if(!g&&this.maxSourceExtent_&&isFinite(c[0])&&isFinite(c[1])&&isFinite(c[2])&&isFinite(c[3])&&!Lt(c,this.maxSourceExtent_))return;let m=0;if(!g&&(!isFinite(r[0])||!isFinite(r[1])||!isFinite(o[0])||!isFinite(o[1])||!isFinite(a[0])||!isFinite(a[1])||!isFinite(l[0])||!isFinite(l[1]))){if(h>0)g=!0;else if(m=(!isFinite(r[0])||!isFinite(r[1])?8:0)+(!isFinite(o[0])||!isFinite(o[1])?4:0)+(!isFinite(a[0])||!isFinite(a[1])?2:0)+(!isFinite(l[0])||!isFinite(l[1])?1:0),m!=1&&m!=2&&m!=4&&m!=8)return}if(h>0){if(!g){const _=[(t[0]+i[0])/2,(t[1]+i[1])/2],p=this.transformInv_(_);let y;f?y=(Xi(r[0],d)+Xi(a[0],d))/2-Xi(p[0],d):y=(r[0]+a[0])/2-p[0];const v=(r[1]+a[1])/2-p[1];g=y*y+v*v>this.errorThresholdSquared_}if(g){if(Math.abs(t[0]-i[0])<=Math.abs(t[1]-i[1])){const _=[(e[0]+i[0])/2,(e[1]+i[1])/2],p=this.transformInv_(_),y=[(s[0]+t[0])/2,(s[1]+t[1])/2],v=this.transformInv_(y);this.addQuad_(t,e,_,y,r,o,p,v,h-1),this.addQuad_(y,_,i,s,v,p,a,l,h-1)}else{const _=[(t[0]+e[0])/2,(t[1]+e[1])/2],p=this.transformInv_(_),y=[(i[0]+s[0])/2,(i[1]+s[1])/2],v=this.transformInv_(y);this.addQuad_(t,_,y,s,r,p,v,l,h-1),this.addQuad_(_,e,i,y,p,o,a,v,h-1)}return}}if(f){if(!this.canWrapXInSource_)return;this.wrapsXInSource_=!0}(m&11)==0&&this.addTriangle_(t,i,s,r,a,l),(m&14)==0&&this.addTriangle_(t,i,e,r,a,o),m&&((m&13)==0&&this.addTriangle_(e,s,t,o,l,r),(m&7)==0&&this.addTriangle_(e,s,i,o,l,a))}calculateSourceExtent(){const t=zt();return this.triangles_.forEach(function(e,i,s){const r=e.source;Ln(t,r[0]),Ln(t,r[1]),Ln(t,r[2])}),t}getTriangles(){return this.triangles_}}const tp=.5;class Fc extends Ko{constructor(t,e,i,s,r,o,a,l,h,c,u,d){super(r,D.IDLE,d),this.renderEdges_=u!==void 0?u:!1,this.pixelRatio_=a,this.gutter_=l,this.canvas_=null,this.sourceTileGrid_=e,this.targetTileGrid_=s,this.wrappedTileCoord_=o||r,this.sourceTiles_=[],this.sourcesListenerKeys_=null,this.sourceZ_=0,this.clipExtent_=t.canWrapX()?t.getExtent():void 0;const f=s.getTileCoordExtent(this.wrappedTileCoord_),g=this.targetTileGrid_.getExtent();let m=this.sourceTileGrid_.getExtent();const _=g?ci(f,g):f;if(Wr(_)===0){this.state=D.EMPTY;return}const p=t.getExtent();p&&(m?m=ci(m,p):m=p);const y=s.getResolution(this.wrappedTileCoord_[0]),v=Hm(t,i,_,y);if(!isFinite(v)||v<=0){this.state=D.EMPTY;return}const x=c!==void 0?c:tp;if(this.triangulation_=new Qm(t,i,_,m,v*x,y),this.triangulation_.getTriangles().length===0){this.state=D.EMPTY;return}this.sourceZ_=e.getZForResolution(v);let E=this.triangulation_.calculateSourceExtent();if(m&&(t.canWrapX()?(E[1]=st(E[1],m[1],m[3]),E[3]=st(E[3],m[1],m[3])):E=ci(E,m)),!Wr(E))this.state=D.EMPTY;else{let w=0,T=0;t.canWrapX()&&(w=Q(p),T=Math.floor((E[0]-p[0])/w)),Sl(E.slice(),t,!0).forEach(I=>{const L=e.getTileRangeForExtentAndZ(I,this.sourceZ_);for(let P=L.minX;P<=L.maxX;P++)for(let A=L.minY;A<=L.maxY;A++){const b=h(this.sourceZ_,P,A,a);if(b){const M=T*w;this.sourceTiles_.push({tile:b,offset:M})}}++T}),this.sourceTiles_.length===0&&(this.state=D.EMPTY)}}getImage(){return this.canvas_}reproject_(){const t=[];if(this.sourceTiles_.forEach(e=>{const i=e.tile;if(i&&i.getState()==D.LOADED){const s=this.sourceTileGrid_.getTileCoordExtent(i.tileCoord);s[0]+=e.offset,s[2]+=e.offset;const r=this.clipExtent_?.slice();r&&(r[0]+=e.offset,r[2]+=e.offset),t.push({extent:s,clipExtent:r,image:i.getImage()})}}),this.sourceTiles_.length=0,t.length===0)this.state=D.ERROR;else{const e=this.wrappedTileCoord_[0],i=this.targetTileGrid_.getTileSize(e),s=typeof i=="number"?i:i[0],r=typeof i=="number"?i:i[1],o=this.targetTileGrid_.getResolution(e),a=this.sourceTileGrid_.getResolution(this.sourceZ_),l=this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_);this.canvas_=qm(s,r,this.pixelRatio_,a,this.sourceTileGrid_.getExtent(),o,l,this.triangulation_,t,this.gutter_,this.renderEdges_,this.interpolate),this.state=D.LOADED}this.changed()}load(){if(this.state==D.IDLE){this.state=D.LOADING,this.changed();let t=0;this.sourcesListenerKeys_=[],this.sourceTiles_.forEach(({tile:e})=>{const i=e.getState();if(i==D.IDLE||i==D.LOADING){t++;const s=Z(e,z.CHANGE,r=>{const o=e.getState();(o==D.LOADED||o==D.ERROR||o==D.EMPTY)&&(nt(s),t--,t===0&&(this.unlistenSources_(),this.reproject_()))});this.sourcesListenerKeys_.push(s)}}),t===0?setTimeout(this.reproject_.bind(this),0):this.sourceTiles_.forEach(function({tile:e},i,s){e.getState()==D.IDLE&&e.load()})}}unlistenSources_(){this.sourcesListenerKeys_.forEach(nt),this.sourcesListenerKeys_=null}release(){this.canvas_&&(Ks(this.canvas_.getContext("2d")),un.push(this.canvas_),this.canvas_=null),super.release()}}const ep=/\{z\}/g,ip=/\{x\}/g,np=/\{y\}/g,sp=/\{-y\}/g;function rp(n,t,e,i,s){return n.replace(ep,t.toString()).replace(ip,e.toString()).replace(np,i.toString()).replace(sp,function(){if(s===void 0)throw new Error("If the URL template has a {-y} placeholder, the grid extent must be known");return(s-i).toString()})}function op(n){const t=[];let e=/\{([a-z])-([a-z])\}/.exec(n);if(e){const i=e[1].charCodeAt(0),s=e[2].charCodeAt(0);let r;for(r=i;r<=s;++r)t.push(n.replace(e[0],String.fromCharCode(r)));return t}if(e=/\{(\d+)-(\d+)\}/.exec(n),e){const i=parseInt(e[2],10);for(let s=parseInt(e[1],10);s<=i;s++)t.push(n.replace(e[0],s.toString()));return t}return t.push(n),t}function ap(n,t){return(function(e,i,s){if(!e)return;let r;const o=e[0];if(t){const a=t.getFullTileRange(o);a&&(r=a.getHeight()-1)}return rp(n,o,e[1],e[2],r)})}function lp(n,t){const e=n.length,i=new Array(e);for(let s=0;s<e;++s)i[s]=ap(n[s],t);return hp(i)}function hp(n){return n.length===1?n[0]:(function(t,e,i){if(!t)return;const s=Ym(t),r=Xi(s,n.length);return n[r](t,e,i)})}class cp extends zh{constructor(t){super({attributions:t.attributions,attributionsCollapsible:t.attributionsCollapsible,projection:t.projection,state:t.state,wrapX:t.wrapX,interpolate:t.interpolate}),this.on,this.once,this.un,this.tilePixelRatio_=t.tilePixelRatio!==void 0?t.tilePixelRatio:1,this.tileGrid=t.tileGrid!==void 0?t.tileGrid:null;const e=[256,256];this.tileGrid&&Pt(this.tileGrid.getTileSize(this.tileGrid.getMinZoom()),e),this.tmpSize=[0,0],this.key_=t.key||V(this),this.tileOptions={transition:t.transition,interpolate:t.interpolate},this.zDirection=t.zDirection?t.zDirection:0}getGutterForProjection(t){return 0}getKey(){return this.key_}setKey(t){this.key_!==t&&(this.key_=t,this.changed())}getResolutions(t){const e=t?this.getTileGridForProjection(t):this.tileGrid;return e?e.getResolutions():null}getTile(t,e,i,s,r){return U()}getTileGrid(){return this.tileGrid}getTileGridForProjection(t){return this.tileGrid?this.tileGrid:Ac(t)}getTilePixelRatio(t){return this.tilePixelRatio_}getTilePixelSize(t,e,i){const s=this.getTileGridForProjection(i),r=this.getTilePixelRatio(e),o=Pt(s.getTileSize(t),this.tmpSize);return r==1?o:kg(o,r,this.tmpSize)}getTileCoordForTileUrlFunction(t,e){const i=e!==void 0?e:this.getProjection(),s=e!==void 0?this.getTileGridForProjection(i):this.tileGrid||this.getTileGridForProjection(i);return this.getWrapX()&&i.isGlobal()&&(t=Bm(s,t,i)),Km(t,s)?t:null}clear(){}refresh(){this.clear(),super.refresh()}}class up extends Ee{constructor(t,e){super(t),this.tile=e}}const ia={TILELOADSTART:"tileloadstart",TILELOADEND:"tileloadend",TILELOADERROR:"tileloaderror"};class na extends cp{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===na.prototype.tileUrlFunction,this.tileLoadFunction=t.tileLoadFunction,t.tileUrlFunction&&(this.tileUrlFunction=t.tileUrlFunction),this.urls=null,t.urls?this.setUrls(t.urls):t.url&&this.setUrl(t.url),this.tileLoadingKeys_={}}getTileLoadFunction(){return this.tileLoadFunction}getTileUrlFunction(){return Object.getPrototypeOf(this).tileUrlFunction===this.tileUrlFunction?this.tileUrlFunction.bind(this):this.tileUrlFunction}getUrls(){return this.urls}handleTileChange(t){const e=t.target,i=V(e),s=e.getState();let r;s==D.LOADING?(this.tileLoadingKeys_[i]=!0,r=ia.TILELOADSTART):i in this.tileLoadingKeys_&&(delete this.tileLoadingKeys_[i],r=s==D.ERROR?ia.TILELOADERROR:s==D.LOADED?ia.TILELOADEND:void 0),r!=null&&this.dispatchEvent(new up(r,e))}setTileLoadFunction(t){this.tileLoadFunction=t,this.changed()}setTileUrlFunction(t,e){this.tileUrlFunction=t,typeof e<"u"?this.setKey(e):this.changed()}setUrl(t){const e=op(t);this.urls=e,this.setUrls(e)}setUrls(t){this.urls=t;const e=t.join(`
|
|
8
|
-
`);this.generateTileUrlFunction_?this.setTileUrlFunction(lp(t,this.tileGrid),e):this.setKey(e)}tileUrlFunction(t,e,i){}}class dp extends na{constructor(t){super({attributions:t.attributions,cacheSize:t.cacheSize,projection:t.projection,state:t.state,tileGrid:t.tileGrid,tileLoadFunction:t.tileLoadFunction?t.tileLoadFunction:fp,tilePixelRatio:t.tilePixelRatio,tileUrlFunction:t.tileUrlFunction,url:t.url,urls:t.urls,wrapX:t.wrapX,transition:t.transition,interpolate:t.interpolate!==void 0?t.interpolate:!0,key:t.key,attributionsCollapsible:t.attributionsCollapsible,zDirection:t.zDirection}),this.crossOrigin=t.crossOrigin!==void 0?t.crossOrigin:null,this.tileClass=t.tileClass!==void 0?t.tileClass:wc,this.tileGridForProjection={},this.reprojectionErrorThreshold_=t.reprojectionErrorThreshold,this.renderReprojectionEdges_=!1}getGutterForProjection(t){return this.getProjection()&&t&&!eo(this.getProjection(),t)?0:this.getGutter()}getGutter(){return 0}getKey(){let t=super.getKey();return this.getInterpolate()||(t+=":disable-interpolation"),t}getTileGridForProjection(t){const e=this.getProjection();if(this.tileGrid&&(!e||eo(e,t)))return this.tileGrid;const i=V(t);return i in this.tileGridForProjection||(this.tileGridForProjection[i]=Ac(t)),this.tileGridForProjection[i]}createTile_(t,e,i,s,r,o){const a=[t,e,i],l=this.getTileCoordForTileUrlFunction(a,r),h=l?this.tileUrlFunction(l,s,r):void 0,c=new this.tileClass(a,h!==void 0?D.IDLE:D.EMPTY,h!==void 0?h:"",this.crossOrigin,this.tileLoadFunction,this.tileOptions);return c.key=o,c.addEventListener(z.CHANGE,this.handleTileChange.bind(this)),c}getTile(t,e,i,s,r){const o=this.getProjection();if(!o||!r||eo(o,r))return this.getTileInternal(t,e,i,s,o||r);const a=[t,e,i],l=this.getKey(),h=this.getTileGridForProjection(o),c=this.getTileGridForProjection(r),u=this.getTileCoordForTileUrlFunction(a,r),d=new Fc(o,h,r,c,a,u,this.getTilePixelRatio(s),this.getGutter(),(f,g,m,_)=>this.getTileInternal(f,g,m,_,o),this.reprojectionErrorThreshold_,this.renderReprojectionEdges_,this.tileOptions);return d.key=l,d}getTileInternal(t,e,i,s,r){const o=this.getKey();return this.createTile_(t,e,i,s,r,o)}setRenderReprojectionEdges(t){this.renderReprojectionEdges_!=t&&(this.renderReprojectionEdges_=t,this.changed())}setTileGridForProjection(t,e){const i=At(t);if(i){const s=V(i);s in this.tileGridForProjection||(this.tileGridForProjection[s]=e)}}}function fp(n,t){n.getImage().src=t}class kc extends dp{constructor(t){t=t||{};const e=t.projection!==void 0?t.projection:"EPSG:3857",i=t.tileGrid!==void 0?t.tileGrid:Um({extent:Qo(e),maxResolution:t.maxResolution,maxZoom:t.maxZoom,minZoom:t.minZoom,tileSize:t.tileSize});super({attributions:t.attributions,cacheSize:t.cacheSize,crossOrigin:t.crossOrigin,interpolate:t.interpolate,projection:e,reprojectionErrorThreshold:t.reprojectionErrorThreshold,tileGrid:i,tileLoadFunction:t.tileLoadFunction,tilePixelRatio:t.tilePixelRatio,tileUrlFunction:t.tileUrlFunction,url:t.url,urls:t.urls,wrapX:t.wrapX!==void 0?t.wrapX:!0,transition:t.transition,attributionsCollapsible:t.attributionsCollapsible,zDirection:t.zDirection}),this.gutter_=t.gutter!==void 0?t.gutter:0}getGutter(){return this.gutter_}}const gp='© <a href="https://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap</a> contributors.';class _p extends kc{constructor(t){t=t||{};let e;t.attributions!==void 0?e=t.attributions:e=[gp];const i=t.crossOrigin!==void 0?t.crossOrigin:"anonymous",s=t.url!==void 0?t.url:"https://tile.openstreetmap.org/{z}/{x}/{y}.png";super({attributions:e,attributionsCollapsible:!1,cacheSize:t.cacheSize,crossOrigin:i,interpolate:t.interpolate,maxZoom:t.maxZoom!==void 0?t.maxZoom:19,reprojectionErrorThreshold:t.reprojectionErrorThreshold,tileLoadFunction:t.tileLoadFunction,transition:t.transition,url:s,wrapX:t.wrapX,zDirection:t.zDirection})}}function sa(n){return n instanceof Image||n instanceof HTMLCanvasElement||n instanceof HTMLVideoElement||n instanceof ImageBitmap?n:null}const mp=new Error("disposed"),pp=[256,256];class Nc extends Ko{constructor(t){const e=D.IDLE;super(t.tileCoord,e,{transition:t.transition,interpolate:t.interpolate}),this.loader_=t.loader,this.data_=null,this.error_=null,this.size_=t.size||null,this.controller_=t.controller||null}getSize(){if(this.size_)return this.size_;const t=sa(this.data_);return t?[t.width,t.height]:pp}getData(){return this.data_}getError(){return this.error_}load(){if(this.state!==D.IDLE&&this.state!==D.ERROR)return;this.state=D.LOADING,this.changed();const t=this;this.loader_().then(function(e){t.data_=e,t.state=D.LOADED,t.changed()}).catch(function(e){t.error_=e,t.state=D.ERROR,t.changed()})}disposeInternal(){this.controller_&&(this.controller_.abort(mp),this.controller_=null),super.disposeInternal()}}class yp{constructor(t){this.highWaterMark=t!==void 0?t:2048,this.count_=0,this.entries_={},this.oldest_=null,this.newest_=null}deleteOldest(){const t=this.pop();t instanceof ws&&t.dispose()}canExpireCache(){return this.highWaterMark>0&&this.getCount()>this.highWaterMark}expireCache(t){for(;this.canExpireCache();)this.deleteOldest()}clear(){for(;this.oldest_;)this.deleteOldest()}containsKey(t){return this.entries_.hasOwnProperty(t)}forEach(t){let e=this.oldest_;for(;e;)t(e.value_,e.key_,this),e=e.newer}get(t,e){const i=this.entries_[t];return J(i!==void 0,"Tried to get a value for a key that does not exist in the cache"),i===this.newest_||(i===this.oldest_?(this.oldest_=this.oldest_.newer,this.oldest_.older=null):(i.newer.older=i.older,i.older.newer=i.newer),i.newer=null,i.older=this.newest_,this.newest_.newer=i,this.newest_=i),i.value_}remove(t){const e=this.entries_[t];return J(e!==void 0,"Tried to get a value for a key that does not exist in the cache"),e===this.newest_?(this.newest_=e.older,this.newest_&&(this.newest_.newer=null)):e===this.oldest_?(this.oldest_=e.newer,this.oldest_&&(this.oldest_.older=null)):(e.newer.older=e.older,e.older.newer=e.newer),delete this.entries_[t],--this.count_,e.value_}getCount(){return this.count_}getKeys(){const t=new Array(this.count_);let e=0,i;for(i=this.newest_;i;i=i.older)t[e++]=i.key_;return t}getValues(){const t=new Array(this.count_);let e=0,i;for(i=this.newest_;i;i=i.older)t[e++]=i.value_;return t}peekLast(){return this.oldest_.value_}peekLastKey(){return this.oldest_.key_}peekFirstKey(){return this.newest_.key_}peek(t){return this.entries_[t]?.value_}pop(){const t=this.oldest_;return delete this.entries_[t.key_],t.newer&&(t.newer.older=null),this.oldest_=t.newer,this.oldest_||(this.newest_=null),--this.count_,t.value_}replace(t,e){this.get(t),this.entries_[t].value_=e}set(t,e){J(!(t in this.entries_),"Tried to set a value for a key that is used already");const i={key_:t,newer:null,older:this.newest_,value_:e};this.newest_?this.newest_.newer=i:this.oldest_=i,this.newest_=i,this.entries_[t]=i,++this.count_}setSize(t){this.highWaterMark=t}}function ra(n,t,e,i,s){return`${V(n)},${t},${Xm(e,i,s)}`}function oa(n,t,e){if(!(e in n))return n[e]=new Set([t]),!0;const i=n[e],s=i.has(t);return s||i.add(t),!s}function xp(n,t,e){const i=n[e];return i?i.delete(t):!1}function Gc(n,t){const e=n.layerStatesArray[n.layerIndex];e.extent&&(t=ci(t,Ke(e.extent,n.viewState.projection)));const i=e.layer.getRenderSource();if(!i.getWrapX()){const s=i.getTileGridForProjection(n.viewState.projection).getExtent();s&&(t=ci(t,s))}return t}class Ep extends Qh{constructor(t,e){super(t),e=e||{},this.extentChanged=!0,this.renderComplete=!1,this.renderedExtent_=null,this.renderedPixelRatio,this.renderedProjection=null,this.renderedTiles=[],this.renderedSourceKey_,this.renderedSourceRevision_,this.tempExtent=zt(),this.tempTileRange_=new Jo(0,0,0,0),this.tempTileCoord_=ur(0,0,0);const i=e.cacheSize!==void 0?e.cacheSize:512;this.tileCache_=new yp(i),this.maxStaleKeys=i*.5}getTileCache(){return this.tileCache_}getOrCreateTile(t,e,i,s){const r=this.tileCache_,a=this.getLayer().getSource(),l=ra(a,a.getKey(),t,e,i);let h;if(r.containsKey(l))h=r.get(l);else{if(h=a.getTile(t,e,i,s.pixelRatio,s.viewState.projection),!h)return null;r.set(l,h)}return h}getTile(t,e,i,s){const r=this.getOrCreateTile(t,e,i,s);return r||null}getData(t){const e=this.frameState;if(!e)return null;const i=this.getLayer(),s=dt(e.pixelToCoordinateTransform,t.slice()),r=i.getExtent();if(r&&!Gi(r,s))return null;const o=e.viewState,a=i.getRenderSource(),l=a.getTileGridForProjection(o.projection),h=a.getTilePixelRatio(e.pixelRatio);for(let c=l.getZForResolution(o.resolution);c>=l.getMinZoom();--c){const u=l.getTileCoordForCoordAndZ(s,c),d=this.getTile(c,u[1],u[2],e);if(!d||d.getState()!==D.LOADED)continue;const f=l.getOrigin(c),g=Pt(l.getTileSize(c)),m=l.getResolution(c);let _;if(d instanceof wc||d instanceof Fc)_=d.getImage();else if(d instanceof Nc){if(_=sa(d.getData()),!_)continue}else continue;const p=Math.floor(h*((s[0]-f[0])/m-u[1]*g[0])),y=Math.floor(h*((f[1]-s[1])/m-u[2]*g[1])),v=Math.round(h*a.getGutterForProjection(o.projection));return this.getImageData(_,p+v,y+v)}return null}prepareFrame(t){this.renderedProjection?t.viewState.projection!==this.renderedProjection&&(this.tileCache_.clear(),this.renderedProjection=t.viewState.projection):this.renderedProjection=t.viewState.projection;const e=this.getLayer().getSource();if(!e)return!1;const i=e.getRevision();return this.renderedSourceRevision_?this.renderedSourceRevision_!==i&&(this.renderedSourceRevision_=i,this.renderedSourceKey_===e.getKey()&&this.tileCache_.clear()):this.renderedSourceRevision_=i,!0}enqueueTiles(t,e,i,s,r){const o=t.viewState,a=this.getLayer(),l=a.getRenderSource(),h=l.getTileGridForProjection(o.projection),c=V(l);c in t.wantedTiles||(t.wantedTiles[c]={});const u=t.wantedTiles[c],d=a.getMapInternal(),f=Math.max(i-r,h.getMinZoom(),h.getZForResolution(Math.min(a.getMaxResolution(),d?d.getView().getResolutionForZoom(Math.max(a.getMinZoom(),0)):h.getResolution(0)),l.zDirection)),g=o.rotation,m=g?Tl(o.center,o.resolution,g,t.size):void 0;for(let _=i;_>=f;--_){const p=h.getTileRangeForExtentAndZ(e,_,this.tempTileRange_),y=h.getResolution(_);for(let v=p.minX;v<=p.maxX;++v)for(let x=p.minY;x<=p.maxY;++x){if(g&&!h.tileCoordIntersectsViewport([_,v,x],m))continue;const E=this.getTile(_,v,x,t);if(!E||!oa(s,E,_))continue;const T=E.getKey();if(u[T]=!0,E.getState()===D.IDLE&&!t.tileQueue.isKeyQueued(T)){const R=ur(_,v,x,this.tempTileCoord_);t.tileQueue.enqueue([E,c,h.getTileCoordCenter(R),y])}}}}findStaleTile_(t,e){const i=this.tileCache_,s=t[0],r=t[1],o=t[2],a=this.getStaleKeys();for(let l=0;l<a.length;++l){const h=ra(this.getLayer().getSource(),a[l],s,r,o);if(i.containsKey(h)){const c=i.peek(h);if(c.getState()===D.LOADED)return c.endTransition(V(this)),oa(e,c,s),!0}}return!1}findAltTiles_(t,e,i,s){const r=t.getTileRangeForTileCoordAndZ(e,i,this.tempTileRange_);if(!r)return!1;let o=!0;const a=this.tileCache_,l=this.getLayer().getRenderSource(),h=l.getKey();for(let c=r.minX;c<=r.maxX;++c)for(let u=r.minY;u<=r.maxY;++u){const d=ra(l,h,i,c,u);let f=!1;if(a.containsKey(d)){const g=a.peek(d);g.getState()===D.LOADED&&(oa(s,g,i),f=!0)}f||(o=!1)}return o}renderFrame(t,e){this.renderComplete=!0;const i=t.layerStatesArray[t.layerIndex],s=t.viewState,r=s.projection,o=s.resolution,a=s.center,l=t.pixelRatio,h=this.getLayer(),c=h.getSource(),u=c.getTileGridForProjection(r),d=u.getZForResolution(o,c.zDirection),f=u.getResolution(d),g=c.getKey();this.renderedSourceKey_?this.renderedSourceKey_!==g&&(this.prependStaleKey(this.renderedSourceKey_),this.renderedSourceKey_=g):this.renderedSourceKey_=g;let m=t.extent;const _=c.getTilePixelRatio(l);this.prepareContainer(t,e);const p=this.context.canvas.width,y=this.context.canvas.height,v=i.extent&&Ke(i.extent);v&&(m=ci(m,Ke(i.extent)));const x=f*p/2/_,E=f*y/2/_,w=[a[0]-x,a[1]-E,a[0]+x,a[1]+E],T={};this.renderedTiles.length=0;const R=h.getPreload();if(t.nextExtent){const F=u.getZForResolution(s.nextResolution,c.zDirection),$=Gc(t,t.nextExtent);this.enqueueTiles(t,$,F,T,R)}const I=Gc(t,m);if(this.enqueueTiles(t,I,d,T,0),R>0&&setTimeout(()=>{this.enqueueTiles(t,I,d-1,T,R-1)},0),!(d in T))return this.container;const L=V(this),P=t.time;for(const F of T[d]){const $=F.getState();if($===D.EMPTY)continue;const B=F.tileCoord;if($===D.LOADED&&F.getAlpha(L,P)===1){F.endTransition(L);continue}if($!==D.ERROR&&(this.renderComplete=!1),this.findStaleTile_(B,T)){xp(T,F,d),t.animate=!0;continue}if(this.findAltTiles_(u,B,d+1,T))continue;const yt=u.getMinZoom();for(let Tt=d-1;Tt>=yt&&!this.findAltTiles_(u,B,Tt,T);--Tt);}const A=f/o*l/_,b=this.getRenderContext(t);ve(this.tempTransform,p/2,y/2,A,A,0,-p/2,-y/2),i.extent&&this.clipUnrotated(b,t,v),c.getInterpolate()||(b.imageSmoothingEnabled=!1),this.preRender(b,t);const M=Object.keys(T).map(Number);M.sort(xe);let Y;const k=[],G=[];for(let F=M.length-1;F>=0;--F){const $=M[F],B=c.getTilePixelSize($,l,r),S=u.getResolution($)/f,yt=B[0]*S*A,Tt=B[1]*S*A,at=u.getTileCoordForCoordAndZ(ui(w),$),Wt=u.getTileCoordExtent(at),xt=dt(this.tempTransform,[_*(Wt[0]-w[0])/f,_*(w[3]-Wt[3])/f]),_e=_*c.getGutterForProjection(r);for(const he of T[$]){if(he.getState()!==D.LOADED)continue;const Xt=he.tileCoord,gr=at[1]-Xt[1],aa=Math.round(xt[0]-(gr-1)*yt),ss=at[2]-Xt[2],Ci=Math.round(xt[1]-(ss-1)*Tt),qt=Math.round(xt[0]-gr*yt),me=Math.round(xt[1]-ss*Tt),dn=aa-qt,fn=Ci-me,rs=M.length===1;let Ri=!1;Y=[qt,me,qt+dn,me,qt+dn,me+fn,qt,me+fn];for(let gn=0,_n=k.length;gn<_n;++gn)if(!rs&&$<G[gn]){const ft=k[gn];Lt([qt,me,qt+dn,me+fn],[ft[0],ft[3],ft[4],ft[7]])&&(Ri||(b.save(),Ri=!0),b.beginPath(),b.moveTo(Y[0],Y[1]),b.lineTo(Y[2],Y[3]),b.lineTo(Y[4],Y[5]),b.lineTo(Y[6],Y[7]),b.moveTo(ft[6],ft[7]),b.lineTo(ft[4],ft[5]),b.lineTo(ft[2],ft[3]),b.lineTo(ft[0],ft[1]),b.clip())}k.push(Y),G.push($),this.drawTile(he,t,qt,me,dn,fn,_e,rs),Ri&&b.restore(),this.renderedTiles.unshift(he),this.updateUsedTiles(t.usedTiles,c,he)}}if(this.renderedResolution=f,this.extentChanged=!this.renderedExtent_||!bn(this.renderedExtent_,w),this.renderedExtent_=w,this.renderedPixelRatio=l,this.postRender(this.context,t),i.extent&&b.restore(),b.imageSmoothingEnabled=!0,this.renderComplete){const F=($,B)=>{const et=V(c),S=B.wantedTiles[et],yt=S?Object.keys(S).length:0;this.updateCacheSize(yt),this.tileCache_.expireCache()};t.postRenderFunctions.push(F)}return this.container}updateCacheSize(t){this.tileCache_.highWaterMark=Math.max(this.tileCache_.highWaterMark,t*2)}drawTile(t,e,i,s,r,o,a,l){let h;if(t instanceof Nc){if(h=sa(t.getData()),!h)throw new Error("Rendering array data is not yet supported")}else h=this.getTileImage(t);if(!h)return;const c=this.getRenderContext(e),u=V(this),d=e.layerStatesArray[e.layerIndex],f=d.opacity*(l?t.getAlpha(u,e.time):1),g=f!==c.globalAlpha;g&&(c.save(),c.globalAlpha=f),c.drawImage(h,a,a,h.width-2*a,h.height-2*a,i,s,r,o),g&&c.restore(),f!==d.opacity?e.animate=!0:l&&t.endTransition(u)}getImage(){const t=this.context;return t?t.canvas:null}getTileImage(t){return t.getImage()}updateUsedTiles(t,e,i){const s=V(e);s in t||(t[s]={}),t[s][i.getKey()]=!0}}const dr={PRELOAD:"preload",USE_INTERIM_TILES_ON_ERROR:"useInterimTilesOnError"};class wp extends hr{constructor(t){t=t||{};const e=Object.assign({},t),i=t.cacheSize;delete t.cacheSize,delete e.preload,delete e.useInterimTilesOnError,super(e),this.on,this.once,this.un,this.cacheSize_=i,this.setPreload(t.preload!==void 0?t.preload:0),this.setUseInterimTilesOnError(t.useInterimTilesOnError!==void 0?t.useInterimTilesOnError:!0)}getCacheSize(){return this.cacheSize_}getPreload(){return this.get(dr.PRELOAD)}setPreload(t){this.set(dr.PRELOAD,t)}getUseInterimTilesOnError(){return this.get(dr.USE_INTERIM_TILES_ON_ERROR)}setUseInterimTilesOnError(t){this.set(dr.USE_INTERIM_TILES_ON_ERROR,t)}getData(t){return super.getData(t)}}class zc extends wp{constructor(t){super(t)}createRenderer(){return new Ep(this,{cacheSize:this.getCacheSize()})}}const Wc=`
|
|
1
|
+
(function(Ta){"use strict";typeof window<"u"&&((window.__svelte??={}).v??=new Set).add("5");const du=1,fu=4,gu=8,_u=16,mu=2,Ia="[",Sa="[!",ba="]",Cn={},vt=Symbol(),La=!1;var pu=Array.isArray,yu=Array.prototype.indexOf,Eu=Array.from,ys=Object.keys,Es=Object.defineProperty,di=Object.getOwnPropertyDescriptor,xu=Object.prototype,wu=Array.prototype,vu=Object.getPrototypeOf,Aa=Object.isExtensible;function Cu(n){for(var t=0;t<n.length;t++)n[t]()}function Ru(){var n,t,e=new Promise((i,s)=>{n=i,t=s});return{promise:e,resolve:n,reject:t}}const _t=2,Dr=4,Ma=8,Re=16,Be=32,Ze=64,xs=128,oe=512,Ct=1024,Gt=2048,Te=4096,Ue=8192,fi=16384,Fr=32768,ws=65536,Pa=1<<17,Oa=1<<18,Ni=1<<19,Tu=1<<20,Rn=32768,kr=1<<21,Da=1<<22,Tn=1<<23,vs=Symbol("$state"),Fa=Symbol("legacy props"),ka=new class extends Error{name="StaleReactionError";message="The reaction that called `getAbortSignal()` was re-run or destroyed"},Na=3,Cs=8;function Iu(n){throw new Error("https://svelte.dev/e/lifecycle_outside_component")}function Su(n){throw new Error("https://svelte.dev/e/effect_in_teardown")}function bu(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function Lu(n){throw new Error("https://svelte.dev/e/effect_orphan")}function Au(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function Mu(){throw new Error("https://svelte.dev/e/hydration_failed")}function Pu(n){throw new Error("https://svelte.dev/e/props_invalid_value")}function Ou(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function Du(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function Fu(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}function ku(){throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror")}function Nr(n){console.warn("https://svelte.dev/e/hydration_mismatch")}function Nu(){console.warn("https://svelte.dev/e/svelte_boundary_reset_noop")}let mt=!1;function Rs(n){mt=n}let st;function Ie(n){if(n===null)throw Nr(),Cn;return st=n}function Ga(){return Ie(be(st))}function Gu(n){if(mt){if(be(st)!==null)throw Nr(),Cn;st=n}}function za(n=1){if(mt){for(var t=n,e=st;t--;)e=be(e);st=e}}function zu(n=!0){for(var t=0,e=st;;){if(e.nodeType===Cs){var i=e.data;if(i===ba){if(t===0)return e;t-=1}else(i===Ia||i===Sa)&&(t+=1)}var s=be(e);n&&e.remove(),e=s}}function Xa(n){return n===this.v}function Xu(n,t){return n!=n?t==t:n!==t||n!==null&&typeof n=="object"||typeof n=="function"}function Wa(n){return!Xu(n,this.v)}let Wu=!1,Zt=null;function Ts(n){Zt=n}function Ya(n,t=!1,e){Zt={p:Zt,i:!1,c:null,e:null,s:n,x:null,l:null}}function $a(n){var t=Zt,e=t.e;if(e!==null){t.e=null;for(var i of e)ol(i)}return n!==void 0&&(t.x=n),t.i=!0,Zt=t.p,n??{}}function Ka(){return!0}let gi=[];function Ba(){var n=gi;gi=[],Cu(n)}function Is(n){if(gi.length===0&&!In){var t=gi;queueMicrotask(()=>{t===gi&&Ba()})}gi.push(n)}function Yu(){for(;gi.length>0;)Ba()}function Za(n){var t=tt;if(t===null)return j.f|=Tn,n;if((t.f&Fr)===0){if((t.f&xs)===0)throw n;t.b.error(n)}else Ss(n,t)}function Ss(n,t){for(;t!==null;){if((t.f&xs)!==0)try{t.b.error(n);return}catch(e){n=e}t=t.parent}throw n}const bs=new Set;let zt=null,Xt=null,me=[],Ls=null,Gr=!1,In=!1;class ae{committed=!1;current=new Map;previous=new Map;#e=new Set;#t=new Set;#l=0;#r=0;#h=null;#o=[];#s=[];skipped_effects=new Set;is_fork=!1;process(t){me=[],this.apply();var e={parent:null,effect:null,effects:[],render_effects:[],block_effects:[]};for(const i of t)this.#i(i,e);this.is_fork||this.#a(),this.#r>0||this.is_fork?(this.#n(e.effects),this.#n(e.render_effects),this.#n(e.block_effects)):(zt=null,Va(e.render_effects),Va(e.effects),this.#h?.resolve()),Xt=null}#i(t,e){t.f^=Ct;for(var i=t.first;i!==null;){var s=i.f,r=(s&(Be|Ze))!==0,o=r&&(s&Ct)!==0,a=o||(s&Ue)!==0||this.skipped_effects.has(i);if((i.f&xs)!==0&&i.b?.is_pending()&&(e={parent:e,effect:i,effects:[],render_effects:[],block_effects:[]}),!a&&i.fn!==null){r?i.f^=Ct:(s&Dr)!==0?e.effects.push(i):Mn(i)&&((i.f&Re)!==0&&e.block_effects.push(i),Pn(i));var l=i.first;if(l!==null){i=l;continue}}var h=i.parent;for(i=i.next;i===null&&h!==null;)h===e.effect&&(this.#n(e.effects),this.#n(e.render_effects),this.#n(e.block_effects),e=e.parent),i=h.next,h=h.parent}}#n(t){for(const e of t)((e.f&Gt)!==0?this.#o:this.#s).push(e),Tt(e,Ct)}capture(t,e){this.previous.has(t)||this.previous.set(t,e),(t.f&Tn)===0&&(this.current.set(t,t.v),Xt?.set(t,t.v))}activate(){zt=this,this.apply()}deactivate(){zt=null,Xt=null}flush(){if(this.activate(),me.length>0){if(Ua(),zt!==null&&zt!==this)return}else this.#l===0&&this.process([]);this.deactivate()}discard(){for(const t of this.#t)t(this);this.#t.clear()}#a(){if(this.#r===0){for(const t of this.#e)t();this.#e.clear()}this.#l===0&&this.#c()}#c(){if(bs.size>1){this.previous.clear();var t=Xt,e=!0,i={parent:null,effect:null,effects:[],render_effects:[],block_effects:[]};for(const s of bs){if(s===this){e=!1;continue}const r=[];for(const[a,l]of this.current){if(s.current.has(a))if(e&&l!==s.current.get(a))s.current.set(a,l);else continue;r.push(a)}if(r.length===0)continue;const o=[...s.current.keys()].filter(a=>!this.current.has(a));if(o.length>0){const a=new Set,l=new Map;for(const h of r)ja(h,o,a,l);if(me.length>0){zt=s,s.apply();for(const h of me)s.#i(h,i);me=[],s.deactivate()}}}zt=null,Xt=t}this.committed=!0,bs.delete(this)}increment(t){this.#l+=1,t&&(this.#r+=1)}decrement(t){this.#l-=1,t&&(this.#r-=1),this.revive()}revive(){for(const t of this.#o)Tt(t,Gt),Gi(t);for(const t of this.#s)Tt(t,Te),Gi(t);this.#o=[],this.#s=[],this.flush()}oncommit(t){this.#e.add(t)}ondiscard(t){this.#t.add(t)}settled(){return(this.#h??=Ru()).promise}static ensure(){if(zt===null){const t=zt=new ae;bs.add(zt),In||ae.enqueue(()=>{zt===t&&t.flush()})}return zt}static enqueue(t){Is(t)}apply(){}}function _i(n){var t=In;In=!0;try{for(var e;;){if(Yu(),me.length===0&&(zt?.flush(),me.length===0))return Ls=null,e;Ua()}}finally{In=t}}function Ua(){var n=pi;Gr=!0;try{var t=0;for(dl(!0);me.length>0;){var e=ae.ensure();if(t++>1e3){var i,s;$u()}e.process(me),Ve.clear()}}finally{Gr=!1,dl(n),Ls=null}}function $u(){try{Au()}catch(n){Ss(n,Ls)}}let Se=null;function Va(n){var t=n.length;if(t!==0){for(var e=0;e<t;){var i=n[e++];if((i.f&(fi|Ue))===0&&Mn(i)&&(Se=new Set,Pn(i),i.deps===null&&i.first===null&&i.nodes_start===null&&(i.teardown===null&&i.ac===null?cl(i):i.fn=null),Se?.size>0)){Ve.clear();for(const s of Se){if((s.f&(fi|Ue))!==0)continue;const r=[s];let o=s.parent;for(;o!==null;)Se.has(o)&&(Se.delete(o),r.push(o)),o=o.parent;for(let a=r.length-1;a>=0;a--){const l=r[a];(l.f&(fi|Ue))===0&&Pn(l)}}Se.clear()}}Se=null}}function ja(n,t,e,i){if(!e.has(n)&&(e.add(n),n.reactions!==null))for(const s of n.reactions){const r=s.f;(r&_t)!==0?ja(s,t,e,i):(r&(Da|Re))!==0&&(r&Gt)===0&&Ha(s,t,i)&&(Tt(s,Gt),Gi(s))}}function Ha(n,t,e){const i=e.get(n);if(i!==void 0)return i;if(n.deps!==null)for(const s of n.deps){if(t.includes(s))return!0;if((s.f&_t)!==0&&Ha(s,t,e))return e.set(s,!0),!0}return e.set(n,!1),!1}function Gi(n){for(var t=Ls=n;t.parent!==null;){t=t.parent;var e=t.f;if(Gr&&t===tt&&(e&Re)!==0&&(e&Oa)===0)return;if((e&(Ze|Be))!==0){if((e&Ct)===0)return;t.f^=Ct}}me.push(t)}function Ku(n){let t=0,e=As(0),i;return()=>{Ms()&&(it(e),al(()=>(t===0&&(i=Br(()=>n(()=>Sn(e)))),t+=1,()=>{Is(()=>{t-=1,t===0&&(i?.(),i=void 0,Sn(e))})})))}}var Bu=ws|Ni|xs;function Zu(n,t,e){new Uu(n,t,e)}class Uu{parent;#e=!1;#t;#l=mt?st:null;#r;#h;#o;#s=null;#i=null;#n=null;#a=null;#c=null;#f=0;#u=0;#g=!1;#d=null;#E=Ku(()=>(this.#d=As(this.#f),()=>{this.#d=null}));constructor(t,e,i){this.#t=t,this.#r=e,this.#h=i,this.parent=tt.b,this.#e=!!this.#r.pending,this.#o=hd(()=>{if(tt.b=this,mt){const r=this.#l;Ga(),r.nodeType===Cs&&r.data===Sa?this.#w():this.#x()}else{var s=this.#p();try{this.#s=mi(()=>i(s))}catch(r){this.error(r)}this.#u>0?this.#m():this.#e=!1}return()=>{this.#c?.remove()}},Bu),mt&&(this.#t=st)}#x(){try{this.#s=mi(()=>this.#h(this.#t))}catch(t){this.error(t)}this.#e=!1}#w(){const t=this.#r.pending;t&&(this.#i=mi(()=>t(this.#t)),ae.enqueue(()=>{var e=this.#p();this.#s=this.#_(()=>(ae.ensure(),mi(()=>this.#h(e)))),this.#u>0?this.#m():(Ps(this.#i,()=>{this.#i=null}),this.#e=!1)}))}#p(){var t=this.#t;return this.#e&&(this.#c=bn(),this.#t.before(this.#c),t=this.#c),t}is_pending(){return this.#e||!!this.parent&&this.parent.is_pending()}has_pending_snippet(){return!!this.#r.pending}#_(t){var e=tt,i=j,s=Zt;He(this.#o),Vt(this.#o),Ts(this.#o.ctx);try{return t()}catch(r){return Za(r),null}finally{He(e),Vt(i),Ts(s)}}#m(){const t=this.#r.pending;this.#s!==null&&(this.#a=document.createDocumentFragment(),this.#a.append(this.#c),fd(this.#s,this.#a)),this.#i===null&&(this.#i=mi(()=>t(this.#t)))}#y(t){if(!this.has_pending_snippet()){this.parent&&this.parent.#y(t);return}this.#u+=t,this.#u===0&&(this.#e=!1,this.#i&&Ps(this.#i,()=>{this.#i=null}),this.#a&&(this.#t.before(this.#a),this.#a=null))}update_pending_count(t){this.#y(t),this.#f+=t,this.#d&&tl(this.#d,this.#f)}get_effect_pending(){return this.#E(),it(this.#d)}error(t){var e=this.#r.onerror;let i=this.#r.failed;if(this.#g||!e&&!i)throw t;this.#s&&(le(this.#s),this.#s=null),this.#i&&(le(this.#i),this.#i=null),this.#n&&(le(this.#n),this.#n=null),mt&&(Ie(this.#l),za(),Ie(zu()));var s=!1,r=!1;const o=()=>{if(s){Nu();return}s=!0,r&&ku(),ae.ensure(),this.#f=0,this.#n!==null&&Ps(this.#n,()=>{this.#n=null}),this.#e=this.has_pending_snippet(),this.#s=this.#_(()=>(this.#g=!1,mi(()=>this.#h(this.#t)))),this.#u>0?this.#m():this.#e=!1};var a=j;try{Vt(null),r=!0,e?.(t,o),r=!1}catch(l){Ss(l,this.#o&&this.#o.parent)}finally{Vt(a)}i&&Is(()=>{this.#n=this.#_(()=>{ae.ensure(),this.#g=!0;try{return mi(()=>{i(this.#t,()=>t,()=>o)})}catch(l){return Ss(l,this.#o.parent),null}finally{this.#g=!1}})})}}function zr(n){var t=_t|Gt,e=j!==null&&(j.f&_t)!==0?j:null;return tt!==null&&(tt.f|=Ni),{ctx:Zt,deps:null,effects:null,equals:Xa,f:t,fn:n,reactions:null,rv:0,v:vt,wv:0,parent:e??tt,ac:null}}function Vu(n){const t=zr(n);return gl(t),t}function ju(n){const t=zr(n);return t.equals=Wa,t}function qa(n){var t=n.effects;if(t!==null){n.effects=null;for(var e=0;e<t.length;e+=1)le(t[e])}}function Hu(n){for(var t=n.parent;t!==null;){if((t.f&_t)===0)return t;t=t.parent}return null}function Xr(n){var t,e=tt;He(Hu(n));try{n.f&=~Rn,qa(n),t=El(n)}finally{He(e)}return t}function Ja(n){var t=Xr(n);if(n.equals(t)||(n.v=t,n.wv=pl()),!yi)if(Xt!==null)Ms()&&Xt.set(n,n.v);else{var e=(n.f&oe)===0?Te:Ct;Tt(n,e)}}let Wr=new Set;const Ve=new Map;let Qa=!1;function As(n,t){var e={f:0,v:n,reactions:null,equals:Xa,rv:0,wv:0};return e}function Ut(n,t){const e=As(n);return gl(e),e}function qu(n,t=!1,e=!0){const i=As(n);return t||(i.equals=Wa),i}function At(n,t,e=!1){j!==null&&(!pe||(j.f&Pa)!==0)&&Ka()&&(j.f&(_t|Re|Da|Pa))!==0&&!Le?.includes(n)&&Fu();let i=e?zi(t):t;return tl(n,i)}function tl(n,t){if(!n.equals(t)){var e=n.v;yi?Ve.set(n,t):Ve.set(n,e),n.v=t;var i=ae.ensure();i.capture(n,e),(n.f&_t)!==0&&((n.f&Gt)!==0&&Xr(n),Tt(n,(n.f&oe)!==0?Ct:Te)),n.wv=pl(),el(n,Gt),tt!==null&&(tt.f&Ct)!==0&&(tt.f&(Be|Ze))===0&&(jt===null?gd([n]):jt.push(n)),!i.is_fork&&Wr.size>0&&!Qa&&Ju()}return t}function Ju(){Qa=!1;const n=Array.from(Wr);for(const t of n)(t.f&Ct)!==0&&Tt(t,Te),Mn(t)&&Pn(t);Wr.clear()}function Sn(n){At(n,n.v+1)}function el(n,t){var e=n.reactions;if(e!==null)for(var i=e.length,s=0;s<i;s++){var r=e[s],o=r.f,a=(o&Gt)===0;if(a&&Tt(r,t),(o&_t)!==0){var l=r;Xt?.delete(l),(o&Rn)===0&&(o&oe&&(r.f|=Rn),el(l,Te))}else a&&((o&Re)!==0&&Se!==null&&Se.add(r),Gi(r))}}function zi(n){if(typeof n!="object"||n===null||vs in n)return n;const t=vu(n);if(t!==xu&&t!==wu)return n;var e=new Map,i=pu(n),s=Ut(0),r=Ei,o=a=>{if(Ei===r)return a();var l=j,h=Ei;Vt(null),ml(r);var c=a();return Vt(l),ml(h),c};return i&&e.set("length",Ut(n.length)),new Proxy(n,{defineProperty(a,l,h){(!("value"in h)||h.configurable===!1||h.enumerable===!1||h.writable===!1)&&Ou();var c=e.get(l);return c===void 0?c=o(()=>{var u=Ut(h.value);return e.set(l,u),u}):At(c,h.value,!0),!0},deleteProperty(a,l){var h=e.get(l);if(h===void 0){if(l in a){const c=o(()=>Ut(vt));e.set(l,c),Sn(s)}}else At(h,vt),Sn(s);return!0},get(a,l,h){if(l===vs)return n;var c=e.get(l),u=l in a;if(c===void 0&&(!u||di(a,l)?.writable)&&(c=o(()=>{var f=zi(u?a[l]:vt),g=Ut(f);return g}),e.set(l,c)),c!==void 0){var d=it(c);return d===vt?void 0:d}return Reflect.get(a,l,h)},getOwnPropertyDescriptor(a,l){var h=Reflect.getOwnPropertyDescriptor(a,l);if(h&&"value"in h){var c=e.get(l);c&&(h.value=it(c))}else if(h===void 0){var u=e.get(l),d=u?.v;if(u!==void 0&&d!==vt)return{enumerable:!0,configurable:!0,value:d,writable:!0}}return h},has(a,l){if(l===vs)return!0;var h=e.get(l),c=h!==void 0&&h.v!==vt||Reflect.has(a,l);if(h!==void 0||tt!==null&&(!c||di(a,l)?.writable)){h===void 0&&(h=o(()=>{var d=c?zi(a[l]):vt,f=Ut(d);return f}),e.set(l,h));var u=it(h);if(u===vt)return!1}return c},set(a,l,h,c){var u=e.get(l),d=l in a;if(i&&l==="length")for(var f=h;f<u.v;f+=1){var g=e.get(f+"");g!==void 0?At(g,vt):f in a&&(g=o(()=>Ut(vt)),e.set(f+"",g))}if(u===void 0)(!d||di(a,l)?.writable)&&(u=o(()=>Ut(void 0)),At(u,zi(h)),e.set(l,u));else{d=u.v!==vt;var m=o(()=>zi(h));At(u,m)}var _=Reflect.getOwnPropertyDescriptor(a,l);if(_?.set&&_.set.call(c,h),!d){if(i&&typeof l=="string"){var p=e.get("length"),y=Number(l);Number.isInteger(y)&&y>=p.v&&At(p,y+1)}Sn(s)}return!0},ownKeys(a){it(s);var l=Reflect.ownKeys(a).filter(u=>{var d=e.get(u);return d===void 0||d.v!==vt});for(var[h,c]of e)c.v!==vt&&!(h in a)&&l.push(h);return l},setPrototypeOf(){Du()}})}var Yr,il,nl,sl;function $r(){if(Yr===void 0){Yr=window,il=/Firefox/.test(navigator.userAgent);var n=Element.prototype,t=Node.prototype,e=Text.prototype;nl=di(t,"firstChild").get,sl=di(t,"nextSibling").get,Aa(n)&&(n.__click=void 0,n.__className=void 0,n.__attributes=null,n.__style=void 0,n.__e=void 0),Aa(e)&&(e.__t=void 0)}}function bn(n=""){return document.createTextNode(n)}function Ln(n){return nl.call(n)}function be(n){return sl.call(n)}function Qu(n,t){if(!mt)return Ln(n);var e=Ln(st);return e===null&&(e=st.appendChild(bn())),Ie(e),e}function td(n,t=!1){if(!mt){var e=Ln(n);return e instanceof Comment&&e.data===""?be(e):e}if(t&&st?.nodeType!==Na){var i=bn();return st?.before(i),Ie(i),i}return st}function ed(n,t=1,e=!1){let i=mt?st:n;for(var s;t--;)s=i,i=be(i);if(!mt)return i;if(e&&i?.nodeType!==Na){var r=bn();return i===null?s?.after(r):i.before(r),Ie(r),r}return Ie(i),i}function id(n){n.textContent=""}function Kr(n){var t=j,e=tt;Vt(null),He(null);try{return n()}finally{Vt(t),He(e)}}function nd(n){tt===null&&(j===null&&Lu(),bu()),yi&&Su()}function sd(n,t){var e=t.last;e===null?t.last=t.first=n:(e.next=n,n.prev=e,t.last=n)}function je(n,t,e,i=!0){var s=tt;s!==null&&(s.f&Ue)!==0&&(n|=Ue);var r={ctx:Zt,deps:null,nodes_start:null,nodes_end:null,f:n|Gt|oe,first:null,fn:t,last:null,next:null,parent:s,b:s&&s.b,prev:null,teardown:null,transitions:null,wv:0,ac:null};if(e)try{Pn(r),r.f|=Fr}catch(l){throw le(r),l}else t!==null&&Gi(r);if(i){var o=r;if(e&&o.deps===null&&o.teardown===null&&o.nodes_start===null&&o.first===o.last&&(o.f&Ni)===0&&(o=o.first,(n&Re)!==0&&(n&ws)!==0&&o!==null&&(o.f|=ws)),o!==null&&(o.parent=s,s!==null&&sd(o,s),j!==null&&(j.f&_t)!==0&&(n&Ze)===0)){var a=j;(a.effects??=[]).push(o)}}return r}function Ms(){return j!==null&&!pe}function rd(n){const t=je(Ma,null,!1);return Tt(t,Ct),t.teardown=n,t}function rl(n){nd();var t=tt.f,e=!j&&(t&Be)!==0&&(t&Fr)===0;if(e){var i=Zt;(i.e??=[]).push(n)}else return ol(n)}function ol(n){return je(Dr|Tu,n,!1)}function od(n){ae.ensure();const t=je(Ze|Ni,n,!0);return()=>{le(t)}}function ad(n){ae.ensure();const t=je(Ze|Ni,n,!0);return(e={})=>new Promise(i=>{e.outro?Ps(t,()=>{le(t),i(void 0)}):(le(t),i(void 0))})}function ld(n){return je(Dr,n,!1)}function al(n,t=0){return je(Ma|t,n,!0)}function hd(n,t=0){var e=je(Re|t,n,!0);return e}function mi(n,t=!0){return je(Be|Ni,n,!0,t)}function ll(n){var t=n.teardown;if(t!==null){const e=yi,i=j;fl(!0),Vt(null);try{t.call(null)}finally{fl(e),Vt(i)}}}function hl(n,t=!1){var e=n.first;for(n.first=n.last=null;e!==null;){const s=e.ac;s!==null&&Kr(()=>{s.abort(ka)});var i=e.next;(e.f&Ze)!==0?e.parent=null:le(e,t),e=i}}function cd(n){for(var t=n.first;t!==null;){var e=t.next;(t.f&Be)===0&&le(t),t=e}}function le(n,t=!0){var e=!1;(t||(n.f&Oa)!==0)&&n.nodes_start!==null&&n.nodes_end!==null&&(ud(n.nodes_start,n.nodes_end),e=!0),hl(n,t&&!e),Os(n,0),Tt(n,fi);var i=n.transitions;if(i!==null)for(const r of i)r.stop();ll(n);var s=n.parent;s!==null&&s.first!==null&&cl(n),n.next=n.prev=n.teardown=n.ctx=n.deps=n.fn=n.nodes_start=n.nodes_end=n.ac=null}function ud(n,t){for(;n!==null;){var e=n===t?null:be(n);n.remove(),n=e}}function cl(n){var t=n.parent,e=n.prev,i=n.next;e!==null&&(e.next=i),i!==null&&(i.prev=e),t!==null&&(t.first===n&&(t.first=i),t.last===n&&(t.last=e))}function Ps(n,t,e=!0){var i=[];ul(n,i,!0),dd(i,()=>{e&&le(n),t&&t()})}function dd(n,t){var e=n.length;if(e>0){var i=()=>--e||t();for(var s of n)s.out(i)}else t()}function ul(n,t,e){if((n.f&Ue)===0){if(n.f^=Ue,n.transitions!==null)for(const o of n.transitions)(o.is_global||e)&&t.push(o);for(var i=n.first;i!==null;){var s=i.next,r=(i.f&ws)!==0||(i.f&Be)!==0&&(n.f&Re)!==0;ul(i,t,r?e:!1),i=s}}}function fd(n,t){for(var e=n.nodes_start,i=n.nodes_end;e!==null;){var s=e===i?null:be(e);t.append(e),e=s}}let pi=!1;function dl(n){pi=n}let yi=!1;function fl(n){yi=n}let j=null,pe=!1;function Vt(n){j=n}let tt=null;function He(n){tt=n}let Le=null;function gl(n){j!==null&&(Le===null?Le=[n]:Le.push(n))}let Rt=null,Wt=0,jt=null;function gd(n){jt=n}let _l=1,An=0,Ei=An;function ml(n){Ei=n}function pl(){return++_l}function Mn(n){var t=n.f;if((t&Gt)!==0)return!0;if(t&_t&&(n.f&=~Rn),(t&Te)!==0){var e=n.deps;if(e!==null)for(var i=e.length,s=0;s<i;s++){var r=e[s];if(Mn(r)&&Ja(r),r.wv>n.wv)return!0}(t&oe)!==0&&Xt===null&&Tt(n,Ct)}return!1}function yl(n,t,e=!0){var i=n.reactions;if(i!==null&&!Le?.includes(n))for(var s=0;s<i.length;s++){var r=i[s];(r.f&_t)!==0?yl(r,t,!1):t===r&&(e?Tt(r,Gt):(r.f&Ct)!==0&&Tt(r,Te),Gi(r))}}function El(n){var t=Rt,e=Wt,i=jt,s=j,r=Le,o=Zt,a=pe,l=Ei,h=n.f;Rt=null,Wt=0,jt=null,j=(h&(Be|Ze))===0?n:null,Le=null,Ts(n.ctx),pe=!1,Ei=++An,n.ac!==null&&(Kr(()=>{n.ac.abort(ka)}),n.ac=null);try{n.f|=kr;var c=n.fn,u=c(),d=n.deps;if(Rt!==null){var f;if(Os(n,Wt),d!==null&&Wt>0)for(d.length=Wt+Rt.length,f=0;f<Rt.length;f++)d[Wt+f]=Rt[f];else n.deps=d=Rt;if(pi&&Ms()&&(n.f&oe)!==0)for(f=Wt;f<d.length;f++)(d[f].reactions??=[]).push(n)}else d!==null&&Wt<d.length&&(Os(n,Wt),d.length=Wt);if(Ka()&&jt!==null&&!pe&&d!==null&&(n.f&(_t|Te|Gt))===0)for(f=0;f<jt.length;f++)yl(jt[f],n);return s!==null&&s!==n&&(An++,jt!==null&&(i===null?i=jt:i.push(...jt))),(n.f&Tn)!==0&&(n.f^=Tn),u}catch(g){return Za(g)}finally{n.f^=kr,Rt=t,Wt=e,jt=i,j=s,Le=r,Ts(o),pe=a,Ei=l}}function _d(n,t){let e=t.reactions;if(e!==null){var i=yu.call(e,n);if(i!==-1){var s=e.length-1;s===0?e=t.reactions=null:(e[i]=e[s],e.pop())}}e===null&&(t.f&_t)!==0&&(Rt===null||!Rt.includes(t))&&(Tt(t,Te),(t.f&oe)!==0&&(t.f^=oe,t.f&=~Rn),qa(t),Os(t,0))}function Os(n,t){var e=n.deps;if(e!==null)for(var i=t;i<e.length;i++)_d(n,e[i])}function Pn(n){var t=n.f;if((t&fi)===0){Tt(n,Ct);var e=tt,i=pi;tt=n,pi=!0;try{(t&Re)!==0?cd(n):hl(n),ll(n);var s=El(n);n.teardown=typeof s=="function"?s:null,n.wv=_l;var r;La&&Wu&&(n.f&Gt)!==0&&n.deps}finally{pi=i,tt=e}}}function it(n){var t=n.f,e=(t&_t)!==0;if(j!==null&&!pe){var i=tt!==null&&(tt.f&fi)!==0;if(!i&&!Le?.includes(n)){var s=j.deps;if((j.f&kr)!==0)n.rv<An&&(n.rv=An,Rt===null&&s!==null&&s[Wt]===n?Wt++:Rt===null?Rt=[n]:Rt.includes(n)||Rt.push(n));else{(j.deps??=[]).push(n);var r=n.reactions;r===null?n.reactions=[j]:r.includes(j)||r.push(j)}}}if(yi){if(Ve.has(n))return Ve.get(n);if(e){var o=n,a=o.v;return((o.f&Ct)===0&&o.reactions!==null||wl(o))&&(a=Xr(o)),Ve.set(o,a),a}}else if(e){if(o=n,Xt?.has(o))return Xt.get(o);Mn(o)&&Ja(o),pi&&Ms()&&(o.f&oe)===0&&xl(o)}else if(Xt?.has(n))return Xt.get(n);if((n.f&Tn)!==0)throw n.v;return n.v}function xl(n){if(n.deps!==null){n.f^=oe;for(const t of n.deps)(t.reactions??=[]).push(n),(t.f&_t)!==0&&(t.f&oe)===0&&xl(t)}}function wl(n){if(n.v===vt)return!0;if(n.deps===null)return!1;for(const t of n.deps)if(Ve.has(t)||(t.f&_t)!==0&&wl(t))return!0;return!1}function Br(n){var t=pe;try{return pe=!0,n()}finally{pe=t}}const md=-7169;function Tt(n,t){n.f=n.f&md|t}const vl=new Set,Zr=new Set;function pd(n,t,e,i={}){function s(r){if(i.capture||On.call(t,r),!r.cancelBubble)return Kr(()=>e?.call(this,r))}return n.startsWith("pointer")||n.startsWith("touch")||n==="wheel"?Is(()=>{t.addEventListener(n,s,i)}):t.addEventListener(n,s,i),s}function yd(n,t,e,i,s){var r={capture:i,passive:s},o=pd(n,t,e,r);(t===document.body||t===window||t===document||t instanceof HTMLMediaElement)&&rd(()=>{t.removeEventListener(n,o,r)})}function Ed(n){for(var t=0;t<n.length;t++)vl.add(n[t]);for(var e of Zr)e(n)}let Cl=null;function On(n){var t=this,e=t.ownerDocument,i=n.type,s=n.composedPath?.()||[],r=s[0]||n.target;Cl=n;var o=0,a=Cl===n&&n.__root;if(a){var l=s.indexOf(a);if(l!==-1&&(t===document||t===window)){n.__root=t;return}var h=s.indexOf(t);if(h===-1)return;l<=h&&(o=l)}if(r=s[o]||n.target,r!==t){Es(n,"currentTarget",{configurable:!0,get(){return r||e}});var c=j,u=tt;Vt(null),He(null);try{for(var d,f=[];r!==null;){var g=r.assignedSlot||r.parentNode||r.host||null;try{var m=r["__"+i];m!=null&&(!r.disabled||n.target===r)&&m.call(r,n)}catch(_){d?f.push(_):d=_}if(n.cancelBubble||g===t||g===null)break;r=g}if(d){for(let _ of f)queueMicrotask(()=>{throw _});throw d}}finally{n.__root=t,delete n.currentTarget,Vt(c),He(u)}}}function xd(n){var t=document.createElement("template");return t.innerHTML=n.replaceAll("<!>","<!---->"),t.content}function Ur(n,t){var e=tt;e.nodes_start===null&&(e.nodes_start=n,e.nodes_end=t)}function wd(n,t){var e=(t&mu)!==0,i,s=!n.startsWith("<!>");return()=>{if(mt)return Ur(st,null),st;i===void 0&&(i=xd(s?n:"<!>"+n));var r=e||il?document.importNode(i,!0):i.cloneNode(!0);{var o=Ln(r),a=r.lastChild;Ur(o,a)}return r}}function Rl(n,t){if(mt){tt.nodes_end=st,Ga();return}n!==null&&n.before(t)}const vd=["touchstart","touchmove"];function Cd(n){return vd.includes(n)}function Tl(n,t){return Il(n,t)}function Rd(n,t){$r(),t.intro=t.intro??!1;const e=t.target,i=mt,s=st;try{for(var r=Ln(e);r&&(r.nodeType!==Cs||r.data!==Ia);)r=be(r);if(!r)throw Cn;Rs(!0),Ie(r);const o=Il(n,{...t,anchor:r});return Rs(!1),o}catch(o){if(o instanceof Error&&o.message.split(`
|
|
2
|
+
`).some(a=>a.startsWith("https://svelte.dev/e/")))throw o;return o!==Cn&&console.warn("Failed to hydrate: ",o),t.recover===!1&&Mu(),$r(),id(e),Rs(!1),Tl(n,t)}finally{Rs(i),Ie(s)}}const Xi=new Map;function Il(n,{target:t,anchor:e,props:i={},events:s,context:r,intro:o=!0}){$r();var a=new Set,l=u=>{for(var d=0;d<u.length;d++){var f=u[d];if(!a.has(f)){a.add(f);var g=Cd(f);t.addEventListener(f,On,{passive:g});var m=Xi.get(f);m===void 0?(document.addEventListener(f,On,{passive:g}),Xi.set(f,1)):Xi.set(f,m+1)}}};l(Eu(vl)),Zr.add(l);var h=void 0,c=ad(()=>{var u=e??t.appendChild(bn());return Zu(u,{pending:()=>{}},d=>{if(r){Ya({});var f=Zt;f.c=r}if(s&&(i.$$events=s),mt&&Ur(d,null),h=n(d,i)||{},mt&&(tt.nodes_end=st,st===null||st.nodeType!==Cs||st.data!==ba))throw Nr(),Cn;r&&$a()}),()=>{for(var d of a){t.removeEventListener(d,On);var f=Xi.get(d);--f===0?(document.removeEventListener(d,On),Xi.delete(d)):Xi.set(d,f)}Zr.delete(l),u!==e&&u.parentNode?.removeChild(u)}});return Vr.set(h,c),h}let Vr=new WeakMap;function Td(n,t){const e=Vr.get(n);return e?(Vr.delete(n),e(t)):Promise.resolve()}function Id(n){Zt===null&&Iu(),rl(()=>{const t=Br(n);if(typeof t=="function")return t})}function Sd(n,t){ld(()=>{var e=n.getRootNode(),i=e.host?e:e.head??e.ownerDocument.head;if(!i.querySelector("#"+t.hash)){const s=document.createElement("style");s.id=t.hash,s.textContent=t.code,i.appendChild(s)}})}let Ds=!1;function bd(n){var t=Ds;try{return Ds=!1,[n(),Ds]}finally{Ds=t}}function Wi(n,t,e,i){var s=(e&gu)!==0,r=(e&_u)!==0,o=i,a=!0,l=()=>(a&&(a=!1,o=r?Br(i):i),o),h;if(s){var c=vs in n||Fa in n;h=di(n,t)?.set??(c&&t in n?y=>n[t]=y:void 0)}var u,d=!1;s?[u,d]=bd(()=>n[t]):u=n[t],u===void 0&&i!==void 0&&(u=l(),h&&(Pu(),h(u)));var f;if(f=()=>{var y=n[t];return y===void 0?l():(a=!0,y)},(e&fu)===0)return f;if(h){var g=n.$$legacy;return(function(y,v){return arguments.length>0?((!v||g||d)&&h(v?f():y),y):f()})}var m=!1,_=((e&du)!==0?zr:ju)(()=>(m=!1,f()));s&&it(_);var p=tt;return(function(y,v){if(arguments.length>0){const E=v?it(_):s?zi(y):y;return At(_,E),m=!0,o!==void 0&&(o=E),y}return yi&&m||(p.f&fi)!==0?_.v:it(_)})}function Ld(n){return new Ad(n)}class Ad{#e;#t;constructor(t){var e=new Map,i=(r,o)=>{var a=qu(o,!1,!1);return e.set(r,a),a};const s=new Proxy({...t.props||{},$$events:{}},{get(r,o){return it(e.get(o)??i(o,Reflect.get(r,o)))},has(r,o){return o===Fa?!0:(it(e.get(o)??i(o,Reflect.get(r,o))),Reflect.has(r,o))},set(r,o,a){return At(e.get(o)??i(o,a),a),Reflect.set(r,o,a)}});this.#t=(t.hydrate?Rd:Tl)(t.component,{target:t.target,anchor:t.anchor,props:s,context:t.context,intro:t.intro??!1,recover:t.recover}),(!t?.props?.$$host||t.sync===!1)&&_i(),this.#e=s.$$events;for(const r of Object.keys(this.#t))r==="$set"||r==="$destroy"||r==="$on"||Es(this,r,{get(){return this.#t[r]},set(o){this.#t[r]=o},enumerable:!0});this.#t.$set=r=>{Object.assign(s,r)},this.#t.$destroy=()=>{Td(this.#t)}}$set(t){this.#t.$set(t)}$on(t,e){this.#e[t]=this.#e[t]||[];const i=(...s)=>e.call(this,...s);return this.#e[t].push(i),()=>{this.#e[t]=this.#e[t].filter(s=>s!==i)}}$destroy(){this.#t.$destroy()}}let Sl;typeof HTMLElement=="function"&&(Sl=class extends HTMLElement{$$ctor;$$s;$$c;$$cn=!1;$$d={};$$r=!1;$$p_d={};$$l={};$$l_u=new Map;$$me;constructor(n,t,e){super(),this.$$ctor=n,this.$$s=t,e&&this.attachShadow({mode:"open"})}addEventListener(n,t,e){if(this.$$l[n]=this.$$l[n]||[],this.$$l[n].push(t),this.$$c){const i=this.$$c.$on(n,t);this.$$l_u.set(t,i)}super.addEventListener(n,t,e)}removeEventListener(n,t,e){if(super.removeEventListener(n,t,e),this.$$c){const i=this.$$l_u.get(t);i&&(i(),this.$$l_u.delete(t))}}async connectedCallback(){if(this.$$cn=!0,!this.$$c){let n=function(i){return s=>{const r=document.createElement("slot");i!=="default"&&(r.name=i),Rl(s,r)}};if(await Promise.resolve(),!this.$$cn||this.$$c)return;const t={},e=Md(this);for(const i of this.$$s)i in e&&(i==="default"&&!this.$$d.children?(this.$$d.children=n(i),t.default=!0):t[i]=n(i));for(const i of this.attributes){const s=this.$$g_p(i.name);s in this.$$d||(this.$$d[s]=Fs(s,i.value,this.$$p_d,"toProp"))}for(const i in this.$$p_d)!(i in this.$$d)&&this[i]!==void 0&&(this.$$d[i]=this[i],delete this[i]);this.$$c=Ld({component:this.$$ctor,target:this.shadowRoot||this,props:{...this.$$d,$$slots:t,$$host:this}}),this.$$me=od(()=>{al(()=>{this.$$r=!0;for(const i of ys(this.$$c)){if(!this.$$p_d[i]?.reflect)continue;this.$$d[i]=this.$$c[i];const s=Fs(i,this.$$d[i],this.$$p_d,"toAttribute");s==null?this.removeAttribute(this.$$p_d[i].attribute||i):this.setAttribute(this.$$p_d[i].attribute||i,s)}this.$$r=!1})});for(const i in this.$$l)for(const s of this.$$l[i]){const r=this.$$c.$on(i,s);this.$$l_u.set(s,r)}this.$$l={}}}attributeChangedCallback(n,t,e){this.$$r||(n=this.$$g_p(n),this.$$d[n]=Fs(n,e,this.$$p_d,"toProp"),this.$$c?.$set({[n]:this.$$d[n]}))}disconnectedCallback(){this.$$cn=!1,Promise.resolve().then(()=>{!this.$$cn&&this.$$c&&(this.$$c.$destroy(),this.$$me(),this.$$c=void 0)})}$$g_p(n){return ys(this.$$p_d).find(t=>this.$$p_d[t].attribute===n||!this.$$p_d[t].attribute&&t.toLowerCase()===n)||n}});function Fs(n,t,e,i){const s=e[n]?.type;if(t=s==="Boolean"&&typeof t!="boolean"?t!=null:t,!i||!e[n])return t;if(i==="toAttribute")switch(s){case"Object":case"Array":return t==null?null:JSON.stringify(t);case"Boolean":return t?"":null;case"Number":return t??null;default:return t}else switch(s){case"Object":case"Array":return t&&JSON.parse(t);case"Boolean":return t;case"Number":return t!=null?+t:t;default:return t}}function Md(n){const t={};return n.childNodes.forEach(e=>{t[e.slot||"default"]=!0}),t}function Pd(n,t,e,i,s,r){let o=class extends Sl{constructor(){super(n,e,s),this.$$p_d=t}static get observedAttributes(){return ys(t).map(a=>(t[a].attribute||a).toLowerCase())}};return ys(t).forEach(a=>{Es(o.prototype,a,{get(){return this.$$c&&a in this.$$c?this.$$c[a]:this.$$d[a]},set(l){l=Fs(a,l,t),this.$$d[a]=l;var h=this.$$c;if(h){var c=di(h,a)?.get;c?h[a]=l:h.$set({[a]:l})}}})}),i.forEach(a=>{Es(o.prototype,a,{get(){return this.$$c?.[a]}})}),n.element=o,o}const Mt={ADD:"add",REMOVE:"remove"},Yi={PROPERTYCHANGE:"propertychange"},z={CHANGE:"change",ERROR:"error",CONTEXTMENU:"contextmenu",CLICK:"click",DBLCLICK:"dblclick",KEYDOWN:"keydown",KEYPRESS:"keypress",LOAD:"load",TOUCHMOVE:"touchmove",WHEEL:"wheel"};class ks{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}}function Od(n,t,e){let i,s;e=e||Ae;let r=0,o=n.length,a=!1;for(;r<o;)i=r+(o-r>>1),s=+e(n[i],t),s<0?r=i+1:(o=i,a=!s);return a?r:~r}function Ae(n,t){return n>t?1:n<t?-1:0}function Dd(n,t){return n<t?1:n>t?-1:0}function jr(n,t,e){if(n[0]<=t)return 0;const i=n.length;if(t<=n[i-1])return i-1;if(typeof e=="function"){for(let s=1;s<i;++s){const r=n[s];if(r===t)return s;if(r<t)return e(t,n[s-1],r)>0?s-1:s}return i-1}if(e>0){for(let s=1;s<i;++s)if(n[s]<t)return s-1;return i-1}if(e<0){for(let s=1;s<i;++s)if(n[s]<=t)return s;return i-1}for(let s=1;s<i;++s){if(n[s]==t)return s;if(n[s]<t)return n[s-1]-t<t-n[s]?s-1:s}return i-1}function Fd(n,t,e){for(;t<e;){const i=n[t];n[t]=n[e],n[e]=i,++t,--e}}function Hr(n,t){const e=Array.isArray(t)?t:[t],i=e.length;for(let s=0;s<i;s++)n[n.length]=e[s]}function qe(n,t){const e=n.length;if(e!==t.length)return!1;for(let i=0;i<e;i++)if(n[i]!==t[i])return!1;return!0}function kd(n,t,e){const i=t||Ae;return n.every(function(s,r){if(r===0)return!0;const o=i(n[r-1],s);return!(o>0||o===0)})}function Dn(){return!0}function Ns(){return!1}function Fn(){}function bl(n){let t,e,i;return function(){const s=Array.prototype.slice.call(arguments);return(!e||this!==i||!qe(s,e))&&(i=this,e=s,t=n.apply(this,arguments)),t}}function Nd(n){function t(){let e;try{e=n()}catch(i){return Promise.reject(i)}return e instanceof Promise?e:Promise.resolve(e)}return t()}function kn(n){for(const t in n)delete n[t]}function $i(n){let t;for(t in n)return!1;return!t}class Me{constructor(t){this.propagationStopped,this.defaultPrevented,this.type=t,this.target=null}preventDefault(){this.defaultPrevented=!0}stopPropagation(){this.propagationStopped=!0}}class Gs extends ks{constructor(t){super(),this.eventTarget_=t,this.pendingRemovals_=null,this.dispatching_=null,this.listeners_=null}addEventListener(t,e){if(!t||!e)return;const i=this.listeners_||(this.listeners_={}),s=i[t]||(i[t]=[]);s.includes(e)||s.push(e)}dispatchEvent(t){const e=typeof t=="string",i=e?t:t.type,s=this.listeners_&&this.listeners_[i];if(!s)return;const r=e?new Me(t):t;r.target||(r.target=this.eventTarget_||this);const o=this.dispatching_||(this.dispatching_={}),a=this.pendingRemovals_||(this.pendingRemovals_={});i in o||(o[i]=0,a[i]=0),++o[i];let l;for(let h=0,c=s.length;h<c;++h)if("handleEvent"in s[h]?l=s[h].handleEvent(r):l=s[h].call(this,r),l===!1||r.propagationStopped){l=!1;break}if(--o[i]===0){let h=a[i];for(delete a[i];h--;)this.removeEventListener(i,Fn);delete o[i]}return l}disposeInternal(){this.listeners_&&kn(this.listeners_)}getListeners(t){return this.listeners_&&this.listeners_[t]||void 0}hasListener(t){return this.listeners_?t?t in this.listeners_:Object.keys(this.listeners_).length>0:!1}removeEventListener(t,e){if(!this.listeners_)return;const i=this.listeners_[t];if(!i)return;const s=i.indexOf(e);s!==-1&&(this.pendingRemovals_&&t in this.pendingRemovals_?(i[s]=Fn,++this.pendingRemovals_[t]):(i.splice(s,1),i.length===0&&delete this.listeners_[t]))}}function Z(n,t,e,i,s){if(s){const o=e;e=function(a){return n.removeEventListener(t,e),o.call(i??this,a)}}else i&&i!==n&&(e=e.bind(i));const r={target:n,type:t,listener:e};return n.addEventListener(t,e),r}function zs(n,t,e,i){return Z(n,t,e,i,!0)}function nt(n){n&&n.target&&(n.target.removeEventListener(n.type,n.listener),kn(n))}class Nn extends Gs{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(t,e){if(Array.isArray(t)){const i=t.length,s=new Array(i);for(let r=0;r<i;++r)s[r]=Z(this,t[r],e);return s}return Z(this,t,e)}onceInternal(t,e){let i;if(Array.isArray(t)){const s=t.length;i=new Array(s);for(let r=0;r<s;++r)i[r]=zs(this,t[r],e)}else i=zs(this,t,e);return e.ol_key=i,i}unInternal(t,e){const i=e.ol_key;if(i)Gd(i);else if(Array.isArray(t))for(let s=0,r=t.length;s<r;++s)this.removeEventListener(t[s],e);else this.removeEventListener(t,e)}}Nn.prototype.on,Nn.prototype.once,Nn.prototype.un;function Gd(n){if(Array.isArray(n))for(let t=0,e=n.length;t<e;++t)nt(n[t]);else nt(n)}function U(){throw new Error("Unimplemented abstract method.")}let zd=0;function V(n){return n.ol_uid||(n.ol_uid=String(++zd))}class Ll extends Me{constructor(t,e,i){super(t),this.key=e,this.oldValue=i}}class he extends Nn{constructor(t){super(),this.on,this.once,this.un,V(this),this.values_=null,t!==void 0&&this.setProperties(t)}get(t){let e;return this.values_&&this.values_.hasOwnProperty(t)&&(e=this.values_[t]),e}getKeys(){return this.values_&&Object.keys(this.values_)||[]}getProperties(){return this.values_&&Object.assign({},this.values_)||{}}getPropertiesInternal(){return this.values_}hasProperties(){return!!this.values_}notify(t,e){let i;i=`change:${t}`,this.hasListener(i)&&this.dispatchEvent(new Ll(i,t,e)),i=Yi.PROPERTYCHANGE,this.hasListener(i)&&this.dispatchEvent(new Ll(i,t,e))}addChangeListener(t,e){this.addEventListener(`change:${t}`,e)}removeChangeListener(t,e){this.removeEventListener(`change:${t}`,e)}set(t,e,i){const s=this.values_||(this.values_={});if(i)s[t]=e;else{const r=s[t];s[t]=e,r!==e&&this.notify(t,r)}}setProperties(t,e){for(const i in t)this.set(i,t[i],e)}applyProperties(t){t.values_&&Object.assign(this.values_||(this.values_={}),t.values_)}unset(t,e){if(this.values_&&t in this.values_){const i=this.values_[t];delete this.values_[t],$i(this.values_)&&(this.values_=null),e||this.notify(t,i)}}}const Al={LENGTH:"length"};class Xs extends Me{constructor(t,e,i){super(t),this.element=e,this.index=i}}class Ht extends he{constructor(t,e){if(super(),this.on,this.once,this.un,e=e||{},this.unique_=!!e.unique,this.array_=t??[],this.unique_)for(let i=1,s=this.array_.length;i<s;++i)this.assertUnique_(this.array_[i],i);this.updateLength_()}clear(){for(;this.getLength()>0;)this.pop()}extend(t){for(let e=0,i=t.length;e<i;++e)this.push(t[e]);return this}forEach(t){const e=this.array_;for(let i=0,s=e.length;i<s;++i)t(e[i],i,e)}getArray(){return this.array_}item(t){return this.array_[t]}getLength(){return this.get(Al.LENGTH)}insertAt(t,e){if(t<0||t>this.getLength())throw new Error("Index out of bounds: "+t);this.unique_&&this.assertUnique_(e),this.array_.splice(t,0,e),this.updateLength_(),this.dispatchEvent(new Xs(Mt.ADD,e,t))}pop(){return this.removeAt(this.getLength()-1)}push(t){const e=this.getLength();return this.insertAt(e,t),this.getLength()}remove(t){const e=this.array_;for(let i=0,s=e.length;i<s;++i)if(e[i]===t)return this.removeAt(i)}removeAt(t){if(t<0||t>=this.getLength())return;const e=this.array_[t];return this.array_.splice(t,1),this.updateLength_(),this.dispatchEvent(new Xs(Mt.REMOVE,e,t)),e}setAt(t,e){const i=this.getLength();if(t>=i){this.insertAt(t,e);return}if(t<0)throw new Error("Index out of bounds: "+t);this.unique_&&this.assertUnique_(e,t);const s=this.array_[t];this.array_[t]=e,this.dispatchEvent(new Xs(Mt.REMOVE,s,t)),this.dispatchEvent(new Xs(Mt.ADD,e,t))}updateLength_(){this.set(Al.LENGTH,this.array_.length)}assertUnique_(t,e){const i=this.array_;for(let s=0,r=i.length;s<r;++s)if(i[s]===t&&s!==e)throw new Error("Duplicate item added to a unique collection")}}function q(n,t){if(!n)throw new Error(t)}class qr extends he{constructor(t){if(super(),this.on,this.once,this.un,this.id_=void 0,this.geometryName_="geometry",this.style_=null,this.styleFunction_=void 0,this.geometryChangeKey_=null,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),t)if(typeof t.getSimplifiedGeometry=="function"){const e=t;this.setGeometry(e)}else{const e=t;this.setProperties(e)}}clone(){const t=new qr(this.hasProperties()?this.getProperties():null);t.setGeometryName(this.getGeometryName());const e=this.getGeometry();e&&t.setGeometry(e.clone());const i=this.getStyle();return i&&t.setStyle(i),t}getGeometry(){return this.get(this.geometryName_)}getId(){return this.id_}getGeometryName(){return this.geometryName_}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}handleGeometryChange_(){this.changed()}handleGeometryChanged_(){this.geometryChangeKey_&&(nt(this.geometryChangeKey_),this.geometryChangeKey_=null);const t=this.getGeometry();t&&(this.geometryChangeKey_=Z(t,z.CHANGE,this.handleGeometryChange_,this)),this.changed()}setGeometry(t){this.set(this.geometryName_,t)}setStyle(t){this.style_=t,this.styleFunction_=t?Xd(t):void 0,this.changed()}setId(t){this.id_=t,this.changed()}setGeometryName(t){this.removeChangeListener(this.geometryName_,this.handleGeometryChanged_),this.geometryName_=t,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),this.handleGeometryChanged_()}}function Xd(n){if(typeof n=="function")return n;let t;return Array.isArray(n)?t=n:(q(typeof n.getZIndex=="function","Expected an `ol/style/Style` or an array of `ol/style/Style.js`"),t=[n]),function(){return t}}const ut={UNKNOWN:0,INTERSECTING:1,ABOVE:2,RIGHT:4,BELOW:8,LEFT:16};function Ml(n){const t=Yt();for(let e=0,i=n.length;e<i;++e)zn(t,n[e]);return t}function Jr(n,t,e){return e?(e[0]=n[0]-t,e[1]=n[1]-t,e[2]=n[2]+t,e[3]=n[3]+t,e):[n[0]-t,n[1]-t,n[2]+t,n[3]+t]}function Pl(n,t){return t?(t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t):n.slice()}function Ol(n,t,e){let i,s;return t<n[0]?i=n[0]-t:n[2]<t?i=t-n[2]:i=0,e<n[1]?s=n[1]-e:n[3]<e?s=e-n[3]:s=0,i*i+s*s}function Ki(n,t){return Dl(n,t[0],t[1])}function Bi(n,t){return n[0]<=t[0]&&t[2]<=n[2]&&n[1]<=t[1]&&t[3]<=n[3]}function Dl(n,t,e){return n[0]<=t&&t<=n[2]&&n[1]<=e&&e<=n[3]}function Qr(n,t){const e=n[0],i=n[1],s=n[2],r=n[3],o=t[0],a=t[1];let l=ut.UNKNOWN;return o<e?l=l|ut.LEFT:o>s&&(l=l|ut.RIGHT),a<i?l=l|ut.BELOW:a>r&&(l=l|ut.ABOVE),l===ut.UNKNOWN&&(l=ut.INTERSECTING),l}function Yt(){return[1/0,1/0,-1/0,-1/0]}function Je(n,t,e,i,s){return s?(s[0]=n,s[1]=t,s[2]=e,s[3]=i,s):[n,t,e,i]}function Ws(n){return Je(1/0,1/0,-1/0,-1/0,n)}function Fl(n,t){const e=n[0],i=n[1];return Je(e,i,e,i,t)}function to(n,t,e,i,s){const r=Ws(s);return Nl(r,n,t,e,i)}function Gn(n,t){return n[0]==t[0]&&n[2]==t[2]&&n[1]==t[1]&&n[3]==t[3]}function kl(n,t){return t[0]<n[0]&&(n[0]=t[0]),t[2]>n[2]&&(n[2]=t[2]),t[1]<n[1]&&(n[1]=t[1]),t[3]>n[3]&&(n[3]=t[3]),n}function zn(n,t){t[0]<n[0]&&(n[0]=t[0]),t[0]>n[2]&&(n[2]=t[0]),t[1]<n[1]&&(n[1]=t[1]),t[1]>n[3]&&(n[3]=t[1])}function Nl(n,t,e,i,s){for(;e<i;e+=s)Wd(n,t[e],t[e+1]);return n}function Wd(n,t,e){n[0]=Math.min(n[0],t),n[1]=Math.min(n[1],e),n[2]=Math.max(n[2],t),n[3]=Math.max(n[3],e)}function Gl(n,t){let e;return e=t(Ys(n)),e||(e=t($s(n)),e)||(e=t(Ks(n)),e)||(e=t(vi(n)),e)?e:!1}function eo(n){let t=0;return Bs(n)||(t=J(n)*It(n)),t}function Ys(n){return[n[0],n[1]]}function $s(n){return[n[2],n[1]]}function xi(n){return[(n[0]+n[2])/2,(n[1]+n[3])/2]}function Yd(n,t){let e;if(t==="bottom-left")e=Ys(n);else if(t==="bottom-right")e=$s(n);else if(t==="top-left")e=vi(n);else if(t==="top-right")e=Ks(n);else throw new Error("Invalid corner");return e}function io(n,t,e,i,s){const[r,o,a,l,h,c,u,d]=zl(n,t,e,i);return Je(Math.min(r,a,h,u),Math.min(o,l,c,d),Math.max(r,a,h,u),Math.max(o,l,c,d),s)}function zl(n,t,e,i){const s=t*i[0]/2,r=t*i[1]/2,o=Math.cos(e),a=Math.sin(e),l=s*o,h=s*a,c=r*o,u=r*a,d=n[0],f=n[1];return[d-l+u,f-h-c,d-l-u,f-h+c,d+l-u,f+h+c,d+l+u,f+h-c,d-l+u,f-h-c]}function It(n){return n[3]-n[1]}function wi(n,t,e){const i=e||Yt();return Pt(n,t)?(n[0]>t[0]?i[0]=n[0]:i[0]=t[0],n[1]>t[1]?i[1]=n[1]:i[1]=t[1],n[2]<t[2]?i[2]=n[2]:i[2]=t[2],n[3]<t[3]?i[3]=n[3]:i[3]=t[3]):Ws(i),i}function vi(n){return[n[0],n[3]]}function Ks(n){return[n[2],n[3]]}function J(n){return n[2]-n[0]}function Pt(n,t){return n[0]<=t[2]&&n[2]>=t[0]&&n[1]<=t[3]&&n[3]>=t[1]}function Bs(n){return n[2]<n[0]||n[3]<n[1]}function $d(n,t){return t?(t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t):n}function Kd(n,t,e){let i=!1;const s=Qr(n,t),r=Qr(n,e);if(s===ut.INTERSECTING||r===ut.INTERSECTING)i=!0;else{const o=n[0],a=n[1],l=n[2],h=n[3],c=t[0],u=t[1],d=e[0],f=e[1],g=(f-u)/(d-c);let m,_;r&ut.ABOVE&&!(s&ut.ABOVE)&&(m=d-(f-h)/g,i=m>=o&&m<=l),!i&&r&ut.RIGHT&&!(s&ut.RIGHT)&&(_=f-(d-l)*g,i=_>=a&&_<=h),!i&&r&ut.BELOW&&!(s&ut.BELOW)&&(m=d-(f-a)/g,i=m>=o&&m<=l),!i&&r&ut.LEFT&&!(s&ut.LEFT)&&(_=f-(d-o)*g,i=_>=a&&_<=h)}return i}function Xl(n,t){const e=t.getExtent(),i=xi(n);if(t.canWrapX()&&(i[0]<e[0]||i[0]>=e[2])){const s=J(e),o=Math.floor((i[0]-e[0])/s)*s;n[0]-=o,n[2]-=o}return n}function Wl(n,t,e){if(t.canWrapX()){const i=t.getExtent();if(!isFinite(n[0])||!isFinite(n[2]))return[[i[0],n[1],i[2],n[3]]];Xl(n,t);const s=J(i);if(J(n)>s&&!e)return[[i[0],n[1],i[2],n[3]]];if(n[0]<i[0])return[[n[0]+s,n[1],i[2],n[3]],[i[0],n[1],n[2],n[3]]];if(n[2]>i[2])return[[n[0],n[1],i[2],n[3]],[i[0],n[1],n[2]-s,n[3]]]}return[n]}function rt(n,t,e){return Math.min(Math.max(n,t),e)}function Bd(n,t,e,i,s,r){const o=s-e,a=r-i;if(o!==0||a!==0){const l=((n-e)*o+(t-i)*a)/(o*o+a*a);l>1?(e=s,i=r):l>0&&(e+=o*l,i+=a*l)}return Zi(n,t,e,i)}function Zi(n,t,e,i){const s=e-n,r=i-t;return s*s+r*r}function Zd(n){const t=n.length;for(let i=0;i<t;i++){let s=i,r=Math.abs(n[i][i]);for(let a=i+1;a<t;a++){const l=Math.abs(n[a][i]);l>r&&(r=l,s=a)}if(r===0)return null;const o=n[s];n[s]=n[i],n[i]=o;for(let a=i+1;a<t;a++){const l=-n[a][i]/n[i][i];for(let h=i;h<t+1;h++)i==h?n[a][h]=0:n[a][h]+=l*n[i][h]}}const e=new Array(t);for(let i=t-1;i>=0;i--){e[i]=n[i][t]/n[i][i];for(let s=i-1;s>=0;s--)n[s][t]-=n[s][i]*e[i]}return e}function Yl(n){return n*180/Math.PI}function Qe(n){return n*Math.PI/180}function Ui(n,t){const e=n%t;return e*t<0?e+t:e}function qt(n,t,e){return n+e*(t-n)}function Zs(n,t){const e=Math.pow(10,t);return Math.round(n*e)/e}function Us(n,t){return Math.floor(Zs(n,t))}function Vs(n,t){return Math.ceil(Zs(n,t))}function no(n,t,e){if(n>=t&&n<e)return n;const i=e-t;return((n-t)%i+i)%i+t}const Ud=63710088e-1;function $l(n,t,e){e=e||Ud;const i=Qe(n[1]),s=Qe(t[1]),r=(s-i)/2,o=Qe(t[0]-n[0])/2,a=Math.sin(r)*Math.sin(r)+Math.sin(o)*Math.sin(o)*Math.cos(i)*Math.cos(s);return 2*e*Math.atan2(Math.sqrt(a),Math.sqrt(1-a))}function Kl(...n){console.warn(...n)}function Vd(n,t){return n[0]+=+t[0],n[1]+=+t[1],n}function js(n,t){let e=!0;for(let i=n.length-1;i>=0;--i)if(n[i]!=t[i]){e=!1;break}return e}function so(n,t){const e=Math.cos(t),i=Math.sin(t),s=n[0]*e-n[1]*i,r=n[1]*e+n[0]*i;return n[0]=s,n[1]=r,n}function jd(n,t){return n[0]*=t,n[1]*=t,n}function Bl(n,t){if(t.canWrapX()){const e=J(t.getExtent()),i=Hd(n,t,e);i&&(n[0]-=i*e)}return n}function Hd(n,t,e){const i=t.getExtent();let s=0;return t.canWrapX()&&(n[0]<i[0]||n[0]>i[2])&&(e=e||J(i),s=Math.floor((n[0]-i[0])/e)),s}const ro={radians:6370997/(2*Math.PI),degrees:2*Math.PI*6370997/360,ft:.3048,m:1,"us-ft":1200/3937};class oo{constructor(t){this.code_=t.code,this.units_=t.units,this.extent_=t.extent!==void 0?t.extent:null,this.worldExtent_=t.worldExtent!==void 0?t.worldExtent:null,this.axisOrientation_=t.axisOrientation!==void 0?t.axisOrientation:"enu",this.global_=t.global!==void 0?t.global:!1,this.canWrapX_=!!(this.global_&&this.extent_),this.getPointResolutionFunc_=t.getPointResolution,this.defaultTileGrid_=null,this.metersPerUnit_=t.metersPerUnit}canWrapX(){return this.canWrapX_}getCode(){return this.code_}getExtent(){return this.extent_}getUnits(){return this.units_}getMetersPerUnit(){return this.metersPerUnit_||ro[this.units_]}getWorldExtent(){return this.worldExtent_}getAxisOrientation(){return this.axisOrientation_}isGlobal(){return this.global_}setGlobal(t){this.global_=t,this.canWrapX_=!!(t&&this.extent_)}getDefaultTileGrid(){return this.defaultTileGrid_}setDefaultTileGrid(t){this.defaultTileGrid_=t}setExtent(t){this.extent_=t,this.canWrapX_=!!(this.global_&&t)}setWorldExtent(t){this.worldExtent_=t}setGetPointResolution(t){this.getPointResolutionFunc_=t}getPointResolutionFunc(){return this.getPointResolutionFunc_}}const Xn=6378137,Vi=Math.PI*Xn,qd=[-Vi,-Vi,Vi,Vi],Jd=[-180,-85,180,85],Hs=Xn*Math.log(Math.tan(Math.PI/2));class ji extends oo{constructor(t){super({code:t,units:"m",extent:qd,global:!0,worldExtent:Jd,getPointResolution:function(e,i){return e/Math.cosh(i[1]/Xn)}})}}const Zl=[new ji("EPSG:3857"),new ji("EPSG:102100"),new ji("EPSG:102113"),new ji("EPSG:900913"),new ji("http://www.opengis.net/def/crs/EPSG/0/3857"),new ji("http://www.opengis.net/gml/srs/epsg.xml#3857")];function Qd(n,t,e,i){const s=n.length;e=e>1?e:2,i=i??e,t===void 0&&(e>2?t=n.slice():t=new Array(s));for(let r=0;r<s;r+=i){t[r]=Vi*n[r]/180;let o=Xn*Math.log(Math.tan(Math.PI*(+n[r+1]+90)/360));o>Hs?o=Hs:o<-Hs&&(o=-Hs),t[r+1]=o}return t}function tf(n,t,e,i){const s=n.length;e=e>1?e:2,i=i??e,t===void 0&&(e>2?t=n.slice():t=new Array(s));for(let r=0;r<s;r+=i)t[r]=180*n[r]/Vi,t[r+1]=360*Math.atan(Math.exp(n[r+1]/Xn))/Math.PI-90;return t}const ef=6378137,Ul=[-180,-90,180,90],nf=Math.PI*ef/180;class Ci extends oo{constructor(t,e){super({code:t,units:"degrees",extent:Ul,axisOrientation:e,global:!0,metersPerUnit:nf,worldExtent:Ul})}}const Vl=[new Ci("CRS:84"),new Ci("EPSG:4326","neu"),new Ci("urn:ogc:def:crs:OGC:1.3:CRS84"),new Ci("urn:ogc:def:crs:OGC:2:84"),new Ci("http://www.opengis.net/def/crs/OGC/1.3/CRS84"),new Ci("http://www.opengis.net/gml/srs/epsg.xml#4326","neu"),new Ci("http://www.opengis.net/def/crs/EPSG/0/4326","neu")];let ao={};function sf(n){return ao[n]||ao[n.replace(/urn:(x-)?ogc:def:crs:EPSG:(.*:)?(\w+)$/,"EPSG:$3")]||null}function rf(n,t){ao[n]=t}let Hi={};function Wn(n,t,e){const i=n.getCode(),s=t.getCode();i in Hi||(Hi[i]={}),Hi[i][s]=e}function lo(n,t){return n in Hi&&t in Hi[n]?Hi[n][t]:null}const qs=.9996,Jt=.00669438,Js=Jt*Jt,Qs=Js*Jt,Ri=Jt/(1-Jt),jl=Math.sqrt(1-Jt),qi=(1-jl)/(1+jl),Hl=qi*qi,ho=Hl*qi,co=ho*qi,ql=co*qi,Jl=1-Jt/4-3*Js/64-5*Qs/256,of=3*Jt/8+3*Js/32+45*Qs/1024,af=15*Js/256+45*Qs/1024,lf=35*Qs/3072,hf=3/2*qi-27/32*ho+269/512*ql,cf=21/16*Hl-55/32*co,uf=151/96*ho-417/128*ql,df=1097/512*co,tr=6378137;function ff(n,t,e){const i=n-5e5,o=(e.north?t:t-1e7)/qs/(tr*Jl),a=o+hf*Math.sin(2*o)+cf*Math.sin(4*o)+uf*Math.sin(6*o)+df*Math.sin(8*o),l=Math.sin(a),h=l*l,c=Math.cos(a),u=l/c,d=u*u,f=d*d,g=1-Jt*h,m=Math.sqrt(1-Jt*h),_=tr/m,p=(1-Jt)/g,y=Ri*c**2,v=y*y,E=i/(_*qs),x=E*E,w=x*E,T=w*E,R=T*E,I=R*E,L=a-u/p*(x/2-T/24*(5+3*d+10*y-4*v-9*Ri))+I/720*(61+90*d+298*y+45*f-252*Ri-3*v);let P=(E-w/6*(1+2*d+y)+R/120*(5-2*y+28*d-3*v+8*Ri+24*f))/c;return P=no(P+Qe(eh(e.number)),-Math.PI,Math.PI),[Yl(P),Yl(L)]}const Ql=-80,th=84,gf=-180,_f=180;function mf(n,t,e){n=no(n,gf,_f),t<Ql?t=Ql:t>th&&(t=th);const i=Qe(t),s=Math.sin(i),r=Math.cos(i),o=s/r,a=o*o,l=a*a,h=Qe(n),c=eh(e.number),u=Qe(c),d=tr/Math.sqrt(1-Jt*s**2),f=Ri*r**2,g=r*no(h-u,-Math.PI,Math.PI),m=g*g,_=m*g,p=_*g,y=p*g,v=y*g,E=tr*(Jl*i-of*Math.sin(2*i)+af*Math.sin(4*i)-lf*Math.sin(6*i)),x=qs*d*(g+_/6*(1-a+f)+y/120*(5-18*a+l+72*f-58*Ri))+5e5;let w=qs*(E+d*o*(m/2+p/24*(5-a+9*f+4*f**2)+v/720*(61-58*a+l+600*f-330*Ri)));return e.north||(w+=1e7),[x,w]}function eh(n){return(n-1)*6-180+3}const pf=[/^EPSG:(\d+)$/,/^urn:ogc:def:crs:EPSG::(\d+)$/,/^http:\/\/www\.opengis\.net\/def\/crs\/EPSG\/0\/(\d+)$/];function ih(n){let t=0;for(const s of pf){const r=n.match(s);if(r){t=parseInt(r[1]);break}}if(!t)return null;let e=0,i=!1;return t>32700&&t<32761?e=t-32700:t>32600&&t<32661&&(i=!0,e=t-32600),e?{number:e,north:i}:null}function nh(n,t){return function(e,i,s,r){const o=e.length;s=s>1?s:2,r=r??s,i||(s>2?i=e.slice():i=new Array(o));for(let a=0;a<o;a+=r){const l=e[a],h=e[a+1],c=n(l,h,t);i[a]=c[0],i[a+1]=c[1]}return i}}function yf(n){return ih(n)?new oo({code:n,units:"m"}):null}function Ef(n){const t=ih(n.getCode());return t?{forward:nh(mf,t),inverse:nh(ff,t)}:null}const xf=[Ef],wf=[yf];let uo=!0;function sh(n){uo=!1}function fo(n,t){if(t!==void 0){for(let e=0,i=n.length;e<i;++e)t[e]=n[e];t=t}else t=n.slice();return t}function go(n){rf(n.getCode(),n),Wn(n,n,fo)}function vf(n){n.forEach(go)}function Ot(n){if(typeof n!="string")return n;const t=sf(n);if(t)return t;for(const e of wf){const i=e(n);if(i)return i}return null}function rh(n,t,e,i){n=Ot(n);let s;const r=n.getPointResolutionFunc();if(r)s=r(t,e);else{const o=n.getUnits();if(o=="degrees"&&!i||i=="degrees")s=t;else{const a=po(n,Ot("EPSG:4326"));if(!a&&o!=="degrees")s=t*n.getMetersPerUnit();else{let h=[e[0]-t/2,e[1],e[0]+t/2,e[1],e[0],e[1]-t/2,e[0],e[1]+t/2];h=a(h,h,2);const c=$l(h.slice(0,2),h.slice(2,4)),u=$l(h.slice(4,6),h.slice(6,8));s=(c+u)/2}const l=n.getMetersPerUnit();l!==void 0&&(s/=l)}}return s}function oh(n){vf(n),n.forEach(function(t){n.forEach(function(e){t!==e&&Wn(t,e,fo)})})}function Cf(n,t,e,i){n.forEach(function(s){t.forEach(function(r){Wn(s,r,e),Wn(r,s,i)})})}function _o(n,t){return n?typeof n=="string"?Ot(n):n:Ot(t)}function Rf(n){return(function(t,e,i,s){const r=t.length;i=i!==void 0?i:2,s=s??i,e=e!==void 0?e:new Array(r);for(let o=0;o<r;o+=s){const a=n(t.slice(o,o+i)),l=a.length;for(let h=0,c=s;h<c;++h)e[o+h]=h>=l?t[o+h]:a[h]}return e})}function mo(n,t){return sh(),Yn(n,"EPSG:4326","EPSG:3857")}function er(n,t){if(n===t)return!0;const e=n.getUnits()===t.getUnits();return(n.getCode()===t.getCode()||po(n,t)===fo)&&e}function po(n,t){const e=n.getCode(),i=t.getCode();let s=lo(e,i);if(s)return s;let r=null,o=null;for(const l of xf)r||(r=l(n)),o||(o=l(t));if(!r&&!o)return null;const a="EPSG:4326";if(o)if(r)s=yo(r.inverse,o.forward);else{const l=lo(e,a);l&&(s=yo(l,o.forward))}else{const l=lo(a,i);l&&(s=yo(r.inverse,l))}return s&&(go(n),go(t),Wn(n,t,s)),s}function yo(n,t){return function(e,i,s,r){return i=n(e,i,s,r),t(i,i,s,r)}}function ir(n,t){const e=Ot(n),i=Ot(t);return po(e,i)}function Yn(n,t,e){const i=ir(t,e);if(!i){const s=Ot(t).getCode(),r=Ot(e).getCode();throw new Error(`No transform available between ${s} and ${r}`)}return i(n,void 0,n.length)}function Eo(n,t){return n}function Pe(n,t){return uo&&!js(n,[0,0])&&n[0]>=-180&&n[0]<=180&&n[1]>=-90&&n[1]<=90&&(uo=!1,Kl("Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.")),n}function ah(n,t){return n}function ti(n,t){return n}function Tf(){oh(Zl),oh(Vl),Cf(Vl,Zl,Qd,tf)}Tf(),new Array(6);function ce(){return[1,0,0,1,0,0]}function If(n,t){return n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=t[3],n[4]=t[4],n[5]=t[5],n}function dt(n,t){const e=t[0],i=t[1];return t[0]=n[0]*e+n[2]*i+n[4],t[1]=n[1]*e+n[3]*i+n[5],t}function Oe(n,t,e,i,s,r,o,a){const l=Math.sin(r),h=Math.cos(r);return n[0]=i*h,n[1]=s*l,n[2]=-i*l,n[3]=s*h,n[4]=o*i*h-a*i*l+t,n[5]=o*s*l+a*s*h+e,n}function lh(n,t){const e=Sf(t);q(e!==0,"Transformation matrix cannot be inverted");const i=t[0],s=t[1],r=t[2],o=t[3],a=t[4],l=t[5];return n[0]=o/e,n[1]=-s/e,n[2]=-r/e,n[3]=i/e,n[4]=(r*l-o*a)/e,n[5]=-(i*l-s*a)/e,n}function Sf(n){return n[0]*n[3]-n[1]*n[2]}const bf=[1e5,1e5,1e5,1e5,2,2];function Lf(n){return"matrix("+n.join(", ")+")"}function xo(n){return n.substring(7,n.length-1).split(",").map(parseFloat)}function Af(n,t){const e=xo(n),i=xo(t);for(let s=0;s<6;++s)if(Math.round((e[s]-i[s])*bf[s])!==0)return!1;return!0}function ei(n,t,e,i,s,r,o){r=r||[],o=o||2;let a=0;for(let l=t;l<e;l+=i){const h=n[l],c=n[l+1];r[a++]=s[0]*h+s[2]*c+s[4],r[a++]=s[1]*h+s[3]*c+s[5];for(let u=2;u<o;u++)r[a++]=n[l+u]}return r&&r.length!=a&&(r.length=a),r}function hh(n,t,e,i,s,r,o){o=o||[];const a=Math.cos(s),l=Math.sin(s),h=r[0],c=r[1];let u=0;for(let d=t;d<e;d+=i){const f=n[d]-h,g=n[d+1]-c;o[u++]=h+f*a-g*l,o[u++]=c+f*l+g*a;for(let m=d+2;m<d+i;++m)o[u++]=n[m]}return o&&o.length!=u&&(o.length=u),o}function Mf(n,t,e,i,s,r,o,a){a=a||[];const l=o[0],h=o[1];let c=0;for(let u=t;u<e;u+=i){const d=n[u]-l,f=n[u+1]-h;a[c++]=l+s*d,a[c++]=h+r*f;for(let g=u+2;g<u+i;++g)a[c++]=n[g]}return a&&a.length!=c&&(a.length=c),a}function Pf(n,t,e,i,s,r,o){o=o||[];let a=0;for(let l=t;l<e;l+=i){o[a++]=n[l]+s,o[a++]=n[l+1]+r;for(let h=l+2;h<l+i;++h)o[a++]=n[h]}return o&&o.length!=a&&(o.length=a),o}const ch=ce(),Of=[NaN,NaN];class Df extends he{constructor(){super(),this.extent_=Yt(),this.extentRevision_=-1,this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=0,this.simplifyTransformedInternal=bl((t,e,i)=>{if(!i)return this.getSimplifiedGeometry(e);const s=this.clone();return s.applyTransform(i),s.getSimplifiedGeometry(e)})}simplifyTransformed(t,e){return this.simplifyTransformedInternal(this.getRevision(),t,e)}clone(){return U()}closestPointXY(t,e,i,s){return U()}containsXY(t,e){return this.closestPointXY(t,e,Of,Number.MIN_VALUE)===0}getClosestPoint(t,e){return e=e||[NaN,NaN],this.closestPointXY(t[0],t[1],e,1/0),e}intersectsCoordinate(t){return this.containsXY(t[0],t[1])}computeExtent(t){return U()}getExtent(t){if(this.extentRevision_!=this.getRevision()){const e=this.computeExtent(this.extent_);(isNaN(e[0])||isNaN(e[1]))&&Ws(e),this.extentRevision_=this.getRevision()}return $d(this.extent_,t)}rotate(t,e){U()}scale(t,e,i){U()}simplify(t){return this.getSimplifiedGeometry(t*t)}getSimplifiedGeometry(t){return U()}getType(){return U()}applyTransform(t){U()}intersectsExtent(t){return U()}translate(t,e){U()}transform(t,e){const i=Ot(t),s=i.getUnits()=="tile-pixels"?function(r,o,a){const l=i.getExtent(),h=i.getWorldExtent(),c=It(h)/It(l);Oe(ch,h[0],h[3],c,-c,0,0,0);const u=ei(r,0,r.length,a,ch,o),d=ir(i,e);return d?d(u,u,a):u}:ir(i,e);return this.applyTransform(s),this}}class wo extends Df{constructor(){super(),this.layout="XY",this.stride=2,this.flatCoordinates}computeExtent(t){return to(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t)}getCoordinates(){return U()}getFirstCoordinate(){return this.flatCoordinates.slice(0,this.stride)}getFlatCoordinates(){return this.flatCoordinates}getLastCoordinate(){return this.flatCoordinates.slice(this.flatCoordinates.length-this.stride)}getLayout(){return this.layout}getSimplifiedGeometry(t){if(this.simplifiedGeometryRevision!==this.getRevision()&&(this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=this.getRevision()),t<0||this.simplifiedGeometryMaxMinSquaredTolerance!==0&&t<=this.simplifiedGeometryMaxMinSquaredTolerance)return this;const e=this.getSimplifiedGeometryInternal(t);return e.getFlatCoordinates().length<this.flatCoordinates.length?e:(this.simplifiedGeometryMaxMinSquaredTolerance=t,this)}getSimplifiedGeometryInternal(t){return this}getStride(){return this.stride}setFlatCoordinates(t,e){this.stride=uh(t),this.layout=t,this.flatCoordinates=e}setCoordinates(t,e){U()}setLayout(t,e,i){let s;if(t)s=uh(t);else{for(let r=0;r<i;++r){if(e.length===0){this.layout="XY",this.stride=2;return}e=e[0]}s=e.length,t=Ff(s)}this.layout=t,this.stride=s}applyTransform(t){this.flatCoordinates&&(t(this.flatCoordinates,this.flatCoordinates,this.layout.startsWith("XYZ")?3:2,this.stride),this.changed())}rotate(t,e){const i=this.getFlatCoordinates();if(i){const s=this.getStride();hh(i,0,i.length,s,t,e,i),this.changed()}}scale(t,e,i){e===void 0&&(e=t),i||(i=xi(this.getExtent()));const s=this.getFlatCoordinates();if(s){const r=this.getStride();Mf(s,0,s.length,r,t,e,i,s),this.changed()}}translate(t,e){const i=this.getFlatCoordinates();if(i){const s=this.getStride();Pf(i,0,i.length,s,t,e,i),this.changed()}}}function Ff(n){let t;return n==2?t="XY":n==3?t="XYZ":n==4&&(t="XYZM"),t}function uh(n){let t;return n=="XY"?t=2:n=="XYZ"||n=="XYM"?t=3:n=="XYZM"&&(t=4),t}function kf(n,t,e){const i=n.getFlatCoordinates();if(!i)return null;const s=n.getStride();return ei(i,0,i.length,s,t,e)}function dh(n,t,e,i){let s=0;const r=n[e-i],o=n[e-i+1];let a=0,l=0;for(;t<e;t+=i){const h=n[t]-r,c=n[t+1]-o;s+=l*h-a*c,a=h,l=c}return s/2}function Nf(n,t,e,i){let s=0;for(let r=0,o=e.length;r<o;++r){const a=e[r];s+=dh(n,t,a,i),t=a}return s}function fh(n,t,e,i,s,r,o){const a=n[t],l=n[t+1],h=n[e]-a,c=n[e+1]-l;let u;if(h===0&&c===0)u=t;else{const d=((s-a)*h+(r-l)*c)/(h*h+c*c);if(d>1)u=e;else if(d>0){for(let f=0;f<i;++f)o[f]=qt(n[t+f],n[e+f],d);o.length=i;return}else u=t}for(let d=0;d<i;++d)o[d]=n[u+d];o.length=i}function gh(n,t,e,i,s){let r=n[t],o=n[t+1];for(t+=i;t<e;t+=i){const a=n[t],l=n[t+1],h=Zi(r,o,a,l);h>s&&(s=h),r=a,o=l}return s}function Gf(n,t,e,i,s){for(let r=0,o=e.length;r<o;++r){const a=e[r];s=gh(n,t,a,i,s),t=a}return s}function _h(n,t,e,i,s,r,o,a,l,h,c){if(t==e)return h;let u,d;if(s===0){if(d=Zi(o,a,n[t],n[t+1]),d<h){for(u=0;u<i;++u)l[u]=n[t+u];return l.length=i,d}return h}c=c||[NaN,NaN];let f=t+i;for(;f<e;)if(fh(n,f-i,f,i,o,a,c),d=Zi(o,a,c[0],c[1]),d<h){for(h=d,u=0;u<i;++u)l[u]=c[u];l.length=i,f+=i}else f+=i*Math.max((Math.sqrt(d)-Math.sqrt(h))/s|0,1);if(fh(n,e-i,t,i,o,a,c),d=Zi(o,a,c[0],c[1]),d<h){for(h=d,u=0;u<i;++u)l[u]=c[u];l.length=i}return h}function zf(n,t,e,i,s,r,o,a,l,h,c){c=c||[NaN,NaN];for(let u=0,d=e.length;u<d;++u){const f=e[u];h=_h(n,t,f,i,s,r,o,a,l,h,c),t=f}return h}function Xf(n,t,e,i){for(let s=0,r=e.length;s<r;++s)n[t++]=e[s];return t}function mh(n,t,e,i){for(let s=0,r=e.length;s<r;++s){const o=e[s];for(let a=0;a<i;++a)n[t++]=o[a]}return t}function Wf(n,t,e,i,s){s=s||[];let r=0;for(let o=0,a=e.length;o<a;++o){const l=mh(n,t,e[o],i);s[r++]=l,t=l}return s.length=r,s}function Ji(n,t,e,i,s){s=s!==void 0?s:[];let r=0;for(let o=t;o<e;o+=i)s[r++]=n.slice(o,o+i);return s.length=r,s}function nr(n,t,e,i,s){s=s!==void 0?s:[];let r=0;for(let o=0,a=e.length;o<a;++o){const l=e[o];s[r++]=Ji(n,t,l,i,s[r]),t=l}return s.length=r,s}function ph(n,t,e,i,s){s=s!==void 0?s:[];let r=0;for(let o=0,a=e.length;o<a;++o){const l=e[o];s[r++]=l.length===1&&l[0]===t?[]:nr(n,t,l,i,s[r]),t=l[l.length-1]}return s.length=r,s}function vo(n,t,e,i,s,r,o){const a=(e-t)/i;if(a<3){for(;t<e;t+=i)r[o++]=n[t],r[o++]=n[t+1];return o}const l=new Array(a);l[0]=1,l[a-1]=1;const h=[t,e-i];let c=0;for(;h.length>0;){const u=h.pop(),d=h.pop();let f=0;const g=n[d],m=n[d+1],_=n[u],p=n[u+1];for(let y=d+i;y<u;y+=i){const v=n[y],E=n[y+1],x=Bd(v,E,g,m,_,p);x>f&&(c=y,f=x)}f>s&&(l[(c-t)/i]=1,d+i<c&&h.push(d,c),c+i<u&&h.push(c,u))}for(let u=0;u<a;++u)l[u]&&(r[o++]=n[t+u*i],r[o++]=n[t+u*i+1]);return o}function Yf(n,t,e,i,s,r,o,a){for(let l=0,h=e.length;l<h;++l){const c=e[l];o=vo(n,t,c,i,s,r,o),a.push(o),t=c}return o}function Ti(n,t){return t*Math.round(n/t)}function $f(n,t,e,i,s,r,o){if(t==e)return o;let a=Ti(n[t],s),l=Ti(n[t+1],s);t+=i,r[o++]=a,r[o++]=l;let h,c;do if(h=Ti(n[t],s),c=Ti(n[t+1],s),t+=i,t==e)return r[o++]=h,r[o++]=c,o;while(h==a&&c==l);for(;t<e;){const u=Ti(n[t],s),d=Ti(n[t+1],s);if(t+=i,u==h&&d==c)continue;const f=h-a,g=c-l,m=u-a,_=d-l;if(f*_==g*m&&(f<0&&m<f||f==m||f>0&&m>f)&&(g<0&&_<g||g==_||g>0&&_>g)){h=u,c=d;continue}r[o++]=h,r[o++]=c,a=h,l=c,h=u,c=d}return r[o++]=h,r[o++]=c,o}function yh(n,t,e,i,s,r,o,a){for(let l=0,h=e.length;l<h;++l){const c=e[l];o=$f(n,t,c,i,s,r,o),a.push(o),t=c}return o}class $n extends wo{constructor(t,e){super(),this.maxDelta_=-1,this.maxDeltaRevision_=-1,e!==void 0&&!Array.isArray(t[0])?this.setFlatCoordinates(e,t):this.setCoordinates(t,e)}clone(){return new $n(this.flatCoordinates.slice(),this.layout)}closestPointXY(t,e,i,s){return s<Ol(this.getExtent(),t,e)?s:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(gh(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),_h(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!0,t,e,i,s))}getArea(){return dh(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinates(){return Ji(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getSimplifiedGeometryInternal(t){const e=[];return e.length=vo(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e,0),new $n(e,"XY")}getType(){return"LinearRing"}intersectsExtent(t){return!1}setCoordinates(t,e){this.setLayout(e,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=mh(this.flatCoordinates,0,t,this.stride),this.changed()}}class sr extends wo{constructor(t,e){super(),this.setCoordinates(t,e)}clone(){const t=new sr(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(t,e,i,s){const r=this.flatCoordinates,o=Zi(t,e,r[0],r[1]);if(o<s){const a=this.stride;for(let l=0;l<a;++l)i[l]=r[l];return i.length=a,o}return s}getCoordinates(){return this.flatCoordinates.slice()}computeExtent(t){return Fl(this.flatCoordinates,t)}getType(){return"Point"}intersectsExtent(t){return Dl(t,this.flatCoordinates[0],this.flatCoordinates[1])}setCoordinates(t,e){this.setLayout(e,t,0),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Xf(this.flatCoordinates,0,t,this.stride),this.changed()}}function Kf(n,t,e,i,s){return!Gl(s,function(o){return!Ii(n,t,e,i,o[0],o[1])})}function Ii(n,t,e,i,s,r){let o=0,a=n[e-i],l=n[e-i+1];for(;t<e;t+=i){const h=n[t],c=n[t+1];l<=r?c>r&&(h-a)*(r-l)-(s-a)*(c-l)>0&&o++:c<=r&&(h-a)*(r-l)-(s-a)*(c-l)<0&&o--,a=h,l=c}return o!==0}function Eh(n,t,e,i,s,r){if(e.length===0||!Ii(n,t,e[0],i,s,r))return!1;for(let o=1,a=e.length;o<a;++o)if(Ii(n,e[o-1],e[o],i,s,r))return!1;return!0}function Co(n,t,e,i,s,r,o){let a,l,h,c,u,d,f;const g=s[r+1],m=[];for(let y=0,v=e.length;y<v;++y){const E=e[y];for(c=n[E-i],d=n[E-i+1],a=t;a<E;a+=i)u=n[a],f=n[a+1],(g<=d&&f<=g||d<=g&&g<=f)&&(h=(g-d)/(f-d)*(u-c)+c,m.push(h)),c=u,d=f}let _=NaN,p=-1/0;for(m.sort(Ae),c=m[0],a=1,l=m.length;a<l;++a){u=m[a];const y=Math.abs(u-c);y>p&&(h=(c+u)/2,Eh(n,t,e,i,h,g)&&(_=h,p=y)),c=u}return isNaN(_)&&(_=s[r]),o?(o.push(_,g,p),o):[_,g,p]}function Bf(n,t,e,i,s){let r=[];for(let o=0,a=e.length;o<a;++o){const l=e[o];r=Co(n,t,l,i,s,2*o,r),t=l[l.length-1]}return r}function Zf(n,t,e,i,s){let r;for(t+=i;t<e;t+=i)if(r=s(n.slice(t-i,t),n.slice(t,t+i)),r)return r;return!1}function xh(n,t,e,i,s,r){return r=r??Nl(Yt(),n,t,e,i),Pt(s,r)?r[0]>=s[0]&&r[2]<=s[2]||r[1]>=s[1]&&r[3]<=s[3]?!0:Zf(n,t,e,i,function(o,a){return Kd(s,o,a)}):!1}function wh(n,t,e,i,s){return!!(xh(n,t,e,i,s)||Ii(n,t,e,i,s[0],s[1])||Ii(n,t,e,i,s[0],s[3])||Ii(n,t,e,i,s[2],s[1])||Ii(n,t,e,i,s[2],s[3]))}function Uf(n,t,e,i,s){if(!wh(n,t,e[0],i,s))return!1;if(e.length===1)return!0;for(let r=1,o=e.length;r<o;++r)if(Kf(n,e[r-1],e[r],i,s)&&!xh(n,e[r-1],e[r],i,s))return!1;return!0}function Vf(n,t,e,i){for(;t<e-i;){for(let s=0;s<i;++s){const r=n[t+s];n[t+s]=n[e-i+s],n[e-i+s]=r}t+=i,e-=i}}function Ro(n,t,e,i){let s=0,r=n[e-i],o=n[e-i+1];for(;t<e;t+=i){const a=n[t],l=n[t+1];s+=(a-r)*(l+o),r=a,o=l}return s===0?void 0:s>0}function jf(n,t,e,i,s){s=s!==void 0?s:!1;for(let r=0,o=e.length;r<o;++r){const a=e[r],l=Ro(n,t,a,i);if(r===0){if(s&&l||!s&&!l)return!1}else if(s&&!l||!s&&l)return!1;t=a}return!0}function vh(n,t,e,i,s){s=s!==void 0?s:!1;for(let r=0,o=e.length;r<o;++r){const a=e[r],l=Ro(n,t,a,i);(r===0?s&&l||!s&&!l:s&&!l||!s&&l)&&Vf(n,t,a,i),t=a}return t}function Hf(n,t){const e=[];let i=0,s=0,r;for(let o=0,a=t.length;o<a;++o){const l=t[o],h=Ro(n,i,l,2);if(r===void 0&&(r=h),h===r)e.push(t.slice(s,o+1));else{if(e.length===0)continue;e[e.length-1].push(t[s])}s=o+1,i=l}return e}class Kn extends wo{constructor(t,e,i){super(),this.ends_=[],this.flatInteriorPointRevision_=-1,this.flatInteriorPoint_=null,this.maxDelta_=-1,this.maxDeltaRevision_=-1,this.orientedRevision_=-1,this.orientedFlatCoordinates_=null,e!==void 0&&i?(this.setFlatCoordinates(e,t),this.ends_=i):this.setCoordinates(t,e)}appendLinearRing(t){this.flatCoordinates?Hr(this.flatCoordinates,t.getFlatCoordinates()):this.flatCoordinates=t.getFlatCoordinates().slice(),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){const t=new Kn(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return t.applyProperties(this),t}closestPointXY(t,e,i,s){return s<Ol(this.getExtent(),t,e)?s:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Gf(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),zf(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!0,t,e,i,s))}containsXY(t,e){return Eh(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,e)}getArea(){return Nf(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride)}getCoordinates(t){let e;return t!==void 0?(e=this.getOrientedFlatCoordinates().slice(),vh(e,0,this.ends_,this.stride,t)):e=this.flatCoordinates,nr(e,0,this.ends_,this.stride)}getEnds(){return this.ends_}getFlatInteriorPoint(){if(this.flatInteriorPointRevision_!=this.getRevision()){const t=xi(this.getExtent());this.flatInteriorPoint_=Co(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,0),this.flatInteriorPointRevision_=this.getRevision()}return this.flatInteriorPoint_}getInteriorPoint(){return new sr(this.getFlatInteriorPoint(),"XYM")}getLinearRingCount(){return this.ends_.length}getLinearRing(t){return t<0||this.ends_.length<=t?null:new $n(this.flatCoordinates.slice(t===0?0:this.ends_[t-1],this.ends_[t]),this.layout)}getLinearRings(){const t=this.layout,e=this.flatCoordinates,i=this.ends_,s=[];let r=0;for(let o=0,a=i.length;o<a;++o){const l=i[o],h=new $n(e.slice(r,l),t);s.push(h),r=l}return s}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){const t=this.flatCoordinates;jf(t,0,this.ends_,this.stride)?this.orientedFlatCoordinates_=t:(this.orientedFlatCoordinates_=t.slice(),this.orientedFlatCoordinates_.length=vh(this.orientedFlatCoordinates_,0,this.ends_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(t){const e=[],i=[];return e.length=yh(this.flatCoordinates,0,this.ends_,this.stride,Math.sqrt(t),e,0,i),new Kn(e,"XY",i)}getType(){return"Polygon"}intersectsExtent(t){return Uf(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,2),this.flatCoordinates||(this.flatCoordinates=[]);const i=Wf(this.flatCoordinates,0,t,this.stride,this.ends_);this.flatCoordinates.length=i.length===0?0:i[i.length-1],this.changed()}}function Ch(n){if(Bs(n))throw new Error("Cannot create polygon from empty extent");const t=n[0],e=n[1],i=n[2],s=n[3],r=[t,e,t,s,i,s,i,e,t,e];return new Kn(r,"XY",[r.length])}function Rh(n,t,e,i,s,r,o){let a,l;const h=(e-t)/i;if(h===1)a=t;else if(h===2)a=t,l=s;else if(h!==0){let c=n[t],u=n[t+1],d=0;const f=[0];for(let _=t+i;_<e;_+=i){const p=n[_],y=n[_+1];d+=Math.sqrt((p-c)*(p-c)+(y-u)*(y-u)),f.push(d),c=p,u=y}const g=s*d,m=Od(f,g);m<0?(l=(g-f[-m-2])/(f[-m-1]-f[-m-2]),a=t+(-m-2)*i):a=t+m*i}o=o>1?o:2,r=r||new Array(o);for(let c=0;c<o;++c)r[c]=a===void 0?NaN:l===void 0?n[a+c]:qt(n[a+c],n[a+i+c],l);return r}function qf(n,t,e,i){let s=n[t],r=n[t+1],o=0;for(let a=t+i;a<e;a+=i){const l=n[a],h=n[a+1];o+=Math.sqrt((l-s)*(l-s)+(h-r)*(h-r)),s=l,r=h}return o}const Qt={PRERENDER:"prerender",POSTRENDER:"postrender",PRECOMPOSE:"precompose",POSTCOMPOSE:"postcompose",RENDERCOMPLETE:"rendercomplete"},Si=typeof navigator<"u"&&typeof navigator.userAgent<"u"?navigator.userAgent.toLowerCase():"";Si.includes("safari")&&!Si.includes("chrom")&&(Si.includes("version/15.4")||/cpu (os|iphone os) 15_4 like mac os x/.test(Si));const Jf=Si.includes("webkit")&&!Si.includes("edge"),Th=Si.includes("macintosh"),Qf=typeof devicePixelRatio<"u"?devicePixelRatio:1,$t=typeof WorkerGlobalScope<"u"&&typeof OffscreenCanvas<"u"&&self instanceof WorkerGlobalScope,Ih=typeof Image<"u"&&Image.prototype.decode,Sh=(function(){let n=!1;try{const t=Object.defineProperty({},"passive",{get:function(){n=!0}});window.addEventListener("_",null,t),window.removeEventListener("_",null,t)}catch{}return n})(),X={IDLE:0,LOADING:1,LOADED:2,ERROR:3};function ht(n,t,e,i){let s;return e&&e.length?s=e.shift():$t?s=new class extends OffscreenCanvas{style={}}(n??300,t??150):s=document.createElement("canvas"),n&&(s.width=n),t&&(s.height=t),s.getContext("2d",i)}let To;function rr(){return To||(To=ht(1,1)),To}function or(n){const t=n.canvas;t.width=1,t.height=1,n.clearRect(0,0,1,1)}function tg(n){let t=n.offsetWidth;const e=getComputedStyle(n);return t+=parseInt(e.marginLeft,10)+parseInt(e.marginRight,10),t}function eg(n){let t=n.offsetHeight;const e=getComputedStyle(n);return t+=parseInt(e.marginTop,10)+parseInt(e.marginBottom,10),t}function bh(n,t){const e=t.parentNode;e&&e.replaceChild(n,t)}function Lh(n){for(;n.lastChild;)n.lastChild.remove()}function ig(n,t){const e=n.childNodes;for(let i=0;;++i){const s=e[i],r=t[i];if(!s&&!r)break;if(s!==r){if(!s){n.appendChild(r);continue}if(!r){n.removeChild(s),--i;continue}n.insertBefore(r,s)}}}function Ah(){return new Proxy({childNodes:[],appendChild:function(t){return this.childNodes.push(t),t},remove:function(){},removeChild:function(t){const e=this.childNodes.indexOf(t);if(e===-1)throw new Error("Node to remove was not found");return this.childNodes.splice(e,1),t},insertBefore:function(t,e){const i=this.childNodes.indexOf(e);if(i===-1)throw new Error("Reference node not found");return this.childNodes.splice(i,0,t),t},style:{}},{get(t,e,i){return e==="firstElementChild"?t.childNodes.length>0?t.childNodes[0]:null:Reflect.get(t,e,i)}})}function ii(n){return typeof HTMLCanvasElement<"u"&&n instanceof HTMLCanvasElement||typeof OffscreenCanvas<"u"&&n instanceof OffscreenCanvas}const Io=[NaN,NaN,NaN,0];let So;function ng(){return So||(So=ht(1,1,void 0,{willReadFrequently:!0,desynchronized:!0})),So}const sg=/^rgba?\(\s*(\d+%?)\s+(\d+%?)\s+(\d+%?)(?:\s*\/\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,rg=/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,og=/^rgba?\(\s*(\d+%)\s*,\s*(\d+%)\s*,\s*(\d+%)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,ag=/^#([\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$/i;function ar(n,t){return n.endsWith("%")?Number(n.substring(0,n.length-1))/t:Number(n)}function Bn(n){throw new Error('failed to parse "'+n+'" as color')}function Mh(n){if(n.toLowerCase().startsWith("rgb")){const r=n.match(rg)||n.match(sg)||n.match(og);if(r){const o=r[4],a=100/255;return[rt(ar(r[1],a)+.5|0,0,255),rt(ar(r[2],a)+.5|0,0,255),rt(ar(r[3],a)+.5|0,0,255),o!==void 0?rt(ar(o,100),0,1):1]}Bn(n)}if(n.startsWith("#")){if(ag.test(n)){const r=n.substring(1),o=r.length<=4?1:2,a=[0,0,0,255];for(let l=0,h=r.length;l<h;l+=o){let c=parseInt(r.substring(l,l+o),16);o===1&&(c+=c<<4),a[l/o]=c}return a[3]=a[3]/255,a}Bn(n)}const t=ng();t.fillStyle="#abcdef";let e=t.fillStyle;t.fillStyle=n,t.fillStyle===e&&(t.fillStyle="#fedcba",e=t.fillStyle,t.fillStyle=n,t.fillStyle===e&&Bn(n));const i=t.fillStyle;if(i.startsWith("#")||i.startsWith("rgba"))return Mh(i);t.clearRect(0,0,1,1),t.fillRect(0,0,1,1);const s=Array.from(t.getImageData(0,0,1,1).data);return s[3]=Zs(s[3]/255,3),s}function lg(n){return typeof n=="string"?n:Do(n)}const hg=1024,Zn={};let bo=0;function cg(n){if(n.length===4)return n;const t=n.slice();return t[3]=1,t}function Lo(n){return n>.0031308?Math.pow(n,1/2.4)*269.025-14.025:n*3294.6}function Ao(n){return n>.2068965?Math.pow(n,3):(n-4/29)*(108/841)}function Mo(n){return n>10.314724?Math.pow((n+14.025)/269.025,2.4):n/3294.6}function Po(n){return n>.0088564?Math.pow(n,1/3):n/(108/841)+4/29}function Ph(n){const t=Mo(n[0]),e=Mo(n[1]),i=Mo(n[2]),s=Po(t*.222488403+e*.716873169+i*.06060791),r=500*(Po(t*.452247074+e*.399439023+i*.148375274)-s),o=200*(s-Po(t*.016863605+e*.117638439+i*.865350722)),a=Math.atan2(o,r)*(180/Math.PI);return[116*s-16,Math.sqrt(r*r+o*o),a<0?a+360:a,n[3]]}function ug(n){const t=(n[0]+16)/116,e=n[1],i=n[2]*Math.PI/180,s=Ao(t),r=Ao(t+e/500*Math.cos(i)),o=Ao(t-e/200*Math.sin(i)),a=Lo(r*3.021973625-s*1.617392459-o*.404875592),l=Lo(r*-.943766287+s*1.916279586+o*.027607165),h=Lo(r*.069407491-s*.22898585+o*1.159737864);return[rt(a+.5|0,0,255),rt(l+.5|0,0,255),rt(h+.5|0,0,255),n[3]]}function Oo(n){if(n==="none")return Io;if(Zn.hasOwnProperty(n))return Zn[n];if(bo>=hg){let e=0;for(const i in Zn)(e++&3)===0&&(delete Zn[i],--bo)}const t=Mh(n);t.length!==4&&Bn(n);for(const e of t)isNaN(e)&&Bn(n);return Zn[n]=t,++bo,t}function Qi(n){return Array.isArray(n)?n:Oo(n)}function Do(n){let t=n[0];t!=(t|0)&&(t=t+.5|0);let e=n[1];e!=(e|0)&&(e=e+.5|0);let i=n[2];i!=(i|0)&&(i=i+.5|0);const s=n[3]===void 0?1:Math.round(n[3]*1e3)/1e3;return"rgba("+t+","+e+","+i+","+s+")"}function dg(n,t,e){const i=n;let s=!0,r=!1,o=!1;const a=[zs(i,z.LOAD,function(){o=!0,r||t()})];return i.src&&Ih?(r=!0,i.decode().then(function(){s&&t()}).catch(function(l){s&&(o?t():e())})):a.push(zs(i,z.ERROR,e)),function(){s=!1,a.forEach(nt)}}function fg(n,t){return new Promise((e,i)=>{function s(){o(),e(n)}function r(){o(),i(new Error("Image load error"))}function o(){n.removeEventListener("load",s),n.removeEventListener("error",r)}n.addEventListener("load",s),n.addEventListener("error",r)})}function gg(n,t){return t&&(n.src=t),n.src&&Ih?new Promise((e,i)=>n.decode().then(()=>e(n)).catch(s=>n.complete&&n.width?e(n):i(s))):fg(n)}class _g{constructor(){this.cache_={},this.patternCache_={},this.cacheSize_=0,this.maxCacheSize_=1024}clear(){this.cache_={},this.patternCache_={},this.cacheSize_=0}canExpireCache(){return this.cacheSize_>this.maxCacheSize_}expire(){if(this.canExpireCache()){let t=0;for(const e in this.cache_){const i=this.cache_[e];(t++&3)===0&&!i.hasListener()&&(delete this.cache_[e],delete this.patternCache_[e],--this.cacheSize_)}}}get(t,e,i){const s=Fo(t,e,i);return s in this.cache_?this.cache_[s]:null}getPattern(t,e,i){const s=Fo(t,e,i);return s in this.patternCache_?this.patternCache_[s]:null}set(t,e,i,s,r){const o=Fo(t,e,i),a=o in this.cache_;this.cache_[o]=s,r&&(s.getImageState()===X.IDLE&&s.load(),s.getImageState()===X.LOADING?s.ready().then(()=>{this.patternCache_[o]=rr().createPattern(s.getImage(1),"repeat")}):this.patternCache_[o]=rr().createPattern(s.getImage(1),"repeat")),a||++this.cacheSize_}setSize(t){this.maxCacheSize_=t,this.expire()}}function Fo(n,t,e){const i=e?Qi(e):"null";return t+":"+n+":"+i}const te=new _g;let Un=null;class Oh extends Gs{constructor(t,e,i,s,r){super(),this.hitDetectionImage_=null,this.image_=t,this.crossOrigin_=i,this.canvas_={},this.color_=r,this.imageState_=s===void 0?X.IDLE:s,this.size_=t&&t.width&&t.height?[t.width,t.height]:null,this.src_=e,this.tainted_,this.ready_=null}initializeImage_(){this.image_=new Image,this.crossOrigin_!==null&&(this.image_.crossOrigin=this.crossOrigin_)}isTainted_(){if(this.tainted_===void 0&&this.imageState_===X.LOADED){Un||(Un=ht(1,1,void 0,{willReadFrequently:!0})),Un.drawImage(this.image_,0,0);try{Un.getImageData(0,0,1,1),this.tainted_=!1}catch{Un=null,this.tainted_=!0}}return this.tainted_===!0}dispatchChangeEvent_(){this.dispatchEvent(z.CHANGE)}handleImageError_(){this.imageState_=X.ERROR,this.dispatchChangeEvent_()}handleImageLoad_(){this.imageState_=X.LOADED,this.size_=[this.image_.width,this.image_.height],this.dispatchChangeEvent_()}getImage(t){return this.image_||this.initializeImage_(),this.replaceColor_(t),this.canvas_[t]?this.canvas_[t]:this.image_}getPixelRatio(t){return this.replaceColor_(t),this.canvas_[t]?t:1}getImageState(){return this.imageState_}getHitDetectionImage(){if(this.image_||this.initializeImage_(),!this.hitDetectionImage_)if(this.isTainted_()){const t=this.size_[0],e=this.size_[1],i=ht(t,e);i.fillRect(0,0,t,e),this.hitDetectionImage_=i.canvas}else this.hitDetectionImage_=this.image_;return this.hitDetectionImage_}getSize(){return this.size_}getSrc(){return this.src_}load(){if(this.imageState_===X.IDLE){this.image_||this.initializeImage_(),this.imageState_=X.LOADING;try{this.src_!==void 0&&(this.image_.src=this.src_)}catch{this.handleImageError_()}this.image_ instanceof HTMLImageElement&&gg(this.image_,this.src_).then(t=>{this.image_=t,this.handleImageLoad_()}).catch(this.handleImageError_.bind(this))}}replaceColor_(t){if(!this.color_||this.canvas_[t]||this.imageState_!==X.LOADED)return;const e=this.image_,i=ht(Math.ceil(e.width*t),Math.ceil(e.height*t)),s=i.canvas;i.scale(t,t),i.drawImage(e,0,0),i.globalCompositeOperation="multiply",i.fillStyle=lg(this.color_),i.fillRect(0,0,s.width/t,s.height/t),i.globalCompositeOperation="destination-in",i.drawImage(e,0,0),this.canvas_[t]=s}ready(){return this.ready_||(this.ready_=new Promise(t=>{if(this.imageState_===X.LOADED||this.imageState_===X.ERROR)t();else{const e=()=>{(this.imageState_===X.LOADED||this.imageState_===X.ERROR)&&(this.removeEventListener(z.CHANGE,e),t())};this.addEventListener(z.CHANGE,e)}})),this.ready_}}function lr(n,t,e,i,s,r){let o=t===void 0?void 0:te.get(t,e,s);return o||(o=new Oh(n,n&&"src"in n?n.src||void 0:t,e,i,s),te.set(t,e,s,o,r)),r&&o&&!te.getPattern(t,e,s)&&te.set(t,e,s,o,r),o}function ye(n){return n?Array.isArray(n)?Do(n):typeof n=="object"&&"src"in n?mg(n):n:null}function mg(n){if(!n.offset||!n.size)return te.getPattern(n.src,"anonymous",n.color);const t=n.src+":"+n.offset,e=te.getPattern(t,void 0,n.color);if(e)return e;const i=te.get(n.src,"anonymous",null);if(i.getImageState()!==X.LOADED)return null;const s=ht(n.size[0],n.size[1]);return s.drawImage(i.getImage(1),n.offset[0],n.offset[1],n.size[0],n.size[1],0,0,n.size[0],n.size[1]),lr(s.canvas,t,void 0,X.LOADED,n.color,!0),te.getPattern(t,void 0,n.color)}class Dh{drawCustom(t,e,i,s,r){}drawGeometry(t){}setStyle(t){}drawCircle(t,e,i){}drawFeature(t,e,i){}drawGeometryCollection(t,e,i){}drawLineString(t,e,i){}drawMultiLineString(t,e,i){}drawMultiPoint(t,e,i){}drawMultiPolygon(t,e,i){}drawPoint(t,e,i){}drawPolygon(t,e,i){}drawText(t,e,i){}setFillStrokeStyle(t,e){}setImageStyle(t,e){}setTextStyle(t,e){}}const hr="ol-hidden",pg="ol-selectable",cr="ol-unselectable",ko="ol-control",Fh="ol-collapsed",yg=new RegExp(["^\\s*(?=(?:(?:[-a-z]+\\s*){0,2}(italic|oblique))?)","(?=(?:(?:[-a-z]+\\s*){0,2}(small-caps))?)","(?=(?:(?:[-a-z]+\\s*){0,2}(bold(?:er)?|lighter|[1-9]00 ))?)","(?:(?:normal|\\1|\\2|\\3)\\s*){0,3}((?:xx?-)?","(?:small|large)|medium|smaller|larger|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx]))","(?:\\s*\\/\\s*(normal|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx])?))",`?\\s*([-,\\"\\'\\sa-z0-9]+?)\\s*$`].join(""),"i"),kh=["style","variant","weight","size","lineHeight","family"],No={normal:400,bold:700},Go=function(n){const t=n.match(yg);if(!t)return null;const e={lineHeight:"normal",size:"1.2em",style:"normal",weight:"400",variant:"normal"};for(let i=0,s=kh.length;i<s;++i){const r=t[i+1];r!==void 0&&(e[kh[i]]=typeof r=="string"?r.trim():r)}return isNaN(Number(e.weight))&&e.weight in No&&(e.weight=No[e.weight]),e.families=e.family.split(/,\s?/).map(i=>i.trim().replace(/^['"]|['"]$/g,"")),e},Nh="10px sans-serif",Dt="#000",tn="round",De=[],Fe=0,en="round",Vn=10,jn="#000",Hn="center",ur="middle",bi=[0,0,0,0],qn=1,nn=new he;let Jn=null,Gh;const zo={},Eg=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace","ui-rounded","emoji","math","fangsong"]);function xg(n,t,e){return`${n} ${t} 16px "${e}"`}const wg=(function(){let t,e;async function i(r){await e.ready;const o=await e.load(r);if(o.length===0)return!1;const a=Go(r),l=a.families[0].toLowerCase(),h=a.weight;return o.some(c=>{const u=c.family.replace(/^['"]|['"]$/g,"").toLowerCase(),d=No[c.weight]||c.weight;return u===l&&c.style===a.style&&d==h})}async function s(){await e.ready;let r=!0;const o=nn.getProperties(),a=Object.keys(o).filter(l=>o[l]<100);for(let l=a.length-1;l>=0;--l){const h=a[l];let c=o[h];c<100&&(await i(h)?(kn(zo),nn.set(h,100)):(c+=10,nn.set(h,c,!0),c<100&&(r=!1)))}t=void 0,r||(t=setTimeout(s,100))}return async function(r){e||(e=$t?self.fonts:document.fonts);const o=Go(r);if(!o)return;const a=o.families;let l=!1;for(const h of a){if(Eg.has(h))continue;const c=xg(o.style,o.weight,h);nn.get(c)===void 0&&(nn.set(c,0,!0),l=!0)}l&&(clearTimeout(t),t=setTimeout(s,100))}})(),vg=(function(){let n;return function(t){let e=zo[t];if(e==null){if($t){const i=Go(t),s=zh(t,"Žg");e=(isNaN(Number(i.lineHeight))?1.2:Number(i.lineHeight))*(s.actualBoundingBoxAscent+s.actualBoundingBoxDescent)}else n||(n=document.createElement("div"),n.innerHTML="M",n.style.minHeight="0",n.style.maxHeight="none",n.style.height="auto",n.style.padding="0",n.style.border="none",n.style.position="absolute",n.style.display="block",n.style.left="-99999px"),n.style.font=t,document.body.appendChild(n),e=n.offsetHeight,document.body.removeChild(n);zo[t]=e}return e}})();function zh(n,t){return Jn||(Jn=ht(1,1)),n!=Gh&&(Jn.font=n,Gh=Jn.font),Jn.measureText(t)}function Xh(n,t){return zh(n,t).width}function Wh(n,t,e){if(t in e)return e[t];const i=t.split(`
|
|
3
|
+
`).reduce((s,r)=>Math.max(s,Xh(n,r)),0);return e[t]=i,i}function Cg(n,t){const e=[],i=[],s=[];let r=0,o=0,a=0,l=0;for(let h=0,c=t.length;h<=c;h+=2){const u=t[h];if(u===`
|
|
4
|
+
`||h===c){r=Math.max(r,o),s.push(o),o=0,a+=l,l=0;continue}const d=t[h+1]||n.font,f=Xh(d,u);e.push(f),o+=f;const g=vg(d);i.push(g),l=Math.max(l,g)}return{width:r,height:a,widths:e,heights:i,lineWidths:s}}function Rg(n,t,e,i,s,r,o,a,l,h,c){n.save(),e!==1&&(n.globalAlpha===void 0?n.globalAlpha=u=>u.globalAlpha*=e:n.globalAlpha*=e),t&&n.transform.apply(n,t),i.contextInstructions?(n.translate(l,h),n.scale(c[0],c[1]),Tg(i,n)):c[0]<0||c[1]<0?(n.translate(l,h),n.scale(c[0],c[1]),n.drawImage(i,s,r,o,a,0,0,o,a)):n.drawImage(i,s,r,o,a,l,h,o*c[0],a*c[1]),n.restore()}function Tg(n,t){const e=n.contextInstructions;for(let i=0,s=e.length;i<s;i+=2)Array.isArray(e[i+1])?t[e[i]].apply(t,e[i+1]):t[e[i]]=e[i+1]}class Ig extends Dh{constructor(t,e,i,s,r,o,a){super(),this.context_=t,this.pixelRatio_=e,this.extent_=i,this.transform_=s,this.transformRotation_=s?Zs(Math.atan2(s[1],s[0]),10):0,this.viewRotation_=r,this.squaredTolerance_=o,this.userTransform_=a,this.contextFillState_=null,this.contextStrokeState_=null,this.contextTextState_=null,this.fillState_=null,this.strokeState_=null,this.image_=null,this.imageAnchorX_=0,this.imageAnchorY_=0,this.imageHeight_=0,this.imageOpacity_=0,this.imageOriginX_=0,this.imageOriginY_=0,this.imageRotateWithView_=!1,this.imageRotation_=0,this.imageScale_=[0,0],this.imageWidth_=0,this.text_="",this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=!1,this.textRotation_=0,this.textScale_=[0,0],this.textFillState_=null,this.textStrokeState_=null,this.textState_=null,this.pixelCoordinates_=[],this.tmpLocalTransform_=ce()}drawImages_(t,e,i,s){if(!this.image_)return;const r=ei(t,e,i,s,this.transform_,this.pixelCoordinates_),o=this.context_,a=this.tmpLocalTransform_,l=o.globalAlpha;this.imageOpacity_!=1&&(o.globalAlpha=l*this.imageOpacity_);let h=this.imageRotation_;this.transformRotation_===0&&(h-=this.viewRotation_),this.imageRotateWithView_&&(h+=this.viewRotation_);for(let c=0,u=r.length;c<u;c+=2){const d=r[c]-this.imageAnchorX_,f=r[c+1]-this.imageAnchorY_;if(h!==0||this.imageScale_[0]!=1||this.imageScale_[1]!=1){const g=d+this.imageAnchorX_,m=f+this.imageAnchorY_;Oe(a,g,m,1,1,h,-g,-m),o.save(),o.transform.apply(o,a),o.translate(g,m),o.scale(this.imageScale_[0],this.imageScale_[1]),o.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,-this.imageAnchorX_,-this.imageAnchorY_,this.imageWidth_,this.imageHeight_),o.restore()}else o.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,d,f,this.imageWidth_,this.imageHeight_)}this.imageOpacity_!=1&&(o.globalAlpha=l)}drawText_(t,e,i,s){if(!this.textState_||this.text_==="")return;this.textFillState_&&this.setContextFillState_(this.textFillState_),this.textStrokeState_&&this.setContextStrokeState_(this.textStrokeState_),this.setContextTextState_(this.textState_);const r=ei(t,e,i,s,this.transform_,this.pixelCoordinates_),o=this.context_;let a=this.textRotation_;for(this.transformRotation_===0&&(a-=this.viewRotation_),this.textRotateWithView_&&(a+=this.viewRotation_);e<i;e+=s){const l=r[e]+this.textOffsetX_,h=r[e+1]+this.textOffsetY_;a!==0||this.textScale_[0]!=1||this.textScale_[1]!=1?(o.save(),o.translate(l-this.textOffsetX_,h-this.textOffsetY_),o.rotate(a),o.translate(this.textOffsetX_,this.textOffsetY_),o.scale(this.textScale_[0],this.textScale_[1]),this.textStrokeState_&&o.strokeText(this.text_,0,0),this.textFillState_&&o.fillText(this.text_,0,0),o.restore()):(this.textStrokeState_&&o.strokeText(this.text_,l,h),this.textFillState_&&o.fillText(this.text_,l,h))}}moveToLineTo_(t,e,i,s,r){const o=this.context_,a=ei(t,e,i,s,this.transform_,this.pixelCoordinates_);o.moveTo(a[0],a[1]);let l=a.length;r&&(l-=2);for(let h=2;h<l;h+=2)o.lineTo(a[h],a[h+1]);return r&&o.closePath(),i}drawRings_(t,e,i,s){for(let r=0,o=i.length;r<o;++r)e=this.moveToLineTo_(t,e,i[r],s,!0);return e}drawCircle(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!Pt(this.extent_,t.getExtent())){if(this.fillState_||this.strokeState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const e=kf(t,this.transform_,this.pixelCoordinates_),i=e[2]-e[0],s=e[3]-e[1],r=Math.sqrt(i*i+s*s),o=this.context_;o.beginPath(),o.arc(e[0],e[1],r,0,2*Math.PI),this.fillState_&&o.fill(),this.strokeState_&&o.stroke()}this.text_!==""&&this.drawText_(t.getCenter(),0,2,2)}}setStyle(t){this.setFillStrokeStyle(t.getFill(),t.getStroke()),this.setImageStyle(t.getImage()),this.setTextStyle(t.getText())}setTransform(t){this.transform_=t}drawGeometry(t){switch(t.getType()){case"Point":this.drawPoint(t);break;case"LineString":this.drawLineString(t);break;case"Polygon":this.drawPolygon(t);break;case"MultiPoint":this.drawMultiPoint(t);break;case"MultiLineString":this.drawMultiLineString(t);break;case"MultiPolygon":this.drawMultiPolygon(t);break;case"GeometryCollection":this.drawGeometryCollection(t);break;case"Circle":this.drawCircle(t);break}}drawFeature(t,e){const i=e.getGeometryFunction()(t);i&&(this.setStyle(e),this.drawGeometry(i))}drawGeometryCollection(t){const e=t.getGeometriesArray();for(let i=0,s=e.length;i<s;++i)this.drawGeometry(e[i])}drawPoint(t){this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_));const e=t.getFlatCoordinates(),i=t.getStride();this.image_&&this.drawImages_(e,0,e.length,i),this.text_!==""&&this.drawText_(e,0,e.length,i)}drawMultiPoint(t){this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_));const e=t.getFlatCoordinates(),i=t.getStride();this.image_&&this.drawImages_(e,0,e.length,i),this.text_!==""&&this.drawText_(e,0,e.length,i)}drawLineString(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!Pt(this.extent_,t.getExtent())){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);const e=this.context_,i=t.getFlatCoordinates();e.beginPath(),this.moveToLineTo_(i,0,i.length,t.getStride(),!1),e.stroke()}if(this.text_!==""){const e=t.getFlatMidpoint();this.drawText_(e,0,2,2)}}}drawMultiLineString(t){this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_));const e=t.getExtent();if(Pt(this.extent_,e)){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);const i=this.context_,s=t.getFlatCoordinates();let r=0;const o=t.getEnds(),a=t.getStride();i.beginPath();for(let l=0,h=o.length;l<h;++l)r=this.moveToLineTo_(s,r,o[l],a,!1);i.stroke()}if(this.text_!==""){const i=t.getFlatMidpoints();this.drawText_(i,0,i.length,2)}}}drawPolygon(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!Pt(this.extent_,t.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const e=this.context_;e.beginPath(),this.drawRings_(t.getOrientedFlatCoordinates(),0,t.getEnds(),t.getStride()),this.fillState_&&e.fill(),this.strokeState_&&e.stroke()}if(this.text_!==""){const e=t.getFlatInteriorPoint();this.drawText_(e,0,2,2)}}}drawMultiPolygon(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!Pt(this.extent_,t.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const e=this.context_,i=t.getOrientedFlatCoordinates();let s=0;const r=t.getEndss(),o=t.getStride();e.beginPath();for(let a=0,l=r.length;a<l;++a){const h=r[a];s=this.drawRings_(i,s,h,o)}this.fillState_&&e.fill(),this.strokeState_&&e.stroke()}if(this.text_!==""){const e=t.getFlatInteriorPoints();this.drawText_(e,0,e.length,2)}}}setContextFillState_(t){const e=this.context_,i=this.contextFillState_;i?i.fillStyle!=t.fillStyle&&(i.fillStyle=t.fillStyle,e.fillStyle=t.fillStyle):(e.fillStyle=t.fillStyle,this.contextFillState_={fillStyle:t.fillStyle})}setContextStrokeState_(t){const e=this.context_,i=this.contextStrokeState_;i?(i.lineCap!=t.lineCap&&(i.lineCap=t.lineCap,e.lineCap=t.lineCap),qe(i.lineDash,t.lineDash)||e.setLineDash(i.lineDash=t.lineDash),i.lineDashOffset!=t.lineDashOffset&&(i.lineDashOffset=t.lineDashOffset,e.lineDashOffset=t.lineDashOffset),i.lineJoin!=t.lineJoin&&(i.lineJoin=t.lineJoin,e.lineJoin=t.lineJoin),i.lineWidth!=t.lineWidth&&(i.lineWidth=t.lineWidth,e.lineWidth=t.lineWidth),i.miterLimit!=t.miterLimit&&(i.miterLimit=t.miterLimit,e.miterLimit=t.miterLimit),i.strokeStyle!=t.strokeStyle&&(i.strokeStyle=t.strokeStyle,e.strokeStyle=t.strokeStyle)):(e.lineCap=t.lineCap,e.setLineDash(t.lineDash),e.lineDashOffset=t.lineDashOffset,e.lineJoin=t.lineJoin,e.lineWidth=t.lineWidth,e.miterLimit=t.miterLimit,e.strokeStyle=t.strokeStyle,this.contextStrokeState_={lineCap:t.lineCap,lineDash:t.lineDash,lineDashOffset:t.lineDashOffset,lineJoin:t.lineJoin,lineWidth:t.lineWidth,miterLimit:t.miterLimit,strokeStyle:t.strokeStyle})}setContextTextState_(t){const e=this.context_,i=this.contextTextState_,s=t.textAlign?t.textAlign:Hn;i?(i.font!=t.font&&(i.font=t.font,e.font=t.font),i.textAlign!=s&&(i.textAlign=s,e.textAlign=s),i.textBaseline!=t.textBaseline&&(i.textBaseline=t.textBaseline,e.textBaseline=t.textBaseline)):(e.font=t.font,e.textAlign=s,e.textBaseline=t.textBaseline,this.contextTextState_={font:t.font,textAlign:s,textBaseline:t.textBaseline})}setFillStrokeStyle(t,e){if(!t)this.fillState_=null;else{const i=t.getColor();this.fillState_={fillStyle:ye(i||Dt)}}if(!e)this.strokeState_=null;else{const i=e.getColor(),s=e.getLineCap(),r=e.getLineDash(),o=e.getLineDashOffset(),a=e.getLineJoin(),l=e.getWidth(),h=e.getMiterLimit(),c=r||De;this.strokeState_={lineCap:s!==void 0?s:tn,lineDash:this.pixelRatio_===1?c:c.map(u=>u*this.pixelRatio_),lineDashOffset:(o||Fe)*this.pixelRatio_,lineJoin:a!==void 0?a:en,lineWidth:(l!==void 0?l:qn)*this.pixelRatio_,miterLimit:h!==void 0?h:Vn,strokeStyle:ye(i||jn)}}}setImageStyle(t){let e;if(!t||!(e=t.getSize())){this.image_=null;return}const i=t.getPixelRatio(this.pixelRatio_),s=t.getAnchor(),r=t.getOrigin();this.image_=t.getImage(this.pixelRatio_),this.imageAnchorX_=s[0]*i,this.imageAnchorY_=s[1]*i,this.imageHeight_=e[1]*i,this.imageOpacity_=t.getOpacity(),this.imageOriginX_=r[0],this.imageOriginY_=r[1],this.imageRotateWithView_=t.getRotateWithView(),this.imageRotation_=t.getRotation();const o=t.getScaleArray();this.imageScale_=[o[0]*this.pixelRatio_/i,o[1]*this.pixelRatio_/i],this.imageWidth_=e[0]*i}setTextStyle(t){if(!t)this.text_="";else{const e=t.getFill();if(!e)this.textFillState_=null;else{const f=e.getColor();this.textFillState_={fillStyle:ye(f||Dt)}}const i=t.getStroke();if(!i)this.textStrokeState_=null;else{const f=i.getColor(),g=i.getLineCap(),m=i.getLineDash(),_=i.getLineDashOffset(),p=i.getLineJoin(),y=i.getWidth(),v=i.getMiterLimit();this.textStrokeState_={lineCap:g!==void 0?g:tn,lineDash:m||De,lineDashOffset:_||Fe,lineJoin:p!==void 0?p:en,lineWidth:y!==void 0?y:qn,miterLimit:v!==void 0?v:Vn,strokeStyle:ye(f||jn)}}const s=t.getFont(),r=t.getOffsetX(),o=t.getOffsetY(),a=t.getRotateWithView(),l=t.getRotation(),h=t.getScaleArray(),c=t.getText(),u=t.getTextAlign(),d=t.getTextBaseline();this.textState_={font:s!==void 0?s:Nh,textAlign:u!==void 0?u:Hn,textBaseline:d!==void 0?d:ur},this.text_=c!==void 0?Array.isArray(c)?c.reduce((f,g,m)=>f+=m%2?" ":g,""):c:"",this.textOffsetX_=r!==void 0?this.pixelRatio_*r:0,this.textOffsetY_=o!==void 0?this.pixelRatio_*o:0,this.textRotateWithView_=a!==void 0?a:!1,this.textRotation_=l!==void 0?l:0,this.textScale_=[this.pixelRatio_*h[0],this.pixelRatio_*h[1]]}}}const Sg=.5,Yh={Point:Fg,LineString:Pg,Polygon:Ng,MultiPoint:kg,MultiLineString:Og,MultiPolygon:Dg,GeometryCollection:Mg,Circle:Lg};function bg(n,t){return parseInt(V(n),10)-parseInt(V(t),10)}function $h(n,t){const e=Kh(n,t);return e*e}function Kh(n,t){return Sg*n/t}function Lg(n,t,e,i,s){const r=e.getFill(),o=e.getStroke();if(r||o){const l=n.getBuilder(e.getZIndex(),"Circle");l.setFillStrokeStyle(r,o),l.drawCircle(t,i,s)}const a=e.getText();if(a&&a.getText()){const l=n.getBuilder(e.getZIndex(),"Text");l.setTextStyle(a),l.drawText(t,i)}}function Bh(n,t,e,i,s,r,o,a){const l=[],h=e.getImage();if(h){let d=!0;const f=h.getImageState();f==X.LOADED||f==X.ERROR?d=!1:f==X.IDLE&&h.load(),d&&l.push(h.ready())}const c=e.getFill();c&&c.loading()&&l.push(c.ready());const u=l.length>0;return u&&Promise.all(l).then(()=>s(null)),Ag(n,t,e,i,r,o,a),u}function Ag(n,t,e,i,s,r,o){const a=e.getGeometryFunction()(t);if(!a)return;const l=a.simplifyTransformed(i,s);if(e.getRenderer())Zh(n,l,e,t,o);else{const c=Yh[l.getType()];c(n,l,e,t,o,r)}}function Zh(n,t,e,i,s){if(t.getType()=="GeometryCollection"){const o=t.getGeometries();for(let a=0,l=o.length;a<l;++a)Zh(n,o[a],e,i,s);return}n.getBuilder(e.getZIndex(),"Default").drawCustom(t,i,e.getRenderer(),e.getHitDetectionRenderer(),s)}function Mg(n,t,e,i,s,r){const o=t.getGeometriesArray();let a,l;for(a=0,l=o.length;a<l;++a){const h=Yh[o[a].getType()];h(n,o[a],e,i,s,r)}}function Pg(n,t,e,i,s){const r=e.getStroke();if(r){const a=n.getBuilder(e.getZIndex(),"LineString");a.setFillStrokeStyle(null,r),a.drawLineString(t,i,s)}const o=e.getText();if(o&&o.getText()){const a=n.getBuilder(e.getZIndex(),"Text");a.setTextStyle(o),a.drawText(t,i,s)}}function Og(n,t,e,i,s){const r=e.getStroke();if(r){const a=n.getBuilder(e.getZIndex(),"LineString");a.setFillStrokeStyle(null,r),a.drawMultiLineString(t,i,s)}const o=e.getText();if(o&&o.getText()){const a=n.getBuilder(e.getZIndex(),"Text");a.setTextStyle(o),a.drawText(t,i,s)}}function Dg(n,t,e,i,s){const r=e.getFill(),o=e.getStroke();if(o||r){const l=n.getBuilder(e.getZIndex(),"Polygon");l.setFillStrokeStyle(r,o),l.drawMultiPolygon(t,i,s)}const a=e.getText();if(a&&a.getText()){const l=n.getBuilder(e.getZIndex(),"Text");l.setTextStyle(a),l.drawText(t,i,s)}}function Fg(n,t,e,i,s,r){const o=e.getImage(),a=e.getText(),l=a&&a.getText(),h=r&&o&&l?{}:void 0;if(o){if(o.getImageState()!=X.LOADED)return;const c=n.getBuilder(e.getZIndex(),"Image");c.setImageStyle(o,h),c.drawPoint(t,i,s)}if(l){const c=n.getBuilder(e.getZIndex(),"Text");c.setTextStyle(a,h),c.drawText(t,i,s)}}function kg(n,t,e,i,s,r){const o=e.getImage(),a=o&&o.getOpacity()!==0,l=e.getText(),h=l&&l.getText(),c=r&&a&&h?{}:void 0;if(a){if(o.getImageState()!=X.LOADED)return;const u=n.getBuilder(e.getZIndex(),"Image");u.setImageStyle(o,c),u.drawMultiPoint(t,i,s)}if(h){const u=n.getBuilder(e.getZIndex(),"Text");u.setTextStyle(l,c),u.drawText(t,i,s)}}function Ng(n,t,e,i,s){const r=e.getFill(),o=e.getStroke();if(r||o){const l=n.getBuilder(e.getZIndex(),"Polygon");l.setFillStrokeStyle(r,o),l.drawPolygon(t,i,s)}const a=e.getText();if(a&&a.getText()){const l=n.getBuilder(e.getZIndex(),"Text");l.setTextStyle(a),l.drawText(t,i,s)}}let Gg=!1;function zg(n,t,e,i,s,r,o){const a=new XMLHttpRequest;a.open("GET",typeof n=="function"?n(e,i,s):n,!0),t.getType()=="arraybuffer"&&(a.responseType="arraybuffer"),a.withCredentials=Gg,a.onload=function(l){if(!a.status||a.status>=200&&a.status<300){const h=t.getType();try{let c;h=="text"||h=="json"?c=a.responseText:h=="xml"?c=a.responseXML||a.responseText:h=="arraybuffer"&&(c=a.response),c?r(t.readFeatures(c,{extent:e,featureProjection:s}),t.readProjection(c)):o()}catch{o()}}else o()},a.onerror=o,a.send()}function Uh(n,t){return function(e,i,s,r,o){zg(n,t,e,i,s,(a,l)=>{this.addFeatures(a),r!==void 0&&r(a)},()=>{this.changed(),o!==void 0&&o()})}}function Xg(n,t){return[[-1/0,-1/0,1/0,1/0]]}function Wg(n,t,e,i){const s=[];let r=Yt();for(let o=0,a=e.length;o<a;++o){const l=e[o];r=to(n,t,l[0],i),s.push((r[0]+r[2])/2,(r[1]+r[3])/2),t=l[l.length-1]}return s}const Vh=ce();class ue{constructor(t,e,i,s,r,o){this.styleFunction,this.extent_,this.id_=o,this.type_=t,this.flatCoordinates_=e,this.flatInteriorPoints_=null,this.flatMidpoints_=null,this.ends_=i||null,this.properties_=r,this.squaredTolerance_,this.stride_=s,this.simplifiedGeometry_}get(t){return this.properties_[t]}getExtent(){return this.extent_||(this.extent_=this.type_==="Point"?Fl(this.flatCoordinates_):to(this.flatCoordinates_,0,this.flatCoordinates_.length,2)),this.extent_}getFlatInteriorPoint(){if(!this.flatInteriorPoints_){const t=xi(this.getExtent());this.flatInteriorPoints_=Co(this.flatCoordinates_,0,this.ends_,2,t,0)}return this.flatInteriorPoints_}getFlatInteriorPoints(){if(!this.flatInteriorPoints_){const t=Hf(this.flatCoordinates_,this.ends_),e=Wg(this.flatCoordinates_,0,t,2);this.flatInteriorPoints_=Bf(this.flatCoordinates_,0,t,2,e)}return this.flatInteriorPoints_}getFlatMidpoint(){return this.flatMidpoints_||(this.flatMidpoints_=Rh(this.flatCoordinates_,0,this.flatCoordinates_.length,2,.5)),this.flatMidpoints_}getFlatMidpoints(){if(!this.flatMidpoints_){this.flatMidpoints_=[];const t=this.flatCoordinates_;let e=0;const i=this.ends_;for(let s=0,r=i.length;s<r;++s){const o=i[s],a=Rh(t,e,o,2,.5);Hr(this.flatMidpoints_,a),e=o}}return this.flatMidpoints_}getId(){return this.id_}getOrientedFlatCoordinates(){return this.flatCoordinates_}getGeometry(){return this}getSimplifiedGeometry(t){return this}simplifyTransformed(t,e){return this}getProperties(){return this.properties_}getPropertiesInternal(){return this.properties_}getStride(){return this.stride_}getStyleFunction(){return this.styleFunction}getType(){return this.type_}transform(t){t=Ot(t);const e=t.getExtent(),i=t.getWorldExtent();if(e&&i){const s=It(i)/It(e);Oe(Vh,i[0],i[3],s,-s,0,0,0),ei(this.flatCoordinates_,0,this.flatCoordinates_.length,2,Vh,this.flatCoordinates_)}}applyTransform(t){t(this.flatCoordinates_,this.flatCoordinates_,this.stride_)}clone(){return new ue(this.type_,this.flatCoordinates_.slice(),this.ends_?.slice(),this.stride_,Object.assign({},this.properties_),this.id_)}getEnds(){return this.ends_}enableSimplifyTransformed(){return this.simplifyTransformed=bl((t,e)=>{if(t===this.squaredTolerance_)return this.simplifiedGeometry_;this.simplifiedGeometry_=this.clone(),e&&this.simplifiedGeometry_.applyTransform(e);const i=this.simplifiedGeometry_.getFlatCoordinates();let s;switch(this.type_){case"LineString":i.length=vo(i,0,this.simplifiedGeometry_.flatCoordinates_.length,this.simplifiedGeometry_.stride_,t,i,0),s=[i.length];break;case"MultiLineString":s=[],i.length=Yf(i,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,t,i,0,s);break;case"Polygon":s=[],i.length=yh(i,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,Math.sqrt(t),i,0,s);break}return s&&(this.simplifiedGeometry_=new ue(this.type_,i,s,2,this.properties_,this.id_)),this.squaredTolerance_=t,this.simplifiedGeometry_}),this}}ue.prototype.getFlatCoordinates=ue.prototype.getOrientedFlatCoordinates;function jh(n,t,e=0,i=n.length-1,s=Yg){for(;i>e;){if(i-e>600){const l=i-e+1,h=t-e+1,c=Math.log(l),u=.5*Math.exp(2*c/3),d=.5*Math.sqrt(c*u*(l-u)/l)*(h-l/2<0?-1:1),f=Math.max(e,Math.floor(t-h*u/l+d)),g=Math.min(i,Math.floor(t+(l-h)*u/l+d));jh(n,t,f,g,s)}const r=n[t];let o=e,a=i;for(Qn(n,e,t),s(n[i],r)>0&&Qn(n,e,i);o<a;){for(Qn(n,o,a),o++,a--;s(n[o],r)<0;)o++;for(;s(n[a],r)>0;)a--}s(n[e],r)===0?Qn(n,e,a):(a++,Qn(n,a,i)),a<=t&&(e=a+1),t<=a&&(i=a-1)}}function Qn(n,t,e){const i=n[t];n[t]=n[e],n[e]=i}function Yg(n,t){return n<t?-1:n>t?1:0}let Hh=class{constructor(t=9){this._maxEntries=Math.max(4,t),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4)),this.clear()}all(){return this._all(this.data,[])}search(t){let e=this.data;const i=[];if(!fr(t,e))return i;const s=this.toBBox,r=[];for(;e;){for(let o=0;o<e.children.length;o++){const a=e.children[o],l=e.leaf?s(a):a;fr(t,l)&&(e.leaf?i.push(a):Wo(t,l)?this._all(a,i):r.push(a))}e=r.pop()}return i}collides(t){let e=this.data;if(!fr(t,e))return!1;const i=[];for(;e;){for(let s=0;s<e.children.length;s++){const r=e.children[s],o=e.leaf?this.toBBox(r):r;if(fr(t,o)){if(e.leaf||Wo(t,o))return!0;i.push(r)}}e=i.pop()}return!1}load(t){if(!(t&&t.length))return this;if(t.length<this._minEntries){for(let i=0;i<t.length;i++)this.insert(t[i]);return this}let e=this._build(t.slice(),0,t.length-1,0);if(!this.data.children.length)this.data=e;else if(this.data.height===e.height)this._splitRoot(this.data,e);else{if(this.data.height<e.height){const i=this.data;this.data=e,e=i}this._insert(e,this.data.height-e.height-1,!0)}return this}insert(t){return t&&this._insert(t,this.data.height-1),this}clear(){return this.data=rn([]),this}remove(t,e){if(!t)return this;let i=this.data;const s=this.toBBox(t),r=[],o=[];let a,l,h;for(;i||r.length;){if(i||(i=r.pop(),l=r[r.length-1],a=o.pop(),h=!0),i.leaf){const c=$g(t,i.children,e);if(c!==-1)return i.children.splice(c,1),r.push(i),this._condense(r),this}!h&&!i.leaf&&Wo(i,s)?(r.push(i),o.push(a),a=0,l=i,i=i.children[0]):l?(a++,i=l.children[a],h=!1):i=null}return this}toBBox(t){return t}compareMinX(t,e){return t.minX-e.minX}compareMinY(t,e){return t.minY-e.minY}toJSON(){return this.data}fromJSON(t){return this.data=t,this}_all(t,e){const i=[];for(;t;)t.leaf?e.push(...t.children):i.push(...t.children),t=i.pop();return e}_build(t,e,i,s){const r=i-e+1;let o=this._maxEntries,a;if(r<=o)return a=rn(t.slice(e,i+1)),sn(a,this.toBBox),a;s||(s=Math.ceil(Math.log(r)/Math.log(o)),o=Math.ceil(r/Math.pow(o,s-1))),a=rn([]),a.leaf=!1,a.height=s;const l=Math.ceil(r/o),h=l*Math.ceil(Math.sqrt(o));qh(t,e,i,h,this.compareMinX);for(let c=e;c<=i;c+=h){const u=Math.min(c+h-1,i);qh(t,c,u,l,this.compareMinY);for(let d=c;d<=u;d+=l){const f=Math.min(d+l-1,u);a.children.push(this._build(t,d,f,s-1))}}return sn(a,this.toBBox),a}_chooseSubtree(t,e,i,s){for(;s.push(e),!(e.leaf||s.length-1===i);){let r=1/0,o=1/0,a;for(let l=0;l<e.children.length;l++){const h=e.children[l],c=Xo(h),u=Zg(t,h)-c;u<o?(o=u,r=c<r?c:r,a=h):u===o&&c<r&&(r=c,a=h)}e=a||e.children[0]}return e}_insert(t,e,i){const s=i?t:this.toBBox(t),r=[],o=this._chooseSubtree(s,this.data,e,r);for(o.children.push(t),es(o,s);e>=0&&r[e].children.length>this._maxEntries;)this._split(r,e),e--;this._adjustParentBBoxes(s,r,e)}_split(t,e){const i=t[e],s=i.children.length,r=this._minEntries;this._chooseSplitAxis(i,r,s);const o=this._chooseSplitIndex(i,r,s),a=rn(i.children.splice(o,i.children.length-o));a.height=i.height,a.leaf=i.leaf,sn(i,this.toBBox),sn(a,this.toBBox),e?t[e-1].children.push(a):this._splitRoot(i,a)}_splitRoot(t,e){this.data=rn([t,e]),this.data.height=t.height+1,this.data.leaf=!1,sn(this.data,this.toBBox)}_chooseSplitIndex(t,e,i){let s,r=1/0,o=1/0;for(let a=e;a<=i-e;a++){const l=ts(t,0,a,this.toBBox),h=ts(t,a,i,this.toBBox),c=Ug(l,h),u=Xo(l)+Xo(h);c<r?(r=c,s=a,o=u<o?u:o):c===r&&u<o&&(o=u,s=a)}return s||i-e}_chooseSplitAxis(t,e,i){const s=t.leaf?this.compareMinX:Kg,r=t.leaf?this.compareMinY:Bg,o=this._allDistMargin(t,e,i,s),a=this._allDistMargin(t,e,i,r);o<a&&t.children.sort(s)}_allDistMargin(t,e,i,s){t.children.sort(s);const r=this.toBBox,o=ts(t,0,e,r),a=ts(t,i-e,i,r);let l=dr(o)+dr(a);for(let h=e;h<i-e;h++){const c=t.children[h];es(o,t.leaf?r(c):c),l+=dr(o)}for(let h=i-e-1;h>=e;h--){const c=t.children[h];es(a,t.leaf?r(c):c),l+=dr(a)}return l}_adjustParentBBoxes(t,e,i){for(let s=i;s>=0;s--)es(e[s],t)}_condense(t){for(let e=t.length-1,i;e>=0;e--)t[e].children.length===0?e>0?(i=t[e-1].children,i.splice(i.indexOf(t[e]),1)):this.clear():sn(t[e],this.toBBox)}};function $g(n,t,e){if(!e)return t.indexOf(n);for(let i=0;i<t.length;i++)if(e(n,t[i]))return i;return-1}function sn(n,t){ts(n,0,n.children.length,t,n)}function ts(n,t,e,i,s){s||(s=rn(null)),s.minX=1/0,s.minY=1/0,s.maxX=-1/0,s.maxY=-1/0;for(let r=t;r<e;r++){const o=n.children[r];es(s,n.leaf?i(o):o)}return s}function es(n,t){return n.minX=Math.min(n.minX,t.minX),n.minY=Math.min(n.minY,t.minY),n.maxX=Math.max(n.maxX,t.maxX),n.maxY=Math.max(n.maxY,t.maxY),n}function Kg(n,t){return n.minX-t.minX}function Bg(n,t){return n.minY-t.minY}function Xo(n){return(n.maxX-n.minX)*(n.maxY-n.minY)}function dr(n){return n.maxX-n.minX+(n.maxY-n.minY)}function Zg(n,t){return(Math.max(t.maxX,n.maxX)-Math.min(t.minX,n.minX))*(Math.max(t.maxY,n.maxY)-Math.min(t.minY,n.minY))}function Ug(n,t){const e=Math.max(n.minX,t.minX),i=Math.max(n.minY,t.minY),s=Math.min(n.maxX,t.maxX),r=Math.min(n.maxY,t.maxY);return Math.max(0,s-e)*Math.max(0,r-i)}function Wo(n,t){return n.minX<=t.minX&&n.minY<=t.minY&&t.maxX<=n.maxX&&t.maxY<=n.maxY}function fr(n,t){return t.minX<=n.maxX&&t.minY<=n.maxY&&t.maxX>=n.minX&&t.maxY>=n.minY}function rn(n){return{children:n,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function qh(n,t,e,i,s){const r=[t,e];for(;r.length;){if(e=r.pop(),t=r.pop(),e-t<=i)continue;const o=t+Math.ceil((e-t)/i/2)*i;jh(n,o,t,e,s),r.push(t,o,o,e)}}class Jh{constructor(t){this.rbush_=new Hh(t),this.items_={}}insert(t,e){const i={minX:t[0],minY:t[1],maxX:t[2],maxY:t[3],value:e};this.rbush_.insert(i),this.items_[V(e)]=i}load(t,e){const i=new Array(e.length);for(let s=0,r=e.length;s<r;s++){const o=t[s],a=e[s],l={minX:o[0],minY:o[1],maxX:o[2],maxY:o[3],value:a};i[s]=l,this.items_[V(a)]=l}this.rbush_.load(i)}remove(t){const e=V(t),i=this.items_[e];return delete this.items_[e],this.rbush_.remove(i)!==null}update(t,e){const i=this.items_[V(e)],s=[i.minX,i.minY,i.maxX,i.maxY];Gn(s,t)||(this.remove(e),this.insert(t,e))}getAll(){return this.rbush_.all().map(function(e){return e.value})}getInExtent(t){const e={minX:t[0],minY:t[1],maxX:t[2],maxY:t[3]};return this.rbush_.search(e).map(function(s){return s.value})}forEach(t){return this.forEach_(this.getAll(),t)}forEachInExtent(t,e){return this.forEach_(this.getInExtent(t),e)}forEach_(t,e){let i;for(let s=0,r=t.length;s<r;s++)if(i=e(t[s]),i)return i;return i}isEmpty(){return $i(this.items_)}clear(){this.rbush_.clear(),this.items_={}}getExtent(t){const e=this.rbush_.toJSON();return Je(e.minX,e.minY,e.maxX,e.maxY,t)}concat(t){this.rbush_.load(t.rbush_.all());for(const e in t.items_)this.items_[e]=t.items_[e]}}class Qh extends he{constructor(t){super(),this.projection=Ot(t.projection),this.attributions_=tc(t.attributions),this.attributionsCollapsible_=t.attributionsCollapsible??!0,this.loading=!1,this.state_=t.state!==void 0?t.state:"ready",this.wrapX_=t.wrapX!==void 0?t.wrapX:!1,this.interpolate_=!!t.interpolate,this.viewResolver=null,this.viewRejector=null;const e=this;this.viewPromise_=new Promise(function(i,s){e.viewResolver=i,e.viewRejector=s})}getAttributions(){return this.attributions_}getAttributionsCollapsible(){return this.attributionsCollapsible_}getProjection(){return this.projection}getResolutions(t){return null}getView(){return this.viewPromise_}getState(){return this.state_}getWrapX(){return this.wrapX_}getInterpolate(){return this.interpolate_}refresh(){this.changed()}setAttributions(t){this.attributions_=tc(t),this.changed()}setState(t){this.state_=t,this.changed()}}function tc(n){return n?typeof n=="function"?n:(Array.isArray(n)||(n=[n]),t=>n):null}const ee={ADDFEATURE:"addfeature",CHANGEFEATURE:"changefeature",CLEAR:"clear",REMOVEFEATURE:"removefeature",FEATURESLOADSTART:"featuresloadstart",FEATURESLOADEND:"featuresloadend",FEATURESLOADERROR:"featuresloaderror"};class ni extends Me{constructor(t,e,i){super(t),this.feature=e,this.features=i}}class Vg extends Qh{constructor(t){t=t||{},super({attributions:t.attributions,interpolate:!0,projection:void 0,state:"ready",wrapX:t.wrapX!==void 0?t.wrapX:!0}),this.on,this.once,this.un,this.loader_=Fn,this.format_=t.format||null,this.overlaps_=t.overlaps===void 0?!0:t.overlaps,this.url_=t.url,t.loader!==void 0?this.loader_=t.loader:this.url_!==void 0&&(q(this.format_,"`format` must be set when `url` is set"),this.loader_=Uh(this.url_,this.format_)),this.strategy_=t.strategy!==void 0?t.strategy:Xg;const e=t.useSpatialIndex!==void 0?t.useSpatialIndex:!0;this.featuresRtree_=e?new Jh:null,this.loadedExtentsRtree_=new Jh,this.loadingExtentsCount_=0,this.nullGeometryFeatures_={},this.idIndex_={},this.uidIndex_={},this.featureChangeKeys_={},this.featuresCollection_=null;let i,s;Array.isArray(t.features)?s=t.features:t.features&&(i=t.features,s=i.getArray()),!e&&i===void 0&&(i=new Ht(s)),s!==void 0&&this.addFeaturesInternal(s),i!==void 0&&this.bindFeaturesCollection_(i)}addFeature(t){this.addFeatureInternal(t),this.changed()}addFeatureInternal(t){const e=V(t);if(!this.addToIndex_(e,t)){this.featuresCollection_&&this.featuresCollection_.remove(t);return}this.setupChangeEvents_(e,t);const i=t.getGeometry();if(i){const s=i.getExtent();this.featuresRtree_&&this.featuresRtree_.insert(s,t)}else this.nullGeometryFeatures_[e]=t;this.dispatchEvent(new ni(ee.ADDFEATURE,t))}setupChangeEvents_(t,e){e instanceof ue||(this.featureChangeKeys_[t]=[Z(e,z.CHANGE,this.handleFeatureChange_,this),Z(e,Yi.PROPERTYCHANGE,this.handleFeatureChange_,this)])}addToIndex_(t,e){let i=!0;if(e.getId()!==void 0){const s=String(e.getId());if(!(s in this.idIndex_))this.idIndex_[s]=e;else if(e instanceof ue){const r=this.idIndex_[s];r instanceof ue?Array.isArray(r)?r.push(e):this.idIndex_[s]=[r,e]:i=!1}else i=!1}return i&&(q(!(t in this.uidIndex_),"The passed `feature` was already added to the source"),this.uidIndex_[t]=e),i}addFeatures(t){this.addFeaturesInternal(t),this.changed()}addFeaturesInternal(t){const e=[],i=[],s=[];for(let r=0,o=t.length;r<o;r++){const a=t[r],l=V(a);this.addToIndex_(l,a)&&i.push(a)}for(let r=0,o=i.length;r<o;r++){const a=i[r],l=V(a);this.setupChangeEvents_(l,a);const h=a.getGeometry();if(h){const c=h.getExtent();e.push(c),s.push(a)}else this.nullGeometryFeatures_[l]=a}if(this.featuresRtree_&&this.featuresRtree_.load(e,s),this.hasListener(ee.ADDFEATURE))for(let r=0,o=i.length;r<o;r++)this.dispatchEvent(new ni(ee.ADDFEATURE,i[r]))}bindFeaturesCollection_(t){let e=!1;this.addEventListener(ee.ADDFEATURE,function(i){e||(e=!0,t.push(i.feature),e=!1)}),this.addEventListener(ee.REMOVEFEATURE,function(i){e||(e=!0,t.remove(i.feature),e=!1)}),t.addEventListener(Mt.ADD,i=>{e||(e=!0,this.addFeature(i.element),e=!1)}),t.addEventListener(Mt.REMOVE,i=>{e||(e=!0,this.removeFeature(i.element),e=!1)}),this.featuresCollection_=t}clear(t){if(t){for(const i in this.featureChangeKeys_)this.featureChangeKeys_[i].forEach(nt);this.featuresCollection_||(this.featureChangeKeys_={},this.idIndex_={},this.uidIndex_={})}else if(this.featuresRtree_){this.featuresRtree_.forEach(i=>{this.removeFeatureInternal(i)});for(const i in this.nullGeometryFeatures_)this.removeFeatureInternal(this.nullGeometryFeatures_[i])}this.featuresCollection_&&this.featuresCollection_.clear(),this.featuresRtree_&&this.featuresRtree_.clear(),this.nullGeometryFeatures_={};const e=new ni(ee.CLEAR);this.dispatchEvent(e),this.changed()}forEachFeature(t){if(this.featuresRtree_)return this.featuresRtree_.forEach(t);this.featuresCollection_&&this.featuresCollection_.forEach(t)}forEachFeatureAtCoordinateDirect(t,e){const i=[t[0],t[1],t[0],t[1]];return this.forEachFeatureInExtent(i,function(s){const r=s.getGeometry();if(r instanceof ue||r.intersectsCoordinate(t))return e(s)})}forEachFeatureInExtent(t,e){if(this.featuresRtree_)return this.featuresRtree_.forEachInExtent(t,e);this.featuresCollection_&&this.featuresCollection_.forEach(e)}forEachFeatureIntersectingExtent(t,e){return this.forEachFeatureInExtent(t,function(i){const s=i.getGeometry();if(s instanceof ue||s.intersectsExtent(t)){const r=e(i);if(r)return r}})}getFeaturesCollection(){return this.featuresCollection_}getFeatures(){let t;return this.featuresCollection_?t=this.featuresCollection_.getArray().slice(0):this.featuresRtree_&&(t=this.featuresRtree_.getAll(),$i(this.nullGeometryFeatures_)||Hr(t,Object.values(this.nullGeometryFeatures_))),t}getFeaturesAtCoordinate(t){const e=[];return this.forEachFeatureAtCoordinateDirect(t,function(i){e.push(i)}),e}getFeaturesInExtent(t,e){if(this.featuresRtree_){if(!(e&&e.canWrapX()&&this.getWrapX()))return this.featuresRtree_.getInExtent(t);const s=Wl(t,e);return[].concat(...s.map(r=>this.featuresRtree_.getInExtent(r)))}return this.featuresCollection_?this.featuresCollection_.getArray().slice(0):[]}getClosestFeatureToCoordinate(t,e){const i=t[0],s=t[1];let r=null;const o=[NaN,NaN];let a=1/0;const l=[-1/0,-1/0,1/0,1/0];return e=e||Dn,this.featuresRtree_.forEachInExtent(l,function(h){if(e(h)){const c=h.getGeometry(),u=a;if(a=c instanceof ue?0:c.closestPointXY(i,s,o,a),a<u){r=h;const d=Math.sqrt(a);l[0]=i-d,l[1]=s-d,l[2]=i+d,l[3]=s+d}}}),r}getExtent(t){return this.featuresRtree_.getExtent(t)}getFeatureById(t){const e=this.idIndex_[t.toString()];return e!==void 0?e:null}getFeatureByUid(t){const e=this.uidIndex_[t];return e!==void 0?e:null}getFormat(){return this.format_}getOverlaps(){return this.overlaps_}getUrl(){return this.url_}handleFeatureChange_(t){const e=t.target,i=V(e),s=e.getGeometry();if(!s)i in this.nullGeometryFeatures_||(this.featuresRtree_&&this.featuresRtree_.remove(e),this.nullGeometryFeatures_[i]=e);else{const o=s.getExtent();i in this.nullGeometryFeatures_?(delete this.nullGeometryFeatures_[i],this.featuresRtree_&&this.featuresRtree_.insert(o,e)):this.featuresRtree_&&this.featuresRtree_.update(o,e)}const r=e.getId();if(r!==void 0){const o=r.toString();this.idIndex_[o]!==e&&(this.removeFromIdIndex_(e),this.idIndex_[o]=e)}else this.removeFromIdIndex_(e),this.uidIndex_[i]=e;this.changed(),this.dispatchEvent(new ni(ee.CHANGEFEATURE,e))}hasFeature(t){const e=t.getId();return e!==void 0?e in this.idIndex_:V(t)in this.uidIndex_}isEmpty(){return this.featuresRtree_?this.featuresRtree_.isEmpty()&&$i(this.nullGeometryFeatures_):this.featuresCollection_?this.featuresCollection_.getLength()===0:!0}loadFeatures(t,e,i){const s=this.loadedExtentsRtree_,r=this.strategy_(t,e,i);for(let o=0,a=r.length;o<a;++o){const l=r[o];s.forEachInExtent(l,function(c){return Bi(c.extent,l)})||(++this.loadingExtentsCount_,this.dispatchEvent(new ni(ee.FEATURESLOADSTART)),this.loader_.call(this,l,e,i,c=>{--this.loadingExtentsCount_,this.dispatchEvent(new ni(ee.FEATURESLOADEND,void 0,c))},()=>{--this.loadingExtentsCount_,this.dispatchEvent(new ni(ee.FEATURESLOADERROR))}),s.insert(l,{extent:l.slice()}))}this.loading=this.loader_.length<4?!1:this.loadingExtentsCount_>0}refresh(){this.clear(!0),this.loadedExtentsRtree_.clear(),super.refresh()}removeLoadedExtent(t){const e=this.loadedExtentsRtree_,i=e.forEachInExtent(t,function(s){if(Gn(s.extent,t))return s});i&&e.remove(i)}removeFeatures(t){let e=!1;for(let i=0,s=t.length;i<s;++i)e=this.removeFeatureInternal(t[i])||e;e&&this.changed()}removeFeature(t){if(!t)return;this.removeFeatureInternal(t)&&this.changed()}removeFeatureInternal(t){const e=V(t);if(!(e in this.uidIndex_))return!1;e in this.nullGeometryFeatures_?delete this.nullGeometryFeatures_[e]:this.featuresRtree_&&this.featuresRtree_.remove(t),this.featureChangeKeys_[e]?.forEach(nt),delete this.featureChangeKeys_[e];const s=t.getId();if(s!==void 0){const r=s.toString(),o=this.idIndex_[r];o===t?delete this.idIndex_[r]:Array.isArray(o)&&(o.splice(o.indexOf(t),1),o.length===1&&(this.idIndex_[r]=o[0]))}return delete this.uidIndex_[e],this.hasListener(ee.REMOVEFEATURE)&&this.dispatchEvent(new ni(ee.REMOVEFEATURE,t)),!0}removeFromIdIndex_(t){for(const e in this.idIndex_)if(this.idIndex_[e]===t){delete this.idIndex_[e];break}}setLoader(t){this.loader_=t}setUrl(t){q(this.format_,"`format` must be set when `url` is set"),this.url_=t,this.setLoader(Uh(t,this.format_))}setOverlaps(t){this.overlaps_=t,this.changed()}}class on{constructor(t){t=t||{},this.patternImage_=null,this.color_=null,t.color!==void 0&&this.setColor(t.color)}clone(){const t=this.getColor();return new on({color:Array.isArray(t)?t.slice():t||void 0})}getColor(){return this.color_}setColor(t){if(t!==null&&typeof t=="object"&&"src"in t){const e=lr(null,t.src,"anonymous",void 0,t.offset?null:t.color?t.color:null,!(t.offset&&t.size));e.ready().then(()=>{this.patternImage_=null}),e.getImageState()===X.IDLE&&e.load(),e.getImageState()===X.LOADING&&(this.patternImage_=e)}this.color_=t}getKey(){const t=this.getColor();return t?t instanceof CanvasPattern||t instanceof CanvasGradient?V(t):typeof t=="object"&&"src"in t?t.src+":"+t.offset:Qi(t).toString():""}loading(){return!!this.patternImage_}ready(){return this.patternImage_?this.patternImage_.ready():Promise.resolve()}}class gr{constructor(t){t=t||{},this.color_=t.color!==void 0?t.color:null,this.lineCap_=t.lineCap,this.lineDash_=t.lineDash!==void 0?t.lineDash:null,this.lineDashOffset_=t.lineDashOffset,this.lineJoin_=t.lineJoin,this.miterLimit_=t.miterLimit,this.width_=t.width}clone(){const t=this.getColor();return new gr({color:Array.isArray(t)?t.slice():t||void 0,lineCap:this.getLineCap(),lineDash:this.getLineDash()?this.getLineDash().slice():void 0,lineDashOffset:this.getLineDashOffset(),lineJoin:this.getLineJoin(),miterLimit:this.getMiterLimit(),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_}getWidth(){return this.width_}setColor(t){this.color_=t}setLineCap(t){this.lineCap_=t}setLineDash(t){this.lineDash_=t}setLineDashOffset(t){this.lineDashOffset_=t}setLineJoin(t){this.lineJoin_=t}setMiterLimit(t){this.miterLimit_=t}setWidth(t){this.width_=t}}function ec(n){return n[0]>0&&n[1]>0}function jg(n,t,e){return e===void 0&&(e=[0,0]),e[0]=n[0]*t+.5|0,e[1]=n[1]*t+.5|0,e}function Ft(n,t){return Array.isArray(n)?n:(t===void 0?t=[n,n]:(t[0]=n,t[1]=n),t)}class _r{constructor(t){this.opacity_=t.opacity,this.rotateWithView_=t.rotateWithView,this.rotation_=t.rotation,this.scale_=t.scale,this.scaleArray_=Ft(t.scale),this.displacement_=t.displacement,this.declutterMode_=t.declutterMode}clone(){const t=this.getScale();return new _r({opacity:this.getOpacity(),scale:Array.isArray(t)?t.slice():t,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()})}getOpacity(){return this.opacity_}getRotateWithView(){return this.rotateWithView_}getRotation(){return this.rotation_}getScale(){return this.scale_}getScaleArray(){return this.scaleArray_}getDisplacement(){return this.displacement_}getDeclutterMode(){return this.declutterMode_}getAnchor(){return U()}getImage(t){return U()}getHitDetectionImage(){return U()}getPixelRatio(t){return 1}getImageState(){return U()}getImageSize(){return U()}getOrigin(){return U()}getSize(){return U()}setDisplacement(t){this.displacement_=t}setOpacity(t){this.opacity_=t}setRotateWithView(t){this.rotateWithView_=t}setRotation(t){this.rotation_=t}setScale(t){this.scale_=t,this.scaleArray_=Ft(t)}listenImageChange(t){U()}load(){U()}unlistenImageChange(t){U()}ready(){return Promise.resolve()}}class mr extends _r{constructor(t){super({opacity:1,rotateWithView:t.rotateWithView!==void 0?t.rotateWithView:!1,rotation:t.rotation!==void 0?t.rotation:0,scale:t.scale!==void 0?t.scale:1,displacement:t.displacement!==void 0?t.displacement:[0,0],declutterMode:t.declutterMode}),this.hitDetectionCanvas_=null,this.fill_=t.fill!==void 0?t.fill:null,this.origin_=[0,0],this.points_=t.points,this.radius=t.radius,this.radius2_=t.radius2,this.angle_=t.angle!==void 0?t.angle:0,this.stroke_=t.stroke!==void 0?t.stroke:null,this.size_,this.renderOptions_,this.imageState_=this.fill_&&this.fill_.loading()?X.LOADING:X.LOADED,this.imageState_===X.LOADING&&this.ready().then(()=>this.imageState_=X.LOADED),this.render()}clone(){const t=this.getScale(),e=new mr({fill:this.getFill()?this.getFill().clone():void 0,points:this.getPoints(),radius:this.getRadius(),radius2:this.getRadius2(),angle:this.getAngle(),stroke:this.getStroke()?this.getStroke().clone():void 0,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),scale:Array.isArray(t)?t.slice():t,displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()});return e.setOpacity(this.getOpacity()),e}getAnchor(){const t=this.size_,e=this.getDisplacement(),i=this.getScaleArray();return[t[0]/2-e[0]/i[0],t[1]/2+e[1]/i[1]]}getAngle(){return this.angle_}getFill(){return this.fill_}setFill(t){this.fill_=t,this.render()}getHitDetectionImage(){return this.hitDetectionCanvas_||(this.hitDetectionCanvas_=this.createHitDetectionCanvas_(this.renderOptions_)),this.hitDetectionCanvas_}getImage(t){const e=this.fill_?.getKey(),i=`${t},${this.angle_},${this.radius},${this.radius2_},${this.points_},${e}`+Object.values(this.renderOptions_).join(",");let s=te.get(i,null,null)?.getImage(1);if(!s){const r=this.renderOptions_,o=Math.ceil(r.size*t),a=ht(o,o);this.draw_(r,a,t),s=a.canvas,te.set(i,null,null,new Oh(s,void 0,null,X.LOADED,null))}return s}getPixelRatio(t){return t}getImageSize(){return this.size_}getImageState(){return this.imageState_}getOrigin(){return this.origin_}getPoints(){return this.points_}getRadius(){return this.radius}getRadius2(){return this.radius2_}getSize(){return this.size_}getStroke(){return this.stroke_}setStroke(t){this.stroke_=t,this.render()}listenImageChange(t){}load(){}unlistenImageChange(t){}calculateLineJoinSize_(t,e,i){if(e===0||this.points_===1/0||t!=="bevel"&&t!=="miter")return e;let s=this.radius,r=this.radius2_===void 0?s:this.radius2_;if(s<r){const w=s;s=r,r=w}const o=this.radius2_===void 0?this.points_:this.points_*2,a=2*Math.PI/o,l=r*Math.sin(a),h=Math.sqrt(r*r-l*l),c=s-h,u=Math.sqrt(l*l+c*c),d=u/l;if(t==="miter"&&d<=i)return d*e;const f=e/2/d,g=e/2*(c/u),_=Math.sqrt((s+f)*(s+f)+g*g)-s;if(this.radius2_===void 0||t==="bevel")return _*2;const p=s*Math.sin(a),y=Math.sqrt(s*s-p*p),v=r-y,x=Math.sqrt(p*p+v*v)/p;if(x<=i){const w=x*e/2-r-s;return 2*Math.max(_,w)}return _*2}createRenderOptions(){let t=tn,e=en,i=0,s=null,r=0,o,a=0;this.stroke_&&(o=ye(this.stroke_.getColor()??jn),a=this.stroke_.getWidth()??qn,s=this.stroke_.getLineDash(),r=this.stroke_.getLineDashOffset()??0,e=this.stroke_.getLineJoin()??en,t=this.stroke_.getLineCap()??tn,i=this.stroke_.getMiterLimit()??Vn);const l=this.calculateLineJoinSize_(e,a,i),h=Math.max(this.radius,this.radius2_||0),c=Math.ceil(2*h+l);return{strokeStyle:o,strokeWidth:a,size:c,lineCap:t,lineDash:s,lineDashOffset:r,lineJoin:e,miterLimit:i}}render(){this.renderOptions_=this.createRenderOptions();const t=this.renderOptions_.size;this.hitDetectionCanvas_=null,this.size_=[t,t]}draw_(t,e,i){if(e.scale(i,i),e.translate(t.size/2,t.size/2),this.createPath_(e),this.fill_){let s=this.fill_.getColor();s===null&&(s=Dt),e.fillStyle=ye(s),e.fill()}t.strokeStyle&&(e.strokeStyle=t.strokeStyle,e.lineWidth=t.strokeWidth,t.lineDash&&(e.setLineDash(t.lineDash),e.lineDashOffset=t.lineDashOffset),e.lineCap=t.lineCap,e.lineJoin=t.lineJoin,e.miterLimit=t.miterLimit,e.stroke())}createHitDetectionCanvas_(t){let e;if(this.fill_){let i=this.fill_.getColor(),s=0;typeof i=="string"&&(i=Qi(i)),i===null?s=1:Array.isArray(i)&&(s=i.length===4?i[3]:1),s===0&&(e=ht(t.size,t.size),this.drawHitDetectionCanvas_(t,e))}return e?e.canvas:this.getImage(1)}createPath_(t){let e=this.points_;const i=this.radius;if(e===1/0)t.arc(0,0,i,0,2*Math.PI);else{const s=this.radius2_===void 0?i:this.radius2_;this.radius2_!==void 0&&(e*=2);const r=this.angle_-Math.PI/2,o=2*Math.PI/e;for(let a=0;a<e;a++){const l=r+a*o,h=a%2===0?i:s;t.lineTo(h*Math.cos(l),h*Math.sin(l))}t.closePath()}}drawHitDetectionCanvas_(t,e){e.translate(t.size/2,t.size/2),this.createPath_(e),e.fillStyle=Dt,e.fill(),t.strokeStyle&&(e.strokeStyle=t.strokeStyle,e.lineWidth=t.strokeWidth,t.lineDash&&(e.setLineDash(t.lineDash),e.lineDashOffset=t.lineDashOffset),e.lineJoin=t.lineJoin,e.miterLimit=t.miterLimit,e.stroke())}ready(){return this.fill_?this.fill_.ready():Promise.resolve()}}class pr extends mr{constructor(t){t=t||{radius:5},super({points:1/0,fill:t.fill,radius:t.radius,stroke:t.stroke,scale:t.scale!==void 0?t.scale:1,rotation:t.rotation!==void 0?t.rotation:0,rotateWithView:t.rotateWithView!==void 0?t.rotateWithView:!1,displacement:t.displacement!==void 0?t.displacement:[0,0],declutterMode:t.declutterMode})}clone(){const t=this.getScale(),e=new pr({fill:this.getFill()?this.getFill().clone():void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,radius:this.getRadius(),scale:Array.isArray(t)?t.slice():t,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()});return e.setOpacity(this.getOpacity()),e}setRadius(t){this.radius=t,this.render()}}class ke{constructor(t){t=t||{},this.geometry_=null,this.geometryFunction_=nc,t.geometry!==void 0&&this.setGeometry(t.geometry),this.fill_=t.fill!==void 0?t.fill:null,this.image_=t.image!==void 0?t.image:null,this.renderer_=t.renderer!==void 0?t.renderer:null,this.hitDetectionRenderer_=t.hitDetectionRenderer!==void 0?t.hitDetectionRenderer:null,this.stroke_=t.stroke!==void 0?t.stroke:null,this.text_=t.text!==void 0?t.text:null,this.zIndex_=t.zIndex}clone(){let t=this.getGeometry();return t&&typeof t=="object"&&(t=t.clone()),new ke({geometry:t??void 0,fill:this.getFill()?this.getFill().clone():void 0,image:this.getImage()?this.getImage().clone():void 0,renderer:this.getRenderer()??void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,text:this.getText()?this.getText().clone():void 0,zIndex:this.getZIndex()})}getRenderer(){return this.renderer_}setRenderer(t){this.renderer_=t}setHitDetectionRenderer(t){this.hitDetectionRenderer_=t}getHitDetectionRenderer(){return this.hitDetectionRenderer_}getGeometry(){return this.geometry_}getGeometryFunction(){return this.geometryFunction_}getFill(){return this.fill_}setFill(t){this.fill_=t}getImage(){return this.image_}setImage(t){this.image_=t}getStroke(){return this.stroke_}setStroke(t){this.stroke_=t}getText(){return this.text_}setText(t){this.text_=t}getZIndex(){return this.zIndex_}setGeometry(t){typeof t=="function"?this.geometryFunction_=t:typeof t=="string"?this.geometryFunction_=function(e){return e.get(t)}:t?t!==void 0&&(this.geometryFunction_=function(){return t}):this.geometryFunction_=nc,this.geometry_=t}setZIndex(t){this.zIndex_=t}}function Hg(n){let t;if(typeof n=="function")t=n;else{let e;Array.isArray(n)?e=n:(q(typeof n.getZIndex=="function","Expected an `Style` or an array of `Style`"),e=[n]),t=function(){return e}}return t}let Yo=null;function ic(n,t){if(!Yo){const e=new on({color:"rgba(255,255,255,0.4)"}),i=new gr({color:"#3399CC",width:1.25});Yo=[new ke({image:new pr({fill:e,stroke:i,radius:5}),fill:e,stroke:i})]}return Yo}function nc(n){return n.getGeometry()}const qg="#333";let Jg=class uu{constructor(t){t=t||{},this.font_=t.font,this.rotation_=t.rotation,this.rotateWithView_=t.rotateWithView,this.keepUpright_=t.keepUpright,this.scale_=t.scale,this.scaleArray_=Ft(t.scale!==void 0?t.scale:1),this.text_=t.text,this.textAlign_=t.textAlign,this.justify_=t.justify,this.repeat_=t.repeat,this.textBaseline_=t.textBaseline,this.fill_=t.fill!==void 0?t.fill:new on({color:qg}),this.maxAngle_=t.maxAngle!==void 0?t.maxAngle:Math.PI/4,this.placement_=t.placement!==void 0?t.placement:"point",this.overflow_=!!t.overflow,this.stroke_=t.stroke!==void 0?t.stroke:null,this.offsetX_=t.offsetX!==void 0?t.offsetX:0,this.offsetY_=t.offsetY!==void 0?t.offsetY:0,this.backgroundFill_=t.backgroundFill?t.backgroundFill:null,this.backgroundStroke_=t.backgroundStroke?t.backgroundStroke:null,this.padding_=t.padding===void 0?null:t.padding,this.declutterMode_=t.declutterMode}clone(){const t=this.getScale();return new uu({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 on?this.getFill().clone():this.getFill(),stroke:this.getStroke()?this.getStroke().clone():void 0,offsetX:this.getOffsetX(),offsetY:this.getOffsetY(),backgroundFill:this.getBackgroundFill()?this.getBackgroundFill().clone():void 0,backgroundStroke:this.getBackgroundStroke()?this.getBackgroundStroke().clone():void 0,padding:this.getPadding()||void 0,declutterMode:this.getDeclutterMode()})}getOverflow(){return this.overflow_}getFont(){return this.font_}getMaxAngle(){return this.maxAngle_}getPlacement(){return this.placement_}getRepeat(){return this.repeat_}getOffsetX(){return this.offsetX_}getOffsetY(){return this.offsetY_}getFill(){return this.fill_}getRotateWithView(){return this.rotateWithView_}getKeepUpright(){return this.keepUpright_}getRotation(){return this.rotation_}getScale(){return this.scale_}getScaleArray(){return this.scaleArray_}getStroke(){return this.stroke_}getText(){return this.text_}getTextAlign(){return this.textAlign_}getJustify(){return this.justify_}getTextBaseline(){return this.textBaseline_}getBackgroundFill(){return this.backgroundFill_}getBackgroundStroke(){return this.backgroundStroke_}getPadding(){return this.padding_}getDeclutterMode(){return this.declutterMode_}setOverflow(t){this.overflow_=t}setFont(t){this.font_=t}setMaxAngle(t){this.maxAngle_=t}setOffsetX(t){this.offsetX_=t}setOffsetY(t){this.offsetY_=t}setPlacement(t){this.placement_=t}setRepeat(t){this.repeat_=t}setRotateWithView(t){this.rotateWithView_=t}setKeepUpright(t){this.keepUpright_=t}setFill(t){this.fill_=t}setRotation(t){this.rotation_=t}setScale(t){this.scale_=t,this.scaleArray_=Ft(t!==void 0?t:1)}setStroke(t){this.stroke_=t}setText(t){this.text_=t}setTextAlign(t){this.textAlign_=t}setJustify(t){this.justify_=t}setTextBaseline(t){this.textBaseline_=t}setBackgroundFill(t){this.backgroundFill_=t}setBackgroundStroke(t){this.backgroundStroke_=t}setPadding(t){this.padding_=t}};const pt={ANIMATING:0,INTERACTING:1},O={BEGIN_GEOMETRY:0,BEGIN_PATH:1,CIRCLE:2,CLOSE_PATH:3,CUSTOM:4,DRAW_CHARS:5,DRAW_IMAGE:6,END_GEOMETRY:7,FILL:8,MOVE_TO_LINE_TO:9,SET_FILL_STYLE:10,SET_STROKE_STYLE:11,STROKE:12},yr=[O.FILL],si=[O.STROKE],Li=[O.BEGIN_PATH],sc=[O.CLOSE_PATH];class is extends Dh{constructor(t,e,i,s){super(),this.tolerance=t,this.maxExtent=e,this.pixelRatio=s,this.maxLineWidth=0,this.resolution=i,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_=null,this.bufferedMaxExtent_=null,this.instructions=[],this.coordinates=[],this.tmpCoordinate_=[],this.hitDetectionInstructions=[],this.state={}}applyPixelRatio(t){const e=this.pixelRatio;return e==1?t:t.map(function(i){return i*e})}appendFlatPointCoordinates(t,e){const i=this.getBufferedMaxExtent(),s=this.tmpCoordinate_,r=this.coordinates;let o=r.length;for(let a=0,l=t.length;a<l;a+=e)s[0]=t[a],s[1]=t[a+1],Ki(i,s)&&(r[o++]=s[0],r[o++]=s[1]);return o}appendFlatLineCoordinates(t,e,i,s,r,o){const a=this.coordinates;let l=a.length;const h=this.getBufferedMaxExtent();o&&(e+=s);let c=t[e],u=t[e+1];const d=this.tmpCoordinate_;let f=!0,g,m,_;for(g=e+s;g<i;g+=s)d[0]=t[g],d[1]=t[g+1],_=Qr(h,d),_!==m?(f&&(a[l++]=c,a[l++]=u,f=!1),a[l++]=d[0],a[l++]=d[1]):_===ut.INTERSECTING?(a[l++]=d[0],a[l++]=d[1],f=!1):f=!0,c=d[0],u=d[1],m=_;return(r&&f||g===e+s)&&(a[l++]=c,a[l++]=u),l}drawCustomCoordinates_(t,e,i,s,r){for(let o=0,a=i.length;o<a;++o){const l=i[o],h=this.appendFlatLineCoordinates(t,e,l,s,!1,!1);r.push(h),e=l}return e}drawCustom(t,e,i,s,r){this.beginGeometry(t,e,r);const o=t.getType(),a=t.getStride(),l=this.coordinates.length;let h,c,u,d,f;switch(o){case"MultiPolygon":h=t.getOrientedFlatCoordinates(),d=[];const g=t.getEndss();f=0;for(let m=0,_=g.length;m<_;++m){const p=[];f=this.drawCustomCoordinates_(h,f,g[m],a,p),d.push(p)}this.instructions.push([O.CUSTOM,l,d,t,i,ph,r]),this.hitDetectionInstructions.push([O.CUSTOM,l,d,t,s||i,ph,r]);break;case"Polygon":case"MultiLineString":u=[],h=o=="Polygon"?t.getOrientedFlatCoordinates():t.getFlatCoordinates(),f=this.drawCustomCoordinates_(h,0,t.getEnds(),a,u),this.instructions.push([O.CUSTOM,l,u,t,i,nr,r]),this.hitDetectionInstructions.push([O.CUSTOM,l,u,t,s||i,nr,r]);break;case"LineString":case"Circle":h=t.getFlatCoordinates(),c=this.appendFlatLineCoordinates(h,0,h.length,a,!1,!1),this.instructions.push([O.CUSTOM,l,c,t,i,Ji,r]),this.hitDetectionInstructions.push([O.CUSTOM,l,c,t,s||i,Ji,r]);break;case"MultiPoint":h=t.getFlatCoordinates(),c=this.appendFlatPointCoordinates(h,a),c>l&&(this.instructions.push([O.CUSTOM,l,c,t,i,Ji,r]),this.hitDetectionInstructions.push([O.CUSTOM,l,c,t,s||i,Ji,r]));break;case"Point":h=t.getFlatCoordinates(),this.coordinates.push(h[0],h[1]),c=this.coordinates.length,this.instructions.push([O.CUSTOM,l,c,t,i,void 0,r]),this.hitDetectionInstructions.push([O.CUSTOM,l,c,t,s||i,void 0,r]);break}this.endGeometry(e)}beginGeometry(t,e,i){this.beginGeometryInstruction1_=[O.BEGIN_GEOMETRY,e,0,t,i],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[O.BEGIN_GEOMETRY,e,0,t,i],this.hitDetectionInstructions.push(this.beginGeometryInstruction2_)}finish(){return{instructions:this.instructions,hitDetectionInstructions:this.hitDetectionInstructions,coordinates:this.coordinates}}reverseHitDetectionInstructions(){const t=this.hitDetectionInstructions;t.reverse();let e;const i=t.length;let s,r,o=-1;for(e=0;e<i;++e)s=t[e],r=s[0],r==O.END_GEOMETRY?o=e:r==O.BEGIN_GEOMETRY&&(s[2]=e,Fd(this.hitDetectionInstructions,o,e),o=-1)}fillStyleToState(t,e={}){if(t){const i=t.getColor();e.fillPatternScale=i&&typeof i=="object"&&"src"in i?this.pixelRatio:1,e.fillStyle=ye(i||Dt)}else e.fillStyle=void 0;return e}strokeStyleToState(t,e={}){if(t){const i=t.getColor();e.strokeStyle=ye(i||jn);const s=t.getLineCap();e.lineCap=s!==void 0?s:tn;const r=t.getLineDash();e.lineDash=r?r.slice():De;const o=t.getLineDashOffset();e.lineDashOffset=o||Fe;const a=t.getLineJoin();e.lineJoin=a!==void 0?a:en;const l=t.getWidth();e.lineWidth=l!==void 0?l:qn;const h=t.getMiterLimit();e.miterLimit=h!==void 0?h:Vn,e.lineWidth>this.maxLineWidth&&(this.maxLineWidth=e.lineWidth,this.bufferedMaxExtent_=null)}else e.strokeStyle=void 0,e.lineCap=void 0,e.lineDash=null,e.lineDashOffset=void 0,e.lineJoin=void 0,e.lineWidth=void 0,e.miterLimit=void 0;return e}setFillStrokeStyle(t,e){const i=this.state;this.fillStyleToState(t,i),this.strokeStyleToState(e,i)}createFill(t){const e=t.fillStyle,i=[O.SET_FILL_STYLE,e];return typeof e!="string"&&i.push(t.fillPatternScale),i}applyStroke(t){this.instructions.push(this.createStroke(t))}createStroke(t){return[O.SET_STROKE_STYLE,t.strokeStyle,t.lineWidth*this.pixelRatio,t.lineCap,t.lineJoin,t.miterLimit,t.lineDash?this.applyPixelRatio(t.lineDash):null,t.lineDashOffset*this.pixelRatio]}updateFillStyle(t,e){const i=t.fillStyle;(typeof i!="string"||t.currentFillStyle!=i)&&(this.instructions.push(e.call(this,t)),t.currentFillStyle=i)}updateStrokeStyle(t,e){const i=t.strokeStyle,s=t.lineCap,r=t.lineDash,o=t.lineDashOffset,a=t.lineJoin,l=t.lineWidth,h=t.miterLimit;(t.currentStrokeStyle!=i||t.currentLineCap!=s||r!=t.currentLineDash&&!qe(t.currentLineDash,r)||t.currentLineDashOffset!=o||t.currentLineJoin!=a||t.currentLineWidth!=l||t.currentMiterLimit!=h)&&(e.call(this,t),t.currentStrokeStyle=i,t.currentLineCap=s,t.currentLineDash=r,t.currentLineDashOffset=o,t.currentLineJoin=a,t.currentLineWidth=l,t.currentMiterLimit=h)}endGeometry(t){this.beginGeometryInstruction1_[2]=this.instructions.length,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_[2]=this.hitDetectionInstructions.length,this.beginGeometryInstruction2_=null;const e=[O.END_GEOMETRY,t];this.instructions.push(e),this.hitDetectionInstructions.push(e)}getBufferedMaxExtent(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=Pl(this.maxExtent),this.maxLineWidth>0)){const t=this.resolution*(this.maxLineWidth+1)/2;Jr(this.bufferedMaxExtent_,t,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_}}class Qg extends is{constructor(t,e,i,s){super(t,e,i,s),this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.anchorX_=void 0,this.anchorY_=void 0,this.height_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.scale_=void 0,this.width_=void 0,this.declutterMode_=void 0,this.declutterImageWithText_=void 0}drawPoint(t,e,i){if(!this.image_||this.maxExtent&&!Ki(this.maxExtent,t.getFlatCoordinates()))return;this.beginGeometry(t,e,i);const s=t.getFlatCoordinates(),r=t.getStride(),o=this.coordinates.length,a=this.appendFlatPointCoordinates(s,r);this.instructions.push([O.DRAW_IMAGE,o,a,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_*this.imagePixelRatio_,this.originY_*this.imagePixelRatio_,this.rotateWithView_,this.rotation_,[this.scale_[0]*this.pixelRatio/this.imagePixelRatio_,this.scale_[1]*this.pixelRatio/this.imagePixelRatio_],Math.ceil(this.width_*this.imagePixelRatio_),this.declutterMode_,this.declutterImageWithText_]),this.hitDetectionInstructions.push([O.DRAW_IMAGE,o,a,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,1,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(e)}drawMultiPoint(t,e,i){if(!this.image_)return;this.beginGeometry(t,e,i);const s=t.getFlatCoordinates(),r=[];for(let l=0,h=s.length;l<h;l+=t.getStride())(!this.maxExtent||Ki(this.maxExtent,s.slice(l,l+2)))&&r.push(s[l],s[l+1]);const o=this.coordinates.length,a=this.appendFlatPointCoordinates(r,2);this.instructions.push([O.DRAW_IMAGE,o,a,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_*this.imagePixelRatio_,this.originY_*this.imagePixelRatio_,this.rotateWithView_,this.rotation_,[this.scale_[0]*this.pixelRatio/this.imagePixelRatio_,this.scale_[1]*this.pixelRatio/this.imagePixelRatio_],Math.ceil(this.width_*this.imagePixelRatio_),this.declutterMode_,this.declutterImageWithText_]),this.hitDetectionInstructions.push([O.DRAW_IMAGE,o,a,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,1,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(e)}finish(){return this.reverseHitDetectionInstructions(),this.anchorX_=void 0,this.anchorY_=void 0,this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.height_=void 0,this.scale_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.width_=void 0,super.finish()}setImageStyle(t,e){const i=t.getAnchor(),s=t.getSize(),r=t.getOrigin();this.imagePixelRatio_=t.getPixelRatio(this.pixelRatio),this.anchorX_=i[0],this.anchorY_=i[1],this.hitDetectionImage_=t.getHitDetectionImage(),this.image_=t.getImage(this.pixelRatio),this.height_=s[1],this.opacity_=t.getOpacity(),this.originX_=r[0],this.originY_=r[1],this.rotateWithView_=t.getRotateWithView(),this.rotation_=t.getRotation(),this.scale_=t.getScaleArray(),this.width_=s[0],this.declutterMode_=t.getDeclutterMode(),this.declutterImageWithText_=e}}class t_ extends is{constructor(t,e,i,s){super(t,e,i,s)}drawFlatCoordinates_(t,e,i,s){const r=this.coordinates.length,o=this.appendFlatLineCoordinates(t,e,i,s,!1,!1),a=[O.MOVE_TO_LINE_TO,r,o];return this.instructions.push(a),this.hitDetectionInstructions.push(a),i}drawLineString(t,e,i){const s=this.state,r=s.strokeStyle,o=s.lineWidth;if(r===void 0||o===void 0)return;this.updateStrokeStyle(s,this.applyStroke),this.beginGeometry(t,e,i),this.hitDetectionInstructions.push([O.SET_STROKE_STYLE,s.strokeStyle,s.lineWidth,s.lineCap,s.lineJoin,s.miterLimit,De,Fe],Li);const a=t.getFlatCoordinates(),l=t.getStride();this.drawFlatCoordinates_(a,0,a.length,l),this.hitDetectionInstructions.push(si),this.endGeometry(e)}drawMultiLineString(t,e,i){const s=this.state,r=s.strokeStyle,o=s.lineWidth;if(r===void 0||o===void 0)return;this.updateStrokeStyle(s,this.applyStroke),this.beginGeometry(t,e,i),this.hitDetectionInstructions.push([O.SET_STROKE_STYLE,s.strokeStyle,s.lineWidth,s.lineCap,s.lineJoin,s.miterLimit,De,Fe],Li);const a=t.getEnds(),l=t.getFlatCoordinates(),h=t.getStride();let c=0;for(let u=0,d=a.length;u<d;++u)c=this.drawFlatCoordinates_(l,c,a[u],h);this.hitDetectionInstructions.push(si),this.endGeometry(e)}finish(){const t=this.state;return t.lastStroke!=null&&t.lastStroke!=this.coordinates.length&&this.instructions.push(si),this.reverseHitDetectionInstructions(),this.state=null,super.finish()}applyStroke(t){t.lastStroke!=null&&t.lastStroke!=this.coordinates.length&&(this.instructions.push(si),t.lastStroke=this.coordinates.length),t.lastStroke=0,super.applyStroke(t),this.instructions.push(Li)}}class rc extends is{constructor(t,e,i,s){super(t,e,i,s)}drawFlatCoordinatess_(t,e,i,s){const r=this.state,o=r.fillStyle!==void 0,a=r.strokeStyle!==void 0,l=i.length;this.instructions.push(Li),this.hitDetectionInstructions.push(Li);for(let h=0;h<l;++h){const c=i[h],u=this.coordinates.length,d=this.appendFlatLineCoordinates(t,e,c,s,!0,!a),f=[O.MOVE_TO_LINE_TO,u,d];this.instructions.push(f),this.hitDetectionInstructions.push(f),a&&(this.instructions.push(sc),this.hitDetectionInstructions.push(sc)),e=c}return o&&(this.instructions.push(yr),this.hitDetectionInstructions.push(yr)),a&&(this.instructions.push(si),this.hitDetectionInstructions.push(si)),e}drawCircle(t,e,i){const s=this.state,r=s.fillStyle,o=s.strokeStyle;if(r===void 0&&o===void 0)return;this.setFillStrokeStyles_(),this.beginGeometry(t,e,i),s.fillStyle!==void 0&&this.hitDetectionInstructions.push([O.SET_FILL_STYLE,Dt]),s.strokeStyle!==void 0&&this.hitDetectionInstructions.push([O.SET_STROKE_STYLE,s.strokeStyle,s.lineWidth,s.lineCap,s.lineJoin,s.miterLimit,De,Fe]);const a=t.getFlatCoordinates(),l=t.getStride(),h=this.coordinates.length;this.appendFlatLineCoordinates(a,0,a.length,l,!1,!1);const c=[O.CIRCLE,h];this.instructions.push(Li,c),this.hitDetectionInstructions.push(Li,c),s.fillStyle!==void 0&&(this.instructions.push(yr),this.hitDetectionInstructions.push(yr)),s.strokeStyle!==void 0&&(this.instructions.push(si),this.hitDetectionInstructions.push(si)),this.endGeometry(e)}drawPolygon(t,e,i){const s=this.state,r=s.fillStyle,o=s.strokeStyle;if(r===void 0&&o===void 0)return;this.setFillStrokeStyles_(),this.beginGeometry(t,e,i),s.fillStyle!==void 0&&this.hitDetectionInstructions.push([O.SET_FILL_STYLE,Dt]),s.strokeStyle!==void 0&&this.hitDetectionInstructions.push([O.SET_STROKE_STYLE,s.strokeStyle,s.lineWidth,s.lineCap,s.lineJoin,s.miterLimit,De,Fe]);const a=t.getEnds(),l=t.getOrientedFlatCoordinates(),h=t.getStride();this.drawFlatCoordinatess_(l,0,a,h),this.endGeometry(e)}drawMultiPolygon(t,e,i){const s=this.state,r=s.fillStyle,o=s.strokeStyle;if(r===void 0&&o===void 0)return;this.setFillStrokeStyles_(),this.beginGeometry(t,e,i),s.fillStyle!==void 0&&this.hitDetectionInstructions.push([O.SET_FILL_STYLE,Dt]),s.strokeStyle!==void 0&&this.hitDetectionInstructions.push([O.SET_STROKE_STYLE,s.strokeStyle,s.lineWidth,s.lineCap,s.lineJoin,s.miterLimit,De,Fe]);const a=t.getEndss(),l=t.getOrientedFlatCoordinates(),h=t.getStride();let c=0;for(let u=0,d=a.length;u<d;++u)c=this.drawFlatCoordinatess_(l,c,a[u],h);this.endGeometry(e)}finish(){this.reverseHitDetectionInstructions(),this.state=null;const t=this.tolerance;if(t!==0){const e=this.coordinates;for(let i=0,s=e.length;i<s;++i)e[i]=Ti(e[i],t)}return super.finish()}setFillStrokeStyles_(){const t=this.state;this.updateFillStyle(t,this.createFill),this.updateStrokeStyle(t,this.applyStroke)}}function e_(n,t,e,i,s){const r=[];let o=e,a=0,l=t.slice(e,2);for(;a<n&&o+s<i;){const[h,c]=l.slice(-2),u=t[o+s],d=t[o+s+1],f=Math.sqrt((u-h)*(u-h)+(d-c)*(d-c));if(a+=f,a>=n){const g=(n-a+f)/f,m=qt(h,u,g),_=qt(c,d,g);l.push(m,_),r.push(l),l=[m,_],a==n&&(o+=s),a=0}else if(a<n)l.push(t[o+s],t[o+s+1]),o+=s;else{const g=f-a,m=qt(h,u,g/f),_=qt(c,d,g/f);l.push(m,_),r.push(l),l=[m,_],a=0,o+=s}}return a>0&&r.push(l),r}function i_(n,t,e,i,s){let r=e,o=e,a=0,l=0,h=e,c,u,d,f,g,m,_,p,y,v;for(u=e;u<i;u+=s){const E=t[u],x=t[u+1];g!==void 0&&(y=E-g,v=x-m,f=Math.sqrt(y*y+v*v),_!==void 0&&(l+=d,c=Math.acos((_*y+p*v)/(d*f)),c>n&&(l>a&&(a=l,r=h,o=u),l=0,h=u-s)),d=f,_=y,p=v),g=E,m=x}return l+=f,l>a?[h,u]:[r,o]}const Er={left:0,center:.5,right:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1};class n_ extends is{constructor(t,e,i,s){super(t,e,i,s),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[Dt]={fillStyle:Dt},this.textStrokeState_=null,this.strokeStates={},this.textState_={},this.textStates={},this.textKey_="",this.fillKey_="",this.strokeKey_="",this.declutterMode_=void 0,this.declutterImageWithText_=void 0}finish(){const t=super.finish();return t.textStates=this.textStates,t.fillStates=this.fillStates,t.strokeStates=this.strokeStates,t}drawText(t,e,i){const s=this.textFillState_,r=this.textStrokeState_,o=this.textState_;if(this.text_===""||!o||!s&&!r)return;const a=this.coordinates;let l=a.length;const h=t.getType();let c=null,u=t.getStride();if(o.placement==="line"&&(h=="LineString"||h=="MultiLineString"||h=="Polygon"||h=="MultiPolygon")){if(!Pt(this.maxExtent,t.getExtent()))return;let d;if(c=t.getFlatCoordinates(),h=="LineString")d=[c.length];else if(h=="MultiLineString")d=t.getEnds();else if(h=="Polygon")d=t.getEnds().slice(0,1);else if(h=="MultiPolygon"){const _=t.getEndss();d=[];for(let p=0,y=_.length;p<y;++p)d.push(_[p][0])}this.beginGeometry(t,e,i);const f=o.repeat,g=f?void 0:o.textAlign;let m=0;for(let _=0,p=d.length;_<p;++_){let y;f?y=e_(f*this.resolution,c,m,d[_],u):y=[c.slice(m,d[_])];for(let v=0,E=y.length;v<E;++v){const x=y[v];let w=0,T=x.length;if(g==null){const I=i_(o.maxAngle,x,0,x.length,2);w=I[0],T=I[1]}for(let I=w;I<T;I+=u)a.push(x[I],x[I+1]);const R=a.length;m=d[_],this.drawChars_(l,R),l=R}}this.endGeometry(e)}else{let d=o.overflow?null:[];switch(h){case"Point":case"MultiPoint":c=t.getFlatCoordinates();break;case"LineString":c=t.getFlatMidpoint();break;case"Circle":c=t.getCenter();break;case"MultiLineString":c=t.getFlatMidpoints(),u=2;break;case"Polygon":c=t.getFlatInteriorPoint(),o.overflow||d.push(c[2]/this.resolution),u=3;break;case"MultiPolygon":const E=t.getFlatInteriorPoints();c=[];for(let x=0,w=E.length;x<w;x+=3)o.overflow||d.push(E[x+2]/this.resolution),c.push(E[x],E[x+1]);if(c.length===0)return;u=2;break}const f=this.appendFlatPointCoordinates(c,u);if(f===l)return;if(d&&(f-l)/2!==c.length/u){let E=l/2;d=d.filter((x,w)=>{const T=a[(E+w)*2]===c[w*u]&&a[(E+w)*2+1]===c[w*u+1];return T||--E,T})}this.saveTextStates_();const g=o.backgroundFill?this.createFill(this.fillStyleToState(o.backgroundFill)):null,m=o.backgroundStroke?this.createStroke(this.strokeStyleToState(o.backgroundStroke)):null;this.beginGeometry(t,e,i);let _=o.padding;if(_!=bi&&(o.scale[0]<0||o.scale[1]<0)){let E=o.padding[0],x=o.padding[1],w=o.padding[2],T=o.padding[3];o.scale[0]<0&&(x=-x,T=-T),o.scale[1]<0&&(E=-E,w=-w),_=[E,x,w,T]}const p=this.pixelRatio;this.instructions.push([O.DRAW_IMAGE,l,f,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[1,1],NaN,this.declutterMode_,this.declutterImageWithText_,_==bi?bi:_.map(function(E){return E*p}),g,m,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,d]);const y=1/p,v=g?g.slice(0):null;v&&(v[1]=Dt),this.hitDetectionInstructions.push([O.DRAW_IMAGE,l,f,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[y,y],NaN,this.declutterMode_,this.declutterImageWithText_,_,v,m,this.text_,this.textKey_,this.strokeKey_,this.fillKey_?Dt:this.fillKey_,this.textOffsetX_,this.textOffsetY_,d]),this.endGeometry(e)}}saveTextStates_(){const t=this.textStrokeState_,e=this.textState_,i=this.textFillState_,s=this.strokeKey_;t&&(s in this.strokeStates||(this.strokeStates[s]={strokeStyle:t.strokeStyle,lineCap:t.lineCap,lineDashOffset:t.lineDashOffset,lineWidth:t.lineWidth,lineJoin:t.lineJoin,miterLimit:t.miterLimit,lineDash:t.lineDash}));const r=this.textKey_;r in this.textStates||(this.textStates[r]={font:e.font,textAlign:e.textAlign||Hn,justify:e.justify,textBaseline:e.textBaseline||ur,scale:e.scale});const o=this.fillKey_;i&&(o in this.fillStates||(this.fillStates[o]={fillStyle:i.fillStyle}))}drawChars_(t,e){const i=this.textStrokeState_,s=this.textState_,r=this.strokeKey_,o=this.textKey_,a=this.fillKey_;this.saveTextStates_();const l=this.pixelRatio,h=Er[s.textBaseline],c=this.textOffsetY_*l,u=this.text_,d=i?i.lineWidth*Math.abs(s.scale[0])/2:0;this.instructions.push([O.DRAW_CHARS,t,e,h,s.overflow,a,s.maxAngle,l,c,r,d*l,u,o,1,this.declutterMode_,this.textKeepUpright_]),this.hitDetectionInstructions.push([O.DRAW_CHARS,t,e,h,s.overflow,a&&Dt,s.maxAngle,l,c,r,d*l,u,o,1/l,this.declutterMode_,this.textKeepUpright_])}setTextStyle(t,e){let i,s,r;if(!t)this.text_="";else{const o=t.getFill();o?(s=this.textFillState_,s||(s={},this.textFillState_=s),s.fillStyle=ye(o.getColor()||Dt)):(s=null,this.textFillState_=s);const a=t.getStroke();if(!a)r=null,this.textStrokeState_=r;else{r=this.textStrokeState_,r||(r={},this.textStrokeState_=r);const m=a.getLineDash(),_=a.getLineDashOffset(),p=a.getWidth(),y=a.getMiterLimit();r.lineCap=a.getLineCap()||tn,r.lineDash=m?m.slice():De,r.lineDashOffset=_===void 0?Fe:_,r.lineJoin=a.getLineJoin()||en,r.lineWidth=p===void 0?qn:p,r.miterLimit=y===void 0?Vn:y,r.strokeStyle=ye(a.getColor()||jn)}i=this.textState_;const l=t.getFont()||Nh;wg(l);const h=t.getScaleArray();i.overflow=t.getOverflow(),i.font=l,i.maxAngle=t.getMaxAngle(),i.placement=t.getPlacement(),i.textAlign=t.getTextAlign(),i.repeat=t.getRepeat(),i.justify=t.getJustify(),i.textBaseline=t.getTextBaseline()||ur,i.backgroundFill=t.getBackgroundFill(),i.backgroundStroke=t.getBackgroundStroke(),i.padding=t.getPadding()||bi,i.scale=h===void 0?[1,1]:h;const c=t.getOffsetX(),u=t.getOffsetY(),d=t.getRotateWithView(),f=t.getKeepUpright(),g=t.getRotation();this.text_=t.getText()||"",this.textOffsetX_=c===void 0?0:c,this.textOffsetY_=u===void 0?0:u,this.textRotateWithView_=d===void 0?!1:d,this.textKeepUpright_=f===void 0?!0:f,this.textRotation_=g===void 0?0:g,this.strokeKey_=r?(typeof r.strokeStyle=="string"?r.strokeStyle:V(r.strokeStyle))+r.lineCap+r.lineDashOffset+"|"+r.lineWidth+r.lineJoin+r.miterLimit+"["+r.lineDash.join()+"]":"",this.textKey_=i.font+i.scale+(i.textAlign||"?")+(i.repeat||"?")+(i.justify||"?")+(i.textBaseline||"?"),this.fillKey_=s&&s.fillStyle?typeof s.fillStyle=="string"?s.fillStyle:"|"+V(s.fillStyle):""}this.declutterMode_=t.getDeclutterMode(),this.declutterImageWithText_=e}}const s_={Circle:rc,Default:is,Image:Qg,LineString:t_,Polygon:rc,Text:n_};class r_{constructor(t,e,i,s){this.tolerance_=t,this.maxExtent_=e,this.pixelRatio_=s,this.resolution_=i,this.buildersByZIndex_={}}finish(){const t={};for(const e in this.buildersByZIndex_){t[e]=t[e]||{};const i=this.buildersByZIndex_[e];for(const s in i){const r=i[s].finish();t[e][s]=r}}return t}getBuilder(t,e){const i=t!==void 0?t.toString():"0";let s=this.buildersByZIndex_[i];s===void 0&&(s={},this.buildersByZIndex_[i]=s);let r=s[e];if(r===void 0){const o=s_[e];r=new o(this.tolerance_,this.maxExtent_,this.resolution_,this.pixelRatio_),s[e]=r}return r}}function o_(n,t,e,i,s,r,o,a,l,h,c,u,d=!0){let f=n[t],g=n[t+1],m=0,_=0,p=0,y=0;function v(){m=f,_=g,t+=i,f=n[t],g=n[t+1],y+=p,p=Math.sqrt((f-m)*(f-m)+(g-_)*(g-_))}do v();while(t<e-i&&y+p<r);let E=p===0?0:(r-y)/p;const x=qt(m,f,E),w=qt(_,g,E),T=t-i,R=y,I=r+a*l(h,s,c);for(;t<e-i&&y+p<I;)v();E=p===0?0:(I-y)/p;const L=qt(m,f,E),P=qt(_,g,E);let A=!1;if(d)if(u){const G=[x,w,L,P];hh(G,0,4,2,u,G,G),A=G[0]>G[2]}else A=x>L;const b=Math.PI,M=[],Y=T+i===t;t=T,p=0,y=R,f=n[t],g=n[t+1];let k;if(Y){v(),k=Math.atan2(g-_,f-m),A&&(k+=k>0?-b:b);const G=(L+x)/2,F=(P+w)/2;return M[0]=[G,F,(I-r)/2,k,s],M}s=s.replace(/\n/g," ");for(let G=0,F=s.length;G<F;){v();let $=Math.atan2(g-_,f-m);if(A&&($+=$>0?-b:b),k!==void 0){let lt=$-k;if(lt+=lt>b?-2*b:lt<-b?2*b:0,Math.abs(lt)>o)return null}k=$;const B=G;let et=0;for(;G<F;++G){const lt=A?F-G-1:G,Kt=a*l(h,s[lt],c);if(t+i<e&&y+p<r+et+Kt/2)break;et+=Kt}if(G===B)continue;const S=A?s.substring(F-B,F-G):s.substring(B,G);E=p===0?0:(r+et/2-y)/p;const xt=qt(m,f,E),bt=qt(_,g,E);M.push([xt,bt,et/2,$,S]),r+=et}return M}class oc{constructor(){this.instructions_=[],this.zIndex=0,this.offset_=0,this.context_=new Proxy(rr(),{get:(t,e)=>{if(typeof rr()[e]=="function")return this.push_(e),this.pushMethodArgs_},set:(t,e,i)=>(this.push_(e,i),!0)})}push_(...t){const e=this.instructions_,i=this.zIndex+this.offset_;e[i]||(e[i]=[]),e[i].push(...t)}pushMethodArgs_=(...t)=>(this.push_(t),this);pushFunction(t){this.push_(t)}getContext(){return this.context_}draw(t){this.instructions_.forEach(e=>{for(let i=0,s=e.length;i<s;++i){const r=e[i];if(typeof r=="function"){r(t);continue}const o=e[++i];if(typeof t[r]=="function")t[r](...o);else{if(typeof o=="function"){t[r]=o(t);continue}t[r]=o}}})}clear(){this.instructions_.length=0,this.zIndex=0,this.offset_=0}offset(){this.offset_=this.instructions_.length,this.zIndex=0}}const an=Yt(),ri=[],Ne=[],Ge=[],oi=[];function ac(n){return n[3].declutterBox}const lc=new RegExp("[֑-ࣿיִ-﷿ﹰ-ﻼࠀ--]");function $o(n,t){return t==="start"?t=lc.test(n)?"right":"left":t==="end"&&(t=lc.test(n)?"left":"right"),Er[t]}function a_(n,t,e){return e>0&&n.push(`
|
|
5
|
+
`,""),n.push(t,""),n}function l_(n,t,e){return e%2===0&&(n+=t),n}class h_{constructor(t,e,i,s,r){this.overlaps=i,this.pixelRatio=e,this.resolution=t,this.alignAndScaleFill_,this.instructions=s.instructions,this.coordinates=s.coordinates,this.coordinateCache_={},this.renderedTransform_=ce(),this.hitDetectionInstructions=s.hitDetectionInstructions,this.pixelCoordinates_=null,this.viewRotation_=0,this.fillStates=s.fillStates||{},this.strokeStates=s.strokeStates||{},this.textStates=s.textStates||{},this.widths_={},this.labels_={},this.zIndexContext_=r?new oc:null}getZIndexContext(){return this.zIndexContext_}createLabel(t,e,i,s){const r=t+e+i+s;if(this.labels_[r])return this.labels_[r];const o=s?this.strokeStates[s]:null,a=i?this.fillStates[i]:null,l=this.textStates[e],h=this.pixelRatio,c=[l.scale[0]*h,l.scale[1]*h],u=l.justify?Er[l.justify]:$o(Array.isArray(t)?t[0]:t,l.textAlign||Hn),d=s&&o.lineWidth?o.lineWidth:0,f=Array.isArray(t)?t:String(t).split(`
|
|
6
|
+
`).reduce(a_,[]),{width:g,height:m,widths:_,heights:p,lineWidths:y}=Cg(l,f),v=g+d,E=[],x=(v+2)*c[0],w=(m+d)*c[1],T={width:x<0?Math.floor(x):Math.ceil(x),height:w<0?Math.floor(w):Math.ceil(w),contextInstructions:E};(c[0]!=1||c[1]!=1)&&E.push("scale",c),s&&(E.push("strokeStyle",o.strokeStyle),E.push("lineWidth",d),E.push("lineCap",o.lineCap),E.push("lineJoin",o.lineJoin),E.push("miterLimit",o.miterLimit),E.push("setLineDash",[o.lineDash]),E.push("lineDashOffset",o.lineDashOffset)),i&&E.push("fillStyle",a.fillStyle),E.push("textBaseline","middle"),E.push("textAlign","center");const R=.5-u;let I=u*v+R*d;const L=[],P=[];let A=0,b=0,M=0,Y=0,k;for(let G=0,F=f.length;G<F;G+=2){const $=f[G];if($===`
|
|
7
|
+
`){b+=A,A=0,I=u*v+R*d,++Y;continue}const B=f[G+1]||l.font;B!==k&&(s&&L.push("font",B),i&&P.push("font",B),k=B),A=Math.max(A,p[M]);const et=[$,I+R*_[M]+u*(_[M]-y[Y]),.5*(d+A)+b];I+=_[M],s&&L.push("strokeText",et),i&&P.push("fillText",et),++M}return Array.prototype.push.apply(E,L),Array.prototype.push.apply(E,P),this.labels_[r]=T,T}replayTextBackground_(t,e,i,s,r,o,a){t.beginPath(),t.moveTo.apply(t,e),t.lineTo.apply(t,i),t.lineTo.apply(t,s),t.lineTo.apply(t,r),t.lineTo.apply(t,e),o&&(this.alignAndScaleFill_=o[2],t.fillStyle=o[1],this.fill_(t)),a&&(this.setStrokeStyle_(t,a),t.stroke())}calculateImageOrLabelDimensions_(t,e,i,s,r,o,a,l,h,c,u,d,f,g,m,_){a*=d[0],l*=d[1];let p=i-a,y=s-l;const v=r+h>t?t-h:r,E=o+c>e?e-c:o,x=g[3]+v*d[0]+g[1],w=g[0]+E*d[1]+g[2],T=p-g[3],R=y-g[0];(m||u!==0)&&(ri[0]=T,oi[0]=T,ri[1]=R,Ne[1]=R,Ne[0]=T+x,Ge[0]=Ne[0],Ge[1]=R+w,oi[1]=Ge[1]);let I;return u!==0?(I=Oe(ce(),i,s,1,1,u,-i,-s),dt(I,ri),dt(I,Ne),dt(I,Ge),dt(I,oi),Je(Math.min(ri[0],Ne[0],Ge[0],oi[0]),Math.min(ri[1],Ne[1],Ge[1],oi[1]),Math.max(ri[0],Ne[0],Ge[0],oi[0]),Math.max(ri[1],Ne[1],Ge[1],oi[1]),an)):Je(Math.min(T,T+x),Math.min(R,R+w),Math.max(T,T+x),Math.max(R,R+w),an),f&&(p=Math.round(p),y=Math.round(y)),{drawImageX:p,drawImageY:y,drawImageW:v,drawImageH:E,originX:h,originY:c,declutterBox:{minX:an[0],minY:an[1],maxX:an[2],maxY:an[3],value:_},canvasTransform:I,scale:d}}replayImageOrLabel_(t,e,i,s,r,o,a){const l=!!(o||a),h=s.declutterBox,c=a?a[2]*s.scale[0]/2:0;return h.minX-c<=e[0]&&h.maxX+c>=0&&h.minY-c<=e[1]&&h.maxY+c>=0&&(l&&this.replayTextBackground_(t,ri,Ne,Ge,oi,o,a),Rg(t,s.canvasTransform,r,i,s.originX,s.originY,s.drawImageW,s.drawImageH,s.drawImageX,s.drawImageY,s.scale)),!0}fill_(t){const e=this.alignAndScaleFill_;if(e){const i=dt(this.renderedTransform_,[0,0]),s=512*this.pixelRatio;t.save(),t.translate(i[0]%s,i[1]%s),e!==1&&t.scale(e,e),t.rotate(this.viewRotation_)}t.fill(),e&&t.restore()}setStrokeStyle_(t,e){t.strokeStyle=e[1],e[1]&&(t.lineWidth=e[2],t.lineCap=e[3],t.lineJoin=e[4],t.miterLimit=e[5],t.lineDashOffset=e[7],t.setLineDash(e[6]))}drawLabelWithPointPlacement_(t,e,i,s){const r=this.textStates[e],o=this.createLabel(t,e,s,i),a=this.strokeStates[i],l=this.pixelRatio,h=$o(Array.isArray(t)?t[0]:t,r.textAlign||Hn),c=Er[r.textBaseline||ur],u=a&&a.lineWidth?a.lineWidth:0,d=o.width/l-2*r.scale[0],f=h*d+2*(.5-h)*u,g=c*o.height/l+2*(.5-c)*u;return{label:o,anchorX:f,anchorY:g}}execute_(t,e,i,s,r,o,a,l){const h=this.zIndexContext_;let c;this.pixelCoordinates_&&qe(i,this.renderedTransform_)?c=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),c=ei(this.coordinates,0,this.coordinates.length,2,i,this.pixelCoordinates_),If(this.renderedTransform_,i));let u=0;const d=s.length;let f=0,g,m,_,p,y,v,E,x,w,T,R,I,L,P=0,A=0;const b=this.coordinateCache_,M=this.viewRotation_,Y=Math.round(Math.atan2(-i[1],i[0])*1e12)/1e12,k={context:t,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:M},G=this.instructions!=s||this.overlaps?0:200;let F,$,B,et;for(;u<d;){const S=s[u];switch(S[0]){case O.BEGIN_GEOMETRY:F=S[1],et=S[3],F.getGeometry()?a!==void 0&&!Pt(a,et.getExtent())?u=S[2]+1:++u:u=S[2],h&&(h.zIndex=S[4]);break;case O.BEGIN_PATH:P>G&&(this.fill_(t),P=0),A>G&&(t.stroke(),A=0),!P&&!A&&(t.beginPath(),y=NaN,v=NaN),++u;break;case O.CIRCLE:f=S[1];const bt=c[f],lt=c[f+1],Kt=c[f+2],wt=c[f+3],we=Kt-bt,_e=wt-lt,Bt=Math.sqrt(we*we+_e*_e);t.moveTo(bt+Bt,lt),t.arc(bt,lt,Bt,0,2*Math.PI,!0),++u;break;case O.CLOSE_PATH:t.closePath(),++u;break;case O.CUSTOM:f=S[1],g=S[2];const Mr=S[3],Ea=S[4],fs=S[5];k.geometry=Mr,k.feature=F,u in b||(b[u]=[]);const Di=b[u];fs?fs(c,f,g,2,Di):(Di[0]=c[f],Di[1]=c[f+1],Di.length=2),h&&(h.zIndex=S[6]),Ea(Di,k),++u;break;case O.DRAW_IMAGE:f=S[1],g=S[2],w=S[3],m=S[4],_=S[5];let ie=S[6];const ve=S[7],En=S[8],xn=S[9],gs=S[10];let Fi=S[11];const wn=S[12];let vn=S[13];p=S[14]||"declutter";const ft=S[15];if(!w&&S.length>=20){T=S[19],R=S[20],I=S[21],L=S[22];const ne=this.drawLabelWithPointPlacement_(T,R,I,L);w=ne.label,S[3]=w;const ki=S[23];m=(ne.anchorX-ki)*this.pixelRatio,S[4]=m;const se=S[24];_=(ne.anchorY-se)*this.pixelRatio,S[5]=_,ie=w.height,S[6]=ie,vn=w.width,S[13]=vn}let xa;S.length>25&&(xa=S[25]);let wa,Pr,Or;S.length>17?(wa=S[16],Pr=S[17],Or=S[18]):(wa=bi,Pr=null,Or=null),gs&&Y?Fi+=M:!gs&&!Y&&(Fi-=M);let kp=0;for(;f<g;f+=2){if(xa&&xa[kp++]<vn/this.pixelRatio)continue;const ne=this.calculateImageOrLabelDimensions_(w.width,w.height,c[f],c[f+1],vn,ie,m,_,En,xn,Fi,wn,r,wa,!!Pr||!!Or,F),ki=[t,e,w,ne,ve,Pr,Or];if(l){let se,Ce,re;if(ft){const at=g-f;if(!ft[at]){ft[at]={args:ki,declutterMode:p};continue}const Lt=ft[at];se=Lt.args,Ce=Lt.declutterMode,delete ft[at],re=ac(se)}let Ye,$e;if(se&&(Ce!=="declutter"||!l.collides(re))&&(Ye=!0),(p!=="declutter"||!l.collides(ne.declutterBox))&&($e=!0),Ce==="declutter"&&p==="declutter"){const at=Ye&&$e;Ye=at,$e=at}Ye&&(Ce!=="none"&&l.insert(re),this.replayImageOrLabel_.apply(this,se)),$e&&(p!=="none"&&l.insert(ne.declutterBox),this.replayImageOrLabel_.apply(this,ki))}else this.replayImageOrLabel_.apply(this,ki)}++u;break;case O.DRAW_CHARS:const su=S[1],ru=S[2],va=S[3],Np=S[4];L=S[5];const Gp=S[6],ou=S[7],au=S[8];I=S[9];const Ca=S[10];T=S[11],Array.isArray(T)&&(T=T.reduce(l_,"")),R=S[12];const lu=[S[13],S[13]];p=S[14]||"declutter";const zp=S[15],Ra=this.textStates[R],_s=Ra.font,ms=[Ra.scale[0]*ou,Ra.scale[1]*ou];let ps;_s in this.widths_?ps=this.widths_[_s]:(ps={},this.widths_[_s]=ps);const hu=qf(c,su,ru,2),cu=Math.abs(ms[0])*Wh(_s,T,ps);if(Np||cu<=hu){const ne=this.textStates[R].textAlign,ki=(hu-cu)*$o(T,ne),se=o_(c,su,ru,2,T,ki,Gp,Math.abs(ms[0]),Wh,_s,ps,Y?0:this.viewRotation_,zp);t:if(se){const Ce=[];let re,Ye,$e,at,Lt;if(I)for(re=0,Ye=se.length;re<Ye;++re){Lt=se[re],$e=Lt[4],at=this.createLabel($e,R,"",I),m=Lt[2]+(ms[0]<0?-Ca:Ca),_=va*at.height+(.5-va)*2*Ca*ms[1]/ms[0]-au;const Ke=this.calculateImageOrLabelDimensions_(at.width,at.height,Lt[0],Lt[1],at.width,at.height,m,_,0,0,Lt[3],lu,!1,bi,!1,F);if(l&&p==="declutter"&&l.collides(Ke.declutterBox))break t;Ce.push([t,e,at,Ke,1,null,null])}if(L)for(re=0,Ye=se.length;re<Ye;++re){Lt=se[re],$e=Lt[4],at=this.createLabel($e,R,L,""),m=Lt[2],_=va*at.height-au;const Ke=this.calculateImageOrLabelDimensions_(at.width,at.height,Lt[0],Lt[1],at.width,at.height,m,_,0,0,Lt[3],lu,!1,bi,!1,F);if(l&&p==="declutter"&&l.collides(Ke.declutterBox))break t;Ce.push([t,e,at,Ke,1,null,null])}l&&p!=="none"&&l.load(Ce.map(ac));for(let Ke=0,Xp=Ce.length;Ke<Xp;++Ke)this.replayImageOrLabel_.apply(this,Ce[Ke])}}++u;break;case O.END_GEOMETRY:if(o!==void 0){F=S[1];const ne=o(F,et,p);if(ne)return ne}++u;break;case O.FILL:G?P++:this.fill_(t),++u;break;case O.MOVE_TO_LINE_TO:for(f=S[1],g=S[2],$=c[f],B=c[f+1],t.moveTo($,B),y=$+.5|0,v=B+.5|0,f+=2;f<g;f+=2)$=c[f],B=c[f+1],E=$+.5|0,x=B+.5|0,(f==g-2||E!==y||x!==v)&&(t.lineTo($,B),y=E,v=x);++u;break;case O.SET_FILL_STYLE:this.alignAndScaleFill_=S[2],P&&(this.fill_(t),P=0,A&&(t.stroke(),A=0)),t.fillStyle=S[1],++u;break;case O.SET_STROKE_STYLE:A&&(t.stroke(),A=0),this.setStrokeStyle_(t,S),++u;break;case O.STROKE:G?A++:t.stroke(),++u;break;default:++u;break}}P&&this.fill_(t),A&&t.stroke()}execute(t,e,i,s,r,o){this.viewRotation_=s,this.execute_(t,e,i,this.instructions,r,void 0,void 0,o)}executeHitDetection(t,e,i,s,r){return this.viewRotation_=i,this.execute_(t,[t.canvas.width,t.canvas.height],e,this.hitDetectionInstructions,!0,s,r)}}const Ai=["Polygon","Circle","LineString","Image","Text","Default"],hc=["Image","Text"],c_=Ai.filter(n=>!hc.includes(n));class u_{constructor(t,e,i,s,r,o,a){this.maxExtent_=t,this.overlaps_=s,this.pixelRatio_=i,this.resolution_=e,this.renderBuffer_=o,this.executorsByZIndex_={},this.hitDetectionContext_=null,this.hitDetectionTransform_=ce(),this.renderedContext_=null,this.deferredZIndexContexts_={},this.createExecutors_(r,a)}clip(t,e){const i=this.getClipCoords(e);t.beginPath(),t.moveTo(i[0],i[1]),t.lineTo(i[2],i[3]),t.lineTo(i[4],i[5]),t.lineTo(i[6],i[7]),t.clip()}createExecutors_(t,e){for(const i in t){let s=this.executorsByZIndex_[i];s===void 0&&(s={},this.executorsByZIndex_[i]=s);const r=t[i];for(const o in r){const a=r[o];s[o]=new h_(this.resolution_,this.pixelRatio_,this.overlaps_,a,e)}}}hasExecutors(t){for(const e in this.executorsByZIndex_){const i=this.executorsByZIndex_[e];for(let s=0,r=t.length;s<r;++s)if(t[s]in i)return!0}return!1}forEachFeatureAtCoordinate(t,e,i,s,r,o){s=Math.round(s);const a=s*2+1,l=Oe(this.hitDetectionTransform_,s+.5,s+.5,1/e,-1/e,-i,-t[0],-t[1]),h=!this.hitDetectionContext_;h&&(this.hitDetectionContext_=ht(a,a));const c=this.hitDetectionContext_;c.canvas.width!==a||c.canvas.height!==a?(c.canvas.width=a,c.canvas.height=a):h||c.clearRect(0,0,a,a);let u;this.renderBuffer_!==void 0&&(u=Yt(),zn(u,t),Jr(u,e*(this.renderBuffer_+s),u));const d=d_(s);let f;function g(x,w,T){const R=c.getImageData(0,0,a,a).data;for(let I=0,L=d.length;I<L;I++)if(R[d[I]]>0){if(!o||T==="none"||f!=="Image"&&f!=="Text"||o.includes(x)){const P=(d[I]-3)/4,A=s-P%a,b=s-(P/a|0),M=r(x,w,A*A+b*b);if(M)return M}c.clearRect(0,0,a,a);break}}const m=Object.keys(this.executorsByZIndex_).map(Number);m.sort(Ae);let _,p,y,v,E;for(_=m.length-1;_>=0;--_){const x=m[_].toString();for(y=this.executorsByZIndex_[x],p=Ai.length-1;p>=0;--p)if(f=Ai[p],v=y[f],v!==void 0&&(E=v.executeHitDetection(c,l,i,g,u),E))return E}}getClipCoords(t){const e=this.maxExtent_;if(!e)return null;const i=e[0],s=e[1],r=e[2],o=e[3],a=[i,s,i,o,r,o,r,s];return ei(a,0,8,2,t,a),a}isEmpty(){return $i(this.executorsByZIndex_)}execute(t,e,i,s,r,o,a){const l=Object.keys(this.executorsByZIndex_).map(Number);l.sort(a?Dd:Ae),o=o||Ai;const h=Ai.length;for(let c=0,u=l.length;c<u;++c){const d=l[c].toString(),f=this.executorsByZIndex_[d];for(let g=0,m=o.length;g<m;++g){const _=o[g],p=f[_];if(p!==void 0){const y=a===null?void 0:p.getZIndexContext(),v=y?y.getContext():t,E=this.maxExtent_&&_!=="Image"&&_!=="Text";if(E&&(v.save(),this.clip(v,i)),!y||_==="Text"||_==="Image"?p.execute(v,e,i,s,r,a):y.pushFunction(x=>p.execute(x,e,i,s,r,a)),E&&v.restore(),y){y.offset();const x=l[c]*h+Ai.indexOf(_);this.deferredZIndexContexts_[x]||(this.deferredZIndexContexts_[x]=[]),this.deferredZIndexContexts_[x].push(y)}}}}this.renderedContext_=t}getDeferredZIndexContexts(){return this.deferredZIndexContexts_}getRenderedContext(){return this.renderedContext_}renderDeferred(){const t=this.deferredZIndexContexts_,e=Object.keys(t).map(Number).sort(Ae);for(let i=0,s=e.length;i<s;++i)t[e[i]].forEach(r=>{r.draw(this.renderedContext_),r.clear()}),t[e[i]].length=0}}const Ko={};function d_(n){if(Ko[n]!==void 0)return Ko[n];const t=n*2+1,e=n*n,i=new Array(e+1);for(let r=0;r<=n;++r)for(let o=0;o<=n;++o){const a=r*r+o*o;if(a>e)break;let l=i[a];l||(l=[],i[a]=l),l.push(((n+r)*t+(n+o))*4+3),r>0&&l.push(((n-r)*t+(n+o))*4+3),o>0&&(l.push(((n+r)*t+(n-o))*4+3),r>0&&l.push(((n-r)*t+(n-o))*4+3))}const s=[];for(let r=0,o=i.length;r<o;++r)i[r]&&s.push(...i[r]);return Ko[n]=s,s}function cc(n,t,e,i){return e!==void 0&&i!==void 0?[e/n,i/t]:e!==void 0?e/n:i!==void 0?i/t:1}class ln extends _r{constructor(t){t=t||{};const e=t.opacity!==void 0?t.opacity:1,i=t.rotation!==void 0?t.rotation:0,s=t.scale!==void 0?t.scale:1,r=t.rotateWithView!==void 0?t.rotateWithView:!1;super({opacity:e,rotation:i,scale:s,displacement:t.displacement!==void 0?t.displacement:[0,0],rotateWithView:r,declutterMode:t.declutterMode}),this.anchor_=t.anchor!==void 0?t.anchor:[.5,.5],this.normalizedAnchor_=null,this.anchorOrigin_=t.anchorOrigin!==void 0?t.anchorOrigin:"top-left",this.anchorXUnits_=t.anchorXUnits!==void 0?t.anchorXUnits:"fraction",this.anchorYUnits_=t.anchorYUnits!==void 0?t.anchorYUnits:"fraction",this.crossOrigin_=t.crossOrigin!==void 0?t.crossOrigin:null;const o=t.img!==void 0?t.img:null;let a=t.src;q(!(a!==void 0&&o),"`image` and `src` cannot be provided at the same time"),(a===void 0||a.length===0)&&o&&(a=o.src||V(o)),q(a!==void 0&&a.length>0,"A defined and non-empty `src` or `image` must be provided"),q(!((t.width!==void 0||t.height!==void 0)&&t.scale!==void 0),"`width` or `height` cannot be provided together with `scale`");let l;if(t.src!==void 0?l=X.IDLE:o!==void 0&&("complete"in o?o.complete?l=o.src?X.LOADED:X.IDLE:l=X.LOADING:l=X.LOADED),this.color_=t.color!==void 0?Qi(t.color):null,this.iconImage_=lr(o,a,this.crossOrigin_,l,this.color_),this.offset_=t.offset!==void 0?t.offset:[0,0],this.offsetOrigin_=t.offsetOrigin!==void 0?t.offsetOrigin:"top-left",this.origin_=null,this.size_=t.size!==void 0?t.size:null,this.initialOptions_,t.width!==void 0||t.height!==void 0){let h,c;if(t.size)[h,c]=t.size;else{const u=this.getImage(1);if(u.width&&u.height)h=u.width,c=u.height;else if(u instanceof HTMLImageElement){this.initialOptions_=t;const d=()=>{if(this.unlistenImageChange(d),!this.initialOptions_)return;const f=this.iconImage_.getSize();this.setScale(cc(f[0],f[1],t.width,t.height))};this.listenImageChange(d);return}}h!==void 0&&this.setScale(cc(h,c,t.width,t.height))}}clone(){let t,e,i;return this.initialOptions_?(e=this.initialOptions_.width,i=this.initialOptions_.height):(t=this.getScale(),t=Array.isArray(t)?t.slice():t),new ln({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_,offset:this.offset_.slice(),offsetOrigin:this.offsetOrigin_,opacity:this.getOpacity(),rotateWithView:this.getRotateWithView(),rotation:this.getRotation(),scale:t,width:e,height:i,size:this.size_!==null?this.size_.slice():void 0,src:this.getSrc(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()})}getAnchor(){let t=this.normalizedAnchor_;if(!t){t=this.anchor_;const s=this.getSize();if(this.anchorXUnits_=="fraction"||this.anchorYUnits_=="fraction"){if(!s)return null;t=this.anchor_.slice(),this.anchorXUnits_=="fraction"&&(t[0]*=s[0]),this.anchorYUnits_=="fraction"&&(t[1]*=s[1])}if(this.anchorOrigin_!="top-left"){if(!s)return null;t===this.anchor_&&(t=this.anchor_.slice()),(this.anchorOrigin_=="top-right"||this.anchorOrigin_=="bottom-right")&&(t[0]=-t[0]+s[0]),(this.anchorOrigin_=="bottom-left"||this.anchorOrigin_=="bottom-right")&&(t[1]=-t[1]+s[1])}this.normalizedAnchor_=t}const e=this.getDisplacement(),i=this.getScaleArray();return[t[0]-e[0]/i[0],t[1]+e[1]/i[1]]}setAnchor(t){this.anchor_=t,this.normalizedAnchor_=null}getColor(){return this.color_}getImage(t){return this.iconImage_.getImage(t)}getPixelRatio(t){return this.iconImage_.getPixelRatio(t)}getImageSize(){return this.iconImage_.getSize()}getImageState(){return this.iconImage_.getImageState()}getHitDetectionImage(){return this.iconImage_.getHitDetectionImage()}getOrigin(){if(this.origin_)return this.origin_;let t=this.offset_;if(this.offsetOrigin_!="top-left"){const e=this.getSize(),i=this.iconImage_.getSize();if(!e||!i)return null;t=t.slice(),(this.offsetOrigin_=="top-right"||this.offsetOrigin_=="bottom-right")&&(t[0]=i[0]-e[0]-t[0]),(this.offsetOrigin_=="bottom-left"||this.offsetOrigin_=="bottom-right")&&(t[1]=i[1]-e[1]-t[1])}return this.origin_=t,this.origin_}getSrc(){return this.iconImage_.getSrc()}setSrc(t){this.iconImage_=lr(null,t,this.crossOrigin_,X.IDLE,this.color_)}getSize(){return this.size_?this.size_:this.iconImage_.getSize()}getWidth(){const t=this.getScaleArray();if(this.size_)return this.size_[0]*t[0];if(this.iconImage_.getImageState()==X.LOADED)return this.iconImage_.getSize()[0]*t[0]}getHeight(){const t=this.getScaleArray();if(this.size_)return this.size_[1]*t[1];if(this.iconImage_.getImageState()==X.LOADED)return this.iconImage_.getSize()[1]*t[1]}setScale(t){delete this.initialOptions_,super.setScale(t)}listenImageChange(t){this.iconImage_.addEventListener(z.CHANGE,t)}load(){this.iconImage_.load()}unlistenImageChange(t){this.iconImage_.removeEventListener(z.CHANGE,t)}ready(){return this.iconImage_.ready()}}const Ee=.5;function f_(n,t,e,i,s,r,o,a,l){const h=s,c=n[0]*Ee,u=n[1]*Ee,d=ht(c,u);d.imageSmoothingEnabled=!1;const f=d.canvas,g=new Ig(d,Ee,s,null,o,a,null),m=e.length,_=Math.floor((256*256*256-1)/m),p={};for(let v=1;v<=m;++v){const E=e[v-1],x=E.getStyleFunction()||i;if(!x)continue;let w=x(E,r);if(!w)continue;Array.isArray(w)||(w=[w]);const R=(v*_).toString(16).padStart(7,"#00000");for(let I=0,L=w.length;I<L;++I){const P=w[I],A=P.getGeometryFunction()(E);if(!A||!Pt(h,A.getExtent()))continue;const b=P.clone(),M=b.getFill();M&&M.setColor(R);const Y=b.getStroke();Y&&(Y.setColor(R),Y.setLineDash(null)),b.setText(void 0);const k=P.getImage();if(k){const B=k.getImageSize();if(!B)continue;const et=ht(B[0],B[1],void 0,{alpha:!1}),S=et.canvas;et.fillStyle=R,et.fillRect(0,0,S.width,S.height),b.setImage(new ln({img:S,anchor:k.getAnchor(),anchorXUnits:"pixels",anchorYUnits:"pixels",offset:k.getOrigin(),opacity:1,size:k.getSize(),scale:k.getScale(),rotation:k.getRotation(),rotateWithView:k.getRotateWithView()}))}const G=b.getZIndex()||0;let F=p[G];F||(F={},p[G]=F,F.Polygon=[],F.Circle=[],F.LineString=[],F.Point=[]);const $=A.getType();if($==="GeometryCollection"){const B=A.getGeometriesArrayRecursive();for(let et=0,S=B.length;et<S;++et){const xt=B[et];F[xt.getType().replace("Multi","")].push(xt,b)}}else F[$.replace("Multi","")].push(A,b)}}const y=Object.keys(p).map(Number).sort(Ae);for(let v=0,E=y.length;v<E;++v){const x=p[y[v]];for(const w in x){const T=x[w];for(let R=0,I=T.length;R<I;R+=2){g.setStyle(T[R+1]);for(let L=0,P=t.length;L<P;++L)g.setTransform(t[L]),g.drawGeometry(T[R])}}}return d.getImageData(0,0,f.width,f.height)}function g_(n,t,e){const i=[];if(e){const s=Math.floor(Math.round(n[0])*Ee),r=Math.floor(Math.round(n[1])*Ee),o=(rt(s,0,e.width-1)+rt(r,0,e.height-1)*e.width)*4,a=e.data[o],l=e.data[o+1],c=e.data[o+2]+256*(l+256*a),u=Math.floor((256*256*256-1)/t.length);c&&c%u===0&&i.push(t[c/u-1])}return i}class uc extends Me{constructor(t,e,i,s){super(t),this.inversePixelTransform=e,this.frameState=i,this.context=s}}const __=5;class m_ extends Nn{constructor(t){super(),this.ready=!0,this.boundHandleImageChange_=this.handleImageChange_.bind(this),this.layer_=t,this.staleKeys_=new Array,this.maxStaleKeys=__}getStaleKeys(){return this.staleKeys_}prependStaleKey(t){this.staleKeys_.unshift(t),this.staleKeys_.length>this.maxStaleKeys&&(this.staleKeys_.length=this.maxStaleKeys)}getFeatures(t){return U()}getData(t){return null}prepareFrame(t){return U()}renderFrame(t,e){return U()}forEachFeatureAtCoordinate(t,e,i,s,r){}getLayer(){return this.layer_}handleFontsChanged(){}handleImageChange_(t){const e=t.target;(e.getState()===X.LOADED||e.getState()===X.ERROR)&&this.renderIfReadyAndVisible()}loadImage(t){let e=t.getState();return e!=X.LOADED&&e!=X.ERROR&&t.addEventListener(z.CHANGE,this.boundHandleImageChange_),e==X.IDLE&&(t.load(),e=t.getState()),e==X.LOADED}renderIfReadyAndVisible(){const t=this.getLayer();t&&t.getVisible()&&t.getSourceState()==="ready"&&t.changed()}renderDeferred(t){}disposeInternal(){delete this.layer_,super.disposeInternal()}}const dc=[];let hn=null;function p_(){hn=ht(1,1,void 0,{willReadFrequently:!0})}class fc extends m_{constructor(t){super(t),this.container=null,this.renderedResolution,this.tempTransform=ce(),this.pixelTransform=ce(),this.inversePixelTransform=ce(),this.context=null,this.deferredContext_=null,this.containerReused=!1,this.frameState=null}getImageData(t,e,i){hn||p_(),hn.clearRect(0,0,1,1);let s;try{hn.drawImage(t,e,i,1,1,0,0,1,1),s=hn.getImageData(0,0,1,1).data}catch{return hn=null,null}return s}getBackground(t){let i=this.getLayer().getBackground();return typeof i=="function"&&(i=i(t.viewState.resolution)),i||void 0}useContainer(t,e,i){const s=this.getLayer().getClassName();let r,o;if(t&&t.className===s&&(!i||t&&t.style.backgroundColor&&qe(Qi(t.style.backgroundColor),Qi(i)))){const a=t.firstElementChild;ii(a)&&(o=a.getContext("2d"))}if(o&&Af(o.canvas.style.transform,e)?(this.container=t,this.context=o,this.containerReused=!0):this.containerReused?(this.container=null,this.context=null,this.containerReused=!1):this.container&&(this.container.style.backgroundColor=null),!this.container){r=$t?Ah():document.createElement("div"),r.className=s;let a=r.style;a.position="absolute",a.width="100%",a.height="100%",o=ht();const l=o.canvas;r.appendChild(l),a=l.style,a.position="absolute",a.left="0",a.transformOrigin="top left",this.container=r,this.context=o}!this.containerReused&&i&&!this.container.style.backgroundColor&&(this.container.style.backgroundColor=i)}clipUnrotated(t,e,i){const s=vi(i),r=Ks(i),o=$s(i),a=Ys(i);dt(e.coordinateToPixelTransform,s),dt(e.coordinateToPixelTransform,r),dt(e.coordinateToPixelTransform,o),dt(e.coordinateToPixelTransform,a);const l=this.inversePixelTransform;dt(l,s),dt(l,r),dt(l,o),dt(l,a),t.save(),t.beginPath(),t.moveTo(Math.round(s[0]),Math.round(s[1])),t.lineTo(Math.round(r[0]),Math.round(r[1])),t.lineTo(Math.round(o[0]),Math.round(o[1])),t.lineTo(Math.round(a[0]),Math.round(a[1])),t.clip()}prepareContainer(t,e){const i=t.extent,s=t.viewState.resolution,r=t.viewState.rotation,o=t.pixelRatio,a=Math.round(J(i)/s*o),l=Math.round(It(i)/s*o);Oe(this.pixelTransform,t.size[0]/2,t.size[1]/2,1/o,1/o,r,-a/2,-l/2),lh(this.inversePixelTransform,this.pixelTransform);const h=Lf(this.pixelTransform);if(this.useContainer(e,h,this.getBackground(t)),!this.containerReused){const c=this.context.canvas;c.width!=a||c.height!=l?(c.width=a,c.height=l):this.context.clearRect(0,0,a,l),h!==c.style.transform&&(c.style.transform=h)}}dispatchRenderEvent_(t,e,i){const s=this.getLayer();if(s.hasListener(t)){const r=new uc(t,this.inversePixelTransform,i,e);s.dispatchEvent(r)}}preRender(t,e){this.frameState=e,!e.declutter&&this.dispatchRenderEvent_(Qt.PRERENDER,t,e)}postRender(t,e){e.declutter||this.dispatchRenderEvent_(Qt.POSTRENDER,t,e)}renderDeferredInternal(t){}getRenderContext(t){return t.declutter&&!this.deferredContext_&&(this.deferredContext_=new oc),t.declutter?this.deferredContext_.getContext():this.context}renderDeferred(t){t.declutter&&(this.dispatchRenderEvent_(Qt.PRERENDER,this.context,t),t.declutter&&this.deferredContext_&&(this.deferredContext_.draw(this.context),this.deferredContext_.clear()),this.renderDeferredInternal(t),this.dispatchRenderEvent_(Qt.POSTRENDER,this.context,t))}getRenderTransform(t,e,i,s,r,o,a){const l=r/2,h=o/2,c=s/e,u=-c,d=-t[0]+a,f=-t[1];return Oe(this.tempTransform,l,h,c,u,-i,d,f)}disposeInternal(){delete this.frameState,super.disposeInternal()}}class y_ extends fc{constructor(t){super(t),this.boundHandleStyleImageChange_=this.handleStyleImageChange_.bind(this),this.animatingOrInteracting_,this.hitDetectionImageData_=null,this.clipped_=!1,this.renderedFeatures_=null,this.renderedRevision_=-1,this.renderedResolution_=NaN,this.renderedExtent_=Yt(),this.wrappedRenderedExtent_=Yt(),this.renderedRotation_,this.renderedCenter_=null,this.renderedProjection_=null,this.renderedPixelRatio_=1,this.renderedRenderOrder_=null,this.renderedFrameDeclutter_,this.replayGroup_=null,this.replayGroupChanged=!0,this.clipping=!0,this.targetContext_=null,this.opacity_=1}renderWorlds(t,e,i){const s=e.extent,r=e.viewState,o=r.center,a=r.resolution,l=r.projection,h=r.rotation,c=l.getExtent(),u=this.getLayer().getSource(),d=this.getLayer().getDeclutter(),f=e.pixelRatio,g=e.viewHints,m=!(g[pt.ANIMATING]||g[pt.INTERACTING]),_=this.context,p=Math.round(J(s)/a*f),y=Math.round(It(s)/a*f),v=u.getWrapX()&&l.canWrapX(),E=v?J(c):null,x=v?Math.ceil((s[2]-c[2])/E)+1:1;let w=v?Math.floor((s[0]-c[0])/E):0;do{let T=this.getRenderTransform(o,a,0,f,p,y,w*E);e.declutter&&(T=T.slice(0)),t.execute(_,[_.canvas.width,_.canvas.height],T,h,m,i===void 0?Ai:i?hc:c_,i?d&&e.declutter[d]:void 0)}while(++w<x)}setDrawContext_(){this.opacity_!==1&&(this.targetContext_=this.context,this.context=ht(this.context.canvas.width,this.context.canvas.height,dc))}resetDrawContext_(){if(this.opacity_!==1&&this.targetContext_){const t=this.targetContext_.globalAlpha;this.targetContext_.globalAlpha=this.opacity_,this.targetContext_.drawImage(this.context.canvas,0,0),this.targetContext_.globalAlpha=t,or(this.context),dc.push(this.context.canvas),this.context=this.targetContext_,this.targetContext_=null}}renderDeclutter(t){!this.replayGroup_||!this.getLayer().getDeclutter()||this.renderWorlds(this.replayGroup_,t,!0)}renderDeferredInternal(t){this.replayGroup_&&(this.replayGroup_.renderDeferred(),this.clipped_&&this.context.restore(),this.resetDrawContext_())}renderFrame(t,e){const i=t.layerStatesArray[t.layerIndex];this.opacity_=i.opacity;const s=t.viewState;this.prepareContainer(t,e);const r=this.context,o=this.replayGroup_;let a=o&&!o.isEmpty();if(!a&&!(this.getLayer().hasListener(Qt.PRERENDER)||this.getLayer().hasListener(Qt.POSTRENDER)))return this.container;if(this.setDrawContext_(),this.preRender(r,t),s.projection,this.clipped_=!1,a&&i.extent&&this.clipping){const l=ti(i.extent);a=Pt(l,t.extent),this.clipped_=a&&!Bi(l,t.extent),this.clipped_&&this.clipUnrotated(r,t,l)}return a&&this.renderWorlds(o,t,this.getLayer().getDeclutter()?!1:void 0),!t.declutter&&this.clipped_&&r.restore(),this.postRender(r,t),this.renderedRotation_!==s.rotation&&(this.renderedRotation_=s.rotation,this.hitDetectionImageData_=null),t.declutter||this.resetDrawContext_(),this.container}getFeatures(t){return new Promise(e=>{if(this.frameState&&!this.hitDetectionImageData_&&!this.animatingOrInteracting_){const i=this.frameState.size.slice(),s=this.renderedCenter_,r=this.renderedResolution_,o=this.renderedRotation_,a=this.renderedProjection_,l=this.wrappedRenderedExtent_,h=this.getLayer(),c=[],u=i[0]*Ee,d=i[1]*Ee;c.push(this.getRenderTransform(s,r,o,Ee,u,d,0).slice());const f=h.getSource(),g=a.getExtent();if(f.getWrapX()&&a.canWrapX()&&!Bi(g,l)){let m=l[0];const _=J(g);let p=0,y;for(;m<g[0];)--p,y=_*p,c.push(this.getRenderTransform(s,r,o,Ee,u,d,y).slice()),m+=_;for(p=0,m=l[2];m>g[2];)++p,y=_*p,c.push(this.getRenderTransform(s,r,o,Ee,u,d,y).slice()),m-=_}this.hitDetectionImageData_=f_(i,c,this.renderedFeatures_,h.getStyleFunction(),l,r,o,$h(r,this.renderedPixelRatio_))}e(g_(t,this.renderedFeatures_,this.hitDetectionImageData_))})}forEachFeatureAtCoordinate(t,e,i,s,r){if(!this.replayGroup_)return;const o=e.viewState.resolution,a=e.viewState.rotation,l=this.getLayer(),h={},c=function(d,f,g){const m=V(d),_=h[m];if(_){if(_!==!0&&g<_.distanceSq){if(g===0)return h[m]=!0,r.splice(r.lastIndexOf(_),1),s(d,l,f);_.geometry=f,_.distanceSq=g}}else{if(g===0)return h[m]=!0,s(d,l,f);r.push(h[m]={feature:d,layer:l,geometry:f,distanceSq:g,callback:s})}},u=this.getLayer().getDeclutter();return this.replayGroup_.forEachFeatureAtCoordinate(t,o,a,i,c,u?e.declutter?.[u]?.all().map(d=>d.value):null)}handleFontsChanged(){const t=this.getLayer();t.getVisible()&&this.replayGroup_&&t.changed()}handleStyleImageChange_(t){this.renderIfReadyAndVisible()}prepareFrame(t){const e=this.getLayer(),i=e.getSource();if(!i)return!1;const s=t.viewHints[pt.ANIMATING],r=t.viewHints[pt.INTERACTING],o=e.getUpdateWhileAnimating(),a=e.getUpdateWhileInteracting();if(this.ready&&!o&&s||!a&&r)return this.animatingOrInteracting_=!0,!0;this.animatingOrInteracting_=!1;const l=t.extent,h=t.viewState,c=h.projection,u=h.resolution,d=t.pixelRatio,f=e.getRevision(),g=e.getRenderBuffer();let m=e.getRenderOrder();m===void 0&&(m=bg);const _=h.center.slice(),p=Jr(l,g*u),y=p.slice(),v=[p.slice()],E=c.getExtent();if(i.getWrapX()&&c.canWrapX()&&!Bi(E,t.extent)){const M=J(E),Y=Math.max(J(p)/2,M);p[0]=E[0]-Y,p[2]=E[2]+Y,Bl(_,c);const k=Xl(v[0],c);k[0]<E[0]&&k[2]<E[2]?v.push([k[0]+M,k[1],k[2]+M,k[3]]):k[0]>E[0]&&k[2]>E[2]&&v.push([k[0]-M,k[1],k[2]-M,k[3]])}if(this.ready&&this.renderedResolution_==u&&this.renderedRevision_==f&&this.renderedRenderOrder_==m&&this.renderedFrameDeclutter_===!!t.declutter&&Bi(this.wrappedRenderedExtent_,p))return qe(this.renderedExtent_,y)||(this.hitDetectionImageData_=null,this.renderedExtent_=y),this.renderedCenter_=_,this.replayGroupChanged=!1,!0;this.replayGroup_=null;const x=new r_(Kh(u,d),p,u,d);let w;for(let M=0,Y=v.length;M<Y;++M)i.loadFeatures(v[M],u,c);const T=$h(u,d);let R=!0;const I=(M,Y)=>{let k;const G=M.getStyleFunction()||e.getStyleFunction();if(G&&(k=G(M,u)),k){const F=this.renderFeature(M,T,k,x,w,this.getLayer().getDeclutter(),Y);R=R&&!F}},L=ah(p),P=i.getFeaturesInExtent(L);m&&P.sort(m);for(let M=0,Y=P.length;M<Y;++M)I(P[M],M);this.renderedFeatures_=P,this.ready=R;const A=x.finish(),b=new u_(p,u,d,i.getOverlaps(),A,e.getRenderBuffer(),!!t.declutter);return this.renderedResolution_=u,this.renderedRevision_=f,this.renderedRenderOrder_=m,this.renderedFrameDeclutter_=!!t.declutter,this.renderedExtent_=y,this.wrappedRenderedExtent_=p,this.renderedCenter_=_,this.renderedProjection_=c,this.renderedPixelRatio_=d,this.replayGroup_=b,this.hitDetectionImageData_=null,this.replayGroupChanged=!0,!0}renderFeature(t,e,i,s,r,o,a){if(!i)return!1;let l=!1;if(Array.isArray(i))for(let h=0,c=i.length;h<c;++h)l=Bh(s,t,i[h],e,this.boundHandleStyleImageChange_,r,o,a)||l;else l=Bh(s,t,i,e,this.boundHandleStyleImageChange_,r,o,a);return l}}let Mi=0;const St=1<<Mi++,K=1<<Mi++,kt=1<<Mi++,de=1<<Mi++,Pi=1<<Mi++,ns=1<<Mi++,xr=Math.pow(2,Mi)-1,Bo={[St]:"boolean",[K]:"number",[kt]:"string",[de]:"color",[Pi]:"number[]",[ns]:"size"},E_=Object.keys(Bo).map(Number).sort(Ae);function x_(n){return n in Bo}function ss(n){const t=[];for(const e of E_)rs(n,e)&&t.push(Bo[e]);return t.length===0?"untyped":t.length<3?t.join(" or "):t.slice(0,-1).join(", ")+", or "+t[t.length-1]}function rs(n,t){return(n&t)===t}function ai(n,t){return n===t}class ct{constructor(t,e){if(!x_(t))throw new Error(`literal expressions must have a specific type, got ${ss(t)}`);this.type=t,this.value=e}}class w_{constructor(t,e,...i){this.type=t,this.operator=e,this.args=i}}function gc(){return{variables:new Set,properties:new Set,featureId:!1,geometryType:!1,mapState:!1}}function gt(n,t,e){switch(typeof n){case"boolean":{if(ai(t,kt))return new ct(kt,n?"true":"false");if(!rs(t,St))throw new Error(`got a boolean, but expected ${ss(t)}`);return new ct(St,n)}case"number":{if(ai(t,ns))return new ct(ns,Ft(n));if(ai(t,St))return new ct(St,!!n);if(ai(t,kt))return new ct(kt,n.toString());if(!rs(t,K))throw new Error(`got a number, but expected ${ss(t)}`);return new ct(K,n)}case"string":{if(ai(t,de))return new ct(de,Oo(n));if(ai(t,St))return new ct(St,!!n);if(!rs(t,kt))throw new Error(`got a string, but expected ${ss(t)}`);return new ct(kt,n)}}if(!Array.isArray(n))throw new Error("expression must be an array or a primitive value");if(n.length===0)throw new Error("empty expression");if(typeof n[0]=="string")return P_(n,t,e);for(const i of n)if(typeof i!="number")throw new Error("expected an array of numbers");if(ai(t,ns)){if(n.length!==2)throw new Error(`expected an array of two values for a size, got ${n.length}`);return new ct(ns,n)}if(ai(t,de)){if(n.length===3)return new ct(de,[...n,1]);if(n.length===4)return new ct(de,n);throw new Error(`expected an array of 3 or 4 values for a color, got ${n.length}`)}if(!rs(t,Pi))throw new Error(`got an array of numbers, but expected ${ss(t)}`);return new ct(Pi,n)}const C={Get:"get",Var:"var",Concat:"concat",GeometryType:"geometry-type",LineMetric:"line-metric",Any:"any",All:"all",Not:"!",Resolution:"resolution",Zoom:"zoom",Time:"time",Equal:"==",NotEqual:"!=",GreaterThan:">",GreaterThanOrEqualTo:">=",LessThan:"<",LessThanOrEqualTo:"<=",Multiply:"*",Divide:"/",Add:"+",Subtract:"-",Clamp:"clamp",Mod:"%",Pow:"^",Abs:"abs",Floor:"floor",Ceil:"ceil",Round:"round",Sin:"sin",Cos:"cos",Atan:"atan",Sqrt:"sqrt",Match:"match",Between:"between",Interpolate:"interpolate",Coalesce:"coalesce",Case:"case",In:"in",Number:"number",String:"string",Array:"array",Color:"color",Id:"id",Band:"band",Palette:"palette",ToString:"to-string",Has:"has"},v_={[C.Get]:N(W(1,1/0),_c),[C.Var]:N(W(1,1),C_),[C.Has]:N(W(1,1/0),_c),[C.Id]:N(R_,cn),[C.Concat]:N(W(2,1/0),H(kt)),[C.GeometryType]:N(T_,cn),[C.LineMetric]:N(cn),[C.Resolution]:N(Zo,cn),[C.Zoom]:N(Zo,cn),[C.Time]:N(Zo,cn),[C.Any]:N(W(2,1/0),H(St)),[C.All]:N(W(2,1/0),H(St)),[C.Not]:N(W(1,1),H(St)),[C.Equal]:N(W(2,2),H(xr)),[C.NotEqual]:N(W(2,2),H(xr)),[C.GreaterThan]:N(W(2,2),H(K)),[C.GreaterThanOrEqualTo]:N(W(2,2),H(K)),[C.LessThan]:N(W(2,2),H(K)),[C.LessThanOrEqualTo]:N(W(2,2),H(K)),[C.Multiply]:N(W(2,1/0),mc),[C.Coalesce]:N(W(2,1/0),mc),[C.Divide]:N(W(2,2),H(K)),[C.Add]:N(W(2,1/0),H(K)),[C.Subtract]:N(W(2,2),H(K)),[C.Clamp]:N(W(3,3),H(K)),[C.Mod]:N(W(2,2),H(K)),[C.Pow]:N(W(2,2),H(K)),[C.Abs]:N(W(1,1),H(K)),[C.Floor]:N(W(1,1),H(K)),[C.Ceil]:N(W(1,1),H(K)),[C.Round]:N(W(1,1),H(K)),[C.Sin]:N(W(1,1),H(K)),[C.Cos]:N(W(1,1),H(K)),[C.Atan]:N(W(1,2),H(K)),[C.Sqrt]:N(W(1,1),H(K)),[C.Match]:N(W(4,1/0),pc,S_),[C.Between]:N(W(3,3),H(K)),[C.Interpolate]:N(W(6,1/0),pc,b_),[C.Case]:N(W(3,1/0),I_,L_),[C.In]:N(W(2,2),A_),[C.Number]:N(W(1,1/0),H(xr)),[C.String]:N(W(1,1/0),H(xr)),[C.Array]:N(W(1,1/0),H(K)),[C.Color]:N(W(1,4),H(K)),[C.Band]:N(W(1,3),H(K)),[C.Palette]:N(W(2,2),M_),[C.ToString]:N(W(1,1),H(St|K|kt|de))};function _c(n,t,e){const i=n.length-1,s=new Array(i);for(let r=0;r<i;++r){const o=n[r+1];switch(typeof o){case"number":{s[r]=new ct(K,o);break}case"string":{s[r]=new ct(kt,o);break}default:throw new Error(`expected a string key or numeric array index for a get operation, got ${o}`)}r===0&&e.properties.add(String(o))}return s}function C_(n,t,e){const i=n[1];if(typeof i!="string")throw new Error("expected a string argument for var operation");return e.variables.add(i),[new ct(kt,i)]}function R_(n,t,e){e.featureId=!0}function T_(n,t,e){e.geometryType=!0}function Zo(n,t,e){e.mapState=!0}function cn(n,t,e){const i=n[0];if(n.length!==1)throw new Error(`expected no arguments for ${i} operation`);return[]}function W(n,t){return function(e,i,s){const r=e[0],o=e.length-1;if(n===t){if(o!==n){const a=n===1?"":"s";throw new Error(`expected ${n} argument${a} for ${r}, got ${o}`)}}else if(o<n||o>t){const a=t===1/0?`${n} or more`:`${n} to ${t}`;throw new Error(`expected ${a} arguments for ${r}, got ${o}`)}}}function mc(n,t,e){const i=n.length-1,s=new Array(i);for(let r=0;r<i;++r){const o=gt(n[r+1],t,e);s[r]=o}return s}function H(n){return function(t,e,i){const s=t.length-1,r=new Array(s);for(let o=0;o<s;++o){const a=gt(t[o+1],n,i);r[o]=a}return r}}function I_(n,t,e){const i=n[0],s=n.length-1;if(s%2===0)throw new Error(`expected an odd number of arguments for ${i}, got ${s} instead`)}function pc(n,t,e){const i=n[0],s=n.length-1;if(s%2===1)throw new Error(`expected an even number of arguments for operation ${i}, got ${s} instead`)}function S_(n,t,e){const i=n.length-1,s=kt|K|St,r=gt(n[1],s,e),o=gt(n[n.length-1],t,e),a=new Array(i-2);for(let l=0;l<i-2;l+=2){try{const h=gt(n[l+2],r.type,e);a[l]=h}catch(h){throw new Error(`failed to parse argument ${l+1} of match expression: ${h.message}`)}try{const h=gt(n[l+3],o.type,e);a[l+1]=h}catch(h){throw new Error(`failed to parse argument ${l+2} of match expression: ${h.message}`)}}return[r,...a,o]}function b_(n,t,e){const i=n[1];let s;switch(i[0]){case"linear":s=1;break;case"exponential":const l=i[1];if(typeof l!="number"||l<=0)throw new Error(`expected a number base for exponential interpolation, got ${JSON.stringify(l)} instead`);s=l;break;default:throw new Error(`invalid interpolation type: ${JSON.stringify(i)}`)}const r=new ct(K,s);let o;try{o=gt(n[2],K,e)}catch(l){throw new Error(`failed to parse argument 1 in interpolate expression: ${l.message}`)}const a=new Array(n.length-3);for(let l=0;l<a.length;l+=2){try{const h=gt(n[l+3],K,e);a[l]=h}catch(h){throw new Error(`failed to parse argument ${l+2} for interpolate expression: ${h.message}`)}try{const h=gt(n[l+4],t,e);a[l+1]=h}catch(h){throw new Error(`failed to parse argument ${l+3} for interpolate expression: ${h.message}`)}}return[r,o,...a]}function L_(n,t,e){const i=gt(n[n.length-1],t,e),s=new Array(n.length-1);for(let r=0;r<s.length-1;r+=2){try{const o=gt(n[r+1],St,e);s[r]=o}catch(o){throw new Error(`failed to parse argument ${r} of case expression: ${o.message}`)}try{const o=gt(n[r+2],i.type,e);s[r+1]=o}catch(o){throw new Error(`failed to parse argument ${r+1} of case expression: ${o.message}`)}}return s[s.length-1]=i,s}function A_(n,t,e){let i=n[2];if(!Array.isArray(i))throw new Error('the second argument for the "in" operator must be an array');let s;if(typeof i[0]=="string"){if(i[0]!=="literal")throw new Error('for the "in" operator, a string array should be wrapped in a "literal" operator to disambiguate from expressions');if(!Array.isArray(i[1]))throw new Error('failed to parse "in" expression: the literal operator must be followed by an array');i=i[1],s=kt}else s=K;const r=new Array(i.length);for(let a=0;a<r.length;a++)try{const l=gt(i[a],s,e);r[a]=l}catch(l){throw new Error(`failed to parse haystack item ${a} for "in" expression: ${l.message}`)}return[gt(n[1],s,e),...r]}function M_(n,t,e){let i;try{i=gt(n[1],K,e)}catch(o){throw new Error(`failed to parse first argument in palette expression: ${o.message}`)}const s=n[2];if(!Array.isArray(s))throw new Error("the second argument of palette must be an array");const r=new Array(s.length);for(let o=0;o<r.length;o++){let a;try{a=gt(s[o],de,e)}catch(l){throw new Error(`failed to parse color at index ${o} in palette expression: ${l.message}`)}if(!(a instanceof ct))throw new Error(`the palette color at index ${o} must be a literal value`);r[o]=a}return[i,...r]}function N(...n){return function(t,e,i){const s=t[0];let r;for(let o=0;o<n.length;o++){const a=n[o](t,e,i);if(o==n.length-1){if(!a)throw new Error("expected last argument validator to return the parsed args");r=a}}return new w_(e,s,...r)}}function P_(n,t,e){const i=n[0],s=v_[i];if(!s)throw new Error(`unknown operator: ${i}`);return s(n,t,e)}function yc(n){if(!n)return"";const t=n.getType();switch(t){case"Point":case"LineString":case"Polygon":return t;case"MultiPoint":case"MultiLineString":case"MultiPolygon":return t.substring(5);case"Circle":return"Polygon";case"GeometryCollection":return yc(n.getGeometries()[0]);default:return""}}function Ec(){return{variables:{},properties:{},resolution:NaN,featureId:null,geometryType:""}}function ze(n,t,e){const i=gt(n,t,e);return fe(i)}function fe(n,t){if(n instanceof ct){if(n.type===de&&typeof n.value=="string"){const i=Oo(n.value);return function(){return i}}return function(){return n.value}}const e=n.operator;switch(e){case C.Number:case C.String:case C.Coalesce:return O_(n);case C.Get:case C.Var:case C.Has:return D_(n);case C.Id:return i=>i.featureId;case C.GeometryType:return i=>i.geometryType;case C.Concat:{const i=n.args.map(s=>fe(s));return s=>"".concat(...i.map(r=>r(s).toString()))}case C.Resolution:return i=>i.resolution;case C.Any:case C.All:case C.Between:case C.In:case C.Not:return k_(n);case C.Equal:case C.NotEqual:case C.LessThan:case C.LessThanOrEqualTo:case C.GreaterThan:case C.GreaterThanOrEqualTo:return F_(n);case C.Multiply:case C.Divide:case C.Add:case C.Subtract:case C.Clamp:case C.Mod:case C.Pow:case C.Abs:case C.Floor:case C.Ceil:case C.Round:case C.Sin:case C.Cos:case C.Atan:case C.Sqrt:return N_(n);case C.Case:return G_(n);case C.Match:return z_(n);case C.Interpolate:return X_(n);case C.ToString:return W_(n);default:throw new Error(`Unsupported operator ${e}`)}}function O_(n,t){const e=n.operator,i=n.args.length,s=new Array(i);for(let r=0;r<i;++r)s[r]=fe(n.args[r]);switch(e){case C.Coalesce:return r=>{for(let o=0;o<i;++o){const a=s[o](r);if(typeof a<"u"&&a!==null)return a}throw new Error("Expected one of the values to be non-null")};case C.Number:case C.String:return r=>{for(let o=0;o<i;++o){const a=s[o](r);if(typeof a===e)return a}throw new Error(`Expected one of the values to be a ${e}`)};default:throw new Error(`Unsupported assertion operator ${e}`)}}function D_(n,t){const i=n.args[0].value;switch(n.operator){case C.Get:return s=>{const r=n.args;let o=s.properties[i];for(let a=1,l=r.length;a<l;++a){const c=r[a].value;o=o[c]}return o};case C.Var:return s=>s.variables[i];case C.Has:return s=>{const r=n.args;if(!(i in s.properties))return!1;let o=s.properties[i];for(let a=1,l=r.length;a<l;++a){const c=r[a].value;if(!o||!Object.hasOwn(o,c))return!1;o=o[c]}return!0};default:throw new Error(`Unsupported accessor operator ${n.operator}`)}}function F_(n,t){const e=n.operator,i=fe(n.args[0]),s=fe(n.args[1]);switch(e){case C.Equal:return r=>i(r)===s(r);case C.NotEqual:return r=>i(r)!==s(r);case C.LessThan:return r=>i(r)<s(r);case C.LessThanOrEqualTo:return r=>i(r)<=s(r);case C.GreaterThan:return r=>i(r)>s(r);case C.GreaterThanOrEqualTo:return r=>i(r)>=s(r);default:throw new Error(`Unsupported comparison operator ${e}`)}}function k_(n,t){const e=n.operator,i=n.args.length,s=new Array(i);for(let r=0;r<i;++r)s[r]=fe(n.args[r]);switch(e){case C.Any:return r=>{for(let o=0;o<i;++o)if(s[o](r))return!0;return!1};case C.All:return r=>{for(let o=0;o<i;++o)if(!s[o](r))return!1;return!0};case C.Between:return r=>{const o=s[0](r),a=s[1](r),l=s[2](r);return o>=a&&o<=l};case C.In:return r=>{const o=s[0](r);for(let a=1;a<i;++a)if(o===s[a](r))return!0;return!1};case C.Not:return r=>!s[0](r);default:throw new Error(`Unsupported logical operator ${e}`)}}function N_(n,t){const e=n.operator,i=n.args.length,s=new Array(i);for(let r=0;r<i;++r)s[r]=fe(n.args[r]);switch(e){case C.Multiply:return r=>{let o=1;for(let a=0;a<i;++a)o*=s[a](r);return o};case C.Divide:return r=>s[0](r)/s[1](r);case C.Add:return r=>{let o=0;for(let a=0;a<i;++a)o+=s[a](r);return o};case C.Subtract:return r=>s[0](r)-s[1](r);case C.Clamp:return r=>{const o=s[0](r),a=s[1](r);if(o<a)return a;const l=s[2](r);return o>l?l:o};case C.Mod:return r=>s[0](r)%s[1](r);case C.Pow:return r=>Math.pow(s[0](r),s[1](r));case C.Abs:return r=>Math.abs(s[0](r));case C.Floor:return r=>Math.floor(s[0](r));case C.Ceil:return r=>Math.ceil(s[0](r));case C.Round:return r=>Math.round(s[0](r));case C.Sin:return r=>Math.sin(s[0](r));case C.Cos:return r=>Math.cos(s[0](r));case C.Atan:return i===2?r=>Math.atan2(s[0](r),s[1](r)):r=>Math.atan(s[0](r));case C.Sqrt:return r=>Math.sqrt(s[0](r));default:throw new Error(`Unsupported numeric operator ${e}`)}}function G_(n,t){const e=n.args.length,i=new Array(e);for(let s=0;s<e;++s)i[s]=fe(n.args[s]);return s=>{for(let r=0;r<e-1;r+=2)if(i[r](s))return i[r+1](s);return i[e-1](s)}}function z_(n,t){const e=n.args.length,i=new Array(e);for(let s=0;s<e;++s)i[s]=fe(n.args[s]);return s=>{const r=i[0](s);for(let o=1;o<e-1;o+=2)if(r===i[o](s))return i[o+1](s);return i[e-1](s)}}function X_(n,t){const e=n.args.length,i=new Array(e);for(let s=0;s<e;++s)i[s]=fe(n.args[s]);return s=>{const r=i[0](s),o=i[1](s);let a,l;for(let h=2;h<e;h+=2){const c=i[h](s);let u=i[h+1](s);const d=Array.isArray(u);if(d&&(u=cg(u)),c>=o)return h===2?u:d?Y_(r,o,a,l,c,u):os(r,o,a,l,c,u);a=c,l=u}return l}}function W_(n,t){const e=n.operator,i=n.args.length,s=new Array(i);for(let r=0;r<i;++r)s[r]=fe(n.args[r]);switch(e){case C.ToString:return r=>{const o=s[0](r);return n.args[0].type===de?Do(o):o.toString()};default:throw new Error(`Unsupported convert operator ${e}`)}}function os(n,t,e,i,s,r){const o=s-e;if(o===0)return i;const a=t-e,l=n===1?a/o:(Math.pow(n,a)-1)/(Math.pow(n,o)-1);return i+l*(r-i)}function Y_(n,t,e,i,s,r){if(s-e===0)return i;const a=Ph(i),l=Ph(r);let h=l[2]-a[2];h>180?h-=360:h<-180&&(h+=360);const c=[os(n,t,e,a[0],s,l[0]),os(n,t,e,a[1],s,l[1]),a[2]+os(n,t,e,0,s,h),os(n,t,e,i[3],s,r[3])];return ug(c)}function $_(n){return!0}function K_(n){const t=gc(),e=B_(n,t),i=Ec();return function(s,r){if(i.properties=s.getPropertiesInternal(),i.resolution=r,t.featureId){const o=s.getId();o!==void 0?i.featureId=o:i.featureId=null}return t.geometryType&&(i.geometryType=yc(s.getGeometry())),e(i)}}function xc(n){const t=gc(),e=n.length,i=new Array(e);for(let o=0;o<e;++o)i[o]=Uo(n[o],t);const s=Ec(),r=new Array(e);return function(o,a){if(s.properties=o.getPropertiesInternal(),s.resolution=a,t.featureId){const h=o.getId();h!==void 0?s.featureId=h:s.featureId=null}let l=0;for(let h=0;h<e;++h){const c=i[h](s);c&&(r[l]=c,l+=1)}return r.length=l,r}}function B_(n,t){const e=n.length,i=new Array(e);for(let s=0;s<e;++s){const r=n[s],o="filter"in r?ze(r.filter,St,t):$_;let a;if(Array.isArray(r.style)){const l=r.style.length;a=new Array(l);for(let h=0;h<l;++h)a[h]=Uo(r.style[h],t)}else a=[Uo(r.style,t)];i[s]={filter:o,styles:a}}return function(s){const r=[];let o=!1;for(let a=0;a<e;++a){const l=i[a].filter;if(l(s)&&!(n[a].else&&o)){o=!0;for(const h of i[a].styles){const c=h(s);c&&r.push(c)}}}return r}}function Uo(n,t){const e=as(n,"",t),i=ls(n,"",t),s=Z_(n,t),r=U_(n,t),o=Nt(n,"z-index",t);if(!e&&!i&&!s&&!r&&!$i(n))throw new Error("No fill, stroke, point, or text symbolizer properties in style: "+JSON.stringify(n));const a=new ke;return function(l){let h=!0;if(e){const c=e(l);c&&(h=!1),a.setFill(c)}if(i){const c=i(l);c&&(h=!1),a.setStroke(c)}if(s){const c=s(l);c&&(h=!1),a.setText(c)}if(r){const c=r(l);c&&(h=!1),a.setImage(c)}return o&&a.setZIndex(o(l)),h?null:a}}function as(n,t,e){let i;if(t+"fill-pattern-src"in n)i=q_(n,t+"fill-",e);else{if(n[t+"fill-color"]==="none")return r=>null;i=Vo(n,t+"fill-color",e)}if(!i)return null;const s=new on;return function(r){const o=i(r);return o===Io?null:(s.setColor(o),s)}}function ls(n,t,e){const i=Nt(n,t+"stroke-width",e),s=Vo(n,t+"stroke-color",e);if(!i&&!s)return null;const r=Xe(n,t+"stroke-line-cap",e),o=Xe(n,t+"stroke-line-join",e),a=wc(n,t+"stroke-line-dash",e),l=Nt(n,t+"stroke-line-dash-offset",e),h=Nt(n,t+"stroke-miter-limit",e),c=new gr;return function(u){if(s){const d=s(u);if(d===Io)return null;c.setColor(d)}if(i&&c.setWidth(i(u)),r){const d=r(u);if(d!=="butt"&&d!=="round"&&d!=="square")throw new Error("Expected butt, round, or square line cap");c.setLineCap(d)}if(o){const d=o(u);if(d!=="bevel"&&d!=="round"&&d!=="miter")throw new Error("Expected bevel, round, or miter line join");c.setLineJoin(d)}return a&&c.setLineDash(a(u)),l&&c.setLineDashOffset(l(u)),h&&c.setMiterLimit(h(u)),c}}function Z_(n,t){const e="text-",i=Xe(n,e+"value",t);if(!i)return null;const s=as(n,e,t),r=as(n,e+"background-",t),o=ls(n,e,t),a=ls(n,e+"background-",t),l=Xe(n,e+"font",t),h=Nt(n,e+"max-angle",t),c=Nt(n,e+"offset-x",t),u=Nt(n,e+"offset-y",t),d=un(n,e+"overflow",t),f=Xe(n,e+"placement",t),g=Nt(n,e+"repeat",t),m=vr(n,e+"scale",t),_=un(n,e+"rotate-with-view",t),p=Nt(n,e+"rotation",t),y=Xe(n,e+"align",t),v=Xe(n,e+"justify",t),E=Xe(n,e+"baseline",t),x=un(n,e+"keep-upright",t),w=wc(n,e+"padding",t),T=Rr(n,e+"declutter-mode"),R=new Jg({declutterMode:T});return function(I){if(R.setText(i(I)),s&&R.setFill(s(I)),r&&R.setBackgroundFill(r(I)),o&&R.setStroke(o(I)),a&&R.setBackgroundStroke(a(I)),l&&R.setFont(l(I)),h&&R.setMaxAngle(h(I)),c&&R.setOffsetX(c(I)),u&&R.setOffsetY(u(I)),d&&R.setOverflow(d(I)),f){const L=f(I);if(L!=="point"&&L!=="line")throw new Error("Expected point or line for text-placement");R.setPlacement(L)}if(g&&R.setRepeat(g(I)),m&&R.setScale(m(I)),_&&R.setRotateWithView(_(I)),p&&R.setRotation(p(I)),y){const L=y(I);if(L!=="left"&&L!=="center"&&L!=="right"&&L!=="end"&&L!=="start")throw new Error("Expected left, right, center, start, or end for text-align");R.setTextAlign(L)}if(v){const L=v(I);if(L!=="left"&&L!=="right"&&L!=="center")throw new Error("Expected left, right, or center for text-justify");R.setJustify(L)}if(E){const L=E(I);if(L!=="bottom"&&L!=="top"&&L!=="middle"&&L!=="alphabetic"&&L!=="hanging")throw new Error("Expected bottom, top, middle, alphabetic, or hanging for text-baseline");R.setTextBaseline(L)}return w&&R.setPadding(w(I)),x&&R.setKeepUpright(x(I)),R}}function U_(n,t){return"icon-src"in n?V_(n,t):"shape-points"in n?j_(n,t):"circle-radius"in n?H_(n,t):null}function V_(n,t){const e="icon-",i=e+"src",s=Tc(n[i],i),r=wr(n,e+"anchor",t),o=vr(n,e+"scale",t),a=Nt(n,e+"opacity",t),l=wr(n,e+"displacement",t),h=Nt(n,e+"rotation",t),c=un(n,e+"rotate-with-view",t),u=Cc(n,e+"anchor-origin"),d=Rc(n,e+"anchor-x-units"),f=Rc(n,e+"anchor-y-units"),g=em(n,e+"color"),m=Q_(n,e+"cross-origin"),_=tm(n,e+"offset"),p=Cc(n,e+"offset-origin"),y=Cr(n,e+"width"),v=Cr(n,e+"height"),E=J_(n,e+"size"),x=Rr(n,e+"declutter-mode"),w=new ln({src:s,anchorOrigin:u,anchorXUnits:d,anchorYUnits:f,color:g,crossOrigin:m,offset:_,offsetOrigin:p,height:v,width:y,size:E,declutterMode:x});return function(T){return a&&w.setOpacity(a(T)),l&&w.setDisplacement(l(T)),h&&w.setRotation(h(T)),c&&w.setRotateWithView(c(T)),o&&w.setScale(o(T)),r&&w.setAnchor(r(T)),w}}function j_(n,t){const e="shape-",i=e+"points",s=e+"radius",r=jo(n[i],i),o=jo(n[s],s),a=as(n,e,t),l=ls(n,e,t),h=vr(n,e+"scale",t),c=wr(n,e+"displacement",t),u=Nt(n,e+"rotation",t),d=un(n,e+"rotate-with-view",t),f=Cr(n,e+"radius2"),g=Cr(n,e+"angle"),m=Rr(n,e+"declutter-mode"),_=new mr({points:r,radius:o,radius2:f,angle:g,declutterMode:m});return function(p){return a&&_.setFill(a(p)),l&&_.setStroke(l(p)),c&&_.setDisplacement(c(p)),u&&_.setRotation(u(p)),d&&_.setRotateWithView(d(p)),h&&_.setScale(h(p)),_}}function H_(n,t){const e="circle-",i=as(n,e,t),s=ls(n,e,t),r=Nt(n,e+"radius",t),o=vr(n,e+"scale",t),a=wr(n,e+"displacement",t),l=Nt(n,e+"rotation",t),h=un(n,e+"rotate-with-view",t),c=Rr(n,e+"declutter-mode"),u=new pr({radius:5,declutterMode:c});return function(d){return r&&u.setRadius(r(d)),i&&u.setFill(i(d)),s&&u.setStroke(s(d)),a&&u.setDisplacement(a(d)),l&&u.setRotation(l(d)),h&&u.setRotateWithView(h(d)),o&&u.setScale(o(d)),u}}function Nt(n,t,e){if(!(t in n))return;const i=ze(n[t],K,e);return function(s){return jo(i(s),t)}}function Xe(n,t,e){if(!(t in n))return null;const i=ze(n[t],kt,e);return function(s){return Tc(i(s),t)}}function q_(n,t,e){const i=Xe(n,t+"pattern-src",e),s=vc(n,t+"pattern-offset",e),r=vc(n,t+"pattern-size",e),o=Vo(n,t+"color",e);return function(a){return{src:i(a),offset:s&&s(a),size:r&&r(a),color:o&&o(a)}}}function un(n,t,e){if(!(t in n))return null;const i=ze(n[t],St,e);return function(s){const r=i(s);if(typeof r!="boolean")throw new Error(`Expected a boolean for ${t}`);return r}}function Vo(n,t,e){if(!(t in n))return null;const i=ze(n[t],de,e);return function(s){return Ic(i(s),t)}}function wc(n,t,e){if(!(t in n))return null;const i=ze(n[t],Pi,e);return function(s){return hs(i(s),t)}}function wr(n,t,e){if(!(t in n))return null;const i=ze(n[t],Pi,e);return function(s){const r=hs(i(s),t);if(r.length!==2)throw new Error(`Expected two numbers for ${t}`);return r}}function vc(n,t,e){if(!(t in n))return null;const i=ze(n[t],Pi,e);return function(s){return Sc(i(s),t)}}function vr(n,t,e){if(!(t in n))return null;const i=ze(n[t],Pi|K,e);return function(s){return im(i(s),t)}}function Cr(n,t){const e=n[t];if(e!==void 0){if(typeof e!="number")throw new Error(`Expected a number for ${t}`);return e}}function J_(n,t){const e=n[t];if(e!==void 0){if(typeof e=="number")return Ft(e);if(!Array.isArray(e))throw new Error(`Expected a number or size array for ${t}`);if(e.length!==2||typeof e[0]!="number"||typeof e[1]!="number")throw new Error(`Expected a number or size array for ${t}`);return e}}function Q_(n,t){const e=n[t];if(e!==void 0){if(typeof e!="string")throw new Error(`Expected a string for ${t}`);return e}}function Cc(n,t){const e=n[t];if(e!==void 0){if(e!=="bottom-left"&&e!=="bottom-right"&&e!=="top-left"&&e!=="top-right")throw new Error(`Expected bottom-left, bottom-right, top-left, or top-right for ${t}`);return e}}function Rc(n,t){const e=n[t];if(e!==void 0){if(e!=="pixels"&&e!=="fraction")throw new Error(`Expected pixels or fraction for ${t}`);return e}}function tm(n,t){const e=n[t];if(e!==void 0)return hs(e,t)}function Rr(n,t){const e=n[t];if(e!==void 0){if(typeof e!="string")throw new Error(`Expected a string for ${t}`);if(e!=="declutter"&&e!=="obstacle"&&e!=="none")throw new Error(`Expected declutter, obstacle, or none for ${t}`);return e}}function em(n,t){const e=n[t];if(e!==void 0)return Ic(e,t)}function hs(n,t){if(!Array.isArray(n))throw new Error(`Expected an array for ${t}`);const e=n.length;for(let i=0;i<e;++i)if(typeof n[i]!="number")throw new Error(`Expected an array of numbers for ${t}`);return n}function Tc(n,t){if(typeof n!="string")throw new Error(`Expected a string for ${t}`);return n}function jo(n,t){if(typeof n!="number")throw new Error(`Expected a number for ${t}`);return n}function Ic(n,t){if(typeof n=="string")return n;const e=hs(n,t),i=e.length;if(i<3||i>4)throw new Error(`Expected a color with 3 or 4 values for ${t}`);return e}function Sc(n,t){const e=hs(n,t);if(e.length!==2)throw new Error(`Expected an array of two numbers for ${t}`);return e}function im(n,t){return typeof n=="number"?n:Sc(n,t)}const ge={CENTER:"center",RESOLUTION:"resolution",ROTATION:"rotation"};function bc(n,t,e){return(function(i,s,r,o,a){if(!i)return;if(!s&&!t)return i;const l=t?0:r[0]*s,h=t?0:r[1]*s,c=a?a[0]:0,u=a?a[1]:0;let d=n[0]+l/2+c,f=n[2]-l/2+c,g=n[1]+h/2+u,m=n[3]-h/2+u;d>f&&(d=(f+d)/2,f=d),g>m&&(g=(m+g)/2,m=g);let _=rt(i[0],d,f),p=rt(i[1],g,m);if(o&&e&&s){const y=30*s;_+=-y*Math.log(1+Math.max(0,d-i[0])/y)+y*Math.log(1+Math.max(0,i[0]-f)/y),p+=-y*Math.log(1+Math.max(0,g-i[1])/y)+y*Math.log(1+Math.max(0,i[1]-m)/y)}return[_,p]})}function nm(n){return n}function Lc(n){return Math.pow(n,3)}function dn(n){return 1-Lc(1-n)}function sm(n){return 3*n*n-2*n*n*n}function rm(n){return n}function Ho(n,t,e,i){const s=J(t)/e[0],r=It(t)/e[1];return i?Math.min(n,Math.max(s,r)):Math.min(n,Math.min(s,r))}function qo(n,t,e){let i=Math.min(n,t);const s=50;return i*=Math.log(1+s*Math.max(0,n/t-1))/s+1,e&&(i=Math.max(i,e),i/=Math.log(1+s*Math.max(0,e/n-1))/s+1),rt(i,e/2,t*2)}function om(n,t,e,i){return t=t!==void 0?t:!0,(function(s,r,o,a){if(s!==void 0){const l=n[0],h=n[n.length-1],c=e?Ho(l,e,o,i):l;if(a)return t?qo(s,c,h):rt(s,h,c);const u=Math.min(c,s),d=Math.floor(jr(n,u,r));return n[d]>c&&d<n.length-1?n[d+1]:n[d]}})}function am(n,t,e,i,s,r){return i=i!==void 0?i:!0,e=e!==void 0?e:0,(function(o,a,l,h){if(o!==void 0){const c=s?Ho(t,s,l,r):t;if(h)return i?qo(o,c,e):rt(o,e,c);const u=1e-9,d=Math.ceil(Math.log(t/c)/Math.log(n)-u),f=-a*(.5-u)+.5,g=Math.min(c,o),m=Math.floor(Math.log(t/g)/Math.log(n)+f),_=Math.max(d,m),p=t/Math.pow(n,_);return rt(p,e,c)}})}function Ac(n,t,e,i,s){return e=e!==void 0?e:!0,(function(r,o,a,l){if(r!==void 0){const h=i?Ho(n,i,a,s):n;return!e||!l?rt(r,t,h):qo(r,h,t)}})}function Jo(n){if(n!==void 0)return 0}function Mc(n){if(n!==void 0)return n}function lm(n){const t=2*Math.PI/n;return(function(e,i){if(i)return e;if(e!==void 0)return e=Math.floor(e/t+.5)*t,e})}function hm(n){const t=Qe(5);return(function(e,i){return i||e===void 0?e:Math.abs(e)<=t?0:e})}const cm=42,Qo=256,ta=0;class xe extends he{constructor(t){super(),this.on,this.once,this.un,t=Object.assign({},t),this.hints_=[0,0],this.animations_=[],this.updateAnimationKey_,this.projection_=_o(t.projection,"EPSG:3857"),this.viewportSize_=[100,100],this.targetCenter_=null,this.targetResolution_,this.targetRotation_,this.nextCenter_=null,this.nextResolution_,this.nextRotation_,this.cancelAnchor_=void 0,t.projection&&sh(),t.center&&(t.center=Pe(t.center,this.projection_)),t.extent&&(t.extent=ti(t.extent,this.projection_)),this.applyOptions_(t)}applyOptions_(t){const e=Object.assign({},t);for(const a in ge)delete e[a];this.setProperties(e,!0);const i=dm(t);this.maxResolution_=i.maxResolution,this.minResolution_=i.minResolution,this.zoomFactor_=i.zoomFactor,this.resolutions_=t.resolutions,this.padding_=t.padding,this.minZoom_=i.minZoom;const s=um(t),r=i.constraint,o=fm(t);this.constraints_={center:s,resolution:r,rotation:o},this.setRotation(t.rotation!==void 0?t.rotation:0),this.setCenterInternal(t.center!==void 0?t.center:null),t.resolution!==void 0?this.setResolution(t.resolution):t.zoom!==void 0&&this.setZoom(t.zoom)}get padding(){return this.padding_}set padding(t){let e=this.padding_;this.padding_=t;const i=this.getCenterInternal();if(i){const s=t||[0,0,0,0];e=e||[0,0,0,0];const r=this.getResolution(),o=r/2*(s[3]-e[3]+e[1]-s[1]),a=r/2*(s[0]-e[0]+e[2]-s[2]);this.setCenterInternal([i[0]+o,i[1]-a])}}getUpdatedOptions_(t){const e=this.getProperties();return e.resolution!==void 0?e.resolution=this.getResolution():e.zoom=this.getZoom(),e.center=this.getCenterInternal(),e.rotation=this.getRotation(),Object.assign({},e,t)}animate(t){this.isDef()&&!this.getAnimating()&&this.resolveConstraints(0);const e=new Array(arguments.length);for(let i=0;i<e.length;++i){let s=arguments[i];s.center&&(s=Object.assign({},s),s.center=Pe(s.center,this.getProjection())),s.anchor&&(s=Object.assign({},s),s.anchor=Pe(s.anchor,this.getProjection())),e[i]=s}this.animateInternal.apply(this,e)}animateInternal(t){let e=arguments.length,i;e>1&&typeof arguments[e-1]=="function"&&(i=arguments[e-1],--e);let s=0;for(;s<e&&!this.isDef();++s){const c=arguments[s];c.center&&this.setCenterInternal(c.center),c.zoom!==void 0?this.setZoom(c.zoom):c.resolution&&this.setResolution(c.resolution),c.rotation!==void 0&&this.setRotation(c.rotation)}if(s===e){i&&Tr(i,!0);return}let r=Date.now(),o=this.targetCenter_.slice(),a=this.targetResolution_,l=this.targetRotation_;const h=[];for(;s<e;++s){const c=arguments[s],u={start:r,complete:!1,anchor:c.anchor,duration:c.duration!==void 0?c.duration:1e3,easing:c.easing||sm,callback:i};if(c.center&&(u.sourceCenter=o,u.targetCenter=c.center.slice(),o=u.targetCenter),c.zoom!==void 0?(u.sourceResolution=a,u.targetResolution=this.getResolutionForZoom(c.zoom),a=u.targetResolution):c.resolution&&(u.sourceResolution=a,u.targetResolution=c.resolution,a=u.targetResolution),c.rotation!==void 0){u.sourceRotation=l;const d=Ui(c.rotation-l+Math.PI,2*Math.PI)-Math.PI;u.targetRotation=l+d,l=u.targetRotation}gm(u)?u.complete=!0:r+=u.duration,h.push(u)}this.animations_.push(h),this.setHint(pt.ANIMATING,1),this.updateAnimations_()}getAnimating(){return this.hints_[pt.ANIMATING]>0}getInteracting(){return this.hints_[pt.INTERACTING]>0}cancelAnimations(){this.setHint(pt.ANIMATING,-this.hints_[pt.ANIMATING]);let t;for(let e=0,i=this.animations_.length;e<i;++e){const s=this.animations_[e];if(s[0].callback&&Tr(s[0].callback,!1),!t)for(let r=0,o=s.length;r<o;++r){const a=s[r];if(!a.complete){t=a.anchor;break}}}this.animations_.length=0,this.cancelAnchor_=t,this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN}updateAnimations_(){if(this.updateAnimationKey_!==void 0&&(cancelAnimationFrame(this.updateAnimationKey_),this.updateAnimationKey_=void 0),!this.getAnimating())return;const t=Date.now();let e=!1;for(let i=this.animations_.length-1;i>=0;--i){const s=this.animations_[i];let r=!0;for(let o=0,a=s.length;o<a;++o){const l=s[o];if(l.complete)continue;const h=t-l.start;let c=l.duration>0?h/l.duration:1;c>=1?(l.complete=!0,c=1):r=!1;const u=l.easing(c);if(l.sourceCenter){const d=l.sourceCenter[0],f=l.sourceCenter[1],g=l.targetCenter[0],m=l.targetCenter[1];this.nextCenter_=l.targetCenter;const _=d+u*(g-d),p=f+u*(m-f);this.targetCenter_=[_,p]}if(l.sourceResolution&&l.targetResolution){const d=u===1?l.targetResolution:l.sourceResolution+u*(l.targetResolution-l.sourceResolution);if(l.anchor){const f=this.getViewportSize_(this.getRotation()),g=this.constraints_.resolution(d,0,f,!0);this.targetCenter_=this.calculateCenterZoom(g,l.anchor)}this.nextResolution_=l.targetResolution,this.targetResolution_=d,this.applyTargetState_(!0)}if(l.sourceRotation!==void 0&&l.targetRotation!==void 0){const d=u===1?Ui(l.targetRotation+Math.PI,2*Math.PI)-Math.PI:l.sourceRotation+u*(l.targetRotation-l.sourceRotation);if(l.anchor){const f=this.constraints_.rotation(d,!0);this.targetCenter_=this.calculateCenterRotate(f,l.anchor)}this.nextRotation_=l.targetRotation,this.targetRotation_=d}if(this.applyTargetState_(!0),e=!0,!l.complete)break}if(r){this.animations_[i]=null,this.setHint(pt.ANIMATING,-1),this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN;const o=s[0].callback;o&&Tr(o,!0)}}this.animations_=this.animations_.filter(Boolean),e&&this.updateAnimationKey_===void 0&&(this.updateAnimationKey_=requestAnimationFrame(this.updateAnimations_.bind(this)))}calculateCenterRotate(t,e){let i;const s=this.getCenterInternal();return s!==void 0&&(i=[s[0]-e[0],s[1]-e[1]],so(i,t-this.getRotation()),Vd(i,e)),i}calculateCenterZoom(t,e){let i;const s=this.getCenterInternal(),r=this.getResolution();if(s!==void 0&&r!==void 0){const o=e[0]-t*(e[0]-s[0])/r,a=e[1]-t*(e[1]-s[1])/r;i=[o,a]}return i}getViewportSize_(t){const e=this.viewportSize_;if(t){const i=e[0],s=e[1];return[Math.abs(i*Math.cos(t))+Math.abs(s*Math.sin(t)),Math.abs(i*Math.sin(t))+Math.abs(s*Math.cos(t))]}return e}setViewportSize(t){this.viewportSize_=Array.isArray(t)?t.slice():[100,100],this.getAnimating()||this.resolveConstraints(0)}getCenter(){const t=this.getCenterInternal();return t&&Eo(t,this.getProjection())}getCenterInternal(){return this.get(ge.CENTER)}getConstraints(){return this.constraints_}getConstrainResolution(){return this.get("constrainResolution")}getHints(t){return t!==void 0?(t[0]=this.hints_[0],t[1]=this.hints_[1],t):this.hints_.slice()}calculateExtent(t){const e=this.calculateExtentInternal(t);return ah(e,this.getProjection())}calculateExtentInternal(t){t=t||this.getViewportSizeMinusPadding_();const e=this.getCenterInternal();q(e,"The view center is not defined");const i=this.getResolution();q(i!==void 0,"The view resolution is not defined");const s=this.getRotation();return q(s!==void 0,"The view rotation is not defined"),io(e,i,s,t)}getMaxResolution(){return this.maxResolution_}getMinResolution(){return this.minResolution_}getMaxZoom(){return this.getZoomForResolution(this.minResolution_)}setMaxZoom(t){this.applyOptions_(this.getUpdatedOptions_({maxZoom:t}))}getMinZoom(){return this.getZoomForResolution(this.maxResolution_)}setMinZoom(t){this.applyOptions_(this.getUpdatedOptions_({minZoom:t}))}setConstrainResolution(t){this.applyOptions_(this.getUpdatedOptions_({constrainResolution:t}))}getProjection(){return this.projection_}getResolution(){return this.get(ge.RESOLUTION)}getResolutions(){return this.resolutions_}getResolutionForExtent(t,e){return this.getResolutionForExtentInternal(ti(t,this.getProjection()),e)}getResolutionForExtentInternal(t,e){e=e||this.getViewportSizeMinusPadding_();const i=J(t)/e[0],s=It(t)/e[1];return Math.max(i,s)}getResolutionForValueFunction(t){t=t||2;const e=this.getConstrainedResolution(this.maxResolution_),i=this.minResolution_,s=Math.log(e/i)/Math.log(t);return(function(r){return e/Math.pow(t,r*s)})}getRotation(){return this.get(ge.ROTATION)}getValueForResolutionFunction(t){const e=Math.log(t||2),i=this.getConstrainedResolution(this.maxResolution_),s=this.minResolution_,r=Math.log(i/s)/e;return(function(o){return Math.log(i/o)/e/r})}getViewportSizeMinusPadding_(t){let e=this.getViewportSize_(t);const i=this.padding_;return i&&(e=[e[0]-i[1]-i[3],e[1]-i[0]-i[2]]),e}getState(){const t=this.getProjection(),e=this.getResolution(),i=this.getRotation();let s=this.getCenterInternal();const r=this.padding_;if(r){const o=this.getViewportSizeMinusPadding_();s=ea(s,this.getViewportSize_(),[o[0]/2+r[3],o[1]/2+r[0]],e,i)}return{center:s.slice(0),projection:t!==void 0?t:null,resolution:e,nextCenter:this.nextCenter_,nextResolution:this.nextResolution_,nextRotation:this.nextRotation_,rotation:i,zoom:this.getZoom()}}getViewStateAndExtent(){return{viewState:this.getState(),extent:this.calculateExtent()}}getZoom(){let t;const e=this.getResolution();return e!==void 0&&(t=this.getZoomForResolution(e)),t}getZoomForResolution(t){let e=this.minZoom_||0,i,s;if(this.resolutions_){const r=jr(this.resolutions_,t,1);e=r,i=this.resolutions_[r],r==this.resolutions_.length-1?s=2:s=i/this.resolutions_[r+1]}else i=this.maxResolution_,s=this.zoomFactor_;return e+Math.log(i/t)/Math.log(s)}getResolutionForZoom(t){if(this.resolutions_?.length){if(this.resolutions_.length===1)return this.resolutions_[0];const e=rt(Math.floor(t),0,this.resolutions_.length-2),i=this.resolutions_[e]/this.resolutions_[e+1];return this.resolutions_[e]/Math.pow(i,rt(t-e,0,1))}return this.maxResolution_/Math.pow(this.zoomFactor_,t-this.minZoom_)}fit(t,e){let i;if(q(Array.isArray(t)||typeof t.getSimplifiedGeometry=="function","Invalid extent or geometry provided as `geometry`"),Array.isArray(t)){q(!Bs(t),"Cannot fit empty extent provided as `geometry`");const s=ti(t,this.getProjection());i=Ch(s)}else if(t.getType()==="Circle"){const s=ti(t.getExtent(),this.getProjection());i=Ch(s),i.rotate(this.getRotation(),xi(s))}else i=t;this.fitInternal(i,e)}rotatedExtentForGeometry(t){const e=this.getRotation(),i=Math.cos(e),s=Math.sin(-e),r=t.getFlatCoordinates(),o=t.getStride();let a=1/0,l=1/0,h=-1/0,c=-1/0;for(let u=0,d=r.length;u<d;u+=o){const f=r[u]*i-r[u+1]*s,g=r[u]*s+r[u+1]*i;a=Math.min(a,f),l=Math.min(l,g),h=Math.max(h,f),c=Math.max(c,g)}return[a,l,h,c]}fitInternal(t,e){e=e||{};let i=e.size;i||(i=this.getViewportSizeMinusPadding_());const s=e.padding!==void 0?e.padding:[0,0,0,0],r=e.nearest!==void 0?e.nearest:!1;let o;e.minResolution!==void 0?o=e.minResolution:e.maxZoom!==void 0?o=this.getResolutionForZoom(e.maxZoom):o=0;const a=this.rotatedExtentForGeometry(t);let l=this.getResolutionForExtentInternal(a,[i[0]-s[1]-s[3],i[1]-s[0]-s[2]]);l=isNaN(l)?o:Math.max(l,o),l=this.getConstrainedResolution(l,r?0:1);const h=this.getRotation(),c=Math.sin(h),u=Math.cos(h),d=xi(a);d[0]+=(s[1]-s[3])/2*l,d[1]+=(s[0]-s[2])/2*l;const f=d[0]*u-d[1]*c,g=d[1]*u+d[0]*c,m=this.getConstrainedCenter([f,g],l),_=e.callback?e.callback:Fn;e.duration!==void 0?this.animateInternal({resolution:l,center:m,duration:e.duration,easing:e.easing},_):(this.targetResolution_=l,this.targetCenter_=m,this.applyTargetState_(!1,!0),Tr(_,!0))}centerOn(t,e,i){this.centerOnInternal(Pe(t,this.getProjection()),e,i)}centerOnInternal(t,e,i){this.setCenterInternal(ea(t,e,i,this.getResolution(),this.getRotation()))}calculateCenterShift(t,e,i,s){let r;const o=this.padding_;if(o&&t){const a=this.getViewportSizeMinusPadding_(-i),l=ea(t,s,[a[0]/2+o[3],a[1]/2+o[0]],e,i);r=[t[0]-l[0],t[1]-l[1]]}return r}isDef(){return!!this.getCenterInternal()&&this.getResolution()!==void 0}adjustCenter(t){const e=Eo(this.targetCenter_,this.getProjection());this.setCenter([e[0]+t[0],e[1]+t[1]])}adjustCenterInternal(t){const e=this.targetCenter_;this.setCenterInternal([e[0]+t[0],e[1]+t[1]])}adjustResolution(t,e){e=e&&Pe(e,this.getProjection()),this.adjustResolutionInternal(t,e)}adjustResolutionInternal(t,e){const i=this.getAnimating()||this.getInteracting(),s=this.getViewportSize_(this.getRotation()),r=this.constraints_.resolution(this.targetResolution_*t,0,s,i);e&&(this.targetCenter_=this.calculateCenterZoom(r,e)),this.targetResolution_*=t,this.applyTargetState_()}adjustZoom(t,e){this.adjustResolution(Math.pow(this.zoomFactor_,-t),e)}adjustRotation(t,e){e&&(e=Pe(e,this.getProjection())),this.adjustRotationInternal(t,e)}adjustRotationInternal(t,e){const i=this.getAnimating()||this.getInteracting(),s=this.constraints_.rotation(this.targetRotation_+t,i);e&&(this.targetCenter_=this.calculateCenterRotate(s,e)),this.targetRotation_+=t,this.applyTargetState_()}setCenter(t){this.setCenterInternal(t&&Pe(t,this.getProjection()))}setCenterInternal(t){this.targetCenter_=t,this.applyTargetState_()}setHint(t,e){return this.hints_[t]+=e,this.changed(),this.hints_[t]}setResolution(t){this.targetResolution_=t,this.applyTargetState_()}setRotation(t){this.targetRotation_=t,this.applyTargetState_()}setZoom(t){this.setResolution(this.getResolutionForZoom(t))}applyTargetState_(t,e){const i=this.getAnimating()||this.getInteracting()||e,s=this.constraints_.rotation(this.targetRotation_,i),r=this.getViewportSize_(s),o=this.constraints_.resolution(this.targetResolution_,0,r,i),a=this.constraints_.center(this.targetCenter_,o,r,i,this.calculateCenterShift(this.targetCenter_,o,s,r));this.get(ge.ROTATION)!==s&&this.set(ge.ROTATION,s),this.get(ge.RESOLUTION)!==o&&(this.set(ge.RESOLUTION,o),this.set("zoom",this.getZoom(),!0)),(!a||!this.get(ge.CENTER)||!js(this.get(ge.CENTER),a))&&this.set(ge.CENTER,a),this.getAnimating()&&!t&&this.cancelAnimations(),this.cancelAnchor_=void 0}resolveConstraints(t,e,i){t=t!==void 0?t:200;const s=e||0,r=this.constraints_.rotation(this.targetRotation_),o=this.getViewportSize_(r),a=this.constraints_.resolution(this.targetResolution_,s,o),l=this.constraints_.center(this.targetCenter_,a,o,!1,this.calculateCenterShift(this.targetCenter_,a,r,o));if(t===0&&!this.cancelAnchor_){this.targetResolution_=a,this.targetRotation_=r,this.targetCenter_=l,this.applyTargetState_();return}i=i||(t===0?this.cancelAnchor_:void 0),this.cancelAnchor_=void 0,(this.getResolution()!==a||this.getRotation()!==r||!this.getCenterInternal()||!js(this.getCenterInternal(),l))&&(this.getAnimating()&&this.cancelAnimations(),this.animateInternal({rotation:r,center:l,resolution:a,duration:t,easing:dn,anchor:i}))}beginInteraction(){this.resolveConstraints(0),this.setHint(pt.INTERACTING,1)}endInteraction(t,e,i){i=i&&Pe(i,this.getProjection()),this.endInteractionInternal(t,e,i)}endInteractionInternal(t,e,i){this.getInteracting()&&(this.setHint(pt.INTERACTING,-1),this.resolveConstraints(t,e,i))}getConstrainedCenter(t,e){const i=this.getViewportSize_(this.getRotation());return this.constraints_.center(t,e||this.getResolution(),i)}getConstrainedZoom(t,e){const i=this.getResolutionForZoom(t);return this.getZoomForResolution(this.getConstrainedResolution(i,e))}getConstrainedResolution(t,e){e=e||0;const i=this.getViewportSize_(this.getRotation());return this.constraints_.resolution(t,e,i)}}function Tr(n,t){setTimeout(function(){n(t)},0)}function um(n){if(n.extent!==void 0){const e=n.smoothExtentConstraint!==void 0?n.smoothExtentConstraint:!0;return bc(n.extent,n.constrainOnlyCenter,e)}const t=_o(n.projection,"EPSG:3857");if(n.multiWorld!==!0&&t.isGlobal()){const e=t.getExtent().slice();return e[0]=-1/0,e[2]=1/0,bc(e,!1,!1)}return nm}function dm(n){let t,e,i,o=n.minZoom!==void 0?n.minZoom:ta,a=n.maxZoom!==void 0?n.maxZoom:28;const l=n.zoomFactor!==void 0?n.zoomFactor:2,h=n.multiWorld!==void 0?n.multiWorld:!1,c=n.smoothResolutionConstraint!==void 0?n.smoothResolutionConstraint:!0,u=n.showFullExtent!==void 0?n.showFullExtent:!1,d=_o(n.projection,"EPSG:3857"),f=d.getExtent();let g=n.constrainOnlyCenter,m=n.extent;if(!h&&!m&&d.isGlobal()&&(g=!1,m=f),n.resolutions!==void 0){const _=n.resolutions;e=_[o],i=_[a]!==void 0?_[a]:_[_.length-1],n.constrainResolution?t=om(_,c,!g&&m,u):t=Ac(e,i,c,!g&&m,u)}else{const p=(f?Math.max(J(f),It(f)):360*ro.degrees/d.getMetersPerUnit())/Qo/Math.pow(2,ta),y=p/Math.pow(2,28-ta);e=n.maxResolution,e!==void 0?o=0:e=p/Math.pow(l,o),i=n.minResolution,i===void 0&&(n.maxZoom!==void 0?n.maxResolution!==void 0?i=e/Math.pow(l,a):i=p/Math.pow(l,a):i=y),a=o+Math.floor(Math.log(e/i)/Math.log(l)),i=e/Math.pow(l,a-o),n.constrainResolution?t=am(l,e,i,c,!g&&m,u):t=Ac(e,i,c,!g&&m,u)}return{constraint:t,maxResolution:e,minResolution:i,minZoom:o,zoomFactor:l}}function fm(n){if(n.enableRotation!==void 0?n.enableRotation:!0){const e=n.constrainRotation;return e===void 0||e===!0?hm():e===!1?Mc:typeof e=="number"?lm(e):Mc}return Jo}function gm(n){return!(n.sourceCenter&&n.targetCenter&&!js(n.sourceCenter,n.targetCenter)||n.sourceResolution!==n.targetResolution||n.sourceRotation!==n.targetRotation)}function ea(n,t,e,i,s){const r=Math.cos(-s);let o=Math.sin(-s),a=n[0]*r-n[1]*o,l=n[1]*r+n[0]*o;a+=(t[0]/2-e[0])*i,l+=(e[1]-t[1]/2)*i,o=-o;const h=a*r-l*o,c=l*r+a*o;return[h,c]}const Q={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"};class Pc extends he{constructor(t){super(),this.on,this.once,this.un,this.background_=t.background;const e=Object.assign({},t);typeof t.properties=="object"&&(delete e.properties,Object.assign(e,t.properties)),e[Q.OPACITY]=t.opacity!==void 0?t.opacity:1,q(typeof e[Q.OPACITY]=="number","Layer opacity must be a number"),e[Q.VISIBLE]=t.visible!==void 0?t.visible:!0,e[Q.Z_INDEX]=t.zIndex,e[Q.MAX_RESOLUTION]=t.maxResolution!==void 0?t.maxResolution:1/0,e[Q.MIN_RESOLUTION]=t.minResolution!==void 0?t.minResolution:0,e[Q.MIN_ZOOM]=t.minZoom!==void 0?t.minZoom:-1/0,e[Q.MAX_ZOOM]=t.maxZoom!==void 0?t.maxZoom:1/0,this.className_=e.className!==void 0?e.className:"ol-layer",delete e.className,this.setProperties(e),this.state_=null}getBackground(){return this.background_}getClassName(){return this.className_}getLayerState(t){const e=this.state_||{layer:this,managed:t===void 0?!0:t},i=this.getZIndex();return e.opacity=rt(Math.round(this.getOpacity()*100)/100,0,1),e.visible=this.getVisible(),e.extent=this.getExtent(),e.zIndex=i===void 0&&!e.managed?1/0:i,e.maxResolution=this.getMaxResolution(),e.minResolution=Math.max(this.getMinResolution(),0),e.minZoom=this.getMinZoom(),e.maxZoom=this.getMaxZoom(),this.state_=e,e}getLayersArray(t){return U()}getLayerStatesArray(t){return U()}getExtent(){return this.get(Q.EXTENT)}getMaxResolution(){return this.get(Q.MAX_RESOLUTION)}getMinResolution(){return this.get(Q.MIN_RESOLUTION)}getMinZoom(){return this.get(Q.MIN_ZOOM)}getMaxZoom(){return this.get(Q.MAX_ZOOM)}getOpacity(){return this.get(Q.OPACITY)}getSourceState(){return U()}getVisible(){return this.get(Q.VISIBLE)}getZIndex(){return this.get(Q.Z_INDEX)}setBackground(t){this.background_=t,this.changed()}setExtent(t){this.set(Q.EXTENT,t)}setMaxResolution(t){this.set(Q.MAX_RESOLUTION,t)}setMinResolution(t){this.set(Q.MIN_RESOLUTION,t)}setMaxZoom(t){this.set(Q.MAX_ZOOM,t)}setMinZoom(t){this.set(Q.MIN_ZOOM,t)}setOpacity(t){q(typeof t=="number","Layer opacity must be a number"),this.set(Q.OPACITY,t)}setVisible(t){this.set(Q.VISIBLE,t)}setZIndex(t){this.set(Q.Z_INDEX,t)}disposeInternal(){this.state_&&(this.state_.layer=null,this.state_=null),super.disposeInternal()}}class Ir extends Pc{constructor(t){const e=Object.assign({},t);delete e.source,super(e),this.on,this.once,this.un,this.mapPrecomposeKey_=null,this.mapRenderKey_=null,this.sourceChangeKey_=null,this.renderer_=null,this.sourceReady_=!1,this.rendered=!1,t.render&&(this.render=t.render),t.map&&this.setMap(t.map),this.addChangeListener(Q.SOURCE,this.handleSourcePropertyChange_);const i=t.source?t.source:null;this.setSource(i)}getLayersArray(t){return t=t||[],t.push(this),t}getLayerStatesArray(t){return t=t||[],t.push(this.getLayerState()),t}getSource(){return this.get(Q.SOURCE)||null}getRenderSource(){return this.getSource()}getSourceState(){const t=this.getSource();return t?t.getState():"undefined"}handleSourceChange_(){this.changed(),!(this.sourceReady_||this.getSource().getState()!=="ready")&&(this.sourceReady_=!0,this.dispatchEvent("sourceready"))}handleSourcePropertyChange_(){this.sourceChangeKey_&&(nt(this.sourceChangeKey_),this.sourceChangeKey_=null),this.sourceReady_=!1;const t=this.getSource();t&&(this.sourceChangeKey_=Z(t,z.CHANGE,this.handleSourceChange_,this),t.getState()==="ready"&&(this.sourceReady_=!0,setTimeout(()=>{this.dispatchEvent("sourceready")},0))),this.changed()}getFeatures(t){return this.renderer_?this.renderer_.getFeatures(t):Promise.resolve([])}getData(t){return!this.renderer_||!this.rendered?null:this.renderer_.getData(t)}isVisible(t){let e;const i=this.getMapInternal();!t&&i&&(t=i.getView()),t instanceof xe?e={viewState:t.getState(),extent:t.calculateExtent()}:e=t,!e.layerStatesArray&&i&&(e.layerStatesArray=i.getLayerGroup().getLayerStatesArray());let s;if(e.layerStatesArray){if(s=e.layerStatesArray.find(o=>o.layer===this),!s)return!1}else s=this.getLayerState();const r=this.getExtent();return ia(s,e.viewState)&&(!r||Pt(r,e.extent))}getAttributions(t){if(!this.isVisible(t))return[];const e=this.getSource()?.getAttributions();if(!e)return[];const i=t instanceof xe?t.getViewStateAndExtent():t;let s=e(i);return Array.isArray(s)||(s=[s]),s}render(t,e){const i=this.getRenderer();return i.prepareFrame(t)?(this.rendered=!0,i.renderFrame(t,e)):null}unrender(){this.rendered=!1}getDeclutter(){}renderDeclutter(t,e){}renderDeferred(t){const e=this.getRenderer();e&&e.renderDeferred(t)}setMapInternal(t){t||this.unrender(),this.set(Q.MAP,t)}getMapInternal(){return this.get(Q.MAP)}setMap(t){this.mapPrecomposeKey_&&(nt(this.mapPrecomposeKey_),this.mapPrecomposeKey_=null),t||this.changed(),this.mapRenderKey_&&(nt(this.mapRenderKey_),this.mapRenderKey_=null),t&&(this.mapPrecomposeKey_=Z(t,Qt.PRECOMPOSE,this.handlePrecompose_,this),this.mapRenderKey_=Z(this,z.CHANGE,t.render,t),this.changed())}handlePrecompose_(t){const e=t.frameState.layerStatesArray,i=this.getLayerState(!1);q(!e.some(s=>s.layer===i.layer),"A layer can only be added to the map once. Use either `layer.setMap()` or `map.addLayer()`, not both."),e.push(i)}setSource(t){this.set(Q.SOURCE,t)}getRenderer(){return this.renderer_||(this.renderer_=this.createRenderer()),this.renderer_}hasRenderer(){return!!this.renderer_}createRenderer(){return null}clearRenderer(){this.renderer_&&(this.renderer_.dispose(),delete this.renderer_)}disposeInternal(){this.clearRenderer(),this.setSource(null),super.disposeInternal()}}function ia(n,t){if(!n.visible)return!1;const e=t.resolution;if(e<n.minResolution||e>=n.maxResolution)return!1;const i=t.zoom;return i>n.minZoom&&i<=n.maxZoom}const Oc={RENDER_ORDER:"renderOrder"};class Dc extends Ir{constructor(t){t=t||{};const e=Object.assign({},t);delete e.style,delete e.renderBuffer,delete e.updateWhileAnimating,delete e.updateWhileInteracting,super(e),this.declutter_=t.declutter?String(t.declutter):void 0,this.renderBuffer_=t.renderBuffer!==void 0?t.renderBuffer:100,this.style_=null,this.styleFunction_=void 0,this.setStyle(t.style),this.updateWhileAnimating_=t.updateWhileAnimating!==void 0?t.updateWhileAnimating:!1,this.updateWhileInteracting_=t.updateWhileInteracting!==void 0?t.updateWhileInteracting:!1}getDeclutter(){return this.declutter_}getFeatures(t){return super.getFeatures(t)}getRenderBuffer(){return this.renderBuffer_}getRenderOrder(){return this.get(Oc.RENDER_ORDER)}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}getUpdateWhileAnimating(){return this.updateWhileAnimating_}getUpdateWhileInteracting(){return this.updateWhileInteracting_}renderDeclutter(t,e){const i=this.getDeclutter();i in t.declutter||(t.declutter[i]=new Hh(9)),this.getRenderer().renderDeclutter(t,e)}setRenderOrder(t){this.set(Oc.RENDER_ORDER,t)}setStyle(t){this.style_=t===void 0?ic:t;const e=_m(t);this.styleFunction_=t===null?void 0:Hg(e),this.changed()}setDeclutter(t){this.declutter_=t?String(t):void 0,this.changed()}}function _m(n){if(n===void 0)return ic;if(!n)return null;if(typeof n=="function"||n instanceof ke)return n;if(!Array.isArray(n))return xc([n]);if(n.length===0)return[];const t=n.length,e=n[0];if(e instanceof ke){const s=new Array(t);for(let r=0;r<t;++r){const o=n[r];if(!(o instanceof ke))throw new Error("Expected a list of style instances");s[r]=o}return s}if("style"in e){const s=new Array(t);for(let r=0;r<t;++r){const o=n[r];if(!("style"in o))throw new Error("Expected a list of rules with a style property");s[r]=o}return K_(s)}return xc(n)}class mm extends Dc{constructor(t){super(t)}createRenderer(){return new y_(this)}}const D={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};class na extends Gs{constructor(t,e,i){super(),i=i||{},this.tileCoord=t,this.state=e,this.key="",this.transition_=i.transition===void 0?250:i.transition,this.transitionStarts_={},this.interpolate=!!i.interpolate}changed(){this.dispatchEvent(z.CHANGE)}release(){this.setState(D.EMPTY)}getKey(){return this.key+"/"+this.tileCoord}getTileCoord(){return this.tileCoord}getState(){return this.state}setState(t){if(this.state!==D.EMPTY){if(this.state!==D.ERROR&&this.state>t)throw new Error("Tile load sequence violation");this.state=t,this.changed()}}load(){U()}getAlpha(t,e){if(!this.transition_)return 1;let i=this.transitionStarts_[t];if(!i)i=e,this.transitionStarts_[t]=i;else if(i===-1)return 1;const s=e-i+1e3/60;return s>=this.transition_?1:Lc(s/this.transition_)}inTransition(t){return this.transition_?this.transitionStarts_[t]!==-1:!1}endTransition(t){this.transition_&&(this.transitionStarts_[t]=-1)}disposeInternal(){this.release(),super.disposeInternal()}}class Fc extends na{constructor(t,e,i,s,r,o){super(t,e,o),this.crossOrigin_=s,this.src_=i,this.key=i,this.image_,$t?this.image_=new OffscreenCanvas(1,1):(this.image_=new Image,s!==null&&(this.image_.crossOrigin=s)),this.unlisten_=null,this.tileLoadFunction_=r}getImage(){return this.image_}setImage(t){this.image_=t,this.state=D.LOADED,this.unlistenImage_(),this.changed()}getCrossOrigin(){return this.crossOrigin_}handleImageError_(){this.state=D.ERROR,this.unlistenImage_(),this.image_=pm(),this.changed()}handleImageLoad_(){if($t)this.state=D.LOADED;else{const t=this.image_;t.naturalWidth&&t.naturalHeight?this.state=D.LOADED:this.state=D.EMPTY}this.unlistenImage_(),this.changed()}load(){this.state==D.ERROR&&(this.state=D.IDLE,this.image_=new Image,this.crossOrigin_!==null&&(this.image_.crossOrigin=this.crossOrigin_)),this.state==D.IDLE&&(this.state=D.LOADING,this.changed(),this.tileLoadFunction_(this,this.src_),this.unlisten_=dg(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this)))}unlistenImage_(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)}disposeInternal(){this.unlistenImage_(),this.image_=null,super.disposeInternal()}}function pm(){const n=ht(1,1);return n.fillStyle="rgba(0,0,0,0)",n.fillRect(0,0,1,1),n.canvas}class ym{constructor(t,e,i){this.decay_=t,this.minVelocity_=e,this.delay_=i,this.points_=[],this.angle_=0,this.initialVelocity_=0}begin(){this.points_.length=0,this.angle_=0,this.initialVelocity_=0}update(t,e){this.points_.push(t,e,Date.now())}end(){if(this.points_.length<6)return!1;const t=Date.now()-this.delay_,e=this.points_.length-3;if(this.points_[e+2]<t)return!1;let i=e-3;for(;i>0&&this.points_[i+2]>t;)i-=3;const s=this.points_[e+2]-this.points_[i+2];if(s<1e3/60)return!1;const r=this.points_[e]-this.points_[i],o=this.points_[e+1]-this.points_[i+1];return this.angle_=Math.atan2(o,r),this.initialVelocity_=Math.sqrt(r*r+o*o)/s,this.initialVelocity_>this.minVelocity_}getDistance(){return(this.minVelocity_-this.initialVelocity_)/this.decay_}getAngle(){return this.angle_}}class fn extends Me{constructor(t,e,i){super(t),this.map=e,this.frameState=i!==void 0?i:null}}class li extends fn{constructor(t,e,i,s,r,o){super(t,e,r),this.originalEvent=i,this.pixel_=null,this.coordinate_=null,this.dragging=s!==void 0?s:!1,this.activePointers=o}get pixel(){return this.pixel_||(this.pixel_=this.map.getEventPixel(this.originalEvent)),this.pixel_}set pixel(t){this.pixel_=t}get coordinate(){return this.coordinate_||(this.coordinate_=this.map.getCoordinateFromPixel(this.pixel)),this.coordinate_}set coordinate(t){this.coordinate_=t}preventDefault(){super.preventDefault(),"preventDefault"in this.originalEvent&&this.originalEvent.preventDefault()}stopPropagation(){super.stopPropagation(),"stopPropagation"in this.originalEvent&&this.originalEvent.stopPropagation()}}const ot={SINGLECLICK:"singleclick",CLICK:z.CLICK,DBLCLICK:z.DBLCLICK,POINTERDRAG:"pointerdrag",POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"},sa={POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown"};class Em extends Gs{constructor(t,e){super(t),this.map_=t,this.clickTimeoutId_,this.emulateClicks_=!1,this.dragging_=!1,this.dragListenerKeys_=[],this.moveTolerance_=e===void 0?1:e,this.down_=null;const i=this.map_.getViewport();this.activePointers_=[],this.trackedTouches_={},this.element_=i,this.pointerdownListenerKey_=Z(i,sa.POINTERDOWN,this.handlePointerDown_,this),this.originalPointerMoveEvent_,this.relayedListenerKey_=Z(i,sa.POINTERMOVE,this.relayMoveEvent_,this),this.boundHandleTouchMove_=this.handleTouchMove_.bind(this),this.element_.addEventListener(z.TOUCHMOVE,this.boundHandleTouchMove_,Sh?{passive:!1}:!1)}emulateClick_(t){let e=new li(ot.CLICK,this.map_,t);this.dispatchEvent(e),this.clickTimeoutId_!==void 0?(clearTimeout(this.clickTimeoutId_),this.clickTimeoutId_=void 0,e=new li(ot.DBLCLICK,this.map_,t),this.dispatchEvent(e)):this.clickTimeoutId_=setTimeout(()=>{this.clickTimeoutId_=void 0;const i=new li(ot.SINGLECLICK,this.map_,t);this.dispatchEvent(i)},250)}updateActivePointers_(t){const e=t,i=e.pointerId;if(e.type==ot.POINTERUP||e.type==ot.POINTERCANCEL){delete this.trackedTouches_[i];for(const s in this.trackedTouches_)if(this.trackedTouches_[s].target!==e.target){delete this.trackedTouches_[s];break}}else(e.type==ot.POINTERDOWN||e.type==ot.POINTERMOVE)&&(this.trackedTouches_[i]=e);this.activePointers_=Object.values(this.trackedTouches_)}handlePointerUp_(t){this.updateActivePointers_(t);const e=new li(ot.POINTERUP,this.map_,t,void 0,void 0,this.activePointers_);this.dispatchEvent(e),this.emulateClicks_&&!e.defaultPrevented&&!this.dragging_&&this.isMouseActionButton_(t)&&this.emulateClick_(this.down_),this.activePointers_.length===0&&(this.dragListenerKeys_.forEach(nt),this.dragListenerKeys_.length=0,this.dragging_=!1,this.down_=null)}isMouseActionButton_(t){return t.button===0}handlePointerDown_(t){this.emulateClicks_=this.activePointers_.length===0,this.updateActivePointers_(t);const e=new li(ot.POINTERDOWN,this.map_,t,void 0,void 0,this.activePointers_);if(this.dispatchEvent(e),this.down_=new PointerEvent(t.type,t),Object.defineProperty(this.down_,"target",{writable:!1,value:t.target}),this.dragListenerKeys_.length===0){const i=this.map_.getOwnerDocument();this.dragListenerKeys_.push(Z(i,ot.POINTERMOVE,this.handlePointerMove_,this),Z(i,ot.POINTERUP,this.handlePointerUp_,this),Z(this.element_,ot.POINTERCANCEL,this.handlePointerUp_,this)),this.element_.getRootNode&&this.element_.getRootNode()!==i&&this.dragListenerKeys_.push(Z(this.element_.getRootNode(),ot.POINTERUP,this.handlePointerUp_,this))}}handlePointerMove_(t){if(this.isMoving_(t)){this.updateActivePointers_(t),this.dragging_=!0;const e=new li(ot.POINTERDRAG,this.map_,t,this.dragging_,void 0,this.activePointers_);this.dispatchEvent(e)}}relayMoveEvent_(t){this.originalPointerMoveEvent_=t;const e=!!(this.down_&&this.isMoving_(t));this.dispatchEvent(new li(ot.POINTERMOVE,this.map_,t,e))}handleTouchMove_(t){const e=this.originalPointerMoveEvent_;(!e||e.defaultPrevented)&&(typeof t.cancelable!="boolean"||t.cancelable===!0)&&t.preventDefault()}isMoving_(t){return this.dragging_||Math.abs(t.clientX-this.down_.clientX)>this.moveTolerance_||Math.abs(t.clientY-this.down_.clientY)>this.moveTolerance_}disposeInternal(){this.relayedListenerKey_&&(nt(this.relayedListenerKey_),this.relayedListenerKey_=null),this.element_.removeEventListener(z.TOUCHMOVE,this.boundHandleTouchMove_),this.pointerdownListenerKey_&&(nt(this.pointerdownListenerKey_),this.pointerdownListenerKey_=null),this.dragListenerKeys_.forEach(nt),this.dragListenerKeys_.length=0,this.element_=null,super.disposeInternal()}}const We={POSTRENDER:"postrender",MOVESTART:"movestart",MOVEEND:"moveend",LOADSTART:"loadstart",LOADEND:"loadend"},yt={LAYERGROUP:"layergroup",SIZE:"size",TARGET:"target",VIEW:"view"},Sr=1/0;class xm{constructor(t,e){this.priorityFunction_=t,this.keyFunction_=e,this.elements_=[],this.priorities_=[],this.queuedElements_={}}clear(){this.elements_.length=0,this.priorities_.length=0,kn(this.queuedElements_)}dequeue(){const t=this.elements_,e=this.priorities_,i=t[0];t.length==1?(t.length=0,e.length=0):(t[0]=t.pop(),e[0]=e.pop(),this.siftUp_(0));const s=this.keyFunction_(i);return delete this.queuedElements_[s],i}enqueue(t){q(!(this.keyFunction_(t)in this.queuedElements_),"Tried to enqueue an `element` that was already added to the queue");const e=this.priorityFunction_(t);return e!=Sr?(this.elements_.push(t),this.priorities_.push(e),this.queuedElements_[this.keyFunction_(t)]=!0,this.siftDown_(0,this.elements_.length-1),!0):!1}getCount(){return this.elements_.length}getLeftChildIndex_(t){return t*2+1}getRightChildIndex_(t){return t*2+2}getParentIndex_(t){return t-1>>1}heapify_(){let t;for(t=(this.elements_.length>>1)-1;t>=0;t--)this.siftUp_(t)}isEmpty(){return this.elements_.length===0}isKeyQueued(t){return t in this.queuedElements_}isQueued(t){return this.isKeyQueued(this.keyFunction_(t))}siftUp_(t){const e=this.elements_,i=this.priorities_,s=e.length,r=e[t],o=i[t],a=t;for(;t<s>>1;){const l=this.getLeftChildIndex_(t),h=this.getRightChildIndex_(t),c=h<s&&i[h]<i[l]?h:l;e[t]=e[c],i[t]=i[c],t=c}e[t]=r,i[t]=o,this.siftDown_(a,t)}siftDown_(t,e){const i=this.elements_,s=this.priorities_,r=i[e],o=s[e];for(;e>t;){const a=this.getParentIndex_(e);if(s[a]>o)i[e]=i[a],s[e]=s[a],e=a;else break}i[e]=r,s[e]=o}reprioritize(){const t=this.priorityFunction_,e=this.elements_,i=this.priorities_;let s=0;const r=e.length;let o,a,l;for(a=0;a<r;++a)o=e[a],l=t(o),l==Sr?delete this.queuedElements_[this.keyFunction_(o)]:(i[s]=l,e[s++]=o);e.length=s,i.length=s,this.heapify_()}}class wm extends xm{constructor(t,e){super(i=>t.apply(null,i),i=>i[0].getKey()),this.boundHandleTileChange_=this.handleTileChange.bind(this),this.tileChangeCallback_=e,this.tilesLoading_=0,this.tilesLoadingKeys_={}}enqueue(t){const e=super.enqueue(t);return e&&t[0].addEventListener(z.CHANGE,this.boundHandleTileChange_),e}getTilesLoading(){return this.tilesLoading_}handleTileChange(t){const e=t.target,i=e.getState();if(i===D.LOADED||i===D.ERROR||i===D.EMPTY){i!==D.ERROR&&e.removeEventListener(z.CHANGE,this.boundHandleTileChange_);const s=e.getKey();s in this.tilesLoadingKeys_&&(delete this.tilesLoadingKeys_[s],--this.tilesLoading_),this.tileChangeCallback_()}}loadMoreTiles(t,e){let i=0;for(;this.tilesLoading_<t&&i<e&&this.getCount()>0;){const s=this.dequeue()[0],r=s.getKey();s.getState()===D.IDLE&&!(r in this.tilesLoadingKeys_)&&(this.tilesLoadingKeys_[r]=!0,++this.tilesLoading_,++i,s.load())}}}function vm(n,t,e,i,s){if(!n||!(e in n.wantedTiles)||!n.wantedTiles[e][t.getKey()])return Sr;const r=n.viewState.center,o=i[0]-r[0],a=i[1]-r[1];return 65536*Math.log(s)+Math.sqrt(o*o+a*a)/s}class ra extends he{constructor(t){super();const e=t.element;e&&!t.target&&!e.style.pointerEvents&&(e.style.pointerEvents="auto"),this.element=e||null,this.target_=null,this.map_=null,this.listenerKeys=[],t.render&&(this.render=t.render),t.target&&this.setTarget(t.target)}disposeInternal(){this.element?.remove(),super.disposeInternal()}getMap(){return this.map_}setMap(t){this.map_&&this.element?.remove();for(let e=0,i=this.listenerKeys.length;e<i;++e)nt(this.listenerKeys[e]);if(this.listenerKeys.length=0,this.map_=t,t){const e=this.target_??t.getOverlayContainerStopEvent();this.element&&e.appendChild(this.element),this.render!==Fn&&this.listenerKeys.push(Z(t,We.POSTRENDER,this.render,this)),t.render()}}render(t){}setTarget(t){this.target_=typeof t=="string"?document.getElementById(t):t}}class Cm extends ra{constructor(t){t=t||{},super({element:document.createElement("div"),render:t.render,target:t.target}),this.ulElement_=document.createElement("ul"),this.collapsed_=t.collapsed!==void 0?t.collapsed:!0,this.userCollapsed_=this.collapsed_,this.overrideCollapsible_=t.collapsible!==void 0,this.collapsible_=t.collapsible!==void 0?t.collapsible:!0,this.collapsible_||(this.collapsed_=!1),this.attributions_=t.attributions;const e=t.className!==void 0?t.className:"ol-attribution",i=t.tipLabel!==void 0?t.tipLabel:"Attributions",s=t.expandClassName!==void 0?t.expandClassName:e+"-expand",r=t.collapseLabel!==void 0?t.collapseLabel:"›",o=t.collapseClassName!==void 0?t.collapseClassName:e+"-collapse";typeof r=="string"?(this.collapseLabel_=document.createElement("span"),this.collapseLabel_.textContent=r,this.collapseLabel_.className=o):this.collapseLabel_=r;const a=t.label!==void 0?t.label:"i";typeof a=="string"?(this.label_=document.createElement("span"),this.label_.textContent=a,this.label_.className=s):this.label_=a;const l=this.collapsible_&&!this.collapsed_?this.collapseLabel_:this.label_;this.toggleButton_=document.createElement("button"),this.toggleButton_.setAttribute("type","button"),this.toggleButton_.setAttribute("aria-expanded",String(!this.collapsed_)),this.toggleButton_.title=i,this.toggleButton_.appendChild(l),this.toggleButton_.addEventListener(z.CLICK,this.handleClick_.bind(this),!1);const h=e+" "+cr+" "+ko+(this.collapsed_&&this.collapsible_?" "+Fh:"")+(this.collapsible_?"":" ol-uncollapsible"),c=this.element;c.className=h,c.appendChild(this.toggleButton_),c.appendChild(this.ulElement_),this.renderedAttributions_=[],this.renderedVisible_=!0}collectSourceAttributions_(t){const e=this.getMap().getAllLayers(),i=new Set(e.flatMap(s=>s.getAttributions(t)));if(this.attributions_!==void 0&&(Array.isArray(this.attributions_)?this.attributions_.forEach(s=>i.add(s)):i.add(this.attributions_)),!this.overrideCollapsible_){const s=!e.some(r=>r.getSource()?.getAttributionsCollapsible()===!1);this.setCollapsible(s)}return Array.from(i)}async updateElement_(t){if(!t){this.renderedVisible_&&(this.element.style.display="none",this.renderedVisible_=!1);return}const e=await Promise.all(this.collectSourceAttributions_(t).map(s=>Nd(()=>s))),i=e.length>0;if(this.renderedVisible_!=i&&(this.element.style.display=i?"":"none",this.renderedVisible_=i),!qe(e,this.renderedAttributions_)){Lh(this.ulElement_);for(let s=0,r=e.length;s<r;++s){const o=document.createElement("li");o.innerHTML=e[s],this.ulElement_.appendChild(o)}this.renderedAttributions_=e}}handleClick_(t){t.preventDefault(),this.handleToggle_(),this.userCollapsed_=this.collapsed_}handleToggle_(){this.element.classList.toggle(Fh),this.collapsed_?bh(this.collapseLabel_,this.label_):bh(this.label_,this.collapseLabel_),this.collapsed_=!this.collapsed_,this.toggleButton_.setAttribute("aria-expanded",String(!this.collapsed_))}getCollapsible(){return this.collapsible_}setCollapsible(t){this.collapsible_!==t&&(this.collapsible_=t,this.element.classList.toggle("ol-uncollapsible"),this.userCollapsed_&&this.handleToggle_())}setCollapsed(t){this.userCollapsed_=t,!(!this.collapsible_||this.collapsed_===t)&&this.handleToggle_()}getCollapsed(){return this.collapsed_}render(t){this.updateElement_(t.frameState)}}class Rm extends ra{constructor(t){t=t||{},super({element:document.createElement("div"),render:t.render,target:t.target});const e=t.className!==void 0?t.className:"ol-rotate",i=t.label!==void 0?t.label:"⇧",s=t.compassClassName!==void 0?t.compassClassName:"ol-compass";this.label_=null,typeof i=="string"?(this.label_=document.createElement("span"),this.label_.className=s,this.label_.textContent=i):(this.label_=i,this.label_.classList.add(s));const r=t.tipLabel?t.tipLabel:"Reset rotation",o=document.createElement("button");o.className=e+"-reset",o.setAttribute("type","button"),o.title=r,o.appendChild(this.label_),o.addEventListener(z.CLICK,this.handleClick_.bind(this),!1);const a=e+" "+cr+" "+ko,l=this.element;l.className=a,l.appendChild(o),this.callResetNorth_=t.resetNorth?t.resetNorth:void 0,this.duration_=t.duration!==void 0?t.duration:250,this.autoHide_=t.autoHide!==void 0?t.autoHide:!0,this.rotation_=void 0,this.autoHide_&&this.element.classList.add(hr)}handleClick_(t){t.preventDefault(),this.callResetNorth_!==void 0?this.callResetNorth_():this.resetNorth_()}resetNorth_(){const e=this.getMap().getView();if(!e)return;const i=e.getRotation();i!==void 0&&(this.duration_>0&&i%(2*Math.PI)!==0?e.animate({rotation:0,duration:this.duration_,easing:dn}):e.setRotation(0))}render(t){const e=t.frameState;if(!e)return;const i=e.viewState.rotation;if(i!=this.rotation_){const s="rotate("+i+"rad)";if(this.autoHide_){const r=this.element.classList.contains(hr);!r&&i===0?this.element.classList.add(hr):r&&i!==0&&this.element.classList.remove(hr)}this.label_.style.transform=s}this.rotation_=i}}class Tm extends ra{constructor(t){t=t||{},super({element:document.createElement("div"),target:t.target});const e=t.className!==void 0?t.className:"ol-zoom",i=t.delta!==void 0?t.delta:1,s=t.zoomInClassName!==void 0?t.zoomInClassName:e+"-in",r=t.zoomOutClassName!==void 0?t.zoomOutClassName:e+"-out",o=t.zoomInLabel!==void 0?t.zoomInLabel:"+",a=t.zoomOutLabel!==void 0?t.zoomOutLabel:"–",l=t.zoomInTipLabel!==void 0?t.zoomInTipLabel:"Zoom in",h=t.zoomOutTipLabel!==void 0?t.zoomOutTipLabel:"Zoom out",c=document.createElement("button");c.className=s,c.setAttribute("type","button"),c.title=l,c.appendChild(typeof o=="string"?document.createTextNode(o):o),c.addEventListener(z.CLICK,this.handleClick_.bind(this,i),!1);const u=document.createElement("button");u.className=r,u.setAttribute("type","button"),u.title=h,u.appendChild(typeof a=="string"?document.createTextNode(a):a),u.addEventListener(z.CLICK,this.handleClick_.bind(this,-i),!1);const d=e+" "+cr+" "+ko,f=this.element;f.className=d,f.appendChild(c),f.appendChild(u),this.duration_=t.duration!==void 0?t.duration:250}handleClick_(t,e){e.preventDefault(),this.zoomByDelta_(t)}zoomByDelta_(t){const i=this.getMap().getView();if(!i)return;const s=i.getZoom();if(s!==void 0){const r=i.getConstrainedZoom(s+t);this.duration_>0?(i.getAnimating()&&i.cancelAnimations(),i.animate({zoom:r,duration:this.duration_,easing:dn})):i.setZoom(r)}}}function Im(n){n=n||{};const t=new Ht;return(n.zoom!==void 0?n.zoom:!0)&&t.push(new Tm(n.zoomOptions)),(n.rotate!==void 0?n.rotate:!0)&&t.push(new Rm(n.rotateOptions)),(n.attribution!==void 0?n.attribution:!0)&&t.push(new Cm(n.attributionOptions)),t}const kc={ACTIVE:"active"};class cs extends he{constructor(t){super(),this.on,this.once,this.un,t&&t.handleEvent&&(this.handleEvent=t.handleEvent),this.map_=null,this.setActive(!0)}getActive(){return this.get(kc.ACTIVE)}getMap(){return this.map_}handleEvent(t){return!0}setActive(t){this.set(kc.ACTIVE,t)}setMap(t){this.map_=t}}function Sm(n,t,e){const i=n.getCenterInternal();if(i){const s=[i[0]+t[0],i[1]+t[1]];n.animateInternal({duration:e!==void 0?e:250,easing:rm,center:n.getConstrainedCenter(s)})}}function oa(n,t,e,i){const s=n.getZoom();if(s===void 0)return;const r=n.getConstrainedZoom(s+t),o=n.getResolutionForZoom(r);n.getAnimating()&&n.cancelAnimations(),n.animate({resolution:o,anchor:e,duration:i!==void 0?i:250,easing:dn})}class bm extends cs{constructor(t){super(),t=t||{},this.delta_=t.delta?t.delta:1,this.duration_=t.duration!==void 0?t.duration:250}handleEvent(t){let e=!1;if(t.type==ot.DBLCLICK){const i=t.originalEvent,s=t.map,r=t.coordinate,o=i.shiftKey?-this.delta_:this.delta_,a=s.getView();oa(a,o,r,this.duration_),i.preventDefault(),e=!0}return!e}}function aa(n){const t=arguments;return function(e){let i=!0;for(let s=0,r=t.length;s<r&&(i=i&&t[s](e),!!i);++s);return i}}const Lm=function(n){const t=n.originalEvent;return t.altKey&&!(t.metaKey||t.ctrlKey)&&t.shiftKey},Am=function(n){const t=n.map.getTargetElement(),e=t.getRootNode(),i=n.map.getOwnerDocument().activeElement;return e instanceof ShadowRoot?e.host.contains(i):t.contains(i)},Nc=function(n){const t=n.map.getTargetElement(),e=t.getRootNode();return(e instanceof ShadowRoot?e.host:t).hasAttribute("tabindex")?Am(n):!0},Mm=Dn,Gc=function(n){const t=n.originalEvent;return"pointerId"in t&&t.button==0&&!(Jf&&Th&&t.ctrlKey)},zc=function(n){const t=n.originalEvent;return!t.altKey&&!(t.metaKey||t.ctrlKey)&&!t.shiftKey},Pm=function(n){const t=n.originalEvent;return Th?t.metaKey:t.ctrlKey},Om=function(n){const t=n.originalEvent;return!t.altKey&&!(t.metaKey||t.ctrlKey)&&t.shiftKey},Xc=function(n){const t=n.originalEvent,e=t.target.tagName;return e!=="INPUT"&&e!=="SELECT"&&e!=="TEXTAREA"&&!t.target.isContentEditable},la=function(n){const t=n.originalEvent;return"pointerId"in t&&t.pointerType=="mouse"},Dm=function(n){const t=n.originalEvent;return"pointerId"in t&&t.isPrimary&&t.button===0};class us extends cs{constructor(t){t=t||{},super(t),t.handleDownEvent&&(this.handleDownEvent=t.handleDownEvent),t.handleDragEvent&&(this.handleDragEvent=t.handleDragEvent),t.handleMoveEvent&&(this.handleMoveEvent=t.handleMoveEvent),t.handleUpEvent&&(this.handleUpEvent=t.handleUpEvent),t.stopDown&&(this.stopDown=t.stopDown),this.handlingDownUpSequence=!1,this.targetPointers=[]}getPointerCount(){return this.targetPointers.length}handleDownEvent(t){return!1}handleDragEvent(t){}handleEvent(t){if(!t.originalEvent)return!0;let e=!1;if(this.updateTrackedPointers_(t),this.handlingDownUpSequence){if(t.type==ot.POINTERDRAG)this.handleDragEvent(t),t.originalEvent.preventDefault();else if(t.type==ot.POINTERUP){const i=this.handleUpEvent(t);this.handlingDownUpSequence=i&&this.targetPointers.length>0}}else if(t.type==ot.POINTERDOWN){const i=this.handleDownEvent(t);this.handlingDownUpSequence=i,e=this.stopDown(i)}else t.type==ot.POINTERMOVE&&this.handleMoveEvent(t);return!e}handleMoveEvent(t){}handleUpEvent(t){return!1}stopDown(t){return t}updateTrackedPointers_(t){t.activePointers&&(this.targetPointers=t.activePointers)}}function ha(n){const t=n.length;let e=0,i=0;for(let s=0;s<t;s++)e+=n[s].clientX,i+=n[s].clientY;return{clientX:e/t,clientY:i/t}}class Fm extends us{constructor(t){super({stopDown:Ns}),t=t||{},this.kinetic_=t.kinetic,this.lastCentroid=null,this.lastPointersCount_,this.panning_=!1;const e=t.condition?t.condition:aa(zc,Dm);this.condition_=t.onFocusOnly?aa(Nc,e):e,this.noKinetic_=!1}handleDragEvent(t){const e=t.map;this.panning_||(this.panning_=!0,e.getView().beginInteraction());const i=this.targetPointers,s=e.getEventPixel(ha(i));if(i.length==this.lastPointersCount_){if(this.kinetic_&&this.kinetic_.update(s[0],s[1]),this.lastCentroid){const r=[this.lastCentroid[0]-s[0],s[1]-this.lastCentroid[1]],a=t.map.getView();jd(r,a.getResolution()),so(r,a.getRotation()),a.adjustCenterInternal(r)}}else this.kinetic_&&this.kinetic_.begin();this.lastCentroid=s,this.lastPointersCount_=i.length,t.originalEvent.preventDefault()}handleUpEvent(t){const e=t.map,i=e.getView();if(this.targetPointers.length===0){if(!this.noKinetic_&&this.kinetic_&&this.kinetic_.end()){const s=this.kinetic_.getDistance(),r=this.kinetic_.getAngle(),o=i.getCenterInternal(),a=e.getPixelFromCoordinateInternal(o),l=e.getCoordinateFromPixelInternal([a[0]-s*Math.cos(r),a[1]-s*Math.sin(r)]);i.animateInternal({center:i.getConstrainedCenter(l),duration:500,easing:dn})}return this.panning_&&(this.panning_=!1,i.endInteraction()),!1}return this.kinetic_&&this.kinetic_.begin(),this.lastCentroid=null,!0}handleDownEvent(t){if(this.targetPointers.length>0&&this.condition_(t)){const i=t.map.getView();return this.lastCentroid=null,i.getAnimating()&&i.cancelAnimations(),this.kinetic_&&this.kinetic_.begin(),this.noKinetic_=this.targetPointers.length>1,!0}return!1}}class km extends us{constructor(t){t=t||{},super({stopDown:Ns}),this.condition_=t.condition?t.condition:Lm,this.lastAngle_=void 0,this.duration_=t.duration!==void 0?t.duration:250}handleDragEvent(t){if(!la(t))return;const e=t.map,i=e.getView();if(i.getConstraints().rotation===Jo)return;const s=e.getSize(),r=t.pixel,o=Math.atan2(s[1]/2-r[1],r[0]-s[0]/2);if(this.lastAngle_!==void 0){const a=o-this.lastAngle_;i.adjustRotationInternal(-a)}this.lastAngle_=o}handleUpEvent(t){return la(t)?(t.map.getView().endInteraction(this.duration_),!1):!0}handleDownEvent(t){return la(t)&&Gc(t)&&this.condition_(t)?(t.map.getView().beginInteraction(),this.lastAngle_=void 0,!0):!1}}class Nm extends ks{constructor(t){super(),this.geometry_=null,this.element_=document.createElement("div"),this.element_.style.position="absolute",this.element_.style.pointerEvents="auto",this.element_.className="ol-box "+t,this.map_=null,this.startPixel_=null,this.endPixel_=null}disposeInternal(){this.setMap(null)}render_(){const t=this.startPixel_,e=this.endPixel_,i="px",s=this.element_.style;s.left=Math.min(t[0],e[0])+i,s.top=Math.min(t[1],e[1])+i,s.width=Math.abs(e[0]-t[0])+i,s.height=Math.abs(e[1]-t[1])+i}setMap(t){if(this.map_){this.map_.getOverlayContainer().removeChild(this.element_);const e=this.element_.style;e.left="inherit",e.top="inherit",e.width="inherit",e.height="inherit"}this.map_=t,this.map_&&this.map_.getOverlayContainer().appendChild(this.element_)}setPixels(t,e){this.startPixel_=t,this.endPixel_=e,this.createOrUpdateGeometry(),this.render_()}createOrUpdateGeometry(){if(!this.map_)return;const t=this.startPixel_,e=this.endPixel_,s=[t,[t[0],e[1]],e,[e[0],t[1]]].map(this.map_.getCoordinateFromPixelInternal,this.map_);s[4]=s[0].slice(),this.geometry_?this.geometry_.setCoordinates([s]):this.geometry_=new Kn([s])}getGeometry(){return this.geometry_}}const gn={BOXSTART:"boxstart",BOXDRAG:"boxdrag",BOXEND:"boxend",BOXCANCEL:"boxcancel"};class ds extends Me{constructor(t,e,i){super(t),this.coordinate=e,this.mapBrowserEvent=i}}class Gm extends us{constructor(t){super(),this.on,this.once,this.un,t=t??{},this.box_=new Nm(t.className||"ol-dragbox"),this.minArea_=t.minArea??64,t.onBoxEnd&&(this.onBoxEnd=t.onBoxEnd),this.startPixel_=null,this.condition_=t.condition??Gc,this.boxEndCondition_=t.boxEndCondition??this.defaultBoxEndCondition}defaultBoxEndCondition(t,e,i){const s=i[0]-e[0],r=i[1]-e[1];return s*s+r*r>=this.minArea_}getGeometry(){return this.box_.getGeometry()}handleDragEvent(t){this.startPixel_&&(this.box_.setPixels(this.startPixel_,t.pixel),this.dispatchEvent(new ds(gn.BOXDRAG,t.coordinate,t)))}handleUpEvent(t){if(!this.startPixel_)return!1;const e=this.boxEndCondition_(t,this.startPixel_,t.pixel);return e&&this.onBoxEnd(t),this.dispatchEvent(new ds(e?gn.BOXEND:gn.BOXCANCEL,t.coordinate,t)),this.box_.setMap(null),this.startPixel_=null,!1}handleDownEvent(t){return this.condition_(t)?(this.startPixel_=t.pixel,this.box_.setMap(t.map),this.box_.setPixels(this.startPixel_,this.startPixel_),this.dispatchEvent(new ds(gn.BOXSTART,t.coordinate,t)),!0):!1}onBoxEnd(t){}setActive(t){t||(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new ds(gn.BOXCANCEL,this.startPixel_,null)),this.startPixel_=null)),super.setActive(t)}setMap(t){this.getMap()&&(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new ds(gn.BOXCANCEL,this.startPixel_,null)),this.startPixel_=null)),super.setMap(t)}}class zm extends Gm{constructor(t){t=t||{};const e=t.condition?t.condition:Om;super({condition:e,className:t.className||"ol-dragzoom",minArea:t.minArea}),this.duration_=t.duration!==void 0?t.duration:200,this.out_=t.out!==void 0?t.out:!1}onBoxEnd(t){const i=this.getMap().getView();let s=this.getGeometry();if(this.out_){const r=i.rotatedExtentForGeometry(s),o=i.getResolutionForExtentInternal(r),a=i.getResolution()/o;s=s.clone(),s.scale(a*a)}i.fitInternal(s,{duration:this.duration_,easing:dn})}}const Oi={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",DOWN:"ArrowDown"};class Xm extends cs{constructor(t){super(),t=t||{},this.defaultCondition_=function(e){return zc(e)&&Xc(e)},this.condition_=t.condition!==void 0?t.condition:this.defaultCondition_,this.duration_=t.duration!==void 0?t.duration:100,this.pixelDelta_=t.pixelDelta!==void 0?t.pixelDelta:128}handleEvent(t){let e=!1;if(t.type==z.KEYDOWN){const i=t.originalEvent,s=i.key;if(this.condition_(t)&&(s==Oi.DOWN||s==Oi.LEFT||s==Oi.RIGHT||s==Oi.UP)){const o=t.map.getView(),a=o.getResolution()*this.pixelDelta_;let l=0,h=0;s==Oi.DOWN?h=-a:s==Oi.LEFT?l=-a:s==Oi.RIGHT?l=a:h=a;const c=[l,h];so(c,o.getRotation()),Sm(o,c,this.duration_),i.preventDefault(),e=!0}}return!e}}class Wm extends cs{constructor(t){super(),t=t||{},this.condition_=t.condition?t.condition:function(e){return!Pm(e)&&Xc(e)},this.delta_=t.delta?t.delta:1,this.duration_=t.duration!==void 0?t.duration:100}handleEvent(t){let e=!1;if(t.type==z.KEYDOWN||t.type==z.KEYPRESS){const i=t.originalEvent,s=i.key;if(this.condition_(t)&&(s==="+"||s==="-")){const r=t.map,o=s==="+"?this.delta_:-this.delta_,a=r.getView();oa(a,o,void 0,this.duration_),i.preventDefault(),e=!0}}return!e}}const Ym=40,$m=300;class Km extends cs{constructor(t){t=t||{},super(t),this.totalDelta_=0,this.lastDelta_=0,this.maxDelta_=t.maxDelta!==void 0?t.maxDelta:1,this.duration_=t.duration!==void 0?t.duration:250,this.timeout_=t.timeout!==void 0?t.timeout:80,this.useAnchor_=t.useAnchor!==void 0?t.useAnchor:!0,this.constrainResolution_=t.constrainResolution!==void 0?t.constrainResolution:!1;const e=t.condition?t.condition:Mm;this.condition_=t.onFocusOnly?aa(Nc,e):e,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_,this.mode_=void 0,this.trackpadEventGap_=400,this.trackpadTimeoutId_,this.deltaPerZoom_=300}endInteraction_(){this.trackpadTimeoutId_=void 0;const t=this.getMap();if(!t)return;t.getView().endInteraction(void 0,this.lastDelta_?this.lastDelta_>0?1:-1:0,this.lastAnchor_?t.getCoordinateFromPixel(this.lastAnchor_):null)}handleEvent(t){if(!this.condition_(t)||t.type!==z.WHEEL)return!0;const i=t.map,s=t.originalEvent;s.preventDefault(),this.useAnchor_&&(this.lastAnchor_=t.pixel);let r=s.deltaY;switch(s.deltaMode){case WheelEvent.DOM_DELTA_LINE:r*=Ym;break;case WheelEvent.DOM_DELTA_PAGE:r*=$m;break}if(r===0)return!1;this.lastDelta_=r;const o=Date.now();this.startTime_===void 0&&(this.startTime_=o),(!this.mode_||o-this.startTime_>this.trackpadEventGap_)&&(this.mode_=Math.abs(r)<4?"trackpad":"wheel");const a=i.getView();if(this.mode_==="trackpad"&&!(a.getConstrainResolution()||this.constrainResolution_))return this.trackpadTimeoutId_?clearTimeout(this.trackpadTimeoutId_):(a.getAnimating()&&a.cancelAnimations(),a.beginInteraction()),this.trackpadTimeoutId_=setTimeout(this.endInteraction_.bind(this),this.timeout_),a.adjustZoom(-r/this.deltaPerZoom_,this.lastAnchor_?i.getCoordinateFromPixel(this.lastAnchor_):null),this.startTime_=o,!1;this.totalDelta_+=r;const l=Math.max(this.timeout_-(o-this.startTime_),0);return clearTimeout(this.timeoutId_),this.timeoutId_=setTimeout(this.handleWheelZoom_.bind(this,i),l),!1}handleWheelZoom_(t){const e=t.getView();e.getAnimating()&&e.cancelAnimations();let i=-rt(this.totalDelta_,-this.maxDelta_*this.deltaPerZoom_,this.maxDelta_*this.deltaPerZoom_)/this.deltaPerZoom_;(e.getConstrainResolution()||this.constrainResolution_)&&(i=i?i>0?1:-1:0),oa(e,i,this.lastAnchor_?t.getCoordinateFromPixel(this.lastAnchor_):null,this.duration_),this.mode_=void 0,this.totalDelta_=0,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_=void 0}setMouseAnchor(t){this.useAnchor_=t,t||(this.lastAnchor_=null)}}class Bm extends us{constructor(t){t=t||{};const e=t;e.stopDown||(e.stopDown=Ns),super(e),this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.threshold_=t.threshold!==void 0?t.threshold:.3,this.duration_=t.duration!==void 0?t.duration:250}handleDragEvent(t){let e=0;const i=this.targetPointers[0],s=this.targetPointers[1],r=Math.atan2(s.clientY-i.clientY,s.clientX-i.clientX);if(this.lastAngle_!==void 0){const l=r-this.lastAngle_;this.rotationDelta_+=l,!this.rotating_&&Math.abs(this.rotationDelta_)>this.threshold_&&(this.rotating_=!0),e=l}this.lastAngle_=r;const o=t.map,a=o.getView();a.getConstraints().rotation!==Jo&&(this.anchor_=o.getCoordinateFromPixelInternal(o.getEventPixel(ha(this.targetPointers))),this.rotating_&&(o.render(),a.adjustRotationInternal(e,this.anchor_)))}handleUpEvent(t){return this.targetPointers.length<2?(t.map.getView().endInteraction(this.duration_),!1):!0}handleDownEvent(t){if(this.targetPointers.length>=2){const e=t.map;return this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.handlingDownUpSequence||e.getView().beginInteraction(),!0}return!1}}class Zm extends us{constructor(t){t=t||{};const e=t;e.stopDown||(e.stopDown=Ns),super(e),this.anchor_=null,this.duration_=t.duration!==void 0?t.duration:400,this.lastDistance_=void 0,this.lastScaleDelta_=1}handleDragEvent(t){let e=1;const i=this.targetPointers[0],s=this.targetPointers[1],r=i.clientX-s.clientX,o=i.clientY-s.clientY,a=Math.sqrt(r*r+o*o);this.lastDistance_!==void 0&&(e=this.lastDistance_/a),this.lastDistance_=a;const l=t.map,h=l.getView();e!=1&&(this.lastScaleDelta_=e),this.anchor_=l.getCoordinateFromPixelInternal(l.getEventPixel(ha(this.targetPointers))),l.render(),h.adjustResolutionInternal(e,this.anchor_)}handleUpEvent(t){if(this.targetPointers.length<2){const i=t.map.getView(),s=this.lastScaleDelta_>1?1:-1;return i.endInteraction(this.duration_,s),!1}return!0}handleDownEvent(t){if(this.targetPointers.length>=2){const e=t.map;return this.anchor_=null,this.lastDistance_=void 0,this.lastScaleDelta_=1,this.handlingDownUpSequence||e.getView().beginInteraction(),!0}return!1}}function Um(n){n=n||{};const t=new Ht,e=new ym(-.005,.05,100);return(n.altShiftDragRotate!==void 0?n.altShiftDragRotate:!0)&&t.push(new km),(n.doubleClickZoom!==void 0?n.doubleClickZoom:!0)&&t.push(new bm({delta:n.zoomDelta,duration:n.zoomDuration})),(n.dragPan!==void 0?n.dragPan:!0)&&t.push(new Fm({onFocusOnly:n.onFocusOnly,kinetic:e})),(n.pinchRotate!==void 0?n.pinchRotate:!0)&&t.push(new Bm),(n.pinchZoom!==void 0?n.pinchZoom:!0)&&t.push(new Zm({duration:n.zoomDuration})),(n.keyboard!==void 0?n.keyboard:!0)&&(t.push(new Xm),t.push(new Wm({delta:n.zoomDelta,duration:n.zoomDuration}))),(n.mouseWheelZoom!==void 0?n.mouseWheelZoom:!0)&&t.push(new Km({onFocusOnly:n.onFocusOnly,duration:n.zoomDuration})),(n.shiftDragZoom!==void 0?n.shiftDragZoom:!0)&&t.push(new zm({duration:n.zoomDuration})),t}const hi={ADDLAYER:"addlayer",REMOVELAYER:"removelayer"};class ci extends Me{constructor(t,e){super(t),this.layer=e}}const ca={LAYERS:"layers"};class _n extends Pc{constructor(t){t=t||{};const e=Object.assign({},t);delete e.layers;let i=t.layers;super(e),this.on,this.once,this.un,this.layersListenerKeys_=[],this.listenerKeys_={},this.addChangeListener(ca.LAYERS,this.handleLayersChanged_),i?Array.isArray(i)?i=new Ht(i.slice(),{unique:!0}):q(typeof i.getArray=="function","Expected `layers` to be an array or a `Collection`"):i=new Ht(void 0,{unique:!0}),this.setLayers(i)}handleLayerChange_(){this.changed()}handleLayersChanged_(){this.layersListenerKeys_.forEach(nt),this.layersListenerKeys_.length=0;const t=this.getLayers();this.layersListenerKeys_.push(Z(t,Mt.ADD,this.handleLayersAdd_,this),Z(t,Mt.REMOVE,this.handleLayersRemove_,this));for(const i in this.listenerKeys_)this.listenerKeys_[i].forEach(nt);kn(this.listenerKeys_);const e=t.getArray();for(let i=0,s=e.length;i<s;i++){const r=e[i];this.registerLayerListeners_(r),this.dispatchEvent(new ci(hi.ADDLAYER,r))}this.changed()}registerLayerListeners_(t){const e=[Z(t,Yi.PROPERTYCHANGE,this.handleLayerChange_,this),Z(t,z.CHANGE,this.handleLayerChange_,this)];t instanceof _n&&e.push(Z(t,hi.ADDLAYER,this.handleLayerGroupAdd_,this),Z(t,hi.REMOVELAYER,this.handleLayerGroupRemove_,this)),this.listenerKeys_[V(t)]=e}handleLayerGroupAdd_(t){this.dispatchEvent(new ci(hi.ADDLAYER,t.layer))}handleLayerGroupRemove_(t){this.dispatchEvent(new ci(hi.REMOVELAYER,t.layer))}handleLayersAdd_(t){const e=t.element;this.registerLayerListeners_(e),this.dispatchEvent(new ci(hi.ADDLAYER,e)),this.changed()}handleLayersRemove_(t){const e=t.element,i=V(e);this.listenerKeys_[i].forEach(nt),delete this.listenerKeys_[i],this.dispatchEvent(new ci(hi.REMOVELAYER,e)),this.changed()}getLayers(){return this.get(ca.LAYERS)}setLayers(t){const e=this.getLayers();if(e){const i=e.getArray();for(let s=0,r=i.length;s<r;++s)this.dispatchEvent(new ci(hi.REMOVELAYER,i[s]))}this.set(ca.LAYERS,t)}getLayersArray(t){return t=t!==void 0?t:[],this.getLayers().forEach(function(e){e.getLayersArray(t)}),t}getLayerStatesArray(t){const e=t!==void 0?t:[],i=e.length;this.getLayers().forEach(function(o){o.getLayerStatesArray(e)});const s=this.getLayerState();let r=s.zIndex;!t&&s.zIndex===void 0&&(r=0);for(let o=i,a=e.length;o<a;o++){const l=e[o];l.opacity*=s.opacity,l.visible=l.visible&&s.visible,l.maxResolution=Math.min(l.maxResolution,s.maxResolution),l.minResolution=Math.max(l.minResolution,s.minResolution),l.minZoom=Math.max(l.minZoom,s.minZoom),l.maxZoom=Math.min(l.maxZoom,s.maxZoom),s.extent!==void 0&&(l.extent!==void 0?l.extent=wi(l.extent,s.extent):l.extent=s.extent),l.zIndex===void 0&&(l.zIndex=r)}return e}getSourceState(){return"ready"}}class Vm extends ks{constructor(t){super(),this.map_=t}dispatchRenderEvent(t,e){U()}calculateMatrices2D(t){const e=t.viewState,i=t.coordinateToPixelTransform,s=t.pixelToCoordinateTransform;Oe(i,t.size[0]/2,t.size[1]/2,1/e.resolution,-1/e.resolution,-e.rotation,-e.center[0],-e.center[1]),lh(s,i)}forEachFeatureAtCoordinate(t,e,i,s,r,o,a,l){let h;const c=e.viewState;function u(E,x,w,T){return r.call(o,x,E?w:null,T)}const d=c.projection,f=Bl(t.slice(),d),g=[[0,0]];if(d.canWrapX()&&s){const E=d.getExtent(),x=J(E);g.push([-x,0],[x,0])}const m=e.layerStatesArray,_=m.length,p=[],y=[];for(let E=0;E<g.length;E++)for(let x=_-1;x>=0;--x){const w=m[x],T=w.layer;if(T.hasRenderer()&&ia(w,c)&&a.call(l,T)){const R=T.getRenderer(),I=T.getSource();if(R&&I){const L=I.getWrapX()?f:t,P=u.bind(null,w.managed);y[0]=L[0]+g[E][0],y[1]=L[1]+g[E][1],h=R.forEachFeatureAtCoordinate(y,e,i,P,p)}if(h)return h}}if(p.length===0)return;const v=1/p.length;return p.forEach((E,x)=>E.distanceSq+=x*v),p.sort((E,x)=>E.distanceSq-x.distanceSq),p.some(E=>h=E.callback(E.feature,E.layer,E.geometry)),h}hasFeatureAtCoordinate(t,e,i,s,r,o){return this.forEachFeatureAtCoordinate(t,e,i,s,Dn,this,r,o)!==void 0}getMap(){return this.map_}renderFrame(t){U()}scheduleExpireIconCache(t){te.canExpireCache()&&t.postRenderFunctions.push(jm)}}function jm(n,t){te.expire()}class Hm extends Vm{constructor(t){super(t),this.fontChangeListenerKey_=Z(nn,Yi.PROPERTYCHANGE,t.redrawText,t),this.element_=$t?Ah():document.createElement("div");const e=this.element_.style;e.position="absolute",e.width="100%",e.height="100%",e.zIndex="0",this.element_.className=cr+" ol-layers";const i=t.getViewport();i&&i.insertBefore(this.element_,i.firstChild||null),this.children_=[],this.renderedVisible_=!0}dispatchRenderEvent(t,e){const i=this.getMap();if(i.hasListener(t)){const s=new uc(t,void 0,e);i.dispatchEvent(s)}}disposeInternal(){nt(this.fontChangeListenerKey_),this.element_.remove(),super.disposeInternal()}renderFrame(t){if(!t){this.renderedVisible_&&(this.element_.style.display="none",this.renderedVisible_=!1);return}this.calculateMatrices2D(t),this.dispatchRenderEvent(Qt.PRECOMPOSE,t);const e=t.layerStatesArray.sort((h,c)=>h.zIndex-c.zIndex);e.some(h=>h.layer instanceof Dc&&h.layer.getDeclutter())&&(t.declutter={});const s=t.viewState;this.children_.length=0;const r=[];let o=null;for(let h=0,c=e.length;h<c;++h){const u=e[h];t.layerIndex=h;const d=u.layer,f=d.getSourceState();if(!ia(u,s)||f!="ready"&&f!="undefined"){d.unrender();continue}const g=d.render(t,o);g&&(g!==o&&(this.children_.push(g),o=g),r.push(u))}this.declutter(t,r),ig(this.element_,this.children_);const l=this.getMap().getTargetElement();if(ii(l)){const h=l.getContext("2d");for(const c of this.children_){const u=c.firstElementChild||c,d=c.style.backgroundColor;if(d&&(!ii(u)||u.width>0)&&(h.fillStyle=d,h.fillRect(0,0,l.width,l.height)),ii(u)&&u.width>0){const f=c.style.opacity||u.style.opacity;h.globalAlpha=f===""?1:Number(f);const g=u.style.transform;if(g)h.setTransform(...xo(g));else{const m=parseFloat(u.style.width)/u.width,_=parseFloat(u.style.height)/u.height;h.setTransform(m,0,0,_,0,0)}h.drawImage(u,0,0)}}h.globalAlpha=1,h.setTransform(1,0,0,1,0,0)}this.dispatchRenderEvent(Qt.POSTCOMPOSE,t),this.renderedVisible_||(this.element_.style.display="",this.renderedVisible_=!0),this.scheduleExpireIconCache(t)}declutter(t,e){if(t.declutter){for(let i=e.length-1;i>=0;--i){const s=e[i],r=s.layer;r.getDeclutter()&&r.renderDeclutter(t,s)}e.forEach(i=>i.layer.renderDeferred(t))}}}function Wc(n){if(n instanceof Ir){n.setMapInternal(null);return}n instanceof _n&&n.getLayers().forEach(Wc)}function Yc(n,t){if(n instanceof Ir){n.setMapInternal(t);return}if(n instanceof _n){const e=n.getLayers().getArray();for(let i=0,s=e.length;i<s;++i)Yc(e[i],t)}}let qm=class extends he{constructor(t){super(),t=t||{},this.on,this.once,this.un;const e=Jm(t);this.renderComplete_=!1,this.loaded_=!0,this.boundHandleBrowserEvent_=this.handleBrowserEvent.bind(this),this.maxTilesLoading_=t.maxTilesLoading!==void 0?t.maxTilesLoading:16,this.pixelRatio_=t.pixelRatio!==void 0?t.pixelRatio:Qf,this.postRenderTimeoutHandle_,this.animationDelayKey_,this.animationDelay_=this.animationDelay_.bind(this),this.coordinateToPixelTransform_=ce(),this.pixelToCoordinateTransform_=ce(),this.frameIndex_=0,this.frameState_=null,this.previousExtent_=null,this.viewPropertyListenerKey_=null,this.viewChangeListenerKey_=null,this.layerGroupPropertyListenerKeys_=null,$t||(this.viewport_=document.createElement("div"),this.viewport_.className="ol-viewport"+("ontouchstart"in window?" ol-touch":""),this.viewport_.style.position="relative",this.viewport_.style.overflow="hidden",this.viewport_.style.width="100%",this.viewport_.style.height="100%",this.overlayContainer_=document.createElement("div"),this.overlayContainer_.style.position="absolute",this.overlayContainer_.style.zIndex="0",this.overlayContainer_.style.width="100%",this.overlayContainer_.style.height="100%",this.overlayContainer_.style.pointerEvents="none",this.overlayContainer_.className="ol-overlaycontainer",this.viewport_.appendChild(this.overlayContainer_),this.overlayContainerStopEvent_=document.createElement("div"),this.overlayContainerStopEvent_.style.position="absolute",this.overlayContainerStopEvent_.style.zIndex="0",this.overlayContainerStopEvent_.style.width="100%",this.overlayContainerStopEvent_.style.height="100%",this.overlayContainerStopEvent_.style.pointerEvents="none",this.overlayContainerStopEvent_.className="ol-overlaycontainer-stopevent",this.viewport_.appendChild(this.overlayContainerStopEvent_)),this.mapBrowserEventHandler_=null,this.moveTolerance_=t.moveTolerance,this.keyboardEventTarget_=e.keyboardEventTarget,this.targetChangeHandlerKeys_=null,this.targetElement_=null,$t||(this.resizeObserver_=new ResizeObserver(()=>this.updateSize())),this.controls=e.controls||($t?new Ht:Im()),this.interactions=e.interactions||($t?new Ht:Um({onFocusOnly:!0})),this.overlays_=e.overlays,this.overlayIdIndex_={},this.renderer_=null,this.postRenderFunctions_=[],this.tileQueue_=new wm(this.getTilePriority.bind(this),this.handleTileChange_.bind(this)),this.addChangeListener(yt.LAYERGROUP,this.handleLayerGroupChanged_),this.addChangeListener(yt.VIEW,this.handleViewChanged_),this.addChangeListener(yt.SIZE,this.handleSizeChanged_),this.addChangeListener(yt.TARGET,this.handleTargetChanged_),this.setProperties(e.values);const i=this;t.view&&!(t.view instanceof xe)&&t.view.then(function(s){i.setView(new xe(s))}),this.controls.addEventListener(Mt.ADD,s=>{s.element.setMap(this)}),this.controls.addEventListener(Mt.REMOVE,s=>{s.element.setMap(null)}),this.interactions.addEventListener(Mt.ADD,s=>{s.element.setMap(this)}),this.interactions.addEventListener(Mt.REMOVE,s=>{s.element.setMap(null)}),this.overlays_.addEventListener(Mt.ADD,s=>{this.addOverlayInternal_(s.element)}),this.overlays_.addEventListener(Mt.REMOVE,s=>{const r=s.element.getId();r!==void 0&&delete this.overlayIdIndex_[r.toString()],s.element.setMap(null)}),this.controls.forEach(s=>{s.setMap(this)}),this.interactions.forEach(s=>{s.setMap(this)}),this.overlays_.forEach(this.addOverlayInternal_.bind(this))}addControl(t){this.getControls().push(t)}addInteraction(t){this.getInteractions().push(t)}addLayer(t){this.getLayerGroup().getLayers().push(t)}handleLayerAdd_(t){Yc(t.layer,this)}addOverlay(t){this.getOverlays().push(t)}addOverlayInternal_(t){const e=t.getId();e!==void 0&&(this.overlayIdIndex_[e.toString()]=t),t.setMap(this)}disposeInternal(){this.controls.clear(),this.interactions.clear(),this.overlays_.clear(),this.resizeObserver_?.disconnect(),this.setTarget(null),super.disposeInternal()}forEachFeatureAtPixel(t,e,i){if(!this.frameState_||!this.renderer_)return;const s=this.getCoordinateFromPixelInternal(t);i=i!==void 0?i:{};const r=i.hitTolerance!==void 0?i.hitTolerance:0,o=i.layerFilter!==void 0?i.layerFilter:Dn,a=i.checkWrapped!==!1;return this.renderer_.forEachFeatureAtCoordinate(s,this.frameState_,r,a,e,null,o,null)}getFeaturesAtPixel(t,e){const i=[];return this.forEachFeatureAtPixel(t,function(s){i.push(s)},e),i}getAllLayers(){const t=[];function e(i){i.forEach(function(s){s instanceof _n?e(s.getLayers()):t.push(s)})}return e(this.getLayers()),t}hasFeatureAtPixel(t,e){if(!this.frameState_||!this.renderer_)return!1;const i=this.getCoordinateFromPixelInternal(t);e=e!==void 0?e:{};const s=e.layerFilter!==void 0?e.layerFilter:Dn,r=e.hitTolerance!==void 0?e.hitTolerance:0,o=e.checkWrapped!==!1;return this.renderer_.hasFeatureAtCoordinate(i,this.frameState_,r,o,s,null)}getEventCoordinate(t){return this.getCoordinateFromPixel(this.getEventPixel(t))}getEventCoordinateInternal(t){return this.getCoordinateFromPixelInternal(this.getEventPixel(t))}getEventPixel(t){const i=this.viewport_.getBoundingClientRect(),s=this.getSize(),r=i.width/s[0],o=i.height/s[1],a="changedTouches"in t?t.changedTouches[0]:t;return[(a.clientX-i.left)/r,(a.clientY-i.top)/o]}getTarget(){return this.get(yt.TARGET)}getTargetElement(){return this.targetElement_}getCoordinateFromPixel(t){return Eo(this.getCoordinateFromPixelInternal(t),this.getView().getProjection())}getCoordinateFromPixelInternal(t){const e=this.frameState_;return e?dt(e.pixelToCoordinateTransform,t.slice()):null}getControls(){return this.controls}getOverlays(){return this.overlays_}getOverlayById(t){const e=this.overlayIdIndex_[t.toString()];return e!==void 0?e:null}getInteractions(){return this.interactions}getLayerGroup(){return this.get(yt.LAYERGROUP)}setLayers(t){const e=this.getLayerGroup();if(t instanceof Ht){e.setLayers(t);return}const i=e.getLayers();i.clear(),i.extend(t)}getLayers(){return this.getLayerGroup().getLayers()}getLoadingOrNotReady(){const t=this.getLayerGroup().getLayerStatesArray();for(let e=0,i=t.length;e<i;++e){const s=t[e];if(!s.visible)continue;const r=s.layer.getRenderer();if(r&&!r.ready)return!0;const o=s.layer.getSource();if(o&&o.loading)return!0}return!1}getPixelFromCoordinate(t){const e=Pe(t,this.getView().getProjection());return this.getPixelFromCoordinateInternal(e)}getPixelFromCoordinateInternal(t){const e=this.frameState_;return e?dt(e.coordinateToPixelTransform,t.slice(0,2)):null}getRenderer(){return this.renderer_}getSize(){return this.get(yt.SIZE)}getView(){return this.get(yt.VIEW)}getViewport(){return this.viewport_}getOverlayContainer(){return this.overlayContainer_}getOverlayContainerStopEvent(){return this.overlayContainerStopEvent_}getOwnerDocument(){const t=this.getTargetElement();return t?t.ownerDocument:document}getTilePriority(t,e,i,s){return vm(this.frameState_,t,e,i,s)}handleBrowserEvent(t,e){e=e||t.type;const i=new li(e,this,t);this.handleMapBrowserEvent(i)}handleMapBrowserEvent(t){if(!this.frameState_)return;const e=t.originalEvent,i=e.type;if(i===sa.POINTERDOWN||i===z.WHEEL||i===z.KEYDOWN){const s=this.getOwnerDocument(),r=this.viewport_.getRootNode?this.viewport_.getRootNode():s,o=e.target,a=r instanceof ShadowRoot?r.host===o?r.host.ownerDocument:r:r===s?s.documentElement:r;if(this.overlayContainerStopEvent_.contains(o)||!a.contains(o))return}if(t.frameState=this.frameState_,this.dispatchEvent(t)!==!1){const s=this.getInteractions().getArray().slice();for(let r=s.length-1;r>=0;r--){const o=s[r];if(o.getMap()!==this||!o.getActive()||!this.getTargetElement())continue;if(!o.handleEvent(t)||t.propagationStopped)break}}}handlePostRender(){const t=this.frameState_,e=this.tileQueue_;if(!e.isEmpty()){let s=this.maxTilesLoading_,r=s;if(t){const o=t.viewHints;if(o[pt.ANIMATING]||o[pt.INTERACTING]){const a=Date.now()-t.time>8;s=a?0:8,r=a?0:2}}e.getTilesLoading()<s&&(e.reprioritize(),e.loadMoreTiles(s,r))}t&&this.renderer_&&!t.animate&&(this.renderComplete_?(this.hasListener(Qt.RENDERCOMPLETE)&&this.renderer_.dispatchRenderEvent(Qt.RENDERCOMPLETE,t),this.loaded_===!1&&(this.loaded_=!0,this.dispatchEvent(new fn(We.LOADEND,this,t)))):this.loaded_===!0&&(this.loaded_=!1,this.dispatchEvent(new fn(We.LOADSTART,this,t))));const i=this.postRenderFunctions_;if(t)for(let s=0,r=i.length;s<r;++s)i[s](this,t);i.length=0}handleSizeChanged_(){this.getView()&&!this.getView().getAnimating()&&this.getView().resolveConstraints(0),this.render()}handleTargetChanged_(){if(this.mapBrowserEventHandler_){for(let i=0,s=this.targetChangeHandlerKeys_.length;i<s;++i)nt(this.targetChangeHandlerKeys_[i]);this.targetChangeHandlerKeys_=null,this.viewport_.removeEventListener(z.CONTEXTMENU,this.boundHandleBrowserEvent_),this.viewport_.removeEventListener(z.WHEEL,this.boundHandleBrowserEvent_),this.mapBrowserEventHandler_.dispose(),this.mapBrowserEventHandler_=null,this.viewport_.remove()}if(this.targetElement_&&!ii(this.targetElement_)){this.resizeObserver_?.unobserve(this.targetElement_);const i=this.targetElement_.getRootNode();i instanceof ShadowRoot&&this.resizeObserver_.unobserve(i.host),this.setSize(void 0)}const t=this.getTarget(),e=typeof t=="string"?document.getElementById(t):t;if(this.targetElement_=e,!e)this.renderer_&&(clearTimeout(this.postRenderTimeoutHandle_),this.postRenderTimeoutHandle_=void 0,this.postRenderFunctions_.length=0,this.renderer_.dispose(),this.renderer_=null),this.animationDelayKey_&&(cancelAnimationFrame(this.animationDelayKey_),this.animationDelayKey_=void 0);else{if(ii(e)||e.appendChild(this.viewport_),this.renderer_||(this.renderer_=new Hm(this)),!ii(e)){this.mapBrowserEventHandler_=new Em(this,this.moveTolerance_);for(const s in ot)this.mapBrowserEventHandler_.addEventListener(ot[s],this.handleMapBrowserEvent.bind(this));this.viewport_.addEventListener(z.CONTEXTMENU,this.boundHandleBrowserEvent_,!1),this.viewport_.addEventListener(z.WHEEL,this.boundHandleBrowserEvent_,Sh?{passive:!1}:!1);let i;if(this.keyboardEventTarget_)i=this.keyboardEventTarget_;else{const s=e.getRootNode();i=s instanceof ShadowRoot?s.host:e}if(this.targetChangeHandlerKeys_=[Z(i,z.KEYDOWN,this.handleBrowserEvent,this),Z(i,z.KEYPRESS,this.handleBrowserEvent,this)],e instanceof HTMLElement){const s=e.getRootNode();s instanceof ShadowRoot&&this.resizeObserver_.observe(s.host),this.resizeObserver_?.observe(e)}}this.updateSize()}}handleTileChange_(){this.render()}handleViewPropertyChanged_(){this.render()}handleViewChanged_(){this.viewPropertyListenerKey_&&(nt(this.viewPropertyListenerKey_),this.viewPropertyListenerKey_=null),this.viewChangeListenerKey_&&(nt(this.viewChangeListenerKey_),this.viewChangeListenerKey_=null);const t=this.getView();t&&(this.updateViewportSize_(this.getSize()),this.viewPropertyListenerKey_=Z(t,Yi.PROPERTYCHANGE,this.handleViewPropertyChanged_,this),this.viewChangeListenerKey_=Z(t,z.CHANGE,this.handleViewPropertyChanged_,this),t.resolveConstraints(0)),this.render()}handleLayerGroupChanged_(){this.layerGroupPropertyListenerKeys_&&(this.layerGroupPropertyListenerKeys_.forEach(nt),this.layerGroupPropertyListenerKeys_=null);const t=this.getLayerGroup();t&&(this.handleLayerAdd_(new ci("addlayer",t)),this.layerGroupPropertyListenerKeys_=[Z(t,Yi.PROPERTYCHANGE,this.render,this),Z(t,z.CHANGE,this.render,this),Z(t,"addlayer",this.handleLayerAdd_,this),Z(t,"removelayer",this.handleLayerRemove_,this)]),this.render()}isRendered(){return!!this.frameState_}animationDelay_(){this.animationDelayKey_=void 0,this.renderFrame_(Date.now())}renderSync(){this.animationDelayKey_&&cancelAnimationFrame(this.animationDelayKey_),this.animationDelay_()}redrawText(){if(!this.frameState_)return;const t=this.frameState_.layerStatesArray;for(let e=0,i=t.length;e<i;++e){const s=t[e].layer;s.hasRenderer()&&s.getRenderer().handleFontsChanged()}}render(){this.renderer_&&this.animationDelayKey_===void 0&&(this.animationDelayKey_=requestAnimationFrame(this.animationDelay_))}removeControl(t){return this.getControls().remove(t)}removeInteraction(t){return this.getInteractions().remove(t)}removeLayer(t){return this.getLayerGroup().getLayers().remove(t)}handleLayerRemove_(t){Wc(t.layer)}removeOverlay(t){return this.getOverlays().remove(t)}renderFrame_(t){const e=this.getSize(),i=this.getView(),s=this.frameState_;let r=null;if(e!==void 0&&ec(e)&&i&&i.isDef()){const o=i.getHints(this.frameState_?this.frameState_.viewHints:void 0),a=i.getState();if(r={animate:!1,coordinateToPixelTransform:this.coordinateToPixelTransform_,declutter:null,extent:io(a.center,a.resolution,a.rotation,e),index:this.frameIndex_++,layerIndex:0,layerStatesArray:this.getLayerGroup().getLayerStatesArray(),pixelRatio:this.pixelRatio_,pixelToCoordinateTransform:this.pixelToCoordinateTransform_,postRenderFunctions:[],size:e,tileQueue:this.tileQueue_,time:t,usedTiles:{},viewState:a,viewHints:o,wantedTiles:{},mapId:V(this),renderTargets:{}},a.nextCenter&&a.nextResolution){const l=isNaN(a.nextRotation)?a.rotation:a.nextRotation;r.nextExtent=io(a.nextCenter,a.nextResolution,l,e)}}this.frameState_=r,this.renderer_.renderFrame(r),r&&(r.animate&&this.render(),Array.prototype.push.apply(this.postRenderFunctions_,r.postRenderFunctions),s&&(!this.previousExtent_||!Bs(this.previousExtent_)&&!Gn(r.extent,this.previousExtent_))&&(this.dispatchEvent(new fn(We.MOVESTART,this,s)),this.previousExtent_=Ws(this.previousExtent_)),this.previousExtent_&&!r.viewHints[pt.ANIMATING]&&!r.viewHints[pt.INTERACTING]&&!Gn(r.extent,this.previousExtent_)&&(this.dispatchEvent(new fn(We.MOVEEND,this,r)),Pl(r.extent,this.previousExtent_))),this.dispatchEvent(new fn(We.POSTRENDER,this,r)),this.renderComplete_=(this.hasListener(We.LOADSTART)||this.hasListener(We.LOADEND)||this.hasListener(Qt.RENDERCOMPLETE))&&!this.tileQueue_.getTilesLoading()&&!this.tileQueue_.getCount()&&!this.getLoadingOrNotReady(),this.postRenderTimeoutHandle_||(this.postRenderTimeoutHandle_=setTimeout(()=>{this.postRenderTimeoutHandle_=void 0,this.handlePostRender()},0))}setLayerGroup(t){const e=this.getLayerGroup();e&&this.handleLayerRemove_(new ci("removelayer",e)),this.set(yt.LAYERGROUP,t)}setSize(t){this.set(yt.SIZE,t)}setTarget(t){this.set(yt.TARGET,t)}setView(t){if(!t||t instanceof xe){this.set(yt.VIEW,t);return}this.set(yt.VIEW,new xe);const e=this;t.then(function(i){e.setView(new xe(i))})}updateSize(){const t=this.getTargetElement();let e;if(t){let s,r;if(ii(t))s=t.width,r=t.height;else{const o=getComputedStyle(t);s=t.offsetWidth-parseFloat(o.borderLeftWidth)-parseFloat(o.paddingLeft)-parseFloat(o.paddingRight)-parseFloat(o.borderRightWidth),r=t.offsetHeight-parseFloat(o.borderTopWidth)-parseFloat(o.paddingTop)-parseFloat(o.paddingBottom)-parseFloat(o.borderBottomWidth)}!isNaN(s)&&!isNaN(r)&&(e=[Math.max(0,s),Math.max(0,r)],!ec(e)&&(t.offsetWidth||t.offsetHeight||t.getClientRects().length)&&Kl("No map visible because the map container's width or height are 0."))}const i=this.getSize();e&&(!i||!qe(e,i))&&(this.setSize(e),this.updateViewportSize_(e))}updateViewportSize_(t){const e=this.getView();e&&e.setViewportSize(t)}};function Jm(n){let t=null;n.keyboardEventTarget!==void 0&&(t=typeof n.keyboardEventTarget=="string"?document.getElementById(n.keyboardEventTarget):n.keyboardEventTarget);const e={},i=n.layers&&typeof n.layers.getLayers=="function"?n.layers:new _n({layers:n.layers});e[yt.LAYERGROUP]=i,e[yt.TARGET]=n.target,e[yt.VIEW]=n.view instanceof xe?n.view:new xe;let s;n.controls!==void 0&&(Array.isArray(n.controls)?s=new Ht(n.controls.slice()):(q(typeof n.controls.getArray=="function","Expected `controls` to be an array or an `ol/Collection.js`"),s=n.controls));let r;n.interactions!==void 0&&(Array.isArray(n.interactions)?r=new Ht(n.interactions.slice()):(q(typeof n.interactions.getArray=="function","Expected `interactions` to be an array or an `ol/Collection.js`"),r=n.interactions));let o;return n.overlays!==void 0?Array.isArray(n.overlays)?o=new Ht(n.overlays.slice()):(q(typeof n.overlays.getArray=="function","Expected `overlays` to be an array or an `ol/Collection.js`"),o=n.overlays):o=new Ht,{controls:s,interactions:r,keyboardEventTarget:t,overlays:o,values:e}}const Et={ELEMENT:"element",MAP:"map",OFFSET:"offset",POSITION:"position",POSITIONING:"positioning"};class Qm extends he{constructor(t){super(),this.on,this.once,this.un,this.options=t,this.id=t.id,this.insertFirst=t.insertFirst!==void 0?t.insertFirst:!0,this.stopEvent=t.stopEvent!==void 0?t.stopEvent:!0,this.element=document.createElement("div"),this.element.className=t.className!==void 0?t.className:"ol-overlay-container "+pg,this.element.style.position="absolute",this.element.style.pointerEvents="auto",this.autoPan=t.autoPan===!0?{}:t.autoPan||void 0,this.rendered={transform_:"",visible:!0},this.mapPostrenderListenerKey=null,this.addChangeListener(Et.ELEMENT,this.handleElementChanged),this.addChangeListener(Et.MAP,this.handleMapChanged),this.addChangeListener(Et.OFFSET,this.handleOffsetChanged),this.addChangeListener(Et.POSITION,this.handlePositionChanged),this.addChangeListener(Et.POSITIONING,this.handlePositioningChanged),t.element!==void 0&&this.setElement(t.element),this.setOffset(t.offset!==void 0?t.offset:[0,0]),this.setPositioning(t.positioning||"top-left"),t.position!==void 0&&this.setPosition(t.position)}getElement(){return this.get(Et.ELEMENT)}getId(){return this.id}getMap(){return this.get(Et.MAP)||null}getOffset(){return this.get(Et.OFFSET)}getPosition(){return this.get(Et.POSITION)}getPositioning(){return this.get(Et.POSITIONING)}handleElementChanged(){Lh(this.element);const t=this.getElement();t&&this.element.appendChild(t)}handleMapChanged(){this.mapPostrenderListenerKey&&(this.element?.remove(),nt(this.mapPostrenderListenerKey),this.mapPostrenderListenerKey=null);const t=this.getMap();if(t){this.mapPostrenderListenerKey=Z(t,We.POSTRENDER,this.render,this),this.updatePixelPosition();const e=this.stopEvent?t.getOverlayContainerStopEvent():t.getOverlayContainer();this.insertFirst?e.insertBefore(this.element,e.childNodes[0]||null):e.appendChild(this.element),this.performAutoPan()}}render(){this.updatePixelPosition()}handleOffsetChanged(){this.updatePixelPosition()}handlePositionChanged(){this.updatePixelPosition(),this.performAutoPan()}handlePositioningChanged(){this.updatePixelPosition()}setElement(t){this.set(Et.ELEMENT,t)}setMap(t){this.set(Et.MAP,t)}setOffset(t){this.set(Et.OFFSET,t)}setPosition(t){this.set(Et.POSITION,t)}performAutoPan(){this.autoPan&&this.panIntoView(this.autoPan)}panIntoView(t){const e=this.getMap();if(!e||!e.getTargetElement()||!this.get(Et.POSITION))return;const i=this.getRect(e.getTargetElement(),e.getSize()),s=this.getElement(),r=this.getRect(s,[tg(s),eg(s)]);t=t||{};const o=t.margin===void 0?20:t.margin;if(!Bi(i,r)){const a=r[0]-i[0],l=i[2]-r[2],h=r[1]-i[1],c=i[3]-r[3],u=[0,0];if(a<0?u[0]=a-o:l<0&&(u[0]=Math.abs(l)+o),h<0?u[1]=h-o:c<0&&(u[1]=Math.abs(c)+o),u[0]!==0||u[1]!==0){const d=e.getView().getCenterInternal(),f=e.getPixelFromCoordinateInternal(d);if(!f)return;const g=[f[0]+u[0],f[1]+u[1]],m=t.animation||{};e.getView().animateInternal({center:e.getCoordinateFromPixelInternal(g),duration:m.duration,easing:m.easing})}}}getRect(t,e){const i=t.getBoundingClientRect(),s=i.left+window.pageXOffset,r=i.top+window.pageYOffset;return[s,r,s+e[0],r+e[1]]}setPositioning(t){this.set(Et.POSITIONING,t)}setVisible(t){this.rendered.visible!==t&&(this.element.style.display=t?"":"none",this.rendered.visible=t)}updatePixelPosition(){const t=this.getMap(),e=this.getPosition();if(!t||!t.isRendered()||!e){this.setVisible(!1);return}const i=t.getPixelFromCoordinate(e),s=t.getSize();this.updateRenderedPosition(i,s)}updateRenderedPosition(t,e){const i=this.element.style,s=this.getOffset(),r=this.getPositioning();this.setVisible(!0);const o=`${t[0]+s[0]}px`,a=`${t[1]+s[1]}px`;let l="0%",h="0%";r=="bottom-right"||r=="center-right"||r=="top-right"?l="-100%":(r=="bottom-center"||r=="center-center"||r=="top-center")&&(l="-50%"),r=="bottom-left"||r=="bottom-center"||r=="bottom-right"?h="-100%":(r=="center-left"||r=="center-center"||r=="center-right")&&(h="-50%");const c=`translate(${l}, ${h}) translate(${o}, ${a})`;this.rendered.transform_!=c&&(this.rendered.transform_=c,i.transform=c)}getOptions(){return this.options}}class ua{constructor(t,e,i,s){this.minX=t,this.maxX=e,this.minY=i,this.maxY=s}contains(t){return this.containsXY(t[1],t[2])}containsTileRange(t){return this.minX<=t.minX&&t.maxX<=this.maxX&&this.minY<=t.minY&&t.maxY<=this.maxY}containsXY(t,e){return this.minX<=t&&t<=this.maxX&&this.minY<=e&&e<=this.maxY}equals(t){return this.minX==t.minX&&this.minY==t.minY&&this.maxX==t.maxX&&this.maxY==t.maxY}extend(t){t.minX<this.minX&&(this.minX=t.minX),t.maxX>this.maxX&&(this.maxX=t.maxX),t.minY<this.minY&&(this.minY=t.minY),t.maxY>this.maxY&&(this.maxY=t.maxY)}getHeight(){return this.maxY-this.minY+1}getSize(){return[this.getWidth(),this.getHeight()]}getWidth(){return this.maxX-this.minX+1}intersects(t){return this.minX<=t.maxX&&this.maxX>=t.minX&&this.minY<=t.maxY&&this.maxY>=t.minY}}function mn(n,t,e,i,s){return s!==void 0?(s.minX=n,s.maxX=t,s.minY=e,s.maxY=i,s):new ua(n,t,e,i)}let da;const pn=[];function $c(n,t,e,i,s){n.beginPath(),n.moveTo(0,0),n.lineTo(t,e),n.lineTo(i,s),n.closePath(),n.save(),n.clip(),n.fillRect(0,0,Math.max(t,i)+1,Math.max(e,s)),n.restore()}function fa(n,t){return Math.abs(n[t*4]-210)>2||Math.abs(n[t*4+3]-.75*255)>2}function tp(){if(da===void 0){const n=ht(6,6,pn);n.globalCompositeOperation="lighter",n.fillStyle="rgba(210, 0, 0, 0.75)",$c(n,4,5,4,0),$c(n,4,5,0,5);const t=n.getImageData(0,0,3,3).data;da=fa(t,0)||fa(t,4)||fa(t,8),or(n),pn.push(n.canvas)}return da}function Kc(n,t,e,i){const s=Yn(e,t,n);let r=rh(t,i,e);const o=t.getMetersPerUnit();o!==void 0&&(r*=o);const a=n.getMetersPerUnit();a!==void 0&&(r/=a);const l=n.getExtent();if(!l||Ki(l,s)){const h=rh(n,r,s)/r;isFinite(h)&&h>0&&(r/=h)}return r}function ep(n,t,e,i){const s=xi(e);let r=Kc(n,t,s,i);return(!isFinite(r)||r<=0)&&Gl(e,function(o){return r=Kc(n,t,o,i),isFinite(r)&&r>0}),r}function ip(n,t,e,i,s,r,o,a,l,h,c,u,d,f){const g=ht(Math.round(e*n),Math.round(e*t),pn);if(u||(g.imageSmoothingEnabled=!1),l.length===0)return g.canvas;g.scale(e,e);function m(x){return Math.round(x*e)/e}g.globalCompositeOperation="lighter";const _=Yt();l.forEach(function(x,w,T){kl(_,x.extent)});let p;const y=e/i,v=(u?1:1+Math.pow(2,-24))/y;p=ht(Math.round(J(_)*y),Math.round(It(_)*y),pn),u||(p.imageSmoothingEnabled=!1),l.forEach(function(x,w,T){if(x.image.width>0&&x.image.height>0){if(x.clipExtent){p.save();const A=(x.clipExtent[0]-_[0])*y,b=-(x.clipExtent[3]-_[3])*y,M=J(x.clipExtent)*y,Y=It(x.clipExtent)*y;p.rect(u?A:Math.round(A),u?b:Math.round(b),u?M:Math.round(A+M)-Math.round(A),u?Y:Math.round(b+Y)-Math.round(b)),p.clip()}const R=(x.extent[0]-_[0])*y,I=-(x.extent[3]-_[3])*y,L=J(x.extent)*y,P=It(x.extent)*y;p.drawImage(x.image,h,h,x.image.width-2*h,x.image.height-2*h,u?R:Math.round(R),u?I:Math.round(I),u?L:Math.round(R+L)-Math.round(R),u?P:Math.round(I+P)-Math.round(I)),x.clipExtent&&p.restore()}});const E=vi(o);return a.getTriangles().forEach(function(x,w,T){const R=x.source,I=x.target;let L=R[0][0],P=R[0][1],A=R[1][0],b=R[1][1],M=R[2][0],Y=R[2][1];const k=m((I[0][0]-E[0])/r),G=m(-(I[0][1]-E[1])/r),F=m((I[1][0]-E[0])/r),$=m(-(I[1][1]-E[1])/r),B=m((I[2][0]-E[0])/r),et=m(-(I[2][1]-E[1])/r),S=L,xt=P;L=0,P=0,A-=S,b-=xt,M-=S,Y-=xt;const bt=[[A,b,0,0,F-k],[M,Y,0,0,B-k],[0,0,A,b,$-G],[0,0,M,Y,et-G]],lt=Zd(bt);if(!lt)return;if(g.save(),g.beginPath(),tp()||!u){g.moveTo(F,$);const wt=4,we=k-F,_e=G-$;for(let Bt=0;Bt<wt;Bt++)g.lineTo(F+m((Bt+1)*we/wt),$+m(Bt*_e/(wt-1))),Bt!=wt-1&&g.lineTo(F+m((Bt+1)*we/wt),$+m((Bt+1)*_e/(wt-1)));g.lineTo(B,et)}else g.moveTo(F,$),g.lineTo(k,G),g.lineTo(B,et);g.clip(),g.transform(lt[0],lt[2],lt[1],lt[3],k,G),g.translate(_[0]-S,_[3]-xt);let Kt;if(p)Kt=p.canvas,g.scale(v,-v);else{const wt=l[0],we=wt.extent;Kt=wt.image,g.scale(J(we)/Kt.width,-It(we)/Kt.height)}g.drawImage(Kt,0,0),g.restore()}),p&&(or(p),pn.push(p.canvas)),c&&(g.save(),g.globalCompositeOperation="source-over",g.strokeStyle="black",g.lineWidth=1,a.getTriangles().forEach(function(x,w,T){const R=x.target,I=(R[0][0]-E[0])/r,L=-(R[0][1]-E[1])/r,P=(R[1][0]-E[0])/r,A=-(R[1][1]-E[1])/r,b=(R[2][0]-E[0])/r,M=-(R[2][1]-E[1])/r;g.beginPath(),g.moveTo(P,A),g.lineTo(I,L),g.lineTo(b,M),g.closePath(),g.stroke()}),g.restore()),g.canvas}const np=10,Bc=.25;class sp{constructor(t,e,i,s,r,o,a){this.sourceProj_=t,this.targetProj_=e;let l={};const h=a?Rf(v=>dt(a,Yn(v,this.targetProj_,this.sourceProj_))):ir(this.targetProj_,this.sourceProj_);this.transformInv_=function(v){const E=v[0]+"/"+v[1];return l[E]||(l[E]=h(v)),l[E]},this.maxSourceExtent_=s,this.errorThresholdSquared_=r*r,this.triangles_=[],this.wrapsXInSource_=!1,this.canWrapXInSource_=this.sourceProj_.canWrapX()&&!!s&&!!this.sourceProj_.getExtent()&&J(s)>=J(this.sourceProj_.getExtent()),this.sourceWorldWidth_=this.sourceProj_.getExtent()?J(this.sourceProj_.getExtent()):null,this.targetWorldWidth_=this.targetProj_.getExtent()?J(this.targetProj_.getExtent()):null;const c=vi(i),u=Ks(i),d=$s(i),f=Ys(i),g=this.transformInv_(c),m=this.transformInv_(u),_=this.transformInv_(d),p=this.transformInv_(f),y=np+(o?Math.max(0,Math.ceil(Math.log2(eo(i)/(o*o*256*256)))):0);if(this.addQuad_(c,u,d,f,g,m,_,p,y),this.wrapsXInSource_){let v=1/0;this.triangles_.forEach(function(E,x,w){v=Math.min(v,E.source[0][0],E.source[1][0],E.source[2][0])}),this.triangles_.forEach(E=>{if(Math.max(E.source[0][0],E.source[1][0],E.source[2][0])-v>this.sourceWorldWidth_/2){const x=[[E.source[0][0],E.source[0][1]],[E.source[1][0],E.source[1][1]],[E.source[2][0],E.source[2][1]]];x[0][0]-v>this.sourceWorldWidth_/2&&(x[0][0]-=this.sourceWorldWidth_),x[1][0]-v>this.sourceWorldWidth_/2&&(x[1][0]-=this.sourceWorldWidth_),x[2][0]-v>this.sourceWorldWidth_/2&&(x[2][0]-=this.sourceWorldWidth_);const w=Math.min(x[0][0],x[1][0],x[2][0]);Math.max(x[0][0],x[1][0],x[2][0])-w<this.sourceWorldWidth_/2&&(E.source=x)}})}l={}}addTriangle_(t,e,i,s,r,o){this.triangles_.push({source:[s,r,o],target:[t,e,i]})}addQuad_(t,e,i,s,r,o,a,l,h){const c=Ml([r,o,a,l]),u=this.sourceWorldWidth_?J(c)/this.sourceWorldWidth_:null,d=this.sourceWorldWidth_,f=this.sourceProj_.canWrapX()&&u>.5&&u<1;let g=!1;if(h>0){if(this.targetProj_.isGlobal()&&this.targetWorldWidth_){const _=Ml([t,e,i,s]);g=J(_)/this.targetWorldWidth_>Bc||g}!f&&this.sourceProj_.isGlobal()&&u&&(g=u>Bc||g)}if(!g&&this.maxSourceExtent_&&isFinite(c[0])&&isFinite(c[1])&&isFinite(c[2])&&isFinite(c[3])&&!Pt(c,this.maxSourceExtent_))return;let m=0;if(!g&&(!isFinite(r[0])||!isFinite(r[1])||!isFinite(o[0])||!isFinite(o[1])||!isFinite(a[0])||!isFinite(a[1])||!isFinite(l[0])||!isFinite(l[1]))){if(h>0)g=!0;else if(m=(!isFinite(r[0])||!isFinite(r[1])?8:0)+(!isFinite(o[0])||!isFinite(o[1])?4:0)+(!isFinite(a[0])||!isFinite(a[1])?2:0)+(!isFinite(l[0])||!isFinite(l[1])?1:0),m!=1&&m!=2&&m!=4&&m!=8)return}if(h>0){if(!g){const _=[(t[0]+i[0])/2,(t[1]+i[1])/2],p=this.transformInv_(_);let y;f?y=(Ui(r[0],d)+Ui(a[0],d))/2-Ui(p[0],d):y=(r[0]+a[0])/2-p[0];const v=(r[1]+a[1])/2-p[1];g=y*y+v*v>this.errorThresholdSquared_}if(g){if(Math.abs(t[0]-i[0])<=Math.abs(t[1]-i[1])){const _=[(e[0]+i[0])/2,(e[1]+i[1])/2],p=this.transformInv_(_),y=[(s[0]+t[0])/2,(s[1]+t[1])/2],v=this.transformInv_(y);this.addQuad_(t,e,_,y,r,o,p,v,h-1),this.addQuad_(y,_,i,s,v,p,a,l,h-1)}else{const _=[(t[0]+e[0])/2,(t[1]+e[1])/2],p=this.transformInv_(_),y=[(i[0]+s[0])/2,(i[1]+s[1])/2],v=this.transformInv_(y);this.addQuad_(t,_,y,s,r,p,v,l,h-1),this.addQuad_(_,e,i,y,p,o,a,v,h-1)}return}}if(f){if(!this.canWrapXInSource_)return;this.wrapsXInSource_=!0}(m&11)==0&&this.addTriangle_(t,i,s,r,a,l),(m&14)==0&&this.addTriangle_(t,i,e,r,a,o),m&&((m&13)==0&&this.addTriangle_(e,s,t,o,l,r),(m&7)==0&&this.addTriangle_(e,s,i,o,l,a))}calculateSourceExtent(){const t=Yt();return this.triangles_.forEach(function(e,i,s){const r=e.source;zn(t,r[0]),zn(t,r[1]),zn(t,r[2])}),t}getTriangles(){return this.triangles_}}const rp=.5;class Zc extends na{constructor(t,e,i,s,r,o,a,l,h,c,u,d){super(r,D.IDLE,d),this.renderEdges_=u!==void 0?u:!1,this.pixelRatio_=a,this.gutter_=l,this.canvas_=null,this.sourceTileGrid_=e,this.targetTileGrid_=s,this.wrappedTileCoord_=o||r,this.sourceTiles_=[],this.sourcesListenerKeys_=null,this.sourceZ_=0,this.clipExtent_=t.canWrapX()?t.getExtent():void 0;const f=s.getTileCoordExtent(this.wrappedTileCoord_),g=this.targetTileGrid_.getExtent();let m=this.sourceTileGrid_.getExtent();const _=g?wi(f,g):f;if(eo(_)===0){this.state=D.EMPTY;return}const p=t.getExtent();p&&(m?m=wi(m,p):m=p);const y=s.getResolution(this.wrappedTileCoord_[0]),v=ep(t,i,_,y);if(!isFinite(v)||v<=0){this.state=D.EMPTY;return}const E=c!==void 0?c:rp;if(this.triangulation_=new sp(t,i,_,m,v*E,y),this.triangulation_.getTriangles().length===0){this.state=D.EMPTY;return}this.sourceZ_=e.getZForResolution(v);let x=this.triangulation_.calculateSourceExtent();if(m&&(t.canWrapX()?(x[1]=rt(x[1],m[1],m[3]),x[3]=rt(x[3],m[1],m[3])):x=wi(x,m)),!eo(x))this.state=D.EMPTY;else{let w=0,T=0;t.canWrapX()&&(w=J(p),T=Math.floor((x[0]-p[0])/w)),Wl(x.slice(),t,!0).forEach(I=>{const L=e.getTileRangeForExtentAndZ(I,this.sourceZ_);for(let P=L.minX;P<=L.maxX;P++)for(let A=L.minY;A<=L.maxY;A++){const b=h(this.sourceZ_,P,A,a);if(b){const M=T*w;this.sourceTiles_.push({tile:b,offset:M})}}++T}),this.sourceTiles_.length===0&&(this.state=D.EMPTY)}}getImage(){return this.canvas_}reproject_(){const t=[];if(this.sourceTiles_.forEach(e=>{const i=e.tile;if(i&&i.getState()==D.LOADED){const s=this.sourceTileGrid_.getTileCoordExtent(i.tileCoord);s[0]+=e.offset,s[2]+=e.offset;const r=this.clipExtent_?.slice();r&&(r[0]+=e.offset,r[2]+=e.offset),t.push({extent:s,clipExtent:r,image:i.getImage()})}}),this.sourceTiles_.length=0,t.length===0)this.state=D.ERROR;else{const e=this.wrappedTileCoord_[0],i=this.targetTileGrid_.getTileSize(e),s=typeof i=="number"?i:i[0],r=typeof i=="number"?i:i[1],o=this.targetTileGrid_.getResolution(e),a=this.sourceTileGrid_.getResolution(this.sourceZ_),l=this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_);this.canvas_=ip(s,r,this.pixelRatio_,a,this.sourceTileGrid_.getExtent(),o,l,this.triangulation_,t,this.gutter_,this.renderEdges_,this.interpolate),this.state=D.LOADED}this.changed()}load(){if(this.state==D.IDLE){this.state=D.LOADING,this.changed();let t=0;this.sourcesListenerKeys_=[],this.sourceTiles_.forEach(({tile:e})=>{const i=e.getState();if(i==D.IDLE||i==D.LOADING){t++;const s=Z(e,z.CHANGE,r=>{const o=e.getState();(o==D.LOADED||o==D.ERROR||o==D.EMPTY)&&(nt(s),t--,t===0&&(this.unlistenSources_(),this.reproject_()))});this.sourcesListenerKeys_.push(s)}}),t===0?setTimeout(this.reproject_.bind(this),0):this.sourceTiles_.forEach(function({tile:e},i,s){e.getState()==D.IDLE&&e.load()})}}unlistenSources_(){this.sourcesListenerKeys_.forEach(nt),this.sourcesListenerKeys_=null}release(){this.canvas_&&(or(this.canvas_.getContext("2d")),pn.push(this.canvas_),this.canvas_=null),super.release()}}function br(n,t,e,i){return i!==void 0?(i[0]=n,i[1]=t,i[2]=e,i):[n,t,e]}function op(n,t,e){return n+"/"+t+"/"+e}function Lr(n,t,e,i,s){return`${V(n)},${t},${op(e,i,s)}`}function ap(n){return lp(n[0],n[1],n[2])}function lp(n,t,e){return(t<<n)+e}function hp(n,t){const e=n[0],i=n[1],s=n[2];if(t.getMinZoom()>e||e>t.getMaxZoom())return!1;const r=t.getFullTileRange(e);return r?r.containsXY(i,s):!0}const yn=[0,0,0],ui=5;class Uc{constructor(t){this.minZoom=t.minZoom!==void 0?t.minZoom:0,this.resolutions_=t.resolutions,q(kd(this.resolutions_,(s,r)=>r-s),"`resolutions` must be sorted in descending order");let e;if(!t.origins){for(let s=0,r=this.resolutions_.length-1;s<r;++s)if(!e)e=this.resolutions_[s]/this.resolutions_[s+1];else if(this.resolutions_[s]/this.resolutions_[s+1]!==e){e=void 0;break}}this.zoomFactor_=e,this.maxZoom=this.resolutions_.length-1,this.origin_=t.origin!==void 0?t.origin:null,this.origins_=null,t.origins!==void 0&&(this.origins_=t.origins,q(this.origins_.length==this.resolutions_.length,"Number of `origins` and `resolutions` must be equal"));const i=t.extent;i!==void 0&&!this.origin_&&!this.origins_&&(this.origin_=vi(i)),q(!this.origin_&&this.origins_||this.origin_&&!this.origins_,"Either `origin` or `origins` must be configured, never both"),this.tileSizes_=null,t.tileSizes!==void 0&&(this.tileSizes_=t.tileSizes,q(this.tileSizes_.length==this.resolutions_.length,"Number of `tileSizes` and `resolutions` must be equal")),this.tileSize_=t.tileSize!==void 0?t.tileSize:this.tileSizes_?null:Qo,q(!this.tileSize_&&this.tileSizes_||this.tileSize_&&!this.tileSizes_,"Either `tileSize` or `tileSizes` must be configured, never both"),this.extent_=i!==void 0?i:null,this.fullTileRanges_=null,this.tmpSize_=[0,0],this.tmpExtent_=[0,0,0,0],t.sizes!==void 0?this.fullTileRanges_=t.sizes.map((s,r)=>{const o=new ua(Math.min(0,s[0]),Math.max(s[0]-1,-1),Math.min(0,s[1]),Math.max(s[1]-1,-1));if(i){const a=this.getTileRangeForExtentAndZ(i,r);o.minX=Math.max(a.minX,o.minX),o.maxX=Math.min(a.maxX,o.maxX),o.minY=Math.max(a.minY,o.minY),o.maxY=Math.min(a.maxY,o.maxY)}return o}):i&&this.calculateTileRanges_(i)}forEachTileCoord(t,e,i){const s=this.getTileRangeForExtentAndZ(t,e);for(let r=s.minX,o=s.maxX;r<=o;++r)for(let a=s.minY,l=s.maxY;a<=l;++a)i([e,r,a])}forEachTileCoordParentTileRange(t,e,i,s){let r,o,a,l=null,h=t[0]-1;for(this.zoomFactor_===2?(o=t[1],a=t[2]):l=this.getTileCoordExtent(t,s);h>=this.minZoom;){if(o!==void 0&&a!==void 0?(o=Math.floor(o/2),a=Math.floor(a/2),r=mn(o,o,a,a,i)):r=this.getTileRangeForExtentAndZ(l,h,i),e(h,r))return!0;--h}return!1}getExtent(){return this.extent_}getMaxZoom(){return this.maxZoom}getMinZoom(){return this.minZoom}getOrigin(t){return this.origin_?this.origin_:this.origins_[t]}getResolution(t){return this.resolutions_[t]}getResolutions(){return this.resolutions_}getTileCoordChildTileRange(t,e,i){if(t[0]<this.maxZoom){if(this.zoomFactor_===2){const r=t[1]*2,o=t[2]*2;return mn(r,r+1,o,o+1,e)}const s=this.getTileCoordExtent(t,i||this.tmpExtent_);return this.getTileRangeForExtentAndZ(s,t[0]+1,e)}return null}getTileRangeForTileCoordAndZ(t,e,i){if(e>this.maxZoom||e<this.minZoom)return null;const s=t[0],r=t[1],o=t[2];if(e===s)return mn(r,o,r,o,i);if(this.zoomFactor_){const l=Math.pow(this.zoomFactor_,e-s),h=Math.floor(r*l),c=Math.floor(o*l);if(e<s)return mn(h,h,c,c,i);const u=Math.floor(l*(r+1))-1,d=Math.floor(l*(o+1))-1;return mn(h,u,c,d,i)}const a=this.getTileCoordExtent(t,this.tmpExtent_);return this.getTileRangeForExtentAndZ(a,e,i)}getTileRangeForExtentAndZ(t,e,i){this.getTileCoordForXYAndZ_(t[0],t[3],e,!1,yn);const s=yn[1],r=yn[2];this.getTileCoordForXYAndZ_(t[2],t[1],e,!0,yn);const o=yn[1],a=yn[2];return mn(s,o,r,a,i)}getTileCoordCenter(t){const e=this.getOrigin(t[0]),i=this.getResolution(t[0]),s=Ft(this.getTileSize(t[0]),this.tmpSize_);return[e[0]+(t[1]+.5)*s[0]*i,e[1]-(t[2]+.5)*s[1]*i]}getTileCoordExtent(t,e){const i=this.getOrigin(t[0]),s=this.getResolution(t[0]),r=Ft(this.getTileSize(t[0]),this.tmpSize_),o=i[0]+t[1]*r[0]*s,a=i[1]-(t[2]+1)*r[1]*s,l=o+r[0]*s,h=a+r[1]*s;return Je(o,a,l,h,e)}getTileCoordForCoordAndResolution(t,e,i){return this.getTileCoordForXYAndResolution_(t[0],t[1],e,!1,i)}getTileCoordForXYAndResolution_(t,e,i,s,r){const o=this.getZForResolution(i),a=i/this.getResolution(o),l=this.getOrigin(o),h=Ft(this.getTileSize(o),this.tmpSize_);let c=a*(t-l[0])/i/h[0],u=a*(l[1]-e)/i/h[1];return s?(c=Vs(c,ui)-1,u=Vs(u,ui)-1):(c=Us(c,ui),u=Us(u,ui)),br(o,c,u,r)}getTileCoordForXYAndZ_(t,e,i,s,r){const o=this.getOrigin(i),a=this.getResolution(i),l=Ft(this.getTileSize(i),this.tmpSize_);let h=(t-o[0])/a/l[0],c=(o[1]-e)/a/l[1];return s?(h=Vs(h,ui)-1,c=Vs(c,ui)-1):(h=Us(h,ui),c=Us(c,ui)),br(i,h,c,r)}getTileCoordForCoordAndZ(t,e,i){return this.getTileCoordForXYAndZ_(t[0],t[1],e,!1,i)}getTileCoordResolution(t){return this.resolutions_[t[0]]}getTileSize(t){return this.tileSize_?this.tileSize_:this.tileSizes_[t]}getFullTileRange(t){return this.fullTileRanges_?this.fullTileRanges_[t]:this.extent_?this.getTileRangeForExtentAndZ(this.extent_,t):null}getZForResolution(t,e){const i=jr(this.resolutions_,t,e||0);return rt(i,this.minZoom,this.maxZoom)}tileCoordIntersectsViewport(t,e){return wh(e,0,e.length,2,this.getTileCoordExtent(t))}calculateTileRanges_(t){const e=this.resolutions_.length,i=new Array(e);for(let s=this.minZoom;s<e;++s)i[s]=this.getTileRangeForExtentAndZ(t,s);this.fullTileRanges_=i}}function Vc(n){let t=n.getDefaultTileGrid();return t||(t=fp(n),n.setDefaultTileGrid(t)),t}function cp(n,t,e){const i=t[0],s=n.getTileCoordCenter(t),r=ga(e);if(!Ki(r,s)){const o=J(r),a=Math.ceil((r[0]-s[0])/o);return s[0]+=o*a,n.getTileCoordForCoordAndZ(s,i)}return t}function up(n,t,e,i){i=i!==void 0?i:"top-left";const s=jc(n,t,e);return new Uc({extent:n,origin:Yd(n,i),resolutions:s,tileSize:e})}function dp(n){const t=n||{},e=t.extent||Ot("EPSG:3857").getExtent(),i={extent:e,minZoom:t.minZoom,tileSize:t.tileSize,resolutions:jc(e,t.maxZoom,t.tileSize,t.maxResolution)};return new Uc(i)}function jc(n,t,e,i){t=t!==void 0?t:cm,e=Ft(e!==void 0?e:Qo);const s=It(n),r=J(n);i=i>0?i:Math.max(r/e[0],s/e[1]);const o=t+1,a=new Array(o);for(let l=0;l<o;++l)a[l]=i/Math.pow(2,l);return a}function fp(n,t,e,i){const s=ga(n);return up(s,t,e,i)}function ga(n){n=Ot(n);let t=n.getExtent();if(!t){const e=180*ro.degrees/n.getMetersPerUnit();t=Je(-e,-e,e,e)}return t}const gp=/\{z\}/g,_p=/\{x\}/g,mp=/\{y\}/g,pp=/\{-y\}/g;function yp(n,t,e,i,s){return n.replace(gp,t.toString()).replace(_p,e.toString()).replace(mp,i.toString()).replace(pp,function(){if(s===void 0)throw new Error("If the URL template has a {-y} placeholder, the grid extent must be known");return(s-i).toString()})}function Ep(n){const t=[];let e=/\{([a-z])-([a-z])\}/.exec(n);if(e){const i=e[1].charCodeAt(0),s=e[2].charCodeAt(0);let r;for(r=i;r<=s;++r)t.push(n.replace(e[0],String.fromCharCode(r)));return t}if(e=/\{(\d+)-(\d+)\}/.exec(n),e){const i=parseInt(e[2],10);for(let s=parseInt(e[1],10);s<=i;s++)t.push(n.replace(e[0],s.toString()));return t}return t.push(n),t}function xp(n,t){return(function(e,i,s){if(!e)return;let r;const o=e[0];if(t){const a=t.getFullTileRange(o);a&&(r=a.getHeight()-1)}return yp(n,o,e[1],e[2],r)})}function wp(n,t){const e=n.length,i=new Array(e);for(let s=0;s<e;++s)i[s]=xp(n[s],t);return vp(i)}function vp(n){return n.length===1?n[0]:(function(t,e,i){if(!t)return;const s=ap(t),r=Ui(s,n.length);return n[r](t,e,i)})}class Cp extends Qh{constructor(t){super({attributions:t.attributions,attributionsCollapsible:t.attributionsCollapsible,projection:t.projection,state:t.state,wrapX:t.wrapX,interpolate:t.interpolate}),this.on,this.once,this.un,this.tilePixelRatio_=t.tilePixelRatio!==void 0?t.tilePixelRatio:1,this.tileGrid=t.tileGrid!==void 0?t.tileGrid:null;const e=[256,256];this.tileGrid&&Ft(this.tileGrid.getTileSize(this.tileGrid.getMinZoom()),e),this.tmpSize=[0,0],this.key_=t.key||V(this),this.tileOptions={transition:t.transition,interpolate:t.interpolate},this.zDirection=t.zDirection?t.zDirection:0}getGutterForProjection(t){return 0}getKey(){return this.key_}setKey(t){this.key_!==t&&(this.key_=t,this.changed())}getResolutions(t){const e=t?this.getTileGridForProjection(t):this.tileGrid;return e?e.getResolutions():null}getTile(t,e,i,s,r,o){return U()}getTileGrid(){return this.tileGrid}getTileGridForProjection(t){return this.tileGrid?this.tileGrid:Vc(t)}getTilePixelRatio(t){return this.tilePixelRatio_}getTilePixelSize(t,e,i){const s=this.getTileGridForProjection(i),r=this.getTilePixelRatio(e),o=Ft(s.getTileSize(t),this.tmpSize);return r==1?o:jg(o,r,this.tmpSize)}getTileCoordForTileUrlFunction(t,e){const i=e!==void 0?e:this.getProjection(),s=e!==void 0?this.getTileGridForProjection(i):this.tileGrid||this.getTileGridForProjection(i);return this.getWrapX()&&i.isGlobal()&&(t=cp(s,t,i)),hp(t,s)?t:null}clear(){}refresh(){this.clear(),super.refresh()}}class Rp extends Me{constructor(t,e){super(t),this.tile=e}}const _a={TILELOADSTART:"tileloadstart",TILELOADEND:"tileloadend",TILELOADERROR:"tileloaderror"};class ma extends Cp{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===ma.prototype.tileUrlFunction,this.tileLoadFunction=t.tileLoadFunction,t.tileUrlFunction&&(this.tileUrlFunction=t.tileUrlFunction),this.urls=null,t.urls?this.setUrls(t.urls):t.url&&this.setUrl(t.url),this.tileLoadingKeys_={}}getTileLoadFunction(){return this.tileLoadFunction}getTileUrlFunction(){return Object.getPrototypeOf(this).tileUrlFunction===this.tileUrlFunction?this.tileUrlFunction.bind(this):this.tileUrlFunction}getUrls(){return this.urls}handleTileChange(t){const e=t.target,i=V(e),s=e.getState();let r;s==D.LOADING?(this.tileLoadingKeys_[i]=!0,r=_a.TILELOADSTART):i in this.tileLoadingKeys_&&(delete this.tileLoadingKeys_[i],r=s==D.ERROR?_a.TILELOADERROR:s==D.LOADED?_a.TILELOADEND:void 0),r!=null&&this.dispatchEvent(new Rp(r,e))}setTileLoadFunction(t){this.tileLoadFunction=t,this.changed()}setTileUrlFunction(t,e){this.tileUrlFunction=t,typeof e<"u"?this.setKey(e):this.changed()}setUrl(t){const e=Ep(t);this.urls=e,this.setUrls(e)}setUrls(t){this.urls=t;const e=t.join(`
|
|
8
|
+
`);this.generateTileUrlFunction_?this.setTileUrlFunction(wp(t,this.tileGrid),e):this.setKey(e)}tileUrlFunction(t,e,i){}}class Tp extends ma{constructor(t){super({attributions:t.attributions,cacheSize:t.cacheSize,projection:t.projection,state:t.state,tileGrid:t.tileGrid,tileLoadFunction:t.tileLoadFunction?t.tileLoadFunction:Hc,tilePixelRatio:t.tilePixelRatio,tileUrlFunction:t.tileUrlFunction,url:t.url,urls:t.urls,wrapX:t.wrapX,transition:t.transition,interpolate:t.interpolate!==void 0?t.interpolate:!0,key:t.key,attributionsCollapsible:t.attributionsCollapsible,zDirection:t.zDirection}),this.crossOrigin=t.crossOrigin!==void 0?t.crossOrigin:null,this.tileClass=t.tileClass!==void 0?t.tileClass:Fc,this.tileGridForProjection={},this.reprojectionErrorThreshold_=t.reprojectionErrorThreshold,this.renderReprojectionEdges_=!1}getGutterForProjection(t){return this.getProjection()&&t&&!er(this.getProjection(),t)?0:this.getGutter()}getGutter(){return 0}getKey(){let t=super.getKey();return this.getInterpolate()||(t+=":disable-interpolation"),t}getTileGridForProjection(t){const e=this.getProjection();if(this.tileGrid&&(!e||er(e,t)))return this.tileGrid;const i=V(t);return i in this.tileGridForProjection||(this.tileGridForProjection[i]=Vc(t)),this.tileGridForProjection[i]}createTile_(t,e,i,s,r,o){const a=[t,e,i],l=this.getTileCoordForTileUrlFunction(a,r),h=l?this.tileUrlFunction(l,s,r):void 0,c=new this.tileClass(a,h!==void 0?D.IDLE:D.EMPTY,h!==void 0?h:"",this.crossOrigin,this.tileLoadFunction,this.tileOptions);return c.key=o,c.addEventListener(z.CHANGE,this.handleTileChange.bind(this)),c}getTile(t,e,i,s,r,o){const a=this.getProjection();if(!a||!r||er(a,r))return this.getTileInternal(t,e,i,s,a||r);const l=[t,e,i],h=this.getKey(),c=this.getTileGridForProjection(a),u=this.getTileGridForProjection(r),d=this.getTileCoordForTileUrlFunction(l,r),f=new Zc(a,c,r,u,l,d,this.getTilePixelRatio(s),this.getGutter(),(g,m,_,p)=>this.getTileInternal(g,m,_,p,a,o),this.reprojectionErrorThreshold_,this.renderReprojectionEdges_,this.tileOptions);return f.key=h,f}getTileInternal(t,e,i,s,r,o){const a=this.getKey(),l=Lr(this,a,t,e,i);if(o&&o.containsKey(l))return o.get(l);const h=this.createTile_(t,e,i,s,r,a);return o?.set(l,h),h}setRenderReprojectionEdges(t){this.renderReprojectionEdges_!=t&&(this.renderReprojectionEdges_=t,this.changed())}setTileGridForProjection(t,e){const i=Ot(t);if(i){const s=V(i);s in this.tileGridForProjection||(this.tileGridForProjection[s]=e)}}}function Hc(n,t){if($t){const e=n.getCrossOrigin();let i="same-origin",s="same-origin";e==="anonymous"||e===""?(i="cors",s="omit"):e==="use-credentials"&&(i="cors",s="include"),fetch(t,{mode:i,credentials:s}).then(r=>{if(!r.ok)throw new Error(`HTTP ${r.status}`);return r.blob()}).then(r=>createImageBitmap(r)).then(r=>{const o=n.getImage();o.width=r.width,o.height=r.height,o.getContext("2d").drawImage(r,0,0),r.close?.(),o.dispatchEvent(new Event("load"))}).catch(()=>{n.getImage().dispatchEvent(new Event("error"))});return}n.getImage().src=t}class qc extends Tp{constructor(t){t=t||{};const e=t.projection!==void 0?t.projection:"EPSG:3857",i=t.tileGrid!==void 0?t.tileGrid:dp({extent:ga(e),maxResolution:t.maxResolution,maxZoom:t.maxZoom,minZoom:t.minZoom,tileSize:t.tileSize});super({attributions:t.attributions,cacheSize:t.cacheSize,crossOrigin:t.crossOrigin,interpolate:t.interpolate,projection:e,reprojectionErrorThreshold:t.reprojectionErrorThreshold,tileGrid:i,tileLoadFunction:t.tileLoadFunction,tilePixelRatio:t.tilePixelRatio,tileUrlFunction:t.tileUrlFunction,url:t.url,urls:t.urls,wrapX:t.wrapX!==void 0?t.wrapX:!0,transition:t.transition,attributionsCollapsible:t.attributionsCollapsible,zDirection:t.zDirection}),this.gutter_=t.gutter!==void 0?t.gutter:0}getGutter(){return this.gutter_}}const Ip='© <a href="https://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap</a> contributors.';class Sp extends qc{constructor(t){t=t||{};let e;t.attributions!==void 0?e=t.attributions:e=[Ip];const i=t.crossOrigin!==void 0?t.crossOrigin:"anonymous",s=t.url!==void 0?t.url:"https://tile.openstreetmap.org/{z}/{x}/{y}.png";super({attributions:e,attributionsCollapsible:!1,cacheSize:t.cacheSize,crossOrigin:i,interpolate:t.interpolate,maxZoom:t.maxZoom!==void 0?t.maxZoom:19,reprojectionErrorThreshold:t.reprojectionErrorThreshold,tileLoadFunction:(r,o)=>{const a=r.getImage();!$t&&a instanceof HTMLImageElement&&(a.referrerPolicy="origin-when-cross-origin"),(t.tileLoadFunction||Hc)(r,o)},transition:t.transition,url:s,wrapX:t.wrapX,zDirection:t.zDirection})}}function pa(n){return n instanceof Image||n instanceof HTMLCanvasElement||n instanceof HTMLVideoElement||n instanceof ImageBitmap?n:null}const bp=new Error("disposed"),Lp=[256,256];class Jc extends na{constructor(t){const e=D.IDLE;super(t.tileCoord,e,{transition:t.transition,interpolate:t.interpolate}),this.loader_=t.loader,this.data_=null,this.error_=null,this.size_=t.size||null,this.controller_=t.controller||null}getSize(){if(this.size_)return this.size_;const t=pa(this.data_);return t?[t.width,t.height]:Lp}getData(){return this.data_}getError(){return this.error_}load(){if(this.state!==D.IDLE&&this.state!==D.ERROR)return;this.state=D.LOADING,this.changed();const t=this;this.loader_().then(function(e){t.data_=e,t.state=D.LOADED,t.changed()}).catch(function(e){t.error_=e,t.state=D.ERROR,t.changed()})}disposeInternal(){this.controller_&&(this.controller_.abort(bp),this.controller_=null),super.disposeInternal()}}class Qc{constructor(t){this.highWaterMark=t!==void 0?t:2048,this.count_=0,this.entries_={},this.oldest_=null,this.newest_=null}deleteOldest(){const t=this.pop();t instanceof ks&&t.dispose()}canExpireCache(){return this.highWaterMark>0&&this.getCount()>this.highWaterMark}expireCache(t){for(;this.canExpireCache();)this.deleteOldest()}clear(){for(;this.oldest_;)this.deleteOldest()}containsKey(t){return this.entries_.hasOwnProperty(t)}forEach(t){let e=this.oldest_;for(;e;)t(e.value_,e.key_,this),e=e.newer}get(t,e){const i=this.entries_[t];return q(i!==void 0,"Tried to get a value for a key that does not exist in the cache"),i===this.newest_||(i===this.oldest_?(this.oldest_=this.oldest_.newer,this.oldest_.older=null):(i.newer.older=i.older,i.older.newer=i.newer),i.newer=null,i.older=this.newest_,this.newest_.newer=i,this.newest_=i),i.value_}remove(t){const e=this.entries_[t];return q(e!==void 0,"Tried to get a value for a key that does not exist in the cache"),e===this.newest_?(this.newest_=e.older,this.newest_&&(this.newest_.newer=null)):e===this.oldest_?(this.oldest_=e.newer,this.oldest_&&(this.oldest_.older=null)):(e.newer.older=e.older,e.older.newer=e.newer),delete this.entries_[t],--this.count_,e.value_}getCount(){return this.count_}getKeys(){const t=new Array(this.count_);let e=0,i;for(i=this.newest_;i;i=i.older)t[e++]=i.key_;return t}getValues(){const t=new Array(this.count_);let e=0,i;for(i=this.newest_;i;i=i.older)t[e++]=i.value_;return t}peekLast(){return this.oldest_.value_}peekLastKey(){return this.oldest_.key_}peekFirstKey(){return this.newest_.key_}peek(t){return this.entries_[t]?.value_}pop(){const t=this.oldest_;return delete this.entries_[t.key_],t.newer&&(t.newer.older=null),this.oldest_=t.newer,this.oldest_||(this.newest_=null),--this.count_,t.value_}replace(t,e){this.get(t),this.entries_[t].value_=e}set(t,e){q(!(t in this.entries_),"Tried to set a value for a key that is used already");const i={key_:t,newer:null,older:this.newest_,value_:e};this.newest_?this.newest_.newer=i:this.oldest_=i,this.newest_=i,this.entries_[t]=i,++this.count_}setSize(t){this.highWaterMark=t}}function ya(n,t,e){if(!(e in n))return n[e]=new Set([t]),!0;const i=n[e],s=i.has(t);return s||i.add(t),!s}function Ap(n,t,e){const i=n[e];return i?i.delete(t):!1}function tu(n,t){const e=n.layerStatesArray[n.layerIndex];e.extent&&(t=wi(t,ti(e.extent,n.viewState.projection)));const i=e.layer.getRenderSource();if(!i.getWrapX()){const s=i.getTileGridForProjection(n.viewState.projection).getExtent();s&&(t=wi(t,s))}return t}class Mp extends fc{constructor(t,e){super(t),e=e||{},this.extentChanged=!0,this.renderComplete=!1,this.renderedExtent_=null,this.renderedPixelRatio,this.renderedProjection=null,this.renderedTiles=[],this.renderedSourceKey_,this.renderedSourceRevision_,this.tempExtent=Yt(),this.tempTileRange_=new ua(0,0,0,0),this.tempTileCoord_=br(0,0,0);const i=e.cacheSize!==void 0?e.cacheSize:512;this.tileCache_=new Qc(i),this.sourceTileCache_=null,this.maxStaleKeys=i*.5}getTileCache(){return this.tileCache_}getSourceTileCache(){return this.sourceTileCache_||(this.sourceTileCache_=new Qc(512)),this.sourceTileCache_}getOrCreateTile(t,e,i,s){const r=this.tileCache_,a=this.getLayer().getSource(),l=Lr(a,a.getKey(),t,e,i);let h;if(r.containsKey(l))h=r.get(l);else{const c=s.viewState.projection,u=a.getProjection();if(h=a.getTile(t,e,i,s.pixelRatio,c,!u||er(u,c)?void 0:this.getSourceTileCache()),!h)return null;r.set(l,h)}return h}getTile(t,e,i,s){const r=this.getOrCreateTile(t,e,i,s);return r||null}getData(t){const e=this.frameState;if(!e)return null;const i=this.getLayer(),s=dt(e.pixelToCoordinateTransform,t.slice()),r=i.getExtent();if(r&&!Ki(r,s))return null;const o=e.viewState,a=i.getRenderSource(),l=a.getTileGridForProjection(o.projection),h=a.getTilePixelRatio(e.pixelRatio);for(let c=l.getZForResolution(o.resolution);c>=l.getMinZoom();--c){const u=l.getTileCoordForCoordAndZ(s,c),d=this.getTile(c,u[1],u[2],e);if(!d||d.getState()!==D.LOADED)continue;const f=l.getOrigin(c),g=Ft(l.getTileSize(c)),m=l.getResolution(c);let _;if(d instanceof Fc||d instanceof Zc)_=d.getImage();else if(d instanceof Jc){if(_=pa(d.getData()),!_)continue}else continue;const p=Math.floor(h*((s[0]-f[0])/m-u[1]*g[0])),y=Math.floor(h*((f[1]-s[1])/m-u[2]*g[1])),v=Math.round(h*a.getGutterForProjection(o.projection));return this.getImageData(_,p+v,y+v)}return null}prepareFrame(t){this.renderedProjection?t.viewState.projection!==this.renderedProjection&&(this.tileCache_.clear(),this.renderedProjection=t.viewState.projection):this.renderedProjection=t.viewState.projection;const e=this.getLayer().getSource();if(!e)return!1;const i=e.getRevision();return this.renderedSourceRevision_?this.renderedSourceRevision_!==i&&(this.renderedSourceRevision_=i,this.renderedSourceKey_===e.getKey()&&(this.tileCache_.clear(),this.sourceTileCache_?.clear())):this.renderedSourceRevision_=i,!0}enqueueTilesForNextExtent(){return!0}enqueueTiles(t,e,i,s,r){const o=t.viewState,a=this.getLayer(),l=a.getRenderSource(),h=l.getTileGridForProjection(o.projection),c=V(l);c in t.wantedTiles||(t.wantedTiles[c]={});const u=t.wantedTiles[c],d=a.getMapInternal(),f=Math.max(i-r,h.getMinZoom(),h.getZForResolution(Math.min(a.getMaxResolution(),d?d.getView().getResolutionForZoom(Math.max(a.getMinZoom(),0)):h.getResolution(0)),l.zDirection)),g=o.rotation,m=g?zl(o.center,o.resolution,g,t.size):void 0;for(let _=i;_>=f;--_){const p=h.getTileRangeForExtentAndZ(e,_,this.tempTileRange_),y=h.getResolution(_);for(let v=p.minX;v<=p.maxX;++v)for(let E=p.minY;E<=p.maxY;++E){if(g&&!h.tileCoordIntersectsViewport([_,v,E],m))continue;const x=this.getTile(_,v,E,t);if(!x||!ya(s,x,_))continue;const T=x.getKey();if(u[T]=!0,x.getState()===D.IDLE&&!t.tileQueue.isKeyQueued(T)){const R=br(_,v,E,this.tempTileCoord_);t.tileQueue.enqueue([x,c,h.getTileCoordCenter(R),y])}}}}findStaleTile_(t,e){const i=this.tileCache_,s=t[0],r=t[1],o=t[2],a=this.getStaleKeys();for(let l=0;l<a.length;++l){const h=Lr(this.getLayer().getSource(),a[l],s,r,o);if(i.containsKey(h)){const c=i.peek(h);if(c.getState()===D.LOADED)return c.endTransition(V(this)),ya(e,c,s),!0}}return!1}findAltTiles_(t,e,i,s){const r=t.getTileRangeForTileCoordAndZ(e,i,this.tempTileRange_);if(!r)return!1;let o=!0;const a=this.tileCache_,l=this.getLayer().getRenderSource(),h=l.getKey();for(let c=r.minX;c<=r.maxX;++c)for(let u=r.minY;u<=r.maxY;++u){const d=Lr(l,h,i,c,u);let f=!1;if(a.containsKey(d)){const g=a.peek(d);g.getState()===D.LOADED&&(ya(s,g,i),f=!0)}f||(o=!1)}return o}renderFrame(t,e){this.renderComplete=!0;const i=t.layerStatesArray[t.layerIndex],s=t.viewState,r=s.projection,o=s.resolution,a=s.center,l=t.pixelRatio,h=this.getLayer(),c=h.getSource(),u=c.getTileGridForProjection(r),d=u.getZForResolution(o,c.zDirection),f=u.getResolution(d),g=c.getKey();this.renderedSourceKey_?this.renderedSourceKey_!==g&&(this.prependStaleKey(this.renderedSourceKey_),this.renderedSourceKey_=g):this.renderedSourceKey_=g;let m=t.extent;const _=c.getTilePixelRatio(l);this.prepareContainer(t,e);const p=this.context.canvas.width,y=this.context.canvas.height,v=i.extent&&ti(i.extent);v&&(m=wi(m,ti(i.extent)));const E=f*p/2/_,x=f*y/2/_,w=[a[0]-E,a[1]-x,a[0]+E,a[1]+x],T={};this.renderedTiles.length=0;const R=h.getPreload();if(t.nextExtent&&this.enqueueTilesForNextExtent()){const F=u.getZForResolution(s.nextResolution,c.zDirection),$=tu(t,t.nextExtent);this.enqueueTiles(t,$,F,T,R)}const I=tu(t,m);if(this.enqueueTiles(t,I,d,T,0),R>0&&setTimeout(()=>{this.enqueueTiles(t,I,d-1,T,R-1)},0),!(d in T))return this.container;const L=V(this),P=t.time;for(const F of T[d]){const $=F.getState();if($===D.EMPTY)continue;const B=F.tileCoord;if($===D.LOADED&&F.getAlpha(L,P)===1){F.endTransition(L);continue}if($!==D.ERROR&&(this.renderComplete=!1),this.findStaleTile_(B,T)){Ap(T,F,d),t.animate=!0;continue}if(this.findAltTiles_(u,B,d+1,T))continue;const xt=u.getMinZoom();for(let bt=d-1;bt>=xt&&!this.findAltTiles_(u,B,bt,T);--bt);}const A=f/o*l/_,b=this.getRenderContext(t);Oe(this.tempTransform,p/2,y/2,A,A,0,-p/2,-y/2),i.extent&&this.clipUnrotated(b,t,v),c.getInterpolate()||(b.imageSmoothingEnabled=!1),this.preRender(b,t);const M=Object.keys(T).map(Number);M.sort(Ae);let Y;const k=[],G=[];for(let F=M.length-1;F>=0;--F){const $=M[F],B=c.getTilePixelSize($,l,r),S=u.getResolution($)/f,xt=B[0]*S*A,bt=B[1]*S*A,lt=u.getTileCoordForCoordAndZ(vi(w),$),Kt=u.getTileCoordExtent(lt),wt=dt(this.tempTransform,[_*(Kt[0]-w[0])/f,_*(w[3]-Kt[3])/f]),we=_*c.getGutterForProjection(r);for(const _e of T[$]){if(_e.getState()!==D.LOADED)continue;const Bt=_e.tileCoord,Mr=lt[1]-Bt[1],Ea=Math.round(wt[0]-(Mr-1)*xt),fs=lt[2]-Bt[2],Di=Math.round(wt[1]-(fs-1)*bt),ie=Math.round(wt[0]-Mr*xt),ve=Math.round(wt[1]-fs*bt),En=Ea-ie,xn=Di-ve,gs=M.length===1;let Fi=!1;Y=[ie,ve,ie+En,ve,ie+En,ve+xn,ie,ve+xn];for(let wn=0,vn=k.length;wn<vn;++wn)if(!gs&&$<G[wn]){const ft=k[wn];Pt([ie,ve,ie+En,ve+xn],[ft[0],ft[3],ft[4],ft[7]])&&(Fi||(b.save(),Fi=!0),b.beginPath(),b.moveTo(Y[0],Y[1]),b.lineTo(Y[2],Y[3]),b.lineTo(Y[4],Y[5]),b.lineTo(Y[6],Y[7]),b.moveTo(ft[6],ft[7]),b.lineTo(ft[4],ft[5]),b.lineTo(ft[2],ft[3]),b.lineTo(ft[0],ft[1]),b.clip())}k.push(Y),G.push($),this.drawTile(_e,t,ie,ve,En,xn,we,gs),Fi&&b.restore(),this.renderedTiles.unshift(_e),this.updateUsedTiles(t.usedTiles,c,_e)}}if(this.renderedResolution=f,this.extentChanged=!this.renderedExtent_||!Gn(this.renderedExtent_,w),this.renderedExtent_=w,this.renderedPixelRatio=l,this.postRender(this.context,t),i.extent&&b.restore(),b.imageSmoothingEnabled=!0,this.renderComplete){const F=($,B)=>{const et=V(c),S=B.wantedTiles[et],xt=S?Object.keys(S).length:0;this.updateCacheSize(xt),this.tileCache_.expireCache(),this.sourceTileCache_?.expireCache()};t.postRenderFunctions.push(F)}return this.container}updateCacheSize(t){this.tileCache_.highWaterMark=Math.max(this.tileCache_.highWaterMark,t*2)}drawTile(t,e,i,s,r,o,a,l){let h;if(t instanceof Jc){if(h=pa(t.getData()),!h)throw new Error("Rendering array data is not yet supported")}else h=this.getTileImage(t);if(!h)return;const c=this.getRenderContext(e),u=V(this),d=e.layerStatesArray[e.layerIndex],f=d.opacity*(l?t.getAlpha(u,e.time):1),g=f!==c.globalAlpha;g&&(c.save(),c.globalAlpha=f),c.drawImage(h,a,a,h.width-2*a,h.height-2*a,i,s,r,o),g&&c.restore(),f!==d.opacity?e.animate=!0:l&&t.endTransition(u)}getImage(){const t=this.context;return t?t.canvas:null}getTileImage(t){return t.getImage()}updateUsedTiles(t,e,i){const s=V(e);s in t||(t[s]={}),t[s][i.getKey()]=!0}}const Ar={PRELOAD:"preload",USE_INTERIM_TILES_ON_ERROR:"useInterimTilesOnError"};class Pp extends Ir{constructor(t){t=t||{};const e=Object.assign({},t),i=t.cacheSize;delete t.cacheSize,delete e.preload,delete e.useInterimTilesOnError,super(e),this.on,this.once,this.un,this.cacheSize_=i,this.setPreload(t.preload!==void 0?t.preload:0),this.setUseInterimTilesOnError(t.useInterimTilesOnError!==void 0?t.useInterimTilesOnError:!0)}getCacheSize(){return this.cacheSize_}getPreload(){return this.get(Ar.PRELOAD)}setPreload(t){this.set(Ar.PRELOAD,t)}getUseInterimTilesOnError(){return this.get(Ar.USE_INTERIM_TILES_ON_ERROR)}setUseInterimTilesOnError(t){this.set(Ar.USE_INTERIM_TILES_ON_ERROR,t)}getData(t){return super.getData(t)}}class eu extends Pp{constructor(t){super(t)}createRenderer(){return new Mp(this,{cacheSize:this.getCacheSize()})}}const iu=`
|
|
9
9
|
.ol-box {
|
|
10
10
|
box-sizing: border-box;
|
|
11
11
|
border-radius: 2px;
|
|
@@ -327,5 +327,5 @@
|
|
|
327
327
|
content: "✖";
|
|
328
328
|
}
|
|
329
329
|
|
|
330
|
-
`;function
|
|
330
|
+
`;function Op(n,t=100,e={}){if(typeof n!="function")throw new TypeError(`Expected the first parameter to be a function, got \`${typeof n}\`.`);if(t<0)throw new RangeError("`wait` must not be negative.");if(typeof e=="boolean")throw new TypeError("The `options` parameter must be an object, not a boolean. Use `{immediate: true}` instead.");const{immediate:i}=e;let s,r,o,a,l;function h(){const d=s,f=r;return s=void 0,r=void 0,l=n.apply(d,f),l}function c(){const d=Date.now()-a;d<t&&d>=0?o=setTimeout(c,t-d):(o=void 0,i||(l=h()))}const u=function(...d){if(s&&this!==s&&Object.getPrototypeOf(this)===Object.getPrototypeOf(s))throw new Error("Debounced method called with different contexts of the same prototype.");s=this,r=d,a=Date.now();const f=i&&!o;if(o||(o=setTimeout(c,t)),f)return l=h(),l};return Object.defineProperty(u,"isPending",{get(){return o!==void 0}}),u.clear=()=>{o&&(clearTimeout(o),o=void 0,s=void 0,r=void 0)},u.flush=()=>{o&&u.trigger()},u.trigger=()=>{l=h(),u.clear()},u}var Dp=wd('<div id="map" style="width: 100%; height: 100%;"></div> <div id="popup" class="ol-popup"><button id="popup-closer" class="ol-popup-closer" aria-label="Close popup"></button> <div id="popup-content"></div></div>',1);const Fp={hash:"svelte-1nwnfh0",code:":host {display:block;height:200px;width:200px;}"};function nu(n,t){Ya(t,!0),Sd(n,Fp);function e(w,T){t.$$host.dispatchEvent(new CustomEvent(w,{detail:T}))}let i=Ut(null),s=Ut(null),r=Ut(void 0),o=Ut(null),a,l=Wi(t,"id",7,""),h=Wi(t,"center",23,()=>[37.5176038,15.0819224]),c=Wi(t,"zoom",7,6),u=Wi(t,"source",23,()=>({type:"osm"})),d=Wi(t,"options",23,()=>({})),f=Wi(t,"data",23,()=>[]);rl(()=>{let w=!1;typeof u()=="string"&&(u(JSON.parse(u())),w=!0),d()&&typeof d()=="string"&&(d(JSON.parse(d())),w=!0),typeof c()=="string"&&(c(Number(c())),w=!0),typeof h()=="string"&&(h(JSON.parse(h())),w=!0),typeof f()=="string"&&(f(JSON.parse(f())),w=!0),w&&m()});function g(w){const T=Yn(w.coordinate,"EPSG:3857","EPSG:4326"),R=it(i)?.getView?.()?.getCenter?.(),I=Yn(R||h(),"EPSG:3857","EPSG:4326"),L=it(i)?.getView?.()?.getZoom?.()||c(),P=it(i)?.forEachFeatureAtPixel(w.pixel,function(A,b){return A});P&&P.get("marker")?(e("markerClick",{coordinates:{latitude:T[1],longitude:T[0]},id:P.get("id")}),P.get("popupHtml")&&it(o)?.innerHTML&&(it(o).innerHTML=P.get("popupHtml"),a?.setPosition(w.coordinate))):(a?.setPosition(void 0),e("pointClickCoordinates",{coordinates:{latitude:T[1],longitude:T[0]},zoom:L,center:I}))}function m(){if(it(s)){if(it(i)){At(i,null);const I=document.createElement("style");I.innerHTML=iu,it(s).innerHTML="",it(s).appendChild(I)}const w=[];u().type.toLowerCase()==="osm"?w.push(new eu({source:new Sp})):u().type.toLowerCase()==="xyz"&&u().url&&w.push(new eu({source:new qc({url:u().url})}));let T=[],R=Yt();if(f()?.filter?.(I=>I.marker)?.length){const I=[];for(const A of f().filter(b=>b.marker).map(b=>b.marker)){const b=new qr({geometry:A?.lngLat?new sr(mo(A.lngLat)):void 0,icon:A?.icon,marker:!0,id:A?.id||void 0,popupHtml:A?.popupHtml});I.push(b);const M=b.getGeometry()?.getCoordinates();A?.lngLat&&T.push(A.lngLat),d().centerFromGeometries&&M&&M[2]!==-1/0&&M[3]!==-1/0&&(console.log("coords",M),R=kl(R,M))}const L=new ke({image:new ln({scale:3,anchor:[.5,.8],src:"https://upload.wikimedia.org/wikipedia/commons/e/e7/Maki2-marker-18.svg"})}),P=new mm({source:new Vg({features:I}),style(A){const b=A.get("icon");let M;return b?.uri?(M=new ke({image:new ln({scale:b.scale||.15,anchor:b.anchor||[.5,.8],src:b.uri,opacity:b.opacity||1,color:b.color||void 0})}),M):L}});w.push(P)}a=new Qm({element:it(r),autoPan:{animation:{duration:250}}}),At(i,new qm({target:it(s),layers:w,overlays:[a],view:new xe({center:mo(h()),zoom:c()})}),!0),d()?.centerFromGeometries&&T&&T.length>1&&R[2]!==-1/0&&R[3]!==-1/0?(console.log("extent",R),it(i).getView().fit(R,{padding:[25,25,25,25]})):d()?.centerFromGeometries&&it(i).getView().setCenter(mo(T[0])),it(i).on("singleclick",function(I){g(I)})}}function _(w){a?.setPosition(void 0),w?.target?.blur?.()}Id(()=>{At(s,t.$$host?.shadowRoot?.querySelector("#map"),!0),At(r,t.$$host?.shadowRoot?.querySelector("#popup"),!0),At(o,t.$$host?.shadowRoot?.querySelector("#popup-content"),!0);const w=document.createElement("style");w.innerHTML=iu,it(s)?.appendChild(w),m()});var p={get id(){return l()},set id(w=""){l(w),_i()},get center(){return h()},set center(w=[37.5176038,15.0819224]){h(w),_i()},get zoom(){return c()},set zoom(w=6){c(w),_i()},get source(){return u()},set source(w={type:"osm"}){u(w),_i()},get options(){return d()},set options(w={}){d(w),_i()},get data(){return f()},set data(w=[]){f(w),_i()}},y=Dp(),v=Vu(()=>Op(m,200));yd("resize",Yr,function(...w){it(v)?.apply(this,w)});var E=ed(td(y),2),x=Qu(E);return x.__click=w=>_(w),za(2),Gu(E),Rl(n,y),$a(p)}Ed(["click"]),customElements.define("hb-map",Pd(nu,{id:{},center:{},zoom:{},source:{},options:{},data:{}},[],[],!0)),Ta.Component=nu,Object.defineProperty(Ta,Symbol.toStringTag,{value:"Module"})})(this.map=this.map||{});
|
|
331
331
|
//# sourceMappingURL=main.iife.js.map
|