@htmlbricks/hb-map 0.66.6 → 0.66.7
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 +10 -10
- package/main.iife.js.map +1 -1
- package/manifest.json +2 -2
- package/package.json +1 -1
package/main.iife.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
(function(Tl){"use strict";typeof window<"u"&&((window.__svelte??={}).v??=new Set).add("5");const pd=1,yd=4,xd=8,Ed=16,wd=2,Sl="[",Il="[!",bl="[?",Pl="]",Wn={},It=Symbol(),vd="http://www.w3.org/1999/xhtml",Cd=!1;var Rd=Array.isArray,Td=Array.prototype.indexOf,rn=Array.prototype.includes,Sd=Array.from,Xs=Object.keys,Ys=Object.defineProperty,Pi=Object.getOwnPropertyDescriptor,Id=Object.prototype,bd=Array.prototype,Pd=Object.getPrototypeOf,Ll=Object.isExtensible;const Ld=()=>{};function Ad(n){for(var t=0;t<n.length;t++)n[t]()}function Md(){var n,t,e=new Promise((i,s)=>{n=i,t=s});return{promise:e,resolve:n,reject:t}}const wt=2,on=4,lo=8,Al=1<<24,Je=16,Oe=32,Qe=64,ho=128,Jt=512,vt=1024,Ft=2048,ve=4096,ti=8192,ei=16384,Li=32768,Ml=1<<25,Ws=65536,Ol=1<<17,Od=1<<18,an=1<<19,Fd=1<<20,Ai=65536,co=1<<21,Fl=1<<22,Vn=1<<23,Vs=Symbol("$state"),Dl=Symbol("legacy props"),uo=new class extends Error{name="StaleReactionError";message="The reaction that called `getAbortSignal()` was re-run or destroyed"},fo=3,go=8;function Dd(n){throw new Error("https://svelte.dev/e/lifecycle_outside_component")}function kd(n){throw new Error("https://svelte.dev/e/effect_in_teardown")}function Nd(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function Gd(n){throw new Error("https://svelte.dev/e/effect_orphan")}function zd(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function Xd(){throw new Error("https://svelte.dev/e/hydration_failed")}function Yd(n){throw new Error("https://svelte.dev/e/props_invalid_value")}function Wd(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function Vd(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function $d(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}function Bd(){throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror")}function _o(n){console.warn("https://svelte.dev/e/hydration_mismatch")}function Kd(){console.warn("https://svelte.dev/e/svelte_boundary_reset_noop")}let bt=!1;function $s(n){bt=n}let ot;function Fe(n){if(n===null)throw _o(),Wn;return ot=n}function kl(){return Fe(ke(ot))}function jd(n){if(bt){if(ke(ot)!==null)throw _o(),Wn;ot=n}}function Nl(n=1){if(bt){for(var t=n,e=ot;t--;)e=ke(e);ot=e}}function Ud(n=!0){for(var t=0,e=ot;;){if(e.nodeType===go){var i=e.data;if(i===Pl){if(t===0)return e;t-=1}else(i===Sl||i===Il||i[0]==="["&&!isNaN(Number(i.slice(1))))&&(t+=1)}var s=ke(e);n&&e.remove(),e=s}}function Gl(n){return n===this.v}function Zd(n,t){return n!=n?t==t:n!==t||n!==null&&typeof n=="object"||typeof n=="function"}function zl(n){return!Zd(n,this.v)}let Hd=!1,Qt=null;function Bs(n){Qt=n}function Xl(n,t=!1,e){Qt={p:Qt,i:!1,c:null,e:null,s:n,x:null,r:it,l:null}}function Yl(n){var t=Qt,e=t.e;if(e!==null){t.e=null;for(var i of e)lh(i)}return n!==void 0&&(t.x=n),t.i=!0,Qt=t.p,n??{}}function Wl(){return!0}let Mi=[];function Vl(){var n=Mi;Mi=[],Ad(n)}function Oi(n){if(Mi.length===0&&!$n){var t=Mi;queueMicrotask(()=>{t===Mi&&Vl()})}Mi.push(n)}function qd(){for(;Mi.length>0;)Vl()}function $l(n){var t=it;if(t===null)return Z.f|=Vn,n;if((t.f&Li)===0&&(t.f&on)===0)throw n;ln(n,t)}function ln(n,t){for(;t!==null;){if((t.f&ho)!==0){if((t.f&Li)===0)throw n;try{t.b.error(n);return}catch(e){n=e}}t=t.parent}throw n}const Jd=-7169;function _t(n,t){n.f=n.f&Jd|t}function mo(n){(n.f&Jt)!==0||n.deps===null?_t(n,vt):_t(n,ve)}function Bl(n){if(n!==null)for(const t of n)(t.f&wt)===0||(t.f&Ai)===0||(t.f^=Ai,Bl(t.deps))}function Kl(n,t,e){(n.f&Ft)!==0?t.add(n):(n.f&ve)!==0&&e.add(n),Bl(n.deps),_t(n,vt)}let Ks=!1;function Qd(n){var t=Ks;try{return Ks=!1,[n(),Ks]}finally{Ks=t}}const ii=new Set;let ft=null,fe=null,po=null,$n=!1,yo=!1,hn=null,js=null;var jl=0;let tf=1;class ni{id=tf++;current=new Map;previous=new Map;#t=new Set;#i=new Set;#r=new Map;#l=new Map;#o=null;#e=[];#n=new Set;#s=new Set;#a=new Map;is_fork=!1;#u=!1;#h=new Set;#d(){return this.is_fork||this.#l.size>0}#g(){for(const i of this.#h)for(const s of i.#l.keys()){for(var t=!1,e=s;e.parent!==null;){if(this.#a.has(e)){t=!0;break}e=e.parent}if(!t)return!0}return!1}skip_effect(t){this.#a.has(t)||this.#a.set(t,{d:[],m:[]})}unskip_effect(t){var e=this.#a.get(t);if(e){this.#a.delete(t);for(var i of e.d)_t(i,Ft),this.schedule(i);for(i of e.m)_t(i,ve),this.schedule(i)}}#f(){if(jl++>1e3&&(ii.delete(this),ef()),!this.#d()){for(const a of this.#n)this.#s.delete(a),_t(a,Ft),this.schedule(a);for(const a of this.#s)_t(a,ve),this.schedule(a)}const t=this.#e;this.#e=[],this.apply();var e=hn=[],i=[],s=js=[];for(const a of t)try{this.#c(a,e,i)}catch(l){throw Jl(a),l}if(ft=null,s.length>0){var r=ni.ensure();for(const a of s)r.schedule(a)}if(hn=null,js=null,this.#d()||this.#g()){this.#_(i),this.#_(e);for(const[a,l]of this.#a)ql(a,l)}else{this.#r.size===0&&ii.delete(this),this.#n.clear(),this.#s.clear();for(const a of this.#t)a(this);this.#t.clear(),Ul(i),Ul(e),this.#o?.resolve()}var o=ft;if(this.#e.length>0){const a=o??=this;a.#e.push(...this.#e.filter(l=>!a.#e.includes(l)))}o!==null&&(ii.add(o),o.#f()),ii.has(this)||this.#m()}#c(t,e,i){t.f^=vt;for(var s=t.first;s!==null;){var r=s.f,o=(r&(Oe|Qe))!==0,a=o&&(r&vt)!==0,l=a||(r&ti)!==0||this.#a.has(s);if(!l&&s.fn!==null){o?s.f^=vt:(r&on)!==0?e.push(s):Un(s)&&((r&Je)!==0&&this.#s.add(s),un(s));var h=s.first;if(h!==null){s=h;continue}}for(;s!==null;){var c=s.next;if(c!==null){s=c;break}s=s.parent}}}#_(t){for(var e=0;e<t.length;e+=1)Kl(t[e],this.#n,this.#s)}capture(t,e,i=!1){e!==It&&!this.previous.has(t)&&this.previous.set(t,e),(t.f&Vn)===0&&(this.current.set(t,[t.v,i]),fe?.set(t,t.v))}activate(){ft=this}deactivate(){ft=null,fe=null}flush(){try{yo=!0,ft=this,this.#f()}finally{jl=0,po=null,hn=null,js=null,yo=!1,ft=null,fe=null,ri.clear()}}discard(){for(const t of this.#i)t(this);this.#i.clear(),ii.delete(this)}#m(){for(const h of ii){var t=h.id<this.id,e=[];for(const[c,[u,d]]of this.current){if(h.current.has(c)){var i=h.current.get(c)[0];if(t&&u!==i)h.current.set(c,[u,d]);else continue}e.push(c)}var s=[...h.current.keys()].filter(c=>!this.current.has(c));if(s.length===0)t&&h.discard();else if(e.length>0){h.activate();var r=new Set,o=new Map;for(var a of e)Zl(a,s,r,o);if(h.#e.length>0){h.apply();for(var l of h.#e)h.#c(l,[],[]);h.#e=[]}h.deactivate()}}for(const h of ii)h.#h.has(this)&&(h.#h.delete(this),h.#h.size===0&&!h.#d()&&(h.activate(),h.#f()))}increment(t,e){let i=this.#r.get(e)??0;if(this.#r.set(e,i+1),t){let s=this.#l.get(e)??0;this.#l.set(e,s+1)}}decrement(t,e,i){let s=this.#r.get(e)??0;if(s===1?this.#r.delete(e):this.#r.set(e,s-1),t){let r=this.#l.get(e)??0;r===1?this.#l.delete(e):this.#l.set(e,r-1)}this.#u||i||(this.#u=!0,Oi(()=>{this.#u=!1,this.flush()}))}transfer_effects(t,e){for(const i of t)this.#n.add(i);for(const i of e)this.#s.add(i);t.clear(),e.clear()}oncommit(t){this.#t.add(t)}ondiscard(t){this.#i.add(t)}settled(){return(this.#o??=Md()).promise}static ensure(){if(ft===null){const t=ft=new ni;yo||(ii.add(ft),$n||Oi(()=>{ft===t&&t.flush()}))}return ft}apply(){{fe=null;return}}schedule(t){if(po=t,t.b?.is_pending&&(t.f&(on|lo|Al))!==0&&(t.f&Li)===0){t.b.defer_effect(t);return}for(var e=t;e.parent!==null;){e=e.parent;var i=e.f;if(hn!==null&&e===it&&(Z===null||(Z.f&wt)===0))return;if((i&(Qe|Oe))!==0){if((i&vt)===0)return;e.f^=vt}}this.#e.push(e)}}function si(n){var t=$n;$n=!0;try{for(var e;;){if(qd(),ft===null)return e;ft.flush()}}finally{$n=t}}function ef(){try{zd()}catch(n){ln(n,po)}}let De=null;function Ul(n){var t=n.length;if(t!==0){for(var e=0;e<t;){var i=n[e++];if((i.f&(ei|ti))===0&&Un(i)&&(De=new Set,un(i),i.deps===null&&i.first===null&&i.nodes===null&&i.teardown===null&&i.ac===null&&uh(i),De?.size>0)){ri.clear();for(const s of De){if((s.f&(ei|ti))!==0)continue;const r=[s];let o=s.parent;for(;o!==null;)De.has(o)&&(De.delete(o),r.push(o)),o=o.parent;for(let a=r.length-1;a>=0;a--){const l=r[a];(l.f&(ei|ti))===0&&un(l)}}De.clear()}}De=null}}function Zl(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&wt)!==0?Zl(s,t,e,i):(r&(Fl|Je))!==0&&(r&Ft)===0&&Hl(s,t,i)&&(_t(s,Ft),xo(s))}}function Hl(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(rn.call(t,s))return!0;if((s.f&wt)!==0&&Hl(s,t,e))return e.set(s,!0),!0}return e.set(n,!1),!1}function xo(n){ft.schedule(n)}function ql(n,t){if(!((n.f&Oe)!==0&&(n.f&vt)!==0)){(n.f&Ft)!==0?t.d.push(n):(n.f&ve)!==0&&t.m.push(n),_t(n,vt);for(var e=n.first;e!==null;)ql(e,t),e=e.next}}function Jl(n){_t(n,vt);for(var t=n.first;t!==null;)Jl(t),t=t.next}function nf(n){let t=0,e=Us(0),i;return()=>{Io()&&(H(e),hh(()=>(t===0&&(i=Lo(()=>n(()=>Bn(e)))),t+=1,()=>{Oi(()=>{t-=1,t===0&&(i?.(),i=void 0,Bn(e))})})))}}var sf=Ws|an;function rf(n,t,e,i){new of(n,t,e,i)}class of{parent;is_pending=!1;transform_error;#t;#i=bt?ot:null;#r;#l;#o;#e=null;#n=null;#s=null;#a=null;#u=0;#h=0;#d=!1;#g=new Set;#f=new Set;#c=null;#_=nf(()=>(this.#c=Us(this.#u),()=>{this.#c=null}));constructor(t,e,i,s){this.#t=t,this.#r=e,this.#l=r=>{var o=it;o.b=this,o.f|=ho,i(r)},this.parent=it.b,this.transform_error=s??this.parent?.transform_error??(r=>r),this.#o=Rf(()=>{if(bt){const r=this.#i;kl();const o=r.data===Il;if(r.data.startsWith(bl)){const l=JSON.parse(r.data.slice(bl.length));this.#w(l)}else o?this.#v():this.#m()}else this.#x()},sf),bt&&(this.#t=ot)}#m(){try{this.#e=Fi(()=>this.#l(this.#t))}catch(t){this.error(t)}}#w(t){const e=this.#r.failed;e&&(this.#s=Fi(()=>{e(this.#t,()=>t,()=>()=>{})}))}#v(){const t=this.#r.pending;t&&(this.is_pending=!0,this.#n=Fi(()=>t(this.#t)),Oi(()=>{var e=this.#a=document.createDocumentFragment(),i=Kn();e.append(i),this.#e=this.#y(()=>Fi(()=>this.#l(i))),this.#h===0&&(this.#t.before(e),this.#a=null,Zs(this.#n,()=>{this.#n=null}),this.#p(ft))}))}#x(){try{if(this.is_pending=this.has_pending_snippet(),this.#h=0,this.#u=0,this.#e=Fi(()=>{this.#l(this.#t)}),this.#h>0){var t=this.#a=document.createDocumentFragment();If(this.#e,t);const e=this.#r.pending;this.#n=Fi(()=>e(this.#t))}else this.#p(ft)}catch(e){this.error(e)}}#p(t){this.is_pending=!1,t.transfer_effects(this.#g,this.#f)}defer_effect(t){Kl(t,this.#g,this.#f)}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!this.#r.pending}#y(t){var e=it,i=Z,s=Qt;li(this.#o),Ce(this.#o),Bs(this.#o.ctx);try{return ni.ensure(),t()}catch(r){return $l(r),null}finally{li(e),Ce(i),Bs(s)}}#E(t,e){if(!this.has_pending_snippet()){this.parent&&this.parent.#E(t,e);return}this.#h+=t,this.#h===0&&(this.#p(e),this.#n&&Zs(this.#n,()=>{this.#n=null}),this.#a&&(this.#t.before(this.#a),this.#a=null))}update_pending_count(t,e){this.#E(t,e),this.#u+=t,!(!this.#c||this.#d)&&(this.#d=!0,Oi(()=>{this.#d=!1,this.#c&&ih(this.#c,this.#u)}))}get_effect_pending(){return this.#_(),H(this.#c)}error(t){var e=this.#r.onerror;let i=this.#r.failed;if(!e&&!i)throw t;this.#e&&(ge(this.#e),this.#e=null),this.#n&&(ge(this.#n),this.#n=null),this.#s&&(ge(this.#s),this.#s=null),bt&&(Fe(this.#i),Nl(),Fe(Ud()));var s=!1,r=!1;const o=()=>{if(s){Kd();return}s=!0,r&&Bd(),this.#s!==null&&Zs(this.#s,()=>{this.#s=null}),this.#y(()=>{this.#x()})},a=l=>{try{r=!0,e?.(l,o),r=!1}catch(h){ln(h,this.#o&&this.#o.parent)}i&&(this.#s=this.#y(()=>{try{return Fi(()=>{var h=it;h.b=this,h.f|=ho,i(this.#t,()=>l,()=>o)})}catch(h){return ln(h,this.#o.parent),null}}))};Oi(()=>{var l;try{l=this.transform_error(t)}catch(h){ln(h,this.#o&&this.#o.parent);return}l!==null&&typeof l=="object"&&typeof l.then=="function"?l.then(a,h=>ln(h,this.#o&&this.#o.parent)):a(l)})}}function Eo(n){var t=wt|Ft,e=Z!==null&&(Z.f&wt)!==0?Z:null;return it!==null&&(it.f|=an),{ctx:Qt,deps:null,effects:null,equals:Gl,f:t,fn:n,reactions:null,rv:0,v:It,wv:0,parent:e??it,ac:null}}function af(n){const t=Eo(n);return gh(t),t}function lf(n){const t=Eo(n);return t.equals=zl,t}function hf(n){var t=n.effects;if(t!==null){n.effects=null;for(var e=0;e<t.length;e+=1)ge(t[e])}}function cf(n){for(var t=n.parent;t!==null;){if((t.f&wt)===0)return(t.f&ei)===0?t:null;t=t.parent}return null}function wo(n){var t,e=it;li(cf(n));try{n.f&=~Ai,hf(n),t=xh(n)}finally{li(e)}return t}function Ql(n){var t=n.v,e=wo(n);if(!n.equals(e)&&(n.wv=ph(),(!ft?.is_fork||n.deps===null)&&(n.v=e,ft?.capture(n,t,!0),n.deps===null))){_t(n,vt);return}ai||(fe!==null?(Io()||ft?.is_fork)&&fe.set(n,e):mo(n))}function uf(n){if(n.effects!==null)for(const t of n.effects)(t.teardown||t.ac)&&(t.teardown?.(),t.ac?.abort(uo),t.teardown=Ld,t.ac=null,Zn(t,0),Po(t))}function th(n){if(n.effects!==null)for(const t of n.effects)t.teardown&&un(t)}let vo=new Set;const ri=new Map;let eh=!1;function Us(n,t){var e={f:0,v:n,reactions:null,equals:Gl,rv:0,wv:0};return e}function te(n,t){const e=Us(n);return gh(e),e}function df(n,t=!1,e=!0){const i=Us(n);return t||(i.equals=zl),i}function zt(n,t,e=!1){Z!==null&&(!_e||(Z.f&Ol)!==0)&&Wl()&&(Z.f&(wt|Je|Fl|Ol))!==0&&(ee===null||!rn.call(ee,n))&&$d();let i=e?cn(t):t;return ih(n,i,js)}function ih(n,t,e=null){if(!n.equals(t)){var i=n.v;ai?ri.set(n,t):ri.set(n,i),n.v=t;var s=ni.ensure();if(s.capture(n,i),(n.f&wt)!==0){const r=n;(n.f&Ft)!==0&&wo(r),fe===null&&mo(r)}n.wv=ph(),nh(n,Ft,e),it!==null&&(it.f&vt)!==0&&(it.f&(Oe|Qe))===0&&(ie===null?bf([n]):ie.push(n)),!s.is_fork&&vo.size>0&&!eh&&ff()}return t}function ff(){eh=!1;for(const n of vo)(n.f&vt)!==0&&_t(n,ve),Un(n)&&un(n);vo.clear()}function Bn(n){zt(n,n.v+1)}function nh(n,t,e){var i=n.reactions;if(i!==null)for(var s=i.length,r=0;r<s;r++){var o=i[r],a=o.f,l=(a&Ft)===0;if(l&&_t(o,t),(a&wt)!==0){var h=o;fe?.delete(h),(a&Ai)===0&&(a&Jt&&(o.f|=Ai),nh(h,ve,e))}else if(l){var c=o;(a&Je)!==0&&De!==null&&De.add(c),e!==null?e.push(c):xo(c)}}}function cn(n){if(typeof n!="object"||n===null||Vs in n)return n;const t=Pd(n);if(t!==Id&&t!==bd)return n;var e=new Map,i=Rd(n),s=te(0),r=ki,o=a=>{if(ki===r)return a();var l=Z,h=ki;Ce(null),mh(r);var c=a();return Ce(l),mh(h),c};return i&&e.set("length",te(n.length)),new Proxy(n,{defineProperty(a,l,h){(!("value"in h)||h.configurable===!1||h.enumerable===!1||h.writable===!1)&&Wd();var c=e.get(l);return c===void 0?o(()=>{var u=te(h.value);return e.set(l,u),u}):zt(c,h.value,!0),!0},deleteProperty(a,l){var h=e.get(l);if(h===void 0){if(l in a){const c=o(()=>te(It));e.set(l,c),Bn(s)}}else zt(h,It),Bn(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||Pi(a,l)?.writable)&&(c=o(()=>{var f=cn(u?a[l]:It),g=te(f);return g}),e.set(l,c)),c!==void 0){var d=H(c);return d===It?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=H(c))}else if(h===void 0){var u=e.get(l),d=u?.v;if(u!==void 0&&d!==It)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!==It||Reflect.has(a,l);if(h!==void 0||it!==null&&(!c||Pi(a,l)?.writable)){h===void 0&&(h=o(()=>{var d=c?cn(a[l]):It,f=te(d);return f}),e.set(l,h));var u=H(h);if(u===It)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?zt(g,It):f in a&&(g=o(()=>te(It)),e.set(f+"",g))}if(u===void 0)(!d||Pi(a,l)?.writable)&&(u=o(()=>te(void 0)),zt(u,cn(h)),e.set(l,u));else{d=u.v!==It;var _=o(()=>cn(h));zt(u,_)}var m=Reflect.getOwnPropertyDescriptor(a,l);if(m?.set&&m.set.call(c,h),!d){if(i&&typeof l=="string"){var p=e.get("length"),y=Number(l);Number.isInteger(y)&&y>=p.v&&zt(p,y+1)}Bn(s)}return!0},ownKeys(a){H(s);var l=Reflect.ownKeys(a).filter(u=>{var d=e.get(u);return d===void 0||d.v!==It});for(var[h,c]of e)c.v!==It&&!(h in a)&&l.push(h);return l},setPrototypeOf(){Vd()}})}var Co,sh,rh,oh;function Ro(){if(Co===void 0){Co=window,sh=/Firefox/.test(navigator.userAgent);var n=Element.prototype,t=Node.prototype,e=Text.prototype;rh=Pi(t,"firstChild").get,oh=Pi(t,"nextSibling").get,Ll(n)&&(n.__click=void 0,n.__className=void 0,n.__attributes=null,n.__style=void 0,n.__e=void 0),Ll(e)&&(e.__t=void 0)}}function Kn(n=""){return document.createTextNode(n)}function jn(n){return rh.call(n)}function ke(n){return oh.call(n)}function gf(n,t){if(!bt)return jn(n);var e=jn(ot);return e===null&&(e=ot.appendChild(Kn())),Fe(e),e}function _f(n,t=!1){if(!bt){var e=jn(n);return e instanceof Comment&&e.data===""?ke(e):e}if(t){if(ot?.nodeType!==fo){var i=Kn();return ot?.before(i),Fe(i),i}ah(ot)}return ot}function mf(n,t=1,e=!1){let i=bt?ot:n;for(var s;t--;)s=i,i=ke(i);if(!bt)return i;if(e){if(i?.nodeType!==fo){var r=Kn();return i===null?s?.after(r):i.before(r),Fe(r),r}ah(i)}return Fe(i),i}function pf(n){n.textContent=""}function To(n,t,e){return document.createElementNS(vd,n,void 0)}function ah(n){if(n.nodeValue.length<65536)return;let t=n.nextSibling;for(;t!==null&&t.nodeType===fo;)t.remove(),n.nodeValue+=t.nodeValue,t=n.nextSibling}function So(n){var t=Z,e=it;Ce(null),li(null);try{return n()}finally{Ce(t),li(e)}}function yf(n){it===null&&(Z===null&&Gd(),Nd()),ai&&kd()}function xf(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){var e=it;e!==null&&(e.f&ti)!==0&&(n|=ti);var i={ctx:Qt,deps:null,nodes:null,f:n|Ft|Jt,first:null,fn:t,last:null,next:null,parent:e,b:e&&e.b,prev:null,teardown:null,wv:0,ac:null},s=i;if((n&on)!==0)hn!==null?hn.push(i):ni.ensure().schedule(i);else if(t!==null){try{un(i)}catch(o){throw ge(i),o}s.deps===null&&s.teardown===null&&s.nodes===null&&s.first===s.last&&(s.f&an)===0&&(s=s.first,(n&Je)!==0&&(n&Ws)!==0&&s!==null&&(s.f|=Ws))}if(s!==null&&(s.parent=e,e!==null&&xf(s,e),Z!==null&&(Z.f&wt)!==0&&(n&Qe)===0)){var r=Z;(r.effects??=[]).push(s)}return i}function Io(){return Z!==null&&!_e}function Ef(n){const t=oi(lo,null);return _t(t,vt),t.teardown=n,t}function bo(n){yf();var t=it.f,e=!Z&&(t&Oe)!==0&&(t&Li)===0;if(e){var i=Qt;(i.e??=[]).push(n)}else return lh(n)}function lh(n){return oi(on|Fd,n)}function wf(n){ni.ensure();const t=oi(Qe|an,n);return()=>{ge(t)}}function vf(n){ni.ensure();const t=oi(Qe|an,n);return(e={})=>new Promise(i=>{e.outro?Zs(t,()=>{ge(t),i(void 0)}):(ge(t),i(void 0))})}function Cf(n){return oi(on,n)}function hh(n,t=0){return oi(lo|t,n)}function Rf(n,t=0){var e=oi(Je|t,n);return e}function Fi(n){return oi(Oe|an,n)}function ch(n){var t=n.teardown;if(t!==null){const e=ai,i=Z;fh(!0),Ce(null);try{t.call(null)}finally{fh(e),Ce(i)}}}function Po(n,t=!1){var e=n.first;for(n.first=n.last=null;e!==null;){const s=e.ac;s!==null&&So(()=>{s.abort(uo)});var i=e.next;(e.f&Qe)!==0?e.parent=null:ge(e,t),e=i}}function Tf(n){for(var t=n.first;t!==null;){var e=t.next;(t.f&Oe)===0&&ge(t),t=e}}function ge(n,t=!0){var e=!1;(t||(n.f&Od)!==0)&&n.nodes!==null&&n.nodes.end!==null&&(Sf(n.nodes.start,n.nodes.end),e=!0),_t(n,Ml),Po(n,t&&!e),Zn(n,0);var i=n.nodes&&n.nodes.t;if(i!==null)for(const r of i)r.stop();ch(n),n.f^=Ml,n.f|=ei;var s=n.parent;s!==null&&s.first!==null&&uh(n),n.next=n.prev=n.teardown=n.ctx=n.deps=n.fn=n.nodes=n.ac=n.b=null}function Sf(n,t){for(;n!==null;){var e=n===t?null:ke(n);n.remove(),n=e}}function uh(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 Zs(n,t,e=!0){var i=[];dh(n,i,!0);var s=()=>{e&&ge(n),t&&t()},r=i.length;if(r>0){var o=()=>--r||s();for(var a of i)a.out(o)}else s()}function dh(n,t,e){if((n.f&ti)===0){n.f^=ti;var i=n.nodes&&n.nodes.t;if(i!==null)for(const a of i)(a.is_global||e)&&t.push(a);for(var s=n.first;s!==null;){var r=s.next,o=(s.f&Ws)!==0||(s.f&Oe)!==0&&(n.f&Je)!==0;dh(s,t,o?e:!1),s=r}}}function If(n,t){if(n.nodes)for(var e=n.nodes.start,i=n.nodes.end;e!==null;){var s=e===i?null:ke(e);t.append(e),e=s}}let Hs=!1,ai=!1;function fh(n){ai=n}let Z=null,_e=!1;function Ce(n){Z=n}let it=null;function li(n){it=n}let ee=null;function gh(n){Z!==null&&(ee===null?ee=[n]:ee.push(n))}let Xt=null,Bt=0,ie=null;function bf(n){ie=n}let _h=1,Di=0,ki=Di;function mh(n){ki=n}function ph(){return++_h}function Un(n){var t=n.f;if((t&Ft)!==0)return!0;if(t&wt&&(n.f&=~Ai),(t&ve)!==0){for(var e=n.deps,i=e.length,s=0;s<i;s++){var r=e[s];if(Un(r)&&Ql(r),r.wv>n.wv)return!0}(t&Jt)!==0&&fe===null&&_t(n,vt)}return!1}function yh(n,t,e=!0){var i=n.reactions;if(i!==null&&!(ee!==null&&rn.call(ee,n)))for(var s=0;s<i.length;s++){var r=i[s];(r.f&wt)!==0?yh(r,t,!1):t===r&&(e?_t(r,Ft):(r.f&vt)!==0&&_t(r,ve),xo(r))}}function xh(n){var t=Xt,e=Bt,i=ie,s=Z,r=ee,o=Qt,a=_e,l=ki,h=n.f;Xt=null,Bt=0,ie=null,Z=(h&(Oe|Qe))===0?n:null,ee=null,Bs(n.ctx),_e=!1,ki=++Di,n.ac!==null&&(So(()=>{n.ac.abort(uo)}),n.ac=null);try{n.f|=co;var c=n.fn,u=c();n.f|=Li;var d=n.deps,f=ft?.is_fork;if(Xt!==null){var g;if(f||Zn(n,Bt),d!==null&&Bt>0)for(d.length=Bt+Xt.length,g=0;g<Xt.length;g++)d[Bt+g]=Xt[g];else n.deps=d=Xt;if(Io()&&(n.f&Jt)!==0)for(g=Bt;g<d.length;g++)(d[g].reactions??=[]).push(n)}else!f&&d!==null&&Bt<d.length&&(Zn(n,Bt),d.length=Bt);if(Wl()&&ie!==null&&!_e&&d!==null&&(n.f&(wt|ve|Ft))===0)for(g=0;g<ie.length;g++)yh(ie[g],n);if(s!==null&&s!==n){if(Di++,s.deps!==null)for(let _=0;_<e;_+=1)s.deps[_].rv=Di;if(t!==null)for(const _ of t)_.rv=Di;ie!==null&&(i===null?i=ie:i.push(...ie))}return(n.f&Vn)!==0&&(n.f^=Vn),u}catch(_){return $l(_)}finally{n.f^=co,Xt=t,Bt=e,ie=i,Z=s,ee=r,Bs(o),_e=a,ki=l}}function Pf(n,t){let e=t.reactions;if(e!==null){var i=Td.call(e,n);if(i!==-1){var s=e.length-1;s===0?e=t.reactions=null:(e[i]=e[s],e.pop())}}if(e===null&&(t.f&wt)!==0&&(Xt===null||!rn.call(Xt,t))){var r=t;(r.f&Jt)!==0&&(r.f^=Jt,r.f&=~Ai),mo(r),uf(r),Zn(r,0)}}function Zn(n,t){var e=n.deps;if(e!==null)for(var i=t;i<e.length;i++)Pf(n,e[i])}function un(n){var t=n.f;if((t&ei)===0){_t(n,vt);var e=it,i=Hs;it=n,Hs=!0;try{(t&(Je|Al))!==0?Tf(n):Po(n),ch(n);var s=xh(n);n.teardown=typeof s=="function"?s:null,n.wv=_h;var r;Cd&&Hd&&(n.f&Ft)!==0&&n.deps}finally{Hs=i,it=e}}}function H(n){var t=n.f,e=(t&wt)!==0;if(Z!==null&&!_e){var i=it!==null&&(it.f&ei)!==0;if(!i&&(ee===null||!rn.call(ee,n))){var s=Z.deps;if((Z.f&co)!==0)n.rv<Di&&(n.rv=Di,Xt===null&&s!==null&&s[Bt]===n?Bt++:Xt===null?Xt=[n]:Xt.push(n));else{(Z.deps??=[]).push(n);var r=n.reactions;r===null?n.reactions=[Z]:rn.call(r,Z)||r.push(Z)}}}if(ai&&ri.has(n))return ri.get(n);if(e){var o=n;if(ai){var a=o.v;return((o.f&vt)===0&&o.reactions!==null||wh(o))&&(a=wo(o)),ri.set(o,a),a}var l=(o.f&Jt)===0&&!_e&&Z!==null&&(Hs||(Z.f&Jt)!==0),h=(o.f&Li)===0;Un(o)&&(l&&(o.f|=Jt),Ql(o)),l&&!h&&(th(o),Eh(o))}if(fe?.has(n))return fe.get(n);if((n.f&Vn)!==0)throw n.v;return n.v}function Eh(n){if(n.f|=Jt,n.deps!==null)for(const t of n.deps)(t.reactions??=[]).push(n),(t.f&wt)!==0&&(t.f&Jt)===0&&(th(t),Eh(t))}function wh(n){if(n.v===It)return!0;if(n.deps===null)return!1;for(const t of n.deps)if(ri.has(t)||(t.f&wt)!==0&&wh(t))return!0;return!1}function Lo(n){var t=_e;try{return _e=!0,n()}finally{_e=t}}const Hn=Symbol("events"),vh=new Set,Ao=new Set;function Lf(n,t,e,i={}){function s(r){if(i.capture||Mo.call(t,r),!r.cancelBubble)return So(()=>e?.call(this,r))}return n.startsWith("pointer")||n.startsWith("touch")||n==="wheel"?Oi(()=>{t.addEventListener(n,s,i)}):t.addEventListener(n,s,i),s}function Af(n,t,e,i,s){var r={capture:i,passive:s},o=Lf(n,t,e,r);(t===document.body||t===window||t===document||t instanceof HTMLMediaElement)&&Ef(()=>{t.removeEventListener(n,o,r)})}function Mf(n,t,e){(t[Hn]??={})[n]=e}function Of(n){for(var t=0;t<n.length;t++)vh.add(n[t]);for(var e of Ao)e(n)}let Ch=null;function Mo(n){var t=this,e=t.ownerDocument,i=n.type,s=n.composedPath?.()||[],r=s[0]||n.target;Ch=n;var o=0,a=Ch===n&&n[Hn];if(a){var l=s.indexOf(a);if(l!==-1&&(t===document||t===window)){n[Hn]=t;return}var h=s.indexOf(t);if(h===-1)return;l<=h&&(o=l)}if(r=s[o]||n.target,r!==t){Ys(n,"currentTarget",{configurable:!0,get(){return r||e}});var c=Z,u=it;Ce(null),li(null);try{for(var d,f=[];r!==null;){var g=r.assignedSlot||r.parentNode||r.host||null;try{var _=r[Hn]?.[i];_!=null&&(!r.disabled||n.target===r)&&_.call(r,n)}catch(m){d?f.push(m):d=m}if(n.cancelBubble||g===t||g===null)break;r=g}if(d){for(let m of f)queueMicrotask(()=>{throw m});throw d}}finally{n[Hn]=t,delete n.currentTarget,Ce(c),li(u)}}}const Ff=globalThis?.window?.trustedTypes&&globalThis.window.trustedTypes.createPolicy("svelte-trusted-html",{createHTML:n=>n});function Df(n){return Ff?.createHTML(n)??n}function kf(n){var t=To("template");return t.innerHTML=Df(n.replaceAll("<!>","<!---->")),t.content}function Oo(n,t){var e=it;e.nodes===null&&(e.nodes={start:n,end:t,a:null,t:null})}function Nf(n,t){var e=(t&wd)!==0,i,s=!n.startsWith("<!>");return()=>{if(bt)return Oo(ot,null),ot;i===void 0&&(i=kf(s?n:"<!>"+n));var r=e||sh?document.importNode(i,!0):i.cloneNode(!0);{var o=jn(r),a=r.lastChild;Oo(o,a)}return r}}function Rh(n,t){if(bt){var e=it;((e.f&Li)===0||e.nodes.end===null)&&(e.nodes.end=ot),kl();return}n!==null&&n.before(t)}const Gf=["touchstart","touchmove"];function zf(n){return Gf.includes(n)}function Th(n,t){return Sh(n,t)}function Xf(n,t){Ro(),t.intro=t.intro??!1;const e=t.target,i=bt,s=ot;try{for(var r=jn(e);r&&(r.nodeType!==go||r.data!==Sl);)r=ke(r);if(!r)throw Wn;$s(!0),Fe(r);const o=Sh(n,{...t,anchor:r});return $s(!1),o}catch(o){if(o instanceof Error&&o.message.split(`
|
|
2
|
-
`).some(a=>a.startsWith("https://svelte.dev/e/")))throw o;return o!==Wn&&console.warn("Failed to hydrate: ",o),t.recover===!1&&Xd(),Ro(),pf(e),$s(!1),Th(n,t)}finally{$s(i),Fe(s)}}const qs=new Map;function Sh(n,{target:t,anchor:e,props:i={},events:s,context:r,intro:o=!0,transformError:a}){Ro();var l=void 0,h=vf(()=>{var c=e??t.appendChild(Kn());rf(c,{pending:()=>{}},f=>{Xl({});var g=Qt;if(r&&(g.c=r),s&&(i.$$events=s),bt&&Oo(f,null),l=n(f,i)||{},bt&&(it.nodes.end=ot,ot===null||ot.nodeType!==go||ot.data!==Pl))throw _o(),Wn;Yl()},a);var u=new Set,d=f=>{for(var g=0;g<f.length;g++){var _=f[g];if(!u.has(_)){u.add(_);var m=zf(_);for(const E of[t,document]){var p=qs.get(E);p===void 0&&(p=new Map,qs.set(E,p));var y=p.get(_);y===void 0?(E.addEventListener(_,Mo,{passive:m}),p.set(_,1)):p.set(_,y+1)}}}};return d(Sd(vh)),Ao.add(d),()=>{for(var f of u)for(const m of[t,document]){var g=qs.get(m),_=g.get(f);--_==0?(m.removeEventListener(f,Mo),g.delete(f),g.size===0&&qs.delete(m)):g.set(f,_)}Ao.delete(d),c!==e&&c.parentNode?.removeChild(c)}});return Fo.set(l,h),l}let Fo=new WeakMap;function Yf(n,t){const e=Fo.get(n);return e?(Fo.delete(n),e(t)):Promise.resolve()}function Wf(n){Qt===null&&Dd(),bo(()=>{const t=Lo(n);if(typeof t=="function")return t})}function Vf(n,t){Cf(()=>{var e=n.getRootNode(),i=e.host?e:e.head??e.ownerDocument.head;if(!i.querySelector("#"+t.hash)){const s=To("style");s.id=t.hash,s.textContent=t.code,i.appendChild(s)}})}function Ni(n,t,e,i){var s=(e&xd)!==0,r=(e&Ed)!==0,o=i,a=!0,l=()=>(a&&(a=!1,o=r?Lo(i):i),o);let h;if(s){var c=Vs in n||Dl in n;h=Pi(n,t)?.set??(c&&t in n?y=>n[t]=y:void 0)}var u,d=!1;s?[u,d]=Qd(()=>n[t]):u=n[t],u===void 0&&i!==void 0&&(u=l(),h&&(Yd(),h(u)));var f;if(f=()=>{var y=n[t];return y===void 0?l():(a=!0,y)},(e&yd)===0)return f;if(h){var g=n.$$legacy;return(function(y,E){return arguments.length>0?((!E||g||d)&&h(E?f():y),y):f()})}var _=!1,m=((e&pd)!==0?Eo:lf)(()=>(_=!1,f()));s&&H(m);var p=it;return(function(y,E){if(arguments.length>0){const x=E?H(m):s?cn(y):y;return zt(m,x),_=!0,o!==void 0&&(o=x),y}return ai&&_||(p.f&ei)!==0?m.v:H(m)})}function $f(n){return new Bf(n)}class Bf{#t;#i;constructor(t){var e=new Map,i=(r,o)=>{var a=df(o,!1,!1);return e.set(r,a),a};const s=new Proxy({...t.props||{},$$events:{}},{get(r,o){return H(e.get(o)??i(o,Reflect.get(r,o)))},has(r,o){return o===Dl?!0:(H(e.get(o)??i(o,Reflect.get(r,o))),Reflect.has(r,o))},set(r,o,a){return zt(e.get(o)??i(o,a),a),Reflect.set(r,o,a)}});this.#i=(t.hydrate?Xf:Th)(t.component,{target:t.target,anchor:t.anchor,props:s,context:t.context,intro:t.intro??!1,recover:t.recover,transformError:t.transformError}),(!t?.props?.$$host||t.sync===!1)&&si(),this.#t=s.$$events;for(const r of Object.keys(this.#i))r==="$set"||r==="$destroy"||r==="$on"||Ys(this,r,{get(){return this.#i[r]},set(o){this.#i[r]=o},enumerable:!0});this.#i.$set=r=>{Object.assign(s,r)},this.#i.$destroy=()=>{Yf(this.#i)}}$set(t){this.#i.$set(t)}$on(t,e){this.#t[t]=this.#t[t]||[];const i=(...s)=>e.call(this,...s);return this.#t[t].push(i),()=>{this.#t[t]=this.#t[t].filter(s=>s!==i)}}$destroy(){this.#i.$destroy()}}let Ih;typeof HTMLElement=="function"&&(Ih=class extends HTMLElement{$$ctor;$$s;$$c;$$cn=!1;$$d={};$$r=!1;$$p_d={};$$l={};$$l_u=new Map;$$me;$$shadowRoot=null;constructor(n,t,e){super(),this.$$ctor=n,this.$$s=t,e&&(this.$$shadowRoot=this.attachShadow(e))}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=To("slot");i!=="default"&&(r.name=i),Rh(s,r)}};if(await Promise.resolve(),!this.$$cn||this.$$c)return;const t={},e=Kf(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]=Js(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=$f({component:this.$$ctor,target:this.$$shadowRoot||this,props:{...this.$$d,$$slots:t,$$host:this}}),this.$$me=wf(()=>{hh(()=>{this.$$r=!0;for(const i of Xs(this.$$c)){if(!this.$$p_d[i]?.reflect)continue;this.$$d[i]=this.$$c[i];const s=Js(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]=Js(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 Xs(this.$$p_d).find(t=>this.$$p_d[t].attribute===n||!this.$$p_d[t].attribute&&t.toLowerCase()===n)||n}});function Js(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 Kf(n){const t={};return n.childNodes.forEach(e=>{t[e.slot||"default"]=!0}),t}function jf(n,t,e,i,s,r){let o=class extends Ih{constructor(){super(n,e,s),this.$$p_d=t}static get observedAttributes(){return Xs(t).map(a=>(t[a].attribute||a).toLowerCase())}};return Xs(t).forEach(a=>{Ys(o.prototype,a,{get(){return this.$$c&&a in this.$$c?this.$$c[a]:this.$$d[a]},set(l){l=Js(a,l,t),this.$$d[a]=l;var h=this.$$c;if(h){var c=Pi(h,a)?.get;c?h[a]=l:h.$set({[a]:l})}}})}),i.forEach(a=>{Ys(o.prototype,a,{get(){return this.$$c?.[a]}})}),n.element=o,o}const Yt={ADD:"add",REMOVE:"remove"},dn={PROPERTYCHANGE:"propertychange"},V={CHANGE:"change",ERROR:"error",CONTEXTMENU:"contextmenu",CLICK:"click",DBLCLICK:"dblclick",KEYDOWN:"keydown",KEYPRESS:"keypress",LOAD:"load",TOUCHMOVE:"touchmove",WHEEL:"wheel"};class Qs{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}}function Uf(n,t,e){let i,s;e=e||Re;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 Re(n,t){return n>t?1:n<t?-1:0}function Zf(n,t){return n<t?1:n>t?-1:0}function Do(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 Hf(n,t,e){for(;t<e;){const i=n[t];n[t]=n[e],n[e]=i,++t,--e}}function Te(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 hi(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 qf(n,t,e){const i=t||Re;return n.every(function(s,r){if(r===0)return!0;const o=i(n[r-1],s);return!(o>0||o===0)})}function qn(){return!0}function tr(){return!1}function Jn(){}function bh(n){let t,e,i;return function(){const s=Array.prototype.slice.call(arguments);return(!e||this!==i||!hi(s,e))&&(i=this,e=s,t=n.apply(this,arguments)),t}}function Jf(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 Qn(n){for(const t in n)delete n[t]}function Gi(n){let t;for(t in n)return!1;return!t}class Ne{constructor(t){this.propagationStopped,this.defaultPrevented,this.type=t,this.target=null}preventDefault(){this.defaultPrevented=!0}stopPropagation(){this.propagationStopped=!0}}class er extends Qs{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 Ne(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,Jn);delete o[i]}return l}disposeInternal(){this.listeners_&&Qn(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]=Jn,++this.pendingRemovals_[t]):(i.splice(s,1),i.length===0&&delete this.listeners_[t]))}}function q(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 ir(n,t,e,i){return q(n,t,e,i,!0)}function rt(n){n&&n.target&&(n.target.removeEventListener(n.type,n.listener),Qn(n))}class ts extends er{constructor(){super(),this.on=this.onInternal,this.once=this.onceInternal,this.un=this.unInternal,this.revision_=0}changed(){++this.revision_,this.dispatchEvent(V.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]=q(this,t[r],e);return s}return q(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]=ir(this,t[r],e)}else i=ir(this,t,e);return e.ol_key=i,i}unInternal(t,e){const i=e.ol_key;if(i)Qf(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)}}ts.prototype.on,ts.prototype.once,ts.prototype.un;function Qf(n){if(Array.isArray(n))for(let t=0,e=n.length;t<e;++t)rt(n[t]);else rt(n)}function j(){throw new Error("Unimplemented abstract method.")}let tg=0;function B(n){return n.ol_uid||(n.ol_uid=String(++tg))}class Ph extends Ne{constructor(t,e,i){super(t),this.key=e,this.oldValue=i}}class me extends ts{constructor(t){super(),this.on,this.once,this.un,B(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 Ph(i,t,e)),i=dn.PROPERTYCHANGE,this.hasListener(i)&&this.dispatchEvent(new Ph(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],Gi(this.values_)&&(this.values_=null),e||this.notify(t,i)}}}const Lh={LENGTH:"length"};class nr extends Ne{constructor(t,e,i){super(t),this.element=e,this.index=i}}class ne extends me{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(Lh.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 nr(Yt.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 nr(Yt.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 nr(Yt.REMOVE,s,t)),this.dispatchEvent(new nr(Yt.ADD,e,t))}updateLength_(){this.set(Lh.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 sr extends me{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 sr(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_&&(rt(this.geometryChangeKey_),this.geometryChangeKey_=null);const t=this.getGeometry();t&&(this.geometryChangeKey_=q(t,V.CHANGE,this.handleGeometryChange_,this)),this.changed()}setGeometry(t){this.set(this.geometryName_,t)}setStyle(t){this.style_=t,this.styleFunction_=t?eg(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 eg(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 Ct={UNKNOWN:0,INTERSECTING:1,ABOVE:2,RIGHT:4,BELOW:8,LEFT:16};function ko(n){const t=Kt();for(let e=0,i=n.length;e<i;++e)is(t,n[e]);return t}function ig(n,t,e){const i=Math.min.apply(null,n),s=Math.min.apply(null,t),r=Math.max.apply(null,n),o=Math.max.apply(null,t);return Ge(i,s,r,o,e)}function ci(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 Ah(n,t){return t?(t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t):n.slice()}function fn(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 gn(n,t){return No(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 No(n,t,e){return n[0]<=t&&t<=n[2]&&n[1]<=e&&e<=n[3]}function Go(n,t){const e=n[0],i=n[1],s=n[2],r=n[3],o=t[0],a=t[1];let l=Ct.UNKNOWN;return o<e?l=l|Ct.LEFT:o>s&&(l=l|Ct.RIGHT),a<i?l=l|Ct.BELOW:a>r&&(l=l|Ct.ABOVE),l===Ct.UNKNOWN&&(l=Ct.INTERSECTING),l}function Kt(){return[1/0,1/0,-1/0,-1/0]}function Ge(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 es(n){return Ge(1/0,1/0,-1/0,-1/0,n)}function Mh(n,t){const e=n[0],i=n[1];return Ge(e,i,e,i,t)}function zo(n,t,e,i,s){const r=es(s);return Fh(r,n,t,e,i)}function _n(n,t){return n[0]==t[0]&&n[2]==t[2]&&n[1]==t[1]&&n[3]==t[3]}function Oh(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 is(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 Fh(n,t,e,i,s){for(;e<i;e+=s)ng(n,t[e],t[e+1]);return n}function ng(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 Dh(n,t){let e;return e=t(rr(n)),e||(e=t(or(n)),e)||(e=t(ar(n)),e)||(e=t(ui(n)),e)?e:!1}function Xo(n){let t=0;return mn(n)||(t=nt(n)*Dt(n)),t}function rr(n){return[n[0],n[1]]}function or(n){return[n[2],n[1]]}function Xi(n){return[(n[0]+n[2])/2,(n[1]+n[3])/2]}function sg(n,t){let e;if(t==="bottom-left")e=rr(n);else if(t==="bottom-right")e=or(n);else if(t==="top-left")e=ui(n);else if(t==="top-right")e=ar(n);else throw new Error("Invalid corner");return e}function Yo(n,t,e,i,s){const[r,o,a,l,h,c,u,d]=kh(n,t,e,i);return Ge(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 kh(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 Dt(n){return n[3]-n[1]}function ze(n,t,e){const i=e||Kt();return gt(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]):es(i),i}function ui(n){return[n[0],n[3]]}function ar(n){return[n[2],n[3]]}function nt(n){return n[2]-n[0]}function gt(n,t){return n[0]<=t[2]&&n[2]>=t[0]&&n[1]<=t[3]&&n[3]>=t[1]}function mn(n){return n[2]<n[0]||n[3]<n[1]}function rg(n,t){return t?(t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t):n}function og(n,t,e){let i=!1;const s=Go(n,t),r=Go(n,e);if(s===Ct.INTERSECTING||r===Ct.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&Ct.ABOVE&&!(s&Ct.ABOVE)&&(_=d-(f-h)/g,i=_>=o&&_<=l),!i&&r&Ct.RIGHT&&!(s&Ct.RIGHT)&&(m=f-(d-l)*g,i=m>=a&&m<=h),!i&&r&Ct.BELOW&&!(s&Ct.BELOW)&&(_=d-(f-a)/g,i=_>=o&&_<=l),!i&&r&Ct.LEFT&&!(s&Ct.LEFT)&&(m=f-(d-o)*g,i=m>=a&&m<=h)}return i}function ag(n,t,e,i){if(mn(n))return es(e);let s=[];if(i>1){const a=n[2]-n[0],l=n[3]-n[1];for(let h=0;h<i;++h)s.push(n[0]+a*h/i,n[1],n[2],n[1]+l*h/i,n[2]-a*h/i,n[3],n[0],n[3]-l*h/i)}else s=[n[0],n[1],n[2],n[1],n[2],n[3],n[0],n[3]];t(s,s,2);const r=[],o=[];for(let a=0,l=s.length;a<l;a+=2)r.push(s[a]),o.push(s[a+1]);return ig(r,o,e)}function Nh(n,t){const e=t.getExtent(),i=Xi(n);if(t.canWrapX()&&(i[0]<e[0]||i[0]>=e[2])){const s=nt(e),o=Math.floor((i[0]-e[0])/s)*s;n[0]-=o,n[2]-=o}return n}function Gh(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]]];Nh(n,t);const s=nt(i);if(nt(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 at(n,t,e){return Math.min(Math.max(n,t),e)}function lg(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 Yi(n,t,e,i)}function Yi(n,t,e,i){const s=e-n,r=i-t;return s*s+r*r}function hg(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 zh(n){return n*180/Math.PI}function di(n){return n*Math.PI/180}function pn(n,t){const e=n%t;return e*t<0?e+t:e}function jt(n,t,e){return n+e*(t-n)}function lr(n,t){const e=Math.pow(10,t);return Math.round(n*e)/e}function hr(n,t){return Math.floor(lr(n,t))}function cr(n,t){return Math.ceil(lr(n,t))}function Wo(n,t,e){if(n>=t&&n<e)return n;const i=e-t;return((n-t)%i+i)%i+t}const cg=63710088e-1;function Xh(n,t,e){e=e||cg;const i=di(n[1]),s=di(t[1]),r=(s-i)/2,o=di(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 Yh(...n){console.warn(...n)}function ug(n,t){return n[0]+=+t[0],n[1]+=+t[1],n}function ur(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 Vo(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 dg(n,t){return n[0]*=t,n[1]*=t,n}function $o(n,t){if(t.canWrapX()){const e=nt(t.getExtent()),i=fg(n,t,e);i&&(n[0]-=i*e)}return n}function fg(n,t,e){const i=t.getExtent();let s=0;return t.canWrapX()&&(n[0]<i[0]||n[0]>i[2])&&(e=e||nt(i),s=Math.floor((n[0]-i[0])/e)),s}function gg(n,t,e){const i=Math.sqrt((t[0]-n[0])*(t[0]-n[0])+(t[1]-n[1])*(t[1]-n[1])),s=[(t[0]-n[0])/i,(t[1]-n[1])/i],r=[-s[1],s[0]],o=Math.sqrt((e[0]-n[0])*(e[0]-n[0])+(e[1]-n[1])*(e[1]-n[1])),a=[(e[0]-n[0])/o,(e[1]-n[1])/o];let l=i===0||o===0?0:Math.acos(at(a[0]*s[0]+a[1]*s[1],-1,1));return l=Math.max(l,1e-5),a[0]*r[0]+a[1]*r[1]>0?l:Math.PI*2-l}const Bo={radians:6370997/(2*Math.PI),degrees:2*Math.PI*6370997/360,ft:.3048,m:1,"us-ft":1200/3937};class dr{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_||Bo[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 ns=6378137,yn=Math.PI*ns,_g=[-yn,-yn,yn,yn],mg=[-180,-85,180,85],fr=ns*Math.log(Math.tan(Math.PI/2));class xn extends dr{constructor(t){super({code:t,units:"m",extent:_g,global:!0,worldExtent:mg,getPointResolution:function(e,i){return e/Math.cosh(i[1]/ns)}})}}const Wh=[new xn("EPSG:3857"),new xn("EPSG:102100"),new xn("EPSG:102113"),new xn("EPSG:900913"),new xn("http://www.opengis.net/def/crs/EPSG/0/3857"),new xn("http://www.opengis.net/gml/srs/epsg.xml#3857")];function pg(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]=yn*n[r]/180;let o=ns*Math.log(Math.tan(Math.PI*(+n[r+1]+90)/360));o>fr?o=fr:o<-fr&&(o=-fr),t[r+1]=o}return t}function yg(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]/yn,t[r+1]=360*Math.atan(Math.exp(n[r+1]/ns))/Math.PI-90;return t}const xg=6378137,Vh=[-180,-90,180,90],Eg=Math.PI*xg/180;class Wi extends dr{constructor(t,e){super({code:t,units:"degrees",extent:Vh,axisOrientation:e,global:!0,metersPerUnit:Eg,worldExtent:Vh})}}const $h=[new Wi("CRS:84"),new Wi("EPSG:4326","neu"),new Wi("urn:ogc:def:crs:OGC:1.3:CRS84"),new Wi("urn:ogc:def:crs:OGC:2:84"),new Wi("http://www.opengis.net/def/crs/OGC/1.3/CRS84"),new Wi("http://www.opengis.net/gml/srs/epsg.xml#4326","neu"),new Wi("http://www.opengis.net/def/crs/EPSG/0/4326","neu")];let Ko={};function wg(n){return Ko[n]||Ko[n.replace(/urn:(x-)?ogc:def:crs:EPSG:(.*:)?(\w+)$/,"EPSG:$3")]||null}function vg(n,t){Ko[n]=t}let En={};function ss(n,t,e){const i=n.getCode(),s=t.getCode();i in En||(En[i]={}),En[i][s]=e}function jo(n,t){return n in En&&t in En[n]?En[n][t]:null}const gr=.9996,se=.00669438,_r=se*se,mr=_r*se,Vi=se/(1-se),Bh=Math.sqrt(1-se),wn=(1-Bh)/(1+Bh),Kh=wn*wn,Uo=Kh*wn,Zo=Uo*wn,jh=Zo*wn,Uh=1-se/4-3*_r/64-5*mr/256,Cg=3*se/8+3*_r/32+45*mr/1024,Rg=15*_r/256+45*mr/1024,Tg=35*mr/3072,Sg=3/2*wn-27/32*Uo+269/512*jh,Ig=21/16*Kh-55/32*Zo,bg=151/96*Uo-417/128*jh,Pg=1097/512*Zo,pr=6378137;function Lg(n,t,e){const i=n-5e5,o=(e.north?t:t-1e7)/gr/(pr*Uh),a=o+Sg*Math.sin(2*o)+Ig*Math.sin(4*o)+bg*Math.sin(6*o)+Pg*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-se*h,_=Math.sqrt(1-se*h),m=pr/_,p=(1-se)/g,y=Vi*c**2,E=y*y,x=i/(m*gr),w=x*x,T=w*x,I=T*x,S=I*x,R=S*x,v=a-u/p*(w/2-I/24*(5+3*d+10*y-4*E-9*Vi))+R/720*(61+90*d+298*y+45*f-252*Vi-3*E);let b=(x-T/6*(1+2*d+y)+S/120*(5-2*y+28*d-3*E+8*Vi+24*f))/c;return b=Wo(b+di(qh(e.number)),-Math.PI,Math.PI),[zh(b),zh(v)]}const Zh=-80,Hh=84,Ag=-180,Mg=180;function Og(n,t,e){n=Wo(n,Ag,Mg),t<Zh?t=Zh:t>Hh&&(t=Hh);const i=di(t),s=Math.sin(i),r=Math.cos(i),o=s/r,a=o*o,l=a*a,h=di(n),c=qh(e.number),u=di(c),d=pr/Math.sqrt(1-se*s**2),f=Vi*r**2,g=r*Wo(h-u,-Math.PI,Math.PI),_=g*g,m=_*g,p=m*g,y=p*g,E=y*g,x=pr*(Uh*i-Cg*Math.sin(2*i)+Rg*Math.sin(4*i)-Tg*Math.sin(6*i)),w=gr*d*(g+m/6*(1-a+f)+y/120*(5-18*a+l+72*f-58*Vi))+5e5;let T=gr*(x+d*o*(_/2+p/24*(5-a+9*f+4*f**2)+E/720*(61-58*a+l+600*f-330*Vi)));return e.north||(T+=1e7),[w,T]}function qh(n){return(n-1)*6-180+3}const Fg=[/^EPSG:(\d+)$/,/^urn:ogc:def:crs:EPSG::(\d+)$/,/^http:\/\/www\.opengis\.net\/def\/crs\/EPSG\/0\/(\d+)$/];function Jh(n){let t=0;for(const s of Fg){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 Qh(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 Dg(n){return Jh(n)?new dr({code:n,units:"m"}):null}function kg(n){const t=Jh(n.getCode());return t?{forward:Qh(Og,t),inverse:Qh(Lg,t)}:null}const Ng=[kg],Gg=[Dg];let Ho=!0;function tc(n){Ho=!1}function qo(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 Jo(n){vg(n.getCode(),n),ss(n,n,qo)}function zg(n){n.forEach(Jo)}function mt(n){if(typeof n!="string")return n;const t=wg(n);if(t)return t;for(const e of Gg){const i=e(n);if(i)return i}return null}function ec(n,t,e,i){n=mt(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=yr(n,mt("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=Xh(h.slice(0,2),h.slice(2,4)),u=Xh(h.slice(4,6),h.slice(6,8));s=(c+u)/2}const l=n.getMetersPerUnit();l!==void 0&&(s/=l)}}return s}function ic(n){zg(n),n.forEach(function(t){n.forEach(function(e){t!==e&&ss(t,e,qo)})})}function Xg(n,t,e,i){n.forEach(function(s){t.forEach(function(r){ss(s,r,e),ss(r,s,i)})})}function Qo(n,t){return n?typeof n=="string"?mt(n):n:mt(t)}function Yg(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 ta(n,t){return tc(),rs(n,"EPSG:4326","EPSG:3857")}function Ut(n,t){if(n===t)return!0;const e=n.getUnits()===t.getUnits();return(n.getCode()===t.getCode()||yr(n,t)===qo)&&e}function yr(n,t){const e=n.getCode(),i=t.getCode();let s=jo(e,i);if(s)return s;let r=null,o=null;for(const l of Ng)r||(r=l(n)),o||(o=l(t));if(!r&&!o)return null;const a="EPSG:4326";if(o)if(r)s=ea(r.inverse,o.forward);else{const l=jo(e,a);l&&(s=ea(l,o.forward))}else{const l=jo(a,i);l&&(s=ea(r.inverse,l))}return s&&(Jo(n),Jo(t),ss(n,t,s)),s}function ea(n,t){return function(e,i,s,r){return i=n(e,i,s,r),t(i,i,s,r)}}function $i(n,t){const e=mt(n),i=mt(t);return yr(e,i)}function rs(n,t,e){const i=$i(t,e);if(!i){const s=mt(t).getCode(),r=mt(e).getCode();throw new Error(`No transform available between ${s} and ${r}`)}return i(n,void 0,n.length)}function xr(n,t,e,i){const s=$i(t,e);return ag(n,s,void 0,i)}let Wg=null;function Vg(){return Wg}function ia(n,t){return n}function Xe(n,t){return Ho&&!ur(n,[0,0])&&n[0]>=-180&&n[0]<=180&&n[1]>=-90&&n[1]<=90&&(Ho=!1,Yh("Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.")),n}function na(n,t){return n}function fi(n,t){return n}function $g(){ic(Wh),ic($h),Xg($h,Wh,pg,yg)}$g();const nc=new Array(6);function re(){return[1,0,0,1,0,0]}function sc(n){return ra(n,1,0,0,1,0,0)}function sa(n,t){const e=n[0],i=n[1],s=n[2],r=n[3],o=n[4],a=n[5],l=t[0],h=t[1],c=t[2],u=t[3],d=t[4],f=t[5];return n[0]=e*l+s*h,n[1]=i*l+r*h,n[2]=e*c+s*u,n[3]=i*c+r*u,n[4]=e*d+s*f+o,n[5]=i*d+r*f+a,n}function ra(n,t,e,i,s,r,o){return n[0]=t,n[1]=e,n[2]=i,n[3]=s,n[4]=r,n[5]=o,n}function Bg(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 pt(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 oa(n,t,e){return sa(n,ra(nc,t,0,0,e,0,0))}function Kg(n,t,e){return sa(n,ra(nc,1,0,0,1,t,e))}function Ye(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 rc(n,t){const e=jg(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 jg(n){return n[0]*n[3]-n[1]*n[2]}const Ug=[1e5,1e5,1e5,1e5,2,2];function Zg(n){return"matrix("+n.join(", ")+")"}function aa(n){return n.substring(7,n.length-1).split(",").map(parseFloat)}function Hg(n,t){const e=aa(n),i=aa(t);for(let s=0;s<6;++s)if(Math.round((e[s]-i[s])*Ug[s])!==0)return!1;return!0}function gi(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 oc(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 _=d+2;_<d+i;++_)o[u++]=n[_]}return o&&o.length!=u&&(o.length=u),o}function qg(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 Jg(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 ac=re(),Qg=[NaN,NaN];class t_ extends me{constructor(){super(),this.extent_=Kt(),this.extentRevision_=-1,this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=0,this.simplifyTransformedInternal=bh((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 j()}closestPointXY(t,e,i,s){return j()}containsXY(t,e){return this.closestPointXY(t,e,Qg,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 j()}getExtent(t){if(this.extentRevision_!=this.getRevision()){const e=this.computeExtent(this.extent_);(isNaN(e[0])||isNaN(e[1]))&&es(e),this.extentRevision_=this.getRevision()}return rg(this.extent_,t)}rotate(t,e){j()}scale(t,e,i){j()}simplify(t){return this.getSimplifiedGeometry(t*t)}getSimplifiedGeometry(t){return j()}getType(){return j()}applyTransform(t){j()}intersectsExtent(t){return j()}translate(t,e){j()}transform(t,e){const i=mt(t),s=i.getUnits()=="tile-pixels"?function(r,o,a){const l=i.getExtent(),h=i.getWorldExtent(),c=Dt(h)/Dt(l);Ye(ac,h[0],h[3],c,-c,0,0,0);const u=gi(r,0,r.length,a,ac,o),d=$i(i,e);return d?d(u,u,a):u}:$i(i,e);return this.applyTransform(s),this}}class Bi extends t_{constructor(){super(),this.layout="XY",this.stride=2,this.flatCoordinates}computeExtent(t){return zo(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t)}getCoordinates(){return j()}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=lc(t),this.layout=t,this.flatCoordinates=e}setCoordinates(t,e){j()}setLayout(t,e,i){let s;if(t)s=lc(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=e_(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();oc(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();qg(s,0,s.length,r,t,e,i,s),this.changed()}}translate(t,e){const i=this.getFlatCoordinates();if(i){const s=this.getStride();Jg(i,0,i.length,s,t,e,i),this.changed()}}}function e_(n){let t;return n==2?t="XY":n==3?t="XYZ":n==4&&(t="XYZM"),t}function lc(n){let t;return n=="XY"?t=2:n=="XYZ"||n=="XYM"?t=3:n=="XYZM"&&(t=4),t}function i_(n,t,e){const i=n.getFlatCoordinates();if(!i)return null;const s=n.getStride();return gi(i,0,i.length,s,t,e)}function hc(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 cc(n,t,e,i){let s=0;for(let r=0,o=e.length;r<o;++r){const a=e[r];s+=hc(n,t,a,i),t=a}return s}function n_(n,t,e,i){let s=0;for(let r=0,o=e.length;r<o;++r){const a=e[r];s+=cc(n,t,a,i),t=a[a.length-1]}return s}function uc(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]=jt(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 la(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=Yi(r,o,a,l);h>s&&(s=h),r=a,o=l}return s}function ha(n,t,e,i,s){for(let r=0,o=e.length;r<o;++r){const a=e[r];s=la(n,t,a,i,s),t=a}return s}function s_(n,t,e,i,s){for(let r=0,o=e.length;r<o;++r){const a=e[r];s=ha(n,t,a,i,s),t=a[a.length-1]}return s}function ca(n,t,e,i,s,r,o,a,l,h,c){if(t==e)return h;let u,d;if(s===0){if(d=Yi(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(uc(n,f-i,f,i,o,a,c),d=Yi(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(r&&(uc(n,e-i,t,i,o,a,c),d=Yi(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 ua(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=ca(n,t,f,i,s,r,o,a,l,h,c),t=f}return h}function r_(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=ua(n,t,f,i,s,r,o,a,l,h,c),t=f[f.length-1]}return h}function o_(n,t,e,i){for(let s=0,r=e.length;s<r;++s)n[t++]=e[s];return t}function Er(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 da(n,t,e,i,s){s=s||[];let r=0;for(let o=0,a=e.length;o<a;++o){const l=Er(n,t,e[o],i);s[r++]=l,t=l}return s.length=r,s}function a_(n,t,e,i,s){s=s||[];let r=0;for(let o=0,a=e.length;o<a;++o){const l=da(n,t,e[o],i,s[r]);l.length===0&&(l[0]=t),s[r++]=l,t=l[l.length-1]}return s.length=r,s}function _i(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 os(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++]=_i(n,t,l,i,s[r]),t=l}return s.length=r,s}function fa(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?[]:os(n,t,l,i,s[r]),t=l[l.length-1]}return s.length=r,s}function wr(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],_=n[d+1],m=n[u],p=n[u+1];for(let y=d+i;y<u;y+=i){const E=n[y],x=n[y+1],w=lg(E,x,g,_,m,p);w>f&&(c=y,f=w)}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 dc(n,t,e,i,s,r,o,a){for(let l=0,h=e.length;l<h;++l){const c=e[l];o=wr(n,t,c,i,s,r,o),a.push(o),t=c}return o}function Ki(n,t){return t*Math.round(n/t)}function l_(n,t,e,i,s,r,o){if(t==e)return o;let a=Ki(n[t],s),l=Ki(n[t+1],s);t+=i,r[o++]=a,r[o++]=l;let h,c;do if(h=Ki(n[t],s),c=Ki(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=Ki(n[t],s),d=Ki(n[t+1],s);if(t+=i,u==h&&d==c)continue;const f=h-a,g=c-l,_=u-a,m=d-l;if(f*m==g*_&&(f<0&&_<f||f==_||f>0&&_>f)&&(g<0&&m<g||g==m||g>0&&m>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 ga(n,t,e,i,s,r,o,a){for(let l=0,h=e.length;l<h;++l){const c=e[l];o=l_(n,t,c,i,s,r,o),a.push(o),t=c}return o}function h_(n,t,e,i,s,r,o,a){for(let l=0,h=e.length;l<h;++l){const c=e[l],u=[];o=ga(n,t,c,i,s,r,o,u),a.push(u),t=c[c.length-1]}return o}class as extends Bi{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 as(this.flatCoordinates.slice(),this.layout)}closestPointXY(t,e,i,s){return s<fn(this.getExtent(),t,e)?s:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(la(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),ca(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!0,t,e,i,s))}getArea(){return hc(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinates(){return _i(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getSimplifiedGeometryInternal(t){const e=[];return e.length=wr(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e,0),new as(e,"XY")}getType(){return"LinearRing"}intersectsExtent(t){return!1}setCoordinates(t,e){this.setLayout(e,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Er(this.flatCoordinates,0,t,this.stride),this.changed()}}class ji extends Bi{constructor(t,e){super(),this.setCoordinates(t,e)}clone(){const t=new ji(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(t,e,i,s){const r=this.flatCoordinates,o=Yi(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 Mh(this.flatCoordinates,t)}getType(){return"Point"}intersectsExtent(t){return No(t,this.flatCoordinates[0],this.flatCoordinates[1])}setCoordinates(t,e){this.setLayout(e,t,0),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=o_(this.flatCoordinates,0,t,this.stride),this.changed()}}function c_(n,t,e,i,s){return!Dh(s,function(o){return!Ui(n,t,e,i,o[0],o[1])})}function Ui(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 _a(n,t,e,i,s,r){if(e.length===0||!Ui(n,t,e[0],i,s,r))return!1;for(let o=1,a=e.length;o<a;++o)if(Ui(n,e[o-1],e[o],i,s,r))return!1;return!0}function u_(n,t,e,i,s,r){if(e.length===0)return!1;for(let o=0,a=e.length;o<a;++o){const l=e[o];if(_a(n,t,l,i,s,r))return!0;t=l[l.length-1]}return!1}function ma(n,t,e,i,s,r,o){let a,l,h,c,u,d,f;const g=s[r+1],_=[];for(let y=0,E=e.length;y<E;++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,_.push(h)),c=u,d=f}let m=NaN,p=-1/0;for(_.sort(Re),c=_[0],a=1,l=_.length;a<l;++a){u=_[a];const y=Math.abs(u-c);y>p&&(h=(c+u)/2,_a(n,t,e,i,h,g)&&(m=h,p=y)),c=u}return isNaN(m)&&(m=s[r]),o?(o.push(m,g,p),o):[m,g,p]}function fc(n,t,e,i,s){let r=[];for(let o=0,a=e.length;o<a;++o){const l=e[o];r=ma(n,t,l,i,s,2*o,r),t=l[l.length-1]}return r}function gc(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 vr(n,t,e,i,s,r){return r=r??Fh(Kt(),n,t,e,i),gt(s,r)?r[0]>=s[0]&&r[2]<=s[2]||r[1]>=s[1]&&r[3]<=s[3]?!0:gc(n,t,e,i,function(o,a){return og(s,o,a)}):!1}function d_(n,t,e,i,s){for(let r=0,o=e.length;r<o;++r){if(vr(n,t,e[r],i,s))return!0;t=e[r]}return!1}function _c(n,t,e,i,s){return!!(vr(n,t,e,i,s)||Ui(n,t,e,i,s[0],s[1])||Ui(n,t,e,i,s[0],s[3])||Ui(n,t,e,i,s[2],s[1])||Ui(n,t,e,i,s[2],s[3]))}function mc(n,t,e,i,s){if(!_c(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(c_(n,e[r-1],e[r],i,s)&&!vr(n,e[r-1],e[r],i,s))return!1;return!0}function f_(n,t,e,i,s){for(let r=0,o=e.length;r<o;++r){const a=e[r];if(mc(n,t,a,i,s))return!0;t=a[a.length-1]}return!1}function g_(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 pa(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 pc(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=pa(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 __(n,t,e,i,s){for(let r=0,o=e.length;r<o;++r){const a=e[r];if(!pc(n,t,a,i,s))return!1;a.length&&(t=a[a.length-1])}return!0}function ya(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=pa(n,t,a,i);(r===0?s&&l||!s&&!l:s&&!l||!s&&l)&&g_(n,t,a,i),t=a}return t}function yc(n,t,e,i,s){for(let r=0,o=e.length;r<o;++r)t=ya(n,t,e[r],i,s);return t}function xc(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=pa(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 mi extends Bi{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?Te(this.flatCoordinates,t.getFlatCoordinates()):this.flatCoordinates=t.getFlatCoordinates().slice(),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){const t=new mi(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return t.applyProperties(this),t}closestPointXY(t,e,i,s){return s<fn(this.getExtent(),t,e)?s:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(ha(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),ua(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!0,t,e,i,s))}containsXY(t,e){return _a(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,e)}getArea(){return cc(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride)}getCoordinates(t){let e;return t!==void 0?(e=this.getOrientedFlatCoordinates().slice(),ya(e,0,this.ends_,this.stride,t)):e=this.flatCoordinates,os(e,0,this.ends_,this.stride)}getEnds(){return this.ends_}getFlatInteriorPoint(){if(this.flatInteriorPointRevision_!=this.getRevision()){const t=Xi(this.getExtent());this.flatInteriorPoint_=ma(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,0),this.flatInteriorPointRevision_=this.getRevision()}return this.flatInteriorPoint_}getInteriorPoint(){return new ji(this.getFlatInteriorPoint(),"XYM")}getLinearRingCount(){return this.ends_.length}getLinearRing(t){return t<0||this.ends_.length<=t?null:new as(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 as(e.slice(r,l),t);s.push(h),r=l}return s}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){const t=this.flatCoordinates;pc(t,0,this.ends_,this.stride)?this.orientedFlatCoordinates_=t:(this.orientedFlatCoordinates_=t.slice(),this.orientedFlatCoordinates_.length=ya(this.orientedFlatCoordinates_,0,this.ends_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(t){const e=[],i=[];return e.length=ga(this.flatCoordinates,0,this.ends_,this.stride,Math.sqrt(t),e,0,i),new mi(e,"XY",i)}getType(){return"Polygon"}intersectsExtent(t){return mc(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,2),this.flatCoordinates||(this.flatCoordinates=[]);const i=da(this.flatCoordinates,0,t,this.stride,this.ends_);this.flatCoordinates.length=i.length===0?0:i[i.length-1],this.changed()}}function Ec(n){if(mn(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 mi(r,"XY",[r.length])}function Cr(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 m=t+i;m<e;m+=i){const p=n[m],y=n[m+1];d+=Math.sqrt((p-c)*(p-c)+(y-u)*(y-u)),f.push(d),c=p,u=y}const g=s*d,_=Uf(f,g);_<0?(l=(g-f[-_-2])/(f[-_-1]-f[-_-2]),a=t+(-_-2)*i):a=t+_*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]:jt(n[a+c],n[a+i+c],l);return r}function xa(n,t,e,i,s,r){if(e==t)return null;let o;if(s<n[t+i-1])return r?(o=n.slice(t,t+i),o[i-1]=s,o):null;if(n[e-1]<s)return r?(o=n.slice(e-i,e),o[i-1]=s,o):null;if(s==n[t+i-1])return n.slice(t,t+i);let a=t/i,l=e/i;for(;a<l;){const d=a+l>>1;s<n[(d+1)*i-1]?l=d:a=d+1}const h=n[a*i-1];if(s==h)return n.slice((a-1)*i,(a-1)*i+i);const c=n[(a+1)*i-1],u=(s-h)/(c-h);o=[];for(let d=0;d<i-1;++d)o.push(jt(n[(a-1)*i+d],n[a*i+d],u));return o.push(s),o}function m_(n,t,e,i,s,r,o){if(o)return xa(n,t,e[e.length-1],i,s,r);let a;if(s<n[i-1])return r?(a=n.slice(0,i),a[i-1]=s,a):null;if(n[n.length-1]<s)return r?(a=n.slice(n.length-i),a[i-1]=s,a):null;for(let l=0,h=e.length;l<h;++l){const c=e[l];if(t!=c){if(s<n[t+i-1])return null;if(s<=n[c-1])return xa(n,t,c,i,s,!1);t=c}}return null}function Ea(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}class vn extends Bi{constructor(t,e){super(),this.flatMidpoint_=null,this.flatMidpointRevision_=-1,this.maxDelta_=-1,this.maxDeltaRevision_=-1,e!==void 0&&!Array.isArray(t[0])?this.setFlatCoordinates(e,t):this.setCoordinates(t,e)}appendCoordinate(t){Te(this.flatCoordinates,t),this.changed()}clone(){const t=new vn(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(t,e,i,s){return s<fn(this.getExtent(),t,e)?s:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(la(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),ca(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!1,t,e,i,s))}forEachSegment(t){return gc(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t)}getCoordinateAtM(t,e){return this.layout!="XYM"&&this.layout!="XYZM"?null:(e=e!==void 0?e:!1,xa(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e))}getCoordinates(){return _i(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinateAt(t,e){return Cr(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e,this.stride)}getLength(){return Ea(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getFlatMidpoint(){return this.flatMidpointRevision_!=this.getRevision()&&(this.flatMidpoint_=this.getCoordinateAt(.5,this.flatMidpoint_??void 0),this.flatMidpointRevision_=this.getRevision()),this.flatMidpoint_}getSimplifiedGeometryInternal(t){const e=[];return e.length=wr(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e,0),new vn(e,"XY")}getType(){return"LineString"}intersectsExtent(t){return vr(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,this.getExtent())}setCoordinates(t,e){this.setLayout(e,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Er(this.flatCoordinates,0,t,this.stride),this.changed()}}const oe={PRERENDER:"prerender",POSTRENDER:"postrender",PRECOMPOSE:"precompose",POSTCOMPOSE:"postcompose",RENDERCOMPLETE:"rendercomplete"},Zi=typeof navigator<"u"&&typeof navigator.userAgent<"u"?navigator.userAgent.toLowerCase():"";Zi.includes("safari")&&!Zi.includes("chrom")&&(Zi.includes("version/15.4")||/cpu (os|iphone os) 15_4 like mac os x/.test(Zi));const p_=Zi.includes("webkit")&&!Zi.includes("edge"),wc=Zi.includes("macintosh"),y_=typeof devicePixelRatio<"u"?devicePixelRatio:1,ae=typeof WorkerGlobalScope<"u"&&typeof OffscreenCanvas<"u"&&self instanceof WorkerGlobalScope,vc=typeof Image<"u"&&Image.prototype.decode,Cc=(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})(),$={IDLE:0,LOADING:1,LOADED:2,ERROR:3};function dt(n,t,e,i){let s;return e&&e.length?s=e.shift():ae?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 wa;function Rr(){return wa||(wa=dt(1,1)),wa}function ls(n){const t=n.canvas;t.width=1,t.height=1,n.clearRect(0,0,1,1)}function x_(n){let t=n.offsetWidth;const e=getComputedStyle(n);return t+=parseInt(e.marginLeft,10)+parseInt(e.marginRight,10),t}function E_(n){let t=n.offsetHeight;const e=getComputedStyle(n);return t+=parseInt(e.marginTop,10)+parseInt(e.marginBottom,10),t}function Rc(n,t){const e=t.parentNode;e&&e.replaceChild(n,t)}function Tc(n){for(;n.lastChild;)n.lastChild.remove()}function w_(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 Sc(){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 pi(n){return typeof HTMLCanvasElement<"u"&&n instanceof HTMLCanvasElement||typeof OffscreenCanvas<"u"&&n instanceof OffscreenCanvas}const va=[NaN,NaN,NaN,0];let Ca;function v_(){return Ca||(Ca=dt(1,1,void 0,{willReadFrequently:!0,desynchronized:!0})),Ca}const C_=/^rgba?\(\s*(\d+%?)\s+(\d+%?)\s+(\d+%?)(?:\s*\/\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,R_=/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,T_=/^rgba?\(\s*(\d+%)\s*,\s*(\d+%)\s*,\s*(\d+%)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,S_=/^#([\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$/i;function Tr(n,t){return n.endsWith("%")?Number(n.substring(0,n.length-1))/t:Number(n)}function hs(n){throw new Error('failed to parse "'+n+'" as color')}function Ic(n){if(n.toLowerCase().startsWith("rgb")){const r=n.match(R_)||n.match(C_)||n.match(T_);if(r){const o=r[4],a=100/255;return[at(Tr(r[1],a)+.5|0,0,255),at(Tr(r[2],a)+.5|0,0,255),at(Tr(r[3],a)+.5|0,0,255),o!==void 0?at(Tr(o,100),0,1):1]}hs(n)}if(n.startsWith("#")){if(S_.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}hs(n)}const t=v_();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&&hs(n));const i=t.fillStyle;if(i.startsWith("#")||i.startsWith("rgba"))return Ic(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]=lr(s[3]/255,3),s}function I_(n){return typeof n=="string"?n:La(n)}const b_=1024,cs={};let Ra=0;function P_(n){if(n.length===4)return n;const t=n.slice();return t[3]=1,t}function Ta(n){return n>.0031308?Math.pow(n,1/2.4)*269.025-14.025:n*3294.6}function Sa(n){return n>.2068965?Math.pow(n,3):(n-4/29)*(108/841)}function Ia(n){return n>10.314724?Math.pow((n+14.025)/269.025,2.4):n/3294.6}function ba(n){return n>.0088564?Math.pow(n,1/3):n/(108/841)+4/29}function bc(n){const t=Ia(n[0]),e=Ia(n[1]),i=Ia(n[2]),s=ba(t*.222488403+e*.716873169+i*.06060791),r=500*(ba(t*.452247074+e*.399439023+i*.148375274)-s),o=200*(s-ba(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 L_(n){const t=(n[0]+16)/116,e=n[1],i=n[2]*Math.PI/180,s=Sa(t),r=Sa(t+e/500*Math.cos(i)),o=Sa(t-e/200*Math.sin(i)),a=Ta(r*3.021973625-s*1.617392459-o*.404875592),l=Ta(r*-.943766287+s*1.916279586+o*.027607165),h=Ta(r*.069407491-s*.22898585+o*1.159737864);return[at(a+.5|0,0,255),at(l+.5|0,0,255),at(h+.5|0,0,255),n[3]]}function Pa(n){if(n==="none")return va;if(cs.hasOwnProperty(n))return cs[n];if(Ra>=b_){let e=0;for(const i in cs)(e++&3)===0&&(delete cs[i],--Ra)}const t=Ic(n);t.length!==4&&hs(n);for(const e of t)isNaN(e)&&hs(n);return cs[n]=t,++Ra,t}function Hi(n){return Array.isArray(n)?n:Pa(n)}function La(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 A_(n,t,e){const i=n;let s=!0,r=!1,o=!1;const a=[ir(i,V.LOAD,function(){o=!0,r||t()})];return i.src&&vc?(r=!0,i.decode().then(function(){s&&t()}).catch(function(l){s&&(o?t():e())})):a.push(ir(i,V.ERROR,e)),function(){s=!1,a.forEach(rt)}}function M_(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 O_(n,t){return t&&(n.src=t),n.src&&vc?new Promise((e,i)=>n.decode().then(()=>e(n)).catch(s=>n.complete&&n.width?e(n):i(s))):M_(n)}class F_{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){const i=Aa(t,e);return i in this.cache_?this.cache_[i]:null}getPattern(t,e){const i=Aa(t,e);return i in this.patternCache_?this.patternCache_[i]:null}set(t,e,i,s){const r=Aa(t,e),o=r in this.cache_;this.cache_[r]=i,s&&(i.getImageState()===$.IDLE&&i.load(),i.getImageState()===$.LOADING?i.ready().then(()=>{this.patternCache_[r]=Rr().createPattern(i.getImage(1),"repeat")}):this.patternCache_[r]=Rr().createPattern(i.getImage(1),"repeat")),o||++this.cacheSize_}setSize(t){this.maxCacheSize_=t,this.expire()}}function Aa(n,t){const e=t?Hi(t):"null";return n+":"+e}const le=new F_;let us=null;class Pc extends er{constructor(t,e,i,s,r){super(),this.hitDetectionImage_=null,this.image_=t,this.crossOrigin_=i?.crossOrigin,this.referrerPolicy_=i?.referrerPolicy,this.canvas_={},this.color_=r,this.imageState_=s===void 0?$.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_),this.referrerPolicy_!==void 0&&(this.image_.referrerPolicy=this.referrerPolicy_)}isTainted_(){if(this.tainted_===void 0&&this.imageState_===$.LOADED){us||(us=dt(1,1,void 0,{willReadFrequently:!0})),us.drawImage(this.image_,0,0);try{us.getImageData(0,0,1,1),this.tainted_=!1}catch{us=null,this.tainted_=!0}}return this.tainted_===!0}dispatchChangeEvent_(){this.dispatchEvent(V.CHANGE)}handleImageError_(){this.imageState_=$.ERROR,this.dispatchChangeEvent_()}handleImageLoad_(){this.imageState_=$.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_}setImage(t){this.image_=t}getPixelRatio(t){return this.replaceColor_(t),this.canvas_[t]?t:1}getImageState(){return this.imageState_}getHitDetectionImage(){if(this.image_||this.initializeImage_(),!this.hitDetectionImage_)if(this.isTainted_()){const t=this.size_[0],e=this.size_[1],i=dt(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_===$.IDLE){this.image_||this.initializeImage_(),this.imageState_=$.LOADING;try{this.src_!==void 0&&(this.image_.src=this.src_)}catch{this.handleImageError_()}this.image_ instanceof HTMLImageElement&&O_(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_!==$.LOADED)return;const e=this.image_,i=dt(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=I_(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_===$.LOADED||this.imageState_===$.ERROR)t();else{const e=()=>{(this.imageState_===$.LOADED||this.imageState_===$.ERROR)&&(this.removeEventListener(V.CHANGE,e),t())};this.addEventListener(V.CHANGE,e)}})),this.ready_}}function ds(n,t,e,i,s,r){let o=t===void 0?void 0:le.get(t,s);return o||(o=new Pc(n,n&&"src"in n?n.src||void 0:t,e,i,s),le.set(t,s,o,r)),r&&o&&!le.getPattern(t,s)&&le.set(t,s,o,r),o}function Se(n){return n?Array.isArray(n)?La(n):typeof n=="object"&&"src"in n?D_(n):n:null}function D_(n){if(!n.offset||!n.size)return le.getPattern(n.src,n.color);const t=n.src+":"+n.offset,e=le.getPattern(t,n.color);if(e)return e;const i=le.get(n.src,null);if(i.getImageState()!==$.LOADED)return null;const s=dt(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]),ds(s.canvas,t,void 0,$.LOADED,n.color,!0),le.getPattern(t,n.color)}function k_(n,t,e,i,s,r){s=s??[],r=r??t;const o=n[0],a=n[1],l=n[n.length-4],h=n[n.length-3];let c,u,d,f,g,_,m,p,y=0;for(let E=0;E<n.length;E+=t){d=c,f=u,g=void 0,_=void 0,E+t<n.length&&(g=n[E+t],_=n[E+t+1]),i&&E===0&&(d=l,f=h),i&&E===n.length-2&&(g=o,_=a),c=n[E],u=n[E+1],[m,p]=Sr(c,u,d,f,g,_,e),s[y++]=m,s[y++]=p;for(let x=2;x<r;x++)s[y++]=n[E+x]}return s.length!=y&&(s.length=y),s}function Sr(n,t,e,i,s,r,o){let a,l;e!==void 0&&i!==void 0?(a=n-e,l=t-i):s!==void 0&&r!==void 0?(a=s-n,l=r-t):(a=1,l=0);const h=Math.hypot(a,l),c=a/h,u=l/h;if(a=-u,l=c,e===void 0||i===void 0)return[n+a*o,t+l*o];if(s===void 0||r===void 0)return[n+a*o,t+l*o];const d=gg([n,t],[e,i],[s,r]);if(Math.cos(d)>.998)return[n+c*o,t+u*o];const f=Math.cos(d/2),g=Math.sin(d/2),_=g*a+f*l,m=-f*a+g*l,p=_*(1/g),y=m*(1/g);return[n+p*o,t+y*o]}class Lc{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 Ir="ol-hidden",N_="ol-selectable",br="ol-unselectable",Ma="ol-control",Ac="ol-collapsed",G_=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"),Mc=["style","variant","weight","size","lineHeight","family"],Oa={normal:400,bold:700},Fa=function(n){const t=n.match(G_);if(!t)return null;const e={lineHeight:"normal",size:"1.2em",style:"normal",weight:"400",variant:"normal"};for(let i=0,s=Mc.length;i<s;++i){const r=t[i+1];r!==void 0&&(e[Mc[i]]=typeof r=="string"?r.trim():r)}return isNaN(Number(e.weight))&&e.weight in Oa&&(e.weight=Oa[e.weight]),e.families=e.family.split(/,\s?/).map(i=>i.trim().replace(/^['"]|['"]$/g,"")),e},Oc="10px sans-serif",Wt="#000",Cn="round",We=[],Ve=0,Rn="round",fs=10,z_=0,gs="#000",_s="center",Pr="middle",qi=[0,0,0,0],ms=1,Tn=new me;let ps=null,Fc;const Da={},X_=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace","ui-rounded","emoji","math","fangsong"]);function Y_(n,t,e){return`${n} ${t} 16px "${e}"`}const W_=(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=Fa(r),l=a.families[0].toLowerCase(),h=a.weight;return o.some(c=>{const u=c.family.replace(/^['"]|['"]$/g,"").toLowerCase(),d=Oa[c.weight]||c.weight;return u===l&&c.style===a.style&&d==h})}async function s(){await e.ready;let r=!0;const o=Tn.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)?(Qn(Da),Tn.set(h,100)):(c+=10,Tn.set(h,c,!0),c<100&&(r=!1)))}t=void 0,r||(t=setTimeout(s,100))}return async function(r){e||(e=ae?self.fonts:document.fonts);const o=Fa(r);if(!o)return;const a=o.families;let l=!1;for(const h of a){if(X_.has(h))continue;const c=Y_(o.style,o.weight,h);Tn.get(c)===void 0&&(Tn.set(c,0,!0),l=!0)}l&&(clearTimeout(t),t=setTimeout(s,100))}})(),V_=(function(){let n;return function(t){let e=Da[t];if(e==null){if(ae){const i=Fa(t),s=Dc(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);Da[t]=e}return e}})();function Dc(n,t){return ps||(ps=dt(1,1)),n!=Fc&&(ps.font=n,Fc=ps.font),ps.measureText(t)}function kc(n,t){return Dc(n,t).width}function Nc(n,t,e){if(t in e)return e[t];const i=t.split(`
|
|
3
|
-
`).reduce((
|
|
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=kc(d,u);e.push(f),o+=f;const g=V_(d);i.push(g),l=Math.max(l,g)}return{width:r,height:a,widths:e,heights:i,lineWidths:s}}function B_(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]),K_(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 K_(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 j_ extends Lc{constructor(t,e,i,s,r,o,a){super(),this.context_=t,this.pixelRatio_=e,this.extent_=i,this.transform_=s,this.transformRotation_=s?lr(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_=re()}drawImages_(t,e,i,s){if(!this.image_)return;const r=gi(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_,_=f+this.imageAnchorY_;Ye(a,g,_,1,1,h,-g,-_),o.save(),o.transform.apply(o,a),o.translate(g,_),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=gi(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,o){const a=this.context_;let l=gi(t,e,i,s,this.transform_,this.pixelCoordinates_);Math.abs(o)>0&&(l=k_(l,s,o,r,l)),a.moveTo(l[0],l[1]);let h=l.length;r&&(h-=2);for(let c=2;c<h;c+=2)a.lineTo(l[c],l[c+1]);return r&&a.closePath(),i}drawRings_(t,e,i,s,r){for(let o=0,a=i.length;o<a;++o)e=this.moveToLineTo_(t,e,i[o],s,!0,r);return e}drawCircle(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!gt(this.extent_,t.getExtent())){if(this.fillState_||this.strokeState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const e=i_(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_)),!!gt(this.extent_,t.getExtent())){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);const e=this.context_,i=t.getFlatCoordinates();e.beginPath(),this.moveToLineTo_(i,0,i.length,t.getStride(),!1,this.strokeState_.strokeOffset),e.stroke()}if(this.text_!==""){const e=t.getFlatMidpoint();this.drawText_(e,0,2,2)}}}drawMultiLineString(t){this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_));const e=t.getExtent();if(gt(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,this.strokeState_.strokeOffset);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_)),!!gt(this.extent_,t.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const e=this.context_;e.beginPath(),this.drawRings_(t.getOrientedFlatCoordinates(),0,t.getEnds(),t.getStride(),this.strokeState_?.strokeOffset),this.fillState_&&e.fill(),this.strokeState_&&e.stroke()}if(this.text_!==""){const e=t.getFlatInteriorPoint();this.drawText_(e,0,2,2)}}}drawMultiPolygon(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!gt(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.strokeState_?.strokeOffset)}this.fillState_&&e.fill(),this.strokeState_&&e.stroke()}if(this.text_!==""){const e=t.getFlatInteriorPoints();this.drawText_(e,0,e.length,2)}}}setContextFillState_(t){const e=this.context_,i=this.contextFillState_;i?i.fillStyle!=t.fillStyle&&(i.fillStyle=t.fillStyle,e.fillStyle=t.fillStyle):(e.fillStyle=t.fillStyle,this.contextFillState_={fillStyle:t.fillStyle})}setContextStrokeState_(t){const e=this.context_,i=this.contextStrokeState_;i?(i.lineCap!=t.lineCap&&(i.lineCap=t.lineCap,e.lineCap=t.lineCap),hi(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:_s;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:Se(i||Wt)}}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||We,u=e.getOffset();this.strokeState_={lineCap:s!==void 0?s:Cn,lineDash:this.pixelRatio_===1?c:c.map(d=>d*this.pixelRatio_),lineDashOffset:(o||Ve)*this.pixelRatio_,lineJoin:a!==void 0?a:Rn,lineWidth:(l!==void 0?l:ms)*this.pixelRatio_,miterLimit:h!==void 0?h:fs,strokeStyle:Se(i||gs),strokeOffset:(u??0)*this.pixelRatio_}}}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:Se(f||Wt)}}const i=t.getStroke();if(!i)this.textStrokeState_=null;else{const f=i.getColor(),g=i.getLineCap(),_=i.getLineDash(),m=i.getLineDashOffset(),p=i.getLineJoin(),y=i.getWidth(),E=i.getMiterLimit();this.textStrokeState_={lineCap:g!==void 0?g:Cn,lineDash:_||We,lineDashOffset:m||Ve,lineJoin:p!==void 0?p:Rn,lineWidth:y!==void 0?y:ms,miterLimit:E!==void 0?E:fs,strokeStyle:Se(f||gs)}}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:Oc,textAlign:u!==void 0?u:_s,textBaseline:d!==void 0?d:Pr},this.text_=c!==void 0?Array.isArray(c)?c.reduce((f,g,_)=>f+=_%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 U_=.5,Gc={Point:im,LineString:Q_,Polygon:sm,MultiPoint:nm,MultiLineString:tm,MultiPolygon:em,GeometryCollection:J_,Circle:H_};function Z_(n,t){return parseInt(B(n),10)-parseInt(B(t),10)}function ka(n,t){const e=zc(n,t);return e*e}function zc(n,t){return U_*n/t}function H_(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 Lr(n,t,e,i,s,r,o,a){const l=[],h=e.getImage();if(h){let d=!0;const f=h.getImageState();f==$.LOADED||f==$.ERROR?d=!1:f==$.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)),q_(n,t,e,i,r,o,a),u}function q_(n,t,e,i,s,r,o){const a=e.getGeometryFunction()(t);if(!a)return;const l=a.simplifyTransformed(i,s);if(e.getRenderer())Xc(n,l,e,t,o);else{const c=Gc[l.getType()];c(n,l,e,t,o,r)}}function Xc(n,t,e,i,s){if(t.getType()=="GeometryCollection"){const o=t.getGeometries();for(let a=0,l=o.length;a<l;++a)Xc(n,o[a],e,i,s);return}n.getBuilder(e.getZIndex(),"Default").drawCustom(t,i,e.getRenderer(),e.getHitDetectionRenderer(),s)}function J_(n,t,e,i,s,r){const o=t.getGeometriesArray();let a,l;for(a=0,l=o.length;a<l;++a){const h=Gc[o[a].getType()];h(n,o[a],e,i,s,r)}}function Q_(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 tm(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 em(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 im(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()!=$.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 nm(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()!=$.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 sm(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 rm=!1;function Yc(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=rm,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 Wc(n,t){return function(e,i,s,r,o){Yc(n,t,e,i,s,(a,l)=>{this.addFeatures(a),r!==void 0&&r(a)},()=>{this.changed(),o!==void 0&&o()})}}function om(n,t){return[[-1/0,-1/0,1/0,1/0]]}function Vc(n,t,e,i){const s=[];let r=Kt();for(let o=0,a=e.length;o<a;++o){const l=e[o];r=zo(n,t,l[0],i),s.push((r[0]+r[2])/2,(r[1]+r[3])/2),t=l[l.length-1]}return s}class Ar extends Bi{constructor(t,e,i){if(super(),this.ends_=[],this.maxDelta_=-1,this.maxDeltaRevision_=-1,Array.isArray(t[0]))this.setCoordinates(t,e);else if(e!==void 0&&i)this.setFlatCoordinates(e,t),this.ends_=i;else{const s=t,r=[],o=[];for(let l=0,h=s.length;l<h;++l){const c=s[l];Te(r,c.getFlatCoordinates()),o.push(r.length)}const a=s.length===0?this.getLayout():s[0].getLayout();this.setFlatCoordinates(a,r),this.ends_=o}}appendLineString(t){Te(this.flatCoordinates,t.getFlatCoordinates().slice()),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){const t=new Ar(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return t.applyProperties(this),t}closestPointXY(t,e,i,s){return s<fn(this.getExtent(),t,e)?s:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(ha(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),ua(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!1,t,e,i,s))}getCoordinateAtM(t,e,i){return this.layout!="XYM"&&this.layout!="XYZM"||this.flatCoordinates.length===0?null:(e=e!==void 0?e:!1,i=i!==void 0?i:!1,m_(this.flatCoordinates,0,this.ends_,this.stride,t,e,i))}getCoordinates(){return os(this.flatCoordinates,0,this.ends_,this.stride)}getEnds(){return this.ends_}getLineString(t){return t<0||this.ends_.length<=t?null:new vn(this.flatCoordinates.slice(t===0?0:this.ends_[t-1],this.ends_[t]),this.layout)}getLineStrings(){const t=this.flatCoordinates,e=this.ends_,i=this.layout,s=[];let r=0;for(let o=0,a=e.length;o<a;++o){const l=e[o],h=new vn(t.slice(r,l),i);s.push(h),r=l}return s}getLength(){const t=this.ends_;let e=0,i=0;for(let s=0,r=t.length;s<r;++s)i+=Ea(this.flatCoordinates,e,t[s],this.stride),e=t[s];return i}getFlatMidpoints(){const t=[],e=this.flatCoordinates;let i=0;const s=this.ends_,r=this.stride;for(let o=0,a=s.length;o<a;++o){const l=s[o],h=Cr(e,i,l,r,.5);Te(t,h),i=l}return t}getSimplifiedGeometryInternal(t){const e=[],i=[];return e.length=dc(this.flatCoordinates,0,this.ends_,this.stride,t,e,0,i),new Ar(e,"XY",i)}getType(){return"MultiLineString"}intersectsExtent(t){return d_(this.flatCoordinates,0,this.ends_,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,2),this.flatCoordinates||(this.flatCoordinates=[]);const i=da(this.flatCoordinates,0,t,this.stride,this.ends_);this.flatCoordinates.length=i.length===0?0:i[i.length-1],this.changed()}}class Mr extends Bi{constructor(t,e){super(),e&&!Array.isArray(t[0])?this.setFlatCoordinates(e,t):this.setCoordinates(t,e)}appendPoint(t){Te(this.flatCoordinates,t.getFlatCoordinates()),this.changed()}clone(){const t=new Mr(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(t,e,i,s){if(s<fn(this.getExtent(),t,e))return s;const r=this.flatCoordinates,o=this.stride;for(let a=0,l=r.length;a<l;a+=o){const h=Yi(t,e,r[a],r[a+1]);if(h<s){s=h;for(let c=0;c<o;++c)i[c]=r[a+c];i.length=o}}return s}getCoordinates(){return _i(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getPoint(t){const e=this.flatCoordinates.length/this.stride;return t<0||e<=t?null:new ji(this.flatCoordinates.slice(t*this.stride,(t+1)*this.stride),this.layout)}getPoints(){const t=this.flatCoordinates,e=this.layout,i=this.stride,s=[];for(let r=0,o=t.length;r<o;r+=i){const a=new ji(t.slice(r,r+i),e);s.push(a)}return s}getType(){return"MultiPoint"}intersectsExtent(t){const e=this.flatCoordinates,i=this.stride;for(let s=0,r=e.length;s<r;s+=i){const o=e[s],a=e[s+1];if(No(t,o,a))return!0}return!1}setCoordinates(t,e){this.setLayout(e,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Er(this.flatCoordinates,0,t,this.stride),this.changed()}}class Or extends Bi{constructor(t,e,i){if(super(),this.endss_=[],this.flatInteriorPointsRevision_=-1,this.flatInteriorPoints_=null,this.maxDelta_=-1,this.maxDeltaRevision_=-1,this.orientedRevision_=-1,this.orientedFlatCoordinates_=null,!i&&!Array.isArray(t[0])){const s=t,r=[],o=[];for(let a=0,l=s.length;a<l;++a){const h=s[a],c=r.length,u=h.getEnds();for(let d=0,f=u.length;d<f;++d)u[d]+=c;Te(r,h.getFlatCoordinates()),o.push(u)}e=s.length===0?this.getLayout():s[0].getLayout(),t=r,i=o}e!==void 0&&i?(this.setFlatCoordinates(e,t),this.endss_=i):this.setCoordinates(t,e)}appendPolygon(t){let e;if(!this.flatCoordinates)this.flatCoordinates=t.getFlatCoordinates().slice(),e=t.getEnds().slice(),this.endss_.push();else{const i=this.flatCoordinates.length;Te(this.flatCoordinates,t.getFlatCoordinates()),e=t.getEnds().slice();for(let s=0,r=e.length;s<r;++s)e[s]+=i}this.endss_.push(e),this.changed()}clone(){const t=this.endss_.length,e=new Array(t);for(let s=0;s<t;++s)e[s]=this.endss_[s].slice();const i=new Or(this.flatCoordinates.slice(),this.layout,e);return i.applyProperties(this),i}closestPointXY(t,e,i,s){return s<fn(this.getExtent(),t,e)?s:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(s_(this.flatCoordinates,0,this.endss_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),r_(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,this.maxDelta_,!0,t,e,i,s))}containsXY(t,e){return u_(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,t,e)}getArea(){return n_(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride)}getCoordinates(t){let e;return t!==void 0?(e=this.getOrientedFlatCoordinates().slice(),yc(e,0,this.endss_,this.stride,t)):e=this.flatCoordinates,fa(e,0,this.endss_,this.stride)}getEndss(){return this.endss_}getFlatInteriorPoints(){if(this.flatInteriorPointsRevision_!=this.getRevision()){const t=Vc(this.flatCoordinates,0,this.endss_,this.stride);this.flatInteriorPoints_=fc(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,t),this.flatInteriorPointsRevision_=this.getRevision()}return this.flatInteriorPoints_}getInteriorPoints(){return new Mr(this.getFlatInteriorPoints().slice(),"XYM")}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){const t=this.flatCoordinates;__(t,0,this.endss_,this.stride)?this.orientedFlatCoordinates_=t:(this.orientedFlatCoordinates_=t.slice(),this.orientedFlatCoordinates_.length=yc(this.orientedFlatCoordinates_,0,this.endss_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(t){const e=[],i=[];return e.length=h_(this.flatCoordinates,0,this.endss_,this.stride,Math.sqrt(t),e,0,i),new Or(e,"XY",i)}getPolygon(t){if(t<0||this.endss_.length<=t)return null;let e;if(t===0)e=0;else{const r=this.endss_[t-1];e=r[r.length-1]}const i=this.endss_[t].slice(),s=i[i.length-1];if(e!==0)for(let r=0,o=i.length;r<o;++r)i[r]-=e;return new mi(this.flatCoordinates.slice(e,s),this.layout,i)}getPolygons(){const t=this.layout,e=this.flatCoordinates,i=this.endss_,s=[];let r=0;for(let o=0,a=i.length;o<a;++o){const l=i[o].slice(),h=l[l.length-1];if(r!==0)for(let u=0,d=l.length;u<d;++u)l[u]-=r;const c=new mi(e.slice(r,h),t,l);s.push(c),r=h}return s}getType(){return"MultiPolygon"}intersectsExtent(t){return f_(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,3),this.flatCoordinates||(this.flatCoordinates=[]);const i=a_(this.flatCoordinates,0,t,this.stride,this.endss_);if(i.length===0)this.flatCoordinates.length=0;else{const s=i[i.length-1];this.flatCoordinates.length=s.length===0?0:s[s.length-1]}this.changed()}}const $c=re();class Zt{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"?Mh(this.flatCoordinates_):zo(this.flatCoordinates_,0,this.flatCoordinates_.length,2)),this.extent_}getFlatInteriorPoint(){if(!this.flatInteriorPoints_){const t=Xi(this.getExtent());this.flatInteriorPoints_=ma(this.flatCoordinates_,0,this.ends_,2,t,0)}return this.flatInteriorPoints_}getFlatInteriorPoints(){if(!this.flatInteriorPoints_){const t=xc(this.flatCoordinates_,this.ends_),e=Vc(this.flatCoordinates_,0,t,2);this.flatInteriorPoints_=fc(this.flatCoordinates_,0,t,2,e)}return this.flatInteriorPoints_}getFlatMidpoint(){return this.flatMidpoints_||(this.flatMidpoints_=Cr(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=Cr(t,e,o,2,.5);Te(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=mt(t);const e=t.getExtent(),i=t.getWorldExtent();if(e&&i){const s=Dt(i)/Dt(e);Ye($c,i[0],i[3],s,-s,0,0,0),gi(this.flatCoordinates_,0,this.flatCoordinates_.length,2,$c,this.flatCoordinates_)}}applyTransform(t){t(this.flatCoordinates_,this.flatCoordinates_,this.stride_)}clone(){return new Zt(this.type_,this.flatCoordinates_.slice(),this.ends_?.slice(),this.stride_,Object.assign({},this.properties_),this.id_)}getEnds(){return this.ends_}enableSimplifyTransformed(){return this.simplifyTransformed=bh((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=wr(i,0,this.simplifiedGeometry_.flatCoordinates_.length,this.simplifiedGeometry_.stride_,t,i,0),s=[i.length];break;case"MultiLineString":s=[],i.length=dc(i,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,t,i,0,s);break;case"Polygon":s=[],i.length=ga(i,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,Math.sqrt(t),i,0,s);break}return s&&(this.simplifiedGeometry_=new Zt(this.type_,i,s,2,this.properties_,this.id_)),this.squaredTolerance_=t,this.simplifiedGeometry_}),this}}Zt.prototype.getFlatCoordinates=Zt.prototype.getOrientedFlatCoordinates;function Bc(n,t,e=0,i=n.length-1,s=am){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));Bc(n,t,f,g,s)}const r=n[t];let o=e,a=i;for(ys(n,e,t),s(n[i],r)>0&&ys(n,e,i);o<a;){for(ys(n,o,a),o++,a--;s(n[o],r)<0;)o++;for(;s(n[a],r)>0;)a--}s(n[e],r)===0?ys(n,e,a):(a++,ys(n,a,i)),a<=t&&(e=a+1),t<=a&&(i=a-1)}}function ys(n,t,e){const i=n[t];n[t]=n[e],n[e]=i}function am(n,t){return n<t?-1:n>t?1:0}let Kc=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(!Dr(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;Dr(t,l)&&(e.leaf?i.push(a):Ga(t,l)?this._all(a,i):r.push(a))}e=r.pop()}return i}collides(t){let e=this.data;if(!Dr(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(Dr(t,o)){if(e.leaf||Ga(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=In([]),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=lm(t,i.children,e);if(c!==-1)return i.children.splice(c,1),r.push(i),this._condense(r),this}!h&&!i.leaf&&Ga(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=In(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=In([]),a.leaf=!1,a.height=s;const l=Math.ceil(r/o),h=l*Math.ceil(Math.sqrt(o));jc(t,e,i,h,this.compareMinX);for(let c=e;c<=i;c+=h){const u=Math.min(c+h-1,i);jc(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=Na(h),u=um(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=In(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=In([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=xs(t,0,a,this.toBBox),h=xs(t,a,i,this.toBBox),c=dm(l,h),u=Na(l)+Na(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:hm,r=t.leaf?this.compareMinY:cm,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=xs(t,0,e,r),a=xs(t,i-e,i,r);let l=Fr(o)+Fr(a);for(let h=e;h<i-e;h++){const c=t.children[h];Es(o,t.leaf?r(c):c),l+=Fr(o)}for(let h=i-e-1;h>=e;h--){const c=t.children[h];Es(a,t.leaf?r(c):c),l+=Fr(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 lm(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){xs(n,0,n.children.length,t,n)}function xs(n,t,e,i,s){s||(s=In(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 hm(n,t){return n.minX-t.minX}function cm(n,t){return n.minY-t.minY}function Na(n){return(n.maxX-n.minX)*(n.maxY-n.minY)}function Fr(n){return n.maxX-n.minX+(n.maxY-n.minY)}function um(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 dm(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 Ga(n,t){return n.minX<=t.minX&&n.minY<=t.minY&&t.maxX<=n.maxX&&t.maxY<=n.maxY}function Dr(n,t){return t.minX<=n.maxX&&t.minY<=n.maxY&&t.maxX>=n.minX&&t.maxY>=n.minY}function In(n){return{children:n,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function jc(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;Bc(n,o,t,e,s),r.push(t,o,o,e)}}class Uc{constructor(t){this.rbush_=new Kc(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_[B(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_[B(a)]=l}this.rbush_.load(i)}remove(t){const e=B(t),i=this.items_[e];return delete this.items_[e],this.rbush_.remove(i)!==null}update(t,e){const i=this.items_[B(e)],s=[i.minX,i.minY,i.maxX,i.maxY];_n(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 Gi(this.items_)}clear(){this.rbush_.clear(),this.items_={}}getExtent(t){const e=this.rbush_.toJSON();return Ge(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 Zc extends me{constructor(t){super(),this.projection=mt(t.projection),this.attributions_=Hc(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_=Hc(t),this.changed()}setState(t){this.state_=t,this.changed()}}function Hc(n){return n?typeof n=="function"?n:(Array.isArray(n)||(n=[n]),t=>n):null}const he={ADDFEATURE:"addfeature",CHANGEFEATURE:"changefeature",CLEAR:"clear",REMOVEFEATURE:"removefeature",FEATURESLOADSTART:"featuresloadstart",FEATURESLOADEND:"featuresloadend",FEATURESLOADERROR:"featuresloaderror"};class yi extends Ne{constructor(t,e,i){super(t),this.feature=e,this.features=i}}class fm extends Zc{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_=Jn,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_=Wc(this.url_,this.format_)),this.strategy_=t.strategy!==void 0?t.strategy:om;const e=t.useSpatialIndex!==void 0?t.useSpatialIndex:!0;this.featuresRtree_=e?new Uc:null,this.loadedExtentsRtree_=new Uc,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 ne(s)),s!==void 0&&this.addFeaturesInternal(s),i!==void 0&&this.bindFeaturesCollection_(i)}addFeature(t){this.addFeatureInternal(t),this.changed()}addFeatureInternal(t){const e=B(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 yi(he.ADDFEATURE,t))}setupChangeEvents_(t,e){e instanceof Zt||(this.featureChangeKeys_[t]=[q(e,V.CHANGE,this.handleFeatureChange_,this),q(e,dn.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 Zt){const r=this.idIndex_[s];r instanceof Zt?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=B(a);this.addToIndex_(l,a)&&i.push(a)}for(let r=0,o=i.length;r<o;r++){const a=i[r],l=B(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(he.ADDFEATURE))for(let r=0,o=i.length;r<o;r++)this.dispatchEvent(new yi(he.ADDFEATURE,i[r]))}bindFeaturesCollection_(t){let e=!1;this.addEventListener(he.ADDFEATURE,function(i){e||(e=!0,t.push(i.feature),e=!1)}),this.addEventListener(he.REMOVEFEATURE,function(i){e||(e=!0,t.remove(i.feature),e=!1)}),t.addEventListener(Yt.ADD,i=>{e||(e=!0,this.addFeature(i.element),e=!1)}),t.addEventListener(Yt.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(rt);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 yi(he.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 Zt||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 Zt||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(),Gi(this.nullGeometryFeatures_)||Te(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=Gh(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||qn,this.featuresRtree_.forEachInExtent(l,function(h){if(e(h)){const c=h.getGeometry(),u=a;if(a=c instanceof Zt?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)??null}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=B(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 yi(he.CHANGEFEATURE,e))}hasFeature(t){const e=t.getId();return e!==void 0?e in this.idIndex_:B(t)in this.uidIndex_}isEmpty(){return this.featuresRtree_?this.featuresRtree_.isEmpty()&&Gi(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 yi(he.FEATURESLOADSTART)),this.loader_.call(this,l,e,i,c=>{--this.loadingExtentsCount_,this.dispatchEvent(new yi(he.FEATURESLOADEND,void 0,c))},()=>{--this.loadingExtentsCount_,this.dispatchEvent(new yi(he.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(_n(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=B(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(rt),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(he.REMOVEFEATURE)&&this.dispatchEvent(new yi(he.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(Wc(t,this.format_))}setOverlaps(t){this.overlaps_=t,this.changed()}}class Ht{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 Ht({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=ds(null,t.src,{crossOrigin:"anonymous"},void 0,t.offset?null:t.color?t.color:null,!(t.offset&&t.size));e.ready().then(()=>{this.patternImage_=null}),e.getImageState()===$.IDLE&&e.load(),e.getImageState()===$.LOADING&&(this.patternImage_=e)}this.color_=t}getKey(){const t=this.getColor();return t?t instanceof CanvasPattern||t instanceof CanvasGradient?B(t):typeof t=="object"&&"src"in t?t.src+":"+t.offset:Hi(t).toString():""}loading(){return!!this.patternImage_}ready(){return this.patternImage_?this.patternImage_.ready():Promise.resolve()}}class pe{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.offset_=t.offset,this.width_=t.width}clone(){const t=this.getColor();return new pe({color:Array.isArray(t)?t.slice():t||void 0,lineCap:this.getLineCap(),lineDash:this.getLineDash()?this.getLineDash().slice():void 0,lineDashOffset:this.getLineDashOffset(),lineJoin:this.getLineJoin(),miterLimit:this.getMiterLimit(),offset:this.getOffset(),width:this.getWidth()})}getColor(){return this.color_}getLineCap(){return this.lineCap_}getLineDash(){return this.lineDash_}getLineDashOffset(){return this.lineDashOffset_}getLineJoin(){return this.lineJoin_}getMiterLimit(){return this.miterLimit_}getOffset(){return this.offset_}getWidth(){return this.width_}setColor(t){this.color_=t}setLineCap(t){this.lineCap_=t}setLineDash(t){this.lineDash_=t}setLineDashOffset(t){this.lineDashOffset_=t}setLineJoin(t){this.lineJoin_=t}setMiterLimit(t){this.miterLimit_=t}setOffset(t){this.offset_=t}setWidth(t){this.width_=t}}function qc(n){return n[0]>0&&n[1]>0}function gm(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 kr{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 kr({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 j()}getImage(t){return j()}getHitDetectionImage(){return j()}getPixelRatio(t){return 1}getImageState(){return j()}getImageSize(){return j()}getOrigin(){return j()}getSize(){return j()}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){j()}load(){j()}unlistenImageChange(t){j()}ready(){return Promise.resolve()}}class Nr extends kr{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()?$.LOADING:$.LOADED,this.imageState_===$.LOADING&&this.ready().then(()=>this.imageState_=$.LOADED),this.render()}clone(){const t=this.getScale(),e=new Nr({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=le.get(i,null)?.getImage(1);if(!s){const r=this.renderOptions_,o=Math.ceil(r.size*t),a=dt(o,o);this.draw_(r,a,t),s=a.canvas;const l=new Pc(s,void 0,null,$.LOADED,null);le.set(i,null,l),createImageBitmap(s).then(h=>{l.setImage(h)})}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}setRadius(t){this.radius!==t&&(this.radius=t,this.render())}getRadius2(){return this.radius2_}setRadius2(t){this.radius2_!==t&&(this.radius2_=t,this.render())}getSize(){return this.size_}getStroke(){return this.stroke_}setStroke(t){this.stroke_=t,this.render()}listenImageChange(t){}load(){}unlistenImageChange(t){}calculateLineJoinSize_(t,e,i){if(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 T=s;s=r,r=T}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),m=Math.sqrt((s+f)*(s+f)+g*g)-s;if(this.radius2_===void 0||t==="bevel")return m*2;const p=s*Math.sin(a),y=Math.sqrt(s*s-p*p),E=r-y,w=Math.sqrt(p*p+E*E)/p;if(w<=i){const T=w*e/2-r-s;return 2*Math.max(m,T)}return m*2}createRenderOptions(){let t=Cn,e=Rn,i=0,s=null,r=0,o,a=0;this.stroke_&&(o=Se(this.stroke_.getColor()??gs),a=this.stroke_.getWidth()??ms,s=this.stroke_.getLineDash(),r=this.stroke_.getLineDashOffset()??0,e=this.stroke_.getLineJoin()??Rn,t=this.stroke_.getLineCap()??Cn,i=this.stroke_.getMiterLimit()??fs);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=Wt),e.fillStyle=Se(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=Hi(i)),i===null?s=1:Array.isArray(i)&&(s=i.length===4?i[3]:1),s===0&&(e=dt(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=Wt,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 Gr extends Nr{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 Gr({fill:this.getFill()?this.getFill().clone():void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,radius:this.getRadius(),scale:Array.isArray(t)?t.slice():t,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()});return e.setOpacity(this.getOpacity()),e}}class yt{constructor(t){t=t||{},this.geometry_=null,this.geometryFunction_=Qc,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 yt({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_=Qc,this.geometry_=t}setZIndex(t){this.zIndex_=t}}function _m(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 za=null;function Jc(n,t){if(!za){const e=new Ht({color:"rgba(255,255,255,0.4)"}),i=new pe({color:"#3399CC",width:1.25});za=[new yt({image:new Gr({fill:e,stroke:i,radius:5}),fill:e,stroke:i})]}return za}function Qc(n){return n.getGeometry()}const mm="#333";let tu=class md{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 Ht({color:mm}),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 md({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 Ht?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_=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 lt={ANIMATING:0,INTERACTING:1},z={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},zr=[z.FILL],xi=[z.STROKE],Ji=[z.BEGIN_PATH],eu=[z.CLOSE_PATH];class ws extends Lc{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],gn(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],m=Go(h,d),m!==_?(f&&(a[l++]=c,a[l++]=u,f=!1),a[l++]=d[0],a[l++]=d[1]):m===Ct.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 _=0,m=g.length;_<m;++_){const p=[];f=this.drawCustomCoordinates_(h,f,g[_],a,p),d.push(p)}this.instructions.push([z.CUSTOM,l,d,t,i,fa,r]),this.hitDetectionInstructions.push([z.CUSTOM,l,d,t,s||i,fa,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([z.CUSTOM,l,u,t,i,os,r]),this.hitDetectionInstructions.push([z.CUSTOM,l,u,t,s||i,os,r]);break;case"LineString":case"Circle":h=t.getFlatCoordinates(),c=this.appendFlatLineCoordinates(h,0,h.length,a,!1,!1),this.instructions.push([z.CUSTOM,l,c,t,i,_i,r]),this.hitDetectionInstructions.push([z.CUSTOM,l,c,t,s||i,_i,r]);break;case"MultiPoint":h=t.getFlatCoordinates(),c=this.appendFlatPointCoordinates(h,a),c>l&&(this.instructions.push([z.CUSTOM,l,c,t,i,_i,r]),this.hitDetectionInstructions.push([z.CUSTOM,l,c,t,s||i,_i,r]));break;case"Point":h=t.getFlatCoordinates(),this.coordinates.push(h[0],h[1]),c=this.coordinates.length,this.instructions.push([z.CUSTOM,l,c,t,i,void 0,r]),this.hitDetectionInstructions.push([z.CUSTOM,l,c,t,s||i,void 0,r]);break}this.endGeometry(e)}beginGeometry(t,e,i){this.beginGeometryInstruction1_=[z.BEGIN_GEOMETRY,e,0,t,i],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[z.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==z.END_GEOMETRY?o=e:r==z.BEGIN_GEOMETRY&&(s[2]=e,Hf(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=Se(i||Wt)}else e.fillStyle=void 0;return e}strokeStyleToState(t,e={}){if(t){const i=t.getColor();e.strokeStyle=Se(i||gs);const s=t.getLineCap();e.lineCap=s!==void 0?s:Cn;const r=t.getLineDash();e.lineDash=r?r.slice():We;const o=t.getLineDashOffset();e.lineDashOffset=o||Ve;const a=t.getLineJoin();e.lineJoin=a!==void 0?a:Rn;const l=t.getWidth();e.lineWidth=l!==void 0?l:ms;const h=t.getMiterLimit();e.miterLimit=h!==void 0?h:fs;const c=t.getOffset();e.strokeOffset=c??z_,e.lineWidth>this.maxLineWidth&&(this.maxLineWidth=e.lineWidth,this.bufferedMaxExtent_=null)}else e.strokeStyle=void 0,e.lineCap=void 0,e.lineDash=null,e.lineDashOffset=void 0,e.lineJoin=void 0,e.lineWidth=void 0,e.miterLimit=void 0,e.strokeOffset=void 0;return e}setFillStrokeStyle(t,e){const i=this.state;this.fillStyleToState(t,i),this.strokeStyleToState(e,i)}createFill(t){const e=t.fillStyle,i=[z.SET_FILL_STYLE,e];return typeof e!="string"&&i.push(t.fillPatternScale),i}applyStroke(t){this.instructions.push(this.createStroke(t))}createStroke(t){return[z.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,c=t.strokeOffset;(t.currentStrokeStyle!=i||t.currentLineCap!=s||r!=t.currentLineDash&&!hi(t.currentLineDash,r)||t.currentLineDashOffset!=o||t.currentLineJoin!=a||t.currentLineWidth!=l||t.currentMiterLimit!=h||t.currentStrokeOffset!=c)&&(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,t.currentStrokeOffset=c)}endGeometry(t){this.beginGeometryInstruction1_[2]=this.instructions.length,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_[2]=this.hitDetectionInstructions.length,this.beginGeometryInstruction2_=null;const e=[z.END_GEOMETRY,t];this.instructions.push(e),this.hitDetectionInstructions.push(e)}getBufferedMaxExtent(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=Ah(this.maxExtent),this.maxLineWidth>0)){const t=this.resolution*(this.maxLineWidth+1)/2;ci(this.bufferedMaxExtent_,t,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_}}class pm extends ws{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&&!gn(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([z.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([z.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||gn(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([z.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([z.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 ym extends ws{constructor(t,e,i,s){super(t,e,i,s)}drawFlatCoordinates_(t,e,i,s,r){const o=this.coordinates.length,a=this.appendFlatLineCoordinates(t,e,i,s,!1,!1);return this.instructions.push([z.MOVE_TO_LINE_TO,o,a,r*this.pixelRatio]),this.hitDetectionInstructions.push([z.MOVE_TO_LINE_TO,o,a,r]),i}drawLineString(t,e,i){const s=this.state,r=s.strokeStyle,o=s.lineWidth,a=s.strokeOffset;if(r===void 0||o===void 0)return;this.updateStrokeStyle(s,this.applyStroke),this.beginGeometry(t,e,i),this.hitDetectionInstructions.push([z.SET_STROKE_STYLE,s.strokeStyle,s.lineWidth,s.lineCap,s.lineJoin,s.miterLimit,We,Ve],Ji);const l=t.getFlatCoordinates(),h=t.getStride();this.drawFlatCoordinates_(l,0,l.length,h,a),this.hitDetectionInstructions.push(xi),this.endGeometry(e)}drawMultiLineString(t,e,i){const s=this.state,r=s.strokeStyle,o=s.lineWidth,a=s.strokeOffset;if(r===void 0||o===void 0)return;this.updateStrokeStyle(s,this.applyStroke),this.beginGeometry(t,e,i),this.hitDetectionInstructions.push([z.SET_STROKE_STYLE,s.strokeStyle,s.lineWidth,s.lineCap,s.lineJoin,s.miterLimit,We,Ve],Ji);const l=t.getEnds(),h=t.getFlatCoordinates(),c=t.getStride();let u=0;for(let d=0,f=l.length;d<f;++d)u=this.drawFlatCoordinates_(h,u,l[d],c,a);this.hitDetectionInstructions.push(xi),this.endGeometry(e)}finish(){const t=this.state;return t.lastStroke!=null&&t.lastStroke!=this.coordinates.length&&this.instructions.push(xi),this.reverseHitDetectionInstructions(),this.state=null,super.finish()}applyStroke(t){t.lastStroke!=null&&t.lastStroke!=this.coordinates.length&&(this.instructions.push(xi),t.lastStroke=this.coordinates.length),t.lastStroke=0,super.applyStroke(t),this.instructions.push(Ji)}}class iu extends ws{constructor(t,e,i,s){super(t,e,i,s)}drawFlatCoordinatess_(t,e,i,s,r){const o=this.state,a=o.fillStyle!==void 0,l=o.strokeStyle!==void 0,h=i.length;this.instructions.push(Ji),this.hitDetectionInstructions.push(Ji);for(let c=0;c<h;++c){const u=i[c],d=this.coordinates.length,f=this.appendFlatLineCoordinates(t,e,u,s,!0,!l);this.instructions.push([z.MOVE_TO_LINE_TO,d,f,r*this.pixelRatio,!0]),this.hitDetectionInstructions.push([z.MOVE_TO_LINE_TO,d,f,r,!0]),l&&(this.instructions.push(eu),this.hitDetectionInstructions.push(eu)),e=u}return a&&(this.instructions.push(zr),this.hitDetectionInstructions.push(zr)),l&&(this.instructions.push(xi),this.hitDetectionInstructions.push(xi)),e}drawCircle(t,e,i){const s=this.state,r=s.fillStyle,o=s.strokeStyle,a=s.strokeOffset;if(r===void 0&&o===void 0||this.handleStrokeOffset_(()=>this.drawCircle(t,e,i)))return;this.setFillStrokeStyles_(),this.beginGeometry(t,e,i),s.fillStyle!==void 0&&this.hitDetectionInstructions.push([z.SET_FILL_STYLE,Wt]),s.strokeStyle!==void 0&&this.hitDetectionInstructions.push([z.SET_STROKE_STYLE,s.strokeStyle,s.lineWidth,s.lineCap,s.lineJoin,s.miterLimit,We,Ve]);const l=t.getFlatCoordinates(),h=t.getStride(),c=this.coordinates.length;this.appendFlatLineCoordinates(l,0,l.length,h,!1,!1);const u=[z.CIRCLE,c,a];this.instructions.push(Ji,u),this.hitDetectionInstructions.push(Ji,u),s.fillStyle!==void 0&&(this.instructions.push(zr),this.hitDetectionInstructions.push(zr)),s.strokeStyle!==void 0&&(this.instructions.push(xi),this.hitDetectionInstructions.push(xi)),this.endGeometry(e)}drawPolygon(t,e,i){const s=this.state,r=s.fillStyle,o=s.strokeStyle,a=s.strokeOffset;if(r===void 0&&o===void 0||this.handleStrokeOffset_(()=>this.drawPolygon(t,e,i)))return;this.setFillStrokeStyles_(),this.beginGeometry(t,e,i),s.fillStyle!==void 0&&this.hitDetectionInstructions.push([z.SET_FILL_STYLE,Wt]),s.strokeStyle!==void 0&&this.hitDetectionInstructions.push([z.SET_STROKE_STYLE,s.strokeStyle,s.lineWidth,s.lineCap,s.lineJoin,s.miterLimit,We,Ve]);const l=t.getEnds(),h=t.getOrientedFlatCoordinates(),c=t.getStride();this.drawFlatCoordinatess_(h,0,l,c,a),this.endGeometry(e)}drawMultiPolygon(t,e,i){const s=this.state,r=s.fillStyle,o=s.strokeStyle,a=s.strokeOffset;if(r===void 0&&o===void 0||this.handleStrokeOffset_(()=>this.drawMultiPolygon(t,e,i)))return;this.setFillStrokeStyles_(),this.beginGeometry(t,e,i),s.fillStyle!==void 0&&this.hitDetectionInstructions.push([z.SET_FILL_STYLE,Wt]),s.strokeStyle!==void 0&&this.hitDetectionInstructions.push([z.SET_STROKE_STYLE,s.strokeStyle,s.lineWidth,s.lineCap,s.lineJoin,s.miterLimit,We,Ve]);const l=t.getEndss(),h=t.getOrientedFlatCoordinates(),c=t.getStride();let u=0;for(let d=0,f=l.length;d<f;++d)u=this.drawFlatCoordinatess_(h,u,l[d],c,a);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]=Ki(e[i],t)}return super.finish()}setFillStrokeStyles_(){const t=this.state;this.updateFillStyle(t,this.createFill),this.updateStrokeStyle(t,this.applyStroke)}handleStrokeOffset_(t){const e=this.state,i=e.fillStyle,s=e.strokeStyle,r=e.strokeOffset;return Math.abs(r)>0&&i!==void 0&&s!==void 0?(e.strokeStyle=void 0,e.strokeOffset=0,t(),e.fillStyle=void 0,e.strokeStyle=s,e.strokeOffset=r,t(),e.fillStyle=i,!0):!1}}function xm(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,_=jt(h,u,g),m=jt(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,_=jt(h,u,g/f),m=jt(c,d,g/f);l.push(_,m),r.push(l),l=[_,m],a=0,o+=s}}return a>0&&r.push(l),r}function Em(n,t,e,i,s){let r=e,o=e,a=0,l=0,h=e,c,u,d,f,g,_,m,p,y,E;for(u=e;u<i;u+=s){const x=t[u],w=t[u+1];g!==void 0&&(y=x-g,E=w-_,f=Math.sqrt(y*y+E*E),m!==void 0&&(l+=d,c=Math.acos((m*y+p*E)/(d*f)),c>n&&(l>a&&(a=l,r=h,o=u),l=0,h=u-s)),d=f,m=y,p=E),g=x,_=w}return l+=f,l>a?[h,u]:[r,o]}const Xr={left:0,center:.5,right:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1};class wm extends ws{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[Wt]={fillStyle:Wt},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(!gt(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 m=t.getEndss();d=[];for(let p=0,y=m.length;p<y;++p)d.push(m[p][0])}this.beginGeometry(t,e,i);const f=o.repeat,g=f?void 0:o.textAlign;let _=0;for(let m=0,p=d.length;m<p;++m){let y;f?y=xm(f*this.resolution,c,_,d[m],u):y=[c.slice(_,d[m])];for(let E=0,x=y.length;E<x;++E){const w=y[E];let T=0,I=w.length;if(g==null){const R=Em(o.maxAngle,w,0,w.length,2);T=R[0],I=R[1]}for(let R=T;R<I;R+=u)a.push(w[R],w[R+1]);const S=a.length;_=d[m],this.drawChars_(l,S),l=S}}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 w=0,T=x.length;w<T;w+=3)o.overflow||d.push(x[w+2]/this.resolution),c.push(x[w],x[w+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((w,T)=>{const I=a[(x+T)*2]===c[T*u]&&a[(x+T)*2+1]===c[T*u+1];return I||--x,I})}this.saveTextStates_();const g=o.backgroundFill?this.createFill(this.fillStyleToState(o.backgroundFill)):null,_=o.backgroundStroke?this.createStroke(this.strokeStyleToState(o.backgroundStroke)):null;this.beginGeometry(t,e,i);let m=o.padding;if(m!=qi&&(o.scale[0]<0||o.scale[1]<0)){let x=o.padding[0],w=o.padding[1],T=o.padding[2],I=o.padding[3];o.scale[0]<0&&(w=-w,I=-I),o.scale[1]<0&&(x=-x,T=-T),m=[x,w,T,I]}const p=this.pixelRatio;this.instructions.push([z.DRAW_IMAGE,l,f,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[1,1],NaN,this.declutterMode_,this.declutterImageWithText_,m==qi?qi:m.map(function(x){return x*p}),g,_,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,d]);const y=1/p,E=g?g.slice(0):null;E&&(E[1]=Wt),this.hitDetectionInstructions.push([z.DRAW_IMAGE,l,f,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[y,y],NaN,this.declutterMode_,this.declutterImageWithText_,m,E,_,this.text_,this.textKey_,this.strokeKey_,this.fillKey_?Wt: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||_s,justify:e.justify,textBaseline:e.textBaseline||Pr,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=Xr[s.textBaseline],c=this.textOffsetY_*l,u=this.text_,d=i?i.lineWidth*Math.abs(s.scale[0])/2:0;this.instructions.push([z.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([z.DRAW_CHARS,t,e,h,s.overflow,a&&Wt,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=Se(o.getColor()||Wt)):(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 _=a.getLineDash(),m=a.getLineDashOffset(),p=a.getWidth(),y=a.getMiterLimit();r.lineCap=a.getLineCap()||Cn,r.lineDash=_?_.slice():We,r.lineDashOffset=m===void 0?Ve:m,r.lineJoin=a.getLineJoin()||Rn,r.lineWidth=p===void 0?ms:p,r.miterLimit=y===void 0?fs:y,r.strokeStyle=Se(a.getColor()||gs)}i=this.textState_;const l=t.getFont()||Oc;W_(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()||Pr,i.backgroundFill=t.getBackgroundFill(),i.backgroundStroke=t.getBackgroundStroke(),i.padding=t.getPadding()||qi,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:B(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:"|"+B(s.fillStyle):""}this.declutterMode_=t.getDeclutterMode(),this.declutterImageWithText_=e}}const vm={Circle:iu,Default:ws,Image:pm,LineString:ym,Polygon:iu,Text:wm};class nu{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=vm[e];r=new o(this.tolerance_,this.maxExtent_,this.resolution_,this.pixelRatio_),s[e]=r}return r}}function Cm(n,t,e,i,s,r,o,a,l,h,c,u,d=!0){let f=n[t],g=n[t+1],_=0,m=0,p=0,y=0;function E(){_=f,m=g,t+=i,f=n[t],g=n[t+1],y+=p,p=Math.sqrt((f-_)*(f-_)+(g-m)*(g-m))}do E();while(t<e-i&&y+p<r);let x=p===0?0:(r-y)/p;const w=jt(_,f,x),T=jt(m,g,x),I=t-i,S=y,R=r+a*l(h,s,c);for(;t<e-i&&y+p<R;)E();x=p===0?0:(R-y)/p;const v=jt(_,f,x),b=jt(m,g,x);let L=!1;if(d)if(u){const D=[w,T,v,b];oc(D,0,4,2,u,D,D),L=D[0]>D[2]}else L=w>v;const O=Math.PI,N=[],M=I+i===t;t=I,p=0,y=S,f=n[t],g=n[t+1];let A;if(M){E(),A=Math.atan2(g-m,f-_),L&&(A+=A>0?-O:O);const D=(v+w)/2,k=(b+T)/2;return N[0]=[D,k,(R-r)/2,A,s],N}s=s.replace(/\n/g," ");for(let D=0,k=s.length;D<k;){E();let G=Math.atan2(g-m,f-_);if(L&&(G+=G>0?-O:O),A!==void 0){let P=G-A;if(P+=P>O?-2*O:P<-O?2*O:0,Math.abs(P)>o)return null}A=G;const W=D;let X=0;for(;D<k;++D){const P=L?k-D-1:D,$t=a*l(h,s[P],c);if(t+i<e&&y+p<r+X+$t/2)break;X+=$t}if(D===W)continue;const J=L?s.substring(k-W,k-D):s.substring(W,D);x=p===0?0:(r+X/2-y)/p;const et=jt(_,f,x),Et=jt(m,g,x);N.push([et,Et,X/2,G,J]),r+=X}return N}class Xa{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 bn=Kt(),Ei=[],$e=[],Be=[],wi=[];function su(n){return n[3].declutterBox}const ru=new RegExp("[֑-ࣿיִ-﷿ﹰ-ﻼࠀ--]");function Ya(n,t){return t==="start"?t=ru.test(n)?"right":"left":t==="end"&&(t=ru.test(n)?"left":"right"),Xr[t]}function Rm(n,t,e){return e>0&&n.push(`
|
|
5
|
-
|
|
6
|
-
`).reduce(
|
|
7
|
-
`){O+=L,L=0,R=u*E+S*d,++M;continue}const W=f[D+1]||l.font;W!==A&&(s&&v.push("font",W),i&&b.push("font",W),A=W),L=Math.max(L,p[N]);const X=[G,R+S*m[N]+u*(m[N]-y[M]),.5*(d+L)+O];R+=m[N],s&&v.push("strokeText",X),i&&b.push("fillText",X),++N}return Array.prototype.push.apply(x,v),Array.prototype.push.apply(x,b),this.labels_[r]=I,I}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 E=r+h>t?t-h:r,x=o+c>e?e-c:o,w=g[3]+E*d[0]+g[1],T=g[0]+x*d[1]+g[2],I=p-g[3],S=y-g[0];(_||u!==0)&&(Ei[0]=I,wi[0]=I,Ei[1]=S,$e[1]=S,$e[0]=I+w,Be[0]=$e[0],Be[1]=S+T,wi[1]=Be[1]);let R;return u!==0?(R=Ye(re(),i,s,1,1,u,-i,-s),pt(R,Ei),pt(R,$e),pt(R,Be),pt(R,wi),Ge(Math.min(Ei[0],$e[0],Be[0],wi[0]),Math.min(Ei[1],$e[1],Be[1],wi[1]),Math.max(Ei[0],$e[0],Be[0],wi[0]),Math.max(Ei[1],$e[1],Be[1],wi[1]),bn)):Ge(Math.min(I,I+w),Math.min(S,S+T),Math.max(I,I+w),Math.max(S,S+T),bn),f&&(p=Math.round(p),y=Math.round(y)),{drawImageX:p,drawImageY:y,drawImageW:E,drawImageH:x,originX:h,originY:c,declutterBox:{minX:bn[0],minY:bn[1],maxX:bn[2],maxY:bn[3],value:m},canvasTransform:R,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,Ei,$e,Be,wi,o,a),B_(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=pt(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.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=Ya(Array.isArray(t)?t[0]:t,r.textAlign||_s),c=Xr[r.textBaseline||Pr],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_&&hi(i,this.renderedTransform_)?c=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),c=gi(this.coordinates,0,this.coordinates.length,2,i,this.pixelCoordinates_),Bg(this.renderedTransform_,i));let u=0;const d=s.length;let f=0,g,_,m,p,y,E,x,w,T,I,S,R,v,b,L,O,N=0,M=0;const A=this.coordinateCache_,D=this.viewRotation_,k=Math.round(Math.atan2(-i[1],i[0])*1e12)/1e12,G={context:t,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:D},W=this.instructions!=s||this.overlaps?0:200;let X,J,et,Et;for(;u<d;){const P=s[u];switch(P[0]){case z.BEGIN_GEOMETRY:X=P[1],Et=P[3],X.getGeometry()?a!==void 0&&!gt(a,Et.getExtent())?u=P[2]+1:++u:u=P[2],h&&(h.zIndex=P[4]);break;case z.BEGIN_PATH:N>W&&(this.fill_(t),N=0),M>W&&(t.stroke(),M=0),!N&&!M&&(t.beginPath(),w=NaN,T=NaN),++u;break;case z.CIRCLE:f=P[1],p=P[2]??0;const ct=c[f],Mt=c[f+1],Nt=c[f+2]-p,St=c[f+3]-p,Pe=Nt-ct,io=St-Mt,Fs=Math.sqrt(Pe*Pe+io*io);t.moveTo(ct+Fs,Mt),t.arc(ct,Mt,Fs,0,2*Math.PI,!0),++u;break;case z.CLOSE_PATH:t.closePath(),++u;break;case z.CUSTOM:f=P[1],g=P[2];const xl=P[3],Le=P[4],we=P[5];G.geometry=xl,G.feature=X,u in A||(A[u]=[]);const Ae=A[u];we?we(c,f,g,2,Ae):(Ae[0]=c[f],Ae[1]=c[f+1],Ae.length=2),h&&(h.zIndex=P[6]),Le(Ae,G),++u;break;case z.DRAW_IMAGE:f=P[1],g=P[2],R=P[3],_=P[4],m=P[5];let bi=P[6];const no=P[7],Ds=P[8],Yn=P[9],so=P[10];let Ot=P[11];const Sy=P[12];let ro=P[13];x=P[14]||"declutter";const ks=P[15];if(!R&&P.length>=20){v=P[19],b=P[20],L=P[21],O=P[22];const ce=this.drawLabelWithPointPlacement_(v,b,L,O);R=ce.label,P[3]=R;const sn=P[23];_=(ce.anchorX-sn)*this.pixelRatio,P[4]=_;const ue=P[24];m=(ce.anchorY-ue)*this.pixelRatio,P[5]=m,bi=R.height,P[6]=bi,ro=R.width,P[13]=ro}let El;P.length>25&&(El=P[25]);let wl,oo,ao;P.length>17?(wl=P[16],oo=P[17],ao=P[18]):(wl=qi,oo=null,ao=null),so&&k?Ot+=D:!so&&!k&&(Ot-=D);let Iy=0;for(;f<g;f+=2){if(El&&El[Iy++]<ro/this.pixelRatio)continue;const ce=this.calculateImageOrLabelDimensions_(R.width,R.height,c[f],c[f+1],ro,bi,_,m,Ds,Yn,Ot,Sy,r,wl,!!oo||!!ao,X),sn=[t,e,R,ce,no,oo,ao];if(l){let ue,Me,de;if(ks){const ut=g-f;if(!ks[ut]){ks[ut]={args:sn,declutterMode:x};continue}const Gt=ks[ut];ue=Gt.args,Me=Gt.declutterMode,delete ks[ut],de=su(ue)}let Ze,He;if(ue&&(Me!=="declutter"||!l.collides(de))&&(Ze=!0),(x!=="declutter"||!l.collides(ce.declutterBox))&&(He=!0),Me==="declutter"&&x==="declutter"){const ut=Ze&&He;Ze=ut,He=ut}Ze&&(Me!=="none"&&l.insert(de),this.replayImageOrLabel_.apply(this,ue)),He&&(x!=="none"&&l.insert(ce.declutterBox),this.replayImageOrLabel_.apply(this,sn))}else this.replayImageOrLabel_.apply(this,sn)}++u;break;case z.DRAW_CHARS:const hd=P[1],cd=P[2],vl=P[3],by=P[4];O=P[5];const Py=P[6],ud=P[7],dd=P[8];L=P[9];const Cl=P[10];v=P[11],Array.isArray(v)&&(v=v.reduce(Tm,"")),b=P[12];const fd=[P[13],P[13]];x=P[14]||"declutter";const Ly=P[15],Rl=this.textStates[b],Ns=Rl.font,Gs=[Rl.scale[0]*ud,Rl.scale[1]*ud];let zs;Ns in this.widths_?zs=this.widths_[Ns]:(zs={},this.widths_[Ns]=zs);const gd=Ea(c,hd,cd,2),_d=Math.abs(Gs[0])*Nc(Ns,v,zs);if(by||_d<=gd){const ce=this.textStates[b].textAlign,sn=(gd-_d)*Ya(v,ce),ue=Cm(c,hd,cd,2,v,sn,Py,Math.abs(Gs[0]),Nc,Ns,zs,k?0:this.viewRotation_,Ly);t:if(ue){const Me=[];let de,Ze,He,ut,Gt;if(L)for(de=0,Ze=ue.length;de<Ze;++de){Gt=ue[de],He=Gt[4],ut=this.createLabel(He,b,"",L),_=Gt[2]+(Gs[0]<0?-Cl:Cl),m=vl*ut.height+(.5-vl)*2*Cl*Gs[1]/Gs[0]-dd;const qe=this.calculateImageOrLabelDimensions_(ut.width,ut.height,Gt[0],Gt[1],ut.width,ut.height,_,m,0,0,Gt[3],fd,!1,qi,!1,X);if(l&&x==="declutter"&&l.collides(qe.declutterBox))break t;Me.push([t,e,ut,qe,1,null,null])}if(O)for(de=0,Ze=ue.length;de<Ze;++de){Gt=ue[de],He=Gt[4],ut=this.createLabel(He,b,O,""),_=Gt[2],m=vl*ut.height-dd;const qe=this.calculateImageOrLabelDimensions_(ut.width,ut.height,Gt[0],Gt[1],ut.width,ut.height,_,m,0,0,Gt[3],fd,!1,qi,!1,X);if(l&&x==="declutter"&&l.collides(qe.declutterBox))break t;Me.push([t,e,ut,qe,1,null,null])}l&&x!=="none"&&l.load(Me.map(su));for(let qe=0,Ay=Me.length;qe<Ay;++qe)this.replayImageOrLabel_.apply(this,Me[qe])}}++u;break;case z.END_GEOMETRY:if(o!==void 0){X=P[1];const ce=o(X,Et,x);if(ce)return ce}++u;break;case z.FILL:W?N++:this.fill_(t),++u;break;case z.MOVE_TO_LINE_TO:for(f=P[1],g=P[2],p=P[3],y=P[4]??!1,J=c[f],et=c[f+1],p&&(E=f,[J,et]=Sr(J,et,y?c[g-4]:void 0,y?c[g-3]:void 0,c[f+2],c[f+3],p)),t.moveTo(J,et),w=J+.5|0,T=et+.5|0,f+=2;f<g;f+=2)J=c[f],et=c[f+1],I=J+.5|0,S=et+.5|0,(f==g-2||I!==w||S!==T)&&(p&&(f==g-2?[J,et]=Sr(J,et,c[f-2],c[f-1],y?c[E+2]:void 0,y?c[E+3]:void 0,p):[J,et]=Sr(J,et,c[f-2],c[f-1],c[f+2],c[f+3],p)),t.lineTo(J,et),w=I,T=S);++u;break;case z.SET_FILL_STYLE:this.alignAndScaleFill_=P[2],N&&(this.fill_(t),N=0,M&&(t.stroke(),M=0)),t.fillStyle=P[1],++u;break;case z.SET_STROKE_STYLE:M&&(t.stroke(),M=0),this.setStrokeStyle_(t,P),++u;break;case z.STROKE:W?M++:t.stroke(),++u;break;default:++u;break}}N&&this.fill_(t),M&&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 Qi=["Polygon","Circle","LineString","Image","Text","Default"],Yr=["Image","Text"],Im=Qi.filter(n=>!Yr.includes(n));let ou=!1,au=!1;function bm(){let n=0;const t=i=>{const s=dt(1,1,null,{willReadFrequently:i});let r=0;const o=performance.now();for(;performance.now()-o<50;++r)s.fillStyle=`rgba(255,0,${r%256},1)`,s.fillRect(0,0,1,1),s.getImageData(0,0,1,1);return n=r>n?r:n,r};ou={[t(!0)]:!0,[t(!1)]:!1,[t(void 0)]:void 0}[n],au=!0}class lu{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_=re(),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 Sm(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){au===!1&&bm(),s=Math.round(s);const a=s*2+1,l=Ye(this.hitDetectionTransform_,s+.5,s+.5,1/e,-1/e,-i,-t[0],-t[1]),h=!this.hitDetectionContext_;h&&(this.hitDetectionContext_=dt(a,a,null,{willReadFrequently:ou}));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=Kt(),is(u,t),ci(u,e*(this.renderBuffer_+s),u));const d=Pm(s);let f;function g(w,T,I){const S=c.getImageData(0,0,a,a).data;for(let R=0,v=d.length;R<v;R++)if(S[d[R]]>0){if(!o||I==="none"||f!=="Image"&&f!=="Text"||o.includes(w)){const b=(d[R]-3)/4,L=s-b%a,O=s-(b/a|0),N=r(w,T,L*L+O*O);if(N)return N}c.clearRect(0,0,a,a);break}}const _=Object.keys(this.executorsByZIndex_).map(Number);_.sort(Re);let m,p,y,E,x;for(m=_.length-1;m>=0;--m){const w=_[m].toString();for(y=this.executorsByZIndex_[w],p=Qi.length-1;p>=0;--p)if(f=Qi[p],E=y[f],E!==void 0&&(x=E.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 gi(a,0,8,2,t,a),a}isEmpty(){return Gi(this.executorsByZIndex_)}execute(t,e,i,s,r,o,a){const l=Object.keys(this.executorsByZIndex_).map(Number);l.sort(a?Zf:Re),o=o||Qi;const h=Qi.length;for(let c=0,u=l.length;c<u;++c){const d=l[c].toString(),f=this.executorsByZIndex_[d];for(let g=0,_=o.length;g<_;++g){const m=o[g],p=f[m];if(p!==void 0){const y=a===null?void 0:p.getZIndexContext(),E=y?y.getContext():t,x=this.maxExtent_&&m!=="Image"&&m!=="Text";if(x&&(E.save(),this.clip(E,i)),!y||m==="Text"||m==="Image"?p.execute(E,e,i,s,r,a):y.pushFunction(w=>p.execute(w,e,i,s,r,a)),x&&E.restore(),y){y.offset();const w=l[c]*h+Qi.indexOf(m);this.deferredZIndexContexts_[w]||(this.deferredZIndexContexts_[w]=[]),this.deferredZIndexContexts_[w].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(Re);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 Wa={};function Pm(n){if(Wa[n]!==void 0)return Wa[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 Wa[n]=s,s}function hu(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 Pn extends kr{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,this.referrerPolicy_=t.referrerPolicy;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||B(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=$.IDLE:o!==void 0&&("complete"in o?o.complete?l=o.src?$.LOADED:$.IDLE:l=$.LOADING:l=$.LOADED),this.color_=t.color!==void 0?Hi(t.color):null,this.iconImage_=ds(o,a,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},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(hu(f[0],f[1],t.width,t.height))};this.listenImageChange(d);return}}h!==void 0&&this.setScale(hu(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 Pn({anchor:this.anchor_.slice(),anchorOrigin:this.anchorOrigin_,anchorXUnits:this.anchorXUnits_,anchorYUnits:this.anchorYUnits_,color:this.color_&&this.color_.slice?this.color_.slice():this.color_||void 0,crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_,offset:this.offset_.slice(),offsetOrigin:this.offsetOrigin_,opacity:this.getOpacity(),rotateWithView:this.getRotateWithView(),rotation:this.getRotation(),scale:t,width:e,height:i,size: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_}setColor(t){const e=t?Hi(t):null;if(this.color_===e||this.color_&&e&&this.color_.length===e.length&&this.color_.every((o,a)=>o===e[a]))return;this.color_=e;const i=this.getSrc(),s=i!==void 0?null:this.getHitDetectionImage(),r=i!==void 0?$.IDLE:this.iconImage_.getImageState();this.iconImage_=ds(s,i,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},r,this.color_)}getImage(t){return this.iconImage_.getImage(t)}getPixelRatio(t){return this.iconImage_.getPixelRatio(t)}getImageSize(){return this.iconImage_.getSize()}getImageState(){return this.iconImage_.getImageState()}getHitDetectionImage(){return this.iconImage_.getHitDetectionImage()}getOrigin(){if(this.origin_)return this.origin_;let t=this.offset_;if(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_=ds(null,t,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},$.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()==$.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()==$.LOADED)return this.iconImage_.getSize()[1]*t[1]}setScale(t){delete this.initialOptions_,super.setScale(t)}listenImageChange(t){this.iconImage_.addEventListener(V.CHANGE,t)}load(){this.iconImage_.load()}unlistenImageChange(t){this.iconImage_.removeEventListener(V.CHANGE,t)}ready(){return this.iconImage_.ready()}}const qt=.5;function cu(n,t,e,i,s,r,o,a,l){const h=l?na(s):s,c=n[0]*qt,u=n[1]*qt,d=dt(c,u);d.imageSmoothingEnabled=!1;const f=d.canvas,g=new j_(d,qt,s,null,o,a,l?yr(Vg(),l):null),_=e.length,m=Math.floor((256*256*256-1)/_),p={};for(let E=1;E<=_;++E){const x=e[E-1],w=x.getStyleFunction()||i;if(!w)continue;let T=w(x,r);if(!T)continue;Array.isArray(T)||(T=[T]);const S=(E*m).toString(16).padStart(7,"#00000");for(let R=0,v=T.length;R<v;++R){const b=T[R],L=b.getGeometryFunction()(x);if(!L||!gt(h,L.getExtent()))continue;const O=b.clone(),N=O.getFill();N&&N.setColor(S);const M=O.getStroke();M&&(M.setColor(S),M.setLineDash(null)),O.setText(void 0);const A=b.getImage();if(A){const W=A.getImageSize();if(!W)continue;const X=dt(W[0],W[1],void 0,{alpha:!1}),J=X.canvas;X.fillStyle=S,X.fillRect(0,0,J.width,J.height),O.setImage(new Pn({img:J,anchor:A.getAnchor(),anchorXUnits:"pixels",anchorYUnits:"pixels",offset:A.getOrigin(),opacity:1,size:A.getSize(),scale:A.getScale(),rotation:A.getRotation(),rotateWithView:A.getRotateWithView()}))}const D=O.getZIndex()||0;let k=p[D];k||(k={},p[D]=k,k.Polygon=[],k.Circle=[],k.LineString=[],k.Point=[]);const G=L.getType();if(G==="GeometryCollection"){const W=L.getGeometriesArrayRecursive();for(let X=0,J=W.length;X<J;++X){const et=W[X];k[et.getType().replace("Multi","")].push(et,O)}}else k[G.replace("Multi","")].push(L,O)}}const y=Object.keys(p).map(Number).sort(Re);for(let E=0,x=y.length;E<x;++E){const w=p[y[E]];for(const T in w){const I=w[T];for(let S=0,R=I.length;S<R;S+=2){g.setStyle(I[S+1]);for(let v=0,b=t.length;v<b;++v)g.setTransform(t[v]),g.drawGeometry(I[S])}}}return d.getImageData(0,0,f.width,f.height)}function uu(n,t,e){const i=[];if(e){const s=Math.floor(Math.round(n[0])*qt),r=Math.floor(Math.round(n[1])*qt),o=(at(s,0,e.width-1)+at(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 du extends Ne{constructor(t,e,i,s){super(t),this.inversePixelTransform=e,this.frameState=i,this.context=s}}const Lm=5;class Am extends ts{constructor(t){super(),this.ready=!0,this.boundHandleImageChange_=this.handleImageChange_.bind(this),this.layer_=t,this.staleKeys_=new Array,this.maxStaleKeys=Lm}getStaleKeys(){return this.staleKeys_}prependStaleKey(t){this.staleKeys_.unshift(t),this.staleKeys_.length>this.maxStaleKeys&&(this.staleKeys_.length=this.maxStaleKeys)}getFeatures(t){return j()}getData(t){return null}prepareFrame(t){return j()}renderFrame(t,e){return j()}forEachFeatureAtCoordinate(t,e,i,s,r){}getLayer(){return this.layer_}handleFontsChanged(){}handleImageChange_(t){const e=t.target;(e.getState()===$.LOADED||e.getState()===$.ERROR)&&this.renderIfReadyAndVisible()}loadImage(t){let e=t.getState();return e!=$.LOADED&&e!=$.ERROR&&t.addEventListener(V.CHANGE,this.boundHandleImageChange_),e==$.IDLE&&(t.load(),e=t.getState()),e==$.LOADED}renderIfReadyAndVisible(){const t=this.getLayer();t&&t.getVisible()&&t.getSourceState()==="ready"&&t.changed()}renderDeferred(t){}disposeInternal(){delete this.layer_,super.disposeInternal()}}const fu=[];let Ln=null;function Mm(){Ln=dt(1,1,void 0,{willReadFrequently:!0})}class gu extends Am{constructor(t){super(t),this.container=null,this.renderedResolution,this.tempTransform=re(),this.pixelTransform=re(),this.inversePixelTransform=re(),this.context=null,this.deferredContext_=null,this.containerReused=!1,this.frameState=null}getImageData(t,e,i){Ln||Mm(),Ln.clearRect(0,0,1,1);let s;try{Ln.drawImage(t,e,i,1,1,0,0,1,1),s=Ln.getImageData(0,0,1,1).data}catch{return Ln=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&&hi(Hi(t.style.backgroundColor),Hi(i)))){const a=t.firstElementChild;pi(a)&&(o=a.getContext("2d"))}if(o&&Hg(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=ae?Sc():document.createElement("div"),r.className=s;let a=r.style;a.position="absolute",a.width="100%",a.height="100%",o=dt();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=ar(i),o=or(i),a=rr(i);pt(e.coordinateToPixelTransform,s),pt(e.coordinateToPixelTransform,r),pt(e.coordinateToPixelTransform,o),pt(e.coordinateToPixelTransform,a);const l=this.inversePixelTransform;pt(l,s),pt(l,r),pt(l,o),pt(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(nt(i)/s*o),l=Math.round(Dt(i)/s*o);Ye(this.pixelTransform,t.size[0]/2,t.size[1]/2,1/o,1/o,r,-a/2,-l/2),rc(this.inversePixelTransform,this.pixelTransform);const h=Zg(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 du(t,this.inversePixelTransform,i,e);s.dispatchEvent(r)}}preRender(t,e){this.frameState=e,!e.declutter&&this.dispatchRenderEvent_(oe.PRERENDER,t,e)}postRender(t,e){e.declutter||this.dispatchRenderEvent_(oe.POSTRENDER,t,e)}renderDeferredInternal(t){}getRenderContext(t){return t.declutter&&!this.deferredContext_&&(this.deferredContext_=new Xa),t.declutter?this.deferredContext_.getContext():this.context}renderDeferred(t){t.declutter&&(this.dispatchRenderEvent_(oe.PRERENDER,this.context,t),t.declutter&&this.deferredContext_&&(this.deferredContext_.draw(this.context),this.deferredContext_.clear()),this.renderDeferredInternal(t),this.dispatchRenderEvent_(oe.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 Ye(this.tempTransform,l,h,c,u,-i,d,f)}disposeInternal(){delete this.frameState,super.disposeInternal()}}class Om extends gu{constructor(t){super(t),this.boundHandleStyleImageChange_=this.handleStyleImageChange_.bind(this),this.animatingOrInteracting_,this.hitDetectionImageData_=null,this.clipExtent_=null,this.extendX_=!1,this.renderedFeatures_=null,this.renderedRevision_=-1,this.renderedResolution_=NaN,this.renderedExtent_=Kt(),this.wrappedRenderedExtent_=Kt(),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,_=!(g[lt.ANIMATING]||g[lt.INTERACTING]),m=this.context,p=Math.round(nt(s)/a*f),y=Math.round(Dt(s)/a*f),E=u.getWrapX()&&l.canWrapX(),x=E?nt(c):null,w=E?Math.ceil((s[2]-c[2])/x)+(this.extendX_?2:1):1;let T=E?Math.floor((s[0]-c[0])/x)-(this.extendX_?1:0):0;do{let I=this.getRenderTransform(o,a,0,f,p,y,T*x);e.declutter&&(I=I.slice(0)),t.execute(m,[m.canvas.width,m.canvas.height],I,h,_,i===void 0?Qi:i?Yr:Im,i?d&&e.declutter[d]:void 0)}while(++T<w)}setDrawContext_(){this.opacity_!==1&&(this.targetContext_=this.context,this.context=dt(this.context.canvas.width,this.context.canvas.height,fu))}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,ls(this.context),fu.push(this.context.canvas),this.context=this.targetContext_,this.targetContext_=null}}renderDeclutter(t){!this.replayGroup_||!this.getLayer().getDeclutter()||this.renderWorlds(this.replayGroup_,t,!0)}renderDeferredInternal(t){this.replayGroup_&&(this.clipExtent_&&this.clipUnrotated(this.context,t,this.clipExtent_),this.replayGroup_.renderDeferred(),this.clipExtent_&&(this.context.restore(),this.clipExtent_=null),this.resetDrawContext_())}renderFrame(t,e){const i=t.layerStatesArray[t.layerIndex];this.opacity_=i.opacity;const s=t.viewState;this.prepareContainer(t,e);const r=this.context,o=this.replayGroup_;let a=o&&!o.isEmpty();if(!a&&!(this.getLayer().hasListener(oe.PRERENDER)||this.getLayer().hasListener(oe.POSTRENDER)))return this.container;this.setDrawContext_(),this.preRender(r,t),s.projection,this.clipExtent_=null;let l=!1;if(a&&i.extent&&this.clipping){const h=fi(i.extent);a=gt(h,t.extent),a&&!zi(h,t.extent)&&(t.declutter?this.clipExtent_=h:(this.clipUnrotated(r,t,h),l=!0))}return a&&this.renderWorlds(o,t,this.getLayer().getDeclutter()?!1:void 0),l&&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]*qt,d=i[1]*qt;c.push(this.getRenderTransform(s,r,o,qt,u,d,0).slice());const f=h.getSource(),g=a.getExtent();if(f.getWrapX()&&a.canWrapX()&&!zi(g,l)){let _=l[0];const m=nt(g);let p=0,y;for(;_<g[0];)--p,y=m*p,c.push(this.getRenderTransform(s,r,o,qt,u,d,y).slice()),_+=m;for(p=0,_=l[2];_>g[2];)++p,y=m*p,c.push(this.getRenderTransform(s,r,o,qt,u,d,y).slice()),_-=m}this.hitDetectionImageData_=cu(i,c,this.renderedFeatures_,h.getStyleFunction(),l,r,o,ka(r,this.renderedPixelRatio_),null)}e(uu(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 _=B(d),m=h[_];if(m){if(m!==!0&&g<m.distanceSq){if(g===0)return h[_]=!0,r.splice(r.lastIndexOf(m),1),s(d,l,f);m.geometry=f,m.distanceSq=g}}else{if(g===0)return h[_]=!0,s(d,l,f);r.push(h[_]={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[lt.ANIMATING],r=t.viewHints[lt.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 _=e.getRenderOrder();_===void 0&&(_=Z_);const m=h.center.slice(),p=ci(l,g*u),y=p.slice(),E=[p.slice()],x=c.getExtent(),w=i.getWrapX()&&c.canWrapX();if(this.extendX_=!1,w){const M=i.getExtent();M&&!mn(M)&&(this.extendX_=M[0]<x[0]||M[2]>x[2])}if(w&&(!zi(x,t.extent)||this.extendX_)){const M=nt(x),A=Math.max(nt(p)/2,M);let D=x[0],k=x[2];this.extendX_&&(D-=M,k+=M),p[0]=D-A,p[2]=k+A,$o(m,c);const G=Nh(E[0],c);G[0]<x[0]&&G[2]<x[2]?E.push([G[0]+M,G[1],G[2]+M,G[3]]):G[0]>x[0]&&G[2]>x[2]&&E.push([G[0]-M,G[1],G[2]-M,G[3]])}if(this.ready&&this.renderedResolution_==u&&this.renderedPixelRatio_===d&&this.renderedRevision_==f&&this.renderedRenderOrder_==_&&this.renderedFrameDeclutter_===!!t.declutter&&zi(this.wrappedRenderedExtent_,p))return hi(this.renderedExtent_,y)||(this.hitDetectionImageData_=null,this.renderedExtent_=y),this.renderedCenter_=m,this.replayGroupChanged=!1,!0;this.replayGroup_=null;const T=new nu(zc(u,d),p,u,d);let I;for(let M=0,A=E.length;M<A;++M)i.loadFeatures(E[M],u,c);const S=ka(u,d);let R=!0;const v=(M,A)=>{let D;const k=M.getStyleFunction()||e.getStyleFunction();if(k&&(D=k(M,u)),D){const G=this.renderFeature(M,S,D,T,I,this.getLayer().getDeclutter(),A);R=R&&!G}},b=na(p),L=i.getFeaturesInExtent(b);_&&L.sort(_);for(let M=0,A=L.length;M<A;++M)v(L[M],M);this.renderedFeatures_=L,this.ready=R;const O=T.finish(),N=new lu(p,u,d,i.getOverlaps(),O,e.getRenderBuffer(),!!t.declutter);return this.renderedResolution_=u,this.renderedRevision_=f,this.renderedRenderOrder_=_,this.renderedFrameDeclutter_=!!t.declutter,this.renderedExtent_=y,this.wrappedRenderedExtent_=p,this.renderedCenter_=m,this.renderedProjection_=c,this.renderedPixelRatio_=d,this.replayGroup_=N,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=Lr(s,t,i[h],e,this.boundHandleStyleImageChange_,r,o,a)||l;else l=Lr(s,t,i,e,this.boundHandleStyleImageChange_,r,o,a);return l}}let tn=0;const kt=1<<tn++,U=1<<tn++,Vt=1<<tn++,ye=1<<tn++,en=1<<tn++,vs=1<<tn++,Wr=Math.pow(2,tn)-1,Va={[kt]:"boolean",[U]:"number",[Vt]:"string",[ye]:"color",[en]:"number[]",[vs]:"size"},Fm=Object.keys(Va).map(Number).sort(Re);function Dm(n){return n in Va}function Cs(n){const t=[];for(const e of Fm)Rs(n,e)&&t.push(Va[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 vi(n,t){return n===t}class xt{constructor(t,e){if(!Dm(t))throw new Error(`literal expressions must have a specific type, got ${Cs(t)}`);this.type=t,this.value=e}}class km{constructor(t,e,...i){this.type=t,this.operator=e,this.args=i}}function _u(){return{variables:new Set,properties:new Set,featureId:!1,geometryType:!1,mapState:!1}}function Rt(n,t,e){switch(typeof n){case"boolean":{if(vi(t,Vt))return new xt(Vt,n?"true":"false");if(!Rs(t,kt))throw new Error(`got a boolean, but expected ${Cs(t)}`);return new xt(kt,n)}case"number":{if(vi(t,vs))return new xt(vs,Pt(n));if(vi(t,kt))return new xt(kt,!!n);if(vi(t,Vt))return new xt(Vt,n.toString());if(!Rs(t,U))throw new Error(`got a number, but expected ${Cs(t)}`);return new xt(U,n)}case"string":{if(vi(t,ye))return new xt(ye,Pa(n));if(vi(t,kt))return new xt(kt,!!n);if(!Rs(t,Vt))throw new Error(`got a string, but expected ${Cs(t)}`);return new xt(Vt,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 jm(n,t,e);for(const i of n)if(typeof i!="number")throw new Error("expected an array of numbers");if(vi(t,vs)){if(n.length!==2)throw new Error(`expected an array of two values for a size, got ${n.length}`);return new xt(vs,n)}if(vi(t,ye)){if(n.length===3)return new xt(ye,[...n,1]);if(n.length===4)return new xt(ye,n);throw new Error(`expected an array of 3 or 4 values for a color, got ${n.length}`)}if(!Rs(t,en))throw new Error(`got an array of numbers, but expected ${Cs(t)}`);return new xt(en,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"},Nm={[C.Get]:Y(K(1,1/0),mu),[C.Var]:Y(K(1,1),Gm),[C.Has]:Y(K(1,1/0),mu),[C.Id]:Y(zm,An),[C.Concat]:Y(K(2,1/0),tt(Vt)),[C.GeometryType]:Y(Xm,An),[C.LineMetric]:Y(An),[C.Resolution]:Y($a,An),[C.Zoom]:Y($a,An),[C.Time]:Y($a,An),[C.Any]:Y(K(2,1/0),tt(kt)),[C.All]:Y(K(2,1/0),tt(kt)),[C.Not]:Y(K(1,1),tt(kt)),[C.Equal]:Y(K(2,2),tt(Wr)),[C.NotEqual]:Y(K(2,2),tt(Wr)),[C.GreaterThan]:Y(K(2,2),tt(U)),[C.GreaterThanOrEqualTo]:Y(K(2,2),tt(U)),[C.LessThan]:Y(K(2,2),tt(U)),[C.LessThanOrEqualTo]:Y(K(2,2),tt(U)),[C.Multiply]:Y(K(2,1/0),pu),[C.Coalesce]:Y(K(2,1/0),pu),[C.Divide]:Y(K(2,2),tt(U)),[C.Add]:Y(K(2,1/0),tt(U)),[C.Subtract]:Y(K(2,2),tt(U)),[C.Clamp]:Y(K(3,3),tt(U)),[C.Mod]:Y(K(2,2),tt(U)),[C.Pow]:Y(K(2,2),tt(U)),[C.Abs]:Y(K(1,1),tt(U)),[C.Floor]:Y(K(1,1),tt(U)),[C.Ceil]:Y(K(1,1),tt(U)),[C.Round]:Y(K(1,1),tt(U)),[C.Sin]:Y(K(1,1),tt(U)),[C.Cos]:Y(K(1,1),tt(U)),[C.Atan]:Y(K(1,2),tt(U)),[C.Sqrt]:Y(K(1,1),tt(U)),[C.Match]:Y(K(4,1/0),yu,Wm),[C.Between]:Y(K(3,3),tt(U)),[C.Interpolate]:Y(K(6,1/0),yu,Vm),[C.Case]:Y(K(3,1/0),Ym,$m),[C.In]:Y(K(2,2),Bm),[C.Number]:Y(K(1,1/0),tt(Wr)),[C.String]:Y(K(1,1/0),tt(Wr)),[C.Array]:Y(K(1,1/0),tt(U)),[C.Color]:Y(K(1,4),tt(U)),[C.Band]:Y(K(1,3),tt(U)),[C.Palette]:Y(K(2,2),Km),[C.ToString]:Y(K(1,1),tt(kt|U|Vt|ye))};function mu(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 xt(U,o);break}case"string":{s[r]=new xt(Vt,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 Gm(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 xt(Vt,i)]}function zm(n,t,e){e.featureId=!0}function Xm(n,t,e){e.geometryType=!0}function $a(n,t,e){e.mapState=!0}function An(n,t,e){const i=n[0];if(n.length!==1)throw new Error(`expected no arguments for ${i} operation`);return[]}function K(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 pu(n,t,e){const i=n.length-1,s=new Array(i);for(let r=0;r<i;++r){const o=Rt(n[r+1],t,e);s[r]=o}return s}function tt(n){return function(t,e,i){const s=t.length-1,r=new Array(s);for(let o=0;o<s;++o){const a=Rt(t[o+1],n,i);r[o]=a}return r}}function Ym(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 yu(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 Wm(n,t,e){const i=n.length-1,s=Vt|U|kt,r=Rt(n[1],s,e),o=Rt(n[n.length-1],t,e),a=new Array(i-2);for(let l=0;l<i-2;l+=2){try{const h=Rt(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=Rt(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 Vm(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 xt(U,s);let o;try{o=Rt(n[2],U,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=Rt(n[l+3],U,e);a[l]=h}catch(h){throw new Error(`failed to parse argument ${l+2} for interpolate expression: ${h.message}`)}try{const h=Rt(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=Rt(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=Rt(n[r+1],kt,e);s[r]=o}catch(o){throw new Error(`failed to parse argument ${r} of case expression: ${o.message}`)}try{const o=Rt(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 Bm(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=Vt}else s=U;const r=new Array(i.length);for(let a=0;a<r.length;a++)try{const l=Rt(i[a],s,e);r[a]=l}catch(l){throw new Error(`failed to parse haystack item ${a} for "in" expression: ${l.message}`)}return[Rt(n[1],s,e),...r]}function Km(n,t,e){let i;try{i=Rt(n[1],U,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=Rt(s[o],ye,e)}catch(l){throw new Error(`failed to parse color at index ${o} in palette expression: ${l.message}`)}if(!(a instanceof xt))throw new Error(`the palette color at index ${o} must be a literal value`);r[o]=a}return[i,...r]}function Y(...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 km(e,s,...r)}}function jm(n,t,e){const i=n[0],s=Nm[i];if(!s)throw new Error(`unknown operator: ${i}`);return s(n,t,e)}function xu(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 xu(n.getGeometries()[0]);default:return""}}function Eu(){return{variables:{},properties:{},resolution:NaN,featureId:null,geometryType:""}}function Ie(n,t,e){const i=Rt(n,t,e);return xe(i)}function xe(n,t){if(n instanceof xt){if(n.type===ye&&typeof n.value=="string"){const i=Pa(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 Um(n);case C.Get:case C.Var:case C.Has:return Zm(n);case C.Id:return i=>i.featureId;case C.GeometryType:return i=>i.geometryType;case C.Concat:{const i=n.args.map(s=>xe(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 qm(n);case C.Equal:case C.NotEqual:case C.LessThan:case C.LessThanOrEqualTo:case C.GreaterThan:case C.GreaterThanOrEqualTo:return Hm(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 Jm(n);case C.Case:return Qm(n);case C.Match:return tp(n);case C.Interpolate:return ep(n);case C.ToString:return ip(n);default:throw new Error(`Unsupported operator ${e}`)}}function Um(n,t){const e=n.operator,i=n.args.length,s=new Array(i);for(let r=0;r<i;++r)s[r]=xe(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 Zm(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 Hm(n,t){const e=n.operator,i=xe(n.args[0]),s=xe(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 qm(n,t){const e=n.operator,i=n.args.length,s=new Array(i);for(let r=0;r<i;++r)s[r]=xe(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 Jm(n,t){const e=n.operator,i=n.args.length,s=new Array(i);for(let r=0;r<i;++r)s[r]=xe(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 Qm(n,t){const e=n.args.length,i=new Array(e);for(let s=0;s<e;++s)i[s]=xe(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 tp(n,t){const e=n.args.length,i=new Array(e);for(let s=0;s<e;++s)i[s]=xe(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 ep(n,t){const e=n.args.length,i=new Array(e);for(let s=0;s<e;++s)i[s]=xe(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=P_(u)),c>=o)return h===2?u:d?np(r,o,a,l,c,u):Ts(r,o,a,l,c,u);a=c,l=u}return l}}function ip(n,t){const e=n.operator,i=n.args.length,s=new Array(i);for(let r=0;r<i;++r)s[r]=xe(n.args[r]);if(e===C.ToString)return r=>{const o=s[0](r);return n.args[0].type===ye?La(o):o.toString()};throw new Error(`Unsupported convert operator ${e}`)}function Ts(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 np(n,t,e,i,s,r){if(s-e===0)return i;const a=bc(i),l=bc(r);let h=l[2]-a[2];h>180?h-=360:h<-180&&(h+=360);const c=[Ts(n,t,e,a[0],s,l[0]),Ts(n,t,e,a[1],s,l[1]),a[2]+Ts(n,t,e,0,s,h),Ts(n,t,e,i[3],s,r[3])];return L_(c)}function sp(n){return!0}function rp(n){const t=_u(),e=op(n,t),i=Eu();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=xu(s.getGeometry())),e(i)}}function wu(n){const t=_u(),e=n.length,i=new Array(e);for(let o=0;o<e;++o)i[o]=Ba(n[o],t);const s=Eu(),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 op(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?Ie(r.filter,kt,t):sp;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]=Ba(r.style[h],t)}else a=[Ba(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 Ba(n,t){const e=Ss(n,"",t),i=Is(n,"",t),s=ap(n,t),r=lp(n,t),o=Tt(n,"z-index",t);if(!e&&!i&&!s&&!r&&!Gi(n))throw new Error("No fill, stroke, point, or text symbolizer properties in style: "+JSON.stringify(n));const a=new yt;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 Ss(n,t,e){let i;if(t+"fill-pattern-src"in n)i=dp(n,t+"fill-",e);else{if(n[t+"fill-color"]==="none")return r=>null;i=Vr(n,t+"fill-color",e)}if(!i)return null;const s=new Ht;return function(r){const o=i(r);return o===va?null:(s.setColor(o),s)}}function Is(n,t,e){const i=Tt(n,t+"stroke-width",e),s=Vr(n,t+"stroke-color",e);if(!i&&!s)return null;const r=je(n,t+"stroke-line-cap",e),o=je(n,t+"stroke-line-join",e),a=vu(n,t+"stroke-line-dash",e),l=Tt(n,t+"stroke-line-dash-offset",e),h=Tt(n,t+"stroke-miter-limit",e),c=Tt(n,t+"stroke-offset",e),u=new pe;return function(d){if(s){const f=s(d);if(f===va)return null;u.setColor(f)}if(i&&u.setWidth(i(d)),r){const f=r(d);if(f!=="butt"&&f!=="round"&&f!=="square")throw new Error("Expected butt, round, or square line cap");u.setLineCap(f)}if(o){const f=o(d);if(f!=="bevel"&&f!=="round"&&f!=="miter")throw new Error("Expected bevel, round, or miter line join");u.setLineJoin(f)}return a&&u.setLineDash(a(d)),l&&u.setLineDashOffset(l(d)),h&&u.setMiterLimit(h(d)),c&&u.setOffset(c(d)),u}}function ap(n,t){const e="text-",i=je(n,e+"value",t);if(!i)return null;const s=Ss(n,e,t),r=Ss(n,e+"background-",t),o=Is(n,e,t),a=Is(n,e+"background-",t),l=je(n,e+"font",t),h=Tt(n,e+"max-angle",t),c=Tt(n,e+"offset-x",t),u=Tt(n,e+"offset-y",t),d=Mn(n,e+"overflow",t),f=je(n,e+"placement",t),g=Tt(n,e+"repeat",t),_=Br(n,e+"scale",t),m=Mn(n,e+"rotate-with-view",t),p=Tt(n,e+"rotation",t),y=je(n,e+"align",t),E=je(n,e+"justify",t),x=je(n,e+"baseline",t),w=Mn(n,e+"keep-upright",t),T=vu(n,e+"padding",t),I=Kr(n,e+"declutter-mode"),S=new tu({declutterMode:I});return function(R){if(S.setText(i(R)),s&&S.setFill(s(R)),r&&S.setBackgroundFill(r(R)),o&&S.setStroke(o(R)),a&&S.setBackgroundStroke(a(R)),l&&S.setFont(l(R)),h&&S.setMaxAngle(h(R)),c&&S.setOffsetX(c(R)),u&&S.setOffsetY(u(R)),d&&S.setOverflow(d(R)),f){const v=f(R);if(v!=="point"&&v!=="line")throw new Error("Expected point or line for text-placement");S.setPlacement(v)}if(g&&S.setRepeat(g(R)),_&&S.setScale(_(R)),m&&S.setRotateWithView(m(R)),p&&S.setRotation(p(R)),y){const v=y(R);if(v!=="left"&&v!=="center"&&v!=="right"&&v!=="end"&&v!=="start")throw new Error("Expected left, right, center, start, or end for text-align");S.setTextAlign(v)}if(E){const v=E(R);if(v!=="left"&&v!=="right"&&v!=="center")throw new Error("Expected left, right, or center for text-justify");S.setJustify(v)}if(x){const v=x(R);if(v!=="bottom"&&v!=="top"&&v!=="middle"&&v!=="alphabetic"&&v!=="hanging")throw new Error("Expected bottom, top, middle, alphabetic, or hanging for text-baseline");S.setTextBaseline(v)}return T&&S.setPadding(T(R)),w&&S.setKeepUpright(w(R)),S}}function lp(n,t){return"icon-src"in n?hp(n,t):"shape-points"in n?cp(n,t):"circle-radius"in n?up(n,t):null}function hp(n,t){const e="icon-",i=e+"src",s=Su(n[i],i),r=$r(n,e+"anchor",t),o=Br(n,e+"scale",t),a=Tt(n,e+"opacity",t),l=$r(n,e+"displacement",t),h=Tt(n,e+"rotation",t),c=Mn(n,e+"rotate-with-view",t),u=Ru(n,e+"anchor-origin"),d=Tu(n,e+"anchor-x-units"),f=Tu(n,e+"anchor-y-units"),g=Ke(n,e+"color");let _,m=null;g!==void 0&&(Array.isArray(g)&&g.length>0&&typeof g[0]=="string"?m=Vr(n,e+"color",t):_=Iu(g,e+"color"));const p=gp(n,e+"cross-origin"),y=_p(n,e+"offset"),E=Ru(n,e+"offset-origin"),x=Ka(n,e+"width"),w=Ka(n,e+"height"),T=fp(n,e+"size"),I=Kr(n,e+"declutter-mode"),S={src:s,anchorOrigin:u,anchorXUnits:d,anchorYUnits:f,crossOrigin:p,offset:y,offsetOrigin:E,height:w,width:x,size:T,declutterMode:I};let R=null;return function(v){if(R)m&&R.setColor(m(v));else{const b=m?m(v):_;R=new Pn(b!==void 0?Object.assign({},S,{color:b}):Object.assign({},S))}return a&&R.setOpacity(a(v)),l&&R.setDisplacement(l(v)),h&&R.setRotation(h(v)),c&&R.setRotateWithView(c(v)),o&&R.setScale(o(v)),r&&R.setAnchor(r(v)),R}}function cp(n,t){const e="shape-",i=e+"points",s=e+"radius",r=ja(n[i],i);if(!(s in n))throw new Error(`Expected a number for ${s}`);const o=Tt(n,s,t),a=typeof n[s]=="number"?n[s]:5,l=e+"radius2",h=Tt(n,l,t),c=typeof n[l]=="number"?n[l]:void 0,u=Ss(n,e,t),d=Is(n,e,t),f=Br(n,e+"scale",t),g=$r(n,e+"displacement",t),_=Tt(n,e+"rotation",t),m=Mn(n,e+"rotate-with-view",t),p=Ka(n,e+"angle"),y=Kr(n,e+"declutter-mode"),E=new Nr({points:r,radius:a,radius2:c,angle:p,declutterMode:y});return function(x){return o&&E.setRadius(o(x)),h&&E.setRadius2(h(x)),u&&E.setFill(u(x)),d&&E.setStroke(d(x)),g&&E.setDisplacement(g(x)),_&&E.setRotation(_(x)),m&&E.setRotateWithView(m(x)),f&&E.setScale(f(x)),E}}function up(n,t){const e="circle-",i=Ss(n,e,t),s=Is(n,e,t),r=Tt(n,e+"radius",t),o=Br(n,e+"scale",t),a=$r(n,e+"displacement",t),l=Tt(n,e+"rotation",t),h=Mn(n,e+"rotate-with-view",t),c=Kr(n,e+"declutter-mode"),u=new Gr({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 Ke(n,t){if(!(t in n))return;const e=n[t];return e===void 0?void 0:e}function Tt(n,t,e){const i=Ke(n,t);if(i===void 0)return;const s=Ie(i,U,e);return function(r){return ja(s(r),t)}}function je(n,t,e){const i=Ke(n,t);if(i===void 0)return null;const s=Ie(i,Vt,e);return function(r){return Su(s(r),t)}}function dp(n,t,e){const i=je(n,t+"pattern-src",e),s=Cu(n,t+"pattern-offset",e),r=Cu(n,t+"pattern-size",e),o=Vr(n,t+"color",e);return function(a){return{src:i(a),offset:s&&s(a),size:r&&r(a),color:o&&o(a)}}}function Mn(n,t,e){const i=Ke(n,t);if(i===void 0)return null;const s=Ie(i,kt,e);return function(r){const o=s(r);if(typeof o!="boolean")throw new Error(`Expected a boolean for ${t}`);return o}}function Vr(n,t,e){const i=Ke(n,t);if(i===void 0)return null;const s=Ie(i,ye,e);return function(r){return Iu(s(r),t)}}function vu(n,t,e){const i=Ke(n,t);if(i===void 0)return null;if(Array.isArray(i)&&(i.length===0||typeof i[0]!="string")){const r=i.map((o,a)=>{if(typeof o=="number")return()=>o;const l=Ie(o,U,e);return function(h){return ja(l(h),`${t}[${a}]`)}});return function(o){const a=new Array(r.length);for(let l=0;l<r.length;++l)a[l]=r[l](o);return a}}const s=Ie(i,en,e);return function(r){return bs(s(r),t)}}function $r(n,t,e){const i=Ke(n,t);if(i===void 0)return null;const s=Ie(i,en,e);return function(r){const o=bs(s(r),t);if(o.length!==2)throw new Error(`Expected two numbers for ${t}`);return o}}function Cu(n,t,e){const i=Ke(n,t);if(i===void 0)return null;const s=Ie(i,en,e);return function(r){return bu(s(r),t)}}function Br(n,t,e){const i=Ke(n,t);if(i===void 0)return null;const s=Ie(i,en|U,e);return function(r){return mp(s(r),t)}}function Ka(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 fp(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 gp(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 Ru(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 Tu(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 _p(n,t){const e=n[t];if(e!==void 0)return bs(e,t)}function Kr(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 bs(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 Su(n,t){if(typeof n!="string")throw new Error(`Expected a string for ${t}`);return n}function ja(n,t){if(typeof n!="number")throw new Error(`Expected a number for ${t}`);return n}function Iu(n,t){if(typeof n=="string")return n;const e=bs(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 bu(n,t){const e=bs(n,t);if(e.length!==2)throw new Error(`Expected an array of two numbers for ${t}`);return e}function mp(n,t){return typeof n=="number"?n:bu(n,t)}const Ee={CENTER:"center",RESOLUTION:"resolution",ROTATION:"rotation"};function Pu(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,_=n[3]-h/2+u;d>f&&(d=(f+d)/2,f=d),g>_&&(g=(_+g)/2,_=g);let m=at(i[0],d,f),p=at(i[1],g,_);if(o&&e&&s){const y=30*s;m+=-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]-_)/y)}return[m,p]})}function pp(n){return n}function Lu(n){return Math.pow(n,3)}function On(n){return 1-Lu(1-n)}function yp(n){return 3*n*n-2*n*n*n}function xp(n){return n}function Ua(n,t,e,i){const s=nt(t)/e[0],r=Dt(t)/e[1];return i?Math.min(n,Math.max(s,r)):Math.min(n,Math.min(s,r))}function Za(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),at(i,e/2,t*2)}function Ep(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?Ua(l,e,o,i):l;if(a)return t?Za(s,c,h):at(s,h,c);const u=Math.min(c,s),d=Math.floor(Do(n,u,r));return n[d]>c&&d<n.length-1?n[d+1]:n[d]}})}function wp(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?Ua(t,s,l,r):t;if(h)return i?Za(o,c,e):at(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),_=Math.floor(Math.log(t/g)/Math.log(n)+f),m=Math.max(d,_),p=t/Math.pow(n,m);return at(p,e,c)}})}function Au(n,t,e,i,s){return e=e!==void 0?e:!0,(function(r,o,a,l){if(r!==void 0){const h=i?Ua(n,i,a,s):n;return!e||!l?at(r,t,h):Za(r,h,t)}})}function Ha(n){if(n!==void 0)return 0}function Mu(n){if(n!==void 0)return n}function vp(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 Cp(n){const t=di(5);return(function(e,i){return i||e===void 0?e:Math.abs(e)<=t?0:e})}const Ou=42,qa=256,Ja=0;class be extends me{constructor(t){super(),this.on,this.once,this.un,t=Object.assign({},t),this.hints_=[0,0],this.animations_=[],this.updateAnimationKey_,this.projection_=Qo(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&&tc(),t.center&&(t.center=Xe(t.center,this.projection_)),t.extent&&(t.extent=fi(t.extent,this.projection_)),this.applyOptions_(t)}applyOptions_(t){const e=Object.assign({},t);for(const a in Ee)delete e[a];this.setProperties(e,!0);const i=Tp(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=Rp(t),r=i.constraint,o=Sp(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=Xe(s.center,this.getProjection())),s.anchor&&(s=Object.assign({},s),s.anchor=Xe(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&&jr(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||yp,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=pn(c.rotation-l+Math.PI,2*Math.PI)-Math.PI;u.targetRotation=l+d,l=u.targetRotation}Ip(u)?u.complete=!0:r+=u.duration,h.push(u)}this.animations_.push(h),this.setHint(lt.ANIMATING,1),this.updateAnimations_()}getAnimating(){return this.hints_[lt.ANIMATING]>0}getInteracting(){return this.hints_[lt.INTERACTING]>0}cancelAnimations(){this.setHint(lt.ANIMATING,-this.hints_[lt.ANIMATING]);let t;for(let e=0,i=this.animations_.length;e<i;++e){const s=this.animations_[e];if(s[0].callback&&jr(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],_=l.targetCenter[1];this.nextCenter_=l.targetCenter;const m=d+u*(g-d),p=f+u*(_-f);this.targetCenter_=[m,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?pn(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(lt.ANIMATING,-1),this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN;const o=s[0].callback;o&&jr(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]],Vo(i,t-this.getRotation()),ug(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&&ia(t,this.getProjection())}getCenterInternal(){return this.get(Ee.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 na(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"),Yo(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(Ee.RESOLUTION)}getResolutions(){return this.resolutions_}getResolutionForExtent(t,e){return this.getResolutionForExtentInternal(fi(t,this.getProjection()),e)}getResolutionForExtentInternal(t,e){e=e||this.getViewportSizeMinusPadding_();const i=nt(t)/e[0],s=Dt(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(Ee.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=Qa(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=Do(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=at(Math.floor(t),0,this.resolutions_.length-2),i=this.resolutions_[e]/this.resolutions_[e+1];return this.resolutions_[e]/Math.pow(i,at(t-e,0,1))}return this.maxResolution_/Math.pow(this.zoomFactor_,t-this.minZoom_)}fit(t,e){let i;if(Q(Array.isArray(t)||typeof t.getSimplifiedGeometry=="function","Invalid extent or geometry provided as `geometry`"),Array.isArray(t)){Q(!mn(t),"Cannot fit empty extent provided as `geometry`");const s=fi(t,this.getProjection());i=Ec(s)}else if(t.getType()==="Circle"){const s=fi(t.getExtent(),this.getProjection());i=Ec(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,_=this.getConstrainedCenter([f,g],l),m=e.callback?e.callback:Jn;e.duration!==void 0?this.animateInternal({resolution:l,center:_,duration:e.duration,easing:e.easing},m):(this.targetResolution_=l,this.targetCenter_=_,this.applyTargetState_(!1,!0),jr(m,!0))}centerOn(t,e,i){this.centerOnInternal(Xe(t,this.getProjection()),e,i)}centerOnInternal(t,e,i){this.setCenterInternal(Qa(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=Qa(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=ia(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&&Xe(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=Xe(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&&Xe(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(Ee.ROTATION)!==s&&this.set(Ee.ROTATION,s),this.get(Ee.RESOLUTION)!==o&&(this.set(Ee.RESOLUTION,o),this.set("zoom",this.getZoom(),!0)),(!a||!this.get(Ee.CENTER)||!ur(this.get(Ee.CENTER),a))&&this.set(Ee.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()||!ur(this.getCenterInternal(),l))&&(this.getAnimating()&&this.cancelAnimations(),this.animateInternal({rotation:r,center:l,resolution:a,duration:t,easing:On,anchor:i}))}beginInteraction(){this.resolveConstraints(0),this.setHint(lt.INTERACTING,1)}endInteraction(t,e,i){i=i&&Xe(i,this.getProjection()),this.endInteractionInternal(t,e,i)}endInteractionInternal(t,e,i){this.getInteracting()&&(this.setHint(lt.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 jr(n,t){setTimeout(function(){n(t)},0)}function Rp(n){if(n.extent!==void 0){const e=n.smoothExtentConstraint!==void 0?n.smoothExtentConstraint:!0;return Pu(n.extent,n.constrainOnlyCenter,e)}const t=Qo(n.projection,"EPSG:3857");if(n.multiWorld!==!0&&t.isGlobal()){const e=t.getExtent().slice();return e[0]=-1/0,e[2]=1/0,Pu(e,!1,!1)}return pp}function Tp(n){let t,e,i,o=n.minZoom!==void 0?n.minZoom:Ja,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=Qo(n.projection,"EPSG:3857"),f=d.getExtent();let g=n.constrainOnlyCenter,_=n.extent;if(!h&&!_&&d.isGlobal()&&(g=!1,_=f),n.resolutions!==void 0){const m=n.resolutions;e=m[o],i=m[a]!==void 0?m[a]:m[m.length-1],n.constrainResolution?t=Ep(m,c,!g&&_,u):t=Au(e,i,c,!g&&_,u)}else{const p=(f?Math.max(nt(f),Dt(f)):360*Bo.degrees/d.getMetersPerUnit())/qa/Math.pow(2,Ja),y=p/Math.pow(2,28-Ja);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=wp(l,e,i,c,!g&&_,u):t=Au(e,i,c,!g&&_,u)}return{constraint:t,maxResolution:e,minResolution:i,minZoom:o,zoomFactor:l}}function Sp(n){if(n.enableRotation!==void 0?n.enableRotation:!0){const e=n.constrainRotation;return e===void 0||e===!0?Cp():e===!1?Mu:typeof e=="number"?vp(e):Mu}return Ha}function Ip(n){return!(n.sourceCenter&&n.targetCenter&&!ur(n.sourceCenter,n.targetCenter)||n.sourceResolution!==n.targetResolution||n.sourceRotation!==n.targetRotation)}function Qa(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 st={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 Fu extends me{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[st.OPACITY]=t.opacity!==void 0?t.opacity:1,Q(typeof e[st.OPACITY]=="number","Layer opacity must be a number"),e[st.VISIBLE]=t.visible!==void 0?t.visible:!0,e[st.Z_INDEX]=t.zIndex,e[st.MAX_RESOLUTION]=t.maxResolution!==void 0?t.maxResolution:1/0,e[st.MIN_RESOLUTION]=t.minResolution!==void 0?t.minResolution:0,e[st.MIN_ZOOM]=t.minZoom!==void 0?t.minZoom:-1/0,e[st.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=at(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 j()}getLayerStatesArray(t){return j()}getExtent(){return this.get(st.EXTENT)}getMaxResolution(){return this.get(st.MAX_RESOLUTION)}getMinResolution(){return this.get(st.MIN_RESOLUTION)}getMinZoom(){return this.get(st.MIN_ZOOM)}getMaxZoom(){return this.get(st.MAX_ZOOM)}getOpacity(){return this.get(st.OPACITY)}getSourceState(){return j()}getVisible(){return this.get(st.VISIBLE)}getZIndex(){return this.get(st.Z_INDEX)}setBackground(t){this.background_=t,this.changed()}setExtent(t){this.set(st.EXTENT,t)}setMaxResolution(t){this.set(st.MAX_RESOLUTION,t)}setMinResolution(t){this.set(st.MIN_RESOLUTION,t)}setMaxZoom(t){this.set(st.MAX_ZOOM,t)}setMinZoom(t){this.set(st.MIN_ZOOM,t)}setOpacity(t){Q(typeof t=="number","Layer opacity must be a number"),this.set(st.OPACITY,t)}setVisible(t){this.set(st.VISIBLE,t)}setZIndex(t){this.set(st.Z_INDEX,t)}disposeInternal(){this.state_&&(this.state_.layer=null,this.state_=null),super.disposeInternal()}}class Ur extends Fu{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(st.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(st.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_&&(rt(this.sourceChangeKey_),this.sourceChangeKey_=null),this.sourceReady_=!1;const t=this.getSource();t&&(this.sourceChangeKey_=q(t,V.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 be?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 tl(s,e.viewState)&&(!r||gt(r,e.extent))}getAttributions(t){if(!this.isVisible(t))return[];const e=this.getSource()?.getAttributions();if(!e)return[];const i=t instanceof be?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(st.MAP,t)}getMapInternal(){return this.get(st.MAP)}setMap(t){this.mapPrecomposeKey_&&(rt(this.mapPrecomposeKey_),this.mapPrecomposeKey_=null),t||this.changed(),this.mapRenderKey_&&(rt(this.mapRenderKey_),this.mapRenderKey_=null),t&&(this.mapPrecomposeKey_=q(t,oe.PRECOMPOSE,this.handlePrecompose_,this),this.mapRenderKey_=q(this,V.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(st.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 tl(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 Du={RENDER_ORDER:"renderOrder"};class el extends Ur{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(Du.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 Kc(9)),this.getRenderer().renderDeclutter(t,e)}setRenderOrder(t){this.set(Du.RENDER_ORDER,t)}setStyle(t){this.style_=t===void 0?Jc:t;const e=bp(t);this.styleFunction_=t===null?void 0:_m(e),this.changed()}setDeclutter(t){this.declutter_=t?String(t):void 0,this.changed()}}function bp(n){if(n===void 0)return Jc;if(!n)return null;if(typeof n=="function"||n instanceof yt)return n;if(!Array.isArray(n))return wu([n]);if(n.length===0)return[];const t=n.length,e=n[0];if(e instanceof yt){const s=new Array(t);for(let r=0;r<t;++r){const o=n[r];if(!(o instanceof yt))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 rp(s)}return wu(n)}class Pp extends el{constructor(t){super(t)}createRenderer(){return new Om(this)}}const F={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};class Ps extends er{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(V.CHANGE)}release(){this.setState(F.EMPTY)}getKey(){return this.key+"/"+this.tileCoord}getTileCoord(){return this.tileCoord}getState(){return this.state}setState(t){if(this.state!==F.EMPTY){if(this.state!==F.ERROR&&this.state>t)throw new Error("Tile load sequence violation");this.state=t,this.changed()}}load(){j()}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:Lu(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 ku extends Ps{constructor(t,e,i,s,r,o){super(t,e,o),this.crossOrigin_=s?.crossOrigin,this.referrerPolicy_=s?.referrerPolicy,this.src_=i,this.key=i,this.image_,ae?this.image_=new OffscreenCanvas(1,1):(this.image_=new Image,this.crossOrigin_!==null&&(this.image_.crossOrigin=this.crossOrigin_),this.referrerPolicy_!==void 0&&(this.image_.referrerPolicy=this.referrerPolicy_)),this.unlisten_=null,this.tileLoadFunction_=r}getImage(){return this.image_}setImage(t){this.image_=t,this.state=F.LOADED,this.unlistenImage_(),this.changed()}getCrossOrigin(){return this.crossOrigin_}getReferrerPolicy(){return this.referrerPolicy_}handleImageError_(){this.state=F.ERROR,this.unlistenImage_(),this.image_=Lp(),this.changed()}handleImageLoad_(){if(ae)this.state=F.LOADED;else{const t=this.image_;t.naturalWidth&&t.naturalHeight?this.state=F.LOADED:this.state=F.EMPTY}this.unlistenImage_(),this.changed()}load(){this.state==F.ERROR&&(this.state=F.IDLE,this.image_=new Image,this.crossOrigin_!==null&&(this.image_.crossOrigin=this.crossOrigin_),this.referrerPolicy_!==void 0&&(this.image_.referrerPolicy=this.referrerPolicy_)),this.state==F.IDLE&&(this.state=F.LOADING,this.changed(),this.tileLoadFunction_(this,this.src_),this.unlisten_=A_(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 Lp(){const n=dt(1,1);return n.fillStyle="rgba(0,0,0,0)",n.fillRect(0,0,1,1),n.canvas}class Ap{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 Ne{constructor(t,e,i){super(t),this.map=e,this.frameState=i!==void 0?i:null}}class Ci 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 ht={SINGLECLICK:"singleclick",CLICK:V.CLICK,DBLCLICK:V.DBLCLICK,POINTERDRAG:"pointerdrag",POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"},il={POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown"};class Mp extends er{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_=q(i,il.POINTERDOWN,this.handlePointerDown_,this),this.originalPointerMoveEvent_,this.relayedListenerKey_=q(i,il.POINTERMOVE,this.relayMoveEvent_,this),this.boundHandleTouchMove_=this.handleTouchMove_.bind(this),this.element_.addEventListener(V.TOUCHMOVE,this.boundHandleTouchMove_,Cc?{passive:!1}:!1)}emulateClick_(t){let e=new Ci(ht.CLICK,this.map_,t);this.dispatchEvent(e),this.clickTimeoutId_!==void 0?(clearTimeout(this.clickTimeoutId_),this.clickTimeoutId_=void 0,e=new Ci(ht.DBLCLICK,this.map_,t),this.dispatchEvent(e)):this.clickTimeoutId_=setTimeout(()=>{this.clickTimeoutId_=void 0;const i=new Ci(ht.SINGLECLICK,this.map_,t);this.dispatchEvent(i)},250)}updateActivePointers_(t){const e=t,i=e.pointerId;if(e.type==ht.POINTERUP||e.type==ht.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==ht.POINTERDOWN||e.type==ht.POINTERMOVE)&&(this.trackedTouches_[i]=e);this.activePointers_=Object.values(this.trackedTouches_)}handlePointerUp_(t){this.updateActivePointers_(t);const e=new Ci(ht.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(rt),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 Ci(ht.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(q(i,ht.POINTERMOVE,this.handlePointerMove_,this),q(i,ht.POINTERUP,this.handlePointerUp_,this),q(this.element_,ht.POINTERCANCEL,this.handlePointerUp_,this)),this.element_.getRootNode&&this.element_.getRootNode()!==i&&this.dragListenerKeys_.push(q(this.element_.getRootNode(),ht.POINTERUP,this.handlePointerUp_,this))}}handlePointerMove_(t){if(this.isMoving_(t)){this.updateActivePointers_(t),this.dragging_=!0;const e=new Ci(ht.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 Ci(ht.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_&&(rt(this.relayedListenerKey_),this.relayedListenerKey_=null),this.element_.removeEventListener(V.TOUCHMOVE,this.boundHandleTouchMove_),this.pointerdownListenerKey_&&(rt(this.pointerdownListenerKey_),this.pointerdownListenerKey_=null),this.dragListenerKeys_.forEach(rt),this.dragListenerKeys_.length=0,this.element_=null,super.disposeInternal()}}const Ue={POSTRENDER:"postrender",MOVESTART:"movestart",MOVEEND:"moveend",LOADSTART:"loadstart",LOADEND:"loadend"},Lt={LAYERGROUP:"layergroup",SIZE:"size",TARGET:"target",VIEW:"view"},Zr=1/0;class Op{constructor(t,e){this.priorityFunction_=t,this.keyFunction_=e,this.elements_=[],this.priorities_=[],this.queuedElements_={}}clear(){this.elements_.length=0,this.priorities_.length=0,Qn(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!=Zr?(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==Zr?delete this.queuedElements_[this.keyFunction_(o)]:(i[s]=l,e[s++]=o);e.length=s,i.length=s,this.heapify_()}}class Fp extends Op{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(V.CHANGE,this.boundHandleTileChange_),e}getTilesLoading(){return this.tilesLoading_}handleTileChange(t){const e=t.target,i=e.getState();if(i===F.LOADED||i===F.ERROR||i===F.EMPTY){i!==F.ERROR&&e.removeEventListener(V.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()===F.IDLE&&!(r in this.tilesLoadingKeys_)&&(this.tilesLoadingKeys_[r]=!0,++this.tilesLoading_,++i,s.load())}}}function Dp(n,t,e,i,s){if(!n||!(e in n.wantedTiles)||!n.wantedTiles[e][t.getKey()])return Zr;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 nl extends me{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)rt(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!==Jn&&this.listenerKeys.push(q(t,Ue.POSTRENDER,this.render,this)),t.render()}}render(t){}setTarget(t){this.target_=typeof t=="string"?document.getElementById(t):t}}class kp extends nl{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(V.CLICK,this.handleClick_.bind(this),!1);const h=e+" "+br+" "+Ma+(this.collapsed_&&this.collapsible_?" "+Ac:"")+(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=>Jf(()=>s))),i=e.length>0;if(this.renderedVisible_!=i&&(this.element.style.display=i?"":"none",this.renderedVisible_=i),!hi(e,this.renderedAttributions_)){Tc(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(Ac),this.collapsed_?Rc(this.collapseLabel_,this.label_):Rc(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 Np extends nl{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(V.CLICK,this.handleClick_.bind(this),!1);const a=e+" "+br+" "+Ma,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(Ir)}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:On}):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(Ir);!r&&i===0?this.element.classList.add(Ir):r&&i!==0&&this.element.classList.remove(Ir)}this.label_.style.transform=s}this.rotation_=i}}class Gp extends nl{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(V.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(V.CLICK,this.handleClick_.bind(this,-i),!1);const d=e+" "+br+" "+Ma,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:On})):i.setZoom(r)}}}function zp(n){n=n||{};const t=new ne;return(n.zoom===void 0||n.zoom)&&t.push(new Gp(n.zoomOptions)),(n.rotate===void 0||n.rotate)&&t.push(new Np(n.rotateOptions)),(n.attribution===void 0||n.attribution)&&t.push(new kp(n.attributionOptions)),t}const Nu={ACTIVE:"active"};class Ls extends me{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(Nu.ACTIVE)}getMap(){return this.map_}handleEvent(t){return!0}setActive(t){this.set(Nu.ACTIVE,t)}setMap(t){this.map_=t}}function Xp(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:xp,center:n.getConstrainedCenter(s)})}}function sl(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:On})}class Yp extends Ls{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==ht.DBLCLICK){const i=t.originalEvent,s=t.map,r=t.coordinate,o=i.shiftKey?-this.delta_:this.delta_,a=s.getView();sl(a,o,r,this.duration_),i.preventDefault(),e=!0}return!e}}function rl(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 Wp=function(n){const t=n.originalEvent;return t.altKey&&!(t.metaKey||t.ctrlKey)&&t.shiftKey},Vp=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)},Gu=function(n){const t=n.map.getTargetElement(),e=t.getRootNode();return(e instanceof ShadowRoot?e.host:t).hasAttribute("tabindex")?Vp(n):!0},$p=qn,zu=function(n){const t=n.originalEvent;return"pointerId"in t&&t.button==0&&!(p_&&wc&&t.ctrlKey)},Xu=function(n){const t=n.originalEvent;return!t.altKey&&!(t.metaKey||t.ctrlKey)&&!t.shiftKey},Bp=function(n){const t=n.originalEvent;return wc?t.metaKey:t.ctrlKey},Kp=function(n){const t=n.originalEvent;return!t.altKey&&!(t.metaKey||t.ctrlKey)&&t.shiftKey},Yu=function(n){const t=n.originalEvent,e=t.target.tagName;return e!=="INPUT"&&e!=="SELECT"&&e!=="TEXTAREA"&&!t.target.isContentEditable},ol=function(n){const t=n.originalEvent;return"pointerId"in t&&t.pointerType=="mouse"},jp=function(n){const t=n.originalEvent;return"pointerId"in t&&t.isPrimary&&t.button===0};class As extends Ls{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==ht.POINTERDRAG)this.handleDragEvent(t),t.originalEvent.preventDefault();else if(t.type==ht.POINTERUP){const i=this.handleUpEvent(t);this.handlingDownUpSequence=i&&this.targetPointers.length>0}}else if(t.type==ht.POINTERDOWN){const i=this.handleDownEvent(t);this.handlingDownUpSequence=i,e=this.stopDown(i)}else t.type==ht.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 al(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 Up extends As{constructor(t){super({stopDown:tr}),t=t||{},this.kinetic_=t.kinetic,this.lastCentroid=null,this.lastPointersCount_,this.panning_=!1;const e=t.condition?t.condition:rl(Xu,jp);this.condition_=t.onFocusOnly?rl(Gu,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(al(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();dg(r,a.getResolution()),Vo(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:On})}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 Zp extends As{constructor(t){t=t||{},super({stopDown:tr}),this.condition_=t.condition?t.condition:Wp,this.lastAngle_=void 0,this.duration_=t.duration!==void 0?t.duration:250}handleDragEvent(t){if(!ol(t))return;const e=t.map,i=e.getView();if(i.getConstraints().rotation===Ha)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 ol(t)?(t.map.getView().endInteraction(this.duration_),!1):!0}handleDownEvent(t){return ol(t)&&zu(t)&&this.condition_(t)?(t.map.getView().beginInteraction(),this.lastAngle_=void 0,!0):!1}}class Hp extends Qs{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 mi([s])}getGeometry(){return this.geometry_}}const Dn={BOXSTART:"boxstart",BOXDRAG:"boxdrag",BOXEND:"boxend",BOXCANCEL:"boxcancel"};class Ms extends Ne{constructor(t,e,i){super(t),this.coordinate=e,this.mapBrowserEvent=i}}class qp extends As{constructor(t){super(),this.on,this.once,this.un,t=t??{},this.box_=new Hp(t.className||"ol-dragbox"),this.minArea_=t.minArea??64,t.onBoxEnd&&(this.onBoxEnd=t.onBoxEnd),this.startPixel_=null,this.condition_=t.condition??zu,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 Ms(Dn.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 Ms(e?Dn.BOXEND:Dn.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 Ms(Dn.BOXSTART,t.coordinate,t)),!0):!1}onBoxEnd(t){}setActive(t){t||(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new Ms(Dn.BOXCANCEL,this.startPixel_,null)),this.startPixel_=null)),super.setActive(t)}setMap(t){this.getMap()&&(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new Ms(Dn.BOXCANCEL,this.startPixel_,null)),this.startPixel_=null)),super.setMap(t)}}class Jp extends qp{constructor(t){t=t||{};const e=t.condition?t.condition:Kp;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:On})}}const nn={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",DOWN:"ArrowDown"};class Qp extends Ls{constructor(t){super(),t=t||{},this.defaultCondition_=function(e){return Xu(e)&&Yu(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==V.KEYDOWN){const i=t.originalEvent,s=i.key;if(this.condition_(t)&&(s==nn.DOWN||s==nn.LEFT||s==nn.RIGHT||s==nn.UP)){const o=t.map.getView(),a=o.getResolution()*this.pixelDelta_;let l=0,h=0;s==nn.DOWN?h=-a:s==nn.LEFT?l=-a:s==nn.RIGHT?l=a:h=a;const c=[l,h];Vo(c,o.getRotation()),Xp(o,c,this.duration_),i.preventDefault(),e=!0}}return!e}}class t0 extends Ls{constructor(t){super(),t=t||{},this.condition_=t.condition?t.condition:function(e){return!Bp(e)&&Yu(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==V.KEYDOWN||t.type==V.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();sl(a,o,void 0,this.duration_),i.preventDefault(),e=!0}}return!e}}const e0=40,i0=300;class n0 extends Ls{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:$p;this.condition_=t.onFocusOnly?rl(Gu,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!==V.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*=e0;break;case WheelEvent.DOM_DELTA_PAGE:r*=i0;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=-at(this.totalDelta_,-this.maxDelta_*this.deltaPerZoom_,this.maxDelta_*this.deltaPerZoom_)/this.deltaPerZoom_;(e.getConstrainResolution()||this.constrainResolution_)&&(i=i?i>0?1:-1:0),sl(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 s0 extends As{constructor(t){t=t||{};const e=t;e.stopDown||(e.stopDown=tr),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!==Ha&&(this.anchor_=o.getCoordinateFromPixelInternal(o.getEventPixel(al(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 r0 extends As{constructor(t){t=t||{};const e=t;e.stopDown||(e.stopDown=tr),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(al(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 o0(n){n=n||{};const t=new ne,e=new Ap(-.005,.05,100);return(n.altShiftDragRotate===void 0||n.altShiftDragRotate)&&t.push(new Zp),(n.doubleClickZoom===void 0||n.doubleClickZoom)&&t.push(new Yp({delta:n.zoomDelta,duration:n.zoomDuration})),(n.dragPan===void 0||n.dragPan)&&t.push(new Up({onFocusOnly:n.onFocusOnly,kinetic:e})),(n.pinchRotate===void 0||n.pinchRotate)&&t.push(new s0),(n.pinchZoom===void 0||n.pinchZoom)&&t.push(new r0({duration:n.zoomDuration})),(n.keyboard===void 0||n.keyboard)&&(t.push(new Qp),t.push(new t0({delta:n.zoomDelta,duration:n.zoomDuration}))),(n.mouseWheelZoom===void 0||n.mouseWheelZoom)&&t.push(new n0({onFocusOnly:n.onFocusOnly,duration:n.zoomDuration})),(n.shiftDragZoom===void 0||n.shiftDragZoom)&&t.push(new Jp({duration:n.zoomDuration})),t}const Ri={ADDLAYER:"addlayer",REMOVELAYER:"removelayer"};class Ti extends Ne{constructor(t,e){super(t),this.layer=e}}const ll={LAYERS:"layers"};class kn extends Fu{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(ll.LAYERS,this.handleLayersChanged_),i?Array.isArray(i)?i=new ne(i.slice(),{unique:!0}):Q(typeof i.getArray=="function","Expected `layers` to be an array or a `Collection`"):i=new ne(void 0,{unique:!0}),this.setLayers(i)}handleLayerChange_(){this.changed()}handleLayersChanged_(){this.layersListenerKeys_.forEach(rt),this.layersListenerKeys_.length=0;const t=this.getLayers();this.layersListenerKeys_.push(q(t,Yt.ADD,this.handleLayersAdd_,this),q(t,Yt.REMOVE,this.handleLayersRemove_,this));for(const i in this.listenerKeys_)this.listenerKeys_[i].forEach(rt);Qn(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 Ti(Ri.ADDLAYER,r))}this.changed()}registerLayerListeners_(t){const e=[q(t,dn.PROPERTYCHANGE,this.handleLayerChange_,this),q(t,V.CHANGE,this.handleLayerChange_,this)];t instanceof kn&&e.push(q(t,Ri.ADDLAYER,this.handleLayerGroupAdd_,this),q(t,Ri.REMOVELAYER,this.handleLayerGroupRemove_,this)),this.listenerKeys_[B(t)]=e}handleLayerGroupAdd_(t){this.dispatchEvent(new Ti(Ri.ADDLAYER,t.layer))}handleLayerGroupRemove_(t){this.dispatchEvent(new Ti(Ri.REMOVELAYER,t.layer))}handleLayersAdd_(t){const e=t.element;this.registerLayerListeners_(e),this.dispatchEvent(new Ti(Ri.ADDLAYER,e)),this.changed()}handleLayersRemove_(t){const e=t.element,i=B(e);this.listenerKeys_[i].forEach(rt),delete this.listenerKeys_[i],this.dispatchEvent(new Ti(Ri.REMOVELAYER,e)),this.changed()}getLayers(){return this.get(ll.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 Ti(Ri.REMOVELAYER,i[s]))}this.set(ll.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=ze(l.extent,s.extent):l.extent=s.extent),l.zIndex===void 0&&(l.zIndex=r)}return e}getSourceState(){return"ready"}}class a0 extends Qs{constructor(t){super(),this.map_=t}dispatchRenderEvent(t,e){j()}calculateMatrices2D(t){const e=t.viewState,i=t.coordinateToPixelTransform,s=t.pixelToCoordinateTransform;Ye(i,t.size[0]/2,t.size[1]/2,1/e.resolution,-1/e.resolution,-e.rotation,-e.center[0],-e.center[1]),rc(s,i)}forEachFeatureAtCoordinate(t,e,i,s,r,o,a,l){let h;const c=e.viewState;function u(x,w,T,I){return r.call(o,w,x?T:null,I)}const d=c.projection,f=$o(t.slice(),d),g=[[0,0]];if(d.canWrapX()&&s){const x=d.getExtent(),w=nt(x);g.push([-w,0],[w,0])}const _=e.layerStatesArray,m=_.length,p=[],y=[];for(let x=0;x<g.length;x++)for(let w=m-1;w>=0;--w){const T=_[w],I=T.layer;if(I.hasRenderer()&&tl(T,c)&&a.call(l,I)){const S=I.getRenderer(),R=I.getSource();if(S&&R){const v=R.getWrapX()?f:t,b=u.bind(null,T.managed);y[0]=v[0]+g[x][0],y[1]=v[1]+g[x][1],h=S.forEachFeatureAtCoordinate(y,e,i,b,p)}if(h)return h}}if(p.length===0)return;const E=1/p.length;return p.forEach((x,w)=>x.distanceSq+=w*E),p.sort((x,w)=>x.distanceSq-w.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,qn,this,r,o)!==void 0}getMap(){return this.map_}renderFrame(t){j()}scheduleExpireIconCache(t){le.canExpireCache()&&t.postRenderFunctions.push(l0)}}function l0(n,t){le.expire()}class h0 extends a0{constructor(t){super(t),this.fontChangeListenerKey_=q(Tn,dn.PROPERTYCHANGE,t.redrawText,t),this.element_=ae?Sc():document.createElement("div");const e=this.element_.style;e.position="absolute",e.width="100%",e.height="100%",e.zIndex="0",this.element_.className=br+" 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 du(t,void 0,e);i.dispatchEvent(s)}}disposeInternal(){rt(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(oe.PRECOMPOSE,t);const e=t.layerStatesArray.sort((h,c)=>h.zIndex-c.zIndex);e.some(h=>h.layer instanceof el&&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(!tl(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),w_(this.element_,this.children_);const l=this.getMap().getTargetElement();if(pi(l)){const h=l.getContext("2d");for(const c of this.children_){const u=c.firstElementChild||c,d=c.style.backgroundColor;if(d&&(!pi(u)||u.width>0)&&(h.fillStyle=d,h.fillRect(0,0,l.width,l.height)),pi(u)&&u.width>0){h.save();const f=c.style.opacity||u.style.opacity;h.globalAlpha=f===""?1:Number(f);const g=u.style.transform;if(g)h.transform(...aa(g));else{const _=parseFloat(u.style.width)/u.width,m=parseFloat(u.style.height)/u.height;h.transform(_,0,0,m,0,0)}h.drawImage(u,0,0),h.restore()}}}this.dispatchRenderEvent(oe.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 Wu(n){if(n instanceof Ur){n.setMapInternal(null);return}n instanceof kn&&n.getLayers().forEach(Wu)}function Vu(n,t){if(n instanceof Ur){n.setMapInternal(t);return}if(n instanceof kn){const e=n.getLayers().getArray();for(let i=0,s=e.length;i<s;++i)Vu(e[i],t)}}let c0=class extends me{constructor(t){super(),t=t||{},this.on,this.once,this.un;const e=u0(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:y_,this.postRenderTimeoutHandle_,this.animationDelayKey_,this.animationDelay_=this.animationDelay_.bind(this),this.coordinateToPixelTransform_=re(),this.pixelToCoordinateTransform_=re(),this.frameIndex_=0,this.frameState_=null,this.previousExtent_=null,this.viewPropertyListenerKey_=null,this.viewChangeListenerKey_=null,this.layerGroupPropertyListenerKeys_=null,ae||(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,ae||(this.resizeObserver_=new ResizeObserver(()=>this.updateSize())),this.controls=e.controls||(ae?new ne:zp()),this.interactions=e.interactions||(ae?new ne:o0({onFocusOnly:!0})),this.overlays_=e.overlays,this.overlayIdIndex_={},this.renderer_=null,this.postRenderFunctions_=[],this.tileQueue_=new Fp(this.getTilePriority.bind(this),this.handleTileChange_.bind(this)),this.addChangeListener(Lt.LAYERGROUP,this.handleLayerGroupChanged_),this.addChangeListener(Lt.VIEW,this.handleViewChanged_),this.addChangeListener(Lt.SIZE,this.handleSizeChanged_),this.addChangeListener(Lt.TARGET,this.handleTargetChanged_),this.setProperties(e.values);const i=this;t.view&&!(t.view instanceof be)&&t.view.then(function(s){i.setView(new be(s))}),this.controls.addEventListener(Yt.ADD,s=>{s.element.setMap(this)}),this.controls.addEventListener(Yt.REMOVE,s=>{s.element.setMap(null)}),this.interactions.addEventListener(Yt.ADD,s=>{s.element.setMap(this)}),this.interactions.addEventListener(Yt.REMOVE,s=>{s.element.setMap(null)}),this.overlays_.addEventListener(Yt.ADD,s=>{this.addOverlayInternal_(s.element)}),this.overlays_.addEventListener(Yt.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){Vu(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:qn,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 kn?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:qn,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(Lt.TARGET)}getTargetElement(){return this.targetElement_}getCoordinateFromPixel(t){return ia(this.getCoordinateFromPixelInternal(t),this.getView().getProjection())}getCoordinateFromPixelInternal(t){const e=this.frameState_;return e?pt(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(Lt.LAYERGROUP)}setLayers(t){const e=this.getLayerGroup();if(t instanceof ne){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=Xe(t,this.getView().getProjection());return this.getPixelFromCoordinateInternal(e)}getPixelFromCoordinateInternal(t){const e=this.frameState_;return e?pt(e.coordinateToPixelTransform,t.slice(0,2)):null}getPixelRatio(){return this.pixelRatio_}setPixelRatio(t){this.pixelRatio_!==t&&(this.pixelRatio_=t,this.render())}getRenderer(){return this.renderer_}getSize(){return this.get(Lt.SIZE)}getView(){return this.get(Lt.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 Dp(this.frameState_,t,e,i,s)}handleBrowserEvent(t,e){e=e||t.type;const i=new Ci(e,this,t);this.handleMapBrowserEvent(i)}handleMapBrowserEvent(t){if(!this.frameState_)return;const e=t.originalEvent,i=e.type;if(i===il.POINTERDOWN||i===V.WHEEL||i===V.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[lt.ANIMATING]||o[lt.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(oe.RENDERCOMPLETE)&&this.renderer_.dispatchRenderEvent(oe.RENDERCOMPLETE,t),this.loaded_===!1&&(this.loaded_=!0,this.dispatchEvent(new Fn(Ue.LOADEND,this,t)))):this.loaded_===!0&&(this.loaded_=!1,this.dispatchEvent(new Fn(Ue.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)rt(this.targetChangeHandlerKeys_[i]);this.targetChangeHandlerKeys_=null,this.viewport_.removeEventListener(V.CONTEXTMENU,this.boundHandleBrowserEvent_),this.viewport_.removeEventListener(V.WHEEL,this.boundHandleBrowserEvent_),this.mapBrowserEventHandler_.dispose(),this.mapBrowserEventHandler_=null,this.viewport_.remove()}if(this.targetElement_&&!pi(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(pi(e)||e.appendChild(this.viewport_),this.renderer_||(this.renderer_=new h0(this)),!pi(e)){this.mapBrowserEventHandler_=new Mp(this,this.moveTolerance_);for(const s in ht)this.mapBrowserEventHandler_.addEventListener(ht[s],this.handleMapBrowserEvent.bind(this));this.viewport_.addEventListener(V.CONTEXTMENU,this.boundHandleBrowserEvent_,!1),this.viewport_.addEventListener(V.WHEEL,this.boundHandleBrowserEvent_,Cc?{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_=[q(i,V.KEYDOWN,this.handleBrowserEvent,this),q(i,V.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_&&(rt(this.viewPropertyListenerKey_),this.viewPropertyListenerKey_=null),this.viewChangeListenerKey_&&(rt(this.viewChangeListenerKey_),this.viewChangeListenerKey_=null);const t=this.getView();t&&(this.updateViewportSize_(this.getSize()),this.viewPropertyListenerKey_=q(t,dn.PROPERTYCHANGE,this.handleViewPropertyChanged_,this),this.viewChangeListenerKey_=q(t,V.CHANGE,this.handleViewPropertyChanged_,this),t.resolveConstraints(0)),this.render()}handleLayerGroupChanged_(){this.layerGroupPropertyListenerKeys_&&(this.layerGroupPropertyListenerKeys_.forEach(rt),this.layerGroupPropertyListenerKeys_=null);const t=this.getLayerGroup();t&&(this.handleLayerAdd_(new Ti("addlayer",t)),this.layerGroupPropertyListenerKeys_=[q(t,dn.PROPERTYCHANGE,this.render,this),q(t,V.CHANGE,this.render,this),q(t,"addlayer",this.handleLayerAdd_,this),q(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){Wu(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&&qc(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:Yo(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:B(this),renderTargets:{}},a.nextCenter&&a.nextResolution){const l=isNaN(a.nextRotation)?a.rotation:a.nextRotation;r.nextExtent=Yo(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_||!mn(this.previousExtent_)&&!_n(r.extent,this.previousExtent_))&&(this.dispatchEvent(new Fn(Ue.MOVESTART,this,s)),this.previousExtent_=es(this.previousExtent_)),this.previousExtent_&&!r.viewHints[lt.ANIMATING]&&!r.viewHints[lt.INTERACTING]&&!_n(r.extent,this.previousExtent_)&&(this.dispatchEvent(new Fn(Ue.MOVEEND,this,r)),Ah(r.extent,this.previousExtent_))),this.dispatchEvent(new Fn(Ue.POSTRENDER,this,r)),this.renderComplete_=(this.hasListener(Ue.LOADSTART)||this.hasListener(Ue.LOADEND)||this.hasListener(oe.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 Ti("removelayer",e)),this.set(Lt.LAYERGROUP,t)}setSize(t){this.set(Lt.SIZE,t)}setTarget(t){this.set(Lt.TARGET,t)}setView(t){if(!t||t instanceof be){this.set(Lt.VIEW,t);return}this.set(Lt.VIEW,new be);const e=this;t.then(function(i){e.setView(new be(i))})}updateSize(){const t=this.getTargetElement();let e;if(t){let s,r;if(pi(t)){const o=t.getContext("2d").getTransform();s=t.width/o.a,r=t.height/o.d}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)],!qc(e)&&(t.offsetWidth||t.offsetHeight||t.getClientRects().length)&&Yh("No map visible because the map container's width or height are 0."))}const i=this.getSize();e&&(!i||!hi(e,i))&&(this.setSize(e),this.updateViewportSize_(e))}updateViewportSize_(t){const e=this.getView();e&&e.setViewportSize(t)}};function u0(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 kn({layers:n.layers});e[Lt.LAYERGROUP]=i,e[Lt.TARGET]=n.target,e[Lt.VIEW]=n.view instanceof be?n.view:new be;let s;n.controls!==void 0&&(Array.isArray(n.controls)?s=new ne(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 ne(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 ne(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 ne,{controls:s,interactions:r,keyboardEventTarget:t,overlays:o,values:e}}const At={ELEMENT:"element",MAP:"map",OFFSET:"offset",POSITION:"position",POSITIONING:"positioning"};class d0 extends me{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 "+N_,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(At.ELEMENT,this.handleElementChanged),this.addChangeListener(At.MAP,this.handleMapChanged),this.addChangeListener(At.OFFSET,this.handleOffsetChanged),this.addChangeListener(At.POSITION,this.handlePositionChanged),this.addChangeListener(At.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(At.ELEMENT)}getId(){return this.id}getMap(){return this.get(At.MAP)||null}getOffset(){return this.get(At.OFFSET)}getPosition(){return this.get(At.POSITION)}getPositioning(){return this.get(At.POSITIONING)}handleElementChanged(){Tc(this.element);const t=this.getElement();t&&this.element.appendChild(t)}handleMapChanged(){this.mapPostrenderListenerKey&&(this.element?.remove(),rt(this.mapPostrenderListenerKey),this.mapPostrenderListenerKey=null);const t=this.getMap();if(t){this.mapPostrenderListenerKey=q(t,Ue.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(At.ELEMENT,t)}setMap(t){this.set(At.MAP,t)}setOffset(t){this.set(At.OFFSET,t)}setPosition(t){this.set(At.POSITION,t)}performAutoPan(){this.autoPan&&this.panIntoView(this.autoPan)}panIntoView(t){const e=this.getMap();if(!e||!e.getTargetElement()||!this.get(At.POSITION))return;const i=this.getRect(e.getTargetElement(),e.getSize()),s=this.getElement(),r=this.getRect(s,[x_(s),E_(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]],_=t.animation||{};e.getView().animateInternal({center:e.getCoordinateFromPixelInternal(g),duration:_.duration,easing:_.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(At.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 hl{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 Nn(n,t,e,i,s){return s!==void 0?(s.minX=n,s.maxX=t,s.minY=e,s.maxY=i,s):new hl(n,t,e,i)}const $u=[];class f0 extends Ps{constructor(t,e,i,s,r){super(t,e,{transition:0}),this.context_=null,this.executorGroups={},this.loadingSourceTiles=0,this.hitDetectionImageData={},this.replayState_={},this.sourceTiles=[],this.errorTileKeys={},this.wantedResolution,this.getSourceTiles=s.bind(void 0,this),this.removeSourceTiles_=r,this.wrappedTileCoord=i}getContext(){return this.context_||(this.context_=dt(1,1,$u)),this.context_}hasContext(){return!!this.context_}getImage(){return this.hasContext()?this.getContext().canvas:null}getReplayState(t){const e=B(t);return e in this.replayState_||(this.replayState_[e]={dirty:!1,renderedRenderOrder:null,renderedResolution:NaN,renderedPixelRatio:NaN,renderedRevision:-1,renderedTileResolution:NaN,renderedTileRevision:-1,renderedTileZ:-1}),this.replayState_[e]}load(){this.getSourceTiles()}release(){this.context_&&(ls(this.context_),$u.push(this.context_.canvas),this.context_=null),this.removeSourceTiles_(this),this.sourceTiles.length=0,super.release()}}let g0=class extends Ps{constructor(t,e,i,s,r,o){super(t,e,o),this.extent=null,this.format_=s,this.features_=null,this.loader_,this.projection=null,this.resolution,this.tileLoadFunction_=r,this.url_=i,this.key=i}getTileUrl(){return this.url_}getFormat(){return this.format_}getFeatures(){return this.features_}load(){this.state==F.IDLE&&(this.setState(F.LOADING),this.tileLoadFunction_(this,this.url_),this.loader_&&this.loader_(this.extent,this.resolution,this.projection))}onLoad(t,e){this.setFeatures(t)}onError(){this.setState(F.ERROR)}setFeatures(t){this.features_=t,this.setState(F.LOADED)}setLoader(t){this.loader_=t}};function Hr(n,t,e,i){return i!==void 0?(i[0]=n,i[1]=t,i[2]=e,i):[n,t,e]}function _0(n,t,e){return n+"/"+t+"/"+e}function qr(n,t,e,i,s){return`${B(n)},${t},${_0(e,i,s)}`}function m0(n){return p0(n[0],n[1],n[2])}function p0(n,t,e){return(t<<n)+e}function y0(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 Gn=[0,0,0],Si=5;class cl{constructor(t){this.minZoom=t.minZoom!==void 0?t.minZoom:0,this.resolutions_=t.resolutions,Q(qf(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_=ui(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:qa,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 hl(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=Nn(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]}getOrigins(){return this.origins_}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 Nn(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 Nn(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 Nn(h,h,c,c,i);const u=Math.floor(l*(r+1))-1,d=Math.floor(l*(o+1))-1;return Nn(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,Gn);const s=Gn[1],r=Gn[2];this.getTileCoordForXYAndZ_(t[2],t[1],e,!0,Gn);const o=Gn[1],a=Gn[2];return Nn(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 Ge(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=cr(c,Si)-1,u=cr(u,Si)-1):(c=hr(c,Si),u=hr(u,Si)),Hr(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=cr(h,Si)-1,c=cr(c,Si)-1):(h=hr(h,Si),c=hr(c,Si)),Hr(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=Do(this.resolutions_,t,e||0);return at(i,this.minZoom,this.maxZoom)}tileCoordIntersectsViewport(t,e){return _c(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 ul(n){let t=n.getDefaultTileGrid();return t||(t=w0(n),n.setDefaultTileGrid(t)),t}function x0(n,t,e){const i=t[0],s=n.getTileCoordCenter(t),r=Jr(e);if(!gn(r,s)){const o=nt(r),a=Math.ceil((r[0]-s[0])/o);return s[0]+=o*a,n.getTileCoordForCoordAndZ(s,i)}return t}function E0(n,t,e,i){i=i!==void 0?i:"top-left";const s=Ku(n,t,e);return new cl({extent:n,origin:sg(n,i),resolutions:s,tileSize:e})}function Bu(n){const t=n||{},e=t.extent||mt("EPSG:3857").getExtent(),i={extent:e,minZoom:t.minZoom,tileSize:t.tileSize,resolutions:Ku(e,t.maxZoom,t.tileSize,t.maxResolution)};return new cl(i)}function Ku(n,t,e,i){t=t!==void 0?t:Ou,e=Pt(e!==void 0?e:qa);const s=Dt(n),r=nt(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 w0(n,t,e,i){const s=Jr(n);return E0(s,t,e,i)}function Jr(n){n=mt(n);let t=n.getExtent();if(!t){const e=180*Bo.degrees/n.getMetersPerUnit();t=Ge(-e,-e,e,e)}return t}let dl;const zn=[];function ju(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 fl(n,t){return Math.abs(n[t*4]-210)>2||Math.abs(n[t*4+3]-.75*255)>2}function v0(){if(dl===void 0){const n=dt(6,6,zn);n.globalCompositeOperation="lighter",n.fillStyle="rgba(210, 0, 0, 0.75)",ju(n,4,5,4,0),ju(n,4,5,0,5);const t=n.getImageData(0,0,3,3).data;dl=fl(t,0)||fl(t,4)||fl(t,8),ls(n),zn.push(n.canvas)}return dl}function Uu(n,t,e,i){const s=rs(e,t,n);let r=ec(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||gn(l,s)){const h=ec(n,r,s)/r;isFinite(h)&&h>0&&(r/=h)}return r}function C0(n,t,e,i){const s=Xi(e);let r=Uu(n,t,s,i);return(!isFinite(r)||r<=0)&&Dh(e,function(o){return r=Uu(n,t,o,i),isFinite(r)&&r>0}),r}function R0(n,t,e,i,s,r,o,a,l,h,c,u,d,f){const g=dt(Math.round(e*n),Math.round(e*t),zn);if(u||(g.imageSmoothingEnabled=!1),l.length===0)return g.canvas;g.scale(e,e);function _(w){return Math.round(w*e)/e}g.globalCompositeOperation="lighter";const m=Kt();l.forEach(function(w,T,I){Oh(m,w.extent)});let p;const y=e/i,E=(u?1:1+Math.pow(2,-24))/y;p=dt(Math.round(nt(m)*y),Math.round(Dt(m)*y),zn),u||(p.imageSmoothingEnabled=!1),l.forEach(function(w,T,I){if(w.image.width>0&&w.image.height>0){if(w.clipExtent){p.save();const L=(w.clipExtent[0]-m[0])*y,O=-(w.clipExtent[3]-m[3])*y,N=nt(w.clipExtent)*y,M=Dt(w.clipExtent)*y;p.rect(u?L:Math.round(L),u?O:Math.round(O),u?N:Math.round(L+N)-Math.round(L),u?M:Math.round(O+M)-Math.round(O)),p.clip()}const S=(w.extent[0]-m[0])*y,R=-(w.extent[3]-m[3])*y,v=nt(w.extent)*y,b=Dt(w.extent)*y;p.drawImage(w.image,h,h,w.image.width-2*h,w.image.height-2*h,u?S:Math.round(S),u?R:Math.round(R),u?v:Math.round(S+v)-Math.round(S),u?b:Math.round(R+b)-Math.round(R)),w.clipExtent&&p.restore()}});const x=ui(o);return a.getTriangles().forEach(function(w,T,I){const S=w.source,R=w.target;let v=S[0][0],b=S[0][1],L=S[1][0],O=S[1][1],N=S[2][0],M=S[2][1];const A=_((R[0][0]-x[0])/r),D=_(-(R[0][1]-x[1])/r),k=_((R[1][0]-x[0])/r),G=_(-(R[1][1]-x[1])/r),W=_((R[2][0]-x[0])/r),X=_(-(R[2][1]-x[1])/r),J=v,et=b;v=0,b=0,L-=J,O-=et,N-=J,M-=et;const Et=[[L,O,0,0,k-A],[N,M,0,0,W-A],[0,0,L,O,G-D],[0,0,N,M,X-D]],P=hg(Et);if(!P)return;if(g.save(),g.beginPath(),v0()||!u){g.moveTo(k,G);const ct=4,Mt=A-k,Nt=D-G;for(let St=0;St<ct;St++)g.lineTo(k+_((St+1)*Mt/ct),G+_(St*Nt/(ct-1))),St!=ct-1&&g.lineTo(k+_((St+1)*Mt/ct),G+_((St+1)*Nt/(ct-1)));g.lineTo(W,X)}else g.moveTo(k,G),g.lineTo(A,D),g.lineTo(W,X);g.clip(),g.transform(P[0],P[2],P[1],P[3],A,D),g.translate(m[0]-J,m[3]-et);let $t;if(p)$t=p.canvas,g.scale(E,-E);else{const ct=l[0],Mt=ct.extent;$t=ct.image,g.scale(nt(Mt)/$t.width,-Dt(Mt)/$t.height)}g.drawImage($t,0,0),g.restore()}),p&&(ls(p),zn.push(p.canvas)),c&&(g.save(),g.globalCompositeOperation="source-over",g.strokeStyle="black",g.lineWidth=1,a.getTriangles().forEach(function(w,T,I){const S=w.target,R=(S[0][0]-x[0])/r,v=-(S[0][1]-x[1])/r,b=(S[1][0]-x[0])/r,L=-(S[1][1]-x[1])/r,O=(S[2][0]-x[0])/r,N=-(S[2][1]-x[1])/r;g.beginPath(),g.moveTo(b,L),g.lineTo(R,v),g.lineTo(O,N),g.closePath(),g.stroke()}),g.restore()),g.canvas}const T0=10,Zu=.25;class S0{constructor(t,e,i,s,r,o,a){this.sourceProj_=t,this.targetProj_=e;let l={};const h=a?Yg(E=>pt(a,rs(E,this.targetProj_,this.sourceProj_))):$i(this.targetProj_,this.sourceProj_);this.transformInv_=function(E){const x=E[0]+"/"+E[1];return l[x]||(l[x]=h(E)),l[x]},this.maxSourceExtent_=s,this.errorThresholdSquared_=r*r,this.triangles_=[],this.wrapsXInSource_=!1,this.canWrapXInSource_=this.sourceProj_.canWrapX()&&!!s&&!!this.sourceProj_.getExtent()&&nt(s)>=nt(this.sourceProj_.getExtent()),this.sourceWorldWidth_=this.sourceProj_.getExtent()?nt(this.sourceProj_.getExtent()):null,this.targetWorldWidth_=this.targetProj_.getExtent()?nt(this.targetProj_.getExtent()):null;const c=ui(i),u=ar(i),d=or(i),f=rr(i),g=this.transformInv_(c),_=this.transformInv_(u),m=this.transformInv_(d),p=this.transformInv_(f),y=T0+(o?Math.max(0,Math.ceil(Math.log2(Xo(i)/(o*o*256*256)))):0);if(this.addQuad_(c,u,d,f,g,_,m,p,y),this.wrapsXInSource_){let E=1/0;this.triangles_.forEach(function(x,w,T){E=Math.min(E,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])-E>this.sourceWorldWidth_/2){const w=[[x.source[0][0],x.source[0][1]],[x.source[1][0],x.source[1][1]],[x.source[2][0],x.source[2][1]]];w[0][0]-E>this.sourceWorldWidth_/2&&(w[0][0]-=this.sourceWorldWidth_),w[1][0]-E>this.sourceWorldWidth_/2&&(w[1][0]-=this.sourceWorldWidth_),w[2][0]-E>this.sourceWorldWidth_/2&&(w[2][0]-=this.sourceWorldWidth_);const T=Math.min(w[0][0],w[1][0],w[2][0]);Math.max(w[0][0],w[1][0],w[2][0])-T<this.sourceWorldWidth_/2&&(x.source=w)}})}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=ko([r,o,a,l]),u=this.sourceWorldWidth_?nt(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 m=ko([t,e,i,s]);g=nt(m)/this.targetWorldWidth_>Zu||g}!f&&this.sourceProj_.isGlobal()&&u&&(g=u>Zu||g)}if(!g&&this.maxSourceExtent_&&isFinite(c[0])&&isFinite(c[1])&&isFinite(c[2])&&isFinite(c[3])&&!gt(c,this.maxSourceExtent_))return;let _=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(_=(!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),_!=1&&_!=2&&_!=4&&_!=8)return}if(h>0){if(!g){const m=[(t[0]+i[0])/2,(t[1]+i[1])/2],p=this.transformInv_(m);let y;f?y=(pn(r[0],d)+pn(a[0],d))/2-pn(p[0],d):y=(r[0]+a[0])/2-p[0];const E=(r[1]+a[1])/2-p[1];g=y*y+E*E>this.errorThresholdSquared_}if(g){if(Math.abs(t[0]-i[0])<=Math.abs(t[1]-i[1])){const m=[(e[0]+i[0])/2,(e[1]+i[1])/2],p=this.transformInv_(m),y=[(s[0]+t[0])/2,(s[1]+t[1])/2],E=this.transformInv_(y);this.addQuad_(t,e,m,y,r,o,p,E,h-1),this.addQuad_(y,m,i,s,E,p,a,l,h-1)}else{const m=[(t[0]+e[0])/2,(t[1]+e[1])/2],p=this.transformInv_(m),y=[(i[0]+s[0])/2,(i[1]+s[1])/2],E=this.transformInv_(y);this.addQuad_(t,m,y,s,r,p,E,l,h-1),this.addQuad_(m,e,i,y,p,o,a,E,h-1)}return}}if(f){if(!this.canWrapXInSource_)return;this.wrapsXInSource_=!0}(_&11)==0&&this.addTriangle_(t,i,s,r,a,l),(_&14)==0&&this.addTriangle_(t,i,e,r,a,o),_&&((_&13)==0&&this.addTriangle_(e,s,t,o,l,r),(_&7)==0&&this.addTriangle_(e,s,i,o,l,a))}calculateSourceExtent(){const t=Kt();return this.triangles_.forEach(function(e,i,s){const r=e.source;is(t,r[0]),is(t,r[1]),is(t,r[2])}),t}getTriangles(){return this.triangles_}}const I0=.5;class Hu extends Ps{constructor(t,e,i,s,r,o,a,l,h,c,u,d){super(r,F.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 _=this.sourceTileGrid_.getExtent();const m=g?ze(f,g):f;if(Xo(m)===0){this.state=F.EMPTY;return}const p=t.getExtent();p&&(_?_=ze(_,p):_=p);const y=s.getResolution(this.wrappedTileCoord_[0]),E=C0(t,i,m,y);if(!isFinite(E)||E<=0){this.state=F.EMPTY;return}const x=c!==void 0?c:I0;if(this.triangulation_=new S0(t,i,m,_,E*x,y),this.triangulation_.getTriangles().length===0){this.state=F.EMPTY;return}this.sourceZ_=e.getZForResolution(E);let w=this.triangulation_.calculateSourceExtent();if(_&&(t.canWrapX()?(w[1]=at(w[1],_[1],_[3]),w[3]=at(w[3],_[1],_[3])):w=ze(w,_)),!Xo(w))this.state=F.EMPTY;else{let T=0,I=0;t.canWrapX()&&(T=nt(p),I=Math.floor((w[0]-p[0])/T)),Gh(w.slice(),t,!0).forEach(R=>{const v=e.getTileRangeForExtentAndZ(R,this.sourceZ_);for(let b=v.minX;b<=v.maxX;b++)for(let L=v.minY;L<=v.maxY;L++){const O=I*T;this.sourceTiles_.push({getTile:()=>h(this.sourceZ_,b,L,a),offset:O})}++I}),this.sourceTiles_.length===0&&(this.state=F.EMPTY)}}getImage(){return this.canvas_}reproject_(){const t=[];if(this.sourceTiles_.forEach(e=>{const i=e.tile;if(i&&i.getState()==F.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=F.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_=R0(s,r,this.pixelRatio_,a,this.sourceTileGrid_.getExtent(),o,l,this.triangulation_,t,this.gutter_,this.renderEdges_,this.interpolate),this.state=F.LOADED}this.changed()}load(){for(const t of this.sourceTiles_)t.tile=t.getTile();if(this.state==F.IDLE){this.state=F.LOADING,this.changed();let t=0;this.sourcesListenerKeys_=[],this.sourceTiles_.forEach(({tile:e})=>{const i=e.getState();if(i==F.IDLE||i==F.LOADING){t++;const s=q(e,V.CHANGE,r=>{const o=e.getState();(o==F.LOADED||o==F.ERROR||o==F.EMPTY)&&(rt(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()==F.IDLE&&e.load()})}}unlistenSources_(){this.sourcesListenerKeys_.forEach(rt),this.sourcesListenerKeys_=null}release(){this.canvas_&&(ls(this.canvas_.getContext("2d")),zn.push(this.canvas_),this.canvas_=null),this.sourceTiles_.length=0,super.release()}}const b0=/\{z\}/g,P0=/\{x\}/g,L0=/\{y\}/g,A0=/\{-y\}/g;function M0(n,t,e,i,s){return n.replace(b0,t.toString()).replace(P0,e.toString()).replace(L0,i.toString()).replace(A0,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 O0(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 F0(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 M0(n,o,e[1],e[2],r)})}function D0(n,t){const e=n.length,i=new Array(e);for(let s=0;s<e;++s)i[s]=F0(n[s],t);return k0(i)}function k0(n){return n.length===1?n[0]:(function(t,e,i){if(!t)return;const s=m0(t),r=pn(s,n.length);return n[r](t,e,i)})}class N0 extends Zc{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||B(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 j()}getTileGrid(){return this.tileGrid}getTileGridForProjection(t){return this.tileGrid?this.tileGrid:ul(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:gm(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=x0(s,t,i)),y0(t,s)?t:null}clear(){}refresh(){this.clear(),super.refresh()}}class G0 extends Ne{constructor(t,e){super(t),this.tile=e}}const gl={TILELOADSTART:"tileloadstart",TILELOADEND:"tileloadend",TILELOADERROR:"tileloaderror"};class Qr extends N0{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===Qr.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=B(e),s=e.getState();let r;s==F.LOADING?(this.tileLoadingKeys_[i]=!0,r=gl.TILELOADSTART):i in this.tileLoadingKeys_&&(delete this.tileLoadingKeys_[i],r=s==F.ERROR?gl.TILELOADERROR:s==F.LOADED?gl.TILELOADEND:void 0),r!=null&&this.dispatchEvent(new G0(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=O0(t);this.urls=e,this.setUrls(e)}setUrls(t){this.urls=t;const e=t.join(`
|
|
8
|
-
`);this.generateTileUrlFunction_?this.setTileUrlFunction(D0(t,this.tileGrid),e):this.setKey(e)}tileUrlFunction(t,e,i){}}class z0 extends Qr{constructor(t){super({attributions:t.attributions,cacheSize:t.cacheSize,projection:t.projection,state:t.state,tileGrid:t.tileGrid,tileLoadFunction:t.tileLoadFunction?t.tileLoadFunction:X0,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.referrerPolicy=t.referrerPolicy,this.tileClass=t.tileClass!==void 0?t.tileClass:ku,this.tileGridForProjection={},this.reprojectionErrorThreshold_=t.reprojectionErrorThreshold,this.renderReprojectionEdges_=!1}getGutterForProjection(t){return this.getProjection()&&t&&!Ut(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||Ut(e,t)))return this.tileGrid;const i=B(t);return i in this.tileGridForProjection||(this.tileGridForProjection[i]=ul(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?F.IDLE:F.EMPTY,h!==void 0?h:"",{crossOrigin:this.crossOrigin,referrerPolicy:this.referrerPolicy},this.tileLoadFunction,this.tileOptions);return c.key=o,c.addEventListener(V.CHANGE,this.handleTileChange.bind(this)),c}getTile(t,e,i,s,r,o){const a=this.getProjection();if(!a||!r||Ut(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 Hu(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=qr(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=mt(t);if(i){const s=B(i);s in this.tileGridForProjection||(this.tileGridForProjection[s]=e)}}}function X0(n,t){if(ae){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");const r={mode:i,credentials:s,referrerPolicy:n.getReferrerPolicy()};fetch(t,r).then(o=>{if(!o.ok)throw new Error(`HTTP ${o.status}`);return o.blob()}).then(o=>createImageBitmap(o)).then(o=>{const a=n.getImage();a.width=o.width,a.height=o.height,a.getContext("2d").drawImage(o,0,0),o.close?.(),a.dispatchEvent(new Event("load"))}).catch(()=>{n.getImage().dispatchEvent(new Event("error"))});return}n.getImage().src=t}class qu extends z0{constructor(t){t=t||{};const e=t.projection!==void 0?t.projection:"EPSG:3857",i=t.tileGrid!==void 0?t.tileGrid:Bu({extent:Jr(e),maxResolution:t.maxResolution,maxZoom:t.maxZoom,minZoom:t.minZoom,tileSize:t.tileSize});super({attributions:t.attributions,cacheSize:t.cacheSize,crossOrigin:t.crossOrigin,referrerPolicy:t.referrerPolicy,interpolate:t.interpolate,projection:e,reprojectionErrorThreshold:t.reprojectionErrorThreshold,tileGrid:i,tileLoadFunction:t.tileLoadFunction,tilePixelRatio:t.tilePixelRatio,tileUrlFunction:t.tileUrlFunction,url:t.url,urls:t.urls,wrapX: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 Y0='© <a href="https://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap</a> contributors.';class W0 extends qu{constructor(t){t=t||{};let e;t.attributions!==void 0?e=t.attributions:e=[Y0];const i=t.url!==void 0?t.url:"https://tile.openstreetmap.org/{z}/{x}/{y}.png";super({attributions:e,attributionsCollapsible:!1,cacheSize:t.cacheSize,crossOrigin:t.crossOrigin!==void 0?t.crossOrigin:"anonymous",referrerPolicy:t.referrerPolicy||"origin-when-cross-origin",interpolate:t.interpolate,maxZoom:t.maxZoom!==void 0?t.maxZoom:19,reprojectionErrorThreshold:t.reprojectionErrorThreshold,tileLoadFunction:t.tileLoadFunction,transition:t.transition,url:i,wrapX:t.wrapX,zDirection:t.zDirection})}}function _l(n){return n instanceof Image||n instanceof HTMLCanvasElement||n instanceof HTMLVideoElement||n instanceof ImageBitmap?n:null}const V0=new Error("disposed"),$0=[256,256];class Ju extends Ps{constructor(t){const e=F.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=_l(this.data_);return t?[t.width,t.height]:$0}getData(){return this.data_}getError(){return this.error_}load(){if(this.state!==F.IDLE&&this.state!==F.ERROR)return;this.state=F.LOADING,this.changed();const t=this;this.loader_().then(function(e){t.data_=e,t.state=F.LOADED,t.changed()}).catch(function(e){t.error_=e,t.state=F.ERROR,t.changed()})}disposeInternal(){this.controller_&&(this.controller_.abort(V0),this.controller_=null),super.disposeInternal()}}class Qu{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 Qs&&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 ml(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 B0(n,t,e){const i=n[e];return i?i.delete(t):!1}function td(n,t){const e=n.layerStatesArray[n.layerIndex];e.extent&&(t=ze(t,fi(e.extent,n.viewState.projection)));const i=e.layer.getRenderSource();if(!i.getWrapX()){const s=i.getTileGridForProjection(n.viewState.projection).getExtent();s&&(t=ze(t,s))}return t}class ed extends gu{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=Kt(),this.tempTileRange_=new hl(0,0,0,0),this.tempTileCoord_=Hr(0,0,0);const i=e.cacheSize!==void 0?e.cacheSize:512;this.tileCache_=new Qu(i),this.sourceTileCache_=null,this.maxStaleKeys=i*.5}getTileCache(){return this.tileCache_}getSourceTileCache(){return this.sourceTileCache_||(this.sourceTileCache_=new Qu(512)),this.sourceTileCache_}getOrCreateTile(t,e,i,s){const r=this.tileCache_,a=this.getLayer().getSource(),l=qr(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||Ut(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=pt(e.pixelToCoordinateTransform,t.slice()),r=i.getExtent();if(r&&!gn(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()!==F.LOADED)continue;const f=l.getOrigin(c),g=Pt(l.getTileSize(c)),_=l.getResolution(c);let m;if(d instanceof ku||d instanceof Hu)m=d.getImage();else if(d instanceof Ju){if(m=_l(d.getData()),!m)continue}else continue;const p=Math.floor(h*((s[0]-f[0])/_-u[1]*g[0])),y=Math.floor(h*((f[1]-s[1])/_-u[2]*g[1])),E=Math.round(h*a.getGutterForProjection(o.projection));return this.getImageData(m,p+E,y+E)}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=B(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,_=g?kh(o.center,o.resolution,g,t.size):void 0;for(let m=i;m>=f;--m){const p=h.getTileRangeForExtentAndZ(e,m,this.tempTileRange_),y=h.getResolution(m);for(let E=p.minX;E<=p.maxX;++E)for(let x=p.minY;x<=p.maxY;++x){if(g&&!h.tileCoordIntersectsViewport([m,E,x],_))continue;const w=this.getTile(m,E,x,t);if(!w||!ml(s,w,m))continue;const I=w.getKey();if(u[I]=!0,w.getState()===F.IDLE&&!t.tileQueue.isKeyQueued(I)){const S=Hr(m,E,x,this.tempTileCoord_);t.tileQueue.enqueue([w,c,h.getTileCoordCenter(S),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=qr(this.getLayer().getSource(),a[l],s,r,o);if(i.containsKey(h)){const c=i.peek(h);if(c.getState()===F.LOADED)return c.endTransition(B(this)),ml(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=qr(l,h,i,c,u);let f=!1;if(a.containsKey(d)){const g=a.peek(d);g.getState()===F.LOADED&&(ml(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 _=t.extent;const m=c.getTilePixelRatio(l);this.prepareContainer(t,e);const p=this.context.canvas.width,y=this.context.canvas.height,E=i.extent&&fi(i.extent);E&&(_=ze(_,fi(i.extent)));const x=f*p/2/m,w=f*y/2/m,T=[a[0]-x,a[1]-w,a[0]+x,a[1]+w],I={};this.renderedTiles.length=0;const S=h.getPreload();if(t.nextExtent&&this.enqueueTilesForNextExtent()){const k=u.getZForResolution(s.nextResolution,c.zDirection),G=td(t,t.nextExtent);this.enqueueTiles(t,G,k,I,S)}const R=td(t,_);if(this.enqueueTiles(t,R,d,I,0),S>0&&setTimeout(()=>{this.enqueueTiles(t,R,d-1,I,S-1)},0),!(d in I))return this.container;const v=B(this),b=t.time;for(const k of I[d]){const G=k.getState();if(G===F.EMPTY)continue;const W=k.tileCoord;if(G===F.LOADED&&k.getAlpha(v,b)===1){k.endTransition(v);continue}if(G!==F.ERROR&&(this.renderComplete=!1),this.findStaleTile_(W,I)){B0(I,k,d),t.animate=!0;continue}if(this.findAltTiles_(u,W,d+1,I))continue;const et=u.getMinZoom();for(let Et=d-1;Et>=et&&!this.findAltTiles_(u,W,Et,I);--Et);}const L=f/o*l/m,O=this.getRenderContext(t);Ye(this.tempTransform,p/2,y/2,L,L,0,-p/2,-y/2),i.extent&&this.clipUnrotated(O,t,E),c.getInterpolate()||(O.imageSmoothingEnabled=!1),this.preRender(O,t);const N=Object.keys(I).map(Number);N.sort(Re);let M;const A=[],D=[];for(let k=N.length-1;k>=0;--k){const G=N[k],W=c.getTilePixelSize(G,l,r),J=u.getResolution(G)/f,et=W[0]*J*L,Et=W[1]*J*L,P=u.getTileCoordForCoordAndZ(ui(T),G),$t=u.getTileCoordExtent(P),ct=pt(this.tempTransform,[m*($t[0]-T[0])/f,m*(T[3]-$t[3])/f]),Mt=m*c.getGutterForProjection(r);for(const Nt of I[G]){if(Nt.getState()!==F.LOADED)continue;const St=Nt.tileCoord,Pe=P[1]-St[1],io=Math.round(ct[0]-(Pe-1)*et),Fs=P[2]-St[2],xl=Math.round(ct[1]-(Fs-1)*Et),Le=Math.round(ct[0]-Pe*et),we=Math.round(ct[1]-Fs*Et),Ae=io-Le,bi=xl-we,no=N.length===1;let Ds=!1;M=[Le,we,Le+Ae,we,Le+Ae,we+bi,Le,we+bi];for(let Yn=0,so=A.length;Yn<so;++Yn)if(!no&&G<D[Yn]){const Ot=A[Yn];gt([Le,we,Le+Ae,we+bi],[Ot[0],Ot[3],Ot[4],Ot[7]])&&(Ds||(O.save(),Ds=!0),O.beginPath(),O.moveTo(M[0],M[1]),O.lineTo(M[2],M[3]),O.lineTo(M[4],M[5]),O.lineTo(M[6],M[7]),O.moveTo(Ot[6],Ot[7]),O.lineTo(Ot[4],Ot[5]),O.lineTo(Ot[2],Ot[3]),O.lineTo(Ot[0],Ot[1]),O.clip())}A.push(M),D.push(G),this.drawTile(Nt,t,Le,we,Ae,bi,Mt,no),Ds&&O.restore(),this.renderedTiles.unshift(Nt),this.updateUsedTiles(t.usedTiles,c,Nt)}}if(this.renderedResolution=f,this.extentChanged=!this.renderedExtent_||!_n(this.renderedExtent_,T),this.renderedExtent_=T,this.renderedPixelRatio=l,this.postRender(this.context,t),i.extent&&O.restore(),O.imageSmoothingEnabled=!0,this.renderComplete){const k=(G,W)=>{const X=B(c),J=W.wantedTiles[X],et=J?Object.keys(J).length:0;this.updateCacheSize(et),this.tileCache_.expireCache(),this.sourceTileCache_?.expireCache()};t.postRenderFunctions.push(k)}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 Ju){if(h=_l(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=B(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=B(e);s in t||(t[s]={}),t[s][i.getKey()]=!0}}const Ii={PRELOAD:"preload",USE_INTERIM_TILES_ON_ERROR:"useInterimTilesOnError"};class K0 extends Ur{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(Ii.PRELOAD)}setPreload(t){this.set(Ii.PRELOAD,t)}getUseInterimTilesOnError(){return this.get(Ii.USE_INTERIM_TILES_ON_ERROR)}setUseInterimTilesOnError(t){this.set(Ii.USE_INTERIM_TILES_ON_ERROR,t)}getData(t){return super.getData(t)}}class id extends K0{constructor(t){super(t)}createRenderer(){return new ed(this,{cacheSize:this.getCacheSize()})}}const j0={image:["Polygon","Circle","LineString","Image","Text"],hybrid:["Polygon","LineString"],vector:[]},nd={hybrid:["Image","Text","Default"],vector:["Polygon","Circle","LineString","Image","Text","Default"]};class U0 extends ed{constructor(t,e){super(t,e),this.boundHandleStyleImageChange_=this.handleStyleImageChange_.bind(this),this.renderedLayerRevision_,this.renderedPixelToCoordinateTransform_=null,this.renderedRotation_,this.renderedOpacity_=1,this.tmpTransform_=re(),this.tileClipContexts_=null}enqueueTilesForNextExtent(){return this.getLayer().getRenderMode()!=="vector"}drawTile(t,e,i,s,r,o,a,l){this.updateExecutorGroup_(t,e.pixelRatio,e.viewState.projection),this.tileImageNeedsRender_(t)&&this.renderTileImage_(t,e),super.drawTile(t,e,i,s,r,o,a,l)}getTile(t,e,i,s){const r=this.getOrCreateTile(t,e,i,s);if(!r)return null;const o=s.viewState,a=o.resolution,l=s.viewHints,h=this.getLayer().getSource(),c=h.getTileGridForProjection(o.projection),u=!(l[lt.ANIMATING]||l[lt.INTERACTING]),d=c.getZForResolution(a,h.zDirection)===t;return u&&d?r.wantedResolution=a:r.wantedResolution||(r.wantedResolution=c.getResolution(t)),r}prepareFrame(t){const e=this.getLayer().getRevision();return this.renderedLayerRevision_!==e&&(this.renderedLayerRevision_=e,this.renderedTiles.length=0),super.prepareFrame(t)}updateExecutorGroup_(t,e,i){const s=this.getLayer(),r=s.getRevision(),o=s.getRenderOrder()||null,a=t.wantedResolution,l=t.getReplayState(s);if(!l.dirty&&l.renderedResolution===a&&l.renderedRevision==r&&l.renderedPixelRatio===e&&l.renderedRenderOrder==o)return;const h=s.getSource(),c=!!s.getDeclutter(),u=h.getTileGrid(),f=h.getTileGridForProjection(i).getTileCoordExtent(t.wrappedTileCoord),g=h.getSourceTiles(e,i,t),_=B(s);delete t.hitDetectionImageData[_],t.executorGroups[_]=[],l.dirty=!1;for(let m=0,p=g.length;m<p;++m){const y=g[m];if(y.getState()!=F.LOADED)continue;const E=h.getProjection(),x=y.tileCoord;let w=u.getTileCoordExtent(x);i&&E&&!Ut(i,E)&&(w=xr(w,E,i,32));const T=ze(f,w),I=ci(T,s.getRenderBuffer()*a,this.tempExtent),S=_n(w,T)?null:I,R=new nu(0,T,a,e),v=ka(a,e),b=function(A,D){let k;const G=A.getStyleFunction()||s.getStyleFunction();if(G&&(k=G(A,a)),k){const W=this.renderFeature(A,v,k,R,c,D);l.dirty=l.dirty||W}},L=y.getFeatures();o&&o!==l.renderedRenderOrder&&L.sort(o);for(let A=0,D=L.length;A<D;++A){let k=L[A];i&&y.projection&&!Ut(i,y.projection)&&(k=k.clone(),k.getGeometry().applyTransform($i(y.projection,i))),(!S||gt(S,k.getGeometry().getExtent()))&&b.call(this,k,A)}const O=R.finish(),N=s.getRenderMode()!=="vector"&&c&&g.length===1?null:T,M=new lu(N,a,e,h.getOverlaps(),O,s.getRenderBuffer(),!0);t.executorGroups[_].push(M)}l.renderedRevision=r,l.renderedPixelRatio=e,l.renderedRenderOrder=o,l.renderedResolution=a}forEachFeatureAtCoordinate(t,e,i,s,r){const o=e.viewState.resolution,a=e.viewState.rotation;i=i??0;const l=this.getLayer(),c=l.getSource().getTileGridForProjection(e.viewState.projection),u=ko([t]);ci(u,o*i,u);const d={},f=function(E,x,w){let T=E.getId();T===void 0&&(T=B(E));const I=d[T];if(I){if(I!==!0&&w<I.distanceSq){if(w===0)return d[T]=!0,r.splice(r.lastIndexOf(I),1),s(E,l,x);I.geometry=x,I.distanceSq=w}}else{if(w===0)return d[T]=!0,s(E,l,x);r.push(d[T]={feature:E,layer:l,geometry:x,distanceSq:w,callback:s})}},g=this.renderedTiles,_=B(l),m=l.getDeclutter(),p=m?e.declutter?.[m]?.all().map(E=>E.value):null;let y;t:for(let E=0,x=g.length;E<x;++E){const w=g[E],T=c.getTileCoordExtent(w.wrappedTileCoord);if(!gt(T,u))continue;const I=w.executorGroups[_];for(let S=0,R=I.length;S<R;++S)if(y=I[S].forEachFeatureAtCoordinate(t,o,a,i,f,p),y)break t}return y}getFeatures(t){return this.renderedTiles.length===0?Promise.resolve([]):new Promise((e,i)=>{const s=this.getLayer(),r=s.getSource(),o=this.renderedProjection,a=o.getExtent(),l=this.renderedResolution,h=r.getTileGridForProjection(o),c=pt(this.renderedPixelToCoordinateTransform_,t.slice()),u=h.getTileCoordForCoordAndResolution(c,l).toString(),d=this.renderedTiles.find(E=>E.tileCoord.toString()===u&&E.getState()===F.LOADED);if(!d||d.loadingSourceTiles>0){e([]);return}r.getWrapX()&&o.canWrapX()&&!zi(a,h.getTileCoordExtent(d.tileCoord))&&$o(c,o);const f=B(s),g=h.getTileCoordExtent(d.wrappedTileCoord),_=ui(g),m=[(c[0]-_[0])/l,(_[1]-c[1])/l],p=d.getSourceTiles().reduce((E,x)=>E.concat(x.getFeatures()),[]);let y=d.hitDetectionImageData[f];if(!y){const E=Pt(h.getTileSize(h.getZForResolution(l,r.zDirection))),x=this.renderedRotation_,w=[this.getRenderTransform(h.getTileCoordCenter(d.wrappedTileCoord),l,0,qt,E[0]*qt,E[1]*qt,0)];y=cu(E,w,p,s.getStyleFunction(),h.getTileCoordExtent(d.wrappedTileCoord),d.getReplayState(s).renderedResolution,x),d.hitDetectionImageData[f]=y}e(uu(m,p,y))})}getFeaturesInExtent(t){const e=[],i=this.getTileCache();if(i.getCount()===0)return e;const r=this.getLayer().getSource().getTileGridForProjection(this.frameState.viewState.projection),o=r.getZForResolution(this.renderedResolution),a={};return i.forEach(l=>{if(l.tileCoord[0]!==o||l.getState()!==F.LOADED)return;const h=l.getSourceTiles();for(let c=0,u=h.length;c<u;++c){const d=h[c],f=d.getKey();if(f in a)continue;a[f]=!0;const g=d.tileCoord;if(gt(t,r.getTileCoordExtent(g))){const _=d.getFeatures();if(_)for(let m=0,p=_.length;m<p;++m){const y=_[m],E=y.getGeometry();gt(t,E.getExtent())&&e.push(y)}}}}),e}handleFontsChanged(){const t=this.getLayer();t.getVisible()&&this.renderedLayerRevision_!==void 0&&t.changed()}handleStyleImageChange_(t){this.renderIfReadyAndVisible()}renderDeclutter(t,e){const i=this.context,s=i.globalAlpha;i.globalAlpha=e.opacity;const r=t.viewHints,o=!(r[lt.ANIMATING]||r[lt.INTERACTING]),a=[this.context.canvas.width,this.context.canvas.height],l=this.getLayer().getDeclutter(),h=l?t.declutter?.[l]:void 0,c=B(this.getLayer()),u=this.renderedTiles;for(let d=0,f=u.length;d<f;++d){const g=u[d],_=g.executorGroups[c];if(_)for(let m=_.length-1;m>=0;--m)_[m].execute(this.context,a,this.getTileRenderTransform(g,t),t.viewState.rotation,o,Yr,h)}i.globalAlpha=s}renderDeferredInternal(t){const e=this.renderedTiles,i=B(this.getLayer()),s=e.reduce((l,h,c)=>(h.executorGroups[i].forEach(u=>l.push({executorGroup:u,index:c})),l),[]),r=s.map(({executorGroup:l})=>l.getDeferredZIndexContexts()),o={};for(let l=0,h=s.length;l<h;++l){const c=s[l].executorGroup.getDeferredZIndexContexts();for(const u in c)o[u]=!0}Object.keys(o).map(Number).sort(Re).forEach(l=>{r.forEach((h,c)=>{h[l]&&(h[l].forEach(u=>{const{executorGroup:d,index:f}=s[c],g=d.getRenderedContext(),_=g.globalAlpha;g.globalAlpha=this.renderedOpacity_;const m=this.tileClipContexts_[f];m&&m.draw(g),u.draw(g),m&&g.restore(),g.globalAlpha=_,u.clear()}),h[l].length=0)})})}getTileRenderTransform(t,e){const i=e.pixelRatio,s=e.viewState,r=s.center,o=s.resolution,a=s.rotation,l=e.size,h=Math.round(l[0]*i),c=Math.round(l[1]*i),d=this.getLayer().getSource().getTileGridForProjection(e.viewState.projection),f=t.tileCoord,g=d.getTileCoordExtent(t.wrappedTileCoord),_=d.getTileCoordExtent(f,this.tempExtent)[0]-g[0];return sa(oa(this.inversePixelTransform.slice(),1/i,1/i),this.getRenderTransform(r,o,a,i,h,c,_))}postRender(t,e){const i=e.viewHints,s=!(i[lt.ANIMATING]||i[lt.INTERACTING]);this.renderedPixelToCoordinateTransform_=e.pixelToCoordinateTransform.slice(),this.renderedRotation_=e.viewState.rotation,this.renderedOpacity_=e.layerStatesArray[e.layerIndex].opacity;const r=this.getLayer(),o=r.getRenderMode(),a=t.globalAlpha;t.globalAlpha=this.renderedOpacity_;const l=r.getDeclutter(),h=l?nd[o].filter(w=>!Yr.includes(w)):nd[o],c=e.viewState,u=c.rotation,d=r.getSource(),g=d.getTileGridForProjection(c.projection).getZForResolution(c.resolution,d.zDirection),_=this.renderedTiles,m=[],p=[],y=[],E=B(r);let x=!0;for(let w=_.length-1;w>=0;--w){const T=_[w];x=x&&!T.getReplayState(r).dirty;const I=T.executorGroups[E].filter(N=>N.hasExecutors(h));if(I.length===0)continue;const S=this.getTileRenderTransform(T,e),R=T.tileCoord[0];let v=!1;const b=I[0].getClipCoords(S);let L=t,O;if(b){O=new Xa,L=O.getContext();for(let N=0,M=m.length;N<M;++N)if(g!==R&&R<p[N]){const A=m[N];gt([b[0],b[3],b[4],b[7]],[A[0],A[3],A[4],A[7]])&&(v||(L.save(),v=!0),L.beginPath(),L.moveTo(b[0],b[1]),L.lineTo(b[2],b[3]),L.lineTo(b[4],b[5]),L.lineTo(b[6],b[7]),L.moveTo(A[6],A[7]),L.lineTo(A[4],A[5]),L.lineTo(A[2],A[3]),L.lineTo(A[0],A[1]),L.clip())}m.push(b),p.push(R)}for(let N=0,M=I.length;N<M;++N)I[N].execute(t,[t.canvas.width,t.canvas.height],S,u,s,h,e.declutter?.[l]);v&&(L===t?L.restore():y[w]=O)}t.globalAlpha=a,this.ready=x,this.tileClipContexts_=y,e.declutter||this.renderDeferredInternal(e),super.postRender(t,e)}renderFeature(t,e,i,s,r,o){if(!i)return!1;let a=!1;if(Array.isArray(i))for(let l=0,h=i.length;l<h;++l)a=Lr(s,t,i[l],e,this.boundHandleStyleImageChange_,void 0,r,o)||a;else a=Lr(s,t,i,e,this.boundHandleStyleImageChange_,void 0,r,o);return a}tileImageNeedsRender_(t){const e=this.getLayer();if(e.getRenderMode()==="vector")return!1;const i=t.getReplayState(e),s=e.getRevision(),r=t.wantedResolution;return i.renderedTileResolution!==r||i.renderedTileRevision!==s}renderTileImage_(t,e){const i=this.getLayer(),s=t.getReplayState(i),r=i.getRevision(),o=t.executorGroups[B(i)];s.renderedTileRevision=r;const a=t.wrappedTileCoord,l=a[0],h=i.getSource();let c=e.pixelRatio;const d=e.viewState.projection,f=h.getTileGridForProjection(d),g=f.getResolution(t.tileCoord[0]),_=e.pixelRatio/t.wantedResolution*g,m=f.getResolution(l),p=t.getContext();c=Math.round(Math.max(c,_/c));const y=h.getTilePixelSize(l,c,d);p.canvas.width=y[0],p.canvas.height=y[1];const E=c/_;if(E!==1){const I=sc(this.tmpTransform_);oa(I,E,E),p.setTransform.apply(p,I)}const x=f.getTileCoordExtent(a,this.tempExtent),w=_/m,T=sc(this.tmpTransform_);oa(T,w,-w),Kg(T,-x[0],-x[3]);for(let I=0,S=o.length;I<S;++I)o[I].execute(p,[p.canvas.width*E,p.canvas.height*E],T,0,!0,j0[i.getRenderMode()],null);s.renderedTileResolution=t.wantedResolution}}class Z0 extends el{constructor(t){t=t||{};const e=Object.assign({},t);delete e.preload;const i=t.cacheSize===void 0?0:t.cacheSize;delete t.cacheSize,delete e.useInterimTilesOnError,super(e),this.on,this.once,this.un,this.cacheSize_=i;const s=t.renderMode||"hybrid";Q(s=="hybrid"||s=="vector","`renderMode` must be `'hybrid'` or `'vector'`"),this.renderMode_=s,this.setPreload(t.preload?t.preload:0),this.setUseInterimTilesOnError(t.useInterimTilesOnError!==void 0?t.useInterimTilesOnError:!0),this.getBackground,this.setBackground}createRenderer(){return new U0(this,{cacheSize:this.cacheSize_})}getFeatures(t){return super.getFeatures(t)}getFeaturesInExtent(t){return this.getRenderer().getFeaturesInExtent(t)}getRenderMode(){return this.renderMode_}getPreload(){return this.get(Ii.PRELOAD)}getUseInterimTilesOnError(){return this.get(Ii.USE_INTERIM_TILES_ON_ERROR)}setPreload(t){this.set(Ii.PRELOAD,t)}setUseInterimTilesOnError(t){this.set(Ii.USE_INTERIM_TILES_ON_ERROR,t)}}class H0 extends Qr{constructor(t){const e=t.projection||"EPSG:3857",i=t.extent||Jr(e),s=t.tileGrid||Bu({extent:i,maxResolution:t.maxResolution,maxZoom:t.maxZoom!==void 0?t.maxZoom:22,minZoom:t.minZoom,tileSize:t.tileSize||512});super({attributions:t.attributions,attributionsCollapsible:t.attributionsCollapsible,cacheSize:t.cacheSize,interpolate:!0,projection:e,state:t.state,tileGrid:s,tileLoadFunction:t.tileLoadFunction?t.tileLoadFunction:q0,tileUrlFunction:t.tileUrlFunction,url:t.url,urls:t.urls,wrapX:t.wrapX===void 0?!0:t.wrapX,transition:t.transition,zDirection:t.zDirection===void 0?1:t.zDirection}),this.format_=t.format?t.format:null,this.tileKeysBySourceTileUrl_={},this.sourceTiles_={},this.overlaps_=t.overlaps==null?!0:t.overlaps,this.tileClass=t.tileClass?t.tileClass:g0,this.tileGrids_={}}getOverlaps(){return this.overlaps_}getSourceTiles(t,e,i){if(i.getState()===F.IDLE){i.setState(F.LOADING);const s=i.wrappedTileCoord,r=this.getTileGridForProjection(e);let o=r.getTileCoordExtent(s);const a=s[0],l=r.getResolution(a);ci(o,-l,o);const h=this.projection;e&&this.projection&&!Ut(e,h)&&(o=xr(o,e,h));const c=this.tileGrid,u=c.getExtent();u&&ze(o,u,o);let d=l;e&&h&&!Ut(e,h)&&(d=l/h.getMetersPerUnit()/e.getMetersPerUnit());const f=c.getZForResolution(d,this.zDirection);c.forEachTileCoord(o,f,g=>{const _=this.tileUrlFunction(g,t,e);this.sourceTiles_[_]||(this.sourceTiles_[_]=new this.tileClass(g,_?F.IDLE:F.EMPTY,_,this.format_,this.tileLoadFunction));const m=this.sourceTiles_[_];i.sourceTiles.push(m),this.tileKeysBySourceTileUrl_[_]||(this.tileKeysBySourceTileUrl_[_]=[]),this.tileKeysBySourceTileUrl_[_].push(i.getKey());const p=m.getState();if(p<F.LOADED){const y=E=>{this.handleTileChange(E);const x=m.getState();if(x===F.LOADED||x===F.ERROR){const w=m.getKey();w in i.errorTileKeys?m.getState()===F.LOADED&&delete i.errorTileKeys[w]:i.loadingSourceTiles--,x===F.ERROR?i.errorTileKeys[w]=!0:m.removeEventListener(V.CHANGE,y),i.loadingSourceTiles===0&&i.setState(Gi(i.errorTileKeys)?F.LOADED:F.ERROR)}};m.addEventListener(V.CHANGE,y),i.loadingSourceTiles++}p===F.IDLE&&(m.extent=c.getTileCoordExtent(g),m.projection=this.projection,m.resolution=c.getResolution(g[0]),m.load())}),i.loadingSourceTiles||i.setState(i.sourceTiles.some(g=>g.getState()===F.ERROR)?F.ERROR:F.LOADED)}return i.sourceTiles}removeSourceTiles(t){const e=t.getKey(),i=t.sourceTiles;for(let s=0,r=i.length;s<r;++s){const o=i[s].getTileUrl();if(!this.tileKeysBySourceTileUrl_[o])return;const a=this.tileKeysBySourceTileUrl_[o].indexOf(e);a!==-1&&(this.tileKeysBySourceTileUrl_[o].splice(a,1),this.tileKeysBySourceTileUrl_[o].length===0&&(delete this.tileKeysBySourceTileUrl_[o],delete this.sourceTiles_[o]))}}getTile(t,e,i,s,r){const o=[t,e,i];let a=this.getTileCoordForTileUrlFunction(o,r);const l=this.getTileGrid().getExtent(),h=this.projection,c=this.getTileGridForProjection(r);if(a&&l){const f=c.getTileCoordExtent(a);ci(f,-c.getResolution(t),f),gt(l,!r||!h||Ut(r,h)?f:xr(f,r,h))||(a=null)}let u=!0;if(a!==null){const f=this.tileGrid,g=c.getResolution(t);let _=g;r&&h&&!Ut(r,h)&&(_=g/h.getMetersPerUnit()/r.getMetersPerUnit());const m=f.getZForResolution(_,1),p=c.getTileCoordExtent(a);ci(p,-g,p),f.forEachTileCoord(!r||!h||Ut(r,h)?p:xr(p,r,h),m,y=>{u=u&&!this.tileUrlFunction(y,s,h)})}const d=new f0(o,u?F.EMPTY:F.IDLE,a,this.getSourceTiles.bind(this,s,r),this.removeSourceTiles.bind(this));return d.key=this.getKey(),d}getTileGridForProjection(t){const e=t.getCode();let i=this.tileGrids_[e];if(!i){const s=this.projection;if(s!==null&&!Ut(s,t))return ul(t);const r=this.tileGrid,o=r.getResolutions().slice(),a=o.map(function(c,u){return r.getOrigin(u)}),l=o.map(function(c,u){return r.getTileSize(u)}),h=Ou+1;for(let c=o.length;c<h;++c)o.push(o[c-1]/2),a.push(a[c-1]),l.push(l[c-1]);i=new cl({extent:r.getExtent(),origins:a,resolutions:o,tileSizes:l}),this.tileGrids_[e]=i}return i}getTilePixelRatio(t){return t}getTilePixelSize(t,e,i){const s=this.getTileGridForProjection(i),r=Pt(s.getTileSize(t),this.tmpSize);return[Math.round(r[0]*e),Math.round(r[1]*e)]}setOverlaps(t){this.overlaps_=t,this.changed()}}function q0(n,t){n.setLoader(function(e,i,s){Yc(t,n.getFormat(),e,i,s,n.onLoad.bind(n),n.onError.bind(n))})}const pl=65536*65536,sd=1/pl,J0=12,rd=typeof TextDecoder>"u"?null:new TextDecoder("utf-8"),yl=0,to=1,Os=2,eo=5;class Q0{constructor(t=new Uint8Array(16)){this.buf=ArrayBuffer.isView(t)?t:new Uint8Array(t),this.dataView=new DataView(this.buf.buffer),this.pos=0,this.type=0,this.length=this.buf.length}readFields(t,e,i=this.length){for(;this.pos<i;){const s=this.readVarint(),r=s>>3,o=this.pos;this.type=s&7,t(r,e,this),this.pos===o&&this.skip(s)}return e}readMessage(t,e){return this.readFields(t,e,this.readVarint()+this.pos)}readFixed32(){const t=this.dataView.getUint32(this.pos,!0);return this.pos+=4,t}readSFixed32(){const t=this.dataView.getInt32(this.pos,!0);return this.pos+=4,t}readFixed64(){const t=this.dataView.getUint32(this.pos,!0)+this.dataView.getUint32(this.pos+4,!0)*pl;return this.pos+=8,t}readSFixed64(){const t=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*pl;return this.pos+=8,t}readFloat(){const t=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,t}readDouble(){const t=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,t}readVarint(t){const e=this.buf;let i,s;return s=e[this.pos++],i=s&127,s<128||(s=e[this.pos++],i|=(s&127)<<7,s<128)||(s=e[this.pos++],i|=(s&127)<<14,s<128)||(s=e[this.pos++],i|=(s&127)<<21,s<128)?i:(s=e[this.pos],i|=(s&15)<<28,ty(i,t,this))}readVarint64(){return this.readVarint(!0)}readSVarint(){const t=this.readVarint();return t%2===1?(t+1)/-2:t/2}readBoolean(){return!!this.readVarint()}readString(){const t=this.readVarint()+this.pos,e=this.pos;return this.pos=t,t-e>=J0&&rd?rd.decode(this.buf.subarray(e,t)):fy(this.buf,e,t)}readBytes(){const t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e}readPackedVarint(t=[],e){const i=this.readPackedEnd();for(;this.pos<i;)t.push(this.readVarint(e));return t}readPackedSVarint(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readSVarint());return t}readPackedBoolean(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readBoolean());return t}readPackedFloat(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readFloat());return t}readPackedDouble(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readDouble());return t}readPackedFixed32(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readFixed32());return t}readPackedSFixed32(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readSFixed32());return t}readPackedFixed64(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readFixed64());return t}readPackedSFixed64(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readSFixed64());return t}readPackedEnd(){return this.type===Os?this.readVarint()+this.pos:this.pos+1}skip(t){const e=t&7;if(e===yl)for(;this.buf[this.pos++]>127;);else if(e===Os)this.pos=this.readVarint()+this.pos;else if(e===eo)this.pos+=4;else if(e===to)this.pos+=8;else throw new Error(`Unimplemented type: ${e}`)}writeTag(t,e){this.writeVarint(t<<3|e)}realloc(t){let e=this.length||16;for(;e<this.pos+t;)e*=2;if(e!==this.length){const i=new Uint8Array(e);i.set(this.buf),this.buf=i,this.dataView=new DataView(i.buffer),this.length=e}}finish(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)}writeFixed32(t){this.realloc(4),this.dataView.setInt32(this.pos,t,!0),this.pos+=4}writeSFixed32(t){this.realloc(4),this.dataView.setInt32(this.pos,t,!0),this.pos+=4}writeFixed64(t){this.realloc(8),this.dataView.setInt32(this.pos,t&-1,!0),this.dataView.setInt32(this.pos+4,Math.floor(t*sd),!0),this.pos+=8}writeSFixed64(t){this.realloc(8),this.dataView.setInt32(this.pos,t&-1,!0),this.dataView.setInt32(this.pos+4,Math.floor(t*sd),!0),this.pos+=8}writeVarint(t){if(t=+t||0,t>268435455||t<0){ey(t,this);return}this.realloc(4),this.buf[this.pos++]=t&127|(t>127?128:0),!(t<=127)&&(this.buf[this.pos++]=(t>>>=7)&127|(t>127?128:0),!(t<=127)&&(this.buf[this.pos++]=(t>>>=7)&127|(t>127?128:0),!(t<=127)&&(this.buf[this.pos++]=t>>>7&127)))}writeSVarint(t){this.writeVarint(t<0?-t*2-1:t*2)}writeBoolean(t){this.writeVarint(+t)}writeString(t){t=String(t),this.realloc(t.length*4),this.pos++;const e=this.pos;this.pos=gy(this.buf,t,this.pos);const i=this.pos-e;i>=128&&od(e,i,this),this.pos=e-1,this.writeVarint(i),this.pos+=i}writeFloat(t){this.realloc(4),this.dataView.setFloat32(this.pos,t,!0),this.pos+=4}writeDouble(t){this.realloc(8),this.dataView.setFloat64(this.pos,t,!0),this.pos+=8}writeBytes(t){const e=t.length;this.writeVarint(e),this.realloc(e);for(let i=0;i<e;i++)this.buf[this.pos++]=t[i]}writeRawMessage(t,e){this.pos++;const i=this.pos;t(e,this);const s=this.pos-i;s>=128&&od(i,s,this),this.pos=i-1,this.writeVarint(s),this.pos+=s}writeMessage(t,e,i){this.writeTag(t,Os),this.writeRawMessage(e,i)}writePackedVarint(t,e){e.length&&this.writeMessage(t,sy,e)}writePackedSVarint(t,e){e.length&&this.writeMessage(t,ry,e)}writePackedBoolean(t,e){e.length&&this.writeMessage(t,ly,e)}writePackedFloat(t,e){e.length&&this.writeMessage(t,oy,e)}writePackedDouble(t,e){e.length&&this.writeMessage(t,ay,e)}writePackedFixed32(t,e){e.length&&this.writeMessage(t,hy,e)}writePackedSFixed32(t,e){e.length&&this.writeMessage(t,cy,e)}writePackedFixed64(t,e){e.length&&this.writeMessage(t,uy,e)}writePackedSFixed64(t,e){e.length&&this.writeMessage(t,dy,e)}writeBytesField(t,e){this.writeTag(t,Os),this.writeBytes(e)}writeFixed32Field(t,e){this.writeTag(t,eo),this.writeFixed32(e)}writeSFixed32Field(t,e){this.writeTag(t,eo),this.writeSFixed32(e)}writeFixed64Field(t,e){this.writeTag(t,to),this.writeFixed64(e)}writeSFixed64Field(t,e){this.writeTag(t,to),this.writeSFixed64(e)}writeVarintField(t,e){this.writeTag(t,yl),this.writeVarint(e)}writeSVarintField(t,e){this.writeTag(t,yl),this.writeSVarint(e)}writeStringField(t,e){this.writeTag(t,Os),this.writeString(e)}writeFloatField(t,e){this.writeTag(t,eo),this.writeFloat(e)}writeDoubleField(t,e){this.writeTag(t,to),this.writeDouble(e)}writeBooleanField(t,e){this.writeVarintField(t,+e)}}function ty(n,t,e){const i=e.buf;let s,r;if(r=i[e.pos++],s=(r&112)>>4,r<128||(r=i[e.pos++],s|=(r&127)<<3,r<128)||(r=i[e.pos++],s|=(r&127)<<10,r<128)||(r=i[e.pos++],s|=(r&127)<<17,r<128)||(r=i[e.pos++],s|=(r&127)<<24,r<128)||(r=i[e.pos++],s|=(r&1)<<31,r<128))return Xn(n,s,t);throw new Error("Expected varint not more than 10 bytes")}function Xn(n,t,e){return e?t*4294967296+(n>>>0):(t>>>0)*4294967296+(n>>>0)}function ey(n,t){let e,i;if(n>=0?(e=n%4294967296|0,i=n/4294967296|0):(e=~(-n%4294967296),i=~(-n/4294967296),e^4294967295?e=e+1|0:(e=0,i=i+1|0)),n>=18446744073709552e3||n<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");t.realloc(10),iy(e,i,t),ny(i,t)}function iy(n,t,e){e.buf[e.pos++]=n&127|128,n>>>=7,e.buf[e.pos++]=n&127|128,n>>>=7,e.buf[e.pos++]=n&127|128,n>>>=7,e.buf[e.pos++]=n&127|128,n>>>=7,e.buf[e.pos]=n&127}function ny(n,t){const e=(n&7)<<4;t.buf[t.pos++]|=e|((n>>>=3)?128:0),n&&(t.buf[t.pos++]=n&127|((n>>>=7)?128:0),n&&(t.buf[t.pos++]=n&127|((n>>>=7)?128:0),n&&(t.buf[t.pos++]=n&127|((n>>>=7)?128:0),n&&(t.buf[t.pos++]=n&127|((n>>>=7)?128:0),n&&(t.buf[t.pos++]=n&127)))))}function od(n,t,e){const i=t<=16383?1:t<=2097151?2:t<=268435455?3:Math.floor(Math.log(t)/(Math.LN2*7));e.realloc(i);for(let s=e.pos-1;s>=n;s--)e.buf[s+i]=e.buf[s]}function sy(n,t){for(let e=0;e<n.length;e++)t.writeVarint(n[e])}function ry(n,t){for(let e=0;e<n.length;e++)t.writeSVarint(n[e])}function oy(n,t){for(let e=0;e<n.length;e++)t.writeFloat(n[e])}function ay(n,t){for(let e=0;e<n.length;e++)t.writeDouble(n[e])}function ly(n,t){for(let e=0;e<n.length;e++)t.writeBoolean(n[e])}function hy(n,t){for(let e=0;e<n.length;e++)t.writeFixed32(n[e])}function cy(n,t){for(let e=0;e<n.length;e++)t.writeSFixed32(n[e])}function uy(n,t){for(let e=0;e<n.length;e++)t.writeFixed64(n[e])}function dy(n,t){for(let e=0;e<n.length;e++)t.writeSFixed64(n[e])}function fy(n,t,e){let i="",s=t;for(;s<e;){const r=n[s];let o=null,a=r>239?4:r>223?3:r>191?2:1;if(s+a>e)break;let l,h,c;a===1?r<128&&(o=r):a===2?(l=n[s+1],(l&192)===128&&(o=(r&31)<<6|l&63,o<=127&&(o=null))):a===3?(l=n[s+1],h=n[s+2],(l&192)===128&&(h&192)===128&&(o=(r&15)<<12|(l&63)<<6|h&63,(o<=2047||o>=55296&&o<=57343)&&(o=null))):a===4&&(l=n[s+1],h=n[s+2],c=n[s+3],(l&192)===128&&(h&192)===128&&(c&192)===128&&(o=(r&15)<<18|(l&63)<<12|(h&63)<<6|c&63,(o<=65535||o>=1114112)&&(o=null))),o===null?(o=65533,a=1):o>65535&&(o-=65536,i+=String.fromCharCode(o>>>10&1023|55296),o=56320|o&1023),i+=String.fromCharCode(o),s+=a}return i}function gy(n,t,e){for(let i=0,s,r;i<t.length;i++){if(s=t.charCodeAt(i),s>55295&&s<57344)if(r)if(s<56320){n[e++]=239,n[e++]=191,n[e++]=189,r=s;continue}else s=r-55296<<10|s-56320|65536,r=null;else{s>56319||i+1===t.length?(n[e++]=239,n[e++]=191,n[e++]=189):r=s;continue}else r&&(n[e++]=239,n[e++]=191,n[e++]=189,r=null);s<128?n[e++]=s:(s<2048?n[e++]=s>>6|192:(s<65536?n[e++]=s>>12|224:(n[e++]=s>>18|240,n[e++]=s>>12&63|128),n[e++]=s>>6&63|128),n[e++]=s&63|128)}return e}class _y{constructor(){this.dataProjection=void 0,this.defaultFeatureProjection=void 0,this.featureClass=sr,this.supportedMediaTypes=null}getReadOptions(t,e){if(e){let i=e.dataProjection?mt(e.dataProjection):this.readProjection(t);e.extent&&i&&i.getUnits()==="tile-pixels"&&(i=mt(i),i.setWorldExtent(e.extent)),e={dataProjection:i,featureProjection:e.featureProjection}}return this.adaptOptions(e)}adaptOptions(t){return Object.assign({dataProjection:this.dataProjection,featureProjection:this.defaultFeatureProjection,featureClass:this.featureClass},t)}getType(){return j()}readFeature(t,e){return j()}readFeatures(t,e){return j()}readGeometry(t,e){return j()}readProjection(t){return j()}writeFeature(t,e){return j()}writeFeatures(t,e){return j()}writeGeometry(t,e){return j()}}function my(n,t,e){const i=e?mt(e.featureProjection):null,s=e?mt(e.dataProjection):null;let r=n;if(i&&s&&!Ut(i,s)){const o=s,a=i;o.getUnits()==="tile-pixels"?r.transform(o,a):r.applyTransform($i(o,a))}return r}class py extends _y{constructor(t){super(),t=t||{},this.dataProjection=new dr({code:"",units:"tile-pixels"}),this.featureClass=t.featureClass?t.featureClass:Zt,this.geometryName_=t.geometryName,this.layerName_=t.layerName?t.layerName:"layer",this.layers_=t.layers?t.layers:null,this.idProperty_=t.idProperty,this.supportedMediaTypes=["application/vnd.mapbox-vector-tile","application/x-protobuf"]}readRawGeometry_(t,e,i,s){t.pos=e.geometry;const r=t.readVarint()+t.pos;let o=1,a=0,l=0,h=0,c=0,u=0;for(;t.pos<r;){if(!a){const d=t.readVarint();o=d&7,a=d>>3}if(a--,o===1||o===2)l+=t.readSVarint(),h+=t.readSVarint(),o===1&&c>u&&(s.push(c),u=c),i.push(l,h),c+=2;else if(o===7)c>u&&(i.push(i[u],i[u+1]),c+=2);else throw new Error("Invalid command found in the PBF")}c>u&&(s.push(c),u=c)}createFeature_(t,e,i){const s=e.type;if(s===0)return null;let r;const o=e.properties;let a;this.idProperty_?(a=o[this.idProperty_],delete o[this.idProperty_]):a=e.id,o[this.layerName_]=e.layer.name;const l=[],h=[];this.readRawGeometry_(t,e,l,h);const c=vy(s,h.length);if(this.featureClass===Zt)r=new this.featureClass(c,l,h,2,o,a),r.transform(i.dataProjection);else{let u;if(c=="Polygon"){const g=xc(l,h);u=g.length>1?new Or(l,"XY",g):new mi(l,"XY",h)}else u=c==="Point"?new ji(l,"XY"):c==="LineString"?new vn(l,"XY"):c==="MultiPoint"?new Mr(l,"XY"):c==="MultiLineString"?new Ar(l,"XY",h):null;const d=this.featureClass;r=new d,this.geometryName_&&r.setGeometryName(this.geometryName_);const f=my(u,!1,i);r.setGeometry(f),a!==void 0&&r.setId(a),r.setProperties(o,!0)}return r}getType(){return"arraybuffer"}readFeatures(t,e){const i=this.layers_;e=this.adaptOptions(e);const s=mt(e.dataProjection);s.setWorldExtent(e.extent),e.dataProjection=s;const r=new Q0(t),o=r.readFields(yy,{}),a=[];for(const l in o){if(i&&!i.includes(l))continue;const h=o[l],c=h?[0,0,h.extent,h.extent]:null;s.setExtent(c);for(let u=0,d=h.length;u<d;++u){const f=wy(r,h,u),g=this.createFeature_(r,f,e);g!==null&&a.push(g)}}return a}readProjection(t){return this.dataProjection}setLayers(t){this.layers_=t}}function yy(n,t,e){if(n===3){const i={keys:[],values:[],features:[]},s=e.readVarint()+e.pos;e.readFields(xy,i,s),i.length=i.features.length,i.length&&(t[i.name]=i)}}function xy(n,t,e){if(n===15)t.version=e.readVarint();else if(n===1)t.name=e.readString();else if(n===5)t.extent=e.readVarint();else if(n===2)t.features.push(e.pos);else if(n===3)t.keys.push(e.readString());else if(n===4){let i=null;const s=e.readVarint()+e.pos;for(;e.pos<s;)n=e.readVarint()>>3,i=n===1?e.readString():n===2?e.readFloat():n===3?e.readDouble():n===4?e.readVarint64():n===5?e.readVarint():n===6?e.readSVarint():n===7?e.readBoolean():null;t.values.push(i)}}function Ey(n,t,e){if(n==1)t.id=e.readVarint();else if(n==2){const i=e.readVarint()+e.pos;for(;e.pos<i;){const s=t.layer.keys[e.readVarint()],r=t.layer.values[e.readVarint()];t.properties[s]=r}}else n==3?t.type=e.readVarint():n==4&&(t.geometry=e.pos)}function wy(n,t,e){n.pos=t.features[e];const i=n.readVarint()+n.pos,s={layer:t,type:0,properties:{}};return n.readFields(Ey,s,i),s}function vy(n,t){let e;return n===1?e=t===1?"Point":"MultiPoint":n===2?e=t===1?"LineString":"MultiLineString":n===3&&(e="Polygon"),e}const ad=`
|
|
1
|
+
(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`}),typeof window<`u`&&((window.__svelte??={}).v??=new Set).add(`5`);var t={},n=Symbol(),r=Array.isArray,i=Array.prototype.indexOf,a=Array.prototype.includes,o=Array.from,s=Object.keys,c=Object.defineProperty,l=Object.getOwnPropertyDescriptor,u=Object.prototype,d=Array.prototype,f=Object.getPrototypeOf,p=Object.isExtensible,m=()=>{};function h(e){for(var t=0;t<e.length;t++)e[t]()}function g(){var e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}var _=1024,v=2048,y=4096,b=8192,x=16384,S=32768,C=1<<25,w=65536,T=1<<19,ee=1<<20,E=65536,D=1<<21,O=1<<23,k=Symbol(`$state`),te=Symbol(`legacy props`),ne=new class extends Error{name=`StaleReactionError`;message="The reaction that called `getAbortSignal()` was re-run or destroyed"};globalThis.document?.contentType;function re(e){throw Error(`https://svelte.dev/e/lifecycle_outside_component`)}function ie(e){throw Error(`https://svelte.dev/e/effect_in_teardown`)}function ae(){throw Error(`https://svelte.dev/e/effect_in_unowned_derived`)}function oe(e){throw Error(`https://svelte.dev/e/effect_orphan`)}function se(){throw Error(`https://svelte.dev/e/effect_update_depth_exceeded`)}function ce(){throw Error(`https://svelte.dev/e/hydration_failed`)}function le(e){throw Error(`https://svelte.dev/e/props_invalid_value`)}function ue(){throw Error(`https://svelte.dev/e/state_descriptors_fixed`)}function de(){throw Error(`https://svelte.dev/e/state_prototype_fixed`)}function fe(){throw Error(`https://svelte.dev/e/state_unsafe_mutation`)}function pe(){throw Error(`https://svelte.dev/e/svelte_boundary_reset_onerror`)}function me(e){console.warn(`https://svelte.dev/e/hydration_mismatch`)}function he(){console.warn(`https://svelte.dev/e/svelte_boundary_reset_noop`)}var ge=!1;function _e(e){ge=e}var A;function ve(e){if(e===null)throw me(),t;return A=e}function ye(){return ve(Wt(A))}function be(e){if(ge){if(Wt(A)!==null)throw me(),t;A=e}}function xe(e=1){if(ge){for(var t=e,n=A;t--;)n=Wt(n);A=n}}function Se(e=!0){for(var t=0,n=A;;){if(n.nodeType===8){var r=n.data;if(r===`]`){if(t===0)return n;--t}else (r===`[`||r===`[!`||r[0]===`[`&&!isNaN(Number(r.slice(1))))&&(t+=1)}var i=Wt(n);e&&n.remove(),n=i}}function Ce(e){return e===this.v}function we(e,t){return e==e?e!==t||typeof e==`object`&&!!e||typeof e==`function`:t==t}function Te(e){return!we(e,this.v)}var Ee=!1,De=!1,Oe=null;function ke(e){Oe=e}function Ae(e,t=!1,n){Oe={p:Oe,i:!1,c:null,e:null,s:e,x:null,r:N,l:De&&!t?{s:null,u:null,$:[]}:null}}function je(e){var t=Oe,n=t.e;if(n!==null){t.e=null;for(var r of n)an(r)}return e!==void 0&&(t.x=e),t.i=!0,Oe=t.p,e??{}}function Me(){return!De||Oe!==null&&Oe.l===null}var Ne=[];function Pe(){var e=Ne;Ne=[],h(e)}function Fe(e){if(Ne.length===0&&!Xe){var t=Ne;queueMicrotask(()=>{t===Ne&&Pe()})}Ne.push(e)}function Ie(){for(;Ne.length>0;)Pe()}function Le(e){var t=N;if(t===null)return M.f|=O,e;if(!(t.f&32768)&&!(t.f&4))throw e;Re(e,t)}function Re(e,t){for(;t!==null;){if(t.f&128){if(!(t.f&32768))throw e;try{t.b.error(e);return}catch(t){e=t}}t=t.parent}throw e}var ze=~(v|y|_);function Be(e,t){e.f=e.f&ze|t}function Ve(e){e.f&512||e.deps===null?Be(e,_):Be(e,y)}function He(e){if(e!==null)for(let t of e)!(t.f&2)||!(t.f&65536)||(t.f^=E,He(t.deps))}function Ue(e,t,n){e.f&2048?t.add(e):e.f&4096&&n.add(e),He(e.deps),Be(e,_)}var We=!1,Ge=!1;function Ke(e){var t=Ge;try{return Ge=!1,[e(),Ge]}finally{Ge=t}}var qe=new Set,j=null,Je=null,Ye=null,Xe=!1,Ze=!1,Qe=null,$e=null,et=0,tt=1,nt=class e{id=tt++;current=new Map;previous=new Map;#e=new Set;#t=new Set;#n=new Map;#r=new Map;#i=null;#a=[];#o=new Set;#s=new Set;#c=new Map;is_fork=!1;#l=!1;#u=new Set;#d(){return this.is_fork||this.#r.size>0}#f(){for(let n of this.#u)for(let r of n.#r.keys()){for(var e=!1,t=r;t.parent!==null;){if(this.#c.has(t)){e=!0;break}t=t.parent}if(!e)return!0}return!1}skip_effect(e){this.#c.has(e)||this.#c.set(e,{d:[],m:[]})}unskip_effect(e){var t=this.#c.get(e);if(t){this.#c.delete(e);for(var n of t.d)Be(n,v),this.schedule(n);for(n of t.m)Be(n,y),this.schedule(n)}}#p(){if(et++>1e3&&(qe.delete(this),it()),!this.#d()){for(let e of this.#o)this.#s.delete(e),Be(e,v),this.schedule(e);for(let e of this.#s)Be(e,y),this.schedule(e)}let t=this.#a;this.#a=[],this.apply();var n=Qe=[],r=[],i=$e=[];for(let e of t)try{this.#m(e,n,r)}catch(t){throw dt(e),t}if(j=null,i.length>0){var a=e.ensure();for(let e of i)a.schedule(e)}if(Qe=null,$e=null,this.#d()||this.#f()){this.#h(r),this.#h(n);for(let[e,t]of this.#c)ut(e,t)}else{this.#n.size===0&&qe.delete(this),this.#o.clear(),this.#s.clear();for(let e of this.#e)e(this);this.#e.clear(),ot(r),ot(n),this.#i?.resolve()}var o=j;if(this.#a.length>0){let e=o??=this;e.#a.push(...this.#a.filter(t=>!e.#a.includes(t)))}o!==null&&(qe.add(o),o.#p()),qe.has(this)||this.#g()}#m(e,t,n){e.f^=_;for(var r=e.first;r!==null;){var i=r.f,a=(i&96)!=0;if(!(a&&i&1024||i&8192||this.#c.has(r))&&r.fn!==null){a?r.f^=_:i&4?t.push(r):Ee&&i&16777224?n.push(r):zn(r)&&(i&16&&this.#s.add(r),Wn(r));var o=r.first;if(o!==null){r=o;continue}}for(;r!==null;){var s=r.next;if(s!==null){r=s;break}r=r.parent}}}#h(e){for(var t=0;t<e.length;t+=1)Ue(e[t],this.#o,this.#s)}capture(e,t,r=!1){t!==n&&!this.previous.has(e)&&this.previous.set(e,t),e.f&8388608||(this.current.set(e,[e.v,r]),Je?.set(e,e.v))}activate(){j=this}deactivate(){j=null,Je=null}flush(){try{Ze=!0,j=this,this.#p()}finally{et=0,Ye=null,Qe=null,$e=null,Ze=!1,j=null,Je=null,Et.clear()}}discard(){for(let e of this.#t)e(this);this.#t.clear(),qe.delete(this)}#g(){for(let c of qe){var e=c.id<this.id,t=[];for(let[r,[i,a]]of this.current){if(c.current.has(r)){var n=c.current.get(r)[0];if(e&&i!==n)c.current.set(r,[i,a]);else continue}t.push(r)}var r=[...c.current.keys()].filter(e=>!this.current.has(e));if(r.length===0)e&&c.discard();else if(t.length>0){c.activate();var i=new Set,a=new Map;for(var o of t)st(o,r,i,a);if(c.#a.length>0){c.apply();for(var s of c.#a)c.#m(s,[],[]);c.#a=[]}c.deactivate()}}for(let e of qe)e.#u.has(this)&&(e.#u.delete(this),e.#u.size===0&&!e.#d()&&(e.activate(),e.#p()))}increment(e,t){let n=this.#n.get(t)??0;if(this.#n.set(t,n+1),e){let e=this.#r.get(t)??0;this.#r.set(t,e+1)}}decrement(e,t,n){let r=this.#n.get(t)??0;if(r===1?this.#n.delete(t):this.#n.set(t,r-1),e){let e=this.#r.get(t)??0;e===1?this.#r.delete(t):this.#r.set(t,e-1)}this.#l||n||(this.#l=!0,Fe(()=>{this.#l=!1,this.flush()}))}transfer_effects(e,t){for(let t of e)this.#o.add(t);for(let e of t)this.#s.add(e);e.clear(),t.clear()}oncommit(e){this.#e.add(e)}ondiscard(e){this.#t.add(e)}settled(){return(this.#i??=g()).promise}static ensure(){if(j===null){let t=j=new e;Ze||(qe.add(j),Xe||Fe(()=>{j===t&&t.flush()}))}return j}apply(){if(!Ee||!this.is_fork&&qe.size===1){Je=null;return}Je=new Map;for(let[e,[t]]of this.current)Je.set(e,t);for(let n of qe)if(!(n===this||n.is_fork)){var e=!1,t=!1;if(n.id<this.id)for(let[r,[,i]]of n.current)i||(e||=this.current.has(r),t||=!this.current.has(r));if(e&&t)this.#u.add(n);else for(let[e,t]of n.previous)Je.has(e)||Je.set(e,t)}}schedule(e){if(Ye=e,e.b?.is_pending&&e.f&16777228&&!(e.f&32768)){e.b.defer_effect(e);return}for(var t=e;t.parent!==null;){t=t.parent;var n=t.f;if(Qe!==null&&t===N&&(Ee||(M===null||!(M.f&2))&&!We))return;if(n&96){if(!(n&1024))return;t.f^=_}}this.#a.push(t)}};function rt(e){var t=Xe;Xe=!0;try{var n;for(e&&(j!==null&&!j.is_fork&&j.flush(),n=e());;){if(Ie(),j===null)return n;j.flush()}}finally{Xe=t}}function it(){try{se()}catch(e){Re(e,Ye)}}var at=null;function ot(e){var t=e.length;if(t!==0){for(var n=0;n<t;){var r=e[n++];if(!(r.f&24576)&&zn(r)&&(at=new Set,Wn(r),r.deps===null&&r.first===null&&r.nodes===null&&r.teardown===null&&r.ac===null&&_n(r),at?.size>0)){Et.clear();for(let e of at){if(e.f&24576)continue;let t=[e],n=e.parent;for(;n!==null;)at.has(n)&&(at.delete(n),t.push(n)),n=n.parent;for(let e=t.length-1;e>=0;e--){let n=t[e];n.f&24576||Wn(n)}}at.clear()}}at=null}}function st(e,t,n,r){if(!n.has(e)&&(n.add(e),e.reactions!==null))for(let i of e.reactions){let e=i.f;e&2?st(i,t,n,r):e&4194320&&!(e&2048)&&ct(i,t,r)&&(Be(i,v),lt(i))}}function ct(e,t,n){let r=n.get(e);if(r!==void 0)return r;if(e.deps!==null)for(let r of e.deps){if(a.call(t,r))return!0;if(r.f&2&&ct(r,t,n))return n.set(r,!0),!0}return n.set(e,!1),!1}function lt(e){j.schedule(e)}function ut(e,t){if(!(e.f&32&&e.f&1024)){e.f&2048?t.d.push(e):e.f&4096&&t.m.push(e),Be(e,_);for(var n=e.first;n!==null;)ut(n,t),n=n.next}}function dt(e){Be(e,_);for(var t=e.first;t!==null;)dt(t),t=t.next}function ft(e){let t=0,n=Ot(0),r;return()=>{tn()&&(P(n),ln(()=>(t===0&&(r=qn(()=>e(()=>Pt(n)))),t+=1,()=>{Fe(()=>{--t,t===0&&(r?.(),r=void 0,Pt(n))})})))}}var pt=w|T;function mt(e,t,n,r){new ht(e,t,n,r)}var ht=class{parent;is_pending=!1;transform_error;#e;#t=ge?A:null;#n;#r;#i;#a=null;#o=null;#s=null;#c=null;#l=0;#u=0;#d=!1;#f=new Set;#p=new Set;#m=null;#h=ft(()=>(this.#m=Ot(this.#l),()=>{this.#m=null}));constructor(e,t,n,r){this.#e=e,this.#n=t,this.#r=e=>{var t=N;t.b=this,t.f|=128,n(e)},this.parent=N.b,this.transform_error=r??this.parent?.transform_error??(e=>e),this.#i=un(()=>{if(ge){let e=this.#t;ye();let t=e.data===`[!`;if(e.data.startsWith(`[?`)){let t=JSON.parse(e.data.slice(2));this.#_(t)}else t?this.#v():this.#g()}else this.#y()},pt),ge&&(this.#e=A)}#g(){try{this.#a=dn(()=>this.#r(this.#e))}catch(e){this.error(e)}}#_(e){let t=this.#n.failed;t&&(this.#s=dn(()=>{t(this.#e,()=>e,()=>()=>{})}))}#v(){let e=this.#n.pending;e&&(this.is_pending=!0,this.#o=dn(()=>e(this.#e)),Fe(()=>{var e=this.#c=document.createDocumentFragment(),t=Ht();e.append(t),this.#a=this.#x(()=>dn(()=>this.#r(t))),this.#u===0&&(this.#e.before(e),this.#c=null,vn(this.#o,()=>{this.#o=null}),this.#b(j))}))}#y(){try{if(this.is_pending=this.has_pending_snippet(),this.#u=0,this.#l=0,this.#a=dn(()=>{this.#r(this.#e)}),this.#u>0){var e=this.#c=document.createDocumentFragment();bn(this.#a,e);let t=this.#n.pending;this.#o=dn(()=>t(this.#e))}else this.#b(j)}catch(e){this.error(e)}}#b(e){this.is_pending=!1,e.transfer_effects(this.#f,this.#p)}defer_effect(e){Ue(e,this.#f,this.#p)}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!this.#n.pending}#x(e){var t=N,n=M,r=Oe;Dn(this.#i),En(this.#i),ke(this.#i.ctx);try{return nt.ensure(),e()}catch(e){return Le(e),null}finally{Dn(t),En(n),ke(r)}}#S(e,t){if(!this.has_pending_snippet()){this.parent&&this.parent.#S(e,t);return}this.#u+=e,this.#u===0&&(this.#b(t),this.#o&&vn(this.#o,()=>{this.#o=null}),this.#c&&=(this.#e.before(this.#c),null))}update_pending_count(e,t){this.#S(e,t),this.#l+=e,!(!this.#m||this.#d)&&(this.#d=!0,Fe(()=>{this.#d=!1,this.#m&&Mt(this.#m,this.#l)}))}get_effect_pending(){return this.#h(),P(this.#m)}error(e){var t=this.#n.onerror;let n=this.#n.failed;if(!t&&!n)throw e;this.#a&&=(hn(this.#a),null),this.#o&&=(hn(this.#o),null),this.#s&&=(hn(this.#s),null),ge&&(ve(this.#t),xe(),ve(Se()));var r=!1,i=!1;let a=()=>{if(r){he();return}r=!0,i&&pe(),this.#s!==null&&vn(this.#s,()=>{this.#s=null}),this.#x(()=>{this.#y()})},o=e=>{try{i=!0,t?.(e,a),i=!1}catch(e){Re(e,this.#i&&this.#i.parent)}n&&(this.#s=this.#x(()=>{try{return dn(()=>{var t=N;t.b=this,t.f|=128,n(this.#e,()=>e,()=>a)})}catch(e){return Re(e,this.#i.parent),null}}))};Fe(()=>{var t;try{t=this.transform_error(e)}catch(e){Re(e,this.#i&&this.#i.parent);return}typeof t==`object`&&t&&typeof t.then==`function`?t.then(o,e=>Re(e,this.#i&&this.#i.parent)):o(t)})}};function gt(e){var t=2|v,r=M!==null&&M.f&2?M:null;return N!==null&&(N.f|=T),{ctx:Oe,deps:null,effects:null,equals:Ce,f:t,fn:e,reactions:null,rv:0,v:n,wv:0,parent:r??N,ac:null}}function _t(e){let t=gt(e);return Ee||kn(t),t}function vt(e){let t=gt(e);return t.equals=Te,t}function yt(e){var t=e.effects;if(t!==null){e.effects=null;for(var n=0;n<t.length;n+=1)hn(t[n])}}function bt(e){for(var t=e.parent;t!==null;){if(!(t.f&2))return t.f&16384?null:t;t=t.parent}return null}function xt(e){var t,n=N;Dn(bt(e));try{e.f&=~E,yt(e),t=Vn(e)}finally{Dn(n)}return t}function St(e){var t=e.v,n=xt(e);if(!e.equals(n)&&(e.wv=Rn(),(!j?.is_fork||e.deps===null)&&(e.v=n,j?.capture(e,t,!0),e.deps===null))){Be(e,_);return}Cn||(Je===null?Ve(e):(tn()||j?.is_fork)&&Je.set(e,n))}function Ct(e){if(e.effects!==null)for(let t of e.effects)(t.teardown||t.ac)&&(t.teardown?.(),t.ac?.abort(ne),t.teardown=m,t.ac=null,Un(t,0),pn(t))}function wt(e){if(e.effects!==null)for(let t of e.effects)t.teardown&&Wn(t)}var Tt=new Set,Et=new Map,Dt=!1;function Ot(e,t){return{f:0,v:e,reactions:null,equals:Ce,rv:0,wv:0}}function kt(e,t){let n=Ot(e,t);return kn(n),n}function At(e,t=!1,n=!0){let r=Ot(e);return t||(r.equals=Te),De&&n&&Oe!==null&&Oe.l!==null&&(Oe.l.s??=[]).push(r),r}function jt(e,t,n=!1){return M!==null&&(!Tn||M.f&131072)&&Me()&&M.f&4325394&&(On===null||!a.call(On,e))&&fe(),Mt(e,n?It(t):t,$e)}function Mt(e,t,n=null){if(!e.equals(t)){var r=e.v;Cn?Et.set(e,t):Et.set(e,r),e.v=t;var i=nt.ensure();if(i.capture(e,r),e.f&2){let t=e;e.f&2048&&xt(t),Je===null&&Ve(t)}e.wv=Rn(),Ft(e,v,n),Me()&&N!==null&&N.f&1024&&!(N.f&96)&&(Mn===null?Nn([e]):Mn.push(e)),!i.is_fork&&Tt.size>0&&!Dt&&Nt()}return t}function Nt(){Dt=!1;for(let e of Tt)e.f&1024&&Be(e,y),zn(e)&&Wn(e);Tt.clear()}function Pt(e){jt(e,e.v+1)}function Ft(e,t,n){var r=e.reactions;if(r!==null)for(var i=Me(),a=r.length,o=0;o<a;o++){var s=r[o],c=s.f;if(!(!i&&s===N)){var l=(c&v)===0;if(l&&Be(s,t),c&2){var u=s;Je?.delete(u),c&65536||(c&512&&(s.f|=E),Ft(u,y,n))}else if(l){var d=s;c&16&&at!==null&&at.add(d),n===null?lt(d):n.push(d)}}}}function It(e){if(typeof e!=`object`||!e||k in e)return e;let t=f(e);if(t!==u&&t!==d)return e;var i=new Map,a=r(e),o=kt(0),s=null,c=In,p=e=>{if(In===c)return e();var t=M,n=In;En(null),Ln(c);var r=e();return En(t),Ln(n),r};return a&&i.set(`length`,kt(e.length,s)),new Proxy(e,{defineProperty(e,t,n){(!(`value`in n)||n.configurable===!1||n.enumerable===!1||n.writable===!1)&&ue();var r=i.get(t);return r===void 0?p(()=>{var e=kt(n.value,s);return i.set(t,e),e}):jt(r,n.value,!0),!0},deleteProperty(e,t){var r=i.get(t);if(r===void 0){if(t in e){let e=p(()=>kt(n,s));i.set(t,e),Pt(o)}}else jt(r,n),Pt(o);return!0},get(t,r,a){if(r===k)return e;var o=i.get(r),c=r in t;if(o===void 0&&(!c||l(t,r)?.writable)&&(o=p(()=>kt(It(c?t[r]:n),s)),i.set(r,o)),o!==void 0){var u=P(o);return u===n?void 0:u}return Reflect.get(t,r,a)},getOwnPropertyDescriptor(e,t){var r=Reflect.getOwnPropertyDescriptor(e,t);if(r&&`value`in r){var a=i.get(t);a&&(r.value=P(a))}else if(r===void 0){var o=i.get(t),s=o?.v;if(o!==void 0&&s!==n)return{enumerable:!0,configurable:!0,value:s,writable:!0}}return r},has(e,t){if(t===k)return!0;var r=i.get(t),a=r!==void 0&&r.v!==n||Reflect.has(e,t);return(r!==void 0||N!==null&&(!a||l(e,t)?.writable))&&(r===void 0&&(r=p(()=>kt(a?It(e[t]):n,s)),i.set(t,r)),P(r)===n)?!1:a},set(e,t,r,c){var u=i.get(t),d=t in e;if(a&&t===`length`)for(var f=r;f<u.v;f+=1){var m=i.get(f+``);m===void 0?f in e&&(m=p(()=>kt(n,s)),i.set(f+``,m)):jt(m,n)}if(u===void 0)(!d||l(e,t)?.writable)&&(u=p(()=>kt(void 0,s)),jt(u,It(r)),i.set(t,u));else{d=u.v!==n;var h=p(()=>It(r));jt(u,h)}var g=Reflect.getOwnPropertyDescriptor(e,t);if(g?.set&&g.set.call(c,r),!d){if(a&&typeof t==`string`){var _=i.get(`length`),v=Number(t);Number.isInteger(v)&&v>=_.v&&jt(_,v+1)}Pt(o)}return!0},ownKeys(e){P(o);var t=Reflect.ownKeys(e).filter(e=>{var t=i.get(e);return t===void 0||t.v!==n});for(var[r,a]of i)a.v!==n&&!(r in e)&&t.push(r);return t},setPrototypeOf(){de()}})}var Lt,Rt,zt,Bt;function Vt(){if(Lt===void 0){Lt=window,Rt=/Firefox/.test(navigator.userAgent);var e=Element.prototype,t=Node.prototype,n=Text.prototype;zt=l(t,`firstChild`).get,Bt=l(t,`nextSibling`).get,p(e)&&(e.__click=void 0,e.__className=void 0,e.__attributes=null,e.__style=void 0,e.__e=void 0),p(n)&&(n.__t=void 0)}}function Ht(e=``){return document.createTextNode(e)}function Ut(e){return zt.call(e)}function Wt(e){return Bt.call(e)}function Gt(e,t){if(!ge)return Ut(e);var n=Ut(A);if(n===null)n=A.appendChild(Ht());else if(t&&n.nodeType!==3){var r=Ht();return n?.before(r),ve(r),r}return t&&Xt(n),ve(n),n}function Kt(e,t=!1){if(!ge){var n=Ut(e);return n instanceof Comment&&n.data===``?Wt(n):n}if(t){if(A?.nodeType!==3){var r=Ht();return A?.before(r),ve(r),r}Xt(A)}return A}function qt(e,t=1,n=!1){let r=ge?A:e;for(var i;t--;)i=r,r=Wt(r);if(!ge)return r;if(n){if(r?.nodeType!==3){var a=Ht();return r===null?i?.after(a):r.before(a),ve(a),a}Xt(r)}return ve(r),r}function Jt(e){e.textContent=``}function Yt(e,t,n){let r=n?{is:n}:void 0;return document.createElementNS(t??`http://www.w3.org/1999/xhtml`,e,r)}function Xt(e){if(e.nodeValue.length<65536)return;let t=e.nextSibling;for(;t!==null&&t.nodeType===3;)t.remove(),e.nodeValue+=t.nodeValue,t=e.nextSibling}function Zt(e){var t=M,n=N;En(null),Dn(null);try{return e()}finally{En(t),Dn(n)}}function Qt(e){N===null&&(M===null&&oe(e),ae()),Cn&&ie(e)}function $t(e,t){var n=t.last;n===null?t.last=t.first=e:(n.next=e,e.prev=n,t.last=e)}function en(e,t){var n=N;n!==null&&n.f&8192&&(e|=b);var r={ctx:Oe,deps:null,nodes:null,f:e|v|512,first:null,fn:t,last:null,next:null,parent:n,b:n&&n.b,prev:null,teardown:null,wv:0,ac:null},i=r;if(e&4)Qe===null?nt.ensure().schedule(r):Qe.push(r);else if(t!==null){try{Wn(r)}catch(e){throw hn(r),e}i.deps===null&&i.teardown===null&&i.nodes===null&&i.first===i.last&&!(i.f&524288)&&(i=i.first,e&16&&e&65536&&i!==null&&(i.f|=w))}if(i!==null&&(i.parent=n,n!==null&&$t(i,n),M!==null&&M.f&2&&!(e&64))){var a=M;(a.effects??=[]).push(i)}return r}function tn(){return M!==null&&!Tn}function nn(e){let t=en(8,null);return Be(t,_),t.teardown=e,t}function rn(e){Qt(`$effect`);var t=N.f;if(!M&&t&32&&!(t&32768)){var n=Oe;(n.e??=[]).push(e)}else return an(e)}function an(e){return en(4|ee,e)}function on(e){nt.ensure();let t=en(64|T,e);return()=>{hn(t)}}function sn(e){nt.ensure();let t=en(64|T,e);return(e={})=>new Promise(n=>{e.outro?vn(t,()=>{hn(t),n(void 0)}):(hn(t),n(void 0))})}function cn(e){return en(4,e)}function ln(e,t=0){return en(8|t,e)}function un(e,t=0){return en(16|t,e)}function dn(e){return en(32|T,e)}function fn(e){var t=e.teardown;if(t!==null){let e=Cn,n=M;wn(!0),En(null);try{t.call(null)}finally{wn(e),En(n)}}}function pn(e,t=!1){var n=e.first;for(e.first=e.last=null;n!==null;){let e=n.ac;e!==null&&Zt(()=>{e.abort(ne)});var r=n.next;n.f&64?n.parent=null:hn(n,t),n=r}}function mn(e){for(var t=e.first;t!==null;){var n=t.next;t.f&32||hn(t),t=n}}function hn(e,t=!0){var n=!1;(t||e.f&262144)&&e.nodes!==null&&e.nodes.end!==null&&(gn(e.nodes.start,e.nodes.end),n=!0),Be(e,C),pn(e,t&&!n),Un(e,0);var r=e.nodes&&e.nodes.t;if(r!==null)for(let e of r)e.stop();fn(e),e.f^=C,e.f|=x;var i=e.parent;i!==null&&i.first!==null&&_n(e),e.next=e.prev=e.teardown=e.ctx=e.deps=e.fn=e.nodes=e.ac=e.b=null}function gn(e,t){for(;e!==null;){var n=e===t?null:Wt(e);e.remove(),e=n}}function _n(e){var t=e.parent,n=e.prev,r=e.next;n!==null&&(n.next=r),r!==null&&(r.prev=n),t!==null&&(t.first===e&&(t.first=r),t.last===e&&(t.last=n))}function vn(e,t,n=!0){var r=[];yn(e,r,!0);var i=()=>{n&&hn(e),t&&t()},a=r.length;if(a>0){var o=()=>--a||i();for(var s of r)s.out(o)}else i()}function yn(e,t,n){if(!(e.f&8192)){e.f^=b;var r=e.nodes&&e.nodes.t;if(r!==null)for(let e of r)(e.is_global||n)&&t.push(e);for(var i=e.first;i!==null;){var a=i.next,o=(i.f&65536)!=0||(i.f&32)!=0&&(e.f&16)!=0;yn(i,t,o?n:!1),i=a}}}function bn(e,t){if(e.nodes)for(var n=e.nodes.start,r=e.nodes.end;n!==null;){var i=n===r?null:Wt(n);t.append(n),n=i}}var xn=null,Sn=!1,Cn=!1;function wn(e){Cn=e}var M=null,Tn=!1;function En(e){M=e}var N=null;function Dn(e){N=e}var On=null;function kn(e){M!==null&&(!Ee||M.f&2)&&(On===null?On=[e]:On.push(e))}var An=null,jn=0,Mn=null;function Nn(e){Mn=e}var Pn=1,Fn=0,In=Fn;function Ln(e){In=e}function Rn(){return++Pn}function zn(e){var t=e.f;if(t&2048)return!0;if(t&2&&(e.f&=~E),t&4096){for(var n=e.deps,r=n.length,i=0;i<r;i++){var a=n[i];if(zn(a)&&St(a),a.wv>e.wv)return!0}t&512&&Je===null&&Be(e,_)}return!1}function Bn(e,t,n=!0){var r=e.reactions;if(r!==null&&!(!Ee&&On!==null&&a.call(On,e)))for(var i=0;i<r.length;i++){var o=r[i];o.f&2?Bn(o,t,!1):t===o&&(n?Be(o,v):o.f&1024&&Be(o,y),lt(o))}}function Vn(e){var t=An,n=jn,r=Mn,i=M,a=On,o=Oe,s=Tn,c=In,l=e.f;An=null,jn=0,Mn=null,M=l&96?null:e,On=null,ke(e.ctx),Tn=!1,In=++Fn,e.ac!==null&&(Zt(()=>{e.ac.abort(ne)}),e.ac=null);try{e.f|=D;var u=e.fn,d=u();e.f|=S;var f=e.deps,p=j?.is_fork;if(An!==null){var m;if(p||Un(e,jn),f!==null&&jn>0)for(f.length=jn+An.length,m=0;m<An.length;m++)f[jn+m]=An[m];else e.deps=f=An;if(tn()&&e.f&512)for(m=jn;m<f.length;m++)(f[m].reactions??=[]).push(e)}else !p&&f!==null&&jn<f.length&&(Un(e,jn),f.length=jn);if(Me()&&Mn!==null&&!Tn&&f!==null&&!(e.f&6146))for(m=0;m<Mn.length;m++)Bn(Mn[m],e);if(i!==null&&i!==e){if(Fn++,i.deps!==null)for(let e=0;e<n;e+=1)i.deps[e].rv=Fn;if(t!==null)for(let e of t)e.rv=Fn;Mn!==null&&(r===null?r=Mn:r.push(...Mn))}return e.f&8388608&&(e.f^=O),d}catch(e){return Le(e)}finally{e.f^=D,An=t,jn=n,Mn=r,M=i,On=a,ke(o),Tn=s,In=c}}function Hn(e,t){let n=t.reactions;if(n!==null){var r=i.call(n,e);if(r!==-1){var o=n.length-1;o===0?n=t.reactions=null:(n[r]=n[o],n.pop())}}if(n===null&&t.f&2&&(An===null||!a.call(An,t))){var s=t;s.f&512&&(s.f^=512,s.f&=~E),Ve(s),Ct(s),Un(s,0)}}function Un(e,t){var n=e.deps;if(n!==null)for(var r=t;r<n.length;r++)Hn(e,n[r])}function Wn(e){var t=e.f;if(!(t&16384)){Be(e,_);var n=N,r=Sn;N=e,Sn=!0;try{t&16777232?mn(e):pn(e),fn(e);var i=Vn(e);e.teardown=typeof i==`function`?i:null,e.wv=Pn}finally{Sn=r,N=n}}}function P(e){var t=(e.f&2)!=0;if(xn?.add(e),M!==null&&!Tn&&!(N!==null&&N.f&16384)&&(On===null||!a.call(On,e))){var n=M.deps;if(M.f&2097152)e.rv<Fn&&(e.rv=Fn,An===null&&n!==null&&n[jn]===e?jn++:An===null?An=[e]:An.push(e));else{(M.deps??=[]).push(e);var r=e.reactions;r===null?e.reactions=[M]:a.call(r,M)||r.push(M)}}if(Cn&&Et.has(e))return Et.get(e);if(t){var i=e;if(Cn){var o=i.v;return(!(i.f&1024)&&i.reactions!==null||Kn(i))&&(o=xt(i)),Et.set(i,o),o}var s=(i.f&512)==0&&!Tn&&M!==null&&(Sn||(M.f&512)!=0),c=(i.f&S)===0;zn(i)&&(s&&(i.f|=512),St(i)),s&&!c&&(wt(i),Gn(i))}if(Je?.has(e))return Je.get(e);if(e.f&8388608)throw e.v;return e.v}function Gn(e){if(e.f|=512,e.deps!==null)for(let t of e.deps)(t.reactions??=[]).push(e),t.f&2&&!(t.f&512)&&(wt(t),Gn(t))}function Kn(e){if(e.v===n)return!0;if(e.deps===null)return!1;for(let t of e.deps)if(Et.has(t)||t.f&2&&Kn(t))return!0;return!1}function qn(e){var t=Tn;try{return Tn=!0,e()}finally{Tn=t}}var Jn=Symbol(`events`),Yn=new Set,Xn=new Set;function Zn(e,t,n,r={}){function i(e){if(r.capture||nr.call(t,e),!e.cancelBubble)return Zt(()=>n?.call(this,e))}return e.startsWith(`pointer`)||e.startsWith(`touch`)||e===`wheel`?Fe(()=>{t.addEventListener(e,i,r)}):t.addEventListener(e,i,r),i}function Qn(e,t,n,r,i){var a={capture:r,passive:i},o=Zn(e,t,n,a);(t===document.body||t===window||t===document||t instanceof HTMLMediaElement)&&nn(()=>{t.removeEventListener(e,o,a)})}function $n(e,t,n){(t[Jn]??={})[e]=n}function er(e){for(var t=0;t<e.length;t++)Yn.add(e[t]);for(var n of Xn)n(e)}var tr=null;function nr(e){var t=this,n=t.ownerDocument,r=e.type,i=e.composedPath?.()||[],a=i[0]||e.target;tr=e;var o=0,s=tr===e&&e[Jn];if(s){var l=i.indexOf(s);if(l!==-1&&(t===document||t===window)){e[Jn]=t;return}var u=i.indexOf(t);if(u===-1)return;l<=u&&(o=l)}if(a=i[o]||e.target,a!==t){c(e,`currentTarget`,{configurable:!0,get(){return a||n}});var d=M,f=N;En(null),Dn(null);try{for(var p,m=[];a!==null;){var h=a.assignedSlot||a.parentNode||a.host||null;try{var g=a[Jn]?.[r];g!=null&&(!a.disabled||e.target===a)&&g.call(a,e)}catch(e){p?m.push(e):p=e}if(e.cancelBubble||h===t||h===null)break;a=h}if(p){for(let e of m)queueMicrotask(()=>{throw e});throw p}}finally{e[Jn]=t,delete e.currentTarget,En(d),Dn(f)}}}var rr=globalThis?.window?.trustedTypes&&globalThis.window.trustedTypes.createPolicy(`svelte-trusted-html`,{createHTML:e=>e});function ir(e){return rr?.createHTML(e)??e}function ar(e){var t=Yt(`template`);return t.innerHTML=ir(e.replaceAll(`<!>`,`<!---->`)),t.content}function or(e,t){var n=N;n.nodes===null&&(n.nodes={start:e,end:t,a:null,t:null})}function sr(e,t){var n=(t&1)!=0,r=(t&2)!=0,i,a=!e.startsWith(`<!>`);return()=>{if(ge)return or(A,null),A;i===void 0&&(i=ar(a?e:`<!>`+e),n||(i=Ut(i)));var t=r||Rt?document.importNode(i,!0):i.cloneNode(!0);if(n){var o=Ut(t),s=t.lastChild;or(o,s)}else or(t,t);return t}}function cr(e,t){if(ge){var n=N;(!(n.f&32768)||n.nodes.end===null)&&(n.nodes.end=A),ye();return}e!==null&&e.before(t)}[...`allowfullscreen.async.autofocus.autoplay.checked.controls.default.disabled.formnovalidate.indeterminate.inert.ismap.loop.multiple.muted.nomodule.novalidate.open.playsinline.readonly.required.reversed.seamless.selected.webkitdirectory.defer.disablepictureinpicture.disableremoteplayback`.split(`.`)];var lr=[`touchstart`,`touchmove`];function ur(e){return lr.includes(e)}function dr(e,t){return mr(e,t)}function fr(e,n){Vt(),n.intro=n.intro??!1;let r=n.target,i=ge,a=A;try{for(var o=Ut(r);o&&(o.nodeType!==8||o.data!==`[`);)o=Wt(o);if(!o)throw t;_e(!0),ve(o);let i=mr(e,{...n,anchor:o});return _e(!1),i}catch(i){if(i instanceof Error&&i.message.split(`
|
|
2
|
+
`).some(e=>e.startsWith(`https://svelte.dev/e/`)))throw i;return i!==t&&console.warn(`Failed to hydrate: `,i),n.recover===!1&&ce(),Vt(),Jt(r),_e(!1),dr(e,n)}finally{_e(i),ve(a)}}var pr=new Map;function mr(e,{target:n,anchor:r,props:i={},events:a,context:s,intro:c=!0,transformError:l}){Vt();var u=void 0,d=sn(()=>{var c=r??n.appendChild(Ht());mt(c,{pending:()=>{}},n=>{Ae({});var r=Oe;if(s&&(r.c=s),a&&(i.$$events=a),ge&&or(n,null),u=e(n,i)||{},ge&&(N.nodes.end=A,A===null||A.nodeType!==8||A.data!==`]`))throw me(),t;je()},l);var d=new Set,f=e=>{for(var t=0;t<e.length;t++){var r=e[t];if(!d.has(r)){d.add(r);var i=ur(r);for(let e of[n,document]){var a=pr.get(e);a===void 0&&(a=new Map,pr.set(e,a));var o=a.get(r);o===void 0?(e.addEventListener(r,nr,{passive:i}),a.set(r,1)):a.set(r,o+1)}}}};return f(o(Yn)),Xn.add(f),()=>{for(var e of d)for(let r of[n,document]){var t=pr.get(r),i=t.get(e);--i==0?(r.removeEventListener(e,nr),t.delete(e),t.size===0&&pr.delete(r)):t.set(e,i)}Xn.delete(f),c!==r&&c.parentNode?.removeChild(c)}});return hr.set(u,d),u}var hr=new WeakMap;function gr(e,t){let n=hr.get(e);return n?(hr.delete(e),n(t)):Promise.resolve()}function _r(e){Oe===null&&re(`onMount`),De&&Oe.l!==null?vr(Oe).m.push(e):rn(()=>{let t=qn(e);if(typeof t==`function`)return t})}function vr(e){var t=e.l;return t.u??={a:[],b:[],m:[]}}function yr(e,t){cn(()=>{var n=e.getRootNode(),r=n.host?n:n.head??n.ownerDocument.head;if(!r.querySelector(`#`+t.hash)){let e=Yt(`style`);e.id=t.hash,e.textContent=t.code,r.appendChild(e)}})}function br(e,t,n,r){var i=!De||(n&2)!=0,a=(n&8)!=0,o=(n&16)!=0,s=r,c=!0,u=()=>(c&&(c=!1,s=o?qn(r):r),s);let d;if(a){var f=k in e||te in e;d=l(e,t)?.set??(f&&t in e?n=>e[t]=n:void 0)}var p,m=!1;a?[p,m]=Ke(()=>e[t]):p=e[t],p===void 0&&r!==void 0&&(p=u(),d&&(i&&le(t),d(p)));var h=i?()=>{var n=e[t];return n===void 0?u():(c=!0,n)}:()=>{var n=e[t];return n!==void 0&&(s=void 0),n===void 0?s:n};if(i&&!(n&4))return h;if(d){var g=e.$$legacy;return(function(e,t){return arguments.length>0?((!i||!t||g||m)&&d(t?h():e),e):h()})}var _=!1,v=(n&1?gt:vt)(()=>(_=!1,h()));a&&P(v);var y=N;return(function(e,t){if(arguments.length>0){let n=t?P(v):i&&a?It(e):e;return jt(v,n),_=!0,s!==void 0&&(s=n),e}return Cn&&_||y.f&16384?v.v:P(v)})}function xr(e){return new Sr(e)}var Sr=class{#e;#t;constructor(e){var t=new Map,n=(e,n)=>{var r=At(n,!1,!1);return t.set(e,r),r};let r=new Proxy({...e.props||{},$$events:{}},{get(e,r){return P(t.get(r)??n(r,Reflect.get(e,r)))},has(e,r){return r===te?!0:(P(t.get(r)??n(r,Reflect.get(e,r))),Reflect.has(e,r))},set(e,r,i){return jt(t.get(r)??n(r,i),i),Reflect.set(e,r,i)}});this.#t=(e.hydrate?fr:dr)(e.component,{target:e.target,anchor:e.anchor,props:r,context:e.context,intro:e.intro??!1,recover:e.recover,transformError:e.transformError}),!Ee&&(!e?.props?.$$host||e.sync===!1)&&rt(),this.#e=r.$$events;for(let e of Object.keys(this.#t))e===`$set`||e===`$destroy`||e===`$on`||c(this,e,{get(){return this.#t[e]},set(t){this.#t[e]=t},enumerable:!0});this.#t.$set=e=>{Object.assign(r,e)},this.#t.$destroy=()=>{gr(this.#t)}}$set(e){this.#t.$set(e)}$on(e,t){this.#e[e]=this.#e[e]||[];let n=(...e)=>t.call(this,...e);return this.#e[e].push(n),()=>{this.#e[e]=this.#e[e].filter(e=>e!==n)}}$destroy(){this.#t.$destroy()}},Cr;typeof HTMLElement==`function`&&(Cr=class extends HTMLElement{$$ctor;$$s;$$c;$$cn=!1;$$d={};$$r=!1;$$p_d={};$$l={};$$l_u=new Map;$$me;$$shadowRoot=null;constructor(e,t,n){super(),this.$$ctor=e,this.$$s=t,n&&(this.$$shadowRoot=this.attachShadow(n))}addEventListener(e,t,n){if(this.$$l[e]=this.$$l[e]||[],this.$$l[e].push(t),this.$$c){let n=this.$$c.$on(e,t);this.$$l_u.set(t,n)}super.addEventListener(e,t,n)}removeEventListener(e,t,n){if(super.removeEventListener(e,t,n),this.$$c){let e=this.$$l_u.get(t);e&&(e(),this.$$l_u.delete(t))}}async connectedCallback(){if(this.$$cn=!0,!this.$$c){if(await Promise.resolve(),!this.$$cn||this.$$c)return;function e(e){return t=>{let n=Yt(`slot`);e!==`default`&&(n.name=e),cr(t,n)}}let t={},n=Tr(this);for(let r of this.$$s)r in n&&(r===`default`&&!this.$$d.children?(this.$$d.children=e(r),t.default=!0):t[r]=e(r));for(let e of this.attributes){let t=this.$$g_p(e.name);t in this.$$d||(this.$$d[t]=wr(t,e.value,this.$$p_d,`toProp`))}for(let e in this.$$p_d)!(e in this.$$d)&&this[e]!==void 0&&(this.$$d[e]=this[e],delete this[e]);this.$$c=xr({component:this.$$ctor,target:this.$$shadowRoot||this,props:{...this.$$d,$$slots:t,$$host:this}}),this.$$me=on(()=>{ln(()=>{this.$$r=!0;for(let e of s(this.$$c)){if(!this.$$p_d[e]?.reflect)continue;this.$$d[e]=this.$$c[e];let t=wr(e,this.$$d[e],this.$$p_d,`toAttribute`);t==null?this.removeAttribute(this.$$p_d[e].attribute||e):this.setAttribute(this.$$p_d[e].attribute||e,t)}this.$$r=!1})});for(let e in this.$$l)for(let t of this.$$l[e]){let n=this.$$c.$on(e,t);this.$$l_u.set(t,n)}this.$$l={}}}attributeChangedCallback(e,t,n){this.$$r||(e=this.$$g_p(e),this.$$d[e]=wr(e,n,this.$$p_d,`toProp`),this.$$c?.$set({[e]:this.$$d[e]}))}disconnectedCallback(){this.$$cn=!1,Promise.resolve().then(()=>{!this.$$cn&&this.$$c&&(this.$$c.$destroy(),this.$$me(),this.$$c=void 0)})}$$g_p(e){return s(this.$$p_d).find(t=>this.$$p_d[t].attribute===e||!this.$$p_d[t].attribute&&t.toLowerCase()===e)||e}});function wr(e,t,n,r){let i=n[e]?.type;if(t=i===`Boolean`&&typeof t!=`boolean`?t!=null:t,!r||!n[e])return t;if(r===`toAttribute`)switch(i){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(i){case`Object`:case`Array`:return t&&JSON.parse(t);case`Boolean`:return t;case`Number`:return t==null?t:+t;default:return t}}function Tr(e){let t={};return e.childNodes.forEach(e=>{t[e.slot||`default`]=!0}),t}function Er(e,t,n,r,i,a){let o=class extends Cr{constructor(){super(e,n,i),this.$$p_d=t}static get observedAttributes(){return s(t).map(e=>(t[e].attribute||e).toLowerCase())}};return s(t).forEach(e=>{c(o.prototype,e,{get(){return this.$$c&&e in this.$$c?this.$$c[e]:this.$$d[e]},set(n){n=wr(e,n,t),this.$$d[e]=n;var r=this.$$c;r&&(l(r,e)?.get?r[e]=n:r.$set({[e]:n}))}})}),r.forEach(e=>{c(o.prototype,e,{get(){return this.$$c?.[e]}})}),a&&(o=a(o)),e.element=o,o}var Dr={ADD:`add`,REMOVE:`remove`},Or={PROPERTYCHANGE:`propertychange`},F={CHANGE:`change`,ERROR:`error`,BLUR:`blur`,CLEAR:`clear`,CONTEXTMENU:`contextmenu`,CLICK:`click`,DBLCLICK:`dblclick`,DRAGENTER:`dragenter`,DRAGOVER:`dragover`,DROP:`drop`,FOCUS:`focus`,KEYDOWN:`keydown`,KEYPRESS:`keypress`,LOAD:`load`,RESIZE:`resize`,TOUCHMOVE:`touchmove`,WHEEL:`wheel`},kr=class{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}};function Ar(e,t,n){let r,i;n||=jr;let a=0,o=e.length,s=!1;for(;a<o;)r=a+(o-a>>1),i=+n(e[r],t),i<0?a=r+1:(o=r,s=!i);return s?a:~a}function jr(e,t){return e>t?1:e<t?-1:0}function Mr(e,t){return e<t?1:e>t?-1:0}function Nr(e,t,n){if(e[0]<=t)return 0;let r=e.length;if(t<=e[r-1])return r-1;if(typeof n==`function`){for(let i=1;i<r;++i){let r=e[i];if(r===t)return i;if(r<t)return n(t,e[i-1],r)>0?i-1:i}return r-1}if(n>0){for(let n=1;n<r;++n)if(e[n]<t)return n-1;return r-1}if(n<0){for(let n=1;n<r;++n)if(e[n]<=t)return n;return r-1}for(let n=1;n<r;++n){if(e[n]==t)return n;if(e[n]<t)return e[n-1]-t<t-e[n]?n-1:n}return r-1}function Pr(e,t,n){for(;t<n;){let r=e[t];e[t]=e[n],e[n]=r,++t,--n}}function Fr(e,t){let n=Array.isArray(t)?t:[t],r=n.length;for(let t=0;t<r;t++)e[e.length]=n[t]}function Ir(e,t){let n=e.length;if(n!==t.length)return!1;for(let r=0;r<n;r++)if(e[r]!==t[r])return!1;return!0}function Lr(e,t,n){let r=t||jr;return e.every(function(t,i){if(i===0)return!0;let a=r(e[i-1],t);return!(a>0||n&&a===0)})}function Rr(){return!0}function zr(){return!1}function Br(){}function Vr(e){let t,n,r;return function(){let i=Array.prototype.slice.call(arguments);return(!n||this!==r||!Ir(i,n))&&(r=this,n=i,t=e.apply(this,arguments)),t}}function Hr(e){function t(){let t;try{t=e()}catch(e){return Promise.reject(e)}return t instanceof Promise?t:Promise.resolve(t)}return t()}function Ur(e){for(let t in e)delete e[t]}function Wr(e){let t;for(t in e)return!1;return!t}var Gr=class{constructor(e){this.propagationStopped,this.defaultPrevented,this.type=e,this.target=null}preventDefault(){this.defaultPrevented=!0}stopPropagation(){this.propagationStopped=!0}},Kr=class extends kr{constructor(e){super(),this.eventTarget_=e,this.pendingRemovals_=null,this.dispatching_=null,this.listeners_=null}addEventListener(e,t){if(!e||!t)return;let n=this.listeners_||={},r=n[e]||(n[e]=[]);r.includes(t)||r.push(t)}dispatchEvent(e){let t=typeof e==`string`,n=t?e:e.type,r=this.listeners_&&this.listeners_[n];if(!r)return;let i=t?new Gr(e):e;i.target||=this.eventTarget_||this;let a=this.dispatching_||={},o=this.pendingRemovals_||={};n in a||(a[n]=0,o[n]=0),++a[n];let s;for(let e=0,t=r.length;e<t;++e)if(s=`handleEvent`in r[e]?r[e].handleEvent(i):r[e].call(this,i),s===!1||i.propagationStopped){s=!1;break}if(--a[n]===0){let e=o[n];for(delete o[n];e--;)this.removeEventListener(n,Br);delete a[n]}return s}disposeInternal(){this.listeners_&&Ur(this.listeners_)}getListeners(e){return this.listeners_&&this.listeners_[e]||void 0}hasListener(e){return this.listeners_?e?e in this.listeners_:Object.keys(this.listeners_).length>0:!1}removeEventListener(e,t){if(!this.listeners_)return;let n=this.listeners_[e];if(!n)return;let r=n.indexOf(t);r!==-1&&(this.pendingRemovals_&&e in this.pendingRemovals_?(n[r]=Br,++this.pendingRemovals_[e]):(n.splice(r,1),n.length===0&&delete this.listeners_[e]))}};function I(e,t,n,r,i){if(i){let i=n;n=function(a){return e.removeEventListener(t,n),i.call(r??this,a)}}else r&&r!==e&&(n=n.bind(r));let a={target:e,type:t,listener:n};return e.addEventListener(t,n),a}function qr(e,t,n,r){return I(e,t,n,r,!0)}function L(e){e&&e.target&&(e.target.removeEventListener(e.type,e.listener),Ur(e))}var Jr=class extends Kr{constructor(){super(),this.on=this.onInternal,this.once=this.onceInternal,this.un=this.unInternal,this.revision_=0}changed(){++this.revision_,this.dispatchEvent(F.CHANGE)}getRevision(){return this.revision_}onInternal(e,t){if(Array.isArray(e)){let n=e.length,r=Array(n);for(let i=0;i<n;++i)r[i]=I(this,e[i],t);return r}return I(this,e,t)}onceInternal(e,t){let n;if(Array.isArray(e)){let r=e.length;n=Array(r);for(let i=0;i<r;++i)n[i]=qr(this,e[i],t)}else n=qr(this,e,t);return t.ol_key=n,n}unInternal(e,t){let n=t.ol_key;if(n)Yr(n);else if(Array.isArray(e))for(let n=0,r=e.length;n<r;++n)this.removeEventListener(e[n],t);else this.removeEventListener(e,t)}};Jr.prototype.on,Jr.prototype.once,Jr.prototype.un;function Yr(e){if(Array.isArray(e))for(let t=0,n=e.length;t<n;++t)L(e[t]);else L(e)}function R(){throw Error(`Unimplemented abstract method.`)}var Xr=0;function z(e){return e.ol_uid||=String(++Xr)}var Zr=class extends Gr{constructor(e,t,n){super(e),this.key=t,this.oldValue=n}},Qr=class extends Jr{constructor(e){super(),this.on,this.once,this.un,z(this),this.values_=null,e!==void 0&&this.setProperties(e)}get(e){let t;return this.values_&&this.values_.hasOwnProperty(e)&&(t=this.values_[e]),t}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(e,t){let n;n=`change:${e}`,this.hasListener(n)&&this.dispatchEvent(new Zr(n,e,t)),n=Or.PROPERTYCHANGE,this.hasListener(n)&&this.dispatchEvent(new Zr(n,e,t))}addChangeListener(e,t){this.addEventListener(`change:${e}`,t)}removeChangeListener(e,t){this.removeEventListener(`change:${e}`,t)}set(e,t,n){let r=this.values_||={};if(n)r[e]=t;else{let n=r[e];r[e]=t,n!==t&&this.notify(e,n)}}setProperties(e,t){for(let n in e)this.set(n,e[n],t)}applyProperties(e){e.values_&&Object.assign(this.values_||={},e.values_)}unset(e,t){if(this.values_&&e in this.values_){let n=this.values_[e];delete this.values_[e],Wr(this.values_)&&(this.values_=null),t||this.notify(e,n)}}},$r={LENGTH:`length`},ei=class extends Gr{constructor(e,t,n){super(e),this.element=t,this.index=n}},ti=class extends Qr{constructor(e,t){if(super(),this.on,this.once,this.un,t||={},this.unique_=!!t.unique,this.array_=e??[],this.unique_)for(let e=1,t=this.array_.length;e<t;++e)this.assertUnique_(this.array_[e],e);this.updateLength_()}clear(){for(;this.getLength()>0;)this.pop()}extend(e){for(let t=0,n=e.length;t<n;++t)this.push(e[t]);return this}forEach(e){let t=this.array_;for(let n=0,r=t.length;n<r;++n)e(t[n],n,t)}getArray(){return this.array_}item(e){return this.array_[e]}getLength(){return this.get($r.LENGTH)}insertAt(e,t){if(e<0||e>this.getLength())throw Error(`Index out of bounds: `+e);this.unique_&&this.assertUnique_(t),this.array_.splice(e,0,t),this.updateLength_(),this.dispatchEvent(new ei(Dr.ADD,t,e))}pop(){return this.removeAt(this.getLength()-1)}push(e){let t=this.getLength();return this.insertAt(t,e),this.getLength()}remove(e){let t=this.array_;for(let n=0,r=t.length;n<r;++n)if(t[n]===e)return this.removeAt(n)}removeAt(e){if(e<0||e>=this.getLength())return;let t=this.array_[e];return this.array_.splice(e,1),this.updateLength_(),this.dispatchEvent(new ei(Dr.REMOVE,t,e)),t}setAt(e,t){if(e>=this.getLength()){this.insertAt(e,t);return}if(e<0)throw Error(`Index out of bounds: `+e);this.unique_&&this.assertUnique_(t,e);let n=this.array_[e];this.array_[e]=t,this.dispatchEvent(new ei(Dr.REMOVE,n,e)),this.dispatchEvent(new ei(Dr.ADD,t,e))}updateLength_(){this.set($r.LENGTH,this.array_.length)}assertUnique_(e,t){let n=this.array_;for(let r=0,i=n.length;r<i;++r)if(n[r]===e&&r!==t)throw Error(`Duplicate item added to a unique collection`)}};function B(e,t){if(!e)throw Error(t)}var ni=class e extends Qr{constructor(e){if(super(),this.on,this.once,this.un,this.id_=void 0,this.geometryName_=`geometry`,this.style_=null,this.styleFunction_=void 0,this.geometryChangeKey_=null,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),e)if(typeof e.getSimplifiedGeometry==`function`){let t=e;this.setGeometry(t)}else{let t=e;this.setProperties(t)}}clone(){let t=new e(this.hasProperties()?this.getProperties():null);t.setGeometryName(this.getGeometryName());let n=this.getGeometry();n&&t.setGeometry(n.clone());let r=this.getStyle();return r&&t.setStyle(r),t}getGeometry(){return this.get(this.geometryName_)}getId(){return this.id_}getGeometryName(){return this.geometryName_}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}handleGeometryChange_(){this.changed()}handleGeometryChanged_(){this.geometryChangeKey_&&=(L(this.geometryChangeKey_),null);let e=this.getGeometry();e&&(this.geometryChangeKey_=I(e,F.CHANGE,this.handleGeometryChange_,this)),this.changed()}setGeometry(e){this.set(this.geometryName_,e)}setStyle(e){this.style_=e,this.styleFunction_=e?ri(e):void 0,this.changed()}setId(e){this.id_=e,this.changed()}setGeometryName(e){this.removeChangeListener(this.geometryName_,this.handleGeometryChanged_),this.geometryName_=e,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),this.handleGeometryChanged_()}};function ri(e){if(typeof e==`function`)return e;let t;return Array.isArray(e)?t=e:(B(typeof e.getZIndex==`function`,"Expected an `ol/style/Style` or an array of `ol/style/Style.js`"),t=[e]),function(){return t}}var ii={UNKNOWN:0,INTERSECTING:1,ABOVE:2,RIGHT:4,BELOW:8,LEFT:16};function ai(e){let t=mi();for(let n=0,r=e.length;n<r;++n)xi(t,e[n]);return t}function oi(e,t,n){return hi(Math.min.apply(null,e),Math.min.apply(null,t),Math.max.apply(null,e),Math.max.apply(null,t),n)}function si(e,t,n){return n?(n[0]=e[0]-t,n[1]=e[1]-t,n[2]=e[2]+t,n[3]=e[3]+t,n):[e[0]-t,e[1]-t,e[2]+t,e[3]+t]}function ci(e,t){return t?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t):e.slice()}function li(e,t,n){let r,i;return r=t<e[0]?e[0]-t:e[2]<t?t-e[2]:0,i=n<e[1]?e[1]-n:e[3]<n?n-e[3]:0,r*r+i*i}function ui(e,t){return fi(e,t[0],t[1])}function di(e,t){return e[0]<=t[0]&&t[2]<=e[2]&&e[1]<=t[1]&&t[3]<=e[3]}function fi(e,t,n){return e[0]<=t&&t<=e[2]&&e[1]<=n&&n<=e[3]}function pi(e,t){let n=e[0],r=e[1],i=e[2],a=e[3],o=t[0],s=t[1],c=ii.UNKNOWN;return o<n?c|=ii.LEFT:o>i&&(c|=ii.RIGHT),s<r?c|=ii.BELOW:s>a&&(c|=ii.ABOVE),c===ii.UNKNOWN&&(c=ii.INTERSECTING),c}function mi(){return[1/0,1/0,-1/0,-1/0]}function hi(e,t,n,r,i){return i?(i[0]=e,i[1]=t,i[2]=n,i[3]=r,i):[e,t,n,r]}function gi(e){return hi(1/0,1/0,-1/0,-1/0,e)}function _i(e,t){let n=e[0],r=e[1];return hi(n,r,n,r,t)}function vi(e,t,n,r,i){return Si(gi(i),e,t,n,r)}function yi(e,t){return e[0]==t[0]&&e[2]==t[2]&&e[1]==t[1]&&e[3]==t[3]}function bi(e,t){return t[0]<e[0]&&(e[0]=t[0]),t[2]>e[2]&&(e[2]=t[2]),t[1]<e[1]&&(e[1]=t[1]),t[3]>e[3]&&(e[3]=t[3]),e}function xi(e,t){t[0]<e[0]&&(e[0]=t[0]),t[0]>e[2]&&(e[2]=t[0]),t[1]<e[1]&&(e[1]=t[1]),t[1]>e[3]&&(e[3]=t[1])}function Si(e,t,n,r,i){for(;n<r;n+=i)Ci(e,t[n],t[n+1]);return e}function Ci(e,t,n){e[0]=Math.min(e[0],t),e[1]=Math.min(e[1],n),e[2]=Math.max(e[2],t),e[3]=Math.max(e[3],n)}function wi(e,t){let n;return n=t(Ei(e)),n||(n=t(Di(e)),n)||(n=t(Fi(e)),n)||(n=t(Pi(e)),n)?n:!1}function Ti(e){let t=0;return Li(e)||(t=V(e)*Mi(e)),t}function Ei(e){return[e[0],e[1]]}function Di(e){return[e[2],e[1]]}function Oi(e){return[(e[0]+e[2])/2,(e[1]+e[3])/2]}function ki(e,t){let n;if(t===`bottom-left`)n=Ei(e);else if(t===`bottom-right`)n=Di(e);else if(t===`top-left`)n=Pi(e);else if(t===`top-right`)n=Fi(e);else throw Error(`Invalid corner`);return n}function Ai(e,t,n,r,i){let[a,o,s,c,l,u,d,f]=ji(e,t,n,r);return hi(Math.min(a,s,l,d),Math.min(o,c,u,f),Math.max(a,s,l,d),Math.max(o,c,u,f),i)}function ji(e,t,n,r){let i=t*r[0]/2,a=t*r[1]/2,o=Math.cos(n),s=Math.sin(n),c=i*o,l=i*s,u=a*o,d=a*s,f=e[0],p=e[1];return[f-c+d,p-l-u,f-c-d,p-l+u,f+c-d,p+l+u,f+c+d,p+l-u,f-c+d,p-l-u]}function Mi(e){return e[3]-e[1]}function Ni(e,t,n){let r=n||mi();return Ii(e,t)?(e[0]>t[0]?r[0]=e[0]:r[0]=t[0],e[1]>t[1]?r[1]=e[1]:r[1]=t[1],e[2]<t[2]?r[2]=e[2]:r[2]=t[2],e[3]<t[3]?r[3]=e[3]:r[3]=t[3]):gi(r),r}function Pi(e){return[e[0],e[3]]}function Fi(e){return[e[2],e[3]]}function V(e){return e[2]-e[0]}function Ii(e,t){return e[0]<=t[2]&&e[2]>=t[0]&&e[1]<=t[3]&&e[3]>=t[1]}function Li(e){return e[2]<e[0]||e[3]<e[1]}function Ri(e,t){return t?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t):e}function zi(e,t,n){let r=!1,i=pi(e,t),a=pi(e,n);if(i===ii.INTERSECTING||a===ii.INTERSECTING)r=!0;else{let o=e[0],s=e[1],c=e[2],l=e[3],u=t[0],d=t[1],f=n[0],p=n[1],m=(p-d)/(f-u),h,g;a&ii.ABOVE&&!(i&ii.ABOVE)&&(h=f-(p-l)/m,r=h>=o&&h<=c),!r&&a&ii.RIGHT&&!(i&ii.RIGHT)&&(g=p-(f-c)*m,r=g>=s&&g<=l),!r&&a&ii.BELOW&&!(i&ii.BELOW)&&(h=f-(p-s)/m,r=h>=o&&h<=c),!r&&a&ii.LEFT&&!(i&ii.LEFT)&&(g=p-(f-o)*m,r=g>=s&&g<=l)}return r}function Bi(e,t,n,r){if(Li(e))return gi(n);let i=[];if(r>1){let t=e[2]-e[0],n=e[3]-e[1];for(let a=0;a<r;++a)i.push(e[0]+t*a/r,e[1],e[2],e[1]+n*a/r,e[2]-t*a/r,e[3],e[0],e[3]-n*a/r)}else i=[e[0],e[1],e[2],e[1],e[2],e[3],e[0],e[3]];t(i,i,2);let a=[],o=[];for(let e=0,t=i.length;e<t;e+=2)a.push(i[e]),o.push(i[e+1]);return oi(a,o,n)}function Vi(e,t){let n=t.getExtent(),r=Oi(e);if(t.canWrapX()&&(r[0]<n[0]||r[0]>=n[2])){let t=V(n),i=Math.floor((r[0]-n[0])/t)*t;e[0]-=i,e[2]-=i}return e}function Hi(e,t,n){if(t.canWrapX()){let r=t.getExtent();if(!isFinite(e[0])||!isFinite(e[2]))return[[r[0],e[1],r[2],e[3]]];Vi(e,t);let i=V(r);if(V(e)>i&&!n)return[[r[0],e[1],r[2],e[3]]];if(e[0]<r[0])return[[e[0]+i,e[1],r[2],e[3]],[r[0],e[1],e[2],e[3]]];if(e[2]>r[2])return[[e[0],e[1],r[2],e[3]],[r[0],e[1],e[2]-i,e[3]]]}return[e]}function H(e,t,n){return Math.min(Math.max(e,t),n)}function Ui(e,t,n,r,i,a){let o=i-n,s=a-r;if(o!==0||s!==0){let c=((e-n)*o+(t-r)*s)/(o*o+s*s);c>1?(n=i,r=a):c>0&&(n+=o*c,r+=s*c)}return Wi(e,t,n,r)}function Wi(e,t,n,r){let i=n-e,a=r-t;return i*i+a*a}function Gi(e){let t=e.length;for(let n=0;n<t;n++){let r=n,i=Math.abs(e[n][n]);for(let a=n+1;a<t;a++){let t=Math.abs(e[a][n]);t>i&&(i=t,r=a)}if(i===0)return null;let a=e[r];e[r]=e[n],e[n]=a;for(let r=n+1;r<t;r++){let i=-e[r][n]/e[n][n];for(let a=n;a<t+1;a++)n==a?e[r][a]=0:e[r][a]+=i*e[n][a]}}let n=Array(t);for(let r=t-1;r>=0;r--){n[r]=e[r][t]/e[r][r];for(let i=r-1;i>=0;i--)e[i][t]-=e[i][r]*n[r]}return n}function Ki(e){return e*180/Math.PI}function qi(e){return e*Math.PI/180}function Ji(e,t){let n=e%t;return n*t<0?n+t:n}function Yi(e,t,n){return e+n*(t-e)}function Xi(e,t){let n=10**t;return Math.round(e*n)/n}function Zi(e,t){return Math.floor(Xi(e,t))}function Qi(e,t){return Math.ceil(Xi(e,t))}function $i(e,t,n){if(e>=t&&e<n)return e;let r=n-t;return((e-t)%r+r)%r+t}function ea(e,t,n){n||=6371008.8;let r=qi(e[1]),i=qi(t[1]),a=(i-r)/2,o=qi(t[0]-e[0])/2,s=Math.sin(a)*Math.sin(a)+Math.sin(o)*Math.sin(o)*Math.cos(r)*Math.cos(i);return 2*n*Math.atan2(Math.sqrt(s),Math.sqrt(1-s))}var ta={info:1,warn:2,error:3,none:4},na=ta.info;function ra(...e){na>ta.warn||console.warn(...e)}function ia(e,t){return e[0]+=+t[0],e[1]+=+t[1],e}function aa(e,t){let n=!0;for(let r=e.length-1;r>=0;--r)if(e[r]!=t[r]){n=!1;break}return n}function oa(e,t){let n=Math.cos(t),r=Math.sin(t),i=e[0]*n-e[1]*r,a=e[1]*n+e[0]*r;return e[0]=i,e[1]=a,e}function sa(e,t){return e[0]*=t,e[1]*=t,e}function ca(e,t){if(t.canWrapX()){let n=V(t.getExtent()),r=la(e,t,n);r&&(e[0]-=r*n)}return e}function la(e,t,n){let r=t.getExtent(),i=0;return t.canWrapX()&&(e[0]<r[0]||e[0]>r[2])&&(n||=V(r),i=Math.floor((e[0]-r[0])/n)),i}function ua(e,t,n){let r=Math.sqrt((t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])),i=[(t[0]-e[0])/r,(t[1]-e[1])/r],a=[-i[1],i[0]],o=Math.sqrt((n[0]-e[0])*(n[0]-e[0])+(n[1]-e[1])*(n[1]-e[1])),s=[(n[0]-e[0])/o,(n[1]-e[1])/o],c=r===0||o===0?0:Math.acos(H(s[0]*i[0]+s[1]*i[1],-1,1));return c=Math.max(c,1e-5),s[0]*a[0]+s[1]*a[1]>0?c:Math.PI*2-c}var da={radians:6370997/(2*Math.PI),degrees:2*Math.PI*6370997/360,ft:.3048,m:1,"us-ft":1200/3937},fa=class{constructor(e){this.code_=e.code,this.units_=e.units,this.extent_=e.extent===void 0?null:e.extent,this.worldExtent_=e.worldExtent===void 0?null:e.worldExtent,this.axisOrientation_=e.axisOrientation===void 0?`enu`:e.axisOrientation,this.global_=e.global===void 0?!1:e.global,this.canWrapX_=!!(this.global_&&this.extent_),this.getPointResolutionFunc_=e.getPointResolution,this.defaultTileGrid_=null,this.metersPerUnit_=e.metersPerUnit}canWrapX(){return this.canWrapX_}getCode(){return this.code_}getExtent(){return this.extent_}getUnits(){return this.units_}getMetersPerUnit(){return this.metersPerUnit_||da[this.units_]}getWorldExtent(){return this.worldExtent_}getAxisOrientation(){return this.axisOrientation_}isGlobal(){return this.global_}setGlobal(e){this.global_=e,this.canWrapX_=!!(e&&this.extent_)}getDefaultTileGrid(){return this.defaultTileGrid_}setDefaultTileGrid(e){this.defaultTileGrid_=e}setExtent(e){this.extent_=e,this.canWrapX_=!!(this.global_&&e)}setWorldExtent(e){this.worldExtent_=e}setGetPointResolution(e){this.getPointResolutionFunc_=e}getPointResolutionFunc(){return this.getPointResolutionFunc_}},pa=6378137,ma=Math.PI*pa,ha=[-ma,-ma,ma,ma],ga=[-180,-85,180,85],_a=pa*Math.log(Math.tan(Math.PI/2)),va=class extends fa{constructor(e){super({code:e,units:`m`,extent:ha,global:!0,worldExtent:ga,getPointResolution:function(e,t){return e/Math.cosh(t[1]/pa)}})}},ya=[new va(`EPSG:3857`),new va(`EPSG:102100`),new va(`EPSG:102113`),new va(`EPSG:900913`),new va(`http://www.opengis.net/def/crs/EPSG/0/3857`),new va(`http://www.opengis.net/gml/srs/epsg.xml#3857`)];function ba(e,t,n,r){let i=e.length;n=n>1?n:2,r??=n,t===void 0&&(t=n>2?e.slice():Array(i));for(let n=0;n<i;n+=r){t[n]=ma*e[n]/180;let r=pa*Math.log(Math.tan(Math.PI*(+e[n+1]+90)/360));r>_a?r=_a:r<-_a&&(r=-_a),t[n+1]=r}return t}function xa(e,t,n,r){let i=e.length;n=n>1?n:2,r??=n,t===void 0&&(t=n>2?e.slice():Array(i));for(let n=0;n<i;n+=r)t[n]=180*e[n]/ma,t[n+1]=360*Math.atan(Math.exp(e[n+1]/pa))/Math.PI-90;return t}var Sa=6378137,Ca=[-180,-90,180,90],wa=Math.PI*Sa/180,Ta=class extends fa{constructor(e,t){super({code:e,units:`degrees`,extent:Ca,axisOrientation:t,global:!0,metersPerUnit:wa,worldExtent:Ca})}},Ea=[new Ta(`CRS:84`),new Ta(`EPSG:4326`,`neu`),new Ta(`urn:ogc:def:crs:OGC:1.3:CRS84`),new Ta(`urn:ogc:def:crs:OGC:2:84`),new Ta(`http://www.opengis.net/def/crs/OGC/1.3/CRS84`),new Ta(`http://www.opengis.net/gml/srs/epsg.xml#4326`,`neu`),new Ta(`http://www.opengis.net/def/crs/EPSG/0/4326`,`neu`)],Da={};function Oa(e){return Da[e]||Da[e.replace(/urn:(x-)?ogc:def:crs:EPSG:(.*:)?(\w+)$/,`EPSG:$3`)]||null}function ka(e,t){Da[e]=t}var Aa={};function ja(e,t,n){let r=e.getCode(),i=t.getCode();r in Aa||(Aa[r]={}),Aa[r][i]=n}function Ma(e,t){return e in Aa&&t in Aa[e]?Aa[e][t]:null}var Na=.9996,Pa=.00669438,Fa=Pa*Pa,Ia=Fa*Pa,La=Pa/(1-Pa),Ra=Math.sqrt(1-Pa),za=(1-Ra)/(1+Ra),Ba=za*za,Va=Ba*za,Ha=Va*za,Ua=Ha*za,Wa=1-Pa/4-3*Fa/64-5*Ia/256,Ga=3*Pa/8+3*Fa/32+45*Ia/1024,Ka=15*Fa/256+45*Ia/1024,qa=35*Ia/3072,Ja=3/2*za-27/32*Va+269/512*Ua,Ya=21/16*Ba-55/32*Ha,Xa=151/96*Va-417/128*Ua,Za=1097/512*Ha,Qa=6378137;function $a(e,t,n){let r=e-5e5,i=(n.north?t:t-1e7)/Na/(Qa*Wa),a=i+Ja*Math.sin(2*i)+Ya*Math.sin(4*i)+Xa*Math.sin(6*i)+Za*Math.sin(8*i),o=Math.sin(a),s=o*o,c=Math.cos(a),l=o/c,u=l*l,d=u*u,f=1-Pa*s,p=Qa/Math.sqrt(1-Pa*s),m=(1-Pa)/f,h=La*c**2,g=h*h,_=r/(p*Na),v=_*_,y=v*_,b=y*_,x=b*_,S=x*_,C=a-l/m*(v/2-b/24*(5+3*u+10*h-4*g-9*La))+S/720*(61+90*u+298*h+45*d-252*La-3*g),w=(_-y/6*(1+2*u+h)+x/120*(5-2*h+28*u-3*g+8*La+24*d))/c;return w=$i(w+qi(ao(n.number)),-Math.PI,Math.PI),[Ki(w),Ki(C)]}var eo=-80,to=84,no=-180,ro=180;function io(e,t,n){e=$i(e,no,ro),t<eo?t=eo:t>to&&(t=to);let r=qi(t),i=Math.sin(r),a=Math.cos(r),o=i/a,s=o*o,c=s*s,l=qi(e),u=qi(ao(n.number)),d=Qa/Math.sqrt(1-Pa*i**2),f=La*a**2,p=a*$i(l-u,-Math.PI,Math.PI),m=p*p,h=m*p,g=h*p,_=g*p,v=_*p,y=Qa*(Wa*r-Ga*Math.sin(2*r)+Ka*Math.sin(4*r)-qa*Math.sin(6*r)),b=Na*d*(p+h/6*(1-s+f)+_/120*(5-18*s+c+72*f-58*La))+5e5,x=Na*(y+d*o*(m/2+g/24*(5-s+9*f+4*f**2)+v/720*(61-58*s+c+600*f-330*La)));return n.north||(x+=1e7),[b,x]}function ao(e){return(e-1)*6-180+3}var oo=[/^EPSG:(\d+)$/,/^urn:ogc:def:crs:EPSG::(\d+)$/,/^http:\/\/www\.opengis\.net\/def\/crs\/EPSG\/0\/(\d+)$/];function so(e){let t=0;for(let n of oo){let r=e.match(n);if(r){t=parseInt(r[1]);break}}if(!t)return null;let n=0,r=!1;return t>32700&&t<32761?n=t-32700:t>32600&&t<32661&&(r=!0,n=t-32600),n?{number:n,north:r}:null}function co(e,t){return function(n,r,i,a){let o=n.length;i=i>1?i:2,a??=i,r||=i>2?n.slice():Array(o);for(let i=0;i<o;i+=a){let a=n[i],o=n[i+1],s=e(a,o,t);r[i]=s[0],r[i+1]=s[1]}return r}}function lo(e){return so(e)?new fa({code:e,units:`m`}):null}function uo(e){let t=so(e.getCode());return t?{forward:co(io,t),inverse:co($a,t)}:null}var fo=[uo],po=[lo],mo=!0;function ho(e){mo=!(e===void 0||e)}function go(e,t){if(t!==void 0){for(let n=0,r=e.length;n<r;++n)t[n]=e[n];t=t}else t=e.slice();return t}function _o(e){ka(e.getCode(),e),ja(e,e,go)}function vo(e){e.forEach(_o)}function yo(e){if(typeof e!=`string`)return e;let t=Oa(e);if(t)return t;for(let t of po){let n=t(e);if(n)return n}return null}function bo(e,t,n,r){e=yo(e);let i,a=e.getPointResolutionFunc();if(a){if(i=a(t,n),r&&r!==e.getUnits()){let t=e.getMetersPerUnit();t&&(i=i*t/da[r])}}else{let a=e.getUnits();if(a==`degrees`&&!r||r==`degrees`)i=t;else{let o=Do(e,yo(`EPSG:4326`));if(!o&&a!==`degrees`)i=t*e.getMetersPerUnit();else{let e=[n[0]-t/2,n[1],n[0]+t/2,n[1],n[0],n[1]-t/2,n[0],n[1]+t/2];e=o(e,e,2),i=(ea(e.slice(0,2),e.slice(2,4))+ea(e.slice(4,6),e.slice(6,8)))/2}let s=r?da[r]:e.getMetersPerUnit();s!==void 0&&(i/=s)}}return i}function xo(e){vo(e),e.forEach(function(t){e.forEach(function(e){t!==e&&ja(t,e,go)})})}function So(e,t,n,r){e.forEach(function(e){t.forEach(function(t){ja(e,t,n),ja(t,e,r)})})}function Co(e,t){return e?typeof e==`string`?yo(e):e:yo(t)}function wo(e){return(function(t,n,r,i){let a=t.length;r=r===void 0?2:r,i??=r,n=n===void 0?Array(a):n;for(let o=0;o<a;o+=i){let a=e(t.slice(o,o+r)),s=a.length;for(let e=0,r=i;e<r;++e)n[o+e]=e>=s?t[o+e]:a[e]}return n})}function To(e,t){return ho(),Ao(e,`EPSG:4326`,t===void 0?`EPSG:3857`:t)}function Eo(e,t){if(e===t)return!0;let n=e.getUnits()===t.getUnits();return(e.getCode()===t.getCode()||Do(e,t)===go)&&n}function Do(e,t){let n=e.getCode(),r=t.getCode(),i=Ma(n,r);if(i)return i;let a=null,o=null;for(let n of fo)a||=n(e),o||=n(t);if(!a&&!o)return null;let s=`EPSG:4326`;if(!o){let e=Ma(s,r);e&&(i=Oo(a.inverse,e))}else if(a)i=Oo(a.inverse,o.forward);else{let e=Ma(n,s);e&&(i=Oo(e,o.forward))}return i&&(_o(e),_o(t),ja(e,t,i)),i}function Oo(e,t){return function(n,r,i,a){return r=e(n,r,i,a),t(r,r,i,a)}}function ko(e,t){return Do(yo(e),yo(t))}function Ao(e,t,n){let r=ko(t,n);if(!r){let e=yo(t).getCode(),r=yo(n).getCode();throw Error(`No transform available between ${e} and ${r}`)}return r(e,void 0,e.length)}function jo(e,t,n,r){return Bi(e,ko(t,n),void 0,r)}var Mo=null;function No(){return Mo}function Po(e,t){return Mo?Ao(e,t,Mo):e}function Fo(e,t){return Mo?Ao(e,Mo,t):(mo&&!aa(e,[0,0])&&e[0]>=-180&&e[0]<=180&&e[1]>=-90&&e[1]<=90&&(mo=!1,ra(`Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.`)),e)}function Io(e,t){return Mo?jo(e,t,Mo):e}function Lo(e,t){return Mo?jo(e,Mo,t):e}function Ro(e,t){if(!Mo)return e;let n=yo(t).getMetersPerUnit(),r=Mo.getMetersPerUnit();return n&&r?e*n/r:e}function zo(){xo(ya),xo(Ea),So(Ea,ya,ba,xa)}zo();var Bo=[,,,,,,];function Vo(){return[1,0,0,1,0,0]}function Ho(e){return Wo(e,1,0,0,1,0,0)}function Uo(e,t){let n=e[0],r=e[1],i=e[2],a=e[3],o=e[4],s=e[5],c=t[0],l=t[1],u=t[2],d=t[3],f=t[4],p=t[5];return e[0]=n*c+i*l,e[1]=r*c+a*l,e[2]=n*u+i*d,e[3]=r*u+a*d,e[4]=n*f+i*p+o,e[5]=r*f+a*p+s,e}function Wo(e,t,n,r,i,a,o){return e[0]=t,e[1]=n,e[2]=r,e[3]=i,e[4]=a,e[5]=o,e}function Go(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e}function Ko(e,t){let n=t[0],r=t[1];return t[0]=e[0]*n+e[2]*r+e[4],t[1]=e[1]*n+e[3]*r+e[5],t}function qo(e,t,n){return Uo(e,Wo(Bo,t,0,0,n,0,0))}function Jo(e,t,n){return Uo(e,Wo(Bo,1,0,0,1,t,n))}function Yo(e,t,n,r,i,a,o,s){let c=Math.sin(a),l=Math.cos(a);return e[0]=r*l,e[1]=i*c,e[2]=-r*c,e[3]=i*l,e[4]=o*r*l-s*r*c+t,e[5]=o*i*c+s*i*l+n,e}function Xo(e,t){let n=Zo(t);B(n!==0,`Transformation matrix cannot be inverted`);let r=t[0],i=t[1],a=t[2],o=t[3],s=t[4],c=t[5];return e[0]=o/n,e[1]=-i/n,e[2]=-a/n,e[3]=r/n,e[4]=(a*c-o*s)/n,e[5]=-(r*c-i*s)/n,e}function Zo(e){return e[0]*e[3]-e[1]*e[2]}var Qo=[1e5,1e5,1e5,1e5,2,2];function $o(e){return`matrix(`+e.join(`, `)+`)`}function es(e){return e.substring(7,e.length-1).split(`,`).map(parseFloat)}function ts(e,t){let n=es(e),r=es(t);for(let e=0;e<6;++e)if(Math.round((n[e]-r[e])*Qo[e])!==0)return!1;return!0}function ns(e,t,n,r,i,a,o){a||=[],o||=2;let s=0;for(let c=t;c<n;c+=r){let t=e[c],n=e[c+1];a[s++]=i[0]*t+i[2]*n+i[4],a[s++]=i[1]*t+i[3]*n+i[5];for(let t=2;t<o;t++)a[s++]=e[c+t]}return a&&a.length!=s&&(a.length=s),a}function rs(e,t,n,r,i,a,o){o||=[];let s=Math.cos(i),c=Math.sin(i),l=a[0],u=a[1],d=0;for(let i=t;i<n;i+=r){let t=e[i]-l,n=e[i+1]-u;o[d++]=l+t*s-n*c,o[d++]=u+t*c+n*s;for(let t=i+2;t<i+r;++t)o[d++]=e[t]}return o&&o.length!=d&&(o.length=d),o}function is(e,t,n,r,i,a,o,s){s||=[];let c=o[0],l=o[1],u=0;for(let o=t;o<n;o+=r){let t=e[o]-c,n=e[o+1]-l;s[u++]=c+i*t,s[u++]=l+a*n;for(let t=o+2;t<o+r;++t)s[u++]=e[t]}return s&&s.length!=u&&(s.length=u),s}function as(e,t,n,r,i,a,o){o||=[];let s=0;for(let c=t;c<n;c+=r){o[s++]=e[c]+i,o[s++]=e[c+1]+a;for(let t=c+2;t<c+r;++t)o[s++]=e[t]}return o&&o.length!=s&&(o.length=s),o}var os=Vo(),ss=[NaN,NaN],cs=class extends Qr{constructor(){super(),this.extent_=mi(),this.extentRevision_=-1,this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=0,this.simplifyTransformedInternal=Vr((e,t,n)=>{if(!n)return this.getSimplifiedGeometry(t);let r=this.clone();return r.applyTransform(n),r.getSimplifiedGeometry(t)})}simplifyTransformed(e,t){return this.simplifyTransformedInternal(this.getRevision(),e,t)}clone(){return R()}closestPointXY(e,t,n,r){return R()}containsXY(e,t){return this.closestPointXY(e,t,ss,Number.MIN_VALUE)===0}getClosestPoint(e,t){return t||=[NaN,NaN],this.closestPointXY(e[0],e[1],t,1/0),t}intersectsCoordinate(e){return this.containsXY(e[0],e[1])}computeExtent(e){return R()}getExtent(e){if(this.extentRevision_!=this.getRevision()){let e=this.computeExtent(this.extent_);(isNaN(e[0])||isNaN(e[1]))&&gi(e),this.extentRevision_=this.getRevision()}return Ri(this.extent_,e)}rotate(e,t){R()}scale(e,t,n){R()}simplify(e){return this.getSimplifiedGeometry(e*e)}getSimplifiedGeometry(e){return R()}getType(){return R()}applyTransform(e){R()}intersectsExtent(e){return R()}translate(e,t){R()}transform(e,t){let n=yo(e),r=n.getUnits()==`tile-pixels`?function(e,r,i){let a=n.getExtent(),o=n.getWorldExtent(),s=Mi(o)/Mi(a);Yo(os,o[0],o[3],s,-s,0,0,0);let c=ns(e,0,e.length,i,os,r),l=ko(n,t);return l?l(c,c,i):c}:ko(n,t);return this.applyTransform(r),this}},ls=class extends cs{constructor(){super(),this.layout=`XY`,this.stride=2,this.flatCoordinates}computeExtent(e){return vi(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e)}getCoordinates(){return R()}getFirstCoordinate(){return this.flatCoordinates.slice(0,this.stride)}getFlatCoordinates(){return this.flatCoordinates}getLastCoordinate(){return this.flatCoordinates.slice(this.flatCoordinates.length-this.stride)}getLayout(){return this.layout}getSimplifiedGeometry(e){if(this.simplifiedGeometryRevision!==this.getRevision()&&(this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=this.getRevision()),e<0||this.simplifiedGeometryMaxMinSquaredTolerance!==0&&e<=this.simplifiedGeometryMaxMinSquaredTolerance)return this;let t=this.getSimplifiedGeometryInternal(e);return t.getFlatCoordinates().length<this.flatCoordinates.length?t:(this.simplifiedGeometryMaxMinSquaredTolerance=e,this)}getSimplifiedGeometryInternal(e){return this}getStride(){return this.stride}setFlatCoordinates(e,t){this.stride=ds(e),this.layout=e,this.flatCoordinates=t}setCoordinates(e,t){R()}setLayout(e,t,n){let r;if(e)r=ds(e);else{for(let e=0;e<n;++e){if(t.length===0){this.layout=`XY`,this.stride=2;return}t=t[0]}r=t.length,e=us(r)}this.layout=e,this.stride=r}applyTransform(e){this.flatCoordinates&&(e(this.flatCoordinates,this.flatCoordinates,this.layout.startsWith(`XYZ`)?3:2,this.stride),this.changed())}rotate(e,t){let n=this.getFlatCoordinates();if(n){let r=this.getStride();rs(n,0,n.length,r,e,t,n),this.changed()}}scale(e,t,n){t===void 0&&(t=e),n||=Oi(this.getExtent());let r=this.getFlatCoordinates();if(r){let i=this.getStride();is(r,0,r.length,i,e,t,n,r),this.changed()}}translate(e,t){let n=this.getFlatCoordinates();if(n){let r=this.getStride();as(n,0,n.length,r,e,t,n),this.changed()}}};function us(e){let t;return e==2?t=`XY`:e==3?t=`XYZ`:e==4&&(t=`XYZM`),t}function ds(e){let t;return e==`XY`?t=2:e==`XYZ`||e==`XYM`?t=3:e==`XYZM`&&(t=4),t}function fs(e,t,n){let r=e.getFlatCoordinates();if(!r)return null;let i=e.getStride();return ns(r,0,r.length,i,t,n)}function ps(e,t,n,r){let i=0,a=e[n-r],o=e[n-r+1],s=0,c=0;for(;t<n;t+=r){let n=e[t]-a,r=e[t+1]-o;i+=c*n-s*r,s=n,c=r}return i/2}function ms(e,t,n,r){let i=0;for(let a=0,o=n.length;a<o;++a){let o=n[a];i+=ps(e,t,o,r),t=o}return i}function hs(e,t,n,r){let i=0;for(let a=0,o=n.length;a<o;++a){let o=n[a];i+=ms(e,t,o,r),t=o[o.length-1]}return i}function gs(e,t,n,r,i,a,o){let s=e[t],c=e[t+1],l=e[n]-s,u=e[n+1]-c,d;if(l===0&&u===0)d=t;else{let f=((i-s)*l+(a-c)*u)/(l*l+u*u);if(f>1)d=n;else if(f>0){for(let i=0;i<r;++i)o[i]=Yi(e[t+i],e[n+i],f);o.length=r;return}else d=t}for(let t=0;t<r;++t)o[t]=e[d+t];o.length=r}function _s(e,t,n,r,i){let a=e[t],o=e[t+1];for(t+=r;t<n;t+=r){let n=e[t],r=e[t+1],s=Wi(a,o,n,r);s>i&&(i=s),a=n,o=r}return i}function vs(e,t,n,r,i){for(let a=0,o=n.length;a<o;++a){let o=n[a];i=_s(e,t,o,r,i),t=o}return i}function ys(e,t,n,r,i){for(let a=0,o=n.length;a<o;++a){let o=n[a];i=vs(e,t,o,r,i),t=o[o.length-1]}return i}function bs(e,t,n,r,i,a,o,s,c,l,u){if(t==n)return l;let d,f;if(i===0){if(f=Wi(o,s,e[t],e[t+1]),f<l){for(d=0;d<r;++d)c[d]=e[t+d];return c.length=r,f}return l}u||=[NaN,NaN];let p=t+r;for(;p<n;)if(gs(e,p-r,p,r,o,s,u),f=Wi(o,s,u[0],u[1]),f<l){for(l=f,d=0;d<r;++d)c[d]=u[d];c.length=r,p+=r}else p+=r*Math.max((Math.sqrt(f)-Math.sqrt(l))/i|0,1);if(a&&(gs(e,n-r,t,r,o,s,u),f=Wi(o,s,u[0],u[1]),f<l)){for(l=f,d=0;d<r;++d)c[d]=u[d];c.length=r}return l}function xs(e,t,n,r,i,a,o,s,c,l,u){u||=[NaN,NaN];for(let d=0,f=n.length;d<f;++d){let f=n[d];l=bs(e,t,f,r,i,a,o,s,c,l,u),t=f}return l}function Ss(e,t,n,r,i,a,o,s,c,l,u){u||=[NaN,NaN];for(let d=0,f=n.length;d<f;++d){let f=n[d];l=xs(e,t,f,r,i,a,o,s,c,l,u),t=f[f.length-1]}return l}function Cs(e,t,n,r){for(let r=0,i=n.length;r<i;++r)e[t++]=n[r];return t}function ws(e,t,n,r){for(let i=0,a=n.length;i<a;++i){let a=n[i];for(let n=0;n<r;++n)e[t++]=a[n]}return t}function Ts(e,t,n,r,i){i||=[];let a=0;for(let o=0,s=n.length;o<s;++o){let s=ws(e,t,n[o],r);i[a++]=s,t=s}return i.length=a,i}function Es(e,t,n,r,i){i||=[];let a=0;for(let o=0,s=n.length;o<s;++o){let s=Ts(e,t,n[o],r,i[a]);s.length===0&&(s[0]=t),i[a++]=s,t=s[s.length-1]}return i.length=a,i}function Ds(e,t,n,r,i){i=i===void 0?[]:i;let a=0;for(let o=t;o<n;o+=r)i[a++]=e.slice(o,o+r);return i.length=a,i}function Os(e,t,n,r,i){i=i===void 0?[]:i;let a=0;for(let o=0,s=n.length;o<s;++o){let s=n[o];i[a++]=Ds(e,t,s,r,i[a]),t=s}return i.length=a,i}function ks(e,t,n,r,i){i=i===void 0?[]:i;let a=0;for(let o=0,s=n.length;o<s;++o){let s=n[o];i[a++]=s.length===1&&s[0]===t?[]:Os(e,t,s,r,i[a]),t=s[s.length-1]}return i.length=a,i}function As(e,t,n,r,i,a,o){let s=(n-t)/r;if(s<3){for(;t<n;t+=r)a[o++]=e[t],a[o++]=e[t+1];return o}let c=Array(s);c[0]=1,c[s-1]=1;let l=[t,n-r],u=0;for(;l.length>0;){let n=l.pop(),a=l.pop(),o=0,s=e[a],d=e[a+1],f=e[n],p=e[n+1];for(let t=a+r;t<n;t+=r){let n=e[t],r=e[t+1],i=Ui(n,r,s,d,f,p);i>o&&(u=t,o=i)}o>i&&(c[(u-t)/r]=1,a+r<u&&l.push(a,u),u+r<n&&l.push(u,n))}for(let n=0;n<s;++n)c[n]&&(a[o++]=e[t+n*r],a[o++]=e[t+n*r+1]);return o}function js(e,t,n,r,i,a,o,s){for(let c=0,l=n.length;c<l;++c){let l=n[c];o=As(e,t,l,r,i,a,o),s.push(o),t=l}return o}function Ms(e,t){return t*Math.round(e/t)}function Ns(e,t,n,r,i,a,o){if(t==n)return o;let s=Ms(e[t],i),c=Ms(e[t+1],i);t+=r,a[o++]=s,a[o++]=c;let l,u;do if(l=Ms(e[t],i),u=Ms(e[t+1],i),t+=r,t==n)return a[o++]=l,a[o++]=u,o;while(l==s&&u==c);for(;t<n;){let n=Ms(e[t],i),d=Ms(e[t+1],i);if(t+=r,n==l&&d==u)continue;let f=l-s,p=u-c,m=n-s,h=d-c;if(f*h==p*m&&(f<0&&m<f||f==m||f>0&&m>f)&&(p<0&&h<p||p==h||p>0&&h>p)){l=n,u=d;continue}a[o++]=l,a[o++]=u,s=l,c=u,l=n,u=d}return a[o++]=l,a[o++]=u,o}function Ps(e,t,n,r,i,a,o,s){for(let c=0,l=n.length;c<l;++c){let l=n[c];o=Ns(e,t,l,r,i,a,o),s.push(o),t=l}return o}function Fs(e,t,n,r,i,a,o,s){for(let c=0,l=n.length;c<l;++c){let l=n[c],u=[];o=Ps(e,t,l,r,i,a,o,u),s.push(u),t=l[l.length-1]}return o}var Is=class e extends ls{constructor(e,t){super(),this.maxDelta_=-1,this.maxDeltaRevision_=-1,t!==void 0&&!Array.isArray(e[0])?this.setFlatCoordinates(t,e):this.setCoordinates(e,t)}clone(){return new e(this.flatCoordinates.slice(),this.layout)}closestPointXY(e,t,n,r){return r<li(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(_s(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),bs(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!0,e,t,n,r))}getArea(){return ps(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinates(){return Ds(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getSimplifiedGeometryInternal(t){let n=[];return n.length=As(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,n,0),new e(n,`XY`)}getType(){return`LinearRing`}intersectsExtent(e){return!1}setCoordinates(e,t){this.setLayout(t,e,1),this.flatCoordinates||=[],this.flatCoordinates.length=ws(this.flatCoordinates,0,e,this.stride),this.changed()}},Ls=class e extends ls{constructor(e,t){super(),this.setCoordinates(e,t)}clone(){let t=new e(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(e,t,n,r){let i=this.flatCoordinates,a=Wi(e,t,i[0],i[1]);if(a<r){let e=this.stride;for(let t=0;t<e;++t)n[t]=i[t];return n.length=e,a}return r}getCoordinates(){return this.flatCoordinates.slice()}computeExtent(e){return _i(this.flatCoordinates,e)}getType(){return`Point`}intersectsExtent(e){return fi(e,this.flatCoordinates[0],this.flatCoordinates[1])}setCoordinates(e,t){this.setLayout(t,e,0),this.flatCoordinates||=[],this.flatCoordinates.length=Cs(this.flatCoordinates,0,e,this.stride),this.changed()}};function Rs(e,t,n,r,i){return!wi(i,function(i){return!zs(e,t,n,r,i[0],i[1])})}function zs(e,t,n,r,i,a){let o=0,s=e[n-r],c=e[n-r+1];for(;t<n;t+=r){let n=e[t],r=e[t+1];c<=a?r>a&&(n-s)*(a-c)-(i-s)*(r-c)>0&&o++:r<=a&&(n-s)*(a-c)-(i-s)*(r-c)<0&&o--,s=n,c=r}return o!==0}function Bs(e,t,n,r,i,a){if(n.length===0||!zs(e,t,n[0],r,i,a))return!1;for(let t=1,o=n.length;t<o;++t)if(zs(e,n[t-1],n[t],r,i,a))return!1;return!0}function Vs(e,t,n,r,i,a){if(n.length===0)return!1;for(let o=0,s=n.length;o<s;++o){let s=n[o];if(Bs(e,t,s,r,i,a))return!0;t=s[s.length-1]}return!1}function Hs(e,t,n,r,i,a,o){let s,c,l,u,d,f,p,m=i[a+1],h=[];for(let i=0,a=n.length;i<a;++i){let a=n[i];for(u=e[a-r],f=e[a-r+1],s=t;s<a;s+=r)d=e[s],p=e[s+1],(m<=f&&p<=m||f<=m&&m<=p)&&(l=(m-f)/(p-f)*(d-u)+u,h.push(l)),u=d,f=p}let g=NaN,_=-1/0;for(h.sort(jr),u=h[0],s=1,c=h.length;s<c;++s){d=h[s];let i=Math.abs(d-u);i>_&&(l=(u+d)/2,Bs(e,t,n,r,l,m)&&(g=l,_=i)),u=d}return isNaN(g)&&(g=i[a]),o?(o.push(g,m,_),o):[g,m,_]}function Us(e,t,n,r,i){let a=[];for(let o=0,s=n.length;o<s;++o){let s=n[o];a=Hs(e,t,s,r,i,2*o,a),t=s[s.length-1]}return a}function Ws(e,t,n,r,i){let a;for(t+=r;t<n;t+=r)if(a=i(e.slice(t-r,t),e.slice(t,t+r)),a)return a;return!1}function Gs(e,t,n,r,i,a){return a??=Si(mi(),e,t,n,r),Ii(i,a)?a[0]>=i[0]&&a[2]<=i[2]||a[1]>=i[1]&&a[3]<=i[3]?!0:Ws(e,t,n,r,function(e,t){return zi(i,e,t)}):!1}function Ks(e,t,n,r,i){for(let a=0,o=n.length;a<o;++a){if(Gs(e,t,n[a],r,i))return!0;t=n[a]}return!1}function qs(e,t,n,r,i){return!!(Gs(e,t,n,r,i)||zs(e,t,n,r,i[0],i[1])||zs(e,t,n,r,i[0],i[3])||zs(e,t,n,r,i[2],i[1])||zs(e,t,n,r,i[2],i[3]))}function Js(e,t,n,r,i){if(!qs(e,t,n[0],r,i))return!1;if(n.length===1)return!0;for(let t=1,a=n.length;t<a;++t)if(Rs(e,n[t-1],n[t],r,i)&&!Gs(e,n[t-1],n[t],r,i))return!1;return!0}function Ys(e,t,n,r,i){for(let a=0,o=n.length;a<o;++a){let o=n[a];if(Js(e,t,o,r,i))return!0;t=o[o.length-1]}return!1}function Xs(e,t,n,r){for(;t<n-r;){for(let i=0;i<r;++i){let a=e[t+i];e[t+i]=e[n-r+i],e[n-r+i]=a}t+=r,n-=r}}function Zs(e,t,n,r){let i=0,a=e[n-r],o=e[n-r+1];for(;t<n;t+=r){let n=e[t],r=e[t+1];i+=(n-a)*(r+o),a=n,o=r}return i===0?void 0:i>0}function Qs(e,t,n,r,i){i=i===void 0?!1:i;for(let a=0,o=n.length;a<o;++a){let o=n[a],s=Zs(e,t,o,r);if(a===0){if(i&&s||!i&&!s)return!1}else if(i&&!s||!i&&s)return!1;t=o}return!0}function $s(e,t,n,r,i){for(let a=0,o=n.length;a<o;++a){let o=n[a];if(!Qs(e,t,o,r,i))return!1;o.length&&(t=o[o.length-1])}return!0}function ec(e,t,n,r,i){i=i===void 0?!1:i;for(let a=0,o=n.length;a<o;++a){let o=n[a],s=Zs(e,t,o,r);(a===0?i&&s||!i&&!s:i&&!s||!i&&s)&&Xs(e,t,o,r),t=o}return t}function tc(e,t,n,r,i){for(let a=0,o=n.length;a<o;++a)t=ec(e,t,n[a],r,i);return t}function nc(e,t){let n=[],r=0,i=0,a;for(let o=0,s=t.length;o<s;++o){let s=t[o],c=Zs(e,r,s,2);if(a===void 0&&(a=c),c===a)n.push(t.slice(i,o+1));else{if(n.length===0)continue;n[n.length-1].push(t[i])}i=o+1,r=s}return n}var rc=class e extends ls{constructor(e,t,n){super(),this.ends_=[],this.flatInteriorPointRevision_=-1,this.flatInteriorPoint_=null,this.maxDelta_=-1,this.maxDeltaRevision_=-1,this.orientedRevision_=-1,this.orientedFlatCoordinates_=null,t!==void 0&&n?(this.setFlatCoordinates(t,e),this.ends_=n):this.setCoordinates(e,t)}appendLinearRing(e){this.flatCoordinates?Fr(this.flatCoordinates,e.getFlatCoordinates()):this.flatCoordinates=e.getFlatCoordinates().slice(),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){let t=new e(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return t.applyProperties(this),t}closestPointXY(e,t,n,r){return r<li(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(vs(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),xs(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!0,e,t,n,r))}containsXY(e,t){return Bs(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,e,t)}getArea(){return ms(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride)}getCoordinates(e){let t;return e===void 0?t=this.flatCoordinates:(t=this.getOrientedFlatCoordinates().slice(),ec(t,0,this.ends_,this.stride,e)),Os(t,0,this.ends_,this.stride)}getEnds(){return this.ends_}getFlatInteriorPoint(){if(this.flatInteriorPointRevision_!=this.getRevision()){let e=Oi(this.getExtent());this.flatInteriorPoint_=Hs(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,e,0),this.flatInteriorPointRevision_=this.getRevision()}return this.flatInteriorPoint_}getInteriorPoint(){return new Ls(this.getFlatInteriorPoint(),`XYM`)}getLinearRingCount(){return this.ends_.length}getLinearRing(e){return e<0||this.ends_.length<=e?null:new Is(this.flatCoordinates.slice(e===0?0:this.ends_[e-1],this.ends_[e]),this.layout)}getLinearRings(){let e=this.layout,t=this.flatCoordinates,n=this.ends_,r=[],i=0;for(let a=0,o=n.length;a<o;++a){let o=n[a],s=new Is(t.slice(i,o),e);r.push(s),i=o}return r}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){let e=this.flatCoordinates;Qs(e,0,this.ends_,this.stride)?this.orientedFlatCoordinates_=e:(this.orientedFlatCoordinates_=e.slice(),this.orientedFlatCoordinates_.length=ec(this.orientedFlatCoordinates_,0,this.ends_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(t){let n=[],r=[];return n.length=Ps(this.flatCoordinates,0,this.ends_,this.stride,Math.sqrt(t),n,0,r),new e(n,`XY`,r)}getType(){return`Polygon`}intersectsExtent(e){return Js(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,2),this.flatCoordinates||=[];let n=Ts(this.flatCoordinates,0,e,this.stride,this.ends_);this.flatCoordinates.length=n.length===0?0:n[n.length-1],this.changed()}};function ic(e){if(Li(e))throw Error(`Cannot create polygon from empty extent`);let t=e[0],n=e[1],r=e[2],i=e[3],a=[t,n,t,i,r,i,r,n,t,n];return new rc(a,`XY`,[a.length])}function ac(e,t,n,r,i,a,o){let s,c,l=(n-t)/r;if(l===1)s=t;else if(l===2)s=t,c=i;else if(l!==0){let a=e[t],o=e[t+1],l=0,u=[0];for(let i=t+r;i<n;i+=r){let t=e[i],n=e[i+1];l+=Math.sqrt((t-a)*(t-a)+(n-o)*(n-o)),u.push(l),a=t,o=n}let d=i*l,f=Ar(u,d);f<0?(c=(d-u[-f-2])/(u[-f-1]-u[-f-2]),s=t+(-f-2)*r):s=t+f*r}o=o>1?o:2,a||=Array(o);for(let t=0;t<o;++t)a[t]=s===void 0?NaN:c===void 0?e[s+t]:Yi(e[s+t],e[s+r+t],c);return a}function oc(e,t,n,r,i,a){if(n==t)return null;let o;if(i<e[t+r-1])return a?(o=e.slice(t,t+r),o[r-1]=i,o):null;if(e[n-1]<i)return a?(o=e.slice(n-r,n),o[r-1]=i,o):null;if(i==e[t+r-1])return e.slice(t,t+r);let s=t/r,c=n/r;for(;s<c;){let t=s+c>>1;i<e[(t+1)*r-1]?c=t:s=t+1}let l=e[s*r-1];if(i==l)return e.slice((s-1)*r,(s-1)*r+r);let u=e[(s+1)*r-1],d=(i-l)/(u-l);o=[];for(let t=0;t<r-1;++t)o.push(Yi(e[(s-1)*r+t],e[s*r+t],d));return o.push(i),o}function sc(e,t,n,r,i,a,o){if(o)return oc(e,t,n[n.length-1],r,i,a);let s;if(i<e[r-1])return a?(s=e.slice(0,r),s[r-1]=i,s):null;if(e[e.length-1]<i)return a?(s=e.slice(e.length-r),s[r-1]=i,s):null;for(let a=0,o=n.length;a<o;++a){let o=n[a];if(t!=o){if(i<e[t+r-1])return null;if(i<=e[o-1])return oc(e,t,o,r,i,!1);t=o}}return null}function cc(e,t,n,r){let i=e[t],a=e[t+1],o=0;for(let s=t+r;s<n;s+=r){let t=e[s],n=e[s+1];o+=Math.sqrt((t-i)*(t-i)+(n-a)*(n-a)),i=t,a=n}return o}var lc=class e extends ls{constructor(e,t){super(),this.flatMidpoint_=null,this.flatMidpointRevision_=-1,this.maxDelta_=-1,this.maxDeltaRevision_=-1,t!==void 0&&!Array.isArray(e[0])?this.setFlatCoordinates(t,e):this.setCoordinates(e,t)}appendCoordinate(e){Fr(this.flatCoordinates,e),this.changed()}clone(){let t=new e(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(e,t,n,r){return r<li(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(_s(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),bs(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!1,e,t,n,r))}forEachSegment(e){return Ws(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e)}getCoordinateAtM(e,t){return this.layout!=`XYM`&&this.layout!=`XYZM`?null:(t=t===void 0?!1:t,oc(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e,t))}getCoordinates(){return Ds(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinateAt(e,t){return ac(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e,t,this.stride)}getLength(){return cc(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getFlatMidpoint(){return this.flatMidpointRevision_!=this.getRevision()&&(this.flatMidpoint_=this.getCoordinateAt(.5,this.flatMidpoint_??void 0),this.flatMidpointRevision_=this.getRevision()),this.flatMidpoint_}getSimplifiedGeometryInternal(t){let n=[];return n.length=As(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,n,0),new e(n,`XY`)}getType(){return`LineString`}intersectsExtent(e){return Gs(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e,this.getExtent())}setCoordinates(e,t){this.setLayout(t,e,1),this.flatCoordinates||=[],this.flatCoordinates.length=ws(this.flatCoordinates,0,e,this.stride),this.changed()}},uc={PRERENDER:`prerender`,POSTRENDER:`postrender`,PRECOMPOSE:`precompose`,POSTCOMPOSE:`postcompose`,RENDERCOMPLETE:`rendercomplete`},dc=typeof navigator<`u`&&navigator.userAgent!==void 0?navigator.userAgent.toLowerCase():``;dc.includes(`safari`)&&!dc.includes(`chrom`)&&(dc.includes(`version/15.4`)||/cpu (os|iphone os) 15_4 like mac os x/.test(dc));var fc=dc.includes(`webkit`)&&!dc.includes(`edge`),pc=dc.includes(`macintosh`),mc=typeof devicePixelRatio<`u`?devicePixelRatio:1,hc=typeof WorkerGlobalScope<`u`&&typeof OffscreenCanvas<`u`&&self instanceof WorkerGlobalScope,gc=typeof Image<`u`&&Image.prototype.decode,_c=(function(){let e=!1;try{let t=Object.defineProperty({},`passive`,{get:function(){e=!0}});window.addEventListener(`_`,null,t),window.removeEventListener(`_`,null,t)}catch{}return e})(),U={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};function vc(e,t,n,r){let i;return i=n&&n.length?n.shift():hc?new class extends OffscreenCanvas{style={}}(e??300,t??150):document.createElement(`canvas`),e&&(i.width=e),t&&(i.height=t),i.getContext(`2d`,r)}var yc;function bc(){return yc||=vc(1,1),yc}function xc(e){let t=e.canvas;t.width=1,t.height=1,e.clearRect(0,0,1,1)}function Sc(e){let t=e.offsetWidth,n=getComputedStyle(e);return t+=parseInt(n.marginLeft,10)+parseInt(n.marginRight,10),t}function Cc(e){let t=e.offsetHeight,n=getComputedStyle(e);return t+=parseInt(n.marginTop,10)+parseInt(n.marginBottom,10),t}function wc(e,t){let n=t.parentNode;n&&n.replaceChild(e,t)}function Tc(e){for(;e.lastChild;)e.lastChild.remove()}function Ec(e,t){let n=e.childNodes;for(let r=0;;++r){let i=n[r],a=t[r];if(!i&&!a)break;if(i!==a){if(!i){e.appendChild(a);continue}if(!a){e.removeChild(i),--r;continue}e.insertBefore(a,i)}}}function Dc(){return new Proxy({childNodes:[],appendChild:function(e){return this.childNodes.push(e),e},remove:function(){},removeChild:function(e){let t=this.childNodes.indexOf(e);if(t===-1)throw Error(`Node to remove was not found`);return this.childNodes.splice(t,1),e},insertBefore:function(e,t){let n=this.childNodes.indexOf(t);if(n===-1)throw Error(`Reference node not found`);return this.childNodes.splice(n,0,e),e},style:{}},{get(e,t,n){return t===`firstElementChild`?e.childNodes.length>0?e.childNodes[0]:null:Reflect.get(e,t,n)}})}function Oc(e){return typeof HTMLCanvasElement<`u`&&e instanceof HTMLCanvasElement||typeof OffscreenCanvas<`u`&&e instanceof OffscreenCanvas}var kc=[NaN,NaN,NaN,0],Ac;function jc(){return Ac||=vc(1,1,void 0,{willReadFrequently:!0,desynchronized:!0}),Ac}var Mc=/^rgba?\(\s*(\d+%?)\s+(\d+%?)\s+(\d+%?)(?:\s*\/\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,Nc=/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,Pc=/^rgba?\(\s*(\d+%)\s*,\s*(\d+%)\s*,\s*(\d+%)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,Fc=/^#([\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$/i;function Ic(e,t){return e.endsWith(`%`)?Number(e.substring(0,e.length-1))/t:Number(e)}function Lc(e){throw Error(`failed to parse "`+e+`" as color`)}function Rc(e){if(e.toLowerCase().startsWith(`rgb`)){let t=e.match(Nc)||e.match(Mc)||e.match(Pc);if(t){let e=t[4],n=100/255;return[H(Ic(t[1],n)+.5|0,0,255),H(Ic(t[2],n)+.5|0,0,255),H(Ic(t[3],n)+.5|0,0,255),e===void 0?1:H(Ic(e,100),0,1)]}Lc(e)}if(e.startsWith(`#`)){if(Fc.test(e)){let t=e.substring(1),n=t.length<=4?1:2,r=[0,0,0,255];for(let e=0,i=t.length;e<i;e+=n){let i=parseInt(t.substring(e,e+n),16);n===1&&(i+=i<<4),r[e/n]=i}return r[3]/=255,r}Lc(e)}let t=jc();t.fillStyle=`#abcdef`;let n=t.fillStyle;t.fillStyle=e,t.fillStyle===n&&(t.fillStyle=`#fedcba`,n=t.fillStyle,t.fillStyle=e,t.fillStyle===n&&Lc(e));let r=t.fillStyle;if(r.startsWith(`#`)||r.startsWith(`rgba`))return Rc(r);t.clearRect(0,0,1,1),t.fillRect(0,0,1,1);let i=Array.from(t.getImageData(0,0,1,1).data);return i[3]=Xi(i[3]/255,3),i}function zc(e){return typeof e==`string`?e:Qc(e)}var Bc=1024,Vc={},Hc=0;function Uc(e){if(e.length===4)return e;let t=e.slice();return t[3]=1,t}function Wc(e){return e>.0031308?e**(1/2.4)*269.025-14.025:e*3294.6}function Gc(e){return e>.2068965?e**3:(e-4/29)*(108/841)}function Kc(e){return e>10.314724?((e+14.025)/269.025)**2.4:e/3294.6}function qc(e){return e>.0088564?e**(1/3):e/(108/841)+4/29}function Jc(e){let t=Kc(e[0]),n=Kc(e[1]),r=Kc(e[2]),i=qc(t*.222488403+n*.716873169+r*.06060791),a=500*(qc(t*.452247074+n*.399439023+r*.148375274)-i),o=200*(i-qc(t*.016863605+n*.117638439+r*.865350722)),s=180/Math.PI*Math.atan2(o,a);return[116*i-16,Math.sqrt(a*a+o*o),s<0?s+360:s,e[3]]}function Yc(e){let t=(e[0]+16)/116,n=e[1],r=e[2]*Math.PI/180,i=Gc(t),a=Gc(t+n/500*Math.cos(r)),o=Gc(t-n/200*Math.sin(r)),s=Wc(a*3.021973625-i*1.617392459-o*.404875592),c=Wc(a*-.943766287+i*1.916279586+o*.027607165),l=Wc(a*.069407491-i*.22898585+o*1.159737864);return[H(s+.5|0,0,255),H(c+.5|0,0,255),H(l+.5|0,0,255),e[3]]}function Xc(e){if(e===`none`)return kc;if(Vc.hasOwnProperty(e))return Vc[e];if(Hc>=Bc){let e=0;for(let t in Vc)e++&3||(delete Vc[t],--Hc)}let t=Rc(e);t.length!==4&&Lc(e);for(let n of t)isNaN(n)&&Lc(e);return Vc[e]=t,++Hc,t}function Zc(e){return Array.isArray(e)?e:Xc(e)}function Qc(e){let t=e[0];t!=(t|0)&&(t=t+.5|0);let n=e[1];n!=(n|0)&&(n=n+.5|0);let r=e[2];r!=(r|0)&&(r=r+.5|0);let i=e[3]===void 0?1:Math.round(e[3]*1e3)/1e3;return`rgba(`+t+`,`+n+`,`+r+`,`+i+`)`}function $c(e,t,n){let r=e,i=!0,a=!1,o=!1,s=[qr(r,F.LOAD,function(){o=!0,a||t()})];return r.src&&gc?(a=!0,r.decode().then(function(){i&&t()}).catch(function(e){i&&(o?t():n())})):s.push(qr(r,F.ERROR,n)),function(){i=!1,s.forEach(L)}}function el(e,t){return new Promise((n,r)=>{function i(){o(),n(e)}function a(){o(),r(Error(`Image load error`))}function o(){e.removeEventListener(`load`,i),e.removeEventListener(`error`,a)}e.addEventListener(`load`,i),e.addEventListener(`error`,a),t&&(e.src=t)})}function tl(e,t){return t&&(e.src=t),e.src&&gc?new Promise((t,n)=>e.decode().then(()=>t(e)).catch(r=>e.complete&&e.width?t(e):n(r))):el(e)}var nl=class{constructor(){this.cache_={},this.patternCache_={},this.cacheSize_=0,this.maxCacheSize_=1024}clear(){this.cache_={},this.patternCache_={},this.cacheSize_=0}canExpireCache(){return this.cacheSize_>this.maxCacheSize_}expire(){if(this.canExpireCache()){let e=0;for(let t in this.cache_){let n=this.cache_[t];!(e++&3)&&!n.hasListener()&&(delete this.cache_[t],delete this.patternCache_[t],--this.cacheSize_)}}}get(e,t){let n=rl(e,t);return n in this.cache_?this.cache_[n]:null}getPattern(e,t){let n=rl(e,t);return n in this.patternCache_?this.patternCache_[n]:null}set(e,t,n,r){let i=rl(e,t),a=i in this.cache_;this.cache_[i]=n,r&&(n.getImageState()===U.IDLE&&n.load(),n.getImageState()===U.LOADING?n.ready().then(()=>{this.patternCache_[i]=bc().createPattern(n.getImage(1),`repeat`)}):this.patternCache_[i]=bc().createPattern(n.getImage(1),`repeat`)),a||++this.cacheSize_}setSize(e){this.maxCacheSize_=e,this.expire()}};function rl(e,t){let n=t?Zc(t):`null`;return e+`:`+n}var il=new nl,al=null,ol=class extends Kr{constructor(e,t,n,r,i){super(),this.hitDetectionImage_=null,this.image_=e,this.crossOrigin_=n?.crossOrigin,this.referrerPolicy_=n?.referrerPolicy,this.canvas_={},this.color_=i,this.imageState_=r===void 0?U.IDLE:r,this.size_=e&&e.width&&e.height?[e.width,e.height]:null,this.src_=t,this.tainted_,this.ready_=null}initializeImage_(){this.image_=new Image,this.crossOrigin_!==null&&(this.image_.crossOrigin=this.crossOrigin_),this.referrerPolicy_!==void 0&&(this.image_.referrerPolicy=this.referrerPolicy_)}isTainted_(){if(this.tainted_===void 0&&this.imageState_===U.LOADED){al||=vc(1,1,void 0,{willReadFrequently:!0}),al.drawImage(this.image_,0,0);try{al.getImageData(0,0,1,1),this.tainted_=!1}catch{al=null,this.tainted_=!0}}return this.tainted_===!0}dispatchChangeEvent_(){this.dispatchEvent(F.CHANGE)}handleImageError_(){this.imageState_=U.ERROR,this.dispatchChangeEvent_()}handleImageLoad_(){this.imageState_=U.LOADED,this.size_=[this.image_.width,this.image_.height],this.dispatchChangeEvent_()}getImage(e){return this.image_||this.initializeImage_(),this.replaceColor_(e),this.canvas_[e]?this.canvas_[e]:this.image_}setImage(e){this.image_=e}getPixelRatio(e){return this.replaceColor_(e),this.canvas_[e]?e:1}getImageState(){return this.imageState_}getHitDetectionImage(){if(this.image_||this.initializeImage_(),!this.hitDetectionImage_)if(this.isTainted_()){let e=this.size_[0],t=this.size_[1],n=vc(e,t);n.fillRect(0,0,e,t),this.hitDetectionImage_=n.canvas}else this.hitDetectionImage_=this.image_;return this.hitDetectionImage_}getSize(){return this.size_}getSrc(){return this.src_}load(){if(this.imageState_===U.IDLE){this.image_||this.initializeImage_(),this.imageState_=U.LOADING;try{this.src_!==void 0&&(this.image_.src=this.src_)}catch{this.handleImageError_()}this.image_ instanceof HTMLImageElement&&tl(this.image_,this.src_).then(e=>{this.image_=e,this.handleImageLoad_()}).catch(this.handleImageError_.bind(this))}}replaceColor_(e){if(!this.color_||this.canvas_[e]||this.imageState_!==U.LOADED)return;let t=this.image_,n=vc(Math.ceil(t.width*e),Math.ceil(t.height*e)),r=n.canvas;n.scale(e,e),n.drawImage(t,0,0),n.globalCompositeOperation=`multiply`,n.fillStyle=zc(this.color_),n.fillRect(0,0,r.width/e,r.height/e),n.globalCompositeOperation=`destination-in`,n.drawImage(t,0,0),this.canvas_[e]=r}ready(){return this.ready_||=new Promise(e=>{if(this.imageState_===U.LOADED||this.imageState_===U.ERROR)e();else{let t=()=>{(this.imageState_===U.LOADED||this.imageState_===U.ERROR)&&(this.removeEventListener(F.CHANGE,t),e())};this.addEventListener(F.CHANGE,t)}}),this.ready_}};function sl(e,t,n,r,i,a){let o=t===void 0?void 0:il.get(t,i);return o||(o=new ol(e,e&&`src`in e?e.src||void 0:t,n,r,i),il.set(t,i,o,a)),a&&o&&!il.getPattern(t,i)&&il.set(t,i,o,a),o}function cl(e){return e?Array.isArray(e)?Qc(e):typeof e==`object`&&`src`in e?ll(e):e:null}function ll(e){if(!e.offset||!e.size)return il.getPattern(e.src,e.color);let t=e.src+`:`+e.offset,n=il.getPattern(t,e.color);if(n)return n;let r=il.get(e.src,null);if(r.getImageState()!==U.LOADED)return null;let i=vc(e.size[0],e.size[1]);return i.drawImage(r.getImage(1),e.offset[0],e.offset[1],e.size[0],e.size[1],0,0,e.size[0],e.size[1]),sl(i.canvas,t,void 0,U.LOADED,e.color,!0),il.getPattern(t,e.color)}function ul(e,t,n,r,i,a){i??=[],a??=t;let o=e[0],s=e[1],c=e[e.length-4],l=e[e.length-3],u,d,f,p,m,h,g,_,v=0;for(let y=0;y<e.length;y+=t){f=u,p=d,m=void 0,h=void 0,y+t<e.length&&(m=e[y+t],h=e[y+t+1]),r&&y===0&&(f=c,p=l),r&&y===e.length-2&&(m=o,h=s),u=e[y],d=e[y+1],[g,_]=dl(u,d,f,p,m,h,n),i[v++]=g,i[v++]=_;for(let t=2;t<a;t++)i[v++]=e[y+t]}return i.length!=v&&(i.length=v),i}function dl(e,t,n,r,i,a,o){let s,c;n!==void 0&&r!==void 0?(s=e-n,c=t-r):i!==void 0&&a!==void 0?(s=i-e,c=a-t):(s=1,c=0);let l=Math.hypot(s,c),u=s/l,d=c/l;if(s=-d,c=u,n===void 0||r===void 0||i===void 0||a===void 0)return[e+s*o,t+c*o];let f=ua([e,t],[n,r],[i,a]);if(Math.cos(f)>.998)return[e+u*o,t+d*o];let p=Math.cos(f/2),m=Math.sin(f/2),h=m*s+p*c,g=-p*s+m*c,_=1/m*h,v=1/m*g;return[e+_*o,t+v*o]}var fl=class{drawCustom(e,t,n,r,i){}drawGeometry(e){}setStyle(e){}drawCircle(e,t,n){}drawFeature(e,t,n){}drawGeometryCollection(e,t,n){}drawLineString(e,t,n){}drawMultiLineString(e,t,n){}drawMultiPoint(e,t,n){}drawMultiPolygon(e,t,n){}drawPoint(e,t,n){}drawPolygon(e,t,n){}drawText(e,t,n){}setFillStrokeStyle(e,t){}setImageStyle(e,t){}setTextStyle(e,t){}},pl=`ol-hidden`,ml=`ol-selectable`,hl=`ol-unselectable`,gl=`ol-control`,_l=`ol-collapsed`,vl=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`),yl=[`style`,`variant`,`weight`,`size`,`lineHeight`,`family`],bl={normal:400,bold:700},xl=function(e){let t=e.match(vl);if(!t)return null;let n={lineHeight:`normal`,size:`1.2em`,style:`normal`,weight:`400`,variant:`normal`};for(let e=0,r=yl.length;e<r;++e){let r=t[e+1];r!==void 0&&(n[yl[e]]=typeof r==`string`?r.trim():r)}return isNaN(Number(n.weight))&&n.weight in bl&&(n.weight=bl[n.weight]),n.families=n.family.split(/,\s?/).map(e=>e.trim().replace(/^['"]|['"]$/g,``)),n},Sl=`10px sans-serif`,Cl=`#000`,wl=`round`,Tl=[],El=`round`,Dl=`#000`,Ol=`center`,kl=`middle`,Al=[0,0,0,0],jl=new Qr,Ml=null,Nl,Pl={},Fl=new Set([`serif`,`sans-serif`,`monospace`,`cursive`,`fantasy`,`system-ui`,`ui-serif`,`ui-sans-serif`,`ui-monospace`,`ui-rounded`,`emoji`,`math`,`fangsong`]);function Il(e,t,n){return`${e} ${t} 16px "${n}"`}var Ll=(function(){let e,t;async function n(e){await t.ready;let n=await t.load(e);if(n.length===0)return!1;let r=xl(e),i=r.families[0].toLowerCase(),a=r.weight;return n.some(e=>{let t=e.family.replace(/^['"]|['"]$/g,``).toLowerCase(),n=bl[e.weight]||e.weight;return t===i&&e.style===r.style&&n==a})}async function r(){await t.ready;let i=!0,a=jl.getProperties(),o=Object.keys(a).filter(e=>a[e]<100);for(let e=o.length-1;e>=0;--e){let t=o[e],r=a[t];r<100&&(await n(t)?(Ur(Pl),jl.set(t,100)):(r+=10,jl.set(t,r,!0),r<100&&(i=!1)))}e=void 0,i||(e=setTimeout(r,100))}return async function(n){t||=hc?self.fonts:document.fonts;let i=xl(n);if(!i)return;let a=i.families,o=!1;for(let e of a){if(Fl.has(e))continue;let t=Il(i.style,i.weight,e);jl.get(t)===void 0&&(jl.set(t,0,!0),o=!0)}o&&(clearTimeout(e),e=setTimeout(r,100))}})(),Rl=(function(){let e;return function(t){let n=Pl[t];if(n==null){if(hc){let e=xl(t),r=zl(t,`Žg`);n=(isNaN(Number(e.lineHeight))?1.2:Number(e.lineHeight))*(r.actualBoundingBoxAscent+r.actualBoundingBoxDescent)}else e||(e=document.createElement(`div`),e.innerHTML=`M`,e.style.minHeight=`0`,e.style.maxHeight=`none`,e.style.height=`auto`,e.style.padding=`0`,e.style.border=`none`,e.style.position=`absolute`,e.style.display=`block`,e.style.left=`-99999px`),e.style.font=t,document.body.appendChild(e),n=e.offsetHeight,document.body.removeChild(e);Pl[t]=n}return n}})();function zl(e,t){return Ml||=vc(1,1),e!=Nl&&(Ml.font=e,Nl=Ml.font),Ml.measureText(t)}function Bl(e,t){return zl(e,t).width}function Vl(e,t,n){if(t in n)return n[t];let r=t.split(`
|
|
3
|
+
`).reduce((t,n)=>Math.max(t,Bl(e,n)),0);return n[t]=r,r}function Hl(e,t){let n=[],r=[],i=[],a=0,o=0,s=0,c=0;for(let l=0,u=t.length;l<=u;l+=2){let d=t[l];if(d===`
|
|
4
|
+
`||l===u){a=Math.max(a,o),i.push(o),o=0,s+=c,c=0;continue}let f=t[l+1]||e.font,p=Bl(f,d);n.push(p),o+=p;let m=Rl(f);r.push(m),c=Math.max(c,m)}return{width:a,height:s,widths:n,heights:r,lineWidths:i}}function Ul(e,t,n,r,i,a,o,s,c,l,u){e.save(),n!==1&&(e.globalAlpha===void 0?e.globalAlpha=e=>e.globalAlpha*=n:e.globalAlpha*=n),t&&e.transform.apply(e,t),r.contextInstructions?(e.translate(c,l),e.scale(u[0],u[1]),Wl(r,e)):u[0]<0||u[1]<0?(e.translate(c,l),e.scale(u[0],u[1]),e.drawImage(r,i,a,o,s,0,0,o,s)):e.drawImage(r,i,a,o,s,c,l,o*u[0],s*u[1]),e.restore()}function Wl(e,t){let n=e.contextInstructions;for(let e=0,r=n.length;e<r;e+=2)Array.isArray(n[e+1])?t[n[e]].apply(t,n[e+1]):t[n[e]]=n[e+1]}var Gl=class extends fl{constructor(e,t,n,r,i,a,o){super(),this.context_=e,this.pixelRatio_=t,this.extent_=n,this.transform_=r,this.transformRotation_=r?Xi(Math.atan2(r[1],r[0]),10):0,this.viewRotation_=i,this.squaredTolerance_=a,this.userTransform_=o,this.contextFillState_=null,this.contextStrokeState_=null,this.contextTextState_=null,this.fillState_=null,this.strokeState_=null,this.image_=null,this.imageAnchorX_=0,this.imageAnchorY_=0,this.imageHeight_=0,this.imageOpacity_=0,this.imageOriginX_=0,this.imageOriginY_=0,this.imageRotateWithView_=!1,this.imageRotation_=0,this.imageScale_=[0,0],this.imageWidth_=0,this.text_=``,this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=!1,this.textRotation_=0,this.textScale_=[0,0],this.textFillState_=null,this.textStrokeState_=null,this.textState_=null,this.pixelCoordinates_=[],this.tmpLocalTransform_=Vo()}drawImages_(e,t,n,r){if(!this.image_)return;let i=ns(e,t,n,r,this.transform_,this.pixelCoordinates_),a=this.context_,o=this.tmpLocalTransform_,s=a.globalAlpha;this.imageOpacity_!=1&&(a.globalAlpha=s*this.imageOpacity_);let c=this.imageRotation_;this.transformRotation_===0&&(c-=this.viewRotation_),this.imageRotateWithView_&&(c+=this.viewRotation_);for(let e=0,t=i.length;e<t;e+=2){let t=i[e]-this.imageAnchorX_,n=i[e+1]-this.imageAnchorY_;if(c!==0||this.imageScale_[0]!=1||this.imageScale_[1]!=1){let e=t+this.imageAnchorX_,r=n+this.imageAnchorY_;Yo(o,e,r,1,1,c,-e,-r),a.save(),a.transform.apply(a,o),a.translate(e,r),a.scale(this.imageScale_[0],this.imageScale_[1]),a.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,-this.imageAnchorX_,-this.imageAnchorY_,this.imageWidth_,this.imageHeight_),a.restore()}else a.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,t,n,this.imageWidth_,this.imageHeight_)}this.imageOpacity_!=1&&(a.globalAlpha=s)}drawText_(e,t,n,r){if(!this.textState_||this.text_===``)return;this.textFillState_&&this.setContextFillState_(this.textFillState_),this.textStrokeState_&&this.setContextStrokeState_(this.textStrokeState_),this.setContextTextState_(this.textState_);let i=ns(e,t,n,r,this.transform_,this.pixelCoordinates_),a=this.context_,o=this.textRotation_;for(this.transformRotation_===0&&(o-=this.viewRotation_),this.textRotateWithView_&&(o+=this.viewRotation_);t<n;t+=r){let e=i[t]+this.textOffsetX_,n=i[t+1]+this.textOffsetY_;o!==0||this.textScale_[0]!=1||this.textScale_[1]!=1?(a.save(),a.translate(e-this.textOffsetX_,n-this.textOffsetY_),a.rotate(o),a.translate(this.textOffsetX_,this.textOffsetY_),a.scale(this.textScale_[0],this.textScale_[1]),this.textStrokeState_&&a.strokeText(this.text_,0,0),this.textFillState_&&a.fillText(this.text_,0,0),a.restore()):(this.textStrokeState_&&a.strokeText(this.text_,e,n),this.textFillState_&&a.fillText(this.text_,e,n))}}moveToLineTo_(e,t,n,r,i,a){let o=this.context_,s=ns(e,t,n,r,this.transform_,this.pixelCoordinates_);Math.abs(a)>0&&(s=ul(s,r,a,i,s)),o.moveTo(s[0],s[1]);let c=s.length;i&&(c-=2);for(let e=2;e<c;e+=2)o.lineTo(s[e],s[e+1]);return i&&o.closePath(),n}drawRings_(e,t,n,r,i){for(let a=0,o=n.length;a<o;++a)t=this.moveToLineTo_(e,t,n[a],r,!0,i);return t}drawCircle(e){if(this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),Ii(this.extent_,e.getExtent())){if(this.fillState_||this.strokeState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);let t=fs(e,this.transform_,this.pixelCoordinates_),n=t[2]-t[0],r=t[3]-t[1],i=Math.sqrt(n*n+r*r),a=this.context_;a.beginPath(),a.arc(t[0],t[1],i,0,2*Math.PI),this.fillState_&&a.fill(),this.strokeState_&&a.stroke()}this.text_!==``&&this.drawText_(e.getCenter(),0,2,2)}}setStyle(e){this.setFillStrokeStyle(e.getFill(),e.getStroke()),this.setImageStyle(e.getImage()),this.setTextStyle(e.getText())}setTransform(e){this.transform_=e}drawGeometry(e){switch(e.getType()){case`Point`:this.drawPoint(e);break;case`LineString`:this.drawLineString(e);break;case`Polygon`:this.drawPolygon(e);break;case`MultiPoint`:this.drawMultiPoint(e);break;case`MultiLineString`:this.drawMultiLineString(e);break;case`MultiPolygon`:this.drawMultiPolygon(e);break;case`GeometryCollection`:this.drawGeometryCollection(e);break;case`Circle`:this.drawCircle(e);break;default:}}drawFeature(e,t){let n=t.getGeometryFunction()(e);n&&(this.setStyle(t),this.drawGeometry(n))}drawGeometryCollection(e){let t=e.getGeometriesArray();for(let e=0,n=t.length;e<n;++e)this.drawGeometry(t[e])}drawPoint(e){this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_));let t=e.getFlatCoordinates(),n=e.getStride();this.image_&&this.drawImages_(t,0,t.length,n),this.text_!==``&&this.drawText_(t,0,t.length,n)}drawMultiPoint(e){this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_));let t=e.getFlatCoordinates(),n=e.getStride();this.image_&&this.drawImages_(t,0,t.length,n),this.text_!==``&&this.drawText_(t,0,t.length,n)}drawLineString(e){if(this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),Ii(this.extent_,e.getExtent())){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);let t=this.context_,n=e.getFlatCoordinates();t.beginPath(),this.moveToLineTo_(n,0,n.length,e.getStride(),!1,this.strokeState_.strokeOffset),t.stroke()}if(this.text_!==``){let t=e.getFlatMidpoint();this.drawText_(t,0,2,2)}}}drawMultiLineString(e){this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_));let t=e.getExtent();if(Ii(this.extent_,t)){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);let t=this.context_,n=e.getFlatCoordinates(),r=0,i=e.getEnds(),a=e.getStride();t.beginPath();for(let e=0,t=i.length;e<t;++e)r=this.moveToLineTo_(n,r,i[e],a,!1,this.strokeState_.strokeOffset);t.stroke()}if(this.text_!==``){let t=e.getFlatMidpoints();this.drawText_(t,0,t.length,2)}}}drawPolygon(e){if(this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),Ii(this.extent_,e.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);let t=this.context_;t.beginPath(),this.drawRings_(e.getOrientedFlatCoordinates(),0,e.getEnds(),e.getStride(),this.strokeState_?.strokeOffset),this.fillState_&&t.fill(),this.strokeState_&&t.stroke()}if(this.text_!==``){let t=e.getFlatInteriorPoint();this.drawText_(t,0,2,2)}}}drawMultiPolygon(e){if(this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),Ii(this.extent_,e.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);let t=this.context_,n=e.getOrientedFlatCoordinates(),r=0,i=e.getEndss(),a=e.getStride();t.beginPath();for(let e=0,t=i.length;e<t;++e){let t=i[e];r=this.drawRings_(n,r,t,a,this.strokeState_?.strokeOffset)}this.fillState_&&t.fill(),this.strokeState_&&t.stroke()}if(this.text_!==``){let t=e.getFlatInteriorPoints();this.drawText_(t,0,t.length,2)}}}setContextFillState_(e){let t=this.context_,n=this.contextFillState_;n?n.fillStyle!=e.fillStyle&&(n.fillStyle=e.fillStyle,t.fillStyle=e.fillStyle):(t.fillStyle=e.fillStyle,this.contextFillState_={fillStyle:e.fillStyle})}setContextStrokeState_(e){let t=this.context_,n=this.contextStrokeState_;n?(n.lineCap!=e.lineCap&&(n.lineCap=e.lineCap,t.lineCap=e.lineCap),Ir(n.lineDash,e.lineDash)||t.setLineDash(n.lineDash=e.lineDash),n.lineDashOffset!=e.lineDashOffset&&(n.lineDashOffset=e.lineDashOffset,t.lineDashOffset=e.lineDashOffset),n.lineJoin!=e.lineJoin&&(n.lineJoin=e.lineJoin,t.lineJoin=e.lineJoin),n.lineWidth!=e.lineWidth&&(n.lineWidth=e.lineWidth,t.lineWidth=e.lineWidth),n.miterLimit!=e.miterLimit&&(n.miterLimit=e.miterLimit,t.miterLimit=e.miterLimit),n.strokeStyle!=e.strokeStyle&&(n.strokeStyle=e.strokeStyle,t.strokeStyle=e.strokeStyle)):(t.lineCap=e.lineCap,t.setLineDash(e.lineDash),t.lineDashOffset=e.lineDashOffset,t.lineJoin=e.lineJoin,t.lineWidth=e.lineWidth,t.miterLimit=e.miterLimit,t.strokeStyle=e.strokeStyle,this.contextStrokeState_={lineCap:e.lineCap,lineDash:e.lineDash,lineDashOffset:e.lineDashOffset,lineJoin:e.lineJoin,lineWidth:e.lineWidth,miterLimit:e.miterLimit,strokeStyle:e.strokeStyle})}setContextTextState_(e){let t=this.context_,n=this.contextTextState_,r=e.textAlign?e.textAlign:Ol;n?(n.font!=e.font&&(n.font=e.font,t.font=e.font),n.textAlign!=r&&(n.textAlign=r,t.textAlign=r),n.textBaseline!=e.textBaseline&&(n.textBaseline=e.textBaseline,t.textBaseline=e.textBaseline)):(t.font=e.font,t.textAlign=r,t.textBaseline=e.textBaseline,this.contextTextState_={font:e.font,textAlign:r,textBaseline:e.textBaseline})}setFillStrokeStyle(e,t){if(e?this.fillState_={fillStyle:cl(e.getColor()||Cl)}:this.fillState_=null,!t)this.strokeState_=null;else{let e=t.getColor(),n=t.getLineCap(),r=t.getLineDash(),i=t.getLineDashOffset(),a=t.getLineJoin(),o=t.getWidth(),s=t.getMiterLimit(),c=r||Tl,l=t.getOffset();this.strokeState_={lineCap:n===void 0?wl:n,lineDash:this.pixelRatio_===1?c:c.map(e=>e*this.pixelRatio_),lineDashOffset:(i||0)*this.pixelRatio_,lineJoin:a===void 0?El:a,lineWidth:(o===void 0?1:o)*this.pixelRatio_,miterLimit:s===void 0?10:s,strokeStyle:cl(e||Dl),strokeOffset:(l??0)*this.pixelRatio_}}}setImageStyle(e){let t;if(!e||!(t=e.getSize())){this.image_=null;return}let n=e.getPixelRatio(this.pixelRatio_),r=e.getAnchor(),i=e.getOrigin();this.image_=e.getImage(this.pixelRatio_),this.imageAnchorX_=r[0]*n,this.imageAnchorY_=r[1]*n,this.imageHeight_=t[1]*n,this.imageOpacity_=e.getOpacity(),this.imageOriginX_=i[0],this.imageOriginY_=i[1],this.imageRotateWithView_=e.getRotateWithView(),this.imageRotation_=e.getRotation();let a=e.getScaleArray();this.imageScale_=[a[0]*this.pixelRatio_/n,a[1]*this.pixelRatio_/n],this.imageWidth_=t[0]*n}setTextStyle(e){if(!e)this.text_=``;else{let t=e.getFill();t?this.textFillState_={fillStyle:cl(t.getColor()||Cl)}:this.textFillState_=null;let n=e.getStroke();if(!n)this.textStrokeState_=null;else{let e=n.getColor(),t=n.getLineCap(),r=n.getLineDash(),i=n.getLineDashOffset(),a=n.getLineJoin(),o=n.getWidth(),s=n.getMiterLimit();this.textStrokeState_={lineCap:t===void 0?wl:t,lineDash:r||Tl,lineDashOffset:i||0,lineJoin:a===void 0?El:a,lineWidth:o===void 0?1:o,miterLimit:s===void 0?10:s,strokeStyle:cl(e||Dl)}}let r=e.getFont(),i=e.getOffsetX(),a=e.getOffsetY(),o=e.getRotateWithView(),s=e.getRotation(),c=e.getScaleArray(),l=e.getText(),u=e.getTextAlign(),d=e.getTextBaseline();this.textState_={font:r===void 0?Sl:r,textAlign:u===void 0?Ol:u,textBaseline:d===void 0?kl:d},this.text_=l===void 0?``:Array.isArray(l)?l.reduce((e,t,n)=>e+=n%2?` `:t,``):l,this.textOffsetX_=i===void 0?0:this.pixelRatio_*i,this.textOffsetY_=a===void 0?0:this.pixelRatio_*a,this.textRotateWithView_=o===void 0?!1:o,this.textRotation_=s===void 0?0:s,this.textScale_=[this.pixelRatio_*c[0],this.pixelRatio_*c[1]]}}},Kl=.5,ql={Point:au,LineString:nu,Polygon:su,MultiPoint:ou,MultiLineString:ru,MultiPolygon:iu,GeometryCollection:tu,Circle:Zl};function Jl(e,t){return parseInt(z(e),10)-parseInt(z(t),10)}function Yl(e,t){let n=Xl(e,t);return n*n}function Xl(e,t){return Kl*e/t}function Zl(e,t,n,r,i){let a=n.getFill(),o=n.getStroke();if(a||o){let s=e.getBuilder(n.getZIndex(),`Circle`);s.setFillStrokeStyle(a,o),s.drawCircle(t,r,i)}let s=n.getText();if(s&&s.getText()){let i=e.getBuilder(n.getZIndex(),`Text`);i.setTextStyle(s),i.drawText(t,r)}}function Ql(e,t,n,r,i,a,o,s){let c=[],l=n.getImage();if(l){let e=!0,t=l.getImageState();t==U.LOADED||t==U.ERROR?e=!1:t==U.IDLE&&l.load(),e&&c.push(l.ready())}let u=n.getFill();u&&u.loading()&&c.push(u.ready());let d=c.length>0;return d&&Promise.all(c).then(()=>i(null)),$l(e,t,n,r,a,o,s),d}function $l(e,t,n,r,i,a,o){let s=n.getGeometryFunction()(t);if(!s)return;let c=s.simplifyTransformed(r,i);if(n.getRenderer())eu(e,c,n,t,o);else{let r=ql[c.getType()];r(e,c,n,t,o,a)}}function eu(e,t,n,r,i){if(t.getType()==`GeometryCollection`){let a=t.getGeometries();for(let t=0,o=a.length;t<o;++t)eu(e,a[t],n,r,i);return}e.getBuilder(n.getZIndex(),`Default`).drawCustom(t,r,n.getRenderer(),n.getHitDetectionRenderer(),i)}function tu(e,t,n,r,i,a){let o=t.getGeometriesArray(),s,c;for(s=0,c=o.length;s<c;++s){let t=ql[o[s].getType()];t(e,o[s],n,r,i,a)}}function nu(e,t,n,r,i){let a=n.getStroke();if(a){let o=e.getBuilder(n.getZIndex(),`LineString`);o.setFillStrokeStyle(null,a),o.drawLineString(t,r,i)}let o=n.getText();if(o&&o.getText()){let a=e.getBuilder(n.getZIndex(),`Text`);a.setTextStyle(o),a.drawText(t,r,i)}}function ru(e,t,n,r,i){let a=n.getStroke();if(a){let o=e.getBuilder(n.getZIndex(),`LineString`);o.setFillStrokeStyle(null,a),o.drawMultiLineString(t,r,i)}let o=n.getText();if(o&&o.getText()){let a=e.getBuilder(n.getZIndex(),`Text`);a.setTextStyle(o),a.drawText(t,r,i)}}function iu(e,t,n,r,i){let a=n.getFill(),o=n.getStroke();if(o||a){let s=e.getBuilder(n.getZIndex(),`Polygon`);s.setFillStrokeStyle(a,o),s.drawMultiPolygon(t,r,i)}let s=n.getText();if(s&&s.getText()){let a=e.getBuilder(n.getZIndex(),`Text`);a.setTextStyle(s),a.drawText(t,r,i)}}function au(e,t,n,r,i,a){let o=n.getImage(),s=n.getText(),c=s&&s.getText(),l=a&&o&&c?{}:void 0;if(o){if(o.getImageState()!=U.LOADED)return;let a=e.getBuilder(n.getZIndex(),`Image`);a.setImageStyle(o,l),a.drawPoint(t,r,i)}if(c){let a=e.getBuilder(n.getZIndex(),`Text`);a.setTextStyle(s,l),a.drawText(t,r,i)}}function ou(e,t,n,r,i,a){let o=n.getImage(),s=o&&o.getOpacity()!==0,c=n.getText(),l=c&&c.getText(),u=a&&s&&l?{}:void 0;if(s){if(o.getImageState()!=U.LOADED)return;let a=e.getBuilder(n.getZIndex(),`Image`);a.setImageStyle(o,u),a.drawMultiPoint(t,r,i)}if(l){let a=e.getBuilder(n.getZIndex(),`Text`);a.setTextStyle(c,u),a.drawText(t,r,i)}}function su(e,t,n,r,i){let a=n.getFill(),o=n.getStroke();if(a||o){let s=e.getBuilder(n.getZIndex(),`Polygon`);s.setFillStrokeStyle(a,o),s.drawPolygon(t,r,i)}let s=n.getText();if(s&&s.getText()){let a=e.getBuilder(n.getZIndex(),`Text`);a.setTextStyle(s),a.drawText(t,r,i)}}var cu=!1;function lu(e,t,n,r,i,a,o){let s=new XMLHttpRequest;s.open(`GET`,typeof e==`function`?e(n,r,i):e,!0),t.getType()==`arraybuffer`&&(s.responseType=`arraybuffer`),s.withCredentials=cu,s.onload=function(e){if(!s.status||s.status>=200&&s.status<300){let e=t.getType();try{let r;e==`text`||e==`json`?r=s.responseText:e==`xml`?r=s.responseXML||s.responseText:e==`arraybuffer`&&(r=s.response),r?a(t.readFeatures(r,{extent:n,featureProjection:i}),t.readProjection(r)):o()}catch{o()}}else o()},s.onerror=o,s.send()}function uu(e,t){return function(n,r,i,a,o){lu(e,t,n,r,i,(e,t)=>{this.addFeatures(e),a!==void 0&&a(e)},()=>{this.changed(),o!==void 0&&o()})}}function du(e,t){return[[-1/0,-1/0,1/0,1/0]]}function fu(e,t,n,r){let i=[],a=mi();for(let o=0,s=n.length;o<s;++o){let s=n[o];a=vi(e,t,s[0],r),i.push((a[0]+a[2])/2,(a[1]+a[3])/2),t=s[s.length-1]}return i}var pu=class e extends ls{constructor(e,t,n){if(super(),this.ends_=[],this.maxDelta_=-1,this.maxDeltaRevision_=-1,Array.isArray(e[0]))this.setCoordinates(e,t);else if(t!==void 0&&n)this.setFlatCoordinates(t,e),this.ends_=n;else{let t=e,n=[],r=[];for(let e=0,i=t.length;e<i;++e){let i=t[e];Fr(n,i.getFlatCoordinates()),r.push(n.length)}let i=t.length===0?this.getLayout():t[0].getLayout();this.setFlatCoordinates(i,n),this.ends_=r}}appendLineString(e){Fr(this.flatCoordinates,e.getFlatCoordinates().slice()),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){let t=new e(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return t.applyProperties(this),t}closestPointXY(e,t,n,r){return r<li(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(vs(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),xs(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!1,e,t,n,r))}getCoordinateAtM(e,t,n){return this.layout!=`XYM`&&this.layout!=`XYZM`||this.flatCoordinates.length===0?null:(t=t===void 0?!1:t,n=n===void 0?!1:n,sc(this.flatCoordinates,0,this.ends_,this.stride,e,t,n))}getCoordinates(){return Os(this.flatCoordinates,0,this.ends_,this.stride)}getEnds(){return this.ends_}getLineString(e){return e<0||this.ends_.length<=e?null:new lc(this.flatCoordinates.slice(e===0?0:this.ends_[e-1],this.ends_[e]),this.layout)}getLineStrings(){let e=this.flatCoordinates,t=this.ends_,n=this.layout,r=[],i=0;for(let a=0,o=t.length;a<o;++a){let o=t[a],s=new lc(e.slice(i,o),n);r.push(s),i=o}return r}getLength(){let e=this.ends_,t=0,n=0;for(let r=0,i=e.length;r<i;++r)n+=cc(this.flatCoordinates,t,e[r],this.stride),t=e[r];return n}getFlatMidpoints(){let e=[],t=this.flatCoordinates,n=0,r=this.ends_,i=this.stride;for(let a=0,o=r.length;a<o;++a){let o=r[a];Fr(e,ac(t,n,o,i,.5)),n=o}return e}getSimplifiedGeometryInternal(t){let n=[],r=[];return n.length=js(this.flatCoordinates,0,this.ends_,this.stride,t,n,0,r),new e(n,`XY`,r)}getType(){return`MultiLineString`}intersectsExtent(e){return Ks(this.flatCoordinates,0,this.ends_,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,2),this.flatCoordinates||=[];let n=Ts(this.flatCoordinates,0,e,this.stride,this.ends_);this.flatCoordinates.length=n.length===0?0:n[n.length-1],this.changed()}},mu=class e extends ls{constructor(e,t){super(),t&&!Array.isArray(e[0])?this.setFlatCoordinates(t,e):this.setCoordinates(e,t)}appendPoint(e){Fr(this.flatCoordinates,e.getFlatCoordinates()),this.changed()}clone(){let t=new e(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(e,t,n,r){if(r<li(this.getExtent(),e,t))return r;let i=this.flatCoordinates,a=this.stride;for(let o=0,s=i.length;o<s;o+=a){let s=Wi(e,t,i[o],i[o+1]);if(s<r){r=s;for(let e=0;e<a;++e)n[e]=i[o+e];n.length=a}}return r}getCoordinates(){return Ds(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getPoint(e){let t=this.flatCoordinates.length/this.stride;return e<0||t<=e?null:new Ls(this.flatCoordinates.slice(e*this.stride,(e+1)*this.stride),this.layout)}getPoints(){let e=this.flatCoordinates,t=this.layout,n=this.stride,r=[];for(let i=0,a=e.length;i<a;i+=n){let a=new Ls(e.slice(i,i+n),t);r.push(a)}return r}getType(){return`MultiPoint`}intersectsExtent(e){let t=this.flatCoordinates,n=this.stride;for(let r=0,i=t.length;r<i;r+=n){let n=t[r],i=t[r+1];if(fi(e,n,i))return!0}return!1}setCoordinates(e,t){this.setLayout(t,e,1),this.flatCoordinates||=[],this.flatCoordinates.length=ws(this.flatCoordinates,0,e,this.stride),this.changed()}},hu=class e extends ls{constructor(e,t,n){if(super(),this.endss_=[],this.flatInteriorPointsRevision_=-1,this.flatInteriorPoints_=null,this.maxDelta_=-1,this.maxDeltaRevision_=-1,this.orientedRevision_=-1,this.orientedFlatCoordinates_=null,!n&&!Array.isArray(e[0])){let r=e,i=[],a=[];for(let e=0,t=r.length;e<t;++e){let t=r[e],n=i.length,o=t.getEnds();for(let e=0,t=o.length;e<t;++e)o[e]+=n;Fr(i,t.getFlatCoordinates()),a.push(o)}t=r.length===0?this.getLayout():r[0].getLayout(),e=i,n=a}t!==void 0&&n?(this.setFlatCoordinates(t,e),this.endss_=n):this.setCoordinates(e,t)}appendPolygon(e){let t;if(!this.flatCoordinates)this.flatCoordinates=e.getFlatCoordinates().slice(),t=e.getEnds().slice(),this.endss_.push();else{let n=this.flatCoordinates.length;Fr(this.flatCoordinates,e.getFlatCoordinates()),t=e.getEnds().slice();for(let e=0,r=t.length;e<r;++e)t[e]+=n}this.endss_.push(t),this.changed()}clone(){let t=this.endss_.length,n=Array(t);for(let e=0;e<t;++e)n[e]=this.endss_[e].slice();let r=new e(this.flatCoordinates.slice(),this.layout,n);return r.applyProperties(this),r}closestPointXY(e,t,n,r){return r<li(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(ys(this.flatCoordinates,0,this.endss_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Ss(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,this.maxDelta_,!0,e,t,n,r))}containsXY(e,t){return Vs(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,e,t)}getArea(){return hs(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride)}getCoordinates(e){let t;return e===void 0?t=this.flatCoordinates:(t=this.getOrientedFlatCoordinates().slice(),tc(t,0,this.endss_,this.stride,e)),ks(t,0,this.endss_,this.stride)}getEndss(){return this.endss_}getFlatInteriorPoints(){if(this.flatInteriorPointsRevision_!=this.getRevision()){let e=fu(this.flatCoordinates,0,this.endss_,this.stride);this.flatInteriorPoints_=Us(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,e),this.flatInteriorPointsRevision_=this.getRevision()}return this.flatInteriorPoints_}getInteriorPoints(){return new mu(this.getFlatInteriorPoints().slice(),`XYM`)}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){let e=this.flatCoordinates;$s(e,0,this.endss_,this.stride)?this.orientedFlatCoordinates_=e:(this.orientedFlatCoordinates_=e.slice(),this.orientedFlatCoordinates_.length=tc(this.orientedFlatCoordinates_,0,this.endss_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(t){let n=[],r=[];return n.length=Fs(this.flatCoordinates,0,this.endss_,this.stride,Math.sqrt(t),n,0,r),new e(n,`XY`,r)}getPolygon(e){if(e<0||this.endss_.length<=e)return null;let t;if(e===0)t=0;else{let n=this.endss_[e-1];t=n[n.length-1]}let n=this.endss_[e].slice(),r=n[n.length-1];if(t!==0)for(let e=0,r=n.length;e<r;++e)n[e]-=t;return new rc(this.flatCoordinates.slice(t,r),this.layout,n)}getPolygons(){let e=this.layout,t=this.flatCoordinates,n=this.endss_,r=[],i=0;for(let a=0,o=n.length;a<o;++a){let o=n[a].slice(),s=o[o.length-1];if(i!==0)for(let e=0,t=o.length;e<t;++e)o[e]-=i;let c=new rc(t.slice(i,s),e,o);r.push(c),i=s}return r}getType(){return`MultiPolygon`}intersectsExtent(e){return Ys(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,3),this.flatCoordinates||=[];let n=Es(this.flatCoordinates,0,e,this.stride,this.endss_);if(n.length===0)this.flatCoordinates.length=0;else{let e=n[n.length-1];this.flatCoordinates.length=e.length===0?0:e[e.length-1]}this.changed()}},gu=Vo(),_u=class e{constructor(e,t,n,r,i,a){this.styleFunction,this.extent_,this.id_=a,this.type_=e,this.flatCoordinates_=t,this.flatInteriorPoints_=null,this.flatMidpoints_=null,this.ends_=n||null,this.properties_=i,this.squaredTolerance_,this.stride_=r,this.simplifiedGeometry_}get(e){return this.properties_[e]}getExtent(){return this.extent_||=this.type_===`Point`?_i(this.flatCoordinates_):vi(this.flatCoordinates_,0,this.flatCoordinates_.length,2),this.extent_}getFlatInteriorPoint(){if(!this.flatInteriorPoints_){let e=Oi(this.getExtent());this.flatInteriorPoints_=Hs(this.flatCoordinates_,0,this.ends_,2,e,0)}return this.flatInteriorPoints_}getFlatInteriorPoints(){if(!this.flatInteriorPoints_){let e=nc(this.flatCoordinates_,this.ends_),t=fu(this.flatCoordinates_,0,e,2);this.flatInteriorPoints_=Us(this.flatCoordinates_,0,e,2,t)}return this.flatInteriorPoints_}getFlatMidpoint(){return this.flatMidpoints_||=ac(this.flatCoordinates_,0,this.flatCoordinates_.length,2,.5),this.flatMidpoints_}getFlatMidpoints(){if(!this.flatMidpoints_){this.flatMidpoints_=[];let e=this.flatCoordinates_,t=0,n=this.ends_;for(let r=0,i=n.length;r<i;++r){let i=n[r],a=ac(e,t,i,2,.5);Fr(this.flatMidpoints_,a),t=i}}return this.flatMidpoints_}getId(){return this.id_}getOrientedFlatCoordinates(){return this.flatCoordinates_}getGeometry(){return this}getSimplifiedGeometry(e){return this}simplifyTransformed(e,t){return this}getProperties(){return this.properties_}getPropertiesInternal(){return this.properties_}getStride(){return this.stride_}getStyleFunction(){return this.styleFunction}getType(){return this.type_}transform(e){e=yo(e);let t=e.getExtent(),n=e.getWorldExtent();if(t&&n){let e=Mi(n)/Mi(t);Yo(gu,n[0],n[3],e,-e,0,0,0),ns(this.flatCoordinates_,0,this.flatCoordinates_.length,2,gu,this.flatCoordinates_)}}applyTransform(e){e(this.flatCoordinates_,this.flatCoordinates_,this.stride_)}clone(){return new e(this.type_,this.flatCoordinates_.slice(),this.ends_?.slice(),this.stride_,Object.assign({},this.properties_),this.id_)}getEnds(){return this.ends_}enableSimplifyTransformed(){return this.simplifyTransformed=Vr((t,n)=>{if(t===this.squaredTolerance_)return this.simplifiedGeometry_;this.simplifiedGeometry_=this.clone(),n&&this.simplifiedGeometry_.applyTransform(n);let r=this.simplifiedGeometry_.getFlatCoordinates(),i;switch(this.type_){case`LineString`:r.length=As(r,0,this.simplifiedGeometry_.flatCoordinates_.length,this.simplifiedGeometry_.stride_,t,r,0),i=[r.length];break;case`MultiLineString`:i=[],r.length=js(r,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,t,r,0,i);break;case`Polygon`:i=[],r.length=Ps(r,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,Math.sqrt(t),r,0,i);break;default:}return i&&(this.simplifiedGeometry_=new e(this.type_,r,i,2,this.properties_,this.id_)),this.squaredTolerance_=t,this.simplifiedGeometry_}),this}};_u.prototype.getFlatCoordinates=_u.prototype.getOrientedFlatCoordinates;function vu(e,t,n=0,r=e.length-1,i=bu){for(;r>n;){if(r-n>600){let a=r-n+1,o=t-n+1,s=Math.log(a),c=.5*Math.exp(2*s/3),l=.5*Math.sqrt(s*c*(a-c)/a)*(o-a/2<0?-1:1);vu(e,t,Math.max(n,Math.floor(t-o*c/a+l)),Math.min(r,Math.floor(t+(a-o)*c/a+l)),i)}let a=e[t],o=n,s=r;for(yu(e,n,t),i(e[r],a)>0&&yu(e,n,r);o<s;){for(yu(e,o,s),o++,s--;i(e[o],a)<0;)o++;for(;i(e[s],a)>0;)s--}i(e[n],a)===0?yu(e,n,s):(s++,yu(e,s,r)),s<=t&&(n=s+1),t<=s&&(r=s-1)}}function yu(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}function bu(e,t){return e<t?-1:e>t?1:0}var xu=class{constructor(e=9){this._maxEntries=Math.max(4,e),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4)),this.clear()}all(){return this._all(this.data,[])}search(e){let t=this.data,n=[];if(!Nu(e,t))return n;let r=this.toBBox,i=[];for(;t;){for(let a=0;a<t.children.length;a++){let o=t.children[a],s=t.leaf?r(o):o;Nu(e,s)&&(t.leaf?n.push(o):Mu(e,s)?this._all(o,n):i.push(o))}t=i.pop()}return n}collides(e){let t=this.data;if(!Nu(e,t))return!1;let n=[];for(;t;){for(let r=0;r<t.children.length;r++){let i=t.children[r],a=t.leaf?this.toBBox(i):i;if(Nu(e,a)){if(t.leaf||Mu(e,a))return!0;n.push(i)}}t=n.pop()}return!1}load(e){if(!(e&&e.length))return this;if(e.length<this._minEntries){for(let t=0;t<e.length;t++)this.insert(e[t]);return this}let t=this._build(e.slice(),0,e.length-1,0);if(!this.data.children.length)this.data=t;else if(this.data.height===t.height)this._splitRoot(this.data,t);else{if(this.data.height<t.height){let e=this.data;this.data=t,t=e}this._insert(t,this.data.height-t.height-1,!0)}return this}insert(e){return e&&this._insert(e,this.data.height-1),this}clear(){return this.data=Pu([]),this}remove(e,t){if(!e)return this;let n=this.data,r=this.toBBox(e),i=[],a=[],o,s,c;for(;n||i.length;){if(n||(n=i.pop(),s=i[i.length-1],o=a.pop(),c=!0),n.leaf){let r=Su(e,n.children,t);if(r!==-1)return n.children.splice(r,1),i.push(n),this._condense(i),this}!c&&!n.leaf&&Mu(n,r)?(i.push(n),a.push(o),o=0,s=n,n=n.children[0]):s?(o++,n=s.children[o],c=!1):n=null}return this}toBBox(e){return e}compareMinX(e,t){return e.minX-t.minX}compareMinY(e,t){return e.minY-t.minY}toJSON(){return this.data}fromJSON(e){return this.data=e,this}_all(e,t){let n=[];for(;e;)e.leaf?t.push(...e.children):n.push(...e.children),e=n.pop();return t}_build(e,t,n,r){let i=n-t+1,a=this._maxEntries,o;if(i<=a)return o=Pu(e.slice(t,n+1)),Cu(o,this.toBBox),o;r||(r=Math.ceil(Math.log(i)/Math.log(a)),a=Math.ceil(i/a**(r-1))),o=Pu([]),o.leaf=!1,o.height=r;let s=Math.ceil(i/a),c=s*Math.ceil(Math.sqrt(a));Fu(e,t,n,c,this.compareMinX);for(let i=t;i<=n;i+=c){let t=Math.min(i+c-1,n);Fu(e,i,t,s,this.compareMinY);for(let n=i;n<=t;n+=s){let i=Math.min(n+s-1,t);o.children.push(this._build(e,n,i,r-1))}}return Cu(o,this.toBBox),o}_chooseSubtree(e,t,n,r){for(;r.push(t),!(t.leaf||r.length-1===n);){let n=1/0,r=1/0,i;for(let a=0;a<t.children.length;a++){let o=t.children[a],s=Ou(o),c=Au(e,o)-s;c<r?(r=c,n=s<n?s:n,i=o):c===r&&s<n&&(n=s,i=o)}t=i||t.children[0]}return t}_insert(e,t,n){let r=n?e:this.toBBox(e),i=[],a=this._chooseSubtree(r,this.data,t,i);for(a.children.push(e),Tu(a,r);t>=0&&i[t].children.length>this._maxEntries;)this._split(i,t),t--;this._adjustParentBBoxes(r,i,t)}_split(e,t){let n=e[t],r=n.children.length,i=this._minEntries;this._chooseSplitAxis(n,i,r);let a=this._chooseSplitIndex(n,i,r),o=Pu(n.children.splice(a,n.children.length-a));o.height=n.height,o.leaf=n.leaf,Cu(n,this.toBBox),Cu(o,this.toBBox),t?e[t-1].children.push(o):this._splitRoot(n,o)}_splitRoot(e,t){this.data=Pu([e,t]),this.data.height=e.height+1,this.data.leaf=!1,Cu(this.data,this.toBBox)}_chooseSplitIndex(e,t,n){let r,i=1/0,a=1/0;for(let o=t;o<=n-t;o++){let t=wu(e,0,o,this.toBBox),s=wu(e,o,n,this.toBBox),c=ju(t,s),l=Ou(t)+Ou(s);c<i?(i=c,r=o,a=l<a?l:a):c===i&&l<a&&(a=l,r=o)}return r||n-t}_chooseSplitAxis(e,t,n){let r=e.leaf?this.compareMinX:Eu,i=e.leaf?this.compareMinY:Du;this._allDistMargin(e,t,n,r)<this._allDistMargin(e,t,n,i)&&e.children.sort(r)}_allDistMargin(e,t,n,r){e.children.sort(r);let i=this.toBBox,a=wu(e,0,t,i),o=wu(e,n-t,n,i),s=ku(a)+ku(o);for(let r=t;r<n-t;r++){let t=e.children[r];Tu(a,e.leaf?i(t):t),s+=ku(a)}for(let r=n-t-1;r>=t;r--){let t=e.children[r];Tu(o,e.leaf?i(t):t),s+=ku(o)}return s}_adjustParentBBoxes(e,t,n){for(let r=n;r>=0;r--)Tu(t[r],e)}_condense(e){for(let t=e.length-1,n;t>=0;t--)e[t].children.length===0?t>0?(n=e[t-1].children,n.splice(n.indexOf(e[t]),1)):this.clear():Cu(e[t],this.toBBox)}};function Su(e,t,n){if(!n)return t.indexOf(e);for(let r=0;r<t.length;r++)if(n(e,t[r]))return r;return-1}function Cu(e,t){wu(e,0,e.children.length,t,e)}function wu(e,t,n,r,i){i||=Pu(null),i.minX=1/0,i.minY=1/0,i.maxX=-1/0,i.maxY=-1/0;for(let a=t;a<n;a++){let t=e.children[a];Tu(i,e.leaf?r(t):t)}return i}function Tu(e,t){return e.minX=Math.min(e.minX,t.minX),e.minY=Math.min(e.minY,t.minY),e.maxX=Math.max(e.maxX,t.maxX),e.maxY=Math.max(e.maxY,t.maxY),e}function Eu(e,t){return e.minX-t.minX}function Du(e,t){return e.minY-t.minY}function Ou(e){return(e.maxX-e.minX)*(e.maxY-e.minY)}function ku(e){return e.maxX-e.minX+(e.maxY-e.minY)}function Au(e,t){return(Math.max(t.maxX,e.maxX)-Math.min(t.minX,e.minX))*(Math.max(t.maxY,e.maxY)-Math.min(t.minY,e.minY))}function ju(e,t){let n=Math.max(e.minX,t.minX),r=Math.max(e.minY,t.minY),i=Math.min(e.maxX,t.maxX),a=Math.min(e.maxY,t.maxY);return Math.max(0,i-n)*Math.max(0,a-r)}function Mu(e,t){return e.minX<=t.minX&&e.minY<=t.minY&&t.maxX<=e.maxX&&t.maxY<=e.maxY}function Nu(e,t){return t.minX<=e.maxX&&t.minY<=e.maxY&&t.maxX>=e.minX&&t.maxY>=e.minY}function Pu(e){return{children:e,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function Fu(e,t,n,r,i){let a=[t,n];for(;a.length;){if(n=a.pop(),t=a.pop(),n-t<=r)continue;let o=t+Math.ceil((n-t)/r/2)*r;vu(e,o,t,n,i),a.push(t,o,o,n)}}var Iu=class{constructor(e){this.rbush_=new xu(e),this.items_={}}insert(e,t){let n={minX:e[0],minY:e[1],maxX:e[2],maxY:e[3],value:t};this.rbush_.insert(n),this.items_[z(t)]=n}load(e,t){let n=Array(t.length);for(let r=0,i=t.length;r<i;r++){let i=e[r],a=t[r],o={minX:i[0],minY:i[1],maxX:i[2],maxY:i[3],value:a};n[r]=o,this.items_[z(a)]=o}this.rbush_.load(n)}remove(e){let t=z(e),n=this.items_[t];return delete this.items_[t],this.rbush_.remove(n)!==null}update(e,t){let n=this.items_[z(t)];yi([n.minX,n.minY,n.maxX,n.maxY],e)||(this.remove(t),this.insert(e,t))}getAll(){return this.rbush_.all().map(function(e){return e.value})}getInExtent(e){let t={minX:e[0],minY:e[1],maxX:e[2],maxY:e[3]};return this.rbush_.search(t).map(function(e){return e.value})}forEach(e){return this.forEach_(this.getAll(),e)}forEachInExtent(e,t){return this.forEach_(this.getInExtent(e),t)}forEach_(e,t){let n;for(let r=0,i=e.length;r<i;r++)if(n=t(e[r]),n)return n;return n}isEmpty(){return Wr(this.items_)}clear(){this.rbush_.clear(),this.items_={}}getExtent(e){let t=this.rbush_.toJSON();return hi(t.minX,t.minY,t.maxX,t.maxY,e)}concat(e){this.rbush_.load(e.rbush_.all());for(let t in e.items_)this.items_[t]=e.items_[t]}},Lu=class extends Qr{constructor(e){super(),this.projection=yo(e.projection),this.attributions_=Ru(e.attributions),this.attributionsCollapsible_=e.attributionsCollapsible??!0,this.loading=!1,this.state_=e.state===void 0?`ready`:e.state,this.wrapX_=e.wrapX===void 0?!1:e.wrapX,this.interpolate_=!!e.interpolate,this.viewResolver=null,this.viewRejector=null;let t=this;this.viewPromise_=new Promise(function(e,n){t.viewResolver=e,t.viewRejector=n})}getAttributions(){return this.attributions_}getAttributionsCollapsible(){return this.attributionsCollapsible_}getProjection(){return this.projection}getResolutions(e){return null}getView(){return this.viewPromise_}getState(){return this.state_}getWrapX(){return this.wrapX_}getInterpolate(){return this.interpolate_}refresh(){this.changed()}setAttributions(e){this.attributions_=Ru(e),this.changed()}setState(e){this.state_=e,this.changed()}};function Ru(e){return e?typeof e==`function`?e:(Array.isArray(e)||(e=[e]),t=>e):null}var zu={ADDFEATURE:`addfeature`,CHANGEFEATURE:`changefeature`,CLEAR:`clear`,REMOVEFEATURE:`removefeature`,FEATURESLOADSTART:`featuresloadstart`,FEATURESLOADEND:`featuresloadend`,FEATURESLOADERROR:`featuresloaderror`},Bu=class extends Gr{constructor(e,t,n){super(e),this.feature=t,this.features=n}},Vu=class extends Lu{constructor(e){e||={},super({attributions:e.attributions,interpolate:!0,projection:void 0,state:`ready`,wrapX:e.wrapX===void 0?!0:e.wrapX}),this.on,this.once,this.un,this.loader_=Br,this.format_=e.format||null,this.overlaps_=e.overlaps===void 0?!0:e.overlaps,this.url_=e.url,e.loader===void 0?this.url_!==void 0&&(B(this.format_,"`format` must be set when `url` is set"),this.loader_=uu(this.url_,this.format_)):this.loader_=e.loader,this.strategy_=e.strategy===void 0?du:e.strategy;let t=e.useSpatialIndex===void 0?!0:e.useSpatialIndex;this.featuresRtree_=t?new Iu:null,this.loadedExtentsRtree_=new Iu,this.loadingExtentsCount_=0,this.nullGeometryFeatures_={},this.idIndex_={},this.uidIndex_={},this.featureChangeKeys_={},this.featuresCollection_=null;let n,r;Array.isArray(e.features)?r=e.features:e.features&&(n=e.features,r=n.getArray()),!t&&n===void 0&&(n=new ti(r)),r!==void 0&&this.addFeaturesInternal(r),n!==void 0&&this.bindFeaturesCollection_(n)}addFeature(e){this.addFeatureInternal(e),this.changed()}addFeatureInternal(e){let t=z(e);if(!this.addToIndex_(t,e)){this.featuresCollection_&&this.featuresCollection_.remove(e);return}this.setupChangeEvents_(t,e);let n=e.getGeometry();if(n){let t=n.getExtent();this.featuresRtree_&&this.featuresRtree_.insert(t,e)}else this.nullGeometryFeatures_[t]=e;this.dispatchEvent(new Bu(zu.ADDFEATURE,e))}setupChangeEvents_(e,t){t instanceof _u||(this.featureChangeKeys_[e]=[I(t,F.CHANGE,this.handleFeatureChange_,this),I(t,Or.PROPERTYCHANGE,this.handleFeatureChange_,this)])}addToIndex_(e,t){let n=!0;if(t.getId()!==void 0){let e=String(t.getId());if(!(e in this.idIndex_))this.idIndex_[e]=t;else if(t instanceof _u){let r=this.idIndex_[e];r instanceof _u?Array.isArray(r)?r.push(t):this.idIndex_[e]=[r,t]:n=!1}else n=!1}return n&&(B(!(e in this.uidIndex_),"The passed `feature` was already added to the source"),this.uidIndex_[e]=t),n}addFeatures(e){this.addFeaturesInternal(e),this.changed()}addFeaturesInternal(e){let t=[],n=[],r=[];for(let t=0,r=e.length;t<r;t++){let r=e[t],i=z(r);this.addToIndex_(i,r)&&n.push(r)}for(let e=0,i=n.length;e<i;e++){let i=n[e],a=z(i);this.setupChangeEvents_(a,i);let o=i.getGeometry();if(o){let e=o.getExtent();t.push(e),r.push(i)}else this.nullGeometryFeatures_[a]=i}if(this.featuresRtree_&&this.featuresRtree_.load(t,r),this.hasListener(zu.ADDFEATURE))for(let e=0,t=n.length;e<t;e++)this.dispatchEvent(new Bu(zu.ADDFEATURE,n[e]))}bindFeaturesCollection_(e){let t=!1;this.addEventListener(zu.ADDFEATURE,function(n){t||=(t=!0,e.push(n.feature),!1)}),this.addEventListener(zu.REMOVEFEATURE,function(n){t||=(t=!0,e.remove(n.feature),!1)}),e.addEventListener(Dr.ADD,e=>{t||=(t=!0,this.addFeature(e.element),!1)}),e.addEventListener(Dr.REMOVE,e=>{t||=(t=!0,this.removeFeature(e.element),!1)}),this.featuresCollection_=e}clear(e){if(e){for(let e in this.featureChangeKeys_)this.featureChangeKeys_[e].forEach(L);this.featuresCollection_||(this.featureChangeKeys_={},this.idIndex_={},this.uidIndex_={})}else if(this.featuresRtree_){this.featuresRtree_.forEach(e=>{this.removeFeatureInternal(e)});for(let e in this.nullGeometryFeatures_)this.removeFeatureInternal(this.nullGeometryFeatures_[e])}this.featuresCollection_&&this.featuresCollection_.clear(),this.featuresRtree_&&this.featuresRtree_.clear(),this.nullGeometryFeatures_={};let t=new Bu(zu.CLEAR);this.dispatchEvent(t),this.changed()}forEachFeature(e){if(this.featuresRtree_)return this.featuresRtree_.forEach(e);this.featuresCollection_&&this.featuresCollection_.forEach(e)}forEachFeatureAtCoordinateDirect(e,t){let n=[e[0],e[1],e[0],e[1]];return this.forEachFeatureInExtent(n,function(n){let r=n.getGeometry();if(r instanceof _u||r.intersectsCoordinate(e))return t(n)})}forEachFeatureInExtent(e,t){if(this.featuresRtree_)return this.featuresRtree_.forEachInExtent(e,t);this.featuresCollection_&&this.featuresCollection_.forEach(t)}forEachFeatureIntersectingExtent(e,t){return this.forEachFeatureInExtent(e,function(n){let r=n.getGeometry();if(r instanceof _u||r.intersectsExtent(e)){let e=t(n);if(e)return e}})}getFeaturesCollection(){return this.featuresCollection_}getFeatures(){let e;return this.featuresCollection_?e=this.featuresCollection_.getArray().slice(0):this.featuresRtree_&&(e=this.featuresRtree_.getAll(),Wr(this.nullGeometryFeatures_)||Fr(e,Object.values(this.nullGeometryFeatures_))),e}getFeaturesAtCoordinate(e){let t=[];return this.forEachFeatureAtCoordinateDirect(e,function(e){t.push(e)}),t}getFeaturesInExtent(e,t){if(this.featuresRtree_){if(!(t&&t.canWrapX()&&this.getWrapX()))return this.featuresRtree_.getInExtent(e);let n=Hi(e,t);return[].concat(...n.map(e=>this.featuresRtree_.getInExtent(e)))}return this.featuresCollection_?this.featuresCollection_.getArray().slice(0):[]}getClosestFeatureToCoordinate(e,t){let n=e[0],r=e[1],i=null,a=[NaN,NaN],o=1/0,s=[-1/0,-1/0,1/0,1/0];return t||=Rr,this.featuresRtree_.forEachInExtent(s,function(e){if(t(e)){let t=e.getGeometry(),c=o;if(o=t instanceof _u?0:t.closestPointXY(n,r,a,o),o<c){i=e;let t=Math.sqrt(o);s[0]=n-t,s[1]=r-t,s[2]=n+t,s[3]=r+t}}}),i}getExtent(e){return this.featuresRtree_?.getExtent(e)??null}getFeatureById(e){let t=this.idIndex_[e.toString()];return t===void 0?null:t}getFeatureByUid(e){let t=this.uidIndex_[e];return t===void 0?null:t}getFormat(){return this.format_}getOverlaps(){return this.overlaps_}getUrl(){return this.url_}handleFeatureChange_(e){let t=e.target,n=z(t),r=t.getGeometry();if(!r)n in this.nullGeometryFeatures_||(this.featuresRtree_&&this.featuresRtree_.remove(t),this.nullGeometryFeatures_[n]=t);else{let e=r.getExtent();n in this.nullGeometryFeatures_?(delete this.nullGeometryFeatures_[n],this.featuresRtree_&&this.featuresRtree_.insert(e,t)):this.featuresRtree_&&this.featuresRtree_.update(e,t)}let i=t.getId();if(i!==void 0){let e=i.toString();this.idIndex_[e]!==t&&(this.removeFromIdIndex_(t),this.idIndex_[e]=t)}else this.removeFromIdIndex_(t),this.uidIndex_[n]=t;this.changed(),this.dispatchEvent(new Bu(zu.CHANGEFEATURE,t))}hasFeature(e){let t=e.getId();return t===void 0?z(e)in this.uidIndex_:t in this.idIndex_}isEmpty(){return this.featuresRtree_?this.featuresRtree_.isEmpty()&&Wr(this.nullGeometryFeatures_):this.featuresCollection_?this.featuresCollection_.getLength()===0:!0}loadFeatures(e,t,n){let r=this.loadedExtentsRtree_,i=this.strategy_(e,t,n);for(let e=0,a=i.length;e<a;++e){let a=i[e];r.forEachInExtent(a,function(e){return di(e.extent,a)})||(++this.loadingExtentsCount_,this.dispatchEvent(new Bu(zu.FEATURESLOADSTART)),this.loader_.call(this,a,t,n,e=>{--this.loadingExtentsCount_,this.dispatchEvent(new Bu(zu.FEATURESLOADEND,void 0,e))},()=>{--this.loadingExtentsCount_,this.dispatchEvent(new Bu(zu.FEATURESLOADERROR))}),r.insert(a,{extent:a.slice()}))}this.loading=this.loader_.length<4?!1:this.loadingExtentsCount_>0}refresh(){this.clear(!0),this.loadedExtentsRtree_.clear(),super.refresh()}removeLoadedExtent(e){let t=this.loadedExtentsRtree_,n=t.forEachInExtent(e,function(t){if(yi(t.extent,e))return t});n&&t.remove(n)}removeFeatures(e){let t=!1;for(let n=0,r=e.length;n<r;++n)t=this.removeFeatureInternal(e[n])||t;t&&this.changed()}removeFeature(e){e&&this.removeFeatureInternal(e)&&this.changed()}removeFeatureInternal(e){let t=z(e);if(!(t in this.uidIndex_))return!1;t in this.nullGeometryFeatures_?delete this.nullGeometryFeatures_[t]:this.featuresRtree_&&this.featuresRtree_.remove(e),this.featureChangeKeys_[t]?.forEach(L),delete this.featureChangeKeys_[t];let n=e.getId();if(n!==void 0){let t=n.toString(),r=this.idIndex_[t];r===e?delete this.idIndex_[t]:Array.isArray(r)&&(r.splice(r.indexOf(e),1),r.length===1&&(this.idIndex_[t]=r[0]))}return delete this.uidIndex_[t],this.hasListener(zu.REMOVEFEATURE)&&this.dispatchEvent(new Bu(zu.REMOVEFEATURE,e)),!0}removeFromIdIndex_(e){for(let t in this.idIndex_)if(this.idIndex_[t]===e){delete this.idIndex_[t];break}}setLoader(e){this.loader_=e}setUrl(e){B(this.format_,"`format` must be set when `url` is set"),this.url_=e,this.setLoader(uu(e,this.format_))}setOverlaps(e){this.overlaps_=e,this.changed()}},Hu=class e{constructor(e){e||={},this.patternImage_=null,this.color_=null,e.color!==void 0&&this.setColor(e.color)}clone(){let t=this.getColor();return new e({color:Array.isArray(t)?t.slice():t||void 0})}getColor(){return this.color_}setColor(e){if(typeof e==`object`&&e&&`src`in e){let t=sl(null,e.src,{crossOrigin:`anonymous`},void 0,e.offset?null:e.color?e.color:null,!(e.offset&&e.size));t.ready().then(()=>{this.patternImage_=null}),t.getImageState()===U.IDLE&&t.load(),t.getImageState()===U.LOADING&&(this.patternImage_=t)}this.color_=e}getKey(){let e=this.getColor();return e?e instanceof CanvasPattern||e instanceof CanvasGradient?z(e):typeof e==`object`&&`src`in e?e.src+`:`+e.offset:Zc(e).toString():``}loading(){return!!this.patternImage_}ready(){return this.patternImage_?this.patternImage_.ready():Promise.resolve()}},Uu=class e{constructor(e){e||={},this.color_=e.color===void 0?null:e.color,this.lineCap_=e.lineCap,this.lineDash_=e.lineDash===void 0?null:e.lineDash,this.lineDashOffset_=e.lineDashOffset,this.lineJoin_=e.lineJoin,this.miterLimit_=e.miterLimit,this.offset_=e.offset,this.width_=e.width}clone(){let t=this.getColor();return new e({color:Array.isArray(t)?t.slice():t||void 0,lineCap:this.getLineCap(),lineDash:this.getLineDash()?this.getLineDash().slice():void 0,lineDashOffset:this.getLineDashOffset(),lineJoin:this.getLineJoin(),miterLimit:this.getMiterLimit(),offset:this.getOffset(),width:this.getWidth()})}getColor(){return this.color_}getLineCap(){return this.lineCap_}getLineDash(){return this.lineDash_}getLineDashOffset(){return this.lineDashOffset_}getLineJoin(){return this.lineJoin_}getMiterLimit(){return this.miterLimit_}getOffset(){return this.offset_}getWidth(){return this.width_}setColor(e){this.color_=e}setLineCap(e){this.lineCap_=e}setLineDash(e){this.lineDash_=e}setLineDashOffset(e){this.lineDashOffset_=e}setLineJoin(e){this.lineJoin_=e}setMiterLimit(e){this.miterLimit_=e}setOffset(e){this.offset_=e}setWidth(e){this.width_=e}};function Wu(e){return e[0]>0&&e[1]>0}function Gu(e,t,n){return n===void 0&&(n=[0,0]),n[0]=e[0]*t+.5|0,n[1]=e[1]*t+.5|0,n}function Ku(e,t){return Array.isArray(e)?e:(t===void 0?t=[e,e]:(t[0]=e,t[1]=e),t)}var qu=class e{constructor(e){this.opacity_=e.opacity,this.rotateWithView_=e.rotateWithView,this.rotation_=e.rotation,this.scale_=e.scale,this.scaleArray_=Ku(e.scale),this.displacement_=e.displacement,this.declutterMode_=e.declutterMode}clone(){let t=this.getScale();return new e({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 R()}getImage(e){return R()}getHitDetectionImage(){return R()}getPixelRatio(e){return 1}getImageState(){return R()}getImageSize(){return R()}getOrigin(){return R()}getSize(){return R()}setDisplacement(e){this.displacement_=e}setOpacity(e){this.opacity_=e}setRotateWithView(e){this.rotateWithView_=e}setRotation(e){this.rotation_=e}setScale(e){this.scale_=e,this.scaleArray_=Ku(e)}listenImageChange(e){R()}load(){R()}unlistenImageChange(e){R()}ready(){return Promise.resolve()}},Ju=class e extends qu{constructor(e){super({opacity:1,rotateWithView:e.rotateWithView===void 0?!1:e.rotateWithView,rotation:e.rotation===void 0?0:e.rotation,scale:e.scale===void 0?1:e.scale,displacement:e.displacement===void 0?[0,0]:e.displacement,declutterMode:e.declutterMode}),this.hitDetectionCanvas_=null,this.fill_=e.fill===void 0?null:e.fill,this.origin_=[0,0],this.points_=e.points,this.radius=e.radius,this.radius2_=e.radius2,this.angle_=e.angle===void 0?0:e.angle,this.stroke_=e.stroke===void 0?null:e.stroke,this.size_,this.renderOptions_,this.imageState_=this.fill_&&this.fill_.loading()?U.LOADING:U.LOADED,this.imageState_===U.LOADING&&this.ready().then(()=>this.imageState_=U.LOADED),this.render()}clone(){let t=this.getScale(),n=new e({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 n.setOpacity(this.getOpacity()),n}getAnchor(){let e=this.size_,t=this.getDisplacement(),n=this.getScaleArray();return[e[0]/2-t[0]/n[0],e[1]/2+t[1]/n[1]]}getAngle(){return this.angle_}getFill(){return this.fill_}setFill(e){this.fill_=e,this.render()}getHitDetectionImage(){return this.hitDetectionCanvas_||=this.createHitDetectionCanvas_(this.renderOptions_),this.hitDetectionCanvas_}getImage(e){let t=this.fill_?.getKey(),n=`${e},${this.angle_},${this.radius},${this.radius2_},${this.points_},${t}`+Object.values(this.renderOptions_).join(`,`),r=il.get(n,null)?.getImage(1);if(!r){let t=this.renderOptions_,i=Math.ceil(t.size*e),a=vc(i,i);this.draw_(t,a,e),r=a.canvas;let o=new ol(r,void 0,null,U.LOADED,null);il.set(n,null,o),createImageBitmap(r).then(e=>{o.setImage(e)})}return r}getPixelRatio(e){return e}getImageSize(){return this.size_}getImageState(){return this.imageState_}getOrigin(){return this.origin_}getPoints(){return this.points_}getRadius(){return this.radius}setRadius(e){this.radius!==e&&(this.radius=e,this.render())}getRadius2(){return this.radius2_}setRadius2(e){this.radius2_!==e&&(this.radius2_=e,this.render())}getSize(){return this.size_}getStroke(){return this.stroke_}setStroke(e){this.stroke_=e,this.render()}listenImageChange(e){}load(){}unlistenImageChange(e){}calculateLineJoinSize_(e,t,n){if(t===0||this.points_===1/0||e!==`bevel`&&e!==`miter`)return t;let r=this.radius,i=this.radius2_===void 0?r:this.radius2_;if(r<i){let e=r;r=i,i=e}let a=this.radius2_===void 0?this.points_:this.points_*2,o=2*Math.PI/a,s=i*Math.sin(o),c=Math.sqrt(i*i-s*s),l=r-c,u=Math.sqrt(s*s+l*l),d=u/s;if(e===`miter`&&d<=n)return d*t;let f=t/2/d,p=t/2*(l/u),m=Math.sqrt((r+f)*(r+f)+p*p)-r;if(this.radius2_===void 0||e===`bevel`)return m*2;let h=r*Math.sin(o),g=Math.sqrt(r*r-h*h),_=i-g,v=Math.sqrt(h*h+_*_)/h;if(v<=n){let e=v*t/2-i-r;return 2*Math.max(m,e)}return m*2}createRenderOptions(){let e=wl,t=El,n=0,r=null,i=0,a,o=0;this.stroke_&&(a=cl(this.stroke_.getColor()??`#000`),o=this.stroke_.getWidth()??1,r=this.stroke_.getLineDash(),i=this.stroke_.getLineDashOffset()??0,t=this.stroke_.getLineJoin()??`round`,e=this.stroke_.getLineCap()??`round`,n=this.stroke_.getMiterLimit()??10);let s=this.calculateLineJoinSize_(t,o,n),c=Math.max(this.radius,this.radius2_||0),l=Math.ceil(2*c+s);return{strokeStyle:a,strokeWidth:o,size:l,lineCap:e,lineDash:r,lineDashOffset:i,lineJoin:t,miterLimit:n}}render(){this.renderOptions_=this.createRenderOptions();let e=this.renderOptions_.size;this.hitDetectionCanvas_=null,this.size_=[e,e]}draw_(e,t,n){if(t.scale(n,n),t.translate(e.size/2,e.size/2),this.createPath_(t),this.fill_){let e=this.fill_.getColor();e===null&&(e=Cl),t.fillStyle=cl(e),t.fill()}e.strokeStyle&&(t.strokeStyle=e.strokeStyle,t.lineWidth=e.strokeWidth,e.lineDash&&(t.setLineDash(e.lineDash),t.lineDashOffset=e.lineDashOffset),t.lineCap=e.lineCap,t.lineJoin=e.lineJoin,t.miterLimit=e.miterLimit,t.stroke())}createHitDetectionCanvas_(e){let t;if(this.fill_){let n=this.fill_.getColor(),r=0;typeof n==`string`&&(n=Zc(n)),n===null?r=1:Array.isArray(n)&&(r=n.length===4?n[3]:1),r===0&&(t=vc(e.size,e.size),this.drawHitDetectionCanvas_(e,t))}return t?t.canvas:this.getImage(1)}createPath_(e){let t=this.points_,n=this.radius;if(t===1/0)e.arc(0,0,n,0,2*Math.PI);else{let r=this.radius2_===void 0?n:this.radius2_;this.radius2_!==void 0&&(t*=2);let i=this.angle_-Math.PI/2,a=2*Math.PI/t;for(let o=0;o<t;o++){let t=i+o*a,s=o%2==0?n:r;e.lineTo(s*Math.cos(t),s*Math.sin(t))}e.closePath()}}drawHitDetectionCanvas_(e,t){t.translate(e.size/2,e.size/2),this.createPath_(t),t.fillStyle=Cl,t.fill(),e.strokeStyle&&(t.strokeStyle=e.strokeStyle,t.lineWidth=e.strokeWidth,e.lineDash&&(t.setLineDash(e.lineDash),t.lineDashOffset=e.lineDashOffset),t.lineJoin=e.lineJoin,t.miterLimit=e.miterLimit,t.stroke())}ready(){return this.fill_?this.fill_.ready():Promise.resolve()}},Yu=class e extends Ju{constructor(e){e||={radius:5},super({points:1/0,fill:e.fill,radius:e.radius,stroke:e.stroke,scale:e.scale===void 0?1:e.scale,rotation:e.rotation===void 0?0:e.rotation,rotateWithView:e.rotateWithView===void 0?!1:e.rotateWithView,displacement:e.displacement===void 0?[0,0]:e.displacement,declutterMode:e.declutterMode})}clone(){let t=this.getScale(),n=new e({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 n.setOpacity(this.getOpacity()),n}},Xu=class e{constructor(e){e||={},this.geometry_=null,this.geometryFunction_=ed,e.geometry!==void 0&&this.setGeometry(e.geometry),this.fill_=e.fill===void 0?null:e.fill,this.image_=e.image===void 0?null:e.image,this.renderer_=e.renderer===void 0?null:e.renderer,this.hitDetectionRenderer_=e.hitDetectionRenderer===void 0?null:e.hitDetectionRenderer,this.stroke_=e.stroke===void 0?null:e.stroke,this.text_=e.text===void 0?null:e.text,this.zIndex_=e.zIndex}clone(){let t=this.getGeometry();return t&&typeof t==`object`&&(t=t.clone()),new e({geometry:t??void 0,fill:this.getFill()?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(e){this.renderer_=e}setHitDetectionRenderer(e){this.hitDetectionRenderer_=e}getHitDetectionRenderer(){return this.hitDetectionRenderer_}getGeometry(){return this.geometry_}getGeometryFunction(){return this.geometryFunction_}getFill(){return this.fill_}setFill(e){this.fill_=e}getImage(){return this.image_}setImage(e){this.image_=e}getStroke(){return this.stroke_}setStroke(e){this.stroke_=e}getText(){return this.text_}setText(e){this.text_=e}getZIndex(){return this.zIndex_}setGeometry(e){typeof e==`function`?this.geometryFunction_=e:typeof e==`string`?this.geometryFunction_=function(t){return t.get(e)}:e?e!==void 0&&(this.geometryFunction_=function(){return e}):this.geometryFunction_=ed,this.geometry_=e}setZIndex(e){this.zIndex_=e}};function Zu(e){let t;if(typeof e==`function`)t=e;else{let n;Array.isArray(e)?n=e:(B(typeof e.getZIndex==`function`,"Expected an `Style` or an array of `Style`"),n=[e]),t=function(){return n}}return t}var Qu=null;function $u(e,t){if(!Qu){let e=new Hu({color:`rgba(255,255,255,0.4)`}),t=new Uu({color:`#3399CC`,width:1.25});Qu=[new Xu({image:new Yu({fill:e,stroke:t,radius:5}),fill:e,stroke:t})]}return Qu}function ed(e){return e.getGeometry()}var td=`#333`,nd=class e{constructor(e){e||={},this.font_=e.font,this.rotation_=e.rotation,this.rotateWithView_=e.rotateWithView,this.keepUpright_=e.keepUpright,this.scale_=e.scale,this.scaleArray_=Ku(e.scale===void 0?1:e.scale),this.text_=e.text,this.textAlign_=e.textAlign,this.justify_=e.justify,this.repeat_=e.repeat,this.textBaseline_=e.textBaseline,this.fill_=e.fill===void 0?new Hu({color:td}):e.fill,this.maxAngle_=e.maxAngle===void 0?Math.PI/4:e.maxAngle,this.placement_=e.placement===void 0?`point`:e.placement,this.overflow_=!!e.overflow,this.stroke_=e.stroke===void 0?null:e.stroke,this.offsetX_=e.offsetX===void 0?0:e.offsetX,this.offsetY_=e.offsetY===void 0?0:e.offsetY,this.backgroundFill_=e.backgroundFill?e.backgroundFill:null,this.backgroundStroke_=e.backgroundStroke?e.backgroundStroke:null,this.padding_=e.padding===void 0?null:e.padding,this.declutterMode_=e.declutterMode}clone(){let t=this.getScale();return new e({font:this.getFont(),placement:this.getPlacement(),repeat:this.getRepeat(),maxAngle:this.getMaxAngle(),overflow:this.getOverflow(),rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),keepUpright:this.getKeepUpright(),scale:Array.isArray(t)?t.slice():t,text:this.getText(),textAlign:this.getTextAlign(),justify:this.getJustify(),textBaseline:this.getTextBaseline(),fill:this.getFill()instanceof Hu?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(e){this.overflow_=e}setFont(e){this.font_=e}setMaxAngle(e){this.maxAngle_=e}setOffsetX(e){this.offsetX_=e}setOffsetY(e){this.offsetY_=e}setPlacement(e){this.placement_=e}setRepeat(e){this.repeat_=e}setRotateWithView(e){this.rotateWithView_=e}setKeepUpright(e){this.keepUpright_=e}setFill(e){this.fill_=e}setRotation(e){this.rotation_=e}setScale(e){this.scale_=e,this.scaleArray_=Ku(e===void 0?1:e)}setStroke(e){this.stroke_=e}setText(e){this.text_=e}setTextAlign(e){this.textAlign_=e}setJustify(e){this.justify_=e}setTextBaseline(e){this.textBaseline_=e}setBackgroundFill(e){this.backgroundFill_=e}setBackgroundStroke(e){this.backgroundStroke_=e}setPadding(e){this.padding_=e}},W={ANIMATING:0,INTERACTING:1},G={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},rd=[G.FILL],id=[G.STROKE],ad=[G.BEGIN_PATH],od=[G.CLOSE_PATH],sd=class extends fl{constructor(e,t,n,r){super(),this.tolerance=e,this.maxExtent=t,this.pixelRatio=r,this.maxLineWidth=0,this.resolution=n,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_=null,this.bufferedMaxExtent_=null,this.instructions=[],this.coordinates=[],this.tmpCoordinate_=[],this.hitDetectionInstructions=[],this.state={}}applyPixelRatio(e){let t=this.pixelRatio;return t==1?e:e.map(function(e){return e*t})}appendFlatPointCoordinates(e,t){let n=this.getBufferedMaxExtent(),r=this.tmpCoordinate_,i=this.coordinates,a=i.length;for(let o=0,s=e.length;o<s;o+=t)r[0]=e[o],r[1]=e[o+1],ui(n,r)&&(i[a++]=r[0],i[a++]=r[1]);return a}appendFlatLineCoordinates(e,t,n,r,i,a){let o=this.coordinates,s=o.length,c=this.getBufferedMaxExtent();a&&(t+=r);let l=e[t],u=e[t+1],d=this.tmpCoordinate_,f=!0,p,m,h;for(p=t+r;p<n;p+=r)d[0]=e[p],d[1]=e[p+1],h=pi(c,d),h===m?h===ii.INTERSECTING?(o[s++]=d[0],o[s++]=d[1],f=!1):f=!0:(f&&=(o[s++]=l,o[s++]=u,!1),o[s++]=d[0],o[s++]=d[1]),l=d[0],u=d[1],m=h;return(i&&f||p===t+r)&&(o[s++]=l,o[s++]=u),s}drawCustomCoordinates_(e,t,n,r,i){for(let a=0,o=n.length;a<o;++a){let o=n[a],s=this.appendFlatLineCoordinates(e,t,o,r,!1,!1);i.push(s),t=o}return t}drawCustom(e,t,n,r,i){this.beginGeometry(e,t,i);let a=e.getType(),o=e.getStride(),s=this.coordinates.length,c,l,u,d,f;switch(a){case`MultiPolygon`:c=e.getOrientedFlatCoordinates(),d=[];let t=e.getEndss();f=0;for(let e=0,n=t.length;e<n;++e){let n=[];f=this.drawCustomCoordinates_(c,f,t[e],o,n),d.push(n)}this.instructions.push([G.CUSTOM,s,d,e,n,ks,i]),this.hitDetectionInstructions.push([G.CUSTOM,s,d,e,r||n,ks,i]);break;case`Polygon`:case`MultiLineString`:u=[],c=a==`Polygon`?e.getOrientedFlatCoordinates():e.getFlatCoordinates(),f=this.drawCustomCoordinates_(c,0,e.getEnds(),o,u),this.instructions.push([G.CUSTOM,s,u,e,n,Os,i]),this.hitDetectionInstructions.push([G.CUSTOM,s,u,e,r||n,Os,i]);break;case`LineString`:case`Circle`:c=e.getFlatCoordinates(),l=this.appendFlatLineCoordinates(c,0,c.length,o,!1,!1),this.instructions.push([G.CUSTOM,s,l,e,n,Ds,i]),this.hitDetectionInstructions.push([G.CUSTOM,s,l,e,r||n,Ds,i]);break;case`MultiPoint`:c=e.getFlatCoordinates(),l=this.appendFlatPointCoordinates(c,o),l>s&&(this.instructions.push([G.CUSTOM,s,l,e,n,Ds,i]),this.hitDetectionInstructions.push([G.CUSTOM,s,l,e,r||n,Ds,i]));break;case`Point`:c=e.getFlatCoordinates(),this.coordinates.push(c[0],c[1]),l=this.coordinates.length,this.instructions.push([G.CUSTOM,s,l,e,n,void 0,i]),this.hitDetectionInstructions.push([G.CUSTOM,s,l,e,r||n,void 0,i]);break;default:}this.endGeometry(t)}beginGeometry(e,t,n){this.beginGeometryInstruction1_=[G.BEGIN_GEOMETRY,t,0,e,n],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[G.BEGIN_GEOMETRY,t,0,e,n],this.hitDetectionInstructions.push(this.beginGeometryInstruction2_)}finish(){return{instructions:this.instructions,hitDetectionInstructions:this.hitDetectionInstructions,coordinates:this.coordinates}}reverseHitDetectionInstructions(){let e=this.hitDetectionInstructions;e.reverse();let t,n=e.length,r,i,a=-1;for(t=0;t<n;++t)r=e[t],i=r[0],i==G.END_GEOMETRY?a=t:i==G.BEGIN_GEOMETRY&&(r[2]=t,Pr(this.hitDetectionInstructions,a,t),a=-1)}fillStyleToState(e,t={}){if(e){let n=e.getColor();t.fillPatternScale=n&&typeof n==`object`&&`src`in n?this.pixelRatio:1,t.fillStyle=cl(n||Cl)}else t.fillStyle=void 0;return t}strokeStyleToState(e,t={}){if(e){t.strokeStyle=cl(e.getColor()||Dl);let n=e.getLineCap();t.lineCap=n===void 0?wl:n;let r=e.getLineDash();t.lineDash=r?r.slice():Tl,t.lineDashOffset=e.getLineDashOffset()||0;let i=e.getLineJoin();t.lineJoin=i===void 0?El:i;let a=e.getWidth();t.lineWidth=a===void 0?1:a;let o=e.getMiterLimit();t.miterLimit=o===void 0?10:o,t.strokeOffset=e.getOffset()??0,t.lineWidth>this.maxLineWidth&&(this.maxLineWidth=t.lineWidth,this.bufferedMaxExtent_=null)}else t.strokeStyle=void 0,t.lineCap=void 0,t.lineDash=null,t.lineDashOffset=void 0,t.lineJoin=void 0,t.lineWidth=void 0,t.miterLimit=void 0,t.strokeOffset=void 0;return t}setFillStrokeStyle(e,t){let n=this.state;this.fillStyleToState(e,n),this.strokeStyleToState(t,n)}createFill(e){let t=e.fillStyle,n=[G.SET_FILL_STYLE,t];return typeof t!=`string`&&n.push(e.fillPatternScale),n}applyStroke(e){this.instructions.push(this.createStroke(e))}createStroke(e){return[G.SET_STROKE_STYLE,e.strokeStyle,e.lineWidth*this.pixelRatio,e.lineCap,e.lineJoin,e.miterLimit,e.lineDash?this.applyPixelRatio(e.lineDash):null,e.lineDashOffset*this.pixelRatio]}updateFillStyle(e,t){let n=e.fillStyle;(typeof n!=`string`||e.currentFillStyle!=n)&&(this.instructions.push(t.call(this,e)),e.currentFillStyle=n)}updateStrokeStyle(e,t){let n=e.strokeStyle,r=e.lineCap,i=e.lineDash,a=e.lineDashOffset,o=e.lineJoin,s=e.lineWidth,c=e.miterLimit,l=e.strokeOffset;(e.currentStrokeStyle!=n||e.currentLineCap!=r||i!=e.currentLineDash&&!Ir(e.currentLineDash,i)||e.currentLineDashOffset!=a||e.currentLineJoin!=o||e.currentLineWidth!=s||e.currentMiterLimit!=c||e.currentStrokeOffset!=l)&&(t.call(this,e),e.currentStrokeStyle=n,e.currentLineCap=r,e.currentLineDash=i,e.currentLineDashOffset=a,e.currentLineJoin=o,e.currentLineWidth=s,e.currentMiterLimit=c,e.currentStrokeOffset=l)}endGeometry(e){this.beginGeometryInstruction1_[2]=this.instructions.length,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_[2]=this.hitDetectionInstructions.length,this.beginGeometryInstruction2_=null;let t=[G.END_GEOMETRY,e];this.instructions.push(t),this.hitDetectionInstructions.push(t)}getBufferedMaxExtent(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=ci(this.maxExtent),this.maxLineWidth>0)){let e=this.resolution*(this.maxLineWidth+1)/2;si(this.bufferedMaxExtent_,e,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_}},cd=class extends sd{constructor(e,t,n,r){super(e,t,n,r),this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.anchorX_=void 0,this.anchorY_=void 0,this.height_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.scale_=void 0,this.width_=void 0,this.declutterMode_=void 0,this.declutterImageWithText_=void 0}drawPoint(e,t,n){if(!this.image_||this.maxExtent&&!ui(this.maxExtent,e.getFlatCoordinates()))return;this.beginGeometry(e,t,n);let r=e.getFlatCoordinates(),i=e.getStride(),a=this.coordinates.length,o=this.appendFlatPointCoordinates(r,i);this.instructions.push([G.DRAW_IMAGE,a,o,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_*this.imagePixelRatio_,this.originY_*this.imagePixelRatio_,this.rotateWithView_,this.rotation_,[this.scale_[0]*this.pixelRatio/this.imagePixelRatio_,this.scale_[1]*this.pixelRatio/this.imagePixelRatio_],Math.ceil(this.width_*this.imagePixelRatio_),this.declutterMode_,this.declutterImageWithText_]),this.hitDetectionInstructions.push([G.DRAW_IMAGE,a,o,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,1,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(t)}drawMultiPoint(e,t,n){if(!this.image_)return;this.beginGeometry(e,t,n);let r=e.getFlatCoordinates(),i=[];for(let t=0,n=r.length;t<n;t+=e.getStride())(!this.maxExtent||ui(this.maxExtent,r.slice(t,t+2)))&&i.push(r[t],r[t+1]);let a=this.coordinates.length,o=this.appendFlatPointCoordinates(i,2);this.instructions.push([G.DRAW_IMAGE,a,o,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_*this.imagePixelRatio_,this.originY_*this.imagePixelRatio_,this.rotateWithView_,this.rotation_,[this.scale_[0]*this.pixelRatio/this.imagePixelRatio_,this.scale_[1]*this.pixelRatio/this.imagePixelRatio_],Math.ceil(this.width_*this.imagePixelRatio_),this.declutterMode_,this.declutterImageWithText_]),this.hitDetectionInstructions.push([G.DRAW_IMAGE,a,o,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,1,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(t)}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(e,t){let n=e.getAnchor(),r=e.getSize(),i=e.getOrigin();this.imagePixelRatio_=e.getPixelRatio(this.pixelRatio),this.anchorX_=n[0],this.anchorY_=n[1],this.hitDetectionImage_=e.getHitDetectionImage(),this.image_=e.getImage(this.pixelRatio),this.height_=r[1],this.opacity_=e.getOpacity(),this.originX_=i[0],this.originY_=i[1],this.rotateWithView_=e.getRotateWithView(),this.rotation_=e.getRotation(),this.scale_=e.getScaleArray(),this.width_=r[0],this.declutterMode_=e.getDeclutterMode(),this.declutterImageWithText_=t}},ld=class extends sd{constructor(e,t,n,r){super(e,t,n,r)}drawFlatCoordinates_(e,t,n,r,i){let a=this.coordinates.length,o=this.appendFlatLineCoordinates(e,t,n,r,!1,!1);return this.instructions.push([G.MOVE_TO_LINE_TO,a,o,i*this.pixelRatio]),this.hitDetectionInstructions.push([G.MOVE_TO_LINE_TO,a,o,i]),n}drawLineString(e,t,n){let r=this.state,i=r.strokeStyle,a=r.lineWidth,o=r.strokeOffset;if(i===void 0||a===void 0)return;this.updateStrokeStyle(r,this.applyStroke),this.beginGeometry(e,t,n),this.hitDetectionInstructions.push([G.SET_STROKE_STYLE,r.strokeStyle,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,Tl,0],ad);let s=e.getFlatCoordinates(),c=e.getStride();this.drawFlatCoordinates_(s,0,s.length,c,o),this.hitDetectionInstructions.push(id),this.endGeometry(t)}drawMultiLineString(e,t,n){let r=this.state,i=r.strokeStyle,a=r.lineWidth,o=r.strokeOffset;if(i===void 0||a===void 0)return;this.updateStrokeStyle(r,this.applyStroke),this.beginGeometry(e,t,n),this.hitDetectionInstructions.push([G.SET_STROKE_STYLE,r.strokeStyle,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,Tl,0],ad);let s=e.getEnds(),c=e.getFlatCoordinates(),l=e.getStride(),u=0;for(let e=0,t=s.length;e<t;++e)u=this.drawFlatCoordinates_(c,u,s[e],l,o);this.hitDetectionInstructions.push(id),this.endGeometry(t)}finish(){let e=this.state;return e.lastStroke!=null&&e.lastStroke!=this.coordinates.length&&this.instructions.push(id),this.reverseHitDetectionInstructions(),this.state=null,super.finish()}applyStroke(e){e.lastStroke!=null&&e.lastStroke!=this.coordinates.length&&(this.instructions.push(id),e.lastStroke=this.coordinates.length),e.lastStroke=0,super.applyStroke(e),this.instructions.push(ad)}},ud=class extends sd{constructor(e,t,n,r){super(e,t,n,r)}drawFlatCoordinatess_(e,t,n,r,i){let a=this.state,o=a.fillStyle!==void 0,s=a.strokeStyle!==void 0,c=n.length;this.instructions.push(ad),this.hitDetectionInstructions.push(ad);for(let a=0;a<c;++a){let o=n[a],c=this.coordinates.length,l=this.appendFlatLineCoordinates(e,t,o,r,!0,!s);this.instructions.push([G.MOVE_TO_LINE_TO,c,l,i*this.pixelRatio,!0]),this.hitDetectionInstructions.push([G.MOVE_TO_LINE_TO,c,l,i,!0]),s&&(this.instructions.push(od),this.hitDetectionInstructions.push(od)),t=o}return o&&(this.instructions.push(rd),this.hitDetectionInstructions.push(rd)),s&&(this.instructions.push(id),this.hitDetectionInstructions.push(id)),t}drawCircle(e,t,n){let r=this.state,i=r.fillStyle,a=r.strokeStyle,o=r.strokeOffset;if(i===void 0&&a===void 0||this.handleStrokeOffset_(()=>this.drawCircle(e,t,n)))return;this.setFillStrokeStyles_(),this.beginGeometry(e,t,n),r.fillStyle!==void 0&&this.hitDetectionInstructions.push([G.SET_FILL_STYLE,Cl]),r.strokeStyle!==void 0&&this.hitDetectionInstructions.push([G.SET_STROKE_STYLE,r.strokeStyle,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,Tl,0]);let s=e.getFlatCoordinates(),c=e.getStride(),l=this.coordinates.length;this.appendFlatLineCoordinates(s,0,s.length,c,!1,!1);let u=[G.CIRCLE,l,o];this.instructions.push(ad,u),this.hitDetectionInstructions.push(ad,u),r.fillStyle!==void 0&&(this.instructions.push(rd),this.hitDetectionInstructions.push(rd)),r.strokeStyle!==void 0&&(this.instructions.push(id),this.hitDetectionInstructions.push(id)),this.endGeometry(t)}drawPolygon(e,t,n){let r=this.state,i=r.fillStyle,a=r.strokeStyle,o=r.strokeOffset;if(i===void 0&&a===void 0||this.handleStrokeOffset_(()=>this.drawPolygon(e,t,n)))return;this.setFillStrokeStyles_(),this.beginGeometry(e,t,n),r.fillStyle!==void 0&&this.hitDetectionInstructions.push([G.SET_FILL_STYLE,Cl]),r.strokeStyle!==void 0&&this.hitDetectionInstructions.push([G.SET_STROKE_STYLE,r.strokeStyle,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,Tl,0]);let s=e.getEnds(),c=e.getOrientedFlatCoordinates(),l=e.getStride();this.drawFlatCoordinatess_(c,0,s,l,o),this.endGeometry(t)}drawMultiPolygon(e,t,n){let r=this.state,i=r.fillStyle,a=r.strokeStyle,o=r.strokeOffset;if(i===void 0&&a===void 0||this.handleStrokeOffset_(()=>this.drawMultiPolygon(e,t,n)))return;this.setFillStrokeStyles_(),this.beginGeometry(e,t,n),r.fillStyle!==void 0&&this.hitDetectionInstructions.push([G.SET_FILL_STYLE,Cl]),r.strokeStyle!==void 0&&this.hitDetectionInstructions.push([G.SET_STROKE_STYLE,r.strokeStyle,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,Tl,0]);let s=e.getEndss(),c=e.getOrientedFlatCoordinates(),l=e.getStride(),u=0;for(let e=0,t=s.length;e<t;++e)u=this.drawFlatCoordinatess_(c,u,s[e],l,o);this.endGeometry(t)}finish(){this.reverseHitDetectionInstructions(),this.state=null;let e=this.tolerance;if(e!==0){let t=this.coordinates;for(let n=0,r=t.length;n<r;++n)t[n]=Ms(t[n],e)}return super.finish()}setFillStrokeStyles_(){let e=this.state;this.updateFillStyle(e,this.createFill),this.updateStrokeStyle(e,this.applyStroke)}handleStrokeOffset_(e){let t=this.state,n=t.fillStyle,r=t.strokeStyle,i=t.strokeOffset;return Math.abs(i)>0&&n!==void 0&&r!==void 0?(t.strokeStyle=void 0,t.strokeOffset=0,e(),t.fillStyle=void 0,t.strokeStyle=r,t.strokeOffset=i,e(),t.fillStyle=n,!0):!1}};function dd(e,t,n,r,i){let a=[],o=n,s=0,c=t.slice(n,2);for(;s<e&&o+i<r;){let[n,r]=c.slice(-2),l=t[o+i],u=t[o+i+1],d=Math.sqrt((l-n)*(l-n)+(u-r)*(u-r));if(s+=d,s>=e){let t=(e-s+d)/d,f=Yi(n,l,t),p=Yi(r,u,t);c.push(f,p),a.push(c),c=[f,p],s==e&&(o+=i),s=0}else if(s<e)c.push(t[o+i],t[o+i+1]),o+=i;else{let e=d-s,t=Yi(n,l,e/d),f=Yi(r,u,e/d);c.push(t,f),a.push(c),c=[t,f],s=0,o+=i}}return s>0&&a.push(c),a}function fd(e,t,n,r,i){let a=n,o=n,s=0,c=0,l=n,u,d,f,p,m,h,g,_,v,y;for(d=n;d<r;d+=i){let n=t[d],r=t[d+1];m!==void 0&&(v=n-m,y=r-h,p=Math.sqrt(v*v+y*y),g!==void 0&&(c+=f,u=Math.acos((g*v+_*y)/(f*p)),u>e&&(c>s&&(s=c,a=l,o=d),c=0,l=d-i)),f=p,g=v,_=y),m=n,h=r}return c+=p,c>s?[l,d]:[a,o]}var pd={left:0,center:.5,right:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1},md={Circle:ud,Default:sd,Image:cd,LineString:ld,Polygon:ud,Text:class extends sd{constructor(e,t,n,r){super(e,t,n,r),this.labels_=null,this.text_=``,this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=void 0,this.textKeepUpright_=void 0,this.textRotation_=0,this.textFillState_=null,this.fillStates={},this.fillStates[Cl]={fillStyle:Cl},this.textStrokeState_=null,this.strokeStates={},this.textState_={},this.textStates={},this.textKey_=``,this.fillKey_=``,this.strokeKey_=``,this.declutterMode_=void 0,this.declutterImageWithText_=void 0}finish(){let e=super.finish();return e.textStates=this.textStates,e.fillStates=this.fillStates,e.strokeStates=this.strokeStates,e}drawText(e,t,n){let r=this.textFillState_,i=this.textStrokeState_,a=this.textState_;if(this.text_===``||!a||!r&&!i)return;let o=this.coordinates,s=o.length,c=e.getType(),l=null,u=e.getStride();if(a.placement===`line`&&(c==`LineString`||c==`MultiLineString`||c==`Polygon`||c==`MultiPolygon`)){if(!Ii(this.maxExtent,e.getExtent()))return;let r;if(l=e.getFlatCoordinates(),c==`LineString`)r=[l.length];else if(c==`MultiLineString`)r=e.getEnds();else if(c==`Polygon`)r=e.getEnds().slice(0,1);else if(c==`MultiPolygon`){let t=e.getEndss();r=[];for(let e=0,n=t.length;e<n;++e)r.push(t[e][0])}this.beginGeometry(e,t,n);let i=a.repeat,d=i?void 0:a.textAlign,f=0;for(let e=0,t=r.length;e<t;++e){let t;t=i?dd(i*this.resolution,l,f,r[e],u):[l.slice(f,r[e])];for(let n=0,i=t.length;n<i;++n){let i=t[n],c=0,l=i.length;if(d==null){let e=fd(a.maxAngle,i,0,i.length,2);c=e[0],l=e[1]}for(let e=c;e<l;e+=u)o.push(i[e],i[e+1]);let p=o.length;f=r[e],this.drawChars_(s,p),s=p}}this.endGeometry(t)}else{let r=a.overflow?null:[];switch(c){case`Point`:case`MultiPoint`:l=e.getFlatCoordinates();break;case`LineString`:l=e.getFlatMidpoint();break;case`Circle`:l=e.getCenter();break;case`MultiLineString`:l=e.getFlatMidpoints(),u=2;break;case`Polygon`:l=e.getFlatInteriorPoint(),a.overflow||r.push(l[2]/this.resolution),u=3;break;case`MultiPolygon`:let t=e.getFlatInteriorPoints();l=[];for(let e=0,n=t.length;e<n;e+=3)a.overflow||r.push(t[e+2]/this.resolution),l.push(t[e],t[e+1]);if(l.length===0)return;u=2;break;default:}let i=this.appendFlatPointCoordinates(l,u);if(i===s)return;if(r&&(i-s)/2!==l.length/u){let e=s/2;r=r.filter((t,n)=>{let r=o[(e+n)*2]===l[n*u]&&o[(e+n)*2+1]===l[n*u+1];return r||--e,r})}this.saveTextStates_();let d=a.backgroundFill?this.createFill(this.fillStyleToState(a.backgroundFill)):null,f=a.backgroundStroke?this.createStroke(this.strokeStyleToState(a.backgroundStroke)):null;this.beginGeometry(e,t,n);let p=a.padding;if(p!=Al&&(a.scale[0]<0||a.scale[1]<0)){let e=a.padding[0],t=a.padding[1],n=a.padding[2],r=a.padding[3];a.scale[0]<0&&(t=-t,r=-r),a.scale[1]<0&&(e=-e,n=-n),p=[e,t,n,r]}let m=this.pixelRatio;this.instructions.push([G.DRAW_IMAGE,s,i,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[1,1],NaN,this.declutterMode_,this.declutterImageWithText_,p==Al?Al:p.map(function(e){return e*m}),d,f,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,r]);let h=1/m,g=d?d.slice(0):null;g&&(g[1]=Cl),this.hitDetectionInstructions.push([G.DRAW_IMAGE,s,i,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[h,h],NaN,this.declutterMode_,this.declutterImageWithText_,p,g,f,this.text_,this.textKey_,this.strokeKey_,this.fillKey_?Cl:this.fillKey_,this.textOffsetX_,this.textOffsetY_,r]),this.endGeometry(t)}}saveTextStates_(){let e=this.textStrokeState_,t=this.textState_,n=this.textFillState_,r=this.strokeKey_;e&&(r in this.strokeStates||(this.strokeStates[r]={strokeStyle:e.strokeStyle,lineCap:e.lineCap,lineDashOffset:e.lineDashOffset,lineWidth:e.lineWidth,lineJoin:e.lineJoin,miterLimit:e.miterLimit,lineDash:e.lineDash}));let i=this.textKey_;i in this.textStates||(this.textStates[i]={font:t.font,textAlign:t.textAlign||`center`,justify:t.justify,textBaseline:t.textBaseline||`middle`,scale:t.scale});let a=this.fillKey_;n&&(a in this.fillStates||(this.fillStates[a]={fillStyle:n.fillStyle}))}drawChars_(e,t){let n=this.textStrokeState_,r=this.textState_,i=this.strokeKey_,a=this.textKey_,o=this.fillKey_;this.saveTextStates_();let s=this.pixelRatio,c=pd[r.textBaseline],l=this.textOffsetY_*s,u=this.text_,d=n?n.lineWidth*Math.abs(r.scale[0])/2:0;this.instructions.push([G.DRAW_CHARS,e,t,c,r.overflow,o,r.maxAngle,s,l,i,d*s,u,a,1,this.declutterMode_,this.textKeepUpright_]),this.hitDetectionInstructions.push([G.DRAW_CHARS,e,t,c,r.overflow,o&&Cl,r.maxAngle,s,l,i,d*s,u,a,1/s,this.declutterMode_,this.textKeepUpright_])}setTextStyle(e,t){let n,r,i;if(!e)this.text_=``;else{let t=e.getFill();t?(r=this.textFillState_,r||(r={},this.textFillState_=r),r.fillStyle=cl(t.getColor()||`#000`)):(r=null,this.textFillState_=r);let a=e.getStroke();if(!a)i=null,this.textStrokeState_=i;else{i=this.textStrokeState_,i||(i={},this.textStrokeState_=i);let e=a.getLineDash(),t=a.getLineDashOffset(),n=a.getWidth(),r=a.getMiterLimit();i.lineCap=a.getLineCap()||`round`,i.lineDash=e?e.slice():Tl,i.lineDashOffset=t===void 0?0:t,i.lineJoin=a.getLineJoin()||`round`,i.lineWidth=n===void 0?1:n,i.miterLimit=r===void 0?10:r,i.strokeStyle=cl(a.getColor()||`#000`)}n=this.textState_;let o=e.getFont()||`10px sans-serif`;Ll(o);let s=e.getScaleArray();n.overflow=e.getOverflow(),n.font=o,n.maxAngle=e.getMaxAngle(),n.placement=e.getPlacement(),n.textAlign=e.getTextAlign(),n.repeat=e.getRepeat(),n.justify=e.getJustify(),n.textBaseline=e.getTextBaseline()||`middle`,n.backgroundFill=e.getBackgroundFill(),n.backgroundStroke=e.getBackgroundStroke(),n.padding=e.getPadding()||Al,n.scale=s===void 0?[1,1]:s;let c=e.getOffsetX(),l=e.getOffsetY(),u=e.getRotateWithView(),d=e.getKeepUpright(),f=e.getRotation();this.text_=e.getText()||``,this.textOffsetX_=c===void 0?0:c,this.textOffsetY_=l===void 0?0:l,this.textRotateWithView_=u===void 0?!1:u,this.textKeepUpright_=d===void 0?!0:d,this.textRotation_=f===void 0?0:f,this.strokeKey_=i?(typeof i.strokeStyle==`string`?i.strokeStyle:z(i.strokeStyle))+i.lineCap+i.lineDashOffset+`|`+i.lineWidth+i.lineJoin+i.miterLimit+`[`+i.lineDash.join()+`]`:``,this.textKey_=n.font+n.scale+(n.textAlign||`?`)+(n.repeat||`?`)+(n.justify||`?`)+(n.textBaseline||`?`),this.fillKey_=r&&r.fillStyle?typeof r.fillStyle==`string`?r.fillStyle:`|`+z(r.fillStyle):``}this.declutterMode_=e.getDeclutterMode(),this.declutterImageWithText_=t}}},hd=class{constructor(e,t,n,r){this.tolerance_=e,this.maxExtent_=t,this.pixelRatio_=r,this.resolution_=n,this.buildersByZIndex_={}}finish(){let e={};for(let t in this.buildersByZIndex_){e[t]=e[t]||{};let n=this.buildersByZIndex_[t];for(let r in n){let i=n[r].finish();e[t][r]=i}}return e}getBuilder(e,t){let n=e===void 0?`0`:e.toString(),r=this.buildersByZIndex_[n];r===void 0&&(r={},this.buildersByZIndex_[n]=r);let i=r[t];if(i===void 0){let e=md[t];i=new e(this.tolerance_,this.maxExtent_,this.resolution_,this.pixelRatio_),r[t]=i}return i}};function gd(e,t,n,r,i,a,o,s,c,l,u,d,f=!0){let p=e[t],m=e[t+1],h=0,g=0,_=0,v=0;function y(){h=p,g=m,t+=r,p=e[t],m=e[t+1],v+=_,_=Math.sqrt((p-h)*(p-h)+(m-g)*(m-g))}do y();while(t<n-r&&v+_<a);let b=_===0?0:(a-v)/_,x=Yi(h,p,b),S=Yi(g,m,b),C=t-r,w=v,T=a+s*c(l,i,u);for(;t<n-r&&v+_<T;)y();b=_===0?0:(T-v)/_;let ee=Yi(h,p,b),E=Yi(g,m,b),D=!1;if(f)if(d){let e=[x,S,ee,E];rs(e,0,4,2,d,e,e),D=e[0]>e[2]}else D=x>ee;let O=Math.PI,k=[],te=C+r===t;t=C,_=0,v=w,p=e[t],m=e[t+1];let ne;if(te)return y(),ne=Math.atan2(m-g,p-h),D&&(ne+=ne>0?-O:O),k[0]=[(ee+x)/2,(E+S)/2,(T-a)/2,ne,i],k;i=i.replace(/\n/g,` `);for(let e=0,d=i.length;e<d;){y();let f=Math.atan2(m-g,p-h);if(D&&(f+=f>0?-O:O),ne!==void 0){let e=f-ne;if(e+=e>O?-2*O:e<-O?2*O:0,Math.abs(e)>o)return null}ne=f;let x=e,S=0;for(;e<d;++e){let o=D?d-e-1:e,f=s*c(l,i[o],u);if(t+r<n&&v+_<a+S+f/2)break;S+=f}if(e===x)continue;let C=D?i.substring(d-x,d-e):i.substring(x,e);b=_===0?0:(a+S/2-v)/_;let w=Yi(h,p,b),T=Yi(g,m,b);k.push([w,T,S/2,f,C]),a+=S}return k}var _d=class{constructor(){this.instructions_=[],this.zIndex=0,this.offset_=0,this.context_=new Proxy(bc(),{get:(e,t)=>{if(typeof bc()[t]==`function`)return this.push_(t),this.pushMethodArgs_},set:(e,t,n)=>(this.push_(t,n),!0)})}push_(...e){let t=this.instructions_,n=this.zIndex+this.offset_;t[n]||(t[n]=[]),t[n].push(...e)}pushMethodArgs_=(...e)=>(this.push_(e),this);pushFunction(e){this.push_(e)}getContext(){return this.context_}draw(e){this.instructions_.forEach(t=>{for(let n=0,r=t.length;n<r;++n){let r=t[n];if(typeof r==`function`){r(e);continue}let i=t[++n];if(typeof e[r]==`function`)e[r](...i);else{if(typeof i==`function`){e[r]=i(e);continue}e[r]=i}}})}clear(){this.instructions_.length=0,this.zIndex=0,this.offset_=0}offset(){this.offset_=this.instructions_.length,this.zIndex=0}},vd=mi(),yd=[],bd=[],xd=[],Sd=[];function Cd(e){return e[3].declutterBox}var wd=RegExp(`[֑-ࣿיִ-﷿ﹰ-ﻼࠀ--]`);function Td(e,t){return t===`start`?t=wd.test(e)?`right`:`left`:t===`end`&&(t=wd.test(e)?`left`:`right`),pd[t]}function Ed(e,t,n){return n>0&&e.push(`
|
|
5
|
+
`,``),e.push(t,``),e}function Dd(e,t,n){return n%2==0&&(e+=t),e}var Od=class{constructor(e,t,n,r,i){this.overlaps=n,this.pixelRatio=t,this.resolution=e,this.alignAndScaleFill_,this.instructions=r.instructions,this.coordinates=r.coordinates,this.coordinateCache_={},this.renderedTransform_=Vo(),this.hitDetectionInstructions=r.hitDetectionInstructions,this.pixelCoordinates_=null,this.viewRotation_=0,this.fillStates=r.fillStates||{},this.strokeStates=r.strokeStates||{},this.textStates=r.textStates||{},this.widths_={},this.labels_={},this.zIndexContext_=i?new _d:null}getZIndexContext(){return this.zIndexContext_}createLabel(e,t,n,r){let i=e+t+n+r;if(this.labels_[i])return this.labels_[i];let a=r?this.strokeStates[r]:null,o=n?this.fillStates[n]:null,s=this.textStates[t],c=this.pixelRatio,l=[s.scale[0]*c,s.scale[1]*c],u=s.justify?pd[s.justify]:Td(Array.isArray(e)?e[0]:e,s.textAlign||`center`),d=r&&a.lineWidth?a.lineWidth:0,f=Array.isArray(e)?e:String(e).split(`
|
|
6
|
+
`).reduce(Ed,[]),{width:p,height:m,widths:h,heights:g,lineWidths:_}=Hl(s,f),v=p+d,y=[],b=(v+2)*l[0],x=(m+d)*l[1],S={width:b<0?Math.floor(b):Math.ceil(b),height:x<0?Math.floor(x):Math.ceil(x),contextInstructions:y};(l[0]!=1||l[1]!=1)&&y.push(`scale`,l),r&&(y.push(`strokeStyle`,a.strokeStyle),y.push(`lineWidth`,d),y.push(`lineCap`,a.lineCap),y.push(`lineJoin`,a.lineJoin),y.push(`miterLimit`,a.miterLimit),y.push(`setLineDash`,[a.lineDash]),y.push(`lineDashOffset`,a.lineDashOffset)),n&&y.push(`fillStyle`,o.fillStyle),y.push(`textBaseline`,`middle`),y.push(`textAlign`,`center`);let C=.5-u,w=u*v+C*d,T=[],ee=[],E=0,D=0,O=0,k=0,te;for(let e=0,t=f.length;e<t;e+=2){let t=f[e];if(t===`
|
|
7
|
+
`){D+=E,E=0,w=u*v+C*d,++k;continue}let i=f[e+1]||s.font;i!==te&&(r&&T.push(`font`,i),n&&ee.push(`font`,i),te=i),E=Math.max(E,g[O]);let a=[t,w+C*h[O]+u*(h[O]-_[k]),.5*(d+E)+D];w+=h[O],r&&T.push(`strokeText`,a),n&&ee.push(`fillText`,a),++O}return Array.prototype.push.apply(y,T),Array.prototype.push.apply(y,ee),this.labels_[i]=S,S}replayTextBackground_(e,t,n,r,i,a,o){e.beginPath(),e.moveTo.apply(e,t),e.lineTo.apply(e,n),e.lineTo.apply(e,r),e.lineTo.apply(e,i),e.lineTo.apply(e,t),a&&(this.alignAndScaleFill_=a[2],e.fillStyle=a[1],this.fill_(e)),o&&(this.setStrokeStyle_(e,o),e.stroke())}calculateImageOrLabelDimensions_(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h){o*=d[0],s*=d[1];let g=n-o,_=r-s,v=i+c>e?e-c:i,y=a+l>t?t-l:a,b=p[3]+v*d[0]+p[1],x=p[0]+y*d[1]+p[2],S=g-p[3],C=_-p[0];(m||u!==0)&&(yd[0]=S,Sd[0]=S,yd[1]=C,bd[1]=C,bd[0]=S+b,xd[0]=bd[0],xd[1]=C+x,Sd[1]=xd[1]);let w;return u===0?hi(Math.min(S,S+b),Math.min(C,C+x),Math.max(S,S+b),Math.max(C,C+x),vd):(w=Yo(Vo(),n,r,1,1,u,-n,-r),Ko(w,yd),Ko(w,bd),Ko(w,xd),Ko(w,Sd),hi(Math.min(yd[0],bd[0],xd[0],Sd[0]),Math.min(yd[1],bd[1],xd[1],Sd[1]),Math.max(yd[0],bd[0],xd[0],Sd[0]),Math.max(yd[1],bd[1],xd[1],Sd[1]),vd)),f&&(g=Math.round(g),_=Math.round(_)),{drawImageX:g,drawImageY:_,drawImageW:v,drawImageH:y,originX:c,originY:l,declutterBox:{minX:vd[0],minY:vd[1],maxX:vd[2],maxY:vd[3],value:h},canvasTransform:w,scale:d}}replayImageOrLabel_(e,t,n,r,i,a,o){let s=!!(a||o),c=r.declutterBox,l=o?o[2]*r.scale[0]/2:0;return c.minX-l<=t[0]&&c.maxX+l>=0&&c.minY-l<=t[1]&&c.maxY+l>=0&&(s&&this.replayTextBackground_(e,yd,bd,xd,Sd,a,o),Ul(e,r.canvasTransform,i,n,r.originX,r.originY,r.drawImageW,r.drawImageH,r.drawImageX,r.drawImageY,r.scale)),!0}fill_(e){let t=this.alignAndScaleFill_;if(t){let n=Ko(this.renderedTransform_,[0,0]),r=512*this.pixelRatio;e.save(),e.translate(n[0]%r,n[1]%r),t!==1&&e.scale(t,t)}e.fill(),t&&e.restore()}setStrokeStyle_(e,t){e.strokeStyle=t[1],t[1]&&(e.lineWidth=t[2],e.lineCap=t[3],e.lineJoin=t[4],e.miterLimit=t[5],e.lineDashOffset=t[7],e.setLineDash(t[6]))}drawLabelWithPointPlacement_(e,t,n,r){let i=this.textStates[t],a=this.createLabel(e,t,r,n),o=this.strokeStates[n],s=this.pixelRatio,c=Td(Array.isArray(e)?e[0]:e,i.textAlign||`center`),l=pd[i.textBaseline||`middle`],u=o&&o.lineWidth?o.lineWidth:0;return{label:a,anchorX:c*(a.width/s-2*i.scale[0])+2*(.5-c)*u,anchorY:l*a.height/s+2*(.5-l)*u}}execute_(e,t,n,r,i,a,o,s){let c=this.zIndexContext_,l;this.pixelCoordinates_&&Ir(n,this.renderedTransform_)?l=this.pixelCoordinates_:(this.pixelCoordinates_||=[],l=ns(this.coordinates,0,this.coordinates.length,2,n,this.pixelCoordinates_),Go(this.renderedTransform_,n));let u=0,d=r.length,f=0,p,m,h,g,_,v,y,b,x,S,C,w,T,ee,E,D,O=0,k=0,te=this.coordinateCache_,ne=this.viewRotation_,re=Math.round(Math.atan2(-n[1],n[0])*0xe8d4a51000)/0xe8d4a51000,ie={context:e,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:ne},ae=this.instructions!=r||this.overlaps?0:200,oe,se,ce,le;for(;u<d;){let n=r[u];switch(n[0]){case G.BEGIN_GEOMETRY:oe=n[1],le=n[3],oe.getGeometry()?o!==void 0&&!Ii(o,le.getExtent())?u=n[2]+1:++u:u=n[2],c&&(c.zIndex=n[4]);break;case G.BEGIN_PATH:O>ae&&(this.fill_(e),O=0),k>ae&&(e.stroke(),k=0),!O&&!k&&(e.beginPath(),b=NaN,x=NaN),++u;break;case G.CIRCLE:f=n[1],g=n[2]??0;let r=l[f],d=l[f+1],ue=l[f+2]-g,de=l[f+3]-g,fe=ue-r,pe=de-d,me=Math.sqrt(fe*fe+pe*pe);e.moveTo(r+me,d),e.arc(r,d,me,0,2*Math.PI,!0),++u;break;case G.CLOSE_PATH:e.closePath(),++u;break;case G.CUSTOM:f=n[1],p=n[2];let he=n[3],ge=n[4],_e=n[5];ie.geometry=he,ie.feature=oe,u in te||(te[u]=[]);let A=te[u];_e?_e(l,f,p,2,A):(A[0]=l[f],A[1]=l[f+1],A.length=2),c&&(c.zIndex=n[6]),ge(A,ie),++u;break;case G.DRAW_IMAGE:f=n[1],p=n[2],w=n[3],m=n[4],h=n[5];let ve=n[6],ye=n[7],be=n[8],xe=n[9],Se=n[10],Ce=n[11],we=n[12],Te=n[13];y=n[14]||`declutter`;let Ee=n[15];if(!w&&n.length>=20){T=n[19],ee=n[20],E=n[21],D=n[22];let e=this.drawLabelWithPointPlacement_(T,ee,E,D);w=e.label,n[3]=w;let t=n[23];m=(e.anchorX-t)*this.pixelRatio,n[4]=m;let r=n[24];h=(e.anchorY-r)*this.pixelRatio,n[5]=h,ve=w.height,n[6]=ve,Te=w.width,n[13]=Te}let De;n.length>25&&(De=n[25]);let Oe,ke,Ae;n.length>17?(Oe=n[16],ke=n[17],Ae=n[18]):(Oe=Al,ke=null,Ae=null),Se&&re?Ce+=ne:!Se&&!re&&(Ce-=ne);let je=0;for(;f<p;f+=2){if(De&&De[je++]<Te/this.pixelRatio)continue;let n=this.calculateImageOrLabelDimensions_(w.width,w.height,l[f],l[f+1],Te,ve,m,h,be,xe,Ce,we,i,Oe,!!ke||!!Ae,oe),r=[e,t,w,n,ye,ke,Ae];if(s){let e,t,i;if(Ee){let n=p-f;if(!Ee[n]){Ee[n]={args:r,declutterMode:y};continue}let a=Ee[n];e=a.args,t=a.declutterMode,delete Ee[n],i=Cd(e)}let a,o;if(e&&(t!==`declutter`||!s.collides(i))&&(a=!0),(y!==`declutter`||!s.collides(n.declutterBox))&&(o=!0),t===`declutter`&&y===`declutter`){let e=a&&o;a=e,o=e}a&&(t!==`none`&&s.insert(i),this.replayImageOrLabel_.apply(this,e)),o&&(y!==`none`&&s.insert(n.declutterBox),this.replayImageOrLabel_.apply(this,r))}else this.replayImageOrLabel_.apply(this,r)}++u;break;case G.DRAW_CHARS:let Me=n[1],Ne=n[2],Pe=n[3],Fe=n[4];D=n[5];let Ie=n[6],Le=n[7],Re=n[8];E=n[9];let ze=n[10];T=n[11],Array.isArray(T)&&(T=T.reduce(Dd,``)),ee=n[12];let Be=[n[13],n[13]];y=n[14]||`declutter`;let Ve=n[15],He=this.textStates[ee],Ue=He.font,We=[He.scale[0]*Le,He.scale[1]*Le],Ge;Ue in this.widths_?Ge=this.widths_[Ue]:(Ge={},this.widths_[Ue]=Ge);let Ke=cc(l,Me,Ne,2),qe=Math.abs(We[0])*Vl(Ue,T,Ge);if(Fe||qe<=Ke){let n=this.textStates[ee].textAlign,r=(Ke-qe)*Td(T,n),i=gd(l,Me,Ne,2,T,r,Ie,Math.abs(We[0]),Vl,Ue,Ge,re?0:this.viewRotation_,Ve);drawChars:if(i){let n=[],r,a,o,c,l;if(E)for(r=0,a=i.length;r<a;++r){l=i[r],o=l[4],c=this.createLabel(o,ee,``,E),m=l[2]+(We[0]<0?-ze:ze),h=Pe*c.height+(.5-Pe)*2*ze*We[1]/We[0]-Re;let a=this.calculateImageOrLabelDimensions_(c.width,c.height,l[0],l[1],c.width,c.height,m,h,0,0,l[3],Be,!1,Al,!1,oe);if(s&&y===`declutter`&&s.collides(a.declutterBox))break drawChars;n.push([e,t,c,a,1,null,null])}if(D)for(r=0,a=i.length;r<a;++r){l=i[r],o=l[4],c=this.createLabel(o,ee,D,``),m=l[2],h=Pe*c.height-Re;let a=this.calculateImageOrLabelDimensions_(c.width,c.height,l[0],l[1],c.width,c.height,m,h,0,0,l[3],Be,!1,Al,!1,oe);if(s&&y===`declutter`&&s.collides(a.declutterBox))break drawChars;n.push([e,t,c,a,1,null,null])}s&&y!==`none`&&s.load(n.map(Cd));for(let e=0,t=n.length;e<t;++e)this.replayImageOrLabel_.apply(this,n[e])}}++u;break;case G.END_GEOMETRY:if(a!==void 0){oe=n[1];let e=a(oe,le,y);if(e)return e}++u;break;case G.FILL:ae?O++:this.fill_(e),++u;break;case G.MOVE_TO_LINE_TO:for(f=n[1],p=n[2],g=n[3],_=n[4]??!1,se=l[f],ce=l[f+1],g&&(v=f,[se,ce]=dl(se,ce,_?l[p-4]:void 0,_?l[p-3]:void 0,l[f+2],l[f+3],g)),e.moveTo(se,ce),b=se+.5|0,x=ce+.5|0,f+=2;f<p;f+=2)se=l[f],ce=l[f+1],S=se+.5|0,C=ce+.5|0,(f==p-2||S!==b||C!==x)&&(g&&(f==p-2?[se,ce]=dl(se,ce,l[f-2],l[f-1],_?l[v+2]:void 0,_?l[v+3]:void 0,g):[se,ce]=dl(se,ce,l[f-2],l[f-1],l[f+2],l[f+3],g)),e.lineTo(se,ce),b=S,x=C);++u;break;case G.SET_FILL_STYLE:this.alignAndScaleFill_=n[2],O&&(this.fill_(e),O=0,k&&=(e.stroke(),0)),e.fillStyle=n[1],++u;break;case G.SET_STROKE_STYLE:k&&=(e.stroke(),0),this.setStrokeStyle_(e,n),++u;break;case G.STROKE:ae?k++:e.stroke(),++u;break;default:++u;break}}O&&this.fill_(e),k&&e.stroke()}execute(e,t,n,r,i,a){this.viewRotation_=r,this.execute_(e,t,n,this.instructions,i,void 0,void 0,a)}executeHitDetection(e,t,n,r,i){return this.viewRotation_=n,this.execute_(e,[e.canvas.width,e.canvas.height],t,this.hitDetectionInstructions,!0,r,i)}},kd=[`Polygon`,`Circle`,`LineString`,`Image`,`Text`,`Default`],Ad=[`Image`,`Text`],jd=kd.filter(e=>!Ad.includes(e)),Md=!1,Nd=!1;function Pd(){let e=0,t=t=>{let n=vc(1,1,null,{willReadFrequently:t}),r=0,i=performance.now();for(;performance.now()-i<50;++r)n.fillStyle=`rgba(255,0,${r%256},1)`,n.fillRect(0,0,1,1),n.getImageData(0,0,1,1);return e=r>e?r:e,r};Md={[t(!0)]:!0,[t(!1)]:!1,[t(void 0)]:void 0}[e],Nd=!0}var Fd=class{constructor(e,t,n,r,i,a,o){this.maxExtent_=e,this.overlaps_=r,this.pixelRatio_=n,this.resolution_=t,this.renderBuffer_=a,this.executorsByZIndex_={},this.hitDetectionContext_=null,this.hitDetectionTransform_=Vo(),this.renderedContext_=null,this.deferredZIndexContexts_={},this.createExecutors_(i,o)}clip(e,t){let n=this.getClipCoords(t);e.beginPath(),e.moveTo(n[0],n[1]),e.lineTo(n[2],n[3]),e.lineTo(n[4],n[5]),e.lineTo(n[6],n[7]),e.clip()}createExecutors_(e,t){for(let n in e){let r=this.executorsByZIndex_[n];r===void 0&&(r={},this.executorsByZIndex_[n]=r);let i=e[n];for(let e in i){let n=i[e];r[e]=new Od(this.resolution_,this.pixelRatio_,this.overlaps_,n,t)}}}hasExecutors(e){for(let t in this.executorsByZIndex_){let n=this.executorsByZIndex_[t];for(let t=0,r=e.length;t<r;++t)if(e[t]in n)return!0}return!1}forEachFeatureAtCoordinate(e,t,n,r,i,a){Nd===!1&&Pd(),r=Math.round(r);let o=r*2+1,s=Yo(this.hitDetectionTransform_,r+.5,r+.5,1/t,-1/t,-n,-e[0],-e[1]),c=!this.hitDetectionContext_;c&&(this.hitDetectionContext_=vc(o,o,null,{willReadFrequently:Md}));let l=this.hitDetectionContext_;l.canvas.width!==o||l.canvas.height!==o?(l.canvas.width=o,l.canvas.height=o):c||l.clearRect(0,0,o,o);let u;this.renderBuffer_!==void 0&&(u=mi(),xi(u,e),si(u,t*(this.renderBuffer_+r),u));let d=Ld(r),f;function p(e,t,n){let s=l.getImageData(0,0,o,o).data;for(let c=0,u=d.length;c<u;c++)if(s[d[c]]>0){if(!a||n===`none`||f!==`Image`&&f!==`Text`||a.includes(e)){let n=(d[c]-3)/4,a=r-n%o,s=r-(n/o|0),l=i(e,t,a*a+s*s);if(l)return l}l.clearRect(0,0,o,o);break}}let m=Object.keys(this.executorsByZIndex_).map(Number);m.sort(jr);let h,g,_,v,y;for(h=m.length-1;h>=0;--h){let e=m[h].toString();for(_=this.executorsByZIndex_[e],g=kd.length-1;g>=0;--g)if(f=kd[g],v=_[f],v!==void 0&&(y=v.executeHitDetection(l,s,n,p,u),y))return y}}getClipCoords(e){let t=this.maxExtent_;if(!t)return null;let n=t[0],r=t[1],i=t[2],a=t[3],o=[n,r,n,a,i,a,i,r];return ns(o,0,8,2,e,o),o}isEmpty(){return Wr(this.executorsByZIndex_)}execute(e,t,n,r,i,a,o){let s=Object.keys(this.executorsByZIndex_).map(Number);s.sort(o?Mr:jr),a||=kd;let c=kd.length;for(let l=0,u=s.length;l<u;++l){let u=s[l].toString(),d=this.executorsByZIndex_[u];for(let u=0,f=a.length;u<f;++u){let f=a[u],p=d[f];if(p!==void 0){let a=o===null?void 0:p.getZIndexContext(),u=a?a.getContext():e,d=this.maxExtent_&&f!==`Image`&&f!==`Text`;if(d&&(u.save(),this.clip(u,n)),!a||f===`Text`||f===`Image`?p.execute(u,t,n,r,i,o):a.pushFunction(e=>p.execute(e,t,n,r,i,o)),d&&u.restore(),a){a.offset();let e=s[l]*c+kd.indexOf(f);this.deferredZIndexContexts_[e]||(this.deferredZIndexContexts_[e]=[]),this.deferredZIndexContexts_[e].push(a)}}}}this.renderedContext_=e}getDeferredZIndexContexts(){return this.deferredZIndexContexts_}getRenderedContext(){return this.renderedContext_}renderDeferred(){let e=this.deferredZIndexContexts_,t=Object.keys(e).map(Number).sort(jr);for(let n=0,r=t.length;n<r;++n)e[t[n]].forEach(e=>{e.draw(this.renderedContext_),e.clear()}),e[t[n]].length=0}},Id={};function Ld(e){if(Id[e]!==void 0)return Id[e];let t=e*2+1,n=e*e,r=Array(n+1);for(let i=0;i<=e;++i)for(let a=0;a<=e;++a){let o=i*i+a*a;if(o>n)break;let s=r[o];s||(s=[],r[o]=s),s.push(((e+i)*t+(e+a))*4+3),i>0&&s.push(((e-i)*t+(e+a))*4+3),a>0&&(s.push(((e+i)*t+(e-a))*4+3),i>0&&s.push(((e-i)*t+(e-a))*4+3))}let i=[];for(let e=0,t=r.length;e<t;++e)r[e]&&i.push(...r[e]);return Id[e]=i,i}function Rd(e,t,n,r){return n!==void 0&&r!==void 0?[n/e,r/t]:n===void 0?r===void 0?1:r/t:n/e}var zd=class e extends qu{constructor(e){e||={};let t=e.opacity===void 0?1:e.opacity,n=e.rotation===void 0?0:e.rotation,r=e.scale===void 0?1:e.scale,i=e.rotateWithView===void 0?!1:e.rotateWithView;super({opacity:t,rotation:n,scale:r,displacement:e.displacement===void 0?[0,0]:e.displacement,rotateWithView:i,declutterMode:e.declutterMode}),this.anchor_=e.anchor===void 0?[.5,.5]:e.anchor,this.normalizedAnchor_=null,this.anchorOrigin_=e.anchorOrigin===void 0?`top-left`:e.anchorOrigin,this.anchorXUnits_=e.anchorXUnits===void 0?`fraction`:e.anchorXUnits,this.anchorYUnits_=e.anchorYUnits===void 0?`fraction`:e.anchorYUnits,this.crossOrigin_=e.crossOrigin===void 0?null:e.crossOrigin,this.referrerPolicy_=e.referrerPolicy;let a=e.img===void 0?null:e.img,o=e.src;B(!(o!==void 0&&a),"`image` and `src` cannot be provided at the same time"),(o===void 0||o.length===0)&&a&&(o=a.src||z(a)),B(o!==void 0&&o.length>0,"A defined and non-empty `src` or `image` must be provided"),B(!((e.width!==void 0||e.height!==void 0)&&e.scale!==void 0),"`width` or `height` cannot be provided together with `scale`");let s;if(e.src===void 0?a!==void 0&&(s=`complete`in a?a.complete?a.src?U.LOADED:U.IDLE:U.LOADING:U.LOADED):s=U.IDLE,this.color_=e.color===void 0?null:Zc(e.color),this.iconImage_=sl(a,o,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},s,this.color_),this.offset_=e.offset===void 0?[0,0]:e.offset,this.offsetOrigin_=e.offsetOrigin===void 0?`top-left`:e.offsetOrigin,this.origin_=null,this.size_=e.size===void 0?null:e.size,this.initialOptions_,e.width!==void 0||e.height!==void 0){let t,n;if(e.size)[t,n]=e.size;else{let r=this.getImage(1);if(r.width&&r.height)t=r.width,n=r.height;else if(r instanceof HTMLImageElement){this.initialOptions_=e;let t=()=>{if(this.unlistenImageChange(t),!this.initialOptions_)return;let n=this.iconImage_.getSize();this.setScale(Rd(n[0],n[1],e.width,e.height))};this.listenImageChange(t);return}}t!==void 0&&this.setScale(Rd(t,n,e.width,e.height))}}clone(){let t,n,r;return this.initialOptions_?(n=this.initialOptions_.width,r=this.initialOptions_.height):(t=this.getScale(),t=Array.isArray(t)?t.slice():t),new e({anchor:this.anchor_.slice(),anchorOrigin:this.anchorOrigin_,anchorXUnits:this.anchorXUnits_,anchorYUnits:this.anchorYUnits_,color:this.color_&&this.color_.slice?this.color_.slice():this.color_||void 0,crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_,offset:this.offset_.slice(),offsetOrigin:this.offsetOrigin_,opacity:this.getOpacity(),rotateWithView:this.getRotateWithView(),rotation:this.getRotation(),scale:t,width:n,height:r,size:this.size_===null?void 0:this.size_.slice(),src:this.getSrc(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()})}getAnchor(){let e=this.normalizedAnchor_;if(!e){e=this.anchor_;let t=this.getSize();if(this.anchorXUnits_==`fraction`||this.anchorYUnits_==`fraction`){if(!t)return null;e=this.anchor_.slice(),this.anchorXUnits_==`fraction`&&(e[0]*=t[0]),this.anchorYUnits_==`fraction`&&(e[1]*=t[1])}if(this.anchorOrigin_!=`top-left`){if(!t)return null;e===this.anchor_&&(e=this.anchor_.slice()),(this.anchorOrigin_==`top-right`||this.anchorOrigin_==`bottom-right`)&&(e[0]=-e[0]+t[0]),(this.anchorOrigin_==`bottom-left`||this.anchorOrigin_==`bottom-right`)&&(e[1]=-e[1]+t[1])}this.normalizedAnchor_=e}let t=this.getDisplacement(),n=this.getScaleArray();return[e[0]-t[0]/n[0],e[1]+t[1]/n[1]]}setAnchor(e){this.anchor_=e,this.normalizedAnchor_=null}getColor(){return this.color_}setColor(e){let t=e?Zc(e):null;if(this.color_===t||this.color_&&t&&this.color_.length===t.length&&this.color_.every((e,n)=>e===t[n]))return;this.color_=t;let n=this.getSrc(),r=n===void 0?this.getHitDetectionImage():null,i=n===void 0?this.iconImage_.getImageState():U.IDLE;this.iconImage_=sl(r,n,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},i,this.color_)}getImage(e){return this.iconImage_.getImage(e)}getPixelRatio(e){return this.iconImage_.getPixelRatio(e)}getImageSize(){return this.iconImage_.getSize()}getImageState(){return this.iconImage_.getImageState()}getHitDetectionImage(){return this.iconImage_.getHitDetectionImage()}getOrigin(){if(this.origin_)return this.origin_;let e=this.offset_;if(this.offsetOrigin_!=`top-left`){let t=this.getSize(),n=this.iconImage_.getSize();if(!t||!n)return null;e=e.slice(),(this.offsetOrigin_==`top-right`||this.offsetOrigin_==`bottom-right`)&&(e[0]=n[0]-t[0]-e[0]),(this.offsetOrigin_==`bottom-left`||this.offsetOrigin_==`bottom-right`)&&(e[1]=n[1]-t[1]-e[1])}return this.origin_=e,this.origin_}getSrc(){return this.iconImage_.getSrc()}setSrc(e){this.iconImage_=sl(null,e,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},U.IDLE,this.color_)}getSize(){return this.size_?this.size_:this.iconImage_.getSize()}getWidth(){let e=this.getScaleArray();if(this.size_)return this.size_[0]*e[0];if(this.iconImage_.getImageState()==U.LOADED)return this.iconImage_.getSize()[0]*e[0]}getHeight(){let e=this.getScaleArray();if(this.size_)return this.size_[1]*e[1];if(this.iconImage_.getImageState()==U.LOADED)return this.iconImage_.getSize()[1]*e[1]}setScale(e){delete this.initialOptions_,super.setScale(e)}listenImageChange(e){this.iconImage_.addEventListener(F.CHANGE,e)}load(){this.iconImage_.load()}unlistenImageChange(e){this.iconImage_.removeEventListener(F.CHANGE,e)}ready(){return this.iconImage_.ready()}},Bd=.5;function Vd(e,t,n,r,i,a,o,s,c){let l=c?Io(i,c):i,u=vc(e[0]*Bd,e[1]*Bd);u.imageSmoothingEnabled=!1;let d=u.canvas,f=new Gl(u,Bd,i,null,o,s,c?Do(No(),c):null),p=n.length,m=Math.floor((256*256*256-1)/p),h={};for(let e=1;e<=p;++e){let t=n[e-1],i=t.getStyleFunction()||r;if(!i)continue;let o=i(t,a);if(!o)continue;Array.isArray(o)||(o=[o]);let s=(e*m).toString(16).padStart(7,`#00000`);for(let e=0,n=o.length;e<n;++e){let n=o[e],r=n.getGeometryFunction()(t);if(!r||!Ii(l,r.getExtent()))continue;let i=n.clone(),a=i.getFill();a&&a.setColor(s);let c=i.getStroke();c&&(c.setColor(s),c.setLineDash(null)),i.setText(void 0);let u=n.getImage();if(u){let e=u.getImageSize();if(!e)continue;let t=vc(e[0],e[1],void 0,{alpha:!1}),n=t.canvas;t.fillStyle=s,t.fillRect(0,0,n.width,n.height),i.setImage(new zd({img:n,anchor:u.getAnchor(),anchorXUnits:`pixels`,anchorYUnits:`pixels`,offset:u.getOrigin(),opacity:1,size:u.getSize(),scale:u.getScale(),rotation:u.getRotation(),rotateWithView:u.getRotateWithView()}))}let d=i.getZIndex()||0,f=h[d];f||(f={},h[d]=f,f.Polygon=[],f.Circle=[],f.LineString=[],f.Point=[]);let p=r.getType();if(p===`GeometryCollection`){let e=r.getGeometriesArrayRecursive();for(let t=0,n=e.length;t<n;++t){let n=e[t];f[n.getType().replace(`Multi`,``)].push(n,i)}}else f[p.replace(`Multi`,``)].push(r,i)}}let g=Object.keys(h).map(Number).sort(jr);for(let e=0,n=g.length;e<n;++e){let n=h[g[e]];for(let e in n){let r=n[e];for(let e=0,n=r.length;e<n;e+=2){f.setStyle(r[e+1]);for(let n=0,i=t.length;n<i;++n)f.setTransform(t[n]),f.drawGeometry(r[e])}}}return u.getImageData(0,0,d.width,d.height)}function Hd(e,t,n){let r=[];if(n){let i=Math.floor(Math.round(e[0])*Bd),a=Math.floor(Math.round(e[1])*Bd),o=(H(i,0,n.width-1)+H(a,0,n.height-1)*n.width)*4,s=n.data[o],c=n.data[o+1],l=n.data[o+2]+256*(c+256*s),u=Math.floor((256*256*256-1)/t.length);l&&l%u===0&&r.push(t[l/u-1])}return r}var Ud=class extends Gr{constructor(e,t,n,r){super(e),this.inversePixelTransform=t,this.frameState=n,this.context=r}},Wd=5,Gd=class extends Jr{constructor(e){super(),this.ready=!0,this.boundHandleImageChange_=this.handleImageChange_.bind(this),this.layer_=e,this.staleKeys_=[],this.maxStaleKeys=Wd}getStaleKeys(){return this.staleKeys_}prependStaleKey(e){this.staleKeys_.unshift(e),this.staleKeys_.length>this.maxStaleKeys&&(this.staleKeys_.length=this.maxStaleKeys)}getFeatures(e){return R()}getData(e){return null}prepareFrame(e){return R()}renderFrame(e,t){return R()}forEachFeatureAtCoordinate(e,t,n,r,i){}getLayer(){return this.layer_}handleFontsChanged(){}handleImageChange_(e){let t=e.target;(t.getState()===U.LOADED||t.getState()===U.ERROR)&&this.renderIfReadyAndVisible()}loadImage(e){let t=e.getState();return t!=U.LOADED&&t!=U.ERROR&&e.addEventListener(F.CHANGE,this.boundHandleImageChange_),t==U.IDLE&&(e.load(),t=e.getState()),t==U.LOADED}renderIfReadyAndVisible(){let e=this.getLayer();e&&e.getVisible()&&e.getSourceState()===`ready`&&e.changed()}renderDeferred(e){}disposeInternal(){delete this.layer_,super.disposeInternal()}},Kd=[],qd=null;function Jd(){qd=vc(1,1,void 0,{willReadFrequently:!0})}var Yd=class extends Gd{constructor(e){super(e),this.container=null,this.renderedResolution,this.tempTransform=Vo(),this.pixelTransform=Vo(),this.inversePixelTransform=Vo(),this.context=null,this.deferredContext_=null,this.containerReused=!1,this.frameState=null}getImageData(e,t,n){qd||Jd(),qd.clearRect(0,0,1,1);let r;try{qd.drawImage(e,t,n,1,1,0,0,1,1),r=qd.getImageData(0,0,1,1).data}catch{return qd=null,null}return r}getBackground(e){let t=this.getLayer().getBackground();return typeof t==`function`&&(t=t(e.viewState.resolution)),t||void 0}useContainer(e,t,n){let r=this.getLayer().getClassName(),i,a;if(e&&e.className===r&&(!n||e&&e.style.backgroundColor&&Ir(Zc(e.style.backgroundColor),Zc(n)))){let t=e.firstElementChild;Oc(t)&&(a=t.getContext(`2d`))}if(a&&ts(a.canvas.style.transform,t)?(this.container=e,this.context=a,this.containerReused=!0):this.containerReused?(this.container=null,this.context=null,this.containerReused=!1):this.container&&(this.container.style.backgroundColor=null),!this.container){i=hc?Dc():document.createElement(`div`),i.className=r;let e=i.style;e.position=`absolute`,e.width=`100%`,e.height=`100%`,a=vc();let t=a.canvas;i.appendChild(t),e=t.style,e.position=`absolute`,e.left=`0`,e.transformOrigin=`top left`,this.container=i,this.context=a}!this.containerReused&&n&&!this.container.style.backgroundColor&&(this.container.style.backgroundColor=n)}clipUnrotated(e,t,n){let r=Pi(n),i=Fi(n),a=Di(n),o=Ei(n);Ko(t.coordinateToPixelTransform,r),Ko(t.coordinateToPixelTransform,i),Ko(t.coordinateToPixelTransform,a),Ko(t.coordinateToPixelTransform,o);let s=this.inversePixelTransform;Ko(s,r),Ko(s,i),Ko(s,a),Ko(s,o),e.save(),e.beginPath(),e.moveTo(Math.round(r[0]),Math.round(r[1])),e.lineTo(Math.round(i[0]),Math.round(i[1])),e.lineTo(Math.round(a[0]),Math.round(a[1])),e.lineTo(Math.round(o[0]),Math.round(o[1])),e.clip()}prepareContainer(e,t){let n=e.extent,r=e.viewState.resolution,i=e.viewState.rotation,a=e.pixelRatio,o=Math.round(V(n)/r*a),s=Math.round(Mi(n)/r*a);Yo(this.pixelTransform,e.size[0]/2,e.size[1]/2,1/a,1/a,i,-o/2,-s/2),Xo(this.inversePixelTransform,this.pixelTransform);let c=$o(this.pixelTransform);if(this.useContainer(t,c,this.getBackground(e)),!this.containerReused){let e=this.context.canvas;e.width!=o||e.height!=s?(e.width=o,e.height=s):this.context.clearRect(0,0,o,s),c!==e.style.transform&&(e.style.transform=c)}}dispatchRenderEvent_(e,t,n){let r=this.getLayer();if(r.hasListener(e)){let i=new Ud(e,this.inversePixelTransform,n,t);r.dispatchEvent(i)}}preRender(e,t){this.frameState=t,!t.declutter&&this.dispatchRenderEvent_(uc.PRERENDER,e,t)}postRender(e,t){t.declutter||this.dispatchRenderEvent_(uc.POSTRENDER,e,t)}renderDeferredInternal(e){}getRenderContext(e){return e.declutter&&!this.deferredContext_&&(this.deferredContext_=new _d),e.declutter?this.deferredContext_.getContext():this.context}renderDeferred(e){e.declutter&&(this.dispatchRenderEvent_(uc.PRERENDER,this.context,e),e.declutter&&this.deferredContext_&&(this.deferredContext_.draw(this.context),this.deferredContext_.clear()),this.renderDeferredInternal(e),this.dispatchRenderEvent_(uc.POSTRENDER,this.context,e))}getRenderTransform(e,t,n,r,i,a,o){let s=i/2,c=a/2,l=r/t,u=-l,d=-e[0]+o,f=-e[1];return Yo(this.tempTransform,s,c,l,u,-n,d,f)}disposeInternal(){delete this.frameState,super.disposeInternal()}},Xd=class extends Yd{constructor(e){super(e),this.boundHandleStyleImageChange_=this.handleStyleImageChange_.bind(this),this.animatingOrInteracting_,this.hitDetectionImageData_=null,this.clipExtent_=null,this.extendX_=!1,this.renderedFeatures_=null,this.renderedRevision_=-1,this.renderedResolution_=NaN,this.renderedExtent_=mi(),this.wrappedRenderedExtent_=mi(),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(e,t,n){let r=t.extent,i=t.viewState,a=i.center,o=i.resolution,s=i.projection,c=i.rotation,l=s.getExtent(),u=this.getLayer().getSource(),d=this.getLayer().getDeclutter(),f=t.pixelRatio,p=t.viewHints,m=!(p[W.ANIMATING]||p[W.INTERACTING]),h=this.context,g=Math.round(V(r)/o*f),_=Math.round(Mi(r)/o*f),v=u.getWrapX()&&s.canWrapX(),y=v?V(l):null,b=v?Math.ceil((r[2]-l[2])/y)+(this.extendX_?2:1):1,x=v?Math.floor((r[0]-l[0])/y)-(this.extendX_?1:0):0;do{let r=this.getRenderTransform(a,o,0,f,g,_,x*y);t.declutter&&(r=r.slice(0)),e.execute(h,[h.canvas.width,h.canvas.height],r,c,m,n===void 0?kd:n?Ad:jd,n?d&&t.declutter[d]:void 0)}while(++x<b)}setDrawContext_(){this.opacity_!==1&&(this.targetContext_=this.context,this.context=vc(this.context.canvas.width,this.context.canvas.height,Kd))}resetDrawContext_(){if(this.opacity_!==1&&this.targetContext_){let e=this.targetContext_.globalAlpha;this.targetContext_.globalAlpha=this.opacity_,this.targetContext_.drawImage(this.context.canvas,0,0),this.targetContext_.globalAlpha=e,xc(this.context),Kd.push(this.context.canvas),this.context=this.targetContext_,this.targetContext_=null}}renderDeclutter(e){!this.replayGroup_||!this.getLayer().getDeclutter()||this.renderWorlds(this.replayGroup_,e,!0)}renderDeferredInternal(e){this.replayGroup_&&(this.clipExtent_&&this.clipUnrotated(this.context,e,this.clipExtent_),this.replayGroup_.renderDeferred(),this.clipExtent_&&=(this.context.restore(),null),this.resetDrawContext_())}renderFrame(e,t){let n=e.layerStatesArray[e.layerIndex];this.opacity_=n.opacity;let r=e.viewState;this.prepareContainer(e,t);let i=this.context,a=this.replayGroup_,o=a&&!a.isEmpty();if(!o&&!(this.getLayer().hasListener(uc.PRERENDER)||this.getLayer().hasListener(uc.POSTRENDER)))return this.container;this.setDrawContext_(),this.preRender(i,e);let s=r.projection;this.clipExtent_=null;let c=!1;if(o&&n.extent&&this.clipping){let t=Lo(n.extent,s);o=Ii(t,e.extent),o&&!di(t,e.extent)&&(e.declutter?this.clipExtent_=t:(this.clipUnrotated(i,e,t),c=!0))}return o&&this.renderWorlds(a,e,this.getLayer().getDeclutter()?!1:void 0),c&&i.restore(),this.postRender(i,e),this.renderedRotation_!==r.rotation&&(this.renderedRotation_=r.rotation,this.hitDetectionImageData_=null),e.declutter||this.resetDrawContext_(),this.container}getFeatures(e){return new Promise(t=>{if(this.frameState&&!this.hitDetectionImageData_&&!this.animatingOrInteracting_){let e=this.frameState.size.slice(),t=this.renderedCenter_,n=this.renderedResolution_,r=this.renderedRotation_,i=this.renderedProjection_,a=this.wrappedRenderedExtent_,o=this.getLayer(),s=[],c=e[0]*Bd,l=e[1]*Bd;s.push(this.getRenderTransform(t,n,r,Bd,c,l,0).slice());let u=o.getSource(),d=i.getExtent();if(u.getWrapX()&&i.canWrapX()&&!di(d,a)){let e=a[0],i=V(d),o=0,u;for(;e<d[0];)--o,u=i*o,s.push(this.getRenderTransform(t,n,r,Bd,c,l,u).slice()),e+=i;for(o=0,e=a[2];e>d[2];)++o,u=i*o,s.push(this.getRenderTransform(t,n,r,Bd,c,l,u).slice()),e-=i}let f=No();this.hitDetectionImageData_=Vd(e,s,this.renderedFeatures_,o.getStyleFunction(),a,n,r,Yl(n,this.renderedPixelRatio_),f?i:null)}t(Hd(e,this.renderedFeatures_,this.hitDetectionImageData_))})}forEachFeatureAtCoordinate(e,t,n,r,i){if(!this.replayGroup_)return;let a=t.viewState.resolution,o=t.viewState.rotation,s=this.getLayer(),c={},l=function(e,t,n){let a=z(e),o=c[a];if(!o){if(n===0)return c[a]=!0,r(e,s,t);i.push(c[a]={feature:e,layer:s,geometry:t,distanceSq:n,callback:r})}else if(o!==!0&&n<o.distanceSq){if(n===0)return c[a]=!0,i.splice(i.lastIndexOf(o),1),r(e,s,t);o.geometry=t,o.distanceSq=n}},u=this.getLayer().getDeclutter();return this.replayGroup_.forEachFeatureAtCoordinate(e,a,o,n,l,u?t.declutter?.[u]?.all().map(e=>e.value):null)}handleFontsChanged(){let e=this.getLayer();e.getVisible()&&this.replayGroup_&&e.changed()}handleStyleImageChange_(e){this.renderIfReadyAndVisible()}prepareFrame(e){let t=this.getLayer(),n=t.getSource();if(!n)return!1;let r=e.viewHints[W.ANIMATING],i=e.viewHints[W.INTERACTING],a=t.getUpdateWhileAnimating(),o=t.getUpdateWhileInteracting();if(this.ready&&!a&&r||!o&&i)return this.animatingOrInteracting_=!0,!0;this.animatingOrInteracting_=!1;let s=e.extent,c=e.viewState,l=c.projection,u=c.resolution,d=e.pixelRatio,f=t.getRevision(),p=t.getRenderBuffer(),m=t.getRenderOrder();m===void 0&&(m=Jl);let h=c.center.slice(),g=si(s,p*u),_=g.slice(),v=[g.slice()],y=l.getExtent(),b=n.getWrapX()&&l.canWrapX();if(this.extendX_=!1,b){let e=n.getExtent();e&&!Li(e)&&(this.extendX_=e[0]<y[0]||e[2]>y[2])}if(b&&(!di(y,e.extent)||this.extendX_)){let e=V(y),t=Math.max(V(g)/2,e),n=y[0],r=y[2];this.extendX_&&(n-=e,r+=e),g[0]=n-t,g[2]=r+t,ca(h,l);let i=Vi(v[0],l);i[0]<y[0]&&i[2]<y[2]?v.push([i[0]+e,i[1],i[2]+e,i[3]]):i[0]>y[0]&&i[2]>y[2]&&v.push([i[0]-e,i[1],i[2]-e,i[3]])}if(this.ready&&this.renderedResolution_==u&&this.renderedPixelRatio_===d&&this.renderedRevision_==f&&this.renderedRenderOrder_==m&&this.renderedFrameDeclutter_===!!e.declutter&&di(this.wrappedRenderedExtent_,g))return Ir(this.renderedExtent_,_)||(this.hitDetectionImageData_=null,this.renderedExtent_=_),this.renderedCenter_=h,this.replayGroupChanged=!1,!0;this.replayGroup_=null;let x=new hd(Xl(u,d),g,u,d),S=No(),C;if(S){for(let e=0,t=v.length;e<t;++e){let t=v[e],r=Io(t,l);n.loadFeatures(r,Ro(u,l),S)}C=Do(S,l)}else for(let e=0,t=v.length;e<t;++e)n.loadFeatures(v[e],u,l);let w=Yl(u,d),T=!0,ee=(e,n)=>{let r,i=e.getStyleFunction()||t.getStyleFunction();if(i&&(r=i(e,u)),r){let t=this.renderFeature(e,w,r,x,C,this.getLayer().getDeclutter(),n);T&&=!t}},E=Io(g,l),D=n.getFeaturesInExtent(E);m&&D.sort(m);for(let e=0,t=D.length;e<t;++e)ee(D[e],e);this.renderedFeatures_=D,this.ready=T;let O=x.finish(),k=new Fd(g,u,d,n.getOverlaps(),O,t.getRenderBuffer(),!!e.declutter);return this.renderedResolution_=u,this.renderedRevision_=f,this.renderedRenderOrder_=m,this.renderedFrameDeclutter_=!!e.declutter,this.renderedExtent_=_,this.wrappedRenderedExtent_=g,this.renderedCenter_=h,this.renderedProjection_=l,this.renderedPixelRatio_=d,this.replayGroup_=k,this.hitDetectionImageData_=null,this.replayGroupChanged=!0,!0}renderFeature(e,t,n,r,i,a,o){if(!n)return!1;let s=!1;if(Array.isArray(n))for(let c=0,l=n.length;c<l;++c)s=Ql(r,e,n[c],t,this.boundHandleStyleImageChange_,i,a,o)||s;else s=Ql(r,e,n,t,this.boundHandleStyleImageChange_,i,a,o);return s}},Zd=0,Qd=1<<Zd++,K=1<<Zd++,$d=1<<Zd++,ef=1<<Zd++,tf=1<<Zd++,nf=1<<Zd++,rf=2**Zd-1,af={[Qd]:`boolean`,[K]:`number`,[$d]:`string`,[ef]:`color`,[tf]:`number[]`,[nf]:`size`},of=Object.keys(af).map(Number).sort(jr);function sf(e){return e in af}function cf(e){let t=[];for(let n of of)lf(e,n)&&t.push(af[n]);return t.length===0?`untyped`:t.length<3?t.join(` or `):t.slice(0,-1).join(`, `)+`, or `+t[t.length-1]}function lf(e,t){return(e&t)===t}function uf(e,t){return e===t}var df=class{constructor(e,t){if(!sf(e))throw Error(`literal expressions must have a specific type, got ${cf(e)}`);this.type=e,this.value=t}},ff=class{constructor(e,t,...n){this.type=e,this.operator=t,this.args=n}};function pf(){return{variables:new Set,properties:new Set,featureId:!1,geometryType:!1,mapState:!1}}function mf(e,t,n){switch(typeof e){case`boolean`:if(uf(t,$d))return new df($d,e?`true`:`false`);if(!lf(t,Qd))throw Error(`got a boolean, but expected ${cf(t)}`);return new df(Qd,e);case`number`:if(uf(t,nf))return new df(nf,Ku(e));if(uf(t,Qd))return new df(Qd,!!e);if(uf(t,$d))return new df($d,e.toString());if(!lf(t,K))throw Error(`got a number, but expected ${cf(t)}`);return new df(K,e);case`string`:if(uf(t,ef))return new df(ef,Xc(e));if(uf(t,Qd))return new df(Qd,!!e);if(!lf(t,$d))throw Error(`got a string, but expected ${cf(t)}`);return new df($d,e);default:}if(!Array.isArray(e))throw Error(`expression must be an array or a primitive value`);if(e.length===0)throw Error(`empty expression`);if(typeof e[0]==`string`)return Af(e,t,n);for(let t of e)if(typeof t!=`number`)throw Error(`expected an array of numbers`);if(uf(t,nf)){if(e.length!==2)throw Error(`expected an array of two values for a size, got ${e.length}`);return new df(nf,e)}if(uf(t,ef)){if(e.length===3)return new df(ef,[...e,1]);if(e.length===4)return new df(ef,e);throw Error(`expected an array of 3 or 4 values for a color, got ${e.length}`)}if(!lf(t,tf))throw Error(`got an array of numbers, but expected ${cf(t)}`);return new df(tf,e)}var q={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`},hf={[q.Get]:X(J(1,1/0),gf),[q.Var]:X(J(1,1),_f),[q.Has]:X(J(1,1/0),gf),[q.Id]:X(vf,xf),[q.Concat]:X(J(2,1/0),Y($d)),[q.GeometryType]:X(yf,xf),[q.LineMetric]:X(xf),[q.Resolution]:X(bf,xf),[q.Zoom]:X(bf,xf),[q.Time]:X(bf,xf),[q.Any]:X(J(2,1/0),Y(Qd)),[q.All]:X(J(2,1/0),Y(Qd)),[q.Not]:X(J(1,1),Y(Qd)),[q.Equal]:X(J(2,2),Y(rf)),[q.NotEqual]:X(J(2,2),Y(rf)),[q.GreaterThan]:X(J(2,2),Y(K)),[q.GreaterThanOrEqualTo]:X(J(2,2),Y(K)),[q.LessThan]:X(J(2,2),Y(K)),[q.LessThanOrEqualTo]:X(J(2,2),Y(K)),[q.Multiply]:X(J(2,1/0),Sf),[q.Coalesce]:X(J(2,1/0),Sf),[q.Divide]:X(J(2,2),Y(K)),[q.Add]:X(J(2,1/0),Y(K)),[q.Subtract]:X(J(2,2),Y(K)),[q.Clamp]:X(J(3,3),Y(K)),[q.Mod]:X(J(2,2),Y(K)),[q.Pow]:X(J(2,2),Y(K)),[q.Abs]:X(J(1,1),Y(K)),[q.Floor]:X(J(1,1),Y(K)),[q.Ceil]:X(J(1,1),Y(K)),[q.Round]:X(J(1,1),Y(K)),[q.Sin]:X(J(1,1),Y(K)),[q.Cos]:X(J(1,1),Y(K)),[q.Atan]:X(J(1,2),Y(K)),[q.Sqrt]:X(J(1,1),Y(K)),[q.Match]:X(J(4,1/0),wf,Tf),[q.Between]:X(J(3,3),Y(K)),[q.Interpolate]:X(J(6,1/0),wf,Ef),[q.Case]:X(J(3,1/0),Cf,Df),[q.In]:X(J(2,2),Of),[q.Number]:X(J(1,1/0),Y(rf)),[q.String]:X(J(1,1/0),Y(rf)),[q.Array]:X(J(1,1/0),Y(K)),[q.Color]:X(J(1,4),Y(K)),[q.Band]:X(J(1,3),Y(K)),[q.Palette]:X(J(2,2),kf),[q.ToString]:X(J(1,1),Y(Qd|K|$d|ef))};function gf(e,t,n){let r=e.length-1,i=Array(r);for(let t=0;t<r;++t){let r=e[t+1];switch(typeof r){case`number`:i[t]=new df(K,r);break;case`string`:i[t]=new df($d,r);break;default:throw Error(`expected a string key or numeric array index for a get operation, got ${r}`)}t===0&&n.properties.add(String(r))}return i}function _f(e,t,n){let r=e[1];if(typeof r!=`string`)throw Error(`expected a string argument for var operation`);return n.variables.add(r),[new df($d,r)]}function vf(e,t,n){n.featureId=!0}function yf(e,t,n){n.geometryType=!0}function bf(e,t,n){n.mapState=!0}function xf(e,t,n){let r=e[0];if(e.length!==1)throw Error(`expected no arguments for ${r} operation`);return[]}function J(e,t){return function(n,r,i){let a=n[0],o=n.length-1;if(e===t){if(o!==e)throw Error(`expected ${e} argument${e===1?``:`s`} for ${a}, got ${o}`)}else if(o<e||o>t){let n=t===1/0?`${e} or more`:`${e} to ${t}`;throw Error(`expected ${n} arguments for ${a}, got ${o}`)}}}function Sf(e,t,n){let r=e.length-1,i=Array(r);for(let a=0;a<r;++a)i[a]=mf(e[a+1],t,n);return i}function Y(e){return function(t,n,r){let i=t.length-1,a=Array(i);for(let n=0;n<i;++n)a[n]=mf(t[n+1],e,r);return a}}function Cf(e,t,n){let r=e[0],i=e.length-1;if(i%2==0)throw Error(`expected an odd number of arguments for ${r}, got ${i} instead`)}function wf(e,t,n){let r=e[0],i=e.length-1;if(i%2==1)throw Error(`expected an even number of arguments for operation ${r}, got ${i} instead`)}function Tf(e,t,n){let r=e.length-1,i=$d|K|Qd,a=mf(e[1],i,n),o=mf(e[e.length-1],t,n),s=Array(r-2);for(let t=0;t<r-2;t+=2){try{s[t]=mf(e[t+2],a.type,n)}catch(e){throw Error(`failed to parse argument ${t+1} of match expression: ${e.message}`)}try{let r=mf(e[t+3],o.type,n);s[t+1]=r}catch(e){throw Error(`failed to parse argument ${t+2} of match expression: ${e.message}`)}}return[a,...s,o]}function Ef(e,t,n){let r=e[1],i;switch(r[0]){case`linear`:i=1;break;case`exponential`:let e=r[1];if(typeof e!=`number`||e<=0)throw Error(`expected a number base for exponential interpolation, got ${JSON.stringify(e)} instead`);i=e;break;default:throw Error(`invalid interpolation type: ${JSON.stringify(r)}`)}let a=new df(K,i),o;try{o=mf(e[2],K,n)}catch(e){throw Error(`failed to parse argument 1 in interpolate expression: ${e.message}`)}let s=Array(e.length-3);for(let r=0;r<s.length;r+=2){try{s[r]=mf(e[r+3],K,n)}catch(e){throw Error(`failed to parse argument ${r+2} for interpolate expression: ${e.message}`)}try{let i=mf(e[r+4],t,n);s[r+1]=i}catch(e){throw Error(`failed to parse argument ${r+3} for interpolate expression: ${e.message}`)}}return[a,o,...s]}function Df(e,t,n){let r=mf(e[e.length-1],t,n),i=Array(e.length-1);for(let t=0;t<i.length-1;t+=2){try{i[t]=mf(e[t+1],Qd,n)}catch(e){throw Error(`failed to parse argument ${t} of case expression: ${e.message}`)}try{let a=mf(e[t+2],r.type,n);i[t+1]=a}catch(e){throw Error(`failed to parse argument ${t+1} of case expression: ${e.message}`)}}return i[i.length-1]=r,i}function Of(e,t,n){let r=e[2];if(!Array.isArray(r))throw Error(`the second argument for the "in" operator must be an array`);let i;if(typeof r[0]==`string`){if(r[0]!==`literal`)throw Error(`for the "in" operator, a string array should be wrapped in a "literal" operator to disambiguate from expressions`);if(!Array.isArray(r[1]))throw Error(`failed to parse "in" expression: the literal operator must be followed by an array`);r=r[1],i=$d}else i=K;let a=Array(r.length);for(let e=0;e<a.length;e++)try{a[e]=mf(r[e],i,n)}catch(t){throw Error(`failed to parse haystack item ${e} for "in" expression: ${t.message}`)}return[mf(e[1],i,n),...a]}function kf(e,t,n){let r;try{r=mf(e[1],K,n)}catch(e){throw Error(`failed to parse first argument in palette expression: ${e.message}`)}let i=e[2];if(!Array.isArray(i))throw Error(`the second argument of palette must be an array`);let a=Array(i.length);for(let e=0;e<a.length;e++){let t;try{t=mf(i[e],ef,n)}catch(t){throw Error(`failed to parse color at index ${e} in palette expression: ${t.message}`)}if(!(t instanceof df))throw Error(`the palette color at index ${e} must be a literal value`);a[e]=t}return[r,...a]}function X(...e){return function(t,n,r){let i=t[0],a;for(let i=0;i<e.length;i++){let o=e[i](t,n,r);if(i==e.length-1){if(!o)throw Error(`expected last argument validator to return the parsed args`);a=o}}return new ff(n,i,...a)}}function Af(e,t,n){let r=e[0],i=hf[r];if(!i)throw Error(`unknown operator: ${r}`);return i(e,t,n)}function jf(e){if(!e)return``;let t=e.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 jf(e.getGeometries()[0]);default:return``}}function Mf(){return{variables:{},properties:{},resolution:NaN,featureId:null,geometryType:``}}function Nf(e,t,n){return Pf(mf(e,t,n),n)}function Pf(e,t){if(e instanceof df){if(e.type===ef&&typeof e.value==`string`){let t=Xc(e.value);return function(){return t}}return function(){return e.value}}let n=e.operator;switch(n){case q.Number:case q.String:case q.Coalesce:return Ff(e,t);case q.Get:case q.Var:case q.Has:return If(e,t);case q.Id:return e=>e.featureId;case q.GeometryType:return e=>e.geometryType;case q.Concat:{let n=e.args.map(e=>Pf(e,t));return e=>``.concat(...n.map(t=>t(e).toString()))}case q.Resolution:return e=>e.resolution;case q.Any:case q.All:case q.Between:case q.In:case q.Not:return Rf(e,t);case q.Equal:case q.NotEqual:case q.LessThan:case q.LessThanOrEqualTo:case q.GreaterThan:case q.GreaterThanOrEqualTo:return Lf(e,t);case q.Multiply:case q.Divide:case q.Add:case q.Subtract:case q.Clamp:case q.Mod:case q.Pow:case q.Abs:case q.Floor:case q.Ceil:case q.Round:case q.Sin:case q.Cos:case q.Atan:case q.Sqrt:return zf(e,t);case q.Case:return Bf(e,t);case q.Match:return Vf(e,t);case q.Interpolate:return Hf(e,t);case q.ToString:return Uf(e,t);default:throw Error(`Unsupported operator ${n}`)}}function Ff(e,t){let n=e.operator,r=e.args.length,i=Array(r);for(let n=0;n<r;++n)i[n]=Pf(e.args[n],t);switch(n){case q.Coalesce:return e=>{for(let t=0;t<r;++t){let n=i[t](e);if(n!=null)return n}throw Error(`Expected one of the values to be non-null`)};case q.Number:case q.String:return e=>{for(let t=0;t<r;++t){let r=i[t](e);if(typeof r===n)return r}throw Error(`Expected one of the values to be a ${n}`)};default:throw Error(`Unsupported assertion operator ${n}`)}}function If(e,t){let n=e.args[0].value;switch(e.operator){case q.Get:return t=>{let r=e.args,i=t.properties[n];for(let e=1,t=r.length;e<t;++e){let t=r[e].value;i=i[t]}return i};case q.Var:return e=>e.variables[n];case q.Has:return t=>{let r=e.args;if(!(n in t.properties))return!1;let i=t.properties[n];for(let e=1,t=r.length;e<t;++e){let t=r[e].value;if(!i||!Object.hasOwn(i,t))return!1;i=i[t]}return!0};default:throw Error(`Unsupported accessor operator ${e.operator}`)}}function Lf(e,t){let n=e.operator,r=Pf(e.args[0],t),i=Pf(e.args[1],t);switch(n){case q.Equal:return e=>r(e)===i(e);case q.NotEqual:return e=>r(e)!==i(e);case q.LessThan:return e=>r(e)<i(e);case q.LessThanOrEqualTo:return e=>r(e)<=i(e);case q.GreaterThan:return e=>r(e)>i(e);case q.GreaterThanOrEqualTo:return e=>r(e)>=i(e);default:throw Error(`Unsupported comparison operator ${n}`)}}function Rf(e,t){let n=e.operator,r=e.args.length,i=Array(r);for(let n=0;n<r;++n)i[n]=Pf(e.args[n],t);switch(n){case q.Any:return e=>{for(let t=0;t<r;++t)if(i[t](e))return!0;return!1};case q.All:return e=>{for(let t=0;t<r;++t)if(!i[t](e))return!1;return!0};case q.Between:return e=>{let t=i[0](e),n=i[1](e),r=i[2](e);return t>=n&&t<=r};case q.In:return e=>{let t=i[0](e);for(let n=1;n<r;++n)if(t===i[n](e))return!0;return!1};case q.Not:return e=>!i[0](e);default:throw Error(`Unsupported logical operator ${n}`)}}function zf(e,t){let n=e.operator,r=e.args.length,i=Array(r);for(let n=0;n<r;++n)i[n]=Pf(e.args[n],t);switch(n){case q.Multiply:return e=>{let t=1;for(let n=0;n<r;++n)t*=i[n](e);return t};case q.Divide:return e=>i[0](e)/i[1](e);case q.Add:return e=>{let t=0;for(let n=0;n<r;++n)t+=i[n](e);return t};case q.Subtract:return e=>i[0](e)-i[1](e);case q.Clamp:return e=>{let t=i[0](e),n=i[1](e);if(t<n)return n;let r=i[2](e);return t>r?r:t};case q.Mod:return e=>i[0](e)%i[1](e);case q.Pow:return e=>i[0](e)**+i[1](e);case q.Abs:return e=>Math.abs(i[0](e));case q.Floor:return e=>Math.floor(i[0](e));case q.Ceil:return e=>Math.ceil(i[0](e));case q.Round:return e=>Math.round(i[0](e));case q.Sin:return e=>Math.sin(i[0](e));case q.Cos:return e=>Math.cos(i[0](e));case q.Atan:return r===2?e=>Math.atan2(i[0](e),i[1](e)):e=>Math.atan(i[0](e));case q.Sqrt:return e=>Math.sqrt(i[0](e));default:throw Error(`Unsupported numeric operator ${n}`)}}function Bf(e,t){let n=e.args.length,r=Array(n);for(let i=0;i<n;++i)r[i]=Pf(e.args[i],t);return e=>{for(let t=0;t<n-1;t+=2)if(r[t](e))return r[t+1](e);return r[n-1](e)}}function Vf(e,t){let n=e.args.length,r=Array(n);for(let i=0;i<n;++i)r[i]=Pf(e.args[i],t);return e=>{let t=r[0](e);for(let i=1;i<n-1;i+=2)if(t===r[i](e))return r[i+1](e);return r[n-1](e)}}function Hf(e,t){let n=e.args.length,r=Array(n);for(let i=0;i<n;++i)r[i]=Pf(e.args[i],t);return e=>{let t=r[0](e),i=r[1](e),a,o;for(let s=2;s<n;s+=2){let n=r[s](e),c=r[s+1](e),l=Array.isArray(c);if(l&&(c=Uc(c)),n>=i)return s===2?c:l?Gf(t,i,a,o,n,c):Wf(t,i,a,o,n,c);a=n,o=c}return o}}function Uf(e,t){let n=e.operator,r=e.args.length,i=Array(r);for(let n=0;n<r;++n)i[n]=Pf(e.args[n],t);switch(n){case q.ToString:return t=>{let n=i[0](t);return e.args[0].type===ef?Qc(n):n.toString()};default:throw Error(`Unsupported convert operator ${n}`)}}function Wf(e,t,n,r,i,a){let o=i-n;if(o===0)return r;let s=t-n;return r+(e===1?s/o:(e**+s-1)/(e**+o-1))*(a-r)}function Gf(e,t,n,r,i,a){if(i-n===0)return r;let o=Jc(r),s=Jc(a),c=s[2]-o[2];return c>180?c-=360:c<-180&&(c+=360),Yc([Wf(e,t,n,o[0],i,s[0]),Wf(e,t,n,o[1],i,s[1]),o[2]+Wf(e,t,n,0,i,c),Wf(e,t,n,r[3],i,a[3])])}function Kf(e){return!0}function qf(e){let t=pf(),n=Yf(e,t),r=Mf();return function(e,i){if(r.properties=e.getPropertiesInternal(),r.resolution=i,t.featureId){let t=e.getId();t===void 0?r.featureId=null:r.featureId=t}return t.geometryType&&(r.geometryType=jf(e.getGeometry())),n(r)}}function Jf(e){let t=pf(),n=e.length,r=Array(n);for(let i=0;i<n;++i)r[i]=Xf(e[i],t);let i=Mf(),a=Array(n);return function(e,o){if(i.properties=e.getPropertiesInternal(),i.resolution=o,t.featureId){let t=e.getId();t===void 0?i.featureId=null:i.featureId=t}let s=0;for(let e=0;e<n;++e){let t=r[e](i);t&&(a[s]=t,s+=1)}return a.length=s,a}}function Yf(e,t){let n=e.length,r=Array(n);for(let i=0;i<n;++i){let n=e[i],a=`filter`in n?Nf(n.filter,Qd,t):Kf,o;if(Array.isArray(n.style)){let e=n.style.length;o=Array(e);for(let r=0;r<e;++r)o[r]=Xf(n.style[r],t)}else o=[Xf(n.style,t)];r[i]={filter:a,styles:o}}return function(t){let i=[],a=!1;for(let o=0;o<n;++o){let n=r[o].filter;if(n(t)&&!(e[o].else&&a)){a=!0;for(let e of r[o].styles){let n=e(t);n&&i.push(n)}}}return i}}function Xf(e,t){let n=Zf(e,``,t),r=Qf(e,``,t),i=$f(e,t),a=ep(e,t),o=ap(e,`z-index`,t);if(!n&&!r&&!i&&!a&&!Wr(e))throw Error(`No fill, stroke, point, or text symbolizer properties in style: `+JSON.stringify(e));let s=new Xu;return function(e){let t=!0;if(n){let r=n(e);r&&(t=!1),s.setFill(r)}if(r){let n=r(e);n&&(t=!1),s.setStroke(n)}if(i){let n=i(e);n&&(t=!1),s.setText(n)}if(a){let n=a(e);n&&(t=!1),s.setImage(n)}return o&&s.setZIndex(o(e)),t?null:s}}function Zf(e,t,n){let r;if(t+`fill-pattern-src`in e)r=sp(e,t+`fill-`,n);else{if(e[t+`fill-color`]===`none`)return e=>null;r=lp(e,t+`fill-color`,n)}if(!r)return null;let i=new Hu;return function(e){let t=r(e);return t===kc?null:(i.setColor(t),i)}}function Qf(e,t,n){let r=ap(e,t+`stroke-width`,n),i=lp(e,t+`stroke-color`,n);if(!r&&!i)return null;let a=op(e,t+`stroke-line-cap`,n),o=op(e,t+`stroke-line-join`,n),s=up(e,t+`stroke-line-dash`,n),c=ap(e,t+`stroke-line-dash-offset`,n),l=ap(e,t+`stroke-miter-limit`,n),u=ap(e,t+`stroke-offset`,n),d=new Uu;return function(e){if(i){let t=i(e);if(t===kc)return null;d.setColor(t)}if(r&&d.setWidth(r(e)),a){let t=a(e);if(t!==`butt`&&t!==`round`&&t!==`square`)throw Error(`Expected butt, round, or square line cap`);d.setLineCap(t)}if(o){let t=o(e);if(t!==`bevel`&&t!==`round`&&t!==`miter`)throw Error(`Expected bevel, round, or miter line join`);d.setLineJoin(t)}return s&&d.setLineDash(s(e)),c&&d.setLineDashOffset(c(e)),l&&d.setMiterLimit(l(e)),u&&d.setOffset(u(e)),d}}function $f(e,t){let n=`text-`,r=op(e,n+`value`,t);if(!r)return null;let i=Zf(e,n,t),a=Zf(e,n+`background-`,t),o=Qf(e,n,t),s=Qf(e,n+`background-`,t),c=op(e,n+`font`,t),l=ap(e,n+`max-angle`,t),u=ap(e,n+`offset-x`,t),d=ap(e,n+`offset-y`,t),f=cp(e,n+`overflow`,t),p=op(e,n+`placement`,t),m=ap(e,n+`repeat`,t),h=pp(e,n+`scale`,t),g=cp(e,n+`rotate-with-view`,t),_=ap(e,n+`rotation`,t),v=op(e,n+`align`,t),y=op(e,n+`justify`,t),b=op(e,n+`baseline`,t),x=cp(e,n+`keep-upright`,t),S=up(e,n+`padding`,t),C=new nd({declutterMode:bp(e,n+`declutter-mode`)});return function(e){if(C.setText(r(e)),i&&C.setFill(i(e)),a&&C.setBackgroundFill(a(e)),o&&C.setStroke(o(e)),s&&C.setBackgroundStroke(s(e)),c&&C.setFont(c(e)),l&&C.setMaxAngle(l(e)),u&&C.setOffsetX(u(e)),d&&C.setOffsetY(d(e)),f&&C.setOverflow(f(e)),p){let t=p(e);if(t!==`point`&&t!==`line`)throw Error(`Expected point or line for text-placement`);C.setPlacement(t)}if(m&&C.setRepeat(m(e)),h&&C.setScale(h(e)),g&&C.setRotateWithView(g(e)),_&&C.setRotation(_(e)),v){let t=v(e);if(t!==`left`&&t!==`center`&&t!==`right`&&t!==`end`&&t!==`start`)throw Error(`Expected left, right, center, start, or end for text-align`);C.setTextAlign(t)}if(y){let t=y(e);if(t!==`left`&&t!==`right`&&t!==`center`)throw Error(`Expected left, right, or center for text-justify`);C.setJustify(t)}if(b){let t=b(e);if(t!==`bottom`&&t!==`top`&&t!==`middle`&&t!==`alphabetic`&&t!==`hanging`)throw Error(`Expected bottom, top, middle, alphabetic, or hanging for text-baseline`);C.setTextBaseline(t)}return S&&C.setPadding(S(e)),x&&C.setKeepUpright(x(e)),C}}function ep(e,t){return`icon-src`in e?tp(e,t):`shape-points`in e?np(e,t):`circle-radius`in e?rp(e,t):null}function tp(e,t){let n=`icon-`,r=n+`src`,i=Sp(e[r],r),a=dp(e,n+`anchor`,t),o=pp(e,n+`scale`,t),s=ap(e,n+`opacity`,t),c=dp(e,n+`displacement`,t),l=ap(e,n+`rotation`,t),u=cp(e,n+`rotate-with-view`,t),d=_p(e,n+`anchor-origin`),f=vp(e,n+`anchor-x-units`),p=vp(e,n+`anchor-y-units`),m=ip(e,n+`color`),h,g=null;m!==void 0&&(Array.isArray(m)&&m.length>0&&typeof m[0]==`string`?g=lp(e,n+`color`,t):h=wp(m,n+`color`));let _=gp(e,n+`cross-origin`),v=yp(e,n+`offset`),y=_p(e,n+`offset-origin`),b=mp(e,n+`width`),x={src:i,anchorOrigin:d,anchorXUnits:f,anchorYUnits:p,crossOrigin:_,offset:v,offsetOrigin:y,height:mp(e,n+`height`),width:b,size:hp(e,n+`size`),declutterMode:bp(e,n+`declutter-mode`)},S=null;return function(e){if(S)g&&S.setColor(g(e));else{let t=g?g(e):h;S=new zd(t===void 0?Object.assign({},x):Object.assign({},x,{color:t}))}return s&&S.setOpacity(s(e)),c&&S.setDisplacement(c(e)),l&&S.setRotation(l(e)),u&&S.setRotateWithView(u(e)),o&&S.setScale(o(e)),a&&S.setAnchor(a(e)),S}}function np(e,t){let n=`shape-`,r=n+`points`,i=n+`radius`,a=Cp(e[r],r);if(!(i in e))throw Error(`Expected a number for ${i}`);let o=ap(e,i,t),s=typeof e[i]==`number`?e[i]:5,c=n+`radius2`,l=ap(e,c,t),u=typeof e[c]==`number`?e[c]:void 0,d=Zf(e,n,t),f=Qf(e,n,t),p=pp(e,n+`scale`,t),m=dp(e,n+`displacement`,t),h=ap(e,n+`rotation`,t),g=cp(e,n+`rotate-with-view`,t),_=new Ju({points:a,radius:s,radius2:u,angle:mp(e,n+`angle`),declutterMode:bp(e,n+`declutter-mode`)});return function(e){return o&&_.setRadius(o(e)),l&&_.setRadius2(l(e)),d&&_.setFill(d(e)),f&&_.setStroke(f(e)),m&&_.setDisplacement(m(e)),h&&_.setRotation(h(e)),g&&_.setRotateWithView(g(e)),p&&_.setScale(p(e)),_}}function rp(e,t){let n=`circle-`,r=Zf(e,n,t),i=Qf(e,n,t),a=ap(e,n+`radius`,t),o=pp(e,n+`scale`,t),s=dp(e,n+`displacement`,t),c=ap(e,n+`rotation`,t),l=cp(e,n+`rotate-with-view`,t),u=new Yu({radius:5,declutterMode:bp(e,n+`declutter-mode`)});return function(e){return a&&u.setRadius(a(e)),r&&u.setFill(r(e)),i&&u.setStroke(i(e)),s&&u.setDisplacement(s(e)),c&&u.setRotation(c(e)),l&&u.setRotateWithView(l(e)),o&&u.setScale(o(e)),u}}function ip(e,t){if(!(t in e))return;let n=e[t];return n===void 0?void 0:n}function ap(e,t,n){let r=ip(e,t);if(r===void 0)return;let i=Nf(r,K,n);return function(e){return Cp(i(e),t)}}function op(e,t,n){let r=ip(e,t);if(r===void 0)return null;let i=Nf(r,$d,n);return function(e){return Sp(i(e),t)}}function sp(e,t,n){let r=op(e,t+`pattern-src`,n),i=fp(e,t+`pattern-offset`,n),a=fp(e,t+`pattern-size`,n),o=lp(e,t+`color`,n);return function(e){return{src:r(e),offset:i&&i(e),size:a&&a(e),color:o&&o(e)}}}function cp(e,t,n){let r=ip(e,t);if(r===void 0)return null;let i=Nf(r,Qd,n);return function(e){let n=i(e);if(typeof n!=`boolean`)throw Error(`Expected a boolean for ${t}`);return n}}function lp(e,t,n){let r=ip(e,t);if(r===void 0)return null;let i=Nf(r,ef,n);return function(e){return wp(i(e),t)}}function up(e,t,n){let r=ip(e,t);if(r===void 0)return null;if(Array.isArray(r)&&(r.length===0||typeof r[0]!=`string`)){let e=r.map((e,r)=>{if(typeof e==`number`)return()=>e;let i=Nf(e,K,n);return function(e){return Cp(i(e),`${t}[${r}]`)}});return function(t){let n=Array(e.length);for(let r=0;r<e.length;++r)n[r]=e[r](t);return n}}let i=Nf(r,tf,n);return function(e){return xp(i(e),t)}}function dp(e,t,n){let r=ip(e,t);if(r===void 0)return null;let i=Nf(r,tf,n);return function(e){let n=xp(i(e),t);if(n.length!==2)throw Error(`Expected two numbers for ${t}`);return n}}function fp(e,t,n){let r=ip(e,t);if(r===void 0)return null;let i=Nf(r,tf,n);return function(e){return Tp(i(e),t)}}function pp(e,t,n){let r=ip(e,t);if(r===void 0)return null;let i=Nf(r,tf|K,n);return function(e){return Ep(i(e),t)}}function mp(e,t){let n=e[t];if(n!==void 0){if(typeof n!=`number`)throw Error(`Expected a number for ${t}`);return n}}function hp(e,t){let n=e[t];if(n!==void 0){if(typeof n==`number`)return Ku(n);if(!Array.isArray(n)||n.length!==2||typeof n[0]!=`number`||typeof n[1]!=`number`)throw Error(`Expected a number or size array for ${t}`);return n}}function gp(e,t){let n=e[t];if(n!==void 0){if(typeof n!=`string`)throw Error(`Expected a string for ${t}`);return n}}function _p(e,t){let n=e[t];if(n!==void 0){if(n!==`bottom-left`&&n!==`bottom-right`&&n!==`top-left`&&n!==`top-right`)throw Error(`Expected bottom-left, bottom-right, top-left, or top-right for ${t}`);return n}}function vp(e,t){let n=e[t];if(n!==void 0){if(n!==`pixels`&&n!==`fraction`)throw Error(`Expected pixels or fraction for ${t}`);return n}}function yp(e,t){let n=e[t];if(n!==void 0)return xp(n,t)}function bp(e,t){let n=e[t];if(n!==void 0){if(typeof n!=`string`)throw Error(`Expected a string for ${t}`);if(n!==`declutter`&&n!==`obstacle`&&n!==`none`)throw Error(`Expected declutter, obstacle, or none for ${t}`);return n}}function xp(e,t){if(!Array.isArray(e))throw Error(`Expected an array for ${t}`);let n=e.length;for(let r=0;r<n;++r)if(typeof e[r]!=`number`)throw Error(`Expected an array of numbers for ${t}`);return e}function Sp(e,t){if(typeof e!=`string`)throw Error(`Expected a string for ${t}`);return e}function Cp(e,t){if(typeof e!=`number`)throw Error(`Expected a number for ${t}`);return e}function wp(e,t){if(typeof e==`string`)return e;let n=xp(e,t),r=n.length;if(r<3||r>4)throw Error(`Expected a color with 3 or 4 values for ${t}`);return n}function Tp(e,t){let n=xp(e,t);if(n.length!==2)throw Error(`Expected an array of two numbers for ${t}`);return n}function Ep(e,t){return typeof e==`number`?e:Tp(e,t)}var Dp={CENTER:`center`,RESOLUTION:`resolution`,ROTATION:`rotation`};function Op(e,t,n){return(function(r,i,a,o,s){if(!r)return;if(!i&&!t)return r;let c=t?0:a[0]*i,l=t?0:a[1]*i,u=s?s[0]:0,d=s?s[1]:0,f=e[0]+c/2+u,p=e[2]-c/2+u,m=e[1]+l/2+d,h=e[3]-l/2+d;f>p&&(f=(p+f)/2,p=f),m>h&&(m=(h+m)/2,h=m);let g=H(r[0],f,p),_=H(r[1],m,h);if(o&&n&&i){let e=30*i;g+=-e*Math.log(1+Math.max(0,f-r[0])/e)+e*Math.log(1+Math.max(0,r[0]-p)/e),_+=-e*Math.log(1+Math.max(0,m-r[1])/e)+e*Math.log(1+Math.max(0,r[1]-h)/e)}return[g,_]})}function kp(e){return e}function Ap(e){return e**3}function jp(e){return 1-Ap(1-e)}function Mp(e){return 3*e*e-2*e*e*e}function Np(e){return e}function Pp(e,t,n,r){let i=V(t)/n[0],a=Mi(t)/n[1];return r?Math.min(e,Math.max(i,a)):Math.min(e,Math.min(i,a))}function Fp(e,t,n){let r=Math.min(e,t);return r*=Math.log(1+50*Math.max(0,e/t-1))/50+1,n&&(r=Math.max(r,n),r/=Math.log(1+50*Math.max(0,n/e-1))/50+1),H(r,n/2,t*2)}function Ip(e,t,n,r){return t=t===void 0?!0:t,(function(i,a,o,s){if(i!==void 0){let c=e[0],l=e[e.length-1],u=n?Pp(c,n,o,r):c;if(s)return t?Fp(i,u,l):H(i,l,u);let d=Math.floor(Nr(e,Math.min(u,i),a));return e[d]>u&&d<e.length-1?e[d+1]:e[d]}})}function Lp(e,t,n,r,i,a){return r=r===void 0?!0:r,n=n===void 0?0:n,(function(o,s,c,l){if(o!==void 0){let u=i?Pp(t,i,c,a):t;if(l)return r?Fp(o,u,n):H(o,n,u);let d=1e-9,f=Math.ceil(Math.log(t/u)/Math.log(e)-d),p=-s*(.5-d)+.5,m=Math.floor(Math.log(t/Math.min(u,o))/Math.log(e)+p);return H(t/e**+Math.max(f,m),n,u)}})}function Rp(e,t,n,r,i){return n=n===void 0?!0:n,(function(a,o,s,c){if(a!==void 0){let o=r?Pp(e,r,s,i):e;return!n||!c?H(a,t,o):Fp(a,o,t)}})}function zp(e){if(e!==void 0)return 0}function Bp(e){if(e!==void 0)return e}function Vp(e){let t=2*Math.PI/e;return(function(e,n){if(n)return e;if(e!==void 0)return e=Math.floor(e/t+.5)*t,e})}function Hp(e){let t=e===void 0?qi(5):e;return(function(e,n){return n||e===void 0?e:Math.abs(e)<=t?0:e})}var Up=0,Wp=class extends Qr{constructor(e){super(),this.on,this.once,this.un,e=Object.assign({},e),this.hints_=[0,0],this.animations_=[],this.updateAnimationKey_,this.projection_=Co(e.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,e.projection&&ho(),e.center&&=Fo(e.center,this.projection_),e.extent&&=Lo(e.extent,this.projection_),this.applyOptions_(e)}applyOptions_(e){let t=Object.assign({},e);for(let e in Dp)delete t[e];this.setProperties(t,!0);let n=qp(e);this.maxResolution_=n.maxResolution,this.minResolution_=n.minResolution,this.zoomFactor_=n.zoomFactor,this.resolutions_=e.resolutions,this.padding_=e.padding,this.minZoom_=n.minZoom,this.constraints_={center:Kp(e),resolution:n.constraint,rotation:Jp(e)},this.setRotation(e.rotation===void 0?0:e.rotation),this.setCenterInternal(e.center===void 0?null:e.center),e.resolution===void 0?e.zoom!==void 0&&this.setZoom(e.zoom):this.setResolution(e.resolution)}get padding(){return this.padding_}set padding(e){let t=this.padding_;this.padding_=e;let n=this.getCenterInternal();if(n){let r=e||[0,0,0,0];t||=[0,0,0,0];let i=this.getResolution(),a=i/2*(r[3]-t[3]+t[1]-r[1]),o=i/2*(r[0]-t[0]+t[2]-r[2]);this.setCenterInternal([n[0]+a,n[1]-o])}}getUpdatedOptions_(e){let t=this.getProperties();return t.resolution===void 0?t.zoom=this.getZoom():t.resolution=this.getResolution(),t.center=this.getCenterInternal(),t.rotation=this.getRotation(),Object.assign({},t,e)}animate(e){this.isDef()&&!this.getAnimating()&&this.resolveConstraints(0);let t=Array(arguments.length);for(let e=0;e<t.length;++e){let n=arguments[e];n.center&&(n=Object.assign({},n),n.center=Fo(n.center,this.getProjection())),n.anchor&&(n=Object.assign({},n),n.anchor=Fo(n.anchor,this.getProjection())),t[e]=n}this.animateInternal.apply(this,t)}animateInternal(e){let t=arguments.length,n;t>1&&typeof arguments[t-1]==`function`&&(n=arguments[t-1],--t);let r=0;for(;r<t&&!this.isDef();++r){let e=arguments[r];e.center&&this.setCenterInternal(e.center),e.zoom===void 0?e.resolution&&this.setResolution(e.resolution):this.setZoom(e.zoom),e.rotation!==void 0&&this.setRotation(e.rotation)}if(r===t){n&&Gp(n,!0);return}let i=Date.now(),a=this.targetCenter_.slice(),o=this.targetResolution_,s=this.targetRotation_,c=[];for(;r<t;++r){let e=arguments[r],t={start:i,complete:!1,anchor:e.anchor,duration:e.duration===void 0?1e3:e.duration,easing:e.easing||Mp,callback:n};if(e.center&&(t.sourceCenter=a,t.targetCenter=e.center.slice(),a=t.targetCenter),e.zoom===void 0?e.resolution&&(t.sourceResolution=o,t.targetResolution=e.resolution,o=t.targetResolution):(t.sourceResolution=o,t.targetResolution=this.getResolutionForZoom(e.zoom),o=t.targetResolution),e.rotation!==void 0){t.sourceRotation=s;let n=Ji(e.rotation-s+Math.PI,2*Math.PI)-Math.PI;t.targetRotation=s+n,s=t.targetRotation}Yp(t)?t.complete=!0:i+=t.duration,c.push(t)}this.animations_.push(c),this.setHint(W.ANIMATING,1),this.updateAnimations_()}getAnimating(){return this.hints_[W.ANIMATING]>0}getInteracting(){return this.hints_[W.INTERACTING]>0}cancelAnimations(){this.setHint(W.ANIMATING,-this.hints_[W.ANIMATING]);let e;for(let t=0,n=this.animations_.length;t<n;++t){let n=this.animations_[t];if(n[0].callback&&Gp(n[0].callback,!1),!e)for(let t=0,r=n.length;t<r;++t){let r=n[t];if(!r.complete){e=r.anchor;break}}}this.animations_.length=0,this.cancelAnchor_=e,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;let e=Date.now(),t=!1;for(let n=this.animations_.length-1;n>=0;--n){let r=this.animations_[n],i=!0;for(let n=0,a=r.length;n<a;++n){let a=r[n];if(a.complete)continue;let o=e-a.start,s=a.duration>0?o/a.duration:1;s>=1?(a.complete=!0,s=1):i=!1;let c=a.easing(s);if(a.sourceCenter){let e=a.sourceCenter[0],t=a.sourceCenter[1],n=a.targetCenter[0],r=a.targetCenter[1];this.nextCenter_=a.targetCenter,this.targetCenter_=[e+c*(n-e),t+c*(r-t)]}if(a.sourceResolution&&a.targetResolution){let e=c===1?a.targetResolution:a.sourceResolution+c*(a.targetResolution-a.sourceResolution);if(a.anchor){let t=this.getViewportSize_(this.getRotation()),n=this.constraints_.resolution(e,0,t,!0);this.targetCenter_=this.calculateCenterZoom(n,a.anchor)}this.nextResolution_=a.targetResolution,this.targetResolution_=e,this.applyTargetState_(!0)}if(a.sourceRotation!==void 0&&a.targetRotation!==void 0){let e=c===1?Ji(a.targetRotation+Math.PI,2*Math.PI)-Math.PI:a.sourceRotation+c*(a.targetRotation-a.sourceRotation);if(a.anchor){let t=this.constraints_.rotation(e,!0);this.targetCenter_=this.calculateCenterRotate(t,a.anchor)}this.nextRotation_=a.targetRotation,this.targetRotation_=e}if(this.applyTargetState_(!0),t=!0,!a.complete)break}if(i){this.animations_[n]=null,this.setHint(W.ANIMATING,-1),this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN;let e=r[0].callback;e&&Gp(e,!0)}}this.animations_=this.animations_.filter(Boolean),t&&this.updateAnimationKey_===void 0&&(this.updateAnimationKey_=requestAnimationFrame(this.updateAnimations_.bind(this)))}calculateCenterRotate(e,t){let n,r=this.getCenterInternal();return r!==void 0&&(n=[r[0]-t[0],r[1]-t[1]],oa(n,e-this.getRotation()),ia(n,t)),n}calculateCenterZoom(e,t){let n,r=this.getCenterInternal(),i=this.getResolution();return r!==void 0&&i!==void 0&&(n=[t[0]-e*(t[0]-r[0])/i,t[1]-e*(t[1]-r[1])/i]),n}getViewportSize_(e){let t=this.viewportSize_;if(e){let n=t[0],r=t[1];return[Math.abs(n*Math.cos(e))+Math.abs(r*Math.sin(e)),Math.abs(n*Math.sin(e))+Math.abs(r*Math.cos(e))]}return t}setViewportSize(e){this.viewportSize_=Array.isArray(e)?e.slice():[100,100],this.getAnimating()||this.resolveConstraints(0)}getCenter(){let e=this.getCenterInternal();return e&&Po(e,this.getProjection())}getCenterInternal(){return this.get(Dp.CENTER)}getConstraints(){return this.constraints_}getConstrainResolution(){return this.get(`constrainResolution`)}getHints(e){return e===void 0?this.hints_.slice():(e[0]=this.hints_[0],e[1]=this.hints_[1],e)}calculateExtent(e){return Io(this.calculateExtentInternal(e),this.getProjection())}calculateExtentInternal(e){e||=this.getViewportSizeMinusPadding_();let t=this.getCenterInternal();B(t,`The view center is not defined`);let n=this.getResolution();B(n!==void 0,`The view resolution is not defined`);let r=this.getRotation();return B(r!==void 0,`The view rotation is not defined`),Ai(t,n,r,e)}getMaxResolution(){return this.maxResolution_}getMinResolution(){return this.minResolution_}getMaxZoom(){return this.getZoomForResolution(this.minResolution_)}setMaxZoom(e){this.applyOptions_(this.getUpdatedOptions_({maxZoom:e}))}getMinZoom(){return this.getZoomForResolution(this.maxResolution_)}setMinZoom(e){this.applyOptions_(this.getUpdatedOptions_({minZoom:e}))}setConstrainResolution(e){this.applyOptions_(this.getUpdatedOptions_({constrainResolution:e}))}getProjection(){return this.projection_}getResolution(){return this.get(Dp.RESOLUTION)}getResolutions(){return this.resolutions_}getResolutionForExtent(e,t){return this.getResolutionForExtentInternal(Lo(e,this.getProjection()),t)}getResolutionForExtentInternal(e,t){t||=this.getViewportSizeMinusPadding_();let n=V(e)/t[0],r=Mi(e)/t[1];return Math.max(n,r)}getResolutionForValueFunction(e){e||=2;let t=this.getConstrainedResolution(this.maxResolution_),n=this.minResolution_,r=Math.log(t/n)/Math.log(e);return(function(n){return t/e**+(n*r)})}getRotation(){return this.get(Dp.ROTATION)}getValueForResolutionFunction(e){let t=Math.log(e||2),n=this.getConstrainedResolution(this.maxResolution_),r=this.minResolution_,i=Math.log(n/r)/t;return(function(e){return Math.log(n/e)/t/i})}getViewportSizeMinusPadding_(e){let t=this.getViewportSize_(e),n=this.padding_;return n&&(t=[t[0]-n[1]-n[3],t[1]-n[0]-n[2]]),t}getState(){let e=this.getProjection(),t=this.getResolution(),n=this.getRotation(),r=this.getCenterInternal(),i=this.padding_;if(i){let e=this.getViewportSizeMinusPadding_();r=Xp(r,this.getViewportSize_(),[e[0]/2+i[3],e[1]/2+i[0]],t,n)}return{center:r.slice(0),projection:e===void 0?null:e,resolution:t,nextCenter:this.nextCenter_,nextResolution:this.nextResolution_,nextRotation:this.nextRotation_,rotation:n,zoom:this.getZoom()}}getViewStateAndExtent(){return{viewState:this.getState(),extent:this.calculateExtent()}}getZoom(){let e,t=this.getResolution();return t!==void 0&&(e=this.getZoomForResolution(t)),e}getZoomForResolution(e){let t=this.minZoom_||0,n,r;if(this.resolutions_){let i=Nr(this.resolutions_,e,1);t=i,n=this.resolutions_[i],r=i==this.resolutions_.length-1?2:n/this.resolutions_[i+1]}else n=this.maxResolution_,r=this.zoomFactor_;return t+Math.log(n/e)/Math.log(r)}getResolutionForZoom(e){if(this.resolutions_?.length){if(this.resolutions_.length===1)return this.resolutions_[0];let t=H(Math.floor(e),0,this.resolutions_.length-2),n=this.resolutions_[t]/this.resolutions_[t+1];return this.resolutions_[t]/n**+H(e-t,0,1)}return this.maxResolution_/this.zoomFactor_**+(e-this.minZoom_)}fit(e,t){let n;if(B(Array.isArray(e)||typeof e.getSimplifiedGeometry==`function`,"Invalid extent or geometry provided as `geometry`"),Array.isArray(e))B(!Li(e),"Cannot fit empty extent provided as `geometry`"),n=ic(Lo(e,this.getProjection()));else if(e.getType()===`Circle`){let t=Lo(e.getExtent(),this.getProjection());n=ic(t),n.rotate(this.getRotation(),Oi(t))}else{let t=No();n=t?e.clone().transform(t,this.getProjection()):e}this.fitInternal(n,t)}rotatedExtentForGeometry(e){let t=this.getRotation(),n=Math.cos(t),r=Math.sin(-t),i=e.getFlatCoordinates(),a=e.getStride(),o=1/0,s=1/0,c=-1/0,l=-1/0;for(let e=0,t=i.length;e<t;e+=a){let t=i[e]*n-i[e+1]*r,a=i[e]*r+i[e+1]*n;o=Math.min(o,t),s=Math.min(s,a),c=Math.max(c,t),l=Math.max(l,a)}return[o,s,c,l]}fitInternal(e,t){t||={};let n=t.size;n||=this.getViewportSizeMinusPadding_();let r=t.padding===void 0?[0,0,0,0]:t.padding,i=t.nearest===void 0?!1:t.nearest,a;a=t.minResolution===void 0?t.maxZoom===void 0?0:this.getResolutionForZoom(t.maxZoom):t.minResolution;let o=this.rotatedExtentForGeometry(e),s=this.getResolutionForExtentInternal(o,[n[0]-r[1]-r[3],n[1]-r[0]-r[2]]);s=isNaN(s)?a:Math.max(s,a),s=this.getConstrainedResolution(s,i?0:1);let c=this.getRotation(),l=Math.sin(c),u=Math.cos(c),d=Oi(o);d[0]+=(r[1]-r[3])/2*s,d[1]+=(r[0]-r[2])/2*s;let f=d[0]*u-d[1]*l,p=d[1]*u+d[0]*l,m=this.getConstrainedCenter([f,p],s),h=t.callback?t.callback:Br;t.duration===void 0?(this.targetResolution_=s,this.targetCenter_=m,this.applyTargetState_(!1,!0),Gp(h,!0)):this.animateInternal({resolution:s,center:m,duration:t.duration,easing:t.easing},h)}centerOn(e,t,n){this.centerOnInternal(Fo(e,this.getProjection()),t,n)}centerOnInternal(e,t,n){this.setCenterInternal(Xp(e,t,n,this.getResolution(),this.getRotation()))}calculateCenterShift(e,t,n,r){let i,a=this.padding_;if(a&&e){let o=this.getViewportSizeMinusPadding_(-n),s=Xp(e,r,[o[0]/2+a[3],o[1]/2+a[0]],t,n);i=[e[0]-s[0],e[1]-s[1]]}return i}isDef(){return!!this.getCenterInternal()&&this.getResolution()!==void 0}adjustCenter(e){let t=Po(this.targetCenter_,this.getProjection());this.setCenter([t[0]+e[0],t[1]+e[1]])}adjustCenterInternal(e){let t=this.targetCenter_;this.setCenterInternal([t[0]+e[0],t[1]+e[1]])}adjustResolution(e,t){t&&=Fo(t,this.getProjection()),this.adjustResolutionInternal(e,t)}adjustResolutionInternal(e,t){let n=this.getAnimating()||this.getInteracting(),r=this.getViewportSize_(this.getRotation()),i=this.constraints_.resolution(this.targetResolution_*e,0,r,n);t&&(this.targetCenter_=this.calculateCenterZoom(i,t)),this.targetResolution_*=e,this.applyTargetState_()}adjustZoom(e,t){this.adjustResolution(this.zoomFactor_**+-e,t)}adjustRotation(e,t){t&&=Fo(t,this.getProjection()),this.adjustRotationInternal(e,t)}adjustRotationInternal(e,t){let n=this.getAnimating()||this.getInteracting(),r=this.constraints_.rotation(this.targetRotation_+e,n);t&&(this.targetCenter_=this.calculateCenterRotate(r,t)),this.targetRotation_+=e,this.applyTargetState_()}setCenter(e){this.setCenterInternal(e&&Fo(e,this.getProjection()))}setCenterInternal(e){this.targetCenter_=e,this.applyTargetState_()}setHint(e,t){return this.hints_[e]+=t,this.changed(),this.hints_[e]}setResolution(e){this.targetResolution_=e,this.applyTargetState_()}setRotation(e){this.targetRotation_=e,this.applyTargetState_()}setZoom(e){this.setResolution(this.getResolutionForZoom(e))}applyTargetState_(e,t){let n=this.getAnimating()||this.getInteracting()||t,r=this.constraints_.rotation(this.targetRotation_,n),i=this.getViewportSize_(r),a=this.constraints_.resolution(this.targetResolution_,0,i,n),o=this.constraints_.center(this.targetCenter_,a,i,n,this.calculateCenterShift(this.targetCenter_,a,r,i));this.get(Dp.ROTATION)!==r&&this.set(Dp.ROTATION,r),this.get(Dp.RESOLUTION)!==a&&(this.set(Dp.RESOLUTION,a),this.set(`zoom`,this.getZoom(),!0)),(!o||!this.get(Dp.CENTER)||!aa(this.get(Dp.CENTER),o))&&this.set(Dp.CENTER,o),this.getAnimating()&&!e&&this.cancelAnimations(),this.cancelAnchor_=void 0}resolveConstraints(e,t,n){e=e===void 0?200:e;let r=t||0,i=this.constraints_.rotation(this.targetRotation_),a=this.getViewportSize_(i),o=this.constraints_.resolution(this.targetResolution_,r,a),s=this.constraints_.center(this.targetCenter_,o,a,!1,this.calculateCenterShift(this.targetCenter_,o,i,a));if(e===0&&!this.cancelAnchor_){this.targetResolution_=o,this.targetRotation_=i,this.targetCenter_=s,this.applyTargetState_();return}n||=e===0?this.cancelAnchor_:void 0,this.cancelAnchor_=void 0,(this.getResolution()!==o||this.getRotation()!==i||!this.getCenterInternal()||!aa(this.getCenterInternal(),s))&&(this.getAnimating()&&this.cancelAnimations(),this.animateInternal({rotation:i,center:s,resolution:o,duration:e,easing:jp,anchor:n}))}beginInteraction(){this.resolveConstraints(0),this.setHint(W.INTERACTING,1)}endInteraction(e,t,n){n&&=Fo(n,this.getProjection()),this.endInteractionInternal(e,t,n)}endInteractionInternal(e,t,n){this.getInteracting()&&(this.setHint(W.INTERACTING,-1),this.resolveConstraints(e,t,n))}getConstrainedCenter(e,t){let n=this.getViewportSize_(this.getRotation());return this.constraints_.center(e,t||this.getResolution(),n)}getConstrainedZoom(e,t){let n=this.getResolutionForZoom(e);return this.getZoomForResolution(this.getConstrainedResolution(n,t))}getConstrainedResolution(e,t){t||=0;let n=this.getViewportSize_(this.getRotation());return this.constraints_.resolution(e,t,n)}};function Gp(e,t){setTimeout(function(){e(t)},0)}function Kp(e){if(e.extent!==void 0){let t=e.smoothExtentConstraint===void 0?!0:e.smoothExtentConstraint;return Op(e.extent,e.constrainOnlyCenter,t)}let t=Co(e.projection,`EPSG:3857`);if(e.multiWorld!==!0&&t.isGlobal()){let e=t.getExtent().slice();return e[0]=-1/0,e[2]=1/0,Op(e,!1,!1)}return kp}function qp(e){let t,n,r,i=e.minZoom===void 0?Up:e.minZoom,a=e.maxZoom===void 0?28:e.maxZoom,o=e.zoomFactor===void 0?2:e.zoomFactor,s=e.multiWorld===void 0?!1:e.multiWorld,c=e.smoothResolutionConstraint===void 0?!0:e.smoothResolutionConstraint,l=e.showFullExtent===void 0?!1:e.showFullExtent,u=Co(e.projection,`EPSG:3857`),d=u.getExtent(),f=e.constrainOnlyCenter,p=e.extent;if(!s&&!p&&u.isGlobal()&&(f=!1,p=d),e.resolutions!==void 0){let o=e.resolutions;n=o[i],r=o[a]===void 0?o[o.length-1]:o[a],t=e.constrainResolution?Ip(o,c,!f&&p,l):Rp(n,r,c,!f&&p,l)}else{let s=(d?Math.max(V(d),Mi(d)):360*da.degrees/u.getMetersPerUnit())/256/2**Up,m=s/2**(28-Up);n=e.maxResolution,n===void 0?n=s/o**+i:i=0,r=e.minResolution,r===void 0&&(r=e.maxZoom===void 0?m:e.maxResolution===void 0?s/o**+a:n/o**+a),a=i+Math.floor(Math.log(n/r)/Math.log(o)),r=n/o**+(a-i),t=e.constrainResolution?Lp(o,n,r,c,!f&&p,l):Rp(n,r,c,!f&&p,l)}return{constraint:t,maxResolution:n,minResolution:r,minZoom:i,zoomFactor:o}}function Jp(e){if(e.enableRotation===void 0||e.enableRotation){let t=e.constrainRotation;return t===void 0||t===!0?Hp():t===!1?Bp:typeof t==`number`?Vp(t):Bp}return zp}function Yp(e){return!(e.sourceCenter&&e.targetCenter&&!aa(e.sourceCenter,e.targetCenter)||e.sourceResolution!==e.targetResolution||e.sourceRotation!==e.targetRotation)}function Xp(e,t,n,r,i){let a=Math.cos(-i),o=Math.sin(-i),s=e[0]*a-e[1]*o,c=e[1]*a+e[0]*o;return s+=(t[0]/2-n[0])*r,c+=(n[1]-t[1]/2)*r,o=-o,[s*a-c*o,c*a+s*o]}var Z={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`},Zp=class extends Qr{constructor(e){super(),this.on,this.once,this.un,this.background_=e.background;let t=Object.assign({},e);typeof e.properties==`object`&&(delete t.properties,Object.assign(t,e.properties)),t[Z.OPACITY]=e.opacity===void 0?1:e.opacity,B(typeof t[Z.OPACITY]==`number`,`Layer opacity must be a number`),t[Z.VISIBLE]=e.visible===void 0?!0:e.visible,t[Z.Z_INDEX]=e.zIndex,t[Z.MAX_RESOLUTION]=e.maxResolution===void 0?1/0:e.maxResolution,t[Z.MIN_RESOLUTION]=e.minResolution===void 0?0:e.minResolution,t[Z.MIN_ZOOM]=e.minZoom===void 0?-1/0:e.minZoom,t[Z.MAX_ZOOM]=e.maxZoom===void 0?1/0:e.maxZoom,this.className_=t.className===void 0?`ol-layer`:t.className,delete t.className,this.setProperties(t),this.state_=null}getBackground(){return this.background_}getClassName(){return this.className_}getLayerState(e){let t=this.state_||{layer:this,managed:e===void 0?!0:e},n=this.getZIndex();return t.opacity=H(Math.round(this.getOpacity()*100)/100,0,1),t.visible=this.getVisible(),t.extent=this.getExtent(),t.zIndex=n===void 0&&!t.managed?1/0:n,t.maxResolution=this.getMaxResolution(),t.minResolution=Math.max(this.getMinResolution(),0),t.minZoom=this.getMinZoom(),t.maxZoom=this.getMaxZoom(),this.state_=t,t}getLayersArray(e){return R()}getLayerStatesArray(e){return R()}getExtent(){return this.get(Z.EXTENT)}getMaxResolution(){return this.get(Z.MAX_RESOLUTION)}getMinResolution(){return this.get(Z.MIN_RESOLUTION)}getMinZoom(){return this.get(Z.MIN_ZOOM)}getMaxZoom(){return this.get(Z.MAX_ZOOM)}getOpacity(){return this.get(Z.OPACITY)}getSourceState(){return R()}getVisible(){return this.get(Z.VISIBLE)}getZIndex(){return this.get(Z.Z_INDEX)}setBackground(e){this.background_=e,this.changed()}setExtent(e){this.set(Z.EXTENT,e)}setMaxResolution(e){this.set(Z.MAX_RESOLUTION,e)}setMinResolution(e){this.set(Z.MIN_RESOLUTION,e)}setMaxZoom(e){this.set(Z.MAX_ZOOM,e)}setMinZoom(e){this.set(Z.MIN_ZOOM,e)}setOpacity(e){B(typeof e==`number`,`Layer opacity must be a number`),this.set(Z.OPACITY,e)}setVisible(e){this.set(Z.VISIBLE,e)}setZIndex(e){this.set(Z.Z_INDEX,e)}disposeInternal(){this.state_&&=(this.state_.layer=null,null),super.disposeInternal()}},Qp=class extends Zp{constructor(e){let t=Object.assign({},e);delete t.source,super(t),this.on,this.once,this.un,this.mapPrecomposeKey_=null,this.mapRenderKey_=null,this.sourceChangeKey_=null,this.renderer_=null,this.sourceReady_=!1,this.rendered=!1,e.render&&(this.render=e.render),e.map&&this.setMap(e.map),this.addChangeListener(Z.SOURCE,this.handleSourcePropertyChange_);let n=e.source?e.source:null;this.setSource(n)}getLayersArray(e){return e||=[],e.push(this),e}getLayerStatesArray(e){return e||=[],e.push(this.getLayerState()),e}getSource(){return this.get(Z.SOURCE)||null}getRenderSource(){return this.getSource()}getSourceState(){let e=this.getSource();return e?e.getState():`undefined`}handleSourceChange_(){this.changed(),!(this.sourceReady_||this.getSource().getState()!==`ready`)&&(this.sourceReady_=!0,this.dispatchEvent(`sourceready`))}handleSourcePropertyChange_(){this.sourceChangeKey_&&=(L(this.sourceChangeKey_),null),this.sourceReady_=!1;let e=this.getSource();e&&(this.sourceChangeKey_=I(e,F.CHANGE,this.handleSourceChange_,this),e.getState()===`ready`&&(this.sourceReady_=!0,setTimeout(()=>{this.dispatchEvent(`sourceready`)},0))),this.changed()}getFeatures(e){return this.renderer_?this.renderer_.getFeatures(e):Promise.resolve([])}getData(e){return!this.renderer_||!this.rendered?null:this.renderer_.getData(e)}isVisible(e){let t,n=this.getMapInternal();!e&&n&&(e=n.getView()),t=e instanceof Wp?{viewState:e.getState(),extent:e.calculateExtent()}:e,!t.layerStatesArray&&n&&(t.layerStatesArray=n.getLayerGroup().getLayerStatesArray());let r;if(t.layerStatesArray){if(r=t.layerStatesArray.find(e=>e.layer===this),!r)return!1}else r=this.getLayerState();let i=this.getExtent();return $p(r,t.viewState)&&(!i||Ii(i,t.extent))}getAttributions(e){if(!this.isVisible(e))return[];let t=this.getSource()?.getAttributions();if(!t)return[];let n=t(e instanceof Wp?e.getViewStateAndExtent():e);return Array.isArray(n)||(n=[n]),n}render(e,t){let n=this.getRenderer();return n.prepareFrame(e)?(this.rendered=!0,n.renderFrame(e,t)):null}unrender(){this.rendered=!1}getDeclutter(){}renderDeclutter(e,t){}renderDeferred(e){let t=this.getRenderer();t&&t.renderDeferred(e)}setMapInternal(e){e||this.unrender(),this.set(Z.MAP,e)}getMapInternal(){return this.get(Z.MAP)}setMap(e){this.mapPrecomposeKey_&&=(L(this.mapPrecomposeKey_),null),e||this.changed(),this.mapRenderKey_&&=(L(this.mapRenderKey_),null),e&&(this.mapPrecomposeKey_=I(e,uc.PRECOMPOSE,this.handlePrecompose_,this),this.mapRenderKey_=I(this,F.CHANGE,e.render,e),this.changed())}handlePrecompose_(e){let t=e.frameState.layerStatesArray,n=this.getLayerState(!1);B(!t.some(e=>e.layer===n.layer),"A layer can only be added to the map once. Use either `layer.setMap()` or `map.addLayer()`, not both."),t.push(n)}setSource(e){this.set(Z.SOURCE,e)}getRenderer(){return this.renderer_||=this.createRenderer(),this.renderer_}hasRenderer(){return!!this.renderer_}createRenderer(){return null}clearRenderer(){this.renderer_&&(this.renderer_.dispose(),delete this.renderer_)}disposeInternal(){this.clearRenderer(),this.setSource(null),super.disposeInternal()}};function $p(e,t){if(!e.visible)return!1;let n=t.resolution;if(n<e.minResolution||n>=e.maxResolution)return!1;let r=t.zoom;return r>e.minZoom&&r<=e.maxZoom}var em={RENDER_ORDER:`renderOrder`},tm=class extends Qp{constructor(e){e||={};let t=Object.assign({},e);delete t.style,delete t.renderBuffer,delete t.updateWhileAnimating,delete t.updateWhileInteracting,super(t),this.declutter_=e.declutter?String(e.declutter):void 0,this.renderBuffer_=e.renderBuffer===void 0?100:e.renderBuffer,this.style_=null,this.styleFunction_=void 0,this.setStyle(e.style),this.updateWhileAnimating_=e.updateWhileAnimating===void 0?!1:e.updateWhileAnimating,this.updateWhileInteracting_=e.updateWhileInteracting===void 0?!1:e.updateWhileInteracting}getDeclutter(){return this.declutter_}getFeatures(e){return super.getFeatures(e)}getRenderBuffer(){return this.renderBuffer_}getRenderOrder(){return this.get(em.RENDER_ORDER)}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}getUpdateWhileAnimating(){return this.updateWhileAnimating_}getUpdateWhileInteracting(){return this.updateWhileInteracting_}renderDeclutter(e,t){let n=this.getDeclutter();n in e.declutter||(e.declutter[n]=new xu(9)),this.getRenderer().renderDeclutter(e,t)}setRenderOrder(e){this.set(em.RENDER_ORDER,e)}setStyle(e){this.style_=e===void 0?$u:e;let t=nm(e);this.styleFunction_=e===null?void 0:Zu(t),this.changed()}setDeclutter(e){this.declutter_=e?String(e):void 0,this.changed()}};function nm(e){if(e===void 0)return $u;if(!e)return null;if(typeof e==`function`||e instanceof Xu)return e;if(!Array.isArray(e))return Jf([e]);if(e.length===0)return[];let t=e.length,n=e[0];if(n instanceof Xu){let n=Array(t);for(let r=0;r<t;++r){let t=e[r];if(!(t instanceof Xu))throw Error(`Expected a list of style instances`);n[r]=t}return n}if(`style`in n){let n=Array(t);for(let r=0;r<t;++r){let t=e[r];if(!(`style`in t))throw Error(`Expected a list of rules with a style property`);n[r]=t}return qf(n)}return Jf(e)}var rm=class extends tm{constructor(e){super(e)}createRenderer(){return new Xd(this)}},Q={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4},im=class extends Kr{constructor(e,t,n){super(),n||={},this.tileCoord=e,this.state=t,this.key=``,this.transition_=n.transition===void 0?250:n.transition,this.transitionStarts_={},this.interpolate=!!n.interpolate}changed(){this.dispatchEvent(F.CHANGE)}release(){this.setState(Q.EMPTY)}getKey(){return this.key+`/`+this.tileCoord}getTileCoord(){return this.tileCoord}getState(){return this.state}setState(e){if(this.state!==Q.EMPTY){if(this.state!==Q.ERROR&&this.state>e)throw Error(`Tile load sequence violation`);this.state=e,this.changed()}}load(){R()}getAlpha(e,t){if(!this.transition_)return 1;let n=this.transitionStarts_[e];if(!n)n=t,this.transitionStarts_[e]=n;else if(n===-1)return 1;let r=t-n+1e3/60;return r>=this.transition_?1:Ap(r/this.transition_)}inTransition(e){return this.transition_?this.transitionStarts_[e]!==-1:!1}endTransition(e){this.transition_&&(this.transitionStarts_[e]=-1)}disposeInternal(){this.release(),super.disposeInternal()}},am=class extends im{constructor(e,t,n,r,i,a){super(e,t,a),this.crossOrigin_=r?.crossOrigin,this.referrerPolicy_=r?.referrerPolicy,this.src_=n,this.key=n,this.image_,hc?this.image_=new OffscreenCanvas(1,1):(this.image_=new Image,this.crossOrigin_!==null&&(this.image_.crossOrigin=this.crossOrigin_),this.referrerPolicy_!==void 0&&(this.image_.referrerPolicy=this.referrerPolicy_)),this.unlisten_=null,this.tileLoadFunction_=i}getImage(){return this.image_}setImage(e){this.image_=e,this.state=Q.LOADED,this.unlistenImage_(),this.changed()}getCrossOrigin(){return this.crossOrigin_}getReferrerPolicy(){return this.referrerPolicy_}handleImageError_(){this.state=Q.ERROR,this.unlistenImage_(),this.image_=om(),this.changed()}handleImageLoad_(){if(hc)this.state=Q.LOADED;else{let e=this.image_;e.naturalWidth&&e.naturalHeight?this.state=Q.LOADED:this.state=Q.EMPTY}this.unlistenImage_(),this.changed()}load(){this.state==Q.ERROR&&(this.state=Q.IDLE,this.image_=new Image,this.crossOrigin_!==null&&(this.image_.crossOrigin=this.crossOrigin_),this.referrerPolicy_!==void 0&&(this.image_.referrerPolicy=this.referrerPolicy_)),this.state==Q.IDLE&&(this.state=Q.LOADING,this.changed(),this.tileLoadFunction_(this,this.src_),this.unlisten_=$c(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this)))}unlistenImage_(){this.unlisten_&&=(this.unlisten_(),null)}disposeInternal(){this.unlistenImage_(),this.image_=null,super.disposeInternal()}};function om(){let e=vc(1,1);return e.fillStyle=`rgba(0,0,0,0)`,e.fillRect(0,0,1,1),e.canvas}var sm=class{constructor(e,t,n){this.decay_=e,this.minVelocity_=t,this.delay_=n,this.points_=[],this.angle_=0,this.initialVelocity_=0}begin(){this.points_.length=0,this.angle_=0,this.initialVelocity_=0}update(e,t){this.points_.push(e,t,Date.now())}end(){if(this.points_.length<6)return!1;let e=Date.now()-this.delay_,t=this.points_.length-3;if(this.points_[t+2]<e)return!1;let n=t-3;for(;n>0&&this.points_[n+2]>e;)n-=3;let r=this.points_[t+2]-this.points_[n+2];if(r<1e3/60)return!1;let i=this.points_[t]-this.points_[n],a=this.points_[t+1]-this.points_[n+1];return this.angle_=Math.atan2(a,i),this.initialVelocity_=Math.sqrt(i*i+a*a)/r,this.initialVelocity_>this.minVelocity_}getDistance(){return(this.minVelocity_-this.initialVelocity_)/this.decay_}getAngle(){return this.angle_}},cm=class extends Gr{constructor(e,t,n){super(e),this.map=t,this.frameState=n===void 0?null:n}},lm=class extends cm{constructor(e,t,n,r,i,a){super(e,t,i),this.originalEvent=n,this.pixel_=null,this.coordinate_=null,this.dragging=r===void 0?!1:r,this.activePointers=a}get pixel(){return this.pixel_||=this.map.getEventPixel(this.originalEvent),this.pixel_}set pixel(e){this.pixel_=e}get coordinate(){return this.coordinate_||=this.map.getCoordinateFromPixel(this.pixel),this.coordinate_}set coordinate(e){this.coordinate_=e}preventDefault(){super.preventDefault(),`preventDefault`in this.originalEvent&&this.originalEvent.preventDefault()}stopPropagation(){super.stopPropagation(),`stopPropagation`in this.originalEvent&&this.originalEvent.stopPropagation()}},$={SINGLECLICK:`singleclick`,CLICK:F.CLICK,DBLCLICK:F.DBLCLICK,POINTERDRAG:`pointerdrag`,POINTERMOVE:`pointermove`,POINTERDOWN:`pointerdown`,POINTERUP:`pointerup`,POINTEROVER:`pointerover`,POINTEROUT:`pointerout`,POINTERENTER:`pointerenter`,POINTERLEAVE:`pointerleave`,POINTERCANCEL:`pointercancel`},um={POINTERMOVE:`pointermove`,POINTERDOWN:`pointerdown`,POINTERUP:`pointerup`,POINTEROVER:`pointerover`,POINTEROUT:`pointerout`,POINTERENTER:`pointerenter`,POINTERLEAVE:`pointerleave`,POINTERCANCEL:`pointercancel`},dm=class extends Kr{constructor(e,t){super(e),this.map_=e,this.clickTimeoutId_,this.emulateClicks_=!1,this.dragging_=!1,this.dragListenerKeys_=[],this.moveTolerance_=t===void 0?1:t,this.down_=null;let n=this.map_.getViewport();this.activePointers_=[],this.trackedTouches_={},this.element_=n,this.pointerdownListenerKey_=I(n,um.POINTERDOWN,this.handlePointerDown_,this),this.originalPointerMoveEvent_,this.relayedListenerKey_=I(n,um.POINTERMOVE,this.relayMoveEvent_,this),this.boundHandleTouchMove_=this.handleTouchMove_.bind(this),this.element_.addEventListener(F.TOUCHMOVE,this.boundHandleTouchMove_,_c?{passive:!1}:!1)}emulateClick_(e){let t=new lm($.CLICK,this.map_,e);this.dispatchEvent(t),this.clickTimeoutId_===void 0?this.clickTimeoutId_=setTimeout(()=>{this.clickTimeoutId_=void 0;let t=new lm($.SINGLECLICK,this.map_,e);this.dispatchEvent(t)},250):(clearTimeout(this.clickTimeoutId_),this.clickTimeoutId_=void 0,t=new lm($.DBLCLICK,this.map_,e),this.dispatchEvent(t))}updateActivePointers_(e){let t=e,n=t.pointerId;if(t.type==$.POINTERUP||t.type==$.POINTERCANCEL){delete this.trackedTouches_[n];for(let e in this.trackedTouches_)if(this.trackedTouches_[e].target!==t.target){delete this.trackedTouches_[e];break}}else (t.type==$.POINTERDOWN||t.type==$.POINTERMOVE)&&(this.trackedTouches_[n]=t);this.activePointers_=Object.values(this.trackedTouches_)}handlePointerUp_(e){this.updateActivePointers_(e);let t=new lm($.POINTERUP,this.map_,e,void 0,void 0,this.activePointers_);this.dispatchEvent(t),this.emulateClicks_&&!t.defaultPrevented&&!this.dragging_&&this.isMouseActionButton_(e)&&this.emulateClick_(this.down_),this.activePointers_.length===0&&(this.dragListenerKeys_.forEach(L),this.dragListenerKeys_.length=0,this.dragging_=!1,this.down_=null)}isMouseActionButton_(e){return e.button===0}handlePointerDown_(e){this.emulateClicks_=this.activePointers_.length===0,this.updateActivePointers_(e);let t=new lm($.POINTERDOWN,this.map_,e,void 0,void 0,this.activePointers_);if(this.dispatchEvent(t),this.down_=new PointerEvent(e.type,e),Object.defineProperty(this.down_,`target`,{writable:!1,value:e.target}),this.dragListenerKeys_.length===0){let e=this.map_.getOwnerDocument();this.dragListenerKeys_.push(I(e,$.POINTERMOVE,this.handlePointerMove_,this),I(e,$.POINTERUP,this.handlePointerUp_,this),I(this.element_,$.POINTERCANCEL,this.handlePointerUp_,this)),this.element_.getRootNode&&this.element_.getRootNode()!==e&&this.dragListenerKeys_.push(I(this.element_.getRootNode(),$.POINTERUP,this.handlePointerUp_,this))}}handlePointerMove_(e){if(this.isMoving_(e)){this.updateActivePointers_(e),this.dragging_=!0;let t=new lm($.POINTERDRAG,this.map_,e,this.dragging_,void 0,this.activePointers_);this.dispatchEvent(t)}}relayMoveEvent_(e){this.originalPointerMoveEvent_=e;let t=!!(this.down_&&this.isMoving_(e));this.dispatchEvent(new lm($.POINTERMOVE,this.map_,e,t))}handleTouchMove_(e){let t=this.originalPointerMoveEvent_;(!t||t.defaultPrevented)&&(typeof e.cancelable!=`boolean`||e.cancelable===!0)&&e.preventDefault()}isMoving_(e){return this.dragging_||Math.abs(e.clientX-this.down_.clientX)>this.moveTolerance_||Math.abs(e.clientY-this.down_.clientY)>this.moveTolerance_}disposeInternal(){this.relayedListenerKey_&&=(L(this.relayedListenerKey_),null),this.element_.removeEventListener(F.TOUCHMOVE,this.boundHandleTouchMove_),this.pointerdownListenerKey_&&=(L(this.pointerdownListenerKey_),null),this.dragListenerKeys_.forEach(L),this.dragListenerKeys_.length=0,this.element_=null,super.disposeInternal()}},fm={POSTRENDER:`postrender`,MOVESTART:`movestart`,MOVEEND:`moveend`,LOADSTART:`loadstart`,LOADEND:`loadend`},pm={LAYERGROUP:`layergroup`,SIZE:`size`,TARGET:`target`,VIEW:`view`},mm=1/0,hm=class{constructor(e,t){this.priorityFunction_=e,this.keyFunction_=t,this.elements_=[],this.priorities_=[],this.queuedElements_={}}clear(){this.elements_.length=0,this.priorities_.length=0,Ur(this.queuedElements_)}dequeue(){let e=this.elements_,t=this.priorities_,n=e[0];e.length==1?(e.length=0,t.length=0):(e[0]=e.pop(),t[0]=t.pop(),this.siftUp_(0));let r=this.keyFunction_(n);return delete this.queuedElements_[r],n}enqueue(e){B(!(this.keyFunction_(e)in this.queuedElements_),"Tried to enqueue an `element` that was already added to the queue");let t=this.priorityFunction_(e);return t==1/0?!1:(this.elements_.push(e),this.priorities_.push(t),this.queuedElements_[this.keyFunction_(e)]=!0,this.siftDown_(0,this.elements_.length-1),!0)}getCount(){return this.elements_.length}getLeftChildIndex_(e){return e*2+1}getRightChildIndex_(e){return e*2+2}getParentIndex_(e){return e-1>>1}heapify_(){let e;for(e=(this.elements_.length>>1)-1;e>=0;e--)this.siftUp_(e)}isEmpty(){return this.elements_.length===0}isKeyQueued(e){return e in this.queuedElements_}isQueued(e){return this.isKeyQueued(this.keyFunction_(e))}siftUp_(e){let t=this.elements_,n=this.priorities_,r=t.length,i=t[e],a=n[e],o=e;for(;e<r>>1;){let i=this.getLeftChildIndex_(e),a=this.getRightChildIndex_(e),o=a<r&&n[a]<n[i]?a:i;t[e]=t[o],n[e]=n[o],e=o}t[e]=i,n[e]=a,this.siftDown_(o,e)}siftDown_(e,t){let n=this.elements_,r=this.priorities_,i=n[t],a=r[t];for(;t>e;){let e=this.getParentIndex_(t);if(r[e]>a)n[t]=n[e],r[t]=r[e],t=e;else break}n[t]=i,r[t]=a}reprioritize(){let e=this.priorityFunction_,t=this.elements_,n=this.priorities_,r=0,i=t.length,a,o,s;for(o=0;o<i;++o)a=t[o],s=e(a),s==1/0?delete this.queuedElements_[this.keyFunction_(a)]:(n[r]=s,t[r++]=a);t.length=r,n.length=r,this.heapify_()}},gm=class extends hm{constructor(e,t){super(t=>e.apply(null,t),e=>e[0].getKey()),this.boundHandleTileChange_=this.handleTileChange.bind(this),this.tileChangeCallback_=t,this.tilesLoading_=0,this.tilesLoadingKeys_={}}enqueue(e){let t=super.enqueue(e);return t&&e[0].addEventListener(F.CHANGE,this.boundHandleTileChange_),t}getTilesLoading(){return this.tilesLoading_}handleTileChange(e){let t=e.target,n=t.getState();if(n===Q.LOADED||n===Q.ERROR||n===Q.EMPTY){n!==Q.ERROR&&t.removeEventListener(F.CHANGE,this.boundHandleTileChange_);let e=t.getKey();e in this.tilesLoadingKeys_&&(delete this.tilesLoadingKeys_[e],--this.tilesLoading_),this.tileChangeCallback_()}}loadMoreTiles(e,t){let n=0;for(;this.tilesLoading_<e&&n<t&&this.getCount()>0;){let e=this.dequeue()[0],t=e.getKey();e.getState()===Q.IDLE&&!(t in this.tilesLoadingKeys_)&&(this.tilesLoadingKeys_[t]=!0,++this.tilesLoading_,++n,e.load())}}};function _m(e,t,n,r,i){if(!e||!(n in e.wantedTiles)||!e.wantedTiles[n][t.getKey()])return mm;let a=e.viewState.center,o=r[0]-a[0],s=r[1]-a[1];return 65536*Math.log(i)+Math.sqrt(o*o+s*s)/i}var vm=class extends Qr{constructor(e){super();let t=e.element;t&&!e.target&&!t.style.pointerEvents&&(t.style.pointerEvents=`auto`),this.element=t||null,this.target_=null,this.map_=null,this.listenerKeys=[],e.render&&(this.render=e.render),e.target&&this.setTarget(e.target)}disposeInternal(){this.element?.remove(),super.disposeInternal()}getMap(){return this.map_}setMap(e){this.map_&&this.element?.remove();for(let e=0,t=this.listenerKeys.length;e<t;++e)L(this.listenerKeys[e]);if(this.listenerKeys.length=0,this.map_=e,e){let t=this.target_??e.getOverlayContainerStopEvent();this.element&&t.appendChild(this.element),this.render!==Br&&this.listenerKeys.push(I(e,fm.POSTRENDER,this.render,this)),e.render()}}render(e){}setTarget(e){this.target_=typeof e==`string`?document.getElementById(e):e}},ym=class extends vm{constructor(e){e||={},super({element:document.createElement(`div`),render:e.render,target:e.target}),this.ulElement_=document.createElement(`ul`),this.collapsed_=e.collapsed===void 0?!0:e.collapsed,this.userCollapsed_=this.collapsed_,this.overrideCollapsible_=e.collapsible!==void 0,this.collapsible_=e.collapsible===void 0?!0:e.collapsible,this.collapsible_||(this.collapsed_=!1),this.attributions_=e.attributions;let t=e.className===void 0?`ol-attribution`:e.className,n=e.tipLabel===void 0?`Attributions`:e.tipLabel,r=e.expandClassName===void 0?t+`-expand`:e.expandClassName,i=e.collapseLabel===void 0?`›`:e.collapseLabel,a=e.collapseClassName===void 0?t+`-collapse`:e.collapseClassName;typeof i==`string`?(this.collapseLabel_=document.createElement(`span`),this.collapseLabel_.textContent=i,this.collapseLabel_.className=a):this.collapseLabel_=i;let o=e.label===void 0?`i`:e.label;typeof o==`string`?(this.label_=document.createElement(`span`),this.label_.textContent=o,this.label_.className=r):this.label_=o;let s=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=n,this.toggleButton_.appendChild(s),this.toggleButton_.addEventListener(F.CLICK,this.handleClick_.bind(this),!1);let c=t+` `+hl+` `+gl+(this.collapsed_&&this.collapsible_?` `+_l:``)+(this.collapsible_?``:` ol-uncollapsible`),l=this.element;l.className=c,l.appendChild(this.toggleButton_),l.appendChild(this.ulElement_),this.renderedAttributions_=[],this.renderedVisible_=!0}collectSourceAttributions_(e){let t=this.getMap().getAllLayers(),n=new Set(t.flatMap(t=>t.getAttributions(e)));if(this.attributions_!==void 0&&(Array.isArray(this.attributions_)?this.attributions_.forEach(e=>n.add(e)):n.add(this.attributions_)),!this.overrideCollapsible_){let e=!t.some(e=>e.getSource()?.getAttributionsCollapsible()===!1);this.setCollapsible(e)}return Array.from(n)}async updateElement_(e){if(!e){this.renderedVisible_&&=(this.element.style.display=`none`,!1);return}let t=await Promise.all(this.collectSourceAttributions_(e).map(e=>Hr(()=>e))),n=t.length>0;if(this.renderedVisible_!=n&&(this.element.style.display=n?``:`none`,this.renderedVisible_=n),!Ir(t,this.renderedAttributions_)){Tc(this.ulElement_);for(let e=0,n=t.length;e<n;++e){let n=document.createElement(`li`);n.innerHTML=t[e],this.ulElement_.appendChild(n)}this.renderedAttributions_=t}}handleClick_(e){e.preventDefault(),this.handleToggle_(),this.userCollapsed_=this.collapsed_}handleToggle_(){this.element.classList.toggle(_l),this.collapsed_?wc(this.collapseLabel_,this.label_):wc(this.label_,this.collapseLabel_),this.collapsed_=!this.collapsed_,this.toggleButton_.setAttribute(`aria-expanded`,String(!this.collapsed_))}getCollapsible(){return this.collapsible_}setCollapsible(e){this.collapsible_!==e&&(this.collapsible_=e,this.element.classList.toggle(`ol-uncollapsible`),this.userCollapsed_&&this.handleToggle_())}setCollapsed(e){this.userCollapsed_=e,!(!this.collapsible_||this.collapsed_===e)&&this.handleToggle_()}getCollapsed(){return this.collapsed_}render(e){this.updateElement_(e.frameState)}},bm=class extends vm{constructor(e){e||={},super({element:document.createElement(`div`),render:e.render,target:e.target});let t=e.className===void 0?`ol-rotate`:e.className,n=e.label===void 0?`⇧`:e.label,r=e.compassClassName===void 0?`ol-compass`:e.compassClassName;this.label_=null,typeof n==`string`?(this.label_=document.createElement(`span`),this.label_.className=r,this.label_.textContent=n):(this.label_=n,this.label_.classList.add(r));let i=e.tipLabel?e.tipLabel:`Reset rotation`,a=document.createElement(`button`);a.className=t+`-reset`,a.setAttribute(`type`,`button`),a.title=i,a.appendChild(this.label_),a.addEventListener(F.CLICK,this.handleClick_.bind(this),!1);let o=t+` `+hl+` `+gl,s=this.element;s.className=o,s.appendChild(a),this.callResetNorth_=e.resetNorth?e.resetNorth:void 0,this.duration_=e.duration===void 0?250:e.duration,this.autoHide_=e.autoHide===void 0?!0:e.autoHide,this.rotation_=void 0,this.autoHide_&&this.element.classList.add(pl)}handleClick_(e){e.preventDefault(),this.callResetNorth_===void 0?this.resetNorth_():this.callResetNorth_()}resetNorth_(){let e=this.getMap().getView();if(!e)return;let t=e.getRotation();t!==void 0&&(this.duration_>0&&t%(2*Math.PI)!=0?e.animate({rotation:0,duration:this.duration_,easing:jp}):e.setRotation(0))}render(e){let t=e.frameState;if(!t)return;let n=t.viewState.rotation;if(n!=this.rotation_){let e=`rotate(`+n+`rad)`;if(this.autoHide_){let e=this.element.classList.contains(pl);!e&&n===0?this.element.classList.add(pl):e&&n!==0&&this.element.classList.remove(pl)}this.label_.style.transform=e}this.rotation_=n}},xm=class extends vm{constructor(e){e||={},super({element:document.createElement(`div`),target:e.target});let t=e.className===void 0?`ol-zoom`:e.className,n=e.delta===void 0?1:e.delta,r=e.zoomInClassName===void 0?t+`-in`:e.zoomInClassName,i=e.zoomOutClassName===void 0?t+`-out`:e.zoomOutClassName,a=e.zoomInLabel===void 0?`+`:e.zoomInLabel,o=e.zoomOutLabel===void 0?`–`:e.zoomOutLabel,s=e.zoomInTipLabel===void 0?`Zoom in`:e.zoomInTipLabel,c=e.zoomOutTipLabel===void 0?`Zoom out`:e.zoomOutTipLabel,l=document.createElement(`button`);l.className=r,l.setAttribute(`type`,`button`),l.title=s,l.appendChild(typeof a==`string`?document.createTextNode(a):a),l.addEventListener(F.CLICK,this.handleClick_.bind(this,n),!1);let u=document.createElement(`button`);u.className=i,u.setAttribute(`type`,`button`),u.title=c,u.appendChild(typeof o==`string`?document.createTextNode(o):o),u.addEventListener(F.CLICK,this.handleClick_.bind(this,-n),!1);let d=t+` `+hl+` `+gl,f=this.element;f.className=d,f.appendChild(l),f.appendChild(u),this.duration_=e.duration===void 0?250:e.duration}handleClick_(e,t){t.preventDefault(),this.zoomByDelta_(e)}zoomByDelta_(e){let t=this.getMap().getView();if(!t)return;let n=t.getZoom();if(n!==void 0){let r=t.getConstrainedZoom(n+e);this.duration_>0?(t.getAnimating()&&t.cancelAnimations(),t.animate({zoom:r,duration:this.duration_,easing:jp})):t.setZoom(r)}}};function Sm(e){e||={};let t=new ti;return(e.zoom===void 0||e.zoom)&&t.push(new xm(e.zoomOptions)),(e.rotate===void 0||e.rotate)&&t.push(new bm(e.rotateOptions)),(e.attribution===void 0||e.attribution)&&t.push(new ym(e.attributionOptions)),t}var Cm={ACTIVE:`active`},wm=class extends Qr{constructor(e){super(),this.on,this.once,this.un,e&&e.handleEvent&&(this.handleEvent=e.handleEvent),this.map_=null,this.setActive(!0)}getActive(){return this.get(Cm.ACTIVE)}getMap(){return this.map_}handleEvent(e){return!0}setActive(e){this.set(Cm.ACTIVE,e)}setMap(e){this.map_=e}};function Tm(e,t,n){let r=e.getCenterInternal();if(r){let i=[r[0]+t[0],r[1]+t[1]];e.animateInternal({duration:n===void 0?250:n,easing:Np,center:e.getConstrainedCenter(i)})}}function Em(e,t,n,r){let i=e.getZoom();if(i===void 0)return;let a=e.getConstrainedZoom(i+t),o=e.getResolutionForZoom(a);e.getAnimating()&&e.cancelAnimations(),e.animate({resolution:o,anchor:n,duration:r===void 0?250:r,easing:jp})}var Dm=class extends wm{constructor(e){super(),e||={},this.delta_=e.delta?e.delta:1,this.duration_=e.duration===void 0?250:e.duration}handleEvent(e){let t=!1;if(e.type==$.DBLCLICK){let n=e.originalEvent,r=e.map,i=e.coordinate,a=n.shiftKey?-this.delta_:this.delta_;Em(r.getView(),a,i,this.duration_),n.preventDefault(),t=!0}return!t}};function Om(e){let t=arguments;return function(e){let n=!0;for(let r=0,i=t.length;r<i&&(n&&=t[r](e),n);++r);return n}}var km=function(e){let t=e.originalEvent;return t.altKey&&!(t.metaKey||t.ctrlKey)&&t.shiftKey},Am=function(e){let t=e.map.getTargetElement(),n=t.getRootNode(),r=e.map.getOwnerDocument().activeElement;return n instanceof ShadowRoot?n.host.contains(r):t.contains(r)},jm=function(e){let t=e.map.getTargetElement(),n=t.getRootNode();return(n instanceof ShadowRoot?n.host:t).hasAttribute(`tabindex`)?Am(e):!0},Mm=Rr,Nm=function(e){let t=e.originalEvent;return`pointerId`in t&&t.button==0&&!(fc&&pc&&t.ctrlKey)},Pm=function(e){let t=e.originalEvent;return!t.altKey&&!(t.metaKey||t.ctrlKey)&&!t.shiftKey},Fm=function(e){let t=e.originalEvent;return pc?t.metaKey:t.ctrlKey},Im=function(e){let t=e.originalEvent;return!t.altKey&&!(t.metaKey||t.ctrlKey)&&t.shiftKey},Lm=function(e){let t=e.originalEvent,n=t.target.tagName;return n!==`INPUT`&&n!==`SELECT`&&n!==`TEXTAREA`&&!t.target.isContentEditable},Rm=function(e){let t=e.originalEvent;return`pointerId`in t&&t.pointerType==`mouse`},zm=function(e){let t=e.originalEvent;return`pointerId`in t&&t.isPrimary&&t.button===0},Bm=class extends wm{constructor(e){e||={},super(e),e.handleDownEvent&&(this.handleDownEvent=e.handleDownEvent),e.handleDragEvent&&(this.handleDragEvent=e.handleDragEvent),e.handleMoveEvent&&(this.handleMoveEvent=e.handleMoveEvent),e.handleUpEvent&&(this.handleUpEvent=e.handleUpEvent),e.stopDown&&(this.stopDown=e.stopDown),this.handlingDownUpSequence=!1,this.targetPointers=[]}getPointerCount(){return this.targetPointers.length}handleDownEvent(e){return!1}handleDragEvent(e){}handleEvent(e){if(!e.originalEvent)return!0;let t=!1;if(this.updateTrackedPointers_(e),this.handlingDownUpSequence)e.type==$.POINTERDRAG?(this.handleDragEvent(e),e.originalEvent.preventDefault()):e.type==$.POINTERUP&&(this.handlingDownUpSequence=this.handleUpEvent(e)&&this.targetPointers.length>0);else if(e.type==$.POINTERDOWN){let n=this.handleDownEvent(e);this.handlingDownUpSequence=n,t=this.stopDown(n)}else e.type==$.POINTERMOVE&&this.handleMoveEvent(e);return!t}handleMoveEvent(e){}handleUpEvent(e){return!1}stopDown(e){return e}updateTrackedPointers_(e){e.activePointers&&(this.targetPointers=e.activePointers)}};function Vm(e){let t=e.length,n=0,r=0;for(let i=0;i<t;i++)n+=e[i].clientX,r+=e[i].clientY;return{clientX:n/t,clientY:r/t}}var Hm=class extends Bm{constructor(e){super({stopDown:zr}),e||={},this.kinetic_=e.kinetic,this.lastCentroid=null,this.lastPointersCount_,this.panning_=!1;let t=e.condition?e.condition:Om(Pm,zm);this.condition_=e.onFocusOnly?Om(jm,t):t,this.noKinetic_=!1}handleDragEvent(e){let t=e.map;this.panning_||(this.panning_=!0,t.getView().beginInteraction());let n=this.targetPointers,r=t.getEventPixel(Vm(n));if(n.length==this.lastPointersCount_){if(this.kinetic_&&this.kinetic_.update(r[0],r[1]),this.lastCentroid){let t=[this.lastCentroid[0]-r[0],r[1]-this.lastCentroid[1]],n=e.map.getView();sa(t,n.getResolution()),oa(t,n.getRotation()),n.adjustCenterInternal(t)}}else this.kinetic_&&this.kinetic_.begin();this.lastCentroid=r,this.lastPointersCount_=n.length,e.originalEvent.preventDefault()}handleUpEvent(e){let t=e.map,n=t.getView();if(this.targetPointers.length===0){if(!this.noKinetic_&&this.kinetic_&&this.kinetic_.end()){let e=this.kinetic_.getDistance(),r=this.kinetic_.getAngle(),i=n.getCenterInternal(),a=t.getPixelFromCoordinateInternal(i),o=t.getCoordinateFromPixelInternal([a[0]-e*Math.cos(r),a[1]-e*Math.sin(r)]);n.animateInternal({center:n.getConstrainedCenter(o),duration:500,easing:jp})}return this.panning_&&(this.panning_=!1,n.endInteraction()),!1}return this.kinetic_&&this.kinetic_.begin(),this.lastCentroid=null,!0}handleDownEvent(e){if(this.targetPointers.length>0&&this.condition_(e)){let t=e.map.getView();return this.lastCentroid=null,t.getAnimating()&&t.cancelAnimations(),this.kinetic_&&this.kinetic_.begin(),this.noKinetic_=this.targetPointers.length>1,!0}return!1}},Um=class extends Bm{constructor(e){e||={},super({stopDown:zr}),this.condition_=e.condition?e.condition:km,this.lastAngle_=void 0,this.duration_=e.duration===void 0?250:e.duration}handleDragEvent(e){if(!Rm(e))return;let t=e.map,n=t.getView();if(n.getConstraints().rotation===zp)return;let r=t.getSize(),i=e.pixel,a=Math.atan2(r[1]/2-i[1],i[0]-r[0]/2);if(this.lastAngle_!==void 0){let e=a-this.lastAngle_;n.adjustRotationInternal(-e)}this.lastAngle_=a}handleUpEvent(e){return Rm(e)?(e.map.getView().endInteraction(this.duration_),!1):!0}handleDownEvent(e){return Rm(e)&&Nm(e)&&this.condition_(e)?(e.map.getView().beginInteraction(),this.lastAngle_=void 0,!0):!1}},Wm=class extends kr{constructor(e){super(),this.geometry_=null,this.element_=document.createElement(`div`),this.element_.style.position=`absolute`,this.element_.style.pointerEvents=`auto`,this.element_.className=`ol-box `+e,this.map_=null,this.startPixel_=null,this.endPixel_=null}disposeInternal(){this.setMap(null)}render_(){let e=this.startPixel_,t=this.endPixel_,n=this.element_.style;n.left=Math.min(e[0],t[0])+`px`,n.top=Math.min(e[1],t[1])+`px`,n.width=Math.abs(t[0]-e[0])+`px`,n.height=Math.abs(t[1]-e[1])+`px`}setMap(e){if(this.map_){this.map_.getOverlayContainer().removeChild(this.element_);let e=this.element_.style;e.left=`inherit`,e.top=`inherit`,e.width=`inherit`,e.height=`inherit`}this.map_=e,this.map_&&this.map_.getOverlayContainer().appendChild(this.element_)}setPixels(e,t){this.startPixel_=e,this.endPixel_=t,this.createOrUpdateGeometry(),this.render_()}createOrUpdateGeometry(){if(!this.map_)return;let e=this.startPixel_,t=this.endPixel_,n=[e,[e[0],t[1]],t,[t[0],e[1]]].map(this.map_.getCoordinateFromPixelInternal,this.map_);n[4]=n[0].slice(),this.geometry_?this.geometry_.setCoordinates([n]):this.geometry_=new rc([n])}getGeometry(){return this.geometry_}},Gm={BOXSTART:`boxstart`,BOXDRAG:`boxdrag`,BOXEND:`boxend`,BOXCANCEL:`boxcancel`},Km=class extends Gr{constructor(e,t,n){super(e),this.coordinate=t,this.mapBrowserEvent=n}},qm=class extends Bm{constructor(e){super(),this.on,this.once,this.un,e??={},this.box_=new Wm(e.className||`ol-dragbox`),this.minArea_=e.minArea??64,e.onBoxEnd&&(this.onBoxEnd=e.onBoxEnd),this.startPixel_=null,this.condition_=e.condition??Nm,this.boxEndCondition_=e.boxEndCondition??this.defaultBoxEndCondition}defaultBoxEndCondition(e,t,n){let r=n[0]-t[0],i=n[1]-t[1];return r*r+i*i>=this.minArea_}getGeometry(){return this.box_.getGeometry()}handleDragEvent(e){this.startPixel_&&(this.box_.setPixels(this.startPixel_,e.pixel),this.dispatchEvent(new Km(Gm.BOXDRAG,e.coordinate,e)))}handleUpEvent(e){if(!this.startPixel_)return!1;let t=this.boxEndCondition_(e,this.startPixel_,e.pixel);return t&&this.onBoxEnd(e),this.dispatchEvent(new Km(t?Gm.BOXEND:Gm.BOXCANCEL,e.coordinate,e)),this.box_.setMap(null),this.startPixel_=null,!1}handleDownEvent(e){return this.condition_(e)?(this.startPixel_=e.pixel,this.box_.setMap(e.map),this.box_.setPixels(this.startPixel_,this.startPixel_),this.dispatchEvent(new Km(Gm.BOXSTART,e.coordinate,e)),!0):!1}onBoxEnd(e){}setActive(e){e||(this.box_.setMap(null),this.startPixel_&&=(this.dispatchEvent(new Km(Gm.BOXCANCEL,this.startPixel_,null)),null)),super.setActive(e)}setMap(e){this.getMap()&&(this.box_.setMap(null),this.startPixel_&&=(this.dispatchEvent(new Km(Gm.BOXCANCEL,this.startPixel_,null)),null)),super.setMap(e)}},Jm=class extends qm{constructor(e){e||={};let t=e.condition?e.condition:Im;super({condition:t,className:e.className||`ol-dragzoom`,minArea:e.minArea}),this.duration_=e.duration===void 0?200:e.duration,this.out_=e.out===void 0?!1:e.out}onBoxEnd(e){let t=this.getMap().getView(),n=this.getGeometry();if(this.out_){let e=t.rotatedExtentForGeometry(n),r=t.getResolutionForExtentInternal(e),i=t.getResolution()/r;n=n.clone(),n.scale(i*i)}t.fitInternal(n,{duration:this.duration_,easing:jp})}},Ym={LEFT:`ArrowLeft`,UP:`ArrowUp`,RIGHT:`ArrowRight`,DOWN:`ArrowDown`},Xm=class extends wm{constructor(e){super(),e||={},this.defaultCondition_=function(e){return Pm(e)&&Lm(e)},this.condition_=e.condition===void 0?this.defaultCondition_:e.condition,this.duration_=e.duration===void 0?100:e.duration,this.pixelDelta_=e.pixelDelta===void 0?128:e.pixelDelta}handleEvent(e){let t=!1;if(e.type==F.KEYDOWN){let n=e.originalEvent,r=n.key;if(this.condition_(e)&&(r==Ym.DOWN||r==Ym.LEFT||r==Ym.RIGHT||r==Ym.UP)){let i=e.map.getView(),a=i.getResolution()*this.pixelDelta_,o=0,s=0;r==Ym.DOWN?s=-a:r==Ym.LEFT?o=-a:r==Ym.RIGHT?o=a:s=a;let c=[o,s];oa(c,i.getRotation()),Tm(i,c,this.duration_),n.preventDefault(),t=!0}}return!t}},Zm=class extends wm{constructor(e){super(),e||={},this.condition_=e.condition?e.condition:function(e){return!Fm(e)&&Lm(e)},this.delta_=e.delta?e.delta:1,this.duration_=e.duration===void 0?100:e.duration}handleEvent(e){let t=!1;if(e.type==F.KEYDOWN||e.type==F.KEYPRESS){let n=e.originalEvent,r=n.key;if(this.condition_(e)&&(r===`+`||r===`-`)){let i=e.map,a=r===`+`?this.delta_:-this.delta_;Em(i.getView(),a,void 0,this.duration_),n.preventDefault(),t=!0}}return!t}},Qm=40,$m=300,eh=class extends wm{constructor(e){e||={},super(e),this.totalDelta_=0,this.lastDelta_=0,this.maxDelta_=e.maxDelta===void 0?1:e.maxDelta,this.duration_=e.duration===void 0?250:e.duration,this.timeout_=e.timeout===void 0?80:e.timeout,this.useAnchor_=e.useAnchor===void 0?!0:e.useAnchor,this.constrainResolution_=e.constrainResolution===void 0?!1:e.constrainResolution;let t=e.condition?e.condition:Mm;this.condition_=e.onFocusOnly?Om(jm,t):t,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_,this.mode_=void 0,this.trackpadEventGap_=400,this.trackpadTimeoutId_,this.deltaPerZoom_=300}endInteraction_(){this.trackpadTimeoutId_=void 0;let e=this.getMap();e&&e.getView().endInteraction(void 0,this.lastDelta_?this.lastDelta_>0?1:-1:0,this.lastAnchor_?e.getCoordinateFromPixel(this.lastAnchor_):null)}handleEvent(e){if(!this.condition_(e)||e.type!==F.WHEEL)return!0;let t=e.map,n=e.originalEvent;n.preventDefault(),this.useAnchor_&&(this.lastAnchor_=e.pixel);let r=n.deltaY;switch(n.deltaMode){case WheelEvent.DOM_DELTA_LINE:r*=Qm;break;case WheelEvent.DOM_DELTA_PAGE:r*=$m;break;default:}if(r===0)return!1;this.lastDelta_=r;let i=Date.now();this.startTime_===void 0&&(this.startTime_=i),(!this.mode_||i-this.startTime_>this.trackpadEventGap_)&&(this.mode_=Math.abs(r)<4?`trackpad`:`wheel`);let a=t.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_?t.getCoordinateFromPixel(this.lastAnchor_):null),this.startTime_=i,!1;this.totalDelta_+=r;let o=Math.max(this.timeout_-(i-this.startTime_),0);return clearTimeout(this.timeoutId_),this.timeoutId_=setTimeout(this.handleWheelZoom_.bind(this,t),o),!1}handleWheelZoom_(e){let t=e.getView();t.getAnimating()&&t.cancelAnimations();let n=-H(this.totalDelta_,-this.maxDelta_*this.deltaPerZoom_,this.maxDelta_*this.deltaPerZoom_)/this.deltaPerZoom_;(t.getConstrainResolution()||this.constrainResolution_)&&(n=n?n>0?1:-1:0),Em(t,n,this.lastAnchor_?e.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(e){this.useAnchor_=e,e||(this.lastAnchor_=null)}},th=class extends Bm{constructor(e){e||={};let t=e;t.stopDown||=zr,super(t),this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.threshold_=e.threshold===void 0?.3:e.threshold,this.duration_=e.duration===void 0?250:e.duration}handleDragEvent(e){let t=0,n=this.targetPointers[0],r=this.targetPointers[1],i=Math.atan2(r.clientY-n.clientY,r.clientX-n.clientX);if(this.lastAngle_!==void 0){let e=i-this.lastAngle_;this.rotationDelta_+=e,!this.rotating_&&Math.abs(this.rotationDelta_)>this.threshold_&&(this.rotating_=!0),t=e}this.lastAngle_=i;let a=e.map,o=a.getView();o.getConstraints().rotation!==zp&&(this.anchor_=a.getCoordinateFromPixelInternal(a.getEventPixel(Vm(this.targetPointers))),this.rotating_&&(a.render(),o.adjustRotationInternal(t,this.anchor_)))}handleUpEvent(e){return this.targetPointers.length<2?(e.map.getView().endInteraction(this.duration_),!1):!0}handleDownEvent(e){if(this.targetPointers.length>=2){let t=e.map;return this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.handlingDownUpSequence||t.getView().beginInteraction(),!0}return!1}},nh=class extends Bm{constructor(e){e||={};let t=e;t.stopDown||=zr,super(t),this.anchor_=null,this.duration_=e.duration===void 0?400:e.duration,this.lastDistance_=void 0,this.lastScaleDelta_=1}handleDragEvent(e){let t=1,n=this.targetPointers[0],r=this.targetPointers[1],i=n.clientX-r.clientX,a=n.clientY-r.clientY,o=Math.sqrt(i*i+a*a);this.lastDistance_!==void 0&&(t=this.lastDistance_/o),this.lastDistance_=o;let s=e.map,c=s.getView();t!=1&&(this.lastScaleDelta_=t),this.anchor_=s.getCoordinateFromPixelInternal(s.getEventPixel(Vm(this.targetPointers))),s.render(),c.adjustResolutionInternal(t,this.anchor_)}handleUpEvent(e){if(this.targetPointers.length<2){let t=e.map.getView(),n=this.lastScaleDelta_>1?1:-1;return t.endInteraction(this.duration_,n),!1}return!0}handleDownEvent(e){if(this.targetPointers.length>=2){let t=e.map;return this.anchor_=null,this.lastDistance_=void 0,this.lastScaleDelta_=1,this.handlingDownUpSequence||t.getView().beginInteraction(),!0}return!1}};function rh(e){e||={};let t=new ti,n=new sm(-.005,.05,100);return(e.altShiftDragRotate===void 0||e.altShiftDragRotate)&&t.push(new Um),(e.doubleClickZoom===void 0||e.doubleClickZoom)&&t.push(new Dm({delta:e.zoomDelta,duration:e.zoomDuration})),(e.dragPan===void 0||e.dragPan)&&t.push(new Hm({onFocusOnly:e.onFocusOnly,kinetic:n})),(e.pinchRotate===void 0||e.pinchRotate)&&t.push(new th),(e.pinchZoom===void 0||e.pinchZoom)&&t.push(new nh({duration:e.zoomDuration})),(e.keyboard===void 0||e.keyboard)&&(t.push(new Xm),t.push(new Zm({delta:e.zoomDelta,duration:e.zoomDuration}))),(e.mouseWheelZoom===void 0||e.mouseWheelZoom)&&t.push(new eh({onFocusOnly:e.onFocusOnly,duration:e.zoomDuration})),(e.shiftDragZoom===void 0||e.shiftDragZoom)&&t.push(new Jm({duration:e.zoomDuration})),t}var ih={ADDLAYER:`addlayer`,REMOVELAYER:`removelayer`},ah=class extends Gr{constructor(e,t){super(e),this.layer=t}},oh={LAYERS:`layers`},sh=class e extends Zp{constructor(e){e||={};let t=Object.assign({},e);delete t.layers;let n=e.layers;super(t),this.on,this.once,this.un,this.layersListenerKeys_=[],this.listenerKeys_={},this.addChangeListener(oh.LAYERS,this.handleLayersChanged_),n?Array.isArray(n)?n=new ti(n.slice(),{unique:!0}):B(typeof n.getArray==`function`,"Expected `layers` to be an array or a `Collection`"):n=new ti(void 0,{unique:!0}),this.setLayers(n)}handleLayerChange_(){this.changed()}handleLayersChanged_(){this.layersListenerKeys_.forEach(L),this.layersListenerKeys_.length=0;let e=this.getLayers();this.layersListenerKeys_.push(I(e,Dr.ADD,this.handleLayersAdd_,this),I(e,Dr.REMOVE,this.handleLayersRemove_,this));for(let e in this.listenerKeys_)this.listenerKeys_[e].forEach(L);Ur(this.listenerKeys_);let t=e.getArray();for(let e=0,n=t.length;e<n;e++){let n=t[e];this.registerLayerListeners_(n),this.dispatchEvent(new ah(ih.ADDLAYER,n))}this.changed()}registerLayerListeners_(t){let n=[I(t,Or.PROPERTYCHANGE,this.handleLayerChange_,this),I(t,F.CHANGE,this.handleLayerChange_,this)];t instanceof e&&n.push(I(t,ih.ADDLAYER,this.handleLayerGroupAdd_,this),I(t,ih.REMOVELAYER,this.handleLayerGroupRemove_,this)),this.listenerKeys_[z(t)]=n}handleLayerGroupAdd_(e){this.dispatchEvent(new ah(ih.ADDLAYER,e.layer))}handleLayerGroupRemove_(e){this.dispatchEvent(new ah(ih.REMOVELAYER,e.layer))}handleLayersAdd_(e){let t=e.element;this.registerLayerListeners_(t),this.dispatchEvent(new ah(ih.ADDLAYER,t)),this.changed()}handleLayersRemove_(e){let t=e.element,n=z(t);this.listenerKeys_[n].forEach(L),delete this.listenerKeys_[n],this.dispatchEvent(new ah(ih.REMOVELAYER,t)),this.changed()}getLayers(){return this.get(oh.LAYERS)}setLayers(e){let t=this.getLayers();if(t){let e=t.getArray();for(let t=0,n=e.length;t<n;++t)this.dispatchEvent(new ah(ih.REMOVELAYER,e[t]))}this.set(oh.LAYERS,e)}getLayersArray(e){return e=e===void 0?[]:e,this.getLayers().forEach(function(t){t.getLayersArray(e)}),e}getLayerStatesArray(e){let t=e===void 0?[]:e,n=t.length;this.getLayers().forEach(function(e){e.getLayerStatesArray(t)});let r=this.getLayerState(),i=r.zIndex;!e&&r.zIndex===void 0&&(i=0);for(let e=n,a=t.length;e<a;e++){let n=t[e];n.opacity*=r.opacity,n.visible=n.visible&&r.visible,n.maxResolution=Math.min(n.maxResolution,r.maxResolution),n.minResolution=Math.max(n.minResolution,r.minResolution),n.minZoom=Math.max(n.minZoom,r.minZoom),n.maxZoom=Math.min(n.maxZoom,r.maxZoom),r.extent!==void 0&&(n.extent===void 0?n.extent=r.extent:n.extent=Ni(n.extent,r.extent)),n.zIndex===void 0&&(n.zIndex=i)}return t}getSourceState(){return`ready`}},ch=class extends kr{constructor(e){super(),this.map_=e}dispatchRenderEvent(e,t){R()}calculateMatrices2D(e){let t=e.viewState,n=e.coordinateToPixelTransform,r=e.pixelToCoordinateTransform;Yo(n,e.size[0]/2,e.size[1]/2,1/t.resolution,-1/t.resolution,-t.rotation,-t.center[0],-t.center[1]),Xo(r,n)}forEachFeatureAtCoordinate(e,t,n,r,i,a,o,s){let c,l=t.viewState;function u(e,t,n,r){return i.call(a,t,e?n:null,r)}let d=l.projection,f=ca(e.slice(),d),p=[[0,0]];if(d.canWrapX()&&r){let e=V(d.getExtent());p.push([-e,0],[e,0])}let m=t.layerStatesArray,h=m.length,g=[],_=[];for(let r=0;r<p.length;r++)for(let i=h-1;i>=0;--i){let a=m[i],d=a.layer;if(d.hasRenderer()&&$p(a,l)&&o.call(s,d)){let i=d.getRenderer(),o=d.getSource();if(i&&o){let s=o.getWrapX()?f:e,l=u.bind(null,a.managed);_[0]=s[0]+p[r][0],_[1]=s[1]+p[r][1],c=i.forEachFeatureAtCoordinate(_,t,n,l,g)}if(c)return c}}if(g.length===0)return;let v=1/g.length;return g.forEach((e,t)=>e.distanceSq+=t*v),g.sort((e,t)=>e.distanceSq-t.distanceSq),g.some(e=>c=e.callback(e.feature,e.layer,e.geometry)),c}hasFeatureAtCoordinate(e,t,n,r,i,a){return this.forEachFeatureAtCoordinate(e,t,n,r,Rr,this,i,a)!==void 0}getMap(){return this.map_}renderFrame(e){R()}scheduleExpireIconCache(e){il.canExpireCache()&&e.postRenderFunctions.push(lh)}};function lh(e,t){il.expire()}var uh=class extends ch{constructor(e){super(e),this.fontChangeListenerKey_=I(jl,Or.PROPERTYCHANGE,e.redrawText,e),this.element_=hc?Dc():document.createElement(`div`);let t=this.element_.style;t.position=`absolute`,t.width=`100%`,t.height=`100%`,t.zIndex=`0`,this.element_.className=hl+` ol-layers`;let n=e.getViewport();n&&n.insertBefore(this.element_,n.firstChild||null),this.children_=[],this.renderedVisible_=!0}dispatchRenderEvent(e,t){let n=this.getMap();if(n.hasListener(e)){let r=new Ud(e,void 0,t);n.dispatchEvent(r)}}disposeInternal(){L(this.fontChangeListenerKey_),this.element_.remove(),super.disposeInternal()}renderFrame(e){if(!e){this.renderedVisible_&&=(this.element_.style.display=`none`,!1);return}this.calculateMatrices2D(e),this.dispatchRenderEvent(uc.PRECOMPOSE,e);let t=e.layerStatesArray.sort((e,t)=>e.zIndex-t.zIndex);t.some(e=>e.layer instanceof tm&&e.layer.getDeclutter())&&(e.declutter={});let n=e.viewState;this.children_.length=0;let r=[],i=null;for(let a=0,o=t.length;a<o;++a){let o=t[a];e.layerIndex=a;let s=o.layer,c=s.getSourceState();if(!$p(o,n)||c!=`ready`&&c!=`undefined`){s.unrender();continue}let l=s.render(e,i);l&&(l!==i&&(this.children_.push(l),i=l),r.push(o))}this.declutter(e,r),Ec(this.element_,this.children_);let a=this.getMap().getTargetElement();if(Oc(a)){let e=a.getContext(`2d`);for(let t of this.children_){let n=t.firstElementChild||t,r=t.style.backgroundColor;if(r&&(!Oc(n)||n.width>0)&&(e.fillStyle=r,e.fillRect(0,0,a.width,a.height)),Oc(n)&&n.width>0){e.save();let r=t.style.opacity||n.style.opacity;e.globalAlpha=r===``?1:Number(r);let i=n.style.transform;if(i)e.transform(...es(i));else{let t=parseFloat(n.style.width)/n.width,r=parseFloat(n.style.height)/n.height;e.transform(t,0,0,r,0,0)}e.drawImage(n,0,0),e.restore()}}}this.dispatchRenderEvent(uc.POSTCOMPOSE,e),this.renderedVisible_||=(this.element_.style.display=``,!0),this.scheduleExpireIconCache(e)}declutter(e,t){if(e.declutter){for(let n=t.length-1;n>=0;--n){let r=t[n],i=r.layer;i.getDeclutter()&&i.renderDeclutter(e,r)}t.forEach(t=>t.layer.renderDeferred(e))}}};function dh(e){if(e instanceof Qp){e.setMapInternal(null);return}e instanceof sh&&e.getLayers().forEach(dh)}function fh(e,t){if(e instanceof Qp){e.setMapInternal(t);return}if(e instanceof sh){let n=e.getLayers().getArray();for(let e=0,r=n.length;e<r;++e)fh(n[e],t)}}var ph=class extends Qr{constructor(e){super(),e||={},this.on,this.once,this.un;let t=mh(e);this.renderComplete_=!1,this.loaded_=!0,this.boundHandleBrowserEvent_=this.handleBrowserEvent.bind(this),this.maxTilesLoading_=e.maxTilesLoading===void 0?16:e.maxTilesLoading,this.pixelRatio_=e.pixelRatio===void 0?mc:e.pixelRatio,this.postRenderTimeoutHandle_,this.animationDelayKey_,this.animationDelay_=this.animationDelay_.bind(this),this.coordinateToPixelTransform_=Vo(),this.pixelToCoordinateTransform_=Vo(),this.frameIndex_=0,this.frameState_=null,this.previousExtent_=null,this.viewPropertyListenerKey_=null,this.viewChangeListenerKey_=null,this.layerGroupPropertyListenerKeys_=null,hc||(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_=e.moveTolerance,this.keyboardEventTarget_=t.keyboardEventTarget,this.targetChangeHandlerKeys_=null,this.targetElement_=null,hc||(this.resizeObserver_=new ResizeObserver(()=>this.updateSize())),this.controls=t.controls||(hc?new ti:Sm()),this.interactions=t.interactions||(hc?new ti:rh({onFocusOnly:!0})),this.overlays_=t.overlays,this.overlayIdIndex_={},this.renderer_=null,this.postRenderFunctions_=[],this.tileQueue_=new gm(this.getTilePriority.bind(this),this.handleTileChange_.bind(this)),this.addChangeListener(pm.LAYERGROUP,this.handleLayerGroupChanged_),this.addChangeListener(pm.VIEW,this.handleViewChanged_),this.addChangeListener(pm.SIZE,this.handleSizeChanged_),this.addChangeListener(pm.TARGET,this.handleTargetChanged_),this.setProperties(t.values);let n=this;e.view&&!(e.view instanceof Wp)&&e.view.then(function(e){n.setView(new Wp(e))}),this.controls.addEventListener(Dr.ADD,e=>{e.element.setMap(this)}),this.controls.addEventListener(Dr.REMOVE,e=>{e.element.setMap(null)}),this.interactions.addEventListener(Dr.ADD,e=>{e.element.setMap(this)}),this.interactions.addEventListener(Dr.REMOVE,e=>{e.element.setMap(null)}),this.overlays_.addEventListener(Dr.ADD,e=>{this.addOverlayInternal_(e.element)}),this.overlays_.addEventListener(Dr.REMOVE,e=>{let t=e.element.getId();t!==void 0&&delete this.overlayIdIndex_[t.toString()],e.element.setMap(null)}),this.controls.forEach(e=>{e.setMap(this)}),this.interactions.forEach(e=>{e.setMap(this)}),this.overlays_.forEach(this.addOverlayInternal_.bind(this))}addControl(e){this.getControls().push(e)}addInteraction(e){this.getInteractions().push(e)}addLayer(e){this.getLayerGroup().getLayers().push(e)}handleLayerAdd_(e){fh(e.layer,this)}addOverlay(e){this.getOverlays().push(e)}addOverlayInternal_(e){let t=e.getId();t!==void 0&&(this.overlayIdIndex_[t.toString()]=e),e.setMap(this)}disposeInternal(){this.controls.clear(),this.interactions.clear(),this.overlays_.clear(),this.resizeObserver_?.disconnect(),this.setTarget(null),super.disposeInternal()}forEachFeatureAtPixel(e,t,n){if(!this.frameState_||!this.renderer_)return;let r=this.getCoordinateFromPixelInternal(e);n=n===void 0?{}:n;let i=n.hitTolerance===void 0?0:n.hitTolerance,a=n.layerFilter===void 0?Rr:n.layerFilter,o=n.checkWrapped!==!1;return this.renderer_.forEachFeatureAtCoordinate(r,this.frameState_,i,o,t,null,a,null)}getFeaturesAtPixel(e,t){let n=[];return this.forEachFeatureAtPixel(e,function(e){n.push(e)},t),n}getAllLayers(){let e=[];function t(n){n.forEach(function(n){n instanceof sh?t(n.getLayers()):e.push(n)})}return t(this.getLayers()),e}hasFeatureAtPixel(e,t){if(!this.frameState_||!this.renderer_)return!1;let n=this.getCoordinateFromPixelInternal(e);t=t===void 0?{}:t;let r=t.layerFilter===void 0?Rr:t.layerFilter,i=t.hitTolerance===void 0?0:t.hitTolerance,a=t.checkWrapped!==!1;return this.renderer_.hasFeatureAtCoordinate(n,this.frameState_,i,a,r,null)}getEventCoordinate(e){return this.getCoordinateFromPixel(this.getEventPixel(e))}getEventCoordinateInternal(e){return this.getCoordinateFromPixelInternal(this.getEventPixel(e))}getEventPixel(e){let t=this.viewport_.getBoundingClientRect(),n=this.getSize(),r=t.width/n[0],i=t.height/n[1],a=`changedTouches`in e?e.changedTouches[0]:e;return[(a.clientX-t.left)/r,(a.clientY-t.top)/i]}getTarget(){return this.get(pm.TARGET)}getTargetElement(){return this.targetElement_}getCoordinateFromPixel(e){return Po(this.getCoordinateFromPixelInternal(e),this.getView().getProjection())}getCoordinateFromPixelInternal(e){let t=this.frameState_;return t?Ko(t.pixelToCoordinateTransform,e.slice()):null}getControls(){return this.controls}getOverlays(){return this.overlays_}getOverlayById(e){let t=this.overlayIdIndex_[e.toString()];return t===void 0?null:t}getInteractions(){return this.interactions}getLayerGroup(){return this.get(pm.LAYERGROUP)}setLayers(e){let t=this.getLayerGroup();if(e instanceof ti){t.setLayers(e);return}let n=t.getLayers();n.clear(),n.extend(e)}getLayers(){return this.getLayerGroup().getLayers()}getLoadingOrNotReady(){let e=this.getLayerGroup().getLayerStatesArray();for(let t=0,n=e.length;t<n;++t){let n=e[t];if(!n.visible)continue;let r=n.layer.getRenderer();if(r&&!r.ready)return!0;let i=n.layer.getSource();if(i&&i.loading)return!0}return!1}getPixelFromCoordinate(e){let t=Fo(e,this.getView().getProjection());return this.getPixelFromCoordinateInternal(t)}getPixelFromCoordinateInternal(e){let t=this.frameState_;return t?Ko(t.coordinateToPixelTransform,e.slice(0,2)):null}getPixelRatio(){return this.pixelRatio_}setPixelRatio(e){this.pixelRatio_!==e&&(this.pixelRatio_=e,this.render())}getRenderer(){return this.renderer_}getSize(){return this.get(pm.SIZE)}getView(){return this.get(pm.VIEW)}getViewport(){return this.viewport_}getOverlayContainer(){return this.overlayContainer_}getOverlayContainerStopEvent(){return this.overlayContainerStopEvent_}getOwnerDocument(){let e=this.getTargetElement();return e?e.ownerDocument:document}getTilePriority(e,t,n,r){return _m(this.frameState_,e,t,n,r)}handleBrowserEvent(e,t){t||=e.type;let n=new lm(t,this,e);this.handleMapBrowserEvent(n)}handleMapBrowserEvent(e){if(!this.frameState_)return;let t=e.originalEvent,n=t.type;if(n===um.POINTERDOWN||n===F.WHEEL||n===F.KEYDOWN){let e=this.getOwnerDocument(),n=this.viewport_.getRootNode?this.viewport_.getRootNode():e,r=t.target,i=n instanceof ShadowRoot?n.host===r?n.host.ownerDocument:n:n===e?e.documentElement:n;if(this.overlayContainerStopEvent_.contains(r)||!i.contains(r))return}if(e.frameState=this.frameState_,this.dispatchEvent(e)!==!1){let t=this.getInteractions().getArray().slice();for(let n=t.length-1;n>=0;n--){let r=t[n];if(!(r.getMap()!==this||!r.getActive()||!this.getTargetElement())&&(!r.handleEvent(e)||e.propagationStopped))break}}}handlePostRender(){let e=this.frameState_,t=this.tileQueue_;if(!t.isEmpty()){let n=this.maxTilesLoading_,r=n;if(e){let t=e.viewHints;if(t[W.ANIMATING]||t[W.INTERACTING]){let t=Date.now()-e.time>8;n=t?0:8,r=t?0:2}}t.getTilesLoading()<n&&(t.reprioritize(),t.loadMoreTiles(n,r))}e&&this.renderer_&&!e.animate&&(this.renderComplete_?(this.hasListener(uc.RENDERCOMPLETE)&&this.renderer_.dispatchRenderEvent(uc.RENDERCOMPLETE,e),this.loaded_===!1&&(this.loaded_=!0,this.dispatchEvent(new cm(fm.LOADEND,this,e)))):this.loaded_===!0&&(this.loaded_=!1,this.dispatchEvent(new cm(fm.LOADSTART,this,e))));let n=this.postRenderFunctions_;if(e)for(let t=0,r=n.length;t<r;++t)n[t](this,e);n.length=0}handleSizeChanged_(){this.getView()&&!this.getView().getAnimating()&&this.getView().resolveConstraints(0),this.render()}handleTargetChanged_(){if(this.mapBrowserEventHandler_){for(let e=0,t=this.targetChangeHandlerKeys_.length;e<t;++e)L(this.targetChangeHandlerKeys_[e]);this.targetChangeHandlerKeys_=null,this.viewport_.removeEventListener(F.CONTEXTMENU,this.boundHandleBrowserEvent_),this.viewport_.removeEventListener(F.WHEEL,this.boundHandleBrowserEvent_),this.mapBrowserEventHandler_.dispose(),this.mapBrowserEventHandler_=null,this.viewport_.remove()}if(this.targetElement_&&!Oc(this.targetElement_)){this.resizeObserver_?.unobserve(this.targetElement_);let e=this.targetElement_.getRootNode();e instanceof ShadowRoot&&this.resizeObserver_.unobserve(e.host),this.setSize(void 0)}let e=this.getTarget(),t=typeof e==`string`?document.getElementById(e):e;if(this.targetElement_=t,!t)this.renderer_&&=(clearTimeout(this.postRenderTimeoutHandle_),this.postRenderTimeoutHandle_=void 0,this.postRenderFunctions_.length=0,this.renderer_.dispose(),null),this.animationDelayKey_&&=(cancelAnimationFrame(this.animationDelayKey_),void 0);else{if(Oc(t)||t.appendChild(this.viewport_),this.renderer_||=new uh(this),!Oc(t)){this.mapBrowserEventHandler_=new dm(this,this.moveTolerance_);for(let e in $)this.mapBrowserEventHandler_.addEventListener($[e],this.handleMapBrowserEvent.bind(this));this.viewport_.addEventListener(F.CONTEXTMENU,this.boundHandleBrowserEvent_,!1),this.viewport_.addEventListener(F.WHEEL,this.boundHandleBrowserEvent_,_c?{passive:!1}:!1);let e;if(this.keyboardEventTarget_)e=this.keyboardEventTarget_;else{let n=t.getRootNode();e=n instanceof ShadowRoot?n.host:t}if(this.targetChangeHandlerKeys_=[I(e,F.KEYDOWN,this.handleBrowserEvent,this),I(e,F.KEYPRESS,this.handleBrowserEvent,this)],t instanceof HTMLElement){let e=t.getRootNode();e instanceof ShadowRoot&&this.resizeObserver_.observe(e.host),this.resizeObserver_?.observe(t)}}this.updateSize()}}handleTileChange_(){this.render()}handleViewPropertyChanged_(){this.render()}handleViewChanged_(){this.viewPropertyListenerKey_&&=(L(this.viewPropertyListenerKey_),null),this.viewChangeListenerKey_&&=(L(this.viewChangeListenerKey_),null);let e=this.getView();e&&(this.updateViewportSize_(this.getSize()),this.viewPropertyListenerKey_=I(e,Or.PROPERTYCHANGE,this.handleViewPropertyChanged_,this),this.viewChangeListenerKey_=I(e,F.CHANGE,this.handleViewPropertyChanged_,this),e.resolveConstraints(0)),this.render()}handleLayerGroupChanged_(){this.layerGroupPropertyListenerKeys_&&=(this.layerGroupPropertyListenerKeys_.forEach(L),null);let e=this.getLayerGroup();e&&(this.handleLayerAdd_(new ah(`addlayer`,e)),this.layerGroupPropertyListenerKeys_=[I(e,Or.PROPERTYCHANGE,this.render,this),I(e,F.CHANGE,this.render,this),I(e,`addlayer`,this.handleLayerAdd_,this),I(e,`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;let e=this.frameState_.layerStatesArray;for(let t=0,n=e.length;t<n;++t){let n=e[t].layer;n.hasRenderer()&&n.getRenderer().handleFontsChanged()}}render(){this.renderer_&&this.animationDelayKey_===void 0&&(this.animationDelayKey_=requestAnimationFrame(this.animationDelay_))}removeControl(e){return this.getControls().remove(e)}removeInteraction(e){return this.getInteractions().remove(e)}removeLayer(e){return this.getLayerGroup().getLayers().remove(e)}handleLayerRemove_(e){dh(e.layer)}removeOverlay(e){return this.getOverlays().remove(e)}renderFrame_(e){let t=this.getSize(),n=this.getView(),r=this.frameState_,i=null;if(t!==void 0&&Wu(t)&&n&&n.isDef()){let r=n.getHints(this.frameState_?this.frameState_.viewHints:void 0),a=n.getState();if(i={animate:!1,coordinateToPixelTransform:this.coordinateToPixelTransform_,declutter:null,extent:Ai(a.center,a.resolution,a.rotation,t),index:this.frameIndex_++,layerIndex:0,layerStatesArray:this.getLayerGroup().getLayerStatesArray(),pixelRatio:this.pixelRatio_,pixelToCoordinateTransform:this.pixelToCoordinateTransform_,postRenderFunctions:[],size:t,tileQueue:this.tileQueue_,time:e,usedTiles:{},viewState:a,viewHints:r,wantedTiles:{},mapId:z(this),renderTargets:{}},a.nextCenter&&a.nextResolution){let e=isNaN(a.nextRotation)?a.rotation:a.nextRotation;i.nextExtent=Ai(a.nextCenter,a.nextResolution,e,t)}}this.frameState_=i,this.renderer_.renderFrame(i),i&&(i.animate&&this.render(),Array.prototype.push.apply(this.postRenderFunctions_,i.postRenderFunctions),r&&(!this.previousExtent_||!Li(this.previousExtent_)&&!yi(i.extent,this.previousExtent_))&&(this.dispatchEvent(new cm(fm.MOVESTART,this,r)),this.previousExtent_=gi(this.previousExtent_)),this.previousExtent_&&!i.viewHints[W.ANIMATING]&&!i.viewHints[W.INTERACTING]&&!yi(i.extent,this.previousExtent_)&&(this.dispatchEvent(new cm(fm.MOVEEND,this,i)),ci(i.extent,this.previousExtent_))),this.dispatchEvent(new cm(fm.POSTRENDER,this,i)),this.renderComplete_=(this.hasListener(fm.LOADSTART)||this.hasListener(fm.LOADEND)||this.hasListener(uc.RENDERCOMPLETE))&&!this.tileQueue_.getTilesLoading()&&!this.tileQueue_.getCount()&&!this.getLoadingOrNotReady(),this.postRenderTimeoutHandle_||=setTimeout(()=>{this.postRenderTimeoutHandle_=void 0,this.handlePostRender()},0)}setLayerGroup(e){let t=this.getLayerGroup();t&&this.handleLayerRemove_(new ah(`removelayer`,t)),this.set(pm.LAYERGROUP,e)}setSize(e){this.set(pm.SIZE,e)}setTarget(e){this.set(pm.TARGET,e)}setView(e){if(!e||e instanceof Wp){this.set(pm.VIEW,e);return}this.set(pm.VIEW,new Wp);let t=this;e.then(function(e){t.setView(new Wp(e))})}updateSize(){let e=this.getTargetElement(),t;if(e){let n,r;if(Oc(e)){let t=e.getContext(`2d`).getTransform();n=e.width/t.a,r=e.height/t.d}else{let t=getComputedStyle(e);n=e.offsetWidth-parseFloat(t.borderLeftWidth)-parseFloat(t.paddingLeft)-parseFloat(t.paddingRight)-parseFloat(t.borderRightWidth),r=e.offsetHeight-parseFloat(t.borderTopWidth)-parseFloat(t.paddingTop)-parseFloat(t.paddingBottom)-parseFloat(t.borderBottomWidth)}!isNaN(n)&&!isNaN(r)&&(t=[Math.max(0,n),Math.max(0,r)],!Wu(t)&&(e.offsetWidth||e.offsetHeight||e.getClientRects().length)&&ra(`No map visible because the map container's width or height are 0.`))}let n=this.getSize();t&&(!n||!Ir(t,n))&&(this.setSize(t),this.updateViewportSize_(t))}updateViewportSize_(e){let t=this.getView();t&&t.setViewportSize(e)}};function mh(e){let t=null;e.keyboardEventTarget!==void 0&&(t=typeof e.keyboardEventTarget==`string`?document.getElementById(e.keyboardEventTarget):e.keyboardEventTarget);let n={},r=e.layers&&typeof e.layers.getLayers==`function`?e.layers:new sh({layers:e.layers});n[pm.LAYERGROUP]=r,n[pm.TARGET]=e.target,n[pm.VIEW]=e.view instanceof Wp?e.view:new Wp;let i;e.controls!==void 0&&(Array.isArray(e.controls)?i=new ti(e.controls.slice()):(B(typeof e.controls.getArray==`function`,"Expected `controls` to be an array or an `ol/Collection.js`"),i=e.controls));let a;e.interactions!==void 0&&(Array.isArray(e.interactions)?a=new ti(e.interactions.slice()):(B(typeof e.interactions.getArray==`function`,"Expected `interactions` to be an array or an `ol/Collection.js`"),a=e.interactions));let o;return e.overlays===void 0?o=new ti:Array.isArray(e.overlays)?o=new ti(e.overlays.slice()):(B(typeof e.overlays.getArray==`function`,"Expected `overlays` to be an array or an `ol/Collection.js`"),o=e.overlays),{controls:i,interactions:a,keyboardEventTarget:t,overlays:o,values:n}}var hh={ELEMENT:`element`,MAP:`map`,OFFSET:`offset`,POSITION:`position`,POSITIONING:`positioning`},gh=class extends Qr{constructor(e){super(),this.on,this.once,this.un,this.options=e,this.id=e.id,this.insertFirst=e.insertFirst===void 0?!0:e.insertFirst,this.stopEvent=e.stopEvent===void 0?!0:e.stopEvent,this.element=document.createElement(`div`),this.element.className=e.className===void 0?`ol-overlay-container `+ml:e.className,this.element.style.position=`absolute`,this.element.style.pointerEvents=`auto`,this.autoPan=e.autoPan===!0?{}:e.autoPan||void 0,this.rendered={transform_:``,visible:!0},this.mapPostrenderListenerKey=null,this.addChangeListener(hh.ELEMENT,this.handleElementChanged),this.addChangeListener(hh.MAP,this.handleMapChanged),this.addChangeListener(hh.OFFSET,this.handleOffsetChanged),this.addChangeListener(hh.POSITION,this.handlePositionChanged),this.addChangeListener(hh.POSITIONING,this.handlePositioningChanged),e.element!==void 0&&this.setElement(e.element),this.setOffset(e.offset===void 0?[0,0]:e.offset),this.setPositioning(e.positioning||`top-left`),e.position!==void 0&&this.setPosition(e.position)}getElement(){return this.get(hh.ELEMENT)}getId(){return this.id}getMap(){return this.get(hh.MAP)||null}getOffset(){return this.get(hh.OFFSET)}getPosition(){return this.get(hh.POSITION)}getPositioning(){return this.get(hh.POSITIONING)}handleElementChanged(){Tc(this.element);let e=this.getElement();e&&this.element.appendChild(e)}handleMapChanged(){this.mapPostrenderListenerKey&&=(this.element?.remove(),L(this.mapPostrenderListenerKey),null);let e=this.getMap();if(e){this.mapPostrenderListenerKey=I(e,fm.POSTRENDER,this.render,this),this.updatePixelPosition();let t=this.stopEvent?e.getOverlayContainerStopEvent():e.getOverlayContainer();this.insertFirst?t.insertBefore(this.element,t.childNodes[0]||null):t.appendChild(this.element),this.performAutoPan()}}render(){this.updatePixelPosition()}handleOffsetChanged(){this.updatePixelPosition()}handlePositionChanged(){this.updatePixelPosition(),this.performAutoPan()}handlePositioningChanged(){this.updatePixelPosition()}setElement(e){this.set(hh.ELEMENT,e)}setMap(e){this.set(hh.MAP,e)}setOffset(e){this.set(hh.OFFSET,e)}setPosition(e){this.set(hh.POSITION,e)}performAutoPan(){this.autoPan&&this.panIntoView(this.autoPan)}panIntoView(e){let t=this.getMap();if(!t||!t.getTargetElement()||!this.get(hh.POSITION))return;let n=this.getRect(t.getTargetElement(),t.getSize()),r=this.getElement(),i=this.getRect(r,[Sc(r),Cc(r)]);e||={};let a=e.margin===void 0?20:e.margin;if(!di(n,i)){let r=i[0]-n[0],o=n[2]-i[2],s=i[1]-n[1],c=n[3]-i[3],l=[0,0];if(r<0?l[0]=r-a:o<0&&(l[0]=Math.abs(o)+a),s<0?l[1]=s-a:c<0&&(l[1]=Math.abs(c)+a),l[0]!==0||l[1]!==0){let n=t.getView().getCenterInternal(),r=t.getPixelFromCoordinateInternal(n);if(!r)return;let i=[r[0]+l[0],r[1]+l[1]],a=e.animation||{};t.getView().animateInternal({center:t.getCoordinateFromPixelInternal(i),duration:a.duration,easing:a.easing})}}}getRect(e,t){let n=e.getBoundingClientRect(),r=n.left+window.pageXOffset,i=n.top+window.pageYOffset;return[r,i,r+t[0],i+t[1]]}setPositioning(e){this.set(hh.POSITIONING,e)}setVisible(e){this.rendered.visible!==e&&(this.element.style.display=e?``:`none`,this.rendered.visible=e)}updatePixelPosition(){let e=this.getMap(),t=this.getPosition();if(!e||!e.isRendered()||!t){this.setVisible(!1);return}let n=e.getPixelFromCoordinate(t),r=e.getSize();this.updateRenderedPosition(n,r)}updateRenderedPosition(e,t){let n=this.element.style,r=this.getOffset(),i=this.getPositioning();this.setVisible(!0);let a=`${e[0]+r[0]}px`,o=`${e[1]+r[1]}px`,s=`0%`,c=`0%`;i==`bottom-right`||i==`center-right`||i==`top-right`?s=`-100%`:(i==`bottom-center`||i==`center-center`||i==`top-center`)&&(s=`-50%`),i==`bottom-left`||i==`bottom-center`||i==`bottom-right`?c=`-100%`:(i==`center-left`||i==`center-center`||i==`center-right`)&&(c=`-50%`);let l=`translate(${s}, ${c}) translate(${a}, ${o})`;this.rendered.transform_!=l&&(this.rendered.transform_=l,n.transform=l)}getOptions(){return this.options}},_h=class{constructor(e,t,n,r){this.minX=e,this.maxX=t,this.minY=n,this.maxY=r}contains(e){return this.containsXY(e[1],e[2])}containsTileRange(e){return this.minX<=e.minX&&e.maxX<=this.maxX&&this.minY<=e.minY&&e.maxY<=this.maxY}containsXY(e,t){return this.minX<=e&&e<=this.maxX&&this.minY<=t&&t<=this.maxY}equals(e){return this.minX==e.minX&&this.minY==e.minY&&this.maxX==e.maxX&&this.maxY==e.maxY}extend(e){e.minX<this.minX&&(this.minX=e.minX),e.maxX>this.maxX&&(this.maxX=e.maxX),e.minY<this.minY&&(this.minY=e.minY),e.maxY>this.maxY&&(this.maxY=e.maxY)}getHeight(){return this.maxY-this.minY+1}getSize(){return[this.getWidth(),this.getHeight()]}getWidth(){return this.maxX-this.minX+1}intersects(e){return this.minX<=e.maxX&&this.maxX>=e.minX&&this.minY<=e.maxY&&this.maxY>=e.minY}};function vh(e,t,n,r,i){return i===void 0?new _h(e,t,n,r):(i.minX=e,i.maxX=t,i.minY=n,i.maxY=r,i)}var yh=[],bh=class extends im{constructor(e,t,n,r,i){super(e,t,{transition:0}),this.context_=null,this.executorGroups={},this.loadingSourceTiles=0,this.hitDetectionImageData={},this.replayState_={},this.sourceTiles=[],this.errorTileKeys={},this.wantedResolution,this.getSourceTiles=r.bind(void 0,this),this.removeSourceTiles_=i,this.wrappedTileCoord=n}getContext(){return this.context_||=vc(1,1,yh),this.context_}hasContext(){return!!this.context_}getImage(){return this.hasContext()?this.getContext().canvas:null}getReplayState(e){let t=z(e);return t in this.replayState_||(this.replayState_[t]={dirty:!1,renderedRenderOrder:null,renderedResolution:NaN,renderedPixelRatio:NaN,renderedRevision:-1,renderedTileResolution:NaN,renderedTileRevision:-1,renderedTileZ:-1}),this.replayState_[t]}load(){this.getSourceTiles()}release(){this.context_&&=(xc(this.context_),yh.push(this.context_.canvas),null),this.removeSourceTiles_(this),this.sourceTiles.length=0,super.release()}},xh=class extends im{constructor(e,t,n,r,i,a){super(e,t,a),this.extent=null,this.format_=r,this.features_=null,this.loader_,this.projection=null,this.resolution,this.tileLoadFunction_=i,this.url_=n,this.key=n}getTileUrl(){return this.url_}getFormat(){return this.format_}getFeatures(){return this.features_}load(){this.state==Q.IDLE&&(this.setState(Q.LOADING),this.tileLoadFunction_(this,this.url_),this.loader_&&this.loader_(this.extent,this.resolution,this.projection))}onLoad(e,t){this.setFeatures(e)}onError(){this.setState(Q.ERROR)}setFeatures(e){this.features_=e,this.setState(Q.LOADED)}setLoader(e){this.loader_=e}};function Sh(e,t,n,r){return r===void 0?[e,t,n]:(r[0]=e,r[1]=t,r[2]=n,r)}function Ch(e,t,n){return e+`/`+t+`/`+n}function wh(e,t,n,r,i){return`${z(e)},${t},${Ch(n,r,i)}`}function Th(e){return Eh(e[0],e[1],e[2])}function Eh(e,t,n){return(t<<e)+n}function Dh(e,t){let n=e[0],r=e[1],i=e[2];if(t.getMinZoom()>n||n>t.getMaxZoom())return!1;let a=t.getFullTileRange(n);return a?a.containsXY(r,i):!0}var Oh=[0,0,0],kh=5,Ah=class{constructor(e){this.minZoom=e.minZoom===void 0?0:e.minZoom,this.resolutions_=e.resolutions,B(Lr(this.resolutions_,(e,t)=>t-e,!0),"`resolutions` must be sorted in descending order");let t;if(!e.origins){for(let e=0,n=this.resolutions_.length-1;e<n;++e)if(!t)t=this.resolutions_[e]/this.resolutions_[e+1];else if(this.resolutions_[e]/this.resolutions_[e+1]!==t){t=void 0;break}}this.zoomFactor_=t,this.maxZoom=this.resolutions_.length-1,this.origin_=e.origin===void 0?null:e.origin,this.origins_=null,e.origins!==void 0&&(this.origins_=e.origins,B(this.origins_.length==this.resolutions_.length,"Number of `origins` and `resolutions` must be equal"));let n=e.extent;n!==void 0&&!this.origin_&&!this.origins_&&(this.origin_=Pi(n)),B(!this.origin_&&this.origins_||this.origin_&&!this.origins_,"Either `origin` or `origins` must be configured, never both"),this.tileSizes_=null,e.tileSizes!==void 0&&(this.tileSizes_=e.tileSizes,B(this.tileSizes_.length==this.resolutions_.length,"Number of `tileSizes` and `resolutions` must be equal")),this.tileSize_=e.tileSize===void 0?this.tileSizes_?null:256:e.tileSize,B(!this.tileSize_&&this.tileSizes_||this.tileSize_&&!this.tileSizes_,"Either `tileSize` or `tileSizes` must be configured, never both"),this.extent_=n===void 0?null:n,this.fullTileRanges_=null,this.tmpSize_=[0,0],this.tmpExtent_=[0,0,0,0],e.sizes===void 0?n&&this.calculateTileRanges_(n):this.fullTileRanges_=e.sizes.map((e,t)=>{let r=new _h(Math.min(0,e[0]),Math.max(e[0]-1,-1),Math.min(0,e[1]),Math.max(e[1]-1,-1));if(n){let e=this.getTileRangeForExtentAndZ(n,t);r.minX=Math.max(e.minX,r.minX),r.maxX=Math.min(e.maxX,r.maxX),r.minY=Math.max(e.minY,r.minY),r.maxY=Math.min(e.maxY,r.maxY)}return r})}forEachTileCoord(e,t,n){let r=this.getTileRangeForExtentAndZ(e,t);for(let e=r.minX,i=r.maxX;e<=i;++e)for(let i=r.minY,a=r.maxY;i<=a;++i)n([t,e,i])}forEachTileCoordParentTileRange(e,t,n,r){let i,a,o,s=null,c=e[0]-1;for(this.zoomFactor_===2?(a=e[1],o=e[2]):s=this.getTileCoordExtent(e,r);c>=this.minZoom;){if(a!==void 0&&o!==void 0?(a=Math.floor(a/2),o=Math.floor(o/2),i=vh(a,a,o,o,n)):i=this.getTileRangeForExtentAndZ(s,c,n),t(c,i))return!0;--c}return!1}getExtent(){return this.extent_}getMaxZoom(){return this.maxZoom}getMinZoom(){return this.minZoom}getOrigin(e){return this.origin_?this.origin_:this.origins_[e]}getOrigins(){return this.origins_}getResolution(e){return this.resolutions_[e]}getResolutions(){return this.resolutions_}getTileCoordChildTileRange(e,t,n){if(e[0]<this.maxZoom){if(this.zoomFactor_===2){let n=e[1]*2,r=e[2]*2;return vh(n,n+1,r,r+1,t)}let r=this.getTileCoordExtent(e,n||this.tmpExtent_);return this.getTileRangeForExtentAndZ(r,e[0]+1,t)}return null}getTileRangeForTileCoordAndZ(e,t,n){if(t>this.maxZoom||t<this.minZoom)return null;let r=e[0],i=e[1],a=e[2];if(t===r)return vh(i,a,i,a,n);if(this.zoomFactor_){let e=this.zoomFactor_**+(t-r),o=Math.floor(i*e),s=Math.floor(a*e);return t<r?vh(o,o,s,s,n):vh(o,Math.floor(e*(i+1))-1,s,Math.floor(e*(a+1))-1,n)}let o=this.getTileCoordExtent(e,this.tmpExtent_);return this.getTileRangeForExtentAndZ(o,t,n)}getTileRangeForExtentAndZ(e,t,n){this.getTileCoordForXYAndZ_(e[0],e[3],t,!1,Oh);let r=Oh[1],i=Oh[2];this.getTileCoordForXYAndZ_(e[2],e[1],t,!0,Oh);let a=Oh[1],o=Oh[2];return vh(r,a,i,o,n)}getTileCoordCenter(e){let t=this.getOrigin(e[0]),n=this.getResolution(e[0]),r=Ku(this.getTileSize(e[0]),this.tmpSize_);return[t[0]+(e[1]+.5)*r[0]*n,t[1]-(e[2]+.5)*r[1]*n]}getTileCoordExtent(e,t){let n=this.getOrigin(e[0]),r=this.getResolution(e[0]),i=Ku(this.getTileSize(e[0]),this.tmpSize_),a=n[0]+e[1]*i[0]*r,o=n[1]-(e[2]+1)*i[1]*r;return hi(a,o,a+i[0]*r,o+i[1]*r,t)}getTileCoordForCoordAndResolution(e,t,n){return this.getTileCoordForXYAndResolution_(e[0],e[1],t,!1,n)}getTileCoordForXYAndResolution_(e,t,n,r,i){let a=this.getZForResolution(n),o=n/this.getResolution(a),s=this.getOrigin(a),c=Ku(this.getTileSize(a),this.tmpSize_),l=o*(e-s[0])/n/c[0],u=o*(s[1]-t)/n/c[1];return r?(l=Qi(l,kh)-1,u=Qi(u,kh)-1):(l=Zi(l,kh),u=Zi(u,kh)),Sh(a,l,u,i)}getTileCoordForXYAndZ_(e,t,n,r,i){let a=this.getOrigin(n),o=this.getResolution(n),s=Ku(this.getTileSize(n),this.tmpSize_),c=(e-a[0])/o/s[0],l=(a[1]-t)/o/s[1];return r?(c=Qi(c,kh)-1,l=Qi(l,kh)-1):(c=Zi(c,kh),l=Zi(l,kh)),Sh(n,c,l,i)}getTileCoordForCoordAndZ(e,t,n){return this.getTileCoordForXYAndZ_(e[0],e[1],t,!1,n)}getTileCoordResolution(e){return this.resolutions_[e[0]]}getTileSize(e){return this.tileSize_?this.tileSize_:this.tileSizes_[e]}getFullTileRange(e){return this.fullTileRanges_?this.fullTileRanges_[e]:this.extent_?this.getTileRangeForExtentAndZ(this.extent_,e):null}getZForResolution(e,t){return H(Nr(this.resolutions_,e,t||0),this.minZoom,this.maxZoom)}tileCoordIntersectsViewport(e,t){return qs(t,0,t.length,2,this.getTileCoordExtent(e))}calculateTileRanges_(e){let t=this.resolutions_.length,n=Array(t);for(let r=this.minZoom;r<t;++r)n[r]=this.getTileRangeForExtentAndZ(e,r);this.fullTileRanges_=n}};function jh(e){let t=e.getDefaultTileGrid();return t||(t=Ih(e),e.setDefaultTileGrid(t)),t}function Mh(e,t,n){let r=t[0],i=e.getTileCoordCenter(t),a=Lh(n);if(!ui(a,i)){let t=V(a),n=Math.ceil((a[0]-i[0])/t);return i[0]+=t*n,e.getTileCoordForCoordAndZ(i,r)}return t}function Nh(e,t,n,r){r=r===void 0?`top-left`:r;let i=Fh(e,t,n);return new Ah({extent:e,origin:ki(e,r),resolutions:i,tileSize:n})}function Ph(e){let t=e||{},n=t.extent||yo(`EPSG:3857`).getExtent();return new Ah({extent:n,minZoom:t.minZoom,tileSize:t.tileSize,resolutions:Fh(n,t.maxZoom,t.tileSize,t.maxResolution)})}function Fh(e,t,n,r){t=t===void 0?42:t,n=Ku(n===void 0?256:n);let i=Mi(e),a=V(e);r=r>0?r:Math.max(a/n[0],i/n[1]);let o=t+1,s=Array(o);for(let e=0;e<o;++e)s[e]=r/2**e;return s}function Ih(e,t,n,r){return Nh(Lh(e),t,n,r)}function Lh(e){e=yo(e);let t=e.getExtent();if(!t){let n=180*da.degrees/e.getMetersPerUnit();t=hi(-n,-n,n,n)}return t}var Rh,zh=[];function Bh(e,t,n,r,i){e.beginPath(),e.moveTo(0,0),e.lineTo(t,n),e.lineTo(r,i),e.closePath(),e.save(),e.clip(),e.fillRect(0,0,Math.max(t,r)+1,Math.max(n,i)),e.restore()}function Vh(e,t){return Math.abs(e[t*4]-210)>2||Math.abs(e[t*4+3]-.75*255)>2}function Hh(){if(Rh===void 0){let e=vc(6,6,zh);e.globalCompositeOperation=`lighter`,e.fillStyle=`rgba(210, 0, 0, 0.75)`,Bh(e,4,5,4,0),Bh(e,4,5,0,5);let t=e.getImageData(0,0,3,3).data;Rh=Vh(t,0)||Vh(t,4)||Vh(t,8),xc(e),zh.push(e.canvas)}return Rh}function Uh(e,t,n,r){let i=Ao(n,t,e),a=bo(t,r,n),o=t.getMetersPerUnit();o!==void 0&&(a*=o);let s=e.getMetersPerUnit();s!==void 0&&(a/=s);let c=e.getExtent();if(!c||ui(c,i)){let t=bo(e,a,i)/a;isFinite(t)&&t>0&&(a/=t)}return a}function Wh(e,t,n,r){let i=Uh(e,t,Oi(n),r);return(!isFinite(i)||i<=0)&&wi(n,function(n){return i=Uh(e,t,n,r),isFinite(i)&&i>0}),i}function Gh(e,t,n,r,i,a,o,s,c,l,u,d,f,p){let m=vc(Math.round(n*e),Math.round(n*t),zh);if(d||(m.imageSmoothingEnabled=!1),c.length===0)return m.canvas;m.scale(n,n);function h(e){return Math.round(e*n)/n}m.globalCompositeOperation=`lighter`;let g=mi();c.forEach(function(e,t,n){bi(g,e.extent)});let _,v=n/r,y=(d?1:1+2**-24)/v;if(!f||c.length!==1||l!==0){if(_=vc(Math.round(V(g)*v),Math.round(Mi(g)*v),zh),d||(_.imageSmoothingEnabled=!1),i&&p){let e=(i[0]-g[0])*v,t=-(i[3]-g[3])*v,n=V(i)*v,r=Mi(i)*v;_.rect(e,t,n,r),_.clip()}c.forEach(function(e,t,n){if(e.image.width>0&&e.image.height>0){if(e.clipExtent){_.save();let t=(e.clipExtent[0]-g[0])*v,n=-(e.clipExtent[3]-g[3])*v,r=V(e.clipExtent)*v,i=Mi(e.clipExtent)*v;_.rect(d?t:Math.round(t),d?n:Math.round(n),d?r:Math.round(t+r)-Math.round(t),d?i:Math.round(n+i)-Math.round(n)),_.clip()}let t=(e.extent[0]-g[0])*v,n=-(e.extent[3]-g[3])*v,r=V(e.extent)*v,i=Mi(e.extent)*v;_.drawImage(e.image,l,l,e.image.width-2*l,e.image.height-2*l,d?t:Math.round(t),d?n:Math.round(n),d?r:Math.round(t+r)-Math.round(t),d?i:Math.round(n+i)-Math.round(n)),e.clipExtent&&_.restore()}})}let b=Pi(o);return s.getTriangles().forEach(function(e,t,n){let r=e.source,i=e.target,o=r[0][0],s=r[0][1],l=r[1][0],u=r[1][1],f=r[2][0],p=r[2][1],v=h((i[0][0]-b[0])/a),x=h(-(i[0][1]-b[1])/a),S=h((i[1][0]-b[0])/a),C=h(-(i[1][1]-b[1])/a),w=h((i[2][0]-b[0])/a),T=h(-(i[2][1]-b[1])/a),ee=o,E=s;o=0,s=0,l-=ee,u-=E,f-=ee,p-=E;let D=Gi([[l,u,0,0,S-v],[f,p,0,0,w-v],[0,0,l,u,C-x],[0,0,f,p,T-x]]);if(!D)return;if(m.save(),m.beginPath(),Hh()||!d){m.moveTo(S,C);let e=v-S,t=x-C;for(let n=0;n<4;n++)m.lineTo(S+h((n+1)*e/4),C+h(n*t/3)),n!=3&&m.lineTo(S+h((n+1)*e/4),C+h((n+1)*t/3));m.lineTo(w,T)}else m.moveTo(S,C),m.lineTo(v,x),m.lineTo(w,T);m.clip(),m.transform(D[0],D[2],D[1],D[3],v,x),m.translate(g[0]-ee,g[3]-E);let O;if(_)O=_.canvas,m.scale(y,-y);else{let e=c[0],t=e.extent;O=e.image,m.scale(V(t)/O.width,-Mi(t)/O.height)}m.drawImage(O,0,0),m.restore()}),_&&(xc(_),zh.push(_.canvas)),u&&(m.save(),m.globalCompositeOperation=`source-over`,m.strokeStyle=`black`,m.lineWidth=1,s.getTriangles().forEach(function(e,t,n){let r=e.target,i=(r[0][0]-b[0])/a,o=-(r[0][1]-b[1])/a,s=(r[1][0]-b[0])/a,c=-(r[1][1]-b[1])/a,l=(r[2][0]-b[0])/a,u=-(r[2][1]-b[1])/a;m.beginPath(),m.moveTo(s,c),m.lineTo(i,o),m.lineTo(l,u),m.closePath(),m.stroke()}),m.restore()),m.canvas}var Kh=10,qh=.25,Jh=class{constructor(e,t,n,r,i,a,o){this.sourceProj_=e,this.targetProj_=t;let s={},c=o?wo(e=>Ko(o,Ao(e,this.targetProj_,this.sourceProj_))):ko(this.targetProj_,this.sourceProj_);this.transformInv_=function(e){let t=e[0]+`/`+e[1];return s[t]||(s[t]=c(e)),s[t]},this.maxSourceExtent_=r,this.errorThresholdSquared_=i*i,this.triangles_=[],this.wrapsXInSource_=!1,this.canWrapXInSource_=this.sourceProj_.canWrapX()&&!!r&&!!this.sourceProj_.getExtent()&&V(r)>=V(this.sourceProj_.getExtent()),this.sourceWorldWidth_=this.sourceProj_.getExtent()?V(this.sourceProj_.getExtent()):null,this.targetWorldWidth_=this.targetProj_.getExtent()?V(this.targetProj_.getExtent()):null;let l=Pi(n),u=Fi(n),d=Di(n),f=Ei(n),p=this.transformInv_(l),m=this.transformInv_(u),h=this.transformInv_(d),g=this.transformInv_(f),_=Kh+(a?Math.max(0,Math.ceil(Math.log2(Ti(n)/(a*a*256*256)))):0);if(this.addQuad_(l,u,d,f,p,m,h,g,_),this.wrapsXInSource_){let e=1/0;this.triangles_.forEach(function(t,n,r){e=Math.min(e,t.source[0][0],t.source[1][0],t.source[2][0])}),this.triangles_.forEach(t=>{if(Math.max(t.source[0][0],t.source[1][0],t.source[2][0])-e>this.sourceWorldWidth_/2){let n=[[t.source[0][0],t.source[0][1]],[t.source[1][0],t.source[1][1]],[t.source[2][0],t.source[2][1]]];n[0][0]-e>this.sourceWorldWidth_/2&&(n[0][0]-=this.sourceWorldWidth_),n[1][0]-e>this.sourceWorldWidth_/2&&(n[1][0]-=this.sourceWorldWidth_),n[2][0]-e>this.sourceWorldWidth_/2&&(n[2][0]-=this.sourceWorldWidth_);let r=Math.min(n[0][0],n[1][0],n[2][0]);Math.max(n[0][0],n[1][0],n[2][0])-r<this.sourceWorldWidth_/2&&(t.source=n)}})}s={}}addTriangle_(e,t,n,r,i,a){this.triangles_.push({source:[r,i,a],target:[e,t,n]})}addQuad_(e,t,n,r,i,a,o,s,c){let l=ai([i,a,o,s]),u=this.sourceWorldWidth_?V(l)/this.sourceWorldWidth_:null,d=this.sourceWorldWidth_,f=this.sourceProj_.canWrapX()&&u>.5&&u<1,p=!1;if(c>0&&(this.targetProj_.isGlobal()&&this.targetWorldWidth_&&(p=V(ai([e,t,n,r]))/this.targetWorldWidth_>qh||p),!f&&this.sourceProj_.isGlobal()&&u&&(p=u>qh||p)),!p&&this.maxSourceExtent_&&isFinite(l[0])&&isFinite(l[1])&&isFinite(l[2])&&isFinite(l[3])&&!Ii(l,this.maxSourceExtent_))return;let m=0;if(!p&&(!isFinite(i[0])||!isFinite(i[1])||!isFinite(a[0])||!isFinite(a[1])||!isFinite(o[0])||!isFinite(o[1])||!isFinite(s[0])||!isFinite(s[1]))){if(c>0)p=!0;else if(m=(!isFinite(i[0])||!isFinite(i[1])?8:0)+(!isFinite(a[0])||!isFinite(a[1])?4:0)+(!isFinite(o[0])||!isFinite(o[1])?2:0)+(!isFinite(s[0])||!isFinite(s[1])?1:0),m!=1&&m!=2&&m!=4&&m!=8)return}if(c>0){if(!p){let t=[(e[0]+n[0])/2,(e[1]+n[1])/2],r=this.transformInv_(t),a;a=f?(Ji(i[0],d)+Ji(o[0],d))/2-Ji(r[0],d):(i[0]+o[0])/2-r[0];let s=(i[1]+o[1])/2-r[1];p=a*a+s*s>this.errorThresholdSquared_}if(p){if(Math.abs(e[0]-n[0])<=Math.abs(e[1]-n[1])){let l=[(t[0]+n[0])/2,(t[1]+n[1])/2],u=this.transformInv_(l),d=[(r[0]+e[0])/2,(r[1]+e[1])/2],f=this.transformInv_(d);this.addQuad_(e,t,l,d,i,a,u,f,c-1),this.addQuad_(d,l,n,r,f,u,o,s,c-1)}else{let l=[(e[0]+t[0])/2,(e[1]+t[1])/2],u=this.transformInv_(l),d=[(n[0]+r[0])/2,(n[1]+r[1])/2],f=this.transformInv_(d);this.addQuad_(e,l,d,r,i,u,f,s,c-1),this.addQuad_(l,t,n,d,u,a,o,f,c-1)}return}}if(f){if(!this.canWrapXInSource_)return;this.wrapsXInSource_=!0}m&11||this.addTriangle_(e,n,r,i,o,s),m&14||this.addTriangle_(e,n,t,i,o,a),m&&(m&13||this.addTriangle_(t,r,e,a,s,i),m&7||this.addTriangle_(t,r,n,a,s,o))}calculateSourceExtent(){let e=mi();return this.triangles_.forEach(function(t,n,r){let i=t.source;xi(e,i[0]),xi(e,i[1]),xi(e,i[2])}),e}getTriangles(){return this.triangles_}},Yh=.5,Xh=class extends im{constructor(e,t,n,r,i,a,o,s,c,l,u,d){super(i,Q.IDLE,d),this.renderEdges_=u===void 0?!1:u,this.pixelRatio_=o,this.gutter_=s,this.canvas_=null,this.sourceTileGrid_=t,this.targetTileGrid_=r,this.wrappedTileCoord_=a||i,this.sourceTiles_=[],this.sourcesListenerKeys_=null,this.sourceZ_=0,this.clipExtent_=e.canWrapX()?e.getExtent():void 0;let f=r.getTileCoordExtent(this.wrappedTileCoord_),p=this.targetTileGrid_.getExtent(),m=this.sourceTileGrid_.getExtent(),h=p?Ni(f,p):f;if(Ti(h)===0){this.state=Q.EMPTY;return}let g=e.getExtent();g&&(m=m?Ni(m,g):g);let _=r.getResolution(this.wrappedTileCoord_[0]),v=Wh(e,n,h,_);if(!isFinite(v)||v<=0){this.state=Q.EMPTY;return}if(this.triangulation_=new Jh(e,n,h,m,v*(l===void 0?Yh:l),_),this.triangulation_.getTriangles().length===0){this.state=Q.EMPTY;return}this.sourceZ_=t.getZForResolution(v);let y=this.triangulation_.calculateSourceExtent();if(m&&(e.canWrapX()?(y[1]=H(y[1],m[1],m[3]),y[3]=H(y[3],m[1],m[3])):y=Ni(y,m)),!Ti(y))this.state=Q.EMPTY;else{let n=0,r=0;e.canWrapX()&&(n=V(g),r=Math.floor((y[0]-g[0])/n)),Hi(y.slice(),e,!0).forEach(e=>{let i=t.getTileRangeForExtentAndZ(e,this.sourceZ_);for(let e=i.minX;e<=i.maxX;e++)for(let t=i.minY;t<=i.maxY;t++){let i=r*n;this.sourceTiles_.push({getTile:()=>c(this.sourceZ_,e,t,o),offset:i})}++r}),this.sourceTiles_.length===0&&(this.state=Q.EMPTY)}}getImage(){return this.canvas_}reproject_(){let e=[];if(this.sourceTiles_.forEach(t=>{let n=t.tile;if(n&&n.getState()==Q.LOADED){let r=this.sourceTileGrid_.getTileCoordExtent(n.tileCoord);r[0]+=t.offset,r[2]+=t.offset;let i=this.clipExtent_?.slice();i&&(i[0]+=t.offset,i[2]+=t.offset),e.push({extent:r,clipExtent:i,image:n.getImage()})}}),this.sourceTiles_.length=0,e.length===0)this.state=Q.ERROR;else{let t=this.wrappedTileCoord_[0],n=this.targetTileGrid_.getTileSize(t),r=typeof n==`number`?n:n[0],i=typeof n==`number`?n:n[1],a=this.targetTileGrid_.getResolution(t),o=this.sourceTileGrid_.getResolution(this.sourceZ_),s=this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_);this.canvas_=Gh(r,i,this.pixelRatio_,o,this.sourceTileGrid_.getExtent(),a,s,this.triangulation_,e,this.gutter_,this.renderEdges_,this.interpolate),this.state=Q.LOADED}this.changed()}load(){for(let e of this.sourceTiles_)e.tile=e.getTile();if(this.state==Q.IDLE){this.state=Q.LOADING,this.changed();let e=0;this.sourcesListenerKeys_=[],this.sourceTiles_.forEach(({tile:t})=>{let n=t.getState();if(n==Q.IDLE||n==Q.LOADING){e++;let n=I(t,F.CHANGE,r=>{let i=t.getState();(i==Q.LOADED||i==Q.ERROR||i==Q.EMPTY)&&(L(n),e--,e===0&&(this.unlistenSources_(),this.reproject_()))});this.sourcesListenerKeys_.push(n)}}),e===0?setTimeout(this.reproject_.bind(this),0):this.sourceTiles_.forEach(function({tile:e},t,n){e.getState()==Q.IDLE&&e.load()})}}unlistenSources_(){this.sourcesListenerKeys_.forEach(L),this.sourcesListenerKeys_=null}release(){this.canvas_&&=(xc(this.canvas_.getContext(`2d`)),zh.push(this.canvas_),null),this.sourceTiles_.length=0,super.release()}},Zh=/\{z\}/g,Qh=/\{x\}/g,$h=/\{y\}/g,eg=/\{-y\}/g;function tg(e,t,n,r,i){return e.replace(Zh,t.toString()).replace(Qh,n.toString()).replace($h,r.toString()).replace(eg,function(){if(i===void 0)throw Error(`If the URL template has a {-y} placeholder, the grid extent must be known`);return(i-r).toString()})}function ng(e){let t=[],n=/\{([a-z])-([a-z])\}/.exec(e);if(n){let r=n[1].charCodeAt(0),i=n[2].charCodeAt(0),a;for(a=r;a<=i;++a)t.push(e.replace(n[0],String.fromCharCode(a)));return t}if(n=/\{(\d+)-(\d+)\}/.exec(e),n){let r=parseInt(n[2],10);for(let i=parseInt(n[1],10);i<=r;i++)t.push(e.replace(n[0],i.toString()));return t}return t.push(e),t}function rg(e,t){return(function(n,r,i){if(!n)return;let a,o=n[0];if(t){let e=t.getFullTileRange(o);e&&(a=e.getHeight()-1)}return tg(e,o,n[1],n[2],a)})}function ig(e,t){let n=e.length,r=Array(n);for(let i=0;i<n;++i)r[i]=rg(e[i],t);return ag(r)}function ag(e){return e.length===1?e[0]:(function(t,n,r){if(t)return e[Ji(Th(t),e.length)](t,n,r)})}var og=class extends Lu{constructor(e){super({attributions:e.attributions,attributionsCollapsible:e.attributionsCollapsible,projection:e.projection,state:e.state,wrapX:e.wrapX,interpolate:e.interpolate}),this.on,this.once,this.un,this.tilePixelRatio_=e.tilePixelRatio===void 0?1:e.tilePixelRatio,this.tileGrid=e.tileGrid===void 0?null:e.tileGrid,this.tileGrid&&Ku(this.tileGrid.getTileSize(this.tileGrid.getMinZoom()),[256,256]),this.tmpSize=[0,0],this.key_=e.key||z(this),this.tileOptions={transition:e.transition,interpolate:e.interpolate},this.zDirection=e.zDirection?e.zDirection:0}getGutterForProjection(e){return 0}getKey(){return this.key_}setKey(e){this.key_!==e&&(this.key_=e,this.changed())}getResolutions(e){let t=e?this.getTileGridForProjection(e):this.tileGrid;return t?t.getResolutions():null}getTile(e,t,n,r,i,a){return R()}getTileGrid(){return this.tileGrid}getTileGridForProjection(e){return this.tileGrid?this.tileGrid:jh(e)}getTilePixelRatio(e){return this.tilePixelRatio_}getTilePixelSize(e,t,n){let r=this.getTileGridForProjection(n),i=this.getTilePixelRatio(t),a=Ku(r.getTileSize(e),this.tmpSize);return i==1?a:Gu(a,i,this.tmpSize)}getTileCoordForTileUrlFunction(e,t){let n=t===void 0?this.getProjection():t,r=t===void 0&&this.tileGrid||this.getTileGridForProjection(n);return this.getWrapX()&&n.isGlobal()&&(e=Mh(r,e,n)),Dh(e,r)?e:null}clear(){}refresh(){this.clear(),super.refresh()}},sg=class extends Gr{constructor(e,t){super(e),this.tile=t}},cg={TILELOADSTART:`tileloadstart`,TILELOADEND:`tileloadend`,TILELOADERROR:`tileloaderror`},lg=class e extends og{constructor(t){super({attributions:t.attributions,cacheSize:t.cacheSize,projection:t.projection,state:t.state,tileGrid:t.tileGrid,tilePixelRatio:t.tilePixelRatio,wrapX:t.wrapX,transition:t.transition,interpolate:t.interpolate,key:t.key,attributionsCollapsible:t.attributionsCollapsible,zDirection:t.zDirection}),this.generateTileUrlFunction_=this.tileUrlFunction===e.prototype.tileUrlFunction,this.tileLoadFunction=t.tileLoadFunction,t.tileUrlFunction&&(this.tileUrlFunction=t.tileUrlFunction),this.urls=null,t.urls?this.setUrls(t.urls):t.url&&this.setUrl(t.url),this.tileLoadingKeys_={}}getTileLoadFunction(){return this.tileLoadFunction}getTileUrlFunction(){return Object.getPrototypeOf(this).tileUrlFunction===this.tileUrlFunction?this.tileUrlFunction.bind(this):this.tileUrlFunction}getUrls(){return this.urls}handleTileChange(e){let t=e.target,n=z(t),r=t.getState(),i;r==Q.LOADING?(this.tileLoadingKeys_[n]=!0,i=cg.TILELOADSTART):n in this.tileLoadingKeys_&&(delete this.tileLoadingKeys_[n],i=r==Q.ERROR?cg.TILELOADERROR:r==Q.LOADED?cg.TILELOADEND:void 0),i!=null&&this.dispatchEvent(new sg(i,t))}setTileLoadFunction(e){this.tileLoadFunction=e,this.changed()}setTileUrlFunction(e,t){this.tileUrlFunction=e,t===void 0?this.changed():this.setKey(t)}setUrl(e){let t=ng(e);this.urls=t,this.setUrls(t)}setUrls(e){this.urls=e;let t=e.join(`
|
|
8
|
+
`);this.generateTileUrlFunction_?this.setTileUrlFunction(ig(e,this.tileGrid),t):this.setKey(t)}tileUrlFunction(e,t,n){}},ug=class extends lg{constructor(e){super({attributions:e.attributions,cacheSize:e.cacheSize,projection:e.projection,state:e.state,tileGrid:e.tileGrid,tileLoadFunction:e.tileLoadFunction?e.tileLoadFunction:dg,tilePixelRatio:e.tilePixelRatio,tileUrlFunction:e.tileUrlFunction,url:e.url,urls:e.urls,wrapX:e.wrapX,transition:e.transition,interpolate:e.interpolate===void 0?!0:e.interpolate,key:e.key,attributionsCollapsible:e.attributionsCollapsible,zDirection:e.zDirection}),this.crossOrigin=e.crossOrigin===void 0?null:e.crossOrigin,this.referrerPolicy=e.referrerPolicy,this.tileClass=e.tileClass===void 0?am:e.tileClass,this.tileGridForProjection={},this.reprojectionErrorThreshold_=e.reprojectionErrorThreshold,this.renderReprojectionEdges_=!1}getGutterForProjection(e){return this.getProjection()&&e&&!Eo(this.getProjection(),e)?0:this.getGutter()}getGutter(){return 0}getKey(){let e=super.getKey();return this.getInterpolate()||(e+=`:disable-interpolation`),e}getTileGridForProjection(e){let t=this.getProjection();if(this.tileGrid&&(!t||Eo(t,e)))return this.tileGrid;let n=z(e);return n in this.tileGridForProjection||(this.tileGridForProjection[n]=jh(e)),this.tileGridForProjection[n]}createTile_(e,t,n,r,i,a){let o=[e,t,n],s=this.getTileCoordForTileUrlFunction(o,i),c=s?this.tileUrlFunction(s,r,i):void 0,l=new this.tileClass(o,c===void 0?Q.EMPTY:Q.IDLE,c===void 0?``:c,{crossOrigin:this.crossOrigin,referrerPolicy:this.referrerPolicy},this.tileLoadFunction,this.tileOptions);return l.key=a,l.addEventListener(F.CHANGE,this.handleTileChange.bind(this)),l}getTile(e,t,n,r,i,a){let o=this.getProjection();if(!o||!i||Eo(o,i))return this.getTileInternal(e,t,n,r,o||i);let s=[e,t,n],c=this.getKey(),l=new Xh(o,this.getTileGridForProjection(o),i,this.getTileGridForProjection(i),s,this.getTileCoordForTileUrlFunction(s,i),this.getTilePixelRatio(r),this.getGutter(),(e,t,n,r)=>this.getTileInternal(e,t,n,r,o,a),this.reprojectionErrorThreshold_,this.renderReprojectionEdges_,this.tileOptions);return l.key=c,l}getTileInternal(e,t,n,r,i,a){let o=this.getKey(),s=wh(this,o,e,t,n);if(a&&a.containsKey(s))return a.get(s);let c=this.createTile_(e,t,n,r,i,o);return a?.set(s,c),c}setRenderReprojectionEdges(e){this.renderReprojectionEdges_!=e&&(this.renderReprojectionEdges_=e,this.changed())}setTileGridForProjection(e,t){let n=yo(e);if(n){let e=z(n);e in this.tileGridForProjection||(this.tileGridForProjection[e]=t)}}};function dg(e,t){if(hc){let n=e.getCrossOrigin(),r=`same-origin`,i=`same-origin`;n===`anonymous`||n===``?(r=`cors`,i=`omit`):n===`use-credentials`&&(r=`cors`,i=`include`);let a={mode:r,credentials:i,referrerPolicy:e.getReferrerPolicy()};fetch(t,a).then(e=>{if(!e.ok)throw Error(`HTTP ${e.status}`);return e.blob()}).then(e=>createImageBitmap(e)).then(t=>{let n=e.getImage();n.width=t.width,n.height=t.height,n.getContext(`2d`).drawImage(t,0,0),t.close?.(),n.dispatchEvent(new Event(`load`))}).catch(()=>{e.getImage().dispatchEvent(new Event(`error`))});return}e.getImage().src=t}var fg=class extends ug{constructor(e){e||={};let t=e.projection===void 0?`EPSG:3857`:e.projection,n=e.tileGrid===void 0?Ph({extent:Lh(t),maxResolution:e.maxResolution,maxZoom:e.maxZoom,minZoom:e.minZoom,tileSize:e.tileSize}):e.tileGrid;super({attributions:e.attributions,cacheSize:e.cacheSize,crossOrigin:e.crossOrigin,referrerPolicy:e.referrerPolicy,interpolate:e.interpolate,projection:t,reprojectionErrorThreshold:e.reprojectionErrorThreshold,tileGrid:n,tileLoadFunction:e.tileLoadFunction,tilePixelRatio:e.tilePixelRatio,tileUrlFunction:e.tileUrlFunction,url:e.url,urls:e.urls,wrapX:e.wrapX===void 0?!0:e.wrapX,transition:e.transition,attributionsCollapsible:e.attributionsCollapsible,zDirection:e.zDirection}),this.gutter_=e.gutter===void 0?0:e.gutter}getGutter(){return this.gutter_}},pg=`© <a href="https://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap</a> contributors.`,mg=class extends fg{constructor(e){e||={};let t;t=e.attributions===void 0?[pg]:e.attributions;let n=e.url===void 0?`https://tile.openstreetmap.org/{z}/{x}/{y}.png`:e.url;super({attributions:t,attributionsCollapsible:!1,cacheSize:e.cacheSize,crossOrigin:e.crossOrigin===void 0?`anonymous`:e.crossOrigin,referrerPolicy:e.referrerPolicy||`origin-when-cross-origin`,interpolate:e.interpolate,maxZoom:e.maxZoom===void 0?19:e.maxZoom,reprojectionErrorThreshold:e.reprojectionErrorThreshold,tileLoadFunction:e.tileLoadFunction,transition:e.transition,url:n,wrapX:e.wrapX,zDirection:e.zDirection})}};function hg(e){return e instanceof Image||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageBitmap?e:null}var gg=Error(`disposed`),_g=[256,256],vg=class extends im{constructor(e){let t=Q.IDLE;super(e.tileCoord,t,{transition:e.transition,interpolate:e.interpolate}),this.loader_=e.loader,this.data_=null,this.error_=null,this.size_=e.size||null,this.controller_=e.controller||null}getSize(){if(this.size_)return this.size_;let e=hg(this.data_);return e?[e.width,e.height]:_g}getData(){return this.data_}getError(){return this.error_}load(){if(this.state!==Q.IDLE&&this.state!==Q.ERROR)return;this.state=Q.LOADING,this.changed();let e=this;this.loader_().then(function(t){e.data_=t,e.state=Q.LOADED,e.changed()}).catch(function(t){e.error_=t,e.state=Q.ERROR,e.changed()})}disposeInternal(){this.controller_&&=(this.controller_.abort(gg),null),super.disposeInternal()}},yg=class{constructor(e){this.highWaterMark=e===void 0?2048:e,this.count_=0,this.entries_={},this.oldest_=null,this.newest_=null}deleteOldest(){let e=this.pop();e instanceof kr&&e.dispose()}canExpireCache(){return this.highWaterMark>0&&this.getCount()>this.highWaterMark}expireCache(e){for(;this.canExpireCache();)this.deleteOldest()}clear(){for(;this.oldest_;)this.deleteOldest()}containsKey(e){return this.entries_.hasOwnProperty(e)}forEach(e){let t=this.oldest_;for(;t;)e(t.value_,t.key_,this),t=t.newer}get(e,t){let n=this.entries_[e];return B(n!==void 0,`Tried to get a value for a key that does not exist in the cache`),n===this.newest_?n.value_:(n===this.oldest_?(this.oldest_=this.oldest_.newer,this.oldest_.older=null):(n.newer.older=n.older,n.older.newer=n.newer),n.newer=null,n.older=this.newest_,this.newest_.newer=n,this.newest_=n,n.value_)}remove(e){let t=this.entries_[e];return B(t!==void 0,`Tried to get a value for a key that does not exist in the cache`),t===this.newest_?(this.newest_=t.older,this.newest_&&(this.newest_.newer=null)):t===this.oldest_?(this.oldest_=t.newer,this.oldest_&&(this.oldest_.older=null)):(t.newer.older=t.older,t.older.newer=t.newer),delete this.entries_[e],--this.count_,t.value_}getCount(){return this.count_}getKeys(){let e=Array(this.count_),t=0,n;for(n=this.newest_;n;n=n.older)e[t++]=n.key_;return e}getValues(){let e=Array(this.count_),t=0,n;for(n=this.newest_;n;n=n.older)e[t++]=n.value_;return e}peekLast(){return this.oldest_.value_}peekLastKey(){return this.oldest_.key_}peekFirstKey(){return this.newest_.key_}peek(e){return this.entries_[e]?.value_}pop(){let e=this.oldest_;return delete this.entries_[e.key_],e.newer&&(e.newer.older=null),this.oldest_=e.newer,this.oldest_||(this.newest_=null),--this.count_,e.value_}replace(e,t){this.get(e),this.entries_[e].value_=t}set(e,t){B(!(e in this.entries_),`Tried to set a value for a key that is used already`);let n={key_:e,newer:null,older:this.newest_,value_:t};this.newest_?this.newest_.newer=n:this.oldest_=n,this.newest_=n,this.entries_[e]=n,++this.count_}setSize(e){this.highWaterMark=e}};function bg(e,t,n){if(!(n in e))return e[n]=new Set([t]),!0;let r=e[n],i=r.has(t);return i||r.add(t),!i}function xg(e,t,n){let r=e[n];return r?r.delete(t):!1}function Sg(e,t){let n=e.layerStatesArray[e.layerIndex];n.extent&&(t=Ni(t,Lo(n.extent,e.viewState.projection)));let r=n.layer.getRenderSource();if(!r.getWrapX()){let n=r.getTileGridForProjection(e.viewState.projection).getExtent();n&&(t=Ni(t,n))}return t}var Cg=class extends Yd{constructor(e,t){super(e),t||={},this.extentChanged=!0,this.renderComplete=!1,this.renderedExtent_=null,this.renderedPixelRatio,this.renderedProjection=null,this.renderedTiles=[],this.renderedSourceKey_,this.renderedSourceRevision_,this.tempExtent=mi(),this.tempTileRange_=new _h(0,0,0,0),this.tempTileCoord_=Sh(0,0,0);let n=t.cacheSize===void 0?512:t.cacheSize;this.tileCache_=new yg(n),this.sourceTileCache_=null,this.maxStaleKeys=n*.5}getTileCache(){return this.tileCache_}getSourceTileCache(){return this.sourceTileCache_||=new yg(512),this.sourceTileCache_}getOrCreateTile(e,t,n,r){let i=this.tileCache_,a=this.getLayer().getSource(),o=wh(a,a.getKey(),e,t,n),s;if(i.containsKey(o))s=i.get(o);else{let c=r.viewState.projection,l=a.getProjection();if(s=a.getTile(e,t,n,r.pixelRatio,c,!l||Eo(l,c)?void 0:this.getSourceTileCache()),!s)return null;i.set(o,s)}return s}getTile(e,t,n,r){return this.getOrCreateTile(e,t,n,r)||null}getData(e){let t=this.frameState;if(!t)return null;let n=this.getLayer(),r=Ko(t.pixelToCoordinateTransform,e.slice()),i=n.getExtent();if(i&&!ui(i,r))return null;let a=t.viewState,o=n.getRenderSource(),s=o.getTileGridForProjection(a.projection),c=o.getTilePixelRatio(t.pixelRatio);for(let e=s.getZForResolution(a.resolution);e>=s.getMinZoom();--e){let n=s.getTileCoordForCoordAndZ(r,e),i=this.getTile(e,n[1],n[2],t);if(!i||i.getState()!==Q.LOADED)continue;let l=s.getOrigin(e),u=Ku(s.getTileSize(e)),d=s.getResolution(e),f;if(i instanceof am||i instanceof Xh)f=i.getImage();else if(i instanceof vg){if(f=hg(i.getData()),!f)continue}else continue;let p=Math.floor(c*((r[0]-l[0])/d-n[1]*u[0])),m=Math.floor(c*((l[1]-r[1])/d-n[2]*u[1])),h=Math.round(c*o.getGutterForProjection(a.projection));return this.getImageData(f,p+h,m+h)}return null}prepareFrame(e){this.renderedProjection?e.viewState.projection!==this.renderedProjection&&(this.tileCache_.clear(),this.renderedProjection=e.viewState.projection):this.renderedProjection=e.viewState.projection;let t=this.getLayer().getSource();if(!t)return!1;let n=t.getRevision();return this.renderedSourceRevision_?this.renderedSourceRevision_!==n&&(this.renderedSourceRevision_=n,this.renderedSourceKey_===t.getKey()&&(this.tileCache_.clear(),this.sourceTileCache_?.clear())):this.renderedSourceRevision_=n,!0}enqueueTilesForNextExtent(){return!0}enqueueTiles(e,t,n,r,i){let a=e.viewState,o=this.getLayer(),s=o.getRenderSource(),c=s.getTileGridForProjection(a.projection),l=z(s);l in e.wantedTiles||(e.wantedTiles[l]={});let u=e.wantedTiles[l],d=o.getMapInternal(),f=Math.max(n-i,c.getMinZoom(),c.getZForResolution(Math.min(o.getMaxResolution(),d?d.getView().getResolutionForZoom(Math.max(o.getMinZoom(),0)):c.getResolution(0)),s.zDirection)),p=a.rotation,m=p?ji(a.center,a.resolution,p,e.size):void 0;for(let i=n;i>=f;--i){let n=c.getTileRangeForExtentAndZ(t,i,this.tempTileRange_),a=c.getResolution(i);for(let t=n.minX;t<=n.maxX;++t)for(let o=n.minY;o<=n.maxY;++o){if(p&&!c.tileCoordIntersectsViewport([i,t,o],m))continue;let n=this.getTile(i,t,o,e);if(!n||!bg(r,n,i))continue;let s=n.getKey();if(u[s]=!0,n.getState()===Q.IDLE&&!e.tileQueue.isKeyQueued(s)){let r=Sh(i,t,o,this.tempTileCoord_);e.tileQueue.enqueue([n,l,c.getTileCoordCenter(r),a])}}}}findStaleTile_(e,t){let n=this.tileCache_,r=e[0],i=e[1],a=e[2],o=this.getStaleKeys();for(let e=0;e<o.length;++e){let s=wh(this.getLayer().getSource(),o[e],r,i,a);if(n.containsKey(s)){let e=n.peek(s);if(e.getState()===Q.LOADED)return e.endTransition(z(this)),bg(t,e,r),!0}}return!1}findAltTiles_(e,t,n,r){let i=e.getTileRangeForTileCoordAndZ(t,n,this.tempTileRange_);if(!i)return!1;let a=!0,o=this.tileCache_,s=this.getLayer().getRenderSource(),c=s.getKey();for(let e=i.minX;e<=i.maxX;++e)for(let t=i.minY;t<=i.maxY;++t){let i=wh(s,c,n,e,t),l=!1;if(o.containsKey(i)){let e=o.peek(i);e.getState()===Q.LOADED&&(bg(r,e,n),l=!0)}l||(a=!1)}return a}renderFrame(e,t){this.renderComplete=!0;let n=e.layerStatesArray[e.layerIndex],r=e.viewState,i=r.projection,a=r.resolution,o=r.center,s=e.pixelRatio,c=this.getLayer(),l=c.getSource(),u=l.getTileGridForProjection(i),d=u.getZForResolution(a,l.zDirection),f=u.getResolution(d),p=l.getKey();this.renderedSourceKey_?this.renderedSourceKey_!==p&&(this.prependStaleKey(this.renderedSourceKey_),this.renderedSourceKey_=p):this.renderedSourceKey_=p;let m=e.extent,h=l.getTilePixelRatio(s);this.prepareContainer(e,t);let g=this.context.canvas.width,_=this.context.canvas.height,v=n.extent&&Lo(n.extent,i);v&&(m=Ni(m,Lo(n.extent,i)));let y=f*g/2/h,b=f*_/2/h,x=[o[0]-y,o[1]-b,o[0]+y,o[1]+b],S={};this.renderedTiles.length=0;let C=c.getPreload();if(e.nextExtent&&this.enqueueTilesForNextExtent()){let t=u.getZForResolution(r.nextResolution,l.zDirection),n=Sg(e,e.nextExtent);this.enqueueTiles(e,n,t,S,C)}let w=Sg(e,m);if(this.enqueueTiles(e,w,d,S,0),C>0&&setTimeout(()=>{this.enqueueTiles(e,w,d-1,S,C-1)},0),!(d in S))return this.container;let T=z(this),ee=e.time;for(let t of S[d]){let n=t.getState();if(n===Q.EMPTY)continue;let r=t.tileCoord;if(n===Q.LOADED&&t.getAlpha(T,ee)===1){t.endTransition(T);continue}if(n!==Q.ERROR&&(this.renderComplete=!1),this.findStaleTile_(r,S)){xg(S,t,d),e.animate=!0;continue}if(this.findAltTiles_(u,r,d+1,S))continue;let i=u.getMinZoom();for(let e=d-1;e>=i&&!this.findAltTiles_(u,r,e,S);--e);}let E=f/a*s/h,D=this.getRenderContext(e);Yo(this.tempTransform,g/2,_/2,E,E,0,-g/2,-_/2),n.extent&&this.clipUnrotated(D,e,v),l.getInterpolate()||(D.imageSmoothingEnabled=!1),this.preRender(D,e);let O=Object.keys(S).map(Number);O.sort(jr);let k,te=[],ne=[];for(let t=O.length-1;t>=0;--t){let n=O[t],r=l.getTilePixelSize(n,s,i),a=u.getResolution(n)/f,o=r[0]*a*E,c=r[1]*a*E,d=u.getTileCoordForCoordAndZ(Pi(x),n),p=u.getTileCoordExtent(d),m=Ko(this.tempTransform,[h*(p[0]-x[0])/f,h*(x[3]-p[3])/f]),g=h*l.getGutterForProjection(i);for(let t of S[n]){if(t.getState()!==Q.LOADED)continue;let r=t.tileCoord,i=d[1]-r[1],a=Math.round(m[0]-(i-1)*o),s=d[2]-r[2],u=Math.round(m[1]-(s-1)*c),f=Math.round(m[0]-i*o),p=Math.round(m[1]-s*c),h=a-f,_=u-p,v=O.length===1,y=!1;k=[f,p,f+h,p,f+h,p+_,f,p+_];for(let e=0,t=te.length;e<t;++e)if(!v&&n<ne[e]){let t=te[e];Ii([f,p,f+h,p+_],[t[0],t[3],t[4],t[7]])&&(y||=(D.save(),!0),D.beginPath(),D.moveTo(k[0],k[1]),D.lineTo(k[2],k[3]),D.lineTo(k[4],k[5]),D.lineTo(k[6],k[7]),D.moveTo(t[6],t[7]),D.lineTo(t[4],t[5]),D.lineTo(t[2],t[3]),D.lineTo(t[0],t[1]),D.clip())}te.push(k),ne.push(n),this.drawTile(t,e,f,p,h,_,g,v),y&&D.restore(),this.renderedTiles.unshift(t),this.updateUsedTiles(e.usedTiles,l,t)}}return this.renderedResolution=f,this.extentChanged=!this.renderedExtent_||!yi(this.renderedExtent_,x),this.renderedExtent_=x,this.renderedPixelRatio=s,this.postRender(this.context,e),n.extent&&D.restore(),D.imageSmoothingEnabled=!0,this.renderComplete&&e.postRenderFunctions.push((e,t)=>{let n=z(l),r=t.wantedTiles[n],i=r?Object.keys(r).length:0;this.updateCacheSize(i),this.tileCache_.expireCache(),this.sourceTileCache_?.expireCache()}),this.container}updateCacheSize(e){this.tileCache_.highWaterMark=Math.max(this.tileCache_.highWaterMark,e*2)}drawTile(e,t,n,r,i,a,o,s){let c;if(e instanceof vg){if(c=hg(e.getData()),!c)throw Error(`Rendering array data is not yet supported`)}else c=this.getTileImage(e);if(!c)return;let l=this.getRenderContext(t),u=z(this),d=t.layerStatesArray[t.layerIndex],f=d.opacity*(s?e.getAlpha(u,t.time):1),p=f!==l.globalAlpha;p&&(l.save(),l.globalAlpha=f),l.drawImage(c,o,o,c.width-2*o,c.height-2*o,n,r,i,a),p&&l.restore(),f===d.opacity?s&&e.endTransition(u):t.animate=!0}getImage(){let e=this.context;return e?e.canvas:null}getTileImage(e){return e.getImage()}updateUsedTiles(e,t,n){let r=z(t);r in e||(e[r]={}),e[r][n.getKey()]=!0}},wg={PRELOAD:`preload`,USE_INTERIM_TILES_ON_ERROR:`useInterimTilesOnError`},Tg=class extends Qp{constructor(e){e||={};let t=Object.assign({},e),n=e.cacheSize;delete e.cacheSize,delete t.preload,delete t.useInterimTilesOnError,super(t),this.on,this.once,this.un,this.cacheSize_=n,this.setPreload(e.preload===void 0?0:e.preload),this.setUseInterimTilesOnError(e.useInterimTilesOnError===void 0?!0:e.useInterimTilesOnError)}getCacheSize(){return this.cacheSize_}getPreload(){return this.get(wg.PRELOAD)}setPreload(e){this.set(wg.PRELOAD,e)}getUseInterimTilesOnError(){return this.get(wg.USE_INTERIM_TILES_ON_ERROR)}setUseInterimTilesOnError(e){this.set(wg.USE_INTERIM_TILES_ON_ERROR,e)}getData(e){return super.getData(e)}},Eg=class extends Tg{constructor(e){super(e)}createRenderer(){return new Cg(this,{cacheSize:this.getCacheSize()})}},Dg={image:[`Polygon`,`Circle`,`LineString`,`Image`,`Text`],hybrid:[`Polygon`,`LineString`],vector:[]},Og={hybrid:[`Image`,`Text`,`Default`],vector:[`Polygon`,`Circle`,`LineString`,`Image`,`Text`,`Default`]},kg=class extends Cg{constructor(e,t){super(e,t),this.boundHandleStyleImageChange_=this.handleStyleImageChange_.bind(this),this.renderedLayerRevision_,this.renderedPixelToCoordinateTransform_=null,this.renderedRotation_,this.renderedOpacity_=1,this.tmpTransform_=Vo(),this.tileClipContexts_=null}enqueueTilesForNextExtent(){return this.getLayer().getRenderMode()!==`vector`}drawTile(e,t,n,r,i,a,o,s){this.updateExecutorGroup_(e,t.pixelRatio,t.viewState.projection),this.tileImageNeedsRender_(e)&&this.renderTileImage_(e,t),super.drawTile(e,t,n,r,i,a,o,s)}getTile(e,t,n,r){let i=this.getOrCreateTile(e,t,n,r);if(!i)return null;let a=r.viewState,o=a.resolution,s=r.viewHints,c=this.getLayer().getSource(),l=c.getTileGridForProjection(a.projection),u=!(s[W.ANIMATING]||s[W.INTERACTING]),d=l.getZForResolution(o,c.zDirection)===e;return u&&d?i.wantedResolution=o:i.wantedResolution||=l.getResolution(e),i}prepareFrame(e){let t=this.getLayer().getRevision();return this.renderedLayerRevision_!==t&&(this.renderedLayerRevision_=t,this.renderedTiles.length=0),super.prepareFrame(e)}updateExecutorGroup_(e,t,n){let r=this.getLayer(),i=r.getRevision(),a=r.getRenderOrder()||null,o=e.wantedResolution,s=e.getReplayState(r);if(!s.dirty&&s.renderedResolution===o&&s.renderedRevision==i&&s.renderedPixelRatio===t&&s.renderedRenderOrder==a)return;let c=r.getSource(),l=!!r.getDeclutter(),u=c.getTileGrid(),d=c.getTileGridForProjection(n).getTileCoordExtent(e.wrappedTileCoord),f=c.getSourceTiles(t,n,e),p=z(r);delete e.hitDetectionImageData[p],e.executorGroups[p]=[],s.dirty=!1;for(let i=0,m=f.length;i<m;++i){let m=f[i];if(m.getState()!=Q.LOADED)continue;let h=c.getProjection(),g=m.tileCoord,_=u.getTileCoordExtent(g);n&&h&&!Eo(n,h)&&(_=jo(_,h,n,32));let v=Ni(d,_),y=si(v,r.getRenderBuffer()*o,this.tempExtent),b=yi(_,v)?null:y,x=new hd(0,v,o,t),S=Yl(o,t),C=function(e,t){let n,i=e.getStyleFunction()||r.getStyleFunction();if(i&&(n=i(e,o)),n){let r=this.renderFeature(e,S,n,x,l,t);s.dirty=s.dirty||r}},w=m.getFeatures();a&&a!==s.renderedRenderOrder&&w.sort(a);for(let e=0,t=w.length;e<t;++e){let t=w[e];n&&m.projection&&!Eo(n,m.projection)&&(t=t.clone(),t.getGeometry().applyTransform(ko(m.projection,n))),(!b||Ii(b,t.getGeometry().getExtent()))&&C.call(this,t,e)}let T=x.finish(),ee=new Fd(r.getRenderMode()!==`vector`&&l&&f.length===1?null:v,o,t,c.getOverlaps(),T,r.getRenderBuffer(),!0);e.executorGroups[p].push(ee)}s.renderedRevision=i,s.renderedPixelRatio=t,s.renderedRenderOrder=a,s.renderedResolution=o}forEachFeatureAtCoordinate(e,t,n,r,i){let a=t.viewState.resolution,o=t.viewState.rotation;n??=0;let s=this.getLayer(),c=s.getSource().getTileGridForProjection(t.viewState.projection),l=ai([e]);si(l,a*n,l);let u={},d=function(e,t,n){let a=e.getId();a===void 0&&(a=z(e));let o=u[a];if(!o){if(n===0)return u[a]=!0,r(e,s,t);i.push(u[a]={feature:e,layer:s,geometry:t,distanceSq:n,callback:r})}else if(o!==!0&&n<o.distanceSq){if(n===0)return u[a]=!0,i.splice(i.lastIndexOf(o),1),r(e,s,t);o.geometry=t,o.distanceSq=n}},f=this.renderedTiles,p=z(s),m=s.getDeclutter(),h=m?t.declutter?.[m]?.all().map(e=>e.value):null,g;foundFeature:for(let t=0,r=f.length;t<r;++t){let r=f[t];if(!Ii(c.getTileCoordExtent(r.wrappedTileCoord),l))continue;let i=r.executorGroups[p];for(let t=0,r=i.length;t<r;++t)if(g=i[t].forEachFeatureAtCoordinate(e,a,o,n,d,h),g)break foundFeature}return g}getFeatures(e){return this.renderedTiles.length===0?Promise.resolve([]):new Promise((t,n)=>{let r=this.getLayer(),i=r.getSource(),a=this.renderedProjection,o=a.getExtent(),s=this.renderedResolution,c=i.getTileGridForProjection(a),l=Ko(this.renderedPixelToCoordinateTransform_,e.slice()),u=c.getTileCoordForCoordAndResolution(l,s).toString(),d=this.renderedTiles.find(e=>e.tileCoord.toString()===u&&e.getState()===Q.LOADED);if(!d||d.loadingSourceTiles>0){t([]);return}i.getWrapX()&&a.canWrapX()&&!di(o,c.getTileCoordExtent(d.tileCoord))&&ca(l,a);let f=z(r),p=Pi(c.getTileCoordExtent(d.wrappedTileCoord)),m=[(l[0]-p[0])/s,(p[1]-l[1])/s],h=d.getSourceTiles().reduce((e,t)=>e.concat(t.getFeatures()),[]),g=d.hitDetectionImageData[f];if(!g){let e=Ku(c.getTileSize(c.getZForResolution(s,i.zDirection))),t=this.renderedRotation_;g=Vd(e,[this.getRenderTransform(c.getTileCoordCenter(d.wrappedTileCoord),s,0,Bd,e[0]*Bd,e[1]*Bd,0)],h,r.getStyleFunction(),c.getTileCoordExtent(d.wrappedTileCoord),d.getReplayState(r).renderedResolution,t),d.hitDetectionImageData[f]=g}t(Hd(m,h,g))})}getFeaturesInExtent(e){let t=[],n=this.getTileCache();if(n.getCount()===0)return t;let r=this.getLayer().getSource().getTileGridForProjection(this.frameState.viewState.projection),i=r.getZForResolution(this.renderedResolution),a={};return n.forEach(n=>{if(n.tileCoord[0]!==i||n.getState()!==Q.LOADED)return;let o=n.getSourceTiles();for(let n=0,i=o.length;n<i;++n){let i=o[n],s=i.getKey();if(s in a)continue;a[s]=!0;let c=i.tileCoord;if(Ii(e,r.getTileCoordExtent(c))){let n=i.getFeatures();if(n)for(let r=0,i=n.length;r<i;++r){let i=n[r];Ii(e,i.getGeometry().getExtent())&&t.push(i)}}}}),t}handleFontsChanged(){let e=this.getLayer();e.getVisible()&&this.renderedLayerRevision_!==void 0&&e.changed()}handleStyleImageChange_(e){this.renderIfReadyAndVisible()}renderDeclutter(e,t){let n=this.context,r=n.globalAlpha;n.globalAlpha=t.opacity;let i=e.viewHints,a=!(i[W.ANIMATING]||i[W.INTERACTING]),o=[this.context.canvas.width,this.context.canvas.height],s=this.getLayer().getDeclutter(),c=s?e.declutter?.[s]:void 0,l=z(this.getLayer()),u=this.renderedTiles;for(let t=0,n=u.length;t<n;++t){let n=u[t],r=n.executorGroups[l];if(r)for(let t=r.length-1;t>=0;--t)r[t].execute(this.context,o,this.getTileRenderTransform(n,e),e.viewState.rotation,a,Ad,c)}n.globalAlpha=r}renderDeferredInternal(e){let t=this.renderedTiles,n=z(this.getLayer()),r=t.reduce((e,t,r)=>(t.executorGroups[n].forEach(t=>e.push({executorGroup:t,index:r})),e),[]),i=r.map(({executorGroup:e})=>e.getDeferredZIndexContexts()),a={};for(let e=0,t=r.length;e<t;++e){let t=r[e].executorGroup.getDeferredZIndexContexts();for(let e in t)a[e]=!0}Object.keys(a).map(Number).sort(jr).forEach(e=>{i.forEach((t,n)=>{t[e]&&(t[e].forEach(e=>{let{executorGroup:t,index:i}=r[n],a=t.getRenderedContext(),o=a.globalAlpha;a.globalAlpha=this.renderedOpacity_;let s=this.tileClipContexts_[i];s&&s.draw(a),e.draw(a),s&&a.restore(),a.globalAlpha=o,e.clear()}),t[e].length=0)})})}getTileRenderTransform(e,t){let n=t.pixelRatio,r=t.viewState,i=r.center,a=r.resolution,o=r.rotation,s=t.size,c=Math.round(s[0]*n),l=Math.round(s[1]*n),u=this.getLayer().getSource().getTileGridForProjection(t.viewState.projection),d=e.tileCoord,f=u.getTileCoordExtent(e.wrappedTileCoord),p=u.getTileCoordExtent(d,this.tempExtent)[0]-f[0];return Uo(qo(this.inversePixelTransform.slice(),1/n,1/n),this.getRenderTransform(i,a,o,n,c,l,p))}postRender(e,t){let n=t.viewHints,r=!(n[W.ANIMATING]||n[W.INTERACTING]);this.renderedPixelToCoordinateTransform_=t.pixelToCoordinateTransform.slice(),this.renderedRotation_=t.viewState.rotation,this.renderedOpacity_=t.layerStatesArray[t.layerIndex].opacity;let i=this.getLayer(),a=i.getRenderMode(),o=e.globalAlpha;e.globalAlpha=this.renderedOpacity_;let s=i.getDeclutter(),c=s?Og[a].filter(e=>!Ad.includes(e)):Og[a],l=t.viewState,u=l.rotation,d=i.getSource(),f=d.getTileGridForProjection(l.projection).getZForResolution(l.resolution,d.zDirection),p=this.renderedTiles,m=[],h=[],g=[],_=z(i),v=!0;for(let n=p.length-1;n>=0;--n){let a=p[n];v&&=!a.getReplayState(i).dirty;let o=a.executorGroups[_].filter(e=>e.hasExecutors(c));if(o.length===0)continue;let l=this.getTileRenderTransform(a,t),d=a.tileCoord[0],y=!1,b=o[0].getClipCoords(l),x=e,S;if(b){S=new _d,x=S.getContext();for(let e=0,t=m.length;e<t;++e)if(f!==d&&d<h[e]){let t=m[e];Ii([b[0],b[3],b[4],b[7]],[t[0],t[3],t[4],t[7]])&&(y||=(x.save(),!0),x.beginPath(),x.moveTo(b[0],b[1]),x.lineTo(b[2],b[3]),x.lineTo(b[4],b[5]),x.lineTo(b[6],b[7]),x.moveTo(t[6],t[7]),x.lineTo(t[4],t[5]),x.lineTo(t[2],t[3]),x.lineTo(t[0],t[1]),x.clip())}m.push(b),h.push(d)}for(let n=0,i=o.length;n<i;++n)o[n].execute(e,[e.canvas.width,e.canvas.height],l,u,r,c,t.declutter?.[s]);y&&(x===e?x.restore():g[n]=S)}e.globalAlpha=o,this.ready=v,this.tileClipContexts_=g,t.declutter||this.renderDeferredInternal(t),super.postRender(e,t)}renderFeature(e,t,n,r,i,a){if(!n)return!1;let o=!1;if(Array.isArray(n))for(let s=0,c=n.length;s<c;++s)o=Ql(r,e,n[s],t,this.boundHandleStyleImageChange_,void 0,i,a)||o;else o=Ql(r,e,n,t,this.boundHandleStyleImageChange_,void 0,i,a);return o}tileImageNeedsRender_(e){let t=this.getLayer();if(t.getRenderMode()===`vector`)return!1;let n=e.getReplayState(t),r=t.getRevision(),i=e.wantedResolution;return n.renderedTileResolution!==i||n.renderedTileRevision!==r}renderTileImage_(e,t){let n=this.getLayer(),r=e.getReplayState(n),i=n.getRevision(),a=e.executorGroups[z(n)];r.renderedTileRevision=i;let o=e.wrappedTileCoord,s=o[0],c=n.getSource(),l=t.pixelRatio,u=t.viewState.projection,d=c.getTileGridForProjection(u),f=d.getResolution(e.tileCoord[0]),p=t.pixelRatio/e.wantedResolution*f,m=d.getResolution(s),h=e.getContext();l=Math.round(Math.max(l,p/l));let g=c.getTilePixelSize(s,l,u);h.canvas.width=g[0],h.canvas.height=g[1];let _=l/p;if(_!==1){let e=Ho(this.tmpTransform_);qo(e,_,_),h.setTransform.apply(h,e)}let v=d.getTileCoordExtent(o,this.tempExtent),y=p/m,b=Ho(this.tmpTransform_);qo(b,y,-y),Jo(b,-v[0],-v[3]);for(let e=0,t=a.length;e<t;++e)a[e].execute(h,[h.canvas.width*_,h.canvas.height*_],b,0,!0,Dg[n.getRenderMode()],null);r.renderedTileResolution=e.wantedResolution}},Ag=class extends tm{constructor(e){e||={};let t=Object.assign({},e);delete t.preload;let n=e.cacheSize===void 0?0:e.cacheSize;delete e.cacheSize,delete t.useInterimTilesOnError,super(t),this.on,this.once,this.un,this.cacheSize_=n;let r=e.renderMode||`hybrid`;B(r==`hybrid`||r==`vector`,"`renderMode` must be `'hybrid'` or `'vector'`"),this.renderMode_=r,this.setPreload(e.preload?e.preload:0),this.setUseInterimTilesOnError(e.useInterimTilesOnError===void 0?!0:e.useInterimTilesOnError),this.getBackground,this.setBackground}createRenderer(){return new kg(this,{cacheSize:this.cacheSize_})}getFeatures(e){return super.getFeatures(e)}getFeaturesInExtent(e){return this.getRenderer().getFeaturesInExtent(e)}getRenderMode(){return this.renderMode_}getPreload(){return this.get(wg.PRELOAD)}getUseInterimTilesOnError(){return this.get(wg.USE_INTERIM_TILES_ON_ERROR)}setPreload(e){this.set(wg.PRELOAD,e)}setUseInterimTilesOnError(e){this.set(wg.USE_INTERIM_TILES_ON_ERROR,e)}},jg=class extends lg{constructor(e){let t=e.projection||`EPSG:3857`,n=e.extent||Lh(t),r=e.tileGrid||Ph({extent:n,maxResolution:e.maxResolution,maxZoom:e.maxZoom===void 0?22:e.maxZoom,minZoom:e.minZoom,tileSize:e.tileSize||512});super({attributions:e.attributions,attributionsCollapsible:e.attributionsCollapsible,cacheSize:e.cacheSize,interpolate:!0,projection:t,state:e.state,tileGrid:r,tileLoadFunction:e.tileLoadFunction?e.tileLoadFunction:Mg,tileUrlFunction:e.tileUrlFunction,url:e.url,urls:e.urls,wrapX:e.wrapX===void 0?!0:e.wrapX,transition:e.transition,zDirection:e.zDirection===void 0?1:e.zDirection}),this.format_=e.format?e.format:null,this.tileKeysBySourceTileUrl_={},this.sourceTiles_={},this.overlaps_=e.overlaps==null?!0:e.overlaps,this.tileClass=e.tileClass?e.tileClass:xh,this.tileGrids_={}}getOverlaps(){return this.overlaps_}getSourceTiles(e,t,n){if(n.getState()===Q.IDLE){n.setState(Q.LOADING);let r=n.wrappedTileCoord,i=this.getTileGridForProjection(t),a=i.getTileCoordExtent(r),o=r[0],s=i.getResolution(o);si(a,-s,a);let c=this.projection;t&&this.projection&&!Eo(t,c)&&(a=jo(a,t,c));let l=this.tileGrid,u=l.getExtent();u&&Ni(a,u,a);let d=s;t&&c&&!Eo(t,c)&&(d=s/c.getMetersPerUnit()/t.getMetersPerUnit());let f=l.getZForResolution(d,this.zDirection);l.forEachTileCoord(a,f,r=>{let i=this.tileUrlFunction(r,e,t);this.sourceTiles_[i]||(this.sourceTiles_[i]=new this.tileClass(r,i?Q.IDLE:Q.EMPTY,i,this.format_,this.tileLoadFunction));let a=this.sourceTiles_[i];n.sourceTiles.push(a),this.tileKeysBySourceTileUrl_[i]||(this.tileKeysBySourceTileUrl_[i]=[]),this.tileKeysBySourceTileUrl_[i].push(n.getKey());let o=a.getState();if(o<Q.LOADED){let e=t=>{this.handleTileChange(t);let r=a.getState();if(r===Q.LOADED||r===Q.ERROR){let t=a.getKey();t in n.errorTileKeys?a.getState()===Q.LOADED&&delete n.errorTileKeys[t]:n.loadingSourceTiles--,r===Q.ERROR?n.errorTileKeys[t]=!0:a.removeEventListener(F.CHANGE,e),n.loadingSourceTiles===0&&n.setState(Wr(n.errorTileKeys)?Q.LOADED:Q.ERROR)}};a.addEventListener(F.CHANGE,e),n.loadingSourceTiles++}o===Q.IDLE&&(a.extent=l.getTileCoordExtent(r),a.projection=this.projection,a.resolution=l.getResolution(r[0]),a.load())}),n.loadingSourceTiles||n.setState(n.sourceTiles.some(e=>e.getState()===Q.ERROR)?Q.ERROR:Q.LOADED)}return n.sourceTiles}removeSourceTiles(e){let t=e.getKey(),n=e.sourceTiles;for(let e=0,r=n.length;e<r;++e){let r=n[e].getTileUrl();if(!this.tileKeysBySourceTileUrl_[r])return;let i=this.tileKeysBySourceTileUrl_[r].indexOf(t);i!==-1&&(this.tileKeysBySourceTileUrl_[r].splice(i,1),this.tileKeysBySourceTileUrl_[r].length===0&&(delete this.tileKeysBySourceTileUrl_[r],delete this.sourceTiles_[r]))}}getTile(e,t,n,r,i){let a=[e,t,n],o=this.getTileCoordForTileUrlFunction(a,i),s=this.getTileGrid().getExtent(),c=this.projection,l=this.getTileGridForProjection(i);if(o&&s){let t=l.getTileCoordExtent(o);si(t,-l.getResolution(e),t),Ii(s,!i||!c||Eo(i,c)?t:jo(t,i,c))||(o=null)}let u=!0;if(o!==null){let t=this.tileGrid,n=l.getResolution(e),a=n;i&&c&&!Eo(i,c)&&(a=n/c.getMetersPerUnit()/i.getMetersPerUnit());let s=t.getZForResolution(a,1),d=l.getTileCoordExtent(o);si(d,-n,d),t.forEachTileCoord(!i||!c||Eo(i,c)?d:jo(d,i,c),s,e=>{u&&=!this.tileUrlFunction(e,r,c)})}let d=new bh(a,u?Q.EMPTY:Q.IDLE,o,this.getSourceTiles.bind(this,r,i),this.removeSourceTiles.bind(this));return d.key=this.getKey(),d}getTileGridForProjection(e){let t=e.getCode(),n=this.tileGrids_[t];if(!n){let r=this.projection;if(r!==null&&!Eo(r,e))return jh(e);let i=this.tileGrid,a=i.getResolutions().slice(),o=a.map(function(e,t){return i.getOrigin(t)}),s=a.map(function(e,t){return i.getTileSize(t)});for(let e=a.length;e<43;++e)a.push(a[e-1]/2),o.push(o[e-1]),s.push(s[e-1]);n=new Ah({extent:i.getExtent(),origins:o,resolutions:a,tileSizes:s}),this.tileGrids_[t]=n}return n}getTilePixelRatio(e){return e}getTilePixelSize(e,t,n){let r=Ku(this.getTileGridForProjection(n).getTileSize(e),this.tmpSize);return[Math.round(r[0]*t),Math.round(r[1]*t)]}setOverlaps(e){this.overlaps_=e,this.changed()}};function Mg(e,t){e.setLoader(function(n,r,i){lu(t,e.getFormat(),n,r,i,e.onLoad.bind(e),e.onError.bind(e))})}var Ng=65536*65536,Pg=1/Ng,Fg=12,Ig=typeof TextDecoder>`u`?null:new TextDecoder(`utf-8`),Lg=0,Rg=1,zg=2,Bg=5,Vg=class{constructor(e=new Uint8Array(16)){this.buf=ArrayBuffer.isView(e)?e:new Uint8Array(e),this.dataView=new DataView(this.buf.buffer),this.pos=0,this.type=0,this.length=this.buf.length}readFields(e,t,n=this.length){for(;this.pos<n;){let n=this.readVarint(),r=n>>3,i=this.pos;this.type=n&7,e(r,t,this),this.pos===i&&this.skip(n)}return t}readMessage(e,t){return this.readFields(e,t,this.readVarint()+this.pos)}readFixed32(){let e=this.dataView.getUint32(this.pos,!0);return this.pos+=4,e}readSFixed32(){let e=this.dataView.getInt32(this.pos,!0);return this.pos+=4,e}readFixed64(){let e=this.dataView.getUint32(this.pos,!0)+this.dataView.getUint32(this.pos+4,!0)*Ng;return this.pos+=8,e}readSFixed64(){let e=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*Ng;return this.pos+=8,e}readFloat(){let e=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,e}readDouble(){let e=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,e}readVarint(e){let t=this.buf,n,r;return r=t[this.pos++],n=r&127,r<128||(r=t[this.pos++],n|=(r&127)<<7,r<128)||(r=t[this.pos++],n|=(r&127)<<14,r<128)||(r=t[this.pos++],n|=(r&127)<<21,r<128)?n:(r=t[this.pos],n|=(r&15)<<28,Hg(n,e,this))}readVarint64(){return this.readVarint(!0)}readSVarint(){let e=this.readVarint();return e%2==1?(e+1)/-2:e/2}readBoolean(){return!!this.readVarint()}readString(){let e=this.readVarint()+this.pos,t=this.pos;return this.pos=e,e-t>=Fg&&Ig?Ig.decode(this.buf.subarray(t,e)):r_(this.buf,t,e)}readBytes(){let e=this.readVarint()+this.pos,t=this.buf.subarray(this.pos,e);return this.pos=e,t}readPackedVarint(e=[],t){let n=this.readPackedEnd();for(;this.pos<n;)e.push(this.readVarint(t));return e}readPackedSVarint(e=[]){let t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readSVarint());return e}readPackedBoolean(e=[]){let t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readBoolean());return e}readPackedFloat(e=[]){let t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readFloat());return e}readPackedDouble(e=[]){let t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readDouble());return e}readPackedFixed32(e=[]){let t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readFixed32());return e}readPackedSFixed32(e=[]){let t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readSFixed32());return e}readPackedFixed64(e=[]){let t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readFixed64());return e}readPackedSFixed64(e=[]){let t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readSFixed64());return e}readPackedEnd(){return this.type===zg?this.readVarint()+this.pos:this.pos+1}skip(e){let t=e&7;if(t===Lg)for(;this.buf[this.pos++]>127;);else if(t===zg)this.pos=this.readVarint()+this.pos;else if(t===Bg)this.pos+=4;else if(t===Rg)this.pos+=8;else throw Error(`Unimplemented type: ${t}`)}writeTag(e,t){this.writeVarint(e<<3|t)}realloc(e){let t=this.length||16;for(;t<this.pos+e;)t*=2;if(t!==this.length){let e=new Uint8Array(t);e.set(this.buf),this.buf=e,this.dataView=new DataView(e.buffer),this.length=t}}finish(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)}writeFixed32(e){this.realloc(4),this.dataView.setInt32(this.pos,e,!0),this.pos+=4}writeSFixed32(e){this.realloc(4),this.dataView.setInt32(this.pos,e,!0),this.pos+=4}writeFixed64(e){this.realloc(8),this.dataView.setInt32(this.pos,e&-1,!0),this.dataView.setInt32(this.pos+4,Math.floor(e*Pg),!0),this.pos+=8}writeSFixed64(e){this.realloc(8),this.dataView.setInt32(this.pos,e&-1,!0),this.dataView.setInt32(this.pos+4,Math.floor(e*Pg),!0),this.pos+=8}writeVarint(e){if(e=+e||0,e>268435455||e<0){Wg(e,this);return}this.realloc(4),this.buf[this.pos++]=e&127|(e>127?128:0),!(e<=127)&&(this.buf[this.pos++]=(e>>>=7)&127|(e>127?128:0),!(e<=127)&&(this.buf[this.pos++]=(e>>>=7)&127|(e>127?128:0),!(e<=127)&&(this.buf[this.pos++]=e>>>7&127)))}writeSVarint(e){this.writeVarint(e<0?-e*2-1:e*2)}writeBoolean(e){this.writeVarint(+e)}writeString(e){e=String(e),this.realloc(e.length*4),this.pos++;let t=this.pos;this.pos=i_(this.buf,e,this.pos);let n=this.pos-t;n>=128&&qg(t,n,this),this.pos=t-1,this.writeVarint(n),this.pos+=n}writeFloat(e){this.realloc(4),this.dataView.setFloat32(this.pos,e,!0),this.pos+=4}writeDouble(e){this.realloc(8),this.dataView.setFloat64(this.pos,e,!0),this.pos+=8}writeBytes(e){let t=e.length;this.writeVarint(t),this.realloc(t);for(let n=0;n<t;n++)this.buf[this.pos++]=e[n]}writeRawMessage(e,t){this.pos++;let n=this.pos;e(t,this);let r=this.pos-n;r>=128&&qg(n,r,this),this.pos=n-1,this.writeVarint(r),this.pos+=r}writeMessage(e,t,n){this.writeTag(e,zg),this.writeRawMessage(t,n)}writePackedVarint(e,t){t.length&&this.writeMessage(e,Jg,t)}writePackedSVarint(e,t){t.length&&this.writeMessage(e,Yg,t)}writePackedBoolean(e,t){t.length&&this.writeMessage(e,Qg,t)}writePackedFloat(e,t){t.length&&this.writeMessage(e,Xg,t)}writePackedDouble(e,t){t.length&&this.writeMessage(e,Zg,t)}writePackedFixed32(e,t){t.length&&this.writeMessage(e,$g,t)}writePackedSFixed32(e,t){t.length&&this.writeMessage(e,e_,t)}writePackedFixed64(e,t){t.length&&this.writeMessage(e,t_,t)}writePackedSFixed64(e,t){t.length&&this.writeMessage(e,n_,t)}writeBytesField(e,t){this.writeTag(e,zg),this.writeBytes(t)}writeFixed32Field(e,t){this.writeTag(e,Bg),this.writeFixed32(t)}writeSFixed32Field(e,t){this.writeTag(e,Bg),this.writeSFixed32(t)}writeFixed64Field(e,t){this.writeTag(e,Rg),this.writeFixed64(t)}writeSFixed64Field(e,t){this.writeTag(e,Rg),this.writeSFixed64(t)}writeVarintField(e,t){this.writeTag(e,Lg),this.writeVarint(t)}writeSVarintField(e,t){this.writeTag(e,Lg),this.writeSVarint(t)}writeStringField(e,t){this.writeTag(e,zg),this.writeString(t)}writeFloatField(e,t){this.writeTag(e,Bg),this.writeFloat(t)}writeDoubleField(e,t){this.writeTag(e,Rg),this.writeDouble(t)}writeBooleanField(e,t){this.writeVarintField(e,+t)}};function Hg(e,t,n){let r=n.buf,i,a;if(a=r[n.pos++],i=(a&112)>>4,a<128||(a=r[n.pos++],i|=(a&127)<<3,a<128)||(a=r[n.pos++],i|=(a&127)<<10,a<128)||(a=r[n.pos++],i|=(a&127)<<17,a<128)||(a=r[n.pos++],i|=(a&127)<<24,a<128)||(a=r[n.pos++],i|=(a&1)<<31,a<128))return Ug(e,i,t);throw Error(`Expected varint not more than 10 bytes`)}function Ug(e,t,n){return n?t*4294967296+(e>>>0):(t>>>0)*4294967296+(e>>>0)}function Wg(e,t){let n,r;if(e>=0?(n=e%4294967296|0,r=e/4294967296|0):(n=~(-e%4294967296),r=~(-e/4294967296),n^4294967295?n=n+1|0:(n=0,r=r+1|0)),e>=0x10000000000000000||e<-0x10000000000000000)throw Error(`Given varint doesn't fit into 10 bytes`);t.realloc(10),Gg(n,r,t),Kg(r,t)}function Gg(e,t,n){n.buf[n.pos++]=e&127|128,e>>>=7,n.buf[n.pos++]=e&127|128,e>>>=7,n.buf[n.pos++]=e&127|128,e>>>=7,n.buf[n.pos++]=e&127|128,e>>>=7,n.buf[n.pos]=e&127}function Kg(e,t){let n=(e&7)<<4;t.buf[t.pos++]|=n|((e>>>=3)?128:0),e&&(t.buf[t.pos++]=e&127|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=e&127|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=e&127|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=e&127|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=e&127)))))}function qg(e,t,n){let r=t<=16383?1:t<=2097151?2:t<=268435455?3:Math.floor(Math.log(t)/(Math.LN2*7));n.realloc(r);for(let t=n.pos-1;t>=e;t--)n.buf[t+r]=n.buf[t]}function Jg(e,t){for(let n=0;n<e.length;n++)t.writeVarint(e[n])}function Yg(e,t){for(let n=0;n<e.length;n++)t.writeSVarint(e[n])}function Xg(e,t){for(let n=0;n<e.length;n++)t.writeFloat(e[n])}function Zg(e,t){for(let n=0;n<e.length;n++)t.writeDouble(e[n])}function Qg(e,t){for(let n=0;n<e.length;n++)t.writeBoolean(e[n])}function $g(e,t){for(let n=0;n<e.length;n++)t.writeFixed32(e[n])}function e_(e,t){for(let n=0;n<e.length;n++)t.writeSFixed32(e[n])}function t_(e,t){for(let n=0;n<e.length;n++)t.writeFixed64(e[n])}function n_(e,t){for(let n=0;n<e.length;n++)t.writeSFixed64(e[n])}function r_(e,t,n){let r=``,i=t;for(;i<n;){let t=e[i],a=null,o=t>239?4:t>223?3:t>191?2:1;if(i+o>n)break;let s,c,l;o===1?t<128&&(a=t):o===2?(s=e[i+1],(s&192)==128&&(a=(t&31)<<6|s&63,a<=127&&(a=null))):o===3?(s=e[i+1],c=e[i+2],(s&192)==128&&(c&192)==128&&(a=(t&15)<<12|(s&63)<<6|c&63,(a<=2047||a>=55296&&a<=57343)&&(a=null))):o===4&&(s=e[i+1],c=e[i+2],l=e[i+3],(s&192)==128&&(c&192)==128&&(l&192)==128&&(a=(t&15)<<18|(s&63)<<12|(c&63)<<6|l&63,(a<=65535||a>=1114112)&&(a=null))),a===null?(a=65533,o=1):a>65535&&(a-=65536,r+=String.fromCharCode(a>>>10&1023|55296),a=56320|a&1023),r+=String.fromCharCode(a),i+=o}return r}function i_(e,t,n){for(let r=0,i,a;r<t.length;r++){if(i=t.charCodeAt(r),i>55295&&i<57344)if(a)if(i<56320){e[n++]=239,e[n++]=191,e[n++]=189,a=i;continue}else i=a-55296<<10|i-56320|65536,a=null;else{i>56319||r+1===t.length?(e[n++]=239,e[n++]=191,e[n++]=189):a=i;continue}else a&&=(e[n++]=239,e[n++]=191,e[n++]=189,null);i<128?e[n++]=i:(i<2048?e[n++]=i>>6|192:(i<65536?e[n++]=i>>12|224:(e[n++]=i>>18|240,e[n++]=i>>12&63|128),e[n++]=i>>6&63|128),e[n++]=i&63|128)}return n}var a_=class{constructor(){this.dataProjection=void 0,this.defaultFeatureProjection=void 0,this.featureClass=ni,this.supportedMediaTypes=null}getReadOptions(e,t){if(t){let n=t.dataProjection?yo(t.dataProjection):this.readProjection(e);t.extent&&n&&n.getUnits()===`tile-pixels`&&(n=yo(n),n.setWorldExtent(t.extent)),t={dataProjection:n,featureProjection:t.featureProjection}}return this.adaptOptions(t)}adaptOptions(e){return Object.assign({dataProjection:this.dataProjection,featureProjection:this.defaultFeatureProjection,featureClass:this.featureClass},e)}getType(){return R()}readFeature(e,t){return R()}readFeatures(e,t){return R()}readGeometry(e,t){return R()}readProjection(e){return R()}writeFeature(e,t){return R()}writeFeatures(e,t){return R()}writeGeometry(e,t){return R()}};function o_(e,t,n){let r=n?yo(n.featureProjection):null,i=n?yo(n.dataProjection):null,a=e;if(r&&i&&!Eo(r,i)){t&&(a=e.clone());let n=t?r:i,o=t?i:r;n.getUnits()===`tile-pixels`?a.transform(n,o):a.applyTransform(ko(n,o))}if(t&&n&&n.decimals!==void 0){let t=10**n.decimals;a===e&&(a=e.clone()),a.applyTransform(function(e){for(let n=0,r=e.length;n<r;++n)e[n]=Math.round(e[n]*t)/t;return e})}return a}var s_=class extends a_{constructor(e){super(),e||={},this.dataProjection=new fa({code:``,units:`tile-pixels`}),this.featureClass=e.featureClass?e.featureClass:_u,this.geometryName_=e.geometryName,this.layerName_=e.layerName?e.layerName:`layer`,this.layers_=e.layers?e.layers:null,this.idProperty_=e.idProperty,this.supportedMediaTypes=[`application/vnd.mapbox-vector-tile`,`application/x-protobuf`]}readRawGeometry_(e,t,n,r){e.pos=t.geometry;let i=e.readVarint()+e.pos,a=1,o=0,s=0,c=0,l=0,u=0;for(;e.pos<i;){if(!o){let t=e.readVarint();a=t&7,o=t>>3}if(o--,a===1||a===2)s+=e.readSVarint(),c+=e.readSVarint(),a===1&&l>u&&(r.push(l),u=l),n.push(s,c),l+=2;else if(a===7)l>u&&(n.push(n[u],n[u+1]),l+=2);else throw Error(`Invalid command found in the PBF`)}l>u&&(r.push(l),u=l)}createFeature_(e,t,n){let r=t.type;if(r===0)return null;let i,a=t.properties,o;this.idProperty_?(o=a[this.idProperty_],delete a[this.idProperty_]):o=t.id,a[this.layerName_]=t.layer.name;let s=[],c=[];this.readRawGeometry_(e,t,s,c);let l=f_(r,c.length);if(this.featureClass===_u)i=new this.featureClass(l,s,c,2,a,o),i.transform(n.dataProjection);else{let e;if(l==`Polygon`){let t=nc(s,c);e=t.length>1?new hu(s,`XY`,t):new rc(s,`XY`,c)}else e=l===`Point`?new Ls(s,`XY`):l===`LineString`?new lc(s,`XY`):l===`MultiPoint`?new mu(s,`XY`):l===`MultiLineString`?new pu(s,`XY`,c):null;let t=this.featureClass;i=new t,this.geometryName_&&i.setGeometryName(this.geometryName_);let r=o_(e,!1,n);i.setGeometry(r),o!==void 0&&i.setId(o),i.setProperties(a,!0)}return i}getType(){return`arraybuffer`}readFeatures(e,t){let n=this.layers_;t=this.adaptOptions(t);let r=yo(t.dataProjection);r.setWorldExtent(t.extent),t.dataProjection=r;let i=new Vg(e),a=i.readFields(c_,{}),o=[];for(let e in a){if(n&&!n.includes(e))continue;let s=a[e],c=s?[0,0,s.extent,s.extent]:null;r.setExtent(c);for(let e=0,n=s.length;e<n;++e){let n=d_(i,s,e),r=this.createFeature_(i,n,t);r!==null&&o.push(r)}}return o}readProjection(e){return this.dataProjection}setLayers(e){this.layers_=e}};function c_(e,t,n){if(e===3){let e={keys:[],values:[],features:[]},r=n.readVarint()+n.pos;n.readFields(l_,e,r),e.length=e.features.length,e.length&&(t[e.name]=e)}}function l_(e,t,n){if(e===15)t.version=n.readVarint();else if(e===1)t.name=n.readString();else if(e===5)t.extent=n.readVarint();else if(e===2)t.features.push(n.pos);else if(e===3)t.keys.push(n.readString());else if(e===4){let r=null,i=n.readVarint()+n.pos;for(;n.pos<i;)e=n.readVarint()>>3,r=e===1?n.readString():e===2?n.readFloat():e===3?n.readDouble():e===4?n.readVarint64():e===5?n.readVarint():e===6?n.readSVarint():e===7?n.readBoolean():null;t.values.push(r)}}function u_(e,t,n){if(e==1)t.id=n.readVarint();else if(e==2){let e=n.readVarint()+n.pos;for(;n.pos<e;){let e=t.layer.keys[n.readVarint()],r=t.layer.values[n.readVarint()];t.properties[e]=r}}else e==3?t.type=n.readVarint():e==4&&(t.geometry=n.pos)}function d_(e,t,n){e.pos=t.features[n];let r=e.readVarint()+e.pos,i={layer:t,type:0,properties:{}};return e.readFields(u_,i,r),i}function f_(e,t){let n;return e===1?n=t===1?`Point`:`MultiPoint`:e===2?n=t===1?`LineString`:`MultiLineString`:e===3&&(n=`Polygon`),n}var p_=`
|
|
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
|
|
331
|
-
//# sourceMappingURL=main.iife.js.map
|
|
330
|
+
`;function m_(e,t=100,n={}){if(typeof e!=`function`)throw TypeError(`Expected the first parameter to be a function, got \`${typeof e}\`.`);if(t<0)throw RangeError("`wait` must not be negative.");if(typeof n==`boolean`)throw TypeError("The `options` parameter must be an object, not a boolean. Use `{immediate: true}` instead.");let{immediate:r}=n,i,a,o,s,c;function l(){let t=i,n=a;return i=void 0,a=void 0,c=e.apply(t,n),c}function u(){let e=Date.now()-s;e<t&&e>=0?o=setTimeout(u,t-e):(o=void 0,r||(c=l()))}let d=function(...e){if(i&&this!==i&&Object.getPrototypeOf(this)===Object.getPrototypeOf(i))throw Error(`Debounced method called with different contexts of the same prototype.`);i=this,a=e,s=Date.now();let n=r&&!o;if(o||=setTimeout(u,t),n)return c=l(),c};return Object.defineProperty(d,`isPending`,{get(){return o!==void 0}}),d.clear=()=>{o&&(clearTimeout(o),o=void 0,i=void 0,a=void 0)},d.flush=()=>{o&&d.trigger()},d.trigger=()=>{c=l(),d.clear()},d}var h_=sr(`<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),g_={hash:`svelte-1nwnfh0`,code:`:host {display:block;height:200px;width:200px;}`};function __(e,t){Ae(t,!0),yr(e,g_);function n(e,n){t.$$host.dispatchEvent(new CustomEvent(e,{detail:n}))}let r=kt(null),i=kt(null),a=kt(void 0),o=kt(null),s,c=br(t,`id`,7,``),l=br(t,`center`,23,()=>[37.5176038,15.0819224]),u=br(t,`zoom`,7,6),d=br(t,`source`,23,()=>({type:`osm`})),f=br(t,`options`,23,()=>({})),p=br(t,`data`,23,()=>[]),m=br(t,`screenshot`,7,``);rn(()=>{let e=!1;typeof d()==`string`&&(d(JSON.parse(d())),e=!0),f()&&typeof f()==`string`&&(f(JSON.parse(f())),e=!0),typeof u()==`string`&&(u(Number(u())),e=!0),typeof l()==`string`&&(l(JSON.parse(l())),e=!0),typeof p()==`string`&&(p(JSON.parse(p())),e=!0),e&&y()}),rn(()=>{m()===`yes`&&P(r)&&h()});function h(){!P(r)||!P(i)||(P(r).once(`rendercomplete`,function(){let e=P(r).getSize();if(!e)return;let t=document.createElement(`canvas`);t.width=e[0],t.height=e[1];let a=t.getContext(`2d`);a&&(P(i).querySelectorAll(`.ol-layer canvas`).forEach(function(e){if(e.width>0){let t=e.parentNode?.style?.opacity;a.globalAlpha=!t||t===``?1:Number(t);let n=e.style.transform.match(/^matrix\(([^)]*)\)$/);if(n){let e=n[1].split(`,`).map(Number);a.setTransform(e[0],e[1],e[2],e[3],e[4],e[5])}a.drawImage(e,0,0)}}),a.globalAlpha=1,a.setTransform(1,0,0,1,0,0),n(`screenshotTaken`,{base64:t.toDataURL(`image/png`)}))}),P(r).renderSync())}function g(e){let t=Ao(e.coordinate,`EPSG:3857`,`EPSG:4326`),i=P(r)?.getView?.()?.getCenter?.(),a=Ao(i||l(),`EPSG:3857`,`EPSG:4326`),c=P(r)?.getView?.()?.getZoom?.()||u(),d=P(r)?.forEachFeatureAtPixel(e.pixel,function(e,t){return e});d&&d.get(`marker`)?(n(`markerClick`,{coordinates:{latitude:t[1],longitude:t[0]},id:d.get(`id`)}),d.get(`popupHtml`)&&P(o)?.innerHTML&&(P(o).innerHTML=d.get(`popupHtml`),s?.setPosition(e.coordinate))):(s?.setPosition(void 0),n(`pointClickCoordinates`,{coordinates:{latitude:t[1],longitude:t[0]},zoom:c,center:a}))}let _={positron:{water:`#aad3df`,waterway:`#aad3df`,park:`#d8e8c8`,landcover:`#e8e4de`,landuse:`#ededed`,building:`#d9d0c9`,buildingStroke:`#cfcdca`,road:`#ffffff`,roadCasing:`#cfcdca`,motorway:`#f0c070`,primary:`#fbe29a`,rail:`#bfbfbf`,boundary:`#b3b3b3`},dark_matter:{water:`#0e1626`,waterway:`#0e1626`,park:`#111c11`,landcover:`#121212`,landuse:`#181818`,building:`#222222`,buildingStroke:`#2a2a2a`,road:`#3c3c3c`,roadCasing:`#222222`,motorway:`#4a4a4a`,primary:`#444444`,rail:`#333333`,boundary:`#4a4a4a`},voyager:{water:`#aad3df`,waterway:`#aad3df`,park:`#c8facc`,landcover:`#e8e4de`,landuse:`#ededed`,building:`#e0d8d0`,buildingStroke:`#d5cec4`,road:`#ffffff`,roadCasing:`#e0dcd8`,motorway:`#f0c56c`,primary:`#fbe29a`,rail:`#bfbfbf`,boundary:`#9e9cab`}};function v(e){let t=_[e]||_.voyager;return function(n){switch(n.get(`layer`)){case`water`:return new Xu({fill:new Hu({color:t.water})});case`waterway`:return new Xu({stroke:new Uu({color:t.waterway,width:1})});case`park`:case`landcover`:return new Xu({fill:new Hu({color:t.landcover})});case`landuse`:return new Xu({fill:new Hu({color:t.landuse})});case`building`:return new Xu({fill:new Hu({color:t.building}),stroke:new Uu({color:t.buildingStroke,width:.5})});case`transportation`:{let e=n.get(`class`),r=t.road,i=1;return e===`motorway`||e===`trunk`?(r=t.motorway,i=3):e===`primary`||e===`secondary`?(r=t.primary,i=2):e===`rail`&&(r=t.rail,i=1),new Xu({stroke:new Uu({color:r,width:i})})}case`boundary`:return new Xu({stroke:new Uu({color:t.boundary,width:1,lineDash:[4,4]})});case`aeroway`:return new Xu({stroke:new Uu({color:t.road,width:1}),fill:new Hu({color:t.landuse})});case`place`:case`poi`:case`housenumber`:case`transportation_name`:case`water_name`:case`aerodrome_label`:case`mountain_peak`:return null;default:{let n=e===`dark_matter`||e===`positron`?t.landuse:t.landcover;return new Xu({fill:new Hu({color:n}),stroke:new Uu({color:n,width:1})})}}}}function y(){if(P(i)){if(P(r)){jt(r,null);let e=document.createElement(`style`);e.innerHTML=p_,P(i).innerHTML=``,P(i).appendChild(e)}let e=[];if(d().type.toLowerCase()===`osm`)e.push(new Eg({source:new mg}));else if(d().type.toLowerCase()===`xyz`&&d().url)e.push(new Eg({source:new fg({url:d().url})}));else if(d().type.toLowerCase()===`carto_vector`){let t=d().style||`voyager`,n=_[t]||_.voyager;e.push(new Ag({source:new jg({format:new s_,url:d().url||`https://tiles-d.basemaps.cartocdn.com/vectortiles/carto.streets/v1/{z}/{x}/{y}.mvt`}),style:v(t),background:t===`dark_matter`?n.landuse:void 0}))}let t=[],n=mi();if(p()?.filter?.(e=>e.marker)?.length){let r=[];for(let e of p().filter(e=>e.marker).map(e=>e.marker)){let i=new ni({geometry:e?.lngLat?new Ls(To(e.lngLat)):void 0,icon:e?.icon,marker:!0,id:e?.id||void 0,popupHtml:e?.popupHtml,label:e?.text,textPosition:e?.text_position||f().text_position||`right`,textOffset:e?.text_offset??f().text_offset});r.push(i);let a=i.getGeometry()?.getCoordinates();e?.lngLat&&t.push(e.lngLat),f().centerFromGeometries&&a&&a[2]!==-1/0&&a[3]!==-1/0&&(console.log(`coords`,a),n=bi(n,a))}let i=new Xu({image:new zd({scale:3,anchor:[.5,.8],src:`https://upload.wikimedia.org/wikipedia/commons/e/e7/Maki2-marker-18.svg`})}),a=new rm({source:new Vu({features:r}),style(e){let t=e.get(`icon`),n=e.get(`label`),r=e.get(`textPosition`)||`right`,a=e.get(`textOffset`),o={offsetX:0,offsetY:0,textAlign:`center`,textBaseline:`middle`};if(t?.uri&&n){let e=t.scale||.15,n=t.anchor?.[0]??.5,i=t.anchor?.[1]??.8,s=e>=1?18*e:150*e,c=-(i-.5)*s,l=-(n-.5)*s,u=a??6,d=s/2;switch(r){case`right`:o.offsetX=l+d+u,o.offsetY=c+3,o.textAlign=`left`,o.textBaseline=`middle`;break;case`left`:o.offsetX=l-d-u,o.offsetY=c+3,o.textAlign=`right`,o.textBaseline=`middle`;break;case`top`:o.offsetX=l,o.offsetY=c-d-u,o.textAlign=`center`,o.textBaseline=`bottom`;break;case`bottom`:o.offsetX=l,o.offsetY=c+d+u,o.textAlign=`center`,o.textBaseline=`top`;break}}let s=Math.round(13*(f().text_scale??1)),c=n?new nd({text:n,font:`${s}px sans-serif`,fill:new Hu({color:`#333`}),stroke:new Uu({color:`#fff`,width:3}),...o}):void 0;return t?.uri?new Xu({image:new zd({scale:t.scale||.15,anchor:t.anchor||[.5,.8],src:t.uri,opacity:t.opacity||1,color:t.color||void 0}),text:c}):n?new Xu({text:c}):i}});e.push(a)}s=new gh({element:P(a),autoPan:{animation:{duration:250}}}),jt(r,new ph({target:P(i),layers:e,overlays:[s],view:new Wp({center:To(l()),zoom:u()})}),!0),f()?.centerFromGeometries&&t&&t.length>1&&n[2]!==-1/0&&n[3]!==-1/0?(console.log(`extent`,n),P(r).getView().fit(n,{padding:[25,25,25,25]})):f()?.centerFromGeometries&&P(r).getView().setCenter(To(t[0])),P(r).on(`singleclick`,function(e){g(e)})}}function b(e){s?.setPosition(void 0),e?.target?.blur?.()}_r(()=>{jt(i,t.$$host?.shadowRoot?.querySelector(`#map`),!0),jt(a,t.$$host?.shadowRoot?.querySelector(`#popup`),!0),jt(o,t.$$host?.shadowRoot?.querySelector(`#popup-content`),!0);let e=document.createElement(`style`);e.innerHTML=p_,P(i)?.appendChild(e),y()});var x={get id(){return c()},set id(e=``){c(e),rt()},get center(){return l()},set center(e=[37.5176038,15.0819224]){l(e),rt()},get zoom(){return u()},set zoom(e=6){u(e),rt()},get source(){return d()},set source(e={type:`osm`}){d(e),rt()},get options(){return f()},set options(e={}){f(e),rt()},get data(){return p()},set data(e=[]){p(e),rt()},get screenshot(){return m()},set screenshot(e=``){m(e),rt()}},S=h_(),C=_t(()=>m_(y,200));Qn(`resize`,Lt,function(...e){P(C)?.apply(this,e)});var w=qt(Kt(S),2),T=Gt(w);return xe(2),be(w),$n(`click`,T,e=>b(e)),cr(e,S),je(x)}er([`click`]),customElements.define(`hb-map`,Er(__,{id:{},center:{},zoom:{},source:{},options:{},data:{},screenshot:{}},[],[],{mode:`open`})),e.Component=__})(this.map=this.map||{});
|
|
331
|
+
//# sourceMappingURL=main.iife.js.map
|