@arenarium/maps 1.0.142 → 1.0.144

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