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