@arenarium/maps 1.0.182 → 1.0.183

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