@arenarium/maps 1.1.2 → 1.1.3

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