@s8lab/sso-client 1.1.2 → 1.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('./index.css');const u=require("react/jsx-runtime"),I=require("react");require("react-dom");function La(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const r in t)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,n.get?n:{enumerable:!0,get:()=>t[r]})}}return e.default=t,Object.freeze(e)}const w=La(I),yn=new Set;function Ma(t){if(yn.has(t))return;yn.add(t);const e=document.createElement("script");e.src=`https://www.google.com/recaptcha/api.js?render=${t}`,e.async=!0,document.head.appendChild(e)}function Hr(t,e){return new Promise((r,n)=>{const s=()=>{window.grecaptcha.ready(()=>{window.grecaptcha.execute(t,{action:e}).then(r).catch(n)})};if(typeof window.grecaptcha<"u"){s();return}let a=0;const i=setInterval(()=>{typeof window.grecaptcha<"u"?(clearInterval(i),s()):a++>30&&(clearInterval(i),n(new Error("reCAPTCHA v3 script failed to load")))},300)})}const vs=I.createContext(null),xs=I.createContext(null);function bs(t){return t?t instanceof Headers?Object.fromEntries(t.entries()):Array.isArray(t)?Object.fromEntries(t):t:{}}async function gn(t,e){const r=await fetch(t,{...e,headers:{"Content-Type":"application/json",...bs(e.headers)}});if(!r.ok){let n=`Request failed: ${r.status} ${r.statusText}`;try{const s=await r.json();s!=null&&s.message?n=s.message:s!=null&&s.error&&(n=s.error)}catch{}throw new Error(n)}if(r.status!==204)return r.json()}function Va({children:t,apiUrl:e,projectId:r,storageKeyPrefix:n="sso",fetcher:s}){const[a,i]=I.useState(null),[o,c]=I.useState(!0),[l,h]=I.useState({user:null,tokens:null,isLoading:!0,isAuthenticated:!1}),f=I.useRef(e);f.current=e;const p=I.useRef(r);p.current=r;const m=I.useRef(s??gn);m.current=s??gn;const x=I.useCallback((V,z={})=>m.current(V,{...z,headers:{...bs(z.headers),"X-Project-Id":p.current}}),[]),v=`${n}:tokens`,S=I.useCallback(V=>{V?localStorage.setItem(v,JSON.stringify(V)):localStorage.removeItem(v)},[v]),k=I.useCallback(()=>{try{const V=localStorage.getItem(v);return V?JSON.parse(V):null}catch{return null}},[v]);I.useEffect(()=>{let V=!1;async function z(){var Q;let N;try{N=await x(`${f.current}/auth/config`),V||i(N)}catch{N={allowSignup:!0,allowMagicLink:!1,captcha:{enabled:!1}},V||i(N)}finally{V||c(!1)}(Q=N.captcha)!=null&&Q.enabled&&N.captcha.provider==="recaptcha"&&N.captcha.version==="v3"&&N.captcha.siteKey&&Ma(N.captcha.siteKey);const B=k();if(!(B!=null&&B.accessToken)){V||h(ye=>({...ye,isLoading:!1}));return}try{const ye=await x(`${f.current}/auth/me`,{headers:{Authorization:`Bearer ${B.accessToken}`}});V||h({user:ye,tokens:B,isLoading:!1,isAuthenticated:!0})}catch{S(null),V||h({user:null,tokens:null,isLoading:!1,isAuthenticated:!1})}}return z(),()=>{V=!0}},[]);const C=I.useCallback(async V=>{h(z=>({...z,isLoading:!0})),console.log(p.current);try{const z=await x(`${f.current}/auth/login`,{method:"POST",body:JSON.stringify(V)});S(z.tokens),h({user:z.user,tokens:z.tokens,isLoading:!1,isAuthenticated:!0})}catch(z){throw h(N=>({...N,isLoading:!1})),z}},[x,S]),U=I.useCallback(async V=>{h(z=>({...z,isLoading:!0}));try{const z=await x(`${f.current}/auth/signup`,{method:"POST",body:JSON.stringify(V)});S(z.tokens),h({user:z.user,tokens:z.tokens,isLoading:!1,isAuthenticated:!0})}catch(z){throw h(N=>({...N,isLoading:!1})),z}},[x,S]),L=I.useCallback(async()=>{h(V=>({...V,isLoading:!0}));try{const V=k();V!=null&&V.accessToken&&await x(`${f.current}/auth/logout`,{method:"POST",headers:{Authorization:`Bearer ${V.accessToken}`}}).catch(()=>{})}finally{S(null),h({user:null,tokens:null,isLoading:!1,isAuthenticated:!1})}},[x,k,S]),b=I.useCallback(async V=>{await x(`${f.current}/auth/forgot-password`,{method:"POST",body:JSON.stringify(V)})},[x]),Z=I.useCallback(async V=>{await x(`${f.current}/auth/magic-link`,{method:"POST",body:JSON.stringify(V)})},[x]),W=I.useCallback(V=>{h(z=>z.user?{...z,user:{...z.user,...V}}:z)},[]),se=I.useMemo(()=>({...l,login:C,signup:U,logout:L,forgotPassword:b,sendMagicLink:Z,updateUser:W}),[l,C,U,L,b,Z,W]),ue=I.useMemo(()=>({config:a,configLoading:o,apiUrl:e}),[a,o,e]);return u.jsx(xs.Provider,{value:ue,children:u.jsx(vs.Provider,{value:se,children:t})})}function Ot(){const t=I.useContext(vs);if(!t)throw new Error("useAuth must be used inside <AuthProvider>");return t}function ur(){const t=I.useContext(xs);if(!t)throw new Error("useAuthConfig must be used inside <AuthProvider>");return t}var Dt=t=>t.type==="checkbox",pt=t=>t instanceof Date,Le=t=>t==null;const _s=t=>typeof t=="object";var _e=t=>!Le(t)&&!Array.isArray(t)&&_s(t)&&!pt(t),$a=t=>_e(t)&&t.target?Dt(t.target)?t.target.checked:t.target.value:t,ws=t=>t.substring(0,t.search(/\.\d+(\.|$)/))||t,Fa=(t,e)=>t.has(ws(e)),Da=t=>{const e=t.constructor&&t.constructor.prototype;return _e(e)&&e.hasOwnProperty("isPrototypeOf")},Yr=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function Ce(t){if(t instanceof Date)return new Date(t);const e=typeof FileList<"u"&&t instanceof FileList;if(Yr&&(t instanceof Blob||e))return t;const r=Array.isArray(t);if(!r&&!(_e(t)&&Da(t)))return t;const n=r?[]:Object.create(Object.getPrototypeOf(t));for(const s in t)Object.prototype.hasOwnProperty.call(t,s)&&(n[s]=Ce(t[s]));return n}var dr=t=>/^\w*$/.test(t),be=t=>t===void 0,Kr=t=>Array.isArray(t)?t.filter(Boolean):[],Jr=t=>Kr(t.replace(/["|']|\]/g,"").split(/\.|\[/)),M=(t,e,r)=>{if(!e||!_e(t))return r;const n=(dr(e)?[e]:Jr(e)).reduce((s,a)=>Le(s)?s:s[a],t);return be(n)||n===t?be(t[e])?r:t[e]:n},Ke=t=>typeof t=="boolean",Ge=t=>typeof t=="function",ge=(t,e,r)=>{let n=-1;const s=dr(e)?[e]:Jr(e),a=s.length,i=a-1;for(;++n<a;){const o=s[n];let c=r;if(n!==i){const l=t[o];c=_e(l)||Array.isArray(l)?l:isNaN(+s[n+1])?{}:[]}if(o==="__proto__"||o==="constructor"||o==="prototype")return;t[o]=c,t=t[o]}};const gt={BLUR:"blur",FOCUS_OUT:"focusout",SUBMIT:"submit",TRIGGER:"trigger",VALID:"valid"},He={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},We={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},gr="form",ks="root",Ua=I.createContext(null);Ua.displayName="HookFormControlContext";var za=(t,e,r,n=!0)=>{const s={defaultValues:e._defaultValues};for(const a in t)Object.defineProperty(s,a,{get:()=>{const i=a;return e._proxyFormState[i]!==He.all&&(e._proxyFormState[i]=!n||He.all),t[i]}});return s};const Ba=typeof window<"u"?I.useLayoutEffect:I.useEffect;var Ae=t=>typeof t=="string",Za=(t,e,r,n,s)=>Ae(t)?(n&&e.watch.add(t),M(r,t,s)):Array.isArray(t)?t.map(a=>(n&&e.watch.add(a),M(r,a))):(n&&(e.watchAll=!0),r),Ar=t=>Le(t)||!_s(t);function st(t,e,r=new WeakSet){if(Ar(t)||Ar(e))return Object.is(t,e);if(pt(t)&&pt(e))return Object.is(t.getTime(),e.getTime());const n=Object.keys(t),s=Object.keys(e);if(n.length!==s.length)return!1;if(r.has(t)||r.has(e))return!0;r.add(t),r.add(e);for(const a of n){const i=t[a];if(!s.includes(a))return!1;if(a!=="ref"){const o=e[a];if(pt(i)&&pt(o)||_e(i)&&_e(o)||Array.isArray(i)&&Array.isArray(o)?!st(i,o,r):!Object.is(i,o))return!1}}return!0}const Wa=I.createContext(null);Wa.displayName="HookFormContext";var Ss=(t,e,r,n,s)=>e?{...r[t],types:{...r[t]&&r[t].types?r[t].types:{},[n]:s||!0}}:{},It=t=>Array.isArray(t)?t:[t],vn=()=>{let t=[];return{get observers(){return t},next:s=>{for(const a of t)a.next&&a.next(s)},subscribe:s=>(t.push(s),{unsubscribe:()=>{t=t.filter(a=>a!==s)}}),unsubscribe:()=>{t=[]}}};function Cs(t,e){const r={};for(const n in t)if(t.hasOwnProperty(n)){const s=t[n],a=e[n];if(s&&_e(s)&&a){const i=Cs(s,a);_e(i)&&(r[n]=i)}else t[n]&&(r[n]=a)}return r}var Ne=t=>_e(t)&&!Object.keys(t).length,Xr=t=>t.type==="file",Xt=t=>{if(!Yr)return!1;const e=t?t.ownerDocument:0;return t instanceof(e&&e.defaultView?e.defaultView.HTMLElement:HTMLElement)},Es=t=>t.type==="select-multiple",Qr=t=>t.type==="radio",qa=t=>Qr(t)||Dt(t),vr=t=>Xt(t)&&t.isConnected;function Ga(t,e){const r=e.slice(0,-1).length;let n=0;for(;n<r;)t=be(t)?n++:t[e[n++]];return t}function Ha(t){for(const e in t)if(t.hasOwnProperty(e)&&!be(t[e]))return!1;return!0}function ke(t,e){const r=Array.isArray(e)?e:dr(e)?[e]:Jr(e),n=r.length===1?t:Ga(t,r),s=r.length-1,a=r[s];return n&&delete n[a],s!==0&&(_e(n)&&Ne(n)||Array.isArray(n)&&Ha(n))&&ke(t,r.slice(0,-1)),t}var Ya=t=>{for(const e in t)if(Ge(t[e]))return!0;return!1};function Rs(t){return Array.isArray(t)||_e(t)&&!Ya(t)}function Tr(t,e={}){for(const r in t){const n=t[r];Rs(n)?(e[r]=Array.isArray(n)?[]:{},Tr(n,e[r])):be(n)||(e[r]=!0)}return e}function xt(t,e,r){r||(r=Tr(e));for(const n in t){const s=t[n];if(Rs(s))be(e)||Ar(r[n])?r[n]=Tr(s,Array.isArray(s)?[]:{}):xt(s,Le(e)?{}:e[n],r[n]);else{const a=e[n];r[n]=!st(s,a)}}return r}const xn={value:!1,isValid:!1},bn={value:!0,isValid:!0};var Os=t=>{if(Array.isArray(t)){if(t.length>1){const e=t.filter(r=>r&&r.checked&&!r.disabled).map(r=>r.value);return{value:e,isValid:!!e.length}}return t[0].checked&&!t[0].disabled?t[0].attributes&&!be(t[0].attributes.value)?be(t[0].value)||t[0].value===""?bn:{value:t[0].value,isValid:!0}:bn:xn}return xn},js=(t,{valueAsNumber:e,valueAsDate:r,setValueAs:n})=>be(t)?t:e?t===""?NaN:t&&+t:r&&Ae(t)?new Date(t):n?n(t):t;const _n={isValid:!1,value:null};var Ns=t=>Array.isArray(t)?t.reduce((e,r)=>r&&r.checked&&!r.disabled?{isValid:!0,value:r.value}:e,_n):_n;function wn(t){const e=t.ref;return Xr(e)?e.files:Qr(e)?Ns(t.refs).value:Es(e)?[...e.selectedOptions].map(({value:r})=>r):Dt(e)?Os(t.refs).value:js(be(e.value)?t.ref.value:e.value,t)}var Ka=(t,e,r,n)=>{const s={};for(const a of t){const i=M(e,a);i&&ge(s,a,i._f)}return{criteriaMode:r,names:[...t],fields:s,shouldUseNativeValidation:n}},Qt=t=>t instanceof RegExp,Nt=t=>be(t)?t:Qt(t)?t.source:_e(t)?Qt(t.value)?t.value.source:t.value:t,kn=t=>({isOnSubmit:!t||t===He.onSubmit,isOnBlur:t===He.onBlur,isOnChange:t===He.onChange,isOnAll:t===He.all,isOnTouch:t===He.onTouched});const Sn="AsyncFunction";var Ja=t=>!!t&&!!t.validate&&!!(Ge(t.validate)&&t.validate.constructor.name===Sn||_e(t.validate)&&Object.values(t.validate).find(e=>e.constructor.name===Sn)),Xa=t=>t.mount&&(t.required||t.min||t.max||t.maxLength||t.minLength||t.pattern||t.validate),Cn=(t,e,r)=>!r&&(e.watchAll||e.watch.has(t)||[...e.watch].some(n=>t.startsWith(n)&&/^\.\w+/.test(t.slice(n.length))));const Lt=(t,e,r,n)=>{for(const s of r||Object.keys(t)){const a=M(t,s);if(a){const{_f:i,...o}=a;if(i){if(i.refs&&i.refs[0]&&e(i.refs[0],s)&&!n)return!0;if(i.ref&&e(i.ref,i.name)&&!n)return!0;if(Lt(o,e))break}else if(_e(o)&&Lt(o,e))break}}};function En(t,e,r){const n=M(t,r);if(n||dr(r))return{error:n,name:r};const s=r.split(".");for(;s.length;){const a=s.join("."),i=M(e,a),o=M(t,a);if(i&&!Array.isArray(i)&&r!==a)return{name:r};if(o&&o.type)return{name:a,error:o};if(o&&o.root&&o.root.type)return{name:`${a}.root`,error:o.root};s.pop()}return{name:r}}var Qa=(t,e,r,n)=>{r(t);const{name:s,...a}=t;return Ne(a)||Object.keys(a).length>=Object.keys(e).length||Object.keys(a).find(i=>e[i]===(!n||He.all))},ei=(t,e,r)=>!t||!e||t===e||It(t).some(n=>n&&(r?n===e:n.startsWith(e)||e.startsWith(n))),ti=(t,e,r,n,s)=>s.isOnAll?!1:!r&&s.isOnTouch?!(e||t):(r?n.isOnBlur:s.isOnBlur)?!t:(r?n.isOnChange:s.isOnChange)?t:!0,ri=(t,e)=>!Kr(M(t,e)).length&&ke(t,e),ni=(t,e,r)=>{const n=It(M(t,r));return ge(n,ks,e[r]),ge(t,r,n),t};function Rn(t,e,r="validate"){if(Ae(t)||Array.isArray(t)&&t.every(Ae)||Ke(t)&&!t)return{type:r,message:Ae(t)?t:"",ref:e}}var vt=t=>_e(t)&&!Qt(t)?t:{value:t,message:""},On=async(t,e,r,n,s,a)=>{const{ref:i,refs:o,required:c,maxLength:l,minLength:h,min:f,max:p,pattern:m,validate:x,name:v,valueAsNumber:S,mount:k}=t._f,C=M(r,v);if(!k||e.has(v))return{};const U=o?o[0]:i,L=N=>{s&&U.reportValidity&&(U.setCustomValidity(Ke(N)?"":N||""),U.reportValidity())},b={},Z=Qr(i),W=Dt(i),se=Z||W,ue=(S||Xr(i))&&be(i.value)&&be(C)||Xt(i)&&i.value===""||C===""||Array.isArray(C)&&!C.length,V=Ss.bind(null,v,n,b),z=(N,B,Q,ye=We.maxLength,de=We.minLength)=>{const xe=N?B:Q;b[v]={type:N?ye:de,message:xe,ref:i,...V(N?ye:de,xe)}};if(a?!Array.isArray(C)||!C.length:c&&(!se&&(ue||Le(C))||Ke(C)&&!C||W&&!Os(o).isValid||Z&&!Ns(o).isValid)){const{value:N,message:B}=Ae(c)?{value:!!c,message:c}:vt(c);if(N&&(b[v]={type:We.required,message:B,ref:U,...V(We.required,B)},!n))return L(B),b}if(!ue&&(!Le(f)||!Le(p))){let N,B;const Q=vt(p),ye=vt(f);if(!Le(C)&&!isNaN(C)){const de=i.valueAsNumber||C&&+C;Le(Q.value)||(N=de>Q.value),Le(ye.value)||(B=de<ye.value)}else{const de=i.valueAsDate||new Date(C),xe=_=>new Date(new Date().toDateString()+" "+_),we=i.type=="time",Ee=i.type=="week";Ae(Q.value)&&C&&(N=we?xe(C)>xe(Q.value):Ee?C>Q.value:de>new Date(Q.value)),Ae(ye.value)&&C&&(B=we?xe(C)<xe(ye.value):Ee?C<ye.value:de<new Date(ye.value))}if((N||B)&&(z(!!N,Q.message,ye.message,We.max,We.min),!n))return L(b[v].message),b}if((l||h)&&!ue&&(Ae(C)||a&&Array.isArray(C))){const N=vt(l),B=vt(h),Q=!Le(N.value)&&C.length>+N.value,ye=!Le(B.value)&&C.length<+B.value;if((Q||ye)&&(z(Q,N.message,B.message),!n))return L(b[v].message),b}if(m&&!ue&&Ae(C)){const{value:N,message:B}=vt(m);if(Qt(N)&&!C.match(N)&&(b[v]={type:We.pattern,message:B,ref:i,...V(We.pattern,B)},!n))return L(B),b}if(x){if(Ge(x)){const N=await x(C,r),B=Rn(N,U);if(B&&(b[v]={...B,...V(We.validate,B.message)},!n))return L(B.message),b}else if(_e(x)){let N={};for(const B in x){if(!Ne(N)&&!n)break;const Q=Rn(await x[B](C,r),U,B);Q&&(N={...Q,...V(B,Q.message)},L(Q.message),n&&(b[v]=N))}if(!Ne(N)&&(b[v]={ref:U,...N},!n))return b}}return L(!0),b};const si={mode:He.onSubmit,reValidateMode:He.onChange,shouldFocusError:!0};function ai(t={}){let e={...si,...t},r={submitCount:0,isDirty:!1,isReady:!1,isLoading:Ge(e.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1},n={},s=_e(e.defaultValues)||_e(e.values)?Ce(e.defaultValues||e.values)||{}:{},a=e.shouldUnregister?{}:Ce(s),i={action:!1,mount:!1,watch:!1,keepIsValid:!1},o={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},c,l=0;const h={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},f={...h};let p={...f};const m={array:vn(),state:vn()},x=e.criteriaMode===He.all,v=d=>y=>{clearTimeout(l),l=setTimeout(d,y)},S=async d=>{if(!i.keepIsValid&&!e.disabled&&(f.isValid||p.isValid||d)){let y;e.resolver?(y=Ne((await se()).errors),k()):y=await z({fields:n,onlyCheckValid:!0,eventType:gt.VALID}),y!==r.isValid&&m.state.next({isValid:y})}},k=(d,y)=>{!e.disabled&&(f.isValidating||f.validatingFields||p.isValidating||p.validatingFields)&&((d||Array.from(o.mount)).forEach(g=>{g&&(y?ge(r.validatingFields,g,y):ke(r.validatingFields,g))}),m.state.next({validatingFields:r.validatingFields,isValidating:!Ne(r.validatingFields)}))},C=(d,y=[],g,A,O=!0,j=!0)=>{if(A&&g&&!e.disabled){if(i.action=!0,j&&Array.isArray(M(n,d))){const D=g(M(n,d),A.argA,A.argB);O&&ge(n,d,D)}if(j&&Array.isArray(M(r.errors,d))){const D=g(M(r.errors,d),A.argA,A.argB);O&&ge(r.errors,d,D),ri(r.errors,d)}if((f.touchedFields||p.touchedFields)&&j&&Array.isArray(M(r.touchedFields,d))){const D=g(M(r.touchedFields,d),A.argA,A.argB);O&&ge(r.touchedFields,d,D)}if(f.dirtyFields||p.dirtyFields){const D=xt(s,a),J=ws(d);ge(r.dirtyFields,J,M(D,J))}m.state.next({name:d,isDirty:B(d,y),dirtyFields:r.dirtyFields,errors:r.errors,isValid:r.isValid})}else ge(a,d,y)},U=(d,y)=>{ge(r.errors,d,y),m.state.next({errors:r.errors})},L=d=>{r.errors=d,m.state.next({errors:r.errors,isValid:!1})},b=(d,y,g,A)=>{const O=M(n,d);if(O){const j=M(a,d,be(g)?M(s,d):g);be(j)||A&&A.defaultChecked||y?ge(a,d,y?j:wn(O._f)):de(d,j),i.mount&&!i.action&&S()}},Z=(d,y,g,A,O)=>{let j=!1,D=!1;const J={name:d};if(!e.disabled){if(!g||A){(f.isDirty||p.isDirty)&&(D=r.isDirty,r.isDirty=J.isDirty=B(),j=D!==J.isDirty);const pe=st(M(s,d),y);D=!!M(r.dirtyFields,d),pe?ke(r.dirtyFields,d):ge(r.dirtyFields,d,!0),J.dirtyFields=r.dirtyFields,j=j||(f.dirtyFields||p.dirtyFields)&&D!==!pe}if(g){const pe=M(r.touchedFields,d);pe||(ge(r.touchedFields,d,g),J.touchedFields=r.touchedFields,j=j||(f.touchedFields||p.touchedFields)&&pe!==g)}j&&O&&m.state.next(J)}return j?J:{}},W=(d,y,g,A)=>{const O=M(r.errors,d),j=(f.isValid||p.isValid)&&Ke(y)&&r.isValid!==y;if(e.delayError&&g?(c=v(()=>U(d,g)),c(e.delayError)):(clearTimeout(l),c=null,g?ge(r.errors,d,g):ke(r.errors,d)),(g?!st(O,g):O)||!Ne(A)||j){const D={...A,...j&&Ke(y)?{isValid:y}:{},errors:r.errors,name:d};r={...r,...D},m.state.next(D)}},se=async d=>(k(d,!0),await e.resolver(a,e.context,Ka(d||o.mount,n,e.criteriaMode,e.shouldUseNativeValidation))),ue=async d=>{const{errors:y}=await se(d);if(k(d),d)for(const g of d){const A=M(y,g);A?ge(r.errors,g,A):ke(r.errors,g)}else r.errors=y;return y},V=async({name:d,eventType:y})=>{if(t.validate){const g=await t.validate({formValues:a,formState:r,name:d,eventType:y});if(_e(g))for(const A in g)g[A]&&ne(`${gr}.${A}`,{message:Ae(g.message)?g.message:"",type:We.validate});else Ae(g)||!g?ne(gr,{message:g||"",type:We.validate}):K(gr);return g}return!0},z=async({fields:d,onlyCheckValid:y,name:g,eventType:A,context:O={valid:!0,runRootValidation:!1}})=>{if(t.validate&&(O.runRootValidation=!0,!await V({name:g,eventType:A})&&(O.valid=!1,y)))return O.valid;for(const j in d){const D=d[j];if(D){const{_f:J,...pe}=D;if(J){const Me=o.array.has(J.name),Ye=D._f&&Ja(D._f);Ye&&f.validatingFields&&k([J.name],!0);const Te=await On(D,o.disabled,a,x,e.shouldUseNativeValidation&&!y,Me);if(Ye&&f.validatingFields&&k([J.name]),Te[J.name]&&(O.valid=!1,y)||(!y&&(M(Te,J.name)?Me?ni(r.errors,Te,J.name):ge(r.errors,J.name,Te[J.name]):ke(r.errors,J.name)),t.shouldUseNativeValidation&&Te[J.name]))break}!Ne(pe)&&await z({context:O,onlyCheckValid:y,fields:pe,name:j,eventType:A})}}return O.valid},N=()=>{for(const d of o.unMount){const y=M(n,d);y&&(y._f.refs?y._f.refs.every(g=>!vr(g)):!vr(y._f.ref))&&oe(d)}o.unMount=new Set},B=(d,y)=>!e.disabled&&(d&&y&&ge(a,d,y),!st(G(),s)),Q=(d,y,g)=>Za(d,o,{...i.mount?a:be(y)?s:Ae(d)?{[d]:y}:y},g,y),ye=d=>Kr(M(i.mount?a:s,d,e.shouldUnregister?M(s,d,[]):[])),de=(d,y,g={})=>{const A=M(n,d);let O=y;if(A){const j=A._f;j&&(!j.disabled&&ge(a,d,js(y,j)),O=Xt(j.ref)&&Le(y)?"":y,Es(j.ref)?[...j.ref.options].forEach(D=>D.selected=O.includes(D.value)):j.refs?Dt(j.ref)?j.refs.forEach(D=>{(!D.defaultChecked||!D.disabled)&&(Array.isArray(O)?D.checked=!!O.find(J=>J===D.value):D.checked=O===D.value||!!O)}):j.refs.forEach(D=>D.checked=D.value===O):Xr(j.ref)?j.ref.value="":(j.ref.value=O,j.ref.type||m.state.next({name:d,values:Ce(a)})))}(g.shouldDirty||g.shouldTouch)&&Z(d,O,g.shouldTouch,g.shouldDirty,!0),g.shouldValidate&&R(d)},xe=(d,y,g)=>{for(const A in y){if(!y.hasOwnProperty(A))return;const O=y[A],j=d+"."+A,D=M(n,j);(o.array.has(d)||_e(O)||D&&!D._f)&&!pt(O)?xe(j,O,g):de(j,O,g)}},we=(d,y,g={})=>{const A=M(n,d),O=o.array.has(d),j=Ce(y);ge(a,d,j),O?(m.array.next({name:d,values:Ce(a)}),(f.isDirty||f.dirtyFields||p.isDirty||p.dirtyFields)&&g.shouldDirty&&m.state.next({name:d,dirtyFields:xt(s,a),isDirty:B(d,j)})):A&&!A._f&&!Le(j)?xe(d,j,g):de(d,j,g),Cn(d,o)?m.state.next({...r,name:d,values:Ce(a)}):m.state.next({name:i.mount?d:void 0,values:Ce(a)})},Ee=async d=>{i.mount=!0;const y=d.target;let g=y.name,A=!0;const O=M(n,g),j=pe=>{A=Number.isNaN(pe)||pt(pe)&&isNaN(pe.getTime())||st(pe,M(a,g,pe))},D=kn(e.mode),J=kn(e.reValidateMode);if(O){let pe,Me;const Ye=y.type?wn(O._f):$a(d),Te=d.type===gt.BLUR||d.type===gt.FOCUS_OUT,Ta=!Xa(O._f)&&!t.validate&&!e.resolver&&!M(r.errors,g)&&!O._f.deps||ti(Te,M(r.touchedFields,g),r.isSubmitted,J,D),mr=Cn(g,o,Te);ge(a,g,Ye),Te?(!y||!y.readOnly)&&(O._f.onBlur&&O._f.onBlur(d),c&&c(0)):O._f.onChange&&O._f.onChange(d);const yr=Z(g,Ye,Te),Pa=!Ne(yr)||mr;if(!Te&&m.state.next({name:g,type:d.type,values:Ce(a)}),Ta)return(f.isValid||p.isValid)&&(e.mode==="onBlur"?Te&&S():Te||S()),Pa&&m.state.next({name:g,...mr?{}:yr});if(!e.resolver&&t.validate&&await V({name:g,eventType:d.type}),!Te&&mr&&m.state.next({...r}),e.resolver){const{errors:pn}=await se([g]);if(k([g]),j(Ye),A){const Ia=En(r.errors,n,g),mn=En(pn,n,Ia.name||g);pe=mn.error,g=mn.name,Me=Ne(pn)}}else k([g],!0),pe=(await On(O,o.disabled,a,x,e.shouldUseNativeValidation))[g],k([g]),j(Ye),A&&(pe?Me=!1:(f.isValid||p.isValid)&&(Me=await z({fields:n,onlyCheckValid:!0,name:g,eventType:d.type})));A&&(O._f.deps&&(!Array.isArray(O._f.deps)||O._f.deps.length>0)&&R(O._f.deps),W(g,Me,pe,yr))}},_=(d,y)=>{if(M(r.errors,y)&&d.focus)return d.focus(),1},R=async(d,y={})=>{let g,A;const O=It(d);if(e.resolver){const j=await ue(be(d)?d:O);g=Ne(j),A=d?!O.some(D=>M(j,D)):g}else d?(A=(await Promise.all(O.map(async j=>{const D=M(n,j);return await z({fields:D&&D._f?{[j]:D}:D,eventType:gt.TRIGGER})}))).every(Boolean),!(!A&&!r.isValid)&&S()):A=g=await z({fields:n,name:d,eventType:gt.TRIGGER});return m.state.next({...!Ae(d)||(f.isValid||p.isValid)&&g!==r.isValid?{}:{name:d},...e.resolver||!d?{isValid:g}:{},errors:r.errors}),y.shouldFocus&&!A&&Lt(n,_,d?O:o.mount),A},G=(d,y)=>{let g={...i.mount?a:s};return y&&(g=Cs(y.dirtyFields?r.dirtyFields:r.touchedFields,g)),be(d)?g:Ae(d)?M(g,d):d.map(A=>M(g,A))},q=(d,y)=>({invalid:!!M((y||r).errors,d),isDirty:!!M((y||r).dirtyFields,d),error:M((y||r).errors,d),isValidating:!!M(r.validatingFields,d),isTouched:!!M((y||r).touchedFields,d)}),K=d=>{const y=d?It(d):void 0;y==null||y.forEach(g=>ke(r.errors,g)),y?y.forEach(g=>{m.state.next({name:g,errors:r.errors})}):m.state.next({errors:{}})},ne=(d,y,g)=>{const A=(M(n,d,{_f:{}})._f||{}).ref,O=M(r.errors,d)||{},{ref:j,message:D,type:J,...pe}=O;ge(r.errors,d,{...pe,...y,ref:A}),m.state.next({name:d,errors:r.errors,isValid:!1}),g&&g.shouldFocus&&A&&A.focus&&A.focus()},ee=(d,y)=>Ge(d)?m.state.subscribe({next:g=>"values"in g&&d(Q(void 0,y),g)}):Q(d,y,!0),te=d=>m.state.subscribe({next:y=>{ei(d.name,y.name,d.exact)&&Qa(y,d.formState||f,Aa,d.reRenderRoot)&&d.callback({values:{...a},...r,...y,defaultValues:s})}}).unsubscribe,ie=d=>(i.mount=!0,p={...p,...d.formState},te({...d,formState:{...h,...d.formState}})),oe=(d,y={})=>{for(const g of d?It(d):o.mount)o.mount.delete(g),o.array.delete(g),y.keepValue||(ke(n,g),ke(a,g)),!y.keepError&&ke(r.errors,g),!y.keepDirty&&ke(r.dirtyFields,g),!y.keepTouched&&ke(r.touchedFields,g),!y.keepIsValidating&&ke(r.validatingFields,g),!e.shouldUnregister&&!y.keepDefaultValue&&ke(s,g);m.state.next({values:Ce(a)}),m.state.next({...r,...y.keepDirty?{isDirty:B()}:{}}),!y.keepIsValid&&S()},ae=({disabled:d,name:y})=>{if(Ke(d)&&i.mount||d||o.disabled.has(y)){const O=o.disabled.has(y)!==!!d;d?o.disabled.add(y):o.disabled.delete(y),O&&i.mount&&!i.action&&S()}},Re=(d,y={})=>{let g=M(n,d);const A=Ke(y.disabled)||Ke(e.disabled);return ge(n,d,{...g||{},_f:{...g&&g._f?g._f:{ref:{name:d}},name:d,mount:!0,...y}}),o.mount.add(d),g?ae({disabled:Ke(y.disabled)?y.disabled:e.disabled,name:d}):b(d,!0,y.value),{...A?{disabled:y.disabled||e.disabled}:{},...e.progressive?{required:!!y.required,min:Nt(y.min),max:Nt(y.max),minLength:Nt(y.minLength),maxLength:Nt(y.maxLength),pattern:Nt(y.pattern)}:{},name:d,onChange:Ee,onBlur:Ee,ref:O=>{if(O){Re(d,y),g=M(n,d);const j=be(O.value)&&O.querySelectorAll&&O.querySelectorAll("input,select,textarea")[0]||O,D=qa(j),J=g._f.refs||[];if(D?J.find(pe=>pe===j):j===g._f.ref)return;ge(n,d,{_f:{...g._f,...D?{refs:[...J.filter(vr),j,...Array.isArray(M(s,d))?[{}]:[]],ref:{type:j.type,name:d}}:{ref:j}}}),b(d,!1,void 0,j)}else g=M(n,d,{}),g._f&&(g._f.mount=!1),(e.shouldUnregister||y.shouldUnregister)&&!(Fa(o.array,d)&&i.action)&&o.unMount.add(d)}}},T=()=>e.shouldFocusError&&Lt(n,_,o.mount),Fe=d=>{Ke(d)&&(m.state.next({disabled:d}),Lt(n,(y,g)=>{const A=M(n,g);A&&(y.disabled=A._f.disabled||d,Array.isArray(A._f.refs)&&A._f.refs.forEach(O=>{O.disabled=A._f.disabled||d}))},0,!1))},ht=(d,y)=>async g=>{let A;g&&(g.preventDefault&&g.preventDefault(),g.persist&&g.persist());let O=Ce(a);if(m.state.next({isSubmitting:!0}),e.resolver){const{errors:j,values:D}=await se();k(),r.errors=j,O=Ce(D)}else await z({fields:n,eventType:gt.SUBMIT});if(o.disabled.size)for(const j of o.disabled)ke(O,j);if(ke(r.errors,ks),Ne(r.errors)){m.state.next({errors:{}});try{await d(O,g)}catch(j){A=j}}else y&&await y({...r.errors},g),T(),setTimeout(T);if(m.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Ne(r.errors)&&!A,submitCount:r.submitCount+1,errors:r.errors}),A)throw A},zt=(d,y={})=>{M(n,d)&&(be(y.defaultValue)?we(d,Ce(M(s,d))):(we(d,y.defaultValue),ge(s,d,Ce(y.defaultValue))),y.keepTouched||ke(r.touchedFields,d),y.keepDirty||(ke(r.dirtyFields,d),r.isDirty=y.defaultValue?B(d,Ce(M(s,d))):B()),y.keepError||(ke(r.errors,d),f.isValid&&S()),m.state.next({...r}))},dn=(d,y={})=>{const g=d?Ce(d):s,A=Ce(g),O=Ne(d),j=O?s:A;if(y.keepDefaultValues||(s=g),!y.keepValues){if(y.keepDirtyValues){const D=new Set([...o.mount,...Object.keys(xt(s,a))]);for(const J of Array.from(D)){const pe=M(r.dirtyFields,J),Me=M(a,J),Ye=M(j,J);pe&&!be(Me)?ge(j,J,Me):!pe&&!be(Ye)&&we(J,Ye)}}else{if(Yr&&be(d))for(const D of o.mount){const J=M(n,D);if(J&&J._f){const pe=Array.isArray(J._f.refs)?J._f.refs[0]:J._f.ref;if(Xt(pe)){const Me=pe.closest("form");if(Me){Me.reset();break}}}}if(y.keepFieldsRef)for(const D of o.mount)we(D,M(j,D));else n={}}a=e.shouldUnregister?y.keepDefaultValues?Ce(s):{}:Ce(j),m.array.next({values:{...j}}),m.state.next({values:{...j}})}o={mount:y.keepDirtyValues?o.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},i.mount=!f.isValid||!!y.keepIsValid||!!y.keepDirtyValues||!e.shouldUnregister&&!Ne(j),i.watch=!!e.shouldUnregister,i.keepIsValid=!!y.keepIsValid,i.action=!1,y.keepErrors||(r.errors={}),m.state.next({submitCount:y.keepSubmitCount?r.submitCount:0,isDirty:O?!1:y.keepDirty?r.isDirty:!!(y.keepDefaultValues&&!st(d,s)),isSubmitted:y.keepIsSubmitted?r.isSubmitted:!1,dirtyFields:O?{}:y.keepDirtyValues?y.keepDefaultValues&&a?xt(s,a):r.dirtyFields:y.keepDefaultValues&&d?xt(s,d):y.keepDirty?r.dirtyFields:{},touchedFields:y.keepTouched?r.touchedFields:{},errors:y.keepErrors?r.errors:{},isSubmitSuccessful:y.keepIsSubmitSuccessful?r.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:s})},fn=(d,y)=>dn(Ge(d)?d(a):d,{...e.resetOptions,...y}),Na=(d,y={})=>{const g=M(n,d),A=g&&g._f;if(A){const O=A.refs?A.refs[0]:A.ref;O.focus&&setTimeout(()=>{O.focus(),y.shouldSelect&&Ge(O.select)&&O.select()})}},Aa=d=>{r={...r,...d}},hn={control:{register:Re,unregister:oe,getFieldState:q,handleSubmit:ht,setError:ne,_subscribe:te,_runSchema:se,_updateIsValidating:k,_focusError:T,_getWatch:Q,_getDirty:B,_setValid:S,_setFieldArray:C,_setDisabledField:ae,_setErrors:L,_getFieldArray:ye,_reset:dn,_resetDefaultValues:()=>Ge(e.defaultValues)&&e.defaultValues().then(d=>{fn(d,e.resetOptions),m.state.next({isLoading:!1})}),_removeUnmounted:N,_disableForm:Fe,_subjects:m,_proxyFormState:f,get _fields(){return n},get _formValues(){return a},get _state(){return i},set _state(d){i=d},get _defaultValues(){return s},get _names(){return o},set _names(d){o=d},get _formState(){return r},get _options(){return e},set _options(d){e={...e,...d}}},subscribe:ie,trigger:R,register:Re,handleSubmit:ht,watch:ee,setValue:we,getValues:G,reset:fn,resetField:zt,clearErrors:K,unregister:oe,setError:ne,setFocus:Na,getFieldState:q};return{...hn,formControl:hn}}function er(t={}){const e=I.useRef(void 0),r=I.useRef(void 0),[n,s]=I.useState({isDirty:!1,isValidating:!1,isLoading:Ge(t.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1,isReady:!1,defaultValues:Ge(t.defaultValues)?void 0:t.defaultValues});if(!e.current)if(t.formControl)e.current={...t.formControl,formState:n},t.defaultValues&&!Ge(t.defaultValues)&&t.formControl.reset(t.defaultValues,t.resetOptions);else{const{formControl:i,...o}=ai(t);e.current={...o,formState:n}}const a=e.current.control;return a._options=t,Ba(()=>{const i=a._subscribe({formState:a._proxyFormState,callback:()=>s({...a._formState}),reRenderRoot:!0});return s(o=>({...o,isReady:!0})),a._formState.isReady=!0,i},[a]),I.useEffect(()=>a._disableForm(t.disabled),[a,t.disabled]),I.useEffect(()=>{t.mode&&(a._options.mode=t.mode),t.reValidateMode&&(a._options.reValidateMode=t.reValidateMode)},[a,t.mode,t.reValidateMode]),I.useEffect(()=>{t.errors&&(a._setErrors(t.errors),a._focusError())},[a,t.errors]),I.useEffect(()=>{t.shouldUnregister&&a._subjects.state.next({values:a._getWatch()})},[a,t.shouldUnregister]),I.useEffect(()=>{if(a._proxyFormState.isDirty){const i=a._getDirty();i!==n.isDirty&&a._subjects.state.next({isDirty:i})}},[a,n.isDirty]),I.useEffect(()=>{var i;t.values&&!st(t.values,r.current)?(a._reset(t.values,{keepFieldsRef:!0,...a._options.resetOptions}),!((i=a._options.resetOptions)===null||i===void 0)&&i.keepIsValid||a._setValid(),r.current=t.values,s(o=>({...o}))):a._resetDefaultValues()},[a,t.values]),I.useEffect(()=>{a._state.mount||(a._setValid(),a._state.mount=!0),a._state.watch&&(a._state.watch=!1,a._subjects.state.next({...a._formState})),a._removeUnmounted()}),e.current.formState=I.useMemo(()=>za(n,a),[a,n]),e.current}const jn=(t,e,r)=>{if(t&&"reportValidity"in t){const n=M(r,e);t.setCustomValidity(n&&n.message||""),t.reportValidity()}},As=(t,e)=>{for(const r in e.fields){const n=e.fields[r];n&&n.ref&&"reportValidity"in n.ref?jn(n.ref,r,t):n.refs&&n.refs.forEach(s=>jn(s,r,t))}},ii=(t,e)=>{e.shouldUseNativeValidation&&As(t,e);const r={};for(const n in t){const s=M(e.fields,n),a=Object.assign(t[n]||{},{ref:s&&s.ref});if(oi(e.names||Object.keys(t),n)){const i=Object.assign({},M(r,n));ge(i,"root",a),ge(r,n,i)}else ge(r,n,a)}return r},oi=(t,e)=>t.some(r=>r.startsWith(e+"."));var ci=function(t,e){for(var r={};t.length;){var n=t[0],s=n.code,a=n.message,i=n.path.join(".");if(!r[i])if("unionErrors"in n){var o=n.unionErrors[0].errors[0];r[i]={message:o.message,type:o.code}}else r[i]={message:a,type:s};if("unionErrors"in n&&n.unionErrors.forEach(function(h){return h.errors.forEach(function(f){return t.push(f)})}),e){var c=r[i].types,l=c&&c[n.code];r[i]=Ss(i,e,r,s,l?[].concat(l,n.message):n.message)}t.shift()}return r},tr=function(t,e,r){return r===void 0&&(r={}),function(n,s,a){try{return Promise.resolve((function(i,o){try{var c=Promise.resolve(t[r.mode==="sync"?"parse":"parseAsync"](n,e)).then(function(l){return a.shouldUseNativeValidation&&As({},a),{errors:{},values:r.raw?n:l}})}catch(l){return o(l)}return c&&c.then?c.then(void 0,o):c})(0,function(i){if((function(o){return Array.isArray(o==null?void 0:o.errors)})(i))return{values:{},errors:ii(ci(i.errors,!a.shouldUseNativeValidation&&a.criteriaMode==="all"),a)};throw i}))}catch(i){return Promise.reject(i)}}},le;(function(t){t.assertEqual=s=>{};function e(s){}t.assertIs=e;function r(s){throw new Error}t.assertNever=r,t.arrayToEnum=s=>{const a={};for(const i of s)a[i]=i;return a},t.getValidEnumValues=s=>{const a=t.objectKeys(s).filter(o=>typeof s[s[o]]!="number"),i={};for(const o of a)i[o]=s[o];return t.objectValues(i)},t.objectValues=s=>t.objectKeys(s).map(function(a){return s[a]}),t.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{const a=[];for(const i in s)Object.prototype.hasOwnProperty.call(s,i)&&a.push(i);return a},t.find=(s,a)=>{for(const i of s)if(a(i))return i},t.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&Number.isFinite(s)&&Math.floor(s)===s;function n(s,a=" | "){return s.map(i=>typeof i=="string"?`'${i}'`:i).join(a)}t.joinValues=n,t.jsonStringifyReplacer=(s,a)=>typeof a=="bigint"?a.toString():a})(le||(le={}));var Nn;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(Nn||(Nn={}));const $=le.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),nt=t=>{switch(typeof t){case"undefined":return $.undefined;case"string":return $.string;case"number":return Number.isNaN(t)?$.nan:$.number;case"boolean":return $.boolean;case"function":return $.function;case"bigint":return $.bigint;case"symbol":return $.symbol;case"object":return Array.isArray(t)?$.array:t===null?$.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?$.promise:typeof Map<"u"&&t instanceof Map?$.map:typeof Set<"u"&&t instanceof Set?$.set:typeof Date<"u"&&t instanceof Date?$.date:$.object;default:return $.unknown}},E=le.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 et extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};const r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){const r=e||function(a){return a.message},n={_errors:[]},s=a=>{for(const i of a.issues)if(i.code==="invalid_union")i.unionErrors.map(s);else if(i.code==="invalid_return_type")s(i.returnTypeError);else if(i.code==="invalid_arguments")s(i.argumentsError);else if(i.path.length===0)n._errors.push(r(i));else{let o=n,c=0;for(;c<i.path.length;){const l=i.path[c];c===i.path.length-1?(o[l]=o[l]||{_errors:[]},o[l]._errors.push(r(i))):o[l]=o[l]||{_errors:[]},o=o[l],c++}}};return s(this),n}static assert(e){if(!(e instanceof et))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,le.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){const r={},n=[];for(const s of this.issues)if(s.path.length>0){const a=s.path[0];r[a]=r[a]||[],r[a].push(e(s))}else n.push(e(s));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}}et.create=t=>new et(t);const Pr=(t,e)=>{let r;switch(t.code){case E.invalid_type:t.received===$.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case E.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,le.jsonStringifyReplacer)}`;break;case E.unrecognized_keys:r=`Unrecognized key(s) in object: ${le.joinValues(t.keys,", ")}`;break;case E.invalid_union:r="Invalid input";break;case E.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${le.joinValues(t.options)}`;break;case E.invalid_enum_value:r=`Invalid enum value. Expected ${le.joinValues(t.options)}, received '${t.received}'`;break;case E.invalid_arguments:r="Invalid function arguments";break;case E.invalid_return_type:r="Invalid function return type";break;case E.invalid_date:r="Invalid date";break;case E.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:le.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case E.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case E.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case E.custom:r="Invalid input";break;case E.invalid_intersection_types:r="Intersection results could not be merged";break;case E.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case E.not_finite:r="Number must be finite";break;default:r=e.defaultError,le.assertNever(t)}return{message:r}};let li=Pr;function ui(){return li}const di=t=>{const{data:e,path:r,errorMaps:n,issueData:s}=t,a=[...r,...s.path||[]],i={...s,path:a};if(s.message!==void 0)return{...s,path:a,message:s.message};let o="";const c=n.filter(l=>!!l).slice().reverse();for(const l of c)o=l(i,{data:e,defaultError:o}).message;return{...s,path:a,message:o}};function P(t,e){const r=ui(),n=di({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===Pr?void 0:Pr].filter(s=>!!s)});t.common.issues.push(n)}class $e{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){const n=[];for(const s of r){if(s.status==="aborted")return H;s.status==="dirty"&&e.dirty(),n.push(s.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){const n=[];for(const s of r){const a=await s.key,i=await s.value;n.push({key:a,value:i})}return $e.mergeObjectSync(e,n)}static mergeObjectSync(e,r){const n={};for(const s of r){const{key:a,value:i}=s;if(a.status==="aborted"||i.status==="aborted")return H;a.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof i.value<"u"||s.alwaysSet)&&(n[a.value]=i.value)}return{status:e.value,value:n}}}const H=Object.freeze({status:"aborted"}),Pt=t=>({status:"dirty",value:t}),Be=t=>({status:"valid",value:t}),An=t=>t.status==="aborted",Tn=t=>t.status==="dirty",wt=t=>t.status==="valid",rr=t=>typeof Promise<"u"&&t instanceof Promise;var F;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(F||(F={}));class lt{constructor(e,r,n,s){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=s}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Pn=(t,e)=>{if(wt(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const r=new et(t.common.issues);return this._error=r,this._error}}};function re(t){if(!t)return{};const{errorMap:e,invalid_type_error:r,required_error:n,description:s}=t;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:s}:{errorMap:(i,o)=>{const{message:c}=t;return i.code==="invalid_enum_value"?{message:c??o.defaultError}:typeof o.data>"u"?{message:c??n??o.defaultError}:i.code!=="invalid_type"?{message:o.defaultError}:{message:c??r??o.defaultError}},description:s}}class ce{get description(){return this._def.description}_getType(e){return nt(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:nt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new $e,ctx:{common:e.parent.common,data:e.data,parsedType:nt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const r=this._parse(e);if(rr(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){const r=this._parse(e);return Promise.resolve(r)}parse(e,r){const n=this.safeParse(e,r);if(n.success)return n.data;throw n.error}safeParse(e,r){const n={common:{issues:[],async:(r==null?void 0:r.async)??!1,contextualErrorMap:r==null?void 0:r.errorMap},path:(r==null?void 0:r.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:nt(e)},s=this._parseSync({data:e,path:n.path,parent:n});return Pn(n,s)}"~validate"(e){var n,s;const r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:nt(e)};if(!this["~standard"].async)try{const a=this._parseSync({data:e,path:[],parent:r});return wt(a)?{value:a.value}:{issues:r.common.issues}}catch(a){(s=(n=a==null?void 0:a.message)==null?void 0:n.toLowerCase())!=null&&s.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(a=>wt(a)?{value:a.value}:{issues:r.common.issues})}async parseAsync(e,r){const n=await this.safeParseAsync(e,r);if(n.success)return n.data;throw n.error}async safeParseAsync(e,r){const n={common:{issues:[],contextualErrorMap:r==null?void 0:r.errorMap,async:!0},path:(r==null?void 0:r.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:nt(e)},s=this._parse({data:e,path:n.path,parent:n}),a=await(rr(s)?s:Promise.resolve(s));return Pn(n,a)}refine(e,r){const n=s=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(s):r;return this._refinement((s,a)=>{const i=e(s),o=()=>a.addIssue({code:E.custom,...n(s)});return typeof Promise<"u"&&i instanceof Promise?i.then(c=>c?!0:(o(),!1)):i?!0:(o(),!1)})}refinement(e,r){return this._refinement((n,s)=>e(n)?!0:(s.addIssue(typeof r=="function"?r(n,s):r),!1))}_refinement(e){return new St({schema:this,typeName:Y.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:r=>this["~validate"](r)}}optional(){return ot.create(this,this._def)}nullable(){return Ct.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Xe.create(this)}promise(){return ir.create(this,this._def)}or(e){return sr.create([this,e],this._def)}and(e){return ar.create(this,e,this._def)}transform(e){return new St({...re(this._def),schema:this,typeName:Y.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const r=typeof e=="function"?e:()=>e;return new Mr({...re(this._def),innerType:this,defaultValue:r,typeName:Y.ZodDefault})}brand(){return new Ii({typeName:Y.ZodBranded,type:this,...re(this._def)})}catch(e){const r=typeof e=="function"?e:()=>e;return new Vr({...re(this._def),innerType:this,catchValue:r,typeName:Y.ZodCatch})}describe(e){const r=this.constructor;return new r({...this._def,description:e})}pipe(e){return en.create(this,e)}readonly(){return $r.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const fi=/^c[^\s-]{8,}$/i,hi=/^[0-9a-z]+$/,pi=/^[0-9A-HJKMNP-TV-Z]{26}$/i,mi=/^[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,yi=/^[a-z0-9_-]{21}$/i,gi=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,vi=/^[-+]?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)?)??$/,xi=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,bi="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let xr;const _i=/^(?:(?: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])$/,wi=/^(?:(?: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])$/,ki=/^(([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]))$/,Si=/^(([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])$/,Ci=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Ei=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Ts="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Ri=new RegExp(`^${Ts}$`);function Ps(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);const r=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function Oi(t){return new RegExp(`^${Ps(t)}$`)}function ji(t){let e=`${Ts}T${Ps(t)}`;const r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function Ni(t,e){return!!((e==="v4"||!e)&&_i.test(t)||(e==="v6"||!e)&&ki.test(t))}function Ai(t,e){if(!gi.test(t))return!1;try{const[r]=t.split(".");if(!r)return!1;const n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),s=JSON.parse(atob(n));return!(typeof s!="object"||s===null||"typ"in s&&(s==null?void 0:s.typ)!=="JWT"||!s.alg||e&&s.alg!==e)}catch{return!1}}function Ti(t,e){return!!((e==="v4"||!e)&&wi.test(t)||(e==="v6"||!e)&&Si.test(t))}class it extends ce{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==$.string){const a=this._getOrReturnCtx(e);return P(a,{code:E.invalid_type,expected:$.string,received:a.parsedType}),H}const n=new $e;let s;for(const a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(s=this._getOrReturnCtx(e,s),P(s,{code:E.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="max")e.data.length>a.value&&(s=this._getOrReturnCtx(e,s),P(s,{code:E.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="length"){const i=e.data.length>a.value,o=e.data.length<a.value;(i||o)&&(s=this._getOrReturnCtx(e,s),i?P(s,{code:E.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):o&&P(s,{code:E.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),n.dirty())}else if(a.kind==="email")xi.test(e.data)||(s=this._getOrReturnCtx(e,s),P(s,{validation:"email",code:E.invalid_string,message:a.message}),n.dirty());else if(a.kind==="emoji")xr||(xr=new RegExp(bi,"u")),xr.test(e.data)||(s=this._getOrReturnCtx(e,s),P(s,{validation:"emoji",code:E.invalid_string,message:a.message}),n.dirty());else if(a.kind==="uuid")mi.test(e.data)||(s=this._getOrReturnCtx(e,s),P(s,{validation:"uuid",code:E.invalid_string,message:a.message}),n.dirty());else if(a.kind==="nanoid")yi.test(e.data)||(s=this._getOrReturnCtx(e,s),P(s,{validation:"nanoid",code:E.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid")fi.test(e.data)||(s=this._getOrReturnCtx(e,s),P(s,{validation:"cuid",code:E.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid2")hi.test(e.data)||(s=this._getOrReturnCtx(e,s),P(s,{validation:"cuid2",code:E.invalid_string,message:a.message}),n.dirty());else if(a.kind==="ulid")pi.test(e.data)||(s=this._getOrReturnCtx(e,s),P(s,{validation:"ulid",code:E.invalid_string,message:a.message}),n.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),P(s,{validation:"url",code:E.invalid_string,message:a.message}),n.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),P(s,{validation:"regex",code:E.invalid_string,message:a.message}),n.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(s=this._getOrReturnCtx(e,s),P(s,{code:E.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),n.dirty()):a.kind==="toLowerCase"?e.data=e.data.toLowerCase():a.kind==="toUpperCase"?e.data=e.data.toUpperCase():a.kind==="startsWith"?e.data.startsWith(a.value)||(s=this._getOrReturnCtx(e,s),P(s,{code:E.invalid_string,validation:{startsWith:a.value},message:a.message}),n.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(s=this._getOrReturnCtx(e,s),P(s,{code:E.invalid_string,validation:{endsWith:a.value},message:a.message}),n.dirty()):a.kind==="datetime"?ji(a).test(e.data)||(s=this._getOrReturnCtx(e,s),P(s,{code:E.invalid_string,validation:"datetime",message:a.message}),n.dirty()):a.kind==="date"?Ri.test(e.data)||(s=this._getOrReturnCtx(e,s),P(s,{code:E.invalid_string,validation:"date",message:a.message}),n.dirty()):a.kind==="time"?Oi(a).test(e.data)||(s=this._getOrReturnCtx(e,s),P(s,{code:E.invalid_string,validation:"time",message:a.message}),n.dirty()):a.kind==="duration"?vi.test(e.data)||(s=this._getOrReturnCtx(e,s),P(s,{validation:"duration",code:E.invalid_string,message:a.message}),n.dirty()):a.kind==="ip"?Ni(e.data,a.version)||(s=this._getOrReturnCtx(e,s),P(s,{validation:"ip",code:E.invalid_string,message:a.message}),n.dirty()):a.kind==="jwt"?Ai(e.data,a.alg)||(s=this._getOrReturnCtx(e,s),P(s,{validation:"jwt",code:E.invalid_string,message:a.message}),n.dirty()):a.kind==="cidr"?Ti(e.data,a.version)||(s=this._getOrReturnCtx(e,s),P(s,{validation:"cidr",code:E.invalid_string,message:a.message}),n.dirty()):a.kind==="base64"?Ci.test(e.data)||(s=this._getOrReturnCtx(e,s),P(s,{validation:"base64",code:E.invalid_string,message:a.message}),n.dirty()):a.kind==="base64url"?Ei.test(e.data)||(s=this._getOrReturnCtx(e,s),P(s,{validation:"base64url",code:E.invalid_string,message:a.message}),n.dirty()):le.assertNever(a);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(s=>e.test(s),{validation:r,code:E.invalid_string,...F.errToObj(n)})}_addCheck(e){return new it({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...F.errToObj(e)})}url(e){return this._addCheck({kind:"url",...F.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...F.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...F.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...F.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...F.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...F.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...F.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...F.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...F.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...F.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...F.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...F.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,...F.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,...F.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...F.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...F.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r==null?void 0:r.position,...F.errToObj(r==null?void 0:r.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...F.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...F.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...F.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...F.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...F.errToObj(r)})}nonempty(e){return this.min(1,F.errToObj(e))}trim(){return new it({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new it({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new it({...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 r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}}it.create=t=>new it({checks:[],typeName:Y.ZodString,coerce:(t==null?void 0:t.coerce)??!1,...re(t)});function Pi(t,e){const r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,s=r>n?r:n,a=Number.parseInt(t.toFixed(s).replace(".","")),i=Number.parseInt(e.toFixed(s).replace(".",""));return a%i/10**s}class Mt extends ce{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)!==$.number){const a=this._getOrReturnCtx(e);return P(a,{code:E.invalid_type,expected:$.number,received:a.parsedType}),H}let n;const s=new $e;for(const a of this._def.checks)a.kind==="int"?le.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),P(n,{code:E.invalid_type,expected:"integer",received:"float",message:a.message}),s.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),P(n,{code:E.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),P(n,{code:E.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):a.kind==="multipleOf"?Pi(e.data,a.value)!==0&&(n=this._getOrReturnCtx(e,n),P(n,{code:E.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),P(n,{code:E.not_finite,message:a.message}),s.dirty()):le.assertNever(a);return{status:s.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,F.toString(r))}gt(e,r){return this.setLimit("min",e,!1,F.toString(r))}lte(e,r){return this.setLimit("max",e,!0,F.toString(r))}lt(e,r){return this.setLimit("max",e,!1,F.toString(r))}setLimit(e,r,n,s){return new Mt({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:F.toString(s)}]})}_addCheck(e){return new Mt({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:F.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:F.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:F.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:F.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:F.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:F.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:F.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:F.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:F.toString(e)})}get minValue(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&le.isInteger(e.value))}get isFinite(){let e=null,r=null;for(const n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(r)&&Number.isFinite(e)}}Mt.create=t=>new Mt({checks:[],typeName:Y.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...re(t)});class Vt extends ce{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)!==$.bigint)return this._getInvalidInput(e);let n;const s=new $e;for(const a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),P(n,{code:E.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),s.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),P(n,{code:E.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),s.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),P(n,{code:E.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):le.assertNever(a);return{status:s.value,value:e.data}}_getInvalidInput(e){const r=this._getOrReturnCtx(e);return P(r,{code:E.invalid_type,expected:$.bigint,received:r.parsedType}),H}gte(e,r){return this.setLimit("min",e,!0,F.toString(r))}gt(e,r){return this.setLimit("min",e,!1,F.toString(r))}lte(e,r){return this.setLimit("max",e,!0,F.toString(r))}lt(e,r){return this.setLimit("max",e,!1,F.toString(r))}setLimit(e,r,n,s){return new Vt({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:F.toString(s)}]})}_addCheck(e){return new Vt({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:F.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:F.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:F.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:F.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:F.toString(r)})}get minValue(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}}Vt.create=t=>new Vt({checks:[],typeName:Y.ZodBigInt,coerce:(t==null?void 0:t.coerce)??!1,...re(t)});class In extends ce{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==$.boolean){const n=this._getOrReturnCtx(e);return P(n,{code:E.invalid_type,expected:$.boolean,received:n.parsedType}),H}return Be(e.data)}}In.create=t=>new In({typeName:Y.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...re(t)});class nr extends ce{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==$.date){const a=this._getOrReturnCtx(e);return P(a,{code:E.invalid_type,expected:$.date,received:a.parsedType}),H}if(Number.isNaN(e.data.getTime())){const a=this._getOrReturnCtx(e);return P(a,{code:E.invalid_date}),H}const n=new $e;let s;for(const a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(s=this._getOrReturnCtx(e,s),P(s,{code:E.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),n.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(s=this._getOrReturnCtx(e,s),P(s,{code:E.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),n.dirty()):le.assertNever(a);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new nr({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:F.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:F.toString(r)})}get minDate(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}}nr.create=t=>new nr({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:Y.ZodDate,...re(t)});class Ln extends ce{_parse(e){if(this._getType(e)!==$.symbol){const n=this._getOrReturnCtx(e);return P(n,{code:E.invalid_type,expected:$.symbol,received:n.parsedType}),H}return Be(e.data)}}Ln.create=t=>new Ln({typeName:Y.ZodSymbol,...re(t)});class Mn extends ce{_parse(e){if(this._getType(e)!==$.undefined){const n=this._getOrReturnCtx(e);return P(n,{code:E.invalid_type,expected:$.undefined,received:n.parsedType}),H}return Be(e.data)}}Mn.create=t=>new Mn({typeName:Y.ZodUndefined,...re(t)});class Vn extends ce{_parse(e){if(this._getType(e)!==$.null){const n=this._getOrReturnCtx(e);return P(n,{code:E.invalid_type,expected:$.null,received:n.parsedType}),H}return Be(e.data)}}Vn.create=t=>new Vn({typeName:Y.ZodNull,...re(t)});class $n extends ce{constructor(){super(...arguments),this._any=!0}_parse(e){return Be(e.data)}}$n.create=t=>new $n({typeName:Y.ZodAny,...re(t)});class Fn extends ce{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Be(e.data)}}Fn.create=t=>new Fn({typeName:Y.ZodUnknown,...re(t)});class ut extends ce{_parse(e){const r=this._getOrReturnCtx(e);return P(r,{code:E.invalid_type,expected:$.never,received:r.parsedType}),H}}ut.create=t=>new ut({typeName:Y.ZodNever,...re(t)});class Dn extends ce{_parse(e){if(this._getType(e)!==$.undefined){const n=this._getOrReturnCtx(e);return P(n,{code:E.invalid_type,expected:$.void,received:n.parsedType}),H}return Be(e.data)}}Dn.create=t=>new Dn({typeName:Y.ZodVoid,...re(t)});class Xe extends ce{_parse(e){const{ctx:r,status:n}=this._processInputParams(e),s=this._def;if(r.parsedType!==$.array)return P(r,{code:E.invalid_type,expected:$.array,received:r.parsedType}),H;if(s.exactLength!==null){const i=r.data.length>s.exactLength.value,o=r.data.length<s.exactLength.value;(i||o)&&(P(r,{code:i?E.too_big:E.too_small,minimum:o?s.exactLength.value:void 0,maximum:i?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),n.dirty())}if(s.minLength!==null&&r.data.length<s.minLength.value&&(P(r,{code:E.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),n.dirty()),s.maxLength!==null&&r.data.length>s.maxLength.value&&(P(r,{code:E.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((i,o)=>s.type._parseAsync(new lt(r,i,r.path,o)))).then(i=>$e.mergeArray(n,i));const a=[...r.data].map((i,o)=>s.type._parseSync(new lt(r,i,r.path,o)));return $e.mergeArray(n,a)}get element(){return this._def.type}min(e,r){return new Xe({...this._def,minLength:{value:e,message:F.toString(r)}})}max(e,r){return new Xe({...this._def,maxLength:{value:e,message:F.toString(r)}})}length(e,r){return new Xe({...this._def,exactLength:{value:e,message:F.toString(r)}})}nonempty(e){return this.min(1,e)}}Xe.create=(t,e)=>new Xe({type:t,minLength:null,maxLength:null,exactLength:null,typeName:Y.ZodArray,...re(e)});function bt(t){if(t instanceof Se){const e={};for(const r in t.shape){const n=t.shape[r];e[r]=ot.create(bt(n))}return new Se({...t._def,shape:()=>e})}else return t instanceof Xe?new Xe({...t._def,type:bt(t.element)}):t instanceof ot?ot.create(bt(t.unwrap())):t instanceof Ct?Ct.create(bt(t.unwrap())):t instanceof mt?mt.create(t.items.map(e=>bt(e))):t}class Se extends ce{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(),r=le.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==$.object){const l=this._getOrReturnCtx(e);return P(l,{code:E.invalid_type,expected:$.object,received:l.parsedType}),H}const{status:n,ctx:s}=this._processInputParams(e),{shape:a,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof ut&&this._def.unknownKeys==="strip"))for(const l in s.data)i.includes(l)||o.push(l);const c=[];for(const l of i){const h=a[l],f=s.data[l];c.push({key:{status:"valid",value:l},value:h._parse(new lt(s,f,s.path,l)),alwaysSet:l in s.data})}if(this._def.catchall instanceof ut){const l=this._def.unknownKeys;if(l==="passthrough")for(const h of o)c.push({key:{status:"valid",value:h},value:{status:"valid",value:s.data[h]}});else if(l==="strict")o.length>0&&(P(s,{code:E.unrecognized_keys,keys:o}),n.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const l=this._def.catchall;for(const h of o){const f=s.data[h];c.push({key:{status:"valid",value:h},value:l._parse(new lt(s,f,s.path,h)),alwaysSet:h in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const l=[];for(const h of c){const f=await h.key,p=await h.value;l.push({key:f,value:p,alwaysSet:h.alwaysSet})}return l}).then(l=>$e.mergeObjectSync(n,l)):$e.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(e){return F.errToObj,new Se({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{var a,i;const s=((i=(a=this._def).errorMap)==null?void 0:i.call(a,r,n).message)??n.defaultError;return r.code==="unrecognized_keys"?{message:F.errToObj(e).message??s}:{message:s}}}:{}})}strip(){return new Se({...this._def,unknownKeys:"strip"})}passthrough(){return new Se({...this._def,unknownKeys:"passthrough"})}extend(e){return new Se({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Se({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Y.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new Se({...this._def,catchall:e})}pick(e){const r={};for(const n of le.objectKeys(e))e[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new Se({...this._def,shape:()=>r})}omit(e){const r={};for(const n of le.objectKeys(this.shape))e[n]||(r[n]=this.shape[n]);return new Se({...this._def,shape:()=>r})}deepPartial(){return bt(this)}partial(e){const r={};for(const n of le.objectKeys(this.shape)){const s=this.shape[n];e&&!e[n]?r[n]=s:r[n]=s.optional()}return new Se({...this._def,shape:()=>r})}required(e){const r={};for(const n of le.objectKeys(this.shape))if(e&&!e[n])r[n]=this.shape[n];else{let a=this.shape[n];for(;a instanceof ot;)a=a._def.innerType;r[n]=a}return new Se({...this._def,shape:()=>r})}keyof(){return Is(le.objectKeys(this.shape))}}Se.create=(t,e)=>new Se({shape:()=>t,unknownKeys:"strip",catchall:ut.create(),typeName:Y.ZodObject,...re(e)});Se.strictCreate=(t,e)=>new Se({shape:()=>t,unknownKeys:"strict",catchall:ut.create(),typeName:Y.ZodObject,...re(e)});Se.lazycreate=(t,e)=>new Se({shape:t,unknownKeys:"strip",catchall:ut.create(),typeName:Y.ZodObject,...re(e)});class sr extends ce{_parse(e){const{ctx:r}=this._processInputParams(e),n=this._def.options;function s(a){for(const o of a)if(o.result.status==="valid")return o.result;for(const o of a)if(o.result.status==="dirty")return r.common.issues.push(...o.ctx.common.issues),o.result;const i=a.map(o=>new et(o.ctx.common.issues));return P(r,{code:E.invalid_union,unionErrors:i}),H}if(r.common.async)return Promise.all(n.map(async a=>{const i={...r,common:{...r.common,issues:[]},parent:null};return{result:await a._parseAsync({data:r.data,path:r.path,parent:i}),ctx:i}})).then(s);{let a;const i=[];for(const c of n){const l={...r,common:{...r.common,issues:[]},parent:null},h=c._parseSync({data:r.data,path:r.path,parent:l});if(h.status==="valid")return h;h.status==="dirty"&&!a&&(a={result:h,ctx:l}),l.common.issues.length&&i.push(l.common.issues)}if(a)return r.common.issues.push(...a.ctx.common.issues),a.result;const o=i.map(c=>new et(c));return P(r,{code:E.invalid_union,unionErrors:o}),H}}get options(){return this._def.options}}sr.create=(t,e)=>new sr({options:t,typeName:Y.ZodUnion,...re(e)});function Ir(t,e){const r=nt(t),n=nt(e);if(t===e)return{valid:!0,data:t};if(r===$.object&&n===$.object){const s=le.objectKeys(e),a=le.objectKeys(t).filter(o=>s.indexOf(o)!==-1),i={...t,...e};for(const o of a){const c=Ir(t[o],e[o]);if(!c.valid)return{valid:!1};i[o]=c.data}return{valid:!0,data:i}}else if(r===$.array&&n===$.array){if(t.length!==e.length)return{valid:!1};const s=[];for(let a=0;a<t.length;a++){const i=t[a],o=e[a],c=Ir(i,o);if(!c.valid)return{valid:!1};s.push(c.data)}return{valid:!0,data:s}}else return r===$.date&&n===$.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}class ar extends ce{_parse(e){const{status:r,ctx:n}=this._processInputParams(e),s=(a,i)=>{if(An(a)||An(i))return H;const o=Ir(a.value,i.value);return o.valid?((Tn(a)||Tn(i))&&r.dirty(),{status:r.value,value:o.data}):(P(n,{code:E.invalid_intersection_types}),H)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([a,i])=>s(a,i)):s(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}ar.create=(t,e,r)=>new ar({left:t,right:e,typeName:Y.ZodIntersection,...re(r)});class mt extends ce{_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==$.array)return P(n,{code:E.invalid_type,expected:$.array,received:n.parsedType}),H;if(n.data.length<this._def.items.length)return P(n,{code:E.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),H;!this._def.rest&&n.data.length>this._def.items.length&&(P(n,{code:E.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());const a=[...n.data].map((i,o)=>{const c=this._def.items[o]||this._def.rest;return c?c._parse(new lt(n,i,n.path,o)):null}).filter(i=>!!i);return n.common.async?Promise.all(a).then(i=>$e.mergeArray(r,i)):$e.mergeArray(r,a)}get items(){return this._def.items}rest(e){return new mt({...this._def,rest:e})}}mt.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new mt({items:t,typeName:Y.ZodTuple,rest:null,...re(e)})};class Un extends ce{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==$.map)return P(n,{code:E.invalid_type,expected:$.map,received:n.parsedType}),H;const s=this._def.keyType,a=this._def.valueType,i=[...n.data.entries()].map(([o,c],l)=>({key:s._parse(new lt(n,o,n.path,[l,"key"])),value:a._parse(new lt(n,c,n.path,[l,"value"]))}));if(n.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const c of i){const l=await c.key,h=await c.value;if(l.status==="aborted"||h.status==="aborted")return H;(l.status==="dirty"||h.status==="dirty")&&r.dirty(),o.set(l.value,h.value)}return{status:r.value,value:o}})}else{const o=new Map;for(const c of i){const l=c.key,h=c.value;if(l.status==="aborted"||h.status==="aborted")return H;(l.status==="dirty"||h.status==="dirty")&&r.dirty(),o.set(l.value,h.value)}return{status:r.value,value:o}}}}Un.create=(t,e,r)=>new Un({valueType:e,keyType:t,typeName:Y.ZodMap,...re(r)});class $t extends ce{_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==$.set)return P(n,{code:E.invalid_type,expected:$.set,received:n.parsedType}),H;const s=this._def;s.minSize!==null&&n.data.size<s.minSize.value&&(P(n,{code:E.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),r.dirty()),s.maxSize!==null&&n.data.size>s.maxSize.value&&(P(n,{code:E.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),r.dirty());const a=this._def.valueType;function i(c){const l=new Set;for(const h of c){if(h.status==="aborted")return H;h.status==="dirty"&&r.dirty(),l.add(h.value)}return{status:r.value,value:l}}const o=[...n.data.values()].map((c,l)=>a._parse(new lt(n,c,n.path,l)));return n.common.async?Promise.all(o).then(c=>i(c)):i(o)}min(e,r){return new $t({...this._def,minSize:{value:e,message:F.toString(r)}})}max(e,r){return new $t({...this._def,maxSize:{value:e,message:F.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}}$t.create=(t,e)=>new $t({valueType:t,minSize:null,maxSize:null,typeName:Y.ZodSet,...re(e)});class zn extends ce{get schema(){return this._def.getter()}_parse(e){const{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}}zn.create=(t,e)=>new zn({getter:t,typeName:Y.ZodLazy,...re(e)});class Lr extends ce{_parse(e){if(e.data!==this._def.value){const r=this._getOrReturnCtx(e);return P(r,{received:r.data,code:E.invalid_literal,expected:this._def.value}),H}return{status:"valid",value:e.data}}get value(){return this._def.value}}Lr.create=(t,e)=>new Lr({value:t,typeName:Y.ZodLiteral,...re(e)});function Is(t,e){return new kt({values:t,typeName:Y.ZodEnum,...re(e)})}class kt extends ce{_parse(e){if(typeof e.data!="string"){const r=this._getOrReturnCtx(e),n=this._def.values;return P(r,{expected:le.joinValues(n),received:r.parsedType,code:E.invalid_type}),H}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const r=this._getOrReturnCtx(e),n=this._def.values;return P(r,{received:r.data,code:E.invalid_enum_value,options:n}),H}return Be(e.data)}get options(){return this._def.values}get enum(){const e={};for(const r of this._def.values)e[r]=r;return e}get Values(){const e={};for(const r of this._def.values)e[r]=r;return e}get Enum(){const e={};for(const r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return kt.create(e,{...this._def,...r})}exclude(e,r=this._def){return kt.create(this.options.filter(n=>!e.includes(n)),{...this._def,...r})}}kt.create=Is;class Bn extends ce{_parse(e){const r=le.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==$.string&&n.parsedType!==$.number){const s=le.objectValues(r);return P(n,{expected:le.joinValues(s),received:n.parsedType,code:E.invalid_type}),H}if(this._cache||(this._cache=new Set(le.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const s=le.objectValues(r);return P(n,{received:n.data,code:E.invalid_enum_value,options:s}),H}return Be(e.data)}get enum(){return this._def.values}}Bn.create=(t,e)=>new Bn({values:t,typeName:Y.ZodNativeEnum,...re(e)});class ir extends ce{unwrap(){return this._def.type}_parse(e){const{ctx:r}=this._processInputParams(e);if(r.parsedType!==$.promise&&r.common.async===!1)return P(r,{code:E.invalid_type,expected:$.promise,received:r.parsedType}),H;const n=r.parsedType===$.promise?r.data:Promise.resolve(r.data);return Be(n.then(s=>this._def.type.parseAsync(s,{path:r.path,errorMap:r.common.contextualErrorMap})))}}ir.create=(t,e)=>new ir({type:t,typeName:Y.ZodPromise,...re(e)});class St extends ce{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Y.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:r,ctx:n}=this._processInputParams(e),s=this._def.effect||null,a={addIssue:i=>{P(n,i),i.fatal?r.abort():r.dirty()},get path(){return n.path}};if(a.addIssue=a.addIssue.bind(a),s.type==="preprocess"){const i=s.transform(n.data,a);if(n.common.async)return Promise.resolve(i).then(async o=>{if(r.value==="aborted")return H;const c=await this._def.schema._parseAsync({data:o,path:n.path,parent:n});return c.status==="aborted"?H:c.status==="dirty"||r.value==="dirty"?Pt(c.value):c});{if(r.value==="aborted")return H;const o=this._def.schema._parseSync({data:i,path:n.path,parent:n});return o.status==="aborted"?H:o.status==="dirty"||r.value==="dirty"?Pt(o.value):o}}if(s.type==="refinement"){const i=o=>{const c=s.refinement(o,a);if(n.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(n.common.async===!1){const o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?H:(o.status==="dirty"&&r.dirty(),i(o.value),{status:r.value,value:o.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>o.status==="aborted"?H:(o.status==="dirty"&&r.dirty(),i(o.value).then(()=>({status:r.value,value:o.value}))))}if(s.type==="transform")if(n.common.async===!1){const i=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!wt(i))return H;const o=s.transform(i.value,a);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:o}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(i=>wt(i)?Promise.resolve(s.transform(i.value,a)).then(o=>({status:r.value,value:o})):H);le.assertNever(s)}}St.create=(t,e,r)=>new St({schema:t,typeName:Y.ZodEffects,effect:e,...re(r)});St.createWithPreprocess=(t,e,r)=>new St({schema:e,effect:{type:"preprocess",transform:t},typeName:Y.ZodEffects,...re(r)});class ot extends ce{_parse(e){return this._getType(e)===$.undefined?Be(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ot.create=(t,e)=>new ot({innerType:t,typeName:Y.ZodOptional,...re(e)});class Ct extends ce{_parse(e){return this._getType(e)===$.null?Be(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Ct.create=(t,e)=>new Ct({innerType:t,typeName:Y.ZodNullable,...re(e)});class Mr extends ce{_parse(e){const{ctx:r}=this._processInputParams(e);let n=r.data;return r.parsedType===$.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}}Mr.create=(t,e)=>new Mr({innerType:t,typeName:Y.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...re(e)});class Vr extends ce{_parse(e){const{ctx:r}=this._processInputParams(e),n={...r,common:{...r.common,issues:[]}},s=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return rr(s)?s.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new et(n.common.issues)},input:n.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new et(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}Vr.create=(t,e)=>new Vr({innerType:t,typeName:Y.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...re(e)});class Zn extends ce{_parse(e){if(this._getType(e)!==$.nan){const n=this._getOrReturnCtx(e);return P(n,{code:E.invalid_type,expected:$.nan,received:n.parsedType}),H}return{status:"valid",value:e.data}}}Zn.create=t=>new Zn({typeName:Y.ZodNaN,...re(t)});class Ii extends ce{_parse(e){const{ctx:r}=this._processInputParams(e),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}}class en extends ce{_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{const a=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?H:a.status==="dirty"?(r.dirty(),Pt(a.value)):this._def.out._parseAsync({data:a.value,path:n.path,parent:n})})();{const s=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?H:s.status==="dirty"?(r.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:n.path,parent:n})}}static create(e,r){return new en({in:e,out:r,typeName:Y.ZodPipeline})}}class $r extends ce{_parse(e){const r=this._def.innerType._parse(e),n=s=>(wt(s)&&(s.value=Object.freeze(s.value)),s);return rr(r)?r.then(s=>n(s)):n(r)}unwrap(){return this._def.innerType}}$r.create=(t,e)=>new $r({innerType:t,typeName:Y.ZodReadonly,...re(e)});var Y;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(Y||(Y={}));const Je=it.create;ut.create;Xe.create;const fr=Se.create;sr.create;ar.create;mt.create;const Li=Lr.create;kt.create;ir.create;ot.create;Ct.create;/**
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('./index.css');const u=require("react/jsx-runtime"),I=require("react");require("react-dom");function La(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const r in t)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,n.get?n:{enumerable:!0,get:()=>t[r]})}}return e.default=t,Object.freeze(e)}const w=La(I),yn=new Set;function Ma(t){if(yn.has(t))return;yn.add(t);const e=document.createElement("script");e.src=`https://www.google.com/recaptcha/api.js?render=${t}`,e.async=!0,document.head.appendChild(e)}function Hr(t,e){return new Promise((r,n)=>{const s=()=>{window.grecaptcha.ready(()=>{window.grecaptcha.execute(t,{action:e}).then(r).catch(n)})};if(typeof window.grecaptcha<"u"){s();return}let a=0;const i=setInterval(()=>{typeof window.grecaptcha<"u"?(clearInterval(i),s()):a++>30&&(clearInterval(i),n(new Error("reCAPTCHA v3 script failed to load")))},300)})}const vs=I.createContext(null),xs=I.createContext(null);function bs(t){return t?t instanceof Headers?Object.fromEntries(t.entries()):Array.isArray(t)?Object.fromEntries(t):t:{}}async function gn(t,e){const r=await fetch(t,{...e,headers:{"Content-Type":"application/json",...bs(e.headers)}});if(!r.ok){let n=`Request failed: ${r.status} ${r.statusText}`;try{const s=await r.json();s!=null&&s.message?n=s.message:s!=null&&s.error&&(n=s.error)}catch{}throw new Error(n)}if(r.status!==204)return r.json()}function Va({children:t,apiUrl:e,projectId:r,storageKeyPrefix:n="sso",fetcher:s}){const[a,i]=I.useState(null),[o,c]=I.useState(!0),[l,h]=I.useState({user:null,tokens:null,isLoading:!0,isAuthenticated:!1}),f=I.useRef(e);f.current=e;const p=I.useRef(r);p.current=r;const m=I.useRef(s??gn);m.current=s??gn;const x=I.useCallback((V,z={})=>m.current(V,{...z,headers:{...bs(z.headers),"X-Project-Id":p.current}}),[]),v=`${n}:tokens`,S=I.useCallback(V=>{V?localStorage.setItem(v,JSON.stringify(V)):localStorage.removeItem(v)},[v]),k=I.useCallback(()=>{try{const V=localStorage.getItem(v);return V?JSON.parse(V):null}catch{return null}},[v]);I.useEffect(()=>{let V=!1;async function z(){var Q;let N;try{N=await x(`${f.current}/auth/config`),V||i(N)}catch{N={allowSignup:!0,allowMagicLink:!1,captcha:{enabled:!1}},V||i(N)}finally{V||c(!1)}(Q=N.captcha)!=null&&Q.enabled&&N.captcha.provider==="recaptcha"&&N.captcha.version==="v3"&&N.captcha.siteKey&&Ma(N.captcha.siteKey);const B=k();if(!(B!=null&&B.accessToken)){V||h(ye=>({...ye,isLoading:!1}));return}try{const ye=await x(`${f.current}/auth/me`,{headers:{Authorization:`Bearer ${B.accessToken}`}});V||h({user:ye,tokens:B,isLoading:!1,isAuthenticated:!0})}catch{S(null),V||h({user:null,tokens:null,isLoading:!1,isAuthenticated:!1})}}return z(),()=>{V=!0}},[]);const C=I.useCallback(async V=>{h(z=>({...z,isLoading:!0}));try{const z=await x(`${f.current}/auth/login`,{method:"POST",body:JSON.stringify(V)});S(z.tokens),h({user:z.user,tokens:z.tokens,isLoading:!1,isAuthenticated:!0})}catch(z){throw h(N=>({...N,isLoading:!1})),z}},[x,S]),U=I.useCallback(async V=>{h(z=>({...z,isLoading:!0}));try{const z=await x(`${f.current}/auth/signup`,{method:"POST",body:JSON.stringify(V)});S(z.tokens),h({user:z.user,tokens:z.tokens,isLoading:!1,isAuthenticated:!0})}catch(z){throw h(N=>({...N,isLoading:!1})),z}},[x,S]),L=I.useCallback(async()=>{h(V=>({...V,isLoading:!0}));try{const V=k();V!=null&&V.accessToken&&await x(`${f.current}/auth/logout`,{method:"POST",headers:{Authorization:`Bearer ${V.accessToken}`}}).catch(()=>{})}finally{S(null),h({user:null,tokens:null,isLoading:!1,isAuthenticated:!1})}},[x,k,S]),b=I.useCallback(async V=>{await x(`${f.current}/auth/forgot-password`,{method:"POST",body:JSON.stringify(V)})},[x]),Z=I.useCallback(async V=>{await x(`${f.current}/auth/magic-link`,{method:"POST",body:JSON.stringify(V)})},[x]),W=I.useCallback(V=>{h(z=>z.user?{...z,user:{...z.user,...V}}:z)},[]),se=I.useMemo(()=>({...l,login:C,signup:U,logout:L,forgotPassword:b,sendMagicLink:Z,updateUser:W}),[l,C,U,L,b,Z,W]),ue=I.useMemo(()=>({config:a,configLoading:o,apiUrl:e}),[a,o,e]);return u.jsx(xs.Provider,{value:ue,children:u.jsx(vs.Provider,{value:se,children:t})})}function Ot(){const t=I.useContext(vs);if(!t)throw new Error("useAuth must be used inside <AuthProvider>");return t}function ur(){const t=I.useContext(xs);if(!t)throw new Error("useAuthConfig must be used inside <AuthProvider>");return t}var Dt=t=>t.type==="checkbox",pt=t=>t instanceof Date,Le=t=>t==null;const _s=t=>typeof t=="object";var _e=t=>!Le(t)&&!Array.isArray(t)&&_s(t)&&!pt(t),$a=t=>_e(t)&&t.target?Dt(t.target)?t.target.checked:t.target.value:t,ws=t=>t.substring(0,t.search(/\.\d+(\.|$)/))||t,Fa=(t,e)=>t.has(ws(e)),Da=t=>{const e=t.constructor&&t.constructor.prototype;return _e(e)&&e.hasOwnProperty("isPrototypeOf")},Yr=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function Ce(t){if(t instanceof Date)return new Date(t);const e=typeof FileList<"u"&&t instanceof FileList;if(Yr&&(t instanceof Blob||e))return t;const r=Array.isArray(t);if(!r&&!(_e(t)&&Da(t)))return t;const n=r?[]:Object.create(Object.getPrototypeOf(t));for(const s in t)Object.prototype.hasOwnProperty.call(t,s)&&(n[s]=Ce(t[s]));return n}var dr=t=>/^\w*$/.test(t),be=t=>t===void 0,Kr=t=>Array.isArray(t)?t.filter(Boolean):[],Jr=t=>Kr(t.replace(/["|']|\]/g,"").split(/\.|\[/)),M=(t,e,r)=>{if(!e||!_e(t))return r;const n=(dr(e)?[e]:Jr(e)).reduce((s,a)=>Le(s)?s:s[a],t);return be(n)||n===t?be(t[e])?r:t[e]:n},Ke=t=>typeof t=="boolean",Ge=t=>typeof t=="function",ge=(t,e,r)=>{let n=-1;const s=dr(e)?[e]:Jr(e),a=s.length,i=a-1;for(;++n<a;){const o=s[n];let c=r;if(n!==i){const l=t[o];c=_e(l)||Array.isArray(l)?l:isNaN(+s[n+1])?{}:[]}if(o==="__proto__"||o==="constructor"||o==="prototype")return;t[o]=c,t=t[o]}};const gt={BLUR:"blur",FOCUS_OUT:"focusout",SUBMIT:"submit",TRIGGER:"trigger",VALID:"valid"},He={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},We={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},gr="form",ks="root",Ua=I.createContext(null);Ua.displayName="HookFormControlContext";var za=(t,e,r,n=!0)=>{const s={defaultValues:e._defaultValues};for(const a in t)Object.defineProperty(s,a,{get:()=>{const i=a;return e._proxyFormState[i]!==He.all&&(e._proxyFormState[i]=!n||He.all),t[i]}});return s};const Ba=typeof window<"u"?I.useLayoutEffect:I.useEffect;var Ae=t=>typeof t=="string",Za=(t,e,r,n,s)=>Ae(t)?(n&&e.watch.add(t),M(r,t,s)):Array.isArray(t)?t.map(a=>(n&&e.watch.add(a),M(r,a))):(n&&(e.watchAll=!0),r),Ar=t=>Le(t)||!_s(t);function st(t,e,r=new WeakSet){if(Ar(t)||Ar(e))return Object.is(t,e);if(pt(t)&&pt(e))return Object.is(t.getTime(),e.getTime());const n=Object.keys(t),s=Object.keys(e);if(n.length!==s.length)return!1;if(r.has(t)||r.has(e))return!0;r.add(t),r.add(e);for(const a of n){const i=t[a];if(!s.includes(a))return!1;if(a!=="ref"){const o=e[a];if(pt(i)&&pt(o)||_e(i)&&_e(o)||Array.isArray(i)&&Array.isArray(o)?!st(i,o,r):!Object.is(i,o))return!1}}return!0}const Wa=I.createContext(null);Wa.displayName="HookFormContext";var Ss=(t,e,r,n,s)=>e?{...r[t],types:{...r[t]&&r[t].types?r[t].types:{},[n]:s||!0}}:{},It=t=>Array.isArray(t)?t:[t],vn=()=>{let t=[];return{get observers(){return t},next:s=>{for(const a of t)a.next&&a.next(s)},subscribe:s=>(t.push(s),{unsubscribe:()=>{t=t.filter(a=>a!==s)}}),unsubscribe:()=>{t=[]}}};function Cs(t,e){const r={};for(const n in t)if(t.hasOwnProperty(n)){const s=t[n],a=e[n];if(s&&_e(s)&&a){const i=Cs(s,a);_e(i)&&(r[n]=i)}else t[n]&&(r[n]=a)}return r}var Ne=t=>_e(t)&&!Object.keys(t).length,Xr=t=>t.type==="file",Xt=t=>{if(!Yr)return!1;const e=t?t.ownerDocument:0;return t instanceof(e&&e.defaultView?e.defaultView.HTMLElement:HTMLElement)},Es=t=>t.type==="select-multiple",Qr=t=>t.type==="radio",qa=t=>Qr(t)||Dt(t),vr=t=>Xt(t)&&t.isConnected;function Ga(t,e){const r=e.slice(0,-1).length;let n=0;for(;n<r;)t=be(t)?n++:t[e[n++]];return t}function Ha(t){for(const e in t)if(t.hasOwnProperty(e)&&!be(t[e]))return!1;return!0}function ke(t,e){const r=Array.isArray(e)?e:dr(e)?[e]:Jr(e),n=r.length===1?t:Ga(t,r),s=r.length-1,a=r[s];return n&&delete n[a],s!==0&&(_e(n)&&Ne(n)||Array.isArray(n)&&Ha(n))&&ke(t,r.slice(0,-1)),t}var Ya=t=>{for(const e in t)if(Ge(t[e]))return!0;return!1};function Rs(t){return Array.isArray(t)||_e(t)&&!Ya(t)}function Tr(t,e={}){for(const r in t){const n=t[r];Rs(n)?(e[r]=Array.isArray(n)?[]:{},Tr(n,e[r])):be(n)||(e[r]=!0)}return e}function xt(t,e,r){r||(r=Tr(e));for(const n in t){const s=t[n];if(Rs(s))be(e)||Ar(r[n])?r[n]=Tr(s,Array.isArray(s)?[]:{}):xt(s,Le(e)?{}:e[n],r[n]);else{const a=e[n];r[n]=!st(s,a)}}return r}const xn={value:!1,isValid:!1},bn={value:!0,isValid:!0};var Os=t=>{if(Array.isArray(t)){if(t.length>1){const e=t.filter(r=>r&&r.checked&&!r.disabled).map(r=>r.value);return{value:e,isValid:!!e.length}}return t[0].checked&&!t[0].disabled?t[0].attributes&&!be(t[0].attributes.value)?be(t[0].value)||t[0].value===""?bn:{value:t[0].value,isValid:!0}:bn:xn}return xn},js=(t,{valueAsNumber:e,valueAsDate:r,setValueAs:n})=>be(t)?t:e?t===""?NaN:t&&+t:r&&Ae(t)?new Date(t):n?n(t):t;const _n={isValid:!1,value:null};var Ns=t=>Array.isArray(t)?t.reduce((e,r)=>r&&r.checked&&!r.disabled?{isValid:!0,value:r.value}:e,_n):_n;function wn(t){const e=t.ref;return Xr(e)?e.files:Qr(e)?Ns(t.refs).value:Es(e)?[...e.selectedOptions].map(({value:r})=>r):Dt(e)?Os(t.refs).value:js(be(e.value)?t.ref.value:e.value,t)}var Ka=(t,e,r,n)=>{const s={};for(const a of t){const i=M(e,a);i&&ge(s,a,i._f)}return{criteriaMode:r,names:[...t],fields:s,shouldUseNativeValidation:n}},Qt=t=>t instanceof RegExp,Nt=t=>be(t)?t:Qt(t)?t.source:_e(t)?Qt(t.value)?t.value.source:t.value:t,kn=t=>({isOnSubmit:!t||t===He.onSubmit,isOnBlur:t===He.onBlur,isOnChange:t===He.onChange,isOnAll:t===He.all,isOnTouch:t===He.onTouched});const Sn="AsyncFunction";var Ja=t=>!!t&&!!t.validate&&!!(Ge(t.validate)&&t.validate.constructor.name===Sn||_e(t.validate)&&Object.values(t.validate).find(e=>e.constructor.name===Sn)),Xa=t=>t.mount&&(t.required||t.min||t.max||t.maxLength||t.minLength||t.pattern||t.validate),Cn=(t,e,r)=>!r&&(e.watchAll||e.watch.has(t)||[...e.watch].some(n=>t.startsWith(n)&&/^\.\w+/.test(t.slice(n.length))));const Lt=(t,e,r,n)=>{for(const s of r||Object.keys(t)){const a=M(t,s);if(a){const{_f:i,...o}=a;if(i){if(i.refs&&i.refs[0]&&e(i.refs[0],s)&&!n)return!0;if(i.ref&&e(i.ref,i.name)&&!n)return!0;if(Lt(o,e))break}else if(_e(o)&&Lt(o,e))break}}};function En(t,e,r){const n=M(t,r);if(n||dr(r))return{error:n,name:r};const s=r.split(".");for(;s.length;){const a=s.join("."),i=M(e,a),o=M(t,a);if(i&&!Array.isArray(i)&&r!==a)return{name:r};if(o&&o.type)return{name:a,error:o};if(o&&o.root&&o.root.type)return{name:`${a}.root`,error:o.root};s.pop()}return{name:r}}var Qa=(t,e,r,n)=>{r(t);const{name:s,...a}=t;return Ne(a)||Object.keys(a).length>=Object.keys(e).length||Object.keys(a).find(i=>e[i]===(!n||He.all))},ei=(t,e,r)=>!t||!e||t===e||It(t).some(n=>n&&(r?n===e:n.startsWith(e)||e.startsWith(n))),ti=(t,e,r,n,s)=>s.isOnAll?!1:!r&&s.isOnTouch?!(e||t):(r?n.isOnBlur:s.isOnBlur)?!t:(r?n.isOnChange:s.isOnChange)?t:!0,ri=(t,e)=>!Kr(M(t,e)).length&&ke(t,e),ni=(t,e,r)=>{const n=It(M(t,r));return ge(n,ks,e[r]),ge(t,r,n),t};function Rn(t,e,r="validate"){if(Ae(t)||Array.isArray(t)&&t.every(Ae)||Ke(t)&&!t)return{type:r,message:Ae(t)?t:"",ref:e}}var vt=t=>_e(t)&&!Qt(t)?t:{value:t,message:""},On=async(t,e,r,n,s,a)=>{const{ref:i,refs:o,required:c,maxLength:l,minLength:h,min:f,max:p,pattern:m,validate:x,name:v,valueAsNumber:S,mount:k}=t._f,C=M(r,v);if(!k||e.has(v))return{};const U=o?o[0]:i,L=N=>{s&&U.reportValidity&&(U.setCustomValidity(Ke(N)?"":N||""),U.reportValidity())},b={},Z=Qr(i),W=Dt(i),se=Z||W,ue=(S||Xr(i))&&be(i.value)&&be(C)||Xt(i)&&i.value===""||C===""||Array.isArray(C)&&!C.length,V=Ss.bind(null,v,n,b),z=(N,B,Q,ye=We.maxLength,de=We.minLength)=>{const xe=N?B:Q;b[v]={type:N?ye:de,message:xe,ref:i,...V(N?ye:de,xe)}};if(a?!Array.isArray(C)||!C.length:c&&(!se&&(ue||Le(C))||Ke(C)&&!C||W&&!Os(o).isValid||Z&&!Ns(o).isValid)){const{value:N,message:B}=Ae(c)?{value:!!c,message:c}:vt(c);if(N&&(b[v]={type:We.required,message:B,ref:U,...V(We.required,B)},!n))return L(B),b}if(!ue&&(!Le(f)||!Le(p))){let N,B;const Q=vt(p),ye=vt(f);if(!Le(C)&&!isNaN(C)){const de=i.valueAsNumber||C&&+C;Le(Q.value)||(N=de>Q.value),Le(ye.value)||(B=de<ye.value)}else{const de=i.valueAsDate||new Date(C),xe=_=>new Date(new Date().toDateString()+" "+_),we=i.type=="time",Ee=i.type=="week";Ae(Q.value)&&C&&(N=we?xe(C)>xe(Q.value):Ee?C>Q.value:de>new Date(Q.value)),Ae(ye.value)&&C&&(B=we?xe(C)<xe(ye.value):Ee?C<ye.value:de<new Date(ye.value))}if((N||B)&&(z(!!N,Q.message,ye.message,We.max,We.min),!n))return L(b[v].message),b}if((l||h)&&!ue&&(Ae(C)||a&&Array.isArray(C))){const N=vt(l),B=vt(h),Q=!Le(N.value)&&C.length>+N.value,ye=!Le(B.value)&&C.length<+B.value;if((Q||ye)&&(z(Q,N.message,B.message),!n))return L(b[v].message),b}if(m&&!ue&&Ae(C)){const{value:N,message:B}=vt(m);if(Qt(N)&&!C.match(N)&&(b[v]={type:We.pattern,message:B,ref:i,...V(We.pattern,B)},!n))return L(B),b}if(x){if(Ge(x)){const N=await x(C,r),B=Rn(N,U);if(B&&(b[v]={...B,...V(We.validate,B.message)},!n))return L(B.message),b}else if(_e(x)){let N={};for(const B in x){if(!Ne(N)&&!n)break;const Q=Rn(await x[B](C,r),U,B);Q&&(N={...Q,...V(B,Q.message)},L(Q.message),n&&(b[v]=N))}if(!Ne(N)&&(b[v]={ref:U,...N},!n))return b}}return L(!0),b};const si={mode:He.onSubmit,reValidateMode:He.onChange,shouldFocusError:!0};function ai(t={}){let e={...si,...t},r={submitCount:0,isDirty:!1,isReady:!1,isLoading:Ge(e.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1},n={},s=_e(e.defaultValues)||_e(e.values)?Ce(e.defaultValues||e.values)||{}:{},a=e.shouldUnregister?{}:Ce(s),i={action:!1,mount:!1,watch:!1,keepIsValid:!1},o={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},c,l=0;const h={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},f={...h};let p={...f};const m={array:vn(),state:vn()},x=e.criteriaMode===He.all,v=d=>y=>{clearTimeout(l),l=setTimeout(d,y)},S=async d=>{if(!i.keepIsValid&&!e.disabled&&(f.isValid||p.isValid||d)){let y;e.resolver?(y=Ne((await se()).errors),k()):y=await z({fields:n,onlyCheckValid:!0,eventType:gt.VALID}),y!==r.isValid&&m.state.next({isValid:y})}},k=(d,y)=>{!e.disabled&&(f.isValidating||f.validatingFields||p.isValidating||p.validatingFields)&&((d||Array.from(o.mount)).forEach(g=>{g&&(y?ge(r.validatingFields,g,y):ke(r.validatingFields,g))}),m.state.next({validatingFields:r.validatingFields,isValidating:!Ne(r.validatingFields)}))},C=(d,y=[],g,A,O=!0,j=!0)=>{if(A&&g&&!e.disabled){if(i.action=!0,j&&Array.isArray(M(n,d))){const D=g(M(n,d),A.argA,A.argB);O&&ge(n,d,D)}if(j&&Array.isArray(M(r.errors,d))){const D=g(M(r.errors,d),A.argA,A.argB);O&&ge(r.errors,d,D),ri(r.errors,d)}if((f.touchedFields||p.touchedFields)&&j&&Array.isArray(M(r.touchedFields,d))){const D=g(M(r.touchedFields,d),A.argA,A.argB);O&&ge(r.touchedFields,d,D)}if(f.dirtyFields||p.dirtyFields){const D=xt(s,a),J=ws(d);ge(r.dirtyFields,J,M(D,J))}m.state.next({name:d,isDirty:B(d,y),dirtyFields:r.dirtyFields,errors:r.errors,isValid:r.isValid})}else ge(a,d,y)},U=(d,y)=>{ge(r.errors,d,y),m.state.next({errors:r.errors})},L=d=>{r.errors=d,m.state.next({errors:r.errors,isValid:!1})},b=(d,y,g,A)=>{const O=M(n,d);if(O){const j=M(a,d,be(g)?M(s,d):g);be(j)||A&&A.defaultChecked||y?ge(a,d,y?j:wn(O._f)):de(d,j),i.mount&&!i.action&&S()}},Z=(d,y,g,A,O)=>{let j=!1,D=!1;const J={name:d};if(!e.disabled){if(!g||A){(f.isDirty||p.isDirty)&&(D=r.isDirty,r.isDirty=J.isDirty=B(),j=D!==J.isDirty);const pe=st(M(s,d),y);D=!!M(r.dirtyFields,d),pe?ke(r.dirtyFields,d):ge(r.dirtyFields,d,!0),J.dirtyFields=r.dirtyFields,j=j||(f.dirtyFields||p.dirtyFields)&&D!==!pe}if(g){const pe=M(r.touchedFields,d);pe||(ge(r.touchedFields,d,g),J.touchedFields=r.touchedFields,j=j||(f.touchedFields||p.touchedFields)&&pe!==g)}j&&O&&m.state.next(J)}return j?J:{}},W=(d,y,g,A)=>{const O=M(r.errors,d),j=(f.isValid||p.isValid)&&Ke(y)&&r.isValid!==y;if(e.delayError&&g?(c=v(()=>U(d,g)),c(e.delayError)):(clearTimeout(l),c=null,g?ge(r.errors,d,g):ke(r.errors,d)),(g?!st(O,g):O)||!Ne(A)||j){const D={...A,...j&&Ke(y)?{isValid:y}:{},errors:r.errors,name:d};r={...r,...D},m.state.next(D)}},se=async d=>(k(d,!0),await e.resolver(a,e.context,Ka(d||o.mount,n,e.criteriaMode,e.shouldUseNativeValidation))),ue=async d=>{const{errors:y}=await se(d);if(k(d),d)for(const g of d){const A=M(y,g);A?ge(r.errors,g,A):ke(r.errors,g)}else r.errors=y;return y},V=async({name:d,eventType:y})=>{if(t.validate){const g=await t.validate({formValues:a,formState:r,name:d,eventType:y});if(_e(g))for(const A in g)g[A]&&ne(`${gr}.${A}`,{message:Ae(g.message)?g.message:"",type:We.validate});else Ae(g)||!g?ne(gr,{message:g||"",type:We.validate}):K(gr);return g}return!0},z=async({fields:d,onlyCheckValid:y,name:g,eventType:A,context:O={valid:!0,runRootValidation:!1}})=>{if(t.validate&&(O.runRootValidation=!0,!await V({name:g,eventType:A})&&(O.valid=!1,y)))return O.valid;for(const j in d){const D=d[j];if(D){const{_f:J,...pe}=D;if(J){const Me=o.array.has(J.name),Ye=D._f&&Ja(D._f);Ye&&f.validatingFields&&k([J.name],!0);const Te=await On(D,o.disabled,a,x,e.shouldUseNativeValidation&&!y,Me);if(Ye&&f.validatingFields&&k([J.name]),Te[J.name]&&(O.valid=!1,y)||(!y&&(M(Te,J.name)?Me?ni(r.errors,Te,J.name):ge(r.errors,J.name,Te[J.name]):ke(r.errors,J.name)),t.shouldUseNativeValidation&&Te[J.name]))break}!Ne(pe)&&await z({context:O,onlyCheckValid:y,fields:pe,name:j,eventType:A})}}return O.valid},N=()=>{for(const d of o.unMount){const y=M(n,d);y&&(y._f.refs?y._f.refs.every(g=>!vr(g)):!vr(y._f.ref))&&oe(d)}o.unMount=new Set},B=(d,y)=>!e.disabled&&(d&&y&&ge(a,d,y),!st(G(),s)),Q=(d,y,g)=>Za(d,o,{...i.mount?a:be(y)?s:Ae(d)?{[d]:y}:y},g,y),ye=d=>Kr(M(i.mount?a:s,d,e.shouldUnregister?M(s,d,[]):[])),de=(d,y,g={})=>{const A=M(n,d);let O=y;if(A){const j=A._f;j&&(!j.disabled&&ge(a,d,js(y,j)),O=Xt(j.ref)&&Le(y)?"":y,Es(j.ref)?[...j.ref.options].forEach(D=>D.selected=O.includes(D.value)):j.refs?Dt(j.ref)?j.refs.forEach(D=>{(!D.defaultChecked||!D.disabled)&&(Array.isArray(O)?D.checked=!!O.find(J=>J===D.value):D.checked=O===D.value||!!O)}):j.refs.forEach(D=>D.checked=D.value===O):Xr(j.ref)?j.ref.value="":(j.ref.value=O,j.ref.type||m.state.next({name:d,values:Ce(a)})))}(g.shouldDirty||g.shouldTouch)&&Z(d,O,g.shouldTouch,g.shouldDirty,!0),g.shouldValidate&&R(d)},xe=(d,y,g)=>{for(const A in y){if(!y.hasOwnProperty(A))return;const O=y[A],j=d+"."+A,D=M(n,j);(o.array.has(d)||_e(O)||D&&!D._f)&&!pt(O)?xe(j,O,g):de(j,O,g)}},we=(d,y,g={})=>{const A=M(n,d),O=o.array.has(d),j=Ce(y);ge(a,d,j),O?(m.array.next({name:d,values:Ce(a)}),(f.isDirty||f.dirtyFields||p.isDirty||p.dirtyFields)&&g.shouldDirty&&m.state.next({name:d,dirtyFields:xt(s,a),isDirty:B(d,j)})):A&&!A._f&&!Le(j)?xe(d,j,g):de(d,j,g),Cn(d,o)?m.state.next({...r,name:d,values:Ce(a)}):m.state.next({name:i.mount?d:void 0,values:Ce(a)})},Ee=async d=>{i.mount=!0;const y=d.target;let g=y.name,A=!0;const O=M(n,g),j=pe=>{A=Number.isNaN(pe)||pt(pe)&&isNaN(pe.getTime())||st(pe,M(a,g,pe))},D=kn(e.mode),J=kn(e.reValidateMode);if(O){let pe,Me;const Ye=y.type?wn(O._f):$a(d),Te=d.type===gt.BLUR||d.type===gt.FOCUS_OUT,Ta=!Xa(O._f)&&!t.validate&&!e.resolver&&!M(r.errors,g)&&!O._f.deps||ti(Te,M(r.touchedFields,g),r.isSubmitted,J,D),mr=Cn(g,o,Te);ge(a,g,Ye),Te?(!y||!y.readOnly)&&(O._f.onBlur&&O._f.onBlur(d),c&&c(0)):O._f.onChange&&O._f.onChange(d);const yr=Z(g,Ye,Te),Pa=!Ne(yr)||mr;if(!Te&&m.state.next({name:g,type:d.type,values:Ce(a)}),Ta)return(f.isValid||p.isValid)&&(e.mode==="onBlur"?Te&&S():Te||S()),Pa&&m.state.next({name:g,...mr?{}:yr});if(!e.resolver&&t.validate&&await V({name:g,eventType:d.type}),!Te&&mr&&m.state.next({...r}),e.resolver){const{errors:pn}=await se([g]);if(k([g]),j(Ye),A){const Ia=En(r.errors,n,g),mn=En(pn,n,Ia.name||g);pe=mn.error,g=mn.name,Me=Ne(pn)}}else k([g],!0),pe=(await On(O,o.disabled,a,x,e.shouldUseNativeValidation))[g],k([g]),j(Ye),A&&(pe?Me=!1:(f.isValid||p.isValid)&&(Me=await z({fields:n,onlyCheckValid:!0,name:g,eventType:d.type})));A&&(O._f.deps&&(!Array.isArray(O._f.deps)||O._f.deps.length>0)&&R(O._f.deps),W(g,Me,pe,yr))}},_=(d,y)=>{if(M(r.errors,y)&&d.focus)return d.focus(),1},R=async(d,y={})=>{let g,A;const O=It(d);if(e.resolver){const j=await ue(be(d)?d:O);g=Ne(j),A=d?!O.some(D=>M(j,D)):g}else d?(A=(await Promise.all(O.map(async j=>{const D=M(n,j);return await z({fields:D&&D._f?{[j]:D}:D,eventType:gt.TRIGGER})}))).every(Boolean),!(!A&&!r.isValid)&&S()):A=g=await z({fields:n,name:d,eventType:gt.TRIGGER});return m.state.next({...!Ae(d)||(f.isValid||p.isValid)&&g!==r.isValid?{}:{name:d},...e.resolver||!d?{isValid:g}:{},errors:r.errors}),y.shouldFocus&&!A&&Lt(n,_,d?O:o.mount),A},G=(d,y)=>{let g={...i.mount?a:s};return y&&(g=Cs(y.dirtyFields?r.dirtyFields:r.touchedFields,g)),be(d)?g:Ae(d)?M(g,d):d.map(A=>M(g,A))},q=(d,y)=>({invalid:!!M((y||r).errors,d),isDirty:!!M((y||r).dirtyFields,d),error:M((y||r).errors,d),isValidating:!!M(r.validatingFields,d),isTouched:!!M((y||r).touchedFields,d)}),K=d=>{const y=d?It(d):void 0;y==null||y.forEach(g=>ke(r.errors,g)),y?y.forEach(g=>{m.state.next({name:g,errors:r.errors})}):m.state.next({errors:{}})},ne=(d,y,g)=>{const A=(M(n,d,{_f:{}})._f||{}).ref,O=M(r.errors,d)||{},{ref:j,message:D,type:J,...pe}=O;ge(r.errors,d,{...pe,...y,ref:A}),m.state.next({name:d,errors:r.errors,isValid:!1}),g&&g.shouldFocus&&A&&A.focus&&A.focus()},ee=(d,y)=>Ge(d)?m.state.subscribe({next:g=>"values"in g&&d(Q(void 0,y),g)}):Q(d,y,!0),te=d=>m.state.subscribe({next:y=>{ei(d.name,y.name,d.exact)&&Qa(y,d.formState||f,Aa,d.reRenderRoot)&&d.callback({values:{...a},...r,...y,defaultValues:s})}}).unsubscribe,ie=d=>(i.mount=!0,p={...p,...d.formState},te({...d,formState:{...h,...d.formState}})),oe=(d,y={})=>{for(const g of d?It(d):o.mount)o.mount.delete(g),o.array.delete(g),y.keepValue||(ke(n,g),ke(a,g)),!y.keepError&&ke(r.errors,g),!y.keepDirty&&ke(r.dirtyFields,g),!y.keepTouched&&ke(r.touchedFields,g),!y.keepIsValidating&&ke(r.validatingFields,g),!e.shouldUnregister&&!y.keepDefaultValue&&ke(s,g);m.state.next({values:Ce(a)}),m.state.next({...r,...y.keepDirty?{isDirty:B()}:{}}),!y.keepIsValid&&S()},ae=({disabled:d,name:y})=>{if(Ke(d)&&i.mount||d||o.disabled.has(y)){const O=o.disabled.has(y)!==!!d;d?o.disabled.add(y):o.disabled.delete(y),O&&i.mount&&!i.action&&S()}},Re=(d,y={})=>{let g=M(n,d);const A=Ke(y.disabled)||Ke(e.disabled);return ge(n,d,{...g||{},_f:{...g&&g._f?g._f:{ref:{name:d}},name:d,mount:!0,...y}}),o.mount.add(d),g?ae({disabled:Ke(y.disabled)?y.disabled:e.disabled,name:d}):b(d,!0,y.value),{...A?{disabled:y.disabled||e.disabled}:{},...e.progressive?{required:!!y.required,min:Nt(y.min),max:Nt(y.max),minLength:Nt(y.minLength),maxLength:Nt(y.maxLength),pattern:Nt(y.pattern)}:{},name:d,onChange:Ee,onBlur:Ee,ref:O=>{if(O){Re(d,y),g=M(n,d);const j=be(O.value)&&O.querySelectorAll&&O.querySelectorAll("input,select,textarea")[0]||O,D=qa(j),J=g._f.refs||[];if(D?J.find(pe=>pe===j):j===g._f.ref)return;ge(n,d,{_f:{...g._f,...D?{refs:[...J.filter(vr),j,...Array.isArray(M(s,d))?[{}]:[]],ref:{type:j.type,name:d}}:{ref:j}}}),b(d,!1,void 0,j)}else g=M(n,d,{}),g._f&&(g._f.mount=!1),(e.shouldUnregister||y.shouldUnregister)&&!(Fa(o.array,d)&&i.action)&&o.unMount.add(d)}}},T=()=>e.shouldFocusError&&Lt(n,_,o.mount),Fe=d=>{Ke(d)&&(m.state.next({disabled:d}),Lt(n,(y,g)=>{const A=M(n,g);A&&(y.disabled=A._f.disabled||d,Array.isArray(A._f.refs)&&A._f.refs.forEach(O=>{O.disabled=A._f.disabled||d}))},0,!1))},ht=(d,y)=>async g=>{let A;g&&(g.preventDefault&&g.preventDefault(),g.persist&&g.persist());let O=Ce(a);if(m.state.next({isSubmitting:!0}),e.resolver){const{errors:j,values:D}=await se();k(),r.errors=j,O=Ce(D)}else await z({fields:n,eventType:gt.SUBMIT});if(o.disabled.size)for(const j of o.disabled)ke(O,j);if(ke(r.errors,ks),Ne(r.errors)){m.state.next({errors:{}});try{await d(O,g)}catch(j){A=j}}else y&&await y({...r.errors},g),T(),setTimeout(T);if(m.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Ne(r.errors)&&!A,submitCount:r.submitCount+1,errors:r.errors}),A)throw A},zt=(d,y={})=>{M(n,d)&&(be(y.defaultValue)?we(d,Ce(M(s,d))):(we(d,y.defaultValue),ge(s,d,Ce(y.defaultValue))),y.keepTouched||ke(r.touchedFields,d),y.keepDirty||(ke(r.dirtyFields,d),r.isDirty=y.defaultValue?B(d,Ce(M(s,d))):B()),y.keepError||(ke(r.errors,d),f.isValid&&S()),m.state.next({...r}))},dn=(d,y={})=>{const g=d?Ce(d):s,A=Ce(g),O=Ne(d),j=O?s:A;if(y.keepDefaultValues||(s=g),!y.keepValues){if(y.keepDirtyValues){const D=new Set([...o.mount,...Object.keys(xt(s,a))]);for(const J of Array.from(D)){const pe=M(r.dirtyFields,J),Me=M(a,J),Ye=M(j,J);pe&&!be(Me)?ge(j,J,Me):!pe&&!be(Ye)&&we(J,Ye)}}else{if(Yr&&be(d))for(const D of o.mount){const J=M(n,D);if(J&&J._f){const pe=Array.isArray(J._f.refs)?J._f.refs[0]:J._f.ref;if(Xt(pe)){const Me=pe.closest("form");if(Me){Me.reset();break}}}}if(y.keepFieldsRef)for(const D of o.mount)we(D,M(j,D));else n={}}a=e.shouldUnregister?y.keepDefaultValues?Ce(s):{}:Ce(j),m.array.next({values:{...j}}),m.state.next({values:{...j}})}o={mount:y.keepDirtyValues?o.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},i.mount=!f.isValid||!!y.keepIsValid||!!y.keepDirtyValues||!e.shouldUnregister&&!Ne(j),i.watch=!!e.shouldUnregister,i.keepIsValid=!!y.keepIsValid,i.action=!1,y.keepErrors||(r.errors={}),m.state.next({submitCount:y.keepSubmitCount?r.submitCount:0,isDirty:O?!1:y.keepDirty?r.isDirty:!!(y.keepDefaultValues&&!st(d,s)),isSubmitted:y.keepIsSubmitted?r.isSubmitted:!1,dirtyFields:O?{}:y.keepDirtyValues?y.keepDefaultValues&&a?xt(s,a):r.dirtyFields:y.keepDefaultValues&&d?xt(s,d):y.keepDirty?r.dirtyFields:{},touchedFields:y.keepTouched?r.touchedFields:{},errors:y.keepErrors?r.errors:{},isSubmitSuccessful:y.keepIsSubmitSuccessful?r.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:s})},fn=(d,y)=>dn(Ge(d)?d(a):d,{...e.resetOptions,...y}),Na=(d,y={})=>{const g=M(n,d),A=g&&g._f;if(A){const O=A.refs?A.refs[0]:A.ref;O.focus&&setTimeout(()=>{O.focus(),y.shouldSelect&&Ge(O.select)&&O.select()})}},Aa=d=>{r={...r,...d}},hn={control:{register:Re,unregister:oe,getFieldState:q,handleSubmit:ht,setError:ne,_subscribe:te,_runSchema:se,_updateIsValidating:k,_focusError:T,_getWatch:Q,_getDirty:B,_setValid:S,_setFieldArray:C,_setDisabledField:ae,_setErrors:L,_getFieldArray:ye,_reset:dn,_resetDefaultValues:()=>Ge(e.defaultValues)&&e.defaultValues().then(d=>{fn(d,e.resetOptions),m.state.next({isLoading:!1})}),_removeUnmounted:N,_disableForm:Fe,_subjects:m,_proxyFormState:f,get _fields(){return n},get _formValues(){return a},get _state(){return i},set _state(d){i=d},get _defaultValues(){return s},get _names(){return o},set _names(d){o=d},get _formState(){return r},get _options(){return e},set _options(d){e={...e,...d}}},subscribe:ie,trigger:R,register:Re,handleSubmit:ht,watch:ee,setValue:we,getValues:G,reset:fn,resetField:zt,clearErrors:K,unregister:oe,setError:ne,setFocus:Na,getFieldState:q};return{...hn,formControl:hn}}function er(t={}){const e=I.useRef(void 0),r=I.useRef(void 0),[n,s]=I.useState({isDirty:!1,isValidating:!1,isLoading:Ge(t.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1,isReady:!1,defaultValues:Ge(t.defaultValues)?void 0:t.defaultValues});if(!e.current)if(t.formControl)e.current={...t.formControl,formState:n},t.defaultValues&&!Ge(t.defaultValues)&&t.formControl.reset(t.defaultValues,t.resetOptions);else{const{formControl:i,...o}=ai(t);e.current={...o,formState:n}}const a=e.current.control;return a._options=t,Ba(()=>{const i=a._subscribe({formState:a._proxyFormState,callback:()=>s({...a._formState}),reRenderRoot:!0});return s(o=>({...o,isReady:!0})),a._formState.isReady=!0,i},[a]),I.useEffect(()=>a._disableForm(t.disabled),[a,t.disabled]),I.useEffect(()=>{t.mode&&(a._options.mode=t.mode),t.reValidateMode&&(a._options.reValidateMode=t.reValidateMode)},[a,t.mode,t.reValidateMode]),I.useEffect(()=>{t.errors&&(a._setErrors(t.errors),a._focusError())},[a,t.errors]),I.useEffect(()=>{t.shouldUnregister&&a._subjects.state.next({values:a._getWatch()})},[a,t.shouldUnregister]),I.useEffect(()=>{if(a._proxyFormState.isDirty){const i=a._getDirty();i!==n.isDirty&&a._subjects.state.next({isDirty:i})}},[a,n.isDirty]),I.useEffect(()=>{var i;t.values&&!st(t.values,r.current)?(a._reset(t.values,{keepFieldsRef:!0,...a._options.resetOptions}),!((i=a._options.resetOptions)===null||i===void 0)&&i.keepIsValid||a._setValid(),r.current=t.values,s(o=>({...o}))):a._resetDefaultValues()},[a,t.values]),I.useEffect(()=>{a._state.mount||(a._setValid(),a._state.mount=!0),a._state.watch&&(a._state.watch=!1,a._subjects.state.next({...a._formState})),a._removeUnmounted()}),e.current.formState=I.useMemo(()=>za(n,a),[a,n]),e.current}const jn=(t,e,r)=>{if(t&&"reportValidity"in t){const n=M(r,e);t.setCustomValidity(n&&n.message||""),t.reportValidity()}},As=(t,e)=>{for(const r in e.fields){const n=e.fields[r];n&&n.ref&&"reportValidity"in n.ref?jn(n.ref,r,t):n.refs&&n.refs.forEach(s=>jn(s,r,t))}},ii=(t,e)=>{e.shouldUseNativeValidation&&As(t,e);const r={};for(const n in t){const s=M(e.fields,n),a=Object.assign(t[n]||{},{ref:s&&s.ref});if(oi(e.names||Object.keys(t),n)){const i=Object.assign({},M(r,n));ge(i,"root",a),ge(r,n,i)}else ge(r,n,a)}return r},oi=(t,e)=>t.some(r=>r.startsWith(e+"."));var ci=function(t,e){for(var r={};t.length;){var n=t[0],s=n.code,a=n.message,i=n.path.join(".");if(!r[i])if("unionErrors"in n){var o=n.unionErrors[0].errors[0];r[i]={message:o.message,type:o.code}}else r[i]={message:a,type:s};if("unionErrors"in n&&n.unionErrors.forEach(function(h){return h.errors.forEach(function(f){return t.push(f)})}),e){var c=r[i].types,l=c&&c[n.code];r[i]=Ss(i,e,r,s,l?[].concat(l,n.message):n.message)}t.shift()}return r},tr=function(t,e,r){return r===void 0&&(r={}),function(n,s,a){try{return Promise.resolve((function(i,o){try{var c=Promise.resolve(t[r.mode==="sync"?"parse":"parseAsync"](n,e)).then(function(l){return a.shouldUseNativeValidation&&As({},a),{errors:{},values:r.raw?n:l}})}catch(l){return o(l)}return c&&c.then?c.then(void 0,o):c})(0,function(i){if((function(o){return Array.isArray(o==null?void 0:o.errors)})(i))return{values:{},errors:ii(ci(i.errors,!a.shouldUseNativeValidation&&a.criteriaMode==="all"),a)};throw i}))}catch(i){return Promise.reject(i)}}},le;(function(t){t.assertEqual=s=>{};function e(s){}t.assertIs=e;function r(s){throw new Error}t.assertNever=r,t.arrayToEnum=s=>{const a={};for(const i of s)a[i]=i;return a},t.getValidEnumValues=s=>{const a=t.objectKeys(s).filter(o=>typeof s[s[o]]!="number"),i={};for(const o of a)i[o]=s[o];return t.objectValues(i)},t.objectValues=s=>t.objectKeys(s).map(function(a){return s[a]}),t.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{const a=[];for(const i in s)Object.prototype.hasOwnProperty.call(s,i)&&a.push(i);return a},t.find=(s,a)=>{for(const i of s)if(a(i))return i},t.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&Number.isFinite(s)&&Math.floor(s)===s;function n(s,a=" | "){return s.map(i=>typeof i=="string"?`'${i}'`:i).join(a)}t.joinValues=n,t.jsonStringifyReplacer=(s,a)=>typeof a=="bigint"?a.toString():a})(le||(le={}));var Nn;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(Nn||(Nn={}));const $=le.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),nt=t=>{switch(typeof t){case"undefined":return $.undefined;case"string":return $.string;case"number":return Number.isNaN(t)?$.nan:$.number;case"boolean":return $.boolean;case"function":return $.function;case"bigint":return $.bigint;case"symbol":return $.symbol;case"object":return Array.isArray(t)?$.array:t===null?$.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?$.promise:typeof Map<"u"&&t instanceof Map?$.map:typeof Set<"u"&&t instanceof Set?$.set:typeof Date<"u"&&t instanceof Date?$.date:$.object;default:return $.unknown}},E=le.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 et extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};const r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){const r=e||function(a){return a.message},n={_errors:[]},s=a=>{for(const i of a.issues)if(i.code==="invalid_union")i.unionErrors.map(s);else if(i.code==="invalid_return_type")s(i.returnTypeError);else if(i.code==="invalid_arguments")s(i.argumentsError);else if(i.path.length===0)n._errors.push(r(i));else{let o=n,c=0;for(;c<i.path.length;){const l=i.path[c];c===i.path.length-1?(o[l]=o[l]||{_errors:[]},o[l]._errors.push(r(i))):o[l]=o[l]||{_errors:[]},o=o[l],c++}}};return s(this),n}static assert(e){if(!(e instanceof et))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,le.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){const r={},n=[];for(const s of this.issues)if(s.path.length>0){const a=s.path[0];r[a]=r[a]||[],r[a].push(e(s))}else n.push(e(s));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}}et.create=t=>new et(t);const Pr=(t,e)=>{let r;switch(t.code){case E.invalid_type:t.received===$.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case E.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,le.jsonStringifyReplacer)}`;break;case E.unrecognized_keys:r=`Unrecognized key(s) in object: ${le.joinValues(t.keys,", ")}`;break;case E.invalid_union:r="Invalid input";break;case E.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${le.joinValues(t.options)}`;break;case E.invalid_enum_value:r=`Invalid enum value. Expected ${le.joinValues(t.options)}, received '${t.received}'`;break;case E.invalid_arguments:r="Invalid function arguments";break;case E.invalid_return_type:r="Invalid function return type";break;case E.invalid_date:r="Invalid date";break;case E.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:le.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case E.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case E.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case E.custom:r="Invalid input";break;case E.invalid_intersection_types:r="Intersection results could not be merged";break;case E.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case E.not_finite:r="Number must be finite";break;default:r=e.defaultError,le.assertNever(t)}return{message:r}};let li=Pr;function ui(){return li}const di=t=>{const{data:e,path:r,errorMaps:n,issueData:s}=t,a=[...r,...s.path||[]],i={...s,path:a};if(s.message!==void 0)return{...s,path:a,message:s.message};let o="";const c=n.filter(l=>!!l).slice().reverse();for(const l of c)o=l(i,{data:e,defaultError:o}).message;return{...s,path:a,message:o}};function P(t,e){const r=ui(),n=di({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===Pr?void 0:Pr].filter(s=>!!s)});t.common.issues.push(n)}class $e{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){const n=[];for(const s of r){if(s.status==="aborted")return H;s.status==="dirty"&&e.dirty(),n.push(s.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){const n=[];for(const s of r){const a=await s.key,i=await s.value;n.push({key:a,value:i})}return $e.mergeObjectSync(e,n)}static mergeObjectSync(e,r){const n={};for(const s of r){const{key:a,value:i}=s;if(a.status==="aborted"||i.status==="aborted")return H;a.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof i.value<"u"||s.alwaysSet)&&(n[a.value]=i.value)}return{status:e.value,value:n}}}const H=Object.freeze({status:"aborted"}),Pt=t=>({status:"dirty",value:t}),Be=t=>({status:"valid",value:t}),An=t=>t.status==="aborted",Tn=t=>t.status==="dirty",wt=t=>t.status==="valid",rr=t=>typeof Promise<"u"&&t instanceof Promise;var F;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(F||(F={}));class lt{constructor(e,r,n,s){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=s}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Pn=(t,e)=>{if(wt(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const r=new et(t.common.issues);return this._error=r,this._error}}};function re(t){if(!t)return{};const{errorMap:e,invalid_type_error:r,required_error:n,description:s}=t;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:s}:{errorMap:(i,o)=>{const{message:c}=t;return i.code==="invalid_enum_value"?{message:c??o.defaultError}:typeof o.data>"u"?{message:c??n??o.defaultError}:i.code!=="invalid_type"?{message:o.defaultError}:{message:c??r??o.defaultError}},description:s}}class ce{get description(){return this._def.description}_getType(e){return nt(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:nt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new $e,ctx:{common:e.parent.common,data:e.data,parsedType:nt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const r=this._parse(e);if(rr(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){const r=this._parse(e);return Promise.resolve(r)}parse(e,r){const n=this.safeParse(e,r);if(n.success)return n.data;throw n.error}safeParse(e,r){const n={common:{issues:[],async:(r==null?void 0:r.async)??!1,contextualErrorMap:r==null?void 0:r.errorMap},path:(r==null?void 0:r.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:nt(e)},s=this._parseSync({data:e,path:n.path,parent:n});return Pn(n,s)}"~validate"(e){var n,s;const r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:nt(e)};if(!this["~standard"].async)try{const a=this._parseSync({data:e,path:[],parent:r});return wt(a)?{value:a.value}:{issues:r.common.issues}}catch(a){(s=(n=a==null?void 0:a.message)==null?void 0:n.toLowerCase())!=null&&s.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(a=>wt(a)?{value:a.value}:{issues:r.common.issues})}async parseAsync(e,r){const n=await this.safeParseAsync(e,r);if(n.success)return n.data;throw n.error}async safeParseAsync(e,r){const n={common:{issues:[],contextualErrorMap:r==null?void 0:r.errorMap,async:!0},path:(r==null?void 0:r.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:nt(e)},s=this._parse({data:e,path:n.path,parent:n}),a=await(rr(s)?s:Promise.resolve(s));return Pn(n,a)}refine(e,r){const n=s=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(s):r;return this._refinement((s,a)=>{const i=e(s),o=()=>a.addIssue({code:E.custom,...n(s)});return typeof Promise<"u"&&i instanceof Promise?i.then(c=>c?!0:(o(),!1)):i?!0:(o(),!1)})}refinement(e,r){return this._refinement((n,s)=>e(n)?!0:(s.addIssue(typeof r=="function"?r(n,s):r),!1))}_refinement(e){return new St({schema:this,typeName:Y.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:r=>this["~validate"](r)}}optional(){return ot.create(this,this._def)}nullable(){return Ct.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Xe.create(this)}promise(){return ir.create(this,this._def)}or(e){return sr.create([this,e],this._def)}and(e){return ar.create(this,e,this._def)}transform(e){return new St({...re(this._def),schema:this,typeName:Y.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const r=typeof e=="function"?e:()=>e;return new Mr({...re(this._def),innerType:this,defaultValue:r,typeName:Y.ZodDefault})}brand(){return new Ii({typeName:Y.ZodBranded,type:this,...re(this._def)})}catch(e){const r=typeof e=="function"?e:()=>e;return new Vr({...re(this._def),innerType:this,catchValue:r,typeName:Y.ZodCatch})}describe(e){const r=this.constructor;return new r({...this._def,description:e})}pipe(e){return en.create(this,e)}readonly(){return $r.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const fi=/^c[^\s-]{8,}$/i,hi=/^[0-9a-z]+$/,pi=/^[0-9A-HJKMNP-TV-Z]{26}$/i,mi=/^[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,yi=/^[a-z0-9_-]{21}$/i,gi=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,vi=/^[-+]?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)?)??$/,xi=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,bi="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let xr;const _i=/^(?:(?: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])$/,wi=/^(?:(?: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])$/,ki=/^(([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]))$/,Si=/^(([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])$/,Ci=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Ei=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Ts="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Ri=new RegExp(`^${Ts}$`);function Ps(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);const r=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function Oi(t){return new RegExp(`^${Ps(t)}$`)}function ji(t){let e=`${Ts}T${Ps(t)}`;const r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function Ni(t,e){return!!((e==="v4"||!e)&&_i.test(t)||(e==="v6"||!e)&&ki.test(t))}function Ai(t,e){if(!gi.test(t))return!1;try{const[r]=t.split(".");if(!r)return!1;const n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),s=JSON.parse(atob(n));return!(typeof s!="object"||s===null||"typ"in s&&(s==null?void 0:s.typ)!=="JWT"||!s.alg||e&&s.alg!==e)}catch{return!1}}function Ti(t,e){return!!((e==="v4"||!e)&&wi.test(t)||(e==="v6"||!e)&&Si.test(t))}class it extends ce{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==$.string){const a=this._getOrReturnCtx(e);return P(a,{code:E.invalid_type,expected:$.string,received:a.parsedType}),H}const n=new $e;let s;for(const a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(s=this._getOrReturnCtx(e,s),P(s,{code:E.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="max")e.data.length>a.value&&(s=this._getOrReturnCtx(e,s),P(s,{code:E.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="length"){const i=e.data.length>a.value,o=e.data.length<a.value;(i||o)&&(s=this._getOrReturnCtx(e,s),i?P(s,{code:E.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):o&&P(s,{code:E.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),n.dirty())}else if(a.kind==="email")xi.test(e.data)||(s=this._getOrReturnCtx(e,s),P(s,{validation:"email",code:E.invalid_string,message:a.message}),n.dirty());else if(a.kind==="emoji")xr||(xr=new RegExp(bi,"u")),xr.test(e.data)||(s=this._getOrReturnCtx(e,s),P(s,{validation:"emoji",code:E.invalid_string,message:a.message}),n.dirty());else if(a.kind==="uuid")mi.test(e.data)||(s=this._getOrReturnCtx(e,s),P(s,{validation:"uuid",code:E.invalid_string,message:a.message}),n.dirty());else if(a.kind==="nanoid")yi.test(e.data)||(s=this._getOrReturnCtx(e,s),P(s,{validation:"nanoid",code:E.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid")fi.test(e.data)||(s=this._getOrReturnCtx(e,s),P(s,{validation:"cuid",code:E.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid2")hi.test(e.data)||(s=this._getOrReturnCtx(e,s),P(s,{validation:"cuid2",code:E.invalid_string,message:a.message}),n.dirty());else if(a.kind==="ulid")pi.test(e.data)||(s=this._getOrReturnCtx(e,s),P(s,{validation:"ulid",code:E.invalid_string,message:a.message}),n.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),P(s,{validation:"url",code:E.invalid_string,message:a.message}),n.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),P(s,{validation:"regex",code:E.invalid_string,message:a.message}),n.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(s=this._getOrReturnCtx(e,s),P(s,{code:E.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),n.dirty()):a.kind==="toLowerCase"?e.data=e.data.toLowerCase():a.kind==="toUpperCase"?e.data=e.data.toUpperCase():a.kind==="startsWith"?e.data.startsWith(a.value)||(s=this._getOrReturnCtx(e,s),P(s,{code:E.invalid_string,validation:{startsWith:a.value},message:a.message}),n.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(s=this._getOrReturnCtx(e,s),P(s,{code:E.invalid_string,validation:{endsWith:a.value},message:a.message}),n.dirty()):a.kind==="datetime"?ji(a).test(e.data)||(s=this._getOrReturnCtx(e,s),P(s,{code:E.invalid_string,validation:"datetime",message:a.message}),n.dirty()):a.kind==="date"?Ri.test(e.data)||(s=this._getOrReturnCtx(e,s),P(s,{code:E.invalid_string,validation:"date",message:a.message}),n.dirty()):a.kind==="time"?Oi(a).test(e.data)||(s=this._getOrReturnCtx(e,s),P(s,{code:E.invalid_string,validation:"time",message:a.message}),n.dirty()):a.kind==="duration"?vi.test(e.data)||(s=this._getOrReturnCtx(e,s),P(s,{validation:"duration",code:E.invalid_string,message:a.message}),n.dirty()):a.kind==="ip"?Ni(e.data,a.version)||(s=this._getOrReturnCtx(e,s),P(s,{validation:"ip",code:E.invalid_string,message:a.message}),n.dirty()):a.kind==="jwt"?Ai(e.data,a.alg)||(s=this._getOrReturnCtx(e,s),P(s,{validation:"jwt",code:E.invalid_string,message:a.message}),n.dirty()):a.kind==="cidr"?Ti(e.data,a.version)||(s=this._getOrReturnCtx(e,s),P(s,{validation:"cidr",code:E.invalid_string,message:a.message}),n.dirty()):a.kind==="base64"?Ci.test(e.data)||(s=this._getOrReturnCtx(e,s),P(s,{validation:"base64",code:E.invalid_string,message:a.message}),n.dirty()):a.kind==="base64url"?Ei.test(e.data)||(s=this._getOrReturnCtx(e,s),P(s,{validation:"base64url",code:E.invalid_string,message:a.message}),n.dirty()):le.assertNever(a);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(s=>e.test(s),{validation:r,code:E.invalid_string,...F.errToObj(n)})}_addCheck(e){return new it({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...F.errToObj(e)})}url(e){return this._addCheck({kind:"url",...F.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...F.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...F.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...F.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...F.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...F.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...F.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...F.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...F.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...F.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...F.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...F.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,...F.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,...F.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...F.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...F.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r==null?void 0:r.position,...F.errToObj(r==null?void 0:r.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...F.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...F.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...F.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...F.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...F.errToObj(r)})}nonempty(e){return this.min(1,F.errToObj(e))}trim(){return new it({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new it({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new it({...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 r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}}it.create=t=>new it({checks:[],typeName:Y.ZodString,coerce:(t==null?void 0:t.coerce)??!1,...re(t)});function Pi(t,e){const r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,s=r>n?r:n,a=Number.parseInt(t.toFixed(s).replace(".","")),i=Number.parseInt(e.toFixed(s).replace(".",""));return a%i/10**s}class Mt extends ce{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)!==$.number){const a=this._getOrReturnCtx(e);return P(a,{code:E.invalid_type,expected:$.number,received:a.parsedType}),H}let n;const s=new $e;for(const a of this._def.checks)a.kind==="int"?le.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),P(n,{code:E.invalid_type,expected:"integer",received:"float",message:a.message}),s.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),P(n,{code:E.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),P(n,{code:E.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):a.kind==="multipleOf"?Pi(e.data,a.value)!==0&&(n=this._getOrReturnCtx(e,n),P(n,{code:E.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),P(n,{code:E.not_finite,message:a.message}),s.dirty()):le.assertNever(a);return{status:s.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,F.toString(r))}gt(e,r){return this.setLimit("min",e,!1,F.toString(r))}lte(e,r){return this.setLimit("max",e,!0,F.toString(r))}lt(e,r){return this.setLimit("max",e,!1,F.toString(r))}setLimit(e,r,n,s){return new Mt({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:F.toString(s)}]})}_addCheck(e){return new Mt({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:F.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:F.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:F.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:F.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:F.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:F.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:F.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:F.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:F.toString(e)})}get minValue(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&le.isInteger(e.value))}get isFinite(){let e=null,r=null;for(const n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(r)&&Number.isFinite(e)}}Mt.create=t=>new Mt({checks:[],typeName:Y.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...re(t)});class Vt extends ce{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)!==$.bigint)return this._getInvalidInput(e);let n;const s=new $e;for(const a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),P(n,{code:E.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),s.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),P(n,{code:E.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),s.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),P(n,{code:E.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):le.assertNever(a);return{status:s.value,value:e.data}}_getInvalidInput(e){const r=this._getOrReturnCtx(e);return P(r,{code:E.invalid_type,expected:$.bigint,received:r.parsedType}),H}gte(e,r){return this.setLimit("min",e,!0,F.toString(r))}gt(e,r){return this.setLimit("min",e,!1,F.toString(r))}lte(e,r){return this.setLimit("max",e,!0,F.toString(r))}lt(e,r){return this.setLimit("max",e,!1,F.toString(r))}setLimit(e,r,n,s){return new Vt({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:F.toString(s)}]})}_addCheck(e){return new Vt({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:F.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:F.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:F.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:F.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:F.toString(r)})}get minValue(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}}Vt.create=t=>new Vt({checks:[],typeName:Y.ZodBigInt,coerce:(t==null?void 0:t.coerce)??!1,...re(t)});class In extends ce{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==$.boolean){const n=this._getOrReturnCtx(e);return P(n,{code:E.invalid_type,expected:$.boolean,received:n.parsedType}),H}return Be(e.data)}}In.create=t=>new In({typeName:Y.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...re(t)});class nr extends ce{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==$.date){const a=this._getOrReturnCtx(e);return P(a,{code:E.invalid_type,expected:$.date,received:a.parsedType}),H}if(Number.isNaN(e.data.getTime())){const a=this._getOrReturnCtx(e);return P(a,{code:E.invalid_date}),H}const n=new $e;let s;for(const a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(s=this._getOrReturnCtx(e,s),P(s,{code:E.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),n.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(s=this._getOrReturnCtx(e,s),P(s,{code:E.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),n.dirty()):le.assertNever(a);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new nr({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:F.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:F.toString(r)})}get minDate(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}}nr.create=t=>new nr({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:Y.ZodDate,...re(t)});class Ln extends ce{_parse(e){if(this._getType(e)!==$.symbol){const n=this._getOrReturnCtx(e);return P(n,{code:E.invalid_type,expected:$.symbol,received:n.parsedType}),H}return Be(e.data)}}Ln.create=t=>new Ln({typeName:Y.ZodSymbol,...re(t)});class Mn extends ce{_parse(e){if(this._getType(e)!==$.undefined){const n=this._getOrReturnCtx(e);return P(n,{code:E.invalid_type,expected:$.undefined,received:n.parsedType}),H}return Be(e.data)}}Mn.create=t=>new Mn({typeName:Y.ZodUndefined,...re(t)});class Vn extends ce{_parse(e){if(this._getType(e)!==$.null){const n=this._getOrReturnCtx(e);return P(n,{code:E.invalid_type,expected:$.null,received:n.parsedType}),H}return Be(e.data)}}Vn.create=t=>new Vn({typeName:Y.ZodNull,...re(t)});class $n extends ce{constructor(){super(...arguments),this._any=!0}_parse(e){return Be(e.data)}}$n.create=t=>new $n({typeName:Y.ZodAny,...re(t)});class Fn extends ce{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Be(e.data)}}Fn.create=t=>new Fn({typeName:Y.ZodUnknown,...re(t)});class ut extends ce{_parse(e){const r=this._getOrReturnCtx(e);return P(r,{code:E.invalid_type,expected:$.never,received:r.parsedType}),H}}ut.create=t=>new ut({typeName:Y.ZodNever,...re(t)});class Dn extends ce{_parse(e){if(this._getType(e)!==$.undefined){const n=this._getOrReturnCtx(e);return P(n,{code:E.invalid_type,expected:$.void,received:n.parsedType}),H}return Be(e.data)}}Dn.create=t=>new Dn({typeName:Y.ZodVoid,...re(t)});class Xe extends ce{_parse(e){const{ctx:r,status:n}=this._processInputParams(e),s=this._def;if(r.parsedType!==$.array)return P(r,{code:E.invalid_type,expected:$.array,received:r.parsedType}),H;if(s.exactLength!==null){const i=r.data.length>s.exactLength.value,o=r.data.length<s.exactLength.value;(i||o)&&(P(r,{code:i?E.too_big:E.too_small,minimum:o?s.exactLength.value:void 0,maximum:i?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),n.dirty())}if(s.minLength!==null&&r.data.length<s.minLength.value&&(P(r,{code:E.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),n.dirty()),s.maxLength!==null&&r.data.length>s.maxLength.value&&(P(r,{code:E.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((i,o)=>s.type._parseAsync(new lt(r,i,r.path,o)))).then(i=>$e.mergeArray(n,i));const a=[...r.data].map((i,o)=>s.type._parseSync(new lt(r,i,r.path,o)));return $e.mergeArray(n,a)}get element(){return this._def.type}min(e,r){return new Xe({...this._def,minLength:{value:e,message:F.toString(r)}})}max(e,r){return new Xe({...this._def,maxLength:{value:e,message:F.toString(r)}})}length(e,r){return new Xe({...this._def,exactLength:{value:e,message:F.toString(r)}})}nonempty(e){return this.min(1,e)}}Xe.create=(t,e)=>new Xe({type:t,minLength:null,maxLength:null,exactLength:null,typeName:Y.ZodArray,...re(e)});function bt(t){if(t instanceof Se){const e={};for(const r in t.shape){const n=t.shape[r];e[r]=ot.create(bt(n))}return new Se({...t._def,shape:()=>e})}else return t instanceof Xe?new Xe({...t._def,type:bt(t.element)}):t instanceof ot?ot.create(bt(t.unwrap())):t instanceof Ct?Ct.create(bt(t.unwrap())):t instanceof mt?mt.create(t.items.map(e=>bt(e))):t}class Se extends ce{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(),r=le.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==$.object){const l=this._getOrReturnCtx(e);return P(l,{code:E.invalid_type,expected:$.object,received:l.parsedType}),H}const{status:n,ctx:s}=this._processInputParams(e),{shape:a,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof ut&&this._def.unknownKeys==="strip"))for(const l in s.data)i.includes(l)||o.push(l);const c=[];for(const l of i){const h=a[l],f=s.data[l];c.push({key:{status:"valid",value:l},value:h._parse(new lt(s,f,s.path,l)),alwaysSet:l in s.data})}if(this._def.catchall instanceof ut){const l=this._def.unknownKeys;if(l==="passthrough")for(const h of o)c.push({key:{status:"valid",value:h},value:{status:"valid",value:s.data[h]}});else if(l==="strict")o.length>0&&(P(s,{code:E.unrecognized_keys,keys:o}),n.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const l=this._def.catchall;for(const h of o){const f=s.data[h];c.push({key:{status:"valid",value:h},value:l._parse(new lt(s,f,s.path,h)),alwaysSet:h in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const l=[];for(const h of c){const f=await h.key,p=await h.value;l.push({key:f,value:p,alwaysSet:h.alwaysSet})}return l}).then(l=>$e.mergeObjectSync(n,l)):$e.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(e){return F.errToObj,new Se({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{var a,i;const s=((i=(a=this._def).errorMap)==null?void 0:i.call(a,r,n).message)??n.defaultError;return r.code==="unrecognized_keys"?{message:F.errToObj(e).message??s}:{message:s}}}:{}})}strip(){return new Se({...this._def,unknownKeys:"strip"})}passthrough(){return new Se({...this._def,unknownKeys:"passthrough"})}extend(e){return new Se({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Se({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Y.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new Se({...this._def,catchall:e})}pick(e){const r={};for(const n of le.objectKeys(e))e[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new Se({...this._def,shape:()=>r})}omit(e){const r={};for(const n of le.objectKeys(this.shape))e[n]||(r[n]=this.shape[n]);return new Se({...this._def,shape:()=>r})}deepPartial(){return bt(this)}partial(e){const r={};for(const n of le.objectKeys(this.shape)){const s=this.shape[n];e&&!e[n]?r[n]=s:r[n]=s.optional()}return new Se({...this._def,shape:()=>r})}required(e){const r={};for(const n of le.objectKeys(this.shape))if(e&&!e[n])r[n]=this.shape[n];else{let a=this.shape[n];for(;a instanceof ot;)a=a._def.innerType;r[n]=a}return new Se({...this._def,shape:()=>r})}keyof(){return Is(le.objectKeys(this.shape))}}Se.create=(t,e)=>new Se({shape:()=>t,unknownKeys:"strip",catchall:ut.create(),typeName:Y.ZodObject,...re(e)});Se.strictCreate=(t,e)=>new Se({shape:()=>t,unknownKeys:"strict",catchall:ut.create(),typeName:Y.ZodObject,...re(e)});Se.lazycreate=(t,e)=>new Se({shape:t,unknownKeys:"strip",catchall:ut.create(),typeName:Y.ZodObject,...re(e)});class sr extends ce{_parse(e){const{ctx:r}=this._processInputParams(e),n=this._def.options;function s(a){for(const o of a)if(o.result.status==="valid")return o.result;for(const o of a)if(o.result.status==="dirty")return r.common.issues.push(...o.ctx.common.issues),o.result;const i=a.map(o=>new et(o.ctx.common.issues));return P(r,{code:E.invalid_union,unionErrors:i}),H}if(r.common.async)return Promise.all(n.map(async a=>{const i={...r,common:{...r.common,issues:[]},parent:null};return{result:await a._parseAsync({data:r.data,path:r.path,parent:i}),ctx:i}})).then(s);{let a;const i=[];for(const c of n){const l={...r,common:{...r.common,issues:[]},parent:null},h=c._parseSync({data:r.data,path:r.path,parent:l});if(h.status==="valid")return h;h.status==="dirty"&&!a&&(a={result:h,ctx:l}),l.common.issues.length&&i.push(l.common.issues)}if(a)return r.common.issues.push(...a.ctx.common.issues),a.result;const o=i.map(c=>new et(c));return P(r,{code:E.invalid_union,unionErrors:o}),H}}get options(){return this._def.options}}sr.create=(t,e)=>new sr({options:t,typeName:Y.ZodUnion,...re(e)});function Ir(t,e){const r=nt(t),n=nt(e);if(t===e)return{valid:!0,data:t};if(r===$.object&&n===$.object){const s=le.objectKeys(e),a=le.objectKeys(t).filter(o=>s.indexOf(o)!==-1),i={...t,...e};for(const o of a){const c=Ir(t[o],e[o]);if(!c.valid)return{valid:!1};i[o]=c.data}return{valid:!0,data:i}}else if(r===$.array&&n===$.array){if(t.length!==e.length)return{valid:!1};const s=[];for(let a=0;a<t.length;a++){const i=t[a],o=e[a],c=Ir(i,o);if(!c.valid)return{valid:!1};s.push(c.data)}return{valid:!0,data:s}}else return r===$.date&&n===$.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}class ar extends ce{_parse(e){const{status:r,ctx:n}=this._processInputParams(e),s=(a,i)=>{if(An(a)||An(i))return H;const o=Ir(a.value,i.value);return o.valid?((Tn(a)||Tn(i))&&r.dirty(),{status:r.value,value:o.data}):(P(n,{code:E.invalid_intersection_types}),H)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([a,i])=>s(a,i)):s(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}ar.create=(t,e,r)=>new ar({left:t,right:e,typeName:Y.ZodIntersection,...re(r)});class mt extends ce{_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==$.array)return P(n,{code:E.invalid_type,expected:$.array,received:n.parsedType}),H;if(n.data.length<this._def.items.length)return P(n,{code:E.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),H;!this._def.rest&&n.data.length>this._def.items.length&&(P(n,{code:E.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());const a=[...n.data].map((i,o)=>{const c=this._def.items[o]||this._def.rest;return c?c._parse(new lt(n,i,n.path,o)):null}).filter(i=>!!i);return n.common.async?Promise.all(a).then(i=>$e.mergeArray(r,i)):$e.mergeArray(r,a)}get items(){return this._def.items}rest(e){return new mt({...this._def,rest:e})}}mt.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new mt({items:t,typeName:Y.ZodTuple,rest:null,...re(e)})};class Un extends ce{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==$.map)return P(n,{code:E.invalid_type,expected:$.map,received:n.parsedType}),H;const s=this._def.keyType,a=this._def.valueType,i=[...n.data.entries()].map(([o,c],l)=>({key:s._parse(new lt(n,o,n.path,[l,"key"])),value:a._parse(new lt(n,c,n.path,[l,"value"]))}));if(n.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const c of i){const l=await c.key,h=await c.value;if(l.status==="aborted"||h.status==="aborted")return H;(l.status==="dirty"||h.status==="dirty")&&r.dirty(),o.set(l.value,h.value)}return{status:r.value,value:o}})}else{const o=new Map;for(const c of i){const l=c.key,h=c.value;if(l.status==="aborted"||h.status==="aborted")return H;(l.status==="dirty"||h.status==="dirty")&&r.dirty(),o.set(l.value,h.value)}return{status:r.value,value:o}}}}Un.create=(t,e,r)=>new Un({valueType:e,keyType:t,typeName:Y.ZodMap,...re(r)});class $t extends ce{_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==$.set)return P(n,{code:E.invalid_type,expected:$.set,received:n.parsedType}),H;const s=this._def;s.minSize!==null&&n.data.size<s.minSize.value&&(P(n,{code:E.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),r.dirty()),s.maxSize!==null&&n.data.size>s.maxSize.value&&(P(n,{code:E.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),r.dirty());const a=this._def.valueType;function i(c){const l=new Set;for(const h of c){if(h.status==="aborted")return H;h.status==="dirty"&&r.dirty(),l.add(h.value)}return{status:r.value,value:l}}const o=[...n.data.values()].map((c,l)=>a._parse(new lt(n,c,n.path,l)));return n.common.async?Promise.all(o).then(c=>i(c)):i(o)}min(e,r){return new $t({...this._def,minSize:{value:e,message:F.toString(r)}})}max(e,r){return new $t({...this._def,maxSize:{value:e,message:F.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}}$t.create=(t,e)=>new $t({valueType:t,minSize:null,maxSize:null,typeName:Y.ZodSet,...re(e)});class zn extends ce{get schema(){return this._def.getter()}_parse(e){const{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}}zn.create=(t,e)=>new zn({getter:t,typeName:Y.ZodLazy,...re(e)});class Lr extends ce{_parse(e){if(e.data!==this._def.value){const r=this._getOrReturnCtx(e);return P(r,{received:r.data,code:E.invalid_literal,expected:this._def.value}),H}return{status:"valid",value:e.data}}get value(){return this._def.value}}Lr.create=(t,e)=>new Lr({value:t,typeName:Y.ZodLiteral,...re(e)});function Is(t,e){return new kt({values:t,typeName:Y.ZodEnum,...re(e)})}class kt extends ce{_parse(e){if(typeof e.data!="string"){const r=this._getOrReturnCtx(e),n=this._def.values;return P(r,{expected:le.joinValues(n),received:r.parsedType,code:E.invalid_type}),H}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const r=this._getOrReturnCtx(e),n=this._def.values;return P(r,{received:r.data,code:E.invalid_enum_value,options:n}),H}return Be(e.data)}get options(){return this._def.values}get enum(){const e={};for(const r of this._def.values)e[r]=r;return e}get Values(){const e={};for(const r of this._def.values)e[r]=r;return e}get Enum(){const e={};for(const r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return kt.create(e,{...this._def,...r})}exclude(e,r=this._def){return kt.create(this.options.filter(n=>!e.includes(n)),{...this._def,...r})}}kt.create=Is;class Bn extends ce{_parse(e){const r=le.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==$.string&&n.parsedType!==$.number){const s=le.objectValues(r);return P(n,{expected:le.joinValues(s),received:n.parsedType,code:E.invalid_type}),H}if(this._cache||(this._cache=new Set(le.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const s=le.objectValues(r);return P(n,{received:n.data,code:E.invalid_enum_value,options:s}),H}return Be(e.data)}get enum(){return this._def.values}}Bn.create=(t,e)=>new Bn({values:t,typeName:Y.ZodNativeEnum,...re(e)});class ir extends ce{unwrap(){return this._def.type}_parse(e){const{ctx:r}=this._processInputParams(e);if(r.parsedType!==$.promise&&r.common.async===!1)return P(r,{code:E.invalid_type,expected:$.promise,received:r.parsedType}),H;const n=r.parsedType===$.promise?r.data:Promise.resolve(r.data);return Be(n.then(s=>this._def.type.parseAsync(s,{path:r.path,errorMap:r.common.contextualErrorMap})))}}ir.create=(t,e)=>new ir({type:t,typeName:Y.ZodPromise,...re(e)});class St extends ce{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Y.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:r,ctx:n}=this._processInputParams(e),s=this._def.effect||null,a={addIssue:i=>{P(n,i),i.fatal?r.abort():r.dirty()},get path(){return n.path}};if(a.addIssue=a.addIssue.bind(a),s.type==="preprocess"){const i=s.transform(n.data,a);if(n.common.async)return Promise.resolve(i).then(async o=>{if(r.value==="aborted")return H;const c=await this._def.schema._parseAsync({data:o,path:n.path,parent:n});return c.status==="aborted"?H:c.status==="dirty"||r.value==="dirty"?Pt(c.value):c});{if(r.value==="aborted")return H;const o=this._def.schema._parseSync({data:i,path:n.path,parent:n});return o.status==="aborted"?H:o.status==="dirty"||r.value==="dirty"?Pt(o.value):o}}if(s.type==="refinement"){const i=o=>{const c=s.refinement(o,a);if(n.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(n.common.async===!1){const o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?H:(o.status==="dirty"&&r.dirty(),i(o.value),{status:r.value,value:o.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>o.status==="aborted"?H:(o.status==="dirty"&&r.dirty(),i(o.value).then(()=>({status:r.value,value:o.value}))))}if(s.type==="transform")if(n.common.async===!1){const i=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!wt(i))return H;const o=s.transform(i.value,a);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:o}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(i=>wt(i)?Promise.resolve(s.transform(i.value,a)).then(o=>({status:r.value,value:o})):H);le.assertNever(s)}}St.create=(t,e,r)=>new St({schema:t,typeName:Y.ZodEffects,effect:e,...re(r)});St.createWithPreprocess=(t,e,r)=>new St({schema:e,effect:{type:"preprocess",transform:t},typeName:Y.ZodEffects,...re(r)});class ot extends ce{_parse(e){return this._getType(e)===$.undefined?Be(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ot.create=(t,e)=>new ot({innerType:t,typeName:Y.ZodOptional,...re(e)});class Ct extends ce{_parse(e){return this._getType(e)===$.null?Be(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Ct.create=(t,e)=>new Ct({innerType:t,typeName:Y.ZodNullable,...re(e)});class Mr extends ce{_parse(e){const{ctx:r}=this._processInputParams(e);let n=r.data;return r.parsedType===$.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}}Mr.create=(t,e)=>new Mr({innerType:t,typeName:Y.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...re(e)});class Vr extends ce{_parse(e){const{ctx:r}=this._processInputParams(e),n={...r,common:{...r.common,issues:[]}},s=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return rr(s)?s.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new et(n.common.issues)},input:n.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new et(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}Vr.create=(t,e)=>new Vr({innerType:t,typeName:Y.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...re(e)});class Zn extends ce{_parse(e){if(this._getType(e)!==$.nan){const n=this._getOrReturnCtx(e);return P(n,{code:E.invalid_type,expected:$.nan,received:n.parsedType}),H}return{status:"valid",value:e.data}}}Zn.create=t=>new Zn({typeName:Y.ZodNaN,...re(t)});class Ii extends ce{_parse(e){const{ctx:r}=this._processInputParams(e),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}}class en extends ce{_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{const a=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?H:a.status==="dirty"?(r.dirty(),Pt(a.value)):this._def.out._parseAsync({data:a.value,path:n.path,parent:n})})();{const s=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?H:s.status==="dirty"?(r.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:n.path,parent:n})}}static create(e,r){return new en({in:e,out:r,typeName:Y.ZodPipeline})}}class $r extends ce{_parse(e){const r=this._def.innerType._parse(e),n=s=>(wt(s)&&(s.value=Object.freeze(s.value)),s);return rr(r)?r.then(s=>n(s)):n(r)}unwrap(){return this._def.innerType}}$r.create=(t,e)=>new $r({innerType:t,typeName:Y.ZodReadonly,...re(e)});var Y;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(Y||(Y={}));const Je=it.create;ut.create;Xe.create;const fr=Se.create;sr.create;ar.create;mt.create;const Li=Lr.create;kt.create;ir.create;ot.create;Ct.create;/**
|
|
2
2
|
* @license lucide-react v0.468.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|