@htmlbricks/hb-map 0.65.13 → 0.65.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/main.iife.js +9 -9
- package/main.iife.js.map +1 -1
- package/manifest.json +195 -2
- package/package.json +1 -1
- package/types/webcomponent.type.d.json +18 -0
- package/types/webcomponent.type.d.ts +7 -0
- package/types/webcomponent_events.type.d.json +14 -1
package/main.iife.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
(function(Sa){"use strict";typeof window<"u"&&((window.__svelte??={}).v??=new Set).add("5");const du=1,fu=4,gu=8,_u=16,mu=2,ba="[",La="[!",Aa="]",Rn={},wt=Symbol(),kr=!1;var pu=Array.isArray,yu=Array.prototype.indexOf,Eu=Array.from,ys=Object.keys,Es=Object.defineProperty,gi=Object.getOwnPropertyDescriptor,xu=Object.prototype,vu=Array.prototype,wu=Object.getPrototypeOf,Ma=Object.isExtensible;function Cu(n){for(var t=0;t<n.length;t++)n[t]()}function Ru(){var n,t,e=new Promise((i,s)=>{n=i,t=s});return{promise:e,resolve:n,reject:t}}const gt=2,Nr=4,Pa=8,Re=16,Be=32,Ze=64,xs=128,ae=512,Ct=1024,zt=2048,Te=4096,Ue=8192,Ve=16384,vs=32768,ws=65536,Oa=1<<17,Da=1<<18,Gi=1<<19,Tu=1<<20,_i=32768,Gr=1<<21,Fa=1<<22,Tn=1<<23,Cs=Symbol("$state"),ka=Symbol("legacy props"),Na=new class extends Error{name="StaleReactionError";message="The reaction that called `getAbortSignal()` was re-run or destroyed"},Ga=3,Rs=8;function Iu(n){throw new Error("https://svelte.dev/e/lifecycle_outside_component")}function Su(n){throw new Error("https://svelte.dev/e/effect_in_teardown")}function bu(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function Lu(n){throw new Error("https://svelte.dev/e/effect_orphan")}function Au(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function Mu(){throw new Error("https://svelte.dev/e/hydration_failed")}function Pu(n){throw new Error("https://svelte.dev/e/props_invalid_value")}function Ou(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function Du(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function Fu(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}function ku(){throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror")}function zr(n){console.warn("https://svelte.dev/e/hydration_mismatch")}function Nu(){console.warn("https://svelte.dev/e/svelte_boundary_reset_noop")}let mt=!1;function Ts(n){mt=n}let st;function Ie(n){if(n===null)throw zr(),Rn;return st=n}function za(){return Ie(be(st))}function Gu(n){if(mt){if(be(st)!==null)throw zr(),Rn;st=n}}function Xa(n=1){if(mt){for(var t=n,e=st;t--;)e=be(e);st=e}}function zu(n=!0){for(var t=0,e=st;;){if(e.nodeType===Rs){var i=e.data;if(i===Aa){if(t===0)return e;t-=1}else(i===ba||i===La)&&(t+=1)}var s=be(e);n&&e.remove(),e=s}}function Wa(n){return n===this.v}function Xu(n,t){return n!=n?t==t:n!==t||n!==null&&typeof n=="object"||typeof n=="function"}function Ya(n){return!Xu(n,this.v)}let Wu=!1,Bt=null;function Is(n){Bt=n}function $a(n,t=!1,e){Bt={p:Bt,i:!1,c:null,e:null,s:n,x:null,l:null}}function Ka(n){var t=Bt,e=t.e;if(e!==null){t.e=null;for(var i of e)al(i)}return n!==void 0&&(t.x=n),t.i=!0,Bt=t.p,n??{}}function Ba(){return!0}let mi=[];function Za(){var n=mi;mi=[],Cu(n)}function Ss(n){if(mi.length===0&&!In){var t=mi;queueMicrotask(()=>{t===mi&&Za()})}mi.push(n)}function Yu(){for(;mi.length>0;)Za()}function Ua(n){var t=tt;if(t===null)return j.f|=Tn,n;if((t.f&vs)===0){if((t.f&xs)===0)throw n;t.b.error(n)}else bs(n,t)}function bs(n,t){for(;t!==null;){if((t.f&xs)!==0)try{t.b.error(n);return}catch(e){n=e}t=t.parent}throw n}const Ls=new Set;let Rt=null,Zt=null,Ut=[],As=null,Xr=!1,In=!1;class le{committed=!1;current=new Map;previous=new Map;#e=new Set;#t=new Set;#l=0;#r=0;#h=null;#o=[];#s=[];skipped_effects=new Set;is_fork=!1;is_deferred(){return this.is_fork||this.#r>0}process(t){Ut=[],this.apply();var e={parent:null,effect:null,effects:[],render_effects:[],block_effects:[]};for(const i of t)this.#i(i,e);this.is_fork||this.#c(),this.is_deferred()?(this.#n(e.effects),this.#n(e.render_effects),this.#n(e.block_effects)):(Rt=null,ja(e.render_effects),ja(e.effects),this.#h?.resolve()),Zt=null}#i(t,e){t.f^=Ct;for(var i=t.first;i!==null;){var s=i.f,r=(s&(Be|Ze))!==0,o=r&&(s&Ct)!==0,a=o||(s&Ue)!==0||this.skipped_effects.has(i);if((i.f&xs)!==0&&i.b?.is_pending()&&(e={parent:e,effect:i,effects:[],render_effects:[],block_effects:[]}),!a&&i.fn!==null){r?i.f^=Ct:(s&Nr)!==0?e.effects.push(i):Mn(i)&&((i.f&Re)!==0&&e.block_effects.push(i),Pn(i));var l=i.first;if(l!==null){i=l;continue}}var h=i.parent;for(i=i.next;i===null&&h!==null;)h===e.effect&&(this.#n(e.effects),this.#n(e.render_effects),this.#n(e.block_effects),e=e.parent),i=h.next,h=h.parent}}#n(t){for(const e of t)((e.f&zt)!==0?this.#o:this.#s).push(e),this.#a(e.deps),It(e,Ct)}#a(t){if(t!==null)for(const e of t)(e.f>)===0||(e.f&_i)===0||(e.f^=_i,this.#a(e.deps))}capture(t,e){this.previous.has(t)||this.previous.set(t,e),(t.f&Tn)===0&&(this.current.set(t,t.v),Zt?.set(t,t.v))}activate(){Rt=this,this.apply()}deactivate(){Rt===this&&(Rt=null,Zt=null)}flush(){if(this.activate(),Ut.length>0){if(Va(),Rt!==null&&Rt!==this)return}else this.#l===0&&this.process([]);this.deactivate()}discard(){for(const t of this.#t)t(this);this.#t.clear()}#c(){if(this.#r===0){for(const t of this.#e)t();this.#e.clear()}this.#l===0&&this.#u()}#u(){if(Ls.size>1){this.previous.clear();var t=Zt,e=!0,i={parent:null,effect:null,effects:[],render_effects:[],block_effects:[]};for(const r of Ls){if(r===this){e=!1;continue}const o=[];for(const[l,h]of this.current){if(r.current.has(l))if(e&&h!==r.current.get(l))r.current.set(l,h);else continue;o.push(l)}if(o.length===0)continue;const a=[...r.current.keys()].filter(l=>!this.current.has(l));if(a.length>0){var s=Ut;Ut=[];const l=new Set,h=new Map;for(const c of o)Ha(c,a,l,h);if(Ut.length>0){Rt=r,r.apply();for(const c of Ut)r.#i(c,i);r.deactivate()}Ut=s}}Rt=null,Zt=t}this.committed=!0,Ls.delete(this)}increment(t){this.#l+=1,t&&(this.#r+=1)}decrement(t){this.#l-=1,t&&(this.#r-=1),this.revive()}revive(){for(const t of this.#o)It(t,zt),zi(t);for(const t of this.#s)It(t,Te),zi(t);this.#o=[],this.#s=[],this.flush()}oncommit(t){this.#e.add(t)}ondiscard(t){this.#t.add(t)}settled(){return(this.#h??=Ru()).promise}static ensure(){if(Rt===null){const t=Rt=new le;Ls.add(Rt),In||le.enqueue(()=>{Rt===t&&t.flush()})}return Rt}static enqueue(t){Ss(t)}apply(){}}function pi(n){var t=In;In=!0;try{for(var e;;){if(Yu(),Ut.length===0&&(Rt?.flush(),Ut.length===0))return As=null,e;Va()}}finally{In=t}}function Va(){var n=qe;Xr=!0;var t=null;try{var e=0;for(Ds(!0);Ut.length>0;){var i=le.ensure();if(e++>1e3){var s,r;$u()}i.process(Ut),je.clear()}}finally{Xr=!1,Ds(n),As=null}}function $u(){try{Au()}catch(n){bs(n,As)}}let Se=null;function ja(n){var t=n.length;if(t!==0){for(var e=0;e<t;){var i=n[e++];if((i.f&(Ve|Ue))===0&&Mn(i)&&(Se=new Set,Pn(i),i.deps===null&&i.first===null&&i.nodes_start===null&&(i.teardown===null&&i.ac===null?ul(i):i.fn=null),Se?.size>0)){je.clear();for(const s of Se){if((s.f&(Ve|Ue))!==0)continue;const r=[s];let o=s.parent;for(;o!==null;)Se.has(o)&&(Se.delete(o),r.push(o)),o=o.parent;for(let a=r.length-1;a>=0;a--){const l=r[a];(l.f&(Ve|Ue))===0&&Pn(l)}}Se.clear()}}Se=null}}function Ha(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>)!==0?Ha(s,t,e,i):(r&(Fa|Re))!==0&&(r&zt)===0&&qa(s,t,i)&&(It(s,zt),zi(s))}}function qa(n,t,e){const i=e.get(n);if(i!==void 0)return i;if(n.deps!==null)for(const s of n.deps){if(t.includes(s))return!0;if((s.f>)!==0&&qa(s,t,e))return e.set(s,!0),!0}return e.set(n,!1),!1}function zi(n){for(var t=As=n;t.parent!==null;){t=t.parent;var e=t.f;if(Xr&&t===tt&&(e&Re)!==0&&(e&Da)===0)return;if((e&(Ze|Be))!==0){if((e&Ct)===0)return;t.f^=Ct}}Ut.push(t)}function Ku(n){let t=0,e=Ms(0),i;return()=>{Ps()&&(it(e),ll(()=>(t===0&&(i=Ur(()=>n(()=>Sn(e)))),t+=1,()=>{Ss(()=>{t-=1,t===0&&(i?.(),i=void 0,Sn(e))})})))}}var Bu=ws|Gi|xs;function Zu(n,t,e){new Uu(n,t,e)}class Uu{parent;#e=!1;#t;#l=mt?st:null;#r;#h;#o;#s=null;#i=null;#n=null;#a=null;#c=null;#u=0;#d=0;#g=!1;#f=null;#E=Ku(()=>(this.#f=Ms(this.#u),()=>{this.#f=null}));constructor(t,e,i){this.#t=t,this.#r=e,this.#h=i,this.parent=tt.b,this.#e=!!this.#r.pending,this.#o=hd(()=>{if(tt.b=this,mt){const r=this.#l;za(),r.nodeType===Rs&&r.data===La?this.#v():this.#x()}else{var s=this.#p();try{this.#s=yi(()=>i(s))}catch(r){this.error(r)}this.#d>0?this.#m():this.#e=!1}return()=>{this.#c?.remove()}},Bu),mt&&(this.#t=st)}#x(){try{this.#s=yi(()=>this.#h(this.#t))}catch(t){this.error(t)}this.#e=!1}#v(){const t=this.#r.pending;t&&(this.#i=yi(()=>t(this.#t)),le.enqueue(()=>{var e=this.#p();this.#s=this.#_(()=>(le.ensure(),yi(()=>this.#h(e)))),this.#d>0?this.#m():(Os(this.#i,()=>{this.#i=null}),this.#e=!1)}))}#p(){var t=this.#t;return this.#e&&(this.#c=bn(),this.#t.before(this.#c),t=this.#c),t}is_pending(){return this.#e||!!this.parent&&this.parent.is_pending()}has_pending_snippet(){return!!this.#r.pending}#_(t){var e=tt,i=j,s=Bt;Je(this.#o),jt(this.#o),Is(this.#o.ctx);try{return t()}catch(r){return Ua(r),null}finally{Je(e),jt(i),Is(s)}}#m(){const t=this.#r.pending;this.#s!==null&&(this.#a=document.createDocumentFragment(),this.#a.append(this.#c),fd(this.#s,this.#a)),this.#i===null&&(this.#i=yi(()=>t(this.#t)))}#y(t){if(!this.has_pending_snippet()){this.parent&&this.parent.#y(t);return}this.#d+=t,this.#d===0&&(this.#e=!1,this.#i&&Os(this.#i,()=>{this.#i=null}),this.#a&&(this.#t.before(this.#a),this.#a=null))}update_pending_count(t){this.#y(t),this.#u+=t,this.#f&&el(this.#f,this.#u)}get_effect_pending(){return this.#E(),it(this.#f)}error(t){var e=this.#r.onerror;let i=this.#r.failed;if(this.#g||!e&&!i)throw t;this.#s&&(he(this.#s),this.#s=null),this.#i&&(he(this.#i),this.#i=null),this.#n&&(he(this.#n),this.#n=null),mt&&(Ie(this.#l),Xa(),Ie(zu()));var s=!1,r=!1;const o=()=>{if(s){Nu();return}s=!0,r&&ku(),le.ensure(),this.#u=0,this.#n!==null&&Os(this.#n,()=>{this.#n=null}),this.#e=this.has_pending_snippet(),this.#s=this.#_(()=>(this.#g=!1,yi(()=>this.#h(this.#t)))),this.#d>0?this.#m():this.#e=!1};var a=j;try{jt(null),r=!0,e?.(t,o),r=!1}catch(l){bs(l,this.#o&&this.#o.parent)}finally{jt(a)}i&&Ss(()=>{this.#n=this.#_(()=>{le.ensure(),this.#g=!0;try{return yi(()=>{i(this.#t,()=>t,()=>o)})}catch(l){return bs(l,this.#o.parent),null}finally{this.#g=!1}})})}}function Wr(n){var t=gt|zt,e=j!==null&&(j.f>)!==0?j:null;return tt!==null&&(tt.f|=Gi),{ctx:Bt,deps:null,effects:null,equals:Wa,f:t,fn:n,reactions:null,rv:0,v:wt,wv:0,parent:e??tt,ac:null}}function Vu(n){const t=Wr(n);return gl(t),t}function ju(n){const t=Wr(n);return t.equals=Ya,t}function Ja(n){var t=n.effects;if(t!==null){n.effects=null;for(var e=0;e<t.length;e+=1)he(t[e])}}function Hu(n){for(var t=n.parent;t!==null;){if((t.f>)===0)return(t.f&Ve)===0?t:null;t=t.parent}return null}function Yr(n){var t,e=tt;Je(Hu(n));try{n.f&=~_i,Ja(n),t=El(n)}finally{Je(e)}return t}function Qa(n){var t=Yr(n);if(n.equals(t)||(Rt?.is_fork||(n.v=t),n.wv=pl()),!Ei)if(Zt!==null)Ps()&&Zt.set(n,t);else{var e=(n.f&ae)===0?Te:Ct;It(n,e)}}let $r=new Set;const je=new Map;let tl=!1;function Ms(n,t){var e={f:0,v:n,reactions:null,equals:Wa,rv:0,wv:0};return e}function Vt(n,t){const e=Ms(n);return gl(e),e}function qu(n,t=!1,e=!0){const i=Ms(n);return t||(i.equals=Ya),i}function Mt(n,t,e=!1){j!==null&&(!pe||(j.f&Oa)!==0)&&Ba()&&(j.f&(gt|Re|Fa|Oa))!==0&&!Le?.includes(n)&&Fu();let i=e?Xi(t):t;return el(n,i)}function el(n,t){if(!n.equals(t)){var e=n.v;Ei?je.set(n,t):je.set(n,e),n.v=t;var i=le.ensure();i.capture(n,e),(n.f>)!==0&&((n.f&zt)!==0&&Yr(n),It(n,(n.f&ae)!==0?Ct:Te)),n.wv=pl(),il(n,zt),tt!==null&&(tt.f&Ct)!==0&&(tt.f&(Be|Ze))===0&&(Ht===null?gd([n]):Ht.push(n)),!i.is_fork&&$r.size>0&&!tl&&Ju()}return t}function Ju(){tl=!1;var n=qe;Ds(!0);const t=Array.from($r);try{for(const e of t)(e.f&Ct)!==0&&It(e,Te),Mn(e)&&Pn(e)}finally{Ds(n)}$r.clear()}function Sn(n){Mt(n,n.v+1)}function il(n,t){var e=n.reactions;if(e!==null)for(var i=e.length,s=0;s<i;s++){var r=e[s],o=r.f,a=(o&zt)===0;if(a&&It(r,t),(o>)!==0){var l=r;Zt?.delete(l),(o&_i)===0&&(o&ae&&(r.f|=_i),il(l,Te))}else a&&((o&Re)!==0&&Se!==null&&Se.add(r),zi(r))}}function Xi(n){if(typeof n!="object"||n===null||Cs in n)return n;const t=wu(n);if(t!==xu&&t!==vu)return n;var e=new Map,i=pu(n),s=Vt(0),r=xi,o=a=>{if(xi===r)return a();var l=j,h=xi;jt(null),ml(r);var c=a();return jt(l),ml(h),c};return i&&e.set("length",Vt(n.length)),new Proxy(n,{defineProperty(a,l,h){(!("value"in h)||h.configurable===!1||h.enumerable===!1||h.writable===!1)&&Ou();var c=e.get(l);return c===void 0?c=o(()=>{var u=Vt(h.value);return e.set(l,u),u}):Mt(c,h.value,!0),!0},deleteProperty(a,l){var h=e.get(l);if(h===void 0){if(l in a){const c=o(()=>Vt(wt));e.set(l,c),Sn(s)}}else Mt(h,wt),Sn(s);return!0},get(a,l,h){if(l===Cs)return n;var c=e.get(l),u=l in a;if(c===void 0&&(!u||gi(a,l)?.writable)&&(c=o(()=>{var f=Xi(u?a[l]:wt),g=Vt(f);return g}),e.set(l,c)),c!==void 0){var d=it(c);return d===wt?void 0:d}return Reflect.get(a,l,h)},getOwnPropertyDescriptor(a,l){var h=Reflect.getOwnPropertyDescriptor(a,l);if(h&&"value"in h){var c=e.get(l);c&&(h.value=it(c))}else if(h===void 0){var u=e.get(l),d=u?.v;if(u!==void 0&&d!==wt)return{enumerable:!0,configurable:!0,value:d,writable:!0}}return h},has(a,l){if(l===Cs)return!0;var h=e.get(l),c=h!==void 0&&h.v!==wt||Reflect.has(a,l);if(h!==void 0||tt!==null&&(!c||gi(a,l)?.writable)){h===void 0&&(h=o(()=>{var d=c?Xi(a[l]):wt,f=Vt(d);return f}),e.set(l,h));var u=it(h);if(u===wt)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?Mt(g,wt):f in a&&(g=o(()=>Vt(wt)),e.set(f+"",g))}if(u===void 0)(!d||gi(a,l)?.writable)&&(u=o(()=>Vt(void 0)),Mt(u,Xi(h)),e.set(l,u));else{d=u.v!==wt;var m=o(()=>Xi(h));Mt(u,m)}var _=Reflect.getOwnPropertyDescriptor(a,l);if(_?.set&&_.set.call(c,h),!d){if(i&&typeof l=="string"){var p=e.get("length"),y=Number(l);Number.isInteger(y)&&y>=p.v&&Mt(p,y+1)}Sn(s)}return!0},ownKeys(a){it(s);var l=Reflect.ownKeys(a).filter(u=>{var d=e.get(u);return d===void 0||d.v!==wt});for(var[h,c]of e)c.v!==wt&&!(h in a)&&l.push(h);return l},setPrototypeOf(){Du()}})}var Kr,nl,sl,rl;function Br(){if(Kr===void 0){Kr=window,nl=/Firefox/.test(navigator.userAgent);var n=Element.prototype,t=Node.prototype,e=Text.prototype;sl=gi(t,"firstChild").get,rl=gi(t,"nextSibling").get,Ma(n)&&(n.__click=void 0,n.__className=void 0,n.__attributes=null,n.__style=void 0,n.__e=void 0),Ma(e)&&(e.__t=void 0)}}function bn(n=""){return document.createTextNode(n)}function Ln(n){return sl.call(n)}function be(n){return rl.call(n)}function Qu(n,t){if(!mt)return Ln(n);var e=Ln(st);return e===null&&(e=st.appendChild(bn())),Ie(e),e}function td(n,t=!1){if(!mt){var e=Ln(n);return e instanceof Comment&&e.data===""?be(e):e}if(t&&st?.nodeType!==Ga){var i=bn();return st?.before(i),Ie(i),i}return st}function ed(n,t=1,e=!1){let i=mt?st:n;for(var s;t--;)s=i,i=be(i);if(!mt)return i;if(e&&i?.nodeType!==Ga){var r=bn();return i===null?s?.after(r):i.before(r),Ie(r),r}return Ie(i),i}function id(n){n.textContent=""}function Zr(n){var t=j,e=tt;jt(null),Je(null);try{return n()}finally{jt(t),Je(e)}}function nd(n){tt===null&&(j===null&&Lu(),bu()),Ei&&Su()}function sd(n,t){var e=t.last;e===null?t.last=t.first=n:(e.next=n,n.prev=e,t.last=n)}function He(n,t,e){var i=tt;i!==null&&(i.f&Ue)!==0&&(n|=Ue);var s={ctx:Bt,deps:null,nodes_start:null,nodes_end:null,f:n|zt|ae,first:null,fn:t,last:null,next:null,parent:i,b:i&&i.b,prev:null,teardown:null,transitions:null,wv:0,ac:null};if(e)try{Pn(s),s.f|=vs}catch(a){throw he(s),a}else t!==null&&zi(s);var r=s;if(e&&r.deps===null&&r.teardown===null&&r.nodes_start===null&&r.first===r.last&&(r.f&Gi)===0&&(r=r.first,(n&Re)!==0&&(n&ws)!==0&&r!==null&&(r.f|=ws)),r!==null&&(r.parent=i,i!==null&&sd(r,i),j!==null&&(j.f>)!==0&&(n&Ze)===0)){var o=j;(o.effects??=[]).push(r)}return s}function Ps(){return j!==null&&!pe}function rd(n){const t=He(Pa,null,!1);return It(t,Ct),t.teardown=n,t}function ol(n){nd();var t=tt.f,e=!j&&(t&Be)!==0&&(t&vs)===0;if(e){var i=Bt;(i.e??=[]).push(n)}else return al(n)}function al(n){return He(Nr|Tu,n,!1)}function od(n){le.ensure();const t=He(Ze|Gi,n,!0);return()=>{he(t)}}function ad(n){le.ensure();const t=He(Ze|Gi,n,!0);return(e={})=>new Promise(i=>{e.outro?Os(t,()=>{he(t),i(void 0)}):(he(t),i(void 0))})}function ld(n){return He(Nr,n,!1)}function ll(n,t=0){return He(Pa|t,n,!0)}function hd(n,t=0){var e=He(Re|t,n,!0);return e}function yi(n){return He(Be|Gi,n,!0)}function hl(n){var t=n.teardown;if(t!==null){const e=Ei,i=j;fl(!0),jt(null);try{t.call(null)}finally{fl(e),jt(i)}}}function cl(n,t=!1){var e=n.first;for(n.first=n.last=null;e!==null;){const s=e.ac;s!==null&&Zr(()=>{s.abort(Na)});var i=e.next;(e.f&Ze)!==0?e.parent=null:he(e,t),e=i}}function cd(n){for(var t=n.first;t!==null;){var e=t.next;(t.f&Be)===0&&he(t),t=e}}function he(n,t=!0){var e=!1;(t||(n.f&Da)!==0)&&n.nodes_start!==null&&n.nodes_end!==null&&(ud(n.nodes_start,n.nodes_end),e=!0),cl(n,t&&!e),Fs(n,0),It(n,Ve);var i=n.transitions;if(i!==null)for(const r of i)r.stop();hl(n);var s=n.parent;s!==null&&s.first!==null&&ul(n),n.next=n.prev=n.teardown=n.ctx=n.deps=n.fn=n.nodes_start=n.nodes_end=n.ac=null}function ud(n,t){for(;n!==null;){var e=n===t?null:be(n);n.remove(),n=e}}function ul(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 Os(n,t,e=!0){var i=[];dl(n,i,!0),dd(i,()=>{e&&he(n),t&&t()})}function dd(n,t){var e=n.length;if(e>0){var i=()=>--e||t();for(var s of n)s.out(i)}else t()}function dl(n,t,e){if((n.f&Ue)===0){if(n.f^=Ue,n.transitions!==null)for(const o of n.transitions)(o.is_global||e)&&t.push(o);for(var i=n.first;i!==null;){var s=i.next,r=(i.f&ws)!==0||(i.f&Be)!==0&&(n.f&Re)!==0;dl(i,t,r?e:!1),i=s}}}function fd(n,t){for(var e=n.nodes_start,i=n.nodes_end;e!==null;){var s=e===i?null:be(e);t.append(e),e=s}}let qe=!1;function Ds(n){qe=n}let Ei=!1;function fl(n){Ei=n}let j=null,pe=!1;function jt(n){j=n}let tt=null;function Je(n){tt=n}let Le=null;function gl(n){j!==null&&(Le===null?Le=[n]:Le.push(n))}let Tt=null,Xt=0,Ht=null;function gd(n){Ht=n}let _l=1,An=0,xi=An;function ml(n){xi=n}function pl(){return++_l}function Mn(n){var t=n.f;if((t&zt)!==0)return!0;if(t>&&(n.f&=~_i),(t&Te)!==0){var e=n.deps;if(e!==null)for(var i=e.length,s=0;s<i;s++){var r=e[s];if(Mn(r)&&Qa(r),r.wv>n.wv)return!0}(t&ae)!==0&&Zt===null&&It(n,Ct)}return!1}function yl(n,t,e=!0){var i=n.reactions;if(i!==null&&!Le?.includes(n))for(var s=0;s<i.length;s++){var r=i[s];(r.f>)!==0?yl(r,t,!1):t===r&&(e?It(r,zt):(r.f&Ct)!==0&&It(r,Te),zi(r))}}function El(n){var t=Tt,e=Xt,i=Ht,s=j,r=Le,o=Bt,a=pe,l=xi,h=n.f;Tt=null,Xt=0,Ht=null,j=(h&(Be|Ze))===0?n:null,Le=null,Is(n.ctx),pe=!1,xi=++An,n.ac!==null&&(Zr(()=>{n.ac.abort(Na)}),n.ac=null);try{n.f|=Gr;var c=n.fn,u=c(),d=n.deps;if(Tt!==null){var f;if(Fs(n,Xt),d!==null&&Xt>0)for(d.length=Xt+Tt.length,f=0;f<Tt.length;f++)d[Xt+f]=Tt[f];else n.deps=d=Tt;if(qe&&Ps()&&(n.f&ae)!==0)for(f=Xt;f<d.length;f++)(d[f].reactions??=[]).push(n)}else d!==null&&Xt<d.length&&(Fs(n,Xt),d.length=Xt);if(Ba()&&Ht!==null&&!pe&&d!==null&&(n.f&(gt|Te|zt))===0)for(f=0;f<Ht.length;f++)yl(Ht[f],n);return s!==null&&s!==n&&(An++,Ht!==null&&(i===null?i=Ht:i.push(...Ht))),(n.f&Tn)!==0&&(n.f^=Tn),u}catch(g){return Ua(g)}finally{n.f^=Gr,Tt=t,Xt=e,Ht=i,j=s,Le=r,Is(o),pe=a,xi=l}}function _d(n,t){let e=t.reactions;if(e!==null){var i=yu.call(e,n);if(i!==-1){var s=e.length-1;s===0?e=t.reactions=null:(e[i]=e[s],e.pop())}}e===null&&(t.f>)!==0&&(Tt===null||!Tt.includes(t))&&(It(t,Te),(t.f&ae)!==0&&(t.f^=ae,t.f&=~_i),Ja(t),Fs(t,0))}function Fs(n,t){var e=n.deps;if(e!==null)for(var i=t;i<e.length;i++)_d(n,e[i])}function Pn(n){var t=n.f;if((t&Ve)===0){It(n,Ct);var e=tt,i=qe;tt=n,qe=!0;try{(t&Re)!==0?cd(n):cl(n),hl(n);var s=El(n);n.teardown=typeof s=="function"?s:null,n.wv=_l;var r;kr&&Wu&&(n.f&zt)!==0&&n.deps}finally{qe=i,tt=e}}}function it(n){var t=n.f,e=(t>)!==0;if(j!==null&&!pe){var i=tt!==null&&(tt.f&Ve)!==0;if(!i&&!Le?.includes(n)){var s=j.deps;if((j.f&Gr)!==0)n.rv<An&&(n.rv=An,Tt===null&&s!==null&&s[Xt]===n?Xt++:Tt===null?Tt=[n]:Tt.includes(n)||Tt.push(n));else{(j.deps??=[]).push(n);var r=n.reactions;r===null?n.reactions=[j]:r.includes(j)||r.push(j)}}}if(Ei){if(je.has(n))return je.get(n);if(e){var o=n,a=o.v;return((o.f&Ct)===0&&o.reactions!==null||vl(o))&&(a=Yr(o)),je.set(o,a),a}}else e&&!Zt?.has(n)&&(o=n,Mn(o)&&Qa(o),qe&&Ps()&&(o.f&ae)===0&&xl(o));if(Zt?.has(n))return Zt.get(n);if((n.f&Tn)!==0)throw n.v;return n.v}function xl(n){if(n.deps!==null){n.f^=ae;for(const t of n.deps)(t.reactions??=[]).push(n),(t.f>)!==0&&(t.f&ae)===0&&xl(t)}}function vl(n){if(n.v===wt)return!0;if(n.deps===null)return!1;for(const t of n.deps)if(je.has(t)||(t.f>)!==0&&vl(t))return!0;return!1}function Ur(n){var t=pe;try{return pe=!0,n()}finally{pe=t}}const md=-7169;function It(n,t){n.f=n.f&md|t}const wl=new Set,Vr=new Set;function pd(n,t,e,i={}){function s(r){if(i.capture||On.call(t,r),!r.cancelBubble)return Zr(()=>e?.call(this,r))}return n.startsWith("pointer")||n.startsWith("touch")||n==="wheel"?Ss(()=>{t.addEventListener(n,s,i)}):t.addEventListener(n,s,i),s}function yd(n,t,e,i,s){var r={capture:i,passive:s},o=pd(n,t,e,r);(t===document.body||t===window||t===document||t instanceof HTMLMediaElement)&&rd(()=>{t.removeEventListener(n,o,r)})}function Ed(n){for(var t=0;t<n.length;t++)wl.add(n[t]);for(var e of Vr)e(n)}let Cl=null;function On(n){var t=this,e=t.ownerDocument,i=n.type,s=n.composedPath?.()||[],r=s[0]||n.target;Cl=n;var o=0,a=Cl===n&&n.__root;if(a){var l=s.indexOf(a);if(l!==-1&&(t===document||t===window)){n.__root=t;return}var h=s.indexOf(t);if(h===-1)return;l<=h&&(o=l)}if(r=s[o]||n.target,r!==t){Es(n,"currentTarget",{configurable:!0,get(){return r||e}});var c=j,u=tt;jt(null),Je(null);try{for(var d,f=[];r!==null;){var g=r.assignedSlot||r.parentNode||r.host||null;try{var m=r["__"+i];m!=null&&(!r.disabled||n.target===r)&&m.call(r,n)}catch(_){d?f.push(_):d=_}if(n.cancelBubble||g===t||g===null)break;r=g}if(d){for(let _ of f)queueMicrotask(()=>{throw _});throw d}}finally{n.__root=t,delete n.currentTarget,jt(c),Je(u)}}}function xd(n){var t=document.createElement("template");return t.innerHTML=n.replaceAll("<!>","<!---->"),t.content}function jr(n,t){var e=tt;e.nodes_start===null&&(e.nodes_start=n,e.nodes_end=t)}function vd(n,t){var e=(t&mu)!==0,i,s=!n.startsWith("<!>");return()=>{if(mt)return jr(st,null),st;i===void 0&&(i=xd(s?n:"<!>"+n));var r=e||nl?document.importNode(i,!0):i.cloneNode(!0);{var o=Ln(r),a=r.lastChild;jr(o,a)}return r}}function Rl(n,t){if(mt){var e=tt;((e.f&vs)===0||e.nodes_end===null)&&(e.nodes_end=st),za();return}n!==null&&n.before(t)}const wd=["touchstart","touchmove"];function Cd(n){return wd.includes(n)}function Tl(n,t){return Il(n,t)}function Rd(n,t){Br(),t.intro=t.intro??!1;const e=t.target,i=mt,s=st;try{for(var r=Ln(e);r&&(r.nodeType!==Rs||r.data!==ba);)r=be(r);if(!r)throw Rn;Ts(!0),Ie(r);const o=Il(n,{...t,anchor:r});return Ts(!1),o}catch(o){if(o instanceof Error&&o.message.split(`
|
|
2
|
-
`).some(a=>a.startsWith("https://svelte.dev/e/")))throw o;return o!==Rn&&console.warn("Failed to hydrate: ",o),t.recover===!1&&Mu(),Br(),id(e),Ts(!1),Tl(n,t)}finally{Ts(i),Ie(s)}}const Wi=new Map;function Il(n,{target:t,anchor:e,props:i={},events:s,context:r,intro:o=!0}){Br();var a=new Set,l=u=>{for(var d=0;d<u.length;d++){var f=u[d];if(!a.has(f)){a.add(f);var g=Cd(f);t.addEventListener(f,On,{passive:g});var m=Wi.get(f);m===void 0?(document.addEventListener(f,On,{passive:g}),Wi.set(f,1)):Wi.set(f,m+1)}}};l(Eu(wl)),Vr.add(l);var h=void 0,c=ad(()=>{var u=e??t.appendChild(bn());return Zu(u,{pending:()=>{}},d=>{if(r){$a({});var f=Bt;f.c=r}if(s&&(i.$$events=s),mt&&jr(d,null),h=n(d,i)||{},mt&&(tt.nodes_end=st,st===null||st.nodeType!==Rs||st.data!==Aa))throw zr(),Rn;r&&Ka()}),()=>{for(var d of a){t.removeEventListener(d,On);var f=Wi.get(d);--f===0?(document.removeEventListener(d,On),Wi.delete(d)):Wi.set(d,f)}Vr.delete(l),u!==e&&u.parentNode?.removeChild(u)}});return Hr.set(h,c),h}let Hr=new WeakMap;function Td(n,t){const e=Hr.get(n);return e?(Hr.delete(n),e(t)):Promise.resolve()}function Id(n){Bt===null&&Iu(),ol(()=>{const t=Ur(n);if(typeof t=="function")return t})}function Sd(n,t){ld(()=>{var e=n.getRootNode(),i=e.host?e:e.head??e.ownerDocument.head;if(!i.querySelector("#"+t.hash)){const s=document.createElement("style");s.id=t.hash,s.textContent=t.code,i.appendChild(s)}})}let ks=!1;function bd(n){var t=ks;try{return ks=!1,[n(),ks]}finally{ks=t}}function Yi(n,t,e,i){var s=(e&gu)!==0,r=(e&_u)!==0,o=i,a=!0,l=()=>(a&&(a=!1,o=r?Ur(i):i),o),h;if(s){var c=Cs in n||ka in n;h=gi(n,t)?.set??(c&&t in n?y=>n[t]=y:void 0)}var u,d=!1;s?[u,d]=bd(()=>n[t]):u=n[t],u===void 0&&i!==void 0&&(u=l(),h&&(Pu(),h(u)));var f;if(f=()=>{var y=n[t];return y===void 0?l():(a=!0,y)},(e&fu)===0)return f;if(h){var g=n.$$legacy;return(function(y,w){return arguments.length>0?((!w||g||d)&&h(w?f():y),y):f()})}var m=!1,_=((e&du)!==0?Wr:ju)(()=>(m=!1,f()));s&&it(_);var p=tt;return(function(y,w){if(arguments.length>0){const E=w?it(_):s?Xi(y):y;return Mt(_,E),m=!0,o!==void 0&&(o=E),y}return Ei&&m||(p.f&Ve)!==0?_.v:it(_)})}function Ld(n){return new Ad(n)}class Ad{#e;#t;constructor(t){var e=new Map,i=(r,o)=>{var a=qu(o,!1,!1);return e.set(r,a),a};const s=new Proxy({...t.props||{},$$events:{}},{get(r,o){return it(e.get(o)??i(o,Reflect.get(r,o)))},has(r,o){return o===ka?!0:(it(e.get(o)??i(o,Reflect.get(r,o))),Reflect.has(r,o))},set(r,o,a){return Mt(e.get(o)??i(o,a),a),Reflect.set(r,o,a)}});this.#t=(t.hydrate?Rd:Tl)(t.component,{target:t.target,anchor:t.anchor,props:s,context:t.context,intro:t.intro??!1,recover:t.recover}),(!t?.props?.$$host||t.sync===!1)&&pi(),this.#e=s.$$events;for(const r of Object.keys(this.#t))r==="$set"||r==="$destroy"||r==="$on"||Es(this,r,{get(){return this.#t[r]},set(o){this.#t[r]=o},enumerable:!0});this.#t.$set=r=>{Object.assign(s,r)},this.#t.$destroy=()=>{Td(this.#t)}}$set(t){this.#t.$set(t)}$on(t,e){this.#e[t]=this.#e[t]||[];const i=(...s)=>e.call(this,...s);return this.#e[t].push(i),()=>{this.#e[t]=this.#e[t].filter(s=>s!==i)}}$destroy(){this.#t.$destroy()}}let Sl;typeof HTMLElement=="function"&&(Sl=class extends HTMLElement{$$ctor;$$s;$$c;$$cn=!1;$$d={};$$r=!1;$$p_d={};$$l={};$$l_u=new Map;$$me;constructor(n,t,e){super(),this.$$ctor=n,this.$$s=t,e&&this.attachShadow({mode:"open"})}addEventListener(n,t,e){if(this.$$l[n]=this.$$l[n]||[],this.$$l[n].push(t),this.$$c){const i=this.$$c.$on(n,t);this.$$l_u.set(t,i)}super.addEventListener(n,t,e)}removeEventListener(n,t,e){if(super.removeEventListener(n,t,e),this.$$c){const i=this.$$l_u.get(t);i&&(i(),this.$$l_u.delete(t))}}async connectedCallback(){if(this.$$cn=!0,!this.$$c){let n=function(i){return s=>{const r=document.createElement("slot");i!=="default"&&(r.name=i),Rl(s,r)}};if(await Promise.resolve(),!this.$$cn||this.$$c)return;const t={},e=Md(this);for(const i of this.$$s)i in e&&(i==="default"&&!this.$$d.children?(this.$$d.children=n(i),t.default=!0):t[i]=n(i));for(const i of this.attributes){const s=this.$$g_p(i.name);s in this.$$d||(this.$$d[s]=Ns(s,i.value,this.$$p_d,"toProp"))}for(const i in this.$$p_d)!(i in this.$$d)&&this[i]!==void 0&&(this.$$d[i]=this[i],delete this[i]);this.$$c=Ld({component:this.$$ctor,target:this.shadowRoot||this,props:{...this.$$d,$$slots:t,$$host:this}}),this.$$me=od(()=>{ll(()=>{this.$$r=!0;for(const i of ys(this.$$c)){if(!this.$$p_d[i]?.reflect)continue;this.$$d[i]=this.$$c[i];const s=Ns(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]=Ns(n,e,this.$$p_d,"toProp"),this.$$c?.$set({[n]:this.$$d[n]}))}disconnectedCallback(){this.$$cn=!1,Promise.resolve().then(()=>{!this.$$cn&&this.$$c&&(this.$$c.$destroy(),this.$$me(),this.$$c=void 0)})}$$g_p(n){return ys(this.$$p_d).find(t=>this.$$p_d[t].attribute===n||!this.$$p_d[t].attribute&&t.toLowerCase()===n)||n}});function Ns(n,t,e,i){const s=e[n]?.type;if(t=s==="Boolean"&&typeof t!="boolean"?t!=null:t,!i||!e[n])return t;if(i==="toAttribute")switch(s){case"Object":case"Array":return t==null?null:JSON.stringify(t);case"Boolean":return t?"":null;case"Number":return t??null;default:return t}else switch(s){case"Object":case"Array":return t&&JSON.parse(t);case"Boolean":return t;case"Number":return t!=null?+t:t;default:return t}}function Md(n){const t={};return n.childNodes.forEach(e=>{t[e.slot||"default"]=!0}),t}function Pd(n,t,e,i,s,r){let o=class extends Sl{constructor(){super(n,e,s),this.$$p_d=t}static get observedAttributes(){return ys(t).map(a=>(t[a].attribute||a).toLowerCase())}};return ys(t).forEach(a=>{Es(o.prototype,a,{get(){return this.$$c&&a in this.$$c?this.$$c[a]:this.$$d[a]},set(l){l=Ns(a,l,t),this.$$d[a]=l;var h=this.$$c;if(h){var c=gi(h,a)?.get;c?h[a]=l:h.$set({[a]:l})}}})}),i.forEach(a=>{Es(o.prototype,a,{get(){return this.$$c?.[a]}})}),n.element=o,o}const Pt={ADD:"add",REMOVE:"remove"},$i={PROPERTYCHANGE:"propertychange"},z={CHANGE:"change",ERROR:"error",CONTEXTMENU:"contextmenu",CLICK:"click",DBLCLICK:"dblclick",KEYDOWN:"keydown",KEYPRESS:"keypress",LOAD:"load",TOUCHMOVE:"touchmove",WHEEL:"wheel"};class Gs{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}}function Od(n,t,e){let i,s;e=e||Ae;let r=0,o=n.length,a=!1;for(;r<o;)i=r+(o-r>>1),s=+e(n[i],t),s<0?r=i+1:(o=i,a=!s);return a?r:~r}function Ae(n,t){return n>t?1:n<t?-1:0}function Dd(n,t){return n<t?1:n>t?-1:0}function qr(n,t,e){if(n[0]<=t)return 0;const i=n.length;if(t<=n[i-1])return i-1;if(typeof e=="function"){for(let s=1;s<i;++s){const r=n[s];if(r===t)return s;if(r<t)return e(t,n[s-1],r)>0?s-1:s}return i-1}if(e>0){for(let s=1;s<i;++s)if(n[s]<t)return s-1;return i-1}if(e<0){for(let s=1;s<i;++s)if(n[s]<=t)return s;return i-1}for(let s=1;s<i;++s){if(n[s]==t)return s;if(n[s]<t)return n[s-1]-t<t-n[s]?s-1:s}return i-1}function Fd(n,t,e){for(;t<e;){const i=n[t];n[t]=n[e],n[e]=i,++t,--e}}function Jr(n,t){const e=Array.isArray(t)?t:[t],i=e.length;for(let s=0;s<i;s++)n[n.length]=e[s]}function Qe(n,t){const e=n.length;if(e!==t.length)return!1;for(let i=0;i<e;i++)if(n[i]!==t[i])return!1;return!0}function kd(n,t,e){const i=t||Ae;return n.every(function(s,r){if(r===0)return!0;const o=i(n[r-1],s);return!(o>0||o===0)})}function Dn(){return!0}function zs(){return!1}function Fn(){}function bl(n){let t,e,i;return function(){const s=Array.prototype.slice.call(arguments);return(!e||this!==i||!Qe(s,e))&&(i=this,e=s,t=n.apply(this,arguments)),t}}function Nd(n){function t(){let e;try{e=n()}catch(i){return Promise.reject(i)}return e instanceof Promise?e:Promise.resolve(e)}return t()}function kn(n){for(const t in n)delete n[t]}function Ki(n){let t;for(t in n)return!1;return!t}class Me{constructor(t){this.propagationStopped,this.defaultPrevented,this.type=t,this.target=null}preventDefault(){this.defaultPrevented=!0}stopPropagation(){this.propagationStopped=!0}}class Xs extends Gs{constructor(t){super(),this.eventTarget_=t,this.pendingRemovals_=null,this.dispatching_=null,this.listeners_=null}addEventListener(t,e){if(!t||!e)return;const i=this.listeners_||(this.listeners_={}),s=i[t]||(i[t]=[]);s.includes(e)||s.push(e)}dispatchEvent(t){const e=typeof t=="string",i=e?t:t.type,s=this.listeners_&&this.listeners_[i];if(!s)return;const r=e?new Me(t):t;r.target||(r.target=this.eventTarget_||this);const o=this.dispatching_||(this.dispatching_={}),a=this.pendingRemovals_||(this.pendingRemovals_={});i in o||(o[i]=0,a[i]=0),++o[i];let l;for(let h=0,c=s.length;h<c;++h)if("handleEvent"in s[h]?l=s[h].handleEvent(r):l=s[h].call(this,r),l===!1||r.propagationStopped){l=!1;break}if(--o[i]===0){let h=a[i];for(delete a[i];h--;)this.removeEventListener(i,Fn);delete o[i]}return l}disposeInternal(){this.listeners_&&kn(this.listeners_)}getListeners(t){return this.listeners_&&this.listeners_[t]||void 0}hasListener(t){return this.listeners_?t?t in this.listeners_:Object.keys(this.listeners_).length>0:!1}removeEventListener(t,e){if(!this.listeners_)return;const i=this.listeners_[t];if(!i)return;const s=i.indexOf(e);s!==-1&&(this.pendingRemovals_&&t in this.pendingRemovals_?(i[s]=Fn,++this.pendingRemovals_[t]):(i.splice(s,1),i.length===0&&delete this.listeners_[t]))}}function Z(n,t,e,i,s){if(s){const o=e;e=function(a){return n.removeEventListener(t,e),o.call(i??this,a)}}else i&&i!==n&&(e=e.bind(i));const r={target:n,type:t,listener:e};return n.addEventListener(t,e),r}function Ws(n,t,e,i){return Z(n,t,e,i,!0)}function nt(n){n&&n.target&&(n.target.removeEventListener(n.type,n.listener),kn(n))}class Nn extends Xs{constructor(){super(),this.on=this.onInternal,this.once=this.onceInternal,this.un=this.unInternal,this.revision_=0}changed(){++this.revision_,this.dispatchEvent(z.CHANGE)}getRevision(){return this.revision_}onInternal(t,e){if(Array.isArray(t)){const i=t.length,s=new Array(i);for(let r=0;r<i;++r)s[r]=Z(this,t[r],e);return s}return Z(this,t,e)}onceInternal(t,e){let i;if(Array.isArray(t)){const s=t.length;i=new Array(s);for(let r=0;r<s;++r)i[r]=Ws(this,t[r],e)}else i=Ws(this,t,e);return e.ol_key=i,i}unInternal(t,e){const i=e.ol_key;if(i)Gd(i);else if(Array.isArray(t))for(let s=0,r=t.length;s<r;++s)this.removeEventListener(t[s],e);else this.removeEventListener(t,e)}}Nn.prototype.on,Nn.prototype.once,Nn.prototype.un;function Gd(n){if(Array.isArray(n))for(let t=0,e=n.length;t<e;++t)nt(n[t]);else nt(n)}function U(){throw new Error("Unimplemented abstract method.")}let zd=0;function V(n){return n.ol_uid||(n.ol_uid=String(++zd))}class Ll extends Me{constructor(t,e,i){super(t),this.key=e,this.oldValue=i}}class ce extends Nn{constructor(t){super(),this.on,this.once,this.un,V(this),this.values_=null,t!==void 0&&this.setProperties(t)}get(t){let e;return this.values_&&this.values_.hasOwnProperty(t)&&(e=this.values_[t]),e}getKeys(){return this.values_&&Object.keys(this.values_)||[]}getProperties(){return this.values_&&Object.assign({},this.values_)||{}}getPropertiesInternal(){return this.values_}hasProperties(){return!!this.values_}notify(t,e){let i;i=`change:${t}`,this.hasListener(i)&&this.dispatchEvent(new Ll(i,t,e)),i=$i.PROPERTYCHANGE,this.hasListener(i)&&this.dispatchEvent(new Ll(i,t,e))}addChangeListener(t,e){this.addEventListener(`change:${t}`,e)}removeChangeListener(t,e){this.removeEventListener(`change:${t}`,e)}set(t,e,i){const s=this.values_||(this.values_={});if(i)s[t]=e;else{const r=s[t];s[t]=e,r!==e&&this.notify(t,r)}}setProperties(t,e){for(const i in t)this.set(i,t[i],e)}applyProperties(t){t.values_&&Object.assign(this.values_||(this.values_={}),t.values_)}unset(t,e){if(this.values_&&t in this.values_){const i=this.values_[t];delete this.values_[t],Ki(this.values_)&&(this.values_=null),e||this.notify(t,i)}}}const Al={LENGTH:"length"};class Ys extends Me{constructor(t,e,i){super(t),this.element=e,this.index=i}}class qt extends ce{constructor(t,e){if(super(),this.on,this.once,this.un,e=e||{},this.unique_=!!e.unique,this.array_=t??[],this.unique_)for(let i=1,s=this.array_.length;i<s;++i)this.assertUnique_(this.array_[i],i);this.updateLength_()}clear(){for(;this.getLength()>0;)this.pop()}extend(t){for(let e=0,i=t.length;e<i;++e)this.push(t[e]);return this}forEach(t){const e=this.array_;for(let i=0,s=e.length;i<s;++i)t(e[i],i,e)}getArray(){return this.array_}item(t){return this.array_[t]}getLength(){return this.get(Al.LENGTH)}insertAt(t,e){if(t<0||t>this.getLength())throw new Error("Index out of bounds: "+t);this.unique_&&this.assertUnique_(e),this.array_.splice(t,0,e),this.updateLength_(),this.dispatchEvent(new Ys(Pt.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 Ys(Pt.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 Ys(Pt.REMOVE,s,t)),this.dispatchEvent(new Ys(Pt.ADD,e,t))}updateLength_(){this.set(Al.LENGTH,this.array_.length)}assertUnique_(t,e){const i=this.array_;for(let s=0,r=i.length;s<r;++s)if(i[s]===t&&s!==e)throw new Error("Duplicate item added to a unique collection")}}function q(n,t){if(!n)throw new Error(t)}class Qr extends ce{constructor(t){if(super(),this.on,this.once,this.un,this.id_=void 0,this.geometryName_="geometry",this.style_=null,this.styleFunction_=void 0,this.geometryChangeKey_=null,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),t)if(typeof t.getSimplifiedGeometry=="function"){const e=t;this.setGeometry(e)}else{const e=t;this.setProperties(e)}}clone(){const t=new Qr(this.hasProperties()?this.getProperties():null);t.setGeometryName(this.getGeometryName());const e=this.getGeometry();e&&t.setGeometry(e.clone());const i=this.getStyle();return i&&t.setStyle(i),t}getGeometry(){return this.get(this.geometryName_)}getId(){return this.id_}getGeometryName(){return this.geometryName_}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}handleGeometryChange_(){this.changed()}handleGeometryChanged_(){this.geometryChangeKey_&&(nt(this.geometryChangeKey_),this.geometryChangeKey_=null);const t=this.getGeometry();t&&(this.geometryChangeKey_=Z(t,z.CHANGE,this.handleGeometryChange_,this)),this.changed()}setGeometry(t){this.set(this.geometryName_,t)}setStyle(t){this.style_=t,this.styleFunction_=t?Xd(t):void 0,this.changed()}setId(t){this.id_=t,this.changed()}setGeometryName(t){this.removeChangeListener(this.geometryName_,this.handleGeometryChanged_),this.geometryName_=t,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),this.handleGeometryChanged_()}}function Xd(n){if(typeof n=="function")return n;let t;return Array.isArray(n)?t=n:(q(typeof n.getZIndex=="function","Expected an `ol/style/Style` or an array of `ol/style/Style.js`"),t=[n]),function(){return t}}const ut={UNKNOWN:0,INTERSECTING:1,ABOVE:2,RIGHT:4,BELOW:8,LEFT:16};function Ml(n){const t=Wt();for(let e=0,i=n.length;e<i;++e)zn(t,n[e]);return t}function to(n,t,e){return e?(e[0]=n[0]-t,e[1]=n[1]-t,e[2]=n[2]+t,e[3]=n[3]+t,e):[n[0]-t,n[1]-t,n[2]+t,n[3]+t]}function Pl(n,t){return t?(t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t):n.slice()}function Ol(n,t,e){let i,s;return t<n[0]?i=n[0]-t:n[2]<t?i=t-n[2]:i=0,e<n[1]?s=n[1]-e:n[3]<e?s=e-n[3]:s=0,i*i+s*s}function Bi(n,t){return Dl(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 Dl(n,t,e){return n[0]<=t&&t<=n[2]&&n[1]<=e&&e<=n[3]}function eo(n,t){const e=n[0],i=n[1],s=n[2],r=n[3],o=t[0],a=t[1];let l=ut.UNKNOWN;return o<e?l=l|ut.LEFT:o>s&&(l=l|ut.RIGHT),a<i?l=l|ut.BELOW:a>r&&(l=l|ut.ABOVE),l===ut.UNKNOWN&&(l=ut.INTERSECTING),l}function Wt(){return[1/0,1/0,-1/0,-1/0]}function ti(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 $s(n){return ti(1/0,1/0,-1/0,-1/0,n)}function Fl(n,t){const e=n[0],i=n[1];return ti(e,i,e,i,t)}function io(n,t,e,i,s){const r=$s(s);return Nl(r,n,t,e,i)}function Gn(n,t){return n[0]==t[0]&&n[2]==t[2]&&n[1]==t[1]&&n[3]==t[3]}function kl(n,t){return t[0]<n[0]&&(n[0]=t[0]),t[2]>n[2]&&(n[2]=t[2]),t[1]<n[1]&&(n[1]=t[1]),t[3]>n[3]&&(n[3]=t[3]),n}function zn(n,t){t[0]<n[0]&&(n[0]=t[0]),t[0]>n[2]&&(n[2]=t[0]),t[1]<n[1]&&(n[1]=t[1]),t[1]>n[3]&&(n[3]=t[1])}function Nl(n,t,e,i,s){for(;e<i;e+=s)Wd(n,t[e],t[e+1]);return n}function Wd(n,t,e){n[0]=Math.min(n[0],t),n[1]=Math.min(n[1],e),n[2]=Math.max(n[2],t),n[3]=Math.max(n[3],e)}function Gl(n,t){let e;return e=t(Ks(n)),e||(e=t(Bs(n)),e)||(e=t(Zs(n)),e)||(e=t(Ci(n)),e)?e:!1}function no(n){let t=0;return Us(n)||(t=J(n)*St(n)),t}function Ks(n){return[n[0],n[1]]}function Bs(n){return[n[2],n[1]]}function vi(n){return[(n[0]+n[2])/2,(n[1]+n[3])/2]}function Yd(n,t){let e;if(t==="bottom-left")e=Ks(n);else if(t==="bottom-right")e=Bs(n);else if(t==="top-left")e=Ci(n);else if(t==="top-right")e=Zs(n);else throw new Error("Invalid corner");return e}function so(n,t,e,i,s){const[r,o,a,l,h,c,u,d]=zl(n,t,e,i);return ti(Math.min(r,a,h,u),Math.min(o,l,c,d),Math.max(r,a,h,u),Math.max(o,l,c,d),s)}function zl(n,t,e,i){const s=t*i[0]/2,r=t*i[1]/2,o=Math.cos(e),a=Math.sin(e),l=s*o,h=s*a,c=r*o,u=r*a,d=n[0],f=n[1];return[d-l+u,f-h-c,d-l-u,f-h+c,d+l-u,f+h+c,d+l+u,f+h-c,d-l+u,f-h-c]}function St(n){return n[3]-n[1]}function wi(n,t,e){const i=e||Wt();return Ot(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]):$s(i),i}function Ci(n){return[n[0],n[3]]}function Zs(n){return[n[2],n[3]]}function J(n){return n[2]-n[0]}function Ot(n,t){return n[0]<=t[2]&&n[2]>=t[0]&&n[1]<=t[3]&&n[3]>=t[1]}function Us(n){return n[2]<n[0]||n[3]<n[1]}function $d(n,t){return t?(t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t):n}function Kd(n,t,e){let i=!1;const s=eo(n,t),r=eo(n,e);if(s===ut.INTERSECTING||r===ut.INTERSECTING)i=!0;else{const o=n[0],a=n[1],l=n[2],h=n[3],c=t[0],u=t[1],d=e[0],f=e[1],g=(f-u)/(d-c);let m,_;r&ut.ABOVE&&!(s&ut.ABOVE)&&(m=d-(f-h)/g,i=m>=o&&m<=l),!i&&r&ut.RIGHT&&!(s&ut.RIGHT)&&(_=f-(d-l)*g,i=_>=a&&_<=h),!i&&r&ut.BELOW&&!(s&ut.BELOW)&&(m=d-(f-a)/g,i=m>=o&&m<=l),!i&&r&ut.LEFT&&!(s&ut.LEFT)&&(_=f-(d-o)*g,i=_>=a&&_<=h)}return i}function Xl(n,t){const e=t.getExtent(),i=vi(n);if(t.canWrapX()&&(i[0]<e[0]||i[0]>=e[2])){const s=J(e),o=Math.floor((i[0]-e[0])/s)*s;n[0]-=o,n[2]-=o}return n}function Wl(n,t,e){if(t.canWrapX()){const i=t.getExtent();if(!isFinite(n[0])||!isFinite(n[2]))return[[i[0],n[1],i[2],n[3]]];Xl(n,t);const s=J(i);if(J(n)>s&&!e)return[[i[0],n[1],i[2],n[3]]];if(n[0]<i[0])return[[n[0]+s,n[1],i[2],n[3]],[i[0],n[1],n[2],n[3]]];if(n[2]>i[2])return[[n[0],n[1],i[2],n[3]],[i[0],n[1],n[2]-s,n[3]]]}return[n]}function rt(n,t,e){return Math.min(Math.max(n,t),e)}function Bd(n,t,e,i,s,r){const o=s-e,a=r-i;if(o!==0||a!==0){const l=((n-e)*o+(t-i)*a)/(o*o+a*a);l>1?(e=s,i=r):l>0&&(e+=o*l,i+=a*l)}return Ui(n,t,e,i)}function Ui(n,t,e,i){const s=e-n,r=i-t;return s*s+r*r}function Zd(n){const t=n.length;for(let i=0;i<t;i++){let s=i,r=Math.abs(n[i][i]);for(let a=i+1;a<t;a++){const l=Math.abs(n[a][i]);l>r&&(r=l,s=a)}if(r===0)return null;const o=n[s];n[s]=n[i],n[i]=o;for(let a=i+1;a<t;a++){const l=-n[a][i]/n[i][i];for(let h=i;h<t+1;h++)i==h?n[a][h]=0:n[a][h]+=l*n[i][h]}}const e=new Array(t);for(let i=t-1;i>=0;i--){e[i]=n[i][t]/n[i][i];for(let s=i-1;s>=0;s--)n[s][t]-=n[s][i]*e[i]}return e}function Yl(n){return n*180/Math.PI}function ei(n){return n*Math.PI/180}function Vi(n,t){const e=n%t;return e*t<0?e+t:e}function Jt(n,t,e){return n+e*(t-n)}function Vs(n,t){const e=Math.pow(10,t);return Math.round(n*e)/e}function js(n,t){return Math.floor(Vs(n,t))}function Hs(n,t){return Math.ceil(Vs(n,t))}function ro(n,t,e){if(n>=t&&n<e)return n;const i=e-t;return((n-t)%i+i)%i+t}const Ud=63710088e-1;function $l(n,t,e){e=e||Ud;const i=ei(n[1]),s=ei(t[1]),r=(s-i)/2,o=ei(t[0]-n[0])/2,a=Math.sin(r)*Math.sin(r)+Math.sin(o)*Math.sin(o)*Math.cos(i)*Math.cos(s);return 2*e*Math.atan2(Math.sqrt(a),Math.sqrt(1-a))}function Kl(...n){console.warn(...n)}function Vd(n,t){return n[0]+=+t[0],n[1]+=+t[1],n}function qs(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 oo(n,t){const e=Math.cos(t),i=Math.sin(t),s=n[0]*e-n[1]*i,r=n[1]*e+n[0]*i;return n[0]=s,n[1]=r,n}function jd(n,t){return n[0]*=t,n[1]*=t,n}function Bl(n,t){if(t.canWrapX()){const e=J(t.getExtent()),i=Hd(n,t,e);i&&(n[0]-=i*e)}return n}function Hd(n,t,e){const i=t.getExtent();let s=0;return t.canWrapX()&&(n[0]<i[0]||n[0]>i[2])&&(e=e||J(i),s=Math.floor((n[0]-i[0])/e)),s}const ao={radians:6370997/(2*Math.PI),degrees:2*Math.PI*6370997/360,ft:.3048,m:1,"us-ft":1200/3937};class lo{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_||ao[this.units_]}getWorldExtent(){return this.worldExtent_}getAxisOrientation(){return this.axisOrientation_}isGlobal(){return this.global_}setGlobal(t){this.global_=t,this.canWrapX_=!!(t&&this.extent_)}getDefaultTileGrid(){return this.defaultTileGrid_}setDefaultTileGrid(t){this.defaultTileGrid_=t}setExtent(t){this.extent_=t,this.canWrapX_=!!(this.global_&&t)}setWorldExtent(t){this.worldExtent_=t}setGetPointResolution(t){this.getPointResolutionFunc_=t}getPointResolutionFunc(){return this.getPointResolutionFunc_}}const Xn=6378137,ji=Math.PI*Xn,qd=[-ji,-ji,ji,ji],Jd=[-180,-85,180,85],Js=Xn*Math.log(Math.tan(Math.PI/2));class Hi extends lo{constructor(t){super({code:t,units:"m",extent:qd,global:!0,worldExtent:Jd,getPointResolution:function(e,i){return e/Math.cosh(i[1]/Xn)}})}}const Zl=[new Hi("EPSG:3857"),new Hi("EPSG:102100"),new Hi("EPSG:102113"),new Hi("EPSG:900913"),new Hi("http://www.opengis.net/def/crs/EPSG/0/3857"),new Hi("http://www.opengis.net/gml/srs/epsg.xml#3857")];function Qd(n,t,e,i){const s=n.length;e=e>1?e:2,i=i??e,t===void 0&&(e>2?t=n.slice():t=new Array(s));for(let r=0;r<s;r+=i){t[r]=ji*n[r]/180;let o=Xn*Math.log(Math.tan(Math.PI*(+n[r+1]+90)/360));o>Js?o=Js:o<-Js&&(o=-Js),t[r+1]=o}return t}function tf(n,t,e,i){const s=n.length;e=e>1?e:2,i=i??e,t===void 0&&(e>2?t=n.slice():t=new Array(s));for(let r=0;r<s;r+=i)t[r]=180*n[r]/ji,t[r+1]=360*Math.atan(Math.exp(n[r+1]/Xn))/Math.PI-90;return t}const ef=6378137,Ul=[-180,-90,180,90],nf=Math.PI*ef/180;class Ri extends lo{constructor(t,e){super({code:t,units:"degrees",extent:Ul,axisOrientation:e,global:!0,metersPerUnit:nf,worldExtent:Ul})}}const Vl=[new Ri("CRS:84"),new Ri("EPSG:4326","neu"),new Ri("urn:ogc:def:crs:OGC:1.3:CRS84"),new Ri("urn:ogc:def:crs:OGC:2:84"),new Ri("http://www.opengis.net/def/crs/OGC/1.3/CRS84"),new Ri("http://www.opengis.net/gml/srs/epsg.xml#4326","neu"),new Ri("http://www.opengis.net/def/crs/EPSG/0/4326","neu")];let ho={};function sf(n){return ho[n]||ho[n.replace(/urn:(x-)?ogc:def:crs:EPSG:(.*:)?(\w+)$/,"EPSG:$3")]||null}function rf(n,t){ho[n]=t}let qi={};function Wn(n,t,e){const i=n.getCode(),s=t.getCode();i in qi||(qi[i]={}),qi[i][s]=e}function co(n,t){return n in qi&&t in qi[n]?qi[n][t]:null}const Qs=.9996,Qt=.00669438,tr=Qt*Qt,er=tr*Qt,Ti=Qt/(1-Qt),jl=Math.sqrt(1-Qt),Ji=(1-jl)/(1+jl),Hl=Ji*Ji,uo=Hl*Ji,fo=uo*Ji,ql=fo*Ji,Jl=1-Qt/4-3*tr/64-5*er/256,of=3*Qt/8+3*tr/32+45*er/1024,af=15*tr/256+45*er/1024,lf=35*er/3072,hf=3/2*Ji-27/32*uo+269/512*ql,cf=21/16*Hl-55/32*fo,uf=151/96*uo-417/128*ql,df=1097/512*fo,ir=6378137;function ff(n,t,e){const i=n-5e5,o=(e.north?t:t-1e7)/Qs/(ir*Jl),a=o+hf*Math.sin(2*o)+cf*Math.sin(4*o)+uf*Math.sin(6*o)+df*Math.sin(8*o),l=Math.sin(a),h=l*l,c=Math.cos(a),u=l/c,d=u*u,f=d*d,g=1-Qt*h,m=Math.sqrt(1-Qt*h),_=ir/m,p=(1-Qt)/g,y=Ti*c**2,w=y*y,E=i/(_*Qs),x=E*E,v=x*E,T=v*E,R=T*E,I=R*E,L=a-u/p*(x/2-T/24*(5+3*d+10*y-4*w-9*Ti))+I/720*(61+90*d+298*y+45*f-252*Ti-3*w);let P=(E-v/6*(1+2*d+y)+R/120*(5-2*y+28*d-3*w+8*Ti+24*f))/c;return P=ro(P+ei(eh(e.number)),-Math.PI,Math.PI),[Yl(P),Yl(L)]}const Ql=-80,th=84,gf=-180,_f=180;function mf(n,t,e){n=ro(n,gf,_f),t<Ql?t=Ql:t>th&&(t=th);const i=ei(t),s=Math.sin(i),r=Math.cos(i),o=s/r,a=o*o,l=a*a,h=ei(n),c=eh(e.number),u=ei(c),d=ir/Math.sqrt(1-Qt*s**2),f=Ti*r**2,g=r*ro(h-u,-Math.PI,Math.PI),m=g*g,_=m*g,p=_*g,y=p*g,w=y*g,E=ir*(Jl*i-of*Math.sin(2*i)+af*Math.sin(4*i)-lf*Math.sin(6*i)),x=Qs*d*(g+_/6*(1-a+f)+y/120*(5-18*a+l+72*f-58*Ti))+5e5;let v=Qs*(E+d*o*(m/2+p/24*(5-a+9*f+4*f**2)+w/720*(61-58*a+l+600*f-330*Ti)));return e.north||(v+=1e7),[x,v]}function eh(n){return(n-1)*6-180+3}const pf=[/^EPSG:(\d+)$/,/^urn:ogc:def:crs:EPSG::(\d+)$/,/^http:\/\/www\.opengis\.net\/def\/crs\/EPSG\/0\/(\d+)$/];function ih(n){let t=0;for(const s of pf){const r=n.match(s);if(r){t=parseInt(r[1]);break}}if(!t)return null;let e=0,i=!1;return t>32700&&t<32761?e=t-32700:t>32600&&t<32661&&(i=!0,e=t-32600),e?{number:e,north:i}:null}function nh(n,t){return function(e,i,s,r){const o=e.length;s=s>1?s:2,r=r??s,i||(s>2?i=e.slice():i=new Array(o));for(let a=0;a<o;a+=r){const l=e[a],h=e[a+1],c=n(l,h,t);i[a]=c[0],i[a+1]=c[1]}return i}}function yf(n){return ih(n)?new lo({code:n,units:"m"}):null}function Ef(n){const t=ih(n.getCode());return t?{forward:nh(mf,t),inverse:nh(ff,t)}:null}const xf=[Ef],vf=[yf];let go=!0;function sh(n){go=!1}function _o(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 mo(n){rf(n.getCode(),n),Wn(n,n,_o)}function wf(n){n.forEach(mo)}function Dt(n){if(typeof n!="string")return n;const t=sf(n);if(t)return t;for(const e of vf){const i=e(n);if(i)return i}return null}function rh(n,t,e,i){n=Dt(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=Eo(n,Dt("EPSG:4326"));if(!a&&o!=="degrees")s=t*n.getMetersPerUnit();else{let h=[e[0]-t/2,e[1],e[0]+t/2,e[1],e[0],e[1]-t/2,e[0],e[1]+t/2];h=a(h,h,2);const c=$l(h.slice(0,2),h.slice(2,4)),u=$l(h.slice(4,6),h.slice(6,8));s=(c+u)/2}const l=n.getMetersPerUnit();l!==void 0&&(s/=l)}}return s}function oh(n){wf(n),n.forEach(function(t){n.forEach(function(e){t!==e&&Wn(t,e,_o)})})}function Cf(n,t,e,i){n.forEach(function(s){t.forEach(function(r){Wn(s,r,e),Wn(r,s,i)})})}function po(n,t){return n?typeof n=="string"?Dt(n):n:Dt(t)}function Rf(n){return(function(t,e,i,s){const r=t.length;i=i!==void 0?i:2,s=s??i,e=e!==void 0?e:new Array(r);for(let o=0;o<r;o+=s){const a=n(t.slice(o,o+i)),l=a.length;for(let h=0,c=s;h<c;++h)e[o+h]=h>=l?t[o+h]:a[h]}return e})}function yo(n,t){return sh(),Yn(n,"EPSG:4326","EPSG:3857")}function nr(n,t){if(n===t)return!0;const e=n.getUnits()===t.getUnits();return(n.getCode()===t.getCode()||Eo(n,t)===_o)&&e}function Eo(n,t){const e=n.getCode(),i=t.getCode();let s=co(e,i);if(s)return s;let r=null,o=null;for(const l of xf)r||(r=l(n)),o||(o=l(t));if(!r&&!o)return null;const a="EPSG:4326";if(o)if(r)s=xo(r.inverse,o.forward);else{const l=co(e,a);l&&(s=xo(l,o.forward))}else{const l=co(a,i);l&&(s=xo(r.inverse,l))}return s&&(mo(n),mo(t),Wn(n,t,s)),s}function xo(n,t){return function(e,i,s,r){return i=n(e,i,s,r),t(i,i,s,r)}}function sr(n,t){const e=Dt(n),i=Dt(t);return Eo(e,i)}function Yn(n,t,e){const i=sr(t,e);if(!i){const s=Dt(t).getCode(),r=Dt(e).getCode();throw new Error(`No transform available between ${s} and ${r}`)}return i(n,void 0,n.length)}function vo(n,t){return n}function Pe(n,t){return go&&!qs(n,[0,0])&&n[0]>=-180&&n[0]<=180&&n[1]>=-90&&n[1]<=90&&(go=!1,Kl("Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.")),n}function ah(n,t){return n}function ii(n,t){return n}function Tf(){oh(Zl),oh(Vl),Cf(Vl,Zl,Qd,tf)}Tf(),new Array(6);function ue(){return[1,0,0,1,0,0]}function If(n,t){return n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=t[3],n[4]=t[4],n[5]=t[5],n}function dt(n,t){const e=t[0],i=t[1];return t[0]=n[0]*e+n[2]*i+n[4],t[1]=n[1]*e+n[3]*i+n[5],t}function Oe(n,t,e,i,s,r,o,a){const l=Math.sin(r),h=Math.cos(r);return n[0]=i*h,n[1]=s*l,n[2]=-i*l,n[3]=s*h,n[4]=o*i*h-a*i*l+t,n[5]=o*s*l+a*s*h+e,n}function lh(n,t){const e=Sf(t);q(e!==0,"Transformation matrix cannot be inverted");const i=t[0],s=t[1],r=t[2],o=t[3],a=t[4],l=t[5];return n[0]=o/e,n[1]=-s/e,n[2]=-r/e,n[3]=i/e,n[4]=(r*l-o*a)/e,n[5]=-(i*l-s*a)/e,n}function Sf(n){return n[0]*n[3]-n[1]*n[2]}const bf=[1e5,1e5,1e5,1e5,2,2];function Lf(n){return"matrix("+n.join(", ")+")"}function wo(n){return n.substring(7,n.length-1).split(",").map(parseFloat)}function Af(n,t){const e=wo(n),i=wo(t);for(let s=0;s<6;++s)if(Math.round((e[s]-i[s])*bf[s])!==0)return!1;return!0}function ni(n,t,e,i,s,r,o){r=r||[],o=o||2;let a=0;for(let l=t;l<e;l+=i){const h=n[l],c=n[l+1];r[a++]=s[0]*h+s[2]*c+s[4],r[a++]=s[1]*h+s[3]*c+s[5];for(let u=2;u<o;u++)r[a++]=n[l+u]}return r&&r.length!=a&&(r.length=a),r}function hh(n,t,e,i,s,r,o){o=o||[];const a=Math.cos(s),l=Math.sin(s),h=r[0],c=r[1];let u=0;for(let d=t;d<e;d+=i){const f=n[d]-h,g=n[d+1]-c;o[u++]=h+f*a-g*l,o[u++]=c+f*l+g*a;for(let m=d+2;m<d+i;++m)o[u++]=n[m]}return o&&o.length!=u&&(o.length=u),o}function Mf(n,t,e,i,s,r,o,a){a=a||[];const l=o[0],h=o[1];let c=0;for(let u=t;u<e;u+=i){const d=n[u]-l,f=n[u+1]-h;a[c++]=l+s*d,a[c++]=h+r*f;for(let g=u+2;g<u+i;++g)a[c++]=n[g]}return a&&a.length!=c&&(a.length=c),a}function Pf(n,t,e,i,s,r,o){o=o||[];let a=0;for(let l=t;l<e;l+=i){o[a++]=n[l]+s,o[a++]=n[l+1]+r;for(let h=l+2;h<l+i;++h)o[a++]=n[h]}return o&&o.length!=a&&(o.length=a),o}const ch=ue(),Of=[NaN,NaN];class Df extends ce{constructor(){super(),this.extent_=Wt(),this.extentRevision_=-1,this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=0,this.simplifyTransformedInternal=bl((t,e,i)=>{if(!i)return this.getSimplifiedGeometry(e);const s=this.clone();return s.applyTransform(i),s.getSimplifiedGeometry(e)})}simplifyTransformed(t,e){return this.simplifyTransformedInternal(this.getRevision(),t,e)}clone(){return U()}closestPointXY(t,e,i,s){return U()}containsXY(t,e){return this.closestPointXY(t,e,Of,Number.MIN_VALUE)===0}getClosestPoint(t,e){return e=e||[NaN,NaN],this.closestPointXY(t[0],t[1],e,1/0),e}intersectsCoordinate(t){return this.containsXY(t[0],t[1])}computeExtent(t){return U()}getExtent(t){if(this.extentRevision_!=this.getRevision()){const e=this.computeExtent(this.extent_);(isNaN(e[0])||isNaN(e[1]))&&$s(e),this.extentRevision_=this.getRevision()}return $d(this.extent_,t)}rotate(t,e){U()}scale(t,e,i){U()}simplify(t){return this.getSimplifiedGeometry(t*t)}getSimplifiedGeometry(t){return U()}getType(){return U()}applyTransform(t){U()}intersectsExtent(t){return U()}translate(t,e){U()}transform(t,e){const i=Dt(t),s=i.getUnits()=="tile-pixels"?function(r,o,a){const l=i.getExtent(),h=i.getWorldExtent(),c=St(h)/St(l);Oe(ch,h[0],h[3],c,-c,0,0,0);const u=ni(r,0,r.length,a,ch,o),d=sr(i,e);return d?d(u,u,a):u}:sr(i,e);return this.applyTransform(s),this}}class Co extends Df{constructor(){super(),this.layout="XY",this.stride=2,this.flatCoordinates}computeExtent(t){return io(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t)}getCoordinates(){return U()}getFirstCoordinate(){return this.flatCoordinates.slice(0,this.stride)}getFlatCoordinates(){return this.flatCoordinates}getLastCoordinate(){return this.flatCoordinates.slice(this.flatCoordinates.length-this.stride)}getLayout(){return this.layout}getSimplifiedGeometry(t){if(this.simplifiedGeometryRevision!==this.getRevision()&&(this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=this.getRevision()),t<0||this.simplifiedGeometryMaxMinSquaredTolerance!==0&&t<=this.simplifiedGeometryMaxMinSquaredTolerance)return this;const e=this.getSimplifiedGeometryInternal(t);return e.getFlatCoordinates().length<this.flatCoordinates.length?e:(this.simplifiedGeometryMaxMinSquaredTolerance=t,this)}getSimplifiedGeometryInternal(t){return this}getStride(){return this.stride}setFlatCoordinates(t,e){this.stride=uh(t),this.layout=t,this.flatCoordinates=e}setCoordinates(t,e){U()}setLayout(t,e,i){let s;if(t)s=uh(t);else{for(let r=0;r<i;++r){if(e.length===0){this.layout="XY",this.stride=2;return}e=e[0]}s=e.length,t=Ff(s)}this.layout=t,this.stride=s}applyTransform(t){this.flatCoordinates&&(t(this.flatCoordinates,this.flatCoordinates,this.layout.startsWith("XYZ")?3:2,this.stride),this.changed())}rotate(t,e){const i=this.getFlatCoordinates();if(i){const s=this.getStride();hh(i,0,i.length,s,t,e,i),this.changed()}}scale(t,e,i){e===void 0&&(e=t),i||(i=vi(this.getExtent()));const s=this.getFlatCoordinates();if(s){const r=this.getStride();Mf(s,0,s.length,r,t,e,i,s),this.changed()}}translate(t,e){const i=this.getFlatCoordinates();if(i){const s=this.getStride();Pf(i,0,i.length,s,t,e,i),this.changed()}}}function Ff(n){let t;return n==2?t="XY":n==3?t="XYZ":n==4&&(t="XYZM"),t}function uh(n){let t;return n=="XY"?t=2:n=="XYZ"||n=="XYM"?t=3:n=="XYZM"&&(t=4),t}function kf(n,t,e){const i=n.getFlatCoordinates();if(!i)return null;const s=n.getStride();return ni(i,0,i.length,s,t,e)}function dh(n,t,e,i){let s=0;const r=n[e-i],o=n[e-i+1];let a=0,l=0;for(;t<e;t+=i){const h=n[t]-r,c=n[t+1]-o;s+=l*h-a*c,a=h,l=c}return s/2}function Nf(n,t,e,i){let s=0;for(let r=0,o=e.length;r<o;++r){const a=e[r];s+=dh(n,t,a,i),t=a}return s}function fh(n,t,e,i,s,r,o){const a=n[t],l=n[t+1],h=n[e]-a,c=n[e+1]-l;let u;if(h===0&&c===0)u=t;else{const d=((s-a)*h+(r-l)*c)/(h*h+c*c);if(d>1)u=e;else if(d>0){for(let f=0;f<i;++f)o[f]=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 gh(n,t,e,i,s){let r=n[t],o=n[t+1];for(t+=i;t<e;t+=i){const a=n[t],l=n[t+1],h=Ui(r,o,a,l);h>s&&(s=h),r=a,o=l}return s}function Gf(n,t,e,i,s){for(let r=0,o=e.length;r<o;++r){const a=e[r];s=gh(n,t,a,i,s),t=a}return s}function _h(n,t,e,i,s,r,o,a,l,h,c){if(t==e)return h;let u,d;if(s===0){if(d=Ui(o,a,n[t],n[t+1]),d<h){for(u=0;u<i;++u)l[u]=n[t+u];return l.length=i,d}return h}c=c||[NaN,NaN];let f=t+i;for(;f<e;)if(fh(n,f-i,f,i,o,a,c),d=Ui(o,a,c[0],c[1]),d<h){for(h=d,u=0;u<i;++u)l[u]=c[u];l.length=i,f+=i}else f+=i*Math.max((Math.sqrt(d)-Math.sqrt(h))/s|0,1);if(fh(n,e-i,t,i,o,a,c),d=Ui(o,a,c[0],c[1]),d<h){for(h=d,u=0;u<i;++u)l[u]=c[u];l.length=i}return h}function zf(n,t,e,i,s,r,o,a,l,h,c){c=c||[NaN,NaN];for(let u=0,d=e.length;u<d;++u){const f=e[u];h=_h(n,t,f,i,s,r,o,a,l,h,c),t=f}return h}function Xf(n,t,e,i){for(let s=0,r=e.length;s<r;++s)n[t++]=e[s];return t}function mh(n,t,e,i){for(let s=0,r=e.length;s<r;++s){const o=e[s];for(let a=0;a<i;++a)n[t++]=o[a]}return t}function Wf(n,t,e,i,s){s=s||[];let r=0;for(let o=0,a=e.length;o<a;++o){const l=mh(n,t,e[o],i);s[r++]=l,t=l}return s.length=r,s}function Qi(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 rr(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++]=Qi(n,t,l,i,s[r]),t=l}return s.length=r,s}function ph(n,t,e,i,s){s=s!==void 0?s:[];let r=0;for(let o=0,a=e.length;o<a;++o){const l=e[o];s[r++]=l.length===1&&l[0]===t?[]:rr(n,t,l,i,s[r]),t=l[l.length-1]}return s.length=r,s}function Ro(n,t,e,i,s,r,o){const a=(e-t)/i;if(a<3){for(;t<e;t+=i)r[o++]=n[t],r[o++]=n[t+1];return o}const l=new Array(a);l[0]=1,l[a-1]=1;const h=[t,e-i];let c=0;for(;h.length>0;){const u=h.pop(),d=h.pop();let f=0;const g=n[d],m=n[d+1],_=n[u],p=n[u+1];for(let y=d+i;y<u;y+=i){const w=n[y],E=n[y+1],x=Bd(w,E,g,m,_,p);x>f&&(c=y,f=x)}f>s&&(l[(c-t)/i]=1,d+i<c&&h.push(d,c),c+i<u&&h.push(c,u))}for(let u=0;u<a;++u)l[u]&&(r[o++]=n[t+u*i],r[o++]=n[t+u*i+1]);return o}function Yf(n,t,e,i,s,r,o,a){for(let l=0,h=e.length;l<h;++l){const c=e[l];o=Ro(n,t,c,i,s,r,o),a.push(o),t=c}return o}function Ii(n,t){return t*Math.round(n/t)}function $f(n,t,e,i,s,r,o){if(t==e)return o;let a=Ii(n[t],s),l=Ii(n[t+1],s);t+=i,r[o++]=a,r[o++]=l;let h,c;do if(h=Ii(n[t],s),c=Ii(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=Ii(n[t],s),d=Ii(n[t+1],s);if(t+=i,u==h&&d==c)continue;const f=h-a,g=c-l,m=u-a,_=d-l;if(f*_==g*m&&(f<0&&m<f||f==m||f>0&&m>f)&&(g<0&&_<g||g==_||g>0&&_>g)){h=u,c=d;continue}r[o++]=h,r[o++]=c,a=h,l=c,h=u,c=d}return r[o++]=h,r[o++]=c,o}function yh(n,t,e,i,s,r,o,a){for(let l=0,h=e.length;l<h;++l){const c=e[l];o=$f(n,t,c,i,s,r,o),a.push(o),t=c}return o}class $n extends Co{constructor(t,e){super(),this.maxDelta_=-1,this.maxDeltaRevision_=-1,e!==void 0&&!Array.isArray(t[0])?this.setFlatCoordinates(e,t):this.setCoordinates(t,e)}clone(){return new $n(this.flatCoordinates.slice(),this.layout)}closestPointXY(t,e,i,s){return s<Ol(this.getExtent(),t,e)?s:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(gh(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),_h(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!0,t,e,i,s))}getArea(){return dh(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinates(){return Qi(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getSimplifiedGeometryInternal(t){const e=[];return e.length=Ro(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e,0),new $n(e,"XY")}getType(){return"LinearRing"}intersectsExtent(t){return!1}setCoordinates(t,e){this.setLayout(e,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=mh(this.flatCoordinates,0,t,this.stride),this.changed()}}class or extends Co{constructor(t,e){super(),this.setCoordinates(t,e)}clone(){const t=new or(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(t,e,i,s){const r=this.flatCoordinates,o=Ui(t,e,r[0],r[1]);if(o<s){const a=this.stride;for(let l=0;l<a;++l)i[l]=r[l];return i.length=a,o}return s}getCoordinates(){return this.flatCoordinates.slice()}computeExtent(t){return Fl(this.flatCoordinates,t)}getType(){return"Point"}intersectsExtent(t){return Dl(t,this.flatCoordinates[0],this.flatCoordinates[1])}setCoordinates(t,e){this.setLayout(e,t,0),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Xf(this.flatCoordinates,0,t,this.stride),this.changed()}}function Kf(n,t,e,i,s){return!Gl(s,function(o){return!Si(n,t,e,i,o[0],o[1])})}function Si(n,t,e,i,s,r){let o=0,a=n[e-i],l=n[e-i+1];for(;t<e;t+=i){const h=n[t],c=n[t+1];l<=r?c>r&&(h-a)*(r-l)-(s-a)*(c-l)>0&&o++:c<=r&&(h-a)*(r-l)-(s-a)*(c-l)<0&&o--,a=h,l=c}return o!==0}function Eh(n,t,e,i,s,r){if(e.length===0||!Si(n,t,e[0],i,s,r))return!1;for(let o=1,a=e.length;o<a;++o)if(Si(n,e[o-1],e[o],i,s,r))return!1;return!0}function To(n,t,e,i,s,r,o){let a,l,h,c,u,d,f;const g=s[r+1],m=[];for(let y=0,w=e.length;y<w;++y){const E=e[y];for(c=n[E-i],d=n[E-i+1],a=t;a<E;a+=i)u=n[a],f=n[a+1],(g<=d&&f<=g||d<=g&&g<=f)&&(h=(g-d)/(f-d)*(u-c)+c,m.push(h)),c=u,d=f}let _=NaN,p=-1/0;for(m.sort(Ae),c=m[0],a=1,l=m.length;a<l;++a){u=m[a];const y=Math.abs(u-c);y>p&&(h=(c+u)/2,Eh(n,t,e,i,h,g)&&(_=h,p=y)),c=u}return isNaN(_)&&(_=s[r]),o?(o.push(_,g,p),o):[_,g,p]}function Bf(n,t,e,i,s){let r=[];for(let o=0,a=e.length;o<a;++o){const l=e[o];r=To(n,t,l,i,s,2*o,r),t=l[l.length-1]}return r}function Zf(n,t,e,i,s){let r;for(t+=i;t<e;t+=i)if(r=s(n.slice(t-i,t),n.slice(t,t+i)),r)return r;return!1}function xh(n,t,e,i,s,r){return r=r??Nl(Wt(),n,t,e,i),Ot(s,r)?r[0]>=s[0]&&r[2]<=s[2]||r[1]>=s[1]&&r[3]<=s[3]?!0:Zf(n,t,e,i,function(o,a){return Kd(s,o,a)}):!1}function vh(n,t,e,i,s){return!!(xh(n,t,e,i,s)||Si(n,t,e,i,s[0],s[1])||Si(n,t,e,i,s[0],s[3])||Si(n,t,e,i,s[2],s[1])||Si(n,t,e,i,s[2],s[3]))}function Uf(n,t,e,i,s){if(!vh(n,t,e[0],i,s))return!1;if(e.length===1)return!0;for(let r=1,o=e.length;r<o;++r)if(Kf(n,e[r-1],e[r],i,s)&&!xh(n,e[r-1],e[r],i,s))return!1;return!0}function Vf(n,t,e,i){for(;t<e-i;){for(let s=0;s<i;++s){const r=n[t+s];n[t+s]=n[e-i+s],n[e-i+s]=r}t+=i,e-=i}}function Io(n,t,e,i){let s=0,r=n[e-i],o=n[e-i+1];for(;t<e;t+=i){const a=n[t],l=n[t+1];s+=(a-r)*(l+o),r=a,o=l}return s===0?void 0:s>0}function jf(n,t,e,i,s){s=s!==void 0?s:!1;for(let r=0,o=e.length;r<o;++r){const a=e[r],l=Io(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 wh(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=Io(n,t,a,i);(r===0?s&&l||!s&&!l:s&&!l||!s&&l)&&Vf(n,t,a,i),t=a}return t}function Hf(n,t){const e=[];let i=0,s=0,r;for(let o=0,a=t.length;o<a;++o){const l=t[o],h=Io(n,i,l,2);if(r===void 0&&(r=h),h===r)e.push(t.slice(s,o+1));else{if(e.length===0)continue;e[e.length-1].push(t[s])}s=o+1,i=l}return e}class Kn extends Co{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?Jr(this.flatCoordinates,t.getFlatCoordinates()):this.flatCoordinates=t.getFlatCoordinates().slice(),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){const t=new Kn(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return t.applyProperties(this),t}closestPointXY(t,e,i,s){return s<Ol(this.getExtent(),t,e)?s:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Gf(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),zf(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!0,t,e,i,s))}containsXY(t,e){return Eh(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,e)}getArea(){return Nf(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride)}getCoordinates(t){let e;return t!==void 0?(e=this.getOrientedFlatCoordinates().slice(),wh(e,0,this.ends_,this.stride,t)):e=this.flatCoordinates,rr(e,0,this.ends_,this.stride)}getEnds(){return this.ends_}getFlatInteriorPoint(){if(this.flatInteriorPointRevision_!=this.getRevision()){const t=vi(this.getExtent());this.flatInteriorPoint_=To(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,0),this.flatInteriorPointRevision_=this.getRevision()}return this.flatInteriorPoint_}getInteriorPoint(){return new or(this.getFlatInteriorPoint(),"XYM")}getLinearRingCount(){return this.ends_.length}getLinearRing(t){return t<0||this.ends_.length<=t?null:new $n(this.flatCoordinates.slice(t===0?0:this.ends_[t-1],this.ends_[t]),this.layout)}getLinearRings(){const t=this.layout,e=this.flatCoordinates,i=this.ends_,s=[];let r=0;for(let o=0,a=i.length;o<a;++o){const l=i[o],h=new $n(e.slice(r,l),t);s.push(h),r=l}return s}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){const t=this.flatCoordinates;jf(t,0,this.ends_,this.stride)?this.orientedFlatCoordinates_=t:(this.orientedFlatCoordinates_=t.slice(),this.orientedFlatCoordinates_.length=wh(this.orientedFlatCoordinates_,0,this.ends_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(t){const e=[],i=[];return e.length=yh(this.flatCoordinates,0,this.ends_,this.stride,Math.sqrt(t),e,0,i),new Kn(e,"XY",i)}getType(){return"Polygon"}intersectsExtent(t){return Uf(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,2),this.flatCoordinates||(this.flatCoordinates=[]);const i=Wf(this.flatCoordinates,0,t,this.stride,this.ends_);this.flatCoordinates.length=i.length===0?0:i[i.length-1],this.changed()}}function Ch(n){if(Us(n))throw new Error("Cannot create polygon from empty extent");const t=n[0],e=n[1],i=n[2],s=n[3],r=[t,e,t,s,i,s,i,e,t,e];return new Kn(r,"XY",[r.length])}function Rh(n,t,e,i,s,r,o){let a,l;const h=(e-t)/i;if(h===1)a=t;else if(h===2)a=t,l=s;else if(h!==0){let c=n[t],u=n[t+1],d=0;const f=[0];for(let _=t+i;_<e;_+=i){const p=n[_],y=n[_+1];d+=Math.sqrt((p-c)*(p-c)+(y-u)*(y-u)),f.push(d),c=p,u=y}const g=s*d,m=Od(f,g);m<0?(l=(g-f[-m-2])/(f[-m-1]-f[-m-2]),a=t+(-m-2)*i):a=t+m*i}o=o>1?o:2,r=r||new Array(o);for(let c=0;c<o;++c)r[c]=a===void 0?NaN:l===void 0?n[a+c]:Jt(n[a+c],n[a+i+c],l);return r}function qf(n,t,e,i){let s=n[t],r=n[t+1],o=0;for(let a=t+i;a<e;a+=i){const l=n[a],h=n[a+1];o+=Math.sqrt((l-s)*(l-s)+(h-r)*(h-r)),s=l,r=h}return o}const te={PRERENDER:"prerender",POSTRENDER:"postrender",PRECOMPOSE:"precompose",POSTCOMPOSE:"postcompose",RENDERCOMPLETE:"rendercomplete"},bi=typeof navigator<"u"&&typeof navigator.userAgent<"u"?navigator.userAgent.toLowerCase():"";bi.includes("safari")&&!bi.includes("chrom")&&(bi.includes("version/15.4")||/cpu (os|iphone os) 15_4 like mac os x/.test(bi));const Jf=bi.includes("webkit")&&!bi.includes("edge"),Th=bi.includes("macintosh"),Qf=typeof devicePixelRatio<"u"?devicePixelRatio:1,Yt=typeof WorkerGlobalScope<"u"&&typeof OffscreenCanvas<"u"&&self instanceof WorkerGlobalScope,Ih=typeof Image<"u"&&Image.prototype.decode,Sh=(function(){let n=!1;try{const t=Object.defineProperty({},"passive",{get:function(){n=!0}});window.addEventListener("_",null,t),window.removeEventListener("_",null,t)}catch{}return n})(),X={IDLE:0,LOADING:1,LOADED:2,ERROR:3};function ht(n,t,e,i){let s;return e&&e.length?s=e.shift():Yt?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 So;function ar(){return So||(So=ht(1,1)),So}function lr(n){const t=n.canvas;t.width=1,t.height=1,n.clearRect(0,0,1,1)}function tg(n){let t=n.offsetWidth;const e=getComputedStyle(n);return t+=parseInt(e.marginLeft,10)+parseInt(e.marginRight,10),t}function eg(n){let t=n.offsetHeight;const e=getComputedStyle(n);return t+=parseInt(e.marginTop,10)+parseInt(e.marginBottom,10),t}function bh(n,t){const e=t.parentNode;e&&e.replaceChild(n,t)}function Lh(n){for(;n.lastChild;)n.lastChild.remove()}function ig(n,t){const e=n.childNodes;for(let i=0;;++i){const s=e[i],r=t[i];if(!s&&!r)break;if(s!==r){if(!s){n.appendChild(r);continue}if(!r){n.removeChild(s),--i;continue}n.insertBefore(r,s)}}}function Ah(){return new Proxy({childNodes:[],appendChild:function(t){return this.childNodes.push(t),t},remove:function(){},removeChild:function(t){const e=this.childNodes.indexOf(t);if(e===-1)throw new Error("Node to remove was not found");return this.childNodes.splice(e,1),t},insertBefore:function(t,e){const i=this.childNodes.indexOf(e);if(i===-1)throw new Error("Reference node not found");return this.childNodes.splice(i,0,t),t},style:{}},{get(t,e,i){return e==="firstElementChild"?t.childNodes.length>0?t.childNodes[0]:null:Reflect.get(t,e,i)}})}function si(n){return typeof HTMLCanvasElement<"u"&&n instanceof HTMLCanvasElement||typeof OffscreenCanvas<"u"&&n instanceof OffscreenCanvas}const bo=[NaN,NaN,NaN,0];let Lo;function ng(){return Lo||(Lo=ht(1,1,void 0,{willReadFrequently:!0,desynchronized:!0})),Lo}const sg=/^rgba?\(\s*(\d+%?)\s+(\d+%?)\s+(\d+%?)(?:\s*\/\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,rg=/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,og=/^rgba?\(\s*(\d+%)\s*,\s*(\d+%)\s*,\s*(\d+%)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,ag=/^#([\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$/i;function hr(n,t){return n.endsWith("%")?Number(n.substring(0,n.length-1))/t:Number(n)}function Bn(n){throw new Error('failed to parse "'+n+'" as color')}function Mh(n){if(n.toLowerCase().startsWith("rgb")){const r=n.match(rg)||n.match(sg)||n.match(og);if(r){const o=r[4],a=100/255;return[rt(hr(r[1],a)+.5|0,0,255),rt(hr(r[2],a)+.5|0,0,255),rt(hr(r[3],a)+.5|0,0,255),o!==void 0?rt(hr(o,100),0,1):1]}Bn(n)}if(n.startsWith("#")){if(ag.test(n)){const r=n.substring(1),o=r.length<=4?1:2,a=[0,0,0,255];for(let l=0,h=r.length;l<h;l+=o){let c=parseInt(r.substring(l,l+o),16);o===1&&(c+=c<<4),a[l/o]=c}return a[3]=a[3]/255,a}Bn(n)}const t=ng();t.fillStyle="#abcdef";let e=t.fillStyle;t.fillStyle=n,t.fillStyle===e&&(t.fillStyle="#fedcba",e=t.fillStyle,t.fillStyle=n,t.fillStyle===e&&Bn(n));const i=t.fillStyle;if(i.startsWith("#")||i.startsWith("rgba"))return Mh(i);t.clearRect(0,0,1,1),t.fillRect(0,0,1,1);const s=Array.from(t.getImageData(0,0,1,1).data);return s[3]=Vs(s[3]/255,3),s}function lg(n){return typeof n=="string"?n:ko(n)}const hg=1024,Zn={};let Ao=0;function cg(n){if(n.length===4)return n;const t=n.slice();return t[3]=1,t}function Mo(n){return n>.0031308?Math.pow(n,1/2.4)*269.025-14.025:n*3294.6}function Po(n){return n>.2068965?Math.pow(n,3):(n-4/29)*(108/841)}function Oo(n){return n>10.314724?Math.pow((n+14.025)/269.025,2.4):n/3294.6}function Do(n){return n>.0088564?Math.pow(n,1/3):n/(108/841)+4/29}function Ph(n){const t=Oo(n[0]),e=Oo(n[1]),i=Oo(n[2]),s=Do(t*.222488403+e*.716873169+i*.06060791),r=500*(Do(t*.452247074+e*.399439023+i*.148375274)-s),o=200*(s-Do(t*.016863605+e*.117638439+i*.865350722)),a=Math.atan2(o,r)*(180/Math.PI);return[116*s-16,Math.sqrt(r*r+o*o),a<0?a+360:a,n[3]]}function ug(n){const t=(n[0]+16)/116,e=n[1],i=n[2]*Math.PI/180,s=Po(t),r=Po(t+e/500*Math.cos(i)),o=Po(t-e/200*Math.sin(i)),a=Mo(r*3.021973625-s*1.617392459-o*.404875592),l=Mo(r*-.943766287+s*1.916279586+o*.027607165),h=Mo(r*.069407491-s*.22898585+o*1.159737864);return[rt(a+.5|0,0,255),rt(l+.5|0,0,255),rt(h+.5|0,0,255),n[3]]}function Fo(n){if(n==="none")return bo;if(Zn.hasOwnProperty(n))return Zn[n];if(Ao>=hg){let e=0;for(const i in Zn)(e++&3)===0&&(delete Zn[i],--Ao)}const t=Mh(n);t.length!==4&&Bn(n);for(const e of t)isNaN(e)&&Bn(n);return Zn[n]=t,++Ao,t}function tn(n){return Array.isArray(n)?n:Fo(n)}function ko(n){let t=n[0];t!=(t|0)&&(t=t+.5|0);let e=n[1];e!=(e|0)&&(e=e+.5|0);let i=n[2];i!=(i|0)&&(i=i+.5|0);const s=n[3]===void 0?1:Math.round(n[3]*1e3)/1e3;return"rgba("+t+","+e+","+i+","+s+")"}function dg(n,t,e){const i=n;let s=!0,r=!1,o=!1;const a=[Ws(i,z.LOAD,function(){o=!0,r||t()})];return i.src&&Ih?(r=!0,i.decode().then(function(){s&&t()}).catch(function(l){s&&(o?t():e())})):a.push(Ws(i,z.ERROR,e)),function(){s=!1,a.forEach(nt)}}function fg(n,t){return new Promise((e,i)=>{function s(){o(),e(n)}function r(){o(),i(new Error("Image load error"))}function o(){n.removeEventListener("load",s),n.removeEventListener("error",r)}n.addEventListener("load",s),n.addEventListener("error",r)})}function gg(n,t){return t&&(n.src=t),n.src&&Ih?new Promise((e,i)=>n.decode().then(()=>e(n)).catch(s=>n.complete&&n.width?e(n):i(s))):fg(n)}class _g{constructor(){this.cache_={},this.patternCache_={},this.cacheSize_=0,this.maxCacheSize_=1024}clear(){this.cache_={},this.patternCache_={},this.cacheSize_=0}canExpireCache(){return this.cacheSize_>this.maxCacheSize_}expire(){if(this.canExpireCache()){let t=0;for(const e in this.cache_){const i=this.cache_[e];(t++&3)===0&&!i.hasListener()&&(delete this.cache_[e],delete this.patternCache_[e],--this.cacheSize_)}}}get(t,e,i){const s=No(t,e,i);return s in this.cache_?this.cache_[s]:null}getPattern(t,e,i){const s=No(t,e,i);return s in this.patternCache_?this.patternCache_[s]:null}set(t,e,i,s,r){const o=No(t,e,i),a=o in this.cache_;this.cache_[o]=s,r&&(s.getImageState()===X.IDLE&&s.load(),s.getImageState()===X.LOADING?s.ready().then(()=>{this.patternCache_[o]=ar().createPattern(s.getImage(1),"repeat")}):this.patternCache_[o]=ar().createPattern(s.getImage(1),"repeat")),a||++this.cacheSize_}setSize(t){this.maxCacheSize_=t,this.expire()}}function No(n,t,e){const i=e?tn(e):"null";return t+":"+n+":"+i}const ee=new _g;let Un=null;class Oh extends Xs{constructor(t,e,i,s,r){super(),this.hitDetectionImage_=null,this.image_=t,this.crossOrigin_=i,this.canvas_={},this.color_=r,this.imageState_=s===void 0?X.IDLE:s,this.size_=t&&t.width&&t.height?[t.width,t.height]:null,this.src_=e,this.tainted_,this.ready_=null}initializeImage_(){this.image_=new Image,this.crossOrigin_!==null&&(this.image_.crossOrigin=this.crossOrigin_)}isTainted_(){if(this.tainted_===void 0&&this.imageState_===X.LOADED){Un||(Un=ht(1,1,void 0,{willReadFrequently:!0})),Un.drawImage(this.image_,0,0);try{Un.getImageData(0,0,1,1),this.tainted_=!1}catch{Un=null,this.tainted_=!0}}return this.tainted_===!0}dispatchChangeEvent_(){this.dispatchEvent(z.CHANGE)}handleImageError_(){this.imageState_=X.ERROR,this.dispatchChangeEvent_()}handleImageLoad_(){this.imageState_=X.LOADED,this.size_=[this.image_.width,this.image_.height],this.dispatchChangeEvent_()}getImage(t){return this.image_||this.initializeImage_(),this.replaceColor_(t),this.canvas_[t]?this.canvas_[t]:this.image_}getPixelRatio(t){return this.replaceColor_(t),this.canvas_[t]?t:1}getImageState(){return this.imageState_}getHitDetectionImage(){if(this.image_||this.initializeImage_(),!this.hitDetectionImage_)if(this.isTainted_()){const t=this.size_[0],e=this.size_[1],i=ht(t,e);i.fillRect(0,0,t,e),this.hitDetectionImage_=i.canvas}else this.hitDetectionImage_=this.image_;return this.hitDetectionImage_}getSize(){return this.size_}getSrc(){return this.src_}load(){if(this.imageState_===X.IDLE){this.image_||this.initializeImage_(),this.imageState_=X.LOADING;try{this.src_!==void 0&&(this.image_.src=this.src_)}catch{this.handleImageError_()}this.image_ instanceof HTMLImageElement&&gg(this.image_,this.src_).then(t=>{this.image_=t,this.handleImageLoad_()}).catch(this.handleImageError_.bind(this))}}replaceColor_(t){if(!this.color_||this.canvas_[t]||this.imageState_!==X.LOADED)return;const e=this.image_,i=ht(Math.ceil(e.width*t),Math.ceil(e.height*t)),s=i.canvas;i.scale(t,t),i.drawImage(e,0,0),i.globalCompositeOperation="multiply",i.fillStyle=lg(this.color_),i.fillRect(0,0,s.width/t,s.height/t),i.globalCompositeOperation="destination-in",i.drawImage(e,0,0),this.canvas_[t]=s}ready(){return this.ready_||(this.ready_=new Promise(t=>{if(this.imageState_===X.LOADED||this.imageState_===X.ERROR)t();else{const e=()=>{(this.imageState_===X.LOADED||this.imageState_===X.ERROR)&&(this.removeEventListener(z.CHANGE,e),t())};this.addEventListener(z.CHANGE,e)}})),this.ready_}}function cr(n,t,e,i,s,r){let o=t===void 0?void 0:ee.get(t,e,s);return o||(o=new Oh(n,n&&"src"in n?n.src||void 0:t,e,i,s),ee.set(t,e,s,o,r)),r&&o&&!ee.getPattern(t,e,s)&&ee.set(t,e,s,o,r),o}function ye(n){return n?Array.isArray(n)?ko(n):typeof n=="object"&&"src"in n?mg(n):n:null}function mg(n){if(!n.offset||!n.size)return ee.getPattern(n.src,"anonymous",n.color);const t=n.src+":"+n.offset,e=ee.getPattern(t,void 0,n.color);if(e)return e;const i=ee.get(n.src,"anonymous",null);if(i.getImageState()!==X.LOADED)return null;const s=ht(n.size[0],n.size[1]);return s.drawImage(i.getImage(1),n.offset[0],n.offset[1],n.size[0],n.size[1],0,0,n.size[0],n.size[1]),cr(s.canvas,t,void 0,X.LOADED,n.color,!0),ee.getPattern(t,void 0,n.color)}class Dh{drawCustom(t,e,i,s,r){}drawGeometry(t){}setStyle(t){}drawCircle(t,e,i){}drawFeature(t,e,i){}drawGeometryCollection(t,e,i){}drawLineString(t,e,i){}drawMultiLineString(t,e,i){}drawMultiPoint(t,e,i){}drawMultiPolygon(t,e,i){}drawPoint(t,e,i){}drawPolygon(t,e,i){}drawText(t,e,i){}setFillStrokeStyle(t,e){}setImageStyle(t,e){}setTextStyle(t,e){}}const ur="ol-hidden",pg="ol-selectable",dr="ol-unselectable",Go="ol-control",Fh="ol-collapsed",yg=new RegExp(["^\\s*(?=(?:(?:[-a-z]+\\s*){0,2}(italic|oblique))?)","(?=(?:(?:[-a-z]+\\s*){0,2}(small-caps))?)","(?=(?:(?:[-a-z]+\\s*){0,2}(bold(?:er)?|lighter|[1-9]00 ))?)","(?:(?:normal|\\1|\\2|\\3)\\s*){0,3}((?:xx?-)?","(?:small|large)|medium|smaller|larger|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx]))","(?:\\s*\\/\\s*(normal|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx])?))",`?\\s*([-,\\"\\'\\sa-z0-9]+?)\\s*$`].join(""),"i"),kh=["style","variant","weight","size","lineHeight","family"],zo={normal:400,bold:700},Xo=function(n){const t=n.match(yg);if(!t)return null;const e={lineHeight:"normal",size:"1.2em",style:"normal",weight:"400",variant:"normal"};for(let i=0,s=kh.length;i<s;++i){const r=t[i+1];r!==void 0&&(e[kh[i]]=typeof r=="string"?r.trim():r)}return isNaN(Number(e.weight))&&e.weight in zo&&(e.weight=zo[e.weight]),e.families=e.family.split(/,\s?/).map(i=>i.trim().replace(/^['"]|['"]$/g,"")),e},Nh="10px sans-serif",Ft="#000",en="round",De=[],Fe=0,nn="round",Vn=10,jn="#000",Hn="center",fr="middle",Li=[0,0,0,0],qn=1,sn=new ce;let Jn=null,Gh;const Wo={},Eg=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace","ui-rounded","emoji","math","fangsong"]);function xg(n,t,e){return`${n} ${t} 16px "${e}"`}const vg=(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=Xo(r),l=a.families[0].toLowerCase(),h=a.weight;return o.some(c=>{const u=c.family.replace(/^['"]|['"]$/g,"").toLowerCase(),d=zo[c.weight]||c.weight;return u===l&&c.style===a.style&&d==h})}async function s(){await e.ready;let r=!0;const o=sn.getProperties(),a=Object.keys(o).filter(l=>o[l]<100);for(let l=a.length-1;l>=0;--l){const h=a[l];let c=o[h];c<100&&(await i(h)?(kn(Wo),sn.set(h,100)):(c+=10,sn.set(h,c,!0),c<100&&(r=!1)))}t=void 0,r||(t=setTimeout(s,100))}return async function(r){e||(e=Yt?self.fonts:document.fonts);const o=Xo(r);if(!o)return;const a=o.families;let l=!1;for(const h of a){if(Eg.has(h))continue;const c=xg(o.style,o.weight,h);sn.get(c)===void 0&&(sn.set(c,0,!0),l=!0)}l&&(clearTimeout(t),t=setTimeout(s,100))}})(),wg=(function(){let n;return function(t){let e=Wo[t];if(e==null){if(Yt){const i=Xo(t),s=zh(t,"Žg");e=(isNaN(Number(i.lineHeight))?1.2:Number(i.lineHeight))*(s.actualBoundingBoxAscent+s.actualBoundingBoxDescent)}else n||(n=document.createElement("div"),n.innerHTML="M",n.style.minHeight="0",n.style.maxHeight="none",n.style.height="auto",n.style.padding="0",n.style.border="none",n.style.position="absolute",n.style.display="block",n.style.left="-99999px"),n.style.font=t,document.body.appendChild(n),e=n.offsetHeight,document.body.removeChild(n);Wo[t]=e}return e}})();function zh(n,t){return Jn||(Jn=ht(1,1)),n!=Gh&&(Jn.font=n,Gh=Jn.font),Jn.measureText(t)}function Xh(n,t){return zh(n,t).width}function Wh(n,t,e){if(t in e)return e[t];const i=t.split(`
|
|
3
|
-
`).reduce((s,r)=>Math.max(s,Xh(n,r)),0);return e[t]=i,i}function
|
|
4
|
-
`||h===c){r=Math.max(r,o),s.push(o),o=0,a+=l,l=0;continue}const d=t[h+1]||n.font,f=Xh(d,u);e.push(f),o+=f;const g=wg(d);i.push(g),l=Math.max(l,g)}return{width:r,height:a,widths:e,heights:i,lineWidths:s}}function Rg(n,t,e,i,s,r,o,a,l,h,c){n.save(),e!==1&&(n.globalAlpha===void 0?n.globalAlpha=u=>u.globalAlpha*=e:n.globalAlpha*=e),t&&n.transform.apply(n,t),i.contextInstructions?(n.translate(l,h),n.scale(c[0],c[1]),Tg(i,n)):c[0]<0||c[1]<0?(n.translate(l,h),n.scale(c[0],c[1]),n.drawImage(i,s,r,o,a,0,0,o,a)):n.drawImage(i,s,r,o,a,l,h,o*c[0],a*c[1]),n.restore()}function Tg(n,t){const e=n.contextInstructions;for(let i=0,s=e.length;i<s;i+=2)Array.isArray(e[i+1])?t[e[i]].apply(t,e[i+1]):t[e[i]]=e[i+1]}class Ig extends Dh{constructor(t,e,i,s,r,o,a){super(),this.context_=t,this.pixelRatio_=e,this.extent_=i,this.transform_=s,this.transformRotation_=s?Vs(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_=ue()}drawImages_(t,e,i,s){if(!this.image_)return;const r=ni(t,e,i,s,this.transform_,this.pixelCoordinates_),o=this.context_,a=this.tmpLocalTransform_,l=o.globalAlpha;this.imageOpacity_!=1&&(o.globalAlpha=l*this.imageOpacity_);let h=this.imageRotation_;this.transformRotation_===0&&(h-=this.viewRotation_),this.imageRotateWithView_&&(h+=this.viewRotation_);for(let c=0,u=r.length;c<u;c+=2){const d=r[c]-this.imageAnchorX_,f=r[c+1]-this.imageAnchorY_;if(h!==0||this.imageScale_[0]!=1||this.imageScale_[1]!=1){const g=d+this.imageAnchorX_,m=f+this.imageAnchorY_;Oe(a,g,m,1,1,h,-g,-m),o.save(),o.transform.apply(o,a),o.translate(g,m),o.scale(this.imageScale_[0],this.imageScale_[1]),o.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,-this.imageAnchorX_,-this.imageAnchorY_,this.imageWidth_,this.imageHeight_),o.restore()}else o.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,d,f,this.imageWidth_,this.imageHeight_)}this.imageOpacity_!=1&&(o.globalAlpha=l)}drawText_(t,e,i,s){if(!this.textState_||this.text_==="")return;this.textFillState_&&this.setContextFillState_(this.textFillState_),this.textStrokeState_&&this.setContextStrokeState_(this.textStrokeState_),this.setContextTextState_(this.textState_);const r=ni(t,e,i,s,this.transform_,this.pixelCoordinates_),o=this.context_;let a=this.textRotation_;for(this.transformRotation_===0&&(a-=this.viewRotation_),this.textRotateWithView_&&(a+=this.viewRotation_);e<i;e+=s){const l=r[e]+this.textOffsetX_,h=r[e+1]+this.textOffsetY_;a!==0||this.textScale_[0]!=1||this.textScale_[1]!=1?(o.save(),o.translate(l-this.textOffsetX_,h-this.textOffsetY_),o.rotate(a),o.translate(this.textOffsetX_,this.textOffsetY_),o.scale(this.textScale_[0],this.textScale_[1]),this.textStrokeState_&&o.strokeText(this.text_,0,0),this.textFillState_&&o.fillText(this.text_,0,0),o.restore()):(this.textStrokeState_&&o.strokeText(this.text_,l,h),this.textFillState_&&o.fillText(this.text_,l,h))}}moveToLineTo_(t,e,i,s,r){const o=this.context_,a=ni(t,e,i,s,this.transform_,this.pixelCoordinates_);o.moveTo(a[0],a[1]);let l=a.length;r&&(l-=2);for(let h=2;h<l;h+=2)o.lineTo(a[h],a[h+1]);return r&&o.closePath(),i}drawRings_(t,e,i,s){for(let r=0,o=i.length;r<o;++r)e=this.moveToLineTo_(t,e,i[r],s,!0);return e}drawCircle(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!Ot(this.extent_,t.getExtent())){if(this.fillState_||this.strokeState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const e=kf(t,this.transform_,this.pixelCoordinates_),i=e[2]-e[0],s=e[3]-e[1],r=Math.sqrt(i*i+s*s),o=this.context_;o.beginPath(),o.arc(e[0],e[1],r,0,2*Math.PI),this.fillState_&&o.fill(),this.strokeState_&&o.stroke()}this.text_!==""&&this.drawText_(t.getCenter(),0,2,2)}}setStyle(t){this.setFillStrokeStyle(t.getFill(),t.getStroke()),this.setImageStyle(t.getImage()),this.setTextStyle(t.getText())}setTransform(t){this.transform_=t}drawGeometry(t){switch(t.getType()){case"Point":this.drawPoint(t);break;case"LineString":this.drawLineString(t);break;case"Polygon":this.drawPolygon(t);break;case"MultiPoint":this.drawMultiPoint(t);break;case"MultiLineString":this.drawMultiLineString(t);break;case"MultiPolygon":this.drawMultiPolygon(t);break;case"GeometryCollection":this.drawGeometryCollection(t);break;case"Circle":this.drawCircle(t);break}}drawFeature(t,e){const i=e.getGeometryFunction()(t);i&&(this.setStyle(e),this.drawGeometry(i))}drawGeometryCollection(t){const e=t.getGeometriesArray();for(let i=0,s=e.length;i<s;++i)this.drawGeometry(e[i])}drawPoint(t){this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_));const e=t.getFlatCoordinates(),i=t.getStride();this.image_&&this.drawImages_(e,0,e.length,i),this.text_!==""&&this.drawText_(e,0,e.length,i)}drawMultiPoint(t){this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_));const e=t.getFlatCoordinates(),i=t.getStride();this.image_&&this.drawImages_(e,0,e.length,i),this.text_!==""&&this.drawText_(e,0,e.length,i)}drawLineString(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!Ot(this.extent_,t.getExtent())){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);const e=this.context_,i=t.getFlatCoordinates();e.beginPath(),this.moveToLineTo_(i,0,i.length,t.getStride(),!1),e.stroke()}if(this.text_!==""){const e=t.getFlatMidpoint();this.drawText_(e,0,2,2)}}}drawMultiLineString(t){this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_));const e=t.getExtent();if(Ot(this.extent_,e)){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);const i=this.context_,s=t.getFlatCoordinates();let r=0;const o=t.getEnds(),a=t.getStride();i.beginPath();for(let l=0,h=o.length;l<h;++l)r=this.moveToLineTo_(s,r,o[l],a,!1);i.stroke()}if(this.text_!==""){const i=t.getFlatMidpoints();this.drawText_(i,0,i.length,2)}}}drawPolygon(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!Ot(this.extent_,t.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const e=this.context_;e.beginPath(),this.drawRings_(t.getOrientedFlatCoordinates(),0,t.getEnds(),t.getStride()),this.fillState_&&e.fill(),this.strokeState_&&e.stroke()}if(this.text_!==""){const e=t.getFlatInteriorPoint();this.drawText_(e,0,2,2)}}}drawMultiPolygon(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!Ot(this.extent_,t.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const e=this.context_,i=t.getOrientedFlatCoordinates();let s=0;const r=t.getEndss(),o=t.getStride();e.beginPath();for(let a=0,l=r.length;a<l;++a){const h=r[a];s=this.drawRings_(i,s,h,o)}this.fillState_&&e.fill(),this.strokeState_&&e.stroke()}if(this.text_!==""){const e=t.getFlatInteriorPoints();this.drawText_(e,0,e.length,2)}}}setContextFillState_(t){const e=this.context_,i=this.contextFillState_;i?i.fillStyle!=t.fillStyle&&(i.fillStyle=t.fillStyle,e.fillStyle=t.fillStyle):(e.fillStyle=t.fillStyle,this.contextFillState_={fillStyle:t.fillStyle})}setContextStrokeState_(t){const e=this.context_,i=this.contextStrokeState_;i?(i.lineCap!=t.lineCap&&(i.lineCap=t.lineCap,e.lineCap=t.lineCap),Qe(i.lineDash,t.lineDash)||e.setLineDash(i.lineDash=t.lineDash),i.lineDashOffset!=t.lineDashOffset&&(i.lineDashOffset=t.lineDashOffset,e.lineDashOffset=t.lineDashOffset),i.lineJoin!=t.lineJoin&&(i.lineJoin=t.lineJoin,e.lineJoin=t.lineJoin),i.lineWidth!=t.lineWidth&&(i.lineWidth=t.lineWidth,e.lineWidth=t.lineWidth),i.miterLimit!=t.miterLimit&&(i.miterLimit=t.miterLimit,e.miterLimit=t.miterLimit),i.strokeStyle!=t.strokeStyle&&(i.strokeStyle=t.strokeStyle,e.strokeStyle=t.strokeStyle)):(e.lineCap=t.lineCap,e.setLineDash(t.lineDash),e.lineDashOffset=t.lineDashOffset,e.lineJoin=t.lineJoin,e.lineWidth=t.lineWidth,e.miterLimit=t.miterLimit,e.strokeStyle=t.strokeStyle,this.contextStrokeState_={lineCap:t.lineCap,lineDash:t.lineDash,lineDashOffset:t.lineDashOffset,lineJoin:t.lineJoin,lineWidth:t.lineWidth,miterLimit:t.miterLimit,strokeStyle:t.strokeStyle})}setContextTextState_(t){const e=this.context_,i=this.contextTextState_,s=t.textAlign?t.textAlign:Hn;i?(i.font!=t.font&&(i.font=t.font,e.font=t.font),i.textAlign!=s&&(i.textAlign=s,e.textAlign=s),i.textBaseline!=t.textBaseline&&(i.textBaseline=t.textBaseline,e.textBaseline=t.textBaseline)):(e.font=t.font,e.textAlign=s,e.textBaseline=t.textBaseline,this.contextTextState_={font:t.font,textAlign:s,textBaseline:t.textBaseline})}setFillStrokeStyle(t,e){if(!t)this.fillState_=null;else{const i=t.getColor();this.fillState_={fillStyle:ye(i||Ft)}}if(!e)this.strokeState_=null;else{const i=e.getColor(),s=e.getLineCap(),r=e.getLineDash(),o=e.getLineDashOffset(),a=e.getLineJoin(),l=e.getWidth(),h=e.getMiterLimit(),c=r||De;this.strokeState_={lineCap:s!==void 0?s:en,lineDash:this.pixelRatio_===1?c:c.map(u=>u*this.pixelRatio_),lineDashOffset:(o||Fe)*this.pixelRatio_,lineJoin:a!==void 0?a:nn,lineWidth:(l!==void 0?l:qn)*this.pixelRatio_,miterLimit:h!==void 0?h:Vn,strokeStyle:ye(i||jn)}}}setImageStyle(t){let e;if(!t||!(e=t.getSize())){this.image_=null;return}const i=t.getPixelRatio(this.pixelRatio_),s=t.getAnchor(),r=t.getOrigin();this.image_=t.getImage(this.pixelRatio_),this.imageAnchorX_=s[0]*i,this.imageAnchorY_=s[1]*i,this.imageHeight_=e[1]*i,this.imageOpacity_=t.getOpacity(),this.imageOriginX_=r[0],this.imageOriginY_=r[1],this.imageRotateWithView_=t.getRotateWithView(),this.imageRotation_=t.getRotation();const o=t.getScaleArray();this.imageScale_=[o[0]*this.pixelRatio_/i,o[1]*this.pixelRatio_/i],this.imageWidth_=e[0]*i}setTextStyle(t){if(!t)this.text_="";else{const e=t.getFill();if(!e)this.textFillState_=null;else{const f=e.getColor();this.textFillState_={fillStyle:ye(f||Ft)}}const i=t.getStroke();if(!i)this.textStrokeState_=null;else{const f=i.getColor(),g=i.getLineCap(),m=i.getLineDash(),_=i.getLineDashOffset(),p=i.getLineJoin(),y=i.getWidth(),w=i.getMiterLimit();this.textStrokeState_={lineCap:g!==void 0?g:en,lineDash:m||De,lineDashOffset:_||Fe,lineJoin:p!==void 0?p:nn,lineWidth:y!==void 0?y:qn,miterLimit:w!==void 0?w:Vn,strokeStyle:ye(f||jn)}}const s=t.getFont(),r=t.getOffsetX(),o=t.getOffsetY(),a=t.getRotateWithView(),l=t.getRotation(),h=t.getScaleArray(),c=t.getText(),u=t.getTextAlign(),d=t.getTextBaseline();this.textState_={font:s!==void 0?s:Nh,textAlign:u!==void 0?u:Hn,textBaseline:d!==void 0?d:fr},this.text_=c!==void 0?Array.isArray(c)?c.reduce((f,g,m)=>f+=m%2?" ":g,""):c:"",this.textOffsetX_=r!==void 0?this.pixelRatio_*r:0,this.textOffsetY_=o!==void 0?this.pixelRatio_*o:0,this.textRotateWithView_=a!==void 0?a:!1,this.textRotation_=l!==void 0?l:0,this.textScale_=[this.pixelRatio_*h[0],this.pixelRatio_*h[1]]}}}const Sg=.5,Yh={Point:Fg,LineString:Pg,Polygon:Ng,MultiPoint:kg,MultiLineString:Og,MultiPolygon:Dg,GeometryCollection:Mg,Circle:Lg};function bg(n,t){return parseInt(V(n),10)-parseInt(V(t),10)}function $h(n,t){const e=Kh(n,t);return e*e}function Kh(n,t){return Sg*n/t}function Lg(n,t,e,i,s){const r=e.getFill(),o=e.getStroke();if(r||o){const l=n.getBuilder(e.getZIndex(),"Circle");l.setFillStrokeStyle(r,o),l.drawCircle(t,i,s)}const a=e.getText();if(a&&a.getText()){const l=n.getBuilder(e.getZIndex(),"Text");l.setTextStyle(a),l.drawText(t,i)}}function Bh(n,t,e,i,s,r,o,a){const l=[],h=e.getImage();if(h){let d=!0;const f=h.getImageState();f==X.LOADED||f==X.ERROR?d=!1:f==X.IDLE&&h.load(),d&&l.push(h.ready())}const c=e.getFill();c&&c.loading()&&l.push(c.ready());const u=l.length>0;return u&&Promise.all(l).then(()=>s(null)),Ag(n,t,e,i,r,o,a),u}function Ag(n,t,e,i,s,r,o){const a=e.getGeometryFunction()(t);if(!a)return;const l=a.simplifyTransformed(i,s);if(e.getRenderer())Zh(n,l,e,t,o);else{const c=Yh[l.getType()];c(n,l,e,t,o,r)}}function Zh(n,t,e,i,s){if(t.getType()=="GeometryCollection"){const o=t.getGeometries();for(let a=0,l=o.length;a<l;++a)Zh(n,o[a],e,i,s);return}n.getBuilder(e.getZIndex(),"Default").drawCustom(t,i,e.getRenderer(),e.getHitDetectionRenderer(),s)}function Mg(n,t,e,i,s,r){const o=t.getGeometriesArray();let a,l;for(a=0,l=o.length;a<l;++a){const h=Yh[o[a].getType()];h(n,o[a],e,i,s,r)}}function Pg(n,t,e,i,s){const r=e.getStroke();if(r){const a=n.getBuilder(e.getZIndex(),"LineString");a.setFillStrokeStyle(null,r),a.drawLineString(t,i,s)}const o=e.getText();if(o&&o.getText()){const a=n.getBuilder(e.getZIndex(),"Text");a.setTextStyle(o),a.drawText(t,i,s)}}function Og(n,t,e,i,s){const r=e.getStroke();if(r){const a=n.getBuilder(e.getZIndex(),"LineString");a.setFillStrokeStyle(null,r),a.drawMultiLineString(t,i,s)}const o=e.getText();if(o&&o.getText()){const a=n.getBuilder(e.getZIndex(),"Text");a.setTextStyle(o),a.drawText(t,i,s)}}function Dg(n,t,e,i,s){const r=e.getFill(),o=e.getStroke();if(o||r){const l=n.getBuilder(e.getZIndex(),"Polygon");l.setFillStrokeStyle(r,o),l.drawMultiPolygon(t,i,s)}const a=e.getText();if(a&&a.getText()){const l=n.getBuilder(e.getZIndex(),"Text");l.setTextStyle(a),l.drawText(t,i,s)}}function Fg(n,t,e,i,s,r){const o=e.getImage(),a=e.getText(),l=a&&a.getText(),h=r&&o&&l?{}:void 0;if(o){if(o.getImageState()!=X.LOADED)return;const c=n.getBuilder(e.getZIndex(),"Image");c.setImageStyle(o,h),c.drawPoint(t,i,s)}if(l){const c=n.getBuilder(e.getZIndex(),"Text");c.setTextStyle(a,h),c.drawText(t,i,s)}}function kg(n,t,e,i,s,r){const o=e.getImage(),a=o&&o.getOpacity()!==0,l=e.getText(),h=l&&l.getText(),c=r&&a&&h?{}:void 0;if(a){if(o.getImageState()!=X.LOADED)return;const u=n.getBuilder(e.getZIndex(),"Image");u.setImageStyle(o,c),u.drawMultiPoint(t,i,s)}if(h){const u=n.getBuilder(e.getZIndex(),"Text");u.setTextStyle(l,c),u.drawText(t,i,s)}}function Ng(n,t,e,i,s){const r=e.getFill(),o=e.getStroke();if(r||o){const l=n.getBuilder(e.getZIndex(),"Polygon");l.setFillStrokeStyle(r,o),l.drawPolygon(t,i,s)}const a=e.getText();if(a&&a.getText()){const l=n.getBuilder(e.getZIndex(),"Text");l.setTextStyle(a),l.drawText(t,i,s)}}let Gg=!1;function zg(n,t,e,i,s,r,o){const a=new XMLHttpRequest;a.open("GET",typeof n=="function"?n(e,i,s):n,!0),t.getType()=="arraybuffer"&&(a.responseType="arraybuffer"),a.withCredentials=Gg,a.onload=function(l){if(!a.status||a.status>=200&&a.status<300){const h=t.getType();try{let c;h=="text"||h=="json"?c=a.responseText:h=="xml"?c=a.responseXML||a.responseText:h=="arraybuffer"&&(c=a.response),c?r(t.readFeatures(c,{extent:e,featureProjection:s}),t.readProjection(c)):o()}catch{o()}}else o()},a.onerror=o,a.send()}function Uh(n,t){return function(e,i,s,r,o){zg(n,t,e,i,s,(a,l)=>{this.addFeatures(a),r!==void 0&&r(a)},()=>{this.changed(),o!==void 0&&o()})}}function Xg(n,t){return[[-1/0,-1/0,1/0,1/0]]}function Wg(n,t,e,i){const s=[];let r=Wt();for(let o=0,a=e.length;o<a;++o){const l=e[o];r=io(n,t,l[0],i),s.push((r[0]+r[2])/2,(r[1]+r[3])/2),t=l[l.length-1]}return s}const Vh=ue();class de{constructor(t,e,i,s,r,o){this.styleFunction,this.extent_,this.id_=o,this.type_=t,this.flatCoordinates_=e,this.flatInteriorPoints_=null,this.flatMidpoints_=null,this.ends_=i||null,this.properties_=r,this.squaredTolerance_,this.stride_=s,this.simplifiedGeometry_}get(t){return this.properties_[t]}getExtent(){return this.extent_||(this.extent_=this.type_==="Point"?Fl(this.flatCoordinates_):io(this.flatCoordinates_,0,this.flatCoordinates_.length,2)),this.extent_}getFlatInteriorPoint(){if(!this.flatInteriorPoints_){const t=vi(this.getExtent());this.flatInteriorPoints_=To(this.flatCoordinates_,0,this.ends_,2,t,0)}return this.flatInteriorPoints_}getFlatInteriorPoints(){if(!this.flatInteriorPoints_){const t=Hf(this.flatCoordinates_,this.ends_),e=Wg(this.flatCoordinates_,0,t,2);this.flatInteriorPoints_=Bf(this.flatCoordinates_,0,t,2,e)}return this.flatInteriorPoints_}getFlatMidpoint(){return this.flatMidpoints_||(this.flatMidpoints_=Rh(this.flatCoordinates_,0,this.flatCoordinates_.length,2,.5)),this.flatMidpoints_}getFlatMidpoints(){if(!this.flatMidpoints_){this.flatMidpoints_=[];const t=this.flatCoordinates_;let e=0;const i=this.ends_;for(let s=0,r=i.length;s<r;++s){const o=i[s],a=Rh(t,e,o,2,.5);Jr(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=Dt(t);const e=t.getExtent(),i=t.getWorldExtent();if(e&&i){const s=St(i)/St(e);Oe(Vh,i[0],i[3],s,-s,0,0,0),ni(this.flatCoordinates_,0,this.flatCoordinates_.length,2,Vh,this.flatCoordinates_)}}applyTransform(t){t(this.flatCoordinates_,this.flatCoordinates_,this.stride_)}clone(){return new de(this.type_,this.flatCoordinates_.slice(),this.ends_?.slice(),this.stride_,Object.assign({},this.properties_),this.id_)}getEnds(){return this.ends_}enableSimplifyTransformed(){return this.simplifyTransformed=bl((t,e)=>{if(t===this.squaredTolerance_)return this.simplifiedGeometry_;this.simplifiedGeometry_=this.clone(),e&&this.simplifiedGeometry_.applyTransform(e);const i=this.simplifiedGeometry_.getFlatCoordinates();let s;switch(this.type_){case"LineString":i.length=Ro(i,0,this.simplifiedGeometry_.flatCoordinates_.length,this.simplifiedGeometry_.stride_,t,i,0),s=[i.length];break;case"MultiLineString":s=[],i.length=Yf(i,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,t,i,0,s);break;case"Polygon":s=[],i.length=yh(i,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,Math.sqrt(t),i,0,s);break}return s&&(this.simplifiedGeometry_=new de(this.type_,i,s,2,this.properties_,this.id_)),this.squaredTolerance_=t,this.simplifiedGeometry_}),this}}de.prototype.getFlatCoordinates=de.prototype.getOrientedFlatCoordinates;function jh(n,t,e=0,i=n.length-1,s=Yg){for(;i>e;){if(i-e>600){const l=i-e+1,h=t-e+1,c=Math.log(l),u=.5*Math.exp(2*c/3),d=.5*Math.sqrt(c*u*(l-u)/l)*(h-l/2<0?-1:1),f=Math.max(e,Math.floor(t-h*u/l+d)),g=Math.min(i,Math.floor(t+(l-h)*u/l+d));jh(n,t,f,g,s)}const r=n[t];let o=e,a=i;for(Qn(n,e,t),s(n[i],r)>0&&Qn(n,e,i);o<a;){for(Qn(n,o,a),o++,a--;s(n[o],r)<0;)o++;for(;s(n[a],r)>0;)a--}s(n[e],r)===0?Qn(n,e,a):(a++,Qn(n,a,i)),a<=t&&(e=a+1),t<=a&&(i=a-1)}}function Qn(n,t,e){const i=n[t];n[t]=n[e],n[e]=i}function Yg(n,t){return n<t?-1:n>t?1:0}let Hh=class{constructor(t=9){this._maxEntries=Math.max(4,t),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4)),this.clear()}all(){return this._all(this.data,[])}search(t){let e=this.data;const i=[];if(!_r(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;_r(t,l)&&(e.leaf?i.push(a):$o(t,l)?this._all(a,i):r.push(a))}e=r.pop()}return i}collides(t){let e=this.data;if(!_r(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(_r(t,o)){if(e.leaf||$o(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=on([]),this}remove(t,e){if(!t)return this;let i=this.data;const s=this.toBBox(t),r=[],o=[];let a,l,h;for(;i||r.length;){if(i||(i=r.pop(),l=r[r.length-1],a=o.pop(),h=!0),i.leaf){const c=$g(t,i.children,e);if(c!==-1)return i.children.splice(c,1),r.push(i),this._condense(r),this}!h&&!i.leaf&&$o(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=on(t.slice(e,i+1)),rn(a,this.toBBox),a;s||(s=Math.ceil(Math.log(r)/Math.log(o)),o=Math.ceil(r/Math.pow(o,s-1))),a=on([]),a.leaf=!1,a.height=s;const l=Math.ceil(r/o),h=l*Math.ceil(Math.sqrt(o));qh(t,e,i,h,this.compareMinX);for(let c=e;c<=i;c+=h){const u=Math.min(c+h-1,i);qh(t,c,u,l,this.compareMinY);for(let d=c;d<=u;d+=l){const f=Math.min(d+l-1,u);a.children.push(this._build(t,d,f,s-1))}}return rn(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=Yo(h),u=Zg(t,h)-c;u<o?(o=u,r=c<r?c:r,a=h):u===o&&c<r&&(r=c,a=h)}e=a||e.children[0]}return e}_insert(t,e,i){const s=i?t:this.toBBox(t),r=[],o=this._chooseSubtree(s,this.data,e,r);for(o.children.push(t),es(o,s);e>=0&&r[e].children.length>this._maxEntries;)this._split(r,e),e--;this._adjustParentBBoxes(s,r,e)}_split(t,e){const i=t[e],s=i.children.length,r=this._minEntries;this._chooseSplitAxis(i,r,s);const o=this._chooseSplitIndex(i,r,s),a=on(i.children.splice(o,i.children.length-o));a.height=i.height,a.leaf=i.leaf,rn(i,this.toBBox),rn(a,this.toBBox),e?t[e-1].children.push(a):this._splitRoot(i,a)}_splitRoot(t,e){this.data=on([t,e]),this.data.height=t.height+1,this.data.leaf=!1,rn(this.data,this.toBBox)}_chooseSplitIndex(t,e,i){let s,r=1/0,o=1/0;for(let a=e;a<=i-e;a++){const l=ts(t,0,a,this.toBBox),h=ts(t,a,i,this.toBBox),c=Ug(l,h),u=Yo(l)+Yo(h);c<r?(r=c,s=a,o=u<o?u:o):c===r&&u<o&&(o=u,s=a)}return s||i-e}_chooseSplitAxis(t,e,i){const s=t.leaf?this.compareMinX:Kg,r=t.leaf?this.compareMinY:Bg,o=this._allDistMargin(t,e,i,s),a=this._allDistMargin(t,e,i,r);o<a&&t.children.sort(s)}_allDistMargin(t,e,i,s){t.children.sort(s);const r=this.toBBox,o=ts(t,0,e,r),a=ts(t,i-e,i,r);let l=gr(o)+gr(a);for(let h=e;h<i-e;h++){const c=t.children[h];es(o,t.leaf?r(c):c),l+=gr(o)}for(let h=i-e-1;h>=e;h--){const c=t.children[h];es(a,t.leaf?r(c):c),l+=gr(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():rn(t[e],this.toBBox)}};function $g(n,t,e){if(!e)return t.indexOf(n);for(let i=0;i<t.length;i++)if(e(n,t[i]))return i;return-1}function rn(n,t){ts(n,0,n.children.length,t,n)}function ts(n,t,e,i,s){s||(s=on(null)),s.minX=1/0,s.minY=1/0,s.maxX=-1/0,s.maxY=-1/0;for(let r=t;r<e;r++){const o=n.children[r];es(s,n.leaf?i(o):o)}return s}function es(n,t){return n.minX=Math.min(n.minX,t.minX),n.minY=Math.min(n.minY,t.minY),n.maxX=Math.max(n.maxX,t.maxX),n.maxY=Math.max(n.maxY,t.maxY),n}function Kg(n,t){return n.minX-t.minX}function Bg(n,t){return n.minY-t.minY}function Yo(n){return(n.maxX-n.minX)*(n.maxY-n.minY)}function gr(n){return n.maxX-n.minX+(n.maxY-n.minY)}function Zg(n,t){return(Math.max(t.maxX,n.maxX)-Math.min(t.minX,n.minX))*(Math.max(t.maxY,n.maxY)-Math.min(t.minY,n.minY))}function Ug(n,t){const e=Math.max(n.minX,t.minX),i=Math.max(n.minY,t.minY),s=Math.min(n.maxX,t.maxX),r=Math.min(n.maxY,t.maxY);return Math.max(0,s-e)*Math.max(0,r-i)}function $o(n,t){return n.minX<=t.minX&&n.minY<=t.minY&&t.maxX<=n.maxX&&t.maxY<=n.maxY}function _r(n,t){return t.minX<=n.maxX&&t.minY<=n.maxY&&t.maxX>=n.minX&&t.maxY>=n.minY}function on(n){return{children:n,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function qh(n,t,e,i,s){const r=[t,e];for(;r.length;){if(e=r.pop(),t=r.pop(),e-t<=i)continue;const o=t+Math.ceil((e-t)/i/2)*i;jh(n,o,t,e,s),r.push(t,o,o,e)}}class Jh{constructor(t){this.rbush_=new Hh(t),this.items_={}}insert(t,e){const i={minX:t[0],minY:t[1],maxX:t[2],maxY:t[3],value:e};this.rbush_.insert(i),this.items_[V(e)]=i}load(t,e){const i=new Array(e.length);for(let s=0,r=e.length;s<r;s++){const o=t[s],a=e[s],l={minX:o[0],minY:o[1],maxX:o[2],maxY:o[3],value:a};i[s]=l,this.items_[V(a)]=l}this.rbush_.load(i)}remove(t){const e=V(t),i=this.items_[e];return delete this.items_[e],this.rbush_.remove(i)!==null}update(t,e){const i=this.items_[V(e)],s=[i.minX,i.minY,i.maxX,i.maxY];Gn(s,t)||(this.remove(e),this.insert(t,e))}getAll(){return this.rbush_.all().map(function(e){return e.value})}getInExtent(t){const e={minX:t[0],minY:t[1],maxX:t[2],maxY:t[3]};return this.rbush_.search(e).map(function(s){return s.value})}forEach(t){return this.forEach_(this.getAll(),t)}forEachInExtent(t,e){return this.forEach_(this.getInExtent(t),e)}forEach_(t,e){let i;for(let s=0,r=t.length;s<r;s++)if(i=e(t[s]),i)return i;return i}isEmpty(){return Ki(this.items_)}clear(){this.rbush_.clear(),this.items_={}}getExtent(t){const e=this.rbush_.toJSON();return ti(e.minX,e.minY,e.maxX,e.maxY,t)}concat(t){this.rbush_.load(t.rbush_.all());for(const e in t.items_)this.items_[e]=t.items_[e]}}class Qh extends ce{constructor(t){super(),this.projection=Dt(t.projection),this.attributions_=tc(t.attributions),this.attributionsCollapsible_=t.attributionsCollapsible??!0,this.loading=!1,this.state_=t.state!==void 0?t.state:"ready",this.wrapX_=t.wrapX!==void 0?t.wrapX:!1,this.interpolate_=!!t.interpolate,this.viewResolver=null,this.viewRejector=null;const e=this;this.viewPromise_=new Promise(function(i,s){e.viewResolver=i,e.viewRejector=s})}getAttributions(){return this.attributions_}getAttributionsCollapsible(){return this.attributionsCollapsible_}getProjection(){return this.projection}getResolutions(t){return null}getView(){return this.viewPromise_}getState(){return this.state_}getWrapX(){return this.wrapX_}getInterpolate(){return this.interpolate_}refresh(){this.changed()}setAttributions(t){this.attributions_=tc(t),this.changed()}setState(t){this.state_=t,this.changed()}}function tc(n){return n?typeof n=="function"?n:(Array.isArray(n)||(n=[n]),t=>n):null}const ie={ADDFEATURE:"addfeature",CHANGEFEATURE:"changefeature",CLEAR:"clear",REMOVEFEATURE:"removefeature",FEATURESLOADSTART:"featuresloadstart",FEATURESLOADEND:"featuresloadend",FEATURESLOADERROR:"featuresloaderror"};class ri extends Me{constructor(t,e,i){super(t),this.feature=e,this.features=i}}class Vg extends Qh{constructor(t){t=t||{},super({attributions:t.attributions,interpolate:!0,projection:void 0,state:"ready",wrapX:t.wrapX!==void 0?t.wrapX:!0}),this.on,this.once,this.un,this.loader_=Fn,this.format_=t.format||null,this.overlaps_=t.overlaps===void 0?!0:t.overlaps,this.url_=t.url,t.loader!==void 0?this.loader_=t.loader:this.url_!==void 0&&(q(this.format_,"`format` must be set when `url` is set"),this.loader_=Uh(this.url_,this.format_)),this.strategy_=t.strategy!==void 0?t.strategy:Xg;const e=t.useSpatialIndex!==void 0?t.useSpatialIndex:!0;this.featuresRtree_=e?new Jh:null,this.loadedExtentsRtree_=new Jh,this.loadingExtentsCount_=0,this.nullGeometryFeatures_={},this.idIndex_={},this.uidIndex_={},this.featureChangeKeys_={},this.featuresCollection_=null;let i,s;Array.isArray(t.features)?s=t.features:t.features&&(i=t.features,s=i.getArray()),!e&&i===void 0&&(i=new qt(s)),s!==void 0&&this.addFeaturesInternal(s),i!==void 0&&this.bindFeaturesCollection_(i)}addFeature(t){this.addFeatureInternal(t),this.changed()}addFeatureInternal(t){const e=V(t);if(!this.addToIndex_(e,t)){this.featuresCollection_&&this.featuresCollection_.remove(t);return}this.setupChangeEvents_(e,t);const i=t.getGeometry();if(i){const s=i.getExtent();this.featuresRtree_&&this.featuresRtree_.insert(s,t)}else this.nullGeometryFeatures_[e]=t;this.dispatchEvent(new ri(ie.ADDFEATURE,t))}setupChangeEvents_(t,e){e instanceof de||(this.featureChangeKeys_[t]=[Z(e,z.CHANGE,this.handleFeatureChange_,this),Z(e,$i.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 de){const r=this.idIndex_[s];r instanceof de?Array.isArray(r)?r.push(e):this.idIndex_[s]=[r,e]:i=!1}else i=!1}return i&&(q(!(t in this.uidIndex_),"The passed `feature` was already added to the source"),this.uidIndex_[t]=e),i}addFeatures(t){this.addFeaturesInternal(t),this.changed()}addFeaturesInternal(t){const e=[],i=[],s=[];for(let r=0,o=t.length;r<o;r++){const a=t[r],l=V(a);this.addToIndex_(l,a)&&i.push(a)}for(let r=0,o=i.length;r<o;r++){const a=i[r],l=V(a);this.setupChangeEvents_(l,a);const h=a.getGeometry();if(h){const c=h.getExtent();e.push(c),s.push(a)}else this.nullGeometryFeatures_[l]=a}if(this.featuresRtree_&&this.featuresRtree_.load(e,s),this.hasListener(ie.ADDFEATURE))for(let r=0,o=i.length;r<o;r++)this.dispatchEvent(new ri(ie.ADDFEATURE,i[r]))}bindFeaturesCollection_(t){let e=!1;this.addEventListener(ie.ADDFEATURE,function(i){e||(e=!0,t.push(i.feature),e=!1)}),this.addEventListener(ie.REMOVEFEATURE,function(i){e||(e=!0,t.remove(i.feature),e=!1)}),t.addEventListener(Pt.ADD,i=>{e||(e=!0,this.addFeature(i.element),e=!1)}),t.addEventListener(Pt.REMOVE,i=>{e||(e=!0,this.removeFeature(i.element),e=!1)}),this.featuresCollection_=t}clear(t){if(t){for(const i in this.featureChangeKeys_)this.featureChangeKeys_[i].forEach(nt);this.featuresCollection_||(this.featureChangeKeys_={},this.idIndex_={},this.uidIndex_={})}else if(this.featuresRtree_){this.featuresRtree_.forEach(i=>{this.removeFeatureInternal(i)});for(const i in this.nullGeometryFeatures_)this.removeFeatureInternal(this.nullGeometryFeatures_[i])}this.featuresCollection_&&this.featuresCollection_.clear(),this.featuresRtree_&&this.featuresRtree_.clear(),this.nullGeometryFeatures_={};const e=new ri(ie.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 de||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 de||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(),Ki(this.nullGeometryFeatures_)||Jr(t,Object.values(this.nullGeometryFeatures_))),t}getFeaturesAtCoordinate(t){const e=[];return this.forEachFeatureAtCoordinateDirect(t,function(i){e.push(i)}),e}getFeaturesInExtent(t,e){if(this.featuresRtree_){if(!(e&&e.canWrapX()&&this.getWrapX()))return this.featuresRtree_.getInExtent(t);const s=Wl(t,e);return[].concat(...s.map(r=>this.featuresRtree_.getInExtent(r)))}return this.featuresCollection_?this.featuresCollection_.getArray().slice(0):[]}getClosestFeatureToCoordinate(t,e){const i=t[0],s=t[1];let r=null;const o=[NaN,NaN];let a=1/0;const l=[-1/0,-1/0,1/0,1/0];return e=e||Dn,this.featuresRtree_.forEachInExtent(l,function(h){if(e(h)){const c=h.getGeometry(),u=a;if(a=c instanceof de?0:c.closestPointXY(i,s,o,a),a<u){r=h;const d=Math.sqrt(a);l[0]=i-d,l[1]=s-d,l[2]=i+d,l[3]=s+d}}}),r}getExtent(t){return this.featuresRtree_.getExtent(t)}getFeatureById(t){const e=this.idIndex_[t.toString()];return e!==void 0?e:null}getFeatureByUid(t){const e=this.uidIndex_[t];return e!==void 0?e:null}getFormat(){return this.format_}getOverlaps(){return this.overlaps_}getUrl(){return this.url_}handleFeatureChange_(t){const e=t.target,i=V(e),s=e.getGeometry();if(!s)i in this.nullGeometryFeatures_||(this.featuresRtree_&&this.featuresRtree_.remove(e),this.nullGeometryFeatures_[i]=e);else{const o=s.getExtent();i in this.nullGeometryFeatures_?(delete this.nullGeometryFeatures_[i],this.featuresRtree_&&this.featuresRtree_.insert(o,e)):this.featuresRtree_&&this.featuresRtree_.update(o,e)}const r=e.getId();if(r!==void 0){const o=r.toString();this.idIndex_[o]!==e&&(this.removeFromIdIndex_(e),this.idIndex_[o]=e)}else this.removeFromIdIndex_(e),this.uidIndex_[i]=e;this.changed(),this.dispatchEvent(new ri(ie.CHANGEFEATURE,e))}hasFeature(t){const e=t.getId();return e!==void 0?e in this.idIndex_:V(t)in this.uidIndex_}isEmpty(){return this.featuresRtree_?this.featuresRtree_.isEmpty()&&Ki(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 ri(ie.FEATURESLOADSTART)),this.loader_.call(this,l,e,i,c=>{--this.loadingExtentsCount_,this.dispatchEvent(new ri(ie.FEATURESLOADEND,void 0,c))},()=>{--this.loadingExtentsCount_,this.dispatchEvent(new ri(ie.FEATURESLOADERROR))}),s.insert(l,{extent:l.slice()}))}this.loading=this.loader_.length<4?!1:this.loadingExtentsCount_>0}refresh(){this.clear(!0),this.loadedExtentsRtree_.clear(),super.refresh()}removeLoadedExtent(t){const e=this.loadedExtentsRtree_,i=e.forEachInExtent(t,function(s){if(Gn(s.extent,t))return s});i&&e.remove(i)}removeFeatures(t){let e=!1;for(let i=0,s=t.length;i<s;++i)e=this.removeFeatureInternal(t[i])||e;e&&this.changed()}removeFeature(t){if(!t)return;this.removeFeatureInternal(t)&&this.changed()}removeFeatureInternal(t){const e=V(t);if(!(e in this.uidIndex_))return!1;e in this.nullGeometryFeatures_?delete this.nullGeometryFeatures_[e]:this.featuresRtree_&&this.featuresRtree_.remove(t),this.featureChangeKeys_[e]?.forEach(nt),delete this.featureChangeKeys_[e];const s=t.getId();if(s!==void 0){const r=s.toString(),o=this.idIndex_[r];o===t?delete this.idIndex_[r]:Array.isArray(o)&&(o.splice(o.indexOf(t),1),o.length===1&&(this.idIndex_[r]=o[0]))}return delete this.uidIndex_[e],this.hasListener(ie.REMOVEFEATURE)&&this.dispatchEvent(new ri(ie.REMOVEFEATURE,t)),!0}removeFromIdIndex_(t){for(const e in this.idIndex_)if(this.idIndex_[e]===t){delete this.idIndex_[e];break}}setLoader(t){this.loader_=t}setUrl(t){q(this.format_,"`format` must be set when `url` is set"),this.url_=t,this.setLoader(Uh(t,this.format_))}setOverlaps(t){this.overlaps_=t,this.changed()}}class an{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 an({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=cr(null,t.src,"anonymous",void 0,t.offset?null:t.color?t.color:null,!(t.offset&&t.size));e.ready().then(()=>{this.patternImage_=null}),e.getImageState()===X.IDLE&&e.load(),e.getImageState()===X.LOADING&&(this.patternImage_=e)}this.color_=t}getKey(){const t=this.getColor();return t?t instanceof CanvasPattern||t instanceof CanvasGradient?V(t):typeof t=="object"&&"src"in t?t.src+":"+t.offset:tn(t).toString():""}loading(){return!!this.patternImage_}ready(){return this.patternImage_?this.patternImage_.ready():Promise.resolve()}}class mr{constructor(t){t=t||{},this.color_=t.color!==void 0?t.color:null,this.lineCap_=t.lineCap,this.lineDash_=t.lineDash!==void 0?t.lineDash:null,this.lineDashOffset_=t.lineDashOffset,this.lineJoin_=t.lineJoin,this.miterLimit_=t.miterLimit,this.width_=t.width}clone(){const t=this.getColor();return new mr({color:Array.isArray(t)?t.slice():t||void 0,lineCap:this.getLineCap(),lineDash:this.getLineDash()?this.getLineDash().slice():void 0,lineDashOffset:this.getLineDashOffset(),lineJoin:this.getLineJoin(),miterLimit:this.getMiterLimit(),width:this.getWidth()})}getColor(){return this.color_}getLineCap(){return this.lineCap_}getLineDash(){return this.lineDash_}getLineDashOffset(){return this.lineDashOffset_}getLineJoin(){return this.lineJoin_}getMiterLimit(){return this.miterLimit_}getWidth(){return this.width_}setColor(t){this.color_=t}setLineCap(t){this.lineCap_=t}setLineDash(t){this.lineDash_=t}setLineDashOffset(t){this.lineDashOffset_=t}setLineJoin(t){this.lineJoin_=t}setMiterLimit(t){this.miterLimit_=t}setWidth(t){this.width_=t}}function ec(n){return n[0]>0&&n[1]>0}function jg(n,t,e){return e===void 0&&(e=[0,0]),e[0]=n[0]*t+.5|0,e[1]=n[1]*t+.5|0,e}function kt(n,t){return Array.isArray(n)?n:(t===void 0?t=[n,n]:(t[0]=n,t[1]=n),t)}class pr{constructor(t){this.opacity_=t.opacity,this.rotateWithView_=t.rotateWithView,this.rotation_=t.rotation,this.scale_=t.scale,this.scaleArray_=kt(t.scale),this.displacement_=t.displacement,this.declutterMode_=t.declutterMode}clone(){const t=this.getScale();return new pr({opacity:this.getOpacity(),scale:Array.isArray(t)?t.slice():t,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()})}getOpacity(){return this.opacity_}getRotateWithView(){return this.rotateWithView_}getRotation(){return this.rotation_}getScale(){return this.scale_}getScaleArray(){return this.scaleArray_}getDisplacement(){return this.displacement_}getDeclutterMode(){return this.declutterMode_}getAnchor(){return U()}getImage(t){return U()}getHitDetectionImage(){return U()}getPixelRatio(t){return 1}getImageState(){return U()}getImageSize(){return U()}getOrigin(){return U()}getSize(){return U()}setDisplacement(t){this.displacement_=t}setOpacity(t){this.opacity_=t}setRotateWithView(t){this.rotateWithView_=t}setRotation(t){this.rotation_=t}setScale(t){this.scale_=t,this.scaleArray_=kt(t)}listenImageChange(t){U()}load(){U()}unlistenImageChange(t){U()}ready(){return Promise.resolve()}}class yr extends pr{constructor(t){super({opacity:1,rotateWithView:t.rotateWithView!==void 0?t.rotateWithView:!1,rotation:t.rotation!==void 0?t.rotation:0,scale:t.scale!==void 0?t.scale:1,displacement:t.displacement!==void 0?t.displacement:[0,0],declutterMode:t.declutterMode}),this.hitDetectionCanvas_=null,this.fill_=t.fill!==void 0?t.fill:null,this.origin_=[0,0],this.points_=t.points,this.radius=t.radius,this.radius2_=t.radius2,this.angle_=t.angle!==void 0?t.angle:0,this.stroke_=t.stroke!==void 0?t.stroke:null,this.size_,this.renderOptions_,this.imageState_=this.fill_&&this.fill_.loading()?X.LOADING:X.LOADED,this.imageState_===X.LOADING&&this.ready().then(()=>this.imageState_=X.LOADED),this.render()}clone(){const t=this.getScale(),e=new yr({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=ee.get(i,null,null)?.getImage(1);if(!s){const r=this.renderOptions_,o=Math.ceil(r.size*t),a=ht(o,o);this.draw_(r,a,t),s=a.canvas,ee.set(i,null,null,new Oh(s,void 0,null,X.LOADED,null))}return s}getPixelRatio(t){return t}getImageSize(){return this.size_}getImageState(){return this.imageState_}getOrigin(){return this.origin_}getPoints(){return this.points_}getRadius(){return this.radius}getRadius2(){return this.radius2_}getSize(){return this.size_}getStroke(){return this.stroke_}setStroke(t){this.stroke_=t,this.render()}listenImageChange(t){}load(){}unlistenImageChange(t){}calculateLineJoinSize_(t,e,i){if(e===0||this.points_===1/0||t!=="bevel"&&t!=="miter")return e;let s=this.radius,r=this.radius2_===void 0?s:this.radius2_;if(s<r){const v=s;s=r,r=v}const o=this.radius2_===void 0?this.points_:this.points_*2,a=2*Math.PI/o,l=r*Math.sin(a),h=Math.sqrt(r*r-l*l),c=s-h,u=Math.sqrt(l*l+c*c),d=u/l;if(t==="miter"&&d<=i)return d*e;const f=e/2/d,g=e/2*(c/u),_=Math.sqrt((s+f)*(s+f)+g*g)-s;if(this.radius2_===void 0||t==="bevel")return _*2;const p=s*Math.sin(a),y=Math.sqrt(s*s-p*p),w=r-y,x=Math.sqrt(p*p+w*w)/p;if(x<=i){const v=x*e/2-r-s;return 2*Math.max(_,v)}return _*2}createRenderOptions(){let t=en,e=nn,i=0,s=null,r=0,o,a=0;this.stroke_&&(o=ye(this.stroke_.getColor()??jn),a=this.stroke_.getWidth()??qn,s=this.stroke_.getLineDash(),r=this.stroke_.getLineDashOffset()??0,e=this.stroke_.getLineJoin()??nn,t=this.stroke_.getLineCap()??en,i=this.stroke_.getMiterLimit()??Vn);const l=this.calculateLineJoinSize_(e,a,i),h=Math.max(this.radius,this.radius2_||0),c=Math.ceil(2*h+l);return{strokeStyle:o,strokeWidth:a,size:c,lineCap:t,lineDash:s,lineDashOffset:r,lineJoin:e,miterLimit:i}}render(){this.renderOptions_=this.createRenderOptions();const t=this.renderOptions_.size;this.hitDetectionCanvas_=null,this.size_=[t,t]}draw_(t,e,i){if(e.scale(i,i),e.translate(t.size/2,t.size/2),this.createPath_(e),this.fill_){let s=this.fill_.getColor();s===null&&(s=Ft),e.fillStyle=ye(s),e.fill()}t.strokeStyle&&(e.strokeStyle=t.strokeStyle,e.lineWidth=t.strokeWidth,t.lineDash&&(e.setLineDash(t.lineDash),e.lineDashOffset=t.lineDashOffset),e.lineCap=t.lineCap,e.lineJoin=t.lineJoin,e.miterLimit=t.miterLimit,e.stroke())}createHitDetectionCanvas_(t){let e;if(this.fill_){let i=this.fill_.getColor(),s=0;typeof i=="string"&&(i=tn(i)),i===null?s=1:Array.isArray(i)&&(s=i.length===4?i[3]:1),s===0&&(e=ht(t.size,t.size),this.drawHitDetectionCanvas_(t,e))}return e?e.canvas:this.getImage(1)}createPath_(t){let e=this.points_;const i=this.radius;if(e===1/0)t.arc(0,0,i,0,2*Math.PI);else{const s=this.radius2_===void 0?i:this.radius2_;this.radius2_!==void 0&&(e*=2);const r=this.angle_-Math.PI/2,o=2*Math.PI/e;for(let a=0;a<e;a++){const l=r+a*o,h=a%2===0?i:s;t.lineTo(h*Math.cos(l),h*Math.sin(l))}t.closePath()}}drawHitDetectionCanvas_(t,e){e.translate(t.size/2,t.size/2),this.createPath_(e),e.fillStyle=Ft,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 Er extends yr{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 Er({fill:this.getFill()?this.getFill().clone():void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,radius:this.getRadius(),scale:Array.isArray(t)?t.slice():t,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()});return e.setOpacity(this.getOpacity()),e}setRadius(t){this.radius=t,this.render()}}class ke{constructor(t){t=t||{},this.geometry_=null,this.geometryFunction_=nc,t.geometry!==void 0&&this.setGeometry(t.geometry),this.fill_=t.fill!==void 0?t.fill:null,this.image_=t.image!==void 0?t.image:null,this.renderer_=t.renderer!==void 0?t.renderer:null,this.hitDetectionRenderer_=t.hitDetectionRenderer!==void 0?t.hitDetectionRenderer:null,this.stroke_=t.stroke!==void 0?t.stroke:null,this.text_=t.text!==void 0?t.text:null,this.zIndex_=t.zIndex}clone(){let t=this.getGeometry();return t&&typeof t=="object"&&(t=t.clone()),new ke({geometry:t??void 0,fill:this.getFill()?this.getFill().clone():void 0,image:this.getImage()?this.getImage().clone():void 0,renderer:this.getRenderer()??void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,text:this.getText()?this.getText().clone():void 0,zIndex:this.getZIndex()})}getRenderer(){return this.renderer_}setRenderer(t){this.renderer_=t}setHitDetectionRenderer(t){this.hitDetectionRenderer_=t}getHitDetectionRenderer(){return this.hitDetectionRenderer_}getGeometry(){return this.geometry_}getGeometryFunction(){return this.geometryFunction_}getFill(){return this.fill_}setFill(t){this.fill_=t}getImage(){return this.image_}setImage(t){this.image_=t}getStroke(){return this.stroke_}setStroke(t){this.stroke_=t}getText(){return this.text_}setText(t){this.text_=t}getZIndex(){return this.zIndex_}setGeometry(t){typeof t=="function"?this.geometryFunction_=t:typeof t=="string"?this.geometryFunction_=function(e){return e.get(t)}:t?t!==void 0&&(this.geometryFunction_=function(){return t}):this.geometryFunction_=nc,this.geometry_=t}setZIndex(t){this.zIndex_=t}}function Hg(n){let t;if(typeof n=="function")t=n;else{let e;Array.isArray(n)?e=n:(q(typeof n.getZIndex=="function","Expected an `Style` or an array of `Style`"),e=[n]),t=function(){return e}}return t}let Ko=null;function ic(n,t){if(!Ko){const e=new an({color:"rgba(255,255,255,0.4)"}),i=new mr({color:"#3399CC",width:1.25});Ko=[new ke({image:new Er({fill:e,stroke:i,radius:5}),fill:e,stroke:i})]}return Ko}function nc(n){return n.getGeometry()}const qg="#333";let Jg=class uu{constructor(t){t=t||{},this.font_=t.font,this.rotation_=t.rotation,this.rotateWithView_=t.rotateWithView,this.keepUpright_=t.keepUpright,this.scale_=t.scale,this.scaleArray_=kt(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 an({color:qg}),this.maxAngle_=t.maxAngle!==void 0?t.maxAngle:Math.PI/4,this.placement_=t.placement!==void 0?t.placement:"point",this.overflow_=!!t.overflow,this.stroke_=t.stroke!==void 0?t.stroke:null,this.offsetX_=t.offsetX!==void 0?t.offsetX:0,this.offsetY_=t.offsetY!==void 0?t.offsetY:0,this.backgroundFill_=t.backgroundFill?t.backgroundFill:null,this.backgroundStroke_=t.backgroundStroke?t.backgroundStroke:null,this.padding_=t.padding===void 0?null:t.padding,this.declutterMode_=t.declutterMode}clone(){const t=this.getScale();return new uu({font:this.getFont(),placement:this.getPlacement(),repeat:this.getRepeat(),maxAngle:this.getMaxAngle(),overflow:this.getOverflow(),rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),keepUpright:this.getKeepUpright(),scale:Array.isArray(t)?t.slice():t,text:this.getText(),textAlign:this.getTextAlign(),justify:this.getJustify(),textBaseline:this.getTextBaseline(),fill:this.getFill()instanceof an?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_=kt(t!==void 0?t:1)}setStroke(t){this.stroke_=t}setText(t){this.text_=t}setTextAlign(t){this.textAlign_=t}setJustify(t){this.justify_=t}setTextBaseline(t){this.textBaseline_=t}setBackgroundFill(t){this.backgroundFill_=t}setBackgroundStroke(t){this.backgroundStroke_=t}setPadding(t){this.padding_=t}};const pt={ANIMATING:0,INTERACTING:1},O={BEGIN_GEOMETRY:0,BEGIN_PATH:1,CIRCLE:2,CLOSE_PATH:3,CUSTOM:4,DRAW_CHARS:5,DRAW_IMAGE:6,END_GEOMETRY:7,FILL:8,MOVE_TO_LINE_TO:9,SET_FILL_STYLE:10,SET_STROKE_STYLE:11,STROKE:12},xr=[O.FILL],oi=[O.STROKE],Ai=[O.BEGIN_PATH],sc=[O.CLOSE_PATH];class is extends Dh{constructor(t,e,i,s){super(),this.tolerance=t,this.maxExtent=e,this.pixelRatio=s,this.maxLineWidth=0,this.resolution=i,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_=null,this.bufferedMaxExtent_=null,this.instructions=[],this.coordinates=[],this.tmpCoordinate_=[],this.hitDetectionInstructions=[],this.state={}}applyPixelRatio(t){const e=this.pixelRatio;return e==1?t:t.map(function(i){return i*e})}appendFlatPointCoordinates(t,e){const i=this.getBufferedMaxExtent(),s=this.tmpCoordinate_,r=this.coordinates;let o=r.length;for(let a=0,l=t.length;a<l;a+=e)s[0]=t[a],s[1]=t[a+1],Bi(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],_=eo(h,d),_!==m?(f&&(a[l++]=c,a[l++]=u,f=!1),a[l++]=d[0],a[l++]=d[1]):_===ut.INTERSECTING?(a[l++]=d[0],a[l++]=d[1],f=!1):f=!0,c=d[0],u=d[1],m=_;return(r&&f||g===e+s)&&(a[l++]=c,a[l++]=u),l}drawCustomCoordinates_(t,e,i,s,r){for(let o=0,a=i.length;o<a;++o){const l=i[o],h=this.appendFlatLineCoordinates(t,e,l,s,!1,!1);r.push(h),e=l}return e}drawCustom(t,e,i,s,r){this.beginGeometry(t,e,r);const o=t.getType(),a=t.getStride(),l=this.coordinates.length;let h,c,u,d,f;switch(o){case"MultiPolygon":h=t.getOrientedFlatCoordinates(),d=[];const g=t.getEndss();f=0;for(let m=0,_=g.length;m<_;++m){const p=[];f=this.drawCustomCoordinates_(h,f,g[m],a,p),d.push(p)}this.instructions.push([O.CUSTOM,l,d,t,i,ph,r]),this.hitDetectionInstructions.push([O.CUSTOM,l,d,t,s||i,ph,r]);break;case"Polygon":case"MultiLineString":u=[],h=o=="Polygon"?t.getOrientedFlatCoordinates():t.getFlatCoordinates(),f=this.drawCustomCoordinates_(h,0,t.getEnds(),a,u),this.instructions.push([O.CUSTOM,l,u,t,i,rr,r]),this.hitDetectionInstructions.push([O.CUSTOM,l,u,t,s||i,rr,r]);break;case"LineString":case"Circle":h=t.getFlatCoordinates(),c=this.appendFlatLineCoordinates(h,0,h.length,a,!1,!1),this.instructions.push([O.CUSTOM,l,c,t,i,Qi,r]),this.hitDetectionInstructions.push([O.CUSTOM,l,c,t,s||i,Qi,r]);break;case"MultiPoint":h=t.getFlatCoordinates(),c=this.appendFlatPointCoordinates(h,a),c>l&&(this.instructions.push([O.CUSTOM,l,c,t,i,Qi,r]),this.hitDetectionInstructions.push([O.CUSTOM,l,c,t,s||i,Qi,r]));break;case"Point":h=t.getFlatCoordinates(),this.coordinates.push(h[0],h[1]),c=this.coordinates.length,this.instructions.push([O.CUSTOM,l,c,t,i,void 0,r]),this.hitDetectionInstructions.push([O.CUSTOM,l,c,t,s||i,void 0,r]);break}this.endGeometry(e)}beginGeometry(t,e,i){this.beginGeometryInstruction1_=[O.BEGIN_GEOMETRY,e,0,t,i],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[O.BEGIN_GEOMETRY,e,0,t,i],this.hitDetectionInstructions.push(this.beginGeometryInstruction2_)}finish(){return{instructions:this.instructions,hitDetectionInstructions:this.hitDetectionInstructions,coordinates:this.coordinates}}reverseHitDetectionInstructions(){const t=this.hitDetectionInstructions;t.reverse();let e;const i=t.length;let s,r,o=-1;for(e=0;e<i;++e)s=t[e],r=s[0],r==O.END_GEOMETRY?o=e:r==O.BEGIN_GEOMETRY&&(s[2]=e,Fd(this.hitDetectionInstructions,o,e),o=-1)}fillStyleToState(t,e={}){if(t){const i=t.getColor();e.fillPatternScale=i&&typeof i=="object"&&"src"in i?this.pixelRatio:1,e.fillStyle=ye(i||Ft)}else e.fillStyle=void 0;return e}strokeStyleToState(t,e={}){if(t){const i=t.getColor();e.strokeStyle=ye(i||jn);const s=t.getLineCap();e.lineCap=s!==void 0?s:en;const r=t.getLineDash();e.lineDash=r?r.slice():De;const o=t.getLineDashOffset();e.lineDashOffset=o||Fe;const a=t.getLineJoin();e.lineJoin=a!==void 0?a:nn;const l=t.getWidth();e.lineWidth=l!==void 0?l:qn;const h=t.getMiterLimit();e.miterLimit=h!==void 0?h:Vn,e.lineWidth>this.maxLineWidth&&(this.maxLineWidth=e.lineWidth,this.bufferedMaxExtent_=null)}else e.strokeStyle=void 0,e.lineCap=void 0,e.lineDash=null,e.lineDashOffset=void 0,e.lineJoin=void 0,e.lineWidth=void 0,e.miterLimit=void 0;return e}setFillStrokeStyle(t,e){const i=this.state;this.fillStyleToState(t,i),this.strokeStyleToState(e,i)}createFill(t){const e=t.fillStyle,i=[O.SET_FILL_STYLE,e];return typeof e!="string"&&i.push(t.fillPatternScale),i}applyStroke(t){this.instructions.push(this.createStroke(t))}createStroke(t){return[O.SET_STROKE_STYLE,t.strokeStyle,t.lineWidth*this.pixelRatio,t.lineCap,t.lineJoin,t.miterLimit,t.lineDash?this.applyPixelRatio(t.lineDash):null,t.lineDashOffset*this.pixelRatio]}updateFillStyle(t,e){const i=t.fillStyle;(typeof i!="string"||t.currentFillStyle!=i)&&(this.instructions.push(e.call(this,t)),t.currentFillStyle=i)}updateStrokeStyle(t,e){const i=t.strokeStyle,s=t.lineCap,r=t.lineDash,o=t.lineDashOffset,a=t.lineJoin,l=t.lineWidth,h=t.miterLimit;(t.currentStrokeStyle!=i||t.currentLineCap!=s||r!=t.currentLineDash&&!Qe(t.currentLineDash,r)||t.currentLineDashOffset!=o||t.currentLineJoin!=a||t.currentLineWidth!=l||t.currentMiterLimit!=h)&&(e.call(this,t),t.currentStrokeStyle=i,t.currentLineCap=s,t.currentLineDash=r,t.currentLineDashOffset=o,t.currentLineJoin=a,t.currentLineWidth=l,t.currentMiterLimit=h)}endGeometry(t){this.beginGeometryInstruction1_[2]=this.instructions.length,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_[2]=this.hitDetectionInstructions.length,this.beginGeometryInstruction2_=null;const e=[O.END_GEOMETRY,t];this.instructions.push(e),this.hitDetectionInstructions.push(e)}getBufferedMaxExtent(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=Pl(this.maxExtent),this.maxLineWidth>0)){const t=this.resolution*(this.maxLineWidth+1)/2;to(this.bufferedMaxExtent_,t,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_}}class Qg extends is{constructor(t,e,i,s){super(t,e,i,s),this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.anchorX_=void 0,this.anchorY_=void 0,this.height_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.scale_=void 0,this.width_=void 0,this.declutterMode_=void 0,this.declutterImageWithText_=void 0}drawPoint(t,e,i){if(!this.image_||this.maxExtent&&!Bi(this.maxExtent,t.getFlatCoordinates()))return;this.beginGeometry(t,e,i);const s=t.getFlatCoordinates(),r=t.getStride(),o=this.coordinates.length,a=this.appendFlatPointCoordinates(s,r);this.instructions.push([O.DRAW_IMAGE,o,a,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_*this.imagePixelRatio_,this.originY_*this.imagePixelRatio_,this.rotateWithView_,this.rotation_,[this.scale_[0]*this.pixelRatio/this.imagePixelRatio_,this.scale_[1]*this.pixelRatio/this.imagePixelRatio_],Math.ceil(this.width_*this.imagePixelRatio_),this.declutterMode_,this.declutterImageWithText_]),this.hitDetectionInstructions.push([O.DRAW_IMAGE,o,a,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,1,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(e)}drawMultiPoint(t,e,i){if(!this.image_)return;this.beginGeometry(t,e,i);const s=t.getFlatCoordinates(),r=[];for(let l=0,h=s.length;l<h;l+=t.getStride())(!this.maxExtent||Bi(this.maxExtent,s.slice(l,l+2)))&&r.push(s[l],s[l+1]);const o=this.coordinates.length,a=this.appendFlatPointCoordinates(r,2);this.instructions.push([O.DRAW_IMAGE,o,a,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_*this.imagePixelRatio_,this.originY_*this.imagePixelRatio_,this.rotateWithView_,this.rotation_,[this.scale_[0]*this.pixelRatio/this.imagePixelRatio_,this.scale_[1]*this.pixelRatio/this.imagePixelRatio_],Math.ceil(this.width_*this.imagePixelRatio_),this.declutterMode_,this.declutterImageWithText_]),this.hitDetectionInstructions.push([O.DRAW_IMAGE,o,a,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,1,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(e)}finish(){return this.reverseHitDetectionInstructions(),this.anchorX_=void 0,this.anchorY_=void 0,this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.height_=void 0,this.scale_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.width_=void 0,super.finish()}setImageStyle(t,e){const i=t.getAnchor(),s=t.getSize(),r=t.getOrigin();this.imagePixelRatio_=t.getPixelRatio(this.pixelRatio),this.anchorX_=i[0],this.anchorY_=i[1],this.hitDetectionImage_=t.getHitDetectionImage(),this.image_=t.getImage(this.pixelRatio),this.height_=s[1],this.opacity_=t.getOpacity(),this.originX_=r[0],this.originY_=r[1],this.rotateWithView_=t.getRotateWithView(),this.rotation_=t.getRotation(),this.scale_=t.getScaleArray(),this.width_=s[0],this.declutterMode_=t.getDeclutterMode(),this.declutterImageWithText_=e}}class t_ extends is{constructor(t,e,i,s){super(t,e,i,s)}drawFlatCoordinates_(t,e,i,s){const r=this.coordinates.length,o=this.appendFlatLineCoordinates(t,e,i,s,!1,!1),a=[O.MOVE_TO_LINE_TO,r,o];return this.instructions.push(a),this.hitDetectionInstructions.push(a),i}drawLineString(t,e,i){const s=this.state,r=s.strokeStyle,o=s.lineWidth;if(r===void 0||o===void 0)return;this.updateStrokeStyle(s,this.applyStroke),this.beginGeometry(t,e,i),this.hitDetectionInstructions.push([O.SET_STROKE_STYLE,s.strokeStyle,s.lineWidth,s.lineCap,s.lineJoin,s.miterLimit,De,Fe],Ai);const a=t.getFlatCoordinates(),l=t.getStride();this.drawFlatCoordinates_(a,0,a.length,l),this.hitDetectionInstructions.push(oi),this.endGeometry(e)}drawMultiLineString(t,e,i){const s=this.state,r=s.strokeStyle,o=s.lineWidth;if(r===void 0||o===void 0)return;this.updateStrokeStyle(s,this.applyStroke),this.beginGeometry(t,e,i),this.hitDetectionInstructions.push([O.SET_STROKE_STYLE,s.strokeStyle,s.lineWidth,s.lineCap,s.lineJoin,s.miterLimit,De,Fe],Ai);const a=t.getEnds(),l=t.getFlatCoordinates(),h=t.getStride();let c=0;for(let u=0,d=a.length;u<d;++u)c=this.drawFlatCoordinates_(l,c,a[u],h);this.hitDetectionInstructions.push(oi),this.endGeometry(e)}finish(){const t=this.state;return t.lastStroke!=null&&t.lastStroke!=this.coordinates.length&&this.instructions.push(oi),this.reverseHitDetectionInstructions(),this.state=null,super.finish()}applyStroke(t){t.lastStroke!=null&&t.lastStroke!=this.coordinates.length&&(this.instructions.push(oi),t.lastStroke=this.coordinates.length),t.lastStroke=0,super.applyStroke(t),this.instructions.push(Ai)}}class rc extends is{constructor(t,e,i,s){super(t,e,i,s)}drawFlatCoordinatess_(t,e,i,s){const r=this.state,o=r.fillStyle!==void 0,a=r.strokeStyle!==void 0,l=i.length;this.instructions.push(Ai),this.hitDetectionInstructions.push(Ai);for(let h=0;h<l;++h){const c=i[h],u=this.coordinates.length,d=this.appendFlatLineCoordinates(t,e,c,s,!0,!a),f=[O.MOVE_TO_LINE_TO,u,d];this.instructions.push(f),this.hitDetectionInstructions.push(f),a&&(this.instructions.push(sc),this.hitDetectionInstructions.push(sc)),e=c}return o&&(this.instructions.push(xr),this.hitDetectionInstructions.push(xr)),a&&(this.instructions.push(oi),this.hitDetectionInstructions.push(oi)),e}drawCircle(t,e,i){const s=this.state,r=s.fillStyle,o=s.strokeStyle;if(r===void 0&&o===void 0)return;this.setFillStrokeStyles_(),this.beginGeometry(t,e,i),s.fillStyle!==void 0&&this.hitDetectionInstructions.push([O.SET_FILL_STYLE,Ft]),s.strokeStyle!==void 0&&this.hitDetectionInstructions.push([O.SET_STROKE_STYLE,s.strokeStyle,s.lineWidth,s.lineCap,s.lineJoin,s.miterLimit,De,Fe]);const a=t.getFlatCoordinates(),l=t.getStride(),h=this.coordinates.length;this.appendFlatLineCoordinates(a,0,a.length,l,!1,!1);const c=[O.CIRCLE,h];this.instructions.push(Ai,c),this.hitDetectionInstructions.push(Ai,c),s.fillStyle!==void 0&&(this.instructions.push(xr),this.hitDetectionInstructions.push(xr)),s.strokeStyle!==void 0&&(this.instructions.push(oi),this.hitDetectionInstructions.push(oi)),this.endGeometry(e)}drawPolygon(t,e,i){const s=this.state,r=s.fillStyle,o=s.strokeStyle;if(r===void 0&&o===void 0)return;this.setFillStrokeStyles_(),this.beginGeometry(t,e,i),s.fillStyle!==void 0&&this.hitDetectionInstructions.push([O.SET_FILL_STYLE,Ft]),s.strokeStyle!==void 0&&this.hitDetectionInstructions.push([O.SET_STROKE_STYLE,s.strokeStyle,s.lineWidth,s.lineCap,s.lineJoin,s.miterLimit,De,Fe]);const a=t.getEnds(),l=t.getOrientedFlatCoordinates(),h=t.getStride();this.drawFlatCoordinatess_(l,0,a,h),this.endGeometry(e)}drawMultiPolygon(t,e,i){const s=this.state,r=s.fillStyle,o=s.strokeStyle;if(r===void 0&&o===void 0)return;this.setFillStrokeStyles_(),this.beginGeometry(t,e,i),s.fillStyle!==void 0&&this.hitDetectionInstructions.push([O.SET_FILL_STYLE,Ft]),s.strokeStyle!==void 0&&this.hitDetectionInstructions.push([O.SET_STROKE_STYLE,s.strokeStyle,s.lineWidth,s.lineCap,s.lineJoin,s.miterLimit,De,Fe]);const a=t.getEndss(),l=t.getOrientedFlatCoordinates(),h=t.getStride();let c=0;for(let u=0,d=a.length;u<d;++u)c=this.drawFlatCoordinatess_(l,c,a[u],h);this.endGeometry(e)}finish(){this.reverseHitDetectionInstructions(),this.state=null;const t=this.tolerance;if(t!==0){const e=this.coordinates;for(let i=0,s=e.length;i<s;++i)e[i]=Ii(e[i],t)}return super.finish()}setFillStrokeStyles_(){const t=this.state;this.updateFillStyle(t,this.createFill),this.updateStrokeStyle(t,this.applyStroke)}}function e_(n,t,e,i,s){const r=[];let o=e,a=0,l=t.slice(e,2);for(;a<n&&o+s<i;){const[h,c]=l.slice(-2),u=t[o+s],d=t[o+s+1],f=Math.sqrt((u-h)*(u-h)+(d-c)*(d-c));if(a+=f,a>=n){const g=(n-a+f)/f,m=Jt(h,u,g),_=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,m=Jt(h,u,g/f),_=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 i_(n,t,e,i,s){let r=e,o=e,a=0,l=0,h=e,c,u,d,f,g,m,_,p,y,w;for(u=e;u<i;u+=s){const E=t[u],x=t[u+1];g!==void 0&&(y=E-g,w=x-m,f=Math.sqrt(y*y+w*w),_!==void 0&&(l+=d,c=Math.acos((_*y+p*w)/(d*f)),c>n&&(l>a&&(a=l,r=h,o=u),l=0,h=u-s)),d=f,_=y,p=w),g=E,m=x}return l+=f,l>a?[h,u]:[r,o]}const vr={left:0,center:.5,right:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1};class n_ extends is{constructor(t,e,i,s){super(t,e,i,s),this.labels_=null,this.text_="",this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=void 0,this.textKeepUpright_=void 0,this.textRotation_=0,this.textFillState_=null,this.fillStates={},this.fillStates[Ft]={fillStyle:Ft},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(!Ot(this.maxExtent,t.getExtent()))return;let d;if(c=t.getFlatCoordinates(),h=="LineString")d=[c.length];else if(h=="MultiLineString")d=t.getEnds();else if(h=="Polygon")d=t.getEnds().slice(0,1);else if(h=="MultiPolygon"){const _=t.getEndss();d=[];for(let p=0,y=_.length;p<y;++p)d.push(_[p][0])}this.beginGeometry(t,e,i);const f=o.repeat,g=f?void 0:o.textAlign;let m=0;for(let _=0,p=d.length;_<p;++_){let y;f?y=e_(f*this.resolution,c,m,d[_],u):y=[c.slice(m,d[_])];for(let w=0,E=y.length;w<E;++w){const x=y[w];let v=0,T=x.length;if(g==null){const I=i_(o.maxAngle,x,0,x.length,2);v=I[0],T=I[1]}for(let I=v;I<T;I+=u)a.push(x[I],x[I+1]);const R=a.length;m=d[_],this.drawChars_(l,R),l=R}}this.endGeometry(e)}else{let d=o.overflow?null:[];switch(h){case"Point":case"MultiPoint":c=t.getFlatCoordinates();break;case"LineString":c=t.getFlatMidpoint();break;case"Circle":c=t.getCenter();break;case"MultiLineString":c=t.getFlatMidpoints(),u=2;break;case"Polygon":c=t.getFlatInteriorPoint(),o.overflow||d.push(c[2]/this.resolution),u=3;break;case"MultiPolygon":const E=t.getFlatInteriorPoints();c=[];for(let x=0,v=E.length;x<v;x+=3)o.overflow||d.push(E[x+2]/this.resolution),c.push(E[x],E[x+1]);if(c.length===0)return;u=2;break}const f=this.appendFlatPointCoordinates(c,u);if(f===l)return;if(d&&(f-l)/2!==c.length/u){let E=l/2;d=d.filter((x,v)=>{const T=a[(E+v)*2]===c[v*u]&&a[(E+v)*2+1]===c[v*u+1];return T||--E,T})}this.saveTextStates_();const g=o.backgroundFill?this.createFill(this.fillStyleToState(o.backgroundFill)):null,m=o.backgroundStroke?this.createStroke(this.strokeStyleToState(o.backgroundStroke)):null;this.beginGeometry(t,e,i);let _=o.padding;if(_!=Li&&(o.scale[0]<0||o.scale[1]<0)){let E=o.padding[0],x=o.padding[1],v=o.padding[2],T=o.padding[3];o.scale[0]<0&&(x=-x,T=-T),o.scale[1]<0&&(E=-E,v=-v),_=[E,x,v,T]}const p=this.pixelRatio;this.instructions.push([O.DRAW_IMAGE,l,f,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[1,1],NaN,this.declutterMode_,this.declutterImageWithText_,_==Li?Li:_.map(function(E){return E*p}),g,m,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,d]);const y=1/p,w=g?g.slice(0):null;w&&(w[1]=Ft),this.hitDetectionInstructions.push([O.DRAW_IMAGE,l,f,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[y,y],NaN,this.declutterMode_,this.declutterImageWithText_,_,w,m,this.text_,this.textKey_,this.strokeKey_,this.fillKey_?Ft:this.fillKey_,this.textOffsetX_,this.textOffsetY_,d]),this.endGeometry(e)}}saveTextStates_(){const t=this.textStrokeState_,e=this.textState_,i=this.textFillState_,s=this.strokeKey_;t&&(s in this.strokeStates||(this.strokeStates[s]={strokeStyle:t.strokeStyle,lineCap:t.lineCap,lineDashOffset:t.lineDashOffset,lineWidth:t.lineWidth,lineJoin:t.lineJoin,miterLimit:t.miterLimit,lineDash:t.lineDash}));const r=this.textKey_;r in this.textStates||(this.textStates[r]={font:e.font,textAlign:e.textAlign||Hn,justify:e.justify,textBaseline:e.textBaseline||fr,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=vr[s.textBaseline],c=this.textOffsetY_*l,u=this.text_,d=i?i.lineWidth*Math.abs(s.scale[0])/2:0;this.instructions.push([O.DRAW_CHARS,t,e,h,s.overflow,a,s.maxAngle,l,c,r,d*l,u,o,1,this.declutterMode_,this.textKeepUpright_]),this.hitDetectionInstructions.push([O.DRAW_CHARS,t,e,h,s.overflow,a&&Ft,s.maxAngle,l,c,r,d*l,u,o,1/l,this.declutterMode_,this.textKeepUpright_])}setTextStyle(t,e){let i,s,r;if(!t)this.text_="";else{const o=t.getFill();o?(s=this.textFillState_,s||(s={},this.textFillState_=s),s.fillStyle=ye(o.getColor()||Ft)):(s=null,this.textFillState_=s);const a=t.getStroke();if(!a)r=null,this.textStrokeState_=r;else{r=this.textStrokeState_,r||(r={},this.textStrokeState_=r);const m=a.getLineDash(),_=a.getLineDashOffset(),p=a.getWidth(),y=a.getMiterLimit();r.lineCap=a.getLineCap()||en,r.lineDash=m?m.slice():De,r.lineDashOffset=_===void 0?Fe:_,r.lineJoin=a.getLineJoin()||nn,r.lineWidth=p===void 0?qn:p,r.miterLimit=y===void 0?Vn:y,r.strokeStyle=ye(a.getColor()||jn)}i=this.textState_;const l=t.getFont()||Nh;vg(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()||fr,i.backgroundFill=t.getBackgroundFill(),i.backgroundStroke=t.getBackgroundStroke(),i.padding=t.getPadding()||Li,i.scale=h===void 0?[1,1]:h;const c=t.getOffsetX(),u=t.getOffsetY(),d=t.getRotateWithView(),f=t.getKeepUpright(),g=t.getRotation();this.text_=t.getText()||"",this.textOffsetX_=c===void 0?0:c,this.textOffsetY_=u===void 0?0:u,this.textRotateWithView_=d===void 0?!1:d,this.textKeepUpright_=f===void 0?!0:f,this.textRotation_=g===void 0?0:g,this.strokeKey_=r?(typeof r.strokeStyle=="string"?r.strokeStyle:V(r.strokeStyle))+r.lineCap+r.lineDashOffset+"|"+r.lineWidth+r.lineJoin+r.miterLimit+"["+r.lineDash.join()+"]":"",this.textKey_=i.font+i.scale+(i.textAlign||"?")+(i.repeat||"?")+(i.justify||"?")+(i.textBaseline||"?"),this.fillKey_=s&&s.fillStyle?typeof s.fillStyle=="string"?s.fillStyle:"|"+V(s.fillStyle):""}this.declutterMode_=t.getDeclutterMode(),this.declutterImageWithText_=e}}const s_={Circle:rc,Default:is,Image:Qg,LineString:t_,Polygon:rc,Text:n_};class r_{constructor(t,e,i,s){this.tolerance_=t,this.maxExtent_=e,this.pixelRatio_=s,this.resolution_=i,this.buildersByZIndex_={}}finish(){const t={};for(const e in this.buildersByZIndex_){t[e]=t[e]||{};const i=this.buildersByZIndex_[e];for(const s in i){const r=i[s].finish();t[e][s]=r}}return t}getBuilder(t,e){const i=t!==void 0?t.toString():"0";let s=this.buildersByZIndex_[i];s===void 0&&(s={},this.buildersByZIndex_[i]=s);let r=s[e];if(r===void 0){const o=s_[e];r=new o(this.tolerance_,this.maxExtent_,this.resolution_,this.pixelRatio_),s[e]=r}return r}}function o_(n,t,e,i,s,r,o,a,l,h,c,u,d=!0){let f=n[t],g=n[t+1],m=0,_=0,p=0,y=0;function w(){m=f,_=g,t+=i,f=n[t],g=n[t+1],y+=p,p=Math.sqrt((f-m)*(f-m)+(g-_)*(g-_))}do w();while(t<e-i&&y+p<r);let E=p===0?0:(r-y)/p;const x=Jt(m,f,E),v=Jt(_,g,E),T=t-i,R=y,I=r+a*l(h,s,c);for(;t<e-i&&y+p<I;)w();E=p===0?0:(I-y)/p;const L=Jt(m,f,E),P=Jt(_,g,E);let A=!1;if(d)if(u){const G=[x,v,L,P];hh(G,0,4,2,u,G,G),A=G[0]>G[2]}else A=x>L;const b=Math.PI,M=[],Y=T+i===t;t=T,p=0,y=R,f=n[t],g=n[t+1];let k;if(Y){w(),k=Math.atan2(g-_,f-m),A&&(k+=k>0?-b:b);const G=(L+x)/2,F=(P+v)/2;return M[0]=[G,F,(I-r)/2,k,s],M}s=s.replace(/\n/g," ");for(let G=0,F=s.length;G<F;){w();let $=Math.atan2(g-_,f-m);if(A&&($+=$>0?-b:b),k!==void 0){let lt=$-k;if(lt+=lt>b?-2*b:lt<-b?2*b:0,Math.abs(lt)>o)return null}k=$;const B=G;let et=0;for(;G<F;++G){const lt=A?F-G-1:G,$t=a*l(h,s[lt],c);if(t+i<e&&y+p<r+et+$t/2)break;et+=$t}if(G===B)continue;const S=A?s.substring(F-B,F-G):s.substring(B,G);E=p===0?0:(r+et/2-y)/p;const xt=Jt(m,f,E),Lt=Jt(_,g,E);M.push([xt,Lt,et/2,$,S]),r+=et}return M}class oc{constructor(){this.instructions_=[],this.zIndex=0,this.offset_=0,this.context_=new Proxy(ar(),{get:(t,e)=>{if(typeof ar()[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 ln=Wt(),ai=[],Ne=[],Ge=[],li=[];function ac(n){return n[3].declutterBox}const lc=new RegExp("[֑-ࣿיִ-﷿ﹰ-ﻼࠀ--]");function Bo(n,t){return t==="start"?t=lc.test(n)?"right":"left":t==="end"&&(t=lc.test(n)?"left":"right"),vr[t]}function a_(n,t,e){return e>0&&n.push(`
|
|
5
|
-
`,""),n.push(t,""),n}function l_(n,t,e){return e%2===0&&(n+=t),n}class h_{constructor(t,e,i,s,r){this.overlaps=i,this.pixelRatio=e,this.resolution=t,this.alignAndScaleFill_,this.instructions=s.instructions,this.coordinates=s.coordinates,this.coordinateCache_={},this.renderedTransform_=
|
|
6
|
-
`).reduce(a_,[]),{width:g,height:m,widths:_,heights:p,lineWidths:y}=
|
|
7
|
-
`){b+=A,A=0,I=u*w+R*d,++Y;continue}const B=f[G+1]||l.font;B!==k&&(s&&L.push("font",B),i&&P.push("font",B),k=B),A=Math.max(A,p[M]);const et=[$,I+R*_[M]+u*(_[M]-y[Y]),.5*(d+A)+b];I+=_[M],s&&L.push("strokeText",et),i&&P.push("fillText",et),++M}return Array.prototype.push.apply(E,L),Array.prototype.push.apply(E,P),this.labels_[r]=T,T}replayTextBackground_(t,e,i,s,r,o,a){t.beginPath(),t.moveTo.apply(t,e),t.lineTo.apply(t,i),t.lineTo.apply(t,s),t.lineTo.apply(t,r),t.lineTo.apply(t,e),o&&(this.alignAndScaleFill_=o[2],t.fillStyle=o[1],this.fill_(t)),a&&(this.setStrokeStyle_(t,a),t.stroke())}calculateImageOrLabelDimensions_(t,e,i,s,r,o,a,l,h,c,u,d,f,g,m,_){a*=d[0],l*=d[1];let p=i-a,y=s-l;const w=r+h>t?t-h:r,E=o+c>e?e-c:o,x=g[3]+w*d[0]+g[1],v=g[0]+E*d[1]+g[2],T=p-g[3],R=y-g[0];(m||u!==0)&&(ai[0]=T,li[0]=T,ai[1]=R,Ne[1]=R,Ne[0]=T+x,Ge[0]=Ne[0],Ge[1]=R+v,li[1]=Ge[1]);let I;return u!==0?(I=Oe(ue(),i,s,1,1,u,-i,-s),dt(I,ai),dt(I,Ne),dt(I,Ge),dt(I,li),ti(Math.min(ai[0],Ne[0],Ge[0],li[0]),Math.min(ai[1],Ne[1],Ge[1],li[1]),Math.max(ai[0],Ne[0],Ge[0],li[0]),Math.max(ai[1],Ne[1],Ge[1],li[1]),ln)):ti(Math.min(T,T+x),Math.min(R,R+v),Math.max(T,T+x),Math.max(R,R+v),ln),f&&(p=Math.round(p),y=Math.round(y)),{drawImageX:p,drawImageY:y,drawImageW:w,drawImageH:E,originX:h,originY:c,declutterBox:{minX:ln[0],minY:ln[1],maxX:ln[2],maxY:ln[3],value:_},canvasTransform:I,scale:d}}replayImageOrLabel_(t,e,i,s,r,o,a){const l=!!(o||a),h=s.declutterBox,c=a?a[2]*s.scale[0]/2:0;return h.minX-c<=e[0]&&h.maxX+c>=0&&h.minY-c<=e[1]&&h.maxY+c>=0&&(l&&this.replayTextBackground_(t,ai,Ne,Ge,li,o,a),Rg(t,s.canvasTransform,r,i,s.originX,s.originY,s.drawImageW,s.drawImageH,s.drawImageX,s.drawImageY,s.scale)),!0}fill_(t){const e=this.alignAndScaleFill_;if(e){const i=dt(this.renderedTransform_,[0,0]),s=512*this.pixelRatio;t.save(),t.translate(i[0]%s,i[1]%s),e!==1&&t.scale(e,e),t.rotate(this.viewRotation_)}t.fill(),e&&t.restore()}setStrokeStyle_(t,e){t.strokeStyle=e[1],e[1]&&(t.lineWidth=e[2],t.lineCap=e[3],t.lineJoin=e[4],t.miterLimit=e[5],t.lineDashOffset=e[7],t.setLineDash(e[6]))}drawLabelWithPointPlacement_(t,e,i,s){const r=this.textStates[e],o=this.createLabel(t,e,s,i),a=this.strokeStates[i],l=this.pixelRatio,h=Bo(Array.isArray(t)?t[0]:t,r.textAlign||Hn),c=vr[r.textBaseline||fr],u=a&&a.lineWidth?a.lineWidth:0,d=o.width/l-2*r.scale[0],f=h*d+2*(.5-h)*u,g=c*o.height/l+2*(.5-c)*u;return{label:o,anchorX:f,anchorY:g}}execute_(t,e,i,s,r,o,a,l){const h=this.zIndexContext_;let c;this.pixelCoordinates_&&Qe(i,this.renderedTransform_)?c=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),c=ni(this.coordinates,0,this.coordinates.length,2,i,this.pixelCoordinates_),If(this.renderedTransform_,i));let u=0;const d=s.length;let f=0,g,m,_,p,y,w,E,x,v,T,R,I,L,P=0,A=0;const b=this.coordinateCache_,M=this.viewRotation_,Y=Math.round(Math.atan2(-i[1],i[0])*1e12)/1e12,k={context:t,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:M},G=this.instructions!=s||this.overlaps?0:200;let F,$,B,et;for(;u<d;){const S=s[u];switch(S[0]){case O.BEGIN_GEOMETRY:F=S[1],et=S[3],F.getGeometry()?a!==void 0&&!Ot(a,et.getExtent())?u=S[2]+1:++u:u=S[2],h&&(h.zIndex=S[4]);break;case O.BEGIN_PATH:P>G&&(this.fill_(t),P=0),A>G&&(t.stroke(),A=0),!P&&!A&&(t.beginPath(),y=NaN,w=NaN),++u;break;case O.CIRCLE:f=S[1];const Lt=c[f],lt=c[f+1],$t=c[f+2],vt=c[f+3],ve=$t-Lt,me=vt-lt,Kt=Math.sqrt(ve*ve+me*me);t.moveTo(Lt+Kt,lt),t.arc(Lt,lt,Kt,0,2*Math.PI,!0),++u;break;case O.CLOSE_PATH:t.closePath(),++u;break;case O.CUSTOM:f=S[1],g=S[2];const Or=S[3],va=S[4],fs=S[5];k.geometry=Or,k.feature=F,u in b||(b[u]=[]);const Fi=b[u];fs?fs(c,f,g,2,Fi):(Fi[0]=c[f],Fi[1]=c[f+1],Fi.length=2),h&&(h.zIndex=S[6]),va(Fi,k),++u;break;case O.DRAW_IMAGE:f=S[1],g=S[2],v=S[3],m=S[4],_=S[5];let ne=S[6];const we=S[7],xn=S[8],vn=S[9],gs=S[10];let ki=S[11];const wn=S[12];let Cn=S[13];p=S[14]||"declutter";const ft=S[15];if(!v&&S.length>=20){T=S[19],R=S[20],I=S[21],L=S[22];const se=this.drawLabelWithPointPlacement_(T,R,I,L);v=se.label,S[3]=v;const Ni=S[23];m=(se.anchorX-Ni)*this.pixelRatio,S[4]=m;const re=S[24];_=(se.anchorY-re)*this.pixelRatio,S[5]=_,ne=v.height,S[6]=ne,Cn=v.width,S[13]=Cn}let wa;S.length>25&&(wa=S[25]);let Ca,Dr,Fr;S.length>17?(Ca=S[16],Dr=S[17],Fr=S[18]):(Ca=Li,Dr=null,Fr=null),gs&&Y?ki+=M:!gs&&!Y&&(ki-=M);let kp=0;for(;f<g;f+=2){if(wa&&wa[kp++]<Cn/this.pixelRatio)continue;const se=this.calculateImageOrLabelDimensions_(v.width,v.height,c[f],c[f+1],Cn,ne,m,_,xn,vn,ki,wn,r,Ca,!!Dr||!!Fr,F),Ni=[t,e,v,se,we,Dr,Fr];if(l){let re,Ce,oe;if(ft){const at=g-f;if(!ft[at]){ft[at]={args:Ni,declutterMode:p};continue}const At=ft[at];re=At.args,Ce=At.declutterMode,delete ft[at],oe=ac(re)}let Ye,$e;if(re&&(Ce!=="declutter"||!l.collides(oe))&&(Ye=!0),(p!=="declutter"||!l.collides(se.declutterBox))&&($e=!0),Ce==="declutter"&&p==="declutter"){const at=Ye&&$e;Ye=at,$e=at}Ye&&(Ce!=="none"&&l.insert(oe),this.replayImageOrLabel_.apply(this,re)),$e&&(p!=="none"&&l.insert(se.declutterBox),this.replayImageOrLabel_.apply(this,Ni))}else this.replayImageOrLabel_.apply(this,Ni)}++u;break;case O.DRAW_CHARS:const su=S[1],ru=S[2],Ra=S[3],Np=S[4];L=S[5];const Gp=S[6],ou=S[7],au=S[8];I=S[9];const Ta=S[10];T=S[11],Array.isArray(T)&&(T=T.reduce(l_,"")),R=S[12];const lu=[S[13],S[13]];p=S[14]||"declutter";const zp=S[15],Ia=this.textStates[R],_s=Ia.font,ms=[Ia.scale[0]*ou,Ia.scale[1]*ou];let ps;_s in this.widths_?ps=this.widths_[_s]:(ps={},this.widths_[_s]=ps);const hu=qf(c,su,ru,2),cu=Math.abs(ms[0])*Wh(_s,T,ps);if(Np||cu<=hu){const se=this.textStates[R].textAlign,Ni=(hu-cu)*Bo(T,se),re=o_(c,su,ru,2,T,Ni,Gp,Math.abs(ms[0]),Wh,_s,ps,Y?0:this.viewRotation_,zp);t:if(re){const Ce=[];let oe,Ye,$e,at,At;if(I)for(oe=0,Ye=re.length;oe<Ye;++oe){At=re[oe],$e=At[4],at=this.createLabel($e,R,"",I),m=At[2]+(ms[0]<0?-Ta:Ta),_=Ra*at.height+(.5-Ra)*2*Ta*ms[1]/ms[0]-au;const Ke=this.calculateImageOrLabelDimensions_(at.width,at.height,At[0],At[1],at.width,at.height,m,_,0,0,At[3],lu,!1,Li,!1,F);if(l&&p==="declutter"&&l.collides(Ke.declutterBox))break t;Ce.push([t,e,at,Ke,1,null,null])}if(L)for(oe=0,Ye=re.length;oe<Ye;++oe){At=re[oe],$e=At[4],at=this.createLabel($e,R,L,""),m=At[2],_=Ra*at.height-au;const Ke=this.calculateImageOrLabelDimensions_(at.width,at.height,At[0],At[1],at.width,at.height,m,_,0,0,At[3],lu,!1,Li,!1,F);if(l&&p==="declutter"&&l.collides(Ke.declutterBox))break t;Ce.push([t,e,at,Ke,1,null,null])}l&&p!=="none"&&l.load(Ce.map(ac));for(let Ke=0,Xp=Ce.length;Ke<Xp;++Ke)this.replayImageOrLabel_.apply(this,Ce[Ke])}}++u;break;case O.END_GEOMETRY:if(o!==void 0){F=S[1];const se=o(F,et,p);if(se)return se}++u;break;case O.FILL:G?P++:this.fill_(t),++u;break;case O.MOVE_TO_LINE_TO:for(f=S[1],g=S[2],$=c[f],B=c[f+1],t.moveTo($,B),y=$+.5|0,w=B+.5|0,f+=2;f<g;f+=2)$=c[f],B=c[f+1],E=$+.5|0,x=B+.5|0,(f==g-2||E!==y||x!==w)&&(t.lineTo($,B),y=E,w=x);++u;break;case O.SET_FILL_STYLE:this.alignAndScaleFill_=S[2],P&&(this.fill_(t),P=0,A&&(t.stroke(),A=0)),t.fillStyle=S[1],++u;break;case O.SET_STROKE_STYLE:A&&(t.stroke(),A=0),this.setStrokeStyle_(t,S),++u;break;case O.STROKE:G?A++:t.stroke(),++u;break;default:++u;break}}P&&this.fill_(t),A&&t.stroke()}execute(t,e,i,s,r,o){this.viewRotation_=s,this.execute_(t,e,i,this.instructions,r,void 0,void 0,o)}executeHitDetection(t,e,i,s,r){return this.viewRotation_=i,this.execute_(t,[t.canvas.width,t.canvas.height],e,this.hitDetectionInstructions,!0,s,r)}}const Mi=["Polygon","Circle","LineString","Image","Text","Default"],hc=["Image","Text"],c_=Mi.filter(n=>!hc.includes(n));class u_{constructor(t,e,i,s,r,o,a){this.maxExtent_=t,this.overlaps_=s,this.pixelRatio_=i,this.resolution_=e,this.renderBuffer_=o,this.executorsByZIndex_={},this.hitDetectionContext_=null,this.hitDetectionTransform_=ue(),this.renderedContext_=null,this.deferredZIndexContexts_={},this.createExecutors_(r,a)}clip(t,e){const i=this.getClipCoords(e);t.beginPath(),t.moveTo(i[0],i[1]),t.lineTo(i[2],i[3]),t.lineTo(i[4],i[5]),t.lineTo(i[6],i[7]),t.clip()}createExecutors_(t,e){for(const i in t){let s=this.executorsByZIndex_[i];s===void 0&&(s={},this.executorsByZIndex_[i]=s);const r=t[i];for(const o in r){const a=r[o];s[o]=new h_(this.resolution_,this.pixelRatio_,this.overlaps_,a,e)}}}hasExecutors(t){for(const e in this.executorsByZIndex_){const i=this.executorsByZIndex_[e];for(let s=0,r=t.length;s<r;++s)if(t[s]in i)return!0}return!1}forEachFeatureAtCoordinate(t,e,i,s,r,o){s=Math.round(s);const a=s*2+1,l=Oe(this.hitDetectionTransform_,s+.5,s+.5,1/e,-1/e,-i,-t[0],-t[1]),h=!this.hitDetectionContext_;h&&(this.hitDetectionContext_=ht(a,a));const c=this.hitDetectionContext_;c.canvas.width!==a||c.canvas.height!==a?(c.canvas.width=a,c.canvas.height=a):h||c.clearRect(0,0,a,a);let u;this.renderBuffer_!==void 0&&(u=Wt(),zn(u,t),to(u,e*(this.renderBuffer_+s),u));const d=d_(s);let f;function g(x,v,T){const R=c.getImageData(0,0,a,a).data;for(let I=0,L=d.length;I<L;I++)if(R[d[I]]>0){if(!o||T==="none"||f!=="Image"&&f!=="Text"||o.includes(x)){const P=(d[I]-3)/4,A=s-P%a,b=s-(P/a|0),M=r(x,v,A*A+b*b);if(M)return M}c.clearRect(0,0,a,a);break}}const m=Object.keys(this.executorsByZIndex_).map(Number);m.sort(Ae);let _,p,y,w,E;for(_=m.length-1;_>=0;--_){const x=m[_].toString();for(y=this.executorsByZIndex_[x],p=Mi.length-1;p>=0;--p)if(f=Mi[p],w=y[f],w!==void 0&&(E=w.executeHitDetection(c,l,i,g,u),E))return E}}getClipCoords(t){const e=this.maxExtent_;if(!e)return null;const i=e[0],s=e[1],r=e[2],o=e[3],a=[i,s,i,o,r,o,r,s];return ni(a,0,8,2,t,a),a}isEmpty(){return Ki(this.executorsByZIndex_)}execute(t,e,i,s,r,o,a){const l=Object.keys(this.executorsByZIndex_).map(Number);l.sort(a?Dd:Ae),o=o||Mi;const h=Mi.length;for(let c=0,u=l.length;c<u;++c){const d=l[c].toString(),f=this.executorsByZIndex_[d];for(let g=0,m=o.length;g<m;++g){const _=o[g],p=f[_];if(p!==void 0){const y=a===null?void 0:p.getZIndexContext(),w=y?y.getContext():t,E=this.maxExtent_&&_!=="Image"&&_!=="Text";if(E&&(w.save(),this.clip(w,i)),!y||_==="Text"||_==="Image"?p.execute(w,e,i,s,r,a):y.pushFunction(x=>p.execute(x,e,i,s,r,a)),E&&w.restore(),y){y.offset();const x=l[c]*h+Mi.indexOf(_);this.deferredZIndexContexts_[x]||(this.deferredZIndexContexts_[x]=[]),this.deferredZIndexContexts_[x].push(y)}}}}this.renderedContext_=t}getDeferredZIndexContexts(){return this.deferredZIndexContexts_}getRenderedContext(){return this.renderedContext_}renderDeferred(){const t=this.deferredZIndexContexts_,e=Object.keys(t).map(Number).sort(Ae);for(let i=0,s=e.length;i<s;++i)t[e[i]].forEach(r=>{r.draw(this.renderedContext_),r.clear()}),t[e[i]].length=0}}const Zo={};function d_(n){if(Zo[n]!==void 0)return Zo[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 Zo[n]=s,s}function cc(n,t,e,i){return e!==void 0&&i!==void 0?[e/n,i/t]:e!==void 0?e/n:i!==void 0?i/t:1}class hn extends pr{constructor(t){t=t||{};const e=t.opacity!==void 0?t.opacity:1,i=t.rotation!==void 0?t.rotation:0,s=t.scale!==void 0?t.scale:1,r=t.rotateWithView!==void 0?t.rotateWithView:!1;super({opacity:e,rotation:i,scale:s,displacement:t.displacement!==void 0?t.displacement:[0,0],rotateWithView:r,declutterMode:t.declutterMode}),this.anchor_=t.anchor!==void 0?t.anchor:[.5,.5],this.normalizedAnchor_=null,this.anchorOrigin_=t.anchorOrigin!==void 0?t.anchorOrigin:"top-left",this.anchorXUnits_=t.anchorXUnits!==void 0?t.anchorXUnits:"fraction",this.anchorYUnits_=t.anchorYUnits!==void 0?t.anchorYUnits:"fraction",this.crossOrigin_=t.crossOrigin!==void 0?t.crossOrigin:null;const o=t.img!==void 0?t.img:null;let a=t.src;q(!(a!==void 0&&o),"`image` and `src` cannot be provided at the same time"),(a===void 0||a.length===0)&&o&&(a=o.src||V(o)),q(a!==void 0&&a.length>0,"A defined and non-empty `src` or `image` must be provided"),q(!((t.width!==void 0||t.height!==void 0)&&t.scale!==void 0),"`width` or `height` cannot be provided together with `scale`");let l;if(t.src!==void 0?l=X.IDLE:o!==void 0&&("complete"in o?o.complete?l=o.src?X.LOADED:X.IDLE:l=X.LOADING:l=X.LOADED),this.color_=t.color!==void 0?tn(t.color):null,this.iconImage_=cr(o,a,this.crossOrigin_,l,this.color_),this.offset_=t.offset!==void 0?t.offset:[0,0],this.offsetOrigin_=t.offsetOrigin!==void 0?t.offsetOrigin:"top-left",this.origin_=null,this.size_=t.size!==void 0?t.size:null,this.initialOptions_,t.width!==void 0||t.height!==void 0){let h,c;if(t.size)[h,c]=t.size;else{const u=this.getImage(1);if(u.width&&u.height)h=u.width,c=u.height;else if(u instanceof HTMLImageElement){this.initialOptions_=t;const d=()=>{if(this.unlistenImageChange(d),!this.initialOptions_)return;const f=this.iconImage_.getSize();this.setScale(cc(f[0],f[1],t.width,t.height))};this.listenImageChange(d);return}}h!==void 0&&this.setScale(cc(h,c,t.width,t.height))}}clone(){let t,e,i;return this.initialOptions_?(e=this.initialOptions_.width,i=this.initialOptions_.height):(t=this.getScale(),t=Array.isArray(t)?t.slice():t),new hn({anchor:this.anchor_.slice(),anchorOrigin:this.anchorOrigin_,anchorXUnits:this.anchorXUnits_,anchorYUnits:this.anchorYUnits_,color:this.color_&&this.color_.slice?this.color_.slice():this.color_||void 0,crossOrigin:this.crossOrigin_,offset:this.offset_.slice(),offsetOrigin:this.offsetOrigin_,opacity:this.getOpacity(),rotateWithView:this.getRotateWithView(),rotation:this.getRotation(),scale:t,width:e,height:i,size:this.size_!==null?this.size_.slice():void 0,src:this.getSrc(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()})}getAnchor(){let t=this.normalizedAnchor_;if(!t){t=this.anchor_;const s=this.getSize();if(this.anchorXUnits_=="fraction"||this.anchorYUnits_=="fraction"){if(!s)return null;t=this.anchor_.slice(),this.anchorXUnits_=="fraction"&&(t[0]*=s[0]),this.anchorYUnits_=="fraction"&&(t[1]*=s[1])}if(this.anchorOrigin_!="top-left"){if(!s)return null;t===this.anchor_&&(t=this.anchor_.slice()),(this.anchorOrigin_=="top-right"||this.anchorOrigin_=="bottom-right")&&(t[0]=-t[0]+s[0]),(this.anchorOrigin_=="bottom-left"||this.anchorOrigin_=="bottom-right")&&(t[1]=-t[1]+s[1])}this.normalizedAnchor_=t}const e=this.getDisplacement(),i=this.getScaleArray();return[t[0]-e[0]/i[0],t[1]+e[1]/i[1]]}setAnchor(t){this.anchor_=t,this.normalizedAnchor_=null}getColor(){return this.color_}getImage(t){return this.iconImage_.getImage(t)}getPixelRatio(t){return this.iconImage_.getPixelRatio(t)}getImageSize(){return this.iconImage_.getSize()}getImageState(){return this.iconImage_.getImageState()}getHitDetectionImage(){return this.iconImage_.getHitDetectionImage()}getOrigin(){if(this.origin_)return this.origin_;let t=this.offset_;if(this.offsetOrigin_!="top-left"){const e=this.getSize(),i=this.iconImage_.getSize();if(!e||!i)return null;t=t.slice(),(this.offsetOrigin_=="top-right"||this.offsetOrigin_=="bottom-right")&&(t[0]=i[0]-e[0]-t[0]),(this.offsetOrigin_=="bottom-left"||this.offsetOrigin_=="bottom-right")&&(t[1]=i[1]-e[1]-t[1])}return this.origin_=t,this.origin_}getSrc(){return this.iconImage_.getSrc()}setSrc(t){this.iconImage_=cr(null,t,this.crossOrigin_,X.IDLE,this.color_)}getSize(){return this.size_?this.size_:this.iconImage_.getSize()}getWidth(){const t=this.getScaleArray();if(this.size_)return this.size_[0]*t[0];if(this.iconImage_.getImageState()==X.LOADED)return this.iconImage_.getSize()[0]*t[0]}getHeight(){const t=this.getScaleArray();if(this.size_)return this.size_[1]*t[1];if(this.iconImage_.getImageState()==X.LOADED)return this.iconImage_.getSize()[1]*t[1]}setScale(t){delete this.initialOptions_,super.setScale(t)}listenImageChange(t){this.iconImage_.addEventListener(z.CHANGE,t)}load(){this.iconImage_.load()}unlistenImageChange(t){this.iconImage_.removeEventListener(z.CHANGE,t)}ready(){return this.iconImage_.ready()}}const Ee=.5;function f_(n,t,e,i,s,r,o,a,l){const h=s,c=n[0]*Ee,u=n[1]*Ee,d=ht(c,u);d.imageSmoothingEnabled=!1;const f=d.canvas,g=new Ig(d,Ee,s,null,o,a,null),m=e.length,_=Math.floor((256*256*256-1)/m),p={};for(let w=1;w<=m;++w){const E=e[w-1],x=E.getStyleFunction()||i;if(!x)continue;let v=x(E,r);if(!v)continue;Array.isArray(v)||(v=[v]);const R=(w*_).toString(16).padStart(7,"#00000");for(let I=0,L=v.length;I<L;++I){const P=v[I],A=P.getGeometryFunction()(E);if(!A||!Ot(h,A.getExtent()))continue;const b=P.clone(),M=b.getFill();M&&M.setColor(R);const Y=b.getStroke();Y&&(Y.setColor(R),Y.setLineDash(null)),b.setText(void 0);const k=P.getImage();if(k){const B=k.getImageSize();if(!B)continue;const et=ht(B[0],B[1],void 0,{alpha:!1}),S=et.canvas;et.fillStyle=R,et.fillRect(0,0,S.width,S.height),b.setImage(new hn({img:S,anchor:k.getAnchor(),anchorXUnits:"pixels",anchorYUnits:"pixels",offset:k.getOrigin(),opacity:1,size:k.getSize(),scale:k.getScale(),rotation:k.getRotation(),rotateWithView:k.getRotateWithView()}))}const G=b.getZIndex()||0;let F=p[G];F||(F={},p[G]=F,F.Polygon=[],F.Circle=[],F.LineString=[],F.Point=[]);const $=A.getType();if($==="GeometryCollection"){const B=A.getGeometriesArrayRecursive();for(let et=0,S=B.length;et<S;++et){const xt=B[et];F[xt.getType().replace("Multi","")].push(xt,b)}}else F[$.replace("Multi","")].push(A,b)}}const y=Object.keys(p).map(Number).sort(Ae);for(let w=0,E=y.length;w<E;++w){const x=p[y[w]];for(const v in x){const T=x[v];for(let R=0,I=T.length;R<I;R+=2){g.setStyle(T[R+1]);for(let L=0,P=t.length;L<P;++L)g.setTransform(t[L]),g.drawGeometry(T[R])}}}return d.getImageData(0,0,f.width,f.height)}function g_(n,t,e){const i=[];if(e){const s=Math.floor(Math.round(n[0])*Ee),r=Math.floor(Math.round(n[1])*Ee),o=(rt(s,0,e.width-1)+rt(r,0,e.height-1)*e.width)*4,a=e.data[o],l=e.data[o+1],c=e.data[o+2]+256*(l+256*a),u=Math.floor((256*256*256-1)/t.length);c&&c%u===0&&i.push(t[c/u-1])}return i}class uc extends Me{constructor(t,e,i,s){super(t),this.inversePixelTransform=e,this.frameState=i,this.context=s}}const __=5;class m_ extends Nn{constructor(t){super(),this.ready=!0,this.boundHandleImageChange_=this.handleImageChange_.bind(this),this.layer_=t,this.staleKeys_=new Array,this.maxStaleKeys=__}getStaleKeys(){return this.staleKeys_}prependStaleKey(t){this.staleKeys_.unshift(t),this.staleKeys_.length>this.maxStaleKeys&&(this.staleKeys_.length=this.maxStaleKeys)}getFeatures(t){return U()}getData(t){return null}prepareFrame(t){return U()}renderFrame(t,e){return U()}forEachFeatureAtCoordinate(t,e,i,s,r){}getLayer(){return this.layer_}handleFontsChanged(){}handleImageChange_(t){const e=t.target;(e.getState()===X.LOADED||e.getState()===X.ERROR)&&this.renderIfReadyAndVisible()}loadImage(t){let e=t.getState();return e!=X.LOADED&&e!=X.ERROR&&t.addEventListener(z.CHANGE,this.boundHandleImageChange_),e==X.IDLE&&(t.load(),e=t.getState()),e==X.LOADED}renderIfReadyAndVisible(){const t=this.getLayer();t&&t.getVisible()&&t.getSourceState()==="ready"&&t.changed()}renderDeferred(t){}disposeInternal(){delete this.layer_,super.disposeInternal()}}const dc=[];let cn=null;function p_(){cn=ht(1,1,void 0,{willReadFrequently:!0})}class fc extends m_{constructor(t){super(t),this.container=null,this.renderedResolution,this.tempTransform=ue(),this.pixelTransform=ue(),this.inversePixelTransform=ue(),this.context=null,this.deferredContext_=null,this.containerReused=!1,this.frameState=null}getImageData(t,e,i){cn||p_(),cn.clearRect(0,0,1,1);let s;try{cn.drawImage(t,e,i,1,1,0,0,1,1),s=cn.getImageData(0,0,1,1).data}catch{return cn=null,null}return s}getBackground(t){let i=this.getLayer().getBackground();return typeof i=="function"&&(i=i(t.viewState.resolution)),i||void 0}useContainer(t,e,i){const s=this.getLayer().getClassName();let r,o;if(t&&t.className===s&&(!i||t&&t.style.backgroundColor&&Qe(tn(t.style.backgroundColor),tn(i)))){const a=t.firstElementChild;si(a)&&(o=a.getContext("2d"))}if(o&&Af(o.canvas.style.transform,e)?(this.container=t,this.context=o,this.containerReused=!0):this.containerReused?(this.container=null,this.context=null,this.containerReused=!1):this.container&&(this.container.style.backgroundColor=null),!this.container){r=Yt?Ah():document.createElement("div"),r.className=s;let a=r.style;a.position="absolute",a.width="100%",a.height="100%",o=ht();const l=o.canvas;r.appendChild(l),a=l.style,a.position="absolute",a.left="0",a.transformOrigin="top left",this.container=r,this.context=o}!this.containerReused&&i&&!this.container.style.backgroundColor&&(this.container.style.backgroundColor=i)}clipUnrotated(t,e,i){const s=Ci(i),r=Zs(i),o=Bs(i),a=Ks(i);dt(e.coordinateToPixelTransform,s),dt(e.coordinateToPixelTransform,r),dt(e.coordinateToPixelTransform,o),dt(e.coordinateToPixelTransform,a);const l=this.inversePixelTransform;dt(l,s),dt(l,r),dt(l,o),dt(l,a),t.save(),t.beginPath(),t.moveTo(Math.round(s[0]),Math.round(s[1])),t.lineTo(Math.round(r[0]),Math.round(r[1])),t.lineTo(Math.round(o[0]),Math.round(o[1])),t.lineTo(Math.round(a[0]),Math.round(a[1])),t.clip()}prepareContainer(t,e){const i=t.extent,s=t.viewState.resolution,r=t.viewState.rotation,o=t.pixelRatio,a=Math.round(J(i)/s*o),l=Math.round(St(i)/s*o);Oe(this.pixelTransform,t.size[0]/2,t.size[1]/2,1/o,1/o,r,-a/2,-l/2),lh(this.inversePixelTransform,this.pixelTransform);const h=Lf(this.pixelTransform);if(this.useContainer(e,h,this.getBackground(t)),!this.containerReused){const c=this.context.canvas;c.width!=a||c.height!=l?(c.width=a,c.height=l):this.context.clearRect(0,0,a,l),h!==c.style.transform&&(c.style.transform=h)}}dispatchRenderEvent_(t,e,i){const s=this.getLayer();if(s.hasListener(t)){const r=new uc(t,this.inversePixelTransform,i,e);s.dispatchEvent(r)}}preRender(t,e){this.frameState=e,!e.declutter&&this.dispatchRenderEvent_(te.PRERENDER,t,e)}postRender(t,e){e.declutter||this.dispatchRenderEvent_(te.POSTRENDER,t,e)}renderDeferredInternal(t){}getRenderContext(t){return t.declutter&&!this.deferredContext_&&(this.deferredContext_=new oc),t.declutter?this.deferredContext_.getContext():this.context}renderDeferred(t){t.declutter&&(this.dispatchRenderEvent_(te.PRERENDER,this.context,t),t.declutter&&this.deferredContext_&&(this.deferredContext_.draw(this.context),this.deferredContext_.clear()),this.renderDeferredInternal(t),this.dispatchRenderEvent_(te.POSTRENDER,this.context,t))}getRenderTransform(t,e,i,s,r,o,a){const l=r/2,h=o/2,c=s/e,u=-c,d=-t[0]+a,f=-t[1];return Oe(this.tempTransform,l,h,c,u,-i,d,f)}disposeInternal(){delete this.frameState,super.disposeInternal()}}class y_ extends fc{constructor(t){super(t),this.boundHandleStyleImageChange_=this.handleStyleImageChange_.bind(this),this.animatingOrInteracting_,this.hitDetectionImageData_=null,this.clipped_=!1,this.renderedFeatures_=null,this.renderedRevision_=-1,this.renderedResolution_=NaN,this.renderedExtent_=Wt(),this.wrappedRenderedExtent_=Wt(),this.renderedRotation_,this.renderedCenter_=null,this.renderedProjection_=null,this.renderedPixelRatio_=1,this.renderedRenderOrder_=null,this.renderedFrameDeclutter_,this.replayGroup_=null,this.replayGroupChanged=!0,this.clipping=!0,this.targetContext_=null,this.opacity_=1}renderWorlds(t,e,i){const s=e.extent,r=e.viewState,o=r.center,a=r.resolution,l=r.projection,h=r.rotation,c=l.getExtent(),u=this.getLayer().getSource(),d=this.getLayer().getDeclutter(),f=e.pixelRatio,g=e.viewHints,m=!(g[pt.ANIMATING]||g[pt.INTERACTING]),_=this.context,p=Math.round(J(s)/a*f),y=Math.round(St(s)/a*f),w=u.getWrapX()&&l.canWrapX(),E=w?J(c):null,x=w?Math.ceil((s[2]-c[2])/E)+1:1;let v=w?Math.floor((s[0]-c[0])/E):0;do{let T=this.getRenderTransform(o,a,0,f,p,y,v*E);e.declutter&&(T=T.slice(0)),t.execute(_,[_.canvas.width,_.canvas.height],T,h,m,i===void 0?Mi:i?hc:c_,i?d&&e.declutter[d]:void 0)}while(++v<x)}setDrawContext_(){this.opacity_!==1&&(this.targetContext_=this.context,this.context=ht(this.context.canvas.width,this.context.canvas.height,dc))}resetDrawContext_(){if(this.opacity_!==1&&this.targetContext_){const t=this.targetContext_.globalAlpha;this.targetContext_.globalAlpha=this.opacity_,this.targetContext_.drawImage(this.context.canvas,0,0),this.targetContext_.globalAlpha=t,lr(this.context),dc.push(this.context.canvas),this.context=this.targetContext_,this.targetContext_=null}}renderDeclutter(t){!this.replayGroup_||!this.getLayer().getDeclutter()||this.renderWorlds(this.replayGroup_,t,!0)}renderDeferredInternal(t){this.replayGroup_&&(this.replayGroup_.renderDeferred(),this.clipped_&&this.context.restore(),this.resetDrawContext_())}renderFrame(t,e){const i=t.layerStatesArray[t.layerIndex];this.opacity_=i.opacity;const s=t.viewState;this.prepareContainer(t,e);const r=this.context,o=this.replayGroup_;let a=o&&!o.isEmpty();if(!a&&!(this.getLayer().hasListener(te.PRERENDER)||this.getLayer().hasListener(te.POSTRENDER)))return this.container;if(this.setDrawContext_(),this.preRender(r,t),s.projection,this.clipped_=!1,a&&i.extent&&this.clipping){const l=ii(i.extent);a=Ot(l,t.extent),this.clipped_=a&&!Zi(l,t.extent),this.clipped_&&this.clipUnrotated(r,t,l)}return a&&this.renderWorlds(o,t,this.getLayer().getDeclutter()?!1:void 0),!t.declutter&&this.clipped_&&r.restore(),this.postRender(r,t),this.renderedRotation_!==s.rotation&&(this.renderedRotation_=s.rotation,this.hitDetectionImageData_=null),t.declutter||this.resetDrawContext_(),this.container}getFeatures(t){return new Promise(e=>{if(this.frameState&&!this.hitDetectionImageData_&&!this.animatingOrInteracting_){const i=this.frameState.size.slice(),s=this.renderedCenter_,r=this.renderedResolution_,o=this.renderedRotation_,a=this.renderedProjection_,l=this.wrappedRenderedExtent_,h=this.getLayer(),c=[],u=i[0]*Ee,d=i[1]*Ee;c.push(this.getRenderTransform(s,r,o,Ee,u,d,0).slice());const f=h.getSource(),g=a.getExtent();if(f.getWrapX()&&a.canWrapX()&&!Zi(g,l)){let m=l[0];const _=J(g);let p=0,y;for(;m<g[0];)--p,y=_*p,c.push(this.getRenderTransform(s,r,o,Ee,u,d,y).slice()),m+=_;for(p=0,m=l[2];m>g[2];)++p,y=_*p,c.push(this.getRenderTransform(s,r,o,Ee,u,d,y).slice()),m-=_}this.hitDetectionImageData_=f_(i,c,this.renderedFeatures_,h.getStyleFunction(),l,r,o,$h(r,this.renderedPixelRatio_))}e(g_(t,this.renderedFeatures_,this.hitDetectionImageData_))})}forEachFeatureAtCoordinate(t,e,i,s,r){if(!this.replayGroup_)return;const o=e.viewState.resolution,a=e.viewState.rotation,l=this.getLayer(),h={},c=function(d,f,g){const m=V(d),_=h[m];if(_){if(_!==!0&&g<_.distanceSq){if(g===0)return h[m]=!0,r.splice(r.lastIndexOf(_),1),s(d,l,f);_.geometry=f,_.distanceSq=g}}else{if(g===0)return h[m]=!0,s(d,l,f);r.push(h[m]={feature:d,layer:l,geometry:f,distanceSq:g,callback:s})}},u=this.getLayer().getDeclutter();return this.replayGroup_.forEachFeatureAtCoordinate(t,o,a,i,c,u?e.declutter?.[u]?.all().map(d=>d.value):null)}handleFontsChanged(){const t=this.getLayer();t.getVisible()&&this.replayGroup_&&t.changed()}handleStyleImageChange_(t){this.renderIfReadyAndVisible()}prepareFrame(t){const e=this.getLayer(),i=e.getSource();if(!i)return!1;const s=t.viewHints[pt.ANIMATING],r=t.viewHints[pt.INTERACTING],o=e.getUpdateWhileAnimating(),a=e.getUpdateWhileInteracting();if(this.ready&&!o&&s||!a&&r)return this.animatingOrInteracting_=!0,!0;this.animatingOrInteracting_=!1;const l=t.extent,h=t.viewState,c=h.projection,u=h.resolution,d=t.pixelRatio,f=e.getRevision(),g=e.getRenderBuffer();let m=e.getRenderOrder();m===void 0&&(m=bg);const _=h.center.slice(),p=to(l,g*u),y=p.slice(),w=[p.slice()],E=c.getExtent();if(i.getWrapX()&&c.canWrapX()&&!Zi(E,t.extent)){const M=J(E),Y=Math.max(J(p)/2,M);p[0]=E[0]-Y,p[2]=E[2]+Y,Bl(_,c);const k=Xl(w[0],c);k[0]<E[0]&&k[2]<E[2]?w.push([k[0]+M,k[1],k[2]+M,k[3]]):k[0]>E[0]&&k[2]>E[2]&&w.push([k[0]-M,k[1],k[2]-M,k[3]])}if(this.ready&&this.renderedResolution_==u&&this.renderedRevision_==f&&this.renderedRenderOrder_==m&&this.renderedFrameDeclutter_===!!t.declutter&&Zi(this.wrappedRenderedExtent_,p))return Qe(this.renderedExtent_,y)||(this.hitDetectionImageData_=null,this.renderedExtent_=y),this.renderedCenter_=_,this.replayGroupChanged=!1,!0;this.replayGroup_=null;const x=new r_(Kh(u,d),p,u,d);let v;for(let M=0,Y=w.length;M<Y;++M)i.loadFeatures(w[M],u,c);const T=$h(u,d);let R=!0;const I=(M,Y)=>{let k;const G=M.getStyleFunction()||e.getStyleFunction();if(G&&(k=G(M,u)),k){const F=this.renderFeature(M,T,k,x,v,this.getLayer().getDeclutter(),Y);R=R&&!F}},L=ah(p),P=i.getFeaturesInExtent(L);m&&P.sort(m);for(let M=0,Y=P.length;M<Y;++M)I(P[M],M);this.renderedFeatures_=P,this.ready=R;const A=x.finish(),b=new u_(p,u,d,i.getOverlaps(),A,e.getRenderBuffer(),!!t.declutter);return this.renderedResolution_=u,this.renderedRevision_=f,this.renderedRenderOrder_=m,this.renderedFrameDeclutter_=!!t.declutter,this.renderedExtent_=y,this.wrappedRenderedExtent_=p,this.renderedCenter_=_,this.renderedProjection_=c,this.renderedPixelRatio_=d,this.replayGroup_=b,this.hitDetectionImageData_=null,this.replayGroupChanged=!0,!0}renderFeature(t,e,i,s,r,o,a){if(!i)return!1;let l=!1;if(Array.isArray(i))for(let h=0,c=i.length;h<c;++h)l=Bh(s,t,i[h],e,this.boundHandleStyleImageChange_,r,o,a)||l;else l=Bh(s,t,i,e,this.boundHandleStyleImageChange_,r,o,a);return l}}let Pi=0;const bt=1<<Pi++,K=1<<Pi++,Nt=1<<Pi++,fe=1<<Pi++,Oi=1<<Pi++,ns=1<<Pi++,wr=Math.pow(2,Pi)-1,Uo={[bt]:"boolean",[K]:"number",[Nt]:"string",[fe]:"color",[Oi]:"number[]",[ns]:"size"},E_=Object.keys(Uo).map(Number).sort(Ae);function x_(n){return n in Uo}function ss(n){const t=[];for(const e of E_)rs(n,e)&&t.push(Uo[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 hi(n,t){return n===t}class ct{constructor(t,e){if(!x_(t))throw new Error(`literal expressions must have a specific type, got ${ss(t)}`);this.type=t,this.value=e}}class v_{constructor(t,e,...i){this.type=t,this.operator=e,this.args=i}}function gc(){return{variables:new Set,properties:new Set,featureId:!1,geometryType:!1,mapState:!1}}function _t(n,t,e){switch(typeof n){case"boolean":{if(hi(t,Nt))return new ct(Nt,n?"true":"false");if(!rs(t,bt))throw new Error(`got a boolean, but expected ${ss(t)}`);return new ct(bt,n)}case"number":{if(hi(t,ns))return new ct(ns,kt(n));if(hi(t,bt))return new ct(bt,!!n);if(hi(t,Nt))return new ct(Nt,n.toString());if(!rs(t,K))throw new Error(`got a number, but expected ${ss(t)}`);return new ct(K,n)}case"string":{if(hi(t,fe))return new ct(fe,Fo(n));if(hi(t,bt))return new ct(bt,!!n);if(!rs(t,Nt))throw new Error(`got a string, but expected ${ss(t)}`);return new ct(Nt,n)}}if(!Array.isArray(n))throw new Error("expression must be an array or a primitive value");if(n.length===0)throw new Error("empty expression");if(typeof n[0]=="string")return P_(n,t,e);for(const i of n)if(typeof i!="number")throw new Error("expected an array of numbers");if(hi(t,ns)){if(n.length!==2)throw new Error(`expected an array of two values for a size, got ${n.length}`);return new ct(ns,n)}if(hi(t,fe)){if(n.length===3)return new ct(fe,[...n,1]);if(n.length===4)return new ct(fe,n);throw new Error(`expected an array of 3 or 4 values for a color, got ${n.length}`)}if(!rs(t,Oi))throw new Error(`got an array of numbers, but expected ${ss(t)}`);return new ct(Oi,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"},w_={[C.Get]:N(W(1,1/0),_c),[C.Var]:N(W(1,1),C_),[C.Has]:N(W(1,1/0),_c),[C.Id]:N(R_,un),[C.Concat]:N(W(2,1/0),H(Nt)),[C.GeometryType]:N(T_,un),[C.LineMetric]:N(un),[C.Resolution]:N(Vo,un),[C.Zoom]:N(Vo,un),[C.Time]:N(Vo,un),[C.Any]:N(W(2,1/0),H(bt)),[C.All]:N(W(2,1/0),H(bt)),[C.Not]:N(W(1,1),H(bt)),[C.Equal]:N(W(2,2),H(wr)),[C.NotEqual]:N(W(2,2),H(wr)),[C.GreaterThan]:N(W(2,2),H(K)),[C.GreaterThanOrEqualTo]:N(W(2,2),H(K)),[C.LessThan]:N(W(2,2),H(K)),[C.LessThanOrEqualTo]:N(W(2,2),H(K)),[C.Multiply]:N(W(2,1/0),mc),[C.Coalesce]:N(W(2,1/0),mc),[C.Divide]:N(W(2,2),H(K)),[C.Add]:N(W(2,1/0),H(K)),[C.Subtract]:N(W(2,2),H(K)),[C.Clamp]:N(W(3,3),H(K)),[C.Mod]:N(W(2,2),H(K)),[C.Pow]:N(W(2,2),H(K)),[C.Abs]:N(W(1,1),H(K)),[C.Floor]:N(W(1,1),H(K)),[C.Ceil]:N(W(1,1),H(K)),[C.Round]:N(W(1,1),H(K)),[C.Sin]:N(W(1,1),H(K)),[C.Cos]:N(W(1,1),H(K)),[C.Atan]:N(W(1,2),H(K)),[C.Sqrt]:N(W(1,1),H(K)),[C.Match]:N(W(4,1/0),pc,S_),[C.Between]:N(W(3,3),H(K)),[C.Interpolate]:N(W(6,1/0),pc,b_),[C.Case]:N(W(3,1/0),I_,L_),[C.In]:N(W(2,2),A_),[C.Number]:N(W(1,1/0),H(wr)),[C.String]:N(W(1,1/0),H(wr)),[C.Array]:N(W(1,1/0),H(K)),[C.Color]:N(W(1,4),H(K)),[C.Band]:N(W(1,3),H(K)),[C.Palette]:N(W(2,2),M_),[C.ToString]:N(W(1,1),H(bt|K|Nt|fe))};function _c(n,t,e){const i=n.length-1,s=new Array(i);for(let r=0;r<i;++r){const o=n[r+1];switch(typeof o){case"number":{s[r]=new ct(K,o);break}case"string":{s[r]=new ct(Nt,o);break}default:throw new Error(`expected a string key or numeric array index for a get operation, got ${o}`)}r===0&&e.properties.add(String(o))}return s}function C_(n,t,e){const i=n[1];if(typeof i!="string")throw new Error("expected a string argument for var operation");return e.variables.add(i),[new ct(Nt,i)]}function R_(n,t,e){e.featureId=!0}function T_(n,t,e){e.geometryType=!0}function Vo(n,t,e){e.mapState=!0}function un(n,t,e){const i=n[0];if(n.length!==1)throw new Error(`expected no arguments for ${i} operation`);return[]}function W(n,t){return function(e,i,s){const r=e[0],o=e.length-1;if(n===t){if(o!==n){const a=n===1?"":"s";throw new Error(`expected ${n} argument${a} for ${r}, got ${o}`)}}else if(o<n||o>t){const a=t===1/0?`${n} or more`:`${n} to ${t}`;throw new Error(`expected ${a} arguments for ${r}, got ${o}`)}}}function mc(n,t,e){const i=n.length-1,s=new Array(i);for(let r=0;r<i;++r){const o=_t(n[r+1],t,e);s[r]=o}return s}function H(n){return function(t,e,i){const s=t.length-1,r=new Array(s);for(let o=0;o<s;++o){const a=_t(t[o+1],n,i);r[o]=a}return r}}function I_(n,t,e){const i=n[0],s=n.length-1;if(s%2===0)throw new Error(`expected an odd number of arguments for ${i}, got ${s} instead`)}function pc(n,t,e){const i=n[0],s=n.length-1;if(s%2===1)throw new Error(`expected an even number of arguments for operation ${i}, got ${s} instead`)}function S_(n,t,e){const i=n.length-1,s=Nt|K|bt,r=_t(n[1],s,e),o=_t(n[n.length-1],t,e),a=new Array(i-2);for(let l=0;l<i-2;l+=2){try{const h=_t(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=_t(n[l+3],o.type,e);a[l+1]=h}catch(h){throw new Error(`failed to parse argument ${l+2} of match expression: ${h.message}`)}}return[r,...a,o]}function b_(n,t,e){const i=n[1];let s;switch(i[0]){case"linear":s=1;break;case"exponential":const l=i[1];if(typeof l!="number"||l<=0)throw new Error(`expected a number base for exponential interpolation, got ${JSON.stringify(l)} instead`);s=l;break;default:throw new Error(`invalid interpolation type: ${JSON.stringify(i)}`)}const r=new ct(K,s);let o;try{o=_t(n[2],K,e)}catch(l){throw new Error(`failed to parse argument 1 in interpolate expression: ${l.message}`)}const a=new Array(n.length-3);for(let l=0;l<a.length;l+=2){try{const h=_t(n[l+3],K,e);a[l]=h}catch(h){throw new Error(`failed to parse argument ${l+2} for interpolate expression: ${h.message}`)}try{const h=_t(n[l+4],t,e);a[l+1]=h}catch(h){throw new Error(`failed to parse argument ${l+3} for interpolate expression: ${h.message}`)}}return[r,o,...a]}function L_(n,t,e){const i=_t(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=_t(n[r+1],bt,e);s[r]=o}catch(o){throw new Error(`failed to parse argument ${r} of case expression: ${o.message}`)}try{const o=_t(n[r+2],i.type,e);s[r+1]=o}catch(o){throw new Error(`failed to parse argument ${r+1} of case expression: ${o.message}`)}}return s[s.length-1]=i,s}function A_(n,t,e){let i=n[2];if(!Array.isArray(i))throw new Error('the second argument for the "in" operator must be an array');let s;if(typeof i[0]=="string"){if(i[0]!=="literal")throw new Error('for the "in" operator, a string array should be wrapped in a "literal" operator to disambiguate from expressions');if(!Array.isArray(i[1]))throw new Error('failed to parse "in" expression: the literal operator must be followed by an array');i=i[1],s=Nt}else s=K;const r=new Array(i.length);for(let a=0;a<r.length;a++)try{const l=_t(i[a],s,e);r[a]=l}catch(l){throw new Error(`failed to parse haystack item ${a} for "in" expression: ${l.message}`)}return[_t(n[1],s,e),...r]}function M_(n,t,e){let i;try{i=_t(n[1],K,e)}catch(o){throw new Error(`failed to parse first argument in palette expression: ${o.message}`)}const s=n[2];if(!Array.isArray(s))throw new Error("the second argument of palette must be an array");const r=new Array(s.length);for(let o=0;o<r.length;o++){let a;try{a=_t(s[o],fe,e)}catch(l){throw new Error(`failed to parse color at index ${o} in palette expression: ${l.message}`)}if(!(a instanceof ct))throw new Error(`the palette color at index ${o} must be a literal value`);r[o]=a}return[i,...r]}function N(...n){return function(t,e,i){const s=t[0];let r;for(let o=0;o<n.length;o++){const a=n[o](t,e,i);if(o==n.length-1){if(!a)throw new Error("expected last argument validator to return the parsed args");r=a}}return new v_(e,s,...r)}}function P_(n,t,e){const i=n[0],s=w_[i];if(!s)throw new Error(`unknown operator: ${i}`);return s(n,t,e)}function yc(n){if(!n)return"";const t=n.getType();switch(t){case"Point":case"LineString":case"Polygon":return t;case"MultiPoint":case"MultiLineString":case"MultiPolygon":return t.substring(5);case"Circle":return"Polygon";case"GeometryCollection":return yc(n.getGeometries()[0]);default:return""}}function Ec(){return{variables:{},properties:{},resolution:NaN,featureId:null,geometryType:""}}function ze(n,t,e){const i=_t(n,t,e);return ge(i)}function ge(n,t){if(n instanceof ct){if(n.type===fe&&typeof n.value=="string"){const i=Fo(n.value);return function(){return i}}return function(){return n.value}}const e=n.operator;switch(e){case C.Number:case C.String:case C.Coalesce:return O_(n);case C.Get:case C.Var:case C.Has:return D_(n);case C.Id:return i=>i.featureId;case C.GeometryType:return i=>i.geometryType;case C.Concat:{const i=n.args.map(s=>ge(s));return s=>"".concat(...i.map(r=>r(s).toString()))}case C.Resolution:return i=>i.resolution;case C.Any:case C.All:case C.Between:case C.In:case C.Not:return k_(n);case C.Equal:case C.NotEqual:case C.LessThan:case C.LessThanOrEqualTo:case C.GreaterThan:case C.GreaterThanOrEqualTo:return F_(n);case C.Multiply:case C.Divide:case C.Add:case C.Subtract:case C.Clamp:case C.Mod:case C.Pow:case C.Abs:case C.Floor:case C.Ceil:case C.Round:case C.Sin:case C.Cos:case C.Atan:case C.Sqrt:return N_(n);case C.Case:return G_(n);case C.Match:return z_(n);case C.Interpolate:return X_(n);case C.ToString:return W_(n);default:throw new Error(`Unsupported operator ${e}`)}}function O_(n,t){const e=n.operator,i=n.args.length,s=new Array(i);for(let r=0;r<i;++r)s[r]=ge(n.args[r]);switch(e){case C.Coalesce:return r=>{for(let o=0;o<i;++o){const a=s[o](r);if(typeof a<"u"&&a!==null)return a}throw new Error("Expected one of the values to be non-null")};case C.Number:case C.String:return r=>{for(let o=0;o<i;++o){const a=s[o](r);if(typeof a===e)return a}throw new Error(`Expected one of the values to be a ${e}`)};default:throw new Error(`Unsupported assertion operator ${e}`)}}function D_(n,t){const i=n.args[0].value;switch(n.operator){case C.Get:return s=>{const r=n.args;let o=s.properties[i];for(let a=1,l=r.length;a<l;++a){const c=r[a].value;o=o[c]}return o};case C.Var:return s=>s.variables[i];case C.Has:return s=>{const r=n.args;if(!(i in s.properties))return!1;let o=s.properties[i];for(let a=1,l=r.length;a<l;++a){const c=r[a].value;if(!o||!Object.hasOwn(o,c))return!1;o=o[c]}return!0};default:throw new Error(`Unsupported accessor operator ${n.operator}`)}}function F_(n,t){const e=n.operator,i=ge(n.args[0]),s=ge(n.args[1]);switch(e){case C.Equal:return r=>i(r)===s(r);case C.NotEqual:return r=>i(r)!==s(r);case C.LessThan:return r=>i(r)<s(r);case C.LessThanOrEqualTo:return r=>i(r)<=s(r);case C.GreaterThan:return r=>i(r)>s(r);case C.GreaterThanOrEqualTo:return r=>i(r)>=s(r);default:throw new Error(`Unsupported comparison operator ${e}`)}}function k_(n,t){const e=n.operator,i=n.args.length,s=new Array(i);for(let r=0;r<i;++r)s[r]=ge(n.args[r]);switch(e){case C.Any:return r=>{for(let o=0;o<i;++o)if(s[o](r))return!0;return!1};case C.All:return r=>{for(let o=0;o<i;++o)if(!s[o](r))return!1;return!0};case C.Between:return r=>{const o=s[0](r),a=s[1](r),l=s[2](r);return o>=a&&o<=l};case C.In:return r=>{const o=s[0](r);for(let a=1;a<i;++a)if(o===s[a](r))return!0;return!1};case C.Not:return r=>!s[0](r);default:throw new Error(`Unsupported logical operator ${e}`)}}function N_(n,t){const e=n.operator,i=n.args.length,s=new Array(i);for(let r=0;r<i;++r)s[r]=ge(n.args[r]);switch(e){case C.Multiply:return r=>{let o=1;for(let a=0;a<i;++a)o*=s[a](r);return o};case C.Divide:return r=>s[0](r)/s[1](r);case C.Add:return r=>{let o=0;for(let a=0;a<i;++a)o+=s[a](r);return o};case C.Subtract:return r=>s[0](r)-s[1](r);case C.Clamp:return r=>{const o=s[0](r),a=s[1](r);if(o<a)return a;const l=s[2](r);return o>l?l:o};case C.Mod:return r=>s[0](r)%s[1](r);case C.Pow:return r=>Math.pow(s[0](r),s[1](r));case C.Abs:return r=>Math.abs(s[0](r));case C.Floor:return r=>Math.floor(s[0](r));case C.Ceil:return r=>Math.ceil(s[0](r));case C.Round:return r=>Math.round(s[0](r));case C.Sin:return r=>Math.sin(s[0](r));case C.Cos:return r=>Math.cos(s[0](r));case C.Atan:return i===2?r=>Math.atan2(s[0](r),s[1](r)):r=>Math.atan(s[0](r));case C.Sqrt:return r=>Math.sqrt(s[0](r));default:throw new Error(`Unsupported numeric operator ${e}`)}}function G_(n,t){const e=n.args.length,i=new Array(e);for(let s=0;s<e;++s)i[s]=ge(n.args[s]);return s=>{for(let r=0;r<e-1;r+=2)if(i[r](s))return i[r+1](s);return i[e-1](s)}}function z_(n,t){const e=n.args.length,i=new Array(e);for(let s=0;s<e;++s)i[s]=ge(n.args[s]);return s=>{const r=i[0](s);for(let o=1;o<e-1;o+=2)if(r===i[o](s))return i[o+1](s);return i[e-1](s)}}function X_(n,t){const e=n.args.length,i=new Array(e);for(let s=0;s<e;++s)i[s]=ge(n.args[s]);return s=>{const r=i[0](s),o=i[1](s);let a,l;for(let h=2;h<e;h+=2){const c=i[h](s);let u=i[h+1](s);const d=Array.isArray(u);if(d&&(u=cg(u)),c>=o)return h===2?u:d?Y_(r,o,a,l,c,u):os(r,o,a,l,c,u);a=c,l=u}return l}}function W_(n,t){const e=n.operator,i=n.args.length,s=new Array(i);for(let r=0;r<i;++r)s[r]=ge(n.args[r]);switch(e){case C.ToString:return r=>{const o=s[0](r);return n.args[0].type===fe?ko(o):o.toString()};default:throw new Error(`Unsupported convert operator ${e}`)}}function os(n,t,e,i,s,r){const o=s-e;if(o===0)return i;const a=t-e,l=n===1?a/o:(Math.pow(n,a)-1)/(Math.pow(n,o)-1);return i+l*(r-i)}function Y_(n,t,e,i,s,r){if(s-e===0)return i;const a=Ph(i),l=Ph(r);let h=l[2]-a[2];h>180?h-=360:h<-180&&(h+=360);const c=[os(n,t,e,a[0],s,l[0]),os(n,t,e,a[1],s,l[1]),a[2]+os(n,t,e,0,s,h),os(n,t,e,i[3],s,r[3])];return ug(c)}function $_(n){return!0}function K_(n){const t=gc(),e=B_(n,t),i=Ec();return function(s,r){if(i.properties=s.getPropertiesInternal(),i.resolution=r,t.featureId){const o=s.getId();o!==void 0?i.featureId=o:i.featureId=null}return t.geometryType&&(i.geometryType=yc(s.getGeometry())),e(i)}}function xc(n){const t=gc(),e=n.length,i=new Array(e);for(let o=0;o<e;++o)i[o]=jo(n[o],t);const s=Ec(),r=new Array(e);return function(o,a){if(s.properties=o.getPropertiesInternal(),s.resolution=a,t.featureId){const h=o.getId();h!==void 0?s.featureId=h:s.featureId=null}let l=0;for(let h=0;h<e;++h){const c=i[h](s);c&&(r[l]=c,l+=1)}return r.length=l,r}}function B_(n,t){const e=n.length,i=new Array(e);for(let s=0;s<e;++s){const r=n[s],o="filter"in r?ze(r.filter,bt,t):$_;let a;if(Array.isArray(r.style)){const l=r.style.length;a=new Array(l);for(let h=0;h<l;++h)a[h]=jo(r.style[h],t)}else a=[jo(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 jo(n,t){const e=as(n,"",t),i=ls(n,"",t),s=Z_(n,t),r=U_(n,t),o=Gt(n,"z-index",t);if(!e&&!i&&!s&&!r&&!Ki(n))throw new Error("No fill, stroke, point, or text symbolizer properties in style: "+JSON.stringify(n));const a=new ke;return function(l){let h=!0;if(e){const c=e(l);c&&(h=!1),a.setFill(c)}if(i){const c=i(l);c&&(h=!1),a.setStroke(c)}if(s){const c=s(l);c&&(h=!1),a.setText(c)}if(r){const c=r(l);c&&(h=!1),a.setImage(c)}return o&&a.setZIndex(o(l)),h?null:a}}function as(n,t,e){let i;if(t+"fill-pattern-src"in n)i=q_(n,t+"fill-",e);else{if(n[t+"fill-color"]==="none")return r=>null;i=Ho(n,t+"fill-color",e)}if(!i)return null;const s=new an;return function(r){const o=i(r);return o===bo?null:(s.setColor(o),s)}}function ls(n,t,e){const i=Gt(n,t+"stroke-width",e),s=Ho(n,t+"stroke-color",e);if(!i&&!s)return null;const r=Xe(n,t+"stroke-line-cap",e),o=Xe(n,t+"stroke-line-join",e),a=vc(n,t+"stroke-line-dash",e),l=Gt(n,t+"stroke-line-dash-offset",e),h=Gt(n,t+"stroke-miter-limit",e),c=new mr;return function(u){if(s){const d=s(u);if(d===bo)return null;c.setColor(d)}if(i&&c.setWidth(i(u)),r){const d=r(u);if(d!=="butt"&&d!=="round"&&d!=="square")throw new Error("Expected butt, round, or square line cap");c.setLineCap(d)}if(o){const d=o(u);if(d!=="bevel"&&d!=="round"&&d!=="miter")throw new Error("Expected bevel, round, or miter line join");c.setLineJoin(d)}return a&&c.setLineDash(a(u)),l&&c.setLineDashOffset(l(u)),h&&c.setMiterLimit(h(u)),c}}function Z_(n,t){const e="text-",i=Xe(n,e+"value",t);if(!i)return null;const s=as(n,e,t),r=as(n,e+"background-",t),o=ls(n,e,t),a=ls(n,e+"background-",t),l=Xe(n,e+"font",t),h=Gt(n,e+"max-angle",t),c=Gt(n,e+"offset-x",t),u=Gt(n,e+"offset-y",t),d=dn(n,e+"overflow",t),f=Xe(n,e+"placement",t),g=Gt(n,e+"repeat",t),m=Rr(n,e+"scale",t),_=dn(n,e+"rotate-with-view",t),p=Gt(n,e+"rotation",t),y=Xe(n,e+"align",t),w=Xe(n,e+"justify",t),E=Xe(n,e+"baseline",t),x=dn(n,e+"keep-upright",t),v=vc(n,e+"padding",t),T=Ir(n,e+"declutter-mode"),R=new Jg({declutterMode:T});return function(I){if(R.setText(i(I)),s&&R.setFill(s(I)),r&&R.setBackgroundFill(r(I)),o&&R.setStroke(o(I)),a&&R.setBackgroundStroke(a(I)),l&&R.setFont(l(I)),h&&R.setMaxAngle(h(I)),c&&R.setOffsetX(c(I)),u&&R.setOffsetY(u(I)),d&&R.setOverflow(d(I)),f){const L=f(I);if(L!=="point"&&L!=="line")throw new Error("Expected point or line for text-placement");R.setPlacement(L)}if(g&&R.setRepeat(g(I)),m&&R.setScale(m(I)),_&&R.setRotateWithView(_(I)),p&&R.setRotation(p(I)),y){const L=y(I);if(L!=="left"&&L!=="center"&&L!=="right"&&L!=="end"&&L!=="start")throw new Error("Expected left, right, center, start, or end for text-align");R.setTextAlign(L)}if(w){const L=w(I);if(L!=="left"&&L!=="right"&&L!=="center")throw new Error("Expected left, right, or center for text-justify");R.setJustify(L)}if(E){const L=E(I);if(L!=="bottom"&&L!=="top"&&L!=="middle"&&L!=="alphabetic"&&L!=="hanging")throw new Error("Expected bottom, top, middle, alphabetic, or hanging for text-baseline");R.setTextBaseline(L)}return v&&R.setPadding(v(I)),x&&R.setKeepUpright(x(I)),R}}function U_(n,t){return"icon-src"in n?V_(n,t):"shape-points"in n?j_(n,t):"circle-radius"in n?H_(n,t):null}function V_(n,t){const e="icon-",i=e+"src",s=Tc(n[i],i),r=Cr(n,e+"anchor",t),o=Rr(n,e+"scale",t),a=Gt(n,e+"opacity",t),l=Cr(n,e+"displacement",t),h=Gt(n,e+"rotation",t),c=dn(n,e+"rotate-with-view",t),u=Cc(n,e+"anchor-origin"),d=Rc(n,e+"anchor-x-units"),f=Rc(n,e+"anchor-y-units"),g=em(n,e+"color"),m=Q_(n,e+"cross-origin"),_=tm(n,e+"offset"),p=Cc(n,e+"offset-origin"),y=Tr(n,e+"width"),w=Tr(n,e+"height"),E=J_(n,e+"size"),x=Ir(n,e+"declutter-mode"),v=new hn({src:s,anchorOrigin:u,anchorXUnits:d,anchorYUnits:f,color:g,crossOrigin:m,offset:_,offsetOrigin:p,height:w,width:y,size:E,declutterMode:x});return function(T){return a&&v.setOpacity(a(T)),l&&v.setDisplacement(l(T)),h&&v.setRotation(h(T)),c&&v.setRotateWithView(c(T)),o&&v.setScale(o(T)),r&&v.setAnchor(r(T)),v}}function j_(n,t){const e="shape-",i=e+"points",s=e+"radius",r=qo(n[i],i),o=qo(n[s],s),a=as(n,e,t),l=ls(n,e,t),h=Rr(n,e+"scale",t),c=Cr(n,e+"displacement",t),u=Gt(n,e+"rotation",t),d=dn(n,e+"rotate-with-view",t),f=Tr(n,e+"radius2"),g=Tr(n,e+"angle"),m=Ir(n,e+"declutter-mode"),_=new yr({points:r,radius:o,radius2:f,angle:g,declutterMode:m});return function(p){return a&&_.setFill(a(p)),l&&_.setStroke(l(p)),c&&_.setDisplacement(c(p)),u&&_.setRotation(u(p)),d&&_.setRotateWithView(d(p)),h&&_.setScale(h(p)),_}}function H_(n,t){const e="circle-",i=as(n,e,t),s=ls(n,e,t),r=Gt(n,e+"radius",t),o=Rr(n,e+"scale",t),a=Cr(n,e+"displacement",t),l=Gt(n,e+"rotation",t),h=dn(n,e+"rotate-with-view",t),c=Ir(n,e+"declutter-mode"),u=new Er({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 Gt(n,t,e){if(!(t in n))return;const i=ze(n[t],K,e);return function(s){return qo(i(s),t)}}function Xe(n,t,e){if(!(t in n))return null;const i=ze(n[t],Nt,e);return function(s){return Tc(i(s),t)}}function q_(n,t,e){const i=Xe(n,t+"pattern-src",e),s=wc(n,t+"pattern-offset",e),r=wc(n,t+"pattern-size",e),o=Ho(n,t+"color",e);return function(a){return{src:i(a),offset:s&&s(a),size:r&&r(a),color:o&&o(a)}}}function dn(n,t,e){if(!(t in n))return null;const i=ze(n[t],bt,e);return function(s){const r=i(s);if(typeof r!="boolean")throw new Error(`Expected a boolean for ${t}`);return r}}function Ho(n,t,e){if(!(t in n))return null;const i=ze(n[t],fe,e);return function(s){return Ic(i(s),t)}}function vc(n,t,e){if(!(t in n))return null;const i=ze(n[t],Oi,e);return function(s){return hs(i(s),t)}}function Cr(n,t,e){if(!(t in n))return null;const i=ze(n[t],Oi,e);return function(s){const r=hs(i(s),t);if(r.length!==2)throw new Error(`Expected two numbers for ${t}`);return r}}function wc(n,t,e){if(!(t in n))return null;const i=ze(n[t],Oi,e);return function(s){return Sc(i(s),t)}}function Rr(n,t,e){if(!(t in n))return null;const i=ze(n[t],Oi|K,e);return function(s){return im(i(s),t)}}function Tr(n,t){const e=n[t];if(e!==void 0){if(typeof e!="number")throw new Error(`Expected a number for ${t}`);return e}}function J_(n,t){const e=n[t];if(e!==void 0){if(typeof e=="number")return kt(e);if(!Array.isArray(e))throw new Error(`Expected a number or size array for ${t}`);if(e.length!==2||typeof e[0]!="number"||typeof e[1]!="number")throw new Error(`Expected a number or size array for ${t}`);return e}}function Q_(n,t){const e=n[t];if(e!==void 0){if(typeof e!="string")throw new Error(`Expected a string for ${t}`);return e}}function Cc(n,t){const e=n[t];if(e!==void 0){if(e!=="bottom-left"&&e!=="bottom-right"&&e!=="top-left"&&e!=="top-right")throw new Error(`Expected bottom-left, bottom-right, top-left, or top-right for ${t}`);return e}}function Rc(n,t){const e=n[t];if(e!==void 0){if(e!=="pixels"&&e!=="fraction")throw new Error(`Expected pixels or fraction for ${t}`);return e}}function tm(n,t){const e=n[t];if(e!==void 0)return hs(e,t)}function Ir(n,t){const e=n[t];if(e!==void 0){if(typeof e!="string")throw new Error(`Expected a string for ${t}`);if(e!=="declutter"&&e!=="obstacle"&&e!=="none")throw new Error(`Expected declutter, obstacle, or none for ${t}`);return e}}function em(n,t){const e=n[t];if(e!==void 0)return Ic(e,t)}function hs(n,t){if(!Array.isArray(n))throw new Error(`Expected an array for ${t}`);const e=n.length;for(let i=0;i<e;++i)if(typeof n[i]!="number")throw new Error(`Expected an array of numbers for ${t}`);return n}function Tc(n,t){if(typeof n!="string")throw new Error(`Expected a string for ${t}`);return n}function qo(n,t){if(typeof n!="number")throw new Error(`Expected a number for ${t}`);return n}function Ic(n,t){if(typeof n=="string")return n;const e=hs(n,t),i=e.length;if(i<3||i>4)throw new Error(`Expected a color with 3 or 4 values for ${t}`);return e}function Sc(n,t){const e=hs(n,t);if(e.length!==2)throw new Error(`Expected an array of two numbers for ${t}`);return e}function im(n,t){return typeof n=="number"?n:Sc(n,t)}const _e={CENTER:"center",RESOLUTION:"resolution",ROTATION:"rotation"};function bc(n,t,e){return(function(i,s,r,o,a){if(!i)return;if(!s&&!t)return i;const l=t?0:r[0]*s,h=t?0:r[1]*s,c=a?a[0]:0,u=a?a[1]:0;let d=n[0]+l/2+c,f=n[2]-l/2+c,g=n[1]+h/2+u,m=n[3]-h/2+u;d>f&&(d=(f+d)/2,f=d),g>m&&(g=(m+g)/2,m=g);let _=rt(i[0],d,f),p=rt(i[1],g,m);if(o&&e&&s){const y=30*s;_+=-y*Math.log(1+Math.max(0,d-i[0])/y)+y*Math.log(1+Math.max(0,i[0]-f)/y),p+=-y*Math.log(1+Math.max(0,g-i[1])/y)+y*Math.log(1+Math.max(0,i[1]-m)/y)}return[_,p]})}function nm(n){return n}function Lc(n){return Math.pow(n,3)}function fn(n){return 1-Lc(1-n)}function sm(n){return 3*n*n-2*n*n*n}function rm(n){return n}function Jo(n,t,e,i){const s=J(t)/e[0],r=St(t)/e[1];return i?Math.min(n,Math.max(s,r)):Math.min(n,Math.min(s,r))}function Qo(n,t,e){let i=Math.min(n,t);const s=50;return i*=Math.log(1+s*Math.max(0,n/t-1))/s+1,e&&(i=Math.max(i,e),i/=Math.log(1+s*Math.max(0,e/n-1))/s+1),rt(i,e/2,t*2)}function om(n,t,e,i){return t=t!==void 0?t:!0,(function(s,r,o,a){if(s!==void 0){const l=n[0],h=n[n.length-1],c=e?Jo(l,e,o,i):l;if(a)return t?Qo(s,c,h):rt(s,h,c);const u=Math.min(c,s),d=Math.floor(qr(n,u,r));return n[d]>c&&d<n.length-1?n[d+1]:n[d]}})}function am(n,t,e,i,s,r){return i=i!==void 0?i:!0,e=e!==void 0?e:0,(function(o,a,l,h){if(o!==void 0){const c=s?Jo(t,s,l,r):t;if(h)return i?Qo(o,c,e):rt(o,e,c);const u=1e-9,d=Math.ceil(Math.log(t/c)/Math.log(n)-u),f=-a*(.5-u)+.5,g=Math.min(c,o),m=Math.floor(Math.log(t/g)/Math.log(n)+f),_=Math.max(d,m),p=t/Math.pow(n,_);return rt(p,e,c)}})}function Ac(n,t,e,i,s){return e=e!==void 0?e:!0,(function(r,o,a,l){if(r!==void 0){const h=i?Jo(n,i,a,s):n;return!e||!l?rt(r,t,h):Qo(r,h,t)}})}function ta(n){if(n!==void 0)return 0}function Mc(n){if(n!==void 0)return n}function lm(n){const t=2*Math.PI/n;return(function(e,i){if(i)return e;if(e!==void 0)return e=Math.floor(e/t+.5)*t,e})}function hm(n){const t=ei(5);return(function(e,i){return i||e===void 0?e:Math.abs(e)<=t?0:e})}const cm=42,ea=256,ia=0;class xe extends ce{constructor(t){super(),this.on,this.once,this.un,t=Object.assign({},t),this.hints_=[0,0],this.animations_=[],this.updateAnimationKey_,this.projection_=po(t.projection,"EPSG:3857"),this.viewportSize_=[100,100],this.targetCenter_=null,this.targetResolution_,this.targetRotation_,this.nextCenter_=null,this.nextResolution_,this.nextRotation_,this.cancelAnchor_=void 0,t.projection&&sh(),t.center&&(t.center=Pe(t.center,this.projection_)),t.extent&&(t.extent=ii(t.extent,this.projection_)),this.applyOptions_(t)}applyOptions_(t){const e=Object.assign({},t);for(const a in _e)delete e[a];this.setProperties(e,!0);const i=dm(t);this.maxResolution_=i.maxResolution,this.minResolution_=i.minResolution,this.zoomFactor_=i.zoomFactor,this.resolutions_=t.resolutions,this.padding_=t.padding,this.minZoom_=i.minZoom;const s=um(t),r=i.constraint,o=fm(t);this.constraints_={center:s,resolution:r,rotation:o},this.setRotation(t.rotation!==void 0?t.rotation:0),this.setCenterInternal(t.center!==void 0?t.center:null),t.resolution!==void 0?this.setResolution(t.resolution):t.zoom!==void 0&&this.setZoom(t.zoom)}get padding(){return this.padding_}set padding(t){let e=this.padding_;this.padding_=t;const i=this.getCenterInternal();if(i){const s=t||[0,0,0,0];e=e||[0,0,0,0];const r=this.getResolution(),o=r/2*(s[3]-e[3]+e[1]-s[1]),a=r/2*(s[0]-e[0]+e[2]-s[2]);this.setCenterInternal([i[0]+o,i[1]-a])}}getUpdatedOptions_(t){const e=this.getProperties();return e.resolution!==void 0?e.resolution=this.getResolution():e.zoom=this.getZoom(),e.center=this.getCenterInternal(),e.rotation=this.getRotation(),Object.assign({},e,t)}animate(t){this.isDef()&&!this.getAnimating()&&this.resolveConstraints(0);const e=new Array(arguments.length);for(let i=0;i<e.length;++i){let s=arguments[i];s.center&&(s=Object.assign({},s),s.center=Pe(s.center,this.getProjection())),s.anchor&&(s=Object.assign({},s),s.anchor=Pe(s.anchor,this.getProjection())),e[i]=s}this.animateInternal.apply(this,e)}animateInternal(t){let e=arguments.length,i;e>1&&typeof arguments[e-1]=="function"&&(i=arguments[e-1],--e);let s=0;for(;s<e&&!this.isDef();++s){const c=arguments[s];c.center&&this.setCenterInternal(c.center),c.zoom!==void 0?this.setZoom(c.zoom):c.resolution&&this.setResolution(c.resolution),c.rotation!==void 0&&this.setRotation(c.rotation)}if(s===e){i&&Sr(i,!0);return}let r=Date.now(),o=this.targetCenter_.slice(),a=this.targetResolution_,l=this.targetRotation_;const h=[];for(;s<e;++s){const c=arguments[s],u={start:r,complete:!1,anchor:c.anchor,duration:c.duration!==void 0?c.duration:1e3,easing:c.easing||sm,callback:i};if(c.center&&(u.sourceCenter=o,u.targetCenter=c.center.slice(),o=u.targetCenter),c.zoom!==void 0?(u.sourceResolution=a,u.targetResolution=this.getResolutionForZoom(c.zoom),a=u.targetResolution):c.resolution&&(u.sourceResolution=a,u.targetResolution=c.resolution,a=u.targetResolution),c.rotation!==void 0){u.sourceRotation=l;const d=Vi(c.rotation-l+Math.PI,2*Math.PI)-Math.PI;u.targetRotation=l+d,l=u.targetRotation}gm(u)?u.complete=!0:r+=u.duration,h.push(u)}this.animations_.push(h),this.setHint(pt.ANIMATING,1),this.updateAnimations_()}getAnimating(){return this.hints_[pt.ANIMATING]>0}getInteracting(){return this.hints_[pt.INTERACTING]>0}cancelAnimations(){this.setHint(pt.ANIMATING,-this.hints_[pt.ANIMATING]);let t;for(let e=0,i=this.animations_.length;e<i;++e){const s=this.animations_[e];if(s[0].callback&&Sr(s[0].callback,!1),!t)for(let r=0,o=s.length;r<o;++r){const a=s[r];if(!a.complete){t=a.anchor;break}}}this.animations_.length=0,this.cancelAnchor_=t,this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN}updateAnimations_(){if(this.updateAnimationKey_!==void 0&&(cancelAnimationFrame(this.updateAnimationKey_),this.updateAnimationKey_=void 0),!this.getAnimating())return;const t=Date.now();let e=!1;for(let i=this.animations_.length-1;i>=0;--i){const s=this.animations_[i];let r=!0;for(let o=0,a=s.length;o<a;++o){const l=s[o];if(l.complete)continue;const h=t-l.start;let c=l.duration>0?h/l.duration:1;c>=1?(l.complete=!0,c=1):r=!1;const u=l.easing(c);if(l.sourceCenter){const d=l.sourceCenter[0],f=l.sourceCenter[1],g=l.targetCenter[0],m=l.targetCenter[1];this.nextCenter_=l.targetCenter;const _=d+u*(g-d),p=f+u*(m-f);this.targetCenter_=[_,p]}if(l.sourceResolution&&l.targetResolution){const d=u===1?l.targetResolution:l.sourceResolution+u*(l.targetResolution-l.sourceResolution);if(l.anchor){const f=this.getViewportSize_(this.getRotation()),g=this.constraints_.resolution(d,0,f,!0);this.targetCenter_=this.calculateCenterZoom(g,l.anchor)}this.nextResolution_=l.targetResolution,this.targetResolution_=d,this.applyTargetState_(!0)}if(l.sourceRotation!==void 0&&l.targetRotation!==void 0){const d=u===1?Vi(l.targetRotation+Math.PI,2*Math.PI)-Math.PI:l.sourceRotation+u*(l.targetRotation-l.sourceRotation);if(l.anchor){const f=this.constraints_.rotation(d,!0);this.targetCenter_=this.calculateCenterRotate(f,l.anchor)}this.nextRotation_=l.targetRotation,this.targetRotation_=d}if(this.applyTargetState_(!0),e=!0,!l.complete)break}if(r){this.animations_[i]=null,this.setHint(pt.ANIMATING,-1),this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN;const o=s[0].callback;o&&Sr(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]],oo(i,t-this.getRotation()),Vd(i,e)),i}calculateCenterZoom(t,e){let i;const s=this.getCenterInternal(),r=this.getResolution();if(s!==void 0&&r!==void 0){const o=e[0]-t*(e[0]-s[0])/r,a=e[1]-t*(e[1]-s[1])/r;i=[o,a]}return i}getViewportSize_(t){const e=this.viewportSize_;if(t){const i=e[0],s=e[1];return[Math.abs(i*Math.cos(t))+Math.abs(s*Math.sin(t)),Math.abs(i*Math.sin(t))+Math.abs(s*Math.cos(t))]}return e}setViewportSize(t){this.viewportSize_=Array.isArray(t)?t.slice():[100,100],this.getAnimating()||this.resolveConstraints(0)}getCenter(){const t=this.getCenterInternal();return t&&vo(t,this.getProjection())}getCenterInternal(){return this.get(_e.CENTER)}getConstraints(){return this.constraints_}getConstrainResolution(){return this.get("constrainResolution")}getHints(t){return t!==void 0?(t[0]=this.hints_[0],t[1]=this.hints_[1],t):this.hints_.slice()}calculateExtent(t){const e=this.calculateExtentInternal(t);return ah(e,this.getProjection())}calculateExtentInternal(t){t=t||this.getViewportSizeMinusPadding_();const e=this.getCenterInternal();q(e,"The view center is not defined");const i=this.getResolution();q(i!==void 0,"The view resolution is not defined");const s=this.getRotation();return q(s!==void 0,"The view rotation is not defined"),so(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(_e.RESOLUTION)}getResolutions(){return this.resolutions_}getResolutionForExtent(t,e){return this.getResolutionForExtentInternal(ii(t,this.getProjection()),e)}getResolutionForExtentInternal(t,e){e=e||this.getViewportSizeMinusPadding_();const i=J(t)/e[0],s=St(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(_e.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=na(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=qr(this.resolutions_,t,1);e=r,i=this.resolutions_[r],r==this.resolutions_.length-1?s=2:s=i/this.resolutions_[r+1]}else i=this.maxResolution_,s=this.zoomFactor_;return e+Math.log(i/t)/Math.log(s)}getResolutionForZoom(t){if(this.resolutions_?.length){if(this.resolutions_.length===1)return this.resolutions_[0];const e=rt(Math.floor(t),0,this.resolutions_.length-2),i=this.resolutions_[e]/this.resolutions_[e+1];return this.resolutions_[e]/Math.pow(i,rt(t-e,0,1))}return this.maxResolution_/Math.pow(this.zoomFactor_,t-this.minZoom_)}fit(t,e){let i;if(q(Array.isArray(t)||typeof t.getSimplifiedGeometry=="function","Invalid extent or geometry provided as `geometry`"),Array.isArray(t)){q(!Us(t),"Cannot fit empty extent provided as `geometry`");const s=ii(t,this.getProjection());i=Ch(s)}else if(t.getType()==="Circle"){const s=ii(t.getExtent(),this.getProjection());i=Ch(s),i.rotate(this.getRotation(),vi(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=vi(a);d[0]+=(s[1]-s[3])/2*l,d[1]+=(s[0]-s[2])/2*l;const f=d[0]*u-d[1]*c,g=d[1]*u+d[0]*c,m=this.getConstrainedCenter([f,g],l),_=e.callback?e.callback:Fn;e.duration!==void 0?this.animateInternal({resolution:l,center:m,duration:e.duration,easing:e.easing},_):(this.targetResolution_=l,this.targetCenter_=m,this.applyTargetState_(!1,!0),Sr(_,!0))}centerOn(t,e,i){this.centerOnInternal(Pe(t,this.getProjection()),e,i)}centerOnInternal(t,e,i){this.setCenterInternal(na(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=na(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=vo(this.targetCenter_,this.getProjection());this.setCenter([e[0]+t[0],e[1]+t[1]])}adjustCenterInternal(t){const e=this.targetCenter_;this.setCenterInternal([e[0]+t[0],e[1]+t[1]])}adjustResolution(t,e){e=e&&Pe(e,this.getProjection()),this.adjustResolutionInternal(t,e)}adjustResolutionInternal(t,e){const i=this.getAnimating()||this.getInteracting(),s=this.getViewportSize_(this.getRotation()),r=this.constraints_.resolution(this.targetResolution_*t,0,s,i);e&&(this.targetCenter_=this.calculateCenterZoom(r,e)),this.targetResolution_*=t,this.applyTargetState_()}adjustZoom(t,e){this.adjustResolution(Math.pow(this.zoomFactor_,-t),e)}adjustRotation(t,e){e&&(e=Pe(e,this.getProjection())),this.adjustRotationInternal(t,e)}adjustRotationInternal(t,e){const i=this.getAnimating()||this.getInteracting(),s=this.constraints_.rotation(this.targetRotation_+t,i);e&&(this.targetCenter_=this.calculateCenterRotate(s,e)),this.targetRotation_+=t,this.applyTargetState_()}setCenter(t){this.setCenterInternal(t&&Pe(t,this.getProjection()))}setCenterInternal(t){this.targetCenter_=t,this.applyTargetState_()}setHint(t,e){return this.hints_[t]+=e,this.changed(),this.hints_[t]}setResolution(t){this.targetResolution_=t,this.applyTargetState_()}setRotation(t){this.targetRotation_=t,this.applyTargetState_()}setZoom(t){this.setResolution(this.getResolutionForZoom(t))}applyTargetState_(t,e){const i=this.getAnimating()||this.getInteracting()||e,s=this.constraints_.rotation(this.targetRotation_,i),r=this.getViewportSize_(s),o=this.constraints_.resolution(this.targetResolution_,0,r,i),a=this.constraints_.center(this.targetCenter_,o,r,i,this.calculateCenterShift(this.targetCenter_,o,s,r));this.get(_e.ROTATION)!==s&&this.set(_e.ROTATION,s),this.get(_e.RESOLUTION)!==o&&(this.set(_e.RESOLUTION,o),this.set("zoom",this.getZoom(),!0)),(!a||!this.get(_e.CENTER)||!qs(this.get(_e.CENTER),a))&&this.set(_e.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()||!qs(this.getCenterInternal(),l))&&(this.getAnimating()&&this.cancelAnimations(),this.animateInternal({rotation:r,center:l,resolution:a,duration:t,easing:fn,anchor:i}))}beginInteraction(){this.resolveConstraints(0),this.setHint(pt.INTERACTING,1)}endInteraction(t,e,i){i=i&&Pe(i,this.getProjection()),this.endInteractionInternal(t,e,i)}endInteractionInternal(t,e,i){this.getInteracting()&&(this.setHint(pt.INTERACTING,-1),this.resolveConstraints(t,e,i))}getConstrainedCenter(t,e){const i=this.getViewportSize_(this.getRotation());return this.constraints_.center(t,e||this.getResolution(),i)}getConstrainedZoom(t,e){const i=this.getResolutionForZoom(t);return this.getZoomForResolution(this.getConstrainedResolution(i,e))}getConstrainedResolution(t,e){e=e||0;const i=this.getViewportSize_(this.getRotation());return this.constraints_.resolution(t,e,i)}}function Sr(n,t){setTimeout(function(){n(t)},0)}function um(n){if(n.extent!==void 0){const e=n.smoothExtentConstraint!==void 0?n.smoothExtentConstraint:!0;return bc(n.extent,n.constrainOnlyCenter,e)}const t=po(n.projection,"EPSG:3857");if(n.multiWorld!==!0&&t.isGlobal()){const e=t.getExtent().slice();return e[0]=-1/0,e[2]=1/0,bc(e,!1,!1)}return nm}function dm(n){let t,e,i,o=n.minZoom!==void 0?n.minZoom:ia,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=po(n.projection,"EPSG:3857"),f=d.getExtent();let g=n.constrainOnlyCenter,m=n.extent;if(!h&&!m&&d.isGlobal()&&(g=!1,m=f),n.resolutions!==void 0){const _=n.resolutions;e=_[o],i=_[a]!==void 0?_[a]:_[_.length-1],n.constrainResolution?t=om(_,c,!g&&m,u):t=Ac(e,i,c,!g&&m,u)}else{const p=(f?Math.max(J(f),St(f)):360*ao.degrees/d.getMetersPerUnit())/ea/Math.pow(2,ia),y=p/Math.pow(2,28-ia);e=n.maxResolution,e!==void 0?o=0:e=p/Math.pow(l,o),i=n.minResolution,i===void 0&&(n.maxZoom!==void 0?n.maxResolution!==void 0?i=e/Math.pow(l,a):i=p/Math.pow(l,a):i=y),a=o+Math.floor(Math.log(e/i)/Math.log(l)),i=e/Math.pow(l,a-o),n.constrainResolution?t=am(l,e,i,c,!g&&m,u):t=Ac(e,i,c,!g&&m,u)}return{constraint:t,maxResolution:e,minResolution:i,minZoom:o,zoomFactor:l}}function fm(n){if(n.enableRotation!==void 0?n.enableRotation:!0){const e=n.constrainRotation;return e===void 0||e===!0?hm():e===!1?Mc:typeof e=="number"?lm(e):Mc}return ta}function gm(n){return!(n.sourceCenter&&n.targetCenter&&!qs(n.sourceCenter,n.targetCenter)||n.sourceResolution!==n.targetResolution||n.sourceRotation!==n.targetRotation)}function na(n,t,e,i,s){const r=Math.cos(-s);let o=Math.sin(-s),a=n[0]*r-n[1]*o,l=n[1]*r+n[0]*o;a+=(t[0]/2-e[0])*i,l+=(e[1]-t[1]/2)*i,o=-o;const h=a*r-l*o,c=l*r+a*o;return[h,c]}const Q={OPACITY:"opacity",VISIBLE:"visible",EXTENT:"extent",Z_INDEX:"zIndex",MAX_RESOLUTION:"maxResolution",MIN_RESOLUTION:"minResolution",MAX_ZOOM:"maxZoom",MIN_ZOOM:"minZoom",SOURCE:"source",MAP:"map"};class Pc extends ce{constructor(t){super(),this.on,this.once,this.un,this.background_=t.background;const e=Object.assign({},t);typeof t.properties=="object"&&(delete e.properties,Object.assign(e,t.properties)),e[Q.OPACITY]=t.opacity!==void 0?t.opacity:1,q(typeof e[Q.OPACITY]=="number","Layer opacity must be a number"),e[Q.VISIBLE]=t.visible!==void 0?t.visible:!0,e[Q.Z_INDEX]=t.zIndex,e[Q.MAX_RESOLUTION]=t.maxResolution!==void 0?t.maxResolution:1/0,e[Q.MIN_RESOLUTION]=t.minResolution!==void 0?t.minResolution:0,e[Q.MIN_ZOOM]=t.minZoom!==void 0?t.minZoom:-1/0,e[Q.MAX_ZOOM]=t.maxZoom!==void 0?t.maxZoom:1/0,this.className_=e.className!==void 0?e.className:"ol-layer",delete e.className,this.setProperties(e),this.state_=null}getBackground(){return this.background_}getClassName(){return this.className_}getLayerState(t){const e=this.state_||{layer:this,managed:t===void 0?!0:t},i=this.getZIndex();return e.opacity=rt(Math.round(this.getOpacity()*100)/100,0,1),e.visible=this.getVisible(),e.extent=this.getExtent(),e.zIndex=i===void 0&&!e.managed?1/0:i,e.maxResolution=this.getMaxResolution(),e.minResolution=Math.max(this.getMinResolution(),0),e.minZoom=this.getMinZoom(),e.maxZoom=this.getMaxZoom(),this.state_=e,e}getLayersArray(t){return U()}getLayerStatesArray(t){return U()}getExtent(){return this.get(Q.EXTENT)}getMaxResolution(){return this.get(Q.MAX_RESOLUTION)}getMinResolution(){return this.get(Q.MIN_RESOLUTION)}getMinZoom(){return this.get(Q.MIN_ZOOM)}getMaxZoom(){return this.get(Q.MAX_ZOOM)}getOpacity(){return this.get(Q.OPACITY)}getSourceState(){return U()}getVisible(){return this.get(Q.VISIBLE)}getZIndex(){return this.get(Q.Z_INDEX)}setBackground(t){this.background_=t,this.changed()}setExtent(t){this.set(Q.EXTENT,t)}setMaxResolution(t){this.set(Q.MAX_RESOLUTION,t)}setMinResolution(t){this.set(Q.MIN_RESOLUTION,t)}setMaxZoom(t){this.set(Q.MAX_ZOOM,t)}setMinZoom(t){this.set(Q.MIN_ZOOM,t)}setOpacity(t){q(typeof t=="number","Layer opacity must be a number"),this.set(Q.OPACITY,t)}setVisible(t){this.set(Q.VISIBLE,t)}setZIndex(t){this.set(Q.Z_INDEX,t)}disposeInternal(){this.state_&&(this.state_.layer=null,this.state_=null),super.disposeInternal()}}class br extends Pc{constructor(t){const e=Object.assign({},t);delete e.source,super(e),this.on,this.once,this.un,this.mapPrecomposeKey_=null,this.mapRenderKey_=null,this.sourceChangeKey_=null,this.renderer_=null,this.sourceReady_=!1,this.rendered=!1,t.render&&(this.render=t.render),t.map&&this.setMap(t.map),this.addChangeListener(Q.SOURCE,this.handleSourcePropertyChange_);const i=t.source?t.source:null;this.setSource(i)}getLayersArray(t){return t=t||[],t.push(this),t}getLayerStatesArray(t){return t=t||[],t.push(this.getLayerState()),t}getSource(){return this.get(Q.SOURCE)||null}getRenderSource(){return this.getSource()}getSourceState(){const t=this.getSource();return t?t.getState():"undefined"}handleSourceChange_(){this.changed(),!(this.sourceReady_||this.getSource().getState()!=="ready")&&(this.sourceReady_=!0,this.dispatchEvent("sourceready"))}handleSourcePropertyChange_(){this.sourceChangeKey_&&(nt(this.sourceChangeKey_),this.sourceChangeKey_=null),this.sourceReady_=!1;const t=this.getSource();t&&(this.sourceChangeKey_=Z(t,z.CHANGE,this.handleSourceChange_,this),t.getState()==="ready"&&(this.sourceReady_=!0,setTimeout(()=>{this.dispatchEvent("sourceready")},0))),this.changed()}getFeatures(t){return this.renderer_?this.renderer_.getFeatures(t):Promise.resolve([])}getData(t){return!this.renderer_||!this.rendered?null:this.renderer_.getData(t)}isVisible(t){let e;const i=this.getMapInternal();!t&&i&&(t=i.getView()),t instanceof xe?e={viewState:t.getState(),extent:t.calculateExtent()}:e=t,!e.layerStatesArray&&i&&(e.layerStatesArray=i.getLayerGroup().getLayerStatesArray());let s;if(e.layerStatesArray){if(s=e.layerStatesArray.find(o=>o.layer===this),!s)return!1}else s=this.getLayerState();const r=this.getExtent();return sa(s,e.viewState)&&(!r||Ot(r,e.extent))}getAttributions(t){if(!this.isVisible(t))return[];const e=this.getSource()?.getAttributions();if(!e)return[];const i=t instanceof xe?t.getViewStateAndExtent():t;let s=e(i);return Array.isArray(s)||(s=[s]),s}render(t,e){const i=this.getRenderer();return i.prepareFrame(t)?(this.rendered=!0,i.renderFrame(t,e)):null}unrender(){this.rendered=!1}getDeclutter(){}renderDeclutter(t,e){}renderDeferred(t){const e=this.getRenderer();e&&e.renderDeferred(t)}setMapInternal(t){t||this.unrender(),this.set(Q.MAP,t)}getMapInternal(){return this.get(Q.MAP)}setMap(t){this.mapPrecomposeKey_&&(nt(this.mapPrecomposeKey_),this.mapPrecomposeKey_=null),t||this.changed(),this.mapRenderKey_&&(nt(this.mapRenderKey_),this.mapRenderKey_=null),t&&(this.mapPrecomposeKey_=Z(t,te.PRECOMPOSE,this.handlePrecompose_,this),this.mapRenderKey_=Z(this,z.CHANGE,t.render,t),this.changed())}handlePrecompose_(t){const e=t.frameState.layerStatesArray,i=this.getLayerState(!1);q(!e.some(s=>s.layer===i.layer),"A layer can only be added to the map once. Use either `layer.setMap()` or `map.addLayer()`, not both."),e.push(i)}setSource(t){this.set(Q.SOURCE,t)}getRenderer(){return this.renderer_||(this.renderer_=this.createRenderer()),this.renderer_}hasRenderer(){return!!this.renderer_}createRenderer(){return null}clearRenderer(){this.renderer_&&(this.renderer_.dispose(),delete this.renderer_)}disposeInternal(){this.clearRenderer(),this.setSource(null),super.disposeInternal()}}function sa(n,t){if(!n.visible)return!1;const e=t.resolution;if(e<n.minResolution||e>=n.maxResolution)return!1;const i=t.zoom;return i>n.minZoom&&i<=n.maxZoom}const Oc={RENDER_ORDER:"renderOrder"};class Dc extends br{constructor(t){t=t||{};const e=Object.assign({},t);delete e.style,delete e.renderBuffer,delete e.updateWhileAnimating,delete e.updateWhileInteracting,super(e),this.declutter_=t.declutter?String(t.declutter):void 0,this.renderBuffer_=t.renderBuffer!==void 0?t.renderBuffer:100,this.style_=null,this.styleFunction_=void 0,this.setStyle(t.style),this.updateWhileAnimating_=t.updateWhileAnimating!==void 0?t.updateWhileAnimating:!1,this.updateWhileInteracting_=t.updateWhileInteracting!==void 0?t.updateWhileInteracting:!1}getDeclutter(){return this.declutter_}getFeatures(t){return super.getFeatures(t)}getRenderBuffer(){return this.renderBuffer_}getRenderOrder(){return this.get(Oc.RENDER_ORDER)}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}getUpdateWhileAnimating(){return this.updateWhileAnimating_}getUpdateWhileInteracting(){return this.updateWhileInteracting_}renderDeclutter(t,e){const i=this.getDeclutter();i in t.declutter||(t.declutter[i]=new Hh(9)),this.getRenderer().renderDeclutter(t,e)}setRenderOrder(t){this.set(Oc.RENDER_ORDER,t)}setStyle(t){this.style_=t===void 0?ic:t;const e=_m(t);this.styleFunction_=t===null?void 0:Hg(e),this.changed()}setDeclutter(t){this.declutter_=t?String(t):void 0,this.changed()}}function _m(n){if(n===void 0)return ic;if(!n)return null;if(typeof n=="function"||n instanceof ke)return n;if(!Array.isArray(n))return xc([n]);if(n.length===0)return[];const t=n.length,e=n[0];if(e instanceof ke){const s=new Array(t);for(let r=0;r<t;++r){const o=n[r];if(!(o instanceof ke))throw new Error("Expected a list of style instances");s[r]=o}return s}if("style"in e){const s=new Array(t);for(let r=0;r<t;++r){const o=n[r];if(!("style"in o))throw new Error("Expected a list of rules with a style property");s[r]=o}return K_(s)}return xc(n)}class mm extends Dc{constructor(t){super(t)}createRenderer(){return new y_(this)}}const D={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};class ra extends Xs{constructor(t,e,i){super(),i=i||{},this.tileCoord=t,this.state=e,this.key="",this.transition_=i.transition===void 0?250:i.transition,this.transitionStarts_={},this.interpolate=!!i.interpolate}changed(){this.dispatchEvent(z.CHANGE)}release(){this.setState(D.EMPTY)}getKey(){return this.key+"/"+this.tileCoord}getTileCoord(){return this.tileCoord}getState(){return this.state}setState(t){if(this.state!==D.EMPTY){if(this.state!==D.ERROR&&this.state>t)throw new Error("Tile load sequence violation");this.state=t,this.changed()}}load(){U()}getAlpha(t,e){if(!this.transition_)return 1;let i=this.transitionStarts_[t];if(!i)i=e,this.transitionStarts_[t]=i;else if(i===-1)return 1;const s=e-i+1e3/60;return s>=this.transition_?1:Lc(s/this.transition_)}inTransition(t){return this.transition_?this.transitionStarts_[t]!==-1:!1}endTransition(t){this.transition_&&(this.transitionStarts_[t]=-1)}disposeInternal(){this.release(),super.disposeInternal()}}class Fc extends ra{constructor(t,e,i,s,r,o){super(t,e,o),this.crossOrigin_=s,this.src_=i,this.key=i,this.image_,Yt?this.image_=new OffscreenCanvas(1,1):(this.image_=new Image,s!==null&&(this.image_.crossOrigin=s)),this.unlisten_=null,this.tileLoadFunction_=r}getImage(){return this.image_}setImage(t){this.image_=t,this.state=D.LOADED,this.unlistenImage_(),this.changed()}getCrossOrigin(){return this.crossOrigin_}handleImageError_(){this.state=D.ERROR,this.unlistenImage_(),this.image_=pm(),this.changed()}handleImageLoad_(){if(Yt)this.state=D.LOADED;else{const t=this.image_;t.naturalWidth&&t.naturalHeight?this.state=D.LOADED:this.state=D.EMPTY}this.unlistenImage_(),this.changed()}load(){this.state==D.ERROR&&(this.state=D.IDLE,this.image_=new Image,this.crossOrigin_!==null&&(this.image_.crossOrigin=this.crossOrigin_)),this.state==D.IDLE&&(this.state=D.LOADING,this.changed(),this.tileLoadFunction_(this,this.src_),this.unlisten_=dg(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this)))}unlistenImage_(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)}disposeInternal(){this.unlistenImage_(),this.image_=null,super.disposeInternal()}}function pm(){const n=ht(1,1);return n.fillStyle="rgba(0,0,0,0)",n.fillRect(0,0,1,1),n.canvas}class ym{constructor(t,e,i){this.decay_=t,this.minVelocity_=e,this.delay_=i,this.points_=[],this.angle_=0,this.initialVelocity_=0}begin(){this.points_.length=0,this.angle_=0,this.initialVelocity_=0}update(t,e){this.points_.push(t,e,Date.now())}end(){if(this.points_.length<6)return!1;const t=Date.now()-this.delay_,e=this.points_.length-3;if(this.points_[e+2]<t)return!1;let i=e-3;for(;i>0&&this.points_[i+2]>t;)i-=3;const s=this.points_[e+2]-this.points_[i+2];if(s<1e3/60)return!1;const r=this.points_[e]-this.points_[i],o=this.points_[e+1]-this.points_[i+1];return this.angle_=Math.atan2(o,r),this.initialVelocity_=Math.sqrt(r*r+o*o)/s,this.initialVelocity_>this.minVelocity_}getDistance(){return(this.minVelocity_-this.initialVelocity_)/this.decay_}getAngle(){return this.angle_}}class gn extends Me{constructor(t,e,i){super(t),this.map=e,this.frameState=i!==void 0?i:null}}class ci extends gn{constructor(t,e,i,s,r,o){super(t,e,r),this.originalEvent=i,this.pixel_=null,this.coordinate_=null,this.dragging=s!==void 0?s:!1,this.activePointers=o}get pixel(){return this.pixel_||(this.pixel_=this.map.getEventPixel(this.originalEvent)),this.pixel_}set pixel(t){this.pixel_=t}get coordinate(){return this.coordinate_||(this.coordinate_=this.map.getCoordinateFromPixel(this.pixel)),this.coordinate_}set coordinate(t){this.coordinate_=t}preventDefault(){super.preventDefault(),"preventDefault"in this.originalEvent&&this.originalEvent.preventDefault()}stopPropagation(){super.stopPropagation(),"stopPropagation"in this.originalEvent&&this.originalEvent.stopPropagation()}}const ot={SINGLECLICK:"singleclick",CLICK:z.CLICK,DBLCLICK:z.DBLCLICK,POINTERDRAG:"pointerdrag",POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"},oa={POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown"};class Em extends Xs{constructor(t,e){super(t),this.map_=t,this.clickTimeoutId_,this.emulateClicks_=!1,this.dragging_=!1,this.dragListenerKeys_=[],this.moveTolerance_=e===void 0?1:e,this.down_=null;const i=this.map_.getViewport();this.activePointers_=[],this.trackedTouches_={},this.element_=i,this.pointerdownListenerKey_=Z(i,oa.POINTERDOWN,this.handlePointerDown_,this),this.originalPointerMoveEvent_,this.relayedListenerKey_=Z(i,oa.POINTERMOVE,this.relayMoveEvent_,this),this.boundHandleTouchMove_=this.handleTouchMove_.bind(this),this.element_.addEventListener(z.TOUCHMOVE,this.boundHandleTouchMove_,Sh?{passive:!1}:!1)}emulateClick_(t){let e=new ci(ot.CLICK,this.map_,t);this.dispatchEvent(e),this.clickTimeoutId_!==void 0?(clearTimeout(this.clickTimeoutId_),this.clickTimeoutId_=void 0,e=new ci(ot.DBLCLICK,this.map_,t),this.dispatchEvent(e)):this.clickTimeoutId_=setTimeout(()=>{this.clickTimeoutId_=void 0;const i=new ci(ot.SINGLECLICK,this.map_,t);this.dispatchEvent(i)},250)}updateActivePointers_(t){const e=t,i=e.pointerId;if(e.type==ot.POINTERUP||e.type==ot.POINTERCANCEL){delete this.trackedTouches_[i];for(const s in this.trackedTouches_)if(this.trackedTouches_[s].target!==e.target){delete this.trackedTouches_[s];break}}else(e.type==ot.POINTERDOWN||e.type==ot.POINTERMOVE)&&(this.trackedTouches_[i]=e);this.activePointers_=Object.values(this.trackedTouches_)}handlePointerUp_(t){this.updateActivePointers_(t);const e=new ci(ot.POINTERUP,this.map_,t,void 0,void 0,this.activePointers_);this.dispatchEvent(e),this.emulateClicks_&&!e.defaultPrevented&&!this.dragging_&&this.isMouseActionButton_(t)&&this.emulateClick_(this.down_),this.activePointers_.length===0&&(this.dragListenerKeys_.forEach(nt),this.dragListenerKeys_.length=0,this.dragging_=!1,this.down_=null)}isMouseActionButton_(t){return t.button===0}handlePointerDown_(t){this.emulateClicks_=this.activePointers_.length===0,this.updateActivePointers_(t);const e=new ci(ot.POINTERDOWN,this.map_,t,void 0,void 0,this.activePointers_);if(this.dispatchEvent(e),this.down_=new PointerEvent(t.type,t),Object.defineProperty(this.down_,"target",{writable:!1,value:t.target}),this.dragListenerKeys_.length===0){const i=this.map_.getOwnerDocument();this.dragListenerKeys_.push(Z(i,ot.POINTERMOVE,this.handlePointerMove_,this),Z(i,ot.POINTERUP,this.handlePointerUp_,this),Z(this.element_,ot.POINTERCANCEL,this.handlePointerUp_,this)),this.element_.getRootNode&&this.element_.getRootNode()!==i&&this.dragListenerKeys_.push(Z(this.element_.getRootNode(),ot.POINTERUP,this.handlePointerUp_,this))}}handlePointerMove_(t){if(this.isMoving_(t)){this.updateActivePointers_(t),this.dragging_=!0;const e=new ci(ot.POINTERDRAG,this.map_,t,this.dragging_,void 0,this.activePointers_);this.dispatchEvent(e)}}relayMoveEvent_(t){this.originalPointerMoveEvent_=t;const e=!!(this.down_&&this.isMoving_(t));this.dispatchEvent(new ci(ot.POINTERMOVE,this.map_,t,e))}handleTouchMove_(t){const e=this.originalPointerMoveEvent_;(!e||e.defaultPrevented)&&(typeof t.cancelable!="boolean"||t.cancelable===!0)&&t.preventDefault()}isMoving_(t){return this.dragging_||Math.abs(t.clientX-this.down_.clientX)>this.moveTolerance_||Math.abs(t.clientY-this.down_.clientY)>this.moveTolerance_}disposeInternal(){this.relayedListenerKey_&&(nt(this.relayedListenerKey_),this.relayedListenerKey_=null),this.element_.removeEventListener(z.TOUCHMOVE,this.boundHandleTouchMove_),this.pointerdownListenerKey_&&(nt(this.pointerdownListenerKey_),this.pointerdownListenerKey_=null),this.dragListenerKeys_.forEach(nt),this.dragListenerKeys_.length=0,this.element_=null,super.disposeInternal()}}const We={POSTRENDER:"postrender",MOVESTART:"movestart",MOVEEND:"moveend",LOADSTART:"loadstart",LOADEND:"loadend"},yt={LAYERGROUP:"layergroup",SIZE:"size",TARGET:"target",VIEW:"view"},Lr=1/0;class xm{constructor(t,e){this.priorityFunction_=t,this.keyFunction_=e,this.elements_=[],this.priorities_=[],this.queuedElements_={}}clear(){this.elements_.length=0,this.priorities_.length=0,kn(this.queuedElements_)}dequeue(){const t=this.elements_,e=this.priorities_,i=t[0];t.length==1?(t.length=0,e.length=0):(t[0]=t.pop(),e[0]=e.pop(),this.siftUp_(0));const s=this.keyFunction_(i);return delete this.queuedElements_[s],i}enqueue(t){q(!(this.keyFunction_(t)in this.queuedElements_),"Tried to enqueue an `element` that was already added to the queue");const e=this.priorityFunction_(t);return e!=Lr?(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==Lr?delete this.queuedElements_[this.keyFunction_(o)]:(i[s]=l,e[s++]=o);e.length=s,i.length=s,this.heapify_()}}class vm extends xm{constructor(t,e){super(i=>t.apply(null,i),i=>i[0].getKey()),this.boundHandleTileChange_=this.handleTileChange.bind(this),this.tileChangeCallback_=e,this.tilesLoading_=0,this.tilesLoadingKeys_={}}enqueue(t){const e=super.enqueue(t);return e&&t[0].addEventListener(z.CHANGE,this.boundHandleTileChange_),e}getTilesLoading(){return this.tilesLoading_}handleTileChange(t){const e=t.target,i=e.getState();if(i===D.LOADED||i===D.ERROR||i===D.EMPTY){i!==D.ERROR&&e.removeEventListener(z.CHANGE,this.boundHandleTileChange_);const s=e.getKey();s in this.tilesLoadingKeys_&&(delete this.tilesLoadingKeys_[s],--this.tilesLoading_),this.tileChangeCallback_()}}loadMoreTiles(t,e){let i=0;for(;this.tilesLoading_<t&&i<e&&this.getCount()>0;){const s=this.dequeue()[0],r=s.getKey();s.getState()===D.IDLE&&!(r in this.tilesLoadingKeys_)&&(this.tilesLoadingKeys_[r]=!0,++this.tilesLoading_,++i,s.load())}}}function wm(n,t,e,i,s){if(!n||!(e in n.wantedTiles)||!n.wantedTiles[e][t.getKey()])return Lr;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 aa extends ce{constructor(t){super();const e=t.element;e&&!t.target&&!e.style.pointerEvents&&(e.style.pointerEvents="auto"),this.element=e||null,this.target_=null,this.map_=null,this.listenerKeys=[],t.render&&(this.render=t.render),t.target&&this.setTarget(t.target)}disposeInternal(){this.element?.remove(),super.disposeInternal()}getMap(){return this.map_}setMap(t){this.map_&&this.element?.remove();for(let e=0,i=this.listenerKeys.length;e<i;++e)nt(this.listenerKeys[e]);if(this.listenerKeys.length=0,this.map_=t,t){const e=this.target_??t.getOverlayContainerStopEvent();this.element&&e.appendChild(this.element),this.render!==Fn&&this.listenerKeys.push(Z(t,We.POSTRENDER,this.render,this)),t.render()}}render(t){}setTarget(t){this.target_=typeof t=="string"?document.getElementById(t):t}}class Cm extends aa{constructor(t){t=t||{},super({element:document.createElement("div"),render:t.render,target:t.target}),this.ulElement_=document.createElement("ul"),this.collapsed_=t.collapsed!==void 0?t.collapsed:!0,this.userCollapsed_=this.collapsed_,this.overrideCollapsible_=t.collapsible!==void 0,this.collapsible_=t.collapsible!==void 0?t.collapsible:!0,this.collapsible_||(this.collapsed_=!1),this.attributions_=t.attributions;const e=t.className!==void 0?t.className:"ol-attribution",i=t.tipLabel!==void 0?t.tipLabel:"Attributions",s=t.expandClassName!==void 0?t.expandClassName:e+"-expand",r=t.collapseLabel!==void 0?t.collapseLabel:"›",o=t.collapseClassName!==void 0?t.collapseClassName:e+"-collapse";typeof r=="string"?(this.collapseLabel_=document.createElement("span"),this.collapseLabel_.textContent=r,this.collapseLabel_.className=o):this.collapseLabel_=r;const a=t.label!==void 0?t.label:"i";typeof a=="string"?(this.label_=document.createElement("span"),this.label_.textContent=a,this.label_.className=s):this.label_=a;const l=this.collapsible_&&!this.collapsed_?this.collapseLabel_:this.label_;this.toggleButton_=document.createElement("button"),this.toggleButton_.setAttribute("type","button"),this.toggleButton_.setAttribute("aria-expanded",String(!this.collapsed_)),this.toggleButton_.title=i,this.toggleButton_.appendChild(l),this.toggleButton_.addEventListener(z.CLICK,this.handleClick_.bind(this),!1);const h=e+" "+dr+" "+Go+(this.collapsed_&&this.collapsible_?" "+Fh:"")+(this.collapsible_?"":" ol-uncollapsible"),c=this.element;c.className=h,c.appendChild(this.toggleButton_),c.appendChild(this.ulElement_),this.renderedAttributions_=[],this.renderedVisible_=!0}collectSourceAttributions_(t){const e=this.getMap().getAllLayers(),i=new Set(e.flatMap(s=>s.getAttributions(t)));if(this.attributions_!==void 0&&(Array.isArray(this.attributions_)?this.attributions_.forEach(s=>i.add(s)):i.add(this.attributions_)),!this.overrideCollapsible_){const s=!e.some(r=>r.getSource()?.getAttributionsCollapsible()===!1);this.setCollapsible(s)}return Array.from(i)}async updateElement_(t){if(!t){this.renderedVisible_&&(this.element.style.display="none",this.renderedVisible_=!1);return}const e=await Promise.all(this.collectSourceAttributions_(t).map(s=>Nd(()=>s))),i=e.length>0;if(this.renderedVisible_!=i&&(this.element.style.display=i?"":"none",this.renderedVisible_=i),!Qe(e,this.renderedAttributions_)){Lh(this.ulElement_);for(let s=0,r=e.length;s<r;++s){const o=document.createElement("li");o.innerHTML=e[s],this.ulElement_.appendChild(o)}this.renderedAttributions_=e}}handleClick_(t){t.preventDefault(),this.handleToggle_(),this.userCollapsed_=this.collapsed_}handleToggle_(){this.element.classList.toggle(Fh),this.collapsed_?bh(this.collapseLabel_,this.label_):bh(this.label_,this.collapseLabel_),this.collapsed_=!this.collapsed_,this.toggleButton_.setAttribute("aria-expanded",String(!this.collapsed_))}getCollapsible(){return this.collapsible_}setCollapsible(t){this.collapsible_!==t&&(this.collapsible_=t,this.element.classList.toggle("ol-uncollapsible"),this.userCollapsed_&&this.handleToggle_())}setCollapsed(t){this.userCollapsed_=t,!(!this.collapsible_||this.collapsed_===t)&&this.handleToggle_()}getCollapsed(){return this.collapsed_}render(t){this.updateElement_(t.frameState)}}class Rm extends aa{constructor(t){t=t||{},super({element:document.createElement("div"),render:t.render,target:t.target});const e=t.className!==void 0?t.className:"ol-rotate",i=t.label!==void 0?t.label:"⇧",s=t.compassClassName!==void 0?t.compassClassName:"ol-compass";this.label_=null,typeof i=="string"?(this.label_=document.createElement("span"),this.label_.className=s,this.label_.textContent=i):(this.label_=i,this.label_.classList.add(s));const r=t.tipLabel?t.tipLabel:"Reset rotation",o=document.createElement("button");o.className=e+"-reset",o.setAttribute("type","button"),o.title=r,o.appendChild(this.label_),o.addEventListener(z.CLICK,this.handleClick_.bind(this),!1);const a=e+" "+dr+" "+Go,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(ur)}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:fn}):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(ur);!r&&i===0?this.element.classList.add(ur):r&&i!==0&&this.element.classList.remove(ur)}this.label_.style.transform=s}this.rotation_=i}}class Tm extends aa{constructor(t){t=t||{},super({element:document.createElement("div"),target:t.target});const e=t.className!==void 0?t.className:"ol-zoom",i=t.delta!==void 0?t.delta:1,s=t.zoomInClassName!==void 0?t.zoomInClassName:e+"-in",r=t.zoomOutClassName!==void 0?t.zoomOutClassName:e+"-out",o=t.zoomInLabel!==void 0?t.zoomInLabel:"+",a=t.zoomOutLabel!==void 0?t.zoomOutLabel:"–",l=t.zoomInTipLabel!==void 0?t.zoomInTipLabel:"Zoom in",h=t.zoomOutTipLabel!==void 0?t.zoomOutTipLabel:"Zoom out",c=document.createElement("button");c.className=s,c.setAttribute("type","button"),c.title=l,c.appendChild(typeof o=="string"?document.createTextNode(o):o),c.addEventListener(z.CLICK,this.handleClick_.bind(this,i),!1);const u=document.createElement("button");u.className=r,u.setAttribute("type","button"),u.title=h,u.appendChild(typeof a=="string"?document.createTextNode(a):a),u.addEventListener(z.CLICK,this.handleClick_.bind(this,-i),!1);const d=e+" "+dr+" "+Go,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:fn})):i.setZoom(r)}}}function Im(n){n=n||{};const t=new qt;return(n.zoom!==void 0?n.zoom:!0)&&t.push(new Tm(n.zoomOptions)),(n.rotate!==void 0?n.rotate:!0)&&t.push(new Rm(n.rotateOptions)),(n.attribution!==void 0?n.attribution:!0)&&t.push(new Cm(n.attributionOptions)),t}const kc={ACTIVE:"active"};class cs extends ce{constructor(t){super(),this.on,this.once,this.un,t&&t.handleEvent&&(this.handleEvent=t.handleEvent),this.map_=null,this.setActive(!0)}getActive(){return this.get(kc.ACTIVE)}getMap(){return this.map_}handleEvent(t){return!0}setActive(t){this.set(kc.ACTIVE,t)}setMap(t){this.map_=t}}function Sm(n,t,e){const i=n.getCenterInternal();if(i){const s=[i[0]+t[0],i[1]+t[1]];n.animateInternal({duration:e!==void 0?e:250,easing:rm,center:n.getConstrainedCenter(s)})}}function la(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:fn})}class bm extends cs{constructor(t){super(),t=t||{},this.delta_=t.delta?t.delta:1,this.duration_=t.duration!==void 0?t.duration:250}handleEvent(t){let e=!1;if(t.type==ot.DBLCLICK){const i=t.originalEvent,s=t.map,r=t.coordinate,o=i.shiftKey?-this.delta_:this.delta_,a=s.getView();la(a,o,r,this.duration_),i.preventDefault(),e=!0}return!e}}function ha(n){const t=arguments;return function(e){let i=!0;for(let s=0,r=t.length;s<r&&(i=i&&t[s](e),!!i);++s);return i}}const Lm=function(n){const t=n.originalEvent;return t.altKey&&!(t.metaKey||t.ctrlKey)&&t.shiftKey},Am=function(n){const t=n.map.getTargetElement(),e=t.getRootNode(),i=n.map.getOwnerDocument().activeElement;return e instanceof ShadowRoot?e.host.contains(i):t.contains(i)},Nc=function(n){const t=n.map.getTargetElement(),e=t.getRootNode();return(e instanceof ShadowRoot?e.host:t).hasAttribute("tabindex")?Am(n):!0},Mm=Dn,Gc=function(n){const t=n.originalEvent;return"pointerId"in t&&t.button==0&&!(Jf&&Th&&t.ctrlKey)},zc=function(n){const t=n.originalEvent;return!t.altKey&&!(t.metaKey||t.ctrlKey)&&!t.shiftKey},Pm=function(n){const t=n.originalEvent;return Th?t.metaKey:t.ctrlKey},Om=function(n){const t=n.originalEvent;return!t.altKey&&!(t.metaKey||t.ctrlKey)&&t.shiftKey},Xc=function(n){const t=n.originalEvent,e=t.target.tagName;return e!=="INPUT"&&e!=="SELECT"&&e!=="TEXTAREA"&&!t.target.isContentEditable},ca=function(n){const t=n.originalEvent;return"pointerId"in t&&t.pointerType=="mouse"},Dm=function(n){const t=n.originalEvent;return"pointerId"in t&&t.isPrimary&&t.button===0};class us extends cs{constructor(t){t=t||{},super(t),t.handleDownEvent&&(this.handleDownEvent=t.handleDownEvent),t.handleDragEvent&&(this.handleDragEvent=t.handleDragEvent),t.handleMoveEvent&&(this.handleMoveEvent=t.handleMoveEvent),t.handleUpEvent&&(this.handleUpEvent=t.handleUpEvent),t.stopDown&&(this.stopDown=t.stopDown),this.handlingDownUpSequence=!1,this.targetPointers=[]}getPointerCount(){return this.targetPointers.length}handleDownEvent(t){return!1}handleDragEvent(t){}handleEvent(t){if(!t.originalEvent)return!0;let e=!1;if(this.updateTrackedPointers_(t),this.handlingDownUpSequence){if(t.type==ot.POINTERDRAG)this.handleDragEvent(t),t.originalEvent.preventDefault();else if(t.type==ot.POINTERUP){const i=this.handleUpEvent(t);this.handlingDownUpSequence=i&&this.targetPointers.length>0}}else if(t.type==ot.POINTERDOWN){const i=this.handleDownEvent(t);this.handlingDownUpSequence=i,e=this.stopDown(i)}else t.type==ot.POINTERMOVE&&this.handleMoveEvent(t);return!e}handleMoveEvent(t){}handleUpEvent(t){return!1}stopDown(t){return t}updateTrackedPointers_(t){t.activePointers&&(this.targetPointers=t.activePointers)}}function ua(n){const t=n.length;let e=0,i=0;for(let s=0;s<t;s++)e+=n[s].clientX,i+=n[s].clientY;return{clientX:e/t,clientY:i/t}}class Fm extends us{constructor(t){super({stopDown:zs}),t=t||{},this.kinetic_=t.kinetic,this.lastCentroid=null,this.lastPointersCount_,this.panning_=!1;const e=t.condition?t.condition:ha(zc,Dm);this.condition_=t.onFocusOnly?ha(Nc,e):e,this.noKinetic_=!1}handleDragEvent(t){const e=t.map;this.panning_||(this.panning_=!0,e.getView().beginInteraction());const i=this.targetPointers,s=e.getEventPixel(ua(i));if(i.length==this.lastPointersCount_){if(this.kinetic_&&this.kinetic_.update(s[0],s[1]),this.lastCentroid){const r=[this.lastCentroid[0]-s[0],s[1]-this.lastCentroid[1]],a=t.map.getView();jd(r,a.getResolution()),oo(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:fn})}return this.panning_&&(this.panning_=!1,i.endInteraction()),!1}return this.kinetic_&&this.kinetic_.begin(),this.lastCentroid=null,!0}handleDownEvent(t){if(this.targetPointers.length>0&&this.condition_(t)){const i=t.map.getView();return this.lastCentroid=null,i.getAnimating()&&i.cancelAnimations(),this.kinetic_&&this.kinetic_.begin(),this.noKinetic_=this.targetPointers.length>1,!0}return!1}}class km extends us{constructor(t){t=t||{},super({stopDown:zs}),this.condition_=t.condition?t.condition:Lm,this.lastAngle_=void 0,this.duration_=t.duration!==void 0?t.duration:250}handleDragEvent(t){if(!ca(t))return;const e=t.map,i=e.getView();if(i.getConstraints().rotation===ta)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 ca(t)?(t.map.getView().endInteraction(this.duration_),!1):!0}handleDownEvent(t){return ca(t)&&Gc(t)&&this.condition_(t)?(t.map.getView().beginInteraction(),this.lastAngle_=void 0,!0):!1}}class Nm extends Gs{constructor(t){super(),this.geometry_=null,this.element_=document.createElement("div"),this.element_.style.position="absolute",this.element_.style.pointerEvents="auto",this.element_.className="ol-box "+t,this.map_=null,this.startPixel_=null,this.endPixel_=null}disposeInternal(){this.setMap(null)}render_(){const t=this.startPixel_,e=this.endPixel_,i="px",s=this.element_.style;s.left=Math.min(t[0],e[0])+i,s.top=Math.min(t[1],e[1])+i,s.width=Math.abs(e[0]-t[0])+i,s.height=Math.abs(e[1]-t[1])+i}setMap(t){if(this.map_){this.map_.getOverlayContainer().removeChild(this.element_);const e=this.element_.style;e.left="inherit",e.top="inherit",e.width="inherit",e.height="inherit"}this.map_=t,this.map_&&this.map_.getOverlayContainer().appendChild(this.element_)}setPixels(t,e){this.startPixel_=t,this.endPixel_=e,this.createOrUpdateGeometry(),this.render_()}createOrUpdateGeometry(){if(!this.map_)return;const t=this.startPixel_,e=this.endPixel_,s=[t,[t[0],e[1]],e,[e[0],t[1]]].map(this.map_.getCoordinateFromPixelInternal,this.map_);s[4]=s[0].slice(),this.geometry_?this.geometry_.setCoordinates([s]):this.geometry_=new Kn([s])}getGeometry(){return this.geometry_}}const _n={BOXSTART:"boxstart",BOXDRAG:"boxdrag",BOXEND:"boxend",BOXCANCEL:"boxcancel"};class ds extends Me{constructor(t,e,i){super(t),this.coordinate=e,this.mapBrowserEvent=i}}class Gm extends us{constructor(t){super(),this.on,this.once,this.un,t=t??{},this.box_=new Nm(t.className||"ol-dragbox"),this.minArea_=t.minArea??64,t.onBoxEnd&&(this.onBoxEnd=t.onBoxEnd),this.startPixel_=null,this.condition_=t.condition??Gc,this.boxEndCondition_=t.boxEndCondition??this.defaultBoxEndCondition}defaultBoxEndCondition(t,e,i){const s=i[0]-e[0],r=i[1]-e[1];return s*s+r*r>=this.minArea_}getGeometry(){return this.box_.getGeometry()}handleDragEvent(t){this.startPixel_&&(this.box_.setPixels(this.startPixel_,t.pixel),this.dispatchEvent(new ds(_n.BOXDRAG,t.coordinate,t)))}handleUpEvent(t){if(!this.startPixel_)return!1;const e=this.boxEndCondition_(t,this.startPixel_,t.pixel);return e&&this.onBoxEnd(t),this.dispatchEvent(new ds(e?_n.BOXEND:_n.BOXCANCEL,t.coordinate,t)),this.box_.setMap(null),this.startPixel_=null,!1}handleDownEvent(t){return this.condition_(t)?(this.startPixel_=t.pixel,this.box_.setMap(t.map),this.box_.setPixels(this.startPixel_,this.startPixel_),this.dispatchEvent(new ds(_n.BOXSTART,t.coordinate,t)),!0):!1}onBoxEnd(t){}setActive(t){t||(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new ds(_n.BOXCANCEL,this.startPixel_,null)),this.startPixel_=null)),super.setActive(t)}setMap(t){this.getMap()&&(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new ds(_n.BOXCANCEL,this.startPixel_,null)),this.startPixel_=null)),super.setMap(t)}}class zm extends Gm{constructor(t){t=t||{};const e=t.condition?t.condition:Om;super({condition:e,className:t.className||"ol-dragzoom",minArea:t.minArea}),this.duration_=t.duration!==void 0?t.duration:200,this.out_=t.out!==void 0?t.out:!1}onBoxEnd(t){const i=this.getMap().getView();let s=this.getGeometry();if(this.out_){const r=i.rotatedExtentForGeometry(s),o=i.getResolutionForExtentInternal(r),a=i.getResolution()/o;s=s.clone(),s.scale(a*a)}i.fitInternal(s,{duration:this.duration_,easing:fn})}}const Di={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",DOWN:"ArrowDown"};class Xm extends cs{constructor(t){super(),t=t||{},this.defaultCondition_=function(e){return zc(e)&&Xc(e)},this.condition_=t.condition!==void 0?t.condition:this.defaultCondition_,this.duration_=t.duration!==void 0?t.duration:100,this.pixelDelta_=t.pixelDelta!==void 0?t.pixelDelta:128}handleEvent(t){let e=!1;if(t.type==z.KEYDOWN){const i=t.originalEvent,s=i.key;if(this.condition_(t)&&(s==Di.DOWN||s==Di.LEFT||s==Di.RIGHT||s==Di.UP)){const o=t.map.getView(),a=o.getResolution()*this.pixelDelta_;let l=0,h=0;s==Di.DOWN?h=-a:s==Di.LEFT?l=-a:s==Di.RIGHT?l=a:h=a;const c=[l,h];oo(c,o.getRotation()),Sm(o,c,this.duration_),i.preventDefault(),e=!0}}return!e}}class Wm extends cs{constructor(t){super(),t=t||{},this.condition_=t.condition?t.condition:function(e){return!Pm(e)&&Xc(e)},this.delta_=t.delta?t.delta:1,this.duration_=t.duration!==void 0?t.duration:100}handleEvent(t){let e=!1;if(t.type==z.KEYDOWN||t.type==z.KEYPRESS){const i=t.originalEvent,s=i.key;if(this.condition_(t)&&(s==="+"||s==="-")){const r=t.map,o=s==="+"?this.delta_:-this.delta_,a=r.getView();la(a,o,void 0,this.duration_),i.preventDefault(),e=!0}}return!e}}const Ym=40,$m=300;class Km extends cs{constructor(t){t=t||{},super(t),this.totalDelta_=0,this.lastDelta_=0,this.maxDelta_=t.maxDelta!==void 0?t.maxDelta:1,this.duration_=t.duration!==void 0?t.duration:250,this.timeout_=t.timeout!==void 0?t.timeout:80,this.useAnchor_=t.useAnchor!==void 0?t.useAnchor:!0,this.constrainResolution_=t.constrainResolution!==void 0?t.constrainResolution:!1;const e=t.condition?t.condition:Mm;this.condition_=t.onFocusOnly?ha(Nc,e):e,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_,this.mode_=void 0,this.trackpadEventGap_=400,this.trackpadTimeoutId_,this.deltaPerZoom_=300}endInteraction_(){this.trackpadTimeoutId_=void 0;const t=this.getMap();if(!t)return;t.getView().endInteraction(void 0,this.lastDelta_?this.lastDelta_>0?1:-1:0,this.lastAnchor_?t.getCoordinateFromPixel(this.lastAnchor_):null)}handleEvent(t){if(!this.condition_(t)||t.type!==z.WHEEL)return!0;const i=t.map,s=t.originalEvent;s.preventDefault(),this.useAnchor_&&(this.lastAnchor_=t.pixel);let r=s.deltaY;switch(s.deltaMode){case WheelEvent.DOM_DELTA_LINE:r*=Ym;break;case WheelEvent.DOM_DELTA_PAGE:r*=$m;break}if(r===0)return!1;this.lastDelta_=r;const o=Date.now();this.startTime_===void 0&&(this.startTime_=o),(!this.mode_||o-this.startTime_>this.trackpadEventGap_)&&(this.mode_=Math.abs(r)<4?"trackpad":"wheel");const a=i.getView();if(this.mode_==="trackpad"&&!(a.getConstrainResolution()||this.constrainResolution_))return this.trackpadTimeoutId_?clearTimeout(this.trackpadTimeoutId_):(a.getAnimating()&&a.cancelAnimations(),a.beginInteraction()),this.trackpadTimeoutId_=setTimeout(this.endInteraction_.bind(this),this.timeout_),a.adjustZoom(-r/this.deltaPerZoom_,this.lastAnchor_?i.getCoordinateFromPixel(this.lastAnchor_):null),this.startTime_=o,!1;this.totalDelta_+=r;const l=Math.max(this.timeout_-(o-this.startTime_),0);return clearTimeout(this.timeoutId_),this.timeoutId_=setTimeout(this.handleWheelZoom_.bind(this,i),l),!1}handleWheelZoom_(t){const e=t.getView();e.getAnimating()&&e.cancelAnimations();let i=-rt(this.totalDelta_,-this.maxDelta_*this.deltaPerZoom_,this.maxDelta_*this.deltaPerZoom_)/this.deltaPerZoom_;(e.getConstrainResolution()||this.constrainResolution_)&&(i=i?i>0?1:-1:0),la(e,i,this.lastAnchor_?t.getCoordinateFromPixel(this.lastAnchor_):null,this.duration_),this.mode_=void 0,this.totalDelta_=0,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_=void 0}setMouseAnchor(t){this.useAnchor_=t,t||(this.lastAnchor_=null)}}class Bm extends us{constructor(t){t=t||{};const e=t;e.stopDown||(e.stopDown=zs),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!==ta&&(this.anchor_=o.getCoordinateFromPixelInternal(o.getEventPixel(ua(this.targetPointers))),this.rotating_&&(o.render(),a.adjustRotationInternal(e,this.anchor_)))}handleUpEvent(t){return this.targetPointers.length<2?(t.map.getView().endInteraction(this.duration_),!1):!0}handleDownEvent(t){if(this.targetPointers.length>=2){const e=t.map;return this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.handlingDownUpSequence||e.getView().beginInteraction(),!0}return!1}}class Zm extends us{constructor(t){t=t||{};const e=t;e.stopDown||(e.stopDown=zs),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(ua(this.targetPointers))),l.render(),h.adjustResolutionInternal(e,this.anchor_)}handleUpEvent(t){if(this.targetPointers.length<2){const i=t.map.getView(),s=this.lastScaleDelta_>1?1:-1;return i.endInteraction(this.duration_,s),!1}return!0}handleDownEvent(t){if(this.targetPointers.length>=2){const e=t.map;return this.anchor_=null,this.lastDistance_=void 0,this.lastScaleDelta_=1,this.handlingDownUpSequence||e.getView().beginInteraction(),!0}return!1}}function Um(n){n=n||{};const t=new qt,e=new ym(-.005,.05,100);return(n.altShiftDragRotate!==void 0?n.altShiftDragRotate:!0)&&t.push(new km),(n.doubleClickZoom!==void 0?n.doubleClickZoom:!0)&&t.push(new bm({delta:n.zoomDelta,duration:n.zoomDuration})),(n.dragPan!==void 0?n.dragPan:!0)&&t.push(new Fm({onFocusOnly:n.onFocusOnly,kinetic:e})),(n.pinchRotate!==void 0?n.pinchRotate:!0)&&t.push(new Bm),(n.pinchZoom!==void 0?n.pinchZoom:!0)&&t.push(new Zm({duration:n.zoomDuration})),(n.keyboard!==void 0?n.keyboard:!0)&&(t.push(new Xm),t.push(new Wm({delta:n.zoomDelta,duration:n.zoomDuration}))),(n.mouseWheelZoom!==void 0?n.mouseWheelZoom:!0)&&t.push(new Km({onFocusOnly:n.onFocusOnly,duration:n.zoomDuration})),(n.shiftDragZoom!==void 0?n.shiftDragZoom:!0)&&t.push(new zm({duration:n.zoomDuration})),t}const ui={ADDLAYER:"addlayer",REMOVELAYER:"removelayer"};class di extends Me{constructor(t,e){super(t),this.layer=e}}const da={LAYERS:"layers"};class mn extends Pc{constructor(t){t=t||{};const e=Object.assign({},t);delete e.layers;let i=t.layers;super(e),this.on,this.once,this.un,this.layersListenerKeys_=[],this.listenerKeys_={},this.addChangeListener(da.LAYERS,this.handleLayersChanged_),i?Array.isArray(i)?i=new qt(i.slice(),{unique:!0}):q(typeof i.getArray=="function","Expected `layers` to be an array or a `Collection`"):i=new qt(void 0,{unique:!0}),this.setLayers(i)}handleLayerChange_(){this.changed()}handleLayersChanged_(){this.layersListenerKeys_.forEach(nt),this.layersListenerKeys_.length=0;const t=this.getLayers();this.layersListenerKeys_.push(Z(t,Pt.ADD,this.handleLayersAdd_,this),Z(t,Pt.REMOVE,this.handleLayersRemove_,this));for(const i in this.listenerKeys_)this.listenerKeys_[i].forEach(nt);kn(this.listenerKeys_);const e=t.getArray();for(let i=0,s=e.length;i<s;i++){const r=e[i];this.registerLayerListeners_(r),this.dispatchEvent(new di(ui.ADDLAYER,r))}this.changed()}registerLayerListeners_(t){const e=[Z(t,$i.PROPERTYCHANGE,this.handleLayerChange_,this),Z(t,z.CHANGE,this.handleLayerChange_,this)];t instanceof mn&&e.push(Z(t,ui.ADDLAYER,this.handleLayerGroupAdd_,this),Z(t,ui.REMOVELAYER,this.handleLayerGroupRemove_,this)),this.listenerKeys_[V(t)]=e}handleLayerGroupAdd_(t){this.dispatchEvent(new di(ui.ADDLAYER,t.layer))}handleLayerGroupRemove_(t){this.dispatchEvent(new di(ui.REMOVELAYER,t.layer))}handleLayersAdd_(t){const e=t.element;this.registerLayerListeners_(e),this.dispatchEvent(new di(ui.ADDLAYER,e)),this.changed()}handleLayersRemove_(t){const e=t.element,i=V(e);this.listenerKeys_[i].forEach(nt),delete this.listenerKeys_[i],this.dispatchEvent(new di(ui.REMOVELAYER,e)),this.changed()}getLayers(){return this.get(da.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 di(ui.REMOVELAYER,i[s]))}this.set(da.LAYERS,t)}getLayersArray(t){return t=t!==void 0?t:[],this.getLayers().forEach(function(e){e.getLayersArray(t)}),t}getLayerStatesArray(t){const e=t!==void 0?t:[],i=e.length;this.getLayers().forEach(function(o){o.getLayerStatesArray(e)});const s=this.getLayerState();let r=s.zIndex;!t&&s.zIndex===void 0&&(r=0);for(let o=i,a=e.length;o<a;o++){const l=e[o];l.opacity*=s.opacity,l.visible=l.visible&&s.visible,l.maxResolution=Math.min(l.maxResolution,s.maxResolution),l.minResolution=Math.max(l.minResolution,s.minResolution),l.minZoom=Math.max(l.minZoom,s.minZoom),l.maxZoom=Math.min(l.maxZoom,s.maxZoom),s.extent!==void 0&&(l.extent!==void 0?l.extent=wi(l.extent,s.extent):l.extent=s.extent),l.zIndex===void 0&&(l.zIndex=r)}return e}getSourceState(){return"ready"}}class Vm extends Gs{constructor(t){super(),this.map_=t}dispatchRenderEvent(t,e){U()}calculateMatrices2D(t){const e=t.viewState,i=t.coordinateToPixelTransform,s=t.pixelToCoordinateTransform;Oe(i,t.size[0]/2,t.size[1]/2,1/e.resolution,-1/e.resolution,-e.rotation,-e.center[0],-e.center[1]),lh(s,i)}forEachFeatureAtCoordinate(t,e,i,s,r,o,a,l){let h;const c=e.viewState;function u(E,x,v,T){return r.call(o,x,E?v:null,T)}const d=c.projection,f=Bl(t.slice(),d),g=[[0,0]];if(d.canWrapX()&&s){const E=d.getExtent(),x=J(E);g.push([-x,0],[x,0])}const m=e.layerStatesArray,_=m.length,p=[],y=[];for(let E=0;E<g.length;E++)for(let x=_-1;x>=0;--x){const v=m[x],T=v.layer;if(T.hasRenderer()&&sa(v,c)&&a.call(l,T)){const R=T.getRenderer(),I=T.getSource();if(R&&I){const L=I.getWrapX()?f:t,P=u.bind(null,v.managed);y[0]=L[0]+g[E][0],y[1]=L[1]+g[E][1],h=R.forEachFeatureAtCoordinate(y,e,i,P,p)}if(h)return h}}if(p.length===0)return;const w=1/p.length;return p.forEach((E,x)=>E.distanceSq+=x*w),p.sort((E,x)=>E.distanceSq-x.distanceSq),p.some(E=>h=E.callback(E.feature,E.layer,E.geometry)),h}hasFeatureAtCoordinate(t,e,i,s,r,o){return this.forEachFeatureAtCoordinate(t,e,i,s,Dn,this,r,o)!==void 0}getMap(){return this.map_}renderFrame(t){U()}scheduleExpireIconCache(t){ee.canExpireCache()&&t.postRenderFunctions.push(jm)}}function jm(n,t){ee.expire()}class Hm extends Vm{constructor(t){super(t),this.fontChangeListenerKey_=Z(sn,$i.PROPERTYCHANGE,t.redrawText,t),this.element_=Yt?Ah():document.createElement("div");const e=this.element_.style;e.position="absolute",e.width="100%",e.height="100%",e.zIndex="0",this.element_.className=dr+" ol-layers";const i=t.getViewport();i&&i.insertBefore(this.element_,i.firstChild||null),this.children_=[],this.renderedVisible_=!0}dispatchRenderEvent(t,e){const i=this.getMap();if(i.hasListener(t)){const s=new uc(t,void 0,e);i.dispatchEvent(s)}}disposeInternal(){nt(this.fontChangeListenerKey_),this.element_.remove(),super.disposeInternal()}renderFrame(t){if(!t){this.renderedVisible_&&(this.element_.style.display="none",this.renderedVisible_=!1);return}this.calculateMatrices2D(t),this.dispatchRenderEvent(te.PRECOMPOSE,t);const e=t.layerStatesArray.sort((h,c)=>h.zIndex-c.zIndex);e.some(h=>h.layer instanceof Dc&&h.layer.getDeclutter())&&(t.declutter={});const s=t.viewState;this.children_.length=0;const r=[];let o=null;for(let h=0,c=e.length;h<c;++h){const u=e[h];t.layerIndex=h;const d=u.layer,f=d.getSourceState();if(!sa(u,s)||f!="ready"&&f!="undefined"){d.unrender();continue}const g=d.render(t,o);g&&(g!==o&&(this.children_.push(g),o=g),r.push(u))}this.declutter(t,r),ig(this.element_,this.children_);const l=this.getMap().getTargetElement();if(si(l)){const h=l.getContext("2d");for(const c of this.children_){const u=c.firstElementChild||c,d=c.style.backgroundColor;if(d&&(!si(u)||u.width>0)&&(h.fillStyle=d,h.fillRect(0,0,l.width,l.height)),si(u)&&u.width>0){const f=c.style.opacity||u.style.opacity;h.globalAlpha=f===""?1:Number(f);const g=u.style.transform;if(g)h.setTransform(...wo(g));else{const m=parseFloat(u.style.width)/u.width,_=parseFloat(u.style.height)/u.height;h.setTransform(m,0,0,_,0,0)}h.drawImage(u,0,0)}}h.globalAlpha=1,h.setTransform(1,0,0,1,0,0)}this.dispatchRenderEvent(te.POSTCOMPOSE,t),this.renderedVisible_||(this.element_.style.display="",this.renderedVisible_=!0),this.scheduleExpireIconCache(t)}declutter(t,e){if(t.declutter){for(let i=e.length-1;i>=0;--i){const s=e[i],r=s.layer;r.getDeclutter()&&r.renderDeclutter(t,s)}e.forEach(i=>i.layer.renderDeferred(t))}}}function Wc(n){if(n instanceof br){n.setMapInternal(null);return}n instanceof mn&&n.getLayers().forEach(Wc)}function Yc(n,t){if(n instanceof br){n.setMapInternal(t);return}if(n instanceof mn){const e=n.getLayers().getArray();for(let i=0,s=e.length;i<s;++i)Yc(e[i],t)}}let qm=class extends ce{constructor(t){super(),t=t||{},this.on,this.once,this.un;const e=Jm(t);this.renderComplete_=!1,this.loaded_=!0,this.boundHandleBrowserEvent_=this.handleBrowserEvent.bind(this),this.maxTilesLoading_=t.maxTilesLoading!==void 0?t.maxTilesLoading:16,this.pixelRatio_=t.pixelRatio!==void 0?t.pixelRatio:Qf,this.postRenderTimeoutHandle_,this.animationDelayKey_,this.animationDelay_=this.animationDelay_.bind(this),this.coordinateToPixelTransform_=ue(),this.pixelToCoordinateTransform_=ue(),this.frameIndex_=0,this.frameState_=null,this.previousExtent_=null,this.viewPropertyListenerKey_=null,this.viewChangeListenerKey_=null,this.layerGroupPropertyListenerKeys_=null,Yt||(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,Yt||(this.resizeObserver_=new ResizeObserver(()=>this.updateSize())),this.controls=e.controls||(Yt?new qt:Im()),this.interactions=e.interactions||(Yt?new qt:Um({onFocusOnly:!0})),this.overlays_=e.overlays,this.overlayIdIndex_={},this.renderer_=null,this.postRenderFunctions_=[],this.tileQueue_=new vm(this.getTilePriority.bind(this),this.handleTileChange_.bind(this)),this.addChangeListener(yt.LAYERGROUP,this.handleLayerGroupChanged_),this.addChangeListener(yt.VIEW,this.handleViewChanged_),this.addChangeListener(yt.SIZE,this.handleSizeChanged_),this.addChangeListener(yt.TARGET,this.handleTargetChanged_),this.setProperties(e.values);const i=this;t.view&&!(t.view instanceof xe)&&t.view.then(function(s){i.setView(new xe(s))}),this.controls.addEventListener(Pt.ADD,s=>{s.element.setMap(this)}),this.controls.addEventListener(Pt.REMOVE,s=>{s.element.setMap(null)}),this.interactions.addEventListener(Pt.ADD,s=>{s.element.setMap(this)}),this.interactions.addEventListener(Pt.REMOVE,s=>{s.element.setMap(null)}),this.overlays_.addEventListener(Pt.ADD,s=>{this.addOverlayInternal_(s.element)}),this.overlays_.addEventListener(Pt.REMOVE,s=>{const r=s.element.getId();r!==void 0&&delete this.overlayIdIndex_[r.toString()],s.element.setMap(null)}),this.controls.forEach(s=>{s.setMap(this)}),this.interactions.forEach(s=>{s.setMap(this)}),this.overlays_.forEach(this.addOverlayInternal_.bind(this))}addControl(t){this.getControls().push(t)}addInteraction(t){this.getInteractions().push(t)}addLayer(t){this.getLayerGroup().getLayers().push(t)}handleLayerAdd_(t){Yc(t.layer,this)}addOverlay(t){this.getOverlays().push(t)}addOverlayInternal_(t){const e=t.getId();e!==void 0&&(this.overlayIdIndex_[e.toString()]=t),t.setMap(this)}disposeInternal(){this.controls.clear(),this.interactions.clear(),this.overlays_.clear(),this.resizeObserver_?.disconnect(),this.setTarget(null),super.disposeInternal()}forEachFeatureAtPixel(t,e,i){if(!this.frameState_||!this.renderer_)return;const s=this.getCoordinateFromPixelInternal(t);i=i!==void 0?i:{};const r=i.hitTolerance!==void 0?i.hitTolerance:0,o=i.layerFilter!==void 0?i.layerFilter:Dn,a=i.checkWrapped!==!1;return this.renderer_.forEachFeatureAtCoordinate(s,this.frameState_,r,a,e,null,o,null)}getFeaturesAtPixel(t,e){const i=[];return this.forEachFeatureAtPixel(t,function(s){i.push(s)},e),i}getAllLayers(){const t=[];function e(i){i.forEach(function(s){s instanceof mn?e(s.getLayers()):t.push(s)})}return e(this.getLayers()),t}hasFeatureAtPixel(t,e){if(!this.frameState_||!this.renderer_)return!1;const i=this.getCoordinateFromPixelInternal(t);e=e!==void 0?e:{};const s=e.layerFilter!==void 0?e.layerFilter:Dn,r=e.hitTolerance!==void 0?e.hitTolerance:0,o=e.checkWrapped!==!1;return this.renderer_.hasFeatureAtCoordinate(i,this.frameState_,r,o,s,null)}getEventCoordinate(t){return this.getCoordinateFromPixel(this.getEventPixel(t))}getEventCoordinateInternal(t){return this.getCoordinateFromPixelInternal(this.getEventPixel(t))}getEventPixel(t){const i=this.viewport_.getBoundingClientRect(),s=this.getSize(),r=i.width/s[0],o=i.height/s[1],a="changedTouches"in t?t.changedTouches[0]:t;return[(a.clientX-i.left)/r,(a.clientY-i.top)/o]}getTarget(){return this.get(yt.TARGET)}getTargetElement(){return this.targetElement_}getCoordinateFromPixel(t){return vo(this.getCoordinateFromPixelInternal(t),this.getView().getProjection())}getCoordinateFromPixelInternal(t){const e=this.frameState_;return e?dt(e.pixelToCoordinateTransform,t.slice()):null}getControls(){return this.controls}getOverlays(){return this.overlays_}getOverlayById(t){const e=this.overlayIdIndex_[t.toString()];return e!==void 0?e:null}getInteractions(){return this.interactions}getLayerGroup(){return this.get(yt.LAYERGROUP)}setLayers(t){const e=this.getLayerGroup();if(t instanceof qt){e.setLayers(t);return}const i=e.getLayers();i.clear(),i.extend(t)}getLayers(){return this.getLayerGroup().getLayers()}getLoadingOrNotReady(){const t=this.getLayerGroup().getLayerStatesArray();for(let e=0,i=t.length;e<i;++e){const s=t[e];if(!s.visible)continue;const r=s.layer.getRenderer();if(r&&!r.ready)return!0;const o=s.layer.getSource();if(o&&o.loading)return!0}return!1}getPixelFromCoordinate(t){const e=Pe(t,this.getView().getProjection());return this.getPixelFromCoordinateInternal(e)}getPixelFromCoordinateInternal(t){const e=this.frameState_;return e?dt(e.coordinateToPixelTransform,t.slice(0,2)):null}getRenderer(){return this.renderer_}getSize(){return this.get(yt.SIZE)}getView(){return this.get(yt.VIEW)}getViewport(){return this.viewport_}getOverlayContainer(){return this.overlayContainer_}getOverlayContainerStopEvent(){return this.overlayContainerStopEvent_}getOwnerDocument(){const t=this.getTargetElement();return t?t.ownerDocument:document}getTilePriority(t,e,i,s){return wm(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===oa.POINTERDOWN||i===z.WHEEL||i===z.KEYDOWN){const s=this.getOwnerDocument(),r=this.viewport_.getRootNode?this.viewport_.getRootNode():s,o=e.target,a=r instanceof ShadowRoot?r.host===o?r.host.ownerDocument:r:r===s?s.documentElement:r;if(this.overlayContainerStopEvent_.contains(o)||!a.contains(o))return}if(t.frameState=this.frameState_,this.dispatchEvent(t)!==!1){const s=this.getInteractions().getArray().slice();for(let r=s.length-1;r>=0;r--){const o=s[r];if(o.getMap()!==this||!o.getActive()||!this.getTargetElement())continue;if(!o.handleEvent(t)||t.propagationStopped)break}}}handlePostRender(){const t=this.frameState_,e=this.tileQueue_;if(!e.isEmpty()){let s=this.maxTilesLoading_,r=s;if(t){const o=t.viewHints;if(o[pt.ANIMATING]||o[pt.INTERACTING]){const a=Date.now()-t.time>8;s=a?0:8,r=a?0:2}}e.getTilesLoading()<s&&(e.reprioritize(),e.loadMoreTiles(s,r))}t&&this.renderer_&&!t.animate&&(this.renderComplete_?(this.hasListener(te.RENDERCOMPLETE)&&this.renderer_.dispatchRenderEvent(te.RENDERCOMPLETE,t),this.loaded_===!1&&(this.loaded_=!0,this.dispatchEvent(new gn(We.LOADEND,this,t)))):this.loaded_===!0&&(this.loaded_=!1,this.dispatchEvent(new gn(We.LOADSTART,this,t))));const i=this.postRenderFunctions_;if(t)for(let s=0,r=i.length;s<r;++s)i[s](this,t);i.length=0}handleSizeChanged_(){this.getView()&&!this.getView().getAnimating()&&this.getView().resolveConstraints(0),this.render()}handleTargetChanged_(){if(this.mapBrowserEventHandler_){for(let i=0,s=this.targetChangeHandlerKeys_.length;i<s;++i)nt(this.targetChangeHandlerKeys_[i]);this.targetChangeHandlerKeys_=null,this.viewport_.removeEventListener(z.CONTEXTMENU,this.boundHandleBrowserEvent_),this.viewport_.removeEventListener(z.WHEEL,this.boundHandleBrowserEvent_),this.mapBrowserEventHandler_.dispose(),this.mapBrowserEventHandler_=null,this.viewport_.remove()}if(this.targetElement_&&!si(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(si(e)||e.appendChild(this.viewport_),this.renderer_||(this.renderer_=new Hm(this)),!si(e)){this.mapBrowserEventHandler_=new Em(this,this.moveTolerance_);for(const s in ot)this.mapBrowserEventHandler_.addEventListener(ot[s],this.handleMapBrowserEvent.bind(this));this.viewport_.addEventListener(z.CONTEXTMENU,this.boundHandleBrowserEvent_,!1),this.viewport_.addEventListener(z.WHEEL,this.boundHandleBrowserEvent_,Sh?{passive:!1}:!1);let i;if(this.keyboardEventTarget_)i=this.keyboardEventTarget_;else{const s=e.getRootNode();i=s instanceof ShadowRoot?s.host:e}if(this.targetChangeHandlerKeys_=[Z(i,z.KEYDOWN,this.handleBrowserEvent,this),Z(i,z.KEYPRESS,this.handleBrowserEvent,this)],e instanceof HTMLElement){const s=e.getRootNode();s instanceof ShadowRoot&&this.resizeObserver_.observe(s.host),this.resizeObserver_?.observe(e)}}this.updateSize()}}handleTileChange_(){this.render()}handleViewPropertyChanged_(){this.render()}handleViewChanged_(){this.viewPropertyListenerKey_&&(nt(this.viewPropertyListenerKey_),this.viewPropertyListenerKey_=null),this.viewChangeListenerKey_&&(nt(this.viewChangeListenerKey_),this.viewChangeListenerKey_=null);const t=this.getView();t&&(this.updateViewportSize_(this.getSize()),this.viewPropertyListenerKey_=Z(t,$i.PROPERTYCHANGE,this.handleViewPropertyChanged_,this),this.viewChangeListenerKey_=Z(t,z.CHANGE,this.handleViewPropertyChanged_,this),t.resolveConstraints(0)),this.render()}handleLayerGroupChanged_(){this.layerGroupPropertyListenerKeys_&&(this.layerGroupPropertyListenerKeys_.forEach(nt),this.layerGroupPropertyListenerKeys_=null);const t=this.getLayerGroup();t&&(this.handleLayerAdd_(new di("addlayer",t)),this.layerGroupPropertyListenerKeys_=[Z(t,$i.PROPERTYCHANGE,this.render,this),Z(t,z.CHANGE,this.render,this),Z(t,"addlayer",this.handleLayerAdd_,this),Z(t,"removelayer",this.handleLayerRemove_,this)]),this.render()}isRendered(){return!!this.frameState_}animationDelay_(){this.animationDelayKey_=void 0,this.renderFrame_(Date.now())}renderSync(){this.animationDelayKey_&&cancelAnimationFrame(this.animationDelayKey_),this.animationDelay_()}redrawText(){if(!this.frameState_)return;const t=this.frameState_.layerStatesArray;for(let e=0,i=t.length;e<i;++e){const s=t[e].layer;s.hasRenderer()&&s.getRenderer().handleFontsChanged()}}render(){this.renderer_&&this.animationDelayKey_===void 0&&(this.animationDelayKey_=requestAnimationFrame(this.animationDelay_))}removeControl(t){return this.getControls().remove(t)}removeInteraction(t){return this.getInteractions().remove(t)}removeLayer(t){return this.getLayerGroup().getLayers().remove(t)}handleLayerRemove_(t){Wc(t.layer)}removeOverlay(t){return this.getOverlays().remove(t)}renderFrame_(t){const e=this.getSize(),i=this.getView(),s=this.frameState_;let r=null;if(e!==void 0&&ec(e)&&i&&i.isDef()){const o=i.getHints(this.frameState_?this.frameState_.viewHints:void 0),a=i.getState();if(r={animate:!1,coordinateToPixelTransform:this.coordinateToPixelTransform_,declutter:null,extent:so(a.center,a.resolution,a.rotation,e),index:this.frameIndex_++,layerIndex:0,layerStatesArray:this.getLayerGroup().getLayerStatesArray(),pixelRatio:this.pixelRatio_,pixelToCoordinateTransform:this.pixelToCoordinateTransform_,postRenderFunctions:[],size:e,tileQueue:this.tileQueue_,time:t,usedTiles:{},viewState:a,viewHints:o,wantedTiles:{},mapId:V(this),renderTargets:{}},a.nextCenter&&a.nextResolution){const l=isNaN(a.nextRotation)?a.rotation:a.nextRotation;r.nextExtent=so(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_||!Us(this.previousExtent_)&&!Gn(r.extent,this.previousExtent_))&&(this.dispatchEvent(new gn(We.MOVESTART,this,s)),this.previousExtent_=$s(this.previousExtent_)),this.previousExtent_&&!r.viewHints[pt.ANIMATING]&&!r.viewHints[pt.INTERACTING]&&!Gn(r.extent,this.previousExtent_)&&(this.dispatchEvent(new gn(We.MOVEEND,this,r)),Pl(r.extent,this.previousExtent_))),this.dispatchEvent(new gn(We.POSTRENDER,this,r)),this.renderComplete_=(this.hasListener(We.LOADSTART)||this.hasListener(We.LOADEND)||this.hasListener(te.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 di("removelayer",e)),this.set(yt.LAYERGROUP,t)}setSize(t){this.set(yt.SIZE,t)}setTarget(t){this.set(yt.TARGET,t)}setView(t){if(!t||t instanceof xe){this.set(yt.VIEW,t);return}this.set(yt.VIEW,new xe);const e=this;t.then(function(i){e.setView(new xe(i))})}updateSize(){const t=this.getTargetElement();let e;if(t){let s,r;if(si(t))s=t.width,r=t.height;else{const o=getComputedStyle(t);s=t.offsetWidth-parseFloat(o.borderLeftWidth)-parseFloat(o.paddingLeft)-parseFloat(o.paddingRight)-parseFloat(o.borderRightWidth),r=t.offsetHeight-parseFloat(o.borderTopWidth)-parseFloat(o.paddingTop)-parseFloat(o.paddingBottom)-parseFloat(o.borderBottomWidth)}!isNaN(s)&&!isNaN(r)&&(e=[Math.max(0,s),Math.max(0,r)],!ec(e)&&(t.offsetWidth||t.offsetHeight||t.getClientRects().length)&&Kl("No map visible because the map container's width or height are 0."))}const i=this.getSize();e&&(!i||!Qe(e,i))&&(this.setSize(e),this.updateViewportSize_(e))}updateViewportSize_(t){const e=this.getView();e&&e.setViewportSize(t)}};function Jm(n){let t=null;n.keyboardEventTarget!==void 0&&(t=typeof n.keyboardEventTarget=="string"?document.getElementById(n.keyboardEventTarget):n.keyboardEventTarget);const e={},i=n.layers&&typeof n.layers.getLayers=="function"?n.layers:new mn({layers:n.layers});e[yt.LAYERGROUP]=i,e[yt.TARGET]=n.target,e[yt.VIEW]=n.view instanceof xe?n.view:new xe;let s;n.controls!==void 0&&(Array.isArray(n.controls)?s=new qt(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 qt(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 qt(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 qt,{controls:s,interactions:r,keyboardEventTarget:t,overlays:o,values:e}}const Et={ELEMENT:"element",MAP:"map",OFFSET:"offset",POSITION:"position",POSITIONING:"positioning"};class Qm extends ce{constructor(t){super(),this.on,this.once,this.un,this.options=t,this.id=t.id,this.insertFirst=t.insertFirst!==void 0?t.insertFirst:!0,this.stopEvent=t.stopEvent!==void 0?t.stopEvent:!0,this.element=document.createElement("div"),this.element.className=t.className!==void 0?t.className:"ol-overlay-container "+pg,this.element.style.position="absolute",this.element.style.pointerEvents="auto",this.autoPan=t.autoPan===!0?{}:t.autoPan||void 0,this.rendered={transform_:"",visible:!0},this.mapPostrenderListenerKey=null,this.addChangeListener(Et.ELEMENT,this.handleElementChanged),this.addChangeListener(Et.MAP,this.handleMapChanged),this.addChangeListener(Et.OFFSET,this.handleOffsetChanged),this.addChangeListener(Et.POSITION,this.handlePositionChanged),this.addChangeListener(Et.POSITIONING,this.handlePositioningChanged),t.element!==void 0&&this.setElement(t.element),this.setOffset(t.offset!==void 0?t.offset:[0,0]),this.setPositioning(t.positioning||"top-left"),t.position!==void 0&&this.setPosition(t.position)}getElement(){return this.get(Et.ELEMENT)}getId(){return this.id}getMap(){return this.get(Et.MAP)||null}getOffset(){return this.get(Et.OFFSET)}getPosition(){return this.get(Et.POSITION)}getPositioning(){return this.get(Et.POSITIONING)}handleElementChanged(){Lh(this.element);const t=this.getElement();t&&this.element.appendChild(t)}handleMapChanged(){this.mapPostrenderListenerKey&&(this.element?.remove(),nt(this.mapPostrenderListenerKey),this.mapPostrenderListenerKey=null);const t=this.getMap();if(t){this.mapPostrenderListenerKey=Z(t,We.POSTRENDER,this.render,this),this.updatePixelPosition();const e=this.stopEvent?t.getOverlayContainerStopEvent():t.getOverlayContainer();this.insertFirst?e.insertBefore(this.element,e.childNodes[0]||null):e.appendChild(this.element),this.performAutoPan()}}render(){this.updatePixelPosition()}handleOffsetChanged(){this.updatePixelPosition()}handlePositionChanged(){this.updatePixelPosition(),this.performAutoPan()}handlePositioningChanged(){this.updatePixelPosition()}setElement(t){this.set(Et.ELEMENT,t)}setMap(t){this.set(Et.MAP,t)}setOffset(t){this.set(Et.OFFSET,t)}setPosition(t){this.set(Et.POSITION,t)}performAutoPan(){this.autoPan&&this.panIntoView(this.autoPan)}panIntoView(t){const e=this.getMap();if(!e||!e.getTargetElement()||!this.get(Et.POSITION))return;const i=this.getRect(e.getTargetElement(),e.getSize()),s=this.getElement(),r=this.getRect(s,[tg(s),eg(s)]);t=t||{};const o=t.margin===void 0?20:t.margin;if(!Zi(i,r)){const a=r[0]-i[0],l=i[2]-r[2],h=r[1]-i[1],c=i[3]-r[3],u=[0,0];if(a<0?u[0]=a-o:l<0&&(u[0]=Math.abs(l)+o),h<0?u[1]=h-o:c<0&&(u[1]=Math.abs(c)+o),u[0]!==0||u[1]!==0){const d=e.getView().getCenterInternal(),f=e.getPixelFromCoordinateInternal(d);if(!f)return;const g=[f[0]+u[0],f[1]+u[1]],m=t.animation||{};e.getView().animateInternal({center:e.getCoordinateFromPixelInternal(g),duration:m.duration,easing:m.easing})}}}getRect(t,e){const i=t.getBoundingClientRect(),s=i.left+window.pageXOffset,r=i.top+window.pageYOffset;return[s,r,s+e[0],r+e[1]]}setPositioning(t){this.set(Et.POSITIONING,t)}setVisible(t){this.rendered.visible!==t&&(this.element.style.display=t?"":"none",this.rendered.visible=t)}updatePixelPosition(){const t=this.getMap(),e=this.getPosition();if(!t||!t.isRendered()||!e){this.setVisible(!1);return}const i=t.getPixelFromCoordinate(e),s=t.getSize();this.updateRenderedPosition(i,s)}updateRenderedPosition(t,e){const i=this.element.style,s=this.getOffset(),r=this.getPositioning();this.setVisible(!0);const o=`${t[0]+s[0]}px`,a=`${t[1]+s[1]}px`;let l="0%",h="0%";r=="bottom-right"||r=="center-right"||r=="top-right"?l="-100%":(r=="bottom-center"||r=="center-center"||r=="top-center")&&(l="-50%"),r=="bottom-left"||r=="bottom-center"||r=="bottom-right"?h="-100%":(r=="center-left"||r=="center-center"||r=="center-right")&&(h="-50%");const c=`translate(${l}, ${h}) translate(${o}, ${a})`;this.rendered.transform_!=c&&(this.rendered.transform_=c,i.transform=c)}getOptions(){return this.options}}class fa{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 pn(n,t,e,i,s){return s!==void 0?(s.minX=n,s.maxX=t,s.minY=e,s.maxY=i,s):new fa(n,t,e,i)}let ga;const yn=[];function $c(n,t,e,i,s){n.beginPath(),n.moveTo(0,0),n.lineTo(t,e),n.lineTo(i,s),n.closePath(),n.save(),n.clip(),n.fillRect(0,0,Math.max(t,i)+1,Math.max(e,s)),n.restore()}function _a(n,t){return Math.abs(n[t*4]-210)>2||Math.abs(n[t*4+3]-.75*255)>2}function tp(){if(ga===void 0){const n=ht(6,6,yn);n.globalCompositeOperation="lighter",n.fillStyle="rgba(210, 0, 0, 0.75)",$c(n,4,5,4,0),$c(n,4,5,0,5);const t=n.getImageData(0,0,3,3).data;ga=_a(t,0)||_a(t,4)||_a(t,8),lr(n),yn.push(n.canvas)}return ga}function Kc(n,t,e,i){const s=Yn(e,t,n);let r=rh(t,i,e);const o=t.getMetersPerUnit();o!==void 0&&(r*=o);const a=n.getMetersPerUnit();a!==void 0&&(r/=a);const l=n.getExtent();if(!l||Bi(l,s)){const h=rh(n,r,s)/r;isFinite(h)&&h>0&&(r/=h)}return r}function ep(n,t,e,i){const s=vi(e);let r=Kc(n,t,s,i);return(!isFinite(r)||r<=0)&&Gl(e,function(o){return r=Kc(n,t,o,i),isFinite(r)&&r>0}),r}function ip(n,t,e,i,s,r,o,a,l,h,c,u,d,f){const g=ht(Math.round(e*n),Math.round(e*t),yn);if(u||(g.imageSmoothingEnabled=!1),l.length===0)return g.canvas;g.scale(e,e);function m(x){return Math.round(x*e)/e}g.globalCompositeOperation="lighter";const _=Wt();l.forEach(function(x,v,T){kl(_,x.extent)});let p;const y=e/i,w=(u?1:1+Math.pow(2,-24))/y;p=ht(Math.round(J(_)*y),Math.round(St(_)*y),yn),u||(p.imageSmoothingEnabled=!1),l.forEach(function(x,v,T){if(x.image.width>0&&x.image.height>0){if(x.clipExtent){p.save();const A=(x.clipExtent[0]-_[0])*y,b=-(x.clipExtent[3]-_[3])*y,M=J(x.clipExtent)*y,Y=St(x.clipExtent)*y;p.rect(u?A:Math.round(A),u?b:Math.round(b),u?M:Math.round(A+M)-Math.round(A),u?Y:Math.round(b+Y)-Math.round(b)),p.clip()}const R=(x.extent[0]-_[0])*y,I=-(x.extent[3]-_[3])*y,L=J(x.extent)*y,P=St(x.extent)*y;p.drawImage(x.image,h,h,x.image.width-2*h,x.image.height-2*h,u?R:Math.round(R),u?I:Math.round(I),u?L:Math.round(R+L)-Math.round(R),u?P:Math.round(I+P)-Math.round(I)),x.clipExtent&&p.restore()}});const E=Ci(o);return a.getTriangles().forEach(function(x,v,T){const R=x.source,I=x.target;let L=R[0][0],P=R[0][1],A=R[1][0],b=R[1][1],M=R[2][0],Y=R[2][1];const k=m((I[0][0]-E[0])/r),G=m(-(I[0][1]-E[1])/r),F=m((I[1][0]-E[0])/r),$=m(-(I[1][1]-E[1])/r),B=m((I[2][0]-E[0])/r),et=m(-(I[2][1]-E[1])/r),S=L,xt=P;L=0,P=0,A-=S,b-=xt,M-=S,Y-=xt;const Lt=[[A,b,0,0,F-k],[M,Y,0,0,B-k],[0,0,A,b,$-G],[0,0,M,Y,et-G]],lt=Zd(Lt);if(!lt)return;if(g.save(),g.beginPath(),tp()||!u){g.moveTo(F,$);const vt=4,ve=k-F,me=G-$;for(let Kt=0;Kt<vt;Kt++)g.lineTo(F+m((Kt+1)*ve/vt),$+m(Kt*me/(vt-1))),Kt!=vt-1&&g.lineTo(F+m((Kt+1)*ve/vt),$+m((Kt+1)*me/(vt-1)));g.lineTo(B,et)}else g.moveTo(F,$),g.lineTo(k,G),g.lineTo(B,et);g.clip(),g.transform(lt[0],lt[2],lt[1],lt[3],k,G),g.translate(_[0]-S,_[3]-xt);let $t;if(p)$t=p.canvas,g.scale(w,-w);else{const vt=l[0],ve=vt.extent;$t=vt.image,g.scale(J(ve)/$t.width,-St(ve)/$t.height)}g.drawImage($t,0,0),g.restore()}),p&&(lr(p),yn.push(p.canvas)),c&&(g.save(),g.globalCompositeOperation="source-over",g.strokeStyle="black",g.lineWidth=1,a.getTriangles().forEach(function(x,v,T){const R=x.target,I=(R[0][0]-E[0])/r,L=-(R[0][1]-E[1])/r,P=(R[1][0]-E[0])/r,A=-(R[1][1]-E[1])/r,b=(R[2][0]-E[0])/r,M=-(R[2][1]-E[1])/r;g.beginPath(),g.moveTo(P,A),g.lineTo(I,L),g.lineTo(b,M),g.closePath(),g.stroke()}),g.restore()),g.canvas}const np=10,Bc=.25;class sp{constructor(t,e,i,s,r,o,a){this.sourceProj_=t,this.targetProj_=e;let l={};const h=a?Rf(w=>dt(a,Yn(w,this.targetProj_,this.sourceProj_))):sr(this.targetProj_,this.sourceProj_);this.transformInv_=function(w){const E=w[0]+"/"+w[1];return l[E]||(l[E]=h(w)),l[E]},this.maxSourceExtent_=s,this.errorThresholdSquared_=r*r,this.triangles_=[],this.wrapsXInSource_=!1,this.canWrapXInSource_=this.sourceProj_.canWrapX()&&!!s&&!!this.sourceProj_.getExtent()&&J(s)>=J(this.sourceProj_.getExtent()),this.sourceWorldWidth_=this.sourceProj_.getExtent()?J(this.sourceProj_.getExtent()):null,this.targetWorldWidth_=this.targetProj_.getExtent()?J(this.targetProj_.getExtent()):null;const c=Ci(i),u=Zs(i),d=Bs(i),f=Ks(i),g=this.transformInv_(c),m=this.transformInv_(u),_=this.transformInv_(d),p=this.transformInv_(f),y=np+(o?Math.max(0,Math.ceil(Math.log2(no(i)/(o*o*256*256)))):0);if(this.addQuad_(c,u,d,f,g,m,_,p,y),this.wrapsXInSource_){let w=1/0;this.triangles_.forEach(function(E,x,v){w=Math.min(w,E.source[0][0],E.source[1][0],E.source[2][0])}),this.triangles_.forEach(E=>{if(Math.max(E.source[0][0],E.source[1][0],E.source[2][0])-w>this.sourceWorldWidth_/2){const x=[[E.source[0][0],E.source[0][1]],[E.source[1][0],E.source[1][1]],[E.source[2][0],E.source[2][1]]];x[0][0]-w>this.sourceWorldWidth_/2&&(x[0][0]-=this.sourceWorldWidth_),x[1][0]-w>this.sourceWorldWidth_/2&&(x[1][0]-=this.sourceWorldWidth_),x[2][0]-w>this.sourceWorldWidth_/2&&(x[2][0]-=this.sourceWorldWidth_);const v=Math.min(x[0][0],x[1][0],x[2][0]);Math.max(x[0][0],x[1][0],x[2][0])-v<this.sourceWorldWidth_/2&&(E.source=x)}})}l={}}addTriangle_(t,e,i,s,r,o){this.triangles_.push({source:[s,r,o],target:[t,e,i]})}addQuad_(t,e,i,s,r,o,a,l,h){const c=Ml([r,o,a,l]),u=this.sourceWorldWidth_?J(c)/this.sourceWorldWidth_:null,d=this.sourceWorldWidth_,f=this.sourceProj_.canWrapX()&&u>.5&&u<1;let g=!1;if(h>0){if(this.targetProj_.isGlobal()&&this.targetWorldWidth_){const _=Ml([t,e,i,s]);g=J(_)/this.targetWorldWidth_>Bc||g}!f&&this.sourceProj_.isGlobal()&&u&&(g=u>Bc||g)}if(!g&&this.maxSourceExtent_&&isFinite(c[0])&&isFinite(c[1])&&isFinite(c[2])&&isFinite(c[3])&&!Ot(c,this.maxSourceExtent_))return;let m=0;if(!g&&(!isFinite(r[0])||!isFinite(r[1])||!isFinite(o[0])||!isFinite(o[1])||!isFinite(a[0])||!isFinite(a[1])||!isFinite(l[0])||!isFinite(l[1]))){if(h>0)g=!0;else if(m=(!isFinite(r[0])||!isFinite(r[1])?8:0)+(!isFinite(o[0])||!isFinite(o[1])?4:0)+(!isFinite(a[0])||!isFinite(a[1])?2:0)+(!isFinite(l[0])||!isFinite(l[1])?1:0),m!=1&&m!=2&&m!=4&&m!=8)return}if(h>0){if(!g){const _=[(t[0]+i[0])/2,(t[1]+i[1])/2],p=this.transformInv_(_);let y;f?y=(Vi(r[0],d)+Vi(a[0],d))/2-Vi(p[0],d):y=(r[0]+a[0])/2-p[0];const w=(r[1]+a[1])/2-p[1];g=y*y+w*w>this.errorThresholdSquared_}if(g){if(Math.abs(t[0]-i[0])<=Math.abs(t[1]-i[1])){const _=[(e[0]+i[0])/2,(e[1]+i[1])/2],p=this.transformInv_(_),y=[(s[0]+t[0])/2,(s[1]+t[1])/2],w=this.transformInv_(y);this.addQuad_(t,e,_,y,r,o,p,w,h-1),this.addQuad_(y,_,i,s,w,p,a,l,h-1)}else{const _=[(t[0]+e[0])/2,(t[1]+e[1])/2],p=this.transformInv_(_),y=[(i[0]+s[0])/2,(i[1]+s[1])/2],w=this.transformInv_(y);this.addQuad_(t,_,y,s,r,p,w,l,h-1),this.addQuad_(_,e,i,y,p,o,a,w,h-1)}return}}if(f){if(!this.canWrapXInSource_)return;this.wrapsXInSource_=!0}(m&11)==0&&this.addTriangle_(t,i,s,r,a,l),(m&14)==0&&this.addTriangle_(t,i,e,r,a,o),m&&((m&13)==0&&this.addTriangle_(e,s,t,o,l,r),(m&7)==0&&this.addTriangle_(e,s,i,o,l,a))}calculateSourceExtent(){const t=Wt();return this.triangles_.forEach(function(e,i,s){const r=e.source;zn(t,r[0]),zn(t,r[1]),zn(t,r[2])}),t}getTriangles(){return this.triangles_}}const rp=.5;class Zc extends ra{constructor(t,e,i,s,r,o,a,l,h,c,u,d){super(r,D.IDLE,d),this.renderEdges_=u!==void 0?u:!1,this.pixelRatio_=a,this.gutter_=l,this.canvas_=null,this.sourceTileGrid_=e,this.targetTileGrid_=s,this.wrappedTileCoord_=o||r,this.sourceTiles_=[],this.sourcesListenerKeys_=null,this.sourceZ_=0,this.clipExtent_=t.canWrapX()?t.getExtent():void 0;const f=s.getTileCoordExtent(this.wrappedTileCoord_),g=this.targetTileGrid_.getExtent();let m=this.sourceTileGrid_.getExtent();const _=g?wi(f,g):f;if(no(_)===0){this.state=D.EMPTY;return}const p=t.getExtent();p&&(m?m=wi(m,p):m=p);const y=s.getResolution(this.wrappedTileCoord_[0]),w=ep(t,i,_,y);if(!isFinite(w)||w<=0){this.state=D.EMPTY;return}const E=c!==void 0?c:rp;if(this.triangulation_=new sp(t,i,_,m,w*E,y),this.triangulation_.getTriangles().length===0){this.state=D.EMPTY;return}this.sourceZ_=e.getZForResolution(w);let x=this.triangulation_.calculateSourceExtent();if(m&&(t.canWrapX()?(x[1]=rt(x[1],m[1],m[3]),x[3]=rt(x[3],m[1],m[3])):x=wi(x,m)),!no(x))this.state=D.EMPTY;else{let v=0,T=0;t.canWrapX()&&(v=J(p),T=Math.floor((x[0]-p[0])/v)),Wl(x.slice(),t,!0).forEach(I=>{const L=e.getTileRangeForExtentAndZ(I,this.sourceZ_);for(let P=L.minX;P<=L.maxX;P++)for(let A=L.minY;A<=L.maxY;A++){const b=h(this.sourceZ_,P,A,a);if(b){const M=T*v;this.sourceTiles_.push({tile:b,offset:M})}}++T}),this.sourceTiles_.length===0&&(this.state=D.EMPTY)}}getImage(){return this.canvas_}reproject_(){const t=[];if(this.sourceTiles_.forEach(e=>{const i=e.tile;if(i&&i.getState()==D.LOADED){const s=this.sourceTileGrid_.getTileCoordExtent(i.tileCoord);s[0]+=e.offset,s[2]+=e.offset;const r=this.clipExtent_?.slice();r&&(r[0]+=e.offset,r[2]+=e.offset),t.push({extent:s,clipExtent:r,image:i.getImage()})}}),this.sourceTiles_.length=0,t.length===0)this.state=D.ERROR;else{const e=this.wrappedTileCoord_[0],i=this.targetTileGrid_.getTileSize(e),s=typeof i=="number"?i:i[0],r=typeof i=="number"?i:i[1],o=this.targetTileGrid_.getResolution(e),a=this.sourceTileGrid_.getResolution(this.sourceZ_),l=this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_);this.canvas_=ip(s,r,this.pixelRatio_,a,this.sourceTileGrid_.getExtent(),o,l,this.triangulation_,t,this.gutter_,this.renderEdges_,this.interpolate),this.state=D.LOADED}this.changed()}load(){if(this.state==D.IDLE){this.state=D.LOADING,this.changed();let t=0;this.sourcesListenerKeys_=[],this.sourceTiles_.forEach(({tile:e})=>{const i=e.getState();if(i==D.IDLE||i==D.LOADING){t++;const s=Z(e,z.CHANGE,r=>{const o=e.getState();(o==D.LOADED||o==D.ERROR||o==D.EMPTY)&&(nt(s),t--,t===0&&(this.unlistenSources_(),this.reproject_()))});this.sourcesListenerKeys_.push(s)}}),t===0?setTimeout(this.reproject_.bind(this),0):this.sourceTiles_.forEach(function({tile:e},i,s){e.getState()==D.IDLE&&e.load()})}}unlistenSources_(){this.sourcesListenerKeys_.forEach(nt),this.sourcesListenerKeys_=null}release(){this.canvas_&&(lr(this.canvas_.getContext("2d")),yn.push(this.canvas_),this.canvas_=null),super.release()}}function Ar(n,t,e,i){return i!==void 0?(i[0]=n,i[1]=t,i[2]=e,i):[n,t,e]}function op(n,t,e){return n+"/"+t+"/"+e}function Mr(n,t,e,i,s){return`${V(n)},${t},${op(e,i,s)}`}function ap(n){return lp(n[0],n[1],n[2])}function lp(n,t,e){return(t<<n)+e}function hp(n,t){const e=n[0],i=n[1],s=n[2];if(t.getMinZoom()>e||e>t.getMaxZoom())return!1;const r=t.getFullTileRange(e);return r?r.containsXY(i,s):!0}const En=[0,0,0],fi=5;class Uc{constructor(t){this.minZoom=t.minZoom!==void 0?t.minZoom:0,this.resolutions_=t.resolutions,q(kd(this.resolutions_,(s,r)=>r-s),"`resolutions` must be sorted in descending order");let e;if(!t.origins){for(let s=0,r=this.resolutions_.length-1;s<r;++s)if(!e)e=this.resolutions_[s]/this.resolutions_[s+1];else if(this.resolutions_[s]/this.resolutions_[s+1]!==e){e=void 0;break}}this.zoomFactor_=e,this.maxZoom=this.resolutions_.length-1,this.origin_=t.origin!==void 0?t.origin:null,this.origins_=null,t.origins!==void 0&&(this.origins_=t.origins,q(this.origins_.length==this.resolutions_.length,"Number of `origins` and `resolutions` must be equal"));const i=t.extent;i!==void 0&&!this.origin_&&!this.origins_&&(this.origin_=Ci(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:ea,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 fa(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=pn(o,o,a,a,i)):r=this.getTileRangeForExtentAndZ(l,h,i),e(h,r))return!0;--h}return!1}getExtent(){return this.extent_}getMaxZoom(){return this.maxZoom}getMinZoom(){return this.minZoom}getOrigin(t){return this.origin_?this.origin_:this.origins_[t]}getResolution(t){return this.resolutions_[t]}getResolutions(){return this.resolutions_}getTileCoordChildTileRange(t,e,i){if(t[0]<this.maxZoom){if(this.zoomFactor_===2){const r=t[1]*2,o=t[2]*2;return pn(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 pn(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 pn(h,h,c,c,i);const u=Math.floor(l*(r+1))-1,d=Math.floor(l*(o+1))-1;return pn(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,En);const s=En[1],r=En[2];this.getTileCoordForXYAndZ_(t[2],t[1],e,!0,En);const o=En[1],a=En[2];return pn(s,o,r,a,i)}getTileCoordCenter(t){const e=this.getOrigin(t[0]),i=this.getResolution(t[0]),s=kt(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=kt(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 ti(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=kt(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=Hs(c,fi)-1,u=Hs(u,fi)-1):(c=js(c,fi),u=js(u,fi)),Ar(o,c,u,r)}getTileCoordForXYAndZ_(t,e,i,s,r){const o=this.getOrigin(i),a=this.getResolution(i),l=kt(this.getTileSize(i),this.tmpSize_);let h=(t-o[0])/a/l[0],c=(o[1]-e)/a/l[1];return s?(h=Hs(h,fi)-1,c=Hs(c,fi)-1):(h=js(h,fi),c=js(c,fi)),Ar(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=qr(this.resolutions_,t,e||0);return rt(i,this.minZoom,this.maxZoom)}tileCoordIntersectsViewport(t,e){return vh(e,0,e.length,2,this.getTileCoordExtent(t))}calculateTileRanges_(t){const e=this.resolutions_.length,i=new Array(e);for(let s=this.minZoom;s<e;++s)i[s]=this.getTileRangeForExtentAndZ(t,s);this.fullTileRanges_=i}}function Vc(n){let t=n.getDefaultTileGrid();return t||(t=fp(n),n.setDefaultTileGrid(t)),t}function cp(n,t,e){const i=t[0],s=n.getTileCoordCenter(t),r=ma(e);if(!Bi(r,s)){const o=J(r),a=Math.ceil((r[0]-s[0])/o);return s[0]+=o*a,n.getTileCoordForCoordAndZ(s,i)}return t}function up(n,t,e,i){i=i!==void 0?i:"top-left";const s=jc(n,t,e);return new Uc({extent:n,origin:Yd(n,i),resolutions:s,tileSize:e})}function dp(n){const t=n||{},e=t.extent||Dt("EPSG:3857").getExtent(),i={extent:e,minZoom:t.minZoom,tileSize:t.tileSize,resolutions:jc(e,t.maxZoom,t.tileSize,t.maxResolution)};return new Uc(i)}function jc(n,t,e,i){t=t!==void 0?t:cm,e=kt(e!==void 0?e:ea);const s=St(n),r=J(n);i=i>0?i:Math.max(r/e[0],s/e[1]);const o=t+1,a=new Array(o);for(let l=0;l<o;++l)a[l]=i/Math.pow(2,l);return a}function fp(n,t,e,i){const s=ma(n);return up(s,t,e,i)}function ma(n){n=Dt(n);let t=n.getExtent();if(!t){const e=180*ao.degrees/n.getMetersPerUnit();t=ti(-e,-e,e,e)}return t}const gp=/\{z\}/g,_p=/\{x\}/g,mp=/\{y\}/g,pp=/\{-y\}/g;function yp(n,t,e,i,s){return n.replace(gp,t.toString()).replace(_p,e.toString()).replace(mp,i.toString()).replace(pp,function(){if(s===void 0)throw new Error("If the URL template has a {-y} placeholder, the grid extent must be known");return(s-i).toString()})}function Ep(n){const t=[];let e=/\{([a-z])-([a-z])\}/.exec(n);if(e){const i=e[1].charCodeAt(0),s=e[2].charCodeAt(0);let r;for(r=i;r<=s;++r)t.push(n.replace(e[0],String.fromCharCode(r)));return t}if(e=/\{(\d+)-(\d+)\}/.exec(n),e){const i=parseInt(e[2],10);for(let s=parseInt(e[1],10);s<=i;s++)t.push(n.replace(e[0],s.toString()));return t}return t.push(n),t}function xp(n,t){return(function(e,i,s){if(!e)return;let r;const o=e[0];if(t){const a=t.getFullTileRange(o);a&&(r=a.getHeight()-1)}return yp(n,o,e[1],e[2],r)})}function vp(n,t){const e=n.length,i=new Array(e);for(let s=0;s<e;++s)i[s]=xp(n[s],t);return wp(i)}function wp(n){return n.length===1?n[0]:(function(t,e,i){if(!t)return;const s=ap(t),r=Vi(s,n.length);return n[r](t,e,i)})}class Cp extends Qh{constructor(t){super({attributions:t.attributions,attributionsCollapsible:t.attributionsCollapsible,projection:t.projection,state:t.state,wrapX:t.wrapX,interpolate:t.interpolate}),this.on,this.once,this.un,this.tilePixelRatio_=t.tilePixelRatio!==void 0?t.tilePixelRatio:1,this.tileGrid=t.tileGrid!==void 0?t.tileGrid:null;const e=[256,256];this.tileGrid&&kt(this.tileGrid.getTileSize(this.tileGrid.getMinZoom()),e),this.tmpSize=[0,0],this.key_=t.key||V(this),this.tileOptions={transition:t.transition,interpolate:t.interpolate},this.zDirection=t.zDirection?t.zDirection:0}getGutterForProjection(t){return 0}getKey(){return this.key_}setKey(t){this.key_!==t&&(this.key_=t,this.changed())}getResolutions(t){const e=t?this.getTileGridForProjection(t):this.tileGrid;return e?e.getResolutions():null}getTile(t,e,i,s,r,o){return U()}getTileGrid(){return this.tileGrid}getTileGridForProjection(t){return this.tileGrid?this.tileGrid:Vc(t)}getTilePixelRatio(t){return this.tilePixelRatio_}getTilePixelSize(t,e,i){const s=this.getTileGridForProjection(i),r=this.getTilePixelRatio(e),o=kt(s.getTileSize(t),this.tmpSize);return r==1?o:jg(o,r,this.tmpSize)}getTileCoordForTileUrlFunction(t,e){const i=e!==void 0?e:this.getProjection(),s=e!==void 0?this.getTileGridForProjection(i):this.tileGrid||this.getTileGridForProjection(i);return this.getWrapX()&&i.isGlobal()&&(t=cp(s,t,i)),hp(t,s)?t:null}clear(){}refresh(){this.clear(),super.refresh()}}class Rp extends Me{constructor(t,e){super(t),this.tile=e}}const pa={TILELOADSTART:"tileloadstart",TILELOADEND:"tileloadend",TILELOADERROR:"tileloaderror"};class ya extends Cp{constructor(t){super({attributions:t.attributions,cacheSize:t.cacheSize,projection:t.projection,state:t.state,tileGrid:t.tileGrid,tilePixelRatio:t.tilePixelRatio,wrapX:t.wrapX,transition:t.transition,interpolate:t.interpolate,key:t.key,attributionsCollapsible:t.attributionsCollapsible,zDirection:t.zDirection}),this.generateTileUrlFunction_=this.tileUrlFunction===ya.prototype.tileUrlFunction,this.tileLoadFunction=t.tileLoadFunction,t.tileUrlFunction&&(this.tileUrlFunction=t.tileUrlFunction),this.urls=null,t.urls?this.setUrls(t.urls):t.url&&this.setUrl(t.url),this.tileLoadingKeys_={}}getTileLoadFunction(){return this.tileLoadFunction}getTileUrlFunction(){return Object.getPrototypeOf(this).tileUrlFunction===this.tileUrlFunction?this.tileUrlFunction.bind(this):this.tileUrlFunction}getUrls(){return this.urls}handleTileChange(t){const e=t.target,i=V(e),s=e.getState();let r;s==D.LOADING?(this.tileLoadingKeys_[i]=!0,r=pa.TILELOADSTART):i in this.tileLoadingKeys_&&(delete this.tileLoadingKeys_[i],r=s==D.ERROR?pa.TILELOADERROR:s==D.LOADED?pa.TILELOADEND:void 0),r!=null&&this.dispatchEvent(new Rp(r,e))}setTileLoadFunction(t){this.tileLoadFunction=t,this.changed()}setTileUrlFunction(t,e){this.tileUrlFunction=t,typeof e<"u"?this.setKey(e):this.changed()}setUrl(t){const e=Ep(t);this.urls=e,this.setUrls(e)}setUrls(t){this.urls=t;const e=t.join(`
|
|
8
|
-
`);this.generateTileUrlFunction_?this.setTileUrlFunction(vp(t,this.tileGrid),e):this.setKey(e)}tileUrlFunction(t,e,i){}}class Tp extends ya{constructor(t){super({attributions:t.attributions,cacheSize:t.cacheSize,projection:t.projection,state:t.state,tileGrid:t.tileGrid,tileLoadFunction:t.tileLoadFunction?t.tileLoadFunction:Hc,tilePixelRatio:t.tilePixelRatio,tileUrlFunction:t.tileUrlFunction,url:t.url,urls:t.urls,wrapX:t.wrapX,transition:t.transition,interpolate:t.interpolate!==void 0?t.interpolate:!0,key:t.key,attributionsCollapsible:t.attributionsCollapsible,zDirection:t.zDirection}),this.crossOrigin=t.crossOrigin!==void 0?t.crossOrigin:null,this.tileClass=t.tileClass!==void 0?t.tileClass:Fc,this.tileGridForProjection={},this.reprojectionErrorThreshold_=t.reprojectionErrorThreshold,this.renderReprojectionEdges_=!1}getGutterForProjection(t){return this.getProjection()&&t&&!nr(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||nr(e,t)))return this.tileGrid;const i=V(t);return i in this.tileGridForProjection||(this.tileGridForProjection[i]=Vc(t)),this.tileGridForProjection[i]}createTile_(t,e,i,s,r,o){const a=[t,e,i],l=this.getTileCoordForTileUrlFunction(a,r),h=l?this.tileUrlFunction(l,s,r):void 0,c=new this.tileClass(a,h!==void 0?D.IDLE:D.EMPTY,h!==void 0?h:"",this.crossOrigin,this.tileLoadFunction,this.tileOptions);return c.key=o,c.addEventListener(z.CHANGE,this.handleTileChange.bind(this)),c}getTile(t,e,i,s,r,o){const a=this.getProjection();if(!a||!r||nr(a,r))return this.getTileInternal(t,e,i,s,a||r);const l=[t,e,i],h=this.getKey(),c=this.getTileGridForProjection(a),u=this.getTileGridForProjection(r),d=this.getTileCoordForTileUrlFunction(l,r),f=new Zc(a,c,r,u,l,d,this.getTilePixelRatio(s),this.getGutter(),(g,m,_,p)=>this.getTileInternal(g,m,_,p,a,o),this.reprojectionErrorThreshold_,this.renderReprojectionEdges_,this.tileOptions);return f.key=h,f}getTileInternal(t,e,i,s,r,o){const a=this.getKey(),l=Mr(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=Dt(t);if(i){const s=V(i);s in this.tileGridForProjection||(this.tileGridForProjection[s]=e)}}}function Hc(n,t){if(Yt){const e=n.getCrossOrigin();let i="same-origin",s="same-origin";e==="anonymous"||e===""?(i="cors",s="omit"):e==="use-credentials"&&(i="cors",s="include"),fetch(t,{mode:i,credentials:s}).then(r=>{if(!r.ok)throw new Error(`HTTP ${r.status}`);return r.blob()}).then(r=>createImageBitmap(r)).then(r=>{const o=n.getImage();o.width=r.width,o.height=r.height,o.getContext("2d").drawImage(r,0,0),r.close?.(),o.dispatchEvent(new Event("load"))}).catch(()=>{n.getImage().dispatchEvent(new Event("error"))});return}n.getImage().src=t}class qc extends Tp{constructor(t){t=t||{};const e=t.projection!==void 0?t.projection:"EPSG:3857",i=t.tileGrid!==void 0?t.tileGrid:dp({extent:ma(e),maxResolution:t.maxResolution,maxZoom:t.maxZoom,minZoom:t.minZoom,tileSize:t.tileSize});super({attributions:t.attributions,cacheSize:t.cacheSize,crossOrigin:t.crossOrigin,interpolate:t.interpolate,projection:e,reprojectionErrorThreshold:t.reprojectionErrorThreshold,tileGrid:i,tileLoadFunction:t.tileLoadFunction,tilePixelRatio:t.tilePixelRatio,tileUrlFunction:t.tileUrlFunction,url:t.url,urls:t.urls,wrapX:t.wrapX!==void 0?t.wrapX:!0,transition:t.transition,attributionsCollapsible:t.attributionsCollapsible,zDirection:t.zDirection}),this.gutter_=t.gutter!==void 0?t.gutter:0}getGutter(){return this.gutter_}}const Ip='© <a href="https://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap</a> contributors.';class Sp extends qc{constructor(t){t=t||{};let e;t.attributions!==void 0?e=t.attributions:e=[Ip];const i=t.crossOrigin!==void 0?t.crossOrigin:"anonymous",s=t.url!==void 0?t.url:"https://tile.openstreetmap.org/{z}/{x}/{y}.png";super({attributions:e,attributionsCollapsible:!1,cacheSize:t.cacheSize,crossOrigin:i,interpolate:t.interpolate,maxZoom:t.maxZoom!==void 0?t.maxZoom:19,reprojectionErrorThreshold:t.reprojectionErrorThreshold,tileLoadFunction:(r,o)=>{const a=r.getImage();!Yt&&a instanceof HTMLImageElement&&(a.referrerPolicy="origin-when-cross-origin"),(t.tileLoadFunction||Hc)(r,o)},transition:t.transition,url:s,wrapX:t.wrapX,zDirection:t.zDirection})}}function Ea(n){return n instanceof Image||n instanceof HTMLCanvasElement||n instanceof HTMLVideoElement||n instanceof ImageBitmap?n:null}const bp=new Error("disposed"),Lp=[256,256];class Jc extends ra{constructor(t){const e=D.IDLE;super(t.tileCoord,e,{transition:t.transition,interpolate:t.interpolate}),this.loader_=t.loader,this.data_=null,this.error_=null,this.size_=t.size||null,this.controller_=t.controller||null}getSize(){if(this.size_)return this.size_;const t=Ea(this.data_);return t?[t.width,t.height]:Lp}getData(){return this.data_}getError(){return this.error_}load(){if(this.state!==D.IDLE&&this.state!==D.ERROR)return;this.state=D.LOADING,this.changed();const t=this;this.loader_().then(function(e){t.data_=e,t.state=D.LOADED,t.changed()}).catch(function(e){t.error_=e,t.state=D.ERROR,t.changed()})}disposeInternal(){this.controller_&&(this.controller_.abort(bp),this.controller_=null),super.disposeInternal()}}class Qc{constructor(t){this.highWaterMark=t!==void 0?t:2048,this.count_=0,this.entries_={},this.oldest_=null,this.newest_=null}deleteOldest(){const t=this.pop();t instanceof Gs&&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 xa(n,t,e){if(!(e in n))return n[e]=new Set([t]),!0;const i=n[e],s=i.has(t);return s||i.add(t),!s}function Ap(n,t,e){const i=n[e];return i?i.delete(t):!1}function tu(n,t){const e=n.layerStatesArray[n.layerIndex];e.extent&&(t=wi(t,ii(e.extent,n.viewState.projection)));const i=e.layer.getRenderSource();if(!i.getWrapX()){const s=i.getTileGridForProjection(n.viewState.projection).getExtent();s&&(t=wi(t,s))}return t}class Mp extends fc{constructor(t,e){super(t),e=e||{},this.extentChanged=!0,this.renderComplete=!1,this.renderedExtent_=null,this.renderedPixelRatio,this.renderedProjection=null,this.renderedTiles=[],this.renderedSourceKey_,this.renderedSourceRevision_,this.tempExtent=Wt(),this.tempTileRange_=new fa(0,0,0,0),this.tempTileCoord_=Ar(0,0,0);const i=e.cacheSize!==void 0?e.cacheSize:512;this.tileCache_=new Qc(i),this.sourceTileCache_=null,this.maxStaleKeys=i*.5}getTileCache(){return this.tileCache_}getSourceTileCache(){return this.sourceTileCache_||(this.sourceTileCache_=new Qc(512)),this.sourceTileCache_}getOrCreateTile(t,e,i,s){const r=this.tileCache_,a=this.getLayer().getSource(),l=Mr(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||nr(u,c)?void 0:this.getSourceTileCache()),!h)return null;r.set(l,h)}return h}getTile(t,e,i,s){const r=this.getOrCreateTile(t,e,i,s);return r||null}getData(t){const e=this.frameState;if(!e)return null;const i=this.getLayer(),s=dt(e.pixelToCoordinateTransform,t.slice()),r=i.getExtent();if(r&&!Bi(r,s))return null;const o=e.viewState,a=i.getRenderSource(),l=a.getTileGridForProjection(o.projection),h=a.getTilePixelRatio(e.pixelRatio);for(let c=l.getZForResolution(o.resolution);c>=l.getMinZoom();--c){const u=l.getTileCoordForCoordAndZ(s,c),d=this.getTile(c,u[1],u[2],e);if(!d||d.getState()!==D.LOADED)continue;const f=l.getOrigin(c),g=kt(l.getTileSize(c)),m=l.getResolution(c);let _;if(d instanceof Fc||d instanceof Zc)_=d.getImage();else if(d instanceof Jc){if(_=Ea(d.getData()),!_)continue}else continue;const p=Math.floor(h*((s[0]-f[0])/m-u[1]*g[0])),y=Math.floor(h*((f[1]-s[1])/m-u[2]*g[1])),w=Math.round(h*a.getGutterForProjection(o.projection));return this.getImageData(_,p+w,y+w)}return null}prepareFrame(t){this.renderedProjection?t.viewState.projection!==this.renderedProjection&&(this.tileCache_.clear(),this.renderedProjection=t.viewState.projection):this.renderedProjection=t.viewState.projection;const e=this.getLayer().getSource();if(!e)return!1;const i=e.getRevision();return this.renderedSourceRevision_?this.renderedSourceRevision_!==i&&(this.renderedSourceRevision_=i,this.renderedSourceKey_===e.getKey()&&(this.tileCache_.clear(),this.sourceTileCache_?.clear())):this.renderedSourceRevision_=i,!0}enqueueTilesForNextExtent(){return!0}enqueueTiles(t,e,i,s,r){const o=t.viewState,a=this.getLayer(),l=a.getRenderSource(),h=l.getTileGridForProjection(o.projection),c=V(l);c in t.wantedTiles||(t.wantedTiles[c]={});const u=t.wantedTiles[c],d=a.getMapInternal(),f=Math.max(i-r,h.getMinZoom(),h.getZForResolution(Math.min(a.getMaxResolution(),d?d.getView().getResolutionForZoom(Math.max(a.getMinZoom(),0)):h.getResolution(0)),l.zDirection)),g=o.rotation,m=g?zl(o.center,o.resolution,g,t.size):void 0;for(let _=i;_>=f;--_){const p=h.getTileRangeForExtentAndZ(e,_,this.tempTileRange_),y=h.getResolution(_);for(let w=p.minX;w<=p.maxX;++w)for(let E=p.minY;E<=p.maxY;++E){if(g&&!h.tileCoordIntersectsViewport([_,w,E],m))continue;const x=this.getTile(_,w,E,t);if(!x||!xa(s,x,_))continue;const T=x.getKey();if(u[T]=!0,x.getState()===D.IDLE&&!t.tileQueue.isKeyQueued(T)){const R=Ar(_,w,E,this.tempTileCoord_);t.tileQueue.enqueue([x,c,h.getTileCoordCenter(R),y])}}}}findStaleTile_(t,e){const i=this.tileCache_,s=t[0],r=t[1],o=t[2],a=this.getStaleKeys();for(let l=0;l<a.length;++l){const h=Mr(this.getLayer().getSource(),a[l],s,r,o);if(i.containsKey(h)){const c=i.peek(h);if(c.getState()===D.LOADED)return c.endTransition(V(this)),xa(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=Mr(l,h,i,c,u);let f=!1;if(a.containsKey(d)){const g=a.peek(d);g.getState()===D.LOADED&&(xa(s,g,i),f=!0)}f||(o=!1)}return o}renderFrame(t,e){this.renderComplete=!0;const i=t.layerStatesArray[t.layerIndex],s=t.viewState,r=s.projection,o=s.resolution,a=s.center,l=t.pixelRatio,h=this.getLayer(),c=h.getSource(),u=c.getTileGridForProjection(r),d=u.getZForResolution(o,c.zDirection),f=u.getResolution(d),g=c.getKey();this.renderedSourceKey_?this.renderedSourceKey_!==g&&(this.prependStaleKey(this.renderedSourceKey_),this.renderedSourceKey_=g):this.renderedSourceKey_=g;let m=t.extent;const _=c.getTilePixelRatio(l);this.prepareContainer(t,e);const p=this.context.canvas.width,y=this.context.canvas.height,w=i.extent&&ii(i.extent);w&&(m=wi(m,ii(i.extent)));const E=f*p/2/_,x=f*y/2/_,v=[a[0]-E,a[1]-x,a[0]+E,a[1]+x],T={};this.renderedTiles.length=0;const R=h.getPreload();if(t.nextExtent&&this.enqueueTilesForNextExtent()){const F=u.getZForResolution(s.nextResolution,c.zDirection),$=tu(t,t.nextExtent);this.enqueueTiles(t,$,F,T,R)}const I=tu(t,m);if(this.enqueueTiles(t,I,d,T,0),R>0&&setTimeout(()=>{this.enqueueTiles(t,I,d-1,T,R-1)},0),!(d in T))return this.container;const L=V(this),P=t.time;for(const F of T[d]){const $=F.getState();if($===D.EMPTY)continue;const B=F.tileCoord;if($===D.LOADED&&F.getAlpha(L,P)===1){F.endTransition(L);continue}if($!==D.ERROR&&(this.renderComplete=!1),this.findStaleTile_(B,T)){Ap(T,F,d),t.animate=!0;continue}if(this.findAltTiles_(u,B,d+1,T))continue;const xt=u.getMinZoom();for(let Lt=d-1;Lt>=xt&&!this.findAltTiles_(u,B,Lt,T);--Lt);}const A=f/o*l/_,b=this.getRenderContext(t);Oe(this.tempTransform,p/2,y/2,A,A,0,-p/2,-y/2),i.extent&&this.clipUnrotated(b,t,w),c.getInterpolate()||(b.imageSmoothingEnabled=!1),this.preRender(b,t);const M=Object.keys(T).map(Number);M.sort(Ae);let Y;const k=[],G=[];for(let F=M.length-1;F>=0;--F){const $=M[F],B=c.getTilePixelSize($,l,r),S=u.getResolution($)/f,xt=B[0]*S*A,Lt=B[1]*S*A,lt=u.getTileCoordForCoordAndZ(Ci(v),$),$t=u.getTileCoordExtent(lt),vt=dt(this.tempTransform,[_*($t[0]-v[0])/f,_*(v[3]-$t[3])/f]),ve=_*c.getGutterForProjection(r);for(const me of T[$]){if(me.getState()!==D.LOADED)continue;const Kt=me.tileCoord,Or=lt[1]-Kt[1],va=Math.round(vt[0]-(Or-1)*xt),fs=lt[2]-Kt[2],Fi=Math.round(vt[1]-(fs-1)*Lt),ne=Math.round(vt[0]-Or*xt),we=Math.round(vt[1]-fs*Lt),xn=va-ne,vn=Fi-we,gs=M.length===1;let ki=!1;Y=[ne,we,ne+xn,we,ne+xn,we+vn,ne,we+vn];for(let wn=0,Cn=k.length;wn<Cn;++wn)if(!gs&&$<G[wn]){const ft=k[wn];Ot([ne,we,ne+xn,we+vn],[ft[0],ft[3],ft[4],ft[7]])&&(ki||(b.save(),ki=!0),b.beginPath(),b.moveTo(Y[0],Y[1]),b.lineTo(Y[2],Y[3]),b.lineTo(Y[4],Y[5]),b.lineTo(Y[6],Y[7]),b.moveTo(ft[6],ft[7]),b.lineTo(ft[4],ft[5]),b.lineTo(ft[2],ft[3]),b.lineTo(ft[0],ft[1]),b.clip())}k.push(Y),G.push($),this.drawTile(me,t,ne,we,xn,vn,ve,gs),ki&&b.restore(),this.renderedTiles.unshift(me),this.updateUsedTiles(t.usedTiles,c,me)}}if(this.renderedResolution=f,this.extentChanged=!this.renderedExtent_||!Gn(this.renderedExtent_,v),this.renderedExtent_=v,this.renderedPixelRatio=l,this.postRender(this.context,t),i.extent&&b.restore(),b.imageSmoothingEnabled=!0,this.renderComplete){const F=($,B)=>{const et=V(c),S=B.wantedTiles[et],xt=S?Object.keys(S).length:0;this.updateCacheSize(xt),this.tileCache_.expireCache(),this.sourceTileCache_?.expireCache()};t.postRenderFunctions.push(F)}return this.container}updateCacheSize(t){this.tileCache_.highWaterMark=Math.max(this.tileCache_.highWaterMark,t*2)}drawTile(t,e,i,s,r,o,a,l){let h;if(t instanceof Jc){if(h=Ea(t.getData()),!h)throw new Error("Rendering array data is not yet supported")}else h=this.getTileImage(t);if(!h)return;const c=this.getRenderContext(e),u=V(this),d=e.layerStatesArray[e.layerIndex],f=d.opacity*(l?t.getAlpha(u,e.time):1),g=f!==c.globalAlpha;g&&(c.save(),c.globalAlpha=f),c.drawImage(h,a,a,h.width-2*a,h.height-2*a,i,s,r,o),g&&c.restore(),f!==d.opacity?e.animate=!0:l&&t.endTransition(u)}getImage(){const t=this.context;return t?t.canvas:null}getTileImage(t){return t.getImage()}updateUsedTiles(t,e,i){const s=V(e);s in t||(t[s]={}),t[s][i.getKey()]=!0}}const Pr={PRELOAD:"preload",USE_INTERIM_TILES_ON_ERROR:"useInterimTilesOnError"};class Pp extends br{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(Pr.PRELOAD)}setPreload(t){this.set(Pr.PRELOAD,t)}getUseInterimTilesOnError(){return this.get(Pr.USE_INTERIM_TILES_ON_ERROR)}setUseInterimTilesOnError(t){this.set(Pr.USE_INTERIM_TILES_ON_ERROR,t)}getData(t){return super.getData(t)}}class eu extends Pp{constructor(t){super(t)}createRenderer(){return new Mp(this,{cacheSize:this.getCacheSize()})}}const iu=`
|
|
1
|
+
(function(ba){"use strict";typeof window<"u"&&((window.__svelte??={}).v??=new Set).add("5");const fu=1,gu=4,_u=8,mu=16,pu=2,La="[",Aa="[!",Ma="]",Rn={},Rt=Symbol(),kr=!1;var yu=Array.isArray,xu=Array.prototype.indexOf,Eu=Array.from,xs=Object.keys,Es=Object.defineProperty,_i=Object.getOwnPropertyDescriptor,vu=Object.prototype,wu=Array.prototype,Cu=Object.getPrototypeOf,Pa=Object.isExtensible;function Ru(n){for(var t=0;t<n.length;t++)n[t]()}function Tu(){var n,t,e=new Promise((i,s)=>{n=i,t=s});return{promise:e,resolve:n,reject:t}}const yt=2,Nr=4,Oa=8,Te=16,Be=32,Ze=64,vs=128,le=512,Tt=1024,Wt=2048,Ie=4096,Ue=8192,Ve=16384,ws=32768,Cs=65536,Da=1<<17,Fa=1<<18,Xi=1<<19,Iu=1<<20,mi=32768,Gr=1<<21,ka=1<<22,Tn=1<<23,Rs=Symbol("$state"),Na=Symbol("legacy props"),Ga=new class extends Error{name="StaleReactionError";message="The reaction that called `getAbortSignal()` was re-run or destroyed"},za=3,Ts=8;function Su(n){throw new Error("https://svelte.dev/e/lifecycle_outside_component")}function bu(n){throw new Error("https://svelte.dev/e/effect_in_teardown")}function Lu(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function Au(n){throw new Error("https://svelte.dev/e/effect_orphan")}function Mu(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function Pu(){throw new Error("https://svelte.dev/e/hydration_failed")}function Ou(n){throw new Error("https://svelte.dev/e/props_invalid_value")}function Du(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function Fu(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function ku(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}function Nu(){throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror")}function zr(n){console.warn("https://svelte.dev/e/hydration_mismatch")}function Gu(){console.warn("https://svelte.dev/e/svelte_boundary_reset_noop")}let Et=!1;function Is(n){Et=n}let rt;function Se(n){if(n===null)throw zr(),Rn;return rt=n}function Xa(){return Se(Le(rt))}function zu(n){if(Et){if(Le(rt)!==null)throw zr(),Rn;rt=n}}function Wa(n=1){if(Et){for(var t=n,e=rt;t--;)e=Le(e);rt=e}}function Xu(n=!0){for(var t=0,e=rt;;){if(e.nodeType===Ts){var i=e.data;if(i===Ma){if(t===0)return e;t-=1}else(i===La||i===Aa)&&(t+=1)}var s=Le(e);n&&e.remove(),e=s}}function Ya(n){return n===this.v}function Wu(n,t){return n!=n?t==t:n!==t||n!==null&&typeof n=="object"||typeof n=="function"}function $a(n){return!Wu(n,this.v)}let Yu=!1,Zt=null;function Ss(n){Zt=n}function Ka(n,t=!1,e){Zt={p:Zt,i:!1,c:null,e:null,s:n,x:null,l:null}}function Ba(n){var t=Zt,e=t.e;if(e!==null){t.e=null;for(var i of e)al(i)}return n!==void 0&&(t.x=n),t.i=!0,Zt=t.p,n??{}}function Za(){return!0}let pi=[];function Ua(){var n=pi;pi=[],Ru(n)}function bs(n){if(pi.length===0&&!In){var t=pi;queueMicrotask(()=>{t===pi&&Ua()})}pi.push(n)}function $u(){for(;pi.length>0;)Ua()}function Va(n){var t=it;if(t===null)return q.f|=Tn,n;if((t.f&ws)===0){if((t.f&vs)===0)throw n;t.b.error(n)}else Ls(n,t)}function Ls(n,t){for(;t!==null;){if((t.f&vs)!==0)try{t.b.error(n);return}catch(e){n=e}t=t.parent}throw n}const As=new Set;let It=null,Ut=null,Vt=[],Ms=null,Xr=!1,In=!1;class he{committed=!1;current=new Map;previous=new Map;#e=new Set;#t=new Set;#l=0;#r=0;#h=null;#o=[];#s=[];skipped_effects=new Set;is_fork=!1;is_deferred(){return this.is_fork||this.#r>0}process(t){Vt=[],this.apply();var e={parent:null,effect:null,effects:[],render_effects:[],block_effects:[]};for(const i of t)this.#i(i,e);this.is_fork||this.#c(),this.is_deferred()?(this.#n(e.effects),this.#n(e.render_effects),this.#n(e.block_effects)):(It=null,Ha(e.render_effects),Ha(e.effects),this.#h?.resolve()),Ut=null}#i(t,e){t.f^=Tt;for(var i=t.first;i!==null;){var s=i.f,r=(s&(Be|Ze))!==0,o=r&&(s&Tt)!==0,a=o||(s&Ue)!==0||this.skipped_effects.has(i);if((i.f&vs)!==0&&i.b?.is_pending()&&(e={parent:e,effect:i,effects:[],render_effects:[],block_effects:[]}),!a&&i.fn!==null){r?i.f^=Tt:(s&Nr)!==0?e.effects.push(i):Mn(i)&&((i.f&Te)!==0&&e.block_effects.push(i),Pn(i));var l=i.first;if(l!==null){i=l;continue}}var h=i.parent;for(i=i.next;i===null&&h!==null;)h===e.effect&&(this.#n(e.effects),this.#n(e.render_effects),this.#n(e.block_effects),e=e.parent),i=h.next,h=h.parent}}#n(t){for(const e of t)((e.f&Wt)!==0?this.#o:this.#s).push(e),this.#a(e.deps),bt(e,Tt)}#a(t){if(t!==null)for(const e of t)(e.f&yt)===0||(e.f&mi)===0||(e.f^=mi,this.#a(e.deps))}capture(t,e){this.previous.has(t)||this.previous.set(t,e),(t.f&Tn)===0&&(this.current.set(t,t.v),Ut?.set(t,t.v))}activate(){It=this,this.apply()}deactivate(){It===this&&(It=null,Ut=null)}flush(){if(this.activate(),Vt.length>0){if(ja(),It!==null&&It!==this)return}else this.#l===0&&this.process([]);this.deactivate()}discard(){for(const t of this.#t)t(this);this.#t.clear()}#c(){if(this.#r===0){for(const t of this.#e)t();this.#e.clear()}this.#l===0&&this.#u()}#u(){if(As.size>1){this.previous.clear();var t=Ut,e=!0,i={parent:null,effect:null,effects:[],render_effects:[],block_effects:[]};for(const r of As){if(r===this){e=!1;continue}const o=[];for(const[l,h]of this.current){if(r.current.has(l))if(e&&h!==r.current.get(l))r.current.set(l,h);else continue;o.push(l)}if(o.length===0)continue;const a=[...r.current.keys()].filter(l=>!this.current.has(l));if(a.length>0){var s=Vt;Vt=[];const l=new Set,h=new Map;for(const c of o)qa(c,a,l,h);if(Vt.length>0){It=r,r.apply();for(const c of Vt)r.#i(c,i);r.deactivate()}Vt=s}}It=null,Ut=t}this.committed=!0,As.delete(this)}increment(t){this.#l+=1,t&&(this.#r+=1)}decrement(t){this.#l-=1,t&&(this.#r-=1),this.revive()}revive(){for(const t of this.#o)bt(t,Wt),Wi(t);for(const t of this.#s)bt(t,Ie),Wi(t);this.#o=[],this.#s=[],this.flush()}oncommit(t){this.#e.add(t)}ondiscard(t){this.#t.add(t)}settled(){return(this.#h??=Tu()).promise}static ensure(){if(It===null){const t=It=new he;As.add(It),In||he.enqueue(()=>{It===t&&t.flush()})}return It}static enqueue(t){bs(t)}apply(){}}function je(n){var t=In;In=!0;try{for(var e;;){if($u(),Vt.length===0&&(It?.flush(),Vt.length===0))return Ms=null,e;ja()}}finally{In=t}}function ja(){var n=Je;Xr=!0;var t=null;try{var e=0;for(Fs(!0);Vt.length>0;){var i=he.ensure();if(e++>1e3){var s,r;Ku()}i.process(Vt),He.clear()}}finally{Xr=!1,Fs(n),Ms=null}}function Ku(){try{Mu()}catch(n){Ls(n,Ms)}}let be=null;function Ha(n){var t=n.length;if(t!==0){for(var e=0;e<t;){var i=n[e++];if((i.f&(Ve|Ue))===0&&Mn(i)&&(be=new Set,Pn(i),i.deps===null&&i.first===null&&i.nodes_start===null&&(i.teardown===null&&i.ac===null?ul(i):i.fn=null),be?.size>0)){He.clear();for(const s of be){if((s.f&(Ve|Ue))!==0)continue;const r=[s];let o=s.parent;for(;o!==null;)be.has(o)&&(be.delete(o),r.push(o)),o=o.parent;for(let a=r.length-1;a>=0;a--){const l=r[a];(l.f&(Ve|Ue))===0&&Pn(l)}}be.clear()}}be=null}}function qa(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&yt)!==0?qa(s,t,e,i):(r&(ka|Te))!==0&&(r&Wt)===0&&Ja(s,t,i)&&(bt(s,Wt),Wi(s))}}function Ja(n,t,e){const i=e.get(n);if(i!==void 0)return i;if(n.deps!==null)for(const s of n.deps){if(t.includes(s))return!0;if((s.f&yt)!==0&&Ja(s,t,e))return e.set(s,!0),!0}return e.set(n,!1),!1}function Wi(n){for(var t=Ms=n;t.parent!==null;){t=t.parent;var e=t.f;if(Xr&&t===it&&(e&Te)!==0&&(e&Fa)===0)return;if((e&(Ze|Be))!==0){if((e&Tt)===0)return;t.f^=Tt}}Vt.push(t)}function Bu(n){let t=0,e=Ps(0),i;return()=>{Os()&&(Z(e),ll(()=>(t===0&&(i=Vr(()=>n(()=>Sn(e)))),t+=1,()=>{bs(()=>{t-=1,t===0&&(i?.(),i=void 0,Sn(e))})})))}}var Zu=Cs|Xi|vs;function Uu(n,t,e){new Vu(n,t,e)}class Vu{parent;#e=!1;#t;#l=Et?rt:null;#r;#h;#o;#s=null;#i=null;#n=null;#a=null;#c=null;#u=0;#d=0;#g=!1;#f=null;#x=Bu(()=>(this.#f=Ps(this.#u),()=>{this.#f=null}));constructor(t,e,i){this.#t=t,this.#r=e,this.#h=i,this.parent=it.b,this.#e=!!this.#r.pending,this.#o=cd(()=>{if(it.b=this,Et){const r=this.#l;Xa(),r.nodeType===Ts&&r.data===Aa?this.#v():this.#E()}else{var s=this.#p();try{this.#s=yi(()=>i(s))}catch(r){this.error(r)}this.#d>0?this.#m():this.#e=!1}return()=>{this.#c?.remove()}},Zu),Et&&(this.#t=rt)}#E(){try{this.#s=yi(()=>this.#h(this.#t))}catch(t){this.error(t)}this.#e=!1}#v(){const t=this.#r.pending;t&&(this.#i=yi(()=>t(this.#t)),he.enqueue(()=>{var e=this.#p();this.#s=this.#_(()=>(he.ensure(),yi(()=>this.#h(e)))),this.#d>0?this.#m():(Ds(this.#i,()=>{this.#i=null}),this.#e=!1)}))}#p(){var t=this.#t;return this.#e&&(this.#c=bn(),this.#t.before(this.#c),t=this.#c),t}is_pending(){return this.#e||!!this.parent&&this.parent.is_pending()}has_pending_snippet(){return!!this.#r.pending}#_(t){var e=it,i=q,s=Zt;Qe(this.#o),Ht(this.#o),Ss(this.#o.ctx);try{return t()}catch(r){return Va(r),null}finally{Qe(e),Ht(i),Ss(s)}}#m(){const t=this.#r.pending;this.#s!==null&&(this.#a=document.createDocumentFragment(),this.#a.append(this.#c),gd(this.#s,this.#a)),this.#i===null&&(this.#i=yi(()=>t(this.#t)))}#y(t){if(!this.has_pending_snippet()){this.parent&&this.parent.#y(t);return}this.#d+=t,this.#d===0&&(this.#e=!1,this.#i&&Ds(this.#i,()=>{this.#i=null}),this.#a&&(this.#t.before(this.#a),this.#a=null))}update_pending_count(t){this.#y(t),this.#u+=t,this.#f&&il(this.#f,this.#u)}get_effect_pending(){return this.#x(),Z(this.#f)}error(t){var e=this.#r.onerror;let i=this.#r.failed;if(this.#g||!e&&!i)throw t;this.#s&&(ce(this.#s),this.#s=null),this.#i&&(ce(this.#i),this.#i=null),this.#n&&(ce(this.#n),this.#n=null),Et&&(Se(this.#l),Wa(),Se(Xu()));var s=!1,r=!1;const o=()=>{if(s){Gu();return}s=!0,r&&Nu(),he.ensure(),this.#u=0,this.#n!==null&&Ds(this.#n,()=>{this.#n=null}),this.#e=this.has_pending_snippet(),this.#s=this.#_(()=>(this.#g=!1,yi(()=>this.#h(this.#t)))),this.#d>0?this.#m():this.#e=!1};var a=q;try{Ht(null),r=!0,e?.(t,o),r=!1}catch(l){Ls(l,this.#o&&this.#o.parent)}finally{Ht(a)}i&&bs(()=>{this.#n=this.#_(()=>{he.ensure(),this.#g=!0;try{return yi(()=>{i(this.#t,()=>t,()=>o)})}catch(l){return Ls(l,this.#o.parent),null}finally{this.#g=!1}})})}}function Wr(n){var t=yt|Wt,e=q!==null&&(q.f&yt)!==0?q:null;return it!==null&&(it.f|=Xi),{ctx:Zt,deps:null,effects:null,equals:Ya,f:t,fn:n,reactions:null,rv:0,v:Rt,wv:0,parent:e??it,ac:null}}function ju(n){const t=Wr(n);return gl(t),t}function Hu(n){const t=Wr(n);return t.equals=$a,t}function Qa(n){var t=n.effects;if(t!==null){n.effects=null;for(var e=0;e<t.length;e+=1)ce(t[e])}}function qu(n){for(var t=n.parent;t!==null;){if((t.f&yt)===0)return(t.f&Ve)===0?t:null;t=t.parent}return null}function Yr(n){var t,e=it;Qe(qu(n));try{n.f&=~mi,Qa(n),t=xl(n)}finally{Qe(e)}return t}function tl(n){var t=Yr(n);if(n.equals(t)||(It?.is_fork||(n.v=t),n.wv=pl()),!xi)if(Ut!==null)Os()&&Ut.set(n,t);else{var e=(n.f&le)===0?Ie:Tt;bt(n,e)}}let $r=new Set;const He=new Map;let el=!1;function Ps(n,t){var e={f:0,v:n,reactions:null,equals:Ya,rv:0,wv:0};return e}function jt(n,t){const e=Ps(n);return gl(e),e}function Ju(n,t=!1,e=!0){const i=Ps(n);return t||(i.equals=$a),i}function Ot(n,t,e=!1){q!==null&&(!ye||(q.f&Da)!==0)&&Za()&&(q.f&(yt|Te|ka|Da))!==0&&!Ae?.includes(n)&&ku();let i=e?Yi(t):t;return il(n,i)}function il(n,t){if(!n.equals(t)){var e=n.v;xi?He.set(n,t):He.set(n,e),n.v=t;var i=he.ensure();i.capture(n,e),(n.f&yt)!==0&&((n.f&Wt)!==0&&Yr(n),bt(n,(n.f&le)!==0?Tt:Ie)),n.wv=pl(),nl(n,Wt),it!==null&&(it.f&Tt)!==0&&(it.f&(Be|Ze))===0&&(qt===null?_d([n]):qt.push(n)),!i.is_fork&&$r.size>0&&!el&&Qu()}return t}function Qu(){el=!1;var n=Je;Fs(!0);const t=Array.from($r);try{for(const e of t)(e.f&Tt)!==0&&bt(e,Ie),Mn(e)&&Pn(e)}finally{Fs(n)}$r.clear()}function Sn(n){Ot(n,n.v+1)}function nl(n,t){var e=n.reactions;if(e!==null)for(var i=e.length,s=0;s<i;s++){var r=e[s],o=r.f,a=(o&Wt)===0;if(a&&bt(r,t),(o&yt)!==0){var l=r;Ut?.delete(l),(o&mi)===0&&(o&le&&(r.f|=mi),nl(l,Ie))}else a&&((o&Te)!==0&&be!==null&&be.add(r),Wi(r))}}function Yi(n){if(typeof n!="object"||n===null||Rs in n)return n;const t=Cu(n);if(t!==vu&&t!==wu)return n;var e=new Map,i=yu(n),s=jt(0),r=Ei,o=a=>{if(Ei===r)return a();var l=q,h=Ei;Ht(null),ml(r);var c=a();return Ht(l),ml(h),c};return i&&e.set("length",jt(n.length)),new Proxy(n,{defineProperty(a,l,h){(!("value"in h)||h.configurable===!1||h.enumerable===!1||h.writable===!1)&&Du();var c=e.get(l);return c===void 0?c=o(()=>{var u=jt(h.value);return e.set(l,u),u}):Ot(c,h.value,!0),!0},deleteProperty(a,l){var h=e.get(l);if(h===void 0){if(l in a){const c=o(()=>jt(Rt));e.set(l,c),Sn(s)}}else Ot(h,Rt),Sn(s);return!0},get(a,l,h){if(l===Rs)return n;var c=e.get(l),u=l in a;if(c===void 0&&(!u||_i(a,l)?.writable)&&(c=o(()=>{var f=Yi(u?a[l]:Rt),g=jt(f);return g}),e.set(l,c)),c!==void 0){var d=Z(c);return d===Rt?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=Z(c))}else if(h===void 0){var u=e.get(l),d=u?.v;if(u!==void 0&&d!==Rt)return{enumerable:!0,configurable:!0,value:d,writable:!0}}return h},has(a,l){if(l===Rs)return!0;var h=e.get(l),c=h!==void 0&&h.v!==Rt||Reflect.has(a,l);if(h!==void 0||it!==null&&(!c||_i(a,l)?.writable)){h===void 0&&(h=o(()=>{var d=c?Yi(a[l]):Rt,f=jt(d);return f}),e.set(l,h));var u=Z(h);if(u===Rt)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?Ot(g,Rt):f in a&&(g=o(()=>jt(Rt)),e.set(f+"",g))}if(u===void 0)(!d||_i(a,l)?.writable)&&(u=o(()=>jt(void 0)),Ot(u,Yi(h)),e.set(l,u));else{d=u.v!==Rt;var m=o(()=>Yi(h));Ot(u,m)}var _=Reflect.getOwnPropertyDescriptor(a,l);if(_?.set&&_.set.call(c,h),!d){if(i&&typeof l=="string"){var p=e.get("length"),y=Number(l);Number.isInteger(y)&&y>=p.v&&Ot(p,y+1)}Sn(s)}return!0},ownKeys(a){Z(s);var l=Reflect.ownKeys(a).filter(u=>{var d=e.get(u);return d===void 0||d.v!==Rt});for(var[h,c]of e)c.v!==Rt&&!(h in a)&&l.push(h);return l},setPrototypeOf(){Fu()}})}var Kr,sl,rl,ol;function Br(){if(Kr===void 0){Kr=window,sl=/Firefox/.test(navigator.userAgent);var n=Element.prototype,t=Node.prototype,e=Text.prototype;rl=_i(t,"firstChild").get,ol=_i(t,"nextSibling").get,Pa(n)&&(n.__click=void 0,n.__className=void 0,n.__attributes=null,n.__style=void 0,n.__e=void 0),Pa(e)&&(e.__t=void 0)}}function bn(n=""){return document.createTextNode(n)}function Ln(n){return rl.call(n)}function Le(n){return ol.call(n)}function td(n,t){if(!Et)return Ln(n);var e=Ln(rt);return e===null&&(e=rt.appendChild(bn())),Se(e),e}function ed(n,t=!1){if(!Et){var e=Ln(n);return e instanceof Comment&&e.data===""?Le(e):e}if(t&&rt?.nodeType!==za){var i=bn();return rt?.before(i),Se(i),i}return rt}function id(n,t=1,e=!1){let i=Et?rt:n;for(var s;t--;)s=i,i=Le(i);if(!Et)return i;if(e&&i?.nodeType!==za){var r=bn();return i===null?s?.after(r):i.before(r),Se(r),r}return Se(i),i}function nd(n){n.textContent=""}function Zr(n){var t=q,e=it;Ht(null),Qe(null);try{return n()}finally{Ht(t),Qe(e)}}function sd(n){it===null&&(q===null&&Au(),Lu()),xi&&bu()}function rd(n,t){var e=t.last;e===null?t.last=t.first=n:(e.next=n,n.prev=e,t.last=n)}function qe(n,t,e){var i=it;i!==null&&(i.f&Ue)!==0&&(n|=Ue);var s={ctx:Zt,deps:null,nodes_start:null,nodes_end:null,f:n|Wt|le,first:null,fn:t,last:null,next:null,parent:i,b:i&&i.b,prev:null,teardown:null,transitions:null,wv:0,ac:null};if(e)try{Pn(s),s.f|=ws}catch(a){throw ce(s),a}else t!==null&&Wi(s);var r=s;if(e&&r.deps===null&&r.teardown===null&&r.nodes_start===null&&r.first===r.last&&(r.f&Xi)===0&&(r=r.first,(n&Te)!==0&&(n&Cs)!==0&&r!==null&&(r.f|=Cs)),r!==null&&(r.parent=i,i!==null&&rd(r,i),q!==null&&(q.f&yt)!==0&&(n&Ze)===0)){var o=q;(o.effects??=[]).push(r)}return s}function Os(){return q!==null&&!ye}function od(n){const t=qe(Oa,null,!1);return bt(t,Tt),t.teardown=n,t}function Ur(n){sd();var t=it.f,e=!q&&(t&Be)!==0&&(t&ws)===0;if(e){var i=Zt;(i.e??=[]).push(n)}else return al(n)}function al(n){return qe(Nr|Iu,n,!1)}function ad(n){he.ensure();const t=qe(Ze|Xi,n,!0);return()=>{ce(t)}}function ld(n){he.ensure();const t=qe(Ze|Xi,n,!0);return(e={})=>new Promise(i=>{e.outro?Ds(t,()=>{ce(t),i(void 0)}):(ce(t),i(void 0))})}function hd(n){return qe(Nr,n,!1)}function ll(n,t=0){return qe(Oa|t,n,!0)}function cd(n,t=0){var e=qe(Te|t,n,!0);return e}function yi(n){return qe(Be|Xi,n,!0)}function hl(n){var t=n.teardown;if(t!==null){const e=xi,i=q;fl(!0),Ht(null);try{t.call(null)}finally{fl(e),Ht(i)}}}function cl(n,t=!1){var e=n.first;for(n.first=n.last=null;e!==null;){const s=e.ac;s!==null&&Zr(()=>{s.abort(Ga)});var i=e.next;(e.f&Ze)!==0?e.parent=null:ce(e,t),e=i}}function ud(n){for(var t=n.first;t!==null;){var e=t.next;(t.f&Be)===0&&ce(t),t=e}}function ce(n,t=!0){var e=!1;(t||(n.f&Fa)!==0)&&n.nodes_start!==null&&n.nodes_end!==null&&(dd(n.nodes_start,n.nodes_end),e=!0),cl(n,t&&!e),ks(n,0),bt(n,Ve);var i=n.transitions;if(i!==null)for(const r of i)r.stop();hl(n);var s=n.parent;s!==null&&s.first!==null&&ul(n),n.next=n.prev=n.teardown=n.ctx=n.deps=n.fn=n.nodes_start=n.nodes_end=n.ac=null}function dd(n,t){for(;n!==null;){var e=n===t?null:Le(n);n.remove(),n=e}}function ul(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 Ds(n,t,e=!0){var i=[];dl(n,i,!0),fd(i,()=>{e&&ce(n),t&&t()})}function fd(n,t){var e=n.length;if(e>0){var i=()=>--e||t();for(var s of n)s.out(i)}else t()}function dl(n,t,e){if((n.f&Ue)===0){if(n.f^=Ue,n.transitions!==null)for(const o of n.transitions)(o.is_global||e)&&t.push(o);for(var i=n.first;i!==null;){var s=i.next,r=(i.f&Cs)!==0||(i.f&Be)!==0&&(n.f&Te)!==0;dl(i,t,r?e:!1),i=s}}}function gd(n,t){for(var e=n.nodes_start,i=n.nodes_end;e!==null;){var s=e===i?null:Le(e);t.append(e),e=s}}let Je=!1;function Fs(n){Je=n}let xi=!1;function fl(n){xi=n}let q=null,ye=!1;function Ht(n){q=n}let it=null;function Qe(n){it=n}let Ae=null;function gl(n){q!==null&&(Ae===null?Ae=[n]:Ae.push(n))}let St=null,Yt=0,qt=null;function _d(n){qt=n}let _l=1,An=0,Ei=An;function ml(n){Ei=n}function pl(){return++_l}function Mn(n){var t=n.f;if((t&Wt)!==0)return!0;if(t&yt&&(n.f&=~mi),(t&Ie)!==0){var e=n.deps;if(e!==null)for(var i=e.length,s=0;s<i;s++){var r=e[s];if(Mn(r)&&tl(r),r.wv>n.wv)return!0}(t&le)!==0&&Ut===null&&bt(n,Tt)}return!1}function yl(n,t,e=!0){var i=n.reactions;if(i!==null&&!Ae?.includes(n))for(var s=0;s<i.length;s++){var r=i[s];(r.f&yt)!==0?yl(r,t,!1):t===r&&(e?bt(r,Wt):(r.f&Tt)!==0&&bt(r,Ie),Wi(r))}}function xl(n){var t=St,e=Yt,i=qt,s=q,r=Ae,o=Zt,a=ye,l=Ei,h=n.f;St=null,Yt=0,qt=null,q=(h&(Be|Ze))===0?n:null,Ae=null,Ss(n.ctx),ye=!1,Ei=++An,n.ac!==null&&(Zr(()=>{n.ac.abort(Ga)}),n.ac=null);try{n.f|=Gr;var c=n.fn,u=c(),d=n.deps;if(St!==null){var f;if(ks(n,Yt),d!==null&&Yt>0)for(d.length=Yt+St.length,f=0;f<St.length;f++)d[Yt+f]=St[f];else n.deps=d=St;if(Je&&Os()&&(n.f&le)!==0)for(f=Yt;f<d.length;f++)(d[f].reactions??=[]).push(n)}else d!==null&&Yt<d.length&&(ks(n,Yt),d.length=Yt);if(Za()&&qt!==null&&!ye&&d!==null&&(n.f&(yt|Ie|Wt))===0)for(f=0;f<qt.length;f++)yl(qt[f],n);return s!==null&&s!==n&&(An++,qt!==null&&(i===null?i=qt:i.push(...qt))),(n.f&Tn)!==0&&(n.f^=Tn),u}catch(g){return Va(g)}finally{n.f^=Gr,St=t,Yt=e,qt=i,q=s,Ae=r,Ss(o),ye=a,Ei=l}}function md(n,t){let e=t.reactions;if(e!==null){var i=xu.call(e,n);if(i!==-1){var s=e.length-1;s===0?e=t.reactions=null:(e[i]=e[s],e.pop())}}e===null&&(t.f&yt)!==0&&(St===null||!St.includes(t))&&(bt(t,Ie),(t.f&le)!==0&&(t.f^=le,t.f&=~mi),Qa(t),ks(t,0))}function ks(n,t){var e=n.deps;if(e!==null)for(var i=t;i<e.length;i++)md(n,e[i])}function Pn(n){var t=n.f;if((t&Ve)===0){bt(n,Tt);var e=it,i=Je;it=n,Je=!0;try{(t&Te)!==0?ud(n):cl(n),hl(n);var s=xl(n);n.teardown=typeof s=="function"?s:null,n.wv=_l;var r;kr&&Yu&&(n.f&Wt)!==0&&n.deps}finally{Je=i,it=e}}}function Z(n){var t=n.f,e=(t&yt)!==0;if(q!==null&&!ye){var i=it!==null&&(it.f&Ve)!==0;if(!i&&!Ae?.includes(n)){var s=q.deps;if((q.f&Gr)!==0)n.rv<An&&(n.rv=An,St===null&&s!==null&&s[Yt]===n?Yt++:St===null?St=[n]:St.includes(n)||St.push(n));else{(q.deps??=[]).push(n);var r=n.reactions;r===null?n.reactions=[q]:r.includes(q)||r.push(q)}}}if(xi){if(He.has(n))return He.get(n);if(e){var o=n,a=o.v;return((o.f&Tt)===0&&o.reactions!==null||vl(o))&&(a=Yr(o)),He.set(o,a),a}}else e&&!Ut?.has(n)&&(o=n,Mn(o)&&tl(o),Je&&Os()&&(o.f&le)===0&&El(o));if(Ut?.has(n))return Ut.get(n);if((n.f&Tn)!==0)throw n.v;return n.v}function El(n){if(n.deps!==null){n.f^=le;for(const t of n.deps)(t.reactions??=[]).push(n),(t.f&yt)!==0&&(t.f&le)===0&&El(t)}}function vl(n){if(n.v===Rt)return!0;if(n.deps===null)return!1;for(const t of n.deps)if(He.has(t)||(t.f&yt)!==0&&vl(t))return!0;return!1}function Vr(n){var t=ye;try{return ye=!0,n()}finally{ye=t}}const pd=-7169;function bt(n,t){n.f=n.f&pd|t}const wl=new Set,jr=new Set;function yd(n,t,e,i={}){function s(r){if(i.capture||On.call(t,r),!r.cancelBubble)return Zr(()=>e?.call(this,r))}return n.startsWith("pointer")||n.startsWith("touch")||n==="wheel"?bs(()=>{t.addEventListener(n,s,i)}):t.addEventListener(n,s,i),s}function xd(n,t,e,i,s){var r={capture:i,passive:s},o=yd(n,t,e,r);(t===document.body||t===window||t===document||t instanceof HTMLMediaElement)&&od(()=>{t.removeEventListener(n,o,r)})}function Ed(n){for(var t=0;t<n.length;t++)wl.add(n[t]);for(var e of jr)e(n)}let Cl=null;function On(n){var t=this,e=t.ownerDocument,i=n.type,s=n.composedPath?.()||[],r=s[0]||n.target;Cl=n;var o=0,a=Cl===n&&n.__root;if(a){var l=s.indexOf(a);if(l!==-1&&(t===document||t===window)){n.__root=t;return}var h=s.indexOf(t);if(h===-1)return;l<=h&&(o=l)}if(r=s[o]||n.target,r!==t){Es(n,"currentTarget",{configurable:!0,get(){return r||e}});var c=q,u=it;Ht(null),Qe(null);try{for(var d,f=[];r!==null;){var g=r.assignedSlot||r.parentNode||r.host||null;try{var m=r["__"+i];m!=null&&(!r.disabled||n.target===r)&&m.call(r,n)}catch(_){d?f.push(_):d=_}if(n.cancelBubble||g===t||g===null)break;r=g}if(d){for(let _ of f)queueMicrotask(()=>{throw _});throw d}}finally{n.__root=t,delete n.currentTarget,Ht(c),Qe(u)}}}function vd(n){var t=document.createElement("template");return t.innerHTML=n.replaceAll("<!>","<!---->"),t.content}function Hr(n,t){var e=it;e.nodes_start===null&&(e.nodes_start=n,e.nodes_end=t)}function wd(n,t){var e=(t&pu)!==0,i,s=!n.startsWith("<!>");return()=>{if(Et)return Hr(rt,null),rt;i===void 0&&(i=vd(s?n:"<!>"+n));var r=e||sl?document.importNode(i,!0):i.cloneNode(!0);{var o=Ln(r),a=r.lastChild;Hr(o,a)}return r}}function Rl(n,t){if(Et){var e=it;((e.f&ws)===0||e.nodes_end===null)&&(e.nodes_end=rt),Xa();return}n!==null&&n.before(t)}const Cd=["touchstart","touchmove"];function Rd(n){return Cd.includes(n)}function Tl(n,t){return Il(n,t)}function Td(n,t){Br(),t.intro=t.intro??!1;const e=t.target,i=Et,s=rt;try{for(var r=Ln(e);r&&(r.nodeType!==Ts||r.data!==La);)r=Le(r);if(!r)throw Rn;Is(!0),Se(r);const o=Il(n,{...t,anchor:r});return Is(!1),o}catch(o){if(o instanceof Error&&o.message.split(`
|
|
2
|
+
`).some(a=>a.startsWith("https://svelte.dev/e/")))throw o;return o!==Rn&&console.warn("Failed to hydrate: ",o),t.recover===!1&&Pu(),Br(),nd(e),Is(!1),Tl(n,t)}finally{Is(i),Se(s)}}const $i=new Map;function Il(n,{target:t,anchor:e,props:i={},events:s,context:r,intro:o=!0}){Br();var a=new Set,l=u=>{for(var d=0;d<u.length;d++){var f=u[d];if(!a.has(f)){a.add(f);var g=Rd(f);t.addEventListener(f,On,{passive:g});var m=$i.get(f);m===void 0?(document.addEventListener(f,On,{passive:g}),$i.set(f,1)):$i.set(f,m+1)}}};l(Eu(wl)),jr.add(l);var h=void 0,c=ld(()=>{var u=e??t.appendChild(bn());return Uu(u,{pending:()=>{}},d=>{if(r){Ka({});var f=Zt;f.c=r}if(s&&(i.$$events=s),Et&&Hr(d,null),h=n(d,i)||{},Et&&(it.nodes_end=rt,rt===null||rt.nodeType!==Ts||rt.data!==Ma))throw zr(),Rn;r&&Ba()}),()=>{for(var d of a){t.removeEventListener(d,On);var f=$i.get(d);--f===0?(document.removeEventListener(d,On),$i.delete(d)):$i.set(d,f)}jr.delete(l),u!==e&&u.parentNode?.removeChild(u)}});return qr.set(h,c),h}let qr=new WeakMap;function Id(n,t){const e=qr.get(n);return e?(qr.delete(n),e(t)):Promise.resolve()}function Sd(n){Zt===null&&Su(),Ur(()=>{const t=Vr(n);if(typeof t=="function")return t})}function bd(n,t){hd(()=>{var e=n.getRootNode(),i=e.host?e:e.head??e.ownerDocument.head;if(!i.querySelector("#"+t.hash)){const s=document.createElement("style");s.id=t.hash,s.textContent=t.code,i.appendChild(s)}})}let Ns=!1;function Ld(n){var t=Ns;try{return Ns=!1,[n(),Ns]}finally{Ns=t}}function vi(n,t,e,i){var s=(e&_u)!==0,r=(e&mu)!==0,o=i,a=!0,l=()=>(a&&(a=!1,o=r?Vr(i):i),o),h;if(s){var c=Rs in n||Na in n;h=_i(n,t)?.set??(c&&t in n?y=>n[t]=y:void 0)}var u,d=!1;s?[u,d]=Ld(()=>n[t]):u=n[t],u===void 0&&i!==void 0&&(u=l(),h&&(Ou(),h(u)));var f;if(f=()=>{var y=n[t];return y===void 0?l():(a=!0,y)},(e&gu)===0)return f;if(h){var g=n.$$legacy;return(function(y,w){return arguments.length>0?((!w||g||d)&&h(w?f():y),y):f()})}var m=!1,_=((e&fu)!==0?Wr:Hu)(()=>(m=!1,f()));s&&Z(_);var p=it;return(function(y,w){if(arguments.length>0){const x=w?Z(_):s?Yi(y):y;return Ot(_,x),m=!0,o!==void 0&&(o=x),y}return xi&&m||(p.f&Ve)!==0?_.v:Z(_)})}function Ad(n){return new Md(n)}class Md{#e;#t;constructor(t){var e=new Map,i=(r,o)=>{var a=Ju(o,!1,!1);return e.set(r,a),a};const s=new Proxy({...t.props||{},$$events:{}},{get(r,o){return Z(e.get(o)??i(o,Reflect.get(r,o)))},has(r,o){return o===Na?!0:(Z(e.get(o)??i(o,Reflect.get(r,o))),Reflect.has(r,o))},set(r,o,a){return Ot(e.get(o)??i(o,a),a),Reflect.set(r,o,a)}});this.#t=(t.hydrate?Td:Tl)(t.component,{target:t.target,anchor:t.anchor,props:s,context:t.context,intro:t.intro??!1,recover:t.recover}),(!t?.props?.$$host||t.sync===!1)&&je(),this.#e=s.$$events;for(const r of Object.keys(this.#t))r==="$set"||r==="$destroy"||r==="$on"||Es(this,r,{get(){return this.#t[r]},set(o){this.#t[r]=o},enumerable:!0});this.#t.$set=r=>{Object.assign(s,r)},this.#t.$destroy=()=>{Id(this.#t)}}$set(t){this.#t.$set(t)}$on(t,e){this.#e[t]=this.#e[t]||[];const i=(...s)=>e.call(this,...s);return this.#e[t].push(i),()=>{this.#e[t]=this.#e[t].filter(s=>s!==i)}}$destroy(){this.#t.$destroy()}}let Sl;typeof HTMLElement=="function"&&(Sl=class extends HTMLElement{$$ctor;$$s;$$c;$$cn=!1;$$d={};$$r=!1;$$p_d={};$$l={};$$l_u=new Map;$$me;constructor(n,t,e){super(),this.$$ctor=n,this.$$s=t,e&&this.attachShadow({mode:"open"})}addEventListener(n,t,e){if(this.$$l[n]=this.$$l[n]||[],this.$$l[n].push(t),this.$$c){const i=this.$$c.$on(n,t);this.$$l_u.set(t,i)}super.addEventListener(n,t,e)}removeEventListener(n,t,e){if(super.removeEventListener(n,t,e),this.$$c){const i=this.$$l_u.get(t);i&&(i(),this.$$l_u.delete(t))}}async connectedCallback(){if(this.$$cn=!0,!this.$$c){let n=function(i){return s=>{const r=document.createElement("slot");i!=="default"&&(r.name=i),Rl(s,r)}};if(await Promise.resolve(),!this.$$cn||this.$$c)return;const t={},e=Pd(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]=Gs(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=Ad({component:this.$$ctor,target:this.shadowRoot||this,props:{...this.$$d,$$slots:t,$$host:this}}),this.$$me=ad(()=>{ll(()=>{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=Gs(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]=Gs(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 Gs(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 Pd(n){const t={};return n.childNodes.forEach(e=>{t[e.slot||"default"]=!0}),t}function Od(n,t,e,i,s,r){let o=class extends Sl{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=>{Es(o.prototype,a,{get(){return this.$$c&&a in this.$$c?this.$$c[a]:this.$$d[a]},set(l){l=Gs(a,l,t),this.$$d[a]=l;var h=this.$$c;if(h){var c=_i(h,a)?.get;c?h[a]=l:h.$set({[a]:l})}}})}),i.forEach(a=>{Es(o.prototype,a,{get(){return this.$$c?.[a]}})}),n.element=o,o}const Dt={ADD:"add",REMOVE:"remove"},Ki={PROPERTYCHANGE:"propertychange"},W={CHANGE:"change",ERROR:"error",CONTEXTMENU:"contextmenu",CLICK:"click",DBLCLICK:"dblclick",KEYDOWN:"keydown",KEYPRESS:"keypress",LOAD:"load",TOUCHMOVE:"touchmove",WHEEL:"wheel"};class zs{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}}function Dd(n,t,e){let i,s;e=e||Me;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 Me(n,t){return n>t?1:n<t?-1:0}function Fd(n,t){return n<t?1:n>t?-1:0}function Jr(n,t,e){if(n[0]<=t)return 0;const i=n.length;if(t<=n[i-1])return i-1;if(typeof e=="function"){for(let s=1;s<i;++s){const r=n[s];if(r===t)return s;if(r<t)return e(t,n[s-1],r)>0?s-1:s}return i-1}if(e>0){for(let s=1;s<i;++s)if(n[s]<t)return s-1;return i-1}if(e<0){for(let s=1;s<i;++s)if(n[s]<=t)return s;return i-1}for(let s=1;s<i;++s){if(n[s]==t)return s;if(n[s]<t)return n[s-1]-t<t-n[s]?s-1:s}return i-1}function kd(n,t,e){for(;t<e;){const i=n[t];n[t]=n[e],n[e]=i,++t,--e}}function Qr(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 ti(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 Nd(n,t,e){const i=t||Me;return n.every(function(s,r){if(r===0)return!0;const o=i(n[r-1],s);return!(o>0||o===0)})}function Dn(){return!0}function Xs(){return!1}function Fn(){}function bl(n){let t,e,i;return function(){const s=Array.prototype.slice.call(arguments);return(!e||this!==i||!ti(s,e))&&(i=this,e=s,t=n.apply(this,arguments)),t}}function Gd(n){function t(){let e;try{e=n()}catch(i){return Promise.reject(i)}return e instanceof Promise?e:Promise.resolve(e)}return t()}function kn(n){for(const t in n)delete n[t]}function Bi(n){let t;for(t in n)return!1;return!t}class Pe{constructor(t){this.propagationStopped,this.defaultPrevented,this.type=t,this.target=null}preventDefault(){this.defaultPrevented=!0}stopPropagation(){this.propagationStopped=!0}}class Ws extends zs{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 Pe(t):t;r.target||(r.target=this.eventTarget_||this);const o=this.dispatching_||(this.dispatching_={}),a=this.pendingRemovals_||(this.pendingRemovals_={});i in o||(o[i]=0,a[i]=0),++o[i];let l;for(let h=0,c=s.length;h<c;++h)if("handleEvent"in s[h]?l=s[h].handleEvent(r):l=s[h].call(this,r),l===!1||r.propagationStopped){l=!1;break}if(--o[i]===0){let h=a[i];for(delete a[i];h--;)this.removeEventListener(i,Fn);delete o[i]}return l}disposeInternal(){this.listeners_&&kn(this.listeners_)}getListeners(t){return this.listeners_&&this.listeners_[t]||void 0}hasListener(t){return this.listeners_?t?t in this.listeners_:Object.keys(this.listeners_).length>0:!1}removeEventListener(t,e){if(!this.listeners_)return;const i=this.listeners_[t];if(!i)return;const s=i.indexOf(e);s!==-1&&(this.pendingRemovals_&&t in this.pendingRemovals_?(i[s]=Fn,++this.pendingRemovals_[t]):(i.splice(s,1),i.length===0&&delete this.listeners_[t]))}}function U(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 Ys(n,t,e,i){return U(n,t,e,i,!0)}function st(n){n&&n.target&&(n.target.removeEventListener(n.type,n.listener),kn(n))}class Nn extends Ws{constructor(){super(),this.on=this.onInternal,this.once=this.onceInternal,this.un=this.unInternal,this.revision_=0}changed(){++this.revision_,this.dispatchEvent(W.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]=U(this,t[r],e);return s}return U(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]=Ys(this,t[r],e)}else i=Ys(this,t,e);return e.ol_key=i,i}unInternal(t,e){const i=e.ol_key;if(i)zd(i);else if(Array.isArray(t))for(let s=0,r=t.length;s<r;++s)this.removeEventListener(t[s],e);else this.removeEventListener(t,e)}}Nn.prototype.on,Nn.prototype.once,Nn.prototype.un;function zd(n){if(Array.isArray(n))for(let t=0,e=n.length;t<e;++t)st(n[t]);else st(n)}function V(){throw new Error("Unimplemented abstract method.")}let Xd=0;function j(n){return n.ol_uid||(n.ol_uid=String(++Xd))}class Ll extends Pe{constructor(t,e,i){super(t),this.key=e,this.oldValue=i}}class ue extends Nn{constructor(t){super(),this.on,this.once,this.un,j(this),this.values_=null,t!==void 0&&this.setProperties(t)}get(t){let e;return this.values_&&this.values_.hasOwnProperty(t)&&(e=this.values_[t]),e}getKeys(){return this.values_&&Object.keys(this.values_)||[]}getProperties(){return this.values_&&Object.assign({},this.values_)||{}}getPropertiesInternal(){return this.values_}hasProperties(){return!!this.values_}notify(t,e){let i;i=`change:${t}`,this.hasListener(i)&&this.dispatchEvent(new Ll(i,t,e)),i=Ki.PROPERTYCHANGE,this.hasListener(i)&&this.dispatchEvent(new Ll(i,t,e))}addChangeListener(t,e){this.addEventListener(`change:${t}`,e)}removeChangeListener(t,e){this.removeEventListener(`change:${t}`,e)}set(t,e,i){const s=this.values_||(this.values_={});if(i)s[t]=e;else{const r=s[t];s[t]=e,r!==e&&this.notify(t,r)}}setProperties(t,e){for(const i in t)this.set(i,t[i],e)}applyProperties(t){t.values_&&Object.assign(this.values_||(this.values_={}),t.values_)}unset(t,e){if(this.values_&&t in this.values_){const i=this.values_[t];delete this.values_[t],Bi(this.values_)&&(this.values_=null),e||this.notify(t,i)}}}const Al={LENGTH:"length"};class $s extends Pe{constructor(t,e,i){super(t),this.element=e,this.index=i}}class Jt extends ue{constructor(t,e){if(super(),this.on,this.once,this.un,e=e||{},this.unique_=!!e.unique,this.array_=t??[],this.unique_)for(let i=1,s=this.array_.length;i<s;++i)this.assertUnique_(this.array_[i],i);this.updateLength_()}clear(){for(;this.getLength()>0;)this.pop()}extend(t){for(let e=0,i=t.length;e<i;++e)this.push(t[e]);return this}forEach(t){const e=this.array_;for(let i=0,s=e.length;i<s;++i)t(e[i],i,e)}getArray(){return this.array_}item(t){return this.array_[t]}getLength(){return this.get(Al.LENGTH)}insertAt(t,e){if(t<0||t>this.getLength())throw new Error("Index out of bounds: "+t);this.unique_&&this.assertUnique_(e),this.array_.splice(t,0,e),this.updateLength_(),this.dispatchEvent(new $s(Dt.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 $s(Dt.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 $s(Dt.REMOVE,s,t)),this.dispatchEvent(new $s(Dt.ADD,e,t))}updateLength_(){this.set(Al.LENGTH,this.array_.length)}assertUnique_(t,e){const i=this.array_;for(let s=0,r=i.length;s<r;++s)if(i[s]===t&&s!==e)throw new Error("Duplicate item added to a unique collection")}}function Q(n,t){if(!n)throw new Error(t)}class to extends ue{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 to(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_&&(st(this.geometryChangeKey_),this.geometryChangeKey_=null);const t=this.getGeometry();t&&(this.geometryChangeKey_=U(t,W.CHANGE,this.handleGeometryChange_,this)),this.changed()}setGeometry(t){this.set(this.geometryName_,t)}setStyle(t){this.style_=t,this.styleFunction_=t?Wd(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 Wd(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 ft={UNKNOWN:0,INTERSECTING:1,ABOVE:2,RIGHT:4,BELOW:8,LEFT:16};function Ml(n){const t=$t();for(let e=0,i=n.length;e<i;++e)zn(t,n[e]);return t}function eo(n,t,e){return e?(e[0]=n[0]-t,e[1]=n[1]-t,e[2]=n[2]+t,e[3]=n[3]+t,e):[n[0]-t,n[1]-t,n[2]+t,n[3]+t]}function Pl(n,t){return t?(t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t):n.slice()}function Ol(n,t,e){let i,s;return t<n[0]?i=n[0]-t:n[2]<t?i=t-n[2]:i=0,e<n[1]?s=n[1]-e:n[3]<e?s=e-n[3]:s=0,i*i+s*s}function Zi(n,t){return Dl(n,t[0],t[1])}function Ui(n,t){return n[0]<=t[0]&&t[2]<=n[2]&&n[1]<=t[1]&&t[3]<=n[3]}function Dl(n,t,e){return n[0]<=t&&t<=n[2]&&n[1]<=e&&e<=n[3]}function io(n,t){const e=n[0],i=n[1],s=n[2],r=n[3],o=t[0],a=t[1];let l=ft.UNKNOWN;return o<e?l=l|ft.LEFT:o>s&&(l=l|ft.RIGHT),a<i?l=l|ft.BELOW:a>r&&(l=l|ft.ABOVE),l===ft.UNKNOWN&&(l=ft.INTERSECTING),l}function $t(){return[1/0,1/0,-1/0,-1/0]}function ei(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 Ks(n){return ei(1/0,1/0,-1/0,-1/0,n)}function Fl(n,t){const e=n[0],i=n[1];return ei(e,i,e,i,t)}function no(n,t,e,i,s){const r=Ks(s);return Nl(r,n,t,e,i)}function Gn(n,t){return n[0]==t[0]&&n[2]==t[2]&&n[1]==t[1]&&n[3]==t[3]}function kl(n,t){return t[0]<n[0]&&(n[0]=t[0]),t[2]>n[2]&&(n[2]=t[2]),t[1]<n[1]&&(n[1]=t[1]),t[3]>n[3]&&(n[3]=t[3]),n}function zn(n,t){t[0]<n[0]&&(n[0]=t[0]),t[0]>n[2]&&(n[2]=t[0]),t[1]<n[1]&&(n[1]=t[1]),t[1]>n[3]&&(n[3]=t[1])}function Nl(n,t,e,i,s){for(;e<i;e+=s)Yd(n,t[e],t[e+1]);return n}function Yd(n,t,e){n[0]=Math.min(n[0],t),n[1]=Math.min(n[1],e),n[2]=Math.max(n[2],t),n[3]=Math.max(n[3],e)}function Gl(n,t){let e;return e=t(Bs(n)),e||(e=t(Zs(n)),e)||(e=t(Us(n)),e)||(e=t(Ri(n)),e)?e:!1}function so(n){let t=0;return Vs(n)||(t=tt(n)*Lt(n)),t}function Bs(n){return[n[0],n[1]]}function Zs(n){return[n[2],n[1]]}function wi(n){return[(n[0]+n[2])/2,(n[1]+n[3])/2]}function $d(n,t){let e;if(t==="bottom-left")e=Bs(n);else if(t==="bottom-right")e=Zs(n);else if(t==="top-left")e=Ri(n);else if(t==="top-right")e=Us(n);else throw new Error("Invalid corner");return e}function ro(n,t,e,i,s){const[r,o,a,l,h,c,u,d]=zl(n,t,e,i);return ei(Math.min(r,a,h,u),Math.min(o,l,c,d),Math.max(r,a,h,u),Math.max(o,l,c,d),s)}function zl(n,t,e,i){const s=t*i[0]/2,r=t*i[1]/2,o=Math.cos(e),a=Math.sin(e),l=s*o,h=s*a,c=r*o,u=r*a,d=n[0],f=n[1];return[d-l+u,f-h-c,d-l-u,f-h+c,d+l-u,f+h+c,d+l+u,f+h-c,d-l+u,f-h-c]}function Lt(n){return n[3]-n[1]}function Ci(n,t,e){const i=e||$t();return Ft(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]):Ks(i),i}function Ri(n){return[n[0],n[3]]}function Us(n){return[n[2],n[3]]}function tt(n){return n[2]-n[0]}function Ft(n,t){return n[0]<=t[2]&&n[2]>=t[0]&&n[1]<=t[3]&&n[3]>=t[1]}function Vs(n){return n[2]<n[0]||n[3]<n[1]}function Kd(n,t){return t?(t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t):n}function Bd(n,t,e){let i=!1;const s=io(n,t),r=io(n,e);if(s===ft.INTERSECTING||r===ft.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&ft.ABOVE&&!(s&ft.ABOVE)&&(m=d-(f-h)/g,i=m>=o&&m<=l),!i&&r&ft.RIGHT&&!(s&ft.RIGHT)&&(_=f-(d-l)*g,i=_>=a&&_<=h),!i&&r&ft.BELOW&&!(s&ft.BELOW)&&(m=d-(f-a)/g,i=m>=o&&m<=l),!i&&r&ft.LEFT&&!(s&ft.LEFT)&&(_=f-(d-o)*g,i=_>=a&&_<=h)}return i}function Xl(n,t){const e=t.getExtent(),i=wi(n);if(t.canWrapX()&&(i[0]<e[0]||i[0]>=e[2])){const s=tt(e),o=Math.floor((i[0]-e[0])/s)*s;n[0]-=o,n[2]-=o}return n}function Wl(n,t,e){if(t.canWrapX()){const i=t.getExtent();if(!isFinite(n[0])||!isFinite(n[2]))return[[i[0],n[1],i[2],n[3]]];Xl(n,t);const s=tt(i);if(tt(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 ot(n,t,e){return Math.min(Math.max(n,t),e)}function Zd(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 Vi(n,t,e,i)}function Vi(n,t,e,i){const s=e-n,r=i-t;return s*s+r*r}function Ud(n){const t=n.length;for(let i=0;i<t;i++){let s=i,r=Math.abs(n[i][i]);for(let a=i+1;a<t;a++){const l=Math.abs(n[a][i]);l>r&&(r=l,s=a)}if(r===0)return null;const o=n[s];n[s]=n[i],n[i]=o;for(let a=i+1;a<t;a++){const l=-n[a][i]/n[i][i];for(let h=i;h<t+1;h++)i==h?n[a][h]=0:n[a][h]+=l*n[i][h]}}const e=new Array(t);for(let i=t-1;i>=0;i--){e[i]=n[i][t]/n[i][i];for(let s=i-1;s>=0;s--)n[s][t]-=n[s][i]*e[i]}return e}function Yl(n){return n*180/Math.PI}function ii(n){return n*Math.PI/180}function ji(n,t){const e=n%t;return e*t<0?e+t:e}function Qt(n,t,e){return n+e*(t-n)}function js(n,t){const e=Math.pow(10,t);return Math.round(n*e)/e}function Hs(n,t){return Math.floor(js(n,t))}function qs(n,t){return Math.ceil(js(n,t))}function oo(n,t,e){if(n>=t&&n<e)return n;const i=e-t;return((n-t)%i+i)%i+t}const Vd=63710088e-1;function $l(n,t,e){e=e||Vd;const i=ii(n[1]),s=ii(t[1]),r=(s-i)/2,o=ii(t[0]-n[0])/2,a=Math.sin(r)*Math.sin(r)+Math.sin(o)*Math.sin(o)*Math.cos(i)*Math.cos(s);return 2*e*Math.atan2(Math.sqrt(a),Math.sqrt(1-a))}function Kl(...n){console.warn(...n)}function jd(n,t){return n[0]+=+t[0],n[1]+=+t[1],n}function Js(n,t){let e=!0;for(let i=n.length-1;i>=0;--i)if(n[i]!=t[i]){e=!1;break}return e}function ao(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 Hd(n,t){return n[0]*=t,n[1]*=t,n}function Bl(n,t){if(t.canWrapX()){const e=tt(t.getExtent()),i=qd(n,t,e);i&&(n[0]-=i*e)}return n}function qd(n,t,e){const i=t.getExtent();let s=0;return t.canWrapX()&&(n[0]<i[0]||n[0]>i[2])&&(e=e||tt(i),s=Math.floor((n[0]-i[0])/e)),s}const lo={radians:6370997/(2*Math.PI),degrees:2*Math.PI*6370997/360,ft:.3048,m:1,"us-ft":1200/3937};class ho{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_||lo[this.units_]}getWorldExtent(){return this.worldExtent_}getAxisOrientation(){return this.axisOrientation_}isGlobal(){return this.global_}setGlobal(t){this.global_=t,this.canWrapX_=!!(t&&this.extent_)}getDefaultTileGrid(){return this.defaultTileGrid_}setDefaultTileGrid(t){this.defaultTileGrid_=t}setExtent(t){this.extent_=t,this.canWrapX_=!!(this.global_&&t)}setWorldExtent(t){this.worldExtent_=t}setGetPointResolution(t){this.getPointResolutionFunc_=t}getPointResolutionFunc(){return this.getPointResolutionFunc_}}const Xn=6378137,Hi=Math.PI*Xn,Jd=[-Hi,-Hi,Hi,Hi],Qd=[-180,-85,180,85],Qs=Xn*Math.log(Math.tan(Math.PI/2));class qi extends ho{constructor(t){super({code:t,units:"m",extent:Jd,global:!0,worldExtent:Qd,getPointResolution:function(e,i){return e/Math.cosh(i[1]/Xn)}})}}const Zl=[new qi("EPSG:3857"),new qi("EPSG:102100"),new qi("EPSG:102113"),new qi("EPSG:900913"),new qi("http://www.opengis.net/def/crs/EPSG/0/3857"),new qi("http://www.opengis.net/gml/srs/epsg.xml#3857")];function tf(n,t,e,i){const s=n.length;e=e>1?e:2,i=i??e,t===void 0&&(e>2?t=n.slice():t=new Array(s));for(let r=0;r<s;r+=i){t[r]=Hi*n[r]/180;let o=Xn*Math.log(Math.tan(Math.PI*(+n[r+1]+90)/360));o>Qs?o=Qs:o<-Qs&&(o=-Qs),t[r+1]=o}return t}function ef(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]/Hi,t[r+1]=360*Math.atan(Math.exp(n[r+1]/Xn))/Math.PI-90;return t}const nf=6378137,Ul=[-180,-90,180,90],sf=Math.PI*nf/180;class Ti extends ho{constructor(t,e){super({code:t,units:"degrees",extent:Ul,axisOrientation:e,global:!0,metersPerUnit:sf,worldExtent:Ul})}}const Vl=[new Ti("CRS:84"),new Ti("EPSG:4326","neu"),new Ti("urn:ogc:def:crs:OGC:1.3:CRS84"),new Ti("urn:ogc:def:crs:OGC:2:84"),new Ti("http://www.opengis.net/def/crs/OGC/1.3/CRS84"),new Ti("http://www.opengis.net/gml/srs/epsg.xml#4326","neu"),new Ti("http://www.opengis.net/def/crs/EPSG/0/4326","neu")];let co={};function rf(n){return co[n]||co[n.replace(/urn:(x-)?ogc:def:crs:EPSG:(.*:)?(\w+)$/,"EPSG:$3")]||null}function of(n,t){co[n]=t}let Ji={};function Wn(n,t,e){const i=n.getCode(),s=t.getCode();i in Ji||(Ji[i]={}),Ji[i][s]=e}function uo(n,t){return n in Ji&&t in Ji[n]?Ji[n][t]:null}const tr=.9996,te=.00669438,er=te*te,ir=er*te,Ii=te/(1-te),jl=Math.sqrt(1-te),Qi=(1-jl)/(1+jl),Hl=Qi*Qi,fo=Hl*Qi,go=fo*Qi,ql=go*Qi,Jl=1-te/4-3*er/64-5*ir/256,af=3*te/8+3*er/32+45*ir/1024,lf=15*er/256+45*ir/1024,hf=35*ir/3072,cf=3/2*Qi-27/32*fo+269/512*ql,uf=21/16*Hl-55/32*go,df=151/96*fo-417/128*ql,ff=1097/512*go,nr=6378137;function gf(n,t,e){const i=n-5e5,o=(e.north?t:t-1e7)/tr/(nr*Jl),a=o+cf*Math.sin(2*o)+uf*Math.sin(4*o)+df*Math.sin(6*o)+ff*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-te*h,m=Math.sqrt(1-te*h),_=nr/m,p=(1-te)/g,y=Ii*c**2,w=y*y,x=i/(_*tr),E=x*x,T=E*x,I=T*x,v=I*x,R=v*x,b=a-u/p*(E/2-I/24*(5+3*d+10*y-4*w-9*Ii))+R/720*(61+90*d+298*y+45*f-252*Ii-3*w);let O=(x-T/6*(1+2*d+y)+v/120*(5-2*y+28*d-3*w+8*Ii+24*f))/c;return O=oo(O+ii(eh(e.number)),-Math.PI,Math.PI),[Yl(O),Yl(b)]}const Ql=-80,th=84,_f=-180,mf=180;function pf(n,t,e){n=oo(n,_f,mf),t<Ql?t=Ql:t>th&&(t=th);const i=ii(t),s=Math.sin(i),r=Math.cos(i),o=s/r,a=o*o,l=a*a,h=ii(n),c=eh(e.number),u=ii(c),d=nr/Math.sqrt(1-te*s**2),f=Ii*r**2,g=r*oo(h-u,-Math.PI,Math.PI),m=g*g,_=m*g,p=_*g,y=p*g,w=y*g,x=nr*(Jl*i-af*Math.sin(2*i)+lf*Math.sin(4*i)-hf*Math.sin(6*i)),E=tr*d*(g+_/6*(1-a+f)+y/120*(5-18*a+l+72*f-58*Ii))+5e5;let T=tr*(x+d*o*(m/2+p/24*(5-a+9*f+4*f**2)+w/720*(61-58*a+l+600*f-330*Ii)));return e.north||(T+=1e7),[E,T]}function eh(n){return(n-1)*6-180+3}const yf=[/^EPSG:(\d+)$/,/^urn:ogc:def:crs:EPSG::(\d+)$/,/^http:\/\/www\.opengis\.net\/def\/crs\/EPSG\/0\/(\d+)$/];function ih(n){let t=0;for(const s of yf){const r=n.match(s);if(r){t=parseInt(r[1]);break}}if(!t)return null;let e=0,i=!1;return t>32700&&t<32761?e=t-32700:t>32600&&t<32661&&(i=!0,e=t-32600),e?{number:e,north:i}:null}function nh(n,t){return function(e,i,s,r){const o=e.length;s=s>1?s:2,r=r??s,i||(s>2?i=e.slice():i=new Array(o));for(let a=0;a<o;a+=r){const l=e[a],h=e[a+1],c=n(l,h,t);i[a]=c[0],i[a+1]=c[1]}return i}}function xf(n){return ih(n)?new ho({code:n,units:"m"}):null}function Ef(n){const t=ih(n.getCode());return t?{forward:nh(pf,t),inverse:nh(gf,t)}:null}const vf=[Ef],wf=[xf];let _o=!0;function sh(n){_o=!1}function mo(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 po(n){of(n.getCode(),n),Wn(n,n,mo)}function Cf(n){n.forEach(po)}function kt(n){if(typeof n!="string")return n;const t=rf(n);if(t)return t;for(const e of wf){const i=e(n);if(i)return i}return null}function rh(n,t,e,i){n=kt(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=Eo(n,kt("EPSG:4326"));if(!a&&o!=="degrees")s=t*n.getMetersPerUnit();else{let h=[e[0]-t/2,e[1],e[0]+t/2,e[1],e[0],e[1]-t/2,e[0],e[1]+t/2];h=a(h,h,2);const c=$l(h.slice(0,2),h.slice(2,4)),u=$l(h.slice(4,6),h.slice(6,8));s=(c+u)/2}const l=n.getMetersPerUnit();l!==void 0&&(s/=l)}}return s}function oh(n){Cf(n),n.forEach(function(t){n.forEach(function(e){t!==e&&Wn(t,e,mo)})})}function Rf(n,t,e,i){n.forEach(function(s){t.forEach(function(r){Wn(s,r,e),Wn(r,s,i)})})}function yo(n,t){return n?typeof n=="string"?kt(n):n:kt(t)}function Tf(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 xo(n,t){return sh(),Yn(n,"EPSG:4326","EPSG:3857")}function sr(n,t){if(n===t)return!0;const e=n.getUnits()===t.getUnits();return(n.getCode()===t.getCode()||Eo(n,t)===mo)&&e}function Eo(n,t){const e=n.getCode(),i=t.getCode();let s=uo(e,i);if(s)return s;let r=null,o=null;for(const l of vf)r||(r=l(n)),o||(o=l(t));if(!r&&!o)return null;const a="EPSG:4326";if(o)if(r)s=vo(r.inverse,o.forward);else{const l=uo(e,a);l&&(s=vo(l,o.forward))}else{const l=uo(a,i);l&&(s=vo(r.inverse,l))}return s&&(po(n),po(t),Wn(n,t,s)),s}function vo(n,t){return function(e,i,s,r){return i=n(e,i,s,r),t(i,i,s,r)}}function rr(n,t){const e=kt(n),i=kt(t);return Eo(e,i)}function Yn(n,t,e){const i=rr(t,e);if(!i){const s=kt(t).getCode(),r=kt(e).getCode();throw new Error(`No transform available between ${s} and ${r}`)}return i(n,void 0,n.length)}function wo(n,t){return n}function Oe(n,t){return _o&&!Js(n,[0,0])&&n[0]>=-180&&n[0]<=180&&n[1]>=-90&&n[1]<=90&&(_o=!1,Kl("Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.")),n}function ah(n,t){return n}function ni(n,t){return n}function If(){oh(Zl),oh(Vl),Rf(Vl,Zl,tf,ef)}If(),new Array(6);function de(){return[1,0,0,1,0,0]}function Sf(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 gt(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 De(n,t,e,i,s,r,o,a){const l=Math.sin(r),h=Math.cos(r);return n[0]=i*h,n[1]=s*l,n[2]=-i*l,n[3]=s*h,n[4]=o*i*h-a*i*l+t,n[5]=o*s*l+a*s*h+e,n}function lh(n,t){const e=bf(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 bf(n){return n[0]*n[3]-n[1]*n[2]}const Lf=[1e5,1e5,1e5,1e5,2,2];function Af(n){return"matrix("+n.join(", ")+")"}function Co(n){return n.substring(7,n.length-1).split(",").map(parseFloat)}function Mf(n,t){const e=Co(n),i=Co(t);for(let s=0;s<6;++s)if(Math.round((e[s]-i[s])*Lf[s])!==0)return!1;return!0}function si(n,t,e,i,s,r,o){r=r||[],o=o||2;let a=0;for(let l=t;l<e;l+=i){const h=n[l],c=n[l+1];r[a++]=s[0]*h+s[2]*c+s[4],r[a++]=s[1]*h+s[3]*c+s[5];for(let u=2;u<o;u++)r[a++]=n[l+u]}return r&&r.length!=a&&(r.length=a),r}function hh(n,t,e,i,s,r,o){o=o||[];const a=Math.cos(s),l=Math.sin(s),h=r[0],c=r[1];let u=0;for(let d=t;d<e;d+=i){const f=n[d]-h,g=n[d+1]-c;o[u++]=h+f*a-g*l,o[u++]=c+f*l+g*a;for(let m=d+2;m<d+i;++m)o[u++]=n[m]}return o&&o.length!=u&&(o.length=u),o}function Pf(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 Of(n,t,e,i,s,r,o){o=o||[];let a=0;for(let l=t;l<e;l+=i){o[a++]=n[l]+s,o[a++]=n[l+1]+r;for(let h=l+2;h<l+i;++h)o[a++]=n[h]}return o&&o.length!=a&&(o.length=a),o}const ch=de(),Df=[NaN,NaN];class Ff extends ue{constructor(){super(),this.extent_=$t(),this.extentRevision_=-1,this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=0,this.simplifyTransformedInternal=bl((t,e,i)=>{if(!i)return this.getSimplifiedGeometry(e);const s=this.clone();return s.applyTransform(i),s.getSimplifiedGeometry(e)})}simplifyTransformed(t,e){return this.simplifyTransformedInternal(this.getRevision(),t,e)}clone(){return V()}closestPointXY(t,e,i,s){return V()}containsXY(t,e){return this.closestPointXY(t,e,Df,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 V()}getExtent(t){if(this.extentRevision_!=this.getRevision()){const e=this.computeExtent(this.extent_);(isNaN(e[0])||isNaN(e[1]))&&Ks(e),this.extentRevision_=this.getRevision()}return Kd(this.extent_,t)}rotate(t,e){V()}scale(t,e,i){V()}simplify(t){return this.getSimplifiedGeometry(t*t)}getSimplifiedGeometry(t){return V()}getType(){return V()}applyTransform(t){V()}intersectsExtent(t){return V()}translate(t,e){V()}transform(t,e){const i=kt(t),s=i.getUnits()=="tile-pixels"?function(r,o,a){const l=i.getExtent(),h=i.getWorldExtent(),c=Lt(h)/Lt(l);De(ch,h[0],h[3],c,-c,0,0,0);const u=si(r,0,r.length,a,ch,o),d=rr(i,e);return d?d(u,u,a):u}:rr(i,e);return this.applyTransform(s),this}}class Ro extends Ff{constructor(){super(),this.layout="XY",this.stride=2,this.flatCoordinates}computeExtent(t){return no(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t)}getCoordinates(){return V()}getFirstCoordinate(){return this.flatCoordinates.slice(0,this.stride)}getFlatCoordinates(){return this.flatCoordinates}getLastCoordinate(){return this.flatCoordinates.slice(this.flatCoordinates.length-this.stride)}getLayout(){return this.layout}getSimplifiedGeometry(t){if(this.simplifiedGeometryRevision!==this.getRevision()&&(this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=this.getRevision()),t<0||this.simplifiedGeometryMaxMinSquaredTolerance!==0&&t<=this.simplifiedGeometryMaxMinSquaredTolerance)return this;const e=this.getSimplifiedGeometryInternal(t);return e.getFlatCoordinates().length<this.flatCoordinates.length?e:(this.simplifiedGeometryMaxMinSquaredTolerance=t,this)}getSimplifiedGeometryInternal(t){return this}getStride(){return this.stride}setFlatCoordinates(t,e){this.stride=uh(t),this.layout=t,this.flatCoordinates=e}setCoordinates(t,e){V()}setLayout(t,e,i){let s;if(t)s=uh(t);else{for(let r=0;r<i;++r){if(e.length===0){this.layout="XY",this.stride=2;return}e=e[0]}s=e.length,t=kf(s)}this.layout=t,this.stride=s}applyTransform(t){this.flatCoordinates&&(t(this.flatCoordinates,this.flatCoordinates,this.layout.startsWith("XYZ")?3:2,this.stride),this.changed())}rotate(t,e){const i=this.getFlatCoordinates();if(i){const s=this.getStride();hh(i,0,i.length,s,t,e,i),this.changed()}}scale(t,e,i){e===void 0&&(e=t),i||(i=wi(this.getExtent()));const s=this.getFlatCoordinates();if(s){const r=this.getStride();Pf(s,0,s.length,r,t,e,i,s),this.changed()}}translate(t,e){const i=this.getFlatCoordinates();if(i){const s=this.getStride();Of(i,0,i.length,s,t,e,i),this.changed()}}}function kf(n){let t;return n==2?t="XY":n==3?t="XYZ":n==4&&(t="XYZM"),t}function uh(n){let t;return n=="XY"?t=2:n=="XYZ"||n=="XYM"?t=3:n=="XYZM"&&(t=4),t}function Nf(n,t,e){const i=n.getFlatCoordinates();if(!i)return null;const s=n.getStride();return si(i,0,i.length,s,t,e)}function dh(n,t,e,i){let s=0;const r=n[e-i],o=n[e-i+1];let a=0,l=0;for(;t<e;t+=i){const h=n[t]-r,c=n[t+1]-o;s+=l*h-a*c,a=h,l=c}return s/2}function Gf(n,t,e,i){let s=0;for(let r=0,o=e.length;r<o;++r){const a=e[r];s+=dh(n,t,a,i),t=a}return s}function fh(n,t,e,i,s,r,o){const a=n[t],l=n[t+1],h=n[e]-a,c=n[e+1]-l;let u;if(h===0&&c===0)u=t;else{const d=((s-a)*h+(r-l)*c)/(h*h+c*c);if(d>1)u=e;else if(d>0){for(let f=0;f<i;++f)o[f]=Qt(n[t+f],n[e+f],d);o.length=i;return}else u=t}for(let d=0;d<i;++d)o[d]=n[u+d];o.length=i}function gh(n,t,e,i,s){let r=n[t],o=n[t+1];for(t+=i;t<e;t+=i){const a=n[t],l=n[t+1],h=Vi(r,o,a,l);h>s&&(s=h),r=a,o=l}return s}function zf(n,t,e,i,s){for(let r=0,o=e.length;r<o;++r){const a=e[r];s=gh(n,t,a,i,s),t=a}return s}function _h(n,t,e,i,s,r,o,a,l,h,c){if(t==e)return h;let u,d;if(s===0){if(d=Vi(o,a,n[t],n[t+1]),d<h){for(u=0;u<i;++u)l[u]=n[t+u];return l.length=i,d}return h}c=c||[NaN,NaN];let f=t+i;for(;f<e;)if(fh(n,f-i,f,i,o,a,c),d=Vi(o,a,c[0],c[1]),d<h){for(h=d,u=0;u<i;++u)l[u]=c[u];l.length=i,f+=i}else f+=i*Math.max((Math.sqrt(d)-Math.sqrt(h))/s|0,1);if(fh(n,e-i,t,i,o,a,c),d=Vi(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 Xf(n,t,e,i,s,r,o,a,l,h,c){c=c||[NaN,NaN];for(let u=0,d=e.length;u<d;++u){const f=e[u];h=_h(n,t,f,i,s,r,o,a,l,h,c),t=f}return h}function Wf(n,t,e,i){for(let s=0,r=e.length;s<r;++s)n[t++]=e[s];return t}function mh(n,t,e,i){for(let s=0,r=e.length;s<r;++s){const o=e[s];for(let a=0;a<i;++a)n[t++]=o[a]}return t}function Yf(n,t,e,i,s){s=s||[];let r=0;for(let o=0,a=e.length;o<a;++o){const l=mh(n,t,e[o],i);s[r++]=l,t=l}return s.length=r,s}function tn(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 or(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++]=tn(n,t,l,i,s[r]),t=l}return s.length=r,s}function ph(n,t,e,i,s){s=s!==void 0?s:[];let r=0;for(let o=0,a=e.length;o<a;++o){const l=e[o];s[r++]=l.length===1&&l[0]===t?[]:or(n,t,l,i,s[r]),t=l[l.length-1]}return s.length=r,s}function To(n,t,e,i,s,r,o){const a=(e-t)/i;if(a<3){for(;t<e;t+=i)r[o++]=n[t],r[o++]=n[t+1];return o}const l=new Array(a);l[0]=1,l[a-1]=1;const h=[t,e-i];let c=0;for(;h.length>0;){const u=h.pop(),d=h.pop();let f=0;const g=n[d],m=n[d+1],_=n[u],p=n[u+1];for(let y=d+i;y<u;y+=i){const w=n[y],x=n[y+1],E=Zd(w,x,g,m,_,p);E>f&&(c=y,f=E)}f>s&&(l[(c-t)/i]=1,d+i<c&&h.push(d,c),c+i<u&&h.push(c,u))}for(let u=0;u<a;++u)l[u]&&(r[o++]=n[t+u*i],r[o++]=n[t+u*i+1]);return o}function $f(n,t,e,i,s,r,o,a){for(let l=0,h=e.length;l<h;++l){const c=e[l];o=To(n,t,c,i,s,r,o),a.push(o),t=c}return o}function Si(n,t){return t*Math.round(n/t)}function Kf(n,t,e,i,s,r,o){if(t==e)return o;let a=Si(n[t],s),l=Si(n[t+1],s);t+=i,r[o++]=a,r[o++]=l;let h,c;do if(h=Si(n[t],s),c=Si(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=Si(n[t],s),d=Si(n[t+1],s);if(t+=i,u==h&&d==c)continue;const f=h-a,g=c-l,m=u-a,_=d-l;if(f*_==g*m&&(f<0&&m<f||f==m||f>0&&m>f)&&(g<0&&_<g||g==_||g>0&&_>g)){h=u,c=d;continue}r[o++]=h,r[o++]=c,a=h,l=c,h=u,c=d}return r[o++]=h,r[o++]=c,o}function yh(n,t,e,i,s,r,o,a){for(let l=0,h=e.length;l<h;++l){const c=e[l];o=Kf(n,t,c,i,s,r,o),a.push(o),t=c}return o}class $n extends Ro{constructor(t,e){super(),this.maxDelta_=-1,this.maxDeltaRevision_=-1,e!==void 0&&!Array.isArray(t[0])?this.setFlatCoordinates(e,t):this.setCoordinates(t,e)}clone(){return new $n(this.flatCoordinates.slice(),this.layout)}closestPointXY(t,e,i,s){return s<Ol(this.getExtent(),t,e)?s:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(gh(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),_h(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!0,t,e,i,s))}getArea(){return dh(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinates(){return tn(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getSimplifiedGeometryInternal(t){const e=[];return e.length=To(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e,0),new $n(e,"XY")}getType(){return"LinearRing"}intersectsExtent(t){return!1}setCoordinates(t,e){this.setLayout(e,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=mh(this.flatCoordinates,0,t,this.stride),this.changed()}}class ar extends Ro{constructor(t,e){super(),this.setCoordinates(t,e)}clone(){const t=new ar(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(t,e,i,s){const r=this.flatCoordinates,o=Vi(t,e,r[0],r[1]);if(o<s){const a=this.stride;for(let l=0;l<a;++l)i[l]=r[l];return i.length=a,o}return s}getCoordinates(){return this.flatCoordinates.slice()}computeExtent(t){return Fl(this.flatCoordinates,t)}getType(){return"Point"}intersectsExtent(t){return Dl(t,this.flatCoordinates[0],this.flatCoordinates[1])}setCoordinates(t,e){this.setLayout(e,t,0),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Wf(this.flatCoordinates,0,t,this.stride),this.changed()}}function Bf(n,t,e,i,s){return!Gl(s,function(o){return!bi(n,t,e,i,o[0],o[1])})}function bi(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 xh(n,t,e,i,s,r){if(e.length===0||!bi(n,t,e[0],i,s,r))return!1;for(let o=1,a=e.length;o<a;++o)if(bi(n,e[o-1],e[o],i,s,r))return!1;return!0}function Io(n,t,e,i,s,r,o){let a,l,h,c,u,d,f;const g=s[r+1],m=[];for(let y=0,w=e.length;y<w;++y){const x=e[y];for(c=n[x-i],d=n[x-i+1],a=t;a<x;a+=i)u=n[a],f=n[a+1],(g<=d&&f<=g||d<=g&&g<=f)&&(h=(g-d)/(f-d)*(u-c)+c,m.push(h)),c=u,d=f}let _=NaN,p=-1/0;for(m.sort(Me),c=m[0],a=1,l=m.length;a<l;++a){u=m[a];const y=Math.abs(u-c);y>p&&(h=(c+u)/2,xh(n,t,e,i,h,g)&&(_=h,p=y)),c=u}return isNaN(_)&&(_=s[r]),o?(o.push(_,g,p),o):[_,g,p]}function Zf(n,t,e,i,s){let r=[];for(let o=0,a=e.length;o<a;++o){const l=e[o];r=Io(n,t,l,i,s,2*o,r),t=l[l.length-1]}return r}function Uf(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 Eh(n,t,e,i,s,r){return r=r??Nl($t(),n,t,e,i),Ft(s,r)?r[0]>=s[0]&&r[2]<=s[2]||r[1]>=s[1]&&r[3]<=s[3]?!0:Uf(n,t,e,i,function(o,a){return Bd(s,o,a)}):!1}function vh(n,t,e,i,s){return!!(Eh(n,t,e,i,s)||bi(n,t,e,i,s[0],s[1])||bi(n,t,e,i,s[0],s[3])||bi(n,t,e,i,s[2],s[1])||bi(n,t,e,i,s[2],s[3]))}function Vf(n,t,e,i,s){if(!vh(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(Bf(n,e[r-1],e[r],i,s)&&!Eh(n,e[r-1],e[r],i,s))return!1;return!0}function jf(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 So(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 Hf(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=So(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 wh(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=So(n,t,a,i);(r===0?s&&l||!s&&!l:s&&!l||!s&&l)&&jf(n,t,a,i),t=a}return t}function qf(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=So(n,i,l,2);if(r===void 0&&(r=h),h===r)e.push(t.slice(s,o+1));else{if(e.length===0)continue;e[e.length-1].push(t[s])}s=o+1,i=l}return e}class Kn extends Ro{constructor(t,e,i){super(),this.ends_=[],this.flatInteriorPointRevision_=-1,this.flatInteriorPoint_=null,this.maxDelta_=-1,this.maxDeltaRevision_=-1,this.orientedRevision_=-1,this.orientedFlatCoordinates_=null,e!==void 0&&i?(this.setFlatCoordinates(e,t),this.ends_=i):this.setCoordinates(t,e)}appendLinearRing(t){this.flatCoordinates?Qr(this.flatCoordinates,t.getFlatCoordinates()):this.flatCoordinates=t.getFlatCoordinates().slice(),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){const t=new Kn(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return t.applyProperties(this),t}closestPointXY(t,e,i,s){return s<Ol(this.getExtent(),t,e)?s:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(zf(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Xf(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!0,t,e,i,s))}containsXY(t,e){return xh(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,e)}getArea(){return Gf(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride)}getCoordinates(t){let e;return t!==void 0?(e=this.getOrientedFlatCoordinates().slice(),wh(e,0,this.ends_,this.stride,t)):e=this.flatCoordinates,or(e,0,this.ends_,this.stride)}getEnds(){return this.ends_}getFlatInteriorPoint(){if(this.flatInteriorPointRevision_!=this.getRevision()){const t=wi(this.getExtent());this.flatInteriorPoint_=Io(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,0),this.flatInteriorPointRevision_=this.getRevision()}return this.flatInteriorPoint_}getInteriorPoint(){return new ar(this.getFlatInteriorPoint(),"XYM")}getLinearRingCount(){return this.ends_.length}getLinearRing(t){return t<0||this.ends_.length<=t?null:new $n(this.flatCoordinates.slice(t===0?0:this.ends_[t-1],this.ends_[t]),this.layout)}getLinearRings(){const t=this.layout,e=this.flatCoordinates,i=this.ends_,s=[];let r=0;for(let o=0,a=i.length;o<a;++o){const l=i[o],h=new $n(e.slice(r,l),t);s.push(h),r=l}return s}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){const t=this.flatCoordinates;Hf(t,0,this.ends_,this.stride)?this.orientedFlatCoordinates_=t:(this.orientedFlatCoordinates_=t.slice(),this.orientedFlatCoordinates_.length=wh(this.orientedFlatCoordinates_,0,this.ends_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(t){const e=[],i=[];return e.length=yh(this.flatCoordinates,0,this.ends_,this.stride,Math.sqrt(t),e,0,i),new Kn(e,"XY",i)}getType(){return"Polygon"}intersectsExtent(t){return Vf(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,2),this.flatCoordinates||(this.flatCoordinates=[]);const i=Yf(this.flatCoordinates,0,t,this.stride,this.ends_);this.flatCoordinates.length=i.length===0?0:i[i.length-1],this.changed()}}function Ch(n){if(Vs(n))throw new Error("Cannot create polygon from empty extent");const t=n[0],e=n[1],i=n[2],s=n[3],r=[t,e,t,s,i,s,i,e,t,e];return new Kn(r,"XY",[r.length])}function Rh(n,t,e,i,s,r,o){let a,l;const h=(e-t)/i;if(h===1)a=t;else if(h===2)a=t,l=s;else if(h!==0){let c=n[t],u=n[t+1],d=0;const f=[0];for(let _=t+i;_<e;_+=i){const p=n[_],y=n[_+1];d+=Math.sqrt((p-c)*(p-c)+(y-u)*(y-u)),f.push(d),c=p,u=y}const g=s*d,m=Dd(f,g);m<0?(l=(g-f[-m-2])/(f[-m-1]-f[-m-2]),a=t+(-m-2)*i):a=t+m*i}o=o>1?o:2,r=r||new Array(o);for(let c=0;c<o;++c)r[c]=a===void 0?NaN:l===void 0?n[a+c]:Qt(n[a+c],n[a+i+c],l);return r}function Jf(n,t,e,i){let s=n[t],r=n[t+1],o=0;for(let a=t+i;a<e;a+=i){const l=n[a],h=n[a+1];o+=Math.sqrt((l-s)*(l-s)+(h-r)*(h-r)),s=l,r=h}return o}const ee={PRERENDER:"prerender",POSTRENDER:"postrender",PRECOMPOSE:"precompose",POSTCOMPOSE:"postcompose",RENDERCOMPLETE:"rendercomplete"},Li=typeof navigator<"u"&&typeof navigator.userAgent<"u"?navigator.userAgent.toLowerCase():"";Li.includes("safari")&&!Li.includes("chrom")&&(Li.includes("version/15.4")||/cpu (os|iphone os) 15_4 like mac os x/.test(Li));const Qf=Li.includes("webkit")&&!Li.includes("edge"),Th=Li.includes("macintosh"),tg=typeof devicePixelRatio<"u"?devicePixelRatio:1,Kt=typeof WorkerGlobalScope<"u"&&typeof OffscreenCanvas<"u"&&self instanceof WorkerGlobalScope,Ih=typeof Image<"u"&&Image.prototype.decode,Sh=(function(){let n=!1;try{const t=Object.defineProperty({},"passive",{get:function(){n=!0}});window.addEventListener("_",null,t),window.removeEventListener("_",null,t)}catch{}return n})(),Y={IDLE:0,LOADING:1,LOADED:2,ERROR:3};function ct(n,t,e,i){let s;return e&&e.length?s=e.shift():Kt?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 bo;function lr(){return bo||(bo=ct(1,1)),bo}function hr(n){const t=n.canvas;t.width=1,t.height=1,n.clearRect(0,0,1,1)}function eg(n){let t=n.offsetWidth;const e=getComputedStyle(n);return t+=parseInt(e.marginLeft,10)+parseInt(e.marginRight,10),t}function ig(n){let t=n.offsetHeight;const e=getComputedStyle(n);return t+=parseInt(e.marginTop,10)+parseInt(e.marginBottom,10),t}function bh(n,t){const e=t.parentNode;e&&e.replaceChild(n,t)}function Lh(n){for(;n.lastChild;)n.lastChild.remove()}function ng(n,t){const e=n.childNodes;for(let i=0;;++i){const s=e[i],r=t[i];if(!s&&!r)break;if(s!==r){if(!s){n.appendChild(r);continue}if(!r){n.removeChild(s),--i;continue}n.insertBefore(r,s)}}}function Ah(){return new Proxy({childNodes:[],appendChild:function(t){return this.childNodes.push(t),t},remove:function(){},removeChild:function(t){const e=this.childNodes.indexOf(t);if(e===-1)throw new Error("Node to remove was not found");return this.childNodes.splice(e,1),t},insertBefore:function(t,e){const i=this.childNodes.indexOf(e);if(i===-1)throw new Error("Reference node not found");return this.childNodes.splice(i,0,t),t},style:{}},{get(t,e,i){return e==="firstElementChild"?t.childNodes.length>0?t.childNodes[0]:null:Reflect.get(t,e,i)}})}function ri(n){return typeof HTMLCanvasElement<"u"&&n instanceof HTMLCanvasElement||typeof OffscreenCanvas<"u"&&n instanceof OffscreenCanvas}const Lo=[NaN,NaN,NaN,0];let Ao;function sg(){return Ao||(Ao=ct(1,1,void 0,{willReadFrequently:!0,desynchronized:!0})),Ao}const rg=/^rgba?\(\s*(\d+%?)\s+(\d+%?)\s+(\d+%?)(?:\s*\/\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,og=/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,ag=/^rgba?\(\s*(\d+%)\s*,\s*(\d+%)\s*,\s*(\d+%)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,lg=/^#([\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$/i;function cr(n,t){return n.endsWith("%")?Number(n.substring(0,n.length-1))/t:Number(n)}function Bn(n){throw new Error('failed to parse "'+n+'" as color')}function Mh(n){if(n.toLowerCase().startsWith("rgb")){const r=n.match(og)||n.match(rg)||n.match(ag);if(r){const o=r[4],a=100/255;return[ot(cr(r[1],a)+.5|0,0,255),ot(cr(r[2],a)+.5|0,0,255),ot(cr(r[3],a)+.5|0,0,255),o!==void 0?ot(cr(o,100),0,1):1]}Bn(n)}if(n.startsWith("#")){if(lg.test(n)){const r=n.substring(1),o=r.length<=4?1:2,a=[0,0,0,255];for(let l=0,h=r.length;l<h;l+=o){let c=parseInt(r.substring(l,l+o),16);o===1&&(c+=c<<4),a[l/o]=c}return a[3]=a[3]/255,a}Bn(n)}const t=sg();t.fillStyle="#abcdef";let e=t.fillStyle;t.fillStyle=n,t.fillStyle===e&&(t.fillStyle="#fedcba",e=t.fillStyle,t.fillStyle=n,t.fillStyle===e&&Bn(n));const i=t.fillStyle;if(i.startsWith("#")||i.startsWith("rgba"))return Mh(i);t.clearRect(0,0,1,1),t.fillRect(0,0,1,1);const s=Array.from(t.getImageData(0,0,1,1).data);return s[3]=js(s[3]/255,3),s}function hg(n){return typeof n=="string"?n:No(n)}const cg=1024,Zn={};let Mo=0;function ug(n){if(n.length===4)return n;const t=n.slice();return t[3]=1,t}function Po(n){return n>.0031308?Math.pow(n,1/2.4)*269.025-14.025:n*3294.6}function Oo(n){return n>.2068965?Math.pow(n,3):(n-4/29)*(108/841)}function Do(n){return n>10.314724?Math.pow((n+14.025)/269.025,2.4):n/3294.6}function Fo(n){return n>.0088564?Math.pow(n,1/3):n/(108/841)+4/29}function Ph(n){const t=Do(n[0]),e=Do(n[1]),i=Do(n[2]),s=Fo(t*.222488403+e*.716873169+i*.06060791),r=500*(Fo(t*.452247074+e*.399439023+i*.148375274)-s),o=200*(s-Fo(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 dg(n){const t=(n[0]+16)/116,e=n[1],i=n[2]*Math.PI/180,s=Oo(t),r=Oo(t+e/500*Math.cos(i)),o=Oo(t-e/200*Math.sin(i)),a=Po(r*3.021973625-s*1.617392459-o*.404875592),l=Po(r*-.943766287+s*1.916279586+o*.027607165),h=Po(r*.069407491-s*.22898585+o*1.159737864);return[ot(a+.5|0,0,255),ot(l+.5|0,0,255),ot(h+.5|0,0,255),n[3]]}function ko(n){if(n==="none")return Lo;if(Zn.hasOwnProperty(n))return Zn[n];if(Mo>=cg){let e=0;for(const i in Zn)(e++&3)===0&&(delete Zn[i],--Mo)}const t=Mh(n);t.length!==4&&Bn(n);for(const e of t)isNaN(e)&&Bn(n);return Zn[n]=t,++Mo,t}function en(n){return Array.isArray(n)?n:ko(n)}function No(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 fg(n,t,e){const i=n;let s=!0,r=!1,o=!1;const a=[Ys(i,W.LOAD,function(){o=!0,r||t()})];return i.src&&Ih?(r=!0,i.decode().then(function(){s&&t()}).catch(function(l){s&&(o?t():e())})):a.push(Ys(i,W.ERROR,e)),function(){s=!1,a.forEach(st)}}function gg(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 _g(n,t){return t&&(n.src=t),n.src&&Ih?new Promise((e,i)=>n.decode().then(()=>e(n)).catch(s=>n.complete&&n.width?e(n):i(s))):gg(n)}class mg{constructor(){this.cache_={},this.patternCache_={},this.cacheSize_=0,this.maxCacheSize_=1024}clear(){this.cache_={},this.patternCache_={},this.cacheSize_=0}canExpireCache(){return this.cacheSize_>this.maxCacheSize_}expire(){if(this.canExpireCache()){let t=0;for(const e in this.cache_){const i=this.cache_[e];(t++&3)===0&&!i.hasListener()&&(delete this.cache_[e],delete this.patternCache_[e],--this.cacheSize_)}}}get(t,e,i){const s=Go(t,e,i);return s in this.cache_?this.cache_[s]:null}getPattern(t,e,i){const s=Go(t,e,i);return s in this.patternCache_?this.patternCache_[s]:null}set(t,e,i,s,r){const o=Go(t,e,i),a=o in this.cache_;this.cache_[o]=s,r&&(s.getImageState()===Y.IDLE&&s.load(),s.getImageState()===Y.LOADING?s.ready().then(()=>{this.patternCache_[o]=lr().createPattern(s.getImage(1),"repeat")}):this.patternCache_[o]=lr().createPattern(s.getImage(1),"repeat")),a||++this.cacheSize_}setSize(t){this.maxCacheSize_=t,this.expire()}}function Go(n,t,e){const i=e?en(e):"null";return t+":"+n+":"+i}const ie=new mg;let Un=null;class Oh extends Ws{constructor(t,e,i,s,r){super(),this.hitDetectionImage_=null,this.image_=t,this.crossOrigin_=i,this.canvas_={},this.color_=r,this.imageState_=s===void 0?Y.IDLE:s,this.size_=t&&t.width&&t.height?[t.width,t.height]:null,this.src_=e,this.tainted_,this.ready_=null}initializeImage_(){this.image_=new Image,this.crossOrigin_!==null&&(this.image_.crossOrigin=this.crossOrigin_)}isTainted_(){if(this.tainted_===void 0&&this.imageState_===Y.LOADED){Un||(Un=ct(1,1,void 0,{willReadFrequently:!0})),Un.drawImage(this.image_,0,0);try{Un.getImageData(0,0,1,1),this.tainted_=!1}catch{Un=null,this.tainted_=!0}}return this.tainted_===!0}dispatchChangeEvent_(){this.dispatchEvent(W.CHANGE)}handleImageError_(){this.imageState_=Y.ERROR,this.dispatchChangeEvent_()}handleImageLoad_(){this.imageState_=Y.LOADED,this.size_=[this.image_.width,this.image_.height],this.dispatchChangeEvent_()}getImage(t){return this.image_||this.initializeImage_(),this.replaceColor_(t),this.canvas_[t]?this.canvas_[t]:this.image_}getPixelRatio(t){return this.replaceColor_(t),this.canvas_[t]?t:1}getImageState(){return this.imageState_}getHitDetectionImage(){if(this.image_||this.initializeImage_(),!this.hitDetectionImage_)if(this.isTainted_()){const t=this.size_[0],e=this.size_[1],i=ct(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_===Y.IDLE){this.image_||this.initializeImage_(),this.imageState_=Y.LOADING;try{this.src_!==void 0&&(this.image_.src=this.src_)}catch{this.handleImageError_()}this.image_ instanceof HTMLImageElement&&_g(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_!==Y.LOADED)return;const e=this.image_,i=ct(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=hg(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_===Y.LOADED||this.imageState_===Y.ERROR)t();else{const e=()=>{(this.imageState_===Y.LOADED||this.imageState_===Y.ERROR)&&(this.removeEventListener(W.CHANGE,e),t())};this.addEventListener(W.CHANGE,e)}})),this.ready_}}function ur(n,t,e,i,s,r){let o=t===void 0?void 0:ie.get(t,e,s);return o||(o=new Oh(n,n&&"src"in n?n.src||void 0:t,e,i,s),ie.set(t,e,s,o,r)),r&&o&&!ie.getPattern(t,e,s)&&ie.set(t,e,s,o,r),o}function xe(n){return n?Array.isArray(n)?No(n):typeof n=="object"&&"src"in n?pg(n):n:null}function pg(n){if(!n.offset||!n.size)return ie.getPattern(n.src,"anonymous",n.color);const t=n.src+":"+n.offset,e=ie.getPattern(t,void 0,n.color);if(e)return e;const i=ie.get(n.src,"anonymous",null);if(i.getImageState()!==Y.LOADED)return null;const s=ct(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]),ur(s.canvas,t,void 0,Y.LOADED,n.color,!0),ie.getPattern(t,void 0,n.color)}class Dh{drawCustom(t,e,i,s,r){}drawGeometry(t){}setStyle(t){}drawCircle(t,e,i){}drawFeature(t,e,i){}drawGeometryCollection(t,e,i){}drawLineString(t,e,i){}drawMultiLineString(t,e,i){}drawMultiPoint(t,e,i){}drawMultiPolygon(t,e,i){}drawPoint(t,e,i){}drawPolygon(t,e,i){}drawText(t,e,i){}setFillStrokeStyle(t,e){}setImageStyle(t,e){}setTextStyle(t,e){}}const dr="ol-hidden",yg="ol-selectable",fr="ol-unselectable",zo="ol-control",Fh="ol-collapsed",xg=new RegExp(["^\\s*(?=(?:(?:[-a-z]+\\s*){0,2}(italic|oblique))?)","(?=(?:(?:[-a-z]+\\s*){0,2}(small-caps))?)","(?=(?:(?:[-a-z]+\\s*){0,2}(bold(?:er)?|lighter|[1-9]00 ))?)","(?:(?:normal|\\1|\\2|\\3)\\s*){0,3}((?:xx?-)?","(?:small|large)|medium|smaller|larger|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx]))","(?:\\s*\\/\\s*(normal|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx])?))",`?\\s*([-,\\"\\'\\sa-z0-9]+?)\\s*$`].join(""),"i"),kh=["style","variant","weight","size","lineHeight","family"],Xo={normal:400,bold:700},Wo=function(n){const t=n.match(xg);if(!t)return null;const e={lineHeight:"normal",size:"1.2em",style:"normal",weight:"400",variant:"normal"};for(let i=0,s=kh.length;i<s;++i){const r=t[i+1];r!==void 0&&(e[kh[i]]=typeof r=="string"?r.trim():r)}return isNaN(Number(e.weight))&&e.weight in Xo&&(e.weight=Xo[e.weight]),e.families=e.family.split(/,\s?/).map(i=>i.trim().replace(/^['"]|['"]$/g,"")),e},Nh="10px sans-serif",Nt="#000",nn="round",Fe=[],ke=0,sn="round",Vn=10,jn="#000",Hn="center",gr="middle",Ai=[0,0,0,0],qn=1,rn=new ue;let Jn=null,Gh;const Yo={},Eg=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace","ui-rounded","emoji","math","fangsong"]);function vg(n,t,e){return`${n} ${t} 16px "${e}"`}const wg=(function(){let t,e;async function i(r){await e.ready;const o=await e.load(r);if(o.length===0)return!1;const a=Wo(r),l=a.families[0].toLowerCase(),h=a.weight;return o.some(c=>{const u=c.family.replace(/^['"]|['"]$/g,"").toLowerCase(),d=Xo[c.weight]||c.weight;return u===l&&c.style===a.style&&d==h})}async function s(){await e.ready;let r=!0;const o=rn.getProperties(),a=Object.keys(o).filter(l=>o[l]<100);for(let l=a.length-1;l>=0;--l){const h=a[l];let c=o[h];c<100&&(await i(h)?(kn(Yo),rn.set(h,100)):(c+=10,rn.set(h,c,!0),c<100&&(r=!1)))}t=void 0,r||(t=setTimeout(s,100))}return async function(r){e||(e=Kt?self.fonts:document.fonts);const o=Wo(r);if(!o)return;const a=o.families;let l=!1;for(const h of a){if(Eg.has(h))continue;const c=vg(o.style,o.weight,h);rn.get(c)===void 0&&(rn.set(c,0,!0),l=!0)}l&&(clearTimeout(t),t=setTimeout(s,100))}})(),Cg=(function(){let n;return function(t){let e=Yo[t];if(e==null){if(Kt){const i=Wo(t),s=zh(t,"Žg");e=(isNaN(Number(i.lineHeight))?1.2:Number(i.lineHeight))*(s.actualBoundingBoxAscent+s.actualBoundingBoxDescent)}else n||(n=document.createElement("div"),n.innerHTML="M",n.style.minHeight="0",n.style.maxHeight="none",n.style.height="auto",n.style.padding="0",n.style.border="none",n.style.position="absolute",n.style.display="block",n.style.left="-99999px"),n.style.font=t,document.body.appendChild(n),e=n.offsetHeight,document.body.removeChild(n);Yo[t]=e}return e}})();function zh(n,t){return Jn||(Jn=ct(1,1)),n!=Gh&&(Jn.font=n,Gh=Jn.font),Jn.measureText(t)}function Xh(n,t){return zh(n,t).width}function Wh(n,t,e){if(t in e)return e[t];const i=t.split(`
|
|
3
|
+
`).reduce((s,r)=>Math.max(s,Xh(n,r)),0);return e[t]=i,i}function Rg(n,t){const e=[],i=[],s=[];let r=0,o=0,a=0,l=0;for(let h=0,c=t.length;h<=c;h+=2){const u=t[h];if(u===`
|
|
4
|
+
`||h===c){r=Math.max(r,o),s.push(o),o=0,a+=l,l=0;continue}const d=t[h+1]||n.font,f=Xh(d,u);e.push(f),o+=f;const g=Cg(d);i.push(g),l=Math.max(l,g)}return{width:r,height:a,widths:e,heights:i,lineWidths:s}}function Tg(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]),Ig(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 Ig(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 Sg extends Dh{constructor(t,e,i,s,r,o,a){super(),this.context_=t,this.pixelRatio_=e,this.extent_=i,this.transform_=s,this.transformRotation_=s?js(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_=de()}drawImages_(t,e,i,s){if(!this.image_)return;const r=si(t,e,i,s,this.transform_,this.pixelCoordinates_),o=this.context_,a=this.tmpLocalTransform_,l=o.globalAlpha;this.imageOpacity_!=1&&(o.globalAlpha=l*this.imageOpacity_);let h=this.imageRotation_;this.transformRotation_===0&&(h-=this.viewRotation_),this.imageRotateWithView_&&(h+=this.viewRotation_);for(let c=0,u=r.length;c<u;c+=2){const d=r[c]-this.imageAnchorX_,f=r[c+1]-this.imageAnchorY_;if(h!==0||this.imageScale_[0]!=1||this.imageScale_[1]!=1){const g=d+this.imageAnchorX_,m=f+this.imageAnchorY_;De(a,g,m,1,1,h,-g,-m),o.save(),o.transform.apply(o,a),o.translate(g,m),o.scale(this.imageScale_[0],this.imageScale_[1]),o.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,-this.imageAnchorX_,-this.imageAnchorY_,this.imageWidth_,this.imageHeight_),o.restore()}else o.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,d,f,this.imageWidth_,this.imageHeight_)}this.imageOpacity_!=1&&(o.globalAlpha=l)}drawText_(t,e,i,s){if(!this.textState_||this.text_==="")return;this.textFillState_&&this.setContextFillState_(this.textFillState_),this.textStrokeState_&&this.setContextStrokeState_(this.textStrokeState_),this.setContextTextState_(this.textState_);const r=si(t,e,i,s,this.transform_,this.pixelCoordinates_),o=this.context_;let a=this.textRotation_;for(this.transformRotation_===0&&(a-=this.viewRotation_),this.textRotateWithView_&&(a+=this.viewRotation_);e<i;e+=s){const l=r[e]+this.textOffsetX_,h=r[e+1]+this.textOffsetY_;a!==0||this.textScale_[0]!=1||this.textScale_[1]!=1?(o.save(),o.translate(l-this.textOffsetX_,h-this.textOffsetY_),o.rotate(a),o.translate(this.textOffsetX_,this.textOffsetY_),o.scale(this.textScale_[0],this.textScale_[1]),this.textStrokeState_&&o.strokeText(this.text_,0,0),this.textFillState_&&o.fillText(this.text_,0,0),o.restore()):(this.textStrokeState_&&o.strokeText(this.text_,l,h),this.textFillState_&&o.fillText(this.text_,l,h))}}moveToLineTo_(t,e,i,s,r){const o=this.context_,a=si(t,e,i,s,this.transform_,this.pixelCoordinates_);o.moveTo(a[0],a[1]);let l=a.length;r&&(l-=2);for(let h=2;h<l;h+=2)o.lineTo(a[h],a[h+1]);return r&&o.closePath(),i}drawRings_(t,e,i,s){for(let r=0,o=i.length;r<o;++r)e=this.moveToLineTo_(t,e,i[r],s,!0);return e}drawCircle(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!Ft(this.extent_,t.getExtent())){if(this.fillState_||this.strokeState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const e=Nf(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_)),!!Ft(this.extent_,t.getExtent())){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);const e=this.context_,i=t.getFlatCoordinates();e.beginPath(),this.moveToLineTo_(i,0,i.length,t.getStride(),!1),e.stroke()}if(this.text_!==""){const e=t.getFlatMidpoint();this.drawText_(e,0,2,2)}}}drawMultiLineString(t){this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_));const e=t.getExtent();if(Ft(this.extent_,e)){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);const i=this.context_,s=t.getFlatCoordinates();let r=0;const o=t.getEnds(),a=t.getStride();i.beginPath();for(let l=0,h=o.length;l<h;++l)r=this.moveToLineTo_(s,r,o[l],a,!1);i.stroke()}if(this.text_!==""){const i=t.getFlatMidpoints();this.drawText_(i,0,i.length,2)}}}drawPolygon(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!Ft(this.extent_,t.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const e=this.context_;e.beginPath(),this.drawRings_(t.getOrientedFlatCoordinates(),0,t.getEnds(),t.getStride()),this.fillState_&&e.fill(),this.strokeState_&&e.stroke()}if(this.text_!==""){const e=t.getFlatInteriorPoint();this.drawText_(e,0,2,2)}}}drawMultiPolygon(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!Ft(this.extent_,t.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const e=this.context_,i=t.getOrientedFlatCoordinates();let s=0;const r=t.getEndss(),o=t.getStride();e.beginPath();for(let a=0,l=r.length;a<l;++a){const h=r[a];s=this.drawRings_(i,s,h,o)}this.fillState_&&e.fill(),this.strokeState_&&e.stroke()}if(this.text_!==""){const e=t.getFlatInteriorPoints();this.drawText_(e,0,e.length,2)}}}setContextFillState_(t){const e=this.context_,i=this.contextFillState_;i?i.fillStyle!=t.fillStyle&&(i.fillStyle=t.fillStyle,e.fillStyle=t.fillStyle):(e.fillStyle=t.fillStyle,this.contextFillState_={fillStyle:t.fillStyle})}setContextStrokeState_(t){const e=this.context_,i=this.contextStrokeState_;i?(i.lineCap!=t.lineCap&&(i.lineCap=t.lineCap,e.lineCap=t.lineCap),ti(i.lineDash,t.lineDash)||e.setLineDash(i.lineDash=t.lineDash),i.lineDashOffset!=t.lineDashOffset&&(i.lineDashOffset=t.lineDashOffset,e.lineDashOffset=t.lineDashOffset),i.lineJoin!=t.lineJoin&&(i.lineJoin=t.lineJoin,e.lineJoin=t.lineJoin),i.lineWidth!=t.lineWidth&&(i.lineWidth=t.lineWidth,e.lineWidth=t.lineWidth),i.miterLimit!=t.miterLimit&&(i.miterLimit=t.miterLimit,e.miterLimit=t.miterLimit),i.strokeStyle!=t.strokeStyle&&(i.strokeStyle=t.strokeStyle,e.strokeStyle=t.strokeStyle)):(e.lineCap=t.lineCap,e.setLineDash(t.lineDash),e.lineDashOffset=t.lineDashOffset,e.lineJoin=t.lineJoin,e.lineWidth=t.lineWidth,e.miterLimit=t.miterLimit,e.strokeStyle=t.strokeStyle,this.contextStrokeState_={lineCap:t.lineCap,lineDash:t.lineDash,lineDashOffset:t.lineDashOffset,lineJoin:t.lineJoin,lineWidth:t.lineWidth,miterLimit:t.miterLimit,strokeStyle:t.strokeStyle})}setContextTextState_(t){const e=this.context_,i=this.contextTextState_,s=t.textAlign?t.textAlign:Hn;i?(i.font!=t.font&&(i.font=t.font,e.font=t.font),i.textAlign!=s&&(i.textAlign=s,e.textAlign=s),i.textBaseline!=t.textBaseline&&(i.textBaseline=t.textBaseline,e.textBaseline=t.textBaseline)):(e.font=t.font,e.textAlign=s,e.textBaseline=t.textBaseline,this.contextTextState_={font:t.font,textAlign:s,textBaseline:t.textBaseline})}setFillStrokeStyle(t,e){if(!t)this.fillState_=null;else{const i=t.getColor();this.fillState_={fillStyle:xe(i||Nt)}}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||Fe;this.strokeState_={lineCap:s!==void 0?s:nn,lineDash:this.pixelRatio_===1?c:c.map(u=>u*this.pixelRatio_),lineDashOffset:(o||ke)*this.pixelRatio_,lineJoin:a!==void 0?a:sn,lineWidth:(l!==void 0?l:qn)*this.pixelRatio_,miterLimit:h!==void 0?h:Vn,strokeStyle:xe(i||jn)}}}setImageStyle(t){let e;if(!t||!(e=t.getSize())){this.image_=null;return}const i=t.getPixelRatio(this.pixelRatio_),s=t.getAnchor(),r=t.getOrigin();this.image_=t.getImage(this.pixelRatio_),this.imageAnchorX_=s[0]*i,this.imageAnchorY_=s[1]*i,this.imageHeight_=e[1]*i,this.imageOpacity_=t.getOpacity(),this.imageOriginX_=r[0],this.imageOriginY_=r[1],this.imageRotateWithView_=t.getRotateWithView(),this.imageRotation_=t.getRotation();const o=t.getScaleArray();this.imageScale_=[o[0]*this.pixelRatio_/i,o[1]*this.pixelRatio_/i],this.imageWidth_=e[0]*i}setTextStyle(t){if(!t)this.text_="";else{const e=t.getFill();if(!e)this.textFillState_=null;else{const f=e.getColor();this.textFillState_={fillStyle:xe(f||Nt)}}const i=t.getStroke();if(!i)this.textStrokeState_=null;else{const f=i.getColor(),g=i.getLineCap(),m=i.getLineDash(),_=i.getLineDashOffset(),p=i.getLineJoin(),y=i.getWidth(),w=i.getMiterLimit();this.textStrokeState_={lineCap:g!==void 0?g:nn,lineDash:m||Fe,lineDashOffset:_||ke,lineJoin:p!==void 0?p:sn,lineWidth:y!==void 0?y:qn,miterLimit:w!==void 0?w:Vn,strokeStyle:xe(f||jn)}}const s=t.getFont(),r=t.getOffsetX(),o=t.getOffsetY(),a=t.getRotateWithView(),l=t.getRotation(),h=t.getScaleArray(),c=t.getText(),u=t.getTextAlign(),d=t.getTextBaseline();this.textState_={font:s!==void 0?s:Nh,textAlign:u!==void 0?u:Hn,textBaseline:d!==void 0?d:gr},this.text_=c!==void 0?Array.isArray(c)?c.reduce((f,g,m)=>f+=m%2?" ":g,""):c:"",this.textOffsetX_=r!==void 0?this.pixelRatio_*r:0,this.textOffsetY_=o!==void 0?this.pixelRatio_*o:0,this.textRotateWithView_=a!==void 0?a:!1,this.textRotation_=l!==void 0?l:0,this.textScale_=[this.pixelRatio_*h[0],this.pixelRatio_*h[1]]}}}const bg=.5,Yh={Point:kg,LineString:Og,Polygon:Gg,MultiPoint:Ng,MultiLineString:Dg,MultiPolygon:Fg,GeometryCollection:Pg,Circle:Ag};function Lg(n,t){return parseInt(j(n),10)-parseInt(j(t),10)}function $h(n,t){const e=Kh(n,t);return e*e}function Kh(n,t){return bg*n/t}function Ag(n,t,e,i,s){const r=e.getFill(),o=e.getStroke();if(r||o){const l=n.getBuilder(e.getZIndex(),"Circle");l.setFillStrokeStyle(r,o),l.drawCircle(t,i,s)}const a=e.getText();if(a&&a.getText()){const l=n.getBuilder(e.getZIndex(),"Text");l.setTextStyle(a),l.drawText(t,i)}}function Bh(n,t,e,i,s,r,o,a){const l=[],h=e.getImage();if(h){let d=!0;const f=h.getImageState();f==Y.LOADED||f==Y.ERROR?d=!1:f==Y.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)),Mg(n,t,e,i,r,o,a),u}function Mg(n,t,e,i,s,r,o){const a=e.getGeometryFunction()(t);if(!a)return;const l=a.simplifyTransformed(i,s);if(e.getRenderer())Zh(n,l,e,t,o);else{const c=Yh[l.getType()];c(n,l,e,t,o,r)}}function Zh(n,t,e,i,s){if(t.getType()=="GeometryCollection"){const o=t.getGeometries();for(let a=0,l=o.length;a<l;++a)Zh(n,o[a],e,i,s);return}n.getBuilder(e.getZIndex(),"Default").drawCustom(t,i,e.getRenderer(),e.getHitDetectionRenderer(),s)}function Pg(n,t,e,i,s,r){const o=t.getGeometriesArray();let a,l;for(a=0,l=o.length;a<l;++a){const h=Yh[o[a].getType()];h(n,o[a],e,i,s,r)}}function Og(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 Dg(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 Fg(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 kg(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()!=Y.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 Ng(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()!=Y.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 Gg(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 zg=!1;function Xg(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=zg,a.onload=function(l){if(!a.status||a.status>=200&&a.status<300){const h=t.getType();try{let c;h=="text"||h=="json"?c=a.responseText:h=="xml"?c=a.responseXML||a.responseText:h=="arraybuffer"&&(c=a.response),c?r(t.readFeatures(c,{extent:e,featureProjection:s}),t.readProjection(c)):o()}catch{o()}}else o()},a.onerror=o,a.send()}function Uh(n,t){return function(e,i,s,r,o){Xg(n,t,e,i,s,(a,l)=>{this.addFeatures(a),r!==void 0&&r(a)},()=>{this.changed(),o!==void 0&&o()})}}function Wg(n,t){return[[-1/0,-1/0,1/0,1/0]]}function Yg(n,t,e,i){const s=[];let r=$t();for(let o=0,a=e.length;o<a;++o){const l=e[o];r=no(n,t,l[0],i),s.push((r[0]+r[2])/2,(r[1]+r[3])/2),t=l[l.length-1]}return s}const Vh=de();class fe{constructor(t,e,i,s,r,o){this.styleFunction,this.extent_,this.id_=o,this.type_=t,this.flatCoordinates_=e,this.flatInteriorPoints_=null,this.flatMidpoints_=null,this.ends_=i||null,this.properties_=r,this.squaredTolerance_,this.stride_=s,this.simplifiedGeometry_}get(t){return this.properties_[t]}getExtent(){return this.extent_||(this.extent_=this.type_==="Point"?Fl(this.flatCoordinates_):no(this.flatCoordinates_,0,this.flatCoordinates_.length,2)),this.extent_}getFlatInteriorPoint(){if(!this.flatInteriorPoints_){const t=wi(this.getExtent());this.flatInteriorPoints_=Io(this.flatCoordinates_,0,this.ends_,2,t,0)}return this.flatInteriorPoints_}getFlatInteriorPoints(){if(!this.flatInteriorPoints_){const t=qf(this.flatCoordinates_,this.ends_),e=Yg(this.flatCoordinates_,0,t,2);this.flatInteriorPoints_=Zf(this.flatCoordinates_,0,t,2,e)}return this.flatInteriorPoints_}getFlatMidpoint(){return this.flatMidpoints_||(this.flatMidpoints_=Rh(this.flatCoordinates_,0,this.flatCoordinates_.length,2,.5)),this.flatMidpoints_}getFlatMidpoints(){if(!this.flatMidpoints_){this.flatMidpoints_=[];const t=this.flatCoordinates_;let e=0;const i=this.ends_;for(let s=0,r=i.length;s<r;++s){const o=i[s],a=Rh(t,e,o,2,.5);Qr(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=kt(t);const e=t.getExtent(),i=t.getWorldExtent();if(e&&i){const s=Lt(i)/Lt(e);De(Vh,i[0],i[3],s,-s,0,0,0),si(this.flatCoordinates_,0,this.flatCoordinates_.length,2,Vh,this.flatCoordinates_)}}applyTransform(t){t(this.flatCoordinates_,this.flatCoordinates_,this.stride_)}clone(){return new fe(this.type_,this.flatCoordinates_.slice(),this.ends_?.slice(),this.stride_,Object.assign({},this.properties_),this.id_)}getEnds(){return this.ends_}enableSimplifyTransformed(){return this.simplifyTransformed=bl((t,e)=>{if(t===this.squaredTolerance_)return this.simplifiedGeometry_;this.simplifiedGeometry_=this.clone(),e&&this.simplifiedGeometry_.applyTransform(e);const i=this.simplifiedGeometry_.getFlatCoordinates();let s;switch(this.type_){case"LineString":i.length=To(i,0,this.simplifiedGeometry_.flatCoordinates_.length,this.simplifiedGeometry_.stride_,t,i,0),s=[i.length];break;case"MultiLineString":s=[],i.length=$f(i,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,t,i,0,s);break;case"Polygon":s=[],i.length=yh(i,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,Math.sqrt(t),i,0,s);break}return s&&(this.simplifiedGeometry_=new fe(this.type_,i,s,2,this.properties_,this.id_)),this.squaredTolerance_=t,this.simplifiedGeometry_}),this}}fe.prototype.getFlatCoordinates=fe.prototype.getOrientedFlatCoordinates;function jh(n,t,e=0,i=n.length-1,s=$g){for(;i>e;){if(i-e>600){const l=i-e+1,h=t-e+1,c=Math.log(l),u=.5*Math.exp(2*c/3),d=.5*Math.sqrt(c*u*(l-u)/l)*(h-l/2<0?-1:1),f=Math.max(e,Math.floor(t-h*u/l+d)),g=Math.min(i,Math.floor(t+(l-h)*u/l+d));jh(n,t,f,g,s)}const r=n[t];let o=e,a=i;for(Qn(n,e,t),s(n[i],r)>0&&Qn(n,e,i);o<a;){for(Qn(n,o,a),o++,a--;s(n[o],r)<0;)o++;for(;s(n[a],r)>0;)a--}s(n[e],r)===0?Qn(n,e,a):(a++,Qn(n,a,i)),a<=t&&(e=a+1),t<=a&&(i=a-1)}}function Qn(n,t,e){const i=n[t];n[t]=n[e],n[e]=i}function $g(n,t){return n<t?-1:n>t?1:0}let Hh=class{constructor(t=9){this._maxEntries=Math.max(4,t),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4)),this.clear()}all(){return this._all(this.data,[])}search(t){let e=this.data;const i=[];if(!mr(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;mr(t,l)&&(e.leaf?i.push(a):Ko(t,l)?this._all(a,i):r.push(a))}e=r.pop()}return i}collides(t){let e=this.data;if(!mr(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(mr(t,o)){if(e.leaf||Ko(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=an([]),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=Kg(t,i.children,e);if(c!==-1)return i.children.splice(c,1),r.push(i),this._condense(r),this}!h&&!i.leaf&&Ko(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=an(t.slice(e,i+1)),on(a,this.toBBox),a;s||(s=Math.ceil(Math.log(r)/Math.log(o)),o=Math.ceil(r/Math.pow(o,s-1))),a=an([]),a.leaf=!1,a.height=s;const l=Math.ceil(r/o),h=l*Math.ceil(Math.sqrt(o));qh(t,e,i,h,this.compareMinX);for(let c=e;c<=i;c+=h){const u=Math.min(c+h-1,i);qh(t,c,u,l,this.compareMinY);for(let d=c;d<=u;d+=l){const f=Math.min(d+l-1,u);a.children.push(this._build(t,d,f,s-1))}}return on(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=$o(h),u=Ug(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=an(i.children.splice(o,i.children.length-o));a.height=i.height,a.leaf=i.leaf,on(i,this.toBBox),on(a,this.toBBox),e?t[e-1].children.push(a):this._splitRoot(i,a)}_splitRoot(t,e){this.data=an([t,e]),this.data.height=t.height+1,this.data.leaf=!1,on(this.data,this.toBBox)}_chooseSplitIndex(t,e,i){let s,r=1/0,o=1/0;for(let a=e;a<=i-e;a++){const l=ts(t,0,a,this.toBBox),h=ts(t,a,i,this.toBBox),c=Vg(l,h),u=$o(l)+$o(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:Bg,r=t.leaf?this.compareMinY:Zg,o=this._allDistMargin(t,e,i,s),a=this._allDistMargin(t,e,i,r);o<a&&t.children.sort(s)}_allDistMargin(t,e,i,s){t.children.sort(s);const r=this.toBBox,o=ts(t,0,e,r),a=ts(t,i-e,i,r);let l=_r(o)+_r(a);for(let h=e;h<i-e;h++){const c=t.children[h];es(o,t.leaf?r(c):c),l+=_r(o)}for(let h=i-e-1;h>=e;h--){const c=t.children[h];es(a,t.leaf?r(c):c),l+=_r(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():on(t[e],this.toBBox)}};function Kg(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 on(n,t){ts(n,0,n.children.length,t,n)}function ts(n,t,e,i,s){s||(s=an(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 Bg(n,t){return n.minX-t.minX}function Zg(n,t){return n.minY-t.minY}function $o(n){return(n.maxX-n.minX)*(n.maxY-n.minY)}function _r(n){return n.maxX-n.minX+(n.maxY-n.minY)}function Ug(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 Vg(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 Ko(n,t){return n.minX<=t.minX&&n.minY<=t.minY&&t.maxX<=n.maxX&&t.maxY<=n.maxY}function mr(n,t){return t.minX<=n.maxX&&t.minY<=n.maxY&&t.maxX>=n.minX&&t.maxY>=n.minY}function an(n){return{children:n,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function qh(n,t,e,i,s){const r=[t,e];for(;r.length;){if(e=r.pop(),t=r.pop(),e-t<=i)continue;const o=t+Math.ceil((e-t)/i/2)*i;jh(n,o,t,e,s),r.push(t,o,o,e)}}class Jh{constructor(t){this.rbush_=new Hh(t),this.items_={}}insert(t,e){const i={minX:t[0],minY:t[1],maxX:t[2],maxY:t[3],value:e};this.rbush_.insert(i),this.items_[j(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_[j(a)]=l}this.rbush_.load(i)}remove(t){const e=j(t),i=this.items_[e];return delete this.items_[e],this.rbush_.remove(i)!==null}update(t,e){const i=this.items_[j(e)],s=[i.minX,i.minY,i.maxX,i.maxY];Gn(s,t)||(this.remove(e),this.insert(t,e))}getAll(){return this.rbush_.all().map(function(e){return e.value})}getInExtent(t){const e={minX:t[0],minY:t[1],maxX:t[2],maxY:t[3]};return this.rbush_.search(e).map(function(s){return s.value})}forEach(t){return this.forEach_(this.getAll(),t)}forEachInExtent(t,e){return this.forEach_(this.getInExtent(t),e)}forEach_(t,e){let i;for(let s=0,r=t.length;s<r;s++)if(i=e(t[s]),i)return i;return i}isEmpty(){return Bi(this.items_)}clear(){this.rbush_.clear(),this.items_={}}getExtent(t){const e=this.rbush_.toJSON();return ei(e.minX,e.minY,e.maxX,e.maxY,t)}concat(t){this.rbush_.load(t.rbush_.all());for(const e in t.items_)this.items_[e]=t.items_[e]}}class Qh extends ue{constructor(t){super(),this.projection=kt(t.projection),this.attributions_=tc(t.attributions),this.attributionsCollapsible_=t.attributionsCollapsible??!0,this.loading=!1,this.state_=t.state!==void 0?t.state:"ready",this.wrapX_=t.wrapX!==void 0?t.wrapX:!1,this.interpolate_=!!t.interpolate,this.viewResolver=null,this.viewRejector=null;const e=this;this.viewPromise_=new Promise(function(i,s){e.viewResolver=i,e.viewRejector=s})}getAttributions(){return this.attributions_}getAttributionsCollapsible(){return this.attributionsCollapsible_}getProjection(){return this.projection}getResolutions(t){return null}getView(){return this.viewPromise_}getState(){return this.state_}getWrapX(){return this.wrapX_}getInterpolate(){return this.interpolate_}refresh(){this.changed()}setAttributions(t){this.attributions_=tc(t),this.changed()}setState(t){this.state_=t,this.changed()}}function tc(n){return n?typeof n=="function"?n:(Array.isArray(n)||(n=[n]),t=>n):null}const ne={ADDFEATURE:"addfeature",CHANGEFEATURE:"changefeature",CLEAR:"clear",REMOVEFEATURE:"removefeature",FEATURESLOADSTART:"featuresloadstart",FEATURESLOADEND:"featuresloadend",FEATURESLOADERROR:"featuresloaderror"};class oi extends Pe{constructor(t,e,i){super(t),this.feature=e,this.features=i}}class jg extends Qh{constructor(t){t=t||{},super({attributions:t.attributions,interpolate:!0,projection:void 0,state:"ready",wrapX:t.wrapX!==void 0?t.wrapX:!0}),this.on,this.once,this.un,this.loader_=Fn,this.format_=t.format||null,this.overlaps_=t.overlaps===void 0?!0:t.overlaps,this.url_=t.url,t.loader!==void 0?this.loader_=t.loader:this.url_!==void 0&&(Q(this.format_,"`format` must be set when `url` is set"),this.loader_=Uh(this.url_,this.format_)),this.strategy_=t.strategy!==void 0?t.strategy:Wg;const e=t.useSpatialIndex!==void 0?t.useSpatialIndex:!0;this.featuresRtree_=e?new Jh:null,this.loadedExtentsRtree_=new Jh,this.loadingExtentsCount_=0,this.nullGeometryFeatures_={},this.idIndex_={},this.uidIndex_={},this.featureChangeKeys_={},this.featuresCollection_=null;let i,s;Array.isArray(t.features)?s=t.features:t.features&&(i=t.features,s=i.getArray()),!e&&i===void 0&&(i=new Jt(s)),s!==void 0&&this.addFeaturesInternal(s),i!==void 0&&this.bindFeaturesCollection_(i)}addFeature(t){this.addFeatureInternal(t),this.changed()}addFeatureInternal(t){const e=j(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 oi(ne.ADDFEATURE,t))}setupChangeEvents_(t,e){e instanceof fe||(this.featureChangeKeys_[t]=[U(e,W.CHANGE,this.handleFeatureChange_,this),U(e,Ki.PROPERTYCHANGE,this.handleFeatureChange_,this)])}addToIndex_(t,e){let i=!0;if(e.getId()!==void 0){const s=String(e.getId());if(!(s in this.idIndex_))this.idIndex_[s]=e;else if(e instanceof fe){const r=this.idIndex_[s];r instanceof fe?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=j(a);this.addToIndex_(l,a)&&i.push(a)}for(let r=0,o=i.length;r<o;r++){const a=i[r],l=j(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(ne.ADDFEATURE))for(let r=0,o=i.length;r<o;r++)this.dispatchEvent(new oi(ne.ADDFEATURE,i[r]))}bindFeaturesCollection_(t){let e=!1;this.addEventListener(ne.ADDFEATURE,function(i){e||(e=!0,t.push(i.feature),e=!1)}),this.addEventListener(ne.REMOVEFEATURE,function(i){e||(e=!0,t.remove(i.feature),e=!1)}),t.addEventListener(Dt.ADD,i=>{e||(e=!0,this.addFeature(i.element),e=!1)}),t.addEventListener(Dt.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(st);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 oi(ne.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 fe||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 fe||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(),Bi(this.nullGeometryFeatures_)||Qr(t,Object.values(this.nullGeometryFeatures_))),t}getFeaturesAtCoordinate(t){const e=[];return this.forEachFeatureAtCoordinateDirect(t,function(i){e.push(i)}),e}getFeaturesInExtent(t,e){if(this.featuresRtree_){if(!(e&&e.canWrapX()&&this.getWrapX()))return this.featuresRtree_.getInExtent(t);const s=Wl(t,e);return[].concat(...s.map(r=>this.featuresRtree_.getInExtent(r)))}return this.featuresCollection_?this.featuresCollection_.getArray().slice(0):[]}getClosestFeatureToCoordinate(t,e){const i=t[0],s=t[1];let r=null;const o=[NaN,NaN];let a=1/0;const l=[-1/0,-1/0,1/0,1/0];return e=e||Dn,this.featuresRtree_.forEachInExtent(l,function(h){if(e(h)){const c=h.getGeometry(),u=a;if(a=c instanceof fe?0:c.closestPointXY(i,s,o,a),a<u){r=h;const d=Math.sqrt(a);l[0]=i-d,l[1]=s-d,l[2]=i+d,l[3]=s+d}}}),r}getExtent(t){return this.featuresRtree_.getExtent(t)}getFeatureById(t){const e=this.idIndex_[t.toString()];return e!==void 0?e:null}getFeatureByUid(t){const e=this.uidIndex_[t];return e!==void 0?e:null}getFormat(){return this.format_}getOverlaps(){return this.overlaps_}getUrl(){return this.url_}handleFeatureChange_(t){const e=t.target,i=j(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 oi(ne.CHANGEFEATURE,e))}hasFeature(t){const e=t.getId();return e!==void 0?e in this.idIndex_:j(t)in this.uidIndex_}isEmpty(){return this.featuresRtree_?this.featuresRtree_.isEmpty()&&Bi(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 Ui(c.extent,l)})||(++this.loadingExtentsCount_,this.dispatchEvent(new oi(ne.FEATURESLOADSTART)),this.loader_.call(this,l,e,i,c=>{--this.loadingExtentsCount_,this.dispatchEvent(new oi(ne.FEATURESLOADEND,void 0,c))},()=>{--this.loadingExtentsCount_,this.dispatchEvent(new oi(ne.FEATURESLOADERROR))}),s.insert(l,{extent:l.slice()}))}this.loading=this.loader_.length<4?!1:this.loadingExtentsCount_>0}refresh(){this.clear(!0),this.loadedExtentsRtree_.clear(),super.refresh()}removeLoadedExtent(t){const e=this.loadedExtentsRtree_,i=e.forEachInExtent(t,function(s){if(Gn(s.extent,t))return s});i&&e.remove(i)}removeFeatures(t){let e=!1;for(let i=0,s=t.length;i<s;++i)e=this.removeFeatureInternal(t[i])||e;e&&this.changed()}removeFeature(t){if(!t)return;this.removeFeatureInternal(t)&&this.changed()}removeFeatureInternal(t){const e=j(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(st),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(ne.REMOVEFEATURE)&&this.dispatchEvent(new oi(ne.REMOVEFEATURE,t)),!0}removeFromIdIndex_(t){for(const e in this.idIndex_)if(this.idIndex_[e]===t){delete this.idIndex_[e];break}}setLoader(t){this.loader_=t}setUrl(t){Q(this.format_,"`format` must be set when `url` is set"),this.url_=t,this.setLoader(Uh(t,this.format_))}setOverlaps(t){this.overlaps_=t,this.changed()}}class Mi{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 Mi({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=ur(null,t.src,"anonymous",void 0,t.offset?null:t.color?t.color:null,!(t.offset&&t.size));e.ready().then(()=>{this.patternImage_=null}),e.getImageState()===Y.IDLE&&e.load(),e.getImageState()===Y.LOADING&&(this.patternImage_=e)}this.color_=t}getKey(){const t=this.getColor();return t?t instanceof CanvasPattern||t instanceof CanvasGradient?j(t):typeof t=="object"&&"src"in t?t.src+":"+t.offset:en(t).toString():""}loading(){return!!this.patternImage_}ready(){return this.patternImage_?this.patternImage_.ready():Promise.resolve()}}class is{constructor(t){t=t||{},this.color_=t.color!==void 0?t.color:null,this.lineCap_=t.lineCap,this.lineDash_=t.lineDash!==void 0?t.lineDash:null,this.lineDashOffset_=t.lineDashOffset,this.lineJoin_=t.lineJoin,this.miterLimit_=t.miterLimit,this.width_=t.width}clone(){const t=this.getColor();return new is({color:Array.isArray(t)?t.slice():t||void 0,lineCap:this.getLineCap(),lineDash:this.getLineDash()?this.getLineDash().slice():void 0,lineDashOffset:this.getLineDashOffset(),lineJoin:this.getLineJoin(),miterLimit:this.getMiterLimit(),width:this.getWidth()})}getColor(){return this.color_}getLineCap(){return this.lineCap_}getLineDash(){return this.lineDash_}getLineDashOffset(){return this.lineDashOffset_}getLineJoin(){return this.lineJoin_}getMiterLimit(){return this.miterLimit_}getWidth(){return this.width_}setColor(t){this.color_=t}setLineCap(t){this.lineCap_=t}setLineDash(t){this.lineDash_=t}setLineDashOffset(t){this.lineDashOffset_=t}setLineJoin(t){this.lineJoin_=t}setMiterLimit(t){this.miterLimit_=t}setWidth(t){this.width_=t}}function ec(n){return n[0]>0&&n[1]>0}function Hg(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 Gt(n,t){return Array.isArray(n)?n:(t===void 0?t=[n,n]:(t[0]=n,t[1]=n),t)}class pr{constructor(t){this.opacity_=t.opacity,this.rotateWithView_=t.rotateWithView,this.rotation_=t.rotation,this.scale_=t.scale,this.scaleArray_=Gt(t.scale),this.displacement_=t.displacement,this.declutterMode_=t.declutterMode}clone(){const t=this.getScale();return new pr({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 V()}getImage(t){return V()}getHitDetectionImage(){return V()}getPixelRatio(t){return 1}getImageState(){return V()}getImageSize(){return V()}getOrigin(){return V()}getSize(){return V()}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_=Gt(t)}listenImageChange(t){V()}load(){V()}unlistenImageChange(t){V()}ready(){return Promise.resolve()}}class yr extends pr{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()?Y.LOADING:Y.LOADED,this.imageState_===Y.LOADING&&this.ready().then(()=>this.imageState_=Y.LOADED),this.render()}clone(){const t=this.getScale(),e=new yr({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=ie.get(i,null,null)?.getImage(1);if(!s){const r=this.renderOptions_,o=Math.ceil(r.size*t),a=ct(o,o);this.draw_(r,a,t),s=a.canvas,ie.set(i,null,null,new Oh(s,void 0,null,Y.LOADED,null))}return s}getPixelRatio(t){return t}getImageSize(){return this.size_}getImageState(){return this.imageState_}getOrigin(){return this.origin_}getPoints(){return this.points_}getRadius(){return this.radius}getRadius2(){return this.radius2_}getSize(){return this.size_}getStroke(){return this.stroke_}setStroke(t){this.stroke_=t,this.render()}listenImageChange(t){}load(){}unlistenImageChange(t){}calculateLineJoinSize_(t,e,i){if(e===0||this.points_===1/0||t!=="bevel"&&t!=="miter")return e;let s=this.radius,r=this.radius2_===void 0?s:this.radius2_;if(s<r){const 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),_=Math.sqrt((s+f)*(s+f)+g*g)-s;if(this.radius2_===void 0||t==="bevel")return _*2;const p=s*Math.sin(a),y=Math.sqrt(s*s-p*p),w=r-y,E=Math.sqrt(p*p+w*w)/p;if(E<=i){const T=E*e/2-r-s;return 2*Math.max(_,T)}return _*2}createRenderOptions(){let t=nn,e=sn,i=0,s=null,r=0,o,a=0;this.stroke_&&(o=xe(this.stroke_.getColor()??jn),a=this.stroke_.getWidth()??qn,s=this.stroke_.getLineDash(),r=this.stroke_.getLineDashOffset()??0,e=this.stroke_.getLineJoin()??sn,t=this.stroke_.getLineCap()??nn,i=this.stroke_.getMiterLimit()??Vn);const l=this.calculateLineJoinSize_(e,a,i),h=Math.max(this.radius,this.radius2_||0),c=Math.ceil(2*h+l);return{strokeStyle:o,strokeWidth:a,size:c,lineCap:t,lineDash:s,lineDashOffset:r,lineJoin:e,miterLimit:i}}render(){this.renderOptions_=this.createRenderOptions();const t=this.renderOptions_.size;this.hitDetectionCanvas_=null,this.size_=[t,t]}draw_(t,e,i){if(e.scale(i,i),e.translate(t.size/2,t.size/2),this.createPath_(e),this.fill_){let s=this.fill_.getColor();s===null&&(s=Nt),e.fillStyle=xe(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=en(i)),i===null?s=1:Array.isArray(i)&&(s=i.length===4?i[3]:1),s===0&&(e=ct(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=Nt,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 xr extends yr{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 xr({fill:this.getFill()?this.getFill().clone():void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,radius:this.getRadius(),scale:Array.isArray(t)?t.slice():t,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()});return e.setOpacity(this.getOpacity()),e}setRadius(t){this.radius=t,this.render()}}class Ee{constructor(t){t=t||{},this.geometry_=null,this.geometryFunction_=nc,t.geometry!==void 0&&this.setGeometry(t.geometry),this.fill_=t.fill!==void 0?t.fill:null,this.image_=t.image!==void 0?t.image:null,this.renderer_=t.renderer!==void 0?t.renderer:null,this.hitDetectionRenderer_=t.hitDetectionRenderer!==void 0?t.hitDetectionRenderer:null,this.stroke_=t.stroke!==void 0?t.stroke:null,this.text_=t.text!==void 0?t.text:null,this.zIndex_=t.zIndex}clone(){let t=this.getGeometry();return t&&typeof t=="object"&&(t=t.clone()),new Ee({geometry:t??void 0,fill:this.getFill()?this.getFill().clone():void 0,image:this.getImage()?this.getImage().clone():void 0,renderer:this.getRenderer()??void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,text:this.getText()?this.getText().clone():void 0,zIndex:this.getZIndex()})}getRenderer(){return this.renderer_}setRenderer(t){this.renderer_=t}setHitDetectionRenderer(t){this.hitDetectionRenderer_=t}getHitDetectionRenderer(){return this.hitDetectionRenderer_}getGeometry(){return this.geometry_}getGeometryFunction(){return this.geometryFunction_}getFill(){return this.fill_}setFill(t){this.fill_=t}getImage(){return this.image_}setImage(t){this.image_=t}getStroke(){return this.stroke_}setStroke(t){this.stroke_=t}getText(){return this.text_}setText(t){this.text_=t}getZIndex(){return this.zIndex_}setGeometry(t){typeof t=="function"?this.geometryFunction_=t:typeof t=="string"?this.geometryFunction_=function(e){return e.get(t)}:t?t!==void 0&&(this.geometryFunction_=function(){return t}):this.geometryFunction_=nc,this.geometry_=t}setZIndex(t){this.zIndex_=t}}function qg(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 Bo=null;function ic(n,t){if(!Bo){const e=new Mi({color:"rgba(255,255,255,0.4)"}),i=new is({color:"#3399CC",width:1.25});Bo=[new Ee({image:new xr({fill:e,stroke:i,radius:5}),fill:e,stroke:i})]}return Bo}function nc(n){return n.getGeometry()}const Jg="#333";let sc=class du{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_=Gt(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 Mi({color:Jg}),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 du({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 Mi?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_=Gt(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 vt={ANIMATING:0,INTERACTING:1},N={BEGIN_GEOMETRY:0,BEGIN_PATH:1,CIRCLE:2,CLOSE_PATH:3,CUSTOM:4,DRAW_CHARS:5,DRAW_IMAGE:6,END_GEOMETRY:7,FILL:8,MOVE_TO_LINE_TO:9,SET_FILL_STYLE:10,SET_STROKE_STYLE:11,STROKE:12},Er=[N.FILL],ai=[N.STROKE],Pi=[N.BEGIN_PATH],rc=[N.CLOSE_PATH];class ns extends Dh{constructor(t,e,i,s){super(),this.tolerance=t,this.maxExtent=e,this.pixelRatio=s,this.maxLineWidth=0,this.resolution=i,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_=null,this.bufferedMaxExtent_=null,this.instructions=[],this.coordinates=[],this.tmpCoordinate_=[],this.hitDetectionInstructions=[],this.state={}}applyPixelRatio(t){const e=this.pixelRatio;return e==1?t:t.map(function(i){return i*e})}appendFlatPointCoordinates(t,e){const i=this.getBufferedMaxExtent(),s=this.tmpCoordinate_,r=this.coordinates;let o=r.length;for(let a=0,l=t.length;a<l;a+=e)s[0]=t[a],s[1]=t[a+1],Zi(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],_=io(h,d),_!==m?(f&&(a[l++]=c,a[l++]=u,f=!1),a[l++]=d[0],a[l++]=d[1]):_===ft.INTERSECTING?(a[l++]=d[0],a[l++]=d[1],f=!1):f=!0,c=d[0],u=d[1],m=_;return(r&&f||g===e+s)&&(a[l++]=c,a[l++]=u),l}drawCustomCoordinates_(t,e,i,s,r){for(let o=0,a=i.length;o<a;++o){const l=i[o],h=this.appendFlatLineCoordinates(t,e,l,s,!1,!1);r.push(h),e=l}return e}drawCustom(t,e,i,s,r){this.beginGeometry(t,e,r);const o=t.getType(),a=t.getStride(),l=this.coordinates.length;let h,c,u,d,f;switch(o){case"MultiPolygon":h=t.getOrientedFlatCoordinates(),d=[];const g=t.getEndss();f=0;for(let m=0,_=g.length;m<_;++m){const p=[];f=this.drawCustomCoordinates_(h,f,g[m],a,p),d.push(p)}this.instructions.push([N.CUSTOM,l,d,t,i,ph,r]),this.hitDetectionInstructions.push([N.CUSTOM,l,d,t,s||i,ph,r]);break;case"Polygon":case"MultiLineString":u=[],h=o=="Polygon"?t.getOrientedFlatCoordinates():t.getFlatCoordinates(),f=this.drawCustomCoordinates_(h,0,t.getEnds(),a,u),this.instructions.push([N.CUSTOM,l,u,t,i,or,r]),this.hitDetectionInstructions.push([N.CUSTOM,l,u,t,s||i,or,r]);break;case"LineString":case"Circle":h=t.getFlatCoordinates(),c=this.appendFlatLineCoordinates(h,0,h.length,a,!1,!1),this.instructions.push([N.CUSTOM,l,c,t,i,tn,r]),this.hitDetectionInstructions.push([N.CUSTOM,l,c,t,s||i,tn,r]);break;case"MultiPoint":h=t.getFlatCoordinates(),c=this.appendFlatPointCoordinates(h,a),c>l&&(this.instructions.push([N.CUSTOM,l,c,t,i,tn,r]),this.hitDetectionInstructions.push([N.CUSTOM,l,c,t,s||i,tn,r]));break;case"Point":h=t.getFlatCoordinates(),this.coordinates.push(h[0],h[1]),c=this.coordinates.length,this.instructions.push([N.CUSTOM,l,c,t,i,void 0,r]),this.hitDetectionInstructions.push([N.CUSTOM,l,c,t,s||i,void 0,r]);break}this.endGeometry(e)}beginGeometry(t,e,i){this.beginGeometryInstruction1_=[N.BEGIN_GEOMETRY,e,0,t,i],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[N.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==N.END_GEOMETRY?o=e:r==N.BEGIN_GEOMETRY&&(s[2]=e,kd(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=xe(i||Nt)}else e.fillStyle=void 0;return e}strokeStyleToState(t,e={}){if(t){const i=t.getColor();e.strokeStyle=xe(i||jn);const s=t.getLineCap();e.lineCap=s!==void 0?s:nn;const r=t.getLineDash();e.lineDash=r?r.slice():Fe;const o=t.getLineDashOffset();e.lineDashOffset=o||ke;const a=t.getLineJoin();e.lineJoin=a!==void 0?a:sn;const l=t.getWidth();e.lineWidth=l!==void 0?l:qn;const h=t.getMiterLimit();e.miterLimit=h!==void 0?h:Vn,e.lineWidth>this.maxLineWidth&&(this.maxLineWidth=e.lineWidth,this.bufferedMaxExtent_=null)}else e.strokeStyle=void 0,e.lineCap=void 0,e.lineDash=null,e.lineDashOffset=void 0,e.lineJoin=void 0,e.lineWidth=void 0,e.miterLimit=void 0;return e}setFillStrokeStyle(t,e){const i=this.state;this.fillStyleToState(t,i),this.strokeStyleToState(e,i)}createFill(t){const e=t.fillStyle,i=[N.SET_FILL_STYLE,e];return typeof e!="string"&&i.push(t.fillPatternScale),i}applyStroke(t){this.instructions.push(this.createStroke(t))}createStroke(t){return[N.SET_STROKE_STYLE,t.strokeStyle,t.lineWidth*this.pixelRatio,t.lineCap,t.lineJoin,t.miterLimit,t.lineDash?this.applyPixelRatio(t.lineDash):null,t.lineDashOffset*this.pixelRatio]}updateFillStyle(t,e){const i=t.fillStyle;(typeof i!="string"||t.currentFillStyle!=i)&&(this.instructions.push(e.call(this,t)),t.currentFillStyle=i)}updateStrokeStyle(t,e){const i=t.strokeStyle,s=t.lineCap,r=t.lineDash,o=t.lineDashOffset,a=t.lineJoin,l=t.lineWidth,h=t.miterLimit;(t.currentStrokeStyle!=i||t.currentLineCap!=s||r!=t.currentLineDash&&!ti(t.currentLineDash,r)||t.currentLineDashOffset!=o||t.currentLineJoin!=a||t.currentLineWidth!=l||t.currentMiterLimit!=h)&&(e.call(this,t),t.currentStrokeStyle=i,t.currentLineCap=s,t.currentLineDash=r,t.currentLineDashOffset=o,t.currentLineJoin=a,t.currentLineWidth=l,t.currentMiterLimit=h)}endGeometry(t){this.beginGeometryInstruction1_[2]=this.instructions.length,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_[2]=this.hitDetectionInstructions.length,this.beginGeometryInstruction2_=null;const e=[N.END_GEOMETRY,t];this.instructions.push(e),this.hitDetectionInstructions.push(e)}getBufferedMaxExtent(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=Pl(this.maxExtent),this.maxLineWidth>0)){const t=this.resolution*(this.maxLineWidth+1)/2;eo(this.bufferedMaxExtent_,t,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_}}class Qg extends ns{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&&!Zi(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([N.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([N.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||Zi(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([N.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([N.DRAW_IMAGE,o,a,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,1,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(e)}finish(){return this.reverseHitDetectionInstructions(),this.anchorX_=void 0,this.anchorY_=void 0,this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.height_=void 0,this.scale_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.width_=void 0,super.finish()}setImageStyle(t,e){const i=t.getAnchor(),s=t.getSize(),r=t.getOrigin();this.imagePixelRatio_=t.getPixelRatio(this.pixelRatio),this.anchorX_=i[0],this.anchorY_=i[1],this.hitDetectionImage_=t.getHitDetectionImage(),this.image_=t.getImage(this.pixelRatio),this.height_=s[1],this.opacity_=t.getOpacity(),this.originX_=r[0],this.originY_=r[1],this.rotateWithView_=t.getRotateWithView(),this.rotation_=t.getRotation(),this.scale_=t.getScaleArray(),this.width_=s[0],this.declutterMode_=t.getDeclutterMode(),this.declutterImageWithText_=e}}class t_ extends ns{constructor(t,e,i,s){super(t,e,i,s)}drawFlatCoordinates_(t,e,i,s){const r=this.coordinates.length,o=this.appendFlatLineCoordinates(t,e,i,s,!1,!1),a=[N.MOVE_TO_LINE_TO,r,o];return this.instructions.push(a),this.hitDetectionInstructions.push(a),i}drawLineString(t,e,i){const s=this.state,r=s.strokeStyle,o=s.lineWidth;if(r===void 0||o===void 0)return;this.updateStrokeStyle(s,this.applyStroke),this.beginGeometry(t,e,i),this.hitDetectionInstructions.push([N.SET_STROKE_STYLE,s.strokeStyle,s.lineWidth,s.lineCap,s.lineJoin,s.miterLimit,Fe,ke],Pi);const a=t.getFlatCoordinates(),l=t.getStride();this.drawFlatCoordinates_(a,0,a.length,l),this.hitDetectionInstructions.push(ai),this.endGeometry(e)}drawMultiLineString(t,e,i){const s=this.state,r=s.strokeStyle,o=s.lineWidth;if(r===void 0||o===void 0)return;this.updateStrokeStyle(s,this.applyStroke),this.beginGeometry(t,e,i),this.hitDetectionInstructions.push([N.SET_STROKE_STYLE,s.strokeStyle,s.lineWidth,s.lineCap,s.lineJoin,s.miterLimit,Fe,ke],Pi);const a=t.getEnds(),l=t.getFlatCoordinates(),h=t.getStride();let c=0;for(let u=0,d=a.length;u<d;++u)c=this.drawFlatCoordinates_(l,c,a[u],h);this.hitDetectionInstructions.push(ai),this.endGeometry(e)}finish(){const t=this.state;return t.lastStroke!=null&&t.lastStroke!=this.coordinates.length&&this.instructions.push(ai),this.reverseHitDetectionInstructions(),this.state=null,super.finish()}applyStroke(t){t.lastStroke!=null&&t.lastStroke!=this.coordinates.length&&(this.instructions.push(ai),t.lastStroke=this.coordinates.length),t.lastStroke=0,super.applyStroke(t),this.instructions.push(Pi)}}class oc extends ns{constructor(t,e,i,s){super(t,e,i,s)}drawFlatCoordinatess_(t,e,i,s){const r=this.state,o=r.fillStyle!==void 0,a=r.strokeStyle!==void 0,l=i.length;this.instructions.push(Pi),this.hitDetectionInstructions.push(Pi);for(let h=0;h<l;++h){const c=i[h],u=this.coordinates.length,d=this.appendFlatLineCoordinates(t,e,c,s,!0,!a),f=[N.MOVE_TO_LINE_TO,u,d];this.instructions.push(f),this.hitDetectionInstructions.push(f),a&&(this.instructions.push(rc),this.hitDetectionInstructions.push(rc)),e=c}return o&&(this.instructions.push(Er),this.hitDetectionInstructions.push(Er)),a&&(this.instructions.push(ai),this.hitDetectionInstructions.push(ai)),e}drawCircle(t,e,i){const s=this.state,r=s.fillStyle,o=s.strokeStyle;if(r===void 0&&o===void 0)return;this.setFillStrokeStyles_(),this.beginGeometry(t,e,i),s.fillStyle!==void 0&&this.hitDetectionInstructions.push([N.SET_FILL_STYLE,Nt]),s.strokeStyle!==void 0&&this.hitDetectionInstructions.push([N.SET_STROKE_STYLE,s.strokeStyle,s.lineWidth,s.lineCap,s.lineJoin,s.miterLimit,Fe,ke]);const a=t.getFlatCoordinates(),l=t.getStride(),h=this.coordinates.length;this.appendFlatLineCoordinates(a,0,a.length,l,!1,!1);const c=[N.CIRCLE,h];this.instructions.push(Pi,c),this.hitDetectionInstructions.push(Pi,c),s.fillStyle!==void 0&&(this.instructions.push(Er),this.hitDetectionInstructions.push(Er)),s.strokeStyle!==void 0&&(this.instructions.push(ai),this.hitDetectionInstructions.push(ai)),this.endGeometry(e)}drawPolygon(t,e,i){const s=this.state,r=s.fillStyle,o=s.strokeStyle;if(r===void 0&&o===void 0)return;this.setFillStrokeStyles_(),this.beginGeometry(t,e,i),s.fillStyle!==void 0&&this.hitDetectionInstructions.push([N.SET_FILL_STYLE,Nt]),s.strokeStyle!==void 0&&this.hitDetectionInstructions.push([N.SET_STROKE_STYLE,s.strokeStyle,s.lineWidth,s.lineCap,s.lineJoin,s.miterLimit,Fe,ke]);const a=t.getEnds(),l=t.getOrientedFlatCoordinates(),h=t.getStride();this.drawFlatCoordinatess_(l,0,a,h),this.endGeometry(e)}drawMultiPolygon(t,e,i){const s=this.state,r=s.fillStyle,o=s.strokeStyle;if(r===void 0&&o===void 0)return;this.setFillStrokeStyles_(),this.beginGeometry(t,e,i),s.fillStyle!==void 0&&this.hitDetectionInstructions.push([N.SET_FILL_STYLE,Nt]),s.strokeStyle!==void 0&&this.hitDetectionInstructions.push([N.SET_STROKE_STYLE,s.strokeStyle,s.lineWidth,s.lineCap,s.lineJoin,s.miterLimit,Fe,ke]);const a=t.getEndss(),l=t.getOrientedFlatCoordinates(),h=t.getStride();let c=0;for(let u=0,d=a.length;u<d;++u)c=this.drawFlatCoordinatess_(l,c,a[u],h);this.endGeometry(e)}finish(){this.reverseHitDetectionInstructions(),this.state=null;const t=this.tolerance;if(t!==0){const e=this.coordinates;for(let i=0,s=e.length;i<s;++i)e[i]=Si(e[i],t)}return super.finish()}setFillStrokeStyles_(){const t=this.state;this.updateFillStyle(t,this.createFill),this.updateStrokeStyle(t,this.applyStroke)}}function e_(n,t,e,i,s){const r=[];let o=e,a=0,l=t.slice(e,2);for(;a<n&&o+s<i;){const[h,c]=l.slice(-2),u=t[o+s],d=t[o+s+1],f=Math.sqrt((u-h)*(u-h)+(d-c)*(d-c));if(a+=f,a>=n){const g=(n-a+f)/f,m=Qt(h,u,g),_=Qt(c,d,g);l.push(m,_),r.push(l),l=[m,_],a==n&&(o+=s),a=0}else if(a<n)l.push(t[o+s],t[o+s+1]),o+=s;else{const g=f-a,m=Qt(h,u,g/f),_=Qt(c,d,g/f);l.push(m,_),r.push(l),l=[m,_],a=0,o+=s}}return a>0&&r.push(l),r}function i_(n,t,e,i,s){let r=e,o=e,a=0,l=0,h=e,c,u,d,f,g,m,_,p,y,w;for(u=e;u<i;u+=s){const x=t[u],E=t[u+1];g!==void 0&&(y=x-g,w=E-m,f=Math.sqrt(y*y+w*w),_!==void 0&&(l+=d,c=Math.acos((_*y+p*w)/(d*f)),c>n&&(l>a&&(a=l,r=h,o=u),l=0,h=u-s)),d=f,_=y,p=w),g=x,m=E}return l+=f,l>a?[h,u]:[r,o]}const vr={left:0,center:.5,right:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1};class n_ extends ns{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[Nt]={fillStyle:Nt},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(!Ft(this.maxExtent,t.getExtent()))return;let d;if(c=t.getFlatCoordinates(),h=="LineString")d=[c.length];else if(h=="MultiLineString")d=t.getEnds();else if(h=="Polygon")d=t.getEnds().slice(0,1);else if(h=="MultiPolygon"){const _=t.getEndss();d=[];for(let p=0,y=_.length;p<y;++p)d.push(_[p][0])}this.beginGeometry(t,e,i);const f=o.repeat,g=f?void 0:o.textAlign;let m=0;for(let _=0,p=d.length;_<p;++_){let y;f?y=e_(f*this.resolution,c,m,d[_],u):y=[c.slice(m,d[_])];for(let w=0,x=y.length;w<x;++w){const E=y[w];let T=0,I=E.length;if(g==null){const R=i_(o.maxAngle,E,0,E.length,2);T=R[0],I=R[1]}for(let R=T;R<I;R+=u)a.push(E[R],E[R+1]);const v=a.length;m=d[_],this.drawChars_(l,v),l=v}}this.endGeometry(e)}else{let d=o.overflow?null:[];switch(h){case"Point":case"MultiPoint":c=t.getFlatCoordinates();break;case"LineString":c=t.getFlatMidpoint();break;case"Circle":c=t.getCenter();break;case"MultiLineString":c=t.getFlatMidpoints(),u=2;break;case"Polygon":c=t.getFlatInteriorPoint(),o.overflow||d.push(c[2]/this.resolution),u=3;break;case"MultiPolygon":const x=t.getFlatInteriorPoints();c=[];for(let E=0,T=x.length;E<T;E+=3)o.overflow||d.push(x[E+2]/this.resolution),c.push(x[E],x[E+1]);if(c.length===0)return;u=2;break}const f=this.appendFlatPointCoordinates(c,u);if(f===l)return;if(d&&(f-l)/2!==c.length/u){let x=l/2;d=d.filter((E,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,m=o.backgroundStroke?this.createStroke(this.strokeStyleToState(o.backgroundStroke)):null;this.beginGeometry(t,e,i);let _=o.padding;if(_!=Ai&&(o.scale[0]<0||o.scale[1]<0)){let x=o.padding[0],E=o.padding[1],T=o.padding[2],I=o.padding[3];o.scale[0]<0&&(E=-E,I=-I),o.scale[1]<0&&(x=-x,T=-T),_=[x,E,T,I]}const p=this.pixelRatio;this.instructions.push([N.DRAW_IMAGE,l,f,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[1,1],NaN,this.declutterMode_,this.declutterImageWithText_,_==Ai?Ai:_.map(function(x){return x*p}),g,m,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,d]);const y=1/p,w=g?g.slice(0):null;w&&(w[1]=Nt),this.hitDetectionInstructions.push([N.DRAW_IMAGE,l,f,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[y,y],NaN,this.declutterMode_,this.declutterImageWithText_,_,w,m,this.text_,this.textKey_,this.strokeKey_,this.fillKey_?Nt:this.fillKey_,this.textOffsetX_,this.textOffsetY_,d]),this.endGeometry(e)}}saveTextStates_(){const t=this.textStrokeState_,e=this.textState_,i=this.textFillState_,s=this.strokeKey_;t&&(s in this.strokeStates||(this.strokeStates[s]={strokeStyle:t.strokeStyle,lineCap:t.lineCap,lineDashOffset:t.lineDashOffset,lineWidth:t.lineWidth,lineJoin:t.lineJoin,miterLimit:t.miterLimit,lineDash:t.lineDash}));const r=this.textKey_;r in this.textStates||(this.textStates[r]={font:e.font,textAlign:e.textAlign||Hn,justify:e.justify,textBaseline:e.textBaseline||gr,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=vr[s.textBaseline],c=this.textOffsetY_*l,u=this.text_,d=i?i.lineWidth*Math.abs(s.scale[0])/2:0;this.instructions.push([N.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([N.DRAW_CHARS,t,e,h,s.overflow,a&&Nt,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=xe(o.getColor()||Nt)):(s=null,this.textFillState_=s);const a=t.getStroke();if(!a)r=null,this.textStrokeState_=r;else{r=this.textStrokeState_,r||(r={},this.textStrokeState_=r);const m=a.getLineDash(),_=a.getLineDashOffset(),p=a.getWidth(),y=a.getMiterLimit();r.lineCap=a.getLineCap()||nn,r.lineDash=m?m.slice():Fe,r.lineDashOffset=_===void 0?ke:_,r.lineJoin=a.getLineJoin()||sn,r.lineWidth=p===void 0?qn:p,r.miterLimit=y===void 0?Vn:y,r.strokeStyle=xe(a.getColor()||jn)}i=this.textState_;const l=t.getFont()||Nh;wg(l);const h=t.getScaleArray();i.overflow=t.getOverflow(),i.font=l,i.maxAngle=t.getMaxAngle(),i.placement=t.getPlacement(),i.textAlign=t.getTextAlign(),i.repeat=t.getRepeat(),i.justify=t.getJustify(),i.textBaseline=t.getTextBaseline()||gr,i.backgroundFill=t.getBackgroundFill(),i.backgroundStroke=t.getBackgroundStroke(),i.padding=t.getPadding()||Ai,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:j(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:"|"+j(s.fillStyle):""}this.declutterMode_=t.getDeclutterMode(),this.declutterImageWithText_=e}}const s_={Circle:oc,Default:ns,Image:Qg,LineString:t_,Polygon:oc,Text:n_};class r_{constructor(t,e,i,s){this.tolerance_=t,this.maxExtent_=e,this.pixelRatio_=s,this.resolution_=i,this.buildersByZIndex_={}}finish(){const t={};for(const e in this.buildersByZIndex_){t[e]=t[e]||{};const i=this.buildersByZIndex_[e];for(const s in i){const r=i[s].finish();t[e][s]=r}}return t}getBuilder(t,e){const i=t!==void 0?t.toString():"0";let s=this.buildersByZIndex_[i];s===void 0&&(s={},this.buildersByZIndex_[i]=s);let r=s[e];if(r===void 0){const o=s_[e];r=new o(this.tolerance_,this.maxExtent_,this.resolution_,this.pixelRatio_),s[e]=r}return r}}function o_(n,t,e,i,s,r,o,a,l,h,c,u,d=!0){let f=n[t],g=n[t+1],m=0,_=0,p=0,y=0;function w(){m=f,_=g,t+=i,f=n[t],g=n[t+1],y+=p,p=Math.sqrt((f-m)*(f-m)+(g-_)*(g-_))}do w();while(t<e-i&&y+p<r);let x=p===0?0:(r-y)/p;const E=Qt(m,f,x),T=Qt(_,g,x),I=t-i,v=y,R=r+a*l(h,s,c);for(;t<e-i&&y+p<R;)w();x=p===0?0:(R-y)/p;const b=Qt(m,f,x),O=Qt(_,g,x);let F=!1;if(d)if(u){const X=[E,T,b,O];hh(X,0,4,2,u,X,X),F=X[0]>X[2]}else F=E>b;const A=Math.PI,L=[],M=I+i===t;t=I,p=0,y=v,f=n[t],g=n[t+1];let P;if(M){w(),P=Math.atan2(g-_,f-m),F&&(P+=P>0?-A:A);const X=(b+E)/2,D=(O+T)/2;return L[0]=[X,D,(R-r)/2,P,s],L}s=s.replace(/\n/g," ");for(let X=0,D=s.length;X<D;){w();let k=Math.atan2(g-_,f-m);if(F&&(k+=k>0?-A:A),P!==void 0){let nt=k-P;if(nt+=nt>A?-2*A:nt<-A?2*A:0,Math.abs(nt)>o)return null}P=k;const K=X;let H=0;for(;X<D;++X){const nt=F?D-X-1:X,mt=a*l(h,s[nt],c);if(t+i<e&&y+p<r+H+mt/2)break;H+=mt}if(X===K)continue;const S=F?s.substring(D-K,D-X):s.substring(K,X);x=p===0?0:(r+H/2-y)/p;const _t=Qt(m,f,x),dt=Qt(_,g,x);L.push([_t,dt,H/2,k,S]),r+=H}return L}class ac{constructor(){this.instructions_=[],this.zIndex=0,this.offset_=0,this.context_=new Proxy(lr(),{get:(t,e)=>{if(typeof lr()[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 ln=$t(),li=[],Ne=[],Ge=[],hi=[];function lc(n){return n[3].declutterBox}const hc=new RegExp("[֑-ࣿיִ-﷿ﹰ-ﻼࠀ--]");function Zo(n,t){return t==="start"?t=hc.test(n)?"right":"left":t==="end"&&(t=hc.test(n)?"left":"right"),vr[t]}function a_(n,t,e){return e>0&&n.push(`
|
|
5
|
+
`,""),n.push(t,""),n}function l_(n,t,e){return e%2===0&&(n+=t),n}class h_{constructor(t,e,i,s,r){this.overlaps=i,this.pixelRatio=e,this.resolution=t,this.alignAndScaleFill_,this.instructions=s.instructions,this.coordinates=s.coordinates,this.coordinateCache_={},this.renderedTransform_=de(),this.hitDetectionInstructions=s.hitDetectionInstructions,this.pixelCoordinates_=null,this.viewRotation_=0,this.fillStates=s.fillStates||{},this.strokeStates=s.strokeStates||{},this.textStates=s.textStates||{},this.widths_={},this.labels_={},this.zIndexContext_=r?new ac:null}getZIndexContext(){return this.zIndexContext_}createLabel(t,e,i,s){const r=t+e+i+s;if(this.labels_[r])return this.labels_[r];const o=s?this.strokeStates[s]:null,a=i?this.fillStates[i]:null,l=this.textStates[e],h=this.pixelRatio,c=[l.scale[0]*h,l.scale[1]*h],u=l.justify?vr[l.justify]:Zo(Array.isArray(t)?t[0]:t,l.textAlign||Hn),d=s&&o.lineWidth?o.lineWidth:0,f=Array.isArray(t)?t:String(t).split(`
|
|
6
|
+
`).reduce(a_,[]),{width:g,height:m,widths:_,heights:p,lineWidths:y}=Rg(l,f),w=g+d,x=[],E=(w+2)*c[0],T=(m+d)*c[1],I={width:E<0?Math.floor(E):Math.ceil(E),height:T<0?Math.floor(T):Math.ceil(T),contextInstructions:x};(c[0]!=1||c[1]!=1)&&x.push("scale",c),s&&(x.push("strokeStyle",o.strokeStyle),x.push("lineWidth",d),x.push("lineCap",o.lineCap),x.push("lineJoin",o.lineJoin),x.push("miterLimit",o.miterLimit),x.push("setLineDash",[o.lineDash]),x.push("lineDashOffset",o.lineDashOffset)),i&&x.push("fillStyle",a.fillStyle),x.push("textBaseline","middle"),x.push("textAlign","center");const v=.5-u;let R=u*w+v*d;const b=[],O=[];let F=0,A=0,L=0,M=0,P;for(let X=0,D=f.length;X<D;X+=2){const k=f[X];if(k===`
|
|
7
|
+
`){A+=F,F=0,R=u*w+v*d,++M;continue}const K=f[X+1]||l.font;K!==P&&(s&&b.push("font",K),i&&O.push("font",K),P=K),F=Math.max(F,p[L]);const H=[k,R+v*_[L]+u*(_[L]-y[M]),.5*(d+F)+A];R+=_[L],s&&b.push("strokeText",H),i&&O.push("fillText",H),++L}return Array.prototype.push.apply(x,b),Array.prototype.push.apply(x,O),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 w=r+h>t?t-h:r,x=o+c>e?e-c:o,E=g[3]+w*d[0]+g[1],T=g[0]+x*d[1]+g[2],I=p-g[3],v=y-g[0];(m||u!==0)&&(li[0]=I,hi[0]=I,li[1]=v,Ne[1]=v,Ne[0]=I+E,Ge[0]=Ne[0],Ge[1]=v+T,hi[1]=Ge[1]);let R;return u!==0?(R=De(de(),i,s,1,1,u,-i,-s),gt(R,li),gt(R,Ne),gt(R,Ge),gt(R,hi),ei(Math.min(li[0],Ne[0],Ge[0],hi[0]),Math.min(li[1],Ne[1],Ge[1],hi[1]),Math.max(li[0],Ne[0],Ge[0],hi[0]),Math.max(li[1],Ne[1],Ge[1],hi[1]),ln)):ei(Math.min(I,I+E),Math.min(v,v+T),Math.max(I,I+E),Math.max(v,v+T),ln),f&&(p=Math.round(p),y=Math.round(y)),{drawImageX:p,drawImageY:y,drawImageW:w,drawImageH:x,originX:h,originY:c,declutterBox:{minX:ln[0],minY:ln[1],maxX:ln[2],maxY:ln[3],value:_},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,li,Ne,Ge,hi,o,a),Tg(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=gt(this.renderedTransform_,[0,0]),s=512*this.pixelRatio;t.save(),t.translate(i[0]%s,i[1]%s),e!==1&&t.scale(e,e),t.rotate(this.viewRotation_)}t.fill(),e&&t.restore()}setStrokeStyle_(t,e){t.strokeStyle=e[1],e[1]&&(t.lineWidth=e[2],t.lineCap=e[3],t.lineJoin=e[4],t.miterLimit=e[5],t.lineDashOffset=e[7],t.setLineDash(e[6]))}drawLabelWithPointPlacement_(t,e,i,s){const r=this.textStates[e],o=this.createLabel(t,e,s,i),a=this.strokeStates[i],l=this.pixelRatio,h=Zo(Array.isArray(t)?t[0]:t,r.textAlign||Hn),c=vr[r.textBaseline||gr],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_&&ti(i,this.renderedTransform_)?c=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),c=si(this.coordinates,0,this.coordinates.length,2,i,this.pixelCoordinates_),Sf(this.renderedTransform_,i));let u=0;const d=s.length;let f=0,g,m,_,p,y,w,x,E,T,I,v,R,b,O=0,F=0;const A=this.coordinateCache_,L=this.viewRotation_,M=Math.round(Math.atan2(-i[1],i[0])*1e12)/1e12,P={context:t,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:L},X=this.instructions!=s||this.overlaps?0:200;let D,k,K,H;for(;u<d;){const S=s[u];switch(S[0]){case N.BEGIN_GEOMETRY:D=S[1],H=S[3],D.getGeometry()?a!==void 0&&!Ft(a,H.getExtent())?u=S[2]+1:++u:u=S[2],h&&(h.zIndex=S[4]);break;case N.BEGIN_PATH:O>X&&(this.fill_(t),O=0),F>X&&(t.stroke(),F=0),!O&&!F&&(t.beginPath(),y=NaN,w=NaN),++u;break;case N.CIRCLE:f=S[1];const dt=c[f],nt=c[f+1],mt=c[f+2],ht=c[f+3],Mt=mt-dt,pe=ht-nt,Bt=Math.sqrt(Mt*Mt+pe*pe);t.moveTo(dt+Bt,nt),t.arc(dt,nt,Bt,0,2*Math.PI,!0),++u;break;case N.CLOSE_PATH:t.closePath(),++u;break;case N.CUSTOM:f=S[1],g=S[2];const Or=S[3],wa=S[4],gs=S[5];P.geometry=Or,P.feature=D,u in A||(A[u]=[]);const Ni=A[u];gs?gs(c,f,g,2,Ni):(Ni[0]=c[f],Ni[1]=c[f+1],Ni.length=2),h&&(h.zIndex=S[6]),wa(Ni,P),++u;break;case N.DRAW_IMAGE:f=S[1],g=S[2],T=S[3],m=S[4],_=S[5];let se=S[6];const Ce=S[7],En=S[8],vn=S[9],_s=S[10];let Gi=S[11];const wn=S[12];let Cn=S[13];p=S[14]||"declutter";const pt=S[15];if(!T&&S.length>=20){I=S[19],v=S[20],R=S[21],b=S[22];const re=this.drawLabelWithPointPlacement_(I,v,R,b);T=re.label,S[3]=T;const zi=S[23];m=(re.anchorX-zi)*this.pixelRatio,S[4]=m;const oe=S[24];_=(re.anchorY-oe)*this.pixelRatio,S[5]=_,se=T.height,S[6]=se,Cn=T.width,S[13]=Cn}let Ca;S.length>25&&(Ca=S[25]);let Ra,Dr,Fr;S.length>17?(Ra=S[16],Dr=S[17],Fr=S[18]):(Ra=Ai,Dr=null,Fr=null),_s&&M?Gi+=L:!_s&&!M&&(Gi-=L);let kp=0;for(;f<g;f+=2){if(Ca&&Ca[kp++]<Cn/this.pixelRatio)continue;const re=this.calculateImageOrLabelDimensions_(T.width,T.height,c[f],c[f+1],Cn,se,m,_,En,vn,Gi,wn,r,Ra,!!Dr||!!Fr,D),zi=[t,e,T,re,Ce,Dr,Fr];if(l){let oe,Re,ae;if(pt){const lt=g-f;if(!pt[lt]){pt[lt]={args:zi,declutterMode:p};continue}const Pt=pt[lt];oe=Pt.args,Re=Pt.declutterMode,delete pt[lt],ae=lc(oe)}let Ye,$e;if(oe&&(Re!=="declutter"||!l.collides(ae))&&(Ye=!0),(p!=="declutter"||!l.collides(re.declutterBox))&&($e=!0),Re==="declutter"&&p==="declutter"){const lt=Ye&&$e;Ye=lt,$e=lt}Ye&&(Re!=="none"&&l.insert(ae),this.replayImageOrLabel_.apply(this,oe)),$e&&(p!=="none"&&l.insert(re.declutterBox),this.replayImageOrLabel_.apply(this,zi))}else this.replayImageOrLabel_.apply(this,zi)}++u;break;case N.DRAW_CHARS:const ru=S[1],ou=S[2],Ta=S[3],Np=S[4];b=S[5];const Gp=S[6],au=S[7],lu=S[8];R=S[9];const Ia=S[10];I=S[11],Array.isArray(I)&&(I=I.reduce(l_,"")),v=S[12];const hu=[S[13],S[13]];p=S[14]||"declutter";const zp=S[15],Sa=this.textStates[v],ms=Sa.font,ps=[Sa.scale[0]*au,Sa.scale[1]*au];let ys;ms in this.widths_?ys=this.widths_[ms]:(ys={},this.widths_[ms]=ys);const cu=Jf(c,ru,ou,2),uu=Math.abs(ps[0])*Wh(ms,I,ys);if(Np||uu<=cu){const re=this.textStates[v].textAlign,zi=(cu-uu)*Zo(I,re),oe=o_(c,ru,ou,2,I,zi,Gp,Math.abs(ps[0]),Wh,ms,ys,M?0:this.viewRotation_,zp);t:if(oe){const Re=[];let ae,Ye,$e,lt,Pt;if(R)for(ae=0,Ye=oe.length;ae<Ye;++ae){Pt=oe[ae],$e=Pt[4],lt=this.createLabel($e,v,"",R),m=Pt[2]+(ps[0]<0?-Ia:Ia),_=Ta*lt.height+(.5-Ta)*2*Ia*ps[1]/ps[0]-lu;const Ke=this.calculateImageOrLabelDimensions_(lt.width,lt.height,Pt[0],Pt[1],lt.width,lt.height,m,_,0,0,Pt[3],hu,!1,Ai,!1,D);if(l&&p==="declutter"&&l.collides(Ke.declutterBox))break t;Re.push([t,e,lt,Ke,1,null,null])}if(b)for(ae=0,Ye=oe.length;ae<Ye;++ae){Pt=oe[ae],$e=Pt[4],lt=this.createLabel($e,v,b,""),m=Pt[2],_=Ta*lt.height-lu;const Ke=this.calculateImageOrLabelDimensions_(lt.width,lt.height,Pt[0],Pt[1],lt.width,lt.height,m,_,0,0,Pt[3],hu,!1,Ai,!1,D);if(l&&p==="declutter"&&l.collides(Ke.declutterBox))break t;Re.push([t,e,lt,Ke,1,null,null])}l&&p!=="none"&&l.load(Re.map(lc));for(let Ke=0,Xp=Re.length;Ke<Xp;++Ke)this.replayImageOrLabel_.apply(this,Re[Ke])}}++u;break;case N.END_GEOMETRY:if(o!==void 0){D=S[1];const re=o(D,H,p);if(re)return re}++u;break;case N.FILL:X?O++:this.fill_(t),++u;break;case N.MOVE_TO_LINE_TO:for(f=S[1],g=S[2],k=c[f],K=c[f+1],t.moveTo(k,K),y=k+.5|0,w=K+.5|0,f+=2;f<g;f+=2)k=c[f],K=c[f+1],x=k+.5|0,E=K+.5|0,(f==g-2||x!==y||E!==w)&&(t.lineTo(k,K),y=x,w=E);++u;break;case N.SET_FILL_STYLE:this.alignAndScaleFill_=S[2],O&&(this.fill_(t),O=0,F&&(t.stroke(),F=0)),t.fillStyle=S[1],++u;break;case N.SET_STROKE_STYLE:F&&(t.stroke(),F=0),this.setStrokeStyle_(t,S),++u;break;case N.STROKE:X?F++:t.stroke(),++u;break;default:++u;break}}O&&this.fill_(t),F&&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 Oi=["Polygon","Circle","LineString","Image","Text","Default"],cc=["Image","Text"],c_=Oi.filter(n=>!cc.includes(n));class u_{constructor(t,e,i,s,r,o,a){this.maxExtent_=t,this.overlaps_=s,this.pixelRatio_=i,this.resolution_=e,this.renderBuffer_=o,this.executorsByZIndex_={},this.hitDetectionContext_=null,this.hitDetectionTransform_=de(),this.renderedContext_=null,this.deferredZIndexContexts_={},this.createExecutors_(r,a)}clip(t,e){const i=this.getClipCoords(e);t.beginPath(),t.moveTo(i[0],i[1]),t.lineTo(i[2],i[3]),t.lineTo(i[4],i[5]),t.lineTo(i[6],i[7]),t.clip()}createExecutors_(t,e){for(const i in t){let s=this.executorsByZIndex_[i];s===void 0&&(s={},this.executorsByZIndex_[i]=s);const r=t[i];for(const o in r){const a=r[o];s[o]=new h_(this.resolution_,this.pixelRatio_,this.overlaps_,a,e)}}}hasExecutors(t){for(const e in this.executorsByZIndex_){const i=this.executorsByZIndex_[e];for(let s=0,r=t.length;s<r;++s)if(t[s]in i)return!0}return!1}forEachFeatureAtCoordinate(t,e,i,s,r,o){s=Math.round(s);const a=s*2+1,l=De(this.hitDetectionTransform_,s+.5,s+.5,1/e,-1/e,-i,-t[0],-t[1]),h=!this.hitDetectionContext_;h&&(this.hitDetectionContext_=ct(a,a));const c=this.hitDetectionContext_;c.canvas.width!==a||c.canvas.height!==a?(c.canvas.width=a,c.canvas.height=a):h||c.clearRect(0,0,a,a);let u;this.renderBuffer_!==void 0&&(u=$t(),zn(u,t),eo(u,e*(this.renderBuffer_+s),u));const d=d_(s);let f;function g(E,T,I){const v=c.getImageData(0,0,a,a).data;for(let R=0,b=d.length;R<b;R++)if(v[d[R]]>0){if(!o||I==="none"||f!=="Image"&&f!=="Text"||o.includes(E)){const O=(d[R]-3)/4,F=s-O%a,A=s-(O/a|0),L=r(E,T,F*F+A*A);if(L)return L}c.clearRect(0,0,a,a);break}}const m=Object.keys(this.executorsByZIndex_).map(Number);m.sort(Me);let _,p,y,w,x;for(_=m.length-1;_>=0;--_){const E=m[_].toString();for(y=this.executorsByZIndex_[E],p=Oi.length-1;p>=0;--p)if(f=Oi[p],w=y[f],w!==void 0&&(x=w.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 si(a,0,8,2,t,a),a}isEmpty(){return Bi(this.executorsByZIndex_)}execute(t,e,i,s,r,o,a){const l=Object.keys(this.executorsByZIndex_).map(Number);l.sort(a?Fd:Me),o=o||Oi;const h=Oi.length;for(let c=0,u=l.length;c<u;++c){const d=l[c].toString(),f=this.executorsByZIndex_[d];for(let g=0,m=o.length;g<m;++g){const _=o[g],p=f[_];if(p!==void 0){const y=a===null?void 0:p.getZIndexContext(),w=y?y.getContext():t,x=this.maxExtent_&&_!=="Image"&&_!=="Text";if(x&&(w.save(),this.clip(w,i)),!y||_==="Text"||_==="Image"?p.execute(w,e,i,s,r,a):y.pushFunction(E=>p.execute(E,e,i,s,r,a)),x&&w.restore(),y){y.offset();const E=l[c]*h+Oi.indexOf(_);this.deferredZIndexContexts_[E]||(this.deferredZIndexContexts_[E]=[]),this.deferredZIndexContexts_[E].push(y)}}}}this.renderedContext_=t}getDeferredZIndexContexts(){return this.deferredZIndexContexts_}getRenderedContext(){return this.renderedContext_}renderDeferred(){const t=this.deferredZIndexContexts_,e=Object.keys(t).map(Number).sort(Me);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 Uo={};function d_(n){if(Uo[n]!==void 0)return Uo[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 Uo[n]=s,s}function uc(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 hn extends pr{constructor(t){t=t||{};const e=t.opacity!==void 0?t.opacity:1,i=t.rotation!==void 0?t.rotation:0,s=t.scale!==void 0?t.scale:1,r=t.rotateWithView!==void 0?t.rotateWithView:!1;super({opacity:e,rotation:i,scale:s,displacement:t.displacement!==void 0?t.displacement:[0,0],rotateWithView:r,declutterMode:t.declutterMode}),this.anchor_=t.anchor!==void 0?t.anchor:[.5,.5],this.normalizedAnchor_=null,this.anchorOrigin_=t.anchorOrigin!==void 0?t.anchorOrigin:"top-left",this.anchorXUnits_=t.anchorXUnits!==void 0?t.anchorXUnits:"fraction",this.anchorYUnits_=t.anchorYUnits!==void 0?t.anchorYUnits:"fraction",this.crossOrigin_=t.crossOrigin!==void 0?t.crossOrigin:null;const o=t.img!==void 0?t.img:null;let a=t.src;Q(!(a!==void 0&&o),"`image` and `src` cannot be provided at the same time"),(a===void 0||a.length===0)&&o&&(a=o.src||j(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=Y.IDLE:o!==void 0&&("complete"in o?o.complete?l=o.src?Y.LOADED:Y.IDLE:l=Y.LOADING:l=Y.LOADED),this.color_=t.color!==void 0?en(t.color):null,this.iconImage_=ur(o,a,this.crossOrigin_,l,this.color_),this.offset_=t.offset!==void 0?t.offset:[0,0],this.offsetOrigin_=t.offsetOrigin!==void 0?t.offsetOrigin:"top-left",this.origin_=null,this.size_=t.size!==void 0?t.size:null,this.initialOptions_,t.width!==void 0||t.height!==void 0){let h,c;if(t.size)[h,c]=t.size;else{const u=this.getImage(1);if(u.width&&u.height)h=u.width,c=u.height;else if(u instanceof HTMLImageElement){this.initialOptions_=t;const d=()=>{if(this.unlistenImageChange(d),!this.initialOptions_)return;const f=this.iconImage_.getSize();this.setScale(uc(f[0],f[1],t.width,t.height))};this.listenImageChange(d);return}}h!==void 0&&this.setScale(uc(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 hn({anchor:this.anchor_.slice(),anchorOrigin:this.anchorOrigin_,anchorXUnits:this.anchorXUnits_,anchorYUnits:this.anchorYUnits_,color:this.color_&&this.color_.slice?this.color_.slice():this.color_||void 0,crossOrigin:this.crossOrigin_,offset:this.offset_.slice(),offsetOrigin:this.offsetOrigin_,opacity:this.getOpacity(),rotateWithView:this.getRotateWithView(),rotation:this.getRotation(),scale:t,width:e,height:i,size:this.size_!==null?this.size_.slice():void 0,src:this.getSrc(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()})}getAnchor(){let t=this.normalizedAnchor_;if(!t){t=this.anchor_;const s=this.getSize();if(this.anchorXUnits_=="fraction"||this.anchorYUnits_=="fraction"){if(!s)return null;t=this.anchor_.slice(),this.anchorXUnits_=="fraction"&&(t[0]*=s[0]),this.anchorYUnits_=="fraction"&&(t[1]*=s[1])}if(this.anchorOrigin_!="top-left"){if(!s)return null;t===this.anchor_&&(t=this.anchor_.slice()),(this.anchorOrigin_=="top-right"||this.anchorOrigin_=="bottom-right")&&(t[0]=-t[0]+s[0]),(this.anchorOrigin_=="bottom-left"||this.anchorOrigin_=="bottom-right")&&(t[1]=-t[1]+s[1])}this.normalizedAnchor_=t}const e=this.getDisplacement(),i=this.getScaleArray();return[t[0]-e[0]/i[0],t[1]+e[1]/i[1]]}setAnchor(t){this.anchor_=t,this.normalizedAnchor_=null}getColor(){return this.color_}getImage(t){return this.iconImage_.getImage(t)}getPixelRatio(t){return this.iconImage_.getPixelRatio(t)}getImageSize(){return this.iconImage_.getSize()}getImageState(){return this.iconImage_.getImageState()}getHitDetectionImage(){return this.iconImage_.getHitDetectionImage()}getOrigin(){if(this.origin_)return this.origin_;let t=this.offset_;if(this.offsetOrigin_!="top-left"){const e=this.getSize(),i=this.iconImage_.getSize();if(!e||!i)return null;t=t.slice(),(this.offsetOrigin_=="top-right"||this.offsetOrigin_=="bottom-right")&&(t[0]=i[0]-e[0]-t[0]),(this.offsetOrigin_=="bottom-left"||this.offsetOrigin_=="bottom-right")&&(t[1]=i[1]-e[1]-t[1])}return this.origin_=t,this.origin_}getSrc(){return this.iconImage_.getSrc()}setSrc(t){this.iconImage_=ur(null,t,this.crossOrigin_,Y.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()==Y.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()==Y.LOADED)return this.iconImage_.getSize()[1]*t[1]}setScale(t){delete this.initialOptions_,super.setScale(t)}listenImageChange(t){this.iconImage_.addEventListener(W.CHANGE,t)}load(){this.iconImage_.load()}unlistenImageChange(t){this.iconImage_.removeEventListener(W.CHANGE,t)}ready(){return this.iconImage_.ready()}}const ve=.5;function f_(n,t,e,i,s,r,o,a,l){const h=s,c=n[0]*ve,u=n[1]*ve,d=ct(c,u);d.imageSmoothingEnabled=!1;const f=d.canvas,g=new Sg(d,ve,s,null,o,a,null),m=e.length,_=Math.floor((256*256*256-1)/m),p={};for(let w=1;w<=m;++w){const x=e[w-1],E=x.getStyleFunction()||i;if(!E)continue;let T=E(x,r);if(!T)continue;Array.isArray(T)||(T=[T]);const v=(w*_).toString(16).padStart(7,"#00000");for(let R=0,b=T.length;R<b;++R){const O=T[R],F=O.getGeometryFunction()(x);if(!F||!Ft(h,F.getExtent()))continue;const A=O.clone(),L=A.getFill();L&&L.setColor(v);const M=A.getStroke();M&&(M.setColor(v),M.setLineDash(null)),A.setText(void 0);const P=O.getImage();if(P){const K=P.getImageSize();if(!K)continue;const H=ct(K[0],K[1],void 0,{alpha:!1}),S=H.canvas;H.fillStyle=v,H.fillRect(0,0,S.width,S.height),A.setImage(new hn({img:S,anchor:P.getAnchor(),anchorXUnits:"pixels",anchorYUnits:"pixels",offset:P.getOrigin(),opacity:1,size:P.getSize(),scale:P.getScale(),rotation:P.getRotation(),rotateWithView:P.getRotateWithView()}))}const X=A.getZIndex()||0;let D=p[X];D||(D={},p[X]=D,D.Polygon=[],D.Circle=[],D.LineString=[],D.Point=[]);const k=F.getType();if(k==="GeometryCollection"){const K=F.getGeometriesArrayRecursive();for(let H=0,S=K.length;H<S;++H){const _t=K[H];D[_t.getType().replace("Multi","")].push(_t,A)}}else D[k.replace("Multi","")].push(F,A)}}const y=Object.keys(p).map(Number).sort(Me);for(let w=0,x=y.length;w<x;++w){const E=p[y[w]];for(const T in E){const I=E[T];for(let v=0,R=I.length;v<R;v+=2){g.setStyle(I[v+1]);for(let b=0,O=t.length;b<O;++b)g.setTransform(t[b]),g.drawGeometry(I[v])}}}return d.getImageData(0,0,f.width,f.height)}function g_(n,t,e){const i=[];if(e){const s=Math.floor(Math.round(n[0])*ve),r=Math.floor(Math.round(n[1])*ve),o=(ot(s,0,e.width-1)+ot(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 dc extends Pe{constructor(t,e,i,s){super(t),this.inversePixelTransform=e,this.frameState=i,this.context=s}}const __=5;class m_ extends Nn{constructor(t){super(),this.ready=!0,this.boundHandleImageChange_=this.handleImageChange_.bind(this),this.layer_=t,this.staleKeys_=new Array,this.maxStaleKeys=__}getStaleKeys(){return this.staleKeys_}prependStaleKey(t){this.staleKeys_.unshift(t),this.staleKeys_.length>this.maxStaleKeys&&(this.staleKeys_.length=this.maxStaleKeys)}getFeatures(t){return V()}getData(t){return null}prepareFrame(t){return V()}renderFrame(t,e){return V()}forEachFeatureAtCoordinate(t,e,i,s,r){}getLayer(){return this.layer_}handleFontsChanged(){}handleImageChange_(t){const e=t.target;(e.getState()===Y.LOADED||e.getState()===Y.ERROR)&&this.renderIfReadyAndVisible()}loadImage(t){let e=t.getState();return e!=Y.LOADED&&e!=Y.ERROR&&t.addEventListener(W.CHANGE,this.boundHandleImageChange_),e==Y.IDLE&&(t.load(),e=t.getState()),e==Y.LOADED}renderIfReadyAndVisible(){const t=this.getLayer();t&&t.getVisible()&&t.getSourceState()==="ready"&&t.changed()}renderDeferred(t){}disposeInternal(){delete this.layer_,super.disposeInternal()}}const fc=[];let cn=null;function p_(){cn=ct(1,1,void 0,{willReadFrequently:!0})}class gc extends m_{constructor(t){super(t),this.container=null,this.renderedResolution,this.tempTransform=de(),this.pixelTransform=de(),this.inversePixelTransform=de(),this.context=null,this.deferredContext_=null,this.containerReused=!1,this.frameState=null}getImageData(t,e,i){cn||p_(),cn.clearRect(0,0,1,1);let s;try{cn.drawImage(t,e,i,1,1,0,0,1,1),s=cn.getImageData(0,0,1,1).data}catch{return cn=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&&ti(en(t.style.backgroundColor),en(i)))){const a=t.firstElementChild;ri(a)&&(o=a.getContext("2d"))}if(o&&Mf(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=Kt?Ah():document.createElement("div"),r.className=s;let a=r.style;a.position="absolute",a.width="100%",a.height="100%",o=ct();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=Ri(i),r=Us(i),o=Zs(i),a=Bs(i);gt(e.coordinateToPixelTransform,s),gt(e.coordinateToPixelTransform,r),gt(e.coordinateToPixelTransform,o),gt(e.coordinateToPixelTransform,a);const l=this.inversePixelTransform;gt(l,s),gt(l,r),gt(l,o),gt(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(tt(i)/s*o),l=Math.round(Lt(i)/s*o);De(this.pixelTransform,t.size[0]/2,t.size[1]/2,1/o,1/o,r,-a/2,-l/2),lh(this.inversePixelTransform,this.pixelTransform);const h=Af(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 dc(t,this.inversePixelTransform,i,e);s.dispatchEvent(r)}}preRender(t,e){this.frameState=e,!e.declutter&&this.dispatchRenderEvent_(ee.PRERENDER,t,e)}postRender(t,e){e.declutter||this.dispatchRenderEvent_(ee.POSTRENDER,t,e)}renderDeferredInternal(t){}getRenderContext(t){return t.declutter&&!this.deferredContext_&&(this.deferredContext_=new ac),t.declutter?this.deferredContext_.getContext():this.context}renderDeferred(t){t.declutter&&(this.dispatchRenderEvent_(ee.PRERENDER,this.context,t),t.declutter&&this.deferredContext_&&(this.deferredContext_.draw(this.context),this.deferredContext_.clear()),this.renderDeferredInternal(t),this.dispatchRenderEvent_(ee.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 De(this.tempTransform,l,h,c,u,-i,d,f)}disposeInternal(){delete this.frameState,super.disposeInternal()}}class y_ extends gc{constructor(t){super(t),this.boundHandleStyleImageChange_=this.handleStyleImageChange_.bind(this),this.animatingOrInteracting_,this.hitDetectionImageData_=null,this.clipped_=!1,this.renderedFeatures_=null,this.renderedRevision_=-1,this.renderedResolution_=NaN,this.renderedExtent_=$t(),this.wrappedRenderedExtent_=$t(),this.renderedRotation_,this.renderedCenter_=null,this.renderedProjection_=null,this.renderedPixelRatio_=1,this.renderedRenderOrder_=null,this.renderedFrameDeclutter_,this.replayGroup_=null,this.replayGroupChanged=!0,this.clipping=!0,this.targetContext_=null,this.opacity_=1}renderWorlds(t,e,i){const s=e.extent,r=e.viewState,o=r.center,a=r.resolution,l=r.projection,h=r.rotation,c=l.getExtent(),u=this.getLayer().getSource(),d=this.getLayer().getDeclutter(),f=e.pixelRatio,g=e.viewHints,m=!(g[vt.ANIMATING]||g[vt.INTERACTING]),_=this.context,p=Math.round(tt(s)/a*f),y=Math.round(Lt(s)/a*f),w=u.getWrapX()&&l.canWrapX(),x=w?tt(c):null,E=w?Math.ceil((s[2]-c[2])/x)+1:1;let T=w?Math.floor((s[0]-c[0])/x):0;do{let I=this.getRenderTransform(o,a,0,f,p,y,T*x);e.declutter&&(I=I.slice(0)),t.execute(_,[_.canvas.width,_.canvas.height],I,h,m,i===void 0?Oi:i?cc:c_,i?d&&e.declutter[d]:void 0)}while(++T<E)}setDrawContext_(){this.opacity_!==1&&(this.targetContext_=this.context,this.context=ct(this.context.canvas.width,this.context.canvas.height,fc))}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,hr(this.context),fc.push(this.context.canvas),this.context=this.targetContext_,this.targetContext_=null}}renderDeclutter(t){!this.replayGroup_||!this.getLayer().getDeclutter()||this.renderWorlds(this.replayGroup_,t,!0)}renderDeferredInternal(t){this.replayGroup_&&(this.replayGroup_.renderDeferred(),this.clipped_&&this.context.restore(),this.resetDrawContext_())}renderFrame(t,e){const i=t.layerStatesArray[t.layerIndex];this.opacity_=i.opacity;const s=t.viewState;this.prepareContainer(t,e);const r=this.context,o=this.replayGroup_;let a=o&&!o.isEmpty();if(!a&&!(this.getLayer().hasListener(ee.PRERENDER)||this.getLayer().hasListener(ee.POSTRENDER)))return this.container;if(this.setDrawContext_(),this.preRender(r,t),s.projection,this.clipped_=!1,a&&i.extent&&this.clipping){const l=ni(i.extent);a=Ft(l,t.extent),this.clipped_=a&&!Ui(l,t.extent),this.clipped_&&this.clipUnrotated(r,t,l)}return a&&this.renderWorlds(o,t,this.getLayer().getDeclutter()?!1:void 0),!t.declutter&&this.clipped_&&r.restore(),this.postRender(r,t),this.renderedRotation_!==s.rotation&&(this.renderedRotation_=s.rotation,this.hitDetectionImageData_=null),t.declutter||this.resetDrawContext_(),this.container}getFeatures(t){return new Promise(e=>{if(this.frameState&&!this.hitDetectionImageData_&&!this.animatingOrInteracting_){const i=this.frameState.size.slice(),s=this.renderedCenter_,r=this.renderedResolution_,o=this.renderedRotation_,a=this.renderedProjection_,l=this.wrappedRenderedExtent_,h=this.getLayer(),c=[],u=i[0]*ve,d=i[1]*ve;c.push(this.getRenderTransform(s,r,o,ve,u,d,0).slice());const f=h.getSource(),g=a.getExtent();if(f.getWrapX()&&a.canWrapX()&&!Ui(g,l)){let m=l[0];const _=tt(g);let p=0,y;for(;m<g[0];)--p,y=_*p,c.push(this.getRenderTransform(s,r,o,ve,u,d,y).slice()),m+=_;for(p=0,m=l[2];m>g[2];)++p,y=_*p,c.push(this.getRenderTransform(s,r,o,ve,u,d,y).slice()),m-=_}this.hitDetectionImageData_=f_(i,c,this.renderedFeatures_,h.getStyleFunction(),l,r,o,$h(r,this.renderedPixelRatio_))}e(g_(t,this.renderedFeatures_,this.hitDetectionImageData_))})}forEachFeatureAtCoordinate(t,e,i,s,r){if(!this.replayGroup_)return;const o=e.viewState.resolution,a=e.viewState.rotation,l=this.getLayer(),h={},c=function(d,f,g){const m=j(d),_=h[m];if(_){if(_!==!0&&g<_.distanceSq){if(g===0)return h[m]=!0,r.splice(r.lastIndexOf(_),1),s(d,l,f);_.geometry=f,_.distanceSq=g}}else{if(g===0)return h[m]=!0,s(d,l,f);r.push(h[m]={feature:d,layer:l,geometry:f,distanceSq:g,callback:s})}},u=this.getLayer().getDeclutter();return this.replayGroup_.forEachFeatureAtCoordinate(t,o,a,i,c,u?e.declutter?.[u]?.all().map(d=>d.value):null)}handleFontsChanged(){const t=this.getLayer();t.getVisible()&&this.replayGroup_&&t.changed()}handleStyleImageChange_(t){this.renderIfReadyAndVisible()}prepareFrame(t){const e=this.getLayer(),i=e.getSource();if(!i)return!1;const s=t.viewHints[vt.ANIMATING],r=t.viewHints[vt.INTERACTING],o=e.getUpdateWhileAnimating(),a=e.getUpdateWhileInteracting();if(this.ready&&!o&&s||!a&&r)return this.animatingOrInteracting_=!0,!0;this.animatingOrInteracting_=!1;const l=t.extent,h=t.viewState,c=h.projection,u=h.resolution,d=t.pixelRatio,f=e.getRevision(),g=e.getRenderBuffer();let m=e.getRenderOrder();m===void 0&&(m=Lg);const _=h.center.slice(),p=eo(l,g*u),y=p.slice(),w=[p.slice()],x=c.getExtent();if(i.getWrapX()&&c.canWrapX()&&!Ui(x,t.extent)){const L=tt(x),M=Math.max(tt(p)/2,L);p[0]=x[0]-M,p[2]=x[2]+M,Bl(_,c);const P=Xl(w[0],c);P[0]<x[0]&&P[2]<x[2]?w.push([P[0]+L,P[1],P[2]+L,P[3]]):P[0]>x[0]&&P[2]>x[2]&&w.push([P[0]-L,P[1],P[2]-L,P[3]])}if(this.ready&&this.renderedResolution_==u&&this.renderedRevision_==f&&this.renderedRenderOrder_==m&&this.renderedFrameDeclutter_===!!t.declutter&&Ui(this.wrappedRenderedExtent_,p))return ti(this.renderedExtent_,y)||(this.hitDetectionImageData_=null,this.renderedExtent_=y),this.renderedCenter_=_,this.replayGroupChanged=!1,!0;this.replayGroup_=null;const E=new r_(Kh(u,d),p,u,d);let T;for(let L=0,M=w.length;L<M;++L)i.loadFeatures(w[L],u,c);const I=$h(u,d);let v=!0;const R=(L,M)=>{let P;const X=L.getStyleFunction()||e.getStyleFunction();if(X&&(P=X(L,u)),P){const D=this.renderFeature(L,I,P,E,T,this.getLayer().getDeclutter(),M);v=v&&!D}},b=ah(p),O=i.getFeaturesInExtent(b);m&&O.sort(m);for(let L=0,M=O.length;L<M;++L)R(O[L],L);this.renderedFeatures_=O,this.ready=v;const F=E.finish(),A=new u_(p,u,d,i.getOverlaps(),F,e.getRenderBuffer(),!!t.declutter);return this.renderedResolution_=u,this.renderedRevision_=f,this.renderedRenderOrder_=m,this.renderedFrameDeclutter_=!!t.declutter,this.renderedExtent_=y,this.wrappedRenderedExtent_=p,this.renderedCenter_=_,this.renderedProjection_=c,this.renderedPixelRatio_=d,this.replayGroup_=A,this.hitDetectionImageData_=null,this.replayGroupChanged=!0,!0}renderFeature(t,e,i,s,r,o,a){if(!i)return!1;let l=!1;if(Array.isArray(i))for(let h=0,c=i.length;h<c;++h)l=Bh(s,t,i[h],e,this.boundHandleStyleImageChange_,r,o,a)||l;else l=Bh(s,t,i,e,this.boundHandleStyleImageChange_,r,o,a);return l}}let Di=0;const At=1<<Di++,B=1<<Di++,zt=1<<Di++,ge=1<<Di++,Fi=1<<Di++,ss=1<<Di++,wr=Math.pow(2,Di)-1,Vo={[At]:"boolean",[B]:"number",[zt]:"string",[ge]:"color",[Fi]:"number[]",[ss]:"size"},x_=Object.keys(Vo).map(Number).sort(Me);function E_(n){return n in Vo}function rs(n){const t=[];for(const e of x_)os(n,e)&&t.push(Vo[e]);return t.length===0?"untyped":t.length<3?t.join(" or "):t.slice(0,-1).join(", ")+", or "+t[t.length-1]}function os(n,t){return(n&t)===t}function ci(n,t){return n===t}class ut{constructor(t,e){if(!E_(t))throw new Error(`literal expressions must have a specific type, got ${rs(t)}`);this.type=t,this.value=e}}class v_{constructor(t,e,...i){this.type=t,this.operator=e,this.args=i}}function _c(){return{variables:new Set,properties:new Set,featureId:!1,geometryType:!1,mapState:!1}}function xt(n,t,e){switch(typeof n){case"boolean":{if(ci(t,zt))return new ut(zt,n?"true":"false");if(!os(t,At))throw new Error(`got a boolean, but expected ${rs(t)}`);return new ut(At,n)}case"number":{if(ci(t,ss))return new ut(ss,Gt(n));if(ci(t,At))return new ut(At,!!n);if(ci(t,zt))return new ut(zt,n.toString());if(!os(t,B))throw new Error(`got a number, but expected ${rs(t)}`);return new ut(B,n)}case"string":{if(ci(t,ge))return new ut(ge,ko(n));if(ci(t,At))return new ut(At,!!n);if(!os(t,zt))throw new Error(`got a string, but expected ${rs(t)}`);return new ut(zt,n)}}if(!Array.isArray(n))throw new Error("expression must be an array or a primitive value");if(n.length===0)throw new Error("empty expression");if(typeof n[0]=="string")return P_(n,t,e);for(const i of n)if(typeof i!="number")throw new Error("expected an array of numbers");if(ci(t,ss)){if(n.length!==2)throw new Error(`expected an array of two values for a size, got ${n.length}`);return new ut(ss,n)}if(ci(t,ge)){if(n.length===3)return new ut(ge,[...n,1]);if(n.length===4)return new ut(ge,n);throw new Error(`expected an array of 3 or 4 values for a color, got ${n.length}`)}if(!os(t,Fi))throw new Error(`got an array of numbers, but expected ${rs(t)}`);return new ut(Fi,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"},w_={[C.Get]:z($(1,1/0),mc),[C.Var]:z($(1,1),C_),[C.Has]:z($(1,1/0),mc),[C.Id]:z(R_,un),[C.Concat]:z($(2,1/0),J(zt)),[C.GeometryType]:z(T_,un),[C.LineMetric]:z(un),[C.Resolution]:z(jo,un),[C.Zoom]:z(jo,un),[C.Time]:z(jo,un),[C.Any]:z($(2,1/0),J(At)),[C.All]:z($(2,1/0),J(At)),[C.Not]:z($(1,1),J(At)),[C.Equal]:z($(2,2),J(wr)),[C.NotEqual]:z($(2,2),J(wr)),[C.GreaterThan]:z($(2,2),J(B)),[C.GreaterThanOrEqualTo]:z($(2,2),J(B)),[C.LessThan]:z($(2,2),J(B)),[C.LessThanOrEqualTo]:z($(2,2),J(B)),[C.Multiply]:z($(2,1/0),pc),[C.Coalesce]:z($(2,1/0),pc),[C.Divide]:z($(2,2),J(B)),[C.Add]:z($(2,1/0),J(B)),[C.Subtract]:z($(2,2),J(B)),[C.Clamp]:z($(3,3),J(B)),[C.Mod]:z($(2,2),J(B)),[C.Pow]:z($(2,2),J(B)),[C.Abs]:z($(1,1),J(B)),[C.Floor]:z($(1,1),J(B)),[C.Ceil]:z($(1,1),J(B)),[C.Round]:z($(1,1),J(B)),[C.Sin]:z($(1,1),J(B)),[C.Cos]:z($(1,1),J(B)),[C.Atan]:z($(1,2),J(B)),[C.Sqrt]:z($(1,1),J(B)),[C.Match]:z($(4,1/0),yc,S_),[C.Between]:z($(3,3),J(B)),[C.Interpolate]:z($(6,1/0),yc,b_),[C.Case]:z($(3,1/0),I_,L_),[C.In]:z($(2,2),A_),[C.Number]:z($(1,1/0),J(wr)),[C.String]:z($(1,1/0),J(wr)),[C.Array]:z($(1,1/0),J(B)),[C.Color]:z($(1,4),J(B)),[C.Band]:z($(1,3),J(B)),[C.Palette]:z($(2,2),M_),[C.ToString]:z($(1,1),J(At|B|zt|ge))};function mc(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 ut(B,o);break}case"string":{s[r]=new ut(zt,o);break}default:throw new Error(`expected a string key or numeric array index for a get operation, got ${o}`)}r===0&&e.properties.add(String(o))}return s}function C_(n,t,e){const i=n[1];if(typeof i!="string")throw new Error("expected a string argument for var operation");return e.variables.add(i),[new ut(zt,i)]}function R_(n,t,e){e.featureId=!0}function T_(n,t,e){e.geometryType=!0}function jo(n,t,e){e.mapState=!0}function un(n,t,e){const i=n[0];if(n.length!==1)throw new Error(`expected no arguments for ${i} operation`);return[]}function $(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 pc(n,t,e){const i=n.length-1,s=new Array(i);for(let r=0;r<i;++r){const o=xt(n[r+1],t,e);s[r]=o}return s}function J(n){return function(t,e,i){const s=t.length-1,r=new Array(s);for(let o=0;o<s;++o){const a=xt(t[o+1],n,i);r[o]=a}return r}}function I_(n,t,e){const i=n[0],s=n.length-1;if(s%2===0)throw new Error(`expected an odd number of arguments for ${i}, got ${s} instead`)}function yc(n,t,e){const i=n[0],s=n.length-1;if(s%2===1)throw new Error(`expected an even number of arguments for operation ${i}, got ${s} instead`)}function S_(n,t,e){const i=n.length-1,s=zt|B|At,r=xt(n[1],s,e),o=xt(n[n.length-1],t,e),a=new Array(i-2);for(let l=0;l<i-2;l+=2){try{const h=xt(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=xt(n[l+3],o.type,e);a[l+1]=h}catch(h){throw new Error(`failed to parse argument ${l+2} of match expression: ${h.message}`)}}return[r,...a,o]}function b_(n,t,e){const i=n[1];let s;switch(i[0]){case"linear":s=1;break;case"exponential":const l=i[1];if(typeof l!="number"||l<=0)throw new Error(`expected a number base for exponential interpolation, got ${JSON.stringify(l)} instead`);s=l;break;default:throw new Error(`invalid interpolation type: ${JSON.stringify(i)}`)}const r=new ut(B,s);let o;try{o=xt(n[2],B,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=xt(n[l+3],B,e);a[l]=h}catch(h){throw new Error(`failed to parse argument ${l+2} for interpolate expression: ${h.message}`)}try{const h=xt(n[l+4],t,e);a[l+1]=h}catch(h){throw new Error(`failed to parse argument ${l+3} for interpolate expression: ${h.message}`)}}return[r,o,...a]}function L_(n,t,e){const i=xt(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=xt(n[r+1],At,e);s[r]=o}catch(o){throw new Error(`failed to parse argument ${r} of case expression: ${o.message}`)}try{const o=xt(n[r+2],i.type,e);s[r+1]=o}catch(o){throw new Error(`failed to parse argument ${r+1} of case expression: ${o.message}`)}}return s[s.length-1]=i,s}function A_(n,t,e){let i=n[2];if(!Array.isArray(i))throw new Error('the second argument for the "in" operator must be an array');let s;if(typeof i[0]=="string"){if(i[0]!=="literal")throw new Error('for the "in" operator, a string array should be wrapped in a "literal" operator to disambiguate from expressions');if(!Array.isArray(i[1]))throw new Error('failed to parse "in" expression: the literal operator must be followed by an array');i=i[1],s=zt}else s=B;const r=new Array(i.length);for(let a=0;a<r.length;a++)try{const l=xt(i[a],s,e);r[a]=l}catch(l){throw new Error(`failed to parse haystack item ${a} for "in" expression: ${l.message}`)}return[xt(n[1],s,e),...r]}function M_(n,t,e){let i;try{i=xt(n[1],B,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=xt(s[o],ge,e)}catch(l){throw new Error(`failed to parse color at index ${o} in palette expression: ${l.message}`)}if(!(a instanceof ut))throw new Error(`the palette color at index ${o} must be a literal value`);r[o]=a}return[i,...r]}function z(...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 v_(e,s,...r)}}function P_(n,t,e){const i=n[0],s=w_[i];if(!s)throw new Error(`unknown operator: ${i}`);return s(n,t,e)}function xc(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 xc(n.getGeometries()[0]);default:return""}}function Ec(){return{variables:{},properties:{},resolution:NaN,featureId:null,geometryType:""}}function ze(n,t,e){const i=xt(n,t,e);return _e(i)}function _e(n,t){if(n instanceof ut){if(n.type===ge&&typeof n.value=="string"){const i=ko(n.value);return function(){return i}}return function(){return n.value}}const e=n.operator;switch(e){case C.Number:case C.String:case C.Coalesce:return O_(n);case C.Get:case C.Var:case C.Has:return D_(n);case C.Id:return i=>i.featureId;case C.GeometryType:return i=>i.geometryType;case C.Concat:{const i=n.args.map(s=>_e(s));return s=>"".concat(...i.map(r=>r(s).toString()))}case C.Resolution:return i=>i.resolution;case C.Any:case C.All:case C.Between:case C.In:case C.Not:return k_(n);case C.Equal:case C.NotEqual:case C.LessThan:case C.LessThanOrEqualTo:case C.GreaterThan:case C.GreaterThanOrEqualTo:return F_(n);case C.Multiply:case C.Divide:case C.Add:case C.Subtract:case C.Clamp:case C.Mod:case C.Pow:case C.Abs:case C.Floor:case C.Ceil:case C.Round:case C.Sin:case C.Cos:case C.Atan:case C.Sqrt:return N_(n);case C.Case:return G_(n);case C.Match:return z_(n);case C.Interpolate:return X_(n);case C.ToString:return W_(n);default:throw new Error(`Unsupported operator ${e}`)}}function O_(n,t){const e=n.operator,i=n.args.length,s=new Array(i);for(let r=0;r<i;++r)s[r]=_e(n.args[r]);switch(e){case C.Coalesce:return r=>{for(let o=0;o<i;++o){const a=s[o](r);if(typeof a<"u"&&a!==null)return a}throw new Error("Expected one of the values to be non-null")};case C.Number:case C.String:return r=>{for(let o=0;o<i;++o){const a=s[o](r);if(typeof a===e)return a}throw new Error(`Expected one of the values to be a ${e}`)};default:throw new Error(`Unsupported assertion operator ${e}`)}}function D_(n,t){const i=n.args[0].value;switch(n.operator){case C.Get:return s=>{const r=n.args;let o=s.properties[i];for(let a=1,l=r.length;a<l;++a){const c=r[a].value;o=o[c]}return o};case C.Var:return s=>s.variables[i];case C.Has:return s=>{const r=n.args;if(!(i in s.properties))return!1;let o=s.properties[i];for(let a=1,l=r.length;a<l;++a){const c=r[a].value;if(!o||!Object.hasOwn(o,c))return!1;o=o[c]}return!0};default:throw new Error(`Unsupported accessor operator ${n.operator}`)}}function F_(n,t){const e=n.operator,i=_e(n.args[0]),s=_e(n.args[1]);switch(e){case C.Equal:return r=>i(r)===s(r);case C.NotEqual:return r=>i(r)!==s(r);case C.LessThan:return r=>i(r)<s(r);case C.LessThanOrEqualTo:return r=>i(r)<=s(r);case C.GreaterThan:return r=>i(r)>s(r);case C.GreaterThanOrEqualTo:return r=>i(r)>=s(r);default:throw new Error(`Unsupported comparison operator ${e}`)}}function k_(n,t){const e=n.operator,i=n.args.length,s=new Array(i);for(let r=0;r<i;++r)s[r]=_e(n.args[r]);switch(e){case C.Any:return r=>{for(let o=0;o<i;++o)if(s[o](r))return!0;return!1};case C.All:return r=>{for(let o=0;o<i;++o)if(!s[o](r))return!1;return!0};case C.Between:return r=>{const o=s[0](r),a=s[1](r),l=s[2](r);return o>=a&&o<=l};case C.In:return r=>{const o=s[0](r);for(let a=1;a<i;++a)if(o===s[a](r))return!0;return!1};case C.Not:return r=>!s[0](r);default:throw new Error(`Unsupported logical operator ${e}`)}}function N_(n,t){const e=n.operator,i=n.args.length,s=new Array(i);for(let r=0;r<i;++r)s[r]=_e(n.args[r]);switch(e){case C.Multiply:return r=>{let o=1;for(let a=0;a<i;++a)o*=s[a](r);return o};case C.Divide:return r=>s[0](r)/s[1](r);case C.Add:return r=>{let o=0;for(let a=0;a<i;++a)o+=s[a](r);return o};case C.Subtract:return r=>s[0](r)-s[1](r);case C.Clamp:return r=>{const o=s[0](r),a=s[1](r);if(o<a)return a;const l=s[2](r);return o>l?l:o};case C.Mod:return r=>s[0](r)%s[1](r);case C.Pow:return r=>Math.pow(s[0](r),s[1](r));case C.Abs:return r=>Math.abs(s[0](r));case C.Floor:return r=>Math.floor(s[0](r));case C.Ceil:return r=>Math.ceil(s[0](r));case C.Round:return r=>Math.round(s[0](r));case C.Sin:return r=>Math.sin(s[0](r));case C.Cos:return r=>Math.cos(s[0](r));case C.Atan:return i===2?r=>Math.atan2(s[0](r),s[1](r)):r=>Math.atan(s[0](r));case C.Sqrt:return r=>Math.sqrt(s[0](r));default:throw new Error(`Unsupported numeric operator ${e}`)}}function G_(n,t){const e=n.args.length,i=new Array(e);for(let s=0;s<e;++s)i[s]=_e(n.args[s]);return s=>{for(let r=0;r<e-1;r+=2)if(i[r](s))return i[r+1](s);return i[e-1](s)}}function z_(n,t){const e=n.args.length,i=new Array(e);for(let s=0;s<e;++s)i[s]=_e(n.args[s]);return s=>{const r=i[0](s);for(let o=1;o<e-1;o+=2)if(r===i[o](s))return i[o+1](s);return i[e-1](s)}}function X_(n,t){const e=n.args.length,i=new Array(e);for(let s=0;s<e;++s)i[s]=_e(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=ug(u)),c>=o)return h===2?u:d?Y_(r,o,a,l,c,u):as(r,o,a,l,c,u);a=c,l=u}return l}}function W_(n,t){const e=n.operator,i=n.args.length,s=new Array(i);for(let r=0;r<i;++r)s[r]=_e(n.args[r]);switch(e){case C.ToString:return r=>{const o=s[0](r);return n.args[0].type===ge?No(o):o.toString()};default:throw new Error(`Unsupported convert operator ${e}`)}}function as(n,t,e,i,s,r){const o=s-e;if(o===0)return i;const a=t-e,l=n===1?a/o:(Math.pow(n,a)-1)/(Math.pow(n,o)-1);return i+l*(r-i)}function Y_(n,t,e,i,s,r){if(s-e===0)return i;const a=Ph(i),l=Ph(r);let h=l[2]-a[2];h>180?h-=360:h<-180&&(h+=360);const c=[as(n,t,e,a[0],s,l[0]),as(n,t,e,a[1],s,l[1]),a[2]+as(n,t,e,0,s,h),as(n,t,e,i[3],s,r[3])];return dg(c)}function $_(n){return!0}function K_(n){const t=_c(),e=B_(n,t),i=Ec();return function(s,r){if(i.properties=s.getPropertiesInternal(),i.resolution=r,t.featureId){const o=s.getId();o!==void 0?i.featureId=o:i.featureId=null}return t.geometryType&&(i.geometryType=xc(s.getGeometry())),e(i)}}function vc(n){const t=_c(),e=n.length,i=new Array(e);for(let o=0;o<e;++o)i[o]=Ho(n[o],t);const s=Ec(),r=new Array(e);return function(o,a){if(s.properties=o.getPropertiesInternal(),s.resolution=a,t.featureId){const h=o.getId();h!==void 0?s.featureId=h:s.featureId=null}let l=0;for(let h=0;h<e;++h){const c=i[h](s);c&&(r[l]=c,l+=1)}return r.length=l,r}}function B_(n,t){const e=n.length,i=new Array(e);for(let s=0;s<e;++s){const r=n[s],o="filter"in r?ze(r.filter,At,t):$_;let a;if(Array.isArray(r.style)){const l=r.style.length;a=new Array(l);for(let h=0;h<l;++h)a[h]=Ho(r.style[h],t)}else a=[Ho(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 Ho(n,t){const e=ls(n,"",t),i=hs(n,"",t),s=Z_(n,t),r=U_(n,t),o=Xt(n,"z-index",t);if(!e&&!i&&!s&&!r&&!Bi(n))throw new Error("No fill, stroke, point, or text symbolizer properties in style: "+JSON.stringify(n));const a=new Ee;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 ls(n,t,e){let i;if(t+"fill-pattern-src"in n)i=q_(n,t+"fill-",e);else{if(n[t+"fill-color"]==="none")return r=>null;i=qo(n,t+"fill-color",e)}if(!i)return null;const s=new Mi;return function(r){const o=i(r);return o===Lo?null:(s.setColor(o),s)}}function hs(n,t,e){const i=Xt(n,t+"stroke-width",e),s=qo(n,t+"stroke-color",e);if(!i&&!s)return null;const r=Xe(n,t+"stroke-line-cap",e),o=Xe(n,t+"stroke-line-join",e),a=wc(n,t+"stroke-line-dash",e),l=Xt(n,t+"stroke-line-dash-offset",e),h=Xt(n,t+"stroke-miter-limit",e),c=new is;return function(u){if(s){const d=s(u);if(d===Lo)return null;c.setColor(d)}if(i&&c.setWidth(i(u)),r){const d=r(u);if(d!=="butt"&&d!=="round"&&d!=="square")throw new Error("Expected butt, round, or square line cap");c.setLineCap(d)}if(o){const d=o(u);if(d!=="bevel"&&d!=="round"&&d!=="miter")throw new Error("Expected bevel, round, or miter line join");c.setLineJoin(d)}return a&&c.setLineDash(a(u)),l&&c.setLineDashOffset(l(u)),h&&c.setMiterLimit(h(u)),c}}function Z_(n,t){const e="text-",i=Xe(n,e+"value",t);if(!i)return null;const s=ls(n,e,t),r=ls(n,e+"background-",t),o=hs(n,e,t),a=hs(n,e+"background-",t),l=Xe(n,e+"font",t),h=Xt(n,e+"max-angle",t),c=Xt(n,e+"offset-x",t),u=Xt(n,e+"offset-y",t),d=dn(n,e+"overflow",t),f=Xe(n,e+"placement",t),g=Xt(n,e+"repeat",t),m=Rr(n,e+"scale",t),_=dn(n,e+"rotate-with-view",t),p=Xt(n,e+"rotation",t),y=Xe(n,e+"align",t),w=Xe(n,e+"justify",t),x=Xe(n,e+"baseline",t),E=dn(n,e+"keep-upright",t),T=wc(n,e+"padding",t),I=Ir(n,e+"declutter-mode"),v=new sc({declutterMode:I});return function(R){if(v.setText(i(R)),s&&v.setFill(s(R)),r&&v.setBackgroundFill(r(R)),o&&v.setStroke(o(R)),a&&v.setBackgroundStroke(a(R)),l&&v.setFont(l(R)),h&&v.setMaxAngle(h(R)),c&&v.setOffsetX(c(R)),u&&v.setOffsetY(u(R)),d&&v.setOverflow(d(R)),f){const b=f(R);if(b!=="point"&&b!=="line")throw new Error("Expected point or line for text-placement");v.setPlacement(b)}if(g&&v.setRepeat(g(R)),m&&v.setScale(m(R)),_&&v.setRotateWithView(_(R)),p&&v.setRotation(p(R)),y){const b=y(R);if(b!=="left"&&b!=="center"&&b!=="right"&&b!=="end"&&b!=="start")throw new Error("Expected left, right, center, start, or end for text-align");v.setTextAlign(b)}if(w){const b=w(R);if(b!=="left"&&b!=="right"&&b!=="center")throw new Error("Expected left, right, or center for text-justify");v.setJustify(b)}if(x){const b=x(R);if(b!=="bottom"&&b!=="top"&&b!=="middle"&&b!=="alphabetic"&&b!=="hanging")throw new Error("Expected bottom, top, middle, alphabetic, or hanging for text-baseline");v.setTextBaseline(b)}return T&&v.setPadding(T(R)),E&&v.setKeepUpright(E(R)),v}}function U_(n,t){return"icon-src"in n?V_(n,t):"shape-points"in n?j_(n,t):"circle-radius"in n?H_(n,t):null}function V_(n,t){const e="icon-",i=e+"src",s=Ic(n[i],i),r=Cr(n,e+"anchor",t),o=Rr(n,e+"scale",t),a=Xt(n,e+"opacity",t),l=Cr(n,e+"displacement",t),h=Xt(n,e+"rotation",t),c=dn(n,e+"rotate-with-view",t),u=Rc(n,e+"anchor-origin"),d=Tc(n,e+"anchor-x-units"),f=Tc(n,e+"anchor-y-units"),g=em(n,e+"color"),m=Q_(n,e+"cross-origin"),_=tm(n,e+"offset"),p=Rc(n,e+"offset-origin"),y=Tr(n,e+"width"),w=Tr(n,e+"height"),x=J_(n,e+"size"),E=Ir(n,e+"declutter-mode"),T=new hn({src:s,anchorOrigin:u,anchorXUnits:d,anchorYUnits:f,color:g,crossOrigin:m,offset:_,offsetOrigin:p,height:w,width:y,size:x,declutterMode:E});return function(I){return a&&T.setOpacity(a(I)),l&&T.setDisplacement(l(I)),h&&T.setRotation(h(I)),c&&T.setRotateWithView(c(I)),o&&T.setScale(o(I)),r&&T.setAnchor(r(I)),T}}function j_(n,t){const e="shape-",i=e+"points",s=e+"radius",r=Jo(n[i],i),o=Jo(n[s],s),a=ls(n,e,t),l=hs(n,e,t),h=Rr(n,e+"scale",t),c=Cr(n,e+"displacement",t),u=Xt(n,e+"rotation",t),d=dn(n,e+"rotate-with-view",t),f=Tr(n,e+"radius2"),g=Tr(n,e+"angle"),m=Ir(n,e+"declutter-mode"),_=new yr({points:r,radius:o,radius2:f,angle:g,declutterMode:m});return function(p){return a&&_.setFill(a(p)),l&&_.setStroke(l(p)),c&&_.setDisplacement(c(p)),u&&_.setRotation(u(p)),d&&_.setRotateWithView(d(p)),h&&_.setScale(h(p)),_}}function H_(n,t){const e="circle-",i=ls(n,e,t),s=hs(n,e,t),r=Xt(n,e+"radius",t),o=Rr(n,e+"scale",t),a=Cr(n,e+"displacement",t),l=Xt(n,e+"rotation",t),h=dn(n,e+"rotate-with-view",t),c=Ir(n,e+"declutter-mode"),u=new xr({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 Xt(n,t,e){if(!(t in n))return;const i=ze(n[t],B,e);return function(s){return Jo(i(s),t)}}function Xe(n,t,e){if(!(t in n))return null;const i=ze(n[t],zt,e);return function(s){return Ic(i(s),t)}}function q_(n,t,e){const i=Xe(n,t+"pattern-src",e),s=Cc(n,t+"pattern-offset",e),r=Cc(n,t+"pattern-size",e),o=qo(n,t+"color",e);return function(a){return{src:i(a),offset:s&&s(a),size:r&&r(a),color:o&&o(a)}}}function dn(n,t,e){if(!(t in n))return null;const i=ze(n[t],At,e);return function(s){const r=i(s);if(typeof r!="boolean")throw new Error(`Expected a boolean for ${t}`);return r}}function qo(n,t,e){if(!(t in n))return null;const i=ze(n[t],ge,e);return function(s){return Sc(i(s),t)}}function wc(n,t,e){if(!(t in n))return null;const i=ze(n[t],Fi,e);return function(s){return cs(i(s),t)}}function Cr(n,t,e){if(!(t in n))return null;const i=ze(n[t],Fi,e);return function(s){const r=cs(i(s),t);if(r.length!==2)throw new Error(`Expected two numbers for ${t}`);return r}}function Cc(n,t,e){if(!(t in n))return null;const i=ze(n[t],Fi,e);return function(s){return bc(i(s),t)}}function Rr(n,t,e){if(!(t in n))return null;const i=ze(n[t],Fi|B,e);return function(s){return im(i(s),t)}}function Tr(n,t){const e=n[t];if(e!==void 0){if(typeof e!="number")throw new Error(`Expected a number for ${t}`);return e}}function J_(n,t){const e=n[t];if(e!==void 0){if(typeof e=="number")return Gt(e);if(!Array.isArray(e))throw new Error(`Expected a number or size array for ${t}`);if(e.length!==2||typeof e[0]!="number"||typeof e[1]!="number")throw new Error(`Expected a number or size array for ${t}`);return e}}function Q_(n,t){const e=n[t];if(e!==void 0){if(typeof e!="string")throw new Error(`Expected a string for ${t}`);return e}}function Rc(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 Tc(n,t){const e=n[t];if(e!==void 0){if(e!=="pixels"&&e!=="fraction")throw new Error(`Expected pixels or fraction for ${t}`);return e}}function tm(n,t){const e=n[t];if(e!==void 0)return cs(e,t)}function Ir(n,t){const e=n[t];if(e!==void 0){if(typeof e!="string")throw new Error(`Expected a string for ${t}`);if(e!=="declutter"&&e!=="obstacle"&&e!=="none")throw new Error(`Expected declutter, obstacle, or none for ${t}`);return e}}function em(n,t){const e=n[t];if(e!==void 0)return Sc(e,t)}function cs(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 Ic(n,t){if(typeof n!="string")throw new Error(`Expected a string for ${t}`);return n}function Jo(n,t){if(typeof n!="number")throw new Error(`Expected a number for ${t}`);return n}function Sc(n,t){if(typeof n=="string")return n;const e=cs(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 bc(n,t){const e=cs(n,t);if(e.length!==2)throw new Error(`Expected an array of two numbers for ${t}`);return e}function im(n,t){return typeof n=="number"?n:bc(n,t)}const me={CENTER:"center",RESOLUTION:"resolution",ROTATION:"rotation"};function Lc(n,t,e){return(function(i,s,r,o,a){if(!i)return;if(!s&&!t)return i;const l=t?0:r[0]*s,h=t?0:r[1]*s,c=a?a[0]:0,u=a?a[1]:0;let d=n[0]+l/2+c,f=n[2]-l/2+c,g=n[1]+h/2+u,m=n[3]-h/2+u;d>f&&(d=(f+d)/2,f=d),g>m&&(g=(m+g)/2,m=g);let _=ot(i[0],d,f),p=ot(i[1],g,m);if(o&&e&&s){const y=30*s;_+=-y*Math.log(1+Math.max(0,d-i[0])/y)+y*Math.log(1+Math.max(0,i[0]-f)/y),p+=-y*Math.log(1+Math.max(0,g-i[1])/y)+y*Math.log(1+Math.max(0,i[1]-m)/y)}return[_,p]})}function nm(n){return n}function Ac(n){return Math.pow(n,3)}function fn(n){return 1-Ac(1-n)}function sm(n){return 3*n*n-2*n*n*n}function rm(n){return n}function Qo(n,t,e,i){const s=tt(t)/e[0],r=Lt(t)/e[1];return i?Math.min(n,Math.max(s,r)):Math.min(n,Math.min(s,r))}function ta(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),ot(i,e/2,t*2)}function om(n,t,e,i){return t=t!==void 0?t:!0,(function(s,r,o,a){if(s!==void 0){const l=n[0],h=n[n.length-1],c=e?Qo(l,e,o,i):l;if(a)return t?ta(s,c,h):ot(s,h,c);const u=Math.min(c,s),d=Math.floor(Jr(n,u,r));return n[d]>c&&d<n.length-1?n[d+1]:n[d]}})}function am(n,t,e,i,s,r){return i=i!==void 0?i:!0,e=e!==void 0?e:0,(function(o,a,l,h){if(o!==void 0){const c=s?Qo(t,s,l,r):t;if(h)return i?ta(o,c,e):ot(o,e,c);const u=1e-9,d=Math.ceil(Math.log(t/c)/Math.log(n)-u),f=-a*(.5-u)+.5,g=Math.min(c,o),m=Math.floor(Math.log(t/g)/Math.log(n)+f),_=Math.max(d,m),p=t/Math.pow(n,_);return ot(p,e,c)}})}function Mc(n,t,e,i,s){return e=e!==void 0?e:!0,(function(r,o,a,l){if(r!==void 0){const h=i?Qo(n,i,a,s):n;return!e||!l?ot(r,t,h):ta(r,h,t)}})}function ea(n){if(n!==void 0)return 0}function Pc(n){if(n!==void 0)return n}function lm(n){const t=2*Math.PI/n;return(function(e,i){if(i)return e;if(e!==void 0)return e=Math.floor(e/t+.5)*t,e})}function hm(n){const t=ii(5);return(function(e,i){return i||e===void 0?e:Math.abs(e)<=t?0:e})}const cm=42,ia=256,na=0;class we extends ue{constructor(t){super(),this.on,this.once,this.un,t=Object.assign({},t),this.hints_=[0,0],this.animations_=[],this.updateAnimationKey_,this.projection_=yo(t.projection,"EPSG:3857"),this.viewportSize_=[100,100],this.targetCenter_=null,this.targetResolution_,this.targetRotation_,this.nextCenter_=null,this.nextResolution_,this.nextRotation_,this.cancelAnchor_=void 0,t.projection&&sh(),t.center&&(t.center=Oe(t.center,this.projection_)),t.extent&&(t.extent=ni(t.extent,this.projection_)),this.applyOptions_(t)}applyOptions_(t){const e=Object.assign({},t);for(const a in me)delete e[a];this.setProperties(e,!0);const i=dm(t);this.maxResolution_=i.maxResolution,this.minResolution_=i.minResolution,this.zoomFactor_=i.zoomFactor,this.resolutions_=t.resolutions,this.padding_=t.padding,this.minZoom_=i.minZoom;const s=um(t),r=i.constraint,o=fm(t);this.constraints_={center:s,resolution:r,rotation:o},this.setRotation(t.rotation!==void 0?t.rotation:0),this.setCenterInternal(t.center!==void 0?t.center:null),t.resolution!==void 0?this.setResolution(t.resolution):t.zoom!==void 0&&this.setZoom(t.zoom)}get padding(){return this.padding_}set padding(t){let e=this.padding_;this.padding_=t;const i=this.getCenterInternal();if(i){const s=t||[0,0,0,0];e=e||[0,0,0,0];const r=this.getResolution(),o=r/2*(s[3]-e[3]+e[1]-s[1]),a=r/2*(s[0]-e[0]+e[2]-s[2]);this.setCenterInternal([i[0]+o,i[1]-a])}}getUpdatedOptions_(t){const e=this.getProperties();return e.resolution!==void 0?e.resolution=this.getResolution():e.zoom=this.getZoom(),e.center=this.getCenterInternal(),e.rotation=this.getRotation(),Object.assign({},e,t)}animate(t){this.isDef()&&!this.getAnimating()&&this.resolveConstraints(0);const e=new Array(arguments.length);for(let i=0;i<e.length;++i){let s=arguments[i];s.center&&(s=Object.assign({},s),s.center=Oe(s.center,this.getProjection())),s.anchor&&(s=Object.assign({},s),s.anchor=Oe(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&&Sr(i,!0);return}let r=Date.now(),o=this.targetCenter_.slice(),a=this.targetResolution_,l=this.targetRotation_;const h=[];for(;s<e;++s){const c=arguments[s],u={start:r,complete:!1,anchor:c.anchor,duration:c.duration!==void 0?c.duration:1e3,easing:c.easing||sm,callback:i};if(c.center&&(u.sourceCenter=o,u.targetCenter=c.center.slice(),o=u.targetCenter),c.zoom!==void 0?(u.sourceResolution=a,u.targetResolution=this.getResolutionForZoom(c.zoom),a=u.targetResolution):c.resolution&&(u.sourceResolution=a,u.targetResolution=c.resolution,a=u.targetResolution),c.rotation!==void 0){u.sourceRotation=l;const d=ji(c.rotation-l+Math.PI,2*Math.PI)-Math.PI;u.targetRotation=l+d,l=u.targetRotation}gm(u)?u.complete=!0:r+=u.duration,h.push(u)}this.animations_.push(h),this.setHint(vt.ANIMATING,1),this.updateAnimations_()}getAnimating(){return this.hints_[vt.ANIMATING]>0}getInteracting(){return this.hints_[vt.INTERACTING]>0}cancelAnimations(){this.setHint(vt.ANIMATING,-this.hints_[vt.ANIMATING]);let t;for(let e=0,i=this.animations_.length;e<i;++e){const s=this.animations_[e];if(s[0].callback&&Sr(s[0].callback,!1),!t)for(let r=0,o=s.length;r<o;++r){const a=s[r];if(!a.complete){t=a.anchor;break}}}this.animations_.length=0,this.cancelAnchor_=t,this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN}updateAnimations_(){if(this.updateAnimationKey_!==void 0&&(cancelAnimationFrame(this.updateAnimationKey_),this.updateAnimationKey_=void 0),!this.getAnimating())return;const t=Date.now();let e=!1;for(let i=this.animations_.length-1;i>=0;--i){const s=this.animations_[i];let r=!0;for(let o=0,a=s.length;o<a;++o){const l=s[o];if(l.complete)continue;const h=t-l.start;let c=l.duration>0?h/l.duration:1;c>=1?(l.complete=!0,c=1):r=!1;const u=l.easing(c);if(l.sourceCenter){const d=l.sourceCenter[0],f=l.sourceCenter[1],g=l.targetCenter[0],m=l.targetCenter[1];this.nextCenter_=l.targetCenter;const _=d+u*(g-d),p=f+u*(m-f);this.targetCenter_=[_,p]}if(l.sourceResolution&&l.targetResolution){const d=u===1?l.targetResolution:l.sourceResolution+u*(l.targetResolution-l.sourceResolution);if(l.anchor){const f=this.getViewportSize_(this.getRotation()),g=this.constraints_.resolution(d,0,f,!0);this.targetCenter_=this.calculateCenterZoom(g,l.anchor)}this.nextResolution_=l.targetResolution,this.targetResolution_=d,this.applyTargetState_(!0)}if(l.sourceRotation!==void 0&&l.targetRotation!==void 0){const d=u===1?ji(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(vt.ANIMATING,-1),this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN;const o=s[0].callback;o&&Sr(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]],ao(i,t-this.getRotation()),jd(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&&wo(t,this.getProjection())}getCenterInternal(){return this.get(me.CENTER)}getConstraints(){return this.constraints_}getConstrainResolution(){return this.get("constrainResolution")}getHints(t){return t!==void 0?(t[0]=this.hints_[0],t[1]=this.hints_[1],t):this.hints_.slice()}calculateExtent(t){const e=this.calculateExtentInternal(t);return ah(e,this.getProjection())}calculateExtentInternal(t){t=t||this.getViewportSizeMinusPadding_();const e=this.getCenterInternal();Q(e,"The view center is not defined");const i=this.getResolution();Q(i!==void 0,"The view resolution is not defined");const s=this.getRotation();return Q(s!==void 0,"The view rotation is not defined"),ro(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(me.RESOLUTION)}getResolutions(){return this.resolutions_}getResolutionForExtent(t,e){return this.getResolutionForExtentInternal(ni(t,this.getProjection()),e)}getResolutionForExtentInternal(t,e){e=e||this.getViewportSizeMinusPadding_();const i=tt(t)/e[0],s=Lt(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(me.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=sa(s,this.getViewportSize_(),[o[0]/2+r[3],o[1]/2+r[0]],e,i)}return{center:s.slice(0),projection:t!==void 0?t:null,resolution:e,nextCenter:this.nextCenter_,nextResolution:this.nextResolution_,nextRotation:this.nextRotation_,rotation:i,zoom:this.getZoom()}}getViewStateAndExtent(){return{viewState:this.getState(),extent:this.calculateExtent()}}getZoom(){let t;const e=this.getResolution();return e!==void 0&&(t=this.getZoomForResolution(e)),t}getZoomForResolution(t){let e=this.minZoom_||0,i,s;if(this.resolutions_){const r=Jr(this.resolutions_,t,1);e=r,i=this.resolutions_[r],r==this.resolutions_.length-1?s=2:s=i/this.resolutions_[r+1]}else i=this.maxResolution_,s=this.zoomFactor_;return e+Math.log(i/t)/Math.log(s)}getResolutionForZoom(t){if(this.resolutions_?.length){if(this.resolutions_.length===1)return this.resolutions_[0];const e=ot(Math.floor(t),0,this.resolutions_.length-2),i=this.resolutions_[e]/this.resolutions_[e+1];return this.resolutions_[e]/Math.pow(i,ot(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(!Vs(t),"Cannot fit empty extent provided as `geometry`");const s=ni(t,this.getProjection());i=Ch(s)}else if(t.getType()==="Circle"){const s=ni(t.getExtent(),this.getProjection());i=Ch(s),i.rotate(this.getRotation(),wi(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=wi(a);d[0]+=(s[1]-s[3])/2*l,d[1]+=(s[0]-s[2])/2*l;const f=d[0]*u-d[1]*c,g=d[1]*u+d[0]*c,m=this.getConstrainedCenter([f,g],l),_=e.callback?e.callback:Fn;e.duration!==void 0?this.animateInternal({resolution:l,center:m,duration:e.duration,easing:e.easing},_):(this.targetResolution_=l,this.targetCenter_=m,this.applyTargetState_(!1,!0),Sr(_,!0))}centerOn(t,e,i){this.centerOnInternal(Oe(t,this.getProjection()),e,i)}centerOnInternal(t,e,i){this.setCenterInternal(sa(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=sa(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=wo(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&&Oe(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=Oe(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&&Oe(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(me.ROTATION)!==s&&this.set(me.ROTATION,s),this.get(me.RESOLUTION)!==o&&(this.set(me.RESOLUTION,o),this.set("zoom",this.getZoom(),!0)),(!a||!this.get(me.CENTER)||!Js(this.get(me.CENTER),a))&&this.set(me.CENTER,a),this.getAnimating()&&!t&&this.cancelAnimations(),this.cancelAnchor_=void 0}resolveConstraints(t,e,i){t=t!==void 0?t:200;const s=e||0,r=this.constraints_.rotation(this.targetRotation_),o=this.getViewportSize_(r),a=this.constraints_.resolution(this.targetResolution_,s,o),l=this.constraints_.center(this.targetCenter_,a,o,!1,this.calculateCenterShift(this.targetCenter_,a,r,o));if(t===0&&!this.cancelAnchor_){this.targetResolution_=a,this.targetRotation_=r,this.targetCenter_=l,this.applyTargetState_();return}i=i||(t===0?this.cancelAnchor_:void 0),this.cancelAnchor_=void 0,(this.getResolution()!==a||this.getRotation()!==r||!this.getCenterInternal()||!Js(this.getCenterInternal(),l))&&(this.getAnimating()&&this.cancelAnimations(),this.animateInternal({rotation:r,center:l,resolution:a,duration:t,easing:fn,anchor:i}))}beginInteraction(){this.resolveConstraints(0),this.setHint(vt.INTERACTING,1)}endInteraction(t,e,i){i=i&&Oe(i,this.getProjection()),this.endInteractionInternal(t,e,i)}endInteractionInternal(t,e,i){this.getInteracting()&&(this.setHint(vt.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 Sr(n,t){setTimeout(function(){n(t)},0)}function um(n){if(n.extent!==void 0){const e=n.smoothExtentConstraint!==void 0?n.smoothExtentConstraint:!0;return Lc(n.extent,n.constrainOnlyCenter,e)}const t=yo(n.projection,"EPSG:3857");if(n.multiWorld!==!0&&t.isGlobal()){const e=t.getExtent().slice();return e[0]=-1/0,e[2]=1/0,Lc(e,!1,!1)}return nm}function dm(n){let t,e,i,o=n.minZoom!==void 0?n.minZoom:na,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=yo(n.projection,"EPSG:3857"),f=d.getExtent();let g=n.constrainOnlyCenter,m=n.extent;if(!h&&!m&&d.isGlobal()&&(g=!1,m=f),n.resolutions!==void 0){const _=n.resolutions;e=_[o],i=_[a]!==void 0?_[a]:_[_.length-1],n.constrainResolution?t=om(_,c,!g&&m,u):t=Mc(e,i,c,!g&&m,u)}else{const p=(f?Math.max(tt(f),Lt(f)):360*lo.degrees/d.getMetersPerUnit())/ia/Math.pow(2,na),y=p/Math.pow(2,28-na);e=n.maxResolution,e!==void 0?o=0:e=p/Math.pow(l,o),i=n.minResolution,i===void 0&&(n.maxZoom!==void 0?n.maxResolution!==void 0?i=e/Math.pow(l,a):i=p/Math.pow(l,a):i=y),a=o+Math.floor(Math.log(e/i)/Math.log(l)),i=e/Math.pow(l,a-o),n.constrainResolution?t=am(l,e,i,c,!g&&m,u):t=Mc(e,i,c,!g&&m,u)}return{constraint:t,maxResolution:e,minResolution:i,minZoom:o,zoomFactor:l}}function fm(n){if(n.enableRotation!==void 0?n.enableRotation:!0){const e=n.constrainRotation;return e===void 0||e===!0?hm():e===!1?Pc:typeof e=="number"?lm(e):Pc}return ea}function gm(n){return!(n.sourceCenter&&n.targetCenter&&!Js(n.sourceCenter,n.targetCenter)||n.sourceResolution!==n.targetResolution||n.sourceRotation!==n.targetRotation)}function sa(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 et={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 Oc extends ue{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[et.OPACITY]=t.opacity!==void 0?t.opacity:1,Q(typeof e[et.OPACITY]=="number","Layer opacity must be a number"),e[et.VISIBLE]=t.visible!==void 0?t.visible:!0,e[et.Z_INDEX]=t.zIndex,e[et.MAX_RESOLUTION]=t.maxResolution!==void 0?t.maxResolution:1/0,e[et.MIN_RESOLUTION]=t.minResolution!==void 0?t.minResolution:0,e[et.MIN_ZOOM]=t.minZoom!==void 0?t.minZoom:-1/0,e[et.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=ot(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 V()}getLayerStatesArray(t){return V()}getExtent(){return this.get(et.EXTENT)}getMaxResolution(){return this.get(et.MAX_RESOLUTION)}getMinResolution(){return this.get(et.MIN_RESOLUTION)}getMinZoom(){return this.get(et.MIN_ZOOM)}getMaxZoom(){return this.get(et.MAX_ZOOM)}getOpacity(){return this.get(et.OPACITY)}getSourceState(){return V()}getVisible(){return this.get(et.VISIBLE)}getZIndex(){return this.get(et.Z_INDEX)}setBackground(t){this.background_=t,this.changed()}setExtent(t){this.set(et.EXTENT,t)}setMaxResolution(t){this.set(et.MAX_RESOLUTION,t)}setMinResolution(t){this.set(et.MIN_RESOLUTION,t)}setMaxZoom(t){this.set(et.MAX_ZOOM,t)}setMinZoom(t){this.set(et.MIN_ZOOM,t)}setOpacity(t){Q(typeof t=="number","Layer opacity must be a number"),this.set(et.OPACITY,t)}setVisible(t){this.set(et.VISIBLE,t)}setZIndex(t){this.set(et.Z_INDEX,t)}disposeInternal(){this.state_&&(this.state_.layer=null,this.state_=null),super.disposeInternal()}}class br extends Oc{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(et.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(et.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_&&(st(this.sourceChangeKey_),this.sourceChangeKey_=null),this.sourceReady_=!1;const t=this.getSource();t&&(this.sourceChangeKey_=U(t,W.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 we?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 ra(s,e.viewState)&&(!r||Ft(r,e.extent))}getAttributions(t){if(!this.isVisible(t))return[];const e=this.getSource()?.getAttributions();if(!e)return[];const i=t instanceof we?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(et.MAP,t)}getMapInternal(){return this.get(et.MAP)}setMap(t){this.mapPrecomposeKey_&&(st(this.mapPrecomposeKey_),this.mapPrecomposeKey_=null),t||this.changed(),this.mapRenderKey_&&(st(this.mapRenderKey_),this.mapRenderKey_=null),t&&(this.mapPrecomposeKey_=U(t,ee.PRECOMPOSE,this.handlePrecompose_,this),this.mapRenderKey_=U(this,W.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(et.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 ra(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 Dc={RENDER_ORDER:"renderOrder"};class Fc extends br{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(Dc.RENDER_ORDER)}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}getUpdateWhileAnimating(){return this.updateWhileAnimating_}getUpdateWhileInteracting(){return this.updateWhileInteracting_}renderDeclutter(t,e){const i=this.getDeclutter();i in t.declutter||(t.declutter[i]=new Hh(9)),this.getRenderer().renderDeclutter(t,e)}setRenderOrder(t){this.set(Dc.RENDER_ORDER,t)}setStyle(t){this.style_=t===void 0?ic:t;const e=_m(t);this.styleFunction_=t===null?void 0:qg(e),this.changed()}setDeclutter(t){this.declutter_=t?String(t):void 0,this.changed()}}function _m(n){if(n===void 0)return ic;if(!n)return null;if(typeof n=="function"||n instanceof Ee)return n;if(!Array.isArray(n))return vc([n]);if(n.length===0)return[];const t=n.length,e=n[0];if(e instanceof Ee){const s=new Array(t);for(let r=0;r<t;++r){const o=n[r];if(!(o instanceof Ee))throw new Error("Expected a list of style instances");s[r]=o}return s}if("style"in e){const s=new Array(t);for(let r=0;r<t;++r){const o=n[r];if(!("style"in o))throw new Error("Expected a list of rules with a style property");s[r]=o}return K_(s)}return vc(n)}class mm extends Fc{constructor(t){super(t)}createRenderer(){return new y_(this)}}const G={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};class oa extends Ws{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(W.CHANGE)}release(){this.setState(G.EMPTY)}getKey(){return this.key+"/"+this.tileCoord}getTileCoord(){return this.tileCoord}getState(){return this.state}setState(t){if(this.state!==G.EMPTY){if(this.state!==G.ERROR&&this.state>t)throw new Error("Tile load sequence violation");this.state=t,this.changed()}}load(){V()}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:Ac(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 kc extends oa{constructor(t,e,i,s,r,o){super(t,e,o),this.crossOrigin_=s,this.src_=i,this.key=i,this.image_,Kt?this.image_=new OffscreenCanvas(1,1):(this.image_=new Image,s!==null&&(this.image_.crossOrigin=s)),this.unlisten_=null,this.tileLoadFunction_=r}getImage(){return this.image_}setImage(t){this.image_=t,this.state=G.LOADED,this.unlistenImage_(),this.changed()}getCrossOrigin(){return this.crossOrigin_}handleImageError_(){this.state=G.ERROR,this.unlistenImage_(),this.image_=pm(),this.changed()}handleImageLoad_(){if(Kt)this.state=G.LOADED;else{const t=this.image_;t.naturalWidth&&t.naturalHeight?this.state=G.LOADED:this.state=G.EMPTY}this.unlistenImage_(),this.changed()}load(){this.state==G.ERROR&&(this.state=G.IDLE,this.image_=new Image,this.crossOrigin_!==null&&(this.image_.crossOrigin=this.crossOrigin_)),this.state==G.IDLE&&(this.state=G.LOADING,this.changed(),this.tileLoadFunction_(this,this.src_),this.unlisten_=fg(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this)))}unlistenImage_(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)}disposeInternal(){this.unlistenImage_(),this.image_=null,super.disposeInternal()}}function pm(){const n=ct(1,1);return n.fillStyle="rgba(0,0,0,0)",n.fillRect(0,0,1,1),n.canvas}class ym{constructor(t,e,i){this.decay_=t,this.minVelocity_=e,this.delay_=i,this.points_=[],this.angle_=0,this.initialVelocity_=0}begin(){this.points_.length=0,this.angle_=0,this.initialVelocity_=0}update(t,e){this.points_.push(t,e,Date.now())}end(){if(this.points_.length<6)return!1;const t=Date.now()-this.delay_,e=this.points_.length-3;if(this.points_[e+2]<t)return!1;let i=e-3;for(;i>0&&this.points_[i+2]>t;)i-=3;const s=this.points_[e+2]-this.points_[i+2];if(s<1e3/60)return!1;const r=this.points_[e]-this.points_[i],o=this.points_[e+1]-this.points_[i+1];return this.angle_=Math.atan2(o,r),this.initialVelocity_=Math.sqrt(r*r+o*o)/s,this.initialVelocity_>this.minVelocity_}getDistance(){return(this.minVelocity_-this.initialVelocity_)/this.decay_}getAngle(){return this.angle_}}class gn extends Pe{constructor(t,e,i){super(t),this.map=e,this.frameState=i!==void 0?i:null}}class ui extends gn{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 at={SINGLECLICK:"singleclick",CLICK:W.CLICK,DBLCLICK:W.DBLCLICK,POINTERDRAG:"pointerdrag",POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"},aa={POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown"};class xm extends Ws{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_=U(i,aa.POINTERDOWN,this.handlePointerDown_,this),this.originalPointerMoveEvent_,this.relayedListenerKey_=U(i,aa.POINTERMOVE,this.relayMoveEvent_,this),this.boundHandleTouchMove_=this.handleTouchMove_.bind(this),this.element_.addEventListener(W.TOUCHMOVE,this.boundHandleTouchMove_,Sh?{passive:!1}:!1)}emulateClick_(t){let e=new ui(at.CLICK,this.map_,t);this.dispatchEvent(e),this.clickTimeoutId_!==void 0?(clearTimeout(this.clickTimeoutId_),this.clickTimeoutId_=void 0,e=new ui(at.DBLCLICK,this.map_,t),this.dispatchEvent(e)):this.clickTimeoutId_=setTimeout(()=>{this.clickTimeoutId_=void 0;const i=new ui(at.SINGLECLICK,this.map_,t);this.dispatchEvent(i)},250)}updateActivePointers_(t){const e=t,i=e.pointerId;if(e.type==at.POINTERUP||e.type==at.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==at.POINTERDOWN||e.type==at.POINTERMOVE)&&(this.trackedTouches_[i]=e);this.activePointers_=Object.values(this.trackedTouches_)}handlePointerUp_(t){this.updateActivePointers_(t);const e=new ui(at.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(st),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 ui(at.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(U(i,at.POINTERMOVE,this.handlePointerMove_,this),U(i,at.POINTERUP,this.handlePointerUp_,this),U(this.element_,at.POINTERCANCEL,this.handlePointerUp_,this)),this.element_.getRootNode&&this.element_.getRootNode()!==i&&this.dragListenerKeys_.push(U(this.element_.getRootNode(),at.POINTERUP,this.handlePointerUp_,this))}}handlePointerMove_(t){if(this.isMoving_(t)){this.updateActivePointers_(t),this.dragging_=!0;const e=new ui(at.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 ui(at.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_&&(st(this.relayedListenerKey_),this.relayedListenerKey_=null),this.element_.removeEventListener(W.TOUCHMOVE,this.boundHandleTouchMove_),this.pointerdownListenerKey_&&(st(this.pointerdownListenerKey_),this.pointerdownListenerKey_=null),this.dragListenerKeys_.forEach(st),this.dragListenerKeys_.length=0,this.element_=null,super.disposeInternal()}}const We={POSTRENDER:"postrender",MOVESTART:"movestart",MOVEEND:"moveend",LOADSTART:"loadstart",LOADEND:"loadend"},wt={LAYERGROUP:"layergroup",SIZE:"size",TARGET:"target",VIEW:"view"},Lr=1/0;class Em{constructor(t,e){this.priorityFunction_=t,this.keyFunction_=e,this.elements_=[],this.priorities_=[],this.queuedElements_={}}clear(){this.elements_.length=0,this.priorities_.length=0,kn(this.queuedElements_)}dequeue(){const t=this.elements_,e=this.priorities_,i=t[0];t.length==1?(t.length=0,e.length=0):(t[0]=t.pop(),e[0]=e.pop(),this.siftUp_(0));const s=this.keyFunction_(i);return delete this.queuedElements_[s],i}enqueue(t){Q(!(this.keyFunction_(t)in this.queuedElements_),"Tried to enqueue an `element` that was already added to the queue");const e=this.priorityFunction_(t);return e!=Lr?(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==Lr?delete this.queuedElements_[this.keyFunction_(o)]:(i[s]=l,e[s++]=o);e.length=s,i.length=s,this.heapify_()}}class vm extends Em{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(W.CHANGE,this.boundHandleTileChange_),e}getTilesLoading(){return this.tilesLoading_}handleTileChange(t){const e=t.target,i=e.getState();if(i===G.LOADED||i===G.ERROR||i===G.EMPTY){i!==G.ERROR&&e.removeEventListener(W.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()===G.IDLE&&!(r in this.tilesLoadingKeys_)&&(this.tilesLoadingKeys_[r]=!0,++this.tilesLoading_,++i,s.load())}}}function wm(n,t,e,i,s){if(!n||!(e in n.wantedTiles)||!n.wantedTiles[e][t.getKey()])return Lr;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 la extends ue{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)st(this.listenerKeys[e]);if(this.listenerKeys.length=0,this.map_=t,t){const e=this.target_??t.getOverlayContainerStopEvent();this.element&&e.appendChild(this.element),this.render!==Fn&&this.listenerKeys.push(U(t,We.POSTRENDER,this.render,this)),t.render()}}render(t){}setTarget(t){this.target_=typeof t=="string"?document.getElementById(t):t}}class Cm extends la{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(W.CLICK,this.handleClick_.bind(this),!1);const h=e+" "+fr+" "+zo+(this.collapsed_&&this.collapsible_?" "+Fh:"")+(this.collapsible_?"":" ol-uncollapsible"),c=this.element;c.className=h,c.appendChild(this.toggleButton_),c.appendChild(this.ulElement_),this.renderedAttributions_=[],this.renderedVisible_=!0}collectSourceAttributions_(t){const e=this.getMap().getAllLayers(),i=new Set(e.flatMap(s=>s.getAttributions(t)));if(this.attributions_!==void 0&&(Array.isArray(this.attributions_)?this.attributions_.forEach(s=>i.add(s)):i.add(this.attributions_)),!this.overrideCollapsible_){const s=!e.some(r=>r.getSource()?.getAttributionsCollapsible()===!1);this.setCollapsible(s)}return Array.from(i)}async updateElement_(t){if(!t){this.renderedVisible_&&(this.element.style.display="none",this.renderedVisible_=!1);return}const e=await Promise.all(this.collectSourceAttributions_(t).map(s=>Gd(()=>s))),i=e.length>0;if(this.renderedVisible_!=i&&(this.element.style.display=i?"":"none",this.renderedVisible_=i),!ti(e,this.renderedAttributions_)){Lh(this.ulElement_);for(let s=0,r=e.length;s<r;++s){const o=document.createElement("li");o.innerHTML=e[s],this.ulElement_.appendChild(o)}this.renderedAttributions_=e}}handleClick_(t){t.preventDefault(),this.handleToggle_(),this.userCollapsed_=this.collapsed_}handleToggle_(){this.element.classList.toggle(Fh),this.collapsed_?bh(this.collapseLabel_,this.label_):bh(this.label_,this.collapseLabel_),this.collapsed_=!this.collapsed_,this.toggleButton_.setAttribute("aria-expanded",String(!this.collapsed_))}getCollapsible(){return this.collapsible_}setCollapsible(t){this.collapsible_!==t&&(this.collapsible_=t,this.element.classList.toggle("ol-uncollapsible"),this.userCollapsed_&&this.handleToggle_())}setCollapsed(t){this.userCollapsed_=t,!(!this.collapsible_||this.collapsed_===t)&&this.handleToggle_()}getCollapsed(){return this.collapsed_}render(t){this.updateElement_(t.frameState)}}class Rm extends la{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(W.CLICK,this.handleClick_.bind(this),!1);const a=e+" "+fr+" "+zo,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(dr)}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:fn}):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(dr);!r&&i===0?this.element.classList.add(dr):r&&i!==0&&this.element.classList.remove(dr)}this.label_.style.transform=s}this.rotation_=i}}class Tm extends la{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(W.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(W.CLICK,this.handleClick_.bind(this,-i),!1);const d=e+" "+fr+" "+zo,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:fn})):i.setZoom(r)}}}function Im(n){n=n||{};const t=new Jt;return(n.zoom!==void 0?n.zoom:!0)&&t.push(new Tm(n.zoomOptions)),(n.rotate!==void 0?n.rotate:!0)&&t.push(new Rm(n.rotateOptions)),(n.attribution!==void 0?n.attribution:!0)&&t.push(new Cm(n.attributionOptions)),t}const Nc={ACTIVE:"active"};class us extends ue{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(Nc.ACTIVE)}getMap(){return this.map_}handleEvent(t){return!0}setActive(t){this.set(Nc.ACTIVE,t)}setMap(t){this.map_=t}}function Sm(n,t,e){const i=n.getCenterInternal();if(i){const s=[i[0]+t[0],i[1]+t[1]];n.animateInternal({duration:e!==void 0?e:250,easing:rm,center:n.getConstrainedCenter(s)})}}function ha(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:fn})}class bm extends us{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==at.DBLCLICK){const i=t.originalEvent,s=t.map,r=t.coordinate,o=i.shiftKey?-this.delta_:this.delta_,a=s.getView();ha(a,o,r,this.duration_),i.preventDefault(),e=!0}return!e}}function ca(n){const t=arguments;return function(e){let i=!0;for(let s=0,r=t.length;s<r&&(i=i&&t[s](e),!!i);++s);return i}}const Lm=function(n){const t=n.originalEvent;return t.altKey&&!(t.metaKey||t.ctrlKey)&&t.shiftKey},Am=function(n){const t=n.map.getTargetElement(),e=t.getRootNode(),i=n.map.getOwnerDocument().activeElement;return e instanceof ShadowRoot?e.host.contains(i):t.contains(i)},Gc=function(n){const t=n.map.getTargetElement(),e=t.getRootNode();return(e instanceof ShadowRoot?e.host:t).hasAttribute("tabindex")?Am(n):!0},Mm=Dn,zc=function(n){const t=n.originalEvent;return"pointerId"in t&&t.button==0&&!(Qf&&Th&&t.ctrlKey)},Xc=function(n){const t=n.originalEvent;return!t.altKey&&!(t.metaKey||t.ctrlKey)&&!t.shiftKey},Pm=function(n){const t=n.originalEvent;return Th?t.metaKey:t.ctrlKey},Om=function(n){const t=n.originalEvent;return!t.altKey&&!(t.metaKey||t.ctrlKey)&&t.shiftKey},Wc=function(n){const t=n.originalEvent,e=t.target.tagName;return e!=="INPUT"&&e!=="SELECT"&&e!=="TEXTAREA"&&!t.target.isContentEditable},ua=function(n){const t=n.originalEvent;return"pointerId"in t&&t.pointerType=="mouse"},Dm=function(n){const t=n.originalEvent;return"pointerId"in t&&t.isPrimary&&t.button===0};class ds extends us{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==at.POINTERDRAG)this.handleDragEvent(t),t.originalEvent.preventDefault();else if(t.type==at.POINTERUP){const i=this.handleUpEvent(t);this.handlingDownUpSequence=i&&this.targetPointers.length>0}}else if(t.type==at.POINTERDOWN){const i=this.handleDownEvent(t);this.handlingDownUpSequence=i,e=this.stopDown(i)}else t.type==at.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 da(n){const t=n.length;let e=0,i=0;for(let s=0;s<t;s++)e+=n[s].clientX,i+=n[s].clientY;return{clientX:e/t,clientY:i/t}}class Fm extends ds{constructor(t){super({stopDown:Xs}),t=t||{},this.kinetic_=t.kinetic,this.lastCentroid=null,this.lastPointersCount_,this.panning_=!1;const e=t.condition?t.condition:ca(Xc,Dm);this.condition_=t.onFocusOnly?ca(Gc,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(da(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();Hd(r,a.getResolution()),ao(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:fn})}return this.panning_&&(this.panning_=!1,i.endInteraction()),!1}return this.kinetic_&&this.kinetic_.begin(),this.lastCentroid=null,!0}handleDownEvent(t){if(this.targetPointers.length>0&&this.condition_(t)){const i=t.map.getView();return this.lastCentroid=null,i.getAnimating()&&i.cancelAnimations(),this.kinetic_&&this.kinetic_.begin(),this.noKinetic_=this.targetPointers.length>1,!0}return!1}}class km extends ds{constructor(t){t=t||{},super({stopDown:Xs}),this.condition_=t.condition?t.condition:Lm,this.lastAngle_=void 0,this.duration_=t.duration!==void 0?t.duration:250}handleDragEvent(t){if(!ua(t))return;const e=t.map,i=e.getView();if(i.getConstraints().rotation===ea)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 ua(t)?(t.map.getView().endInteraction(this.duration_),!1):!0}handleDownEvent(t){return ua(t)&&zc(t)&&this.condition_(t)?(t.map.getView().beginInteraction(),this.lastAngle_=void 0,!0):!1}}class Nm extends zs{constructor(t){super(),this.geometry_=null,this.element_=document.createElement("div"),this.element_.style.position="absolute",this.element_.style.pointerEvents="auto",this.element_.className="ol-box "+t,this.map_=null,this.startPixel_=null,this.endPixel_=null}disposeInternal(){this.setMap(null)}render_(){const t=this.startPixel_,e=this.endPixel_,i="px",s=this.element_.style;s.left=Math.min(t[0],e[0])+i,s.top=Math.min(t[1],e[1])+i,s.width=Math.abs(e[0]-t[0])+i,s.height=Math.abs(e[1]-t[1])+i}setMap(t){if(this.map_){this.map_.getOverlayContainer().removeChild(this.element_);const e=this.element_.style;e.left="inherit",e.top="inherit",e.width="inherit",e.height="inherit"}this.map_=t,this.map_&&this.map_.getOverlayContainer().appendChild(this.element_)}setPixels(t,e){this.startPixel_=t,this.endPixel_=e,this.createOrUpdateGeometry(),this.render_()}createOrUpdateGeometry(){if(!this.map_)return;const t=this.startPixel_,e=this.endPixel_,s=[t,[t[0],e[1]],e,[e[0],t[1]]].map(this.map_.getCoordinateFromPixelInternal,this.map_);s[4]=s[0].slice(),this.geometry_?this.geometry_.setCoordinates([s]):this.geometry_=new Kn([s])}getGeometry(){return this.geometry_}}const _n={BOXSTART:"boxstart",BOXDRAG:"boxdrag",BOXEND:"boxend",BOXCANCEL:"boxcancel"};class fs extends Pe{constructor(t,e,i){super(t),this.coordinate=e,this.mapBrowserEvent=i}}class Gm extends ds{constructor(t){super(),this.on,this.once,this.un,t=t??{},this.box_=new Nm(t.className||"ol-dragbox"),this.minArea_=t.minArea??64,t.onBoxEnd&&(this.onBoxEnd=t.onBoxEnd),this.startPixel_=null,this.condition_=t.condition??zc,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 fs(_n.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 fs(e?_n.BOXEND:_n.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 fs(_n.BOXSTART,t.coordinate,t)),!0):!1}onBoxEnd(t){}setActive(t){t||(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new fs(_n.BOXCANCEL,this.startPixel_,null)),this.startPixel_=null)),super.setActive(t)}setMap(t){this.getMap()&&(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new fs(_n.BOXCANCEL,this.startPixel_,null)),this.startPixel_=null)),super.setMap(t)}}class zm extends Gm{constructor(t){t=t||{};const e=t.condition?t.condition:Om;super({condition:e,className:t.className||"ol-dragzoom",minArea:t.minArea}),this.duration_=t.duration!==void 0?t.duration:200,this.out_=t.out!==void 0?t.out:!1}onBoxEnd(t){const i=this.getMap().getView();let s=this.getGeometry();if(this.out_){const r=i.rotatedExtentForGeometry(s),o=i.getResolutionForExtentInternal(r),a=i.getResolution()/o;s=s.clone(),s.scale(a*a)}i.fitInternal(s,{duration:this.duration_,easing:fn})}}const ki={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",DOWN:"ArrowDown"};class Xm extends us{constructor(t){super(),t=t||{},this.defaultCondition_=function(e){return Xc(e)&&Wc(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==W.KEYDOWN){const i=t.originalEvent,s=i.key;if(this.condition_(t)&&(s==ki.DOWN||s==ki.LEFT||s==ki.RIGHT||s==ki.UP)){const o=t.map.getView(),a=o.getResolution()*this.pixelDelta_;let l=0,h=0;s==ki.DOWN?h=-a:s==ki.LEFT?l=-a:s==ki.RIGHT?l=a:h=a;const c=[l,h];ao(c,o.getRotation()),Sm(o,c,this.duration_),i.preventDefault(),e=!0}}return!e}}class Wm extends us{constructor(t){super(),t=t||{},this.condition_=t.condition?t.condition:function(e){return!Pm(e)&&Wc(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==W.KEYDOWN||t.type==W.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();ha(a,o,void 0,this.duration_),i.preventDefault(),e=!0}}return!e}}const Ym=40,$m=300;class Km extends us{constructor(t){t=t||{},super(t),this.totalDelta_=0,this.lastDelta_=0,this.maxDelta_=t.maxDelta!==void 0?t.maxDelta:1,this.duration_=t.duration!==void 0?t.duration:250,this.timeout_=t.timeout!==void 0?t.timeout:80,this.useAnchor_=t.useAnchor!==void 0?t.useAnchor:!0,this.constrainResolution_=t.constrainResolution!==void 0?t.constrainResolution:!1;const e=t.condition?t.condition:Mm;this.condition_=t.onFocusOnly?ca(Gc,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!==W.WHEEL)return!0;const i=t.map,s=t.originalEvent;s.preventDefault(),this.useAnchor_&&(this.lastAnchor_=t.pixel);let r=s.deltaY;switch(s.deltaMode){case WheelEvent.DOM_DELTA_LINE:r*=Ym;break;case WheelEvent.DOM_DELTA_PAGE:r*=$m;break}if(r===0)return!1;this.lastDelta_=r;const o=Date.now();this.startTime_===void 0&&(this.startTime_=o),(!this.mode_||o-this.startTime_>this.trackpadEventGap_)&&(this.mode_=Math.abs(r)<4?"trackpad":"wheel");const a=i.getView();if(this.mode_==="trackpad"&&!(a.getConstrainResolution()||this.constrainResolution_))return this.trackpadTimeoutId_?clearTimeout(this.trackpadTimeoutId_):(a.getAnimating()&&a.cancelAnimations(),a.beginInteraction()),this.trackpadTimeoutId_=setTimeout(this.endInteraction_.bind(this),this.timeout_),a.adjustZoom(-r/this.deltaPerZoom_,this.lastAnchor_?i.getCoordinateFromPixel(this.lastAnchor_):null),this.startTime_=o,!1;this.totalDelta_+=r;const l=Math.max(this.timeout_-(o-this.startTime_),0);return clearTimeout(this.timeoutId_),this.timeoutId_=setTimeout(this.handleWheelZoom_.bind(this,i),l),!1}handleWheelZoom_(t){const e=t.getView();e.getAnimating()&&e.cancelAnimations();let i=-ot(this.totalDelta_,-this.maxDelta_*this.deltaPerZoom_,this.maxDelta_*this.deltaPerZoom_)/this.deltaPerZoom_;(e.getConstrainResolution()||this.constrainResolution_)&&(i=i?i>0?1:-1:0),ha(e,i,this.lastAnchor_?t.getCoordinateFromPixel(this.lastAnchor_):null,this.duration_),this.mode_=void 0,this.totalDelta_=0,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_=void 0}setMouseAnchor(t){this.useAnchor_=t,t||(this.lastAnchor_=null)}}class Bm extends ds{constructor(t){t=t||{};const e=t;e.stopDown||(e.stopDown=Xs),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!==ea&&(this.anchor_=o.getCoordinateFromPixelInternal(o.getEventPixel(da(this.targetPointers))),this.rotating_&&(o.render(),a.adjustRotationInternal(e,this.anchor_)))}handleUpEvent(t){return this.targetPointers.length<2?(t.map.getView().endInteraction(this.duration_),!1):!0}handleDownEvent(t){if(this.targetPointers.length>=2){const e=t.map;return this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.handlingDownUpSequence||e.getView().beginInteraction(),!0}return!1}}class Zm extends ds{constructor(t){t=t||{};const e=t;e.stopDown||(e.stopDown=Xs),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(da(this.targetPointers))),l.render(),h.adjustResolutionInternal(e,this.anchor_)}handleUpEvent(t){if(this.targetPointers.length<2){const i=t.map.getView(),s=this.lastScaleDelta_>1?1:-1;return i.endInteraction(this.duration_,s),!1}return!0}handleDownEvent(t){if(this.targetPointers.length>=2){const e=t.map;return this.anchor_=null,this.lastDistance_=void 0,this.lastScaleDelta_=1,this.handlingDownUpSequence||e.getView().beginInteraction(),!0}return!1}}function Um(n){n=n||{};const t=new Jt,e=new ym(-.005,.05,100);return(n.altShiftDragRotate!==void 0?n.altShiftDragRotate:!0)&&t.push(new km),(n.doubleClickZoom!==void 0?n.doubleClickZoom:!0)&&t.push(new bm({delta:n.zoomDelta,duration:n.zoomDuration})),(n.dragPan!==void 0?n.dragPan:!0)&&t.push(new Fm({onFocusOnly:n.onFocusOnly,kinetic:e})),(n.pinchRotate!==void 0?n.pinchRotate:!0)&&t.push(new Bm),(n.pinchZoom!==void 0?n.pinchZoom:!0)&&t.push(new Zm({duration:n.zoomDuration})),(n.keyboard!==void 0?n.keyboard:!0)&&(t.push(new Xm),t.push(new Wm({delta:n.zoomDelta,duration:n.zoomDuration}))),(n.mouseWheelZoom!==void 0?n.mouseWheelZoom:!0)&&t.push(new Km({onFocusOnly:n.onFocusOnly,duration:n.zoomDuration})),(n.shiftDragZoom!==void 0?n.shiftDragZoom:!0)&&t.push(new zm({duration:n.zoomDuration})),t}const di={ADDLAYER:"addlayer",REMOVELAYER:"removelayer"};class fi extends Pe{constructor(t,e){super(t),this.layer=e}}const fa={LAYERS:"layers"};class mn extends Oc{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(fa.LAYERS,this.handleLayersChanged_),i?Array.isArray(i)?i=new Jt(i.slice(),{unique:!0}):Q(typeof i.getArray=="function","Expected `layers` to be an array or a `Collection`"):i=new Jt(void 0,{unique:!0}),this.setLayers(i)}handleLayerChange_(){this.changed()}handleLayersChanged_(){this.layersListenerKeys_.forEach(st),this.layersListenerKeys_.length=0;const t=this.getLayers();this.layersListenerKeys_.push(U(t,Dt.ADD,this.handleLayersAdd_,this),U(t,Dt.REMOVE,this.handleLayersRemove_,this));for(const i in this.listenerKeys_)this.listenerKeys_[i].forEach(st);kn(this.listenerKeys_);const e=t.getArray();for(let i=0,s=e.length;i<s;i++){const r=e[i];this.registerLayerListeners_(r),this.dispatchEvent(new fi(di.ADDLAYER,r))}this.changed()}registerLayerListeners_(t){const e=[U(t,Ki.PROPERTYCHANGE,this.handleLayerChange_,this),U(t,W.CHANGE,this.handleLayerChange_,this)];t instanceof mn&&e.push(U(t,di.ADDLAYER,this.handleLayerGroupAdd_,this),U(t,di.REMOVELAYER,this.handleLayerGroupRemove_,this)),this.listenerKeys_[j(t)]=e}handleLayerGroupAdd_(t){this.dispatchEvent(new fi(di.ADDLAYER,t.layer))}handleLayerGroupRemove_(t){this.dispatchEvent(new fi(di.REMOVELAYER,t.layer))}handleLayersAdd_(t){const e=t.element;this.registerLayerListeners_(e),this.dispatchEvent(new fi(di.ADDLAYER,e)),this.changed()}handleLayersRemove_(t){const e=t.element,i=j(e);this.listenerKeys_[i].forEach(st),delete this.listenerKeys_[i],this.dispatchEvent(new fi(di.REMOVELAYER,e)),this.changed()}getLayers(){return this.get(fa.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 fi(di.REMOVELAYER,i[s]))}this.set(fa.LAYERS,t)}getLayersArray(t){return t=t!==void 0?t:[],this.getLayers().forEach(function(e){e.getLayersArray(t)}),t}getLayerStatesArray(t){const e=t!==void 0?t:[],i=e.length;this.getLayers().forEach(function(o){o.getLayerStatesArray(e)});const s=this.getLayerState();let r=s.zIndex;!t&&s.zIndex===void 0&&(r=0);for(let o=i,a=e.length;o<a;o++){const l=e[o];l.opacity*=s.opacity,l.visible=l.visible&&s.visible,l.maxResolution=Math.min(l.maxResolution,s.maxResolution),l.minResolution=Math.max(l.minResolution,s.minResolution),l.minZoom=Math.max(l.minZoom,s.minZoom),l.maxZoom=Math.min(l.maxZoom,s.maxZoom),s.extent!==void 0&&(l.extent!==void 0?l.extent=Ci(l.extent,s.extent):l.extent=s.extent),l.zIndex===void 0&&(l.zIndex=r)}return e}getSourceState(){return"ready"}}class Vm extends zs{constructor(t){super(),this.map_=t}dispatchRenderEvent(t,e){V()}calculateMatrices2D(t){const e=t.viewState,i=t.coordinateToPixelTransform,s=t.pixelToCoordinateTransform;De(i,t.size[0]/2,t.size[1]/2,1/e.resolution,-1/e.resolution,-e.rotation,-e.center[0],-e.center[1]),lh(s,i)}forEachFeatureAtCoordinate(t,e,i,s,r,o,a,l){let h;const c=e.viewState;function u(x,E,T,I){return r.call(o,E,x?T:null,I)}const d=c.projection,f=Bl(t.slice(),d),g=[[0,0]];if(d.canWrapX()&&s){const x=d.getExtent(),E=tt(x);g.push([-E,0],[E,0])}const m=e.layerStatesArray,_=m.length,p=[],y=[];for(let x=0;x<g.length;x++)for(let E=_-1;E>=0;--E){const T=m[E],I=T.layer;if(I.hasRenderer()&&ra(T,c)&&a.call(l,I)){const v=I.getRenderer(),R=I.getSource();if(v&&R){const b=R.getWrapX()?f:t,O=u.bind(null,T.managed);y[0]=b[0]+g[x][0],y[1]=b[1]+g[x][1],h=v.forEachFeatureAtCoordinate(y,e,i,O,p)}if(h)return h}}if(p.length===0)return;const w=1/p.length;return p.forEach((x,E)=>x.distanceSq+=E*w),p.sort((x,E)=>x.distanceSq-E.distanceSq),p.some(x=>h=x.callback(x.feature,x.layer,x.geometry)),h}hasFeatureAtCoordinate(t,e,i,s,r,o){return this.forEachFeatureAtCoordinate(t,e,i,s,Dn,this,r,o)!==void 0}getMap(){return this.map_}renderFrame(t){V()}scheduleExpireIconCache(t){ie.canExpireCache()&&t.postRenderFunctions.push(jm)}}function jm(n,t){ie.expire()}class Hm extends Vm{constructor(t){super(t),this.fontChangeListenerKey_=U(rn,Ki.PROPERTYCHANGE,t.redrawText,t),this.element_=Kt?Ah():document.createElement("div");const e=this.element_.style;e.position="absolute",e.width="100%",e.height="100%",e.zIndex="0",this.element_.className=fr+" 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 dc(t,void 0,e);i.dispatchEvent(s)}}disposeInternal(){st(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(ee.PRECOMPOSE,t);const e=t.layerStatesArray.sort((h,c)=>h.zIndex-c.zIndex);e.some(h=>h.layer instanceof Fc&&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(!ra(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),ng(this.element_,this.children_);const l=this.getMap().getTargetElement();if(ri(l)){const h=l.getContext("2d");for(const c of this.children_){const u=c.firstElementChild||c,d=c.style.backgroundColor;if(d&&(!ri(u)||u.width>0)&&(h.fillStyle=d,h.fillRect(0,0,l.width,l.height)),ri(u)&&u.width>0){const f=c.style.opacity||u.style.opacity;h.globalAlpha=f===""?1:Number(f);const g=u.style.transform;if(g)h.setTransform(...Co(g));else{const m=parseFloat(u.style.width)/u.width,_=parseFloat(u.style.height)/u.height;h.setTransform(m,0,0,_,0,0)}h.drawImage(u,0,0)}}h.globalAlpha=1,h.setTransform(1,0,0,1,0,0)}this.dispatchRenderEvent(ee.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 Yc(n){if(n instanceof br){n.setMapInternal(null);return}n instanceof mn&&n.getLayers().forEach(Yc)}function $c(n,t){if(n instanceof br){n.setMapInternal(t);return}if(n instanceof mn){const e=n.getLayers().getArray();for(let i=0,s=e.length;i<s;++i)$c(e[i],t)}}let qm=class extends ue{constructor(t){super(),t=t||{},this.on,this.once,this.un;const e=Jm(t);this.renderComplete_=!1,this.loaded_=!0,this.boundHandleBrowserEvent_=this.handleBrowserEvent.bind(this),this.maxTilesLoading_=t.maxTilesLoading!==void 0?t.maxTilesLoading:16,this.pixelRatio_=t.pixelRatio!==void 0?t.pixelRatio:tg,this.postRenderTimeoutHandle_,this.animationDelayKey_,this.animationDelay_=this.animationDelay_.bind(this),this.coordinateToPixelTransform_=de(),this.pixelToCoordinateTransform_=de(),this.frameIndex_=0,this.frameState_=null,this.previousExtent_=null,this.viewPropertyListenerKey_=null,this.viewChangeListenerKey_=null,this.layerGroupPropertyListenerKeys_=null,Kt||(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,Kt||(this.resizeObserver_=new ResizeObserver(()=>this.updateSize())),this.controls=e.controls||(Kt?new Jt:Im()),this.interactions=e.interactions||(Kt?new Jt:Um({onFocusOnly:!0})),this.overlays_=e.overlays,this.overlayIdIndex_={},this.renderer_=null,this.postRenderFunctions_=[],this.tileQueue_=new vm(this.getTilePriority.bind(this),this.handleTileChange_.bind(this)),this.addChangeListener(wt.LAYERGROUP,this.handleLayerGroupChanged_),this.addChangeListener(wt.VIEW,this.handleViewChanged_),this.addChangeListener(wt.SIZE,this.handleSizeChanged_),this.addChangeListener(wt.TARGET,this.handleTargetChanged_),this.setProperties(e.values);const i=this;t.view&&!(t.view instanceof we)&&t.view.then(function(s){i.setView(new we(s))}),this.controls.addEventListener(Dt.ADD,s=>{s.element.setMap(this)}),this.controls.addEventListener(Dt.REMOVE,s=>{s.element.setMap(null)}),this.interactions.addEventListener(Dt.ADD,s=>{s.element.setMap(this)}),this.interactions.addEventListener(Dt.REMOVE,s=>{s.element.setMap(null)}),this.overlays_.addEventListener(Dt.ADD,s=>{this.addOverlayInternal_(s.element)}),this.overlays_.addEventListener(Dt.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){$c(t.layer,this)}addOverlay(t){this.getOverlays().push(t)}addOverlayInternal_(t){const e=t.getId();e!==void 0&&(this.overlayIdIndex_[e.toString()]=t),t.setMap(this)}disposeInternal(){this.controls.clear(),this.interactions.clear(),this.overlays_.clear(),this.resizeObserver_?.disconnect(),this.setTarget(null),super.disposeInternal()}forEachFeatureAtPixel(t,e,i){if(!this.frameState_||!this.renderer_)return;const s=this.getCoordinateFromPixelInternal(t);i=i!==void 0?i:{};const r=i.hitTolerance!==void 0?i.hitTolerance:0,o=i.layerFilter!==void 0?i.layerFilter:Dn,a=i.checkWrapped!==!1;return this.renderer_.forEachFeatureAtCoordinate(s,this.frameState_,r,a,e,null,o,null)}getFeaturesAtPixel(t,e){const i=[];return this.forEachFeatureAtPixel(t,function(s){i.push(s)},e),i}getAllLayers(){const t=[];function e(i){i.forEach(function(s){s instanceof mn?e(s.getLayers()):t.push(s)})}return e(this.getLayers()),t}hasFeatureAtPixel(t,e){if(!this.frameState_||!this.renderer_)return!1;const i=this.getCoordinateFromPixelInternal(t);e=e!==void 0?e:{};const s=e.layerFilter!==void 0?e.layerFilter:Dn,r=e.hitTolerance!==void 0?e.hitTolerance:0,o=e.checkWrapped!==!1;return this.renderer_.hasFeatureAtCoordinate(i,this.frameState_,r,o,s,null)}getEventCoordinate(t){return this.getCoordinateFromPixel(this.getEventPixel(t))}getEventCoordinateInternal(t){return this.getCoordinateFromPixelInternal(this.getEventPixel(t))}getEventPixel(t){const i=this.viewport_.getBoundingClientRect(),s=this.getSize(),r=i.width/s[0],o=i.height/s[1],a="changedTouches"in t?t.changedTouches[0]:t;return[(a.clientX-i.left)/r,(a.clientY-i.top)/o]}getTarget(){return this.get(wt.TARGET)}getTargetElement(){return this.targetElement_}getCoordinateFromPixel(t){return wo(this.getCoordinateFromPixelInternal(t),this.getView().getProjection())}getCoordinateFromPixelInternal(t){const e=this.frameState_;return e?gt(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(wt.LAYERGROUP)}setLayers(t){const e=this.getLayerGroup();if(t instanceof Jt){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=Oe(t,this.getView().getProjection());return this.getPixelFromCoordinateInternal(e)}getPixelFromCoordinateInternal(t){const e=this.frameState_;return e?gt(e.coordinateToPixelTransform,t.slice(0,2)):null}getRenderer(){return this.renderer_}getSize(){return this.get(wt.SIZE)}getView(){return this.get(wt.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 wm(this.frameState_,t,e,i,s)}handleBrowserEvent(t,e){e=e||t.type;const i=new ui(e,this,t);this.handleMapBrowserEvent(i)}handleMapBrowserEvent(t){if(!this.frameState_)return;const e=t.originalEvent,i=e.type;if(i===aa.POINTERDOWN||i===W.WHEEL||i===W.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[vt.ANIMATING]||o[vt.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(ee.RENDERCOMPLETE)&&this.renderer_.dispatchRenderEvent(ee.RENDERCOMPLETE,t),this.loaded_===!1&&(this.loaded_=!0,this.dispatchEvent(new gn(We.LOADEND,this,t)))):this.loaded_===!0&&(this.loaded_=!1,this.dispatchEvent(new gn(We.LOADSTART,this,t))));const i=this.postRenderFunctions_;if(t)for(let s=0,r=i.length;s<r;++s)i[s](this,t);i.length=0}handleSizeChanged_(){this.getView()&&!this.getView().getAnimating()&&this.getView().resolveConstraints(0),this.render()}handleTargetChanged_(){if(this.mapBrowserEventHandler_){for(let i=0,s=this.targetChangeHandlerKeys_.length;i<s;++i)st(this.targetChangeHandlerKeys_[i]);this.targetChangeHandlerKeys_=null,this.viewport_.removeEventListener(W.CONTEXTMENU,this.boundHandleBrowserEvent_),this.viewport_.removeEventListener(W.WHEEL,this.boundHandleBrowserEvent_),this.mapBrowserEventHandler_.dispose(),this.mapBrowserEventHandler_=null,this.viewport_.remove()}if(this.targetElement_&&!ri(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(ri(e)||e.appendChild(this.viewport_),this.renderer_||(this.renderer_=new Hm(this)),!ri(e)){this.mapBrowserEventHandler_=new xm(this,this.moveTolerance_);for(const s in at)this.mapBrowserEventHandler_.addEventListener(at[s],this.handleMapBrowserEvent.bind(this));this.viewport_.addEventListener(W.CONTEXTMENU,this.boundHandleBrowserEvent_,!1),this.viewport_.addEventListener(W.WHEEL,this.boundHandleBrowserEvent_,Sh?{passive:!1}:!1);let i;if(this.keyboardEventTarget_)i=this.keyboardEventTarget_;else{const s=e.getRootNode();i=s instanceof ShadowRoot?s.host:e}if(this.targetChangeHandlerKeys_=[U(i,W.KEYDOWN,this.handleBrowserEvent,this),U(i,W.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_&&(st(this.viewPropertyListenerKey_),this.viewPropertyListenerKey_=null),this.viewChangeListenerKey_&&(st(this.viewChangeListenerKey_),this.viewChangeListenerKey_=null);const t=this.getView();t&&(this.updateViewportSize_(this.getSize()),this.viewPropertyListenerKey_=U(t,Ki.PROPERTYCHANGE,this.handleViewPropertyChanged_,this),this.viewChangeListenerKey_=U(t,W.CHANGE,this.handleViewPropertyChanged_,this),t.resolveConstraints(0)),this.render()}handleLayerGroupChanged_(){this.layerGroupPropertyListenerKeys_&&(this.layerGroupPropertyListenerKeys_.forEach(st),this.layerGroupPropertyListenerKeys_=null);const t=this.getLayerGroup();t&&(this.handleLayerAdd_(new fi("addlayer",t)),this.layerGroupPropertyListenerKeys_=[U(t,Ki.PROPERTYCHANGE,this.render,this),U(t,W.CHANGE,this.render,this),U(t,"addlayer",this.handleLayerAdd_,this),U(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){Yc(t.layer)}removeOverlay(t){return this.getOverlays().remove(t)}renderFrame_(t){const e=this.getSize(),i=this.getView(),s=this.frameState_;let r=null;if(e!==void 0&&ec(e)&&i&&i.isDef()){const o=i.getHints(this.frameState_?this.frameState_.viewHints:void 0),a=i.getState();if(r={animate:!1,coordinateToPixelTransform:this.coordinateToPixelTransform_,declutter:null,extent:ro(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:j(this),renderTargets:{}},a.nextCenter&&a.nextResolution){const l=isNaN(a.nextRotation)?a.rotation:a.nextRotation;r.nextExtent=ro(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_||!Vs(this.previousExtent_)&&!Gn(r.extent,this.previousExtent_))&&(this.dispatchEvent(new gn(We.MOVESTART,this,s)),this.previousExtent_=Ks(this.previousExtent_)),this.previousExtent_&&!r.viewHints[vt.ANIMATING]&&!r.viewHints[vt.INTERACTING]&&!Gn(r.extent,this.previousExtent_)&&(this.dispatchEvent(new gn(We.MOVEEND,this,r)),Pl(r.extent,this.previousExtent_))),this.dispatchEvent(new gn(We.POSTRENDER,this,r)),this.renderComplete_=(this.hasListener(We.LOADSTART)||this.hasListener(We.LOADEND)||this.hasListener(ee.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 fi("removelayer",e)),this.set(wt.LAYERGROUP,t)}setSize(t){this.set(wt.SIZE,t)}setTarget(t){this.set(wt.TARGET,t)}setView(t){if(!t||t instanceof we){this.set(wt.VIEW,t);return}this.set(wt.VIEW,new we);const e=this;t.then(function(i){e.setView(new we(i))})}updateSize(){const t=this.getTargetElement();let e;if(t){let s,r;if(ri(t))s=t.width,r=t.height;else{const o=getComputedStyle(t);s=t.offsetWidth-parseFloat(o.borderLeftWidth)-parseFloat(o.paddingLeft)-parseFloat(o.paddingRight)-parseFloat(o.borderRightWidth),r=t.offsetHeight-parseFloat(o.borderTopWidth)-parseFloat(o.paddingTop)-parseFloat(o.paddingBottom)-parseFloat(o.borderBottomWidth)}!isNaN(s)&&!isNaN(r)&&(e=[Math.max(0,s),Math.max(0,r)],!ec(e)&&(t.offsetWidth||t.offsetHeight||t.getClientRects().length)&&Kl("No map visible because the map container's width or height are 0."))}const i=this.getSize();e&&(!i||!ti(e,i))&&(this.setSize(e),this.updateViewportSize_(e))}updateViewportSize_(t){const e=this.getView();e&&e.setViewportSize(t)}};function Jm(n){let t=null;n.keyboardEventTarget!==void 0&&(t=typeof n.keyboardEventTarget=="string"?document.getElementById(n.keyboardEventTarget):n.keyboardEventTarget);const e={},i=n.layers&&typeof n.layers.getLayers=="function"?n.layers:new mn({layers:n.layers});e[wt.LAYERGROUP]=i,e[wt.TARGET]=n.target,e[wt.VIEW]=n.view instanceof we?n.view:new we;let s;n.controls!==void 0&&(Array.isArray(n.controls)?s=new Jt(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 Jt(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 Jt(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 Jt,{controls:s,interactions:r,keyboardEventTarget:t,overlays:o,values:e}}const Ct={ELEMENT:"element",MAP:"map",OFFSET:"offset",POSITION:"position",POSITIONING:"positioning"};class Qm extends ue{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 "+yg,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(Ct.ELEMENT,this.handleElementChanged),this.addChangeListener(Ct.MAP,this.handleMapChanged),this.addChangeListener(Ct.OFFSET,this.handleOffsetChanged),this.addChangeListener(Ct.POSITION,this.handlePositionChanged),this.addChangeListener(Ct.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(Ct.ELEMENT)}getId(){return this.id}getMap(){return this.get(Ct.MAP)||null}getOffset(){return this.get(Ct.OFFSET)}getPosition(){return this.get(Ct.POSITION)}getPositioning(){return this.get(Ct.POSITIONING)}handleElementChanged(){Lh(this.element);const t=this.getElement();t&&this.element.appendChild(t)}handleMapChanged(){this.mapPostrenderListenerKey&&(this.element?.remove(),st(this.mapPostrenderListenerKey),this.mapPostrenderListenerKey=null);const t=this.getMap();if(t){this.mapPostrenderListenerKey=U(t,We.POSTRENDER,this.render,this),this.updatePixelPosition();const e=this.stopEvent?t.getOverlayContainerStopEvent():t.getOverlayContainer();this.insertFirst?e.insertBefore(this.element,e.childNodes[0]||null):e.appendChild(this.element),this.performAutoPan()}}render(){this.updatePixelPosition()}handleOffsetChanged(){this.updatePixelPosition()}handlePositionChanged(){this.updatePixelPosition(),this.performAutoPan()}handlePositioningChanged(){this.updatePixelPosition()}setElement(t){this.set(Ct.ELEMENT,t)}setMap(t){this.set(Ct.MAP,t)}setOffset(t){this.set(Ct.OFFSET,t)}setPosition(t){this.set(Ct.POSITION,t)}performAutoPan(){this.autoPan&&this.panIntoView(this.autoPan)}panIntoView(t){const e=this.getMap();if(!e||!e.getTargetElement()||!this.get(Ct.POSITION))return;const i=this.getRect(e.getTargetElement(),e.getSize()),s=this.getElement(),r=this.getRect(s,[eg(s),ig(s)]);t=t||{};const o=t.margin===void 0?20:t.margin;if(!Ui(i,r)){const a=r[0]-i[0],l=i[2]-r[2],h=r[1]-i[1],c=i[3]-r[3],u=[0,0];if(a<0?u[0]=a-o:l<0&&(u[0]=Math.abs(l)+o),h<0?u[1]=h-o:c<0&&(u[1]=Math.abs(c)+o),u[0]!==0||u[1]!==0){const d=e.getView().getCenterInternal(),f=e.getPixelFromCoordinateInternal(d);if(!f)return;const g=[f[0]+u[0],f[1]+u[1]],m=t.animation||{};e.getView().animateInternal({center:e.getCoordinateFromPixelInternal(g),duration:m.duration,easing:m.easing})}}}getRect(t,e){const i=t.getBoundingClientRect(),s=i.left+window.pageXOffset,r=i.top+window.pageYOffset;return[s,r,s+e[0],r+e[1]]}setPositioning(t){this.set(Ct.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 ga{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 pn(n,t,e,i,s){return s!==void 0?(s.minX=n,s.maxX=t,s.minY=e,s.maxY=i,s):new ga(n,t,e,i)}let _a;const yn=[];function Kc(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 ma(n,t){return Math.abs(n[t*4]-210)>2||Math.abs(n[t*4+3]-.75*255)>2}function tp(){if(_a===void 0){const n=ct(6,6,yn);n.globalCompositeOperation="lighter",n.fillStyle="rgba(210, 0, 0, 0.75)",Kc(n,4,5,4,0),Kc(n,4,5,0,5);const t=n.getImageData(0,0,3,3).data;_a=ma(t,0)||ma(t,4)||ma(t,8),hr(n),yn.push(n.canvas)}return _a}function Bc(n,t,e,i){const s=Yn(e,t,n);let r=rh(t,i,e);const o=t.getMetersPerUnit();o!==void 0&&(r*=o);const a=n.getMetersPerUnit();a!==void 0&&(r/=a);const l=n.getExtent();if(!l||Zi(l,s)){const h=rh(n,r,s)/r;isFinite(h)&&h>0&&(r/=h)}return r}function ep(n,t,e,i){const s=wi(e);let r=Bc(n,t,s,i);return(!isFinite(r)||r<=0)&&Gl(e,function(o){return r=Bc(n,t,o,i),isFinite(r)&&r>0}),r}function ip(n,t,e,i,s,r,o,a,l,h,c,u,d,f){const g=ct(Math.round(e*n),Math.round(e*t),yn);if(u||(g.imageSmoothingEnabled=!1),l.length===0)return g.canvas;g.scale(e,e);function m(E){return Math.round(E*e)/e}g.globalCompositeOperation="lighter";const _=$t();l.forEach(function(E,T,I){kl(_,E.extent)});let p;const y=e/i,w=(u?1:1+Math.pow(2,-24))/y;p=ct(Math.round(tt(_)*y),Math.round(Lt(_)*y),yn),u||(p.imageSmoothingEnabled=!1),l.forEach(function(E,T,I){if(E.image.width>0&&E.image.height>0){if(E.clipExtent){p.save();const F=(E.clipExtent[0]-_[0])*y,A=-(E.clipExtent[3]-_[3])*y,L=tt(E.clipExtent)*y,M=Lt(E.clipExtent)*y;p.rect(u?F:Math.round(F),u?A:Math.round(A),u?L:Math.round(F+L)-Math.round(F),u?M:Math.round(A+M)-Math.round(A)),p.clip()}const v=(E.extent[0]-_[0])*y,R=-(E.extent[3]-_[3])*y,b=tt(E.extent)*y,O=Lt(E.extent)*y;p.drawImage(E.image,h,h,E.image.width-2*h,E.image.height-2*h,u?v:Math.round(v),u?R:Math.round(R),u?b:Math.round(v+b)-Math.round(v),u?O:Math.round(R+O)-Math.round(R)),E.clipExtent&&p.restore()}});const x=Ri(o);return a.getTriangles().forEach(function(E,T,I){const v=E.source,R=E.target;let b=v[0][0],O=v[0][1],F=v[1][0],A=v[1][1],L=v[2][0],M=v[2][1];const P=m((R[0][0]-x[0])/r),X=m(-(R[0][1]-x[1])/r),D=m((R[1][0]-x[0])/r),k=m(-(R[1][1]-x[1])/r),K=m((R[2][0]-x[0])/r),H=m(-(R[2][1]-x[1])/r),S=b,_t=O;b=0,O=0,F-=S,A-=_t,L-=S,M-=_t;const dt=[[F,A,0,0,D-P],[L,M,0,0,K-P],[0,0,F,A,k-X],[0,0,L,M,H-X]],nt=Ud(dt);if(!nt)return;if(g.save(),g.beginPath(),tp()||!u){g.moveTo(D,k);const ht=4,Mt=P-D,pe=X-k;for(let Bt=0;Bt<ht;Bt++)g.lineTo(D+m((Bt+1)*Mt/ht),k+m(Bt*pe/(ht-1))),Bt!=ht-1&&g.lineTo(D+m((Bt+1)*Mt/ht),k+m((Bt+1)*pe/(ht-1)));g.lineTo(K,H)}else g.moveTo(D,k),g.lineTo(P,X),g.lineTo(K,H);g.clip(),g.transform(nt[0],nt[2],nt[1],nt[3],P,X),g.translate(_[0]-S,_[3]-_t);let mt;if(p)mt=p.canvas,g.scale(w,-w);else{const ht=l[0],Mt=ht.extent;mt=ht.image,g.scale(tt(Mt)/mt.width,-Lt(Mt)/mt.height)}g.drawImage(mt,0,0),g.restore()}),p&&(hr(p),yn.push(p.canvas)),c&&(g.save(),g.globalCompositeOperation="source-over",g.strokeStyle="black",g.lineWidth=1,a.getTriangles().forEach(function(E,T,I){const v=E.target,R=(v[0][0]-x[0])/r,b=-(v[0][1]-x[1])/r,O=(v[1][0]-x[0])/r,F=-(v[1][1]-x[1])/r,A=(v[2][0]-x[0])/r,L=-(v[2][1]-x[1])/r;g.beginPath(),g.moveTo(O,F),g.lineTo(R,b),g.lineTo(A,L),g.closePath(),g.stroke()}),g.restore()),g.canvas}const np=10,Zc=.25;class sp{constructor(t,e,i,s,r,o,a){this.sourceProj_=t,this.targetProj_=e;let l={};const h=a?Tf(w=>gt(a,Yn(w,this.targetProj_,this.sourceProj_))):rr(this.targetProj_,this.sourceProj_);this.transformInv_=function(w){const x=w[0]+"/"+w[1];return l[x]||(l[x]=h(w)),l[x]},this.maxSourceExtent_=s,this.errorThresholdSquared_=r*r,this.triangles_=[],this.wrapsXInSource_=!1,this.canWrapXInSource_=this.sourceProj_.canWrapX()&&!!s&&!!this.sourceProj_.getExtent()&&tt(s)>=tt(this.sourceProj_.getExtent()),this.sourceWorldWidth_=this.sourceProj_.getExtent()?tt(this.sourceProj_.getExtent()):null,this.targetWorldWidth_=this.targetProj_.getExtent()?tt(this.targetProj_.getExtent()):null;const c=Ri(i),u=Us(i),d=Zs(i),f=Bs(i),g=this.transformInv_(c),m=this.transformInv_(u),_=this.transformInv_(d),p=this.transformInv_(f),y=np+(o?Math.max(0,Math.ceil(Math.log2(so(i)/(o*o*256*256)))):0);if(this.addQuad_(c,u,d,f,g,m,_,p,y),this.wrapsXInSource_){let w=1/0;this.triangles_.forEach(function(x,E,T){w=Math.min(w,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])-w>this.sourceWorldWidth_/2){const E=[[x.source[0][0],x.source[0][1]],[x.source[1][0],x.source[1][1]],[x.source[2][0],x.source[2][1]]];E[0][0]-w>this.sourceWorldWidth_/2&&(E[0][0]-=this.sourceWorldWidth_),E[1][0]-w>this.sourceWorldWidth_/2&&(E[1][0]-=this.sourceWorldWidth_),E[2][0]-w>this.sourceWorldWidth_/2&&(E[2][0]-=this.sourceWorldWidth_);const T=Math.min(E[0][0],E[1][0],E[2][0]);Math.max(E[0][0],E[1][0],E[2][0])-T<this.sourceWorldWidth_/2&&(x.source=E)}})}l={}}addTriangle_(t,e,i,s,r,o){this.triangles_.push({source:[s,r,o],target:[t,e,i]})}addQuad_(t,e,i,s,r,o,a,l,h){const c=Ml([r,o,a,l]),u=this.sourceWorldWidth_?tt(c)/this.sourceWorldWidth_:null,d=this.sourceWorldWidth_,f=this.sourceProj_.canWrapX()&&u>.5&&u<1;let g=!1;if(h>0){if(this.targetProj_.isGlobal()&&this.targetWorldWidth_){const _=Ml([t,e,i,s]);g=tt(_)/this.targetWorldWidth_>Zc||g}!f&&this.sourceProj_.isGlobal()&&u&&(g=u>Zc||g)}if(!g&&this.maxSourceExtent_&&isFinite(c[0])&&isFinite(c[1])&&isFinite(c[2])&&isFinite(c[3])&&!Ft(c,this.maxSourceExtent_))return;let m=0;if(!g&&(!isFinite(r[0])||!isFinite(r[1])||!isFinite(o[0])||!isFinite(o[1])||!isFinite(a[0])||!isFinite(a[1])||!isFinite(l[0])||!isFinite(l[1]))){if(h>0)g=!0;else if(m=(!isFinite(r[0])||!isFinite(r[1])?8:0)+(!isFinite(o[0])||!isFinite(o[1])?4:0)+(!isFinite(a[0])||!isFinite(a[1])?2:0)+(!isFinite(l[0])||!isFinite(l[1])?1:0),m!=1&&m!=2&&m!=4&&m!=8)return}if(h>0){if(!g){const _=[(t[0]+i[0])/2,(t[1]+i[1])/2],p=this.transformInv_(_);let y;f?y=(ji(r[0],d)+ji(a[0],d))/2-ji(p[0],d):y=(r[0]+a[0])/2-p[0];const w=(r[1]+a[1])/2-p[1];g=y*y+w*w>this.errorThresholdSquared_}if(g){if(Math.abs(t[0]-i[0])<=Math.abs(t[1]-i[1])){const _=[(e[0]+i[0])/2,(e[1]+i[1])/2],p=this.transformInv_(_),y=[(s[0]+t[0])/2,(s[1]+t[1])/2],w=this.transformInv_(y);this.addQuad_(t,e,_,y,r,o,p,w,h-1),this.addQuad_(y,_,i,s,w,p,a,l,h-1)}else{const _=[(t[0]+e[0])/2,(t[1]+e[1])/2],p=this.transformInv_(_),y=[(i[0]+s[0])/2,(i[1]+s[1])/2],w=this.transformInv_(y);this.addQuad_(t,_,y,s,r,p,w,l,h-1),this.addQuad_(_,e,i,y,p,o,a,w,h-1)}return}}if(f){if(!this.canWrapXInSource_)return;this.wrapsXInSource_=!0}(m&11)==0&&this.addTriangle_(t,i,s,r,a,l),(m&14)==0&&this.addTriangle_(t,i,e,r,a,o),m&&((m&13)==0&&this.addTriangle_(e,s,t,o,l,r),(m&7)==0&&this.addTriangle_(e,s,i,o,l,a))}calculateSourceExtent(){const t=$t();return this.triangles_.forEach(function(e,i,s){const r=e.source;zn(t,r[0]),zn(t,r[1]),zn(t,r[2])}),t}getTriangles(){return this.triangles_}}const rp=.5;class Uc extends oa{constructor(t,e,i,s,r,o,a,l,h,c,u,d){super(r,G.IDLE,d),this.renderEdges_=u!==void 0?u:!1,this.pixelRatio_=a,this.gutter_=l,this.canvas_=null,this.sourceTileGrid_=e,this.targetTileGrid_=s,this.wrappedTileCoord_=o||r,this.sourceTiles_=[],this.sourcesListenerKeys_=null,this.sourceZ_=0,this.clipExtent_=t.canWrapX()?t.getExtent():void 0;const f=s.getTileCoordExtent(this.wrappedTileCoord_),g=this.targetTileGrid_.getExtent();let m=this.sourceTileGrid_.getExtent();const _=g?Ci(f,g):f;if(so(_)===0){this.state=G.EMPTY;return}const p=t.getExtent();p&&(m?m=Ci(m,p):m=p);const y=s.getResolution(this.wrappedTileCoord_[0]),w=ep(t,i,_,y);if(!isFinite(w)||w<=0){this.state=G.EMPTY;return}const x=c!==void 0?c:rp;if(this.triangulation_=new sp(t,i,_,m,w*x,y),this.triangulation_.getTriangles().length===0){this.state=G.EMPTY;return}this.sourceZ_=e.getZForResolution(w);let E=this.triangulation_.calculateSourceExtent();if(m&&(t.canWrapX()?(E[1]=ot(E[1],m[1],m[3]),E[3]=ot(E[3],m[1],m[3])):E=Ci(E,m)),!so(E))this.state=G.EMPTY;else{let T=0,I=0;t.canWrapX()&&(T=tt(p),I=Math.floor((E[0]-p[0])/T)),Wl(E.slice(),t,!0).forEach(R=>{const b=e.getTileRangeForExtentAndZ(R,this.sourceZ_);for(let O=b.minX;O<=b.maxX;O++)for(let F=b.minY;F<=b.maxY;F++){const A=h(this.sourceZ_,O,F,a);if(A){const L=I*T;this.sourceTiles_.push({tile:A,offset:L})}}++I}),this.sourceTiles_.length===0&&(this.state=G.EMPTY)}}getImage(){return this.canvas_}reproject_(){const t=[];if(this.sourceTiles_.forEach(e=>{const i=e.tile;if(i&&i.getState()==G.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=G.ERROR;else{const e=this.wrappedTileCoord_[0],i=this.targetTileGrid_.getTileSize(e),s=typeof i=="number"?i:i[0],r=typeof i=="number"?i:i[1],o=this.targetTileGrid_.getResolution(e),a=this.sourceTileGrid_.getResolution(this.sourceZ_),l=this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_);this.canvas_=ip(s,r,this.pixelRatio_,a,this.sourceTileGrid_.getExtent(),o,l,this.triangulation_,t,this.gutter_,this.renderEdges_,this.interpolate),this.state=G.LOADED}this.changed()}load(){if(this.state==G.IDLE){this.state=G.LOADING,this.changed();let t=0;this.sourcesListenerKeys_=[],this.sourceTiles_.forEach(({tile:e})=>{const i=e.getState();if(i==G.IDLE||i==G.LOADING){t++;const s=U(e,W.CHANGE,r=>{const o=e.getState();(o==G.LOADED||o==G.ERROR||o==G.EMPTY)&&(st(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()==G.IDLE&&e.load()})}}unlistenSources_(){this.sourcesListenerKeys_.forEach(st),this.sourcesListenerKeys_=null}release(){this.canvas_&&(hr(this.canvas_.getContext("2d")),yn.push(this.canvas_),this.canvas_=null),super.release()}}function Ar(n,t,e,i){return i!==void 0?(i[0]=n,i[1]=t,i[2]=e,i):[n,t,e]}function op(n,t,e){return n+"/"+t+"/"+e}function Mr(n,t,e,i,s){return`${j(n)},${t},${op(e,i,s)}`}function ap(n){return lp(n[0],n[1],n[2])}function lp(n,t,e){return(t<<n)+e}function hp(n,t){const e=n[0],i=n[1],s=n[2];if(t.getMinZoom()>e||e>t.getMaxZoom())return!1;const r=t.getFullTileRange(e);return r?r.containsXY(i,s):!0}const xn=[0,0,0],gi=5;class Vc{constructor(t){this.minZoom=t.minZoom!==void 0?t.minZoom:0,this.resolutions_=t.resolutions,Q(Nd(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_=Ri(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:ia,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 ga(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=pn(o,o,a,a,i)):r=this.getTileRangeForExtentAndZ(l,h,i),e(h,r))return!0;--h}return!1}getExtent(){return this.extent_}getMaxZoom(){return this.maxZoom}getMinZoom(){return this.minZoom}getOrigin(t){return this.origin_?this.origin_:this.origins_[t]}getResolution(t){return this.resolutions_[t]}getResolutions(){return this.resolutions_}getTileCoordChildTileRange(t,e,i){if(t[0]<this.maxZoom){if(this.zoomFactor_===2){const r=t[1]*2,o=t[2]*2;return pn(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 pn(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 pn(h,h,c,c,i);const u=Math.floor(l*(r+1))-1,d=Math.floor(l*(o+1))-1;return pn(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,xn);const s=xn[1],r=xn[2];this.getTileCoordForXYAndZ_(t[2],t[1],e,!0,xn);const o=xn[1],a=xn[2];return pn(s,o,r,a,i)}getTileCoordCenter(t){const e=this.getOrigin(t[0]),i=this.getResolution(t[0]),s=Gt(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=Gt(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 ei(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=Gt(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=qs(c,gi)-1,u=qs(u,gi)-1):(c=Hs(c,gi),u=Hs(u,gi)),Ar(o,c,u,r)}getTileCoordForXYAndZ_(t,e,i,s,r){const o=this.getOrigin(i),a=this.getResolution(i),l=Gt(this.getTileSize(i),this.tmpSize_);let h=(t-o[0])/a/l[0],c=(o[1]-e)/a/l[1];return s?(h=qs(h,gi)-1,c=qs(c,gi)-1):(h=Hs(h,gi),c=Hs(c,gi)),Ar(i,h,c,r)}getTileCoordForCoordAndZ(t,e,i){return this.getTileCoordForXYAndZ_(t[0],t[1],e,!1,i)}getTileCoordResolution(t){return this.resolutions_[t[0]]}getTileSize(t){return this.tileSize_?this.tileSize_:this.tileSizes_[t]}getFullTileRange(t){return this.fullTileRanges_?this.fullTileRanges_[t]:this.extent_?this.getTileRangeForExtentAndZ(this.extent_,t):null}getZForResolution(t,e){const i=Jr(this.resolutions_,t,e||0);return ot(i,this.minZoom,this.maxZoom)}tileCoordIntersectsViewport(t,e){return vh(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 jc(n){let t=n.getDefaultTileGrid();return t||(t=fp(n),n.setDefaultTileGrid(t)),t}function cp(n,t,e){const i=t[0],s=n.getTileCoordCenter(t),r=pa(e);if(!Zi(r,s)){const o=tt(r),a=Math.ceil((r[0]-s[0])/o);return s[0]+=o*a,n.getTileCoordForCoordAndZ(s,i)}return t}function up(n,t,e,i){i=i!==void 0?i:"top-left";const s=Hc(n,t,e);return new Vc({extent:n,origin:$d(n,i),resolutions:s,tileSize:e})}function dp(n){const t=n||{},e=t.extent||kt("EPSG:3857").getExtent(),i={extent:e,minZoom:t.minZoom,tileSize:t.tileSize,resolutions:Hc(e,t.maxZoom,t.tileSize,t.maxResolution)};return new Vc(i)}function Hc(n,t,e,i){t=t!==void 0?t:cm,e=Gt(e!==void 0?e:ia);const s=Lt(n),r=tt(n);i=i>0?i:Math.max(r/e[0],s/e[1]);const o=t+1,a=new Array(o);for(let l=0;l<o;++l)a[l]=i/Math.pow(2,l);return a}function fp(n,t,e,i){const s=pa(n);return up(s,t,e,i)}function pa(n){n=kt(n);let t=n.getExtent();if(!t){const e=180*lo.degrees/n.getMetersPerUnit();t=ei(-e,-e,e,e)}return t}const gp=/\{z\}/g,_p=/\{x\}/g,mp=/\{y\}/g,pp=/\{-y\}/g;function yp(n,t,e,i,s){return n.replace(gp,t.toString()).replace(_p,e.toString()).replace(mp,i.toString()).replace(pp,function(){if(s===void 0)throw new Error("If the URL template has a {-y} placeholder, the grid extent must be known");return(s-i).toString()})}function xp(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 Ep(n,t){return(function(e,i,s){if(!e)return;let r;const o=e[0];if(t){const a=t.getFullTileRange(o);a&&(r=a.getHeight()-1)}return yp(n,o,e[1],e[2],r)})}function vp(n,t){const e=n.length,i=new Array(e);for(let s=0;s<e;++s)i[s]=Ep(n[s],t);return wp(i)}function wp(n){return n.length===1?n[0]:(function(t,e,i){if(!t)return;const s=ap(t),r=ji(s,n.length);return n[r](t,e,i)})}class Cp extends Qh{constructor(t){super({attributions:t.attributions,attributionsCollapsible:t.attributionsCollapsible,projection:t.projection,state:t.state,wrapX:t.wrapX,interpolate:t.interpolate}),this.on,this.once,this.un,this.tilePixelRatio_=t.tilePixelRatio!==void 0?t.tilePixelRatio:1,this.tileGrid=t.tileGrid!==void 0?t.tileGrid:null;const e=[256,256];this.tileGrid&&Gt(this.tileGrid.getTileSize(this.tileGrid.getMinZoom()),e),this.tmpSize=[0,0],this.key_=t.key||j(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 V()}getTileGrid(){return this.tileGrid}getTileGridForProjection(t){return this.tileGrid?this.tileGrid:jc(t)}getTilePixelRatio(t){return this.tilePixelRatio_}getTilePixelSize(t,e,i){const s=this.getTileGridForProjection(i),r=this.getTilePixelRatio(e),o=Gt(s.getTileSize(t),this.tmpSize);return r==1?o:Hg(o,r,this.tmpSize)}getTileCoordForTileUrlFunction(t,e){const i=e!==void 0?e:this.getProjection(),s=e!==void 0?this.getTileGridForProjection(i):this.tileGrid||this.getTileGridForProjection(i);return this.getWrapX()&&i.isGlobal()&&(t=cp(s,t,i)),hp(t,s)?t:null}clear(){}refresh(){this.clear(),super.refresh()}}class Rp extends Pe{constructor(t,e){super(t),this.tile=e}}const ya={TILELOADSTART:"tileloadstart",TILELOADEND:"tileloadend",TILELOADERROR:"tileloaderror"};class xa extends Cp{constructor(t){super({attributions:t.attributions,cacheSize:t.cacheSize,projection:t.projection,state:t.state,tileGrid:t.tileGrid,tilePixelRatio:t.tilePixelRatio,wrapX:t.wrapX,transition:t.transition,interpolate:t.interpolate,key:t.key,attributionsCollapsible:t.attributionsCollapsible,zDirection:t.zDirection}),this.generateTileUrlFunction_=this.tileUrlFunction===xa.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=j(e),s=e.getState();let r;s==G.LOADING?(this.tileLoadingKeys_[i]=!0,r=ya.TILELOADSTART):i in this.tileLoadingKeys_&&(delete this.tileLoadingKeys_[i],r=s==G.ERROR?ya.TILELOADERROR:s==G.LOADED?ya.TILELOADEND:void 0),r!=null&&this.dispatchEvent(new Rp(r,e))}setTileLoadFunction(t){this.tileLoadFunction=t,this.changed()}setTileUrlFunction(t,e){this.tileUrlFunction=t,typeof e<"u"?this.setKey(e):this.changed()}setUrl(t){const e=xp(t);this.urls=e,this.setUrls(e)}setUrls(t){this.urls=t;const e=t.join(`
|
|
8
|
+
`);this.generateTileUrlFunction_?this.setTileUrlFunction(vp(t,this.tileGrid),e):this.setKey(e)}tileUrlFunction(t,e,i){}}class Tp extends xa{constructor(t){super({attributions:t.attributions,cacheSize:t.cacheSize,projection:t.projection,state:t.state,tileGrid:t.tileGrid,tileLoadFunction:t.tileLoadFunction?t.tileLoadFunction:qc,tilePixelRatio:t.tilePixelRatio,tileUrlFunction:t.tileUrlFunction,url:t.url,urls:t.urls,wrapX:t.wrapX,transition:t.transition,interpolate:t.interpolate!==void 0?t.interpolate:!0,key:t.key,attributionsCollapsible:t.attributionsCollapsible,zDirection:t.zDirection}),this.crossOrigin=t.crossOrigin!==void 0?t.crossOrigin:null,this.tileClass=t.tileClass!==void 0?t.tileClass:kc,this.tileGridForProjection={},this.reprojectionErrorThreshold_=t.reprojectionErrorThreshold,this.renderReprojectionEdges_=!1}getGutterForProjection(t){return this.getProjection()&&t&&!sr(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||sr(e,t)))return this.tileGrid;const i=j(t);return i in this.tileGridForProjection||(this.tileGridForProjection[i]=jc(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?G.IDLE:G.EMPTY,h!==void 0?h:"",this.crossOrigin,this.tileLoadFunction,this.tileOptions);return c.key=o,c.addEventListener(W.CHANGE,this.handleTileChange.bind(this)),c}getTile(t,e,i,s,r,o){const a=this.getProjection();if(!a||!r||sr(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 Uc(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=Mr(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=kt(t);if(i){const s=j(i);s in this.tileGridForProjection||(this.tileGridForProjection[s]=e)}}}function qc(n,t){if(Kt){const e=n.getCrossOrigin();let i="same-origin",s="same-origin";e==="anonymous"||e===""?(i="cors",s="omit"):e==="use-credentials"&&(i="cors",s="include"),fetch(t,{mode:i,credentials:s}).then(r=>{if(!r.ok)throw new Error(`HTTP ${r.status}`);return r.blob()}).then(r=>createImageBitmap(r)).then(r=>{const o=n.getImage();o.width=r.width,o.height=r.height,o.getContext("2d").drawImage(r,0,0),r.close?.(),o.dispatchEvent(new Event("load"))}).catch(()=>{n.getImage().dispatchEvent(new Event("error"))});return}n.getImage().src=t}class Jc extends Tp{constructor(t){t=t||{};const e=t.projection!==void 0?t.projection:"EPSG:3857",i=t.tileGrid!==void 0?t.tileGrid:dp({extent:pa(e),maxResolution:t.maxResolution,maxZoom:t.maxZoom,minZoom:t.minZoom,tileSize:t.tileSize});super({attributions:t.attributions,cacheSize:t.cacheSize,crossOrigin:t.crossOrigin,interpolate:t.interpolate,projection:e,reprojectionErrorThreshold:t.reprojectionErrorThreshold,tileGrid:i,tileLoadFunction:t.tileLoadFunction,tilePixelRatio:t.tilePixelRatio,tileUrlFunction:t.tileUrlFunction,url:t.url,urls:t.urls,wrapX:t.wrapX!==void 0?t.wrapX:!0,transition:t.transition,attributionsCollapsible:t.attributionsCollapsible,zDirection:t.zDirection}),this.gutter_=t.gutter!==void 0?t.gutter:0}getGutter(){return this.gutter_}}const Ip='© <a href="https://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap</a> contributors.';class Sp extends Jc{constructor(t){t=t||{};let e;t.attributions!==void 0?e=t.attributions:e=[Ip];const i=t.crossOrigin!==void 0?t.crossOrigin:"anonymous",s=t.url!==void 0?t.url:"https://tile.openstreetmap.org/{z}/{x}/{y}.png";super({attributions:e,attributionsCollapsible:!1,cacheSize:t.cacheSize,crossOrigin:i,interpolate:t.interpolate,maxZoom:t.maxZoom!==void 0?t.maxZoom:19,reprojectionErrorThreshold:t.reprojectionErrorThreshold,tileLoadFunction:(r,o)=>{const a=r.getImage();!Kt&&a instanceof HTMLImageElement&&(a.referrerPolicy="origin-when-cross-origin"),(t.tileLoadFunction||qc)(r,o)},transition:t.transition,url:s,wrapX:t.wrapX,zDirection:t.zDirection})}}function Ea(n){return n instanceof Image||n instanceof HTMLCanvasElement||n instanceof HTMLVideoElement||n instanceof ImageBitmap?n:null}const bp=new Error("disposed"),Lp=[256,256];class Qc extends oa{constructor(t){const e=G.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=Ea(this.data_);return t?[t.width,t.height]:Lp}getData(){return this.data_}getError(){return this.error_}load(){if(this.state!==G.IDLE&&this.state!==G.ERROR)return;this.state=G.LOADING,this.changed();const t=this;this.loader_().then(function(e){t.data_=e,t.state=G.LOADED,t.changed()}).catch(function(e){t.error_=e,t.state=G.ERROR,t.changed()})}disposeInternal(){this.controller_&&(this.controller_.abort(bp),this.controller_=null),super.disposeInternal()}}class tu{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 zs&&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 va(n,t,e){if(!(e in n))return n[e]=new Set([t]),!0;const i=n[e],s=i.has(t);return s||i.add(t),!s}function Ap(n,t,e){const i=n[e];return i?i.delete(t):!1}function eu(n,t){const e=n.layerStatesArray[n.layerIndex];e.extent&&(t=Ci(t,ni(e.extent,n.viewState.projection)));const i=e.layer.getRenderSource();if(!i.getWrapX()){const s=i.getTileGridForProjection(n.viewState.projection).getExtent();s&&(t=Ci(t,s))}return t}class Mp extends gc{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=$t(),this.tempTileRange_=new ga(0,0,0,0),this.tempTileCoord_=Ar(0,0,0);const i=e.cacheSize!==void 0?e.cacheSize:512;this.tileCache_=new tu(i),this.sourceTileCache_=null,this.maxStaleKeys=i*.5}getTileCache(){return this.tileCache_}getSourceTileCache(){return this.sourceTileCache_||(this.sourceTileCache_=new tu(512)),this.sourceTileCache_}getOrCreateTile(t,e,i,s){const r=this.tileCache_,a=this.getLayer().getSource(),l=Mr(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||sr(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=gt(e.pixelToCoordinateTransform,t.slice()),r=i.getExtent();if(r&&!Zi(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()!==G.LOADED)continue;const f=l.getOrigin(c),g=Gt(l.getTileSize(c)),m=l.getResolution(c);let _;if(d instanceof kc||d instanceof Uc)_=d.getImage();else if(d instanceof Qc){if(_=Ea(d.getData()),!_)continue}else continue;const p=Math.floor(h*((s[0]-f[0])/m-u[1]*g[0])),y=Math.floor(h*((f[1]-s[1])/m-u[2]*g[1])),w=Math.round(h*a.getGutterForProjection(o.projection));return this.getImageData(_,p+w,y+w)}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=j(l);c in t.wantedTiles||(t.wantedTiles[c]={});const u=t.wantedTiles[c],d=a.getMapInternal(),f=Math.max(i-r,h.getMinZoom(),h.getZForResolution(Math.min(a.getMaxResolution(),d?d.getView().getResolutionForZoom(Math.max(a.getMinZoom(),0)):h.getResolution(0)),l.zDirection)),g=o.rotation,m=g?zl(o.center,o.resolution,g,t.size):void 0;for(let _=i;_>=f;--_){const p=h.getTileRangeForExtentAndZ(e,_,this.tempTileRange_),y=h.getResolution(_);for(let w=p.minX;w<=p.maxX;++w)for(let x=p.minY;x<=p.maxY;++x){if(g&&!h.tileCoordIntersectsViewport([_,w,x],m))continue;const E=this.getTile(_,w,x,t);if(!E||!va(s,E,_))continue;const I=E.getKey();if(u[I]=!0,E.getState()===G.IDLE&&!t.tileQueue.isKeyQueued(I)){const v=Ar(_,w,x,this.tempTileCoord_);t.tileQueue.enqueue([E,c,h.getTileCoordCenter(v),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=Mr(this.getLayer().getSource(),a[l],s,r,o);if(i.containsKey(h)){const c=i.peek(h);if(c.getState()===G.LOADED)return c.endTransition(j(this)),va(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=Mr(l,h,i,c,u);let f=!1;if(a.containsKey(d)){const g=a.peek(d);g.getState()===G.LOADED&&(va(s,g,i),f=!0)}f||(o=!1)}return o}renderFrame(t,e){this.renderComplete=!0;const i=t.layerStatesArray[t.layerIndex],s=t.viewState,r=s.projection,o=s.resolution,a=s.center,l=t.pixelRatio,h=this.getLayer(),c=h.getSource(),u=c.getTileGridForProjection(r),d=u.getZForResolution(o,c.zDirection),f=u.getResolution(d),g=c.getKey();this.renderedSourceKey_?this.renderedSourceKey_!==g&&(this.prependStaleKey(this.renderedSourceKey_),this.renderedSourceKey_=g):this.renderedSourceKey_=g;let m=t.extent;const _=c.getTilePixelRatio(l);this.prepareContainer(t,e);const p=this.context.canvas.width,y=this.context.canvas.height,w=i.extent&&ni(i.extent);w&&(m=Ci(m,ni(i.extent)));const x=f*p/2/_,E=f*y/2/_,T=[a[0]-x,a[1]-E,a[0]+x,a[1]+E],I={};this.renderedTiles.length=0;const v=h.getPreload();if(t.nextExtent&&this.enqueueTilesForNextExtent()){const D=u.getZForResolution(s.nextResolution,c.zDirection),k=eu(t,t.nextExtent);this.enqueueTiles(t,k,D,I,v)}const R=eu(t,m);if(this.enqueueTiles(t,R,d,I,0),v>0&&setTimeout(()=>{this.enqueueTiles(t,R,d-1,I,v-1)},0),!(d in I))return this.container;const b=j(this),O=t.time;for(const D of I[d]){const k=D.getState();if(k===G.EMPTY)continue;const K=D.tileCoord;if(k===G.LOADED&&D.getAlpha(b,O)===1){D.endTransition(b);continue}if(k!==G.ERROR&&(this.renderComplete=!1),this.findStaleTile_(K,I)){Ap(I,D,d),t.animate=!0;continue}if(this.findAltTiles_(u,K,d+1,I))continue;const _t=u.getMinZoom();for(let dt=d-1;dt>=_t&&!this.findAltTiles_(u,K,dt,I);--dt);}const F=f/o*l/_,A=this.getRenderContext(t);De(this.tempTransform,p/2,y/2,F,F,0,-p/2,-y/2),i.extent&&this.clipUnrotated(A,t,w),c.getInterpolate()||(A.imageSmoothingEnabled=!1),this.preRender(A,t);const L=Object.keys(I).map(Number);L.sort(Me);let M;const P=[],X=[];for(let D=L.length-1;D>=0;--D){const k=L[D],K=c.getTilePixelSize(k,l,r),S=u.getResolution(k)/f,_t=K[0]*S*F,dt=K[1]*S*F,nt=u.getTileCoordForCoordAndZ(Ri(T),k),mt=u.getTileCoordExtent(nt),ht=gt(this.tempTransform,[_*(mt[0]-T[0])/f,_*(T[3]-mt[3])/f]),Mt=_*c.getGutterForProjection(r);for(const pe of I[k]){if(pe.getState()!==G.LOADED)continue;const Bt=pe.tileCoord,Or=nt[1]-Bt[1],wa=Math.round(ht[0]-(Or-1)*_t),gs=nt[2]-Bt[2],Ni=Math.round(ht[1]-(gs-1)*dt),se=Math.round(ht[0]-Or*_t),Ce=Math.round(ht[1]-gs*dt),En=wa-se,vn=Ni-Ce,_s=L.length===1;let Gi=!1;M=[se,Ce,se+En,Ce,se+En,Ce+vn,se,Ce+vn];for(let wn=0,Cn=P.length;wn<Cn;++wn)if(!_s&&k<X[wn]){const pt=P[wn];Ft([se,Ce,se+En,Ce+vn],[pt[0],pt[3],pt[4],pt[7]])&&(Gi||(A.save(),Gi=!0),A.beginPath(),A.moveTo(M[0],M[1]),A.lineTo(M[2],M[3]),A.lineTo(M[4],M[5]),A.lineTo(M[6],M[7]),A.moveTo(pt[6],pt[7]),A.lineTo(pt[4],pt[5]),A.lineTo(pt[2],pt[3]),A.lineTo(pt[0],pt[1]),A.clip())}P.push(M),X.push(k),this.drawTile(pe,t,se,Ce,En,vn,Mt,_s),Gi&&A.restore(),this.renderedTiles.unshift(pe),this.updateUsedTiles(t.usedTiles,c,pe)}}if(this.renderedResolution=f,this.extentChanged=!this.renderedExtent_||!Gn(this.renderedExtent_,T),this.renderedExtent_=T,this.renderedPixelRatio=l,this.postRender(this.context,t),i.extent&&A.restore(),A.imageSmoothingEnabled=!0,this.renderComplete){const D=(k,K)=>{const H=j(c),S=K.wantedTiles[H],_t=S?Object.keys(S).length:0;this.updateCacheSize(_t),this.tileCache_.expireCache(),this.sourceTileCache_?.expireCache()};t.postRenderFunctions.push(D)}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 Qc){if(h=Ea(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=j(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=j(e);s in t||(t[s]={}),t[s][i.getKey()]=!0}}const Pr={PRELOAD:"preload",USE_INTERIM_TILES_ON_ERROR:"useInterimTilesOnError"};class Pp extends br{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(Pr.PRELOAD)}setPreload(t){this.set(Pr.PRELOAD,t)}getUseInterimTilesOnError(){return this.get(Pr.USE_INTERIM_TILES_ON_ERROR)}setUseInterimTilesOnError(t){this.set(Pr.USE_INTERIM_TILES_ON_ERROR,t)}getData(t){return super.getData(t)}}class iu extends Pp{constructor(t){super(t)}createRenderer(){return new Mp(this,{cacheSize:this.getCacheSize()})}}const nu=`
|
|
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 Op(n,t=100,e={}){if(typeof n!="function")throw new TypeError(`Expected the first parameter to be a function, got \`${typeof n}\`.`);if(t<0)throw new RangeError("`wait` must not be negative.");if(typeof e=="boolean")throw new TypeError("The `options` parameter must be an object, not a boolean. Use `{immediate: true}` instead.");const{immediate:i}=e;let s,r,o,a,l;function h(){const d=s,f=r;return s=void 0,r=void 0,l=n.apply(d,f),l}function c(){const d=Date.now()-a;d<t&&d>=0?o=setTimeout(c,t-d):(o=void 0,i||(l=h()))}const u=function(...d){if(s&&this!==s&&Object.getPrototypeOf(this)===Object.getPrototypeOf(s))throw new Error("Debounced method called with different contexts of the same prototype.");s=this,r=d,a=Date.now();const f=i&&!o;if(o||(o=setTimeout(c,t)),f)return l=h(),l};return Object.defineProperty(u,"isPending",{get(){return o!==void 0}}),u.clear=()=>{o&&(clearTimeout(o),o=void 0,s=void 0,r=void 0)},u.flush=()=>{o&&u.trigger()},u.trigger=()=>{l=h(),u.clear()},u}var Dp=
|
|
330
|
+
`;function Op(n,t=100,e={}){if(typeof n!="function")throw new TypeError(`Expected the first parameter to be a function, got \`${typeof n}\`.`);if(t<0)throw new RangeError("`wait` must not be negative.");if(typeof e=="boolean")throw new TypeError("The `options` parameter must be an object, not a boolean. Use `{immediate: true}` instead.");const{immediate:i}=e;let s,r,o,a,l;function h(){const d=s,f=r;return s=void 0,r=void 0,l=n.apply(d,f),l}function c(){const d=Date.now()-a;d<t&&d>=0?o=setTimeout(c,t-d):(o=void 0,i||(l=h()))}const u=function(...d){if(s&&this!==s&&Object.getPrototypeOf(this)===Object.getPrototypeOf(s))throw new Error("Debounced method called with different contexts of the same prototype.");s=this,r=d,a=Date.now();const f=i&&!o;if(o||(o=setTimeout(c,t)),f)return l=h(),l};return Object.defineProperty(u,"isPending",{get(){return o!==void 0}}),u.clear=()=>{o&&(clearTimeout(o),o=void 0,s=void 0,r=void 0)},u.flush=()=>{o&&u.trigger()},u.trigger=()=>{l=h(),u.clear()},u}var Dp=wd('<div id="map" style="width: 100%; height: 100%;"></div> <div id="popup" class="ol-popup"><button id="popup-closer" class="ol-popup-closer" aria-label="Close popup"></button> <div id="popup-content"></div></div>',1);const Fp={hash:"svelte-1nwnfh0",code:":host {display:block;height:200px;width:200px;}"};function su(n,t){Ka(t,!0),bd(n,Fp);function e(v,R){t.$$host.dispatchEvent(new CustomEvent(v,{detail:R}))}let i=jt(null),s=jt(null),r=jt(void 0),o=jt(null),a,l=vi(t,"id",7,""),h=vi(t,"center",23,()=>[37.5176038,15.0819224]),c=vi(t,"zoom",7,6),u=vi(t,"source",23,()=>({type:"osm"})),d=vi(t,"options",23,()=>({})),f=vi(t,"data",23,()=>[]),g=vi(t,"screenshot",7,"");Ur(()=>{let v=!1;typeof u()=="string"&&(u(JSON.parse(u())),v=!0),d()&&typeof d()=="string"&&(d(JSON.parse(d())),v=!0),typeof c()=="string"&&(c(Number(c())),v=!0),typeof h()=="string"&&(h(JSON.parse(h())),v=!0),typeof f()=="string"&&(f(JSON.parse(f())),v=!0),v&&p()}),Ur(()=>{g()==="yes"&&Z(i)&&m()});function m(){!Z(i)||!Z(s)||(Z(i).once("rendercomplete",function(){const v=Z(i).getSize();if(!v)return;const R=document.createElement("canvas");R.width=v[0],R.height=v[1];const b=R.getContext("2d");if(!b)return;Z(s).querySelectorAll(".ol-layer canvas").forEach(function(A){if(A.width>0){const M=A.parentNode?.style?.opacity;b.globalAlpha=!M||M===""?1:Number(M);const X=A.style.transform.match(/^matrix\(([^)]*)\)$/);if(X){const D=X[1].split(",").map(Number);b.setTransform(D[0],D[1],D[2],D[3],D[4],D[5])}b.drawImage(A,0,0)}}),b.globalAlpha=1,b.setTransform(1,0,0,1,0,0);const F=R.toDataURL("image/png");e("screenshotTaken",{base64:F})}),Z(i).renderSync())}function _(v){const R=Yn(v.coordinate,"EPSG:3857","EPSG:4326"),b=Z(i)?.getView?.()?.getCenter?.(),O=Yn(b||h(),"EPSG:3857","EPSG:4326"),F=Z(i)?.getView?.()?.getZoom?.()||c(),A=Z(i)?.forEachFeatureAtPixel(v.pixel,function(L,M){return L});A&&A.get("marker")?(e("markerClick",{coordinates:{latitude:R[1],longitude:R[0]},id:A.get("id")}),A.get("popupHtml")&&Z(o)?.innerHTML&&(Z(o).innerHTML=A.get("popupHtml"),a?.setPosition(v.coordinate))):(a?.setPosition(void 0),e("pointClickCoordinates",{coordinates:{latitude:R[1],longitude:R[0]},zoom:F,center:O}))}function p(){if(Z(s)){if(Z(i)){Ot(i,null);const O=document.createElement("style");O.innerHTML=nu,Z(s).innerHTML="",Z(s).appendChild(O)}const v=[];u().type.toLowerCase()==="osm"?v.push(new iu({source:new Sp})):u().type.toLowerCase()==="xyz"&&u().url&&v.push(new iu({source:new Jc({url:u().url})}));let R=[],b=$t();if(f()?.filter?.(O=>O.marker)?.length){const O=[];for(const L of f().filter(M=>M.marker).map(M=>M.marker)){const M=new to({geometry:L?.lngLat?new ar(xo(L.lngLat)):void 0,icon:L?.icon,marker:!0,id:L?.id||void 0,popupHtml:L?.popupHtml,label:L?.text,textPosition:L?.text_position||"right",textOffset:L?.text_offset});O.push(M);const P=M.getGeometry()?.getCoordinates();L?.lngLat&&R.push(L.lngLat),d().centerFromGeometries&&P&&P[2]!==-1/0&&P[3]!==-1/0&&(console.log("coords",P),b=kl(b,P))}const F=new Ee({image:new hn({scale:3,anchor:[.5,.8],src:"https://upload.wikimedia.org/wikipedia/commons/e/e7/Maki2-marker-18.svg"})}),A=new mm({source:new jg({features:O}),style(L){const M=L.get("icon"),P=L.get("label"),X=L.get("textPosition")||"right",D=L.get("textOffset");let k={offsetX:0,offsetY:0,textAlign:"center",textBaseline:"middle"};if(M?.uri&&P){const H=M.scale||.15,S=M.anchor?.[0]??.5,_t=M.anchor?.[1]??.8,dt=H>=1?18*H:150*H,nt=-(_t-.5)*dt,mt=-(S-.5)*dt,ht=D??6,Mt=dt/2;switch(X){case"right":k.offsetX=mt+Mt+ht,k.offsetY=nt+3,k.textAlign="left",k.textBaseline="middle";break;case"left":k.offsetX=mt-Mt-ht,k.offsetY=nt+3,k.textAlign="right",k.textBaseline="middle";break;case"top":k.offsetX=mt,k.offsetY=nt-Mt-ht,k.textAlign="center",k.textBaseline="bottom";break;case"bottom":k.offsetX=mt,k.offsetY=nt+Mt+ht,k.textAlign="center",k.textBaseline="top";break}}const K=P?new sc({text:P,font:"13px sans-serif",fill:new Mi({color:"#333"}),stroke:new is({color:"#fff",width:3}),...k}):void 0;return M?.uri?new Ee({image:new hn({scale:M.scale||.15,anchor:M.anchor||[.5,.8],src:M.uri,opacity:M.opacity||1,color:M.color||void 0}),text:K}):P?new Ee({text:K}):F}});v.push(A)}a=new Qm({element:Z(r),autoPan:{animation:{duration:250}}}),Ot(i,new qm({target:Z(s),layers:v,overlays:[a],view:new we({center:xo(h()),zoom:c()})}),!0),d()?.centerFromGeometries&&R&&R.length>1&&b[2]!==-1/0&&b[3]!==-1/0?(console.log("extent",b),Z(i).getView().fit(b,{padding:[25,25,25,25]})):d()?.centerFromGeometries&&Z(i).getView().setCenter(xo(R[0])),Z(i).on("singleclick",function(O){_(O)})}}function y(v){a?.setPosition(void 0),v?.target?.blur?.()}Sd(()=>{Ot(s,t.$$host?.shadowRoot?.querySelector("#map"),!0),Ot(r,t.$$host?.shadowRoot?.querySelector("#popup"),!0),Ot(o,t.$$host?.shadowRoot?.querySelector("#popup-content"),!0);const v=document.createElement("style");v.innerHTML=nu,Z(s)?.appendChild(v),p()});var w={get id(){return l()},set id(v=""){l(v),je()},get center(){return h()},set center(v=[37.5176038,15.0819224]){h(v),je()},get zoom(){return c()},set zoom(v=6){c(v),je()},get source(){return u()},set source(v={type:"osm"}){u(v),je()},get options(){return d()},set options(v={}){d(v),je()},get data(){return f()},set data(v=[]){f(v),je()},get screenshot(){return g()},set screenshot(v=""){g(v),je()}},x=Dp(),E=ju(()=>Op(p,200));xd("resize",Kr,function(...v){Z(E)?.apply(this,v)});var T=id(ed(x),2),I=td(T);return I.__click=v=>y(v),Wa(2),zu(T),Rl(n,x),Ba(w)}Ed(["click"]),customElements.define("hb-map",Od(su,{id:{},center:{},zoom:{},source:{},options:{},data:{},screenshot:{}},[],[],!0)),ba.Component=su,Object.defineProperty(ba,Symbol.toStringTag,{value:"Module"})})(this.map=this.map||{});
|
|
331
331
|
//# sourceMappingURL=main.iife.js.map
|