@arenarium/maps 1.1.3 → 1.2.1
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/dist/main.cjs.js +1 -1
- package/dist/main.d.ts +125 -362
- package/dist/main.es.js +2548 -4477
- package/dist/main.umd.js +1 -0
- package/dist/style.css +1 -1
- package/package.json +25 -58
- package/dist/attribution-3vg4I3xA.cjs +0 -1
- package/dist/attribution-BYiDRQF4.js +0 -4
- package/dist/google.cjs.js +0 -1
- package/dist/google.d.ts +0 -311
- package/dist/google.es.js +0 -166
- package/dist/index.css +0 -1
- package/dist/index.d.ts +0 -630
- package/dist/index.js +0 -1
- package/dist/mapbox.cjs.js +0 -1
- package/dist/mapbox.d.ts +0 -250
- package/dist/mapbox.es.js +0 -63
- package/dist/maplibre.cjs.js +0 -1
- package/dist/maplibre.d.ts +0 -250
- package/dist/maplibre.es.js +0 -1791
package/dist/main.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var Rs=Object.defineProperty;var rn=r=>{throw TypeError(r)};var Ns=(r,e,t)=>e in r?Rs(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var f=(r,e,t)=>Ns(r,typeof e!="symbol"?e+"":e,t),sr=(r,e,t)=>e.has(r)||rn("Cannot "+t);var k=(r,e,t)=>(sr(r,e,"read from private field"),t?t.call(r):e.get(r)),D=(r,e,t)=>e.has(r)?rn("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),j=(r,e,t,n)=>(sr(r,e,"write to private field"),n?n.call(r,t):e.set(r,t),t),Re=(r,e,t)=>(sr(r,e,"access private method"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Rn=!1;var Nn=Array.isArray,Is=Array.prototype.indexOf,Ps=Array.from,ur=Object.defineProperty,pt=Object.getOwnPropertyDescriptor,Ls=Object.prototype,Ds=Array.prototype,Zs=Object.getPrototypeOf,nn=Object.isExtensible;function js(r){for(var e=0;e<r.length;e++)r[e]()}function Fs(){var r,e,t=new Promise((n,s)=>{r=n,e=s});return{promise:t,resolve:r,reject:e}}const X=2,Pr=4,In=8,Nt=16,Ae=32,Fe=64,Pn=128,K=256,Bt=512,W=1024,se=2048,Oe=4096,nt=8192,ut=16384,Lr=32768,zs=65536,sn=1<<17,Vs=1<<18,It=1<<19,Us=1<<20,cr=1<<21,Dr=1<<22,Le=1<<23,Ft=Symbol("$state"),Zr=new class extends Error{constructor(){super(...arguments);f(this,"name","StaleReactionError");f(this,"message","The reaction that called `getAbortSignal()` was re-run or destroyed")}};function Bs(){throw new Error("https://svelte.dev/e/await_outside_boundary")}function $s(){throw new Error("https://svelte.dev/e/async_derived_orphan")}function qs(r){throw new Error("https://svelte.dev/e/effect_in_teardown")}function Ws(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function Hs(r){throw new Error("https://svelte.dev/e/effect_orphan")}function Ys(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function Xs(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function Gs(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function Js(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}const Ks=2,F=Symbol();function Ln(r){return r===this.v}let Qs=!1,ae=null;function $t(r){ae=r}function jr(r,e=!1,t){ae={p:ae,c:null,e:null,s:r,x:null,l:null}}function Fr(r){var e=ae,t=e.e;if(t!==null){e.e=null;for(var n of t)Jn(n)}return r!==void 0&&(e.x=r),ae=e.p,r??{}}function Dn(){return!0}const ea=new WeakMap;function ta(r){var e=M;if(e===null)return S.f|=Le,r;if((e.f&Lr)===0){if((e.f&Pn)===0)throw!e.parent&&r instanceof Error&&Zn(r),r;e.b.error(r)}else zr(r,e)}function zr(r,e){for(;e!==null;){if((e.f&Pn)!==0)try{e.b.error(r);return}catch(t){r=t}e=e.parent}throw r instanceof Error&&Zn(r),r}function Zn(r){const e=ea.get(r);e&&(ur(r,"message",{value:e.message}),ur(r,"stack",{value:e.stack}))}let qe=[];function ra(){var r=qe;qe=[],js(r)}function jn(r){if(qe.length===0){var e=qe;queueMicrotask(()=>{e===qe&&ra()})}qe.push(r)}function na(){const r=M.b;return r===null&&Bs(),r}function sa(r){var e=X|se,t=S!==null&&(S.f&X)!==0?S:null;return M===null||t!==null&&(t.f&K)!==0?e|=K:M.f|=It,{ctx:ae,deps:null,effects:null,equals:Ln,f:e,fn:r,reactions:null,rv:0,v:F,wv:0,parent:t??M,ac:null}}function aa(r,e){let t=M;t===null&&$s();var n=t.b,s=void 0,a=Bn(F),i=null,o=!S;return ga(()=>{try{var l=r();i&&Promise.resolve(l).catch(()=>{})}catch(m){l=Promise.reject(m)}var u=()=>l;s=(i==null?void 0:i.then(u,u))??Promise.resolve(l),i=s;var c=U,p=n.is_pending();o&&(n.update_pending_count(1),p||c.increment());const g=(m,y=void 0)=>{i=null,p||c.activate(),y?y!==Zr&&(a.f|=Le,hr(a,y)):((a.f&Le)!==0&&(a.f^=Le),hr(a,m)),o&&(n.update_pending_count(-1),p||c.decrement()),Vn()};if(s.then(g,m=>g(null,m||"unknown")),c)return()=>{queueMicrotask(()=>c.neuter())}}),new Promise(l=>{function u(c){function p(){c===s?l(a):u(s)}c.then(p,p)}u(s)})}function Fn(r){var e=r.effects;if(e!==null){r.effects=null;for(var t=0;t<e.length;t+=1)je(e[t])}}function ia(r){for(var e=r.parent;e!==null;){if((e.f&X)===0)return e;e=e.parent}return null}function Vr(r){var e,t=M;Te(ia(r));try{Fn(r),e=os(r)}finally{Te(t)}return e}function zn(r){var e=Vr(r);if(r.equals(e)||(r.v=e,r.wv=as()),!ct){var t=(ke||(r.f&K)!==0)&&r.deps!==null?Oe:W;Q(r,t)}}function oa(r,e,t){const n=sa;if(e.length===0){t(r.map(n));return}var s=U,a=M,i=la(),o=na();Promise.all(e.map(l=>aa(l))).then(l=>{s==null||s.activate(),i();try{t([...r.map(n),...l])}catch(u){(a.f&ut)===0&&zr(u,a)}s==null||s.deactivate(),Vn()}).catch(l=>{o.error(l)})}function la(){var r=M,e=S,t=ae,n=U;return function(){Te(r),de(e),$t(t),n==null||n.activate()}}function Vn(){Te(null),de(null),$t(null)}const ar=new Set;let U=null,an=new Set,gt=[],Ur=null,dr=!1;var Tt,Qe,we,Ct,Mt,Ne,et,Ie,xe,tt,At,Ot,ne,Un,zt,fr;const Jt=class Jt{constructor(){D(this,ne);f(this,"current",new Map);D(this,Tt,new Map);D(this,Qe,new Set);D(this,we,0);D(this,Ct,null);D(this,Mt,!1);D(this,Ne,[]);D(this,et,[]);D(this,Ie,[]);D(this,xe,[]);D(this,tt,[]);D(this,At,[]);D(this,Ot,[]);f(this,"skipped_effects",new Set)}process(e){var s;gt=[];for(const a of e)Re(this,ne,Un).call(this,a);if(k(this,Ne).length===0&&k(this,we)===0){Re(this,ne,fr).call(this);var t=k(this,Ie),n=k(this,xe);j(this,Ie,[]),j(this,xe,[]),j(this,tt,[]),U=null,on(t),on(n),U===null?U=this:ar.delete(this),(s=k(this,Ct))==null||s.resolve()}else Re(this,ne,zt).call(this,k(this,Ie)),Re(this,ne,zt).call(this,k(this,xe)),Re(this,ne,zt).call(this,k(this,tt));for(const a of k(this,Ne))Je(a);for(const a of k(this,et))Je(a);j(this,Ne,[]),j(this,et,[])}capture(e,t){k(this,Tt).has(e)||k(this,Tt).set(e,t),this.current.set(e,e.v)}activate(){U=this}deactivate(){U=null;for(const e of an)if(an.delete(e),e(),U!==null)break}neuter(){j(this,Mt,!0)}flush(){gt.length>0?ua():Re(this,ne,fr).call(this),U===this&&(k(this,we)===0&&ar.delete(this),this.deactivate())}increment(){j(this,we,k(this,we)+1)}decrement(){if(j(this,we,k(this,we)-1),k(this,we)===0){for(const e of k(this,At))Q(e,se),wt(e);for(const e of k(this,Ot))Q(e,Oe),wt(e);j(this,Ie,[]),j(this,xe,[]),this.flush()}else this.deactivate()}add_callback(e){k(this,Qe).add(e)}settled(){return(k(this,Ct)??j(this,Ct,Fs())).promise}static ensure(){if(U===null){const e=U=new Jt;ar.add(U),Jt.enqueue(()=>{U===e&&e.flush()})}return U}static enqueue(e){jn(e)}};Tt=new WeakMap,Qe=new WeakMap,we=new WeakMap,Ct=new WeakMap,Mt=new WeakMap,Ne=new WeakMap,et=new WeakMap,Ie=new WeakMap,xe=new WeakMap,tt=new WeakMap,At=new WeakMap,Ot=new WeakMap,ne=new WeakSet,Un=function(e){var c;e.f^=W;for(var t=e.first;t!==null;){var n=t.f,s=(n&(Ae|Fe))!==0,a=s&&(n&W)!==0,i=a||(n&nt)!==0||this.skipped_effects.has(t);if(!i&&t.fn!==null){if(s)t.f^=W;else if((n&Pr)!==0)k(this,xe).push(t);else if((n&W)===0)if((n&Dr)!==0){var o=(c=t.b)!=null&&c.is_pending()?k(this,et):k(this,Ne);o.push(t)}else er(t)&&((t.f&Nt)!==0&&k(this,tt).push(t),Je(t));var l=t.first;if(l!==null){t=l;continue}}var u=t.parent;for(t=t.next;t===null&&u!==null;)t=u.next,u=u.parent}},zt=function(e){for(const t of e)((t.f&se)!==0?k(this,At):k(this,Ot)).push(t),Q(t,W);e.length=0},fr=function(){if(!k(this,Mt))for(const e of k(this,Qe))e();k(this,Qe).clear()};let yt=Jt;function ua(){var r=Ge;dr=!0;try{var e=0;for(un(!0);gt.length>0;){var t=yt.ensure();if(e++>1e3){var n,s;ca()}t.process(gt),Ee.clear()}}finally{dr=!1,un(r),Ur=null}}function ca(){try{Ys()}catch(r){zr(r,Ur)}}let pe=null;function on(r){var e=r.length;if(e!==0){for(var t=0;t<e;){var n=r[t++];if((n.f&(ut|nt))===0&&er(n)&&(pe=[],Je(n),n.deps===null&&n.first===null&&n.nodes_start===null&&(n.teardown===null&&n.ac===null?rs(n):n.fn=null),(pe==null?void 0:pe.length)>0)){Ee.clear();for(const s of pe)Je(s);pe=[]}}pe=null}}function wt(r){for(var e=Ur=r;e.parent!==null;){e=e.parent;var t=e.f;if(dr&&e===M&&(t&Nt)!==0)return;if((t&(Fe|Ae))!==0){if((t&W)===0)return;e.f^=W}}gt.push(e)}const Ee=new Map;function Bn(r,e){var t={f:0,v:r,reactions:null,equals:Ln,rv:0,wv:0};return t}function B(r,e){const t=Bn(r);return Ea(t),t}function z(r,e,t=!1){S!==null&&(!le||(S.f&sn)!==0)&&Dn()&&(S.f&(X|Nt|Dr|sn))!==0&&!(q!=null&&q.includes(r))&&Js();let n=t?ft(e):e;return hr(r,n)}function hr(r,e){if(!r.equals(e)){var t=r.v;ct?Ee.set(r,e):Ee.set(r,t),r.v=e;var n=yt.ensure();n.capture(r,t),(r.f&X)!==0&&((r.f&se)!==0&&Vr(r),Q(r,(r.f&K)===0?W:Oe)),r.wv=as(),$n(r,se),M!==null&&(M.f&W)!==0&&(M.f&(Ae|Fe))===0&&(J===null?Sa([r]):J.push(r))}return e}function ir(r){z(r,r.v+1)}function $n(r,e){var t=r.reactions;if(t!==null)for(var n=t.length,s=0;s<n;s++){var a=t[s],i=a.f,o=(i&se)===0;o&&Q(a,e),(i&X)!==0?$n(a,Oe):o&&((i&Nt)!==0&&pe!==null&&pe.push(a),wt(a))}}function ft(r){if(typeof r!="object"||r===null||Ft in r)return r;const e=Zs(r);if(e!==Ls&&e!==Ds)return r;var t=new Map,n=Nn(r),s=B(0),a=De,i=o=>{if(De===a)return o();var l=S,u=De;de(null),dn(a);var c=o();return de(l),dn(u),c};return n&&t.set("length",B(r.length)),new Proxy(r,{defineProperty(o,l,u){(!("value"in u)||u.configurable===!1||u.enumerable===!1||u.writable===!1)&&Xs();var c=t.get(l);return c===void 0?c=i(()=>{var p=B(u.value);return t.set(l,p),p}):z(c,u.value,!0),!0},deleteProperty(o,l){var u=t.get(l);if(u===void 0){if(l in o){const c=i(()=>B(F));t.set(l,c),ir(s)}}else z(u,F),ir(s);return!0},get(o,l,u){var m;if(l===Ft)return r;var c=t.get(l),p=l in o;if(c===void 0&&(!p||(m=pt(o,l))!=null&&m.writable)&&(c=i(()=>{var y=ft(p?o[l]:F),I=B(y);return I}),t.set(l,c)),c!==void 0){var g=N(c);return g===F?void 0:g}return Reflect.get(o,l,u)},getOwnPropertyDescriptor(o,l){var u=Reflect.getOwnPropertyDescriptor(o,l);if(u&&"value"in u){var c=t.get(l);c&&(u.value=N(c))}else if(u===void 0){var p=t.get(l),g=p==null?void 0:p.v;if(p!==void 0&&g!==F)return{enumerable:!0,configurable:!0,value:g,writable:!0}}return u},has(o,l){var g;if(l===Ft)return!0;var u=t.get(l),c=u!==void 0&&u.v!==F||Reflect.has(o,l);if(u!==void 0||M!==null&&(!c||(g=pt(o,l))!=null&&g.writable)){u===void 0&&(u=i(()=>{var m=c?ft(o[l]):F,y=B(m);return y}),t.set(l,u));var p=N(u);if(p===F)return!1}return c},set(o,l,u,c){var Z;var p=t.get(l),g=l in o;if(n&&l==="length")for(var m=u;m<p.v;m+=1){var y=t.get(m+"");y!==void 0?z(y,F):m in o&&(y=i(()=>B(F)),t.set(m+"",y))}if(p===void 0)(!g||(Z=pt(o,l))!=null&&Z.writable)&&(p=i(()=>B(void 0)),z(p,ft(u)),t.set(l,p));else{g=p.v!==F;var I=i(()=>ft(u));z(p,I)}var V=Reflect.getOwnPropertyDescriptor(o,l);if(V!=null&&V.set&&V.set.call(c,u),!g){if(n&&typeof l=="string"){var te=t.get("length"),O=Number(l);Number.isInteger(O)&&O>=te.v&&z(te,O+1)}ir(s)}return!0},ownKeys(o){N(s);var l=Reflect.ownKeys(o).filter(p=>{var g=t.get(p);return g===void 0||g.v!==F});for(var[u,c]of t)c.v!==F&&!(u in o)&&l.push(u);return l},setPrototypeOf(){Gs()}})}var ln,qn,Wn,Hn;function da(){if(ln===void 0){ln=window,qn=/Firefox/.test(navigator.userAgent);var r=Element.prototype,e=Node.prototype,t=Text.prototype;Wn=pt(e,"firstChild").get,Hn=pt(e,"nextSibling").get,nn(r)&&(r.__click=void 0,r.__className=void 0,r.__attributes=null,r.__style=void 0,r.__e=void 0),nn(t)&&(t.__t=void 0)}}function fa(r=""){return document.createTextNode(r)}function Yn(r){return Wn.call(r)}function Xn(r){return Hn.call(r)}function pr(r,e){return Yn(r)}function ha(r,e=1,t=!1){let n=r;for(;e--;)n=Xn(n);return n}function Gn(r){var e=S,t=M;de(null),Te(null);try{return r()}finally{de(e),Te(t)}}function pa(r){M===null&&S===null&&Hs(),S!==null&&(S.f&K)!==0&&M===null&&Ws(),ct&&qs()}function ma(r,e){var t=e.last;t===null?e.last=e.first=r:(t.next=r,r.prev=t,e.last=r)}function ze(r,e,t,n=!0){var s=M;s!==null&&(s.f&nt)!==0&&(r|=nt);var a={ctx:ae,deps:null,nodes_start:null,nodes_end:null,f:r|se,first:null,fn:e,last:null,next:null,parent:s,b:s&&s.b,prev:null,teardown:null,transitions:null,wv:0,ac:null};if(t)try{Je(a),a.f|=Lr}catch(l){throw je(a),l}else e!==null&&wt(a);if(n){var i=a;if(t&&i.deps===null&&i.teardown===null&&i.nodes_start===null&&i.first===i.last&&(i.f&It)===0&&(i=i.first),i!==null&&(i.parent=s,s!==null&&ma(i,s),S!==null&&(S.f&X)!==0&&(r&Fe)===0)){var o=S;(o.effects??(o.effects=[])).push(i)}}return a}function oe(r){pa();var e=M.f,t=!S&&(e&Ae)!==0&&(e&Lr)===0;if(t){var n=ae;(n.e??(n.e=[])).push(r)}else return Jn(r)}function Jn(r){return ze(Pr|Us,r,!1)}function va(r){yt.ensure();const e=ze(Fe|It,r,!0);return(t={})=>new Promise(n=>{t.outro?ka(e,()=>{je(e),n(void 0)}):(je(e),n(void 0))})}function _a(r){return ze(Pr,r,!1)}function ga(r){return ze(Dr|It,r,!0)}function Kn(r,e=0){return ze(In|e,r,!0)}function Qn(r,e=[],t=[]){oa(e,t,n=>{ze(In,()=>r(...n.map(N)),!0)})}function ya(r,e=!0){return ze(Ae|It,r,!0,e)}function es(r){var e=r.teardown;if(e!==null){const t=ct,n=S;cn(!0),de(null);try{e.call(null)}finally{cn(t),de(n)}}}function ts(r,e=!1){var t=r.first;for(r.first=r.last=null;t!==null;){const s=t.ac;s!==null&&Gn(()=>{s.abort(Zr)});var n=t.next;(t.f&Fe)!==0?t.parent=null:je(t,e),t=n}}function wa(r){for(var e=r.first;e!==null;){var t=e.next;(e.f&Ae)===0&&je(e),e=t}}function je(r,e=!0){var t=!1;(e||(r.f&Vs)!==0)&&r.nodes_start!==null&&r.nodes_end!==null&&(xa(r.nodes_start,r.nodes_end),t=!0),ts(r,e&&!t),qt(r,0),Q(r,ut);var n=r.transitions;if(n!==null)for(const a of n)a.stop();es(r);var s=r.parent;s!==null&&s.first!==null&&rs(r),r.next=r.prev=r.teardown=r.ctx=r.deps=r.fn=r.nodes_start=r.nodes_end=r.ac=null}function xa(r,e){for(;r!==null;){var t=r===e?null:Xn(r);r.remove(),r=t}}function rs(r){var e=r.parent,t=r.prev,n=r.next;t!==null&&(t.next=n),n!==null&&(n.prev=t),e!==null&&(e.first===r&&(e.first=n),e.last===r&&(e.last=t))}function ka(r,e){var t=[];ns(r,t,!0),ba(t,()=>{je(r),e&&e()})}function ba(r,e){var t=r.length;if(t>0){var n=()=>--t||e();for(var s of r)s.out(n)}else e()}function ns(r,e,t){if((r.f&nt)===0){if(r.f^=nt,r.transitions!==null)for(const i of r.transitions)(i.is_global||t)&&e.push(i);for(var n=r.first;n!==null;){var s=n.next,a=(n.f&zs)!==0||(n.f&Ae)!==0;ns(n,e,a?t:!1),n=s}}}let Ge=!1;function un(r){Ge=r}let ct=!1;function cn(r){ct=r}let S=null,le=!1;function de(r){S=r}let M=null;function Te(r){M=r}let q=null;function Ea(r){S!==null&&(q===null?q=[r]:q.push(r))}let $=null,Y=0,J=null;function Sa(r){J=r}let ss=1,xt=0,De=xt;function dn(r){De=r}let ke=!1;function as(){return++ss}function er(r){var p;var e=r.f;if((e&se)!==0)return!0;if((e&Oe)!==0){var t=r.deps,n=(e&K)!==0;if(t!==null){var s,a,i=(e&Bt)!==0,o=n&&M!==null&&!ke,l=t.length;if((i||o)&&(M===null||(M.f&ut)===0)){var u=r,c=u.parent;for(s=0;s<l;s++)a=t[s],(i||!((p=a==null?void 0:a.reactions)!=null&&p.includes(u)))&&(a.reactions??(a.reactions=[])).push(u);i&&(u.f^=Bt),o&&c!==null&&(c.f&K)===0&&(u.f^=K)}for(s=0;s<l;s++)if(a=t[s],er(a)&&zn(a),a.wv>r.wv)return!0}(!n||M!==null&&!ke)&&Q(r,W)}return!1}function is(r,e,t=!0){var n=r.reactions;if(n!==null&&!(q!=null&&q.includes(r)))for(var s=0;s<n.length;s++){var a=n[s];(a.f&X)!==0?is(a,e,!1):e===a&&(t?Q(a,se):(a.f&W)!==0&&Q(a,Oe),wt(a))}}function os(r){var I;var e=$,t=Y,n=J,s=S,a=ke,i=q,o=ae,l=le,u=De,c=r.f;$=null,Y=0,J=null,ke=(c&K)!==0&&(le||!Ge||S===null),S=(c&(Ae|Fe))===0?r:null,q=null,$t(r.ctx),le=!1,De=++xt,r.ac!==null&&(Gn(()=>{r.ac.abort(Zr)}),r.ac=null);try{r.f|=cr;var p=r.fn,g=p(),m=r.deps;if($!==null){var y;if(qt(r,Y),m!==null&&Y>0)for(m.length=Y+$.length,y=0;y<$.length;y++)m[Y+y]=$[y];else r.deps=m=$;if(!ke||(c&X)!==0&&r.reactions!==null)for(y=Y;y<m.length;y++)((I=m[y]).reactions??(I.reactions=[])).push(r)}else m!==null&&Y<m.length&&(qt(r,Y),m.length=Y);if(Dn()&&J!==null&&!le&&m!==null&&(r.f&(X|Oe|se))===0)for(y=0;y<J.length;y++)is(J[y],r);return s!==null&&s!==r&&(xt++,J!==null&&(n===null?n=J:n.push(...J))),(r.f&Le)!==0&&(r.f^=Le),g}catch(V){return ta(V)}finally{r.f^=cr,$=e,Y=t,J=n,S=s,ke=a,q=i,$t(o),le=l,De=u}}function Ta(r,e){let t=e.reactions;if(t!==null){var n=Is.call(t,r);if(n!==-1){var s=t.length-1;s===0?t=e.reactions=null:(t[n]=t[s],t.pop())}}t===null&&(e.f&X)!==0&&($===null||!$.includes(e))&&(Q(e,Oe),(e.f&(K|Bt))===0&&(e.f^=Bt),Fn(e),qt(e,0))}function qt(r,e){var t=r.deps;if(t!==null)for(var n=e;n<t.length;n++)Ta(r,t[n])}function Je(r){var e=r.f;if((e&ut)===0){Q(r,W);var t=M,n=Ge;M=r,Ge=!0;try{(e&Nt)!==0?wa(r):ts(r),es(r);var s=os(r);r.teardown=typeof s=="function"?s:null,r.wv=ss;var a;Rn&&Qs&&(r.f&se)!==0&&r.deps}finally{Ge=n,M=t}}}function N(r){var e=r.f,t=(e&X)!==0;if(S!==null&&!le){var n=M!==null&&(M.f&ut)!==0;if(!n&&!(q!=null&&q.includes(r))){var s=S.deps;if((S.f&cr)!==0)r.rv<xt&&(r.rv=xt,$===null&&s!==null&&s[Y]===r?Y++:$===null?$=[r]:(!ke||!$.includes(r))&&$.push(r));else{(S.deps??(S.deps=[])).push(r);var a=r.reactions;a===null?r.reactions=[S]:a.includes(S)||a.push(S)}}}else if(t&&r.deps===null&&r.effects===null){var i=r,o=i.parent;o!==null&&(o.f&K)===0&&(i.f^=K)}if(ct){if(Ee.has(r))return Ee.get(r);if(t){i=r;var l=i.v;return((i.f&W)===0&&i.reactions!==null||ls(i))&&(l=Vr(i)),Ee.set(i,l),l}}else t&&(i=r,er(i)&&zn(i));if((r.f&Le)!==0)throw r.v;return r.v}function ls(r){if(r.v===F)return!0;if(r.deps===null)return!1;for(const e of r.deps)if(Ee.has(e)||(e.f&X)!==0&&ls(e))return!0;return!1}function Ca(r){var e=le;try{return le=!0,r()}finally{le=e}}const Ma=-7169;function Q(r,e){r.f=r.f&Ma|e}const Aa=["touchstart","touchmove"];function Oa(r){return Aa.includes(r)}const Ra=new Set,fn=new Set;let hn=null;function jt(r){var O;var e=this,t=e.ownerDocument,n=r.type,s=((O=r.composedPath)==null?void 0:O.call(r))||[],a=s[0]||r.target;hn=r;var i=0,o=hn===r&&r.__root;if(o){var l=s.indexOf(o);if(l!==-1&&(e===document||e===window)){r.__root=e;return}var u=s.indexOf(e);if(u===-1)return;l<=u&&(i=l)}if(a=s[i]||r.target,a!==e){ur(r,"currentTarget",{configurable:!0,get(){return a||t}});var c=S,p=M;de(null),Te(null);try{for(var g,m=[];a!==null;){var y=a.assignedSlot||a.parentNode||a.host||null;try{var I=a["__"+n];if(I!=null&&(!a.disabled||r.target===a))if(Nn(I)){var[V,...te]=I;V.apply(a,[r,...te])}else I.call(a,r)}catch(Z){g?m.push(Z):g=Z}if(r.cancelBubble||y===e||y===null)break;a=y}if(g){for(let Z of m)queueMicrotask(()=>{throw Z});throw g}}finally{r.__root=e,delete r.currentTarget,de(c),Te(p)}}}function Na(r){var e=document.createElement("template");return e.innerHTML=r.replaceAll("<!>","<!---->"),e.content}function Ia(r,e){var t=M;t.nodes_start===null&&(t.nodes_start=r,t.nodes_end=e)}function us(r,e){var t=(e&Ks)!==0,n,s=!r.startsWith("<!>");return()=>{n===void 0&&(n=Na(s?r:"<!>"+r),n=Yn(n));var a=t||qn?document.importNode(n,!0):n.cloneNode(!0);return Ia(a,a),a}}function cs(r,e){r!==null&&r.before(e)}function Br(r,e){return Pa(r,e)}const Be=new Map;function Pa(r,{target:e,anchor:t,props:n={},events:s,context:a,intro:i=!0}){da();var o=new Set,l=p=>{for(var g=0;g<p.length;g++){var m=p[g];if(!o.has(m)){o.add(m);var y=Oa(m);e.addEventListener(m,jt,{passive:y});var I=Be.get(m);I===void 0?(document.addEventListener(m,jt,{passive:y}),Be.set(m,1)):Be.set(m,I+1)}}};l(Ps(Ra)),fn.add(l);var u=void 0,c=va(()=>{var p=t??e.appendChild(fa());return ya(()=>{if(a){jr({});var g=ae;g.c=a}s&&(n.$$events=s),u=r(p,n)||{},a&&Fr()}),()=>{var y;for(var g of o){e.removeEventListener(g,jt);var m=Be.get(g);--m===0?(document.removeEventListener(g,jt),Be.delete(g)):Be.set(g,m)}fn.delete(l),p!==t&&((y=p.parentNode)==null||y.removeChild(p))}});return La.set(u,c),u}let La=new WeakMap;function ds(r){var e,t,n="";if(typeof r=="string"||typeof r=="number")n+=r;else if(typeof r=="object")if(Array.isArray(r)){var s=r.length;for(e=0;e<s;e++)r[e]&&(t=ds(r[e]))&&(n&&(n+=" "),n+=t)}else for(t in r)r[t]&&(n&&(n+=" "),n+=t);return n}function Da(){for(var r,e,t=0,n="",s=arguments.length;t<s;t++)(r=arguments[t])&&(e=ds(r))&&(n&&(n+=" "),n+=e);return n}function fs(r){return typeof r=="object"?Da(r):r??""}function Za(r,e,t){var n=r==null?"":""+r;return e&&(n=n?n+" "+e:e),n===""?null:n}function ja(r,e){return r==null?null:String(r)}function hs(r,e,t,n,s,a){var i=r.__className;if(i!==t||i===void 0){var o=Za(t,n);o==null?r.removeAttribute("class"):r.className=o,r.__className=t}return a}function Wt(r,e,t,n){var s=r.__style;if(s!==e){var a=ja(e);a==null?r.removeAttribute("style"):r.style.cssText=a,r.__style=e}return n}const Fa=()=>performance.now(),ue={tick:r=>requestAnimationFrame(r),now:()=>Fa(),tasks:new Set};function ps(){const r=ue.now();ue.tasks.forEach(e=>{e.c(r)||(ue.tasks.delete(e),e.f())}),ue.tasks.size!==0&&ue.tick(ps)}function za(r){let e;return ue.tasks.size===0&&ue.tick(ps),{promise:new Promise(t=>{ue.tasks.add(e={c:r,f:t})}),abort(){ue.tasks.delete(e)}}}function pn(r,e){return r===e||(r==null?void 0:r[Ft])===e}function We(r={},e,t,n){return _a(()=>{var s,a;return Kn(()=>{s=a,a=[],Ca(()=>{r!==t(...a)&&(e(r,...a),s&&pn(t(...s),r)&&e(null,...s))})}),()=>{jn(()=>{a&&pn(t(...a),r)&&e(null,...a)})}}),r}const Va="5";var On;typeof window<"u"&&((On=window.__svelte??(window.__svelte={})).v??(On.v=new Set)).add(Va);function Ua(r){return r}function mr(r){return-.5*(Math.cos(Math.PI*r)-1)}function Ba(r){const e=Math.cos(r*Math.PI*.5);return Math.abs(e)<1e-14?1:1-e}function $a(r){return Math.sin(r*Math.PI/2)}const qa=128,Wa=0,Ha=1,Ya=2;class Xa{constructor(){f(this,"animationsStarted",!1);f(this,"animationsCount",0);f(this,"animationsLimit",qa);f(this,"layers",new Array)}start(){window.requestAnimationFrame(this.tick.bind(this))}tick(){try{this.animationsCount=0;for(let e=0;e<this.layers.length;e++){const t=this.layers[e];if(t==null)continue;const n=t.animations;if(n!=null)for(let s=0;s<n.length;s++){const a=n[s];if(a!=null){for(const i of a.values())if(!i.executed&&(i.executed=!0,i.function(),this.animationsCount++,this.animationsCount==this.animationsLimit))return}}}}catch{}finally{window.requestAnimationFrame(this.tick.bind(this))}}equeue(e,t,n,s){let a=this.layers[e];a==null&&(a=this.layers[e]={animations:new Array});let i=a.animations[t];i==null&&(i=a.animations[t]=new Map);let o={id:n,priority:t,executed:!1,function:s};i.set(n,o),this.animationsStarted==!1&&(this.animationsStarted=!0,this.start())}clear(e,t){for(let n=0;n<this.layers.length;n++){let s=this.layers[n];if(s==null)continue;let a=s.animations[e];if(a==null)return;let i=a.get(t);if(i==null||i.executed==!1)return;a.delete(t)}}speed(){return Math.pow(2,2*this.animationsCount/this.animationsLimit)}stacked(){return this.animationsCount==this.animationsLimit}setLimit(e){this.animationsLimit=e}}const ye=new Xa;function mn(r){return Object.prototype.toString.call(r)==="[object Date]"}function vr(r,e){if(r===e||r!==r)return()=>r;const t=typeof r;if(t!==typeof e||Array.isArray(r)!==Array.isArray(e))throw new Error("Cannot interpolate values of different type");if(Array.isArray(r)){const n=e.map((s,a)=>vr(r[a],s));return s=>n.map(a=>a(s))}if(t==="object"){if(!r||!e)throw new Error("Object cannot be null");if(mn(r)&&mn(e)){const a=r.getTime(),o=e.getTime()-a;return l=>new Date(a+l*o)}const n=Object.keys(e),s={};return n.forEach(a=>{s[a]=vr(r[a],e[a])}),a=>{const i={};return n.forEach(o=>{i[o]=s[o](a)}),i}}if(t==="number"){const n=e-r;return s=>r+s*n}return()=>e}var me,rt,Rt,Pe;const Gr=class Gr{constructor(e,t={}){D(this,me);D(this,rt);D(this,Rt);D(this,Pe,null);j(this,me,B(e)),j(this,rt,B(e)),j(this,Rt,t)}static of(e,t){const n=new Gr(e(),t);return Kn(()=>{n.set(e())}),n}set(e,t){var p;z(k(this,rt),e);let{delay:n=0,duration:s=400,easing:a=Ua,interpolate:i=vr}={...k(this,Rt),...t};if(s===0)return(p=k(this,Pe))==null||p.abort(),z(k(this,me),e),Promise.resolve();const o=ue.now()+n;let l,u=!1,c=k(this,Pe);return j(this,Pe,za(g=>{if(g<o)return!0;if(!u){u=!0;const y=k(this,me).v;l=i(y,e),typeof s=="function"&&(s=s(y,e)),c==null||c.abort()}const m=g-o;return m>s?(z(k(this,me),e),!1):(z(k(this,me),l(a(m/s))),!0)})),k(this,Pe).promise}get current(){return N(k(this,me))}get target(){return N(k(this,rt))}set target(e){this.set(e)}};me=new WeakMap,rt=new WeakMap,Rt=new WeakMap,Pe=new WeakMap;let _r=Gr;class Vt{constructor(e,t){f(this,"value");f(this,"motion");this.value=e,this.motion=new _r(e,t)}set(e,t){this.value=e,this.motion.set(e,t)}update(e){this.motion.set(this.value,e)}snap(){this.motion.set(this.value,{duration:0})}}var Ga=us('<div><div class="body svelte-zz3jrb"></div></div>');function Ja(r,e){jr(e,!0);let t,n;function s(){return n}let a=B(!1);function i(P){z(a,P,!0)}function o(){return N(a)}let l=B(!0),u=0,c=150;function p(P){P!=N(l)&&(z(l,P,!0),u=performance.now())}function g(){return performance.now()-u<c?y.motion.current==0:y.value==0}let m=0,y=new Vt(0,{easing:mr});oe(()=>{N(a)==!1&&(y.snap(),ye.clear(e.priority,e.id))}),oe(()=>{y.set(N(l)?0:m,{duration:75})}),oe(()=>{I(y.motion.current)});function I(P){t&&ye.equeue(e.layer,e.priority,e.id,()=>{t.style.scale=P.toString(),t.style.filter=`brightness(${.25+.75*P})`,n.style.opacity=P.toString()})}function V(P){P!=m&&(m=P,y.set(P,{duration:75}))}function te(){return y.value}var O={getBody:s,setDisplayed:i,getDisplayed:o,setCollapsed:p,getCollapsed:g,setScale:V,getScale:te},Z=Ga(),ie=pr(Z);return We(ie,P=>n=P,()=>n),We(Z,P=>t=P,()=>t),Qn(()=>{hs(Z,1,fs(["pin",N(a)&&"displayed"]),"svelte-zz3jrb"),Wt(Z,`width: ${e.width}px; height: ${e.height}px; border-radius: ${e.radius}px`),Wt(ie,`width: ${e.width-4}px; height: ${e.height-4}px; border-radius: ${e.radius-2}px`)}),cs(r,Z),Fr(O)}var mt;(r=>{function e(t,n,s){const a=t/2,i=n/2,o=Math.sqrt(a*a+i*i),l=Math.atan(i/a)*(180/Math.PI),u=s*(Math.PI/180);return s<180?s<90?s<l?{x:0,y:o*Math.sin(u)-i}:{x:o*Math.cos(u)-a,y:0}:s<180-l?{x:o*Math.cos(u)-a,y:0}:{x:-t,y:o*Math.sin(u)-i}:s<270?s<180+l?{x:-t,y:o*Math.sin(u)-i}:{x:o*Math.cos(u)-a,y:-n}:s<360-l?{x:o*Math.cos(u)-a,y:-n}:{x:0,y:o*Math.sin(u)-i}}r.getOffsets=e})(mt||(mt={}));var Ka=us('<div><div class="pointer svelte-11extwn"></div> <div class="bubble svelte-11extwn"><div class="body svelte-11extwn"></div></div></div>');function ms(r,e){jr(e,!0);let t,n,s,a;const i=e.width+2*e.margin,o=e.height+2*e.margin,l=()=>a;oe(()=>{s.style.width=`${e.margin*4}px`,s.style.height=`${e.margin*4}px`});let u=B(!0);function c(A){z(u,A,!0)}function p(){return N(u)}let g=B(!0),m=0,y=300;function I(A){A!=N(g)&&(z(g,A,!0),m=performance.now())}function V(){return performance.now()-m<y?O.motion.current==0:O.value==0}function te(){return performance.now()-m<y?O.motion.current==1:O.value==1}let O=new Vt(0);oe(()=>{N(u)==!1&&(O.snap(),ye.clear(e.priority,e.id+"_scale"))}),oe(()=>{N(g)==!0&&O.value!=0&&(ye.stacked()?O.set(0,{duration:0}):O.set(0,{duration:150,easing:Ba})),N(g)==!1&&O.value!=1&&O.set(1,{duration:150,easing:$a})}),oe(()=>{Z(O.motion.current)});function Z(A){!t||!n||!s||ye.equeue(N(g)?0:e.layer,e.priority,e.id+"_scale",()=>{t.style.opacity=`${A}`,n.style.scale=`${A}`,s.style.scale=`${A}`})}let ie=NaN,P=B(!1),_e=new Vt(-i/2,{easing:mr}),Pt=new Vt(-o/2,{easing:mr});oe(()=>{N(u)==!1&&(_e.snap(),_e.snap(),ye.clear(e.priority,e.id+"_angle"))}),oe(()=>{N(g)==!0&&N(P)&&(_e.update({duration:75}),_e.update({duration:75}))}),oe(()=>{Jr(_e.motion.current,Pt.motion.current)});function Jr(A,Dt){if(!t||!n||!s)return;const he=A+i/2,Zt=Dt+o/2,Ve=o<i?he*o/i:he,Ue=o>i?Zt*i/o:Zt,Ts=Math.atan2(Ue,Ve)/Math.PI*180-45,en=0,Cs=30,nr=Math.sqrt(Ve*Ve+Ue*Ue),dt=Math.min(i,o)/2,Ms=dt*Math.SQRT2,As=(nr-dt)/(Ms-dt),tn=en+As*(Cs-en),Os=nr<dt?nr/dt:1;ye.equeue(e.layer,e.priority,e.id+"_angle",()=>{n.style.transform=`translate(${Math.round(A)}px, ${Math.round(Dt)}px)`,s.style.transform=`scale(${Os}) rotate(${Ts}deg) skew(${tn}deg, ${tn}deg)`})}function bs(A,Dt){if(N(P)==!1||Dt==!0){let he=mt.getOffsets(i,o,A);_e.set(Math.round(he.x),{duration:0}),Pt.set(Math.round(he.y),{duration:0}),Jr(_e.value,Pt.value),ie=A,z(P,!0)}else if(A!=ie){let he=Math.abs(A-ie),Zt=he<180?he:360-he,Ve=Math.log(Zt)*75,Ue=mt.getOffsets(i,o,A);_e.set(Math.round(Ue.x),{duration:Ve}),Pt.set(Math.round(Ue.y),{duration:Ve}),ie=A}}function Es(){return mt.getOffsets(i,o,ie)}var Ss={getBody:l,setDisplayed:c,getDisplayed:p,setCollapsed:I,getCollapsed:V,getExpanded:te,setAngle:bs,getOffsets:Es},Lt=Ka(),Kr=pr(Lt);We(Kr,A=>s=A,()=>s);var rr=ha(Kr,2),Qr=pr(rr);return We(Qr,A=>a=A,()=>a),We(rr,A=>n=A,()=>n),We(Lt,A=>t=A,()=>t),Qn(()=>{hs(Lt,1,fs(["anchor",N(u)&&"displayed"]),"svelte-11extwn"),Wt(rr,`margin: ${e.margin}px;`),Wt(Qr,`width: ${e.width}px; height: ${e.height}px; border-radius: ${e.radius}px;`)}),cs(r,Lt),Fr(Ss)}var vt;(r=>{async function e(n,s){const a=await fetch(n,s);if(!a.ok)throw new Error(a.statusText);return a.json()}r.get=e;async function t(n,s,a){const i=await fetch(n,{method:"POST",body:JSON.stringify(s),headers:{"Content-Type":"application/json",...a==null?void 0:a.headers},...a});if(!i.ok)throw new Error(i.statusText);return i.json()}r.post=t})(vt||(vt={}));var He;(r=>{function e(o,l,u){return{x:n(l)*u,y:s(o)*u}}r.project=e;function t(o,l,u){return{lat:i(l/u),lng:a(o/u)}}r.unproject=t;function n(o){return(180+o)/360}function s(o){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+o*Math.PI/360)))/360}function a(o){return o*360-180}function i(o){return 360/Math.PI*Math.atan(Math.exp((180-o*360)*Math.PI/180))-90}})(He||(He={}));class vs{constructor(e,t,n,s,a){f(this,"swLat");f(this,"swLng");f(this,"neLat");f(this,"neLng");const i=n*Math.pow(2,t),o=He.project(e.sw.lat,e.sw.lng,i),l=He.project(e.ne.lat,e.ne.lng,i),u=o.x-s,c=o.y+a,p=l.x+s,g=l.y-a,m=He.unproject(u,c,i),y=He.unproject(p,g,i);this.swLat=m.lat,this.swLng=m.lng,this.neLat=y.lat,this.neLng=y.lng}contains(e,t){return this.swLat<=e&&e<=this.neLat?this.swLng<this.neLng?this.swLng<=t&&t<=this.neLng:t<=this.neLng||this.swLng<=t:!1}}var C;(function(r){r.assertEqual=s=>{};function e(s){}r.assertIs=e;function t(s){throw new Error}r.assertNever=t,r.arrayToEnum=s=>{const a={};for(const i of s)a[i]=i;return a},r.getValidEnumValues=s=>{const a=r.objectKeys(s).filter(o=>typeof s[s[o]]!="number"),i={};for(const o of a)i[o]=s[o];return r.objectValues(i)},r.objectValues=s=>r.objectKeys(s).map(function(a){return s[a]}),r.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{const a=[];for(const i in s)Object.prototype.hasOwnProperty.call(s,i)&&a.push(i);return a},r.find=(s,a)=>{for(const i of s)if(a(i))return i},r.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&Number.isFinite(s)&&Math.floor(s)===s;function n(s,a=" | "){return s.map(i=>typeof i=="string"?`'${i}'`:i).join(a)}r.joinValues=n,r.jsonStringifyReplacer=(s,a)=>typeof a=="bigint"?a.toString():a})(C||(C={}));var vn;(function(r){r.mergeShapes=(e,t)=>({...e,...t})})(vn||(vn={}));const v=C.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),ge=r=>{switch(typeof r){case"undefined":return v.undefined;case"string":return v.string;case"number":return Number.isNaN(r)?v.nan:v.number;case"boolean":return v.boolean;case"function":return v.function;case"bigint":return v.bigint;case"symbol":return v.symbol;case"object":return Array.isArray(r)?v.array:r===null?v.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?v.promise:typeof Map<"u"&&r instanceof Map?v.map:typeof Set<"u"&&r instanceof Set?v.set:typeof Date<"u"&&r instanceof Date?v.date:v.object;default:return v.unknown}},d=C.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class ee extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){const t=e||function(a){return a.message},n={_errors:[]},s=a=>{for(const i of a.issues)if(i.code==="invalid_union")i.unionErrors.map(s);else if(i.code==="invalid_return_type")s(i.returnTypeError);else if(i.code==="invalid_arguments")s(i.argumentsError);else if(i.path.length===0)n._errors.push(t(i));else{let o=n,l=0;for(;l<i.path.length;){const u=i.path[l];l===i.path.length-1?(o[u]=o[u]||{_errors:[]},o[u]._errors.push(t(i))):o[u]=o[u]||{_errors:[]},o=o[u],l++}}};return s(this),n}static assert(e){if(!(e instanceof ee))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,C.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){const t={},n=[];for(const s of this.issues)if(s.path.length>0){const a=s.path[0];t[a]=t[a]||[],t[a].push(e(s))}else n.push(e(s));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}}ee.create=r=>new ee(r);const kt=(r,e)=>{let t;switch(r.code){case d.invalid_type:r.received===v.undefined?t="Required":t=`Expected ${r.expected}, received ${r.received}`;break;case d.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(r.expected,C.jsonStringifyReplacer)}`;break;case d.unrecognized_keys:t=`Unrecognized key(s) in object: ${C.joinValues(r.keys,", ")}`;break;case d.invalid_union:t="Invalid input";break;case d.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${C.joinValues(r.options)}`;break;case d.invalid_enum_value:t=`Invalid enum value. Expected ${C.joinValues(r.options)}, received '${r.received}'`;break;case d.invalid_arguments:t="Invalid function arguments";break;case d.invalid_return_type:t="Invalid function return type";break;case d.invalid_date:t="Invalid date";break;case d.invalid_string:typeof r.validation=="object"?"includes"in r.validation?(t=`Invalid input: must include "${r.validation.includes}"`,typeof r.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${r.validation.position}`)):"startsWith"in r.validation?t=`Invalid input: must start with "${r.validation.startsWith}"`:"endsWith"in r.validation?t=`Invalid input: must end with "${r.validation.endsWith}"`:C.assertNever(r.validation):r.validation!=="regex"?t=`Invalid ${r.validation}`:t="Invalid";break;case d.too_small:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at least":"more than"} ${r.minimum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at least":"over"} ${r.minimum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="bigint"?t=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(r.minimum))}`:t="Invalid input";break;case d.too_big:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at most":"less than"} ${r.maximum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at most":"under"} ${r.maximum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="bigint"?t=`BigInt must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly":r.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(r.maximum))}`:t="Invalid input";break;case d.custom:t="Invalid input";break;case d.invalid_intersection_types:t="Intersection results could not be merged";break;case d.not_multiple_of:t=`Number must be a multiple of ${r.multipleOf}`;break;case d.not_finite:t="Number must be finite";break;default:t=e.defaultError,C.assertNever(r)}return{message:t}};let Qa=kt;function gr(){return Qa}const yr=r=>{const{data:e,path:t,errorMaps:n,issueData:s}=r,a=[...t,...s.path||[]],i={...s,path:a};if(s.message!==void 0)return{...s,path:a,message:s.message};let o="";const l=n.filter(u=>!!u).slice().reverse();for(const u of l)o=u(i,{data:e,defaultError:o}).message;return{...s,path:a,message:o}};function h(r,e){const t=gr(),n=yr({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,t,t===kt?void 0:kt].filter(s=>!!s)});r.common.issues.push(n)}class G{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){const n=[];for(const s of t){if(s.status==="aborted")return w;s.status==="dirty"&&e.dirty(),n.push(s.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){const n=[];for(const s of t){const a=await s.key,i=await s.value;n.push({key:a,value:i})}return G.mergeObjectSync(e,n)}static mergeObjectSync(e,t){const n={};for(const s of t){const{key:a,value:i}=s;if(a.status==="aborted"||i.status==="aborted")return w;a.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof i.value<"u"||s.alwaysSet)&&(n[a.value]=i.value)}return{status:e.value,value:n}}}const w=Object.freeze({status:"aborted"}),ht=r=>({status:"dirty",value:r}),H=r=>({status:"valid",value:r}),_n=r=>r.status==="aborted",gn=r=>r.status==="dirty",st=r=>r.status==="valid",Ht=r=>typeof Promise<"u"&&r instanceof Promise;var _;(function(r){r.errToObj=e=>typeof e=="string"?{message:e}:e||{},r.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(_||(_={}));class Ce{constructor(e,t,n,s){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=s}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const yn=(r,e)=>{if(st(e))return{success:!0,data:e.value};if(!r.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new ee(r.common.issues);return this._error=t,this._error}}};function E(r){if(!r)return{};const{errorMap:e,invalid_type_error:t,required_error:n,description:s}=r;if(e&&(t||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:s}:{errorMap:(i,o)=>{const{message:l}=r;return i.code==="invalid_enum_value"?{message:l??o.defaultError}:typeof o.data>"u"?{message:l??n??o.defaultError}:i.code!=="invalid_type"?{message:o.defaultError}:{message:l??t??o.defaultError}},description:s}}class T{get description(){return this._def.description}_getType(e){return ge(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:ge(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new G,ctx:{common:e.parent.common,data:e.data,parsedType:ge(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(Ht(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){const n={common:{issues:[],async:(t==null?void 0:t.async)??!1,contextualErrorMap:t==null?void 0:t.errorMap},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ge(e)},s=this._parseSync({data:e,path:n.path,parent:n});return yn(n,s)}"~validate"(e){var n,s;const t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ge(e)};if(!this["~standard"].async)try{const a=this._parseSync({data:e,path:[],parent:t});return st(a)?{value:a.value}:{issues:t.common.issues}}catch(a){(s=(n=a==null?void 0:a.message)==null?void 0:n.toLowerCase())!=null&&s.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(a=>st(a)?{value:a.value}:{issues:t.common.issues})}async parseAsync(e,t){const n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){const n={common:{issues:[],contextualErrorMap:t==null?void 0:t.errorMap,async:!0},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ge(e)},s=this._parse({data:e,path:n.path,parent:n}),a=await(Ht(s)?s:Promise.resolve(s));return yn(n,a)}refine(e,t){const n=s=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(s):t;return this._refinement((s,a)=>{const i=e(s),o=()=>a.addIssue({code:d.custom,...n(s)});return typeof Promise<"u"&&i instanceof Promise?i.then(l=>l?!0:(o(),!1)):i?!0:(o(),!1)})}refinement(e,t){return this._refinement((n,s)=>e(n)?!0:(s.addIssue(typeof t=="function"?t(n,s):t),!1))}_refinement(e){return new ot({schema:this,typeName:x.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:t=>this["~validate"](t)}}optional(){return Se.create(this,this._def)}nullable(){return lt.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ce.create(this)}promise(){return St.create(this,this._def)}or(e){return Xt.create([this,e],this._def)}and(e){return Gt.create(this,e,this._def)}transform(e){return new ot({...E(this._def),schema:this,typeName:x.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new Er({...E(this._def),innerType:this,defaultValue:t,typeName:x.ZodDefault})}brand(){return new ki({typeName:x.ZodBranded,type:this,...E(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new Sr({...E(this._def),innerType:this,catchValue:t,typeName:x.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return $r.create(this,e)}readonly(){return Tr.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const ei=/^c[^\s-]{8,}$/i,ti=/^[0-9a-z]+$/,ri=/^[0-9A-HJKMNP-TV-Z]{26}$/i,ni=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,si=/^[a-z0-9_-]{21}$/i,ai=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,ii=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,oi=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,li="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let or;const ui=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ci=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,di=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,fi=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,hi=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,pi=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,_s="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",mi=new RegExp(`^${_s}$`);function gs(r){let e="[0-5]\\d";r.precision?e=`${e}\\.\\d{${r.precision}}`:r.precision==null&&(e=`${e}(\\.\\d+)?`);const t=r.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`}function vi(r){return new RegExp(`^${gs(r)}$`)}function _i(r){let e=`${_s}T${gs(r)}`;const t=[];return t.push(r.local?"Z?":"Z"),r.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function gi(r,e){return!!((e==="v4"||!e)&&ui.test(r)||(e==="v6"||!e)&&di.test(r))}function yi(r,e){if(!ai.test(r))return!1;try{const[t]=r.split(".");if(!t)return!1;const n=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),s=JSON.parse(atob(n));return!(typeof s!="object"||s===null||"typ"in s&&(s==null?void 0:s.typ)!=="JWT"||!s.alg||e&&s.alg!==e)}catch{return!1}}function wi(r,e){return!!((e==="v4"||!e)&&ci.test(r)||(e==="v6"||!e)&&fi.test(r))}class be extends T{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==v.string){const a=this._getOrReturnCtx(e);return h(a,{code:d.invalid_type,expected:v.string,received:a.parsedType}),w}const n=new G;let s;for(const a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(s=this._getOrReturnCtx(e,s),h(s,{code:d.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="max")e.data.length>a.value&&(s=this._getOrReturnCtx(e,s),h(s,{code:d.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="length"){const i=e.data.length>a.value,o=e.data.length<a.value;(i||o)&&(s=this._getOrReturnCtx(e,s),i?h(s,{code:d.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):o&&h(s,{code:d.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),n.dirty())}else if(a.kind==="email")oi.test(e.data)||(s=this._getOrReturnCtx(e,s),h(s,{validation:"email",code:d.invalid_string,message:a.message}),n.dirty());else if(a.kind==="emoji")or||(or=new RegExp(li,"u")),or.test(e.data)||(s=this._getOrReturnCtx(e,s),h(s,{validation:"emoji",code:d.invalid_string,message:a.message}),n.dirty());else if(a.kind==="uuid")ni.test(e.data)||(s=this._getOrReturnCtx(e,s),h(s,{validation:"uuid",code:d.invalid_string,message:a.message}),n.dirty());else if(a.kind==="nanoid")si.test(e.data)||(s=this._getOrReturnCtx(e,s),h(s,{validation:"nanoid",code:d.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid")ei.test(e.data)||(s=this._getOrReturnCtx(e,s),h(s,{validation:"cuid",code:d.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid2")ti.test(e.data)||(s=this._getOrReturnCtx(e,s),h(s,{validation:"cuid2",code:d.invalid_string,message:a.message}),n.dirty());else if(a.kind==="ulid")ri.test(e.data)||(s=this._getOrReturnCtx(e,s),h(s,{validation:"ulid",code:d.invalid_string,message:a.message}),n.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),h(s,{validation:"url",code:d.invalid_string,message:a.message}),n.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),h(s,{validation:"regex",code:d.invalid_string,message:a.message}),n.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(s=this._getOrReturnCtx(e,s),h(s,{code:d.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),n.dirty()):a.kind==="toLowerCase"?e.data=e.data.toLowerCase():a.kind==="toUpperCase"?e.data=e.data.toUpperCase():a.kind==="startsWith"?e.data.startsWith(a.value)||(s=this._getOrReturnCtx(e,s),h(s,{code:d.invalid_string,validation:{startsWith:a.value},message:a.message}),n.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(s=this._getOrReturnCtx(e,s),h(s,{code:d.invalid_string,validation:{endsWith:a.value},message:a.message}),n.dirty()):a.kind==="datetime"?_i(a).test(e.data)||(s=this._getOrReturnCtx(e,s),h(s,{code:d.invalid_string,validation:"datetime",message:a.message}),n.dirty()):a.kind==="date"?mi.test(e.data)||(s=this._getOrReturnCtx(e,s),h(s,{code:d.invalid_string,validation:"date",message:a.message}),n.dirty()):a.kind==="time"?vi(a).test(e.data)||(s=this._getOrReturnCtx(e,s),h(s,{code:d.invalid_string,validation:"time",message:a.message}),n.dirty()):a.kind==="duration"?ii.test(e.data)||(s=this._getOrReturnCtx(e,s),h(s,{validation:"duration",code:d.invalid_string,message:a.message}),n.dirty()):a.kind==="ip"?gi(e.data,a.version)||(s=this._getOrReturnCtx(e,s),h(s,{validation:"ip",code:d.invalid_string,message:a.message}),n.dirty()):a.kind==="jwt"?yi(e.data,a.alg)||(s=this._getOrReturnCtx(e,s),h(s,{validation:"jwt",code:d.invalid_string,message:a.message}),n.dirty()):a.kind==="cidr"?wi(e.data,a.version)||(s=this._getOrReturnCtx(e,s),h(s,{validation:"cidr",code:d.invalid_string,message:a.message}),n.dirty()):a.kind==="base64"?hi.test(e.data)||(s=this._getOrReturnCtx(e,s),h(s,{validation:"base64",code:d.invalid_string,message:a.message}),n.dirty()):a.kind==="base64url"?pi.test(e.data)||(s=this._getOrReturnCtx(e,s),h(s,{validation:"base64url",code:d.invalid_string,message:a.message}),n.dirty()):C.assertNever(a);return{status:n.value,value:e.data}}_regex(e,t,n){return this.refinement(s=>e.test(s),{validation:t,code:d.invalid_string,..._.errToObj(n)})}_addCheck(e){return new be({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",..._.errToObj(e)})}url(e){return this._addCheck({kind:"url",..._.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",..._.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",..._.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",..._.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",..._.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",..._.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",..._.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",..._.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",..._.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",..._.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",..._.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",..._.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(e==null?void 0:e.offset)??!1,local:(e==null?void 0:e.local)??!1,..._.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,..._.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",..._.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,..._.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t==null?void 0:t.position,..._.errToObj(t==null?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,..._.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,..._.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,..._.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,..._.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,..._.errToObj(t)})}nonempty(e){return this.min(1,_.errToObj(e))}trim(){return new be({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new be({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new be({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}be.create=r=>new be({checks:[],typeName:x.ZodString,coerce:(r==null?void 0:r.coerce)??!1,...E(r)});function xi(r,e){const t=(r.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,s=t>n?t:n,a=Number.parseInt(r.toFixed(s).replace(".","")),i=Number.parseInt(e.toFixed(s).replace(".",""));return a%i/10**s}class at extends T{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==v.number){const a=this._getOrReturnCtx(e);return h(a,{code:d.invalid_type,expected:v.number,received:a.parsedType}),w}let n;const s=new G;for(const a of this._def.checks)a.kind==="int"?C.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),h(n,{code:d.invalid_type,expected:"integer",received:"float",message:a.message}),s.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),h(n,{code:d.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),h(n,{code:d.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):a.kind==="multipleOf"?xi(e.data,a.value)!==0&&(n=this._getOrReturnCtx(e,n),h(n,{code:d.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),h(n,{code:d.not_finite,message:a.message}),s.dirty()):C.assertNever(a);return{status:s.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,_.toString(t))}gt(e,t){return this.setLimit("min",e,!1,_.toString(t))}lte(e,t){return this.setLimit("max",e,!0,_.toString(t))}lt(e,t){return this.setLimit("max",e,!1,_.toString(t))}setLimit(e,t,n,s){return new at({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:_.toString(s)}]})}_addCheck(e){return new at({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:_.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:_.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:_.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:_.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:_.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:_.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:_.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:_.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:_.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&C.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(t===null||n.value>t)&&(t=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(t)&&Number.isFinite(e)}}at.create=r=>new at({checks:[],typeName:x.ZodNumber,coerce:(r==null?void 0:r.coerce)||!1,...E(r)});class bt extends T{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==v.bigint)return this._getInvalidInput(e);let n;const s=new G;for(const a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),h(n,{code:d.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),s.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),h(n,{code:d.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),s.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),h(n,{code:d.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):C.assertNever(a);return{status:s.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return h(t,{code:d.invalid_type,expected:v.bigint,received:t.parsedType}),w}gte(e,t){return this.setLimit("min",e,!0,_.toString(t))}gt(e,t){return this.setLimit("min",e,!1,_.toString(t))}lte(e,t){return this.setLimit("max",e,!0,_.toString(t))}lt(e,t){return this.setLimit("max",e,!1,_.toString(t))}setLimit(e,t,n,s){return new bt({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:_.toString(s)}]})}_addCheck(e){return new bt({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:_.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:_.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:_.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:_.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:_.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}bt.create=r=>new bt({checks:[],typeName:x.ZodBigInt,coerce:(r==null?void 0:r.coerce)??!1,...E(r)});class wr extends T{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==v.boolean){const n=this._getOrReturnCtx(e);return h(n,{code:d.invalid_type,expected:v.boolean,received:n.parsedType}),w}return H(e.data)}}wr.create=r=>new wr({typeName:x.ZodBoolean,coerce:(r==null?void 0:r.coerce)||!1,...E(r)});class Yt extends T{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==v.date){const a=this._getOrReturnCtx(e);return h(a,{code:d.invalid_type,expected:v.date,received:a.parsedType}),w}if(Number.isNaN(e.data.getTime())){const a=this._getOrReturnCtx(e);return h(a,{code:d.invalid_date}),w}const n=new G;let s;for(const a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(s=this._getOrReturnCtx(e,s),h(s,{code:d.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),n.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(s=this._getOrReturnCtx(e,s),h(s,{code:d.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),n.dirty()):C.assertNever(a);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Yt({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:_.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:_.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}}Yt.create=r=>new Yt({checks:[],coerce:(r==null?void 0:r.coerce)||!1,typeName:x.ZodDate,...E(r)});class wn extends T{_parse(e){if(this._getType(e)!==v.symbol){const n=this._getOrReturnCtx(e);return h(n,{code:d.invalid_type,expected:v.symbol,received:n.parsedType}),w}return H(e.data)}}wn.create=r=>new wn({typeName:x.ZodSymbol,...E(r)});class xn extends T{_parse(e){if(this._getType(e)!==v.undefined){const n=this._getOrReturnCtx(e);return h(n,{code:d.invalid_type,expected:v.undefined,received:n.parsedType}),w}return H(e.data)}}xn.create=r=>new xn({typeName:x.ZodUndefined,...E(r)});class kn extends T{_parse(e){if(this._getType(e)!==v.null){const n=this._getOrReturnCtx(e);return h(n,{code:d.invalid_type,expected:v.null,received:n.parsedType}),w}return H(e.data)}}kn.create=r=>new kn({typeName:x.ZodNull,...E(r)});class xr extends T{constructor(){super(...arguments),this._any=!0}_parse(e){return H(e.data)}}xr.create=r=>new xr({typeName:x.ZodAny,...E(r)});class Ke extends T{constructor(){super(...arguments),this._unknown=!0}_parse(e){return H(e.data)}}Ke.create=r=>new Ke({typeName:x.ZodUnknown,...E(r)});class Me extends T{_parse(e){const t=this._getOrReturnCtx(e);return h(t,{code:d.invalid_type,expected:v.never,received:t.parsedType}),w}}Me.create=r=>new Me({typeName:x.ZodNever,...E(r)});class kr extends T{_parse(e){if(this._getType(e)!==v.undefined){const n=this._getOrReturnCtx(e);return h(n,{code:d.invalid_type,expected:v.void,received:n.parsedType}),w}return H(e.data)}}kr.create=r=>new kr({typeName:x.ZodVoid,...E(r)});class ce extends T{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),s=this._def;if(t.parsedType!==v.array)return h(t,{code:d.invalid_type,expected:v.array,received:t.parsedType}),w;if(s.exactLength!==null){const i=t.data.length>s.exactLength.value,o=t.data.length<s.exactLength.value;(i||o)&&(h(t,{code:i?d.too_big:d.too_small,minimum:o?s.exactLength.value:void 0,maximum:i?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),n.dirty())}if(s.minLength!==null&&t.data.length<s.minLength.value&&(h(t,{code:d.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),n.dirty()),s.maxLength!==null&&t.data.length>s.maxLength.value&&(h(t,{code:d.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((i,o)=>s.type._parseAsync(new Ce(t,i,t.path,o)))).then(i=>G.mergeArray(n,i));const a=[...t.data].map((i,o)=>s.type._parseSync(new Ce(t,i,t.path,o)));return G.mergeArray(n,a)}get element(){return this._def.type}min(e,t){return new ce({...this._def,minLength:{value:e,message:_.toString(t)}})}max(e,t){return new ce({...this._def,maxLength:{value:e,message:_.toString(t)}})}length(e,t){return new ce({...this._def,exactLength:{value:e,message:_.toString(t)}})}nonempty(e){return this.min(1,e)}}ce.create=(r,e)=>new ce({type:r,minLength:null,maxLength:null,exactLength:null,typeName:x.ZodArray,...E(e)});function $e(r){if(r instanceof L){const e={};for(const t in r.shape){const n=r.shape[t];e[t]=Se.create($e(n))}return new L({...r._def,shape:()=>e})}else return r instanceof ce?new ce({...r._def,type:$e(r.element)}):r instanceof Se?Se.create($e(r.unwrap())):r instanceof lt?lt.create($e(r.unwrap())):r instanceof ve?ve.create(r.items.map(e=>$e(e))):r}class L extends T{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),t=C.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==v.object){const u=this._getOrReturnCtx(e);return h(u,{code:d.invalid_type,expected:v.object,received:u.parsedType}),w}const{status:n,ctx:s}=this._processInputParams(e),{shape:a,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof Me&&this._def.unknownKeys==="strip"))for(const u in s.data)i.includes(u)||o.push(u);const l=[];for(const u of i){const c=a[u],p=s.data[u];l.push({key:{status:"valid",value:u},value:c._parse(new Ce(s,p,s.path,u)),alwaysSet:u in s.data})}if(this._def.catchall instanceof Me){const u=this._def.unknownKeys;if(u==="passthrough")for(const c of o)l.push({key:{status:"valid",value:c},value:{status:"valid",value:s.data[c]}});else if(u==="strict")o.length>0&&(h(s,{code:d.unrecognized_keys,keys:o}),n.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const u=this._def.catchall;for(const c of o){const p=s.data[c];l.push({key:{status:"valid",value:c},value:u._parse(new Ce(s,p,s.path,c)),alwaysSet:c in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const u=[];for(const c of l){const p=await c.key,g=await c.value;u.push({key:p,value:g,alwaysSet:c.alwaysSet})}return u}).then(u=>G.mergeObjectSync(n,u)):G.mergeObjectSync(n,l)}get shape(){return this._def.shape()}strict(e){return _.errToObj,new L({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,n)=>{var a,i;const s=((i=(a=this._def).errorMap)==null?void 0:i.call(a,t,n).message)??n.defaultError;return t.code==="unrecognized_keys"?{message:_.errToObj(e).message??s}:{message:s}}}:{}})}strip(){return new L({...this._def,unknownKeys:"strip"})}passthrough(){return new L({...this._def,unknownKeys:"passthrough"})}extend(e){return new L({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new L({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:x.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new L({...this._def,catchall:e})}pick(e){const t={};for(const n of C.objectKeys(e))e[n]&&this.shape[n]&&(t[n]=this.shape[n]);return new L({...this._def,shape:()=>t})}omit(e){const t={};for(const n of C.objectKeys(this.shape))e[n]||(t[n]=this.shape[n]);return new L({...this._def,shape:()=>t})}deepPartial(){return $e(this)}partial(e){const t={};for(const n of C.objectKeys(this.shape)){const s=this.shape[n];e&&!e[n]?t[n]=s:t[n]=s.optional()}return new L({...this._def,shape:()=>t})}required(e){const t={};for(const n of C.objectKeys(this.shape))if(e&&!e[n])t[n]=this.shape[n];else{let a=this.shape[n];for(;a instanceof Se;)a=a._def.innerType;t[n]=a}return new L({...this._def,shape:()=>t})}keyof(){return ys(C.objectKeys(this.shape))}}L.create=(r,e)=>new L({shape:()=>r,unknownKeys:"strip",catchall:Me.create(),typeName:x.ZodObject,...E(e)});L.strictCreate=(r,e)=>new L({shape:()=>r,unknownKeys:"strict",catchall:Me.create(),typeName:x.ZodObject,...E(e)});L.lazycreate=(r,e)=>new L({shape:r,unknownKeys:"strip",catchall:Me.create(),typeName:x.ZodObject,...E(e)});class Xt extends T{_parse(e){const{ctx:t}=this._processInputParams(e),n=this._def.options;function s(a){for(const o of a)if(o.result.status==="valid")return o.result;for(const o of a)if(o.result.status==="dirty")return t.common.issues.push(...o.ctx.common.issues),o.result;const i=a.map(o=>new ee(o.ctx.common.issues));return h(t,{code:d.invalid_union,unionErrors:i}),w}if(t.common.async)return Promise.all(n.map(async a=>{const i={...t,common:{...t.common,issues:[]},parent:null};return{result:await a._parseAsync({data:t.data,path:t.path,parent:i}),ctx:i}})).then(s);{let a;const i=[];for(const l of n){const u={...t,common:{...t.common,issues:[]},parent:null},c=l._parseSync({data:t.data,path:t.path,parent:u});if(c.status==="valid")return c;c.status==="dirty"&&!a&&(a={result:c,ctx:u}),u.common.issues.length&&i.push(u.common.issues)}if(a)return t.common.issues.push(...a.ctx.common.issues),a.result;const o=i.map(l=>new ee(l));return h(t,{code:d.invalid_union,unionErrors:o}),w}}get options(){return this._def.options}}Xt.create=(r,e)=>new Xt({options:r,typeName:x.ZodUnion,...E(e)});function br(r,e){const t=ge(r),n=ge(e);if(r===e)return{valid:!0,data:r};if(t===v.object&&n===v.object){const s=C.objectKeys(e),a=C.objectKeys(r).filter(o=>s.indexOf(o)!==-1),i={...r,...e};for(const o of a){const l=br(r[o],e[o]);if(!l.valid)return{valid:!1};i[o]=l.data}return{valid:!0,data:i}}else if(t===v.array&&n===v.array){if(r.length!==e.length)return{valid:!1};const s=[];for(let a=0;a<r.length;a++){const i=r[a],o=e[a],l=br(i,o);if(!l.valid)return{valid:!1};s.push(l.data)}return{valid:!0,data:s}}else return t===v.date&&n===v.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}class Gt extends T{_parse(e){const{status:t,ctx:n}=this._processInputParams(e),s=(a,i)=>{if(_n(a)||_n(i))return w;const o=br(a.value,i.value);return o.valid?((gn(a)||gn(i))&&t.dirty(),{status:t.value,value:o.data}):(h(n,{code:d.invalid_intersection_types}),w)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([a,i])=>s(a,i)):s(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}Gt.create=(r,e,t)=>new Gt({left:r,right:e,typeName:x.ZodIntersection,...E(t)});class ve extends T{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==v.array)return h(n,{code:d.invalid_type,expected:v.array,received:n.parsedType}),w;if(n.data.length<this._def.items.length)return h(n,{code:d.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),w;!this._def.rest&&n.data.length>this._def.items.length&&(h(n,{code:d.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const a=[...n.data].map((i,o)=>{const l=this._def.items[o]||this._def.rest;return l?l._parse(new Ce(n,i,n.path,o)):null}).filter(i=>!!i);return n.common.async?Promise.all(a).then(i=>G.mergeArray(t,i)):G.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new ve({...this._def,rest:e})}}ve.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ve({items:r,typeName:x.ZodTuple,rest:null,...E(e)})};class bn extends T{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==v.map)return h(n,{code:d.invalid_type,expected:v.map,received:n.parsedType}),w;const s=this._def.keyType,a=this._def.valueType,i=[...n.data.entries()].map(([o,l],u)=>({key:s._parse(new Ce(n,o,n.path,[u,"key"])),value:a._parse(new Ce(n,l,n.path,[u,"value"]))}));if(n.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const l of i){const u=await l.key,c=await l.value;if(u.status==="aborted"||c.status==="aborted")return w;(u.status==="dirty"||c.status==="dirty")&&t.dirty(),o.set(u.value,c.value)}return{status:t.value,value:o}})}else{const o=new Map;for(const l of i){const u=l.key,c=l.value;if(u.status==="aborted"||c.status==="aborted")return w;(u.status==="dirty"||c.status==="dirty")&&t.dirty(),o.set(u.value,c.value)}return{status:t.value,value:o}}}}bn.create=(r,e,t)=>new bn({valueType:e,keyType:r,typeName:x.ZodMap,...E(t)});class Et extends T{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==v.set)return h(n,{code:d.invalid_type,expected:v.set,received:n.parsedType}),w;const s=this._def;s.minSize!==null&&n.data.size<s.minSize.value&&(h(n,{code:d.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),t.dirty()),s.maxSize!==null&&n.data.size>s.maxSize.value&&(h(n,{code:d.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),t.dirty());const a=this._def.valueType;function i(l){const u=new Set;for(const c of l){if(c.status==="aborted")return w;c.status==="dirty"&&t.dirty(),u.add(c.value)}return{status:t.value,value:u}}const o=[...n.data.values()].map((l,u)=>a._parse(new Ce(n,l,n.path,u)));return n.common.async?Promise.all(o).then(l=>i(l)):i(o)}min(e,t){return new Et({...this._def,minSize:{value:e,message:_.toString(t)}})}max(e,t){return new Et({...this._def,maxSize:{value:e,message:_.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}Et.create=(r,e)=>new Et({valueType:r,minSize:null,maxSize:null,typeName:x.ZodSet,...E(e)});class _t extends T{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==v.function)return h(t,{code:d.invalid_type,expected:v.function,received:t.parsedType}),w;function n(o,l){return yr({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,gr(),kt].filter(u=>!!u),issueData:{code:d.invalid_arguments,argumentsError:l}})}function s(o,l){return yr({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,gr(),kt].filter(u=>!!u),issueData:{code:d.invalid_return_type,returnTypeError:l}})}const a={errorMap:t.common.contextualErrorMap},i=t.data;if(this._def.returns instanceof St){const o=this;return H(async function(...l){const u=new ee([]),c=await o._def.args.parseAsync(l,a).catch(m=>{throw u.addIssue(n(l,m)),u}),p=await Reflect.apply(i,this,c);return await o._def.returns._def.type.parseAsync(p,a).catch(m=>{throw u.addIssue(s(p,m)),u})})}else{const o=this;return H(function(...l){const u=o._def.args.safeParse(l,a);if(!u.success)throw new ee([n(l,u.error)]);const c=Reflect.apply(i,this,u.data),p=o._def.returns.safeParse(c,a);if(!p.success)throw new ee([s(c,p.error)]);return p.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new _t({...this._def,args:ve.create(e).rest(Ke.create())})}returns(e){return new _t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new _t({args:e||ve.create([]).rest(Ke.create()),returns:t||Ke.create(),typeName:x.ZodFunction,...E(n)})}}class En extends T{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}En.create=(r,e)=>new En({getter:r,typeName:x.ZodLazy,...E(e)});class Sn extends T{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return h(t,{received:t.data,code:d.invalid_literal,expected:this._def.value}),w}return{status:"valid",value:e.data}}get value(){return this._def.value}}Sn.create=(r,e)=>new Sn({value:r,typeName:x.ZodLiteral,...E(e)});function ys(r,e){return new it({values:r,typeName:x.ZodEnum,...E(e)})}class it extends T{_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),n=this._def.values;return h(t,{expected:C.joinValues(n),received:t.parsedType,code:d.invalid_type}),w}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const t=this._getOrReturnCtx(e),n=this._def.values;return h(t,{received:t.data,code:d.invalid_enum_value,options:n}),w}return H(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return it.create(e,{...this._def,...t})}exclude(e,t=this._def){return it.create(this.options.filter(n=>!e.includes(n)),{...this._def,...t})}}it.create=ys;class Tn extends T{_parse(e){const t=C.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==v.string&&n.parsedType!==v.number){const s=C.objectValues(t);return h(n,{expected:C.joinValues(s),received:n.parsedType,code:d.invalid_type}),w}if(this._cache||(this._cache=new Set(C.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const s=C.objectValues(t);return h(n,{received:n.data,code:d.invalid_enum_value,options:s}),w}return H(e.data)}get enum(){return this._def.values}}Tn.create=(r,e)=>new Tn({values:r,typeName:x.ZodNativeEnum,...E(e)});class St extends T{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==v.promise&&t.common.async===!1)return h(t,{code:d.invalid_type,expected:v.promise,received:t.parsedType}),w;const n=t.parsedType===v.promise?t.data:Promise.resolve(t.data);return H(n.then(s=>this._def.type.parseAsync(s,{path:t.path,errorMap:t.common.contextualErrorMap})))}}St.create=(r,e)=>new St({type:r,typeName:x.ZodPromise,...E(e)});class ot extends T{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===x.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:n}=this._processInputParams(e),s=this._def.effect||null,a={addIssue:i=>{h(n,i),i.fatal?t.abort():t.dirty()},get path(){return n.path}};if(a.addIssue=a.addIssue.bind(a),s.type==="preprocess"){const i=s.transform(n.data,a);if(n.common.async)return Promise.resolve(i).then(async o=>{if(t.value==="aborted")return w;const l=await this._def.schema._parseAsync({data:o,path:n.path,parent:n});return l.status==="aborted"?w:l.status==="dirty"||t.value==="dirty"?ht(l.value):l});{if(t.value==="aborted")return w;const o=this._def.schema._parseSync({data:i,path:n.path,parent:n});return o.status==="aborted"?w:o.status==="dirty"||t.value==="dirty"?ht(o.value):o}}if(s.type==="refinement"){const i=o=>{const l=s.refinement(o,a);if(n.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(n.common.async===!1){const o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?w:(o.status==="dirty"&&t.dirty(),i(o.value),{status:t.value,value:o.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>o.status==="aborted"?w:(o.status==="dirty"&&t.dirty(),i(o.value).then(()=>({status:t.value,value:o.value}))))}if(s.type==="transform")if(n.common.async===!1){const i=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!st(i))return w;const o=s.transform(i.value,a);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:o}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(i=>st(i)?Promise.resolve(s.transform(i.value,a)).then(o=>({status:t.value,value:o})):w);C.assertNever(s)}}ot.create=(r,e,t)=>new ot({schema:r,typeName:x.ZodEffects,effect:e,...E(t)});ot.createWithPreprocess=(r,e,t)=>new ot({schema:e,effect:{type:"preprocess",transform:r},typeName:x.ZodEffects,...E(t)});class Se extends T{_parse(e){return this._getType(e)===v.undefined?H(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Se.create=(r,e)=>new Se({innerType:r,typeName:x.ZodOptional,...E(e)});class lt extends T{_parse(e){return this._getType(e)===v.null?H(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}lt.create=(r,e)=>new lt({innerType:r,typeName:x.ZodNullable,...E(e)});class Er extends T{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===v.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}Er.create=(r,e)=>new Er({innerType:r,typeName:x.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...E(e)});class Sr extends T{_parse(e){const{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},s=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return Ht(s)?s.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new ee(n.common.issues)},input:n.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new ee(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}Sr.create=(r,e)=>new Sr({innerType:r,typeName:x.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...E(e)});class Cn extends T{_parse(e){if(this._getType(e)!==v.nan){const n=this._getOrReturnCtx(e);return h(n,{code:d.invalid_type,expected:v.nan,received:n.parsedType}),w}return{status:"valid",value:e.data}}}Cn.create=r=>new Cn({typeName:x.ZodNaN,...E(r)});class ki extends T{_parse(e){const{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}}class $r extends T{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{const a=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?w:a.status==="dirty"?(t.dirty(),ht(a.value)):this._def.out._parseAsync({data:a.value,path:n.path,parent:n})})();{const s=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?w:s.status==="dirty"?(t.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:n.path,parent:n})}}static create(e,t){return new $r({in:e,out:t,typeName:x.ZodPipeline})}}class Tr extends T{_parse(e){const t=this._def.innerType._parse(e),n=s=>(st(s)&&(s.value=Object.freeze(s.value)),s);return Ht(t)?t.then(s=>n(s)):n(t)}unwrap(){return this._def.innerType}}Tr.create=(r,e)=>new Tr({innerType:r,typeName:x.ZodReadonly,...E(e)});var x;(function(r){r.ZodString="ZodString",r.ZodNumber="ZodNumber",r.ZodNaN="ZodNaN",r.ZodBigInt="ZodBigInt",r.ZodBoolean="ZodBoolean",r.ZodDate="ZodDate",r.ZodSymbol="ZodSymbol",r.ZodUndefined="ZodUndefined",r.ZodNull="ZodNull",r.ZodAny="ZodAny",r.ZodUnknown="ZodUnknown",r.ZodNever="ZodNever",r.ZodVoid="ZodVoid",r.ZodArray="ZodArray",r.ZodObject="ZodObject",r.ZodUnion="ZodUnion",r.ZodDiscriminatedUnion="ZodDiscriminatedUnion",r.ZodIntersection="ZodIntersection",r.ZodTuple="ZodTuple",r.ZodRecord="ZodRecord",r.ZodMap="ZodMap",r.ZodSet="ZodSet",r.ZodFunction="ZodFunction",r.ZodLazy="ZodLazy",r.ZodLiteral="ZodLiteral",r.ZodEnum="ZodEnum",r.ZodEffects="ZodEffects",r.ZodNativeEnum="ZodNativeEnum",r.ZodOptional="ZodOptional",r.ZodNullable="ZodNullable",r.ZodDefault="ZodDefault",r.ZodCatch="ZodCatch",r.ZodPromise="ZodPromise",r.ZodBranded="ZodBranded",r.ZodPipeline="ZodPipeline",r.ZodReadonly="ZodReadonly"})(x||(x={}));const fe=be.create,b=at.create,ws=wr.create,qr=xr.create;Ke.create;Me.create;const Ut=kr.create,tr=ce.create,R=L.create;Xt.create;Gt.create;const Mn=ve.create,re=_t.create,bi=it.create,Ei=St.create;Se.create;lt.create;R({pin:R({fade:ws().optional(),maxCount:b().optional(),maxZoom:b().optional()}).optional(),animation:R({queue:R({limit:b().optional()}).optional()}).optional()});const Cr=b().min(-90).max(90),Mr=b().min(-180).max(180),Si=R({sw:R({lat:Cr,lng:Mr}),ne:R({lat:Cr,lng:Mr})}),Ar=qr().refine(r=>r instanceof HTMLElement,"Must be an HTMLElement"),Ti=R({mapSize:b().min(1),zoomMin:b().min(0),zoomMax:b().min(0),zoomScale:b().min(1).max(10)}),Ci=R({instance:qr(),inserted:re().returns(ws()),insert:re().returns(Ut()),remove:re().returns(Ut()),update:re().args(b()).returns(Ut())}),Mi=R({getParameters:re().args().returns(Ti),getContainer:re().args().returns(Ar),getZoom:re().args().returns(b()),getBounds:re().args().returns(Si),panBy:re().args(b(),b()).returns(Ut()),createMarker:re().args(Ar,Cr,Mr,b()).returns(Ci)}),lr=re().args(fe()).returns(Ei(Ar)),Ai=R({id:fe().min(1),rank:b(),lat:b().min(-90).max(90),lng:b().min(-180).max(180),tooltip:R({style:R({width:b(),height:b(),margin:b(),radius:b()}).refine(r=>Math.min(r.width,r.height)/r.margin>=6,"Tooltip: minimum of width or height must be greater than or equal to 6 * margin"),body:lr}),pin:R({style:R({width:b(),height:b(),radius:b()}),body:lr}).optional(),popup:R({style:R({width:b(),height:b(),radius:b(),margin:b()}),body:lr}).optional()}),Oi=tr(Ai);var Ze;(r=>{r.COUNT=12,r.DEGREES=[0,30,60,90,120,150,180,210,240,270,300,330],r.DEGREES_DEFAULT=270})(Ze||(Ze={}));const Wr=fe().length(32),xs=fe().min(1);R({key:Wr,version:fe()});R({token:xs});const Ri=Mn([b(),tr(Mn([b(),b()]))]),ks=R({mapSize:b().min(1),zoomMin:b().min(0).max(24),zoomMax:b().min(0).max(24),zoomScale:b().min(1).max(10)}),Ni=R({id:fe(),rank:b(),lat:b(),lng:b(),width:b(),height:b(),margin:b()});R({key:Wr,parameters:ks,input:tr(Ni),token:fe().optional()});R({token:fe().optional(),states:tr(Ri)});const Ii=bi(["info","warn","error"]);R({level:Ii,key:fe(),title:fe(),content:qr()});const An="1.1.2",Hr="https://maps.api.arenarium.dev",Pi=`${Hr}/auth`,Li=`${Hr}/states`,Di=`${Hr}/log`;class Yr{constructor(e,t,n,s){f(this,"apiKey");f(this,"apiToken");f(this,"apiDevEnvironment");f(this,"mapProvider");f(this,"markerDataArray",new Array);f(this,"markerDataMap",new Map);f(this,"markerDataUpdating",!1);f(this,"markerPinProcessor");f(this,"markerTooltipProcessor");f(this,"markerPopupProcessor");Wr.parse(e),xs.parse(t),Mi.parse(n),this.apiKey=e,this.apiToken=t,this.apiDevEnvironment=(window==null?void 0:window.location.host.startsWith("localhost"))||(window==null?void 0:window.location.host.startsWith("127.0.0.1")),this.mapProvider=n,this.markerPinProcessor=new Rr(n),this.markerTooltipProcessor=new ji(n),this.markerPopupProcessor=new Fi(n),this.setConfiguration(s)}static async create(e,t,n){const s={key:e,version:An};let i=(await vt.post(Pi,s)).token;if(!i)throw new Error("Failed to get api token");return new Yr(e,i,t,n)}setConfiguration(e){var t,n;ye.setLimit(((n=(t=e==null?void 0:e.animation)==null?void 0:t.queue)==null?void 0:n.limit)??8*navigator.hardwareConcurrency),this.markerPinProcessor.setConfiguration(e)}async updateMarkers(e){Oi.parse(e);try{await this.updateMarkerData(e),this.processMarkerDataCallback()}catch(t){throw console.error(t),this.removeMarkerData(),t instanceof Error&&this.log("error","Failed to update markers",t),t}}removeMarkers(){try{this.removeMarkerData()}catch(e){throw console.error(e),e instanceof Error&&this.log("error","Failed to remove markers",e),e}}showPopup(e){try{for(const t of this.markerDataArray)t.marker.id==e?this.markerPopupProcessor.show(t):this.markerPopupProcessor.hide(t)}catch(t){console.error(t);for(const n of this.markerDataArray)this.markerPopupProcessor.hide(n);throw t instanceof Error&&this.log("error","Failed to show popup",t),t}}hidePopup(e){try{if(e){const t=this.markerDataMap.get(e);if(t==null)return;this.markerPopupProcessor.hide(t)}else for(const t of this.markerDataArray)this.markerPopupProcessor.hide(t)}catch(t){console.error(t);for(const n of this.markerDataArray)this.markerPopupProcessor.hide(n);throw t instanceof Error&&this.log("error","Failed to hide popup",t),t}}async updateMarkerData(e){try{let t=this.markerDataArray.map(s=>s.marker);for(let s=0;s<e.length;s++){const a=e[s];this.markerDataMap.get(a.id)||t.push(a)}const n=await this.getMarkerStates(t);try{this.markerDataUpdating=!0;for(let s=0;s<t.length;s++){const a=t[s],i=n[s],o=this.markerDataMap.get(a.id);if(o)o.update(i);else{const l=new Zi(this.mapProvider,a,i);l.create(),this.markerDataMap.set(a.id,l),this.markerDataArray.push(l)}}this.markerDataArray.sort((s,a)=>s.zoom-a.zoom),this.markerPinProcessor.updateElements(this.markerDataArray.map(s=>s.pin)),this.markerTooltipProcessor.updateElements(this.markerDataArray.map(s=>s.tooltip)),this.markerPopupProcessor.updateElements(this.markerDataArray.map(s=>s.popup).filter(s=>s!=null))}finally{this.markerDataUpdating=!1}}catch(t){throw console.error(t),this.markerDataArray.forEach(n=>n.remove()),this.markerDataArray.length=0,this.markerDataMap.clear(),t instanceof Error&&this.log("error","Failed to update marker data",t),t}finally{this.markerDataUpdating=!1}}removeMarkerData(){try{this.markerDataUpdating=!0,this.markerPinProcessor.removeElements(),this.markerTooltipProcessor.removeElements(),this.markerPopupProcessor.removeElements(),this.markerDataArray.length=0,this.markerDataMap.clear()}catch(e){throw console.error(e),e instanceof Error&&this.log("error","Failed to remove marker data",e),e}finally{this.markerDataUpdating=!1}}async getMarkerStates(e){if(e.length==0)return[];if(e.length==1)return[[0,[[0,Ze.DEGREES.indexOf(Ze.DEGREES_DEFAULT)]]]];const t=this.mapProvider.getParameters();ks.parse(t);const n=e.map(i=>({id:i.id,rank:i.rank,lat:i.lat,lng:i.lng,width:i.tooltip.style.width,height:i.tooltip.style.height,margin:i.tooltip.style.margin})),s={key:this.apiKey,token:this.apiToken,parameters:t,input:n},a=await vt.post(Li,s,{headers:{"Cache-Control":this.apiDevEnvironment?"no-cache":""}});return a.token&&(this.apiToken=a.token),a.states}processMarkerDataCallback(){if(this.mapProvider.getContainer().parentElement!=null&&this.markerDataArray.length!=0)try{this.processMarkerData(),window.setTimeout(this.processMarkerDataCallback.bind(this),25)}catch(e){console.error(e),e instanceof Error&&this.log("error","Failed to process marker data",e)}}processMarkerData(){if(this.markerDataUpdating)return;const e=this.mapProvider.getBounds(),t=this.mapProvider.getZoom();this.markerPopupProcessor.process(),this.markerTooltipProcessor.process(e,t),this.markerPinProcessor.process(e,t)}async log(e,t,n){if(!this.apiDevEnvironment)try{const s={key:this.apiKey,title:t,level:e,content:{version:An,...n}};await vt.post(Di,s)}catch(s){console.error(s)}}}class Zi{constructor(e,t,n){f(this,"marker");f(this,"zoom");f(this,"pin");f(this,"tooltip");f(this,"popup");this.marker=t,this.zoom=n[0],this.pin=new Or(e,t,n),this.tooltip=new Nr(e,t,n),t.popup&&(this.popup=new Ir(e,t))}create(){var e;this.pin.create(),this.tooltip.create(),(e=this.popup)==null||e.create()}update(e){this.pin.update(e),this.tooltip.update(e)}remove(){var e;this.pin.remove(),this.tooltip.remove(),(e=this.popup)==null||e.remove()}}class Xr{constructor(e,t){f(this,"provider");f(this,"id");f(this,"lat");f(this,"lng");f(this,"shown");f(this,"element");f(this,"component");f(this,"marker");this.provider=e,this.id=t.id,this.lat=t.lat,this.lng=t.lng,this.shown=!0}create(){this.createElement(),this.createMarker(),this.updateZIndex()}createElement(){throw new Error("Create element not implemented")}createMarker(){const e=this.element;if(!e)throw new Error("Failed to create provider marker");this.marker=this.provider.createMarker(e,this.lat,this.lng,this.getZindex())}updateZIndex(){if(this.marker==null)throw new Error("Failed to update provider marker z-index");this.marker.update(this.getZindex())}updateMap(e){const t=this.marker,n=this.component;if(t==null||n==null)throw new Error("Failed to update provider marker map");e?t.inserted()==!1&&t.insert():t.inserted()==!0&&t.remove()}getZindex(){throw new Error("Get z-index not implemented")}remove(){var e;(e=this.marker)==null||e.remove()}}const Ye=class Ye extends Xr{constructor(t,n,s){var a,i,o,l;super(t,n);f(this,"width");f(this,"height");f(this,"radius");f(this,"zoom");f(this,"bodyLoading",!1);f(this,"bodyLoaded",!1);f(this,"bodyCallback");this.width=((a=n.pin)==null?void 0:a.style.width)??Ye.DEFAULT_SIZE,this.height=((i=n.pin)==null?void 0:i.style.height)??Ye.DEFAULT_SIZE,this.radius=((o=n.pin)==null?void 0:o.style.radius)??Ye.DEFAULT_SIZE,this.zoom=s[0],this.bodyCallback=(l=n.pin)==null?void 0:l.body}createElement(){this.element=document.createElement("div"),this.element.classList.add("pin"),this.component=Br(Ja,{target:this.element,props:{id:this.id+"_pin",layer:Ya,priority:this.zoom*this.provider.getParameters().zoomScale,width:this.width,height:this.height,radius:this.radius}})}update(t){this.zoom=t[0],this.updateZIndex()}updateMap(t){var n;super.updateMap(t),(n=this.component)==null||n.setDisplayed(t)}updateBody(){var n;if(this.bodyCallback==null||this.bodyLoaded||this.bodyLoading)return;const t=(n=this.component)==null?void 0:n.getBody();t!=null&&(this.bodyLoading=!0,this.bodyCallback(this.id).then(s=>{s instanceof HTMLElement?t.appendChild(s):console.error("Failed to load pin body")}).catch(s=>console.error(s)).finally(()=>{this.bodyLoaded=!0,this.bodyLoading=!1}))}setCollapsed(t){if(this.component==null)throw new Error("Failed to set pin collapsed");this.component.setCollapsed(t)}setScale(t){if(this.component==null)throw new Error("Failed to set pin scale");this.component.setScale(t)}getScaleFromZoomDistance(t){return this.zoom<t?1:Math.max(0,1-(this.zoom-t)*.125)}getZindex(){const t=this.provider.getParameters();return Math.round((t.zoomMax-this.zoom)*t.zoomScale)}isCollapsed(){return this.component==null?!1:this.component.getCollapsed()}isBodyLoaded(){return this.bodyCallback==null||this.bodyLoaded}};f(Ye,"DEFAULT_SIZE",16);let Or=Ye;const Xe=class Xe{constructor(e){f(this,"provider");f(this,"pinElements",new Array);f(this,"pinMaxWidth",0);f(this,"pinMaxHeight",0);f(this,"pinFade",!1);f(this,"pinMaxCount",0);f(this,"pinMaxZoomDelta",0);this.provider=e}setConfiguration(e){var t,n,s;this.pinFade=((t=e==null?void 0:e.pin)==null?void 0:t.fade)??!0,this.pinMaxCount=((n=e==null?void 0:e.pin)==null?void 0:n.maxCount)??Math.max(Xe.MAP_PINS_MAX_COUNT,8*navigator.hardwareConcurrency),this.pinMaxZoomDelta=((s=e==null?void 0:e.pin)==null?void 0:s.maxZoom)??Xe.MAP_PINS_MAX_ZOOM}updateElements(e){this.pinElements=e,this.pinMaxWidth=e.reduce((t,n)=>Math.max(t,n.width),0),this.pinMaxHeight=e.reduce((t,n)=>Math.max(t,n.height),0)}removeElements(){this.pinElements.forEach(e=>e.remove()),this.pinElements.length=0}process(e,t){const n=this.provider.getParameters().mapSize,s=new vs(e,t,n,this.pinMaxWidth*2,this.pinMaxHeight*2);let a=0;for(const i of this.pinElements)s.contains(i.lat,i.lng)?i.shown&&t<i.zoom&&i.zoom<t+this.pinMaxZoomDelta?(a<this.pinMaxCount&&(i.setCollapsed(!1),i.setScale(this.pinFade?i.getScaleFromZoomDistance(t):1),i.updateMap(!0),i.isBodyLoaded()==!1&&i.updateBody()),a++):(i.setCollapsed(!0),i.isCollapsed()&&i.updateMap(!1)):i.updateMap(!1)}};f(Xe,"MAP_PINS_MAX_ZOOM",2),f(Xe,"MAP_PINS_MAX_COUNT",128);let Rr=Xe;const Kt=class Kt extends Xr{constructor(t,n,s){super(t,n);f(this,"width");f(this,"height");f(this,"margin");f(this,"radius");f(this,"zoom");f(this,"angle");f(this,"states");f(this,"bodyLoading",!1);f(this,"bodyLoaded",!1);f(this,"bodyCallback");this.width=n.tooltip.style.width,this.height=n.tooltip.style.height,this.margin=n.tooltip.style.margin,this.radius=n.tooltip.style.radius,this.zoom=s[0],this.angle=Ze.DEGREES_DEFAULT,this.states=s[1].map(a=>[a[0],Ze.DEGREES[a[1]]]),this.bodyCallback=n.tooltip.body}createElement(){this.element=document.createElement("div"),this.element.classList.add("tooltip"),this.component=Br(ms,{target:this.element,props:{id:this.id+"_tooltip",layer:Ha,priority:this.zoom*this.provider.getParameters().zoomScale,width:this.width,height:this.height,margin:this.margin,radius:this.radius}})}update(t){this.zoom=t[0],this.states=t[1].map(n=>[n[0],Ze.DEGREES[n[1]]]),this.updateZIndex()}updateMap(t){var n;super.updateMap(t),(n=this.component)==null||n.setDisplayed(t)}updateState(t){if(this.component==null)throw new Error("Failed to update tooltip state");this.angle=this.getAngle(t),this.component.setAngle(this.angle)}updateBody(){var n;if(this.bodyLoaded||this.bodyLoading)return;const t=(n=this.component)==null?void 0:n.getBody();t!=null&&(this.bodyLoading=!0,this.bodyCallback(this.id).then(s=>{s instanceof HTMLElement?t.appendChild(s):console.error("Failed to load tooltip body")}).catch(s=>console.error(s)).finally(()=>{this.bodyLoaded=!0,this.bodyLoading=!1}))}getAngle(t){const n=this.states.findLast(s=>s[0]<=t);if(!n)throw new Error("Angle not found");return n[1]}getZindex(){const t=this.provider.getParameters();return Math.round((t.zoomMax-this.zoom)*t.zoomScale)+Kt.Z_INDEX_OFFSET}setCollapsed(t){if(this.component==null)throw new Error("Failed to set tooltip collapsed");this.component.setCollapsed(t)}isExpanded(){return this.component==null?!1:this.component.getExpanded()}isCollapsed(){return this.component==null?!1:this.component.getCollapsed()}isBodyLoaded(){return this.bodyLoaded}};f(Kt,"Z_INDEX_OFFSET",1e6);let Nr=Kt;class ji{constructor(e){f(this,"provider");f(this,"tooltipElements",new Array);f(this,"tooltipMaxWidth",0);f(this,"tooltipMaxHeight",0);this.provider=e}updateElements(e){this.tooltipElements=e,this.tooltipMaxWidth=this.tooltipElements.reduce((t,n)=>Math.max(t,n.width),0),this.tooltipMaxHeight=this.tooltipElements.reduce((t,n)=>Math.max(t,n.height),0)}removeElements(){this.tooltipElements.forEach(e=>e.remove()),this.tooltipElements.length=0}process(e,t){const n=this.provider.getParameters().mapSize,s=new vs(e,t,n,this.tooltipMaxWidth*2,this.tooltipMaxHeight*2);for(const a of this.tooltipElements)s.contains(a.lat,a.lng)?a.shown&&a.zoom<=t?(a.updateState(t),a.setCollapsed(!1),a.updateMap(!0),a.isCollapsed()==!1&&a.isBodyLoaded()==!1&&a.updateBody()):(a.setCollapsed(!0),a.isCollapsed()&&a.updateMap(!1)):a.updateMap(!1)}}const Qt=class Qt extends Xr{constructor(t,n){if(n.popup==null)throw new Error("Failed to create popup");super(t,n);f(this,"width");f(this,"height");f(this,"margin");f(this,"radius");f(this,"bodyLoading",!1);f(this,"bodyLoaded",!1);f(this,"bodyCallback");this.shown=!1,this.width=n.popup.style.width,this.height=n.popup.style.height,this.margin=n.popup.style.margin,this.radius=n.popup.style.radius,this.bodyCallback=n.popup.body}createElement(){this.element=document.createElement("div"),this.element.classList.add("popup"),this.component=Br(ms,{target:this.element,props:{id:this.id+"_popup",layer:Wa,priority:0,width:this.width,height:this.height,margin:this.margin,radius:this.radius}})}updateMap(t){var n;super.updateMap(t),(n=this.component)==null||n.setDisplayed(t)}updateBody(){var n;if(this.bodyLoaded||this.bodyLoading)return;const t=(n=this.component)==null?void 0:n.getBody();t!=null&&(this.bodyLoading=!0,this.bodyCallback(this.id).then(s=>{s instanceof HTMLElement?t.appendChild(s):console.error("Failed to load popup body")}).catch(s=>console.error(s)).finally(()=>{this.bodyLoaded=!0,this.bodyLoading=!1}))}getZindex(){return Qt.Z_INDEX_OFFSET}setCollapsed(t){if(this.component==null)throw new Error("Failed to set popup collapsed");this.component.setCollapsed(t)}setAngle(t){if(this.component==null)throw new Error("Failed to set popup angle");this.component.setAngle(t,!0)}isExpanded(){return this.component==null?!1:this.component.getExpanded()}isCollapsed(){return this.component==null?!1:this.component.getCollapsed()}isBodyLoaded(){return this.bodyLoaded}};f(Qt,"Z_INDEX_OFFSET",2e6);let Ir=Qt;class Fi{constructor(e){f(this,"provider");f(this,"popupElements",new Array);f(this,"popupPositioned",new Map);this.provider=e}show(e){e.popup&&(e.pin.shown=!1,e.tooltip.shown=!1,this.popupPositioned.set(e.marker.id,!1),e.popup.setAngle(e.tooltip.angle),e.popup.shown=!0)}hide(e){e.popup&&(e.pin.shown=!0,e.tooltip.shown=!0,e.popup.shown=!1)}updateElements(e){this.popupElements=e,this.popupPositioned=new Map(e.map(t=>[t.id,!1]))}removeElements(){this.popupElements.forEach(e=>e.remove()),this.popupElements.length=0,this.popupPositioned.clear()}process(){var e,t;for(const n of this.popupElements)if(n.shown){if(n.setCollapsed(!1),n.updateMap(!0),n.isExpanded()&&n.isBodyLoaded()==!1&&n.updateBody(),n.isCollapsed()==!1&&this.popupPositioned.get(n.id)==!1){const s=(e=n.component)==null?void 0:e.getBody();if(s==null)continue;const a=(t=n.component)==null?void 0:t.getOffsets();if(a==null)continue;const i=s.getBoundingClientRect();if(i.x==0&&i.y==0&&i.width==0&&i.height==0)continue;const o=i.x+i.width/2,l=i.y+i.height/2,u=o+a.x,c=l+a.y,p=u+n.width,g=c+n.height,m=this.provider.getContainer().getBoundingClientRect(),y=u-m.left,I=m.right-p,V=c-m.top,te=m.bottom-g,O=Math.min(n.width,n.height)/4,Z=y<0?y-O:I<0?-I+O:0,ie=V<0?V-O:te<0?-te+O:0;this.provider.panBy(Z,ie),this.popupPositioned.set(n.id,!0)}}else n.setCollapsed(!0),n.isCollapsed()&&n.updateMap(!1)}}exports.MapManager=Yr;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const kr=!1;var Er=Array.isArray,xn=Array.prototype.indexOf,Pn=Array.from,Mt=Object.defineProperty,Ue=Object.getOwnPropertyDescriptor,Sn=Object.prototype,An=Array.prototype,Dn=Object.getPrototypeOf,or=Object.isExtensible;function Cn(t){for(var e=0;e<t.length;e++)t[e]()}function Tn(){var t,e,r=new Promise((n,i)=>{t=n,e=i});return{promise:r,resolve:t,reject:e}}const R=2,It=4,Mr=8,Le=16,fe=32,ge=64,Ot=128,q=256,st=512,L=1024,K=2048,ce=4096,Ae=8192,Ie=16384,Ft=32768,xr=65536,ar=1<<17,Ln=1<<18,Oe=1<<19,In=1<<20,xt=1<<21,Rt=1<<22,ve=1<<23,rt=Symbol("$state"),Nt=new class extends Error{name="StaleReactionError";message="The reaction that called `getAbortSignal()` was re-run or destroyed"};function On(){throw new Error("https://svelte.dev/e/async_derived_orphan")}function Fn(t){throw new Error("https://svelte.dev/e/effect_in_teardown")}function Rn(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function Nn(t){throw new Error("https://svelte.dev/e/effect_orphan")}function jn(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function zn(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function Bn(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function Un(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}function Zn(){throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror")}const qn=2,x=Symbol();function Hn(){console.warn("https://svelte.dev/e/svelte_boundary_reset_noop")}function Pr(t){return t===this.v}let Yn=!1,Y=null;function De(t){Y=t}function jt(t,e=!1,r){Y={p:Y,c:null,e:null,s:t,x:null,l:null}}function zt(t){var e=Y,r=e.e;if(r!==null){e.e=null;for(var n of r)zr(n)}return t!==void 0&&(e.x=t),Y=e.p,t??{}}function Sr(){return!0}let Me=[];function Vn(){var t=Me;Me=[],Cn(t)}function ut(t){if(Me.length===0){var e=Me;queueMicrotask(()=>{e===Me&&Vn()})}Me.push(t)}const Xn=new WeakMap;function Ar(t){var e=m;if(e===null)return v.f|=ve,t;if((e.f&Ft)===0){if((e.f&Ot)===0)throw!e.parent&&t instanceof Error&&Dr(t),t;e.b.error(t)}else Ce(t,e)}function Ce(t,e){for(;e!==null;){if((e.f&Ot)!==0)try{e.b.error(t);return}catch(r){t=r}e=e.parent}throw t instanceof Error&&Dr(t),t}function Dr(t){const e=Xn.get(t);e&&(Mt(t,"message",{value:e.message}),Mt(t,"stack",{value:e.stack}))}const wt=new Set;let A=null,Pt=new Set,Xe=[],Bt=null,St=!1;class ie{current=new Map;#e=new Map;#t=new Set;#a=0;#n=null;#c=!1;#o=[];#i=[];#r=[];#s=[];#l=[];#h=[];#f=[];skipped_effects=new Set;process(e){Xe=[];for(const i of e)this.#p(i);if(this.#o.length===0&&this.#a===0){this.#d();var r=this.#r,n=this.#s;this.#r=[],this.#s=[],this.#l=[],A=null,lr(r),lr(n),A===null?A=this:wt.delete(this),this.#n?.resolve()}else this.#u(this.#r),this.#u(this.#s),this.#u(this.#l);for(const i of this.#o)Se(i);for(const i of this.#i)Se(i);this.#o=[],this.#i=[]}#p(e){e.f^=L;for(var r=e.first;r!==null;){var n=r.f,i=(n&(fe|ge))!==0,s=i&&(n&L)!==0,o=s||(n&Ae)!==0||this.skipped_effects.has(r);if(!o&&r.fn!==null){if(i)r.f^=L;else if((n&It)!==0)this.#s.push(r);else if((n&L)===0)if((n&Rt)!==0){var l=r.b?.is_pending()?this.#i:this.#o;l.push(r)}else ct(r)&&((r.f&Le)!==0&&this.#l.push(r),Se(r));var a=r.first;if(a!==null){r=a;continue}}var u=r.parent;for(r=r.next;r===null&&u!==null;)r=u.next,u=u.parent}}#u(e){for(const r of e)((r.f&K)!==0?this.#h:this.#f).push(r),H(r,L);e.length=0}capture(e,r){this.#e.has(e)||this.#e.set(e,r),this.current.set(e,e.v)}activate(){A=this}deactivate(){A=null;for(const e of Pt)if(Pt.delete(e),e(),A!==null)break}neuter(){this.#c=!0}flush(){Xe.length>0?Wn():this.#d(),A===this&&(this.#a===0&&wt.delete(this),this.deactivate())}#d(){if(!this.#c)for(const e of this.#t)e();this.#t.clear()}increment(){this.#a+=1}decrement(){if(this.#a-=1,this.#a===0){for(const e of this.#h)H(e,K),We(e);for(const e of this.#f)H(e,ce),We(e);this.#r=[],this.#s=[],this.flush()}else this.deactivate()}add_callback(e){this.#t.add(e)}settled(){return(this.#n??=Tn()).promise}static ensure(){if(A===null){const e=A=new ie;wt.add(A),ie.enqueue(()=>{A===e&&e.flush()})}return A}static enqueue(e){ut(e)}}function Wn(){var t=Pe;St=!0;try{var e=0;for(cr(!0);Xe.length>0;){var r=ie.ensure();if(e++>1e3){var n,i;Gn()}r.process(Xe),ue.clear()}}finally{St=!1,cr(t),Bt=null}}function Gn(){try{jn()}catch(t){Ce(t,Bt)}}let de=null;function lr(t){var e=t.length;if(e!==0){for(var r=0;r<e;){var n=t[r++];if((n.f&(Ie|Ae))===0&&ct(n)&&(de=[],Se(n),n.deps===null&&n.first===null&&n.nodes_start===null&&(n.teardown===null&&n.ac===null?qr(n):n.fn=null),de?.length>0)){ue.clear();for(const i of de)Se(i);de=[]}}de=null}}function We(t){for(var e=Bt=t;e.parent!==null;){e=e.parent;var r=e.f;if(St&&e===m&&(r&Le)!==0)return;if((r&(ge|fe))!==0){if((r&L)===0)return;e.f^=L}}Xe.push(e)}function Kn(t){let e=0,r=ft(0),n;return()=>{ci()&&(g(r),qt(()=>(e===0&&(n=Kr(()=>t(()=>Ze(r)))),e+=1,()=>{ut(()=>{e-=1,e===0&&(n?.(),n=void 0,Ze(r))})})))}}var Jn=xr|Oe|Ot;function Qn(t,e,r){new $n(t,e,r)}class $n{parent;#e=!1;#t;#a=null;#n;#c;#o;#i=null;#r=null;#s=null;#l=null;#h=0;#f=0;#p=!1;#u=null;#d=()=>{this.#u&&ot(this.#u,this.#h)};#g=Kn(()=>(this.#u=ft(this.#h),()=>{this.#u=null}));constructor(e,r,n){this.#t=e,this.#n=r,this.#c=n,this.parent=m.b,this.#e=!!this.#n.pending,this.#o=vi(()=>{m.b=this;{try{this.#i=pe(()=>n(this.#t))}catch(i){this.error(i)}this.#f>0?this.#m():this.#e=!1}},Jn)}#_(){try{this.#i=pe(()=>this.#c(this.#t))}catch(e){this.error(e)}this.#e=!1}#w(){const e=this.#n.pending;e&&(this.#r=pe(()=>e(this.#t)),ie.enqueue(()=>{this.#i=this.#v(()=>(ie.ensure(),pe(()=>this.#c(this.#t)))),this.#f>0?this.#m():(nt(this.#r,()=>{this.#r=null}),this.#e=!1)}))}is_pending(){return this.#e||!!this.parent&&this.parent.is_pending()}has_pending_snippet(){return!!this.#n.pending}#v(e){var r=m,n=v,i=Y;ne(this.#o),I(this.#o),De(this.#o.ctx);try{return e()}catch(s){return Ar(s),null}finally{ne(r),I(n),De(i)}}#m(){const e=this.#n.pending;this.#i!==null&&(this.#l=document.createDocumentFragment(),ei(this.#i,this.#l)),this.#r===null&&(this.#r=pe(()=>e(this.#t)))}#y(e){if(!this.has_pending_snippet()){this.parent&&this.parent.#y(e);return}this.#f+=e,this.#f===0&&(this.#e=!1,this.#r&&nt(this.#r,()=>{this.#r=null}),this.#l&&(this.#t.before(this.#l),this.#l=null))}update_pending_count(e){this.#y(e),this.#h+=e,Pt.add(this.#d)}get_effect_pending(){return this.#g(),g(this.#u)}error(e){var r=this.#n.onerror;let n=this.#n.failed;if(this.#p||!r&&!n)throw e;this.#i&&(te(this.#i),this.#i=null),this.#r&&(te(this.#r),this.#r=null),this.#s&&(te(this.#s),this.#s=null);var i=!1,s=!1;const o=()=>{if(i){Hn();return}i=!0,s&&Zn(),ie.ensure(),this.#h=0,this.#s!==null&&nt(this.#s,()=>{this.#s=null}),this.#e=this.has_pending_snippet(),this.#i=this.#v(()=>(this.#p=!1,pe(()=>this.#c(this.#t)))),this.#f>0?this.#m():this.#e=!1};var l=v;try{I(null),s=!0,r?.(e,o),s=!1}catch(a){Ce(a,this.#o&&this.#o.parent)}finally{I(l)}n&&ut(()=>{this.#s=this.#v(()=>{this.#p=!0;try{return pe(()=>{n(this.#t,()=>e,()=>o)})}catch(a){return Ce(a,this.#o.parent),null}finally{this.#p=!1}})})}}function ei(t,e){for(var r=t.nodes_start,n=t.nodes_end;r!==null;){var i=r===n?null:Zt(r);e.append(r),r=i}}function ti(t,e,r){const n=ni;if(e.length===0){r(t.map(n));return}var i=A,s=m,o=ri();Promise.all(e.map(l=>ii(l))).then(l=>{i?.activate(),o();try{r([...t.map(n),...l])}catch(a){(s.f&Ie)===0&&Ce(a,s)}i?.deactivate(),Cr()}).catch(l=>{Ce(l,s)})}function ri(){var t=m,e=v,r=Y,n=A;return function(){ne(t),I(e),De(r),n?.activate()}}function Cr(){ne(null),I(null),De(null)}function ni(t){var e=R|K,r=v!==null&&(v.f&R)!==0?v:null;return m===null||r!==null&&(r.f&q)!==0?e|=q:m.f|=Oe,{ctx:Y,deps:null,effects:null,equals:Pr,f:e,fn:t,reactions:null,rv:0,v:x,wv:0,parent:r??m,ac:null}}function ii(t,e){let r=m;r===null&&On();var n=r.b,i=void 0,s=ft(x),o=null,l=!v;return di(()=>{try{var a=t();o&&Promise.resolve(a).catch(()=>{})}catch(c){a=Promise.reject(c)}var u=()=>a;i=o?.then(u,u)??Promise.resolve(a),o=i;var f=A,p=n.is_pending();l&&(n.update_pending_count(1),p||f.increment());const h=(c,d=void 0)=>{o=null,p||f.activate(),d?d!==Nt&&(s.f|=ve,ot(s,d)):((s.f&ve)!==0&&(s.f^=ve),ot(s,c)),l&&(n.update_pending_count(-1),p||f.decrement()),Cr()};if(i.then(h,c=>h(null,c||"unknown")),f)return()=>{queueMicrotask(()=>f.neuter())}}),new Promise(a=>{function u(f){function p(){f===i?a(s):u(i)}f.then(p,p)}u(i)})}function Tr(t){var e=t.effects;if(e!==null){t.effects=null;for(var r=0;r<e.length;r+=1)te(e[r])}}function si(t){for(var e=t.parent;e!==null;){if((e.f&R)===0)return e;e=e.parent}return null}function Ut(t){var e,r=m;ne(si(t));try{Tr(t),e=Wr(t)}finally{ne(r)}return e}function Lr(t){var e=Ut(t);if(t.equals(e)||(t.v=e,t.wv=Vr()),!Fe){var r=(le||(t.f&q)!==0)&&t.deps!==null?ce:L;H(t,r)}}const ue=new Map;function ft(t,e){var r={f:0,v:t,reactions:null,equals:Pr,rv:0,wv:0};return r}function D(t,e){const r=ft(t);return _i(r),r}function P(t,e,r=!1){v!==null&&(!G||(v.f&ar)!==0)&&Sr()&&(v.f&(R|Le|Rt|ar))!==0&&!se?.includes(t)&&Un();let n=r?je(e):e;return ot(t,n)}function ot(t,e){if(!t.equals(e)){var r=t.v;Fe?ue.set(t,e):ue.set(t,r),t.v=e;var n=ie.ensure();n.capture(t,r),(t.f&R)!==0&&((t.f&K)!==0&&Ut(t),H(t,(t.f&q)===0?L:ce)),t.wv=Vr(),Ir(t,K),m!==null&&(m.f&L)!==0&&(m.f&(fe|ge))===0&&(j===null?wi([t]):j.push(t))}return e}function Ze(t){P(t,t.v+1)}function Ir(t,e){var r=t.reactions;if(r!==null)for(var n=r.length,i=0;i<n;i++){var s=r[i],o=s.f,l=(o&K)===0;l&&H(s,e),(o&R)!==0?Ir(s,ce):l&&((o&Le)!==0&&de!==null&&de.push(s),We(s))}}function je(t){if(typeof t!="object"||t===null||rt in t)return t;const e=Dn(t);if(e!==Sn&&e!==An)return t;var r=new Map,n=Er(t),i=D(0),s=me,o=l=>{if(me===s)return l();var a=v,u=me;I(null),pr(s);var f=l();return I(a),pr(u),f};return n&&r.set("length",D(t.length)),new Proxy(t,{defineProperty(l,a,u){(!("value"in u)||u.configurable===!1||u.enumerable===!1||u.writable===!1)&&zn();var f=r.get(a);return f===void 0?f=o(()=>{var p=D(u.value);return r.set(a,p),p}):P(f,u.value,!0),!0},deleteProperty(l,a){var u=r.get(a);if(u===void 0){if(a in l){const f=o(()=>D(x));r.set(a,f),Ze(i)}}else P(u,x),Ze(i);return!0},get(l,a,u){if(a===rt)return t;var f=r.get(a),p=a in l;if(f===void 0&&(!p||Ue(l,a)?.writable)&&(f=o(()=>{var c=je(p?l[a]:x),d=D(c);return d}),r.set(a,f)),f!==void 0){var h=g(f);return h===x?void 0:h}return Reflect.get(l,a,u)},getOwnPropertyDescriptor(l,a){var u=Reflect.getOwnPropertyDescriptor(l,a);if(u&&"value"in u){var f=r.get(a);f&&(u.value=g(f))}else if(u===void 0){var p=r.get(a),h=p?.v;if(p!==void 0&&h!==x)return{enumerable:!0,configurable:!0,value:h,writable:!0}}return u},has(l,a){if(a===rt)return!0;var u=r.get(a),f=u!==void 0&&u.v!==x||Reflect.has(l,a);if(u!==void 0||m!==null&&(!f||Ue(l,a)?.writable)){u===void 0&&(u=o(()=>{var h=f?je(l[a]):x,c=D(h);return c}),r.set(a,u));var p=g(u);if(p===x)return!1}return f},set(l,a,u,f){var p=r.get(a),h=a in l;if(n&&a==="length")for(var c=u;c<p.v;c+=1){var d=r.get(c+"");d!==void 0?P(d,x):c in l&&(d=o(()=>D(x)),r.set(c+"",d))}if(p===void 0)(!h||Ue(l,a)?.writable)&&(p=o(()=>D(void 0)),P(p,je(u)),r.set(a,p));else{h=p.v!==x;var w=o(()=>je(u));P(p,w)}var O=Reflect.getOwnPropertyDescriptor(l,a);if(O?.set&&O.set.call(f,u),!h){if(n&&typeof a=="string"){var J=r.get("length"),E=Number(a);Number.isInteger(E)&&E>=J.v&&P(J,E+1)}Ze(i)}return!0},ownKeys(l){g(i);var a=Reflect.ownKeys(l).filter(p=>{var h=r.get(p);return h===void 0||h.v!==x});for(var[u,f]of r)f.v!==x&&!(u in l)&&a.push(u);return a},setPrototypeOf(){Bn()}})}var ur,Or,Fr,Rr;function oi(){if(ur===void 0){ur=window,Or=/Firefox/.test(navigator.userAgent);var t=Element.prototype,e=Node.prototype,r=Text.prototype;Fr=Ue(e,"firstChild").get,Rr=Ue(e,"nextSibling").get,or(t)&&(t.__click=void 0,t.__className=void 0,t.__attributes=null,t.__style=void 0,t.__e=void 0),or(r)&&(r.__t=void 0)}}function ai(t=""){return document.createTextNode(t)}function Nr(t){return Fr.call(t)}function Zt(t){return Rr.call(t)}function fr(t,e){return Nr(t)}function li(t,e=1,r=!1){let n=t;for(;e--;)n=Zt(n);return n}function jr(t){var e=v,r=m;I(null),ne(null);try{return t()}finally{I(e),ne(r)}}function ui(t){m===null&&v===null&&Nn(),v!==null&&(v.f&q)!==0&&m===null&&Rn(),Fe&&Fn()}function fi(t,e){var r=e.last;r===null?e.last=e.first=t:(r.next=t,t.prev=r,e.last=t)}function he(t,e,r,n=!0){var i=m;i!==null&&(i.f&Ae)!==0&&(t|=Ae);var s={ctx:Y,deps:null,nodes_start:null,nodes_end:null,f:t|K,first:null,fn:e,last:null,next:null,parent:i,b:i&&i.b,prev:null,teardown:null,transitions:null,wv:0,ac:null};if(r)try{Se(s),s.f|=Ft}catch(a){throw te(s),a}else e!==null&&We(s);if(n){var o=s;if(r&&o.deps===null&&o.teardown===null&&o.nodes_start===null&&o.first===o.last&&(o.f&Oe)===0&&(o=o.first),o!==null&&(o.parent=i,i!==null&&fi(o,i),v!==null&&(v.f&R)!==0&&(t&ge)===0)){var l=v;(l.effects??=[]).push(o)}}return s}function ci(){return v!==null&&!G}function Q(t){ui();var e=m.f,r=!v&&(e&fe)!==0&&(e&Ft)===0;if(r){var n=Y;(n.e??=[]).push(t)}else return zr(t)}function zr(t){return he(It|In,t,!1)}function hi(t){ie.ensure();const e=he(ge|Oe,t,!0);return(r={})=>new Promise(n=>{r.outro?nt(e,()=>{te(e),n(void 0)}):(te(e),n(void 0))})}function pi(t){return he(It,t,!1)}function di(t){return he(Rt|Oe,t,!0)}function qt(t,e=0){return he(Mr|e,t,!0)}function Br(t,e=[],r=[]){ti(e,r,n=>{he(Mr,()=>t(...n.map(g)),!0)})}function vi(t,e=0){var r=he(Le|e,t,!0);return r}function pe(t,e=!0){return he(fe|Oe,t,!0,e)}function Ur(t){var e=t.teardown;if(e!==null){const r=Fe,n=v;hr(!0),I(null);try{e.call(null)}finally{hr(r),I(n)}}}function Zr(t,e=!1){var r=t.first;for(t.first=t.last=null;r!==null;){const i=r.ac;i!==null&&jr(()=>{i.abort(Nt)});var n=r.next;(r.f&ge)!==0?r.parent=null:te(r,e),r=n}}function mi(t){for(var e=t.first;e!==null;){var r=e.next;(e.f&fe)===0&&te(e),e=r}}function te(t,e=!0){var r=!1;(e||(t.f&Ln)!==0)&&t.nodes_start!==null&&t.nodes_end!==null&&(yi(t.nodes_start,t.nodes_end),r=!0),Zr(t,e&&!r),at(t,0),H(t,Ie);var n=t.transitions;if(n!==null)for(const s of n)s.stop();Ur(t);var i=t.parent;i!==null&&i.first!==null&&qr(t),t.next=t.prev=t.teardown=t.ctx=t.deps=t.fn=t.nodes_start=t.nodes_end=t.ac=null}function yi(t,e){for(;t!==null;){var r=t===e?null:Zt(t);t.remove(),t=r}}function qr(t){var e=t.parent,r=t.prev,n=t.next;r!==null&&(r.next=n),n!==null&&(n.prev=r),e!==null&&(e.first===t&&(e.first=n),e.last===t&&(e.last=r))}function nt(t,e){var r=[];Hr(t,r,!0),gi(r,()=>{te(t),e&&e()})}function gi(t,e){var r=t.length;if(r>0){var n=()=>--r||e();for(var i of t)i.out(n)}else e()}function Hr(t,e,r){if((t.f&Ae)===0){if(t.f^=Ae,t.transitions!==null)for(const o of t.transitions)(o.is_global||r)&&e.push(o);for(var n=t.first;n!==null;){var i=n.next,s=(n.f&xr)!==0||(n.f&fe)!==0;Hr(n,e,s?r:!1),n=i}}}let Pe=!1;function cr(t){Pe=t}let Fe=!1;function hr(t){Fe=t}let v=null,G=!1;function I(t){v=t}let m=null;function ne(t){m=t}let se=null;function _i(t){v!==null&&(se===null?se=[t]:se.push(t))}let C=null,F=0,j=null;function wi(t){j=t}let Yr=1,Ge=0,me=Ge;function pr(t){me=t}let le=!1;function Vr(){return++Yr}function ct(t){var e=t.f;if((e&K)!==0)return!0;if((e&ce)!==0){var r=t.deps,n=(e&q)!==0;if(r!==null){var i,s,o=(e&st)!==0,l=n&&m!==null&&!le,a=r.length;if((o||l)&&(m===null||(m.f&Ie)===0)){var u=t,f=u.parent;for(i=0;i<a;i++)s=r[i],(o||!s?.reactions?.includes(u))&&(s.reactions??=[]).push(u);o&&(u.f^=st),l&&f!==null&&(f.f&q)===0&&(u.f^=q)}for(i=0;i<a;i++)if(s=r[i],ct(s)&&Lr(s),s.wv>t.wv)return!0}(!n||m!==null&&!le)&&H(t,L)}return!1}function Xr(t,e,r=!0){var n=t.reactions;if(n!==null&&!se?.includes(t))for(var i=0;i<n.length;i++){var s=n[i];(s.f&R)!==0?Xr(s,e,!1):e===s&&(r?H(s,K):(s.f&L)!==0&&H(s,ce),We(s))}}function Wr(t){var e=C,r=F,n=j,i=v,s=le,o=se,l=Y,a=G,u=me,f=t.f;C=null,F=0,j=null,le=(f&q)!==0&&(G||!Pe||v===null),v=(f&(fe|ge))===0?t:null,se=null,De(t.ctx),G=!1,me=++Ge,t.ac!==null&&(jr(()=>{t.ac.abort(Nt)}),t.ac=null);try{t.f|=xt;var p=t.fn,h=p(),c=t.deps;if(C!==null){var d;if(at(t,F),c!==null&&F>0)for(c.length=F+C.length,d=0;d<C.length;d++)c[F+d]=C[d];else t.deps=c=C;if(!le||(f&R)!==0&&t.reactions!==null)for(d=F;d<c.length;d++)(c[d].reactions??=[]).push(t)}else c!==null&&F<c.length&&(at(t,F),c.length=F);if(Sr()&&j!==null&&!G&&c!==null&&(t.f&(R|ce|K))===0)for(d=0;d<j.length;d++)Xr(j[d],t);return i!==null&&i!==t&&(Ge++,j!==null&&(n===null?n=j:n.push(...j))),(t.f&ve)!==0&&(t.f^=ve),h}catch(w){return Ar(w)}finally{t.f^=xt,C=e,F=r,j=n,v=i,le=s,se=o,De(l),G=a,me=u}}function bi(t,e){let r=e.reactions;if(r!==null){var n=xn.call(r,t);if(n!==-1){var i=r.length-1;i===0?r=e.reactions=null:(r[n]=r[i],r.pop())}}r===null&&(e.f&R)!==0&&(C===null||!C.includes(e))&&(H(e,ce),(e.f&(q|st))===0&&(e.f^=st),Tr(e),at(e,0))}function at(t,e){var r=t.deps;if(r!==null)for(var n=e;n<r.length;n++)bi(t,r[n])}function Se(t){var e=t.f;if((e&Ie)===0){H(t,L);var r=m,n=Pe;m=t,Pe=!0;try{(e&Le)!==0?mi(t):Zr(t),Ur(t);var i=Wr(t);t.teardown=typeof i=="function"?i:null,t.wv=Yr;var s;kr&&Yn&&(t.f&K)!==0&&t.deps}finally{Pe=n,m=r}}}function g(t){var e=t.f,r=(e&R)!==0;if(v!==null&&!G){var n=m!==null&&(m.f&Ie)!==0;if(!n&&!se?.includes(t)){var i=v.deps;if((v.f&xt)!==0)t.rv<Ge&&(t.rv=Ge,C===null&&i!==null&&i[F]===t?F++:C===null?C=[t]:(!le||!C.includes(t))&&C.push(t));else{(v.deps??=[]).push(t);var s=t.reactions;s===null?t.reactions=[v]:s.includes(v)||s.push(v)}}}else if(r&&t.deps===null&&t.effects===null){var o=t,l=o.parent;l!==null&&(l.f&q)===0&&(o.f^=q)}if(Fe){if(ue.has(t))return ue.get(t);if(r){o=t;var a=o.v;return((o.f&L)===0&&o.reactions!==null||Gr(o))&&(a=Ut(o)),ue.set(o,a),a}}else r&&(o=t,ct(o)&&Lr(o));if((t.f&ve)!==0)throw t.v;return t.v}function Gr(t){if(t.v===x)return!0;if(t.deps===null)return!1;for(const e of t.deps)if(ue.has(e)||(e.f&R)!==0&&Gr(e))return!0;return!1}function Kr(t){var e=G;try{return G=!0,t()}finally{G=e}}const ki=-7169;function H(t,e){t.f=t.f&ki|e}const Ei=["touchstart","touchmove"];function Mi(t){return Ei.includes(t)}const xi=new Set,dr=new Set;let vr=null;function et(t){var e=this,r=e.ownerDocument,n=t.type,i=t.composedPath?.()||[],s=i[0]||t.target;vr=t;var o=0,l=vr===t&&t.__root;if(l){var a=i.indexOf(l);if(a!==-1&&(e===document||e===window)){t.__root=e;return}var u=i.indexOf(e);if(u===-1)return;a<=u&&(o=a)}if(s=i[o]||t.target,s!==e){Mt(t,"currentTarget",{configurable:!0,get(){return s||r}});var f=v,p=m;I(null),ne(null);try{for(var h,c=[];s!==null;){var d=s.assignedSlot||s.parentNode||s.host||null;try{var w=s["__"+n];if(w!=null&&(!s.disabled||t.target===s))if(Er(w)){var[O,...J]=w;O.apply(s,[t,...J])}else w.call(s,t)}catch(E){h?c.push(E):h=E}if(t.cancelBubble||d===e||d===null)break;s=d}if(h){for(let E of c)queueMicrotask(()=>{throw E});throw h}}finally{t.__root=e,delete t.currentTarget,I(f),ne(p)}}}function Pi(t){var e=document.createElement("template");return e.innerHTML=t.replaceAll("<!>","<!---->"),e.content}function Si(t,e){var r=m;r.nodes_start===null&&(r.nodes_start=t,r.nodes_end=e)}function Jr(t,e){var r=(e&qn)!==0,n,i=!t.startsWith("<!>");return()=>{n===void 0&&(n=Pi(i?t:"<!>"+t),n=Nr(n));var s=r||Or?document.importNode(n,!0):n.cloneNode(!0);return Si(s,s),s}}function Qr(t,e){t!==null&&t.before(e)}function Ht(t,e){return Ai(t,e)}const Ee=new Map;function Ai(t,{target:e,anchor:r,props:n={},events:i,context:s,intro:o=!0}){oi();var l=new Set,a=p=>{for(var h=0;h<p.length;h++){var c=p[h];if(!l.has(c)){l.add(c);var d=Mi(c);e.addEventListener(c,et,{passive:d});var w=Ee.get(c);w===void 0?(document.addEventListener(c,et,{passive:d}),Ee.set(c,1)):Ee.set(c,w+1)}}};a(Pn(xi)),dr.add(a);var u=void 0,f=hi(()=>{var p=r??e.appendChild(ai());return Qn(p,{pending:()=>{}},h=>{if(s){jt({});var c=Y;c.c=s}i&&(n.$$events=i),u=t(h,n)||{},s&&zt()}),()=>{for(var h of l){e.removeEventListener(h,et);var c=Ee.get(h);--c===0?(document.removeEventListener(h,et),Ee.delete(h)):Ee.set(h,c)}dr.delete(a),p!==r&&p.parentNode?.removeChild(p)}});return Di.set(u,f),u}let Di=new WeakMap;function $r(t){var e,r,n="";if(typeof t=="string"||typeof t=="number")n+=t;else if(typeof t=="object")if(Array.isArray(t)){var i=t.length;for(e=0;e<i;e++)t[e]&&(r=$r(t[e]))&&(n&&(n+=" "),n+=r)}else for(r in t)t[r]&&(n&&(n+=" "),n+=r);return n}function Ci(){for(var t,e,r=0,n="",i=arguments.length;r<i;r++)(t=arguments[r])&&(e=$r(t))&&(n&&(n+=" "),n+=e);return n}function en(t){return typeof t=="object"?Ci(t):t??""}function Ti(t,e,r){var n=t==null?"":""+t;return e&&(n=n?n+" "+e:e),n===""?null:n}function mr(t,e=!1){var r=e?" !important;":";",n="";for(var i in t){var s=t[i];s!=null&&s!==""&&(n+=" "+i+": "+s+r)}return n}function Li(t,e){if(e){var r="",n,i;return Array.isArray(e)?(n=e[0],i=e[1]):n=e,n&&(r+=mr(n)),i&&(r+=mr(i,!0)),r=r.trim(),r===""?null:r}return String(t)}function tn(t,e,r,n,i,s){var o=t.__className;if(o!==r||o===void 0){var l=Ti(r,n);l==null?t.removeAttribute("class"):t.className=l,t.__className=r}return s}function bt(t,e={},r,n){for(var i in r){var s=r[i];e[i]!==s&&(r[i]==null?t.style.removeProperty(i):t.style.setProperty(i,s,n))}}function ze(t,e,r,n){var i=t.__style;if(i!==e){var s=Li(e,n);s==null?t.removeAttribute("style"):t.style.cssText=s,t.__style=e}else n&&(Array.isArray(n)?(bt(t,r?.[0],n[0]),bt(t,r?.[1],n[1],"important")):bt(t,r,n));return n}const Ii=()=>performance.now(),$={tick:t=>requestAnimationFrame(t),now:()=>Ii(),tasks:new Set};function rn(){const t=$.now();$.tasks.forEach(e=>{e.c(t)||($.tasks.delete(e),e.f())}),$.tasks.size!==0&&$.tick(rn)}function Oi(t){let e;return $.tasks.size===0&&$.tick(rn),{promise:new Promise(r=>{$.tasks.add(e={c:t,f:r})}),abort(){$.tasks.delete(e)}}}function yr(t,e){return t===e||t?.[rt]===e}function Be(t={},e,r,n){return pi(()=>{var i,s;return qt(()=>{i=s,s=[],Kr(()=>{t!==r(...s)&&(e(t,...s),i&&yr(r(...i),t)&&e(null,...i))})}),()=>{ut(()=>{s&&yr(r(...s),t)&&e(null,...s)})}}),t}const Fi="5";typeof window<"u"&&((window.__svelte??={}).v??=new Set).add(Fi);function Ri(t){return t}function At(t){return-.5*(Math.cos(Math.PI*t)-1)}function Ni(t){const e=Math.cos(t*Math.PI*.5);return Math.abs(e)<1e-14?1:1-e}function ji(t){return Math.sin(t*Math.PI/2)}const zi=128,Bi=0,Ui=1,Zi=2;class qi{animationsStarted=!1;animationsCount=0;animationsLimit=zi;layers=new Array;start(){window.requestAnimationFrame(this.tick.bind(this))}tick(){try{this.animationsCount=0;for(let e=0;e<this.layers.length;e++){const r=this.layers[e];if(r==null)continue;const n=r.animations;if(n!=null)for(let i=0;i<n.length;i++){const s=n[i];if(s!=null){for(const o of s.values())if(!o.executed&&(o.executed=!0,o.function(),this.animationsCount++,this.animationsCount==this.animationsLimit))return}}}}catch{}finally{window.requestAnimationFrame(this.tick.bind(this))}}equeue(e,r,n,i){let s=this.layers[e];s==null&&(s=this.layers[e]={animations:new Array});let o=s.animations[r];o==null&&(o=s.animations[r]=new Map);let l={id:n,priority:r,executed:!1,function:i};o.set(n,l),this.animationsStarted==!1&&(this.animationsStarted=!0,this.start())}clear(e,r){for(let n=0;n<this.layers.length;n++){let i=this.layers[n];if(i==null)continue;let s=i.animations[e];if(s==null)return;let o=s.get(r);if(o==null||o.executed==!1)return;s.delete(r)}}speed(){return Math.pow(2,2*this.animationsCount/this.animationsLimit)}stacked(){return this.animationsCount==this.animationsLimit}setLimit(e){this.animationsLimit=e}}const ae=new qi;function gr(t){return Object.prototype.toString.call(t)==="[object Date]"}function Dt(t,e){if(t===e||t!==t)return()=>t;const r=typeof t;if(r!==typeof e||Array.isArray(t)!==Array.isArray(e))throw new Error("Cannot interpolate values of different type");if(Array.isArray(t)){const n=e.map((i,s)=>Dt(t[s],i));return i=>n.map(s=>s(i))}if(r==="object"){if(!t||!e)throw new Error("Object cannot be null");if(gr(t)&&gr(e)){const s=t.getTime(),l=e.getTime()-s;return a=>new Date(s+a*l)}const n=Object.keys(e),i={};return n.forEach(s=>{i[s]=Dt(t[s],e[s])}),s=>{const o={};return n.forEach(l=>{o[l]=i[l](s)}),o}}if(r==="number"){const n=e-t;return i=>t+i*n}return()=>e}class Yt{#e;#t;#a;#n=null;constructor(e,r={}){this.#e=D(e),this.#t=D(e),this.#a=r}static of(e,r){const n=new Yt(e(),r);return qt(()=>{n.set(e())}),n}set(e,r){P(this.#t,e);let{delay:n=0,duration:i=400,easing:s=Ri,interpolate:o=Dt}={...this.#a,...r};if(i===0)return this.#n?.abort(),P(this.#e,e),Promise.resolve();const l=$.now()+n;let a,u=!1,f=this.#n;return this.#n=Oi(p=>{if(p<l)return!0;if(!u){u=!0;const c=this.#e.v;a=o(c,e),typeof i=="function"&&(i=i(c,e)),f?.abort()}const h=p-l;return h>i?(P(this.#e,e),!1):(P(this.#e,a(s(h/i))),!0)}),this.#n.promise}get current(){return g(this.#e)}get target(){return g(this.#t)}set target(e){this.set(e)}}class it{value;motion;constructor(e,r){this.value=e,this.motion=new Yt(e,r)}set(e,r){this.value=e,this.motion.set(e,r)}update(e){this.motion.set(this.value,e)}snap(){this.motion.set(this.value,{duration:0})}}var Hi=Jr("<div></div>");function Yi(t,e){jt(e,!0);let r=e.style.width,n=e.style.height,i=e.style.radius,s=e.colors?.background??"darkgreen",o=e.colors?.border??"white",l=e.colors?.shadow??"0px 2px 2px rgba(0, 0, 0, 0.5)",a;function u(){return a}let f=D(!1);function p(b){P(f,b,!0)}function h(){return g(f)}let c=D(!0),d=0,w=150;function O(b){b!=g(c)&&(P(c,b,!0),d=performance.now())}function J(){return performance.now()-d<w?V.motion.current==0:V.value==0}let E=0,V=new it(0,{easing:At});Q(()=>{g(f)==!1&&(V.snap(),ae.clear(e.priority,e.id))}),Q(()=>{V.set(g(c)?0:E,{duration:75})}),Q(()=>{Je(V.motion.current)});function Je(b){a&&ae.equeue(e.layer,e.priority,e.id,()=>{a.style.scale=b.toString(),a.style.filter=`brightness(${.25+.75*b})`})}function pt(b){b!=E&&(E=b,V.set(b,{duration:75}))}function dt(){return V.value}var vt={getBody:u,setDisplayed:p,getDisplayed:h,setCollapsed:O,getCollapsed:J,setScale:pt,getScale:dt},M=Hi();let Qe;return Be(M,b=>a=b,()=>a),Br(b=>{tn(M,1,en(["pin",g(f)&&"displayed"]),"svelte-zz3jrb"),Qe=ze(M,"",Qe,b)},[()=>({width:`${r}px`,height:`${n}px`,"border-radius":`${i}px`,"border-color":o,"background-color":s,"box-shadow":l})]),Qr(t,M),zt(vt)}var qe;(t=>{function e(r,n,i){const s=r/2,o=n/2,l=Math.sqrt(s*s+o*o),a=Math.atan(o/s)*(180/Math.PI),u=i*(Math.PI/180);return i<180?i<90?i<a?{x:0,y:l*Math.sin(u)-o}:{x:l*Math.cos(u)-s,y:0}:i<180-a?{x:l*Math.cos(u)-s,y:0}:{x:-r,y:l*Math.sin(u)-o}:i<270?i<180+a?{x:-r,y:l*Math.sin(u)-o}:{x:l*Math.cos(u)-s,y:-n}:i<360-a?{x:l*Math.cos(u)-s,y:-n}:{x:0,y:l*Math.sin(u)-o}}t.getOffsets=e})(qe||(qe={}));var Vi=Jr('<div><div class="pointer svelte-11extwn"></div> <div class="bubble svelte-11extwn"><div class="body svelte-11extwn"></div></div></div>');function nn(t,e){jt(e,!0);let r=e.style.width,n=e.style.height,i=e.style.margin,s=e.style.radius,o=e.colors?.background??"white",l=e.colors?.shadow??"0px 2px 2px rgba(0, 0, 0, 0.5)",a,u,f,p;const h=r+2*i,c=n+2*i,d=()=>p;Q(()=>{f.style.width=`${i*4}px`,f.style.height=`${i*4}px`});let w=D(!0);function O(y){P(w,y,!0)}function J(){return g(w)}let E=D(!0),V=0,Je=300;function pt(y){y!=g(E)&&(P(E,y,!0),V=performance.now())}function dt(){return performance.now()-V<Je?M.motion.current==0:M.value==0}function vt(){return performance.now()-V<Je?M.motion.current==1:M.value==1}let M=new it(0);Q(()=>{g(w)==!1&&(M.snap(),ae.clear(e.priority,e.id+"_scale"))}),Q(()=>{g(E)==!0&&M.value!=0&&(ae.stacked()?M.set(0,{duration:0}):M.set(0,{duration:150,easing:Ni})),g(E)==!1&&M.value!=1&&M.set(1,{duration:150,easing:ji})}),Q(()=>{Qe(M.motion.current)});function Qe(y){!a||!u||!f||ae.equeue(g(E)?0:e.layer,e.priority,e.id+"_scale",()=>{a.style.opacity=`${y}`,u.style.scale=`${y}`,f.style.scale=`${y}`})}let b=NaN,mt=D(!1),oe=new it(-h/2,{easing:At}),$e=new it(-c/2,{easing:At});Q(()=>{g(w)==!1&&(oe.snap(),oe.snap(),ae.clear(e.priority,e.id+"_angle"))}),Q(()=>{g(E)==!0&&g(mt)&&(oe.update({duration:75}),oe.update({duration:75}))}),Q(()=>{Qt(oe.motion.current,$e.motion.current)});function Qt(y,_e){if(!a||!u||!f)return;const X=y+h/2,we=_e+c/2,be=c<h?X*c/h:X,ke=c>h?we*h/c:we,wn=Math.atan2(ke,be)/Math.PI*180-45,ir=0,bn=30,_t=Math.sqrt(be*be+ke*ke),Ne=Math.min(h,c)/2,kn=Ne*Math.SQRT2,En=(_t-Ne)/(kn-Ne),sr=ir+En*(bn-ir),Mn=_t<Ne?_t/Ne:1;ae.equeue(e.layer,e.priority,e.id+"_angle",()=>{u.style.transform=`translate(${Math.round(y)}px, ${Math.round(_e)}px)`,f.style.transform=`scale(${Mn}) rotate(${wn}deg) skew(${sr}deg, ${sr}deg)`})}function yn(y,_e){if(g(mt)==!1||_e==!0){let X=qe.getOffsets(h,c,y);oe.set(Math.round(X.x),{duration:0}),$e.set(Math.round(X.y),{duration:0}),Qt(oe.value,$e.value),b=y,P(mt,!0)}else if(y!=b){let X=Math.abs(y-b),we=X<180?X:360-X,be=Math.log(we)*75,ke=qe.getOffsets(h,c,y);oe.set(Math.round(ke.x),{duration:be}),$e.set(Math.round(ke.y),{duration:be}),b=y}}function gn(){return qe.getOffsets(h,c,b)}var _n={getBody:d,setDisplayed:O,getDisplayed:J,setCollapsed:pt,getCollapsed:dt,getExpanded:vt,setAngle:yn,getOffsets:gn},Re=Vi();let $t;var yt=fr(Re);let er;Be(yt,y=>f=y,()=>f);var gt=li(yt,2);let tr;var rr=fr(gt);let nr;return Be(rr,y=>p=y,()=>p),Be(gt,y=>u=y,()=>u),Be(Re,y=>a=y,()=>a),Br((y,_e,X,we)=>{tn(Re,1,en(["anchor",g(w)&&"displayed"]),"svelte-11extwn"),$t=ze(Re,"",$t,y),er=ze(yt,"",er,_e),tr=ze(gt,"",tr,X),nr=ze(rr,"",nr,we)},[()=>({filter:`drop-shadow(${l})`}),()=>({"background-color":o}),()=>({margin:`${i}px;`}),()=>({width:`${r}px`,height:`${n}px`,"border-radius":`${s}px;`,"background-color":o})]),Qr(t,Re),zt(_n)}var He;(t=>{async function e(n,i){const s=await fetch(n,i);if(!s.ok)throw new Error(s.statusText);return s.json()}t.get=e;async function r(n,i,s){const o=await fetch(n,{method:"POST",body:JSON.stringify(i),headers:{"Content-Type":"application/json",...s?.headers},...s});if(!o.ok)throw new Error(o.statusText);return o.json()}t.post=r})(He||(He={}));var xe;(t=>{function e(l,a,u){return{x:n(a)*u,y:i(l)*u}}t.project=e;function r(l,a,u){return{lat:o(a/u),lng:s(l/u)}}t.unproject=r;function n(l){return(180+l)/360}function i(l){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+l*Math.PI/360)))/360}function s(l){return l*360-180}function o(l){return 360/Math.PI*Math.atan(Math.exp((180-l*360)*Math.PI/180))-90}})(xe||(xe={}));class sn{swLat;swLng;neLat;neLng;constructor(e,r,n,i,s){const o=n*Math.pow(2,r),l=xe.project(e.sw.lat,e.sw.lng,o),a=xe.project(e.ne.lat,e.ne.lng,o),u=l.x-i,f=l.y+s,p=a.x+i,h=a.y-s,c=xe.unproject(u,f,o),d=xe.unproject(p,h,o);this.swLat=c.lat,this.swLng=c.lng,this.neLat=d.lat,this.neLng=d.lng}contains(e,r){return this.swLat<=e&&e<=this.neLat?this.swLng<this.neLng?this.swLng<=r&&r<=this.neLng:r<=this.neLng||this.swLng<=r:!1}}var kt;function on(t){return{lang:t?.lang??kt?.lang,message:t?.message,abortEarly:t?.abortEarly??kt?.abortEarly,abortPipeEarly:t?.abortPipeEarly??kt?.abortPipeEarly}}var Xi;function Wi(t){return Xi?.get(t)}var Gi;function Ki(t){return Gi?.get(t)}var Ji;function Qi(t,e){return Ji?.get(t)?.get(e)}function Ke(t){const e=typeof t;return e==="string"?`"${t}"`:e==="number"||e==="bigint"||e==="boolean"?`${t}`:e==="object"||e==="function"?(t&&Object.getPrototypeOf(t)?.constructor?.name)??"null":e}function S(t,e,r,n,i){const s=i&&"input"in i?i.input:r.value,o=i?.expected??t.expects??null,l=i?.received??Ke(s),a={kind:t.kind,type:t.type,input:s,expected:o,received:l,message:`Invalid ${e}: ${o?`Expected ${o} but r`:"R"}eceived ${l}`,requirement:t.requirement,path:i?.path,issues:i?.issues,lang:n.lang,abortEarly:n.abortEarly,abortPipeEarly:n.abortPipeEarly},u=t.kind==="schema",f=i?.message??t.message??Qi(t.reference,a.lang)??(u?Ki(a.lang):null)??n.message??Wi(a.lang);f!==void 0&&(a.message=typeof f=="function"?f(a):f),u&&(r.typed=!1),r.issues?r.issues.push(a):r.issues=[a]}function N(t){return{version:1,vendor:"valibot",validate(e){return t["~run"]({value:e},on())}}}var ht=class extends Error{constructor(t){super(t[0].message),this.name="ValiError",this.issues=t}};function z(t){return{kind:"transformation",type:"args",reference:z,async:!1,schema:t,"~run"(e,r){const n=e.value;return e.value=(...i)=>{const s=this.schema["~run"]({value:i},r);if(s.issues)throw new ht(s.issues);return n(...s.value)},e}}}function an(){return{kind:"transformation",type:"await",reference:an,async:!0,async"~run"(t){return t.value=await t.value,t}}}function ln(t,e){return{kind:"validation",type:"check",reference:ln,async:!1,expects:null,requirement:t,message:e,"~run"(r,n){return r.typed&&!this.requirement(r.value)&&S(this,"input",r,n),r}}}function un(t,e){return{kind:"validation",type:"length",reference:un,async:!1,expects:`${t}`,requirement:t,message:e,"~run"(r,n){return r.typed&&r.value.length!==this.requirement&&S(this,"length",r,n,{received:`${r.value.length}`}),r}}}function Te(t,e){return{kind:"validation",type:"max_value",reference:Te,async:!1,expects:`<=${t instanceof Date?t.toJSON():Ke(t)}`,requirement:t,message:e,"~run"(r,n){return r.typed&&!(r.value<=this.requirement)&&S(this,"value",r,n,{received:r.value instanceof Date?r.value.toJSON():Ke(r.value)}),r}}}function Vt(t,e){return{kind:"validation",type:"min_length",reference:Vt,async:!1,expects:`>=${t}`,requirement:t,message:e,"~run"(r,n){return r.typed&&r.value.length<this.requirement&&S(this,"length",r,n,{received:`${r.value.length}`}),r}}}function ee(t,e){return{kind:"validation",type:"min_value",reference:ee,async:!1,expects:`>=${t instanceof Date?t.toJSON():Ke(t)}`,requirement:t,message:e,"~run"(r,n){return r.typed&&!(r.value>=this.requirement)&&S(this,"value",r,n,{received:r.value instanceof Date?r.value.toJSON():Ke(r.value)}),r}}}function W(t){return{kind:"transformation",type:"returns",reference:W,async:!1,schema:t,"~run"(e,r){const n=e.value;return e.value=(...i)=>{const s=this.schema["~run"]({value:n(...i)},r);if(s.issues)throw new ht(s.issues);return s.value},e}}}function fn(t){return{kind:"transformation",type:"returns",reference:fn,async:!1,schema:t,"~run"(e,r){const n=e.value;return e.value=async(...i)=>{const s=await this.schema["~run"]({value:await n(...i)},r);if(s.issues)throw new ht(s.issues);return s.value},e}}}function $i(t,e,r){return typeof t.fallback=="function"?t.fallback(e,r):t.fallback}function cn(t,e,r){return typeof t.default=="function"?t.default(e,r):t.default}function hn(t,e){return{kind:"schema",type:"array",reference:hn,expects:"Array",async:!1,item:t,message:e,get"~standard"(){return N(this)},"~run"(r,n){const i=r.value;if(Array.isArray(i)){r.typed=!0,r.value=[];for(let s=0;s<i.length;s++){const o=i[s],l=this.item["~run"]({value:o},n);if(l.issues){const a={type:"array",origin:"value",input:i,key:s,value:o};for(const u of l.issues)u.path?u.path.unshift(a):u.path=[a],r.issues?.push(u);if(r.issues||(r.issues=l.issues),n.abortEarly){r.typed=!1;break}}l.typed||(r.typed=!1),r.value.push(l.value)}}else S(this,"type",r,n);return r}}}function pn(t){return{kind:"schema",type:"boolean",reference:pn,expects:"boolean",async:!1,message:t,get"~standard"(){return N(this)},"~run"(e,r){return typeof e.value=="boolean"?e.typed=!0:S(this,"type",e,r),e}}}function dn(t,e){return{kind:"schema",type:"custom",reference:dn,expects:"unknown",async:!1,check:t,message:e,get"~standard"(){return N(this)},"~run"(r,n){return this.check(r.value)?r.typed=!0:S(this,"type",r,n),r}}}function B(t){return{kind:"schema",type:"function",reference:B,expects:"Function",async:!1,message:t,get"~standard"(){return N(this)},"~run"(e,r){return typeof e.value=="function"?e.typed=!0:S(this,"type",e,r),e}}}function k(t){return{kind:"schema",type:"number",reference:k,expects:"number",async:!1,message:t,get"~standard"(){return N(this)},"~run"(e,r){return typeof e.value=="number"&&!isNaN(e.value)?e.typed=!0:S(this,"type",e,r),e}}}function T(t,e){return{kind:"schema",type:"object",reference:T,expects:"Object",async:!1,entries:t,message:e,get"~standard"(){return N(this)},"~run"(r,n){const i=r.value;if(i&&typeof i=="object"){r.typed=!0,r.value={};for(const s in this.entries){const o=this.entries[s];if(s in i||(o.type==="exact_optional"||o.type==="optional"||o.type==="nullish")&&o.default!==void 0){const l=s in i?i[s]:cn(o),a=o["~run"]({value:l},n);if(a.issues){const u={type:"object",origin:"value",input:i,key:s,value:l};for(const f of a.issues)f.path?f.path.unshift(u):f.path=[u],r.issues?.push(f);if(r.issues||(r.issues=a.issues),n.abortEarly){r.typed=!1;break}}a.typed||(r.typed=!1),r.value[s]=a.value}else if(o.fallback!==void 0)r.value[s]=$i(o);else if(o.type!=="exact_optional"&&o.type!=="optional"&&o.type!=="nullish"&&(S(this,"key",r,n,{input:void 0,expected:`"${s}"`,path:[{type:"object",origin:"key",input:i,key:s,value:i[s]}]}),n.abortEarly))break}}else S(this,"type",r,n);return r}}}function U(t,e){return{kind:"schema",type:"optional",reference:U,expects:`(${t.expects} | undefined)`,async:!1,wrapped:t,default:e,get"~standard"(){return N(this)},"~run"(r,n){return r.value===void 0&&(this.default!==void 0&&(r.value=cn(this,r,n)),r.value===void 0)?(r.typed=!0,r):this.wrapped["~run"](r,n)}}}function vn(t){return{kind:"schema",type:"promise",reference:vn,expects:"Promise",async:!1,message:t,get"~standard"(){return N(this)},"~run"(e,r){return e.value instanceof Promise?e.typed=!0:S(this,"type",e,r),e}}}function re(t){return{kind:"schema",type:"string",reference:re,expects:"string",async:!1,message:t,get"~standard"(){return N(this)},"~run"(e,r){return typeof e.value=="string"?e.typed=!0:S(this,"type",e,r),e}}}function Z(t,e){return{kind:"schema",type:"tuple",reference:Z,expects:"Array",async:!1,items:t,message:e,get"~standard"(){return N(this)},"~run"(r,n){const i=r.value;if(Array.isArray(i)){r.typed=!0,r.value=[];for(let s=0;s<this.items.length;s++){const o=i[s],l=this.items[s]["~run"]({value:o},n);if(l.issues){const a={type:"array",origin:"value",input:i,key:s,value:o};for(const u of l.issues)u.path?u.path.unshift(a):u.path=[a],r.issues?.push(u);if(r.issues||(r.issues=l.issues),n.abortEarly){r.typed=!1;break}}l.typed||(r.typed=!1),r.value.push(l.value)}}else S(this,"type",r,n);return r}}}function Ye(t){return{kind:"schema",type:"void",reference:Ye,expects:"void",async:!1,message:t,get"~standard"(){return N(this)},"~run"(e,r){return e.value===void 0?e.typed=!0:S(this,"type",e,r),e}}}function tt(t,e,r){const n=t["~run"]({value:e},on(r));if(n.issues)throw new ht(n.issues);return n.value}function _(...t){return{...t[0],pipe:t,get"~standard"(){return N(this)},"~run"(e,r){for(const n of t)if(n.kind!=="metadata"){if(e.issues&&(n.kind==="schema"||n.kind==="transformation")){e.typed=!1;break}(!e.issues||!r.abortEarly&&!r.abortPipeEarly)&&(e=n["~run"](e,r))}return e}}}function es(...t){return{...t[0],pipe:t,async:!0,get"~standard"(){return N(this)},async"~run"(e,r){for(const n of t)if(n.kind!=="metadata"){if(e.issues&&(n.kind==="schema"||n.kind==="transformation")){e.typed=!1;break}(!e.issues||!r.abortEarly&&!r.abortPipeEarly)&&(e=await n["~run"](e,r))}return e}}}const Ct=_(k(),ee(-90),Te(90)),Tt=_(k(),ee(-180),Te(180)),ts=T({sw:T({lat:Ct,lng:Tt}),ne:T({lat:Ct,lng:Tt})}),Lt=dn(t=>t instanceof HTMLElement,"Must be an HTMLElement"),rs=T({mapSize:_(k(),ee(1)),zoomMin:_(k(),ee(0)),zoomMax:_(k(),ee(0)),zoomScale:_(k(),ee(1),Te(10))}),ns=T({inserted:_(B(),z(Z([])),W(pn())),insert:_(B(),z(Z([])),W(Ye())),remove:_(B(),z(Z([])),W(Ye())),update:_(B(),z(Z([k()])),W(Ye()))}),is=T({getParameters:_(B(),z(Z([])),W(rs)),getContainer:_(B(),z(Z([])),W(Lt)),getZoom:_(B(),z(Z([])),W(k())),getBounds:_(B(),z(Z([])),W(ts)),panBy:_(B(),z(Z([k(),k()])),W(Ye())),createMarker:_(B(),z(Z([Lt,Ct,Tt,k()])),W(ns))}),Et=_(B(),z(Z([re()])),fn(es(vn(),an(),Lt))),ss=T({background:U(re()),border:U(re()),shadow:U(re())}),os=T({width:k(),height:k(),radius:k()}),_r=T({background:U(re()),shadow:U(re())}),wr=_(T({width:k(),height:k(),margin:k(),radius:k()}),ln(t=>Math.min(t.width,t.height)/t.margin>=6,"Tooltip: minimum of width or height must be greater than or equal to 6 * margin")),as=T({id:_(re(),Vt(1)),rank:_(k(),ee(0)),lat:_(k(),ee(-90),Te(90)),lng:_(k(),ee(-180),Te(180)),tooltip:T({body:Et,style:wr,colors:U(_r)}),pin:U(T({body:Et,style:U(os),colors:U(ss)})),popup:U(T({body:Et,style:wr,colors:U(_r)}))}),ls=hn(as);var ye;(t=>{t.COUNT=12,t.DEGREES=[0,30,60,90,120,150,180,210,240,270,300,330],t.DEGREES_DEFAULT=270})(ye||(ye={}));const us=_(re(),un(32)),fs=_(re(),Vt(1)),br="1.2.0",Xt="https://maps.api.arenarium.dev",cs=`${Xt}/auth`,hs=`${Xt}/states`,ps=`${Xt}/log`;class Wt{apiKey;apiToken;apiDevEnvironment;mapProvider;markerDataArray=new Array;markerDataMap=new Map;markerDataUpdating=!1;markerPinProcessor;markerTooltipProcessor;markerPopupProcessor;constructor(e,r,n,i){tt(us,e),tt(fs,r),tt(is,n),this.apiKey=e,this.apiToken=r,this.apiDevEnvironment=window?.location.host.startsWith("localhost")||window?.location.host.startsWith("127.0.0.1"),this.mapProvider=n,this.markerPinProcessor=new lt(n),this.markerTooltipProcessor=new vs(n),this.markerPopupProcessor=new ms(n),this.setConfiguration(i)}static async create(e,r,n){const i={key:e,version:br};let o=(await He.post(cs,i)).token;if(!o)throw new Error("Failed to get api token");return new Wt(e,o,r,n)}setConfiguration(e){ae.setLimit(e?.animation?.queue?.limit??8*navigator.hardwareConcurrency),this.markerPinProcessor.setConfiguration(e)}async updateMarkers(e){tt(ls,e);try{await this.updateMarkerData(e),this.processMarkerDataCallback()}catch(r){throw console.error(r),this.removeMarkerData(),r instanceof Error&&this.log("error","Failed to update markers",r),r}}removeMarkers(){try{this.removeMarkerData()}catch(e){throw console.error(e),e instanceof Error&&this.log("error","Failed to remove markers",e),e}}showPopup(e){try{for(const r of this.markerDataArray)r.marker.id==e?this.markerPopupProcessor.show(r):this.markerPopupProcessor.hide(r)}catch(r){console.error(r);for(const n of this.markerDataArray)this.markerPopupProcessor.hide(n);throw r instanceof Error&&this.log("error","Failed to show popup",r),r}}hidePopup(e){try{if(e){const r=this.markerDataMap.get(e);if(r==null)return;this.markerPopupProcessor.hide(r)}else for(const r of this.markerDataArray)this.markerPopupProcessor.hide(r)}catch(r){console.error(r);for(const n of this.markerDataArray)this.markerPopupProcessor.hide(n);throw r instanceof Error&&this.log("error","Failed to hide popup",r),r}}async updateMarkerData(e){try{let r=this.markerDataArray.map(i=>i.marker);for(let i=0;i<e.length;i++){const s=e[i];this.markerDataMap.get(s.id)||r.push(s)}const n=await this.getMarkerStates(r);try{this.markerDataUpdating=!0;for(let i=0;i<r.length;i++){const s=r[i],o=n[i],l=this.markerDataMap.get(s.id);if(l)l.update(o);else{const a=new ds(this.mapProvider,s,o);a.create(),this.markerDataMap.set(s.id,a),this.markerDataArray.push(a)}}this.markerDataArray.sort((i,s)=>i.zoom-s.zoom),this.markerPinProcessor.updateElements(this.markerDataArray.map(i=>i.pin)),this.markerTooltipProcessor.updateElements(this.markerDataArray.map(i=>i.tooltip)),this.markerPopupProcessor.updateElements(this.markerDataArray.map(i=>i.popup).filter(i=>i!=null))}finally{this.markerDataUpdating=!1}}catch(r){throw console.error(r),this.markerDataArray.forEach(n=>n.remove()),this.markerDataArray.length=0,this.markerDataMap.clear(),r instanceof Error&&this.log("error","Failed to update marker data",r),r}finally{this.markerDataUpdating=!1}}removeMarkerData(){try{this.markerDataUpdating=!0,this.markerPinProcessor.removeElements(),this.markerTooltipProcessor.removeElements(),this.markerPopupProcessor.removeElements(),this.markerDataArray.length=0,this.markerDataMap.clear()}catch(e){throw console.error(e),e instanceof Error&&this.log("error","Failed to remove marker data",e),e}finally{this.markerDataUpdating=!1}}async getMarkerStates(e){if(e.length==0)return[];if(e.length==1)return[[0,[[0,ye.DEGREES.indexOf(ye.DEGREES_DEFAULT)]]]];const r=e.map(s=>({id:s.id,rank:s.rank,lat:s.lat,lng:s.lng,width:s.tooltip.style.width,height:s.tooltip.style.height,margin:s.tooltip.style.margin})),n={key:this.apiKey,token:this.apiToken,parameters:this.mapProvider.getParameters(),input:r},i=await He.post(hs,n,{headers:{"Cache-Control":this.apiDevEnvironment?"no-cache":""}});return i.token&&(this.apiToken=i.token),i.states}processMarkerDataCallback(){if(this.mapProvider.getContainer().parentElement!=null&&this.markerDataArray.length!=0)try{this.processMarkerData(),window.setTimeout(this.processMarkerDataCallback.bind(this),25)}catch(e){console.error(e),e instanceof Error&&this.log("error","Failed to process marker data",e)}}processMarkerData(){if(this.markerDataUpdating)return;const e=this.mapProvider.getBounds(),r=this.mapProvider.getZoom();this.markerPopupProcessor.process(),this.markerTooltipProcessor.process(e,r),this.markerPinProcessor.process(e,r)}async log(e,r,n){if(!this.apiDevEnvironment)try{const i={key:this.apiKey,title:r,level:e,content:{version:br,...n}};await He.post(ps,i)}catch(i){console.error(i)}}}class ds{marker;zoom;pin;tooltip;popup;constructor(e,r,n){this.marker=r,this.zoom=n[0],this.pin=new Ve(e,r,n),this.tooltip=new Kt(e,r,n),r.popup&&(this.popup=new Jt(e,r))}create(){this.pin.create(),this.tooltip.create(),this.popup?.create()}update(e){this.pin.update(e),this.tooltip.update(e)}remove(){this.pin.remove(),this.tooltip.remove(),this.popup?.remove()}}class Gt{provider;id;lat;lng;shown;element;component;marker;constructor(e,r){this.provider=e,this.id=r.id,this.lat=r.lat,this.lng=r.lng,this.shown=!0}create(){this.createElement(),this.createMarker(),this.updateZIndex()}createElement(){throw new Error("Create element not implemented")}createMarker(){const e=this.element;if(!e)throw new Error("Failed to create provider marker");this.marker=this.provider.createMarker(e,this.lat,this.lng,this.getZindex())}updateZIndex(){if(this.marker==null)throw new Error("Failed to update provider marker z-index");this.marker.update(this.getZindex())}updateMap(e){const r=this.marker,n=this.component;if(r==null||n==null)throw new Error("Failed to update provider marker map");e?r.inserted()==!1&&r.insert():r.inserted()==!0&&r.remove()}getZindex(){throw new Error("Get z-index not implemented")}remove(){this.marker?.remove()}}class Ve extends Gt{static DEFAULT_SIZE=16;style;colors;zoom;bodyLoading=!1;bodyLoaded=!1;bodyCallback;constructor(e,r,n){super(e,r),this.style=r.pin?.style??{width:Ve.DEFAULT_SIZE,height:Ve.DEFAULT_SIZE,radius:Ve.DEFAULT_SIZE},this.colors=r.pin?.colors,this.zoom=n[0],this.bodyCallback=r.pin?.body}createElement(){this.element=document.createElement("div"),this.element.classList.add("pin"),this.component=Ht(Yi,{target:this.element,props:{id:this.id+"_pin",layer:Zi,priority:this.zoom*this.provider.getParameters().zoomScale,style:this.style,colors:this.colors}})}update(e){this.zoom=e[0],this.updateZIndex()}updateMap(e){super.updateMap(e),this.component?.setDisplayed(e)}updateBody(){if(this.bodyCallback==null||this.bodyLoaded||this.bodyLoading)return;const e=this.component?.getBody();e!=null&&(this.bodyLoading=!0,this.bodyCallback(this.id).then(r=>{r instanceof HTMLElement?e.appendChild(r):console.error("Failed to load pin body")}).catch(r=>console.error(r)).finally(()=>{this.bodyLoaded=!0,this.bodyLoading=!1}))}setCollapsed(e){if(this.component==null)throw new Error("Failed to set pin collapsed");this.component.setCollapsed(e)}setScale(e){if(this.component==null)throw new Error("Failed to set pin scale");this.component.setScale(e)}getScaleFromZoomDistance(e){return this.zoom<e?1:Math.max(0,1-(this.zoom-e)*.125)}getZindex(){const e=this.provider.getParameters();return Math.round((e.zoomMax-this.zoom)*e.zoomScale)}isCollapsed(){return this.component==null?!1:this.component.getCollapsed()}isBodyLoaded(){return this.bodyCallback==null||this.bodyLoaded}}class lt{static MAP_PINS_MAX_ZOOM=2;static MAP_PINS_MAX_COUNT=128;provider;pinElements=new Array;pinMaxWidth=0;pinMaxHeight=0;pinFade=!1;pinMaxCount=0;pinMaxZoomDelta=0;constructor(e){this.provider=e}setConfiguration(e){this.pinFade=e?.pin?.fade??!0,this.pinMaxCount=e?.pin?.maxCount??Math.max(lt.MAP_PINS_MAX_COUNT,8*navigator.hardwareConcurrency),this.pinMaxZoomDelta=e?.pin?.maxZoom??lt.MAP_PINS_MAX_ZOOM}updateElements(e){this.pinElements=e,this.pinMaxWidth=e.reduce((r,n)=>Math.max(r,n.style.width),0),this.pinMaxHeight=e.reduce((r,n)=>Math.max(r,n.style.height),0)}removeElements(){this.pinElements.forEach(e=>e.remove()),this.pinElements.length=0}process(e,r){const n=this.provider.getParameters().mapSize,i=new sn(e,r,n,this.pinMaxWidth*2,this.pinMaxHeight*2);let s=0;for(const o of this.pinElements)i.contains(o.lat,o.lng)?o.shown&&r<o.zoom&&o.zoom<r+this.pinMaxZoomDelta?(s<this.pinMaxCount&&(o.setCollapsed(!1),o.setScale(this.pinFade?o.getScaleFromZoomDistance(r):1),o.updateMap(!0),o.isBodyLoaded()==!1&&o.updateBody()),s++):(o.setCollapsed(!0),o.isCollapsed()&&o.updateMap(!1)):o.updateMap(!1)}}class Kt extends Gt{static Z_INDEX_OFFSET=1e6;style;colors;zoom;angle;states;bodyLoading=!1;bodyLoaded=!1;bodyCallback;constructor(e,r,n){super(e,r),this.style=r.tooltip.style,this.colors=r.tooltip.colors,this.zoom=n[0],this.angle=ye.DEGREES_DEFAULT,this.states=n[1].map(i=>[i[0],ye.DEGREES[i[1]]]),this.bodyCallback=r.tooltip.body}createElement(){this.element=document.createElement("div"),this.element.classList.add("tooltip"),this.component=Ht(nn,{target:this.element,props:{id:this.id+"_tooltip",layer:Ui,priority:this.zoom*this.provider.getParameters().zoomScale,style:this.style,colors:this.colors}})}update(e){this.zoom=e[0],this.states=e[1].map(r=>[r[0],ye.DEGREES[r[1]]]),this.updateZIndex()}updateMap(e){super.updateMap(e),this.component?.setDisplayed(e)}updateState(e){if(this.component==null)throw new Error("Failed to update tooltip state");this.angle=this.getAngle(e),this.component.setAngle(this.angle)}updateBody(){if(this.bodyLoaded||this.bodyLoading)return;const e=this.component?.getBody();e!=null&&(this.bodyLoading=!0,this.bodyCallback(this.id).then(r=>{r instanceof HTMLElement?e.appendChild(r):console.error("Failed to load tooltip body")}).catch(r=>console.error(r)).finally(()=>{this.bodyLoaded=!0,this.bodyLoading=!1}))}getAngle(e){const r=this.states.findLast(n=>n[0]<=e);if(!r)throw new Error("Angle not found");return r[1]}getZindex(){const e=this.provider.getParameters();return Math.round((e.zoomMax-this.zoom)*e.zoomScale)+Kt.Z_INDEX_OFFSET}setCollapsed(e){if(this.component==null)throw new Error("Failed to set tooltip collapsed");this.component.setCollapsed(e)}isExpanded(){return this.component==null?!1:this.component.getExpanded()}isCollapsed(){return this.component==null?!1:this.component.getCollapsed()}isBodyLoaded(){return this.bodyLoaded}}class vs{provider;tooltipElements=new Array;tooltipMaxWidth=0;tooltipMaxHeight=0;constructor(e){this.provider=e}updateElements(e){this.tooltipElements=e,this.tooltipMaxWidth=this.tooltipElements.reduce((r,n)=>Math.max(r,n.style.width),0),this.tooltipMaxHeight=this.tooltipElements.reduce((r,n)=>Math.max(r,n.style.height),0)}removeElements(){this.tooltipElements.forEach(e=>e.remove()),this.tooltipElements.length=0}process(e,r){const n=this.provider.getParameters().mapSize,i=new sn(e,r,n,this.tooltipMaxWidth*2,this.tooltipMaxHeight*2);for(const s of this.tooltipElements)i.contains(s.lat,s.lng)?s.shown&&s.zoom<=r?(s.updateState(r),s.setCollapsed(!1),s.updateMap(!0),s.isCollapsed()==!1&&s.isBodyLoaded()==!1&&s.updateBody()):(s.setCollapsed(!0),s.isCollapsed()&&s.updateMap(!1)):s.updateMap(!1)}}class Jt extends Gt{static Z_INDEX_OFFSET=2e6;style;colors;bodyLoading=!1;bodyLoaded=!1;bodyCallback;constructor(e,r){if(r.popup==null)throw new Error("Failed to create popup");super(e,r),this.shown=!1,this.style=r.popup.style,this.colors=r.popup.colors,this.bodyCallback=r.popup.body}createElement(){this.element=document.createElement("div"),this.element.classList.add("popup"),this.component=Ht(nn,{target:this.element,props:{id:this.id+"_popup",layer:Bi,priority:0,style:this.style,colors:this.colors}})}updateMap(e){super.updateMap(e),this.component?.setDisplayed(e)}updateBody(){if(this.bodyLoaded||this.bodyLoading)return;const e=this.component?.getBody();e!=null&&(this.bodyLoading=!0,this.bodyCallback(this.id).then(r=>{r instanceof HTMLElement?e.appendChild(r):console.error("Failed to load popup body")}).catch(r=>console.error(r)).finally(()=>{this.bodyLoaded=!0,this.bodyLoading=!1}))}getZindex(){return Jt.Z_INDEX_OFFSET}setCollapsed(e){if(this.component==null)throw new Error("Failed to set popup collapsed");this.component.setCollapsed(e)}setAngle(e){if(this.component==null)throw new Error("Failed to set popup angle");this.component.setAngle(e,!0)}isExpanded(){return this.component==null?!1:this.component.getExpanded()}isCollapsed(){return this.component==null?!1:this.component.getCollapsed()}isBodyLoaded(){return this.bodyLoaded}}class ms{provider;popupElements=new Array;popupPositioned=new Map;constructor(e){this.provider=e}show(e){e.popup&&(e.pin.shown=!1,e.tooltip.shown=!1,this.popupPositioned.set(e.marker.id,!1),e.popup.setAngle(e.tooltip.angle),e.popup.shown=!0)}hide(e){e.popup&&(e.pin.shown=!0,e.tooltip.shown=!0,e.popup.shown=!1)}updateElements(e){this.popupElements=e,this.popupPositioned=new Map(e.map(r=>[r.id,!1]))}removeElements(){this.popupElements.forEach(e=>e.remove()),this.popupElements.length=0,this.popupPositioned.clear()}process(){for(const e of this.popupElements)if(e.shown){if(e.setCollapsed(!1),e.updateMap(!0),e.isExpanded()&&e.isBodyLoaded()==!1&&e.updateBody(),e.isCollapsed()==!1&&this.popupPositioned.get(e.id)==!1){const r=e.component?.getBody();if(r==null)continue;const n=e.component?.getOffsets();if(n==null)continue;const i=r.getBoundingClientRect();if(i.x==0&&i.y==0&&i.width==0&&i.height==0)continue;const s=i.x+i.width/2,o=i.y+i.height/2,l=s+n.x,a=o+n.y,u=l+e.style.width,f=a+e.style.height,p=this.provider.getContainer().getBoundingClientRect(),h=l-p.left,c=p.right-u,d=a-p.top,w=p.bottom-f,O=Math.min(e.style.width,e.style.height)/4,J=h<0?h-O:c<0?-c+O:0,E=d<0?d-O:w<0?-w+O:0;this.provider.panBy(J,E),this.popupPositioned.set(e.id,!0)}}else e.setCollapsed(!0),e.isCollapsed()&&e.updateMap(!1)}}const mn=()=>'<img src="https://arenarium.dev/favicon.svg" alt="Arenarium Maps" style="height: 1.25em; vertical-align: middle;" />',ys=()=>`<a href="https://arenarium.dev" target="_blank" style="color: inherit;">${mn()}<span> @arenarium/maps</span></a>`;exports.MapManager=Wt;exports.getAttributionHtml=ys;exports.getImageHtml=mn;
|