@arenarium/maps 1.0.189 → 1.0.190

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 CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";var Cs=Object.defineProperty;var Qr=r=>{throw TypeError(r)};var Ts=(r,e,t)=>e in r?Cs(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var f=(r,e,t)=>Ts(r,typeof e!="symbol"?e+"":e,t),Qt=(r,e,t)=>e.has(r)||Qr("Cannot "+t);var k=(r,e,t)=>(Qt(r,e,"read from private field"),t?t.call(r):e.get(r)),P=(r,e,t)=>e.has(r)?Qr("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),j=(r,e,t,n)=>(Qt(r,e,"write to private field"),n?n.call(r,t):e.set(r,t),t),Te=(r,e,t)=>(Qt(r,e,"access private method"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const H=require("./states-Dj48QyzN.cjs"),On=!1;var Nn=Array.isArray,As=Array.prototype.indexOf,Ms=Array.from,ar=Object.defineProperty,ft=Object.getOwnPropertyDescriptor,Os=Object.prototype,Ns=Array.prototype,Rs=Object.getPrototypeOf,en=Object.isExtensible;function Is(r){for(var e=0;e<r.length;e++)r[e]()}function Ls(){var r,e,t=new Promise((n,s)=>{r=n,e=s});return{promise:t,resolve:r,reject:e}}const X=2,Nr=4,Rn=8,Ht=16,Se=32,Pe=64,In=128,ee=256,Dt=512,q=1024,se=2048,Ce=4096,Je=8192,at=16384,Rr=32768,Ds=65536,tn=1<<17,Ps=1<<18,Ir=1<<19,Ln=1<<20,ir=1<<21,Lr=1<<22,Ne=1<<23,Nt=Symbol("$state"),Dr=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 Zs(){throw new Error("https://svelte.dev/e/await_outside_boundary")}function js(){throw new Error("https://svelte.dev/e/async_derived_orphan")}function Fs(r){throw new Error("https://svelte.dev/e/effect_in_teardown")}function zs(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function Vs(r){throw new Error("https://svelte.dev/e/effect_orphan")}function Bs(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function Us(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function $s(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function qs(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}const Ws=2,F=Symbol();function Dn(r){return r===this.v}let Ys=!1,ae=null;function Pt(r){ae=r}function Pr(r,e=!1,t){ae={p:ae,c:null,e:null,s:r,x:null,l:null}}function Zr(r){var e=ae,t=e.e;if(t!==null){e.e=null;for(var n of t)Gn(n)}return r!==void 0&&(e.x=r),ae=e.p,r??{}}function Pn(){return!0}const Hs=new WeakMap;function Xs(r){var e=M;if(e===null)return S.f|=Ne,r;if((e.f&Rr)===0){if((e.f&In)===0)throw!e.parent&&r instanceof Error&&Zn(r),r;e.b.error(r)}else jr(r,e)}function jr(r,e){for(;e!==null;){if((e.f&In)!==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=Hs.get(r);e&&(ar(r,"message",{value:e.message}),ar(r,"stack",{value:e.stack}))}let Zt=[];function Gs(){var r=Zt;Zt=[],Is(r)}function Js(r){Zt.length===0&&queueMicrotask(Gs),Zt.push(r)}function Ks(){for(var r=M.b;r!==null&&!r.has_pending_snippet();)r=r.parent;return r===null&&Zs(),r}function Qs(r){var e=X|se,t=S!==null&&(S.f&X)!==0?S:null;return M===null||t!==null&&(t.f&ee)!==0?e|=ee:M.f|=Ir,{ctx:ae,deps:null,effects:null,equals:Dn,f:e,fn:r,reactions:null,rv:0,v:F,wv:0,parent:t??M,ac:null}}function ea(r,e){let t=M;t===null&&js();var n=t.b,s=void 0,a=Un(F),i=null,o=!S;return ha(()=>{try{var l=r()}catch(v){l=Promise.reject(v)}var u=()=>l;s=(i==null?void 0:i.then(u,u))??Promise.resolve(l),i=s;var d=Z,h=n.pending;o&&(n.update_pending_count(1),h||d.increment());const p=(v,x=void 0)=>{i=null,h||d.activate(),x?x!==Dr&&(a.f|=Ne,ur(a,x)):((a.f&Ne)!==0&&(a.f^=Ne),ur(a,v)),o&&(n.update_pending_count(-1),h||d.decrement()),zn()};if(s.then(p,v=>p(null,v||"unknown")),d)return()=>{queueMicrotask(()=>d.neuter())}}),new Promise(l=>{function u(d){function h(){d===s?l(a):u(s)}d.then(h,h)}u(s)})}function jn(r){var e=r.effects;if(e!==null){r.effects=null;for(var t=0;t<e.length;t+=1)Le(e[t])}}function ta(r){for(var e=r.parent;e!==null;){if((e.f&X)===0)return e;e=e.parent}return null}function Fr(r){var e,t=M;Qe(ta(r));try{jn(r),e=is(r)}finally{Qe(t)}return e}function Fn(r){var e=Fr(r);if(r.equals(e)||(r.v=e,r.wv=ss()),!it)if(_e!==null)_e.set(r,r.v);else{var t=(ye||(r.f&ee)!==0)&&r.deps!==null?Ce:q;te(r,t)}}function ra(r,e,t){const n=Qs;if(e.length===0){t(r.map(n));return}var s=Z,a=M,i=na(),o=Ks();Promise.all(e.map(l=>ea(l))).then(l=>{s==null||s.activate(),i();try{t([...r.map(n),...l])}catch(u){(a.f&at)===0&&jr(u,a)}s==null||s.deactivate(),zn()}).catch(l=>{o.error(l)})}function na(){var r=M,e=S,t=ae;return function(){Qe(r),xe(e),Pt(t)}}function zn(){Qe(null),xe(null),Pt(null)}const ut=new Set;let Z=null,_e=null,rn=new Set,jt=[];function Vn(){const r=jt.shift();jt.length>0&&queueMicrotask(Vn),r()}let mt=[],zr=null,or=!1;var We,Ye,ve,xt,bt,Ae,He,Me,ge,Xe,Et,St,ne,Bn,Rt,lr;const qt=class qt{constructor(){P(this,ne);f(this,"current",new Map);P(this,We,new Map);P(this,Ye,new Set);P(this,ve,0);P(this,xt,null);P(this,bt,!1);P(this,Ae,[]);P(this,He,[]);P(this,Me,[]);P(this,ge,[]);P(this,Xe,[]);P(this,Et,[]);P(this,St,[]);f(this,"skipped_effects",new Set)}process(e){var a;mt=[];var t=null;if(ut.size>1){t=new Map,_e=new Map;for(const[i,o]of this.current)t.set(i,{v:i.v,wv:i.wv}),i.v=o;for(const i of ut)if(i!==this)for(const[o,l]of k(i,We))t.has(o)||(t.set(o,{v:o.v,wv:o.wv}),o.v=l)}for(const i of e)Te(this,ne,Bn).call(this,i);if(k(this,Ae).length===0&&k(this,ve)===0){Te(this,ne,lr).call(this);var n=k(this,Me),s=k(this,ge);j(this,Me,[]),j(this,ge,[]),j(this,Xe,[]),Z=null,nn(n),nn(s),Z===null?Z=this:ut.delete(this),(a=k(this,xt))==null||a.resolve()}else Te(this,ne,Rt).call(this,k(this,Me)),Te(this,ne,Rt).call(this,k(this,ge)),Te(this,ne,Rt).call(this,k(this,Xe));if(t){for(const[i,{v:o,wv:l}]of t)i.wv<=l&&(i.v=o);_e=null}for(const i of k(this,Ae))ht(i);for(const i of k(this,He))ht(i);j(this,Ae,[]),j(this,He,[])}capture(e,t){k(this,We).has(e)||k(this,We).set(e,t),this.current.set(e,e.v)}activate(){Z=this}deactivate(){Z=null;for(const e of rn)if(rn.delete(e),e(),Z!==null)break}neuter(){j(this,bt,!0)}flush(){mt.length>0?sa():Te(this,ne,lr).call(this),Z===this&&(k(this,ve)===0&&ut.delete(this),this.deactivate())}increment(){j(this,ve,k(this,ve)+1)}decrement(){if(j(this,ve,k(this,ve)-1),k(this,ve)===0){for(const e of k(this,Et))te(e,se),Ke(e);for(const e of k(this,St))te(e,Ce),Ke(e);j(this,Me,[]),j(this,ge,[]),this.flush()}else this.deactivate()}add_callback(e){k(this,Ye).add(e)}settled(){return(k(this,xt)??j(this,xt,Ls())).promise}static ensure(){if(Z===null){const e=Z=new qt;ut.add(Z),qt.enqueue(()=>{Z===e&&e.flush()})}return Z}static enqueue(e){jt.length===0&&queueMicrotask(Vn),jt.unshift(e)}};We=new WeakMap,Ye=new WeakMap,ve=new WeakMap,xt=new WeakMap,bt=new WeakMap,Ae=new WeakMap,He=new WeakMap,Me=new WeakMap,ge=new WeakMap,Xe=new WeakMap,Et=new WeakMap,St=new WeakMap,ne=new WeakSet,Bn=function(e){var d;e.f^=q;for(var t=e.first;t!==null;){var n=t.f,s=(n&(Se|Pe))!==0,a=s&&(n&q)!==0,i=a||(n&Je)!==0||this.skipped_effects.has(t);if(!i&&t.fn!==null){if(s)t.f^=q;else if((n&q)===0)if((n&Nr)!==0)k(this,ge).push(t);else if((n&Lr)!==0){var o=(d=t.b)!=null&&d.pending?k(this,He):k(this,Ae);o.push(t)}else Xt(t)&&((t.f&Ht)!==0&&k(this,Xe).push(t),ht(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}},Rt=function(e){for(const t of e)((t.f&se)!==0?k(this,Et):k(this,St)).push(t),te(t,q);e.length=0},lr=function(){if(!k(this,bt))for(const e of k(this,Ye))e();k(this,Ye).clear()};let vt=qt;function sa(){var r=$e;or=!0;try{var e=0;for(an(!0);mt.length>0;){var t=vt.ensure();if(e++>1e3){var n,s;aa()}t.process(mt),Re.clear()}}finally{or=!1,an(r),zr=null}}function aa(){try{Bs()}catch(r){jr(r,zr)}}function nn(r){var e=r.length;if(e!==0){for(var t=0;t<e;){var n=r[t++];if((n.f&(at|Je))===0&&Xt(n)){var s=Z?Z.current.size:0;if(ht(n),n.deps===null&&n.first===null&&n.nodes_start===null&&(n.teardown===null&&n.ac===null?ts(n):n.fn=null),Z!==null&&Z.current.size>s&&(n.f&Ln)!==0)break}}for(;t<e;)Ke(r[t++])}}function Ke(r){for(var e=zr=r;e.parent!==null;){e=e.parent;var t=e.f;if(or&&e===M&&(t&Ht)!==0)return;if((t&(Pe|Se))!==0){if((t&q)===0)return;e.f^=q}}mt.push(e)}const Re=new Map;function Un(r,e){var t={f:0,v:r,reactions:null,equals:Dn,rv:0,wv:0};return t}function $(r,e){const t=Un(r);return ya(t),t}function B(r,e,t=!1){S!==null&&(!ie||(S.f&tn)!==0)&&Pn()&&(S.f&(X|Ht|Lr|tn))!==0&&!(U!=null&&U.includes(r))&&qs();let n=t?dt(e):e;return ur(r,n)}function ur(r,e){if(!r.equals(e)){var t=r.v;it?Re.set(r,e):Re.set(r,t),r.v=e;var n=vt.ensure();n.capture(r,t),(r.f&X)!==0&&((r.f&se)!==0&&Fr(r),te(r,(r.f&ee)===0?q:Ce)),r.wv=ss(),$n(r,se),M!==null&&(M.f&q)!==0&&(M.f&(Se|Pe))===0&&(Q===null?wa([r]):Q.push(r))}return e}function er(r){B(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&&te(a,e),(i&X)!==0?$n(a,Ce):o&&Ke(a)}}function dt(r){if(typeof r!="object"||r===null||Nt in r)return r;const e=Rs(r);if(e!==Os&&e!==Ns)return r;var t=new Map,n=Nn(r),s=$(0),a=Ie,i=o=>{if(Ie===a)return o();var l=S,u=Ie;xe(null),ln(a);var d=o();return xe(l),ln(u),d};return n&&t.set("length",$(r.length)),new Proxy(r,{defineProperty(o,l,u){(!("value"in u)||u.configurable===!1||u.enumerable===!1||u.writable===!1)&&Us();var d=t.get(l);return d===void 0?d=i(()=>{var h=$(u.value);return t.set(l,h),h}):B(d,u.value,!0),!0},deleteProperty(o,l){var u=t.get(l);if(u===void 0){if(l in o){const d=i(()=>$(F));t.set(l,d),er(s)}}else B(u,F),er(s);return!0},get(o,l,u){var v;if(l===Nt)return r;var d=t.get(l),h=l in o;if(d===void 0&&(!h||(v=ft(o,l))!=null&&v.writable)&&(d=i(()=>{var x=dt(h?o[l]:F),N=$(x);return N}),t.set(l,d)),d!==void 0){var p=L(d);return p===F?void 0:p}return Reflect.get(o,l,u)},getOwnPropertyDescriptor(o,l){var u=Reflect.getOwnPropertyDescriptor(o,l);if(u&&"value"in u){var d=t.get(l);d&&(u.value=L(d))}else if(u===void 0){var h=t.get(l),p=h==null?void 0:h.v;if(h!==void 0&&p!==F)return{enumerable:!0,configurable:!0,value:p,writable:!0}}return u},has(o,l){var p;if(l===Nt)return!0;var u=t.get(l),d=u!==void 0&&u.v!==F||Reflect.has(o,l);if(u!==void 0||M!==null&&(!d||(p=ft(o,l))!=null&&p.writable)){u===void 0&&(u=i(()=>{var v=d?dt(o[l]):F,x=$(v);return x}),t.set(l,u));var h=L(u);if(h===F)return!1}return d},set(o,l,u,d){var z;var h=t.get(l),p=l in o;if(n&&l==="length")for(var v=u;v<h.v;v+=1){var x=t.get(v+"");x!==void 0?B(x,F):v in o&&(x=i(()=>$(F)),t.set(v+"",x))}if(h===void 0)(!p||(z=ft(o,l))!=null&&z.writable)&&(h=i(()=>$(void 0)),B(h,dt(u)),t.set(l,h));else{p=h.v!==F;var N=i(()=>dt(u));B(h,N)}var I=Reflect.getOwnPropertyDescriptor(o,l);if(I!=null&&I.set&&I.set.call(d,u),!p){if(n&&typeof l=="string"){var J=t.get("length"),T=Number(l);Number.isInteger(T)&&T>=J.v&&B(J,T+1)}er(s)}return!0},ownKeys(o){L(s);var l=Reflect.ownKeys(o).filter(h=>{var p=t.get(h);return p===void 0||p.v!==F});for(var[u,d]of t)d.v!==F&&!(u in o)&&l.push(u);return l},setPrototypeOf(){$s()}})}var sn,qn,Wn,Yn;function ia(){if(sn===void 0){sn=window,qn=/Firefox/.test(navigator.userAgent);var r=Element.prototype,e=Node.prototype,t=Text.prototype;Wn=ft(e,"firstChild").get,Yn=ft(e,"nextSibling").get,en(r)&&(r.__click=void 0,r.__className=void 0,r.__attributes=null,r.__style=void 0,r.__e=void 0),en(t)&&(t.__t=void 0)}}function oa(r=""){return document.createTextNode(r)}function Hn(r){return Wn.call(r)}function Xn(r){return Yn.call(r)}function dr(r,e){return Hn(r)}function la(r,e=1,t=!1){let n=r;for(;e--;)n=Xn(n);return n}function ua(r){M===null&&S===null&&Vs(),S!==null&&(S.f&ee)!==0&&M===null&&zs(),it&&Fs()}function da(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&Je)!==0&&(r|=Je);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{ht(a),a.f|=Rr}catch(l){throw Le(a),l}else e!==null&&Ke(a);var i=t&&a.deps===null&&a.first===null&&a.nodes_start===null&&a.teardown===null&&(a.f&Ir)===0;if(!i&&n&&(s!==null&&da(a,s),S!==null&&(S.f&X)!==0&&(r&Pe)===0)){var o=S;(o.effects??(o.effects=[])).push(a)}return a}function ce(r){ua();var e=M.f,t=!S&&(e&Se)!==0&&(e&Rr)===0;if(t){var n=ae;(n.e??(n.e=[])).push(r)}else return Gn(r)}function Gn(r){return Ze(Nr|Ln,r,!1)}function ca(r){vt.ensure();const e=Ze(Pe,r,!0);return(t={})=>new Promise(n=>{t.outro?ga(e,()=>{Le(e),n(void 0)}):(Le(e),n(void 0))})}function fa(r){return Ze(Nr,r,!1)}function ha(r){return Ze(Lr|Ir,r,!0)}function Jn(r,e=0){return Ze(Rn|e,r,!0)}function Kn(r,e=[],t=[]){ra(e,t,n=>{Ze(Rn,()=>r(...n.map(L)),!0)})}function pa(r,e=!0){return Ze(Se,r,!0,e)}function Qn(r){var e=r.teardown;if(e!==null){const t=it,n=S;on(!0),xe(null);try{e.call(null)}finally{on(t),xe(n)}}}function es(r,e=!1){var s;var t=r.first;for(r.first=r.last=null;t!==null;){(s=t.ac)==null||s.abort(Dr);var n=t.next;(t.f&Pe)!==0?t.parent=null:Le(t,e),t=n}}function ma(r){for(var e=r.first;e!==null;){var t=e.next;(e.f&Se)===0&&Le(e),e=t}}function Le(r,e=!0){var t=!1;(e||(r.f&Ps)!==0)&&r.nodes_start!==null&&r.nodes_end!==null&&(va(r.nodes_start,r.nodes_end),t=!0),es(r,e&&!t),Ft(r,0),te(r,at);var n=r.transitions;if(n!==null)for(const a of n)a.stop();Qn(r);var s=r.parent;s!==null&&s.first!==null&&ts(r),r.next=r.prev=r.teardown=r.ctx=r.deps=r.fn=r.nodes_start=r.nodes_end=r.ac=null}function va(r,e){for(;r!==null;){var t=r===e?null:Xn(r);r.remove(),r=t}}function ts(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 ga(r,e){var t=[];rs(r,t,!0),_a(t,()=>{Le(r),e&&e()})}function _a(r,e){var t=r.length;if(t>0){var n=()=>--t||e();for(var s of r)s.out(n)}else e()}function rs(r,e,t){if((r.f&Je)===0){if(r.f^=Je,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&Ds)!==0||(n.f&Se)!==0;rs(n,e,a?t:!1),n=s}}}let $e=!1;function an(r){$e=r}let it=!1;function on(r){it=r}let S=null,ie=!1;function xe(r){S=r}let M=null;function Qe(r){M=r}let U=null;function ya(r){S!==null&&(U===null?U=[r]:U.push(r))}let V=null,Y=0,Q=null;function wa(r){Q=r}let ns=1,gt=0,Ie=gt;function ln(r){Ie=r}let ye=!1;function ss(){return++ns}function Xt(r){var h;var e=r.f;if((e&se)!==0)return!0;if((e&Ce)!==0){var t=r.deps,n=(e&ee)!==0;if(t!==null){var s,a,i=(e&Dt)!==0,o=n&&M!==null&&!ye,l=t.length;if((i||o)&&(M===null||(M.f&at)===0)){var u=r,d=u.parent;for(s=0;s<l;s++)a=t[s],(i||!((h=a==null?void 0:a.reactions)!=null&&h.includes(u)))&&(a.reactions??(a.reactions=[])).push(u);i&&(u.f^=Dt),o&&d!==null&&(d.f&ee)===0&&(u.f^=ee)}for(s=0;s<l;s++)if(a=t[s],Xt(a)&&Fn(a),a.wv>r.wv)return!0}(!n||M!==null&&!ye)&&te(r,q)}return!1}function as(r,e,t=!0){var n=r.reactions;if(n!==null&&!(U!=null&&U.includes(r)))for(var s=0;s<n.length;s++){var a=n[s];(a.f&X)!==0?as(a,e,!1):e===a&&(t?te(a,se):(a.f&q)!==0&&te(a,Ce),Ke(a))}}function is(r){var x;var e=V,t=Y,n=Q,s=S,a=ye,i=U,o=ae,l=ie,u=Ie,d=r.f;V=null,Y=0,Q=null,ye=(d&ee)!==0&&(ie||!$e||S===null),S=(d&(Se|Pe))===0?r:null,U=null,Pt(r.ctx),ie=!1,Ie=++gt,r.ac!==null&&(r.ac.abort(Dr),r.ac=null);try{r.f|=ir;var h=(0,r.fn)(),p=r.deps;if(V!==null){var v;if(Ft(r,Y),p!==null&&Y>0)for(p.length=Y+V.length,v=0;v<V.length;v++)p[Y+v]=V[v];else r.deps=p=V;if(!ye||(d&X)!==0&&r.reactions!==null)for(v=Y;v<p.length;v++)((x=p[v]).reactions??(x.reactions=[])).push(r)}else p!==null&&Y<p.length&&(Ft(r,Y),p.length=Y);if(Pn()&&Q!==null&&!ie&&p!==null&&(r.f&(X|Ce|se))===0)for(v=0;v<Q.length;v++)as(Q[v],r);return s!==null&&s!==r&&(gt++,Q!==null&&(n===null?n=Q:n.push(...Q))),(r.f&Ne)!==0&&(r.f^=Ne),h}catch(N){return Xs(N)}finally{r.f^=ir,V=e,Y=t,Q=n,S=s,ye=a,U=i,Pt(o),ie=l,Ie=u}}function ka(r,e){let t=e.reactions;if(t!==null){var n=As.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&&(V===null||!V.includes(e))&&(te(e,Ce),(e.f&(ee|Dt))===0&&(e.f^=Dt),jn(e),Ft(e,0))}function Ft(r,e){var t=r.deps;if(t!==null)for(var n=e;n<t.length;n++)ka(r,t[n])}function ht(r){var e=r.f;if((e&at)===0){te(r,q);var t=M,n=$e;M=r,$e=!0;try{(e&Ht)!==0?ma(r):es(r),Qn(r);var s=is(r);r.teardown=typeof s=="function"?s:null,r.wv=ns;var a;On&&Ys&&(r.f&se)!==0&&r.deps}finally{$e=n,M=t}}}function L(r){var e=r.f,t=(e&X)!==0;if(S!==null&&!ie){var n=M!==null&&(M.f&at)!==0;if(!n&&!(U!=null&&U.includes(r))){var s=S.deps;if((S.f&ir)!==0)r.rv<gt&&(r.rv=gt,V===null&&s!==null&&s[Y]===r?Y++:V===null?V=[r]:(!ye||!V.includes(r))&&V.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&ee)===0&&(i.f^=ee)}if(it){if(Re.has(r))return Re.get(r);if(t){i=r;var l=i.v;return((i.f&q)===0&&i.reactions!==null||os(i))&&(l=Fr(i)),Re.set(i,l),l}}else if(t){if(i=r,_e!=null&&_e.has(i))return _e.get(i);Xt(i)&&Fn(i)}if((r.f&Ne)!==0)throw r.v;return r.v}function os(r){if(r.v===F)return!0;if(r.deps===null)return!1;for(const e of r.deps)if(Re.has(e)||(e.f&X)!==0&&os(e))return!0;return!1}function xa(r){var e=ie;try{return ie=!0,r()}finally{ie=e}}const ba=-7169;function te(r,e){r.f=r.f&ba|e}const Ea=["touchstart","touchmove"];function Sa(r){return Ea.includes(r)}const Ca=new Set,un=new Set;function Ot(r){var T;var e=this,t=e.ownerDocument,n=r.type,s=((T=r.composedPath)==null?void 0:T.call(r))||[],a=s[0]||r.target,i=0,o=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){ar(r,"currentTarget",{configurable:!0,get(){return a||t}});var d=S,h=M;xe(null),Qe(null);try{for(var p,v=[];a!==null;){var x=a.assignedSlot||a.parentNode||a.host||null;try{var N=a["__"+n];if(N!=null&&(!a.disabled||r.target===a))if(Nn(N)){var[I,...J]=N;I.apply(a,[r,...J])}else N.call(a,r)}catch(z){p?v.push(z):p=z}if(r.cancelBubble||x===e||x===null)break;a=x}if(p){for(let z of v)queueMicrotask(()=>{throw z});throw p}}finally{r.__root=e,delete r.currentTarget,xe(d),Qe(h)}}}function Ta(r){var e=document.createElement("template");return e.innerHTML=r.replaceAll("<!>","<!---->"),e.content}function Aa(r,e){var t=M;t.nodes_start===null&&(t.nodes_start=r,t.nodes_end=e)}function ls(r,e){var t=(e&Ws)!==0,n,s=!r.startsWith("<!>");return()=>{n===void 0&&(n=Ta(s?r:"<!>"+r),n=Hn(n));var a=t||qn?document.importNode(n,!0):n.cloneNode(!0);return Aa(a,a),a}}function us(r,e){r!==null&&r.before(e)}function Vr(r,e){return Ma(r,e)}const Fe=new Map;function Ma(r,{target:e,anchor:t,props:n={},events:s,context:a,intro:i=!0}){ia();var o=new Set,l=h=>{for(var p=0;p<h.length;p++){var v=h[p];if(!o.has(v)){o.add(v);var x=Sa(v);e.addEventListener(v,Ot,{passive:x});var N=Fe.get(v);N===void 0?(document.addEventListener(v,Ot,{passive:x}),Fe.set(v,1)):Fe.set(v,N+1)}}};l(Ms(Ca)),un.add(l);var u=void 0,d=ca(()=>{var h=t??e.appendChild(oa());return pa(()=>{if(a){Pr({});var p=ae;p.c=a}s&&(n.$$events=s),u=r(h,n)||{},a&&Zr()}),()=>{var x;for(var p of o){e.removeEventListener(p,Ot);var v=Fe.get(p);--v===0?(document.removeEventListener(p,Ot),Fe.delete(p)):Fe.set(p,v)}un.delete(l),h!==t&&((x=h.parentNode)==null||x.removeChild(h))}});return Oa.set(u,d),u}let Oa=new WeakMap;const dn=[...`
2
- \r\f \v\uFEFF`];function Na(r,e,t){var n=r==null?"":""+r;if(t){for(var s in t)if(t[s])n=n?n+" "+s:s;else if(n.length)for(var a=s.length,i=0;(i=n.indexOf(s,i))>=0;){var o=i+a;(i===0||dn.includes(n[i-1]))&&(o===n.length||dn.includes(n[o]))?n=(i===0?"":n.substring(0,i))+n.substring(o+1):i=o}}return n===""?null:n}function cn(r,e=!1){var t=e?" !important;":";",n="";for(var s in r){var a=r[s];a!=null&&a!==""&&(n+=" "+s+": "+a+t)}return n}function tr(r){return r[0]!=="-"||r[1]!=="-"?r.toLowerCase():r}function Ra(r,e){if(e){var t="",n,s;if(Array.isArray(e)?(n=e[0],s=e[1]):n=e,r){r=String(r).replaceAll(/\s*\/\*.*?\*\/\s*/g,"").trim();var a=!1,i=0,o=!1,l=[];n&&l.push(...Object.keys(n).map(tr)),s&&l.push(...Object.keys(s).map(tr));var u=0,d=-1;const N=r.length;for(var h=0;h<N;h++){var p=r[h];if(o?p==="/"&&r[h-1]==="*"&&(o=!1):a?a===p&&(a=!1):p==="/"&&r[h+1]==="*"?o=!0:p==='"'||p==="'"?a=p:p==="("?i++:p===")"&&i--,!o&&a===!1&&i===0){if(p===":"&&d===-1)d=h;else if(p===";"||h===N-1){if(d!==-1){var v=tr(r.substring(u,d).trim());if(!l.includes(v)){p!==";"&&h++;var x=r.substring(u,h).trim();t+=" "+x+";"}}u=h+1,d=-1}}}}return n&&(t+=cn(n)),s&&(t+=cn(s,!0)),t=t.trim(),t===""?null:t}return r==null?null:String(r)}function ds(r,e,t,n,s,a){var i=r.__className;if(i!==t||i===void 0){var o=Na(t,n,a);o==null?r.removeAttribute("class"):r.className=o,r.__className=t}else if(a&&s!==a)for(var l in a){var u=!!a[l];(s==null||u!==!!s[l])&&r.classList.toggle(l,u)}return a}function rr(r,e={},t,n){for(var s in t){var a=t[s];e[s]!==a&&(t[s]==null?r.style.removeProperty(s):r.style.setProperty(s,a,n))}}function zt(r,e,t,n){var s=r.__style;if(s!==e){var a=Ra(e,n);a==null?r.removeAttribute("style"):r.style.cssText=a,r.__style=e}else n&&(Array.isArray(n)?(rr(r,t==null?void 0:t[0],n[0]),rr(r,t==null?void 0:t[1],n[1],"important")):rr(r,t,n));return n}const Ia=()=>performance.now(),oe={tick:r=>requestAnimationFrame(r),now:()=>Ia(),tasks:new Set};function cs(){const r=oe.now();oe.tasks.forEach(e=>{e.c(r)||(oe.tasks.delete(e),e.f())}),oe.tasks.size!==0&&oe.tick(cs)}function La(r){let e;return oe.tasks.size===0&&oe.tick(cs),{promise:new Promise(t=>{oe.tasks.add(e={c:r,f:t})}),abort(){oe.tasks.delete(e)}}}function fn(r,e){return r===e||(r==null?void 0:r[Nt])===e}function Ve(r={},e,t,n){return fa(()=>{var s,a;return Jn(()=>{s=a,a=[],xa(()=>{r!==t(...a)&&(e(r,...a),s&&fn(t(...s),r)&&e(null,...s))})}),()=>{Js(()=>{a&&fn(t(...a),r)&&e(null,...a)})}}),r}const Da="5";var Mn;typeof window<"u"&&((Mn=window.__svelte??(window.__svelte={})).v??(Mn.v=new Set)).add(Da);function Pa(r){return r}function cr(r){return-.5*(Math.cos(Math.PI*r)-1)}function Za(r){const e=Math.cos(r*Math.PI*.5);return Math.abs(e)<1e-14?1:1-e}function ja(r){return Math.sin(r*Math.PI/2)}const Fa=128,za=0,Va=1,Ba=2;class Ua{constructor(){f(this,"animationsStarted",!1);f(this,"animationsCount",0);f(this,"animationsLimit",Fa);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 me=new Ua;function hn(r){return Object.prototype.toString.call(r)==="[object Date]"}function fr(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)=>fr(r[a],s));return s=>n.map(a=>a(s))}if(t==="object"){if(!r||!e)throw new Error("Object cannot be null");if(hn(r)&&hn(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]=fr(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 fe,Ge,Ct,Oe;const Wr=class Wr{constructor(e,t={}){P(this,fe);P(this,Ge);P(this,Ct);P(this,Oe,null);j(this,fe,$(e)),j(this,Ge,$(e)),j(this,Ct,t)}static of(e,t){const n=new Wr(e(),t);return Jn(()=>{n.set(e())}),n}set(e,t){var h;B(k(this,Ge),e);let{delay:n=0,duration:s=400,easing:a=Pa,interpolate:i=fr}={...k(this,Ct),...t};if(s===0)return(h=k(this,Oe))==null||h.abort(),B(k(this,fe),e),Promise.resolve();const o=oe.now()+n;let l,u=!1,d=k(this,Oe);return j(this,Oe,La(p=>{if(p<o)return!0;if(!u){u=!0;const x=k(this,fe).v;l=i(x,e),typeof s=="function"&&(s=s(x,e)),d==null||d.abort()}const v=p-o;return v>s?(B(k(this,fe),e),!1):(B(k(this,fe),l(a(v/s))),!0)})),k(this,Oe).promise}get current(){return L(k(this,fe))}get target(){return L(k(this,Ge))}set target(e){this.set(e)}};fe=new WeakMap,Ge=new WeakMap,Ct=new WeakMap,Oe=new WeakMap;let hr=Wr;class It{constructor(e,t){f(this,"value");f(this,"motion");this.value=e,this.motion=new hr(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 $a=ls('<div><div class="body svelte-1nfn9j8"></div></div>');function qa(r,e){Pr(e,!0);let t,n;function s(){return n}let a=$(!1);function i(T){B(a,T,!0)}function o(){return L(a)}let l=new It(0,{easing:cr});ce(()=>{u(l.motion.current)}),ce(()=>{L(a)==!1&&(l.snap(),me.clear(e.priority,e.id))});function u(T){t&&me.equeue(e.layer,e.priority,e.id,()=>{t.style.scale=T.toString(),t.style.filter=`brightness(${.25+.75*T})`,n.style.opacity=T.toString()})}function d(T){T!=l.value&&l.set(T,{duration:75})}function h(){return l.motion.current==0}function p(){return l.value}var v=$a();let x,N;var I=dr(v);let J;return Ve(I,T=>n=T,()=>n),Ve(v,T=>t=T,()=>t),Kn((T,z,K)=>{x=ds(v,1,"pin svelte-1nfn9j8",null,x,T),N=zt(v,"",N,z),J=zt(I,"",J,K)},[()=>({displayed:L(a)}),()=>({width:`${e.width}px`,height:`${e.height}px`,"border-radius":`${e.radius}px`}),()=>({width:`${e.width-4}px`,height:`${e.height-4}px`,"border-radius":`${e.radius-2}px`})]),us(r,v),Zr({getBody:s,setDisplayed:i,getDisplayed:o,setScale:d,getCollapsed:h,getScale:p})}var Wa=ls('<div><div class="pointer svelte-j5igi2"></div> <div class="bubble svelte-j5igi2"><div class="body svelte-j5igi2"></div></div></div>');function fs(r,e){Pr(e,!0);let t,n,s,a;const i=e.width+2*e.margin,o=e.height+2*e.margin,l=()=>a;ce(()=>{s.style.width=`${e.margin*4}px`,s.style.height=`${e.margin*4}px`});let u=$(!0);function d(O){B(u,O,!0)}function h(){return L(u)}let p=$(!0);function v(O){B(p,O,!0)}function x(){return I.motion.current==0}function N(){return I.motion.current==1}let I=new It(0);ce(()=>{J(I.motion.current)}),ce(()=>{L(u)==!1&&(I.snap(),me.clear(e.priority,e.id+"_scale"))}),ce(()=>{L(p)==!0&&I.value!=0&&(me.stacked()?I.set(0,{duration:0}):I.set(0,{duration:150,easing:Za})),L(p)==!1&&I.value!=1&&I.set(1,{duration:150,easing:ja})});function J(O){!t||!n||!s||me.equeue(L(p)?0:e.layer,e.priority,e.id+"_scale",()=>{t.style.opacity=`${O}`,n.style.scale=`${O}`,s.style.scale=`${O}`})}let T=NaN,z=$(!1),K=new It(-i/2,{easing:cr}),Tt=new It(-o/2,{easing:cr});ce(()=>{Yr(K.motion.current,Tt.motion.current)}),ce(()=>{L(u)==!1&&(K.snap(),K.snap(),me.clear(e.priority,e.id+"_angle"))}),ce(()=>{L(p)==!0&&L(z)&&(K.update({duration:75}),K.update({duration:75}))});function Yr(O,de){if(!t||!n||!s)return;const Mt=O+i/2,ot=de+o/2,je=o<i?Mt*o/i:Mt,Jt=o>i?ot*i/o:ot,ks=Math.atan2(Jt,je)/Math.PI*180-45,Jr=0,xs=30,Kt=Math.sqrt(je*je+Jt*Jt),lt=Math.min(i,o)/2,bs=lt*Math.SQRT2,Es=(Kt-lt)/(bs-lt),Kr=Jr+Es*(xs-Jr),Ss=Kt<lt?Kt/lt:1;me.equeue(e.layer,e.priority,e.id+"_angle",()=>{n.style.transform=`translate(${Math.round(O)}px, ${Math.round(de)}px)`,s.style.transform=`scale(${Ss}) rotate(${ks}deg) skew(${Kr}deg, ${Kr}deg)`})}function ys(O){if(L(z)==!1){let de=H.Rectangle.getOffsets(i,o,O);K.set(Math.round(de.x),{duration:0}),Tt.set(Math.round(de.y),{duration:0}),Yr(K.value,Tt.value),T=O,B(z,!0)}else if(O!=T){let de=Math.abs(O-T),Mt=de<180?de:360-de,ot=Math.log(Mt)*75,je=H.Rectangle.getOffsets(i,o,O);K.set(Math.round(je.x),{duration:ot}),Tt.set(Math.round(je.y),{duration:ot}),T=O}}function ws(){return H.Rectangle.getOffsets(i,o,T)}var At=Wa();let Hr;var Xr=dr(At);Ve(Xr,O=>s=O,()=>s);var Gt=la(Xr,2),Gr=dr(Gt);return Ve(Gr,O=>a=O,()=>a),Ve(Gt,O=>n=O,()=>n),Ve(At,O=>t=O,()=>t),Kn(O=>{Hr=ds(At,1,"anchor svelte-j5igi2",null,Hr,O),zt(Gt,`margin: ${e.margin}px;`),zt(Gr,`width: ${e.width}px; height: ${e.height}px; border-radius: ${e.radius}px;`)},[()=>({displayed:L(u)})]),us(r,At),Zr({getBody:l,setDisplayed:d,getDisplayed:h,setCollapsed:v,getCollapsed:x,getExpanded:N,setAngle:ys,getOffsets:ws})}class hs{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=H.Mercator.project(e.sw.lat,e.sw.lng,i),l=H.Mercator.project(e.ne.lat,e.ne.lng,i),u=o.x-s,d=o.y+a,h=l.x+s,p=l.y-a,v=H.Mercator.unproject(u,d,i),x=H.Mercator.unproject(h,p,i);this.swLat=v.lat,this.swLng=v.lng,this.neLat=x.lat,this.neLng=x.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 A;(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})(A||(A={}));var pn;(function(r){r.mergeShapes=(e,t)=>({...e,...t})})(pn||(pn={}));const g=A.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),pe=r=>{switch(typeof r){case"undefined":return g.undefined;case"string":return g.string;case"number":return Number.isNaN(r)?g.nan:g.number;case"boolean":return g.boolean;case"function":return g.function;case"bigint":return g.bigint;case"symbol":return g.symbol;case"object":return Array.isArray(r)?g.array:r===null?g.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?g.promise:typeof Map<"u"&&r instanceof Map?g.map:typeof Set<"u"&&r instanceof Set?g.set:typeof Date<"u"&&r instanceof Date?g.date:g.object;default:return g.unknown}},c=A.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 re 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 re))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,A.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()}}re.create=r=>new re(r);const _t=(r,e)=>{let t;switch(r.code){case c.invalid_type:r.received===g.undefined?t="Required":t=`Expected ${r.expected}, received ${r.received}`;break;case c.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(r.expected,A.jsonStringifyReplacer)}`;break;case c.unrecognized_keys:t=`Unrecognized key(s) in object: ${A.joinValues(r.keys,", ")}`;break;case c.invalid_union:t="Invalid input";break;case c.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${A.joinValues(r.options)}`;break;case c.invalid_enum_value:t=`Invalid enum value. Expected ${A.joinValues(r.options)}, received '${r.received}'`;break;case c.invalid_arguments:t="Invalid function arguments";break;case c.invalid_return_type:t="Invalid function return type";break;case c.invalid_date:t="Invalid date";break;case c.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}"`:A.assertNever(r.validation):r.validation!=="regex"?t=`Invalid ${r.validation}`:t="Invalid";break;case c.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 c.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 c.custom:t="Invalid input";break;case c.invalid_intersection_types:t="Intersection results could not be merged";break;case c.not_multiple_of:t=`Number must be a multiple of ${r.multipleOf}`;break;case c.not_finite:t="Number must be finite";break;default:t=e.defaultError,A.assertNever(r)}return{message:t}};let Ya=_t;function pr(){return Ya}const mr=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 m(r,e){const t=pr(),n=mr({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,t,t===_t?void 0:_t].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 y;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 y;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 y=Object.freeze({status:"aborted"}),ct=r=>({status:"dirty",value:r}),W=r=>({status:"valid",value:r}),mn=r=>r.status==="aborted",vn=r=>r.status==="dirty",et=r=>r.status==="valid",Vt=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 be{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 gn=(r,e)=>{if(et(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 re(r.common.issues);return this._error=t,this._error}}};function b(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 C{get description(){return this._def.description}_getType(e){return pe(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:pe(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:pe(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(Vt(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:pe(e)},s=this._parseSync({data:e,path:n.path,parent:n});return gn(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:pe(e)};if(!this["~standard"].async)try{const a=this._parseSync({data:e,path:[],parent:t});return et(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=>et(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:pe(e)},s=this._parse({data:e,path:n.path,parent:n}),a=await(Vt(s)?s:Promise.resolve(s));return gn(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:c.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 nt({schema:this,typeName:w.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 ke.create(this,this._def)}nullable(){return st.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ue.create(this)}promise(){return kt.create(this,this._def)}or(e){return Ut.create([this,e],this._def)}and(e){return $t.create(this,e,this._def)}transform(e){return new nt({...b(this._def),schema:this,typeName:w.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new wr({...b(this._def),innerType:this,defaultValue:t,typeName:w.ZodDefault})}brand(){return new vi({typeName:w.ZodBranded,type:this,...b(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new kr({...b(this._def),innerType:this,catchValue:t,typeName:w.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return Br.create(this,e)}readonly(){return xr.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Ha=/^c[^\s-]{8,}$/i,Xa=/^[0-9a-z]+$/,Ga=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Ja=/^[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,Ka=/^[a-z0-9_-]{21}$/i,Qa=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,ei=/^[-+]?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)?)??$/,ti=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,ri="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let nr;const ni=/^(?:(?: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])$/,si=/^(?:(?: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])$/,ai=/^(([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]))$/,ii=/^(([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])$/,oi=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,li=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,ps="((\\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])))",ui=new RegExp(`^${ps}$`);function ms(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 di(r){return new RegExp(`^${ms(r)}$`)}function ci(r){let e=`${ps}T${ms(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 fi(r,e){return!!((e==="v4"||!e)&&ni.test(r)||(e==="v6"||!e)&&ai.test(r))}function hi(r,e){if(!Qa.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 pi(r,e){return!!((e==="v4"||!e)&&si.test(r)||(e==="v6"||!e)&&ii.test(r))}class we extends C{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==g.string){const a=this._getOrReturnCtx(e);return m(a,{code:c.invalid_type,expected:g.string,received:a.parsedType}),y}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),m(s,{code:c.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),m(s,{code:c.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?m(s,{code:c.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):o&&m(s,{code:c.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),n.dirty())}else if(a.kind==="email")ti.test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"email",code:c.invalid_string,message:a.message}),n.dirty());else if(a.kind==="emoji")nr||(nr=new RegExp(ri,"u")),nr.test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"emoji",code:c.invalid_string,message:a.message}),n.dirty());else if(a.kind==="uuid")Ja.test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"uuid",code:c.invalid_string,message:a.message}),n.dirty());else if(a.kind==="nanoid")Ka.test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"nanoid",code:c.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid")Ha.test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"cuid",code:c.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid2")Xa.test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"cuid2",code:c.invalid_string,message:a.message}),n.dirty());else if(a.kind==="ulid")Ga.test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"ulid",code:c.invalid_string,message:a.message}),n.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),m(s,{validation:"url",code:c.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),m(s,{validation:"regex",code:c.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),m(s,{code:c.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),m(s,{code:c.invalid_string,validation:{startsWith:a.value},message:a.message}),n.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(s=this._getOrReturnCtx(e,s),m(s,{code:c.invalid_string,validation:{endsWith:a.value},message:a.message}),n.dirty()):a.kind==="datetime"?ci(a).test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{code:c.invalid_string,validation:"datetime",message:a.message}),n.dirty()):a.kind==="date"?ui.test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{code:c.invalid_string,validation:"date",message:a.message}),n.dirty()):a.kind==="time"?di(a).test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{code:c.invalid_string,validation:"time",message:a.message}),n.dirty()):a.kind==="duration"?ei.test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"duration",code:c.invalid_string,message:a.message}),n.dirty()):a.kind==="ip"?fi(e.data,a.version)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"ip",code:c.invalid_string,message:a.message}),n.dirty()):a.kind==="jwt"?hi(e.data,a.alg)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"jwt",code:c.invalid_string,message:a.message}),n.dirty()):a.kind==="cidr"?pi(e.data,a.version)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"cidr",code:c.invalid_string,message:a.message}),n.dirty()):a.kind==="base64"?oi.test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"base64",code:c.invalid_string,message:a.message}),n.dirty()):a.kind==="base64url"?li.test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"base64url",code:c.invalid_string,message:a.message}),n.dirty()):A.assertNever(a);return{status:n.value,value:e.data}}_regex(e,t,n){return this.refinement(s=>e.test(s),{validation:t,code:c.invalid_string,..._.errToObj(n)})}_addCheck(e){return new we({...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 we({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new we({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new we({...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}}we.create=r=>new we({checks:[],typeName:w.ZodString,coerce:(r==null?void 0:r.coerce)??!1,...b(r)});function mi(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 tt extends C{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)!==g.number){const a=this._getOrReturnCtx(e);return m(a,{code:c.invalid_type,expected:g.number,received:a.parsedType}),y}let n;const s=new G;for(const a of this._def.checks)a.kind==="int"?A.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),m(n,{code:c.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),m(n,{code:c.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),m(n,{code:c.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):a.kind==="multipleOf"?mi(e.data,a.value)!==0&&(n=this._getOrReturnCtx(e,n),m(n,{code:c.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),m(n,{code:c.not_finite,message:a.message}),s.dirty()):A.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 tt({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:_.toString(s)}]})}_addCheck(e){return new tt({...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"&&A.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)}}tt.create=r=>new tt({checks:[],typeName:w.ZodNumber,coerce:(r==null?void 0:r.coerce)||!1,...b(r)});class yt extends C{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)!==g.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),m(n,{code:c.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),m(n,{code:c.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),m(n,{code:c.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):A.assertNever(a);return{status:s.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return m(t,{code:c.invalid_type,expected:g.bigint,received:t.parsedType}),y}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 yt({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:_.toString(s)}]})}_addCheck(e){return new yt({...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}}yt.create=r=>new yt({checks:[],typeName:w.ZodBigInt,coerce:(r==null?void 0:r.coerce)??!1,...b(r)});class vr extends C{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==g.boolean){const n=this._getOrReturnCtx(e);return m(n,{code:c.invalid_type,expected:g.boolean,received:n.parsedType}),y}return W(e.data)}}vr.create=r=>new vr({typeName:w.ZodBoolean,coerce:(r==null?void 0:r.coerce)||!1,...b(r)});class Bt extends C{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==g.date){const a=this._getOrReturnCtx(e);return m(a,{code:c.invalid_type,expected:g.date,received:a.parsedType}),y}if(Number.isNaN(e.data.getTime())){const a=this._getOrReturnCtx(e);return m(a,{code:c.invalid_date}),y}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),m(s,{code:c.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),m(s,{code:c.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),n.dirty()):A.assertNever(a);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Bt({...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}}Bt.create=r=>new Bt({checks:[],coerce:(r==null?void 0:r.coerce)||!1,typeName:w.ZodDate,...b(r)});class _n extends C{_parse(e){if(this._getType(e)!==g.symbol){const n=this._getOrReturnCtx(e);return m(n,{code:c.invalid_type,expected:g.symbol,received:n.parsedType}),y}return W(e.data)}}_n.create=r=>new _n({typeName:w.ZodSymbol,...b(r)});class yn extends C{_parse(e){if(this._getType(e)!==g.undefined){const n=this._getOrReturnCtx(e);return m(n,{code:c.invalid_type,expected:g.undefined,received:n.parsedType}),y}return W(e.data)}}yn.create=r=>new yn({typeName:w.ZodUndefined,...b(r)});class wn extends C{_parse(e){if(this._getType(e)!==g.null){const n=this._getOrReturnCtx(e);return m(n,{code:c.invalid_type,expected:g.null,received:n.parsedType}),y}return W(e.data)}}wn.create=r=>new wn({typeName:w.ZodNull,...b(r)});class gr extends C{constructor(){super(...arguments),this._any=!0}_parse(e){return W(e.data)}}gr.create=r=>new gr({typeName:w.ZodAny,...b(r)});class qe extends C{constructor(){super(...arguments),this._unknown=!0}_parse(e){return W(e.data)}}qe.create=r=>new qe({typeName:w.ZodUnknown,...b(r)});class Ee extends C{_parse(e){const t=this._getOrReturnCtx(e);return m(t,{code:c.invalid_type,expected:g.never,received:t.parsedType}),y}}Ee.create=r=>new Ee({typeName:w.ZodNever,...b(r)});class _r extends C{_parse(e){if(this._getType(e)!==g.undefined){const n=this._getOrReturnCtx(e);return m(n,{code:c.invalid_type,expected:g.void,received:n.parsedType}),y}return W(e.data)}}_r.create=r=>new _r({typeName:w.ZodVoid,...b(r)});class ue extends C{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),s=this._def;if(t.parsedType!==g.array)return m(t,{code:c.invalid_type,expected:g.array,received:t.parsedType}),y;if(s.exactLength!==null){const i=t.data.length>s.exactLength.value,o=t.data.length<s.exactLength.value;(i||o)&&(m(t,{code:i?c.too_big:c.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&&(m(t,{code:c.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&&(m(t,{code:c.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 be(t,i,t.path,o)))).then(i=>G.mergeArray(n,i));const a=[...t.data].map((i,o)=>s.type._parseSync(new be(t,i,t.path,o)));return G.mergeArray(n,a)}get element(){return this._def.type}min(e,t){return new ue({...this._def,minLength:{value:e,message:_.toString(t)}})}max(e,t){return new ue({...this._def,maxLength:{value:e,message:_.toString(t)}})}length(e,t){return new ue({...this._def,exactLength:{value:e,message:_.toString(t)}})}nonempty(e){return this.min(1,e)}}ue.create=(r,e)=>new ue({type:r,minLength:null,maxLength:null,exactLength:null,typeName:w.ZodArray,...b(e)});function ze(r){if(r instanceof D){const e={};for(const t in r.shape){const n=r.shape[t];e[t]=ke.create(ze(n))}return new D({...r._def,shape:()=>e})}else return r instanceof ue?new ue({...r._def,type:ze(r.element)}):r instanceof ke?ke.create(ze(r.unwrap())):r instanceof st?st.create(ze(r.unwrap())):r instanceof he?he.create(r.items.map(e=>ze(e))):r}class D extends C{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=A.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==g.object){const u=this._getOrReturnCtx(e);return m(u,{code:c.invalid_type,expected:g.object,received:u.parsedType}),y}const{status:n,ctx:s}=this._processInputParams(e),{shape:a,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof Ee&&this._def.unknownKeys==="strip"))for(const u in s.data)i.includes(u)||o.push(u);const l=[];for(const u of i){const d=a[u],h=s.data[u];l.push({key:{status:"valid",value:u},value:d._parse(new be(s,h,s.path,u)),alwaysSet:u in s.data})}if(this._def.catchall instanceof Ee){const u=this._def.unknownKeys;if(u==="passthrough")for(const d of o)l.push({key:{status:"valid",value:d},value:{status:"valid",value:s.data[d]}});else if(u==="strict")o.length>0&&(m(s,{code:c.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 d of o){const h=s.data[d];l.push({key:{status:"valid",value:d},value:u._parse(new be(s,h,s.path,d)),alwaysSet:d in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const u=[];for(const d of l){const h=await d.key,p=await d.value;u.push({key:h,value:p,alwaysSet:d.alwaysSet})}return u}).then(u=>G.mergeObjectSync(n,u)):G.mergeObjectSync(n,l)}get shape(){return this._def.shape()}strict(e){return _.errToObj,new D({...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 D({...this._def,unknownKeys:"strip"})}passthrough(){return new D({...this._def,unknownKeys:"passthrough"})}extend(e){return new D({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new D({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:w.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new D({...this._def,catchall:e})}pick(e){const t={};for(const n of A.objectKeys(e))e[n]&&this.shape[n]&&(t[n]=this.shape[n]);return new D({...this._def,shape:()=>t})}omit(e){const t={};for(const n of A.objectKeys(this.shape))e[n]||(t[n]=this.shape[n]);return new D({...this._def,shape:()=>t})}deepPartial(){return ze(this)}partial(e){const t={};for(const n of A.objectKeys(this.shape)){const s=this.shape[n];e&&!e[n]?t[n]=s:t[n]=s.optional()}return new D({...this._def,shape:()=>t})}required(e){const t={};for(const n of A.objectKeys(this.shape))if(e&&!e[n])t[n]=this.shape[n];else{let a=this.shape[n];for(;a instanceof ke;)a=a._def.innerType;t[n]=a}return new D({...this._def,shape:()=>t})}keyof(){return vs(A.objectKeys(this.shape))}}D.create=(r,e)=>new D({shape:()=>r,unknownKeys:"strip",catchall:Ee.create(),typeName:w.ZodObject,...b(e)});D.strictCreate=(r,e)=>new D({shape:()=>r,unknownKeys:"strict",catchall:Ee.create(),typeName:w.ZodObject,...b(e)});D.lazycreate=(r,e)=>new D({shape:r,unknownKeys:"strip",catchall:Ee.create(),typeName:w.ZodObject,...b(e)});class Ut extends C{_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 re(o.ctx.common.issues));return m(t,{code:c.invalid_union,unionErrors:i}),y}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},d=l._parseSync({data:t.data,path:t.path,parent:u});if(d.status==="valid")return d;d.status==="dirty"&&!a&&(a={result:d,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 re(l));return m(t,{code:c.invalid_union,unionErrors:o}),y}}get options(){return this._def.options}}Ut.create=(r,e)=>new Ut({options:r,typeName:w.ZodUnion,...b(e)});function yr(r,e){const t=pe(r),n=pe(e);if(r===e)return{valid:!0,data:r};if(t===g.object&&n===g.object){const s=A.objectKeys(e),a=A.objectKeys(r).filter(o=>s.indexOf(o)!==-1),i={...r,...e};for(const o of a){const l=yr(r[o],e[o]);if(!l.valid)return{valid:!1};i[o]=l.data}return{valid:!0,data:i}}else if(t===g.array&&n===g.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=yr(i,o);if(!l.valid)return{valid:!1};s.push(l.data)}return{valid:!0,data:s}}else return t===g.date&&n===g.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}class $t extends C{_parse(e){const{status:t,ctx:n}=this._processInputParams(e),s=(a,i)=>{if(mn(a)||mn(i))return y;const o=yr(a.value,i.value);return o.valid?((vn(a)||vn(i))&&t.dirty(),{status:t.value,value:o.data}):(m(n,{code:c.invalid_intersection_types}),y)};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}))}}$t.create=(r,e,t)=>new $t({left:r,right:e,typeName:w.ZodIntersection,...b(t)});class he extends C{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==g.array)return m(n,{code:c.invalid_type,expected:g.array,received:n.parsedType}),y;if(n.data.length<this._def.items.length)return m(n,{code:c.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),y;!this._def.rest&&n.data.length>this._def.items.length&&(m(n,{code:c.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 be(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 he({...this._def,rest:e})}}he.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new he({items:r,typeName:w.ZodTuple,rest:null,...b(e)})};class kn extends C{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!==g.map)return m(n,{code:c.invalid_type,expected:g.map,received:n.parsedType}),y;const s=this._def.keyType,a=this._def.valueType,i=[...n.data.entries()].map(([o,l],u)=>({key:s._parse(new be(n,o,n.path,[u,"key"])),value:a._parse(new be(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,d=await l.value;if(u.status==="aborted"||d.status==="aborted")return y;(u.status==="dirty"||d.status==="dirty")&&t.dirty(),o.set(u.value,d.value)}return{status:t.value,value:o}})}else{const o=new Map;for(const l of i){const u=l.key,d=l.value;if(u.status==="aborted"||d.status==="aborted")return y;(u.status==="dirty"||d.status==="dirty")&&t.dirty(),o.set(u.value,d.value)}return{status:t.value,value:o}}}}kn.create=(r,e,t)=>new kn({valueType:e,keyType:r,typeName:w.ZodMap,...b(t)});class wt extends C{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==g.set)return m(n,{code:c.invalid_type,expected:g.set,received:n.parsedType}),y;const s=this._def;s.minSize!==null&&n.data.size<s.minSize.value&&(m(n,{code:c.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&&(m(n,{code:c.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 d of l){if(d.status==="aborted")return y;d.status==="dirty"&&t.dirty(),u.add(d.value)}return{status:t.value,value:u}}const o=[...n.data.values()].map((l,u)=>a._parse(new be(n,l,n.path,u)));return n.common.async?Promise.all(o).then(l=>i(l)):i(o)}min(e,t){return new wt({...this._def,minSize:{value:e,message:_.toString(t)}})}max(e,t){return new wt({...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)}}wt.create=(r,e)=>new wt({valueType:r,minSize:null,maxSize:null,typeName:w.ZodSet,...b(e)});class pt extends C{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==g.function)return m(t,{code:c.invalid_type,expected:g.function,received:t.parsedType}),y;function n(o,l){return mr({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,pr(),_t].filter(u=>!!u),issueData:{code:c.invalid_arguments,argumentsError:l}})}function s(o,l){return mr({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,pr(),_t].filter(u=>!!u),issueData:{code:c.invalid_return_type,returnTypeError:l}})}const a={errorMap:t.common.contextualErrorMap},i=t.data;if(this._def.returns instanceof kt){const o=this;return W(async function(...l){const u=new re([]),d=await o._def.args.parseAsync(l,a).catch(v=>{throw u.addIssue(n(l,v)),u}),h=await Reflect.apply(i,this,d);return await o._def.returns._def.type.parseAsync(h,a).catch(v=>{throw u.addIssue(s(h,v)),u})})}else{const o=this;return W(function(...l){const u=o._def.args.safeParse(l,a);if(!u.success)throw new re([n(l,u.error)]);const d=Reflect.apply(i,this,u.data),h=o._def.returns.safeParse(d,a);if(!h.success)throw new re([s(d,h.error)]);return h.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new pt({...this._def,args:he.create(e).rest(qe.create())})}returns(e){return new pt({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new pt({args:e||he.create([]).rest(qe.create()),returns:t||qe.create(),typeName:w.ZodFunction,...b(n)})}}class xn extends C{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})}}xn.create=(r,e)=>new xn({getter:r,typeName:w.ZodLazy,...b(e)});class bn extends C{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return m(t,{received:t.data,code:c.invalid_literal,expected:this._def.value}),y}return{status:"valid",value:e.data}}get value(){return this._def.value}}bn.create=(r,e)=>new bn({value:r,typeName:w.ZodLiteral,...b(e)});function vs(r,e){return new rt({values:r,typeName:w.ZodEnum,...b(e)})}class rt extends C{_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),n=this._def.values;return m(t,{expected:A.joinValues(n),received:t.parsedType,code:c.invalid_type}),y}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 m(t,{received:t.data,code:c.invalid_enum_value,options:n}),y}return W(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 rt.create(e,{...this._def,...t})}exclude(e,t=this._def){return rt.create(this.options.filter(n=>!e.includes(n)),{...this._def,...t})}}rt.create=vs;class En extends C{_parse(e){const t=A.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==g.string&&n.parsedType!==g.number){const s=A.objectValues(t);return m(n,{expected:A.joinValues(s),received:n.parsedType,code:c.invalid_type}),y}if(this._cache||(this._cache=new Set(A.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const s=A.objectValues(t);return m(n,{received:n.data,code:c.invalid_enum_value,options:s}),y}return W(e.data)}get enum(){return this._def.values}}En.create=(r,e)=>new En({values:r,typeName:w.ZodNativeEnum,...b(e)});class kt extends C{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==g.promise&&t.common.async===!1)return m(t,{code:c.invalid_type,expected:g.promise,received:t.parsedType}),y;const n=t.parsedType===g.promise?t.data:Promise.resolve(t.data);return W(n.then(s=>this._def.type.parseAsync(s,{path:t.path,errorMap:t.common.contextualErrorMap})))}}kt.create=(r,e)=>new kt({type:r,typeName:w.ZodPromise,...b(e)});class nt extends C{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===w.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=>{m(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 y;const l=await this._def.schema._parseAsync({data:o,path:n.path,parent:n});return l.status==="aborted"?y:l.status==="dirty"||t.value==="dirty"?ct(l.value):l});{if(t.value==="aborted")return y;const o=this._def.schema._parseSync({data:i,path:n.path,parent:n});return o.status==="aborted"?y:o.status==="dirty"||t.value==="dirty"?ct(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"?y:(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"?y:(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(!et(i))return y;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=>et(i)?Promise.resolve(s.transform(i.value,a)).then(o=>({status:t.value,value:o})):y);A.assertNever(s)}}nt.create=(r,e,t)=>new nt({schema:r,typeName:w.ZodEffects,effect:e,...b(t)});nt.createWithPreprocess=(r,e,t)=>new nt({schema:e,effect:{type:"preprocess",transform:r},typeName:w.ZodEffects,...b(t)});class ke extends C{_parse(e){return this._getType(e)===g.undefined?W(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ke.create=(r,e)=>new ke({innerType:r,typeName:w.ZodOptional,...b(e)});class st extends C{_parse(e){return this._getType(e)===g.null?W(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}st.create=(r,e)=>new st({innerType:r,typeName:w.ZodNullable,...b(e)});class wr extends C{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===g.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}wr.create=(r,e)=>new wr({innerType:r,typeName:w.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...b(e)});class kr extends C{_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 Vt(s)?s.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new re(n.common.issues)},input:n.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new re(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}kr.create=(r,e)=>new kr({innerType:r,typeName:w.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...b(e)});class Sn extends C{_parse(e){if(this._getType(e)!==g.nan){const n=this._getOrReturnCtx(e);return m(n,{code:c.invalid_type,expected:g.nan,received:n.parsedType}),y}return{status:"valid",value:e.data}}}Sn.create=r=>new Sn({typeName:w.ZodNaN,...b(r)});class vi extends C{_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 Br extends C{_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"?y:a.status==="dirty"?(t.dirty(),ct(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"?y: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 Br({in:e,out:t,typeName:w.ZodPipeline})}}class xr extends C{_parse(e){const t=this._def.innerType._parse(e),n=s=>(et(s)&&(s.value=Object.freeze(s.value)),s);return Vt(t)?t.then(s=>n(s)):n(t)}unwrap(){return this._def.innerType}}xr.create=(r,e)=>new xr({innerType:r,typeName:w.ZodReadonly,...b(e)});var w;(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"})(w||(w={}));const De=we.create,E=tt.create,br=vr.create,Ur=gr.create;qe.create;Ee.create;const Lt=_r.create,$r=ue.create,R=D.create;Ut.create;$t.create;const Cn=he.create,le=pt.create,gi=rt.create,_i=kt.create;ke.create;st.create;R({pin:R({fade:br().optional(),maxCount:E().optional(),maxZoom:E().optional()}).optional(),animation:R({queue:R({limit:E().optional()}).optional()}).optional(),api:R({states:R({url:De().optional(),key:De()}).optional(),log:R({enabled:br()}).optional()}).optional()});const Er=E().min(-90).max(90),Sr=E().min(-180).max(180),yi=R({sw:R({lat:Er,lng:Sr}),ne:R({lat:Er,lng:Sr})}),Cr=Ur().refine(r=>r instanceof HTMLElement,"Must be an HTMLElement"),gs=R({mapSize:E(),zoomMin:E(),zoomMax:E(),zoomScale:E()}),wi=R({instance:Ur(),inserted:le().returns(br()),insert:le().returns(Lt()),remove:le().returns(Lt()),update:le().args(E()).returns(Lt())}),ki=R({parameters:gs,getContainer:le().args().returns(Cr),getZoom:le().args().returns(E()),getBounds:le().args().returns(yi),panBy:le().args(E(),E()).returns(Lt()),createMarker:le().args(Cr,Er,Sr,E()).returns(wi)}),sr=le().args(De()).returns(_i(Cr)),xi=R({id:De().min(1),rank:E(),lat:E().min(-90).max(90),lng:E().min(-180).max(180),tooltip:R({style:R({width:E(),height:E(),margin:E(),radius:E()}).refine(r=>Math.min(r.width,r.height)/r.margin>=5,"Tooltip width and height must be at least 5 times the margin"),body:sr}),pin:R({style:R({width:E(),height:E(),radius:E()}),body:sr}).optional(),popup:R({style:R({width:E(),height:E(),radius:E(),margin:E()}),body:sr}).optional()}),bi=$r(xi);Cn([E(),$r(Cn([E(),E()]))]);const Ei=R({id:De(),rank:E(),lat:E(),lng:E(),width:E(),height:E(),margin:E()});R({key:De(),parameters:gs,input:$r(Ei)});const Si=gi(["info","warn","error"]);R({title:De(),level:Si,content:Ur()});const _s="https://arenarium.dev/api/public/v1",Ci=`${_s}/log`,Ti=`${_s}/tooltip/states`,Tn="1.0.188";class Ai{constructor(e,t){f(this,"provider");f(this,"apiStatesUrl");f(this,"apiStatesKey");f(this,"apiLogEnabled");f(this,"markerDataArray",new Array);f(this,"markerDataMap",new Map);f(this,"markerDataUpdating",!1);f(this,"markerPinProcessor");f(this,"markerTooltipProcessor");f(this,"markerPopupProcessor");ki.parse(e),this.provider=e,this.markerPinProcessor=new Ar(e),this.markerTooltipProcessor=new Mi(e),this.markerPopupProcessor=new Oi(e),this.configuration=t,this.log("info","Loaded")}set configuration(e){var t,n,s,a,i,o,l,u;this.apiStatesUrl=(n=(t=e==null?void 0:e.api)==null?void 0:t.states)==null?void 0:n.url,this.apiStatesKey=(a=(s=e==null?void 0:e.api)==null?void 0:s.states)==null?void 0:a.key,this.apiLogEnabled=(o=(i=e==null?void 0:e.api)==null?void 0:i.log)==null?void 0:o.enabled,this.markerPinProcessor.setConfiguration(e),me.setLimit(((u=(l=e==null?void 0:e.animation)==null?void 0:l.queue)==null?void 0:u.limit)??8*navigator.hardwareConcurrency)}async updateMarkers(e){bi.parse(e);try{let t;if(e.length>1){const n=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}));if(this.apiStatesKey!=null){const s={key:this.apiStatesKey,parameters:this.provider.parameters,input:n},a=await fetch(this.apiStatesUrl??Ti,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(!a.ok||!a.body)throw new Error("Failed to get marker states: "+a.statusText);t=await a.json()}else t=H.getStates(this.provider.parameters,n)}else t=[[0,[[0,H.Angles.DEGREES.indexOf(H.Angles.DEGREES_DEFAULT)]]]];this.updateMarkerData(e,t),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}}updateMarkerData(e,t){try{this.markerDataUpdating=!0;const n=new Map(e.map((a,i)=>[a.id,new An(this.provider,a,t[i])])),s=Array.from(this.markerDataArray);for(const a of s)n.has(a.marker.id)==!1&&(a.remove(),this.markerDataMap.delete(a.marker.id),this.markerDataArray.splice(this.markerDataArray.indexOf(a),1));for(let a=0;a<e.length;a++){const i=e[a],o=t[a],l=this.markerDataMap.get(i.id);if(l)l.update(o);else{const u=new An(this.provider,i,o);u.create(),this.markerDataMap.set(i.id,u),this.markerDataArray.push(u)}}this.markerDataArray.sort((a,i)=>a.zoom-i.zoom),this.markerPinProcessor.updateElements(this.markerDataArray.map(a=>a.pin)),this.markerTooltipProcessor.updateElements(this.markerDataArray.map(a=>a.tooltip))}catch(n){throw console.error(n),this.markerDataArray.forEach(s=>s.remove()),this.markerDataArray.length=0,this.markerDataMap.clear(),n instanceof Error&&this.log("error","Failed to update marker data",n),n}finally{this.markerDataUpdating=!1}}removeMarkerData(){try{this.markerDataUpdating=!0,this.markerPinProcessor.removeElements(),this.markerTooltipProcessor.removeElements(),this.markerPopupProcessor.clear(),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}}processMarkerDataCallback(){if(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.provider.getBounds(),t=this.provider.getZoom();this.markerPopupProcessor.process(),this.markerTooltipProcessor.process(e,t),this.markerPinProcessor.process(e,t)}async log(e,t,n){if(!(this.apiLogEnabled==null&&(window!=null&&window.location.host.startsWith("localhost")))&&this.apiLogEnabled!=!1)try{const s={title:`[CLIENT:${Tn}] ${t}`,level:e,content:{version:Tn,...n}};await fetch(Ci,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)})}catch(s){console.error(s)}}}class An{constructor(e,t,n){f(this,"marker");f(this,"zoom");f(this,"pin");f(this,"tooltip");this.marker=t,this.zoom=n[0],this.pin=new Tr(e,t,n),this.tooltip=new Mr(e,t,n)}create(){this.pin.create(),this.tooltip.create()}update(e){this.pin.update(e),this.tooltip.update(e)}remove(){this.pin.remove(),this.tooltip.remove()}}class qr{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,t;(e=this.marker)==null||e.remove(),(t=this.element)==null||t.remove()}}const Be=class Be extends qr{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)??Be.DEFAULT_SIZE,this.height=((i=n.pin)==null?void 0:i.style.height)??Be.DEFAULT_SIZE,this.radius=((o=n.pin)==null?void 0:o.style.radius)??Be.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=Vr(qa,{target:this.element,props:{id:this.id+"_pin",layer:Ba,priority:this.zoom*this.provider.parameters.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)}updateState(t){if(this.component==null)throw new Error("Failed to update pin state");this.component.setScale(this.getScale(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.setScale(t?0:1)}getScale(t){return this.zoom<t?1:Math.max(0,1-(this.zoom-t)*.125)}getZindex(){return Math.round((this.provider.parameters.zoomMax-this.zoom)*this.provider.parameters.zoomScale)}isCollapsed(){return this.component==null?!1:this.component.getCollapsed()}isBodyLoaded(){return this.bodyCallback==null||this.bodyLoaded}};f(Be,"DEFAULT_SIZE",16);let Tr=Be;const Ue=class Ue{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(Ue.MAP_PINS_MAX_COUNT,8*navigator.hardwareConcurrency),this.pinMaxZoomDelta=((s=e==null?void 0:e.pin)==null?void 0:s.maxZoom)??Ue.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.parameters.mapSize,s=new hs(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&&(this.pinFade==!0?i.updateState(t):i.setCollapsed(!1),i.updateMap(!0),i.isBodyLoaded()==!1&&i.updateBody()),a++):(i.setCollapsed(!0),i.isCollapsed()&&i.updateMap(!1)):i.updateMap(!1)}};f(Ue,"MAP_PINS_MAX_ZOOM",2),f(Ue,"MAP_PINS_MAX_COUNT",128);let Ar=Ue;const Wt=class Wt extends qr{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=H.Angles.DEGREES_DEFAULT,this.states=s[1].map(a=>[a[0],H.Angles.DEGREES[a[1]]]),this.bodyCallback=n.tooltip.body}createElement(){this.element=document.createElement("div"),this.element.classList.add("tooltip"),this.component=Vr(fs,{target:this.element,props:{id:this.id+"_tooltip",layer:Va,priority:this.zoom*this.provider.parameters.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],H.Angles.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(){return Math.round((this.provider.parameters.zoomMax-this.zoom)*this.provider.parameters.zoomScale)+Wt.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(Wt,"Z_INDEX_OFFSET",1e6);let Mr=Wt;class Mi{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.parameters.mapSize,s=new hs(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 Yt=class Yt extends qr{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=Vr(fs,{target:this.element,props:{id:this.id+"_popup",layer:za,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 Yt.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)}isExpanded(){return this.component==null?!1:this.component.getExpanded()}isCollapsed(){return this.component==null?!1:this.component.getCollapsed()}isBodyLoaded(){return this.bodyLoaded}};f(Yt,"Z_INDEX_OFFSET",2e6);let Or=Yt;class Oi{constructor(e){f(this,"provider");f(this,"popupElements",new Map);f(this,"popupPositioned",new Map);this.provider=e}show(e){e.pin.shown=!1,e.tooltip.shown=!1;const t=new Or(this.provider,e.marker);this.popupElements.set(e.marker.id,t),this.popupPositioned.set(e.marker.id,!1),t.create(),t.setAngle(e.tooltip.angle),t.shown=!0}hide(e){e.pin.shown=!0,e.tooltip.shown=!0;const t=this.popupElements.get(e.marker.id);t!=null&&(t.shown=!1)}clear(){this.popupElements.values().forEach(e=>e.remove()),this.popupElements.clear(),this.popupPositioned.clear()}process(){var e,t;for(const n of this.popupElements.values())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,d=l+a.y,h=u+n.width,p=d+n.height,v=this.provider.getContainer().getBoundingClientRect(),x=u-v.left,N=v.right-h,I=d-v.top,J=v.bottom-p,T=Math.min(n.width,n.height)/4,z=x<0?x-T:N<0?-N+T:0,K=I<0?I-T:J<0?-J+T:0;this.provider.panBy(z,K),this.popupPositioned.set(n.id,!0)}}else n.setCollapsed(!0),n.isCollapsed()&&(n.updateMap(!1),n.remove(),this.popupElements.delete(n.id),this.popupPositioned.delete(n.id))}}exports.MapManager=Ai;
1
+ "use strict";var ri=Object.defineProperty;var We=e=>{throw TypeError(e)};var ii=(e,t,r)=>t in e?ri(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var f=(e,t,r)=>ii(e,typeof t!="symbol"?t+"":t,r),he=(e,t,r)=>t.has(e)||We("Cannot "+r);var v=(e,t,r)=>(he(e,t,"read from private field"),r?r.call(e):t.get(e)),k=(e,t,r)=>t.has(e)?We("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),S=(e,t,r,i)=>(he(e,t,"write to private field"),i?i.call(e,r):t.set(e,r),r),nt=(e,t,r)=>(he(e,t,"access private method"),r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const P=require("./states-C618H9PS.cjs"),fr=!1;var hr=Array.isArray,ni=Array.prototype.indexOf,si=Array.from,ve=Object.defineProperty,Ft=Object.getOwnPropertyDescriptor,ai=Object.prototype,oi=Array.prototype,li=Object.getPrototypeOf,Ve=Object.isExtensible;function ui(e){for(var t=0;t<e.length;t++)e[t]()}function fi(){var e,t,r=new Promise((i,s)=>{e=i,t=s});return{promise:r,resolve:e,reject:t}}const N=2,Ce=4,dr=8,ae=16,rt=32,dt=64,cr=128,U=256,Jt=512,F=1024,Z=2048,it=4096,At=8192,Ct=16384,De=32768,hi=65536,Ge=1<<17,di=1<<18,Le=1<<19,pr=1<<20,me=1<<21,Pe=1<<22,lt=1<<23,Vt=Symbol("$state"),Te=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 ci(){throw new Error("https://svelte.dev/e/await_outside_boundary")}function pi(){throw new Error("https://svelte.dev/e/async_derived_orphan")}function vi(e){throw new Error("https://svelte.dev/e/effect_in_teardown")}function mi(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function gi(e){throw new Error("https://svelte.dev/e/effect_orphan")}function wi(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function _i(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function yi(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function Ei(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}const bi=2,x=Symbol();function vr(e){return e===this.v}let Mi=!1,Y=null;function Qt(e){Y=e}function Oe(e,t=!1,r){Y={p:Y,c:null,e:null,s:e,x:null,l:null}}function Fe(e){var t=Y,r=t.e;if(r!==null){t.e=null;for(var i of r)Lr(i)}return e!==void 0&&(t.x=e),Y=t.p,e??{}}function mr(){return!0}const ki=new WeakMap;function Ai(e){var t=_;if(t===null)return g.f|=lt,e;if((t.f&De)===0){if((t.f&cr)===0)throw!t.parent&&e instanceof Error&&gr(e),e;t.b.error(e)}else Ie(e,t)}function Ie(e,t){for(;t!==null;){if((t.f&cr)!==0)try{t.b.error(e);return}catch(r){e=r}t=t.parent}throw e instanceof Error&&gr(e),e}function gr(e){const t=ki.get(e);t&&(ve(e,"message",{value:t.message}),ve(e,"stack",{value:t.stack}))}let $t=[];function Si(){var e=$t;$t=[],ui(e)}function xi(e){$t.length===0&&queueMicrotask(Si),$t.push(e)}function Ci(){for(var e=_.b;e!==null&&!e.has_pending_snippet();)e=e.parent;return e===null&&ci(),e}function Di(e){var t=N|Z,r=g!==null&&(g.f&N)!==0?g:null;return _===null||r!==null&&(r.f&U)!==0?t|=U:_.f|=Le,{ctx:Y,deps:null,effects:null,equals:vr,f:t,fn:e,reactions:null,rv:0,v:x,wv:0,parent:r??_,ac:null}}function Li(e,t){let r=_;r===null&&pi();var i=r.b,s=void 0,n=Mr(x),a=null,o=!g;return Zi(()=>{try{var l=e()}catch(p){l=Promise.reject(p)}var u=()=>l;s=(a==null?void 0:a.then(u,u))??Promise.resolve(l),a=s;var d=A,c=i.pending;o&&(i.update_pending_count(1),c||d.increment());const h=(p,m=void 0)=>{a=null,c||d.activate(),m?m!==Te&&(n.f|=lt,_e(n,m)):((n.f&lt)!==0&&(n.f^=lt),_e(n,p)),o&&(i.update_pending_count(-1),c||d.decrement()),yr()};if(s.then(h,p=>h(null,p||"unknown")),d)return()=>{queueMicrotask(()=>d.neuter())}}),new Promise(l=>{function u(d){function c(){d===s?l(n):u(s)}d.then(c,c)}u(s)})}function wr(e){var t=e.effects;if(t!==null){e.effects=null;for(var r=0;r<t.length;r+=1)ht(t[r])}}function Pi(e){for(var t=e.parent;t!==null;){if((t.f&N)===0)return t;t=t.parent}return null}function Ne(e){var t,r=_;xt(Pi(e));try{wr(e),t=Ur(e)}finally{xt(r)}return t}function _r(e){var t=Ne(e);if(e.equals(t)||(e.v=t,e.wv=zr()),!Dt)if($!==null)$.set(e,e.v);else{var r=(tt||(e.f&U)!==0)&&e.deps!==null?it:F;B(e,r)}}function Ti(e,t,r){const i=Di;if(t.length===0){r(e.map(i));return}var s=A,n=_,a=Oi(),o=Ci();Promise.all(t.map(l=>Li(l))).then(l=>{s==null||s.activate(),a();try{r([...e.map(i),...l])}catch(u){(n.f&Ct)===0&&Ie(u,n)}s==null||s.deactivate(),yr()}).catch(l=>{o.error(l)})}function Oi(){var e=_,t=g,r=Y;return function(){xt(e),et(t),Qt(r)}}function yr(){xt(null),et(null),Qt(null)}const Tt=new Set;let A=null,$=null,Ke=new Set,te=[];function Er(){const e=te.shift();te.length>0&&queueMicrotask(Er),e()}let Nt=[],Re=null,ge=!1;var yt,Et,J,jt,Ut,st,bt,at,Q,Mt,Bt,qt,q,br,Gt,we;const ie=class ie{constructor(){k(this,q);f(this,"current",new Map);k(this,yt,new Map);k(this,Et,new Set);k(this,J,0);k(this,jt,null);k(this,Ut,!1);k(this,st,[]);k(this,bt,[]);k(this,at,[]);k(this,Q,[]);k(this,Mt,[]);k(this,Bt,[]);k(this,qt,[]);f(this,"skipped_effects",new Set)}process(t){var n;Nt=[];var r=null;if(Tt.size>1){r=new Map,$=new Map;for(const[a,o]of this.current)r.set(a,{v:a.v,wv:a.wv}),a.v=o;for(const a of Tt)if(a!==this)for(const[o,l]of v(a,yt))r.has(o)||(r.set(o,{v:o.v,wv:o.wv}),o.v=l)}for(const a of t)nt(this,q,br).call(this,a);if(v(this,st).length===0&&v(this,J)===0){nt(this,q,we).call(this);var i=v(this,at),s=v(this,Q);S(this,at,[]),S(this,Q,[]),S(this,Mt,[]),A=null,Je(i),Je(s),A===null?A=this:Tt.delete(this),(n=v(this,jt))==null||n.resolve()}else nt(this,q,Gt).call(this,v(this,at)),nt(this,q,Gt).call(this,v(this,Q)),nt(this,q,Gt).call(this,v(this,Mt));if(r){for(const[a,{v:o,wv:l}]of r)a.wv<=l&&(a.v=o);$=null}for(const a of v(this,st))It(a);for(const a of v(this,bt))It(a);S(this,st,[]),S(this,bt,[])}capture(t,r){v(this,yt).has(t)||v(this,yt).set(t,r),this.current.set(t,t.v)}activate(){A=this}deactivate(){A=null;for(const t of Ke)if(Ke.delete(t),t(),A!==null)break}neuter(){S(this,Ut,!0)}flush(){Nt.length>0?Fi():nt(this,q,we).call(this),A===this&&(v(this,J)===0&&Tt.delete(this),this.deactivate())}increment(){S(this,J,v(this,J)+1)}decrement(){if(S(this,J,v(this,J)-1),v(this,J)===0){for(const t of v(this,Bt))B(t,Z),St(t);for(const t of v(this,qt))B(t,it),St(t);S(this,at,[]),S(this,Q,[]),this.flush()}else this.deactivate()}add_callback(t){v(this,Et).add(t)}settled(){return(v(this,jt)??S(this,jt,fi())).promise}static ensure(){if(A===null){const t=A=new ie;Tt.add(A),ie.enqueue(()=>{A===t&&t.flush()})}return A}static enqueue(t){te.length===0&&queueMicrotask(Er),te.unshift(t)}};yt=new WeakMap,Et=new WeakMap,J=new WeakMap,jt=new WeakMap,Ut=new WeakMap,st=new WeakMap,bt=new WeakMap,at=new WeakMap,Q=new WeakMap,Mt=new WeakMap,Bt=new WeakMap,qt=new WeakMap,q=new WeakSet,br=function(t){var d;t.f^=F;for(var r=t.first;r!==null;){var i=r.f,s=(i&(rt|dt))!==0,n=s&&(i&F)!==0,a=n||(i&At)!==0||this.skipped_effects.has(r);if(!a&&r.fn!==null){if(s)r.f^=F;else if((i&F)===0)if((i&Ce)!==0)v(this,Q).push(r);else if((i&Pe)!==0){var o=(d=r.b)!=null&&d.pending?v(this,bt):v(this,st);o.push(r)}else oe(r)&&((r.f&ae)!==0&&v(this,Mt).push(r),It(r));var l=r.first;if(l!==null){r=l;continue}}var u=r.parent;for(r=r.next;r===null&&u!==null;)r=u.next,u=u.parent}},Gt=function(t){for(const r of t)((r.f&Z)!==0?v(this,Bt):v(this,qt)).push(r),B(r,F);t.length=0},we=function(){if(!v(this,Ut))for(const t of v(this,Et))t();v(this,Et).clear()};let Rt=ie;function Fi(){var e=_t;ge=!0;try{var t=0;for($e(!0);Nt.length>0;){var r=Rt.ensure();if(t++>1e3){var i,s;Ii()}r.process(Nt),ut.clear()}}finally{ge=!1,$e(e),Re=null}}function Ii(){try{wi()}catch(e){Ie(e,Re)}}function Je(e){var t=e.length;if(t!==0){for(var r=0;r<t;){var i=e[r++];if((i.f&(Ct|At))===0&&oe(i)){var s=A?A.current.size:0;if(It(i),i.deps===null&&i.first===null&&i.nodes_start===null&&(i.teardown===null&&i.ac===null?Ir(i):i.fn=null),A!==null&&A.current.size>s&&(i.f&pr)!==0)break}}for(;r<t;)St(e[r++])}}function St(e){for(var t=Re=e;t.parent!==null;){t=t.parent;var r=t.f;if(ge&&t===_&&(r&ae)!==0)return;if((r&(dt|rt))!==0){if((r&F)===0)return;t.f^=F}}Nt.push(t)}const ut=new Map;function Mr(e,t){var r={f:0,v:e,reactions:null,equals:vr,rv:0,wv:0};return r}function O(e,t){const r=Mr(e);return Gi(r),r}function L(e,t,r=!1){g!==null&&(!H||(g.f&Ge)!==0)&&mr()&&(g.f&(N|ae|Pe|Ge))!==0&&!(T!=null&&T.includes(e))&&Ei();let i=r?Ot(t):t;return _e(e,i)}function _e(e,t){if(!e.equals(t)){var r=e.v;Dt?ut.set(e,t):ut.set(e,r),e.v=t;var i=Rt.ensure();i.capture(e,r),(e.f&N)!==0&&((e.f&Z)!==0&&Ne(e),B(e,(e.f&U)===0?F:it)),e.wv=zr(),kr(e,Z),_!==null&&(_.f&F)!==0&&(_.f&(rt|dt))===0&&(j===null?Ki([e]):j.push(e))}return t}function de(e){L(e,e.v+1)}function kr(e,t){var r=e.reactions;if(r!==null)for(var i=r.length,s=0;s<i;s++){var n=r[s],a=n.f,o=(a&Z)===0;o&&B(n,t),(a&N)!==0?kr(n,it):o&&St(n)}}function Ot(e){if(typeof e!="object"||e===null||Vt in e)return e;const t=li(e);if(t!==ai&&t!==oi)return e;var r=new Map,i=hr(e),s=O(0),n=ft,a=o=>{if(ft===n)return o();var l=g,u=ft;et(null),er(n);var d=o();return et(l),er(u),d};return i&&r.set("length",O(e.length)),new Proxy(e,{defineProperty(o,l,u){(!("value"in u)||u.configurable===!1||u.enumerable===!1||u.writable===!1)&&_i();var d=r.get(l);return d===void 0?d=a(()=>{var c=O(u.value);return r.set(l,c),c}):L(d,u.value,!0),!0},deleteProperty(o,l){var u=r.get(l);if(u===void 0){if(l in o){const d=a(()=>O(x));r.set(l,d),de(s)}}else L(u,x),de(s);return!0},get(o,l,u){var p;if(l===Vt)return e;var d=r.get(l),c=l in o;if(d===void 0&&(!c||(p=Ft(o,l))!=null&&p.writable)&&(d=a(()=>{var m=Ot(c?o[l]:x),E=O(m);return E}),r.set(l,d)),d!==void 0){var h=M(d);return h===x?void 0:h}return Reflect.get(o,l,u)},getOwnPropertyDescriptor(o,l){var u=Reflect.getOwnPropertyDescriptor(o,l);if(u&&"value"in u){var d=r.get(l);d&&(u.value=M(d))}else if(u===void 0){var c=r.get(l),h=c==null?void 0:c.v;if(c!==void 0&&h!==x)return{enumerable:!0,configurable:!0,value:h,writable:!0}}return u},has(o,l){var h;if(l===Vt)return!0;var u=r.get(l),d=u!==void 0&&u.v!==x||Reflect.has(o,l);if(u!==void 0||_!==null&&(!d||(h=Ft(o,l))!=null&&h.writable)){u===void 0&&(u=a(()=>{var p=d?Ot(o[l]):x,m=O(p);return m}),r.set(l,u));var c=M(u);if(c===x)return!1}return d},set(o,l,u,d){var C;var c=r.get(l),h=l in o;if(i&&l==="length")for(var p=u;p<c.v;p+=1){var m=r.get(p+"");m!==void 0?L(m,x):p in o&&(m=a(()=>O(x)),r.set(p+"",m))}if(c===void 0)(!h||(C=Ft(o,l))!=null&&C.writable)&&(c=a(()=>O(void 0)),L(c,Ot(u)),r.set(l,c));else{h=c.v!==x;var E=a(()=>Ot(u));L(c,E)}var b=Reflect.getOwnPropertyDescriptor(o,l);if(b!=null&&b.set&&b.set.call(d,u),!h){if(i&&typeof l=="string"){var R=r.get("length"),w=Number(l);Number.isInteger(w)&&w>=R.v&&L(R,w+1)}de(s)}return!0},ownKeys(o){M(s);var l=Reflect.ownKeys(o).filter(c=>{var h=r.get(c);return h===void 0||h.v!==x});for(var[u,d]of r)d.v!==x&&!(u in o)&&l.push(u);return l},setPrototypeOf(){yi()}})}var Qe,Ar,Sr,xr;function Ni(){if(Qe===void 0){Qe=window,Ar=/Firefox/.test(navigator.userAgent);var e=Element.prototype,t=Node.prototype,r=Text.prototype;Sr=Ft(t,"firstChild").get,xr=Ft(t,"nextSibling").get,Ve(e)&&(e.__click=void 0,e.__className=void 0,e.__attributes=null,e.__style=void 0,e.__e=void 0),Ve(r)&&(r.__t=void 0)}}function Ri(e=""){return document.createTextNode(e)}function Cr(e){return Sr.call(e)}function Dr(e){return xr.call(e)}function ye(e,t){return Cr(e)}function zi(e,t=1,r=!1){let i=e;for(;t--;)i=Dr(i);return i}function ji(e){_===null&&g===null&&gi(),g!==null&&(g.f&U)!==0&&_===null&&mi(),Dt&&vi()}function Ui(e,t){var r=t.last;r===null?t.last=t.first=e:(r.next=e,e.prev=r,t.last=e)}function ct(e,t,r,i=!0){var s=_;s!==null&&(s.f&At)!==0&&(e|=At);var n={ctx:Y,deps:null,nodes_start:null,nodes_end:null,f:e|Z,first:null,fn:t,last:null,next:null,parent:s,b:s&&s.b,prev:null,teardown:null,transitions:null,wv:0,ac:null};if(r)try{It(n),n.f|=De}catch(l){throw ht(n),l}else t!==null&&St(n);var a=r&&n.deps===null&&n.first===null&&n.nodes_start===null&&n.teardown===null&&(n.f&Le)===0;if(!a&&i&&(s!==null&&Ui(n,s),g!==null&&(g.f&N)!==0&&(e&dt)===0)){var o=g;(o.effects??(o.effects=[])).push(n)}return n}function V(e){ji();var t=_.f,r=!g&&(t&rt)!==0&&(t&De)===0;if(r){var i=Y;(i.e??(i.e=[])).push(e)}else return Lr(e)}function Lr(e){return ct(Ce|pr,e,!1)}function Bi(e){Rt.ensure();const t=ct(dt,e,!0);return(r={})=>new Promise(i=>{r.outro?Wi(t,()=>{ht(t),i(void 0)}):(ht(t),i(void 0))})}function qi(e){return ct(Ce,e,!1)}function Zi(e){return ct(Pe|Le,e,!0)}function Pr(e,t=0){return ct(dr|t,e,!0)}function Tr(e,t=[],r=[]){Ti(t,r,i=>{ct(dr,()=>e(...i.map(M)),!0)})}function Yi(e,t=!0){return ct(rt,e,!0,t)}function Or(e){var t=e.teardown;if(t!==null){const r=Dt,i=g;tr(!0),et(null);try{t.call(null)}finally{tr(r),et(i)}}}function Fr(e,t=!1){var s;var r=e.first;for(e.first=e.last=null;r!==null;){(s=r.ac)==null||s.abort(Te);var i=r.next;(r.f&dt)!==0?r.parent=null:ht(r,t),r=i}}function Hi(e){for(var t=e.first;t!==null;){var r=t.next;(t.f&rt)===0&&ht(t),t=r}}function ht(e,t=!0){var r=!1;(t||(e.f&di)!==0)&&e.nodes_start!==null&&e.nodes_end!==null&&(Xi(e.nodes_start,e.nodes_end),r=!0),Fr(e,t&&!r),ee(e,0),B(e,Ct);var i=e.transitions;if(i!==null)for(const n of i)n.stop();Or(e);var s=e.parent;s!==null&&s.first!==null&&Ir(e),e.next=e.prev=e.teardown=e.ctx=e.deps=e.fn=e.nodes_start=e.nodes_end=e.ac=null}function Xi(e,t){for(;e!==null;){var r=e===t?null:Dr(e);e.remove(),e=r}}function Ir(e){var t=e.parent,r=e.prev,i=e.next;r!==null&&(r.next=i),i!==null&&(i.prev=r),t!==null&&(t.first===e&&(t.first=i),t.last===e&&(t.last=r))}function Wi(e,t){var r=[];Nr(e,r,!0),Vi(r,()=>{ht(e),t&&t()})}function Vi(e,t){var r=e.length;if(r>0){var i=()=>--r||t();for(var s of e)s.out(i)}else t()}function Nr(e,t,r){if((e.f&At)===0){if(e.f^=At,e.transitions!==null)for(const a of e.transitions)(a.is_global||r)&&t.push(a);for(var i=e.first;i!==null;){var s=i.next,n=(i.f&hi)!==0||(i.f&rt)!==0;Nr(i,t,n?r:!1),i=s}}}let _t=!1;function $e(e){_t=e}let Dt=!1;function tr(e){Dt=e}let g=null,H=!1;function et(e){g=e}let _=null;function xt(e){_=e}let T=null;function Gi(e){g!==null&&(T===null?T=[e]:T.push(e))}let D=null,I=0,j=null;function Ki(e){j=e}let Rr=1,zt=0,ft=zt;function er(e){ft=e}let tt=!1;function zr(){return++Rr}function oe(e){var c;var t=e.f;if((t&Z)!==0)return!0;if((t&it)!==0){var r=e.deps,i=(t&U)!==0;if(r!==null){var s,n,a=(t&Jt)!==0,o=i&&_!==null&&!tt,l=r.length;if((a||o)&&(_===null||(_.f&Ct)===0)){var u=e,d=u.parent;for(s=0;s<l;s++)n=r[s],(a||!((c=n==null?void 0:n.reactions)!=null&&c.includes(u)))&&(n.reactions??(n.reactions=[])).push(u);a&&(u.f^=Jt),o&&d!==null&&(d.f&U)===0&&(u.f^=U)}for(s=0;s<l;s++)if(n=r[s],oe(n)&&_r(n),n.wv>e.wv)return!0}(!i||_!==null&&!tt)&&B(e,F)}return!1}function jr(e,t,r=!0){var i=e.reactions;if(i!==null&&!(T!=null&&T.includes(e)))for(var s=0;s<i.length;s++){var n=i[s];(n.f&N)!==0?jr(n,t,!1):t===n&&(r?B(n,Z):(n.f&F)!==0&&B(n,it),St(n))}}function Ur(e){var m;var t=D,r=I,i=j,s=g,n=tt,a=T,o=Y,l=H,u=ft,d=e.f;D=null,I=0,j=null,tt=(d&U)!==0&&(H||!_t||g===null),g=(d&(rt|dt))===0?e:null,T=null,Qt(e.ctx),H=!1,ft=++zt,e.ac!==null&&(e.ac.abort(Te),e.ac=null);try{e.f|=me;var c=(0,e.fn)(),h=e.deps;if(D!==null){var p;if(ee(e,I),h!==null&&I>0)for(h.length=I+D.length,p=0;p<D.length;p++)h[I+p]=D[p];else e.deps=h=D;if(!tt||(d&N)!==0&&e.reactions!==null)for(p=I;p<h.length;p++)((m=h[p]).reactions??(m.reactions=[])).push(e)}else h!==null&&I<h.length&&(ee(e,I),h.length=I);if(mr()&&j!==null&&!H&&h!==null&&(e.f&(N|it|Z))===0)for(p=0;p<j.length;p++)jr(j[p],e);return s!==null&&s!==e&&(zt++,j!==null&&(i===null?i=j:i.push(...j))),(e.f&lt)!==0&&(e.f^=lt),c}catch(E){return Ai(E)}finally{e.f^=me,D=t,I=r,j=i,g=s,tt=n,T=a,Qt(o),H=l,ft=u}}function Ji(e,t){let r=t.reactions;if(r!==null){var i=ni.call(r,e);if(i!==-1){var s=r.length-1;s===0?r=t.reactions=null:(r[i]=r[s],r.pop())}}r===null&&(t.f&N)!==0&&(D===null||!D.includes(t))&&(B(t,it),(t.f&(U|Jt))===0&&(t.f^=Jt),wr(t),ee(t,0))}function ee(e,t){var r=e.deps;if(r!==null)for(var i=t;i<r.length;i++)Ji(e,r[i])}function It(e){var t=e.f;if((t&Ct)===0){B(e,F);var r=_,i=_t;_=e,_t=!0;try{(t&ae)!==0?Hi(e):Fr(e),Or(e);var s=Ur(e);e.teardown=typeof s=="function"?s:null,e.wv=Rr;var n;fr&&Mi&&(e.f&Z)!==0&&e.deps}finally{_t=i,_=r}}}function M(e){var t=e.f,r=(t&N)!==0;if(g!==null&&!H){var i=_!==null&&(_.f&Ct)!==0;if(!i&&!(T!=null&&T.includes(e))){var s=g.deps;if((g.f&me)!==0)e.rv<zt&&(e.rv=zt,D===null&&s!==null&&s[I]===e?I++:D===null?D=[e]:(!tt||!D.includes(e))&&D.push(e));else{(g.deps??(g.deps=[])).push(e);var n=e.reactions;n===null?e.reactions=[g]:n.includes(g)||n.push(g)}}}else if(r&&e.deps===null&&e.effects===null){var a=e,o=a.parent;o!==null&&(o.f&U)===0&&(a.f^=U)}if(Dt){if(ut.has(e))return ut.get(e);if(r){a=e;var l=a.v;return((a.f&F)===0&&a.reactions!==null||Br(a))&&(l=Ne(a)),ut.set(a,l),l}}else if(r){if(a=e,$!=null&&$.has(a))return $.get(a);oe(a)&&_r(a)}if((e.f&lt)!==0)throw e.v;return e.v}function Br(e){if(e.v===x)return!0;if(e.deps===null)return!1;for(const t of e.deps)if(ut.has(t)||(t.f&N)!==0&&Br(t))return!0;return!1}function Qi(e){var t=H;try{return H=!0,e()}finally{H=t}}const $i=-7169;function B(e,t){e.f=e.f&$i|t}const tn=["touchstart","touchmove"];function en(e){return tn.includes(e)}const rn=new Set,rr=new Set;function Wt(e){var w;var t=this,r=t.ownerDocument,i=e.type,s=((w=e.composedPath)==null?void 0:w.call(e))||[],n=s[0]||e.target,a=0,o=e.__root;if(o){var l=s.indexOf(o);if(l!==-1&&(t===document||t===window)){e.__root=t;return}var u=s.indexOf(t);if(u===-1)return;l<=u&&(a=l)}if(n=s[a]||e.target,n!==t){ve(e,"currentTarget",{configurable:!0,get(){return n||r}});var d=g,c=_;et(null),xt(null);try{for(var h,p=[];n!==null;){var m=n.assignedSlot||n.parentNode||n.host||null;try{var E=n["__"+i];if(E!=null&&(!n.disabled||e.target===n))if(hr(E)){var[b,...R]=E;b.apply(n,[e,...R])}else E.call(n,e)}catch(C){h?p.push(C):h=C}if(e.cancelBubble||m===t||m===null)break;n=m}if(h){for(let C of p)queueMicrotask(()=>{throw C});throw h}}finally{e.__root=t,delete e.currentTarget,et(d),xt(c)}}}function nn(e){var t=document.createElement("template");return t.innerHTML=e.replaceAll("<!>","<!---->"),t.content}function sn(e,t){var r=_;r.nodes_start===null&&(r.nodes_start=e,r.nodes_end=t)}function qr(e,t){var r=(t&bi)!==0,i,s=!e.startsWith("<!>");return()=>{i===void 0&&(i=nn(s?e:"<!>"+e),i=Cr(i));var n=r||Ar?document.importNode(i,!0):i.cloneNode(!0);return sn(n,n),n}}function Zr(e,t){e!==null&&e.before(t)}function ze(e,t){return an(e,t)}const vt=new Map;function an(e,{target:t,anchor:r,props:i={},events:s,context:n,intro:a=!0}){Ni();var o=new Set,l=c=>{for(var h=0;h<c.length;h++){var p=c[h];if(!o.has(p)){o.add(p);var m=en(p);t.addEventListener(p,Wt,{passive:m});var E=vt.get(p);E===void 0?(document.addEventListener(p,Wt,{passive:m}),vt.set(p,1)):vt.set(p,E+1)}}};l(si(rn)),rr.add(l);var u=void 0,d=Bi(()=>{var c=r??t.appendChild(Ri());return Yi(()=>{if(n){Oe({});var h=Y;h.c=n}s&&(i.$$events=s),u=e(c,i)||{},n&&Fe()}),()=>{var m;for(var h of o){t.removeEventListener(h,Wt);var p=vt.get(h);--p===0?(document.removeEventListener(h,Wt),vt.delete(h)):vt.set(h,p)}rr.delete(l),c!==r&&((m=c.parentNode)==null||m.removeChild(c))}});return on.set(u,d),u}let on=new WeakMap;const ir=[...`
2
+ \r\f \v\uFEFF`];function ln(e,t,r){var i=e==null?"":""+e;if(r){for(var s in r)if(r[s])i=i?i+" "+s:s;else if(i.length)for(var n=s.length,a=0;(a=i.indexOf(s,a))>=0;){var o=a+n;(a===0||ir.includes(i[a-1]))&&(o===i.length||ir.includes(i[o]))?i=(a===0?"":i.substring(0,a))+i.substring(o+1):a=o}}return i===""?null:i}function nr(e,t=!1){var r=t?" !important;":";",i="";for(var s in e){var n=e[s];n!=null&&n!==""&&(i+=" "+s+": "+n+r)}return i}function ce(e){return e[0]!=="-"||e[1]!=="-"?e.toLowerCase():e}function un(e,t){if(t){var r="",i,s;if(Array.isArray(t)?(i=t[0],s=t[1]):i=t,e){e=String(e).replaceAll(/\s*\/\*.*?\*\/\s*/g,"").trim();var n=!1,a=0,o=!1,l=[];i&&l.push(...Object.keys(i).map(ce)),s&&l.push(...Object.keys(s).map(ce));var u=0,d=-1;const E=e.length;for(var c=0;c<E;c++){var h=e[c];if(o?h==="/"&&e[c-1]==="*"&&(o=!1):n?n===h&&(n=!1):h==="/"&&e[c+1]==="*"?o=!0:h==='"'||h==="'"?n=h:h==="("?a++:h===")"&&a--,!o&&n===!1&&a===0){if(h===":"&&d===-1)d=c;else if(h===";"||c===E-1){if(d!==-1){var p=ce(e.substring(u,d).trim());if(!l.includes(p)){h!==";"&&c++;var m=e.substring(u,c).trim();r+=" "+m+";"}}u=c+1,d=-1}}}}return i&&(r+=nr(i)),s&&(r+=nr(s,!0)),r=r.trim(),r===""?null:r}return e==null?null:String(e)}function Yr(e,t,r,i,s,n){var a=e.__className;if(a!==r||a===void 0){var o=ln(r,i,n);o==null?e.removeAttribute("class"):e.className=o,e.__className=r}else if(n&&s!==n)for(var l in n){var u=!!n[l];(s==null||u!==!!s[l])&&e.classList.toggle(l,u)}return n}function pe(e,t={},r,i){for(var s in r){var n=r[s];t[s]!==n&&(r[s]==null?e.style.removeProperty(s):e.style.setProperty(s,n,i))}}function re(e,t,r,i){var s=e.__style;if(s!==t){var n=un(t,i);n==null?e.removeAttribute("style"):e.style.cssText=n,e.__style=t}else i&&(Array.isArray(i)?(pe(e,r==null?void 0:r[0],i[0]),pe(e,r==null?void 0:r[1],i[1],"important")):pe(e,r,i));return i}const fn=()=>performance.now(),X={tick:e=>requestAnimationFrame(e),now:()=>fn(),tasks:new Set};function Hr(){const e=X.now();X.tasks.forEach(t=>{t.c(e)||(X.tasks.delete(t),t.f())}),X.tasks.size!==0&&X.tick(Hr)}function hn(e){let t;return X.tasks.size===0&&X.tick(Hr),{promise:new Promise(r=>{X.tasks.add(t={c:e,f:r})}),abort(){X.tasks.delete(t)}}}function sr(e,t){return e===t||(e==null?void 0:e[Vt])===t}function mt(e={},t,r,i){return qi(()=>{var s,n;return Pr(()=>{s=n,n=[],Qi(()=>{e!==r(...n)&&(t(e,...n),s&&sr(r(...s),e)&&t(null,...s))})}),()=>{xi(()=>{n&&sr(r(...n),e)&&t(null,...n)})}}),e}const dn="5";var ur;typeof window<"u"&&((ur=window.__svelte??(window.__svelte={})).v??(ur.v=new Set)).add(dn);function cn(e){return e}function Ee(e){return-.5*(Math.cos(Math.PI*e)-1)}function pn(e){const t=Math.cos(e*Math.PI*.5);return Math.abs(t)<1e-14?1:1-t}function vn(e){return Math.sin(e*Math.PI/2)}const mn=128,gn=0,wn=1,_n=2;class yn{constructor(){f(this,"animationsStarted",!1);f(this,"animationsCount",0);f(this,"animationsLimit",mn);f(this,"layers",new Array)}start(){window.requestAnimationFrame(this.tick.bind(this))}tick(){try{this.animationsCount=0;for(let t=0;t<this.layers.length;t++){const r=this.layers[t];if(r==null)continue;const i=r.animations;if(i!=null)for(let s=0;s<i.length;s++){const n=i[s];if(n!=null){for(const a of n.values())if(!a.executed&&(a.executed=!0,a.function(),this.animationsCount++,this.animationsCount==this.animationsLimit))return}}}}catch{}finally{window.requestAnimationFrame(this.tick.bind(this))}}equeue(t,r,i,s){let n=this.layers[t];n==null&&(n=this.layers[t]={animations:new Array});let a=n.animations[r];a==null&&(a=n.animations[r]=new Map);let o={id:i,priority:r,executed:!1,function:s};a.set(i,o),this.animationsStarted==!1&&(this.animationsStarted=!0,this.start())}clear(t,r){for(let i=0;i<this.layers.length;i++){let s=this.layers[i];if(s==null)continue;let n=s.animations[t];if(n==null)return;let a=n.get(r);if(a==null||a.executed==!1)return;n.delete(r)}}speed(){return Math.pow(2,2*this.animationsCount/this.animationsLimit)}stacked(){return this.animationsCount==this.animationsLimit}setLimit(t){this.animationsLimit=t}}const K=new yn;function ar(e){return Object.prototype.toString.call(e)==="[object Date]"}function be(e,t){if(e===t||e!==e)return()=>e;const r=typeof e;if(r!==typeof t||Array.isArray(e)!==Array.isArray(t))throw new Error("Cannot interpolate values of different type");if(Array.isArray(e)){const i=t.map((s,n)=>be(e[n],s));return s=>i.map(n=>n(s))}if(r==="object"){if(!e||!t)throw new Error("Object cannot be null");if(ar(e)&&ar(t)){const n=e.getTime(),o=t.getTime()-n;return l=>new Date(n+l*o)}const i=Object.keys(t),s={};return i.forEach(n=>{s[n]=be(e[n],t[n])}),n=>{const a={};return i.forEach(o=>{a[o]=s[o](n)}),a}}if(r==="number"){const i=t-e;return s=>e+s*i}return()=>t}var G,kt,Zt,ot;const Ue=class Ue{constructor(t,r={}){k(this,G);k(this,kt);k(this,Zt);k(this,ot,null);S(this,G,O(t)),S(this,kt,O(t)),S(this,Zt,r)}static of(t,r){const i=new Ue(t(),r);return Pr(()=>{i.set(t())}),i}set(t,r){var c;L(v(this,kt),t);let{delay:i=0,duration:s=400,easing:n=cn,interpolate:a=be}={...v(this,Zt),...r};if(s===0)return(c=v(this,ot))==null||c.abort(),L(v(this,G),t),Promise.resolve();const o=X.now()+i;let l,u=!1,d=v(this,ot);return S(this,ot,hn(h=>{if(h<o)return!0;if(!u){u=!0;const m=v(this,G).v;l=a(m,t),typeof s=="function"&&(s=s(m,t)),d==null||d.abort()}const p=h-o;return p>s?(L(v(this,G),t),!1):(L(v(this,G),l(n(p/s))),!0)})),v(this,ot).promise}get current(){return M(v(this,G))}get target(){return M(v(this,kt))}set target(t){this.set(t)}};G=new WeakMap,kt=new WeakMap,Zt=new WeakMap,ot=new WeakMap;let Me=Ue;class Kt{constructor(t,r){f(this,"value");f(this,"motion");this.value=t,this.motion=new Me(t,r)}set(t,r){this.value=t,this.motion.set(t,r)}update(t){this.motion.set(this.value,t)}snap(){this.motion.set(this.value,{duration:0})}}var En=qr('<div><div class="body svelte-1nfn9j8"></div></div>');function bn(e,t){Oe(t,!0);let r,i;function s(){return i}let n=O(!1);function a(w){L(n,w,!0)}function o(){return M(n)}let l=new Kt(0,{easing:Ee});V(()=>{u(l.motion.current)}),V(()=>{M(n)==!1&&(l.snap(),K.clear(t.priority,t.id))});function u(w){r&&K.equeue(t.layer,t.priority,t.id,()=>{r.style.scale=w.toString(),r.style.filter=`brightness(${.25+.75*w})`,i.style.opacity=w.toString()})}function d(w){w!=l.value&&l.set(w,{duration:75})}function c(){return l.motion.current==0}function h(){return l.value}var p=En();let m,E;var b=ye(p);let R;return mt(b,w=>i=w,()=>i),mt(p,w=>r=w,()=>r),Tr((w,C,z)=>{m=Yr(p,1,"pin svelte-1nfn9j8",null,m,w),E=re(p,"",E,C),R=re(b,"",R,z)},[()=>({displayed:M(n)}),()=>({width:`${t.width}px`,height:`${t.height}px`,"border-radius":`${t.radius}px`}),()=>({width:`${t.width-4}px`,height:`${t.height-4}px`,"border-radius":`${t.radius-2}px`})]),Zr(e,p),Fe({getBody:s,setDisplayed:a,getDisplayed:o,setScale:d,getCollapsed:c,getScale:h})}var Mn=qr('<div><div class="pointer svelte-j5igi2"></div> <div class="bubble svelte-j5igi2"><div class="body svelte-j5igi2"></div></div></div>');function Xr(e,t){Oe(t,!0);let r,i,s,n;const a=t.width+2*t.margin,o=t.height+2*t.margin,l=()=>n;V(()=>{s.style.width=`${t.margin*4}px`,s.style.height=`${t.margin*4}px`});let u=O(!0);function d(y){L(u,y,!0)}function c(){return M(u)}let h=O(!0);function p(y){L(h,y,!0)}function m(){return b.motion.current==0}function E(){return b.motion.current==1}let b=new Kt(0);V(()=>{R(b.motion.current)}),V(()=>{M(u)==!1&&(b.snap(),K.clear(t.priority,t.id+"_scale"))}),V(()=>{M(h)==!0&&b.value!=0&&(K.stacked()?b.set(0,{duration:0}):b.set(0,{duration:150,easing:pn})),M(h)==!1&&b.value!=1&&b.set(1,{duration:150,easing:vn})});function R(y){!r||!i||!s||K.equeue(M(h)?0:t.layer,t.priority,t.id+"_scale",()=>{r.style.opacity=`${y}`,i.style.scale=`${y}`,s.style.scale=`${y}`})}let w=NaN,C=O(!1),z=new Kt(-a/2,{easing:Ee}),Yt=new Kt(-o/2,{easing:Ee});V(()=>{Be(z.motion.current,Yt.motion.current)}),V(()=>{M(u)==!1&&(z.snap(),z.snap(),K.clear(t.priority,t.id+"_angle"))}),V(()=>{M(h)==!0&&M(C)&&(z.update({duration:75}),z.update({duration:75}))});function Be(y,W){if(!r||!i||!s)return;const Xt=y+a/2,Lt=W+o/2,pt=o<a?Xt*o/a:Xt,ue=o>a?Lt*a/o:Lt,Jr=Math.atan2(ue,pt)/Math.PI*180-45,He=0,Qr=30,fe=Math.sqrt(pt*pt+ue*ue),Pt=Math.min(a,o)/2,$r=Pt*Math.SQRT2,ti=(fe-Pt)/($r-Pt),Xe=He+ti*(Qr-He),ei=fe<Pt?fe/Pt:1;K.equeue(t.layer,t.priority,t.id+"_angle",()=>{i.style.transform=`translate(${Math.round(y)}px, ${Math.round(W)}px)`,s.style.transform=`scale(${ei}) rotate(${Jr}deg) skew(${Xe}deg, ${Xe}deg)`})}function Gr(y){if(M(C)==!1){let W=P.Rectangle.getOffsets(a,o,y);z.set(Math.round(W.x),{duration:0}),Yt.set(Math.round(W.y),{duration:0}),Be(z.value,Yt.value),w=y,L(C,!0)}else if(y!=w){let W=Math.abs(y-w),Xt=W<180?W:360-W,Lt=Math.log(Xt)*75,pt=P.Rectangle.getOffsets(a,o,y);z.set(Math.round(pt.x),{duration:Lt}),Yt.set(Math.round(pt.y),{duration:Lt}),w=y}}function Kr(){return P.Rectangle.getOffsets(a,o,w)}var Ht=Mn();let qe;var Ze=ye(Ht);mt(Ze,y=>s=y,()=>s);var le=zi(Ze,2),Ye=ye(le);return mt(Ye,y=>n=y,()=>n),mt(le,y=>i=y,()=>i),mt(Ht,y=>r=y,()=>r),Tr(y=>{qe=Yr(Ht,1,"anchor svelte-j5igi2",null,qe,y),re(le,`margin: ${t.margin}px;`),re(Ye,`width: ${t.width}px; height: ${t.height}px; border-radius: ${t.radius}px;`)},[()=>({displayed:M(u)})]),Zr(e,Ht),Fe({getBody:l,setDisplayed:d,getDisplayed:c,setCollapsed:p,getCollapsed:m,getExpanded:E,setAngle:Gr,getOffsets:Kr})}class Wr{constructor(t,r,i,s,n){f(this,"swLat");f(this,"swLng");f(this,"neLat");f(this,"neLng");const a=i*Math.pow(2,r),o=P.Mercator.project(t.sw.lat,t.sw.lng,a),l=P.Mercator.project(t.ne.lat,t.ne.lng,a),u=o.x-s,d=o.y+n,c=l.x+s,h=l.y-n,p=P.Mercator.unproject(u,d,a),m=P.Mercator.unproject(c,h,a);this.swLat=p.lat,this.swLng=p.lng,this.neLat=m.lat,this.neLng=m.lng}contains(t,r){return this.swLat<=t&&t<=this.neLat?this.swLng<this.neLng?this.swLng<=r&&r<=this.neLng:r<=this.neLng||this.swLng<=r:!1}}const Vr="https://arenarium.dev/api/public/v1",kn=`${Vr}/log`,An=`${Vr}/tooltip/states`,or="1.0.189";class Sn{constructor(t,r){f(this,"provider");f(this,"apiStatesUrl");f(this,"apiStatesKey");f(this,"apiLogEnabled");f(this,"markerDataArray",new Array);f(this,"markerDataMap",new Map);f(this,"markerDataUpdating",!1);f(this,"markerPinProcessor");f(this,"markerTooltipProcessor");f(this,"markerPopupProcessor");P.mapProviderSchema.parse(t),this.provider=t,this.markerPinProcessor=new Ae(t),this.markerTooltipProcessor=new xn(t),this.markerPopupProcessor=new Cn(t),this.configuration=r,this.log("info","Loaded")}set configuration(t){var r,i,s,n,a,o,l,u;this.apiStatesUrl=(i=(r=t==null?void 0:t.api)==null?void 0:r.states)==null?void 0:i.url,this.apiStatesKey=(n=(s=t==null?void 0:t.api)==null?void 0:s.states)==null?void 0:n.key,this.apiLogEnabled=(o=(a=t==null?void 0:t.api)==null?void 0:a.log)==null?void 0:o.enabled,this.markerPinProcessor.setConfiguration(t),K.setLimit(((u=(l=t==null?void 0:t.animation)==null?void 0:l.queue)==null?void 0:u.limit)??8*navigator.hardwareConcurrency)}async updateMarkers(t){P.mapMarkersSchema.parse(t);try{let r;if(t.length>1){const i=this.provider.getParameters(),s=t.map(n=>({id:n.id,rank:n.rank,lat:n.lat,lng:n.lng,width:n.tooltip.style.width,height:n.tooltip.style.height,margin:n.tooltip.style.margin}));if(this.apiStatesKey!=null){const n={key:this.apiStatesKey,parameters:i,input:s},a=await fetch(this.apiStatesUrl??An,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!a.ok||!a.body)throw new Error("Failed to get marker states: "+a.statusText);r=await a.json()}else r=P.getStates(i,s)}else r=[[0,[[0,P.Angles.DEGREES.indexOf(P.Angles.DEGREES_DEFAULT)]]]];this.updateMarkerData(t,r),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(t){throw console.error(t),t instanceof Error&&this.log("error","Failed to remove markers",t),t}}showPopup(t){try{for(const r of this.markerDataArray)r.marker.id==t?this.markerPopupProcessor.show(r):this.markerPopupProcessor.hide(r)}catch(r){console.error(r);for(const i of this.markerDataArray)this.markerPopupProcessor.hide(i);throw r instanceof Error&&this.log("error","Failed to show popup",r),r}}hidePopup(t){try{if(t){const r=this.markerDataMap.get(t);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 i of this.markerDataArray)this.markerPopupProcessor.hide(i);throw r instanceof Error&&this.log("error","Failed to hide popup",r),r}}updateMarkerData(t,r){try{this.markerDataUpdating=!0;const i=new Map(t.map((n,a)=>[n.id,new lr(this.provider,n,r[a])])),s=Array.from(this.markerDataArray);for(const n of s)i.has(n.marker.id)==!1&&(n.remove(),this.markerDataMap.delete(n.marker.id),this.markerDataArray.splice(this.markerDataArray.indexOf(n),1));for(let n=0;n<t.length;n++){const a=t[n],o=r[n],l=this.markerDataMap.get(a.id);if(l)l.update(o);else{const u=new lr(this.provider,a,o);u.create(),this.markerDataMap.set(a.id,u),this.markerDataArray.push(u)}}this.markerDataArray.sort((n,a)=>n.zoom-a.zoom),this.markerPinProcessor.updateElements(this.markerDataArray.map(n=>n.pin)),this.markerTooltipProcessor.updateElements(this.markerDataArray.map(n=>n.tooltip))}catch(i){throw console.error(i),this.markerDataArray.forEach(s=>s.remove()),this.markerDataArray.length=0,this.markerDataMap.clear(),i instanceof Error&&this.log("error","Failed to update marker data",i),i}finally{this.markerDataUpdating=!1}}removeMarkerData(){try{this.markerDataUpdating=!0,this.markerPinProcessor.removeElements(),this.markerTooltipProcessor.removeElements(),this.markerPopupProcessor.clear(),this.markerDataArray.length=0,this.markerDataMap.clear()}catch(t){throw console.error(t),t instanceof Error&&this.log("error","Failed to remove marker data",t),t}finally{this.markerDataUpdating=!1}}processMarkerDataCallback(){if(this.markerDataArray.length!=0)try{this.processMarkerData(),window.setTimeout(this.processMarkerDataCallback.bind(this),25)}catch(t){console.error(t),t instanceof Error&&this.log("error","Failed to process marker data",t)}}processMarkerData(){if(this.markerDataUpdating)return;const t=this.provider.getBounds(),r=this.provider.getZoom();this.markerPopupProcessor.process(),this.markerTooltipProcessor.process(t,r),this.markerPinProcessor.process(t,r)}async log(t,r,i){if(!(this.apiLogEnabled==null&&(window!=null&&window.location.host.startsWith("localhost")))&&this.apiLogEnabled!=!1)try{const s={title:`[CLIENT:${or}] ${r}`,level:t,content:{version:or,...i}};await fetch(kn,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)})}catch(s){console.error(s)}}}class lr{constructor(t,r,i){f(this,"marker");f(this,"zoom");f(this,"pin");f(this,"tooltip");this.marker=r,this.zoom=i[0],this.pin=new ke(t,r,i),this.tooltip=new Se(t,r,i)}create(){this.pin.create(),this.tooltip.create()}update(t){this.pin.update(t),this.tooltip.update(t)}remove(){this.pin.remove(),this.tooltip.remove()}}class je{constructor(t,r){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=t,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 t=this.element;if(!t)throw new Error("Failed to create provider marker");this.marker=this.provider.createMarker(t,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(t){const r=this.marker,i=this.component;if(r==null||i==null)throw new Error("Failed to update provider marker map");t?r.inserted()==!1&&r.insert():r.inserted()==!0&&r.remove()}getZindex(){throw new Error("Get z-index not implemented")}remove(){var t,r;(t=this.marker)==null||t.remove(),(r=this.element)==null||r.remove()}}const gt=class gt extends je{constructor(r,i,s){var n,a,o,l;super(r,i);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=((n=i.pin)==null?void 0:n.style.width)??gt.DEFAULT_SIZE,this.height=((a=i.pin)==null?void 0:a.style.height)??gt.DEFAULT_SIZE,this.radius=((o=i.pin)==null?void 0:o.style.radius)??gt.DEFAULT_SIZE,this.zoom=s[0],this.bodyCallback=(l=i.pin)==null?void 0:l.body}createElement(){this.element=document.createElement("div"),this.element.classList.add("pin"),this.component=ze(bn,{target:this.element,props:{id:this.id+"_pin",layer:_n,priority:this.zoom*this.provider.getParameters().zoomScale,width:this.width,height:this.height,radius:this.radius}})}update(r){this.zoom=r[0],this.updateZIndex()}updateMap(r){var i;super.updateMap(r),(i=this.component)==null||i.setDisplayed(r)}updateState(r){if(this.component==null)throw new Error("Failed to update pin state");this.component.setScale(this.getScale(r))}updateBody(){var i;if(this.bodyCallback==null||this.bodyLoaded||this.bodyLoading)return;const r=(i=this.component)==null?void 0:i.getBody();r!=null&&(this.bodyLoading=!0,this.bodyCallback(this.id).then(s=>{s instanceof HTMLElement?r.appendChild(s):console.error("Failed to load pin body")}).catch(s=>console.error(s)).finally(()=>{this.bodyLoaded=!0,this.bodyLoading=!1}))}setCollapsed(r){if(this.component==null)throw new Error("Failed to set pin collapsed");this.component.setScale(r?0:1)}getScale(r){return this.zoom<r?1:Math.max(0,1-(this.zoom-r)*.125)}getZindex(){const r=this.provider.getParameters();return Math.round((r.zoomMax-this.zoom)*r.zoomScale)}isCollapsed(){return this.component==null?!1:this.component.getCollapsed()}isBodyLoaded(){return this.bodyCallback==null||this.bodyLoaded}};f(gt,"DEFAULT_SIZE",16);let ke=gt;const wt=class wt{constructor(t){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=t}setConfiguration(t){var r,i,s;this.pinFade=((r=t==null?void 0:t.pin)==null?void 0:r.fade)??!0,this.pinMaxCount=((i=t==null?void 0:t.pin)==null?void 0:i.maxCount)??Math.max(wt.MAP_PINS_MAX_COUNT,8*navigator.hardwareConcurrency),this.pinMaxZoomDelta=((s=t==null?void 0:t.pin)==null?void 0:s.maxZoom)??wt.MAP_PINS_MAX_ZOOM}updateElements(t){this.pinElements=t,this.pinMaxWidth=t.reduce((r,i)=>Math.max(r,i.width),0),this.pinMaxHeight=t.reduce((r,i)=>Math.max(r,i.height),0)}removeElements(){this.pinElements.forEach(t=>t.remove()),this.pinElements.length=0}process(t,r){const i=this.provider.getParameters().mapSize,s=new Wr(t,r,i,this.pinMaxWidth*2,this.pinMaxHeight*2);let n=0;for(const a of this.pinElements)s.contains(a.lat,a.lng)?a.shown&&r<=a.zoom&&a.zoom<=r+this.pinMaxZoomDelta?(n<this.pinMaxCount&&(this.pinFade==!0?a.updateState(r):a.setCollapsed(!1),a.updateMap(!0),a.isBodyLoaded()==!1&&a.updateBody()),n++):(a.setCollapsed(!0),a.isCollapsed()&&a.updateMap(!1)):a.updateMap(!1)}};f(wt,"MAP_PINS_MAX_ZOOM",2),f(wt,"MAP_PINS_MAX_COUNT",128);let Ae=wt;const ne=class ne extends je{constructor(r,i,s){super(r,i);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=i.tooltip.style.width,this.height=i.tooltip.style.height,this.margin=i.tooltip.style.margin,this.radius=i.tooltip.style.radius,this.zoom=s[0],this.angle=P.Angles.DEGREES_DEFAULT,this.states=s[1].map(n=>[n[0],P.Angles.DEGREES[n[1]]]),this.bodyCallback=i.tooltip.body}createElement(){this.element=document.createElement("div"),this.element.classList.add("tooltip"),this.component=ze(Xr,{target:this.element,props:{id:this.id+"_tooltip",layer:wn,priority:this.zoom*this.provider.getParameters().zoomScale,width:this.width,height:this.height,margin:this.margin,radius:this.radius}})}update(r){this.zoom=r[0],this.states=r[1].map(i=>[i[0],P.Angles.DEGREES[i[1]]]),this.updateZIndex()}updateMap(r){var i;super.updateMap(r),(i=this.component)==null||i.setDisplayed(r)}updateState(r){if(this.component==null)throw new Error("Failed to update tooltip state");this.angle=this.getAngle(r),this.component.setAngle(this.angle)}updateBody(){var i;if(this.bodyLoaded||this.bodyLoading)return;const r=(i=this.component)==null?void 0:i.getBody();r!=null&&(this.bodyLoading=!0,this.bodyCallback(this.id).then(s=>{s instanceof HTMLElement?r.appendChild(s):console.error("Failed to load tooltip body")}).catch(s=>console.error(s)).finally(()=>{this.bodyLoaded=!0,this.bodyLoading=!1}))}getAngle(r){const i=this.states.findLast(s=>s[0]<=r);if(!i)throw new Error("Angle not found");return i[1]}getZindex(){const r=this.provider.getParameters();return Math.round((r.zoomMax-this.zoom)*r.zoomScale)+ne.Z_INDEX_OFFSET}setCollapsed(r){if(this.component==null)throw new Error("Failed to set tooltip collapsed");this.component.setCollapsed(r)}isExpanded(){return this.component==null?!1:this.component.getExpanded()}isCollapsed(){return this.component==null?!1:this.component.getCollapsed()}isBodyLoaded(){return this.bodyLoaded}};f(ne,"Z_INDEX_OFFSET",1e6);let Se=ne;class xn{constructor(t){f(this,"provider");f(this,"tooltipElements",new Array);f(this,"tooltipMaxWidth",0);f(this,"tooltipMaxHeight",0);this.provider=t}updateElements(t){this.tooltipElements=t,this.tooltipMaxWidth=this.tooltipElements.reduce((r,i)=>Math.max(r,i.width),0),this.tooltipMaxHeight=this.tooltipElements.reduce((r,i)=>Math.max(r,i.height),0)}removeElements(){this.tooltipElements.forEach(t=>t.remove()),this.tooltipElements.length=0}process(t,r){const i=this.provider.getParameters().mapSize,s=new Wr(t,r,i,this.tooltipMaxWidth*2,this.tooltipMaxHeight*2);for(const n of this.tooltipElements)s.contains(n.lat,n.lng)?n.shown&&n.zoom<=r?(n.updateState(r),n.setCollapsed(!1),n.updateMap(!0),n.isCollapsed()==!1&&n.isBodyLoaded()==!1&&n.updateBody()):(n.setCollapsed(!0),n.isCollapsed()&&n.updateMap(!1)):n.updateMap(!1)}}const se=class se extends je{constructor(r,i){if(i.popup==null)throw new Error("Failed to create popup");super(r,i);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=i.popup.style.width,this.height=i.popup.style.height,this.margin=i.popup.style.margin,this.radius=i.popup.style.radius,this.bodyCallback=i.popup.body}createElement(){this.element=document.createElement("div"),this.element.classList.add("popup"),this.component=ze(Xr,{target:this.element,props:{id:this.id+"_popup",layer:gn,priority:0,width:this.width,height:this.height,margin:this.margin,radius:this.radius}})}updateMap(r){var i;super.updateMap(r),(i=this.component)==null||i.setDisplayed(r)}updateBody(){var i;if(this.bodyLoaded||this.bodyLoading)return;const r=(i=this.component)==null?void 0:i.getBody();r!=null&&(this.bodyLoading=!0,this.bodyCallback(this.id).then(s=>{s instanceof HTMLElement?r.appendChild(s):console.error("Failed to load popup body")}).catch(s=>console.error(s)).finally(()=>{this.bodyLoaded=!0,this.bodyLoading=!1}))}getZindex(){return se.Z_INDEX_OFFSET}setCollapsed(r){if(this.component==null)throw new Error("Failed to set popup collapsed");this.component.setCollapsed(r)}setAngle(r){if(this.component==null)throw new Error("Failed to set popup angle");this.component.setAngle(r)}isExpanded(){return this.component==null?!1:this.component.getExpanded()}isCollapsed(){return this.component==null?!1:this.component.getCollapsed()}isBodyLoaded(){return this.bodyLoaded}};f(se,"Z_INDEX_OFFSET",2e6);let xe=se;class Cn{constructor(t){f(this,"provider");f(this,"popupElements",new Map);f(this,"popupPositioned",new Map);this.provider=t}show(t){t.pin.shown=!1,t.tooltip.shown=!1;const r=new xe(this.provider,t.marker);this.popupElements.set(t.marker.id,r),this.popupPositioned.set(t.marker.id,!1),r.create(),r.setAngle(t.tooltip.angle),r.shown=!0}hide(t){t.pin.shown=!0,t.tooltip.shown=!0;const r=this.popupElements.get(t.marker.id);r!=null&&(r.shown=!1)}clear(){this.popupElements.values().forEach(t=>t.remove()),this.popupElements.clear(),this.popupPositioned.clear()}process(){var t,r;for(const i of this.popupElements.values())if(i.shown){if(i.setCollapsed(!1),i.updateMap(!0),i.isExpanded()&&i.isBodyLoaded()==!1&&i.updateBody(),i.isCollapsed()==!1&&this.popupPositioned.get(i.id)==!1){const s=(t=i.component)==null?void 0:t.getBody();if(s==null)continue;const n=(r=i.component)==null?void 0:r.getOffsets();if(n==null)continue;const a=s.getBoundingClientRect();if(a.x==0&&a.y==0&&a.width==0&&a.height==0)continue;const o=a.x+a.width/2,l=a.y+a.height/2,u=o+n.x,d=l+n.y,c=u+i.width,h=d+i.height,p=this.provider.getContainer().getBoundingClientRect(),m=u-p.left,E=p.right-c,b=d-p.top,R=p.bottom-h,w=Math.min(i.width,i.height)/4,C=m<0?m-w:E<0?-E+w:0,z=b<0?b-w:R<0?-R+w:0;this.provider.panBy(C,z),this.popupPositioned.set(i.id,!0)}}else i.setCollapsed(!0),i.isCollapsed()&&(i.updateMap(!1),i.remove(),this.popupElements.delete(i.id),this.popupPositioned.delete(i.id))}}exports.MapManager=Sn;
package/dist/main.d.ts CHANGED
@@ -318,7 +318,7 @@ declare const mapMarkerSchema: z.ZodObject<{
318
318
  export declare type MapProvider = z.infer<typeof mapProviderSchema>;
319
319
 
320
320
  declare const mapProviderSchema: z.ZodObject<{
321
- parameters: z.ZodObject<{
321
+ getParameters: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodObject<{
322
322
  mapSize: z.ZodNumber;
323
323
  zoomMin: z.ZodNumber;
324
324
  zoomMax: z.ZodNumber;
@@ -333,7 +333,7 @@ declare const mapProviderSchema: z.ZodObject<{
333
333
  zoomMin: number;
334
334
  zoomMax: number;
335
335
  zoomScale: number;
336
- }>;
336
+ }>>;
337
337
  getContainer: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodEffects<z.ZodAny, HTMLElement, any>>;
338
338
  getZoom: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodNumber>;
339
339
  getBounds: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodObject<{
@@ -397,7 +397,7 @@ declare const mapProviderSchema: z.ZodObject<{
397
397
  instance?: any;
398
398
  }>>;
399
399
  }, "strip", z.ZodTypeAny, {
400
- parameters: {
400
+ getParameters: (...args: unknown[]) => {
401
401
  mapSize: number;
402
402
  zoomMin: number;
403
403
  zoomMax: number;
@@ -424,7 +424,7 @@ declare const mapProviderSchema: z.ZodObject<{
424
424
  instance?: any;
425
425
  };
426
426
  }, {
427
- parameters: {
427
+ getParameters: (...args: unknown[]) => {
428
428
  mapSize: number;
429
429
  zoomMin: number;
430
430
  zoomMax: number;