@service_laboratory/auth 4.0.6 → 4.0.8

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.
@@ -1,49 +1,44 @@
1
- (function(G,V){typeof exports=="object"&&typeof module<"u"?V(exports,require("react"),require("@service_laboratory/ui"),require("lucide-react"),require("@tanstack/react-router"),require("@tanstack/store")):typeof define=="function"&&define.amd?define(["exports","react","@service_laboratory/ui","lucide-react","@tanstack/react-router","@tanstack/store"],V):(G=typeof globalThis<"u"?globalThis:G||self,V(G.auth={},G.react,G["@service_laboratory/ui"],G["lucide-react"],G["@tanstack/react-router"],G["@tanstack/store"]))})(this,(function(G,V,b,Oe,xe,xr){"use strict";var mt={exports:{}},et={};var kr;function Ss(){if(kr)return et;kr=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function r(n,s,o){var i=null;if(o!==void 0&&(i=""+o),s.key!==void 0&&(i=""+s.key),"key"in s){o={};for(var a in s)a!=="key"&&(o[a]=s[a])}else o=s;return s=o.ref,{$$typeof:e,type:n,key:i,ref:s!==void 0?s:null,props:o}}return et.Fragment=t,et.jsx=r,et.jsxs=r,et}var tt={};var Er;function xs(){return Er||(Er=1,process.env.NODE_ENV!=="production"&&(function(){function e(l){if(l==null)return null;if(typeof l=="function")return l.$$typeof===ze?null:l.displayName||l.name||null;if(typeof l=="string")return l;switch(l){case j:return"Fragment";case P:return"Profiler";case D:return"StrictMode";case M:return"Suspense";case K:return"SuspenseList";case Q:return"Activity"}if(typeof l=="object")switch(typeof l.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),l.$$typeof){case k:return"Portal";case L:return l.displayName||"Context";case Z:return(l._context.displayName||"Context")+".Consumer";case C:var S=l.render;return l=l.displayName,l||(l=S.displayName||S.name||"",l=l!==""?"ForwardRef("+l+")":"ForwardRef"),l;case ae:return S=l.displayName||null,S!==null?S:e(l.type)||"Memo";case se:S=l._payload,l=l._init;try{return e(l(S))}catch{}}return null}function t(l){return""+l}function r(l){try{t(l);var S=!1}catch{S=!0}if(S){S=console;var z=S.error,I=typeof Symbol=="function"&&Symbol.toStringTag&&l[Symbol.toStringTag]||l.constructor.name||"Object";return z.call(S,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",I),t(l)}}function n(l){if(l===j)return"<>";if(typeof l=="object"&&l!==null&&l.$$typeof===se)return"<...>";try{var S=e(l);return S?"<"+S+">":"<...>"}catch{return"<...>"}}function s(){var l=T.A;return l===null?null:l.getOwner()}function o(){return Error("react-stack-top-frame")}function i(l){if(N.call(l,"key")){var S=Object.getOwnPropertyDescriptor(l,"key").get;if(S&&S.isReactWarning)return!1}return l.key!==void 0}function a(l,S){function z(){Y||(Y=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",S))}z.isReactWarning=!0,Object.defineProperty(l,"key",{get:z,configurable:!0})}function u(){var l=e(this.type);return H[l]||(H[l]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),l=this.props.ref,l!==void 0?l:null}function c(l,S,z,I,Ce,Ne){var U=z.ref;return l={$$typeof:_,type:l,key:S,props:z,_owner:I},(U!==void 0?U:null)!==null?Object.defineProperty(l,"ref",{enumerable:!1,get:u}):Object.defineProperty(l,"ref",{enumerable:!1,value:null}),l._store={},Object.defineProperty(l._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(l,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(l,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:Ce}),Object.defineProperty(l,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:Ne}),Object.freeze&&(Object.freeze(l.props),Object.freeze(l)),l}function h(l,S,z,I,Ce,Ne){var U=S.children;if(U!==void 0)if(I)if(B(U)){for(I=0;I<U.length;I++)d(U[I]);Object.freeze&&Object.freeze(U)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else d(U);if(N.call(S,"key")){U=e(l);var pe=Object.keys(S).filter(function(Je){return Je!=="key"});I=0<pe.length?"{key: someKey, "+pe.join(": ..., ")+": ...}":"{key: someKey}",Se[U+I]||(pe=0<pe.length?"{"+pe.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
1
+ (function(U,P){typeof exports=="object"&&typeof module<"u"?P(exports,require("react"),require("@service_laboratory/ui"),require("lucide-react"),require("@tanstack/react-router"),require("@service_laboratory/locale"),require("@tanstack/store")):typeof define=="function"&&define.amd?define(["exports","react","@service_laboratory/ui","lucide-react","@tanstack/react-router","@service_laboratory/locale","@tanstack/store"],P):(U=typeof globalThis<"u"?globalThis:U||self,P(U.auth={},U.react,U["@service_laboratory/ui"],U["lucide-react"],U["@tanstack/react-router"],U["@service_laboratory/locale"],U["@tanstack/store"]))})(this,(function(U,P,p,ve,ge,Zn,rr){"use strict";var it={exports:{}},Ke={};var nr;function In(){if(nr)return Ke;nr=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function r(n,o,i){var s=null;if(i!==void 0&&(s=""+i),o.key!==void 0&&(s=""+o.key),"key"in o){i={};for(var a in o)a!=="key"&&(i[a]=o[a])}else i=o;return o=i.ref,{$$typeof:e,type:n,key:s,ref:o!==void 0?o:null,props:i}}return Ke.Fragment=t,Ke.jsx=r,Ke.jsxs=r,Ke}var Ge={};var or;function Ln(){return or||(or=1,process.env.NODE_ENV!=="production"&&(function(){function e(_){if(_==null)return null;if(typeof _=="function")return _.$$typeof===Je?null:_.displayName||_.name||null;if(typeof _=="string")return _;switch(_){case T:return"Fragment";case j:return"Profiler";case L:return"StrictMode";case M:return"Suspense";case K:return"SuspenseList";case he:return"Activity"}if(typeof _=="object")switch(typeof _.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),_.$$typeof){case S:return"Portal";case D:return _.displayName||"Context";case I:return(_._context.displayName||"Context")+".Consumer";case C:var $=_.render;return _=_.displayName,_||(_=$.displayName||$.name||"",_=_!==""?"ForwardRef("+_+")":"ForwardRef"),_;case fe:return $=_.displayName||null,$!==null?$:e(_.type)||"Memo";case Se:$=_._payload,_=_._init;try{return e(_($))}catch{}}return null}function t(_){return""+_}function r(_){try{t(_);var $=!1}catch{$=!0}if($){$=console;var W=$.error,G=typeof Symbol=="function"&&Symbol.toStringTag&&_[Symbol.toStringTag]||_.constructor.name||"Object";return W.call($,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",G),t(_)}}function n(_){if(_===T)return"<>";if(typeof _=="object"&&_!==null&&_.$$typeof===Se)return"<...>";try{var $=e(_);return $?"<"+$+">":"<...>"}catch{return"<...>"}}function o(){var _=A.A;return _===null?null:_.getOwner()}function i(){return Error("react-stack-top-frame")}function s(_){if(Z.call(_,"key")){var $=Object.getOwnPropertyDescriptor(_,"key").get;if($&&$.isReactWarning)return!1}return _.key!==void 0}function a(_,$){function W(){pe||(pe=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",$))}W.isReactWarning=!0,Object.defineProperty(_,"key",{get:W,configurable:!0})}function l(){var _=e(this.type);return ce[_]||(ce[_]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),_=this.props.ref,_!==void 0?_:null}function d(_,$,W,G,We,qe){var X=W.ref;return _={$$typeof:O,type:_,key:$,props:W,_owner:G},(X!==void 0?X:null)!==null?Object.defineProperty(_,"ref",{enumerable:!1,get:l}):Object.defineProperty(_,"ref",{enumerable:!1,value:null}),_._store={},Object.defineProperty(_._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(_,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(_,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:We}),Object.defineProperty(_,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:qe}),Object.freeze&&(Object.freeze(_.props),Object.freeze(_)),_}function w(_,$,W,G,We,qe){var X=$.children;if(X!==void 0)if(G)if(Y(X)){for(G=0;G<X.length;G++)y(X[G]);Object.freeze&&Object.freeze(X)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else y(X);if(Z.call($,"key")){X=e(_);var ze=Object.keys($).filter(function(st){return st!=="key"});G=0<ze.length?"{key: someKey, "+ze.join(": ..., ")+": ...}":"{key: someKey}",Ae[X+G]||(ze=0<ze.length?"{"+ze.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
2
2
  let props = %s;
3
3
  <%s {...props} />
4
4
  React keys must be passed directly to JSX without using spread:
5
5
  let props = %s;
6
- <%s key={someKey} {...props} />`,I,U,pe,U),Se[U+I]=!0)}if(U=null,z!==void 0&&(r(z),U=""+z),i(S)&&(r(S.key),U=""+S.key),"key"in S){z={};for(var Re in S)Re!=="key"&&(z[Re]=S[Re])}else z=S;return U&&a(z,typeof l=="function"?l.displayName||l.name||"Unknown":l),c(l,U,z,s(),Ce,Ne)}function d(l){y(l)?l._store&&(l._store.validated=1):typeof l=="object"&&l!==null&&l.$$typeof===se&&(l._payload.status==="fulfilled"?y(l._payload.value)&&l._payload.value._store&&(l._payload.value._store.validated=1):l._store&&(l._store.validated=1))}function y(l){return typeof l=="object"&&l!==null&&l.$$typeof===_}var p=V,_=Symbol.for("react.transitional.element"),k=Symbol.for("react.portal"),j=Symbol.for("react.fragment"),D=Symbol.for("react.strict_mode"),P=Symbol.for("react.profiler"),Z=Symbol.for("react.consumer"),L=Symbol.for("react.context"),C=Symbol.for("react.forward_ref"),M=Symbol.for("react.suspense"),K=Symbol.for("react.suspense_list"),ae=Symbol.for("react.memo"),se=Symbol.for("react.lazy"),Q=Symbol.for("react.activity"),ze=Symbol.for("react.client.reference"),T=p.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,N=Object.prototype.hasOwnProperty,B=Array.isArray,ee=console.createTask?console.createTask:function(){return null};p={react_stack_bottom_frame:function(l){return l()}};var Y,H={},he=p.react_stack_bottom_frame.bind(p,o)(),ge=ee(n(o)),Se={};tt.Fragment=j,tt.jsx=function(l,S,z){var I=1e4>T.recentlyCreatedOwnerStacks++;return h(l,S,z,!1,I?Error("react-stack-top-frame"):he,I?ee(n(l)):ge)},tt.jsxs=function(l,S,z){var I=1e4>T.recentlyCreatedOwnerStacks++;return h(l,S,z,!0,I?Error("react-stack-top-frame"):he,I?ee(n(l)):ge)}})()),tt}var Or;function ks(){return Or||(Or=1,process.env.NODE_ENV==="production"?mt.exports=Ss():mt.exports=xs()),mt.exports}var g=ks();const Es=({reset:e,processing:t})=>g.jsx("div",{className:"fixed right-2 top-4",children:g.jsx(b.Button,{onClick:e,variant:t?"destructive":"secondary",size:"icon-sm",className:"cursor-pointer",disabled:t,children:g.jsx(Oe.RefreshCw,{className:b.cn({"animate-spin":t})})})}),me={loginForm:{emailInput:"login-form-email-input",passwordInput:"login-form-password-input",submitButton:"login-form-submit-button",signUpFormLink:"login-form-signup-link",resetPasswordLink:"login-form-reset-password-link"},signupForm:{emailInput:"signup-form-email-input",passwordInput:"signup-form-password-input",submitButton:"signup-form-submit-button"},verifyEmailForm:{authCodeInput:"verify-email-form-auth-code-input",submitButton:"verify-email-form-submit-button"},startResetPasswordForm:{emailInput:"start-reset-password-form-email-input",submitButton:"start-reset-password-form-submit-button"},confirmResetPasswordForm:{authCodeInput:"confirm-reset-password-form-auth-code-input",newPasswordInput:"confirm-reset-password-form-new-password-input",submitButton:"confirm-reset-password-form-submit-button"}};function Os(e){const[t,r]=V.useState(!1);return g.jsx("div",{className:"flex flex-col gap-6",children:g.jsxs(b.Card,{children:[g.jsxs(b.CardHeader,{children:[g.jsx(b.CardTitle,{className:"text-2xl",children:e.i18n.t("auth.confirmResetPasswordForm.form.title")}),g.jsx(b.CardDescription,{children:e.i18n.t("auth.confirmResetPasswordForm.form.description")})]}),g.jsx(b.CardContent,{children:g.jsx(b.Form,{...e.form,children:g.jsx("form",{onSubmit:e.form.handleSubmit(e.submit),children:g.jsxs("div",{className:"flex flex-col gap-6",children:[g.jsxs("div",{className:"grid gap-2",children:[g.jsx(b.Label,{children:e.i18n.t("auth.confirmResetPasswordForm.form.authCodeInputLabel")}),g.jsx(b.FormField,{control:e.form.control,name:"code",render:({field:n})=>g.jsx(b.FormItem,{children:g.jsx(b.FormControl,{children:g.jsx(b.Input,{type:"text",placeholder:"00001234","data-testid":me.confirmResetPasswordForm.authCodeInput,required:!0,...n})})})})]}),g.jsxs("div",{className:"grid gap-2",children:[g.jsx("div",{className:"flex items-center",children:g.jsx(b.Label,{children:e.i18n.t("auth.confirmResetPasswordForm.form.passwordInputLabel")})}),g.jsx(b.FormField,{control:e.form.control,name:"password",render:({field:n,fieldState:s})=>g.jsx(b.FormItem,{children:g.jsx(b.FormControl,{className:"relative",children:g.jsxs(g.Fragment,{children:[g.jsxs("div",{className:"relative",children:[t?g.jsx(Oe.EyeOff,{className:"absolute right-3 top-1/2 transform -translate-y-1/2 text-gray-500 z-10 cursor-pointer",onClick:()=>{r(!1)}}):g.jsx(Oe.EyeIcon,{className:"absolute right-3 top-1/2 transform -translate-y-1/2 text-gray-500 z-10 cursor-pointer",onClick:()=>{r(!0)}}),g.jsx(b.Input,{disabled:e.form.formState.isSubmitting,type:t?"text":"password",placeholder:"********","aria-invalid":!!e.form.formState.errors?.password,"data-testid":me.confirmResetPasswordForm.newPasswordInput,...n,className:"pr-10"})]}),s.invalid&&g.jsx(b.FieldError,{errors:[s.error]})]})})})})]}),g.jsxs(b.Button,{type:"submit",className:"w-full cursor-pointer","data-testid":me.confirmResetPasswordForm.submitButton,children:[e.i18n.t("auth.confirmResetPasswordForm.form.submitButtonLabel"),e.form.formState.isSubmitting&&g.jsx(Oe.Loader2Icon,{className:"animate-spin"})]}),g.jsxs(b.FieldDescription,{className:"text-center",children:[e.i18n.t("auth.confirmResetPasswordForm.form.loginLinkMessage")," ",g.jsx(xe.Link,{to:"/auth/login",children:e.i18n.t("auth.confirmResetPasswordForm.form.loginLink")})]})]})})})})]})})}const R=e=>typeof e=="string",rt=()=>{let e,t;const r=new Promise((n,s)=>{e=n,t=s});return r.resolve=e,r.reject=t,r},Fr=e=>e==null?"":""+e,Fs=(e,t,r)=>{e.forEach(n=>{t[n]&&(r[n]=t[n])})},Ps=/###/g,Pr=e=>e&&e.indexOf("###")>-1?e.replace(Ps,"."):e,jr=e=>!e||R(e),nt=(e,t,r)=>{const n=R(t)?t.split("."):t;let s=0;for(;s<n.length-1;){if(jr(e))return{};const o=Pr(n[s]);!e[o]&&r&&(e[o]=new r),Object.prototype.hasOwnProperty.call(e,o)?e=e[o]:e={},++s}return jr(e)?{}:{obj:e,k:Pr(n[s])}},$r=(e,t,r)=>{const{obj:n,k:s}=nt(e,t,Object);if(n!==void 0||t.length===1){n[s]=r;return}let o=t[t.length-1],i=t.slice(0,t.length-1),a=nt(e,i,Object);for(;a.obj===void 0&&i.length;)o=`${i[i.length-1]}.${o}`,i=i.slice(0,i.length-1),a=nt(e,i,Object),a?.obj&&typeof a.obj[`${a.k}.${o}`]<"u"&&(a.obj=void 0);a.obj[`${a.k}.${o}`]=r},js=(e,t,r,n)=>{const{obj:s,k:o}=nt(e,t,Object);s[o]=s[o]||[],s[o].push(r)},gt=(e,t)=>{const{obj:r,k:n}=nt(e,t);if(r&&Object.prototype.hasOwnProperty.call(r,n))return r[n]},$s=(e,t,r)=>{const n=gt(e,r);return n!==void 0?n:gt(t,r)},Lr=(e,t,r)=>{for(const n in t)n!=="__proto__"&&n!=="constructor"&&(n in e?R(e[n])||e[n]instanceof String||R(t[n])||t[n]instanceof String?r&&(e[n]=t[n]):Lr(e[n],t[n],r):e[n]=t[n]);return e},We=e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var Ls={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"};const zs=e=>R(e)?e.replace(/[&<>"'\/]/g,t=>Ls[t]):e;class Cs{constructor(t){this.capacity=t,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(t){const r=this.regExpMap.get(t);if(r!==void 0)return r;const n=new RegExp(t);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(t,n),this.regExpQueue.push(t),n}}const Ns=[" ",",","?","!",";"],Rs=new Cs(20),As=(e,t,r)=>{t=t||"",r=r||"";const n=Ns.filter(i=>t.indexOf(i)<0&&r.indexOf(i)<0);if(n.length===0)return!0;const s=Rs.getRegExp(`(${n.map(i=>i==="?"?"\\?":i).join("|")})`);let o=!s.test(e);if(!o){const i=e.indexOf(r);i>0&&!s.test(e.substring(0,i))&&(o=!0)}return o},Zt=(e,t,r=".")=>{if(!e)return;if(e[t])return Object.prototype.hasOwnProperty.call(e,t)?e[t]:void 0;const n=t.split(r);let s=e;for(let o=0;o<n.length;){if(!s||typeof s!="object")return;let i,a="";for(let u=o;u<n.length;++u)if(u!==o&&(a+=r),a+=n[u],i=s[a],i!==void 0){if(["string","number","boolean"].indexOf(typeof i)>-1&&u<n.length-1)continue;o+=u-o+1;break}s=i}return s},st=e=>e?.replace("_","-"),Ts={type:"logger",log(e){this.output("log",e)},warn(e){this.output("warn",e)},error(e){this.output("error",e)},output(e,t){console?.[e]?.apply?.(console,t)}};class yt{constructor(t,r={}){this.init(t,r)}init(t,r={}){this.prefix=r.prefix||"i18next:",this.logger=t||Ts,this.options=r,this.debug=r.debug}log(...t){return this.forward(t,"log","",!0)}warn(...t){return this.forward(t,"warn","",!0)}error(...t){return this.forward(t,"error","")}deprecate(...t){return this.forward(t,"warn","WARNING DEPRECATED: ",!0)}forward(t,r,n,s){return s&&!this.debug?null:(R(t[0])&&(t[0]=`${n}${this.prefix} ${t[0]}`),this.logger[r](t))}create(t){return new yt(this.logger,{prefix:`${this.prefix}:${t}:`,...this.options})}clone(t){return t=t||this.options,t.prefix=t.prefix||this.prefix,new yt(this.logger,t)}}var je=new yt;class vt{constructor(){this.observers={}}on(t,r){return t.split(" ").forEach(n=>{this.observers[n]||(this.observers[n]=new Map);const s=this.observers[n].get(r)||0;this.observers[n].set(r,s+1)}),this}off(t,r){if(this.observers[t]){if(!r){delete this.observers[t];return}this.observers[t].delete(r)}}emit(t,...r){this.observers[t]&&Array.from(this.observers[t].entries()).forEach(([s,o])=>{for(let i=0;i<o;i++)s(...r)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(([s,o])=>{for(let i=0;i<o;i++)s.apply(s,[t,...r])})}}class zr extends vt{constructor(t,r={ns:["translation"],defaultNS:"translation"}){super(),this.data=t||{},this.options=r,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(t){this.options.ns.indexOf(t)<0&&this.options.ns.push(t)}removeNamespaces(t){const r=this.options.ns.indexOf(t);r>-1&&this.options.ns.splice(r,1)}getResource(t,r,n,s={}){const o=s.keySeparator!==void 0?s.keySeparator:this.options.keySeparator,i=s.ignoreJSONStructure!==void 0?s.ignoreJSONStructure:this.options.ignoreJSONStructure;let a;t.indexOf(".")>-1?a=t.split("."):(a=[t,r],n&&(Array.isArray(n)?a.push(...n):R(n)&&o?a.push(...n.split(o)):a.push(n)));const u=gt(this.data,a);return!u&&!r&&!n&&t.indexOf(".")>-1&&(t=a[0],r=a[1],n=a.slice(2).join(".")),u||!i||!R(n)?u:Zt(this.data?.[t]?.[r],n,o)}addResource(t,r,n,s,o={silent:!1}){const i=o.keySeparator!==void 0?o.keySeparator:this.options.keySeparator;let a=[t,r];n&&(a=a.concat(i?n.split(i):n)),t.indexOf(".")>-1&&(a=t.split("."),s=r,r=a[1]),this.addNamespaces(r),$r(this.data,a,s),o.silent||this.emit("added",t,r,n,s)}addResources(t,r,n,s={silent:!1}){for(const o in n)(R(n[o])||Array.isArray(n[o]))&&this.addResource(t,r,o,n[o],{silent:!0});s.silent||this.emit("added",t,r,n)}addResourceBundle(t,r,n,s,o,i={silent:!1,skipCopy:!1}){let a=[t,r];t.indexOf(".")>-1&&(a=t.split("."),s=n,n=r,r=a[1]),this.addNamespaces(r);let u=gt(this.data,a)||{};i.skipCopy||(n=JSON.parse(JSON.stringify(n))),s?Lr(u,n,o):u={...u,...n},$r(this.data,a,u),i.silent||this.emit("added",t,r,n)}removeResourceBundle(t,r){this.hasResourceBundle(t,r)&&delete this.data[t][r],this.removeNamespaces(r),this.emit("removed",t,r)}hasResourceBundle(t,r){return this.getResource(t,r)!==void 0}getResourceBundle(t,r){return r||(r=this.options.defaultNS),this.getResource(t,r)}getDataByLanguage(t){return this.data[t]}hasLanguageSomeTranslations(t){const r=this.getDataByLanguage(t);return!!(r&&Object.keys(r)||[]).find(s=>r[s]&&Object.keys(r[s]).length>0)}toJSON(){return this.data}}var Cr={processors:{},addPostProcessor(e){this.processors[e.name]=e},handle(e,t,r,n,s){return e.forEach(o=>{t=this.processors[o]?.process(t,r,n,s)??t}),t}};const Nr=Symbol("i18next/PATH_KEY");function Ds(){const e=[],t=Object.create(null);let r;return t.get=(n,s)=>(r?.revoke?.(),s===Nr?e:(e.push(s),r=Proxy.revocable(n,t),r.proxy)),Proxy.revocable(Object.create(null),t).proxy}function Ut(e,t){const{[Nr]:r}=e(Ds());return r.join(t?.keySeparator??".")}const Rr={},Mt=e=>!R(e)&&typeof e!="boolean"&&typeof e!="number";class _t extends vt{constructor(t,r={}){super(),Fs(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],t,this),this.options=r,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=je.create("translator")}changeLanguage(t){t&&(this.language=t)}exists(t,r={interpolation:{}}){const n={...r};if(t==null)return!1;const s=this.resolve(t,n);if(s?.res===void 0)return!1;const o=Mt(s.res);return!(n.returnObjects===!1&&o)}extractFromKey(t,r){let n=r.nsSeparator!==void 0?r.nsSeparator:this.options.nsSeparator;n===void 0&&(n=":");const s=r.keySeparator!==void 0?r.keySeparator:this.options.keySeparator;let o=r.ns||this.options.defaultNS||[];const i=n&&t.indexOf(n)>-1,a=!this.options.userDefinedKeySeparator&&!r.keySeparator&&!this.options.userDefinedNsSeparator&&!r.nsSeparator&&!As(t,n,s);if(i&&!a){const u=t.match(this.interpolator.nestingRegexp);if(u&&u.length>0)return{key:t,namespaces:R(o)?[o]:o};const c=t.split(n);(n!==s||n===s&&this.options.ns.indexOf(c[0])>-1)&&(o=c.shift()),t=c.join(s)}return{key:t,namespaces:R(o)?[o]:o}}translate(t,r,n){let s=typeof r=="object"?{...r}:r;if(typeof s!="object"&&this.options.overloadTranslationOptionHandler&&(s=this.options.overloadTranslationOptionHandler(arguments)),typeof s=="object"&&(s={...s}),s||(s={}),t==null)return"";typeof t=="function"&&(t=Ut(t,{...this.options,...s})),Array.isArray(t)||(t=[String(t)]);const o=s.returnDetails!==void 0?s.returnDetails:this.options.returnDetails,i=s.keySeparator!==void 0?s.keySeparator:this.options.keySeparator,{key:a,namespaces:u}=this.extractFromKey(t[t.length-1],s),c=u[u.length-1];let h=s.nsSeparator!==void 0?s.nsSeparator:this.options.nsSeparator;h===void 0&&(h=":");const d=s.lng||this.language,y=s.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(d?.toLowerCase()==="cimode")return y?o?{res:`${c}${h}${a}`,usedKey:a,exactUsedKey:a,usedLng:d,usedNS:c,usedParams:this.getUsedParamsDetails(s)}:`${c}${h}${a}`:o?{res:a,usedKey:a,exactUsedKey:a,usedLng:d,usedNS:c,usedParams:this.getUsedParamsDetails(s)}:a;const p=this.resolve(t,s);let _=p?.res;const k=p?.usedKey||a,j=p?.exactUsedKey||a,D=["[object Number]","[object Function]","[object RegExp]"],P=s.joinArrays!==void 0?s.joinArrays:this.options.joinArrays,Z=!this.i18nFormat||this.i18nFormat.handleAsObject,L=s.count!==void 0&&!R(s.count),C=_t.hasDefaultValue(s),M=L?this.pluralResolver.getSuffix(d,s.count,s):"",K=s.ordinal&&L?this.pluralResolver.getSuffix(d,s.count,{ordinal:!1}):"",ae=L&&!s.ordinal&&s.count===0,se=ae&&s[`defaultValue${this.options.pluralSeparator}zero`]||s[`defaultValue${M}`]||s[`defaultValue${K}`]||s.defaultValue;let Q=_;Z&&!_&&C&&(Q=se);const ze=Mt(Q),T=Object.prototype.toString.apply(Q);if(Z&&Q&&ze&&D.indexOf(T)<0&&!(R(P)&&Array.isArray(Q))){if(!s.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const N=this.options.returnedObjectHandler?this.options.returnedObjectHandler(k,Q,{...s,ns:u}):`key '${a} (${this.language})' returned an object instead of string.`;return o?(p.res=N,p.usedParams=this.getUsedParamsDetails(s),p):N}if(i){const N=Array.isArray(Q),B=N?[]:{},ee=N?j:k;for(const Y in Q)if(Object.prototype.hasOwnProperty.call(Q,Y)){const H=`${ee}${i}${Y}`;C&&!_?B[Y]=this.translate(H,{...s,defaultValue:Mt(se)?se[Y]:void 0,joinArrays:!1,ns:u}):B[Y]=this.translate(H,{...s,joinArrays:!1,ns:u}),B[Y]===H&&(B[Y]=Q[Y])}_=B}}else if(Z&&R(P)&&Array.isArray(_))_=_.join(P),_&&(_=this.extendTranslation(_,t,s,n));else{let N=!1,B=!1;!this.isValidLookup(_)&&C&&(N=!0,_=se),this.isValidLookup(_)||(B=!0,_=a);const Y=(s.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&B?void 0:_,H=C&&se!==_&&this.options.updateMissing;if(B||N||H){if(this.logger.log(H?"updateKey":"missingKey",d,c,a,H?se:_),i){const l=this.resolve(a,{...s,keySeparator:!1});l&&l.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let he=[];const ge=this.languageUtils.getFallbackCodes(this.options.fallbackLng,s.lng||this.language);if(this.options.saveMissingTo==="fallback"&&ge&&ge[0])for(let l=0;l<ge.length;l++)he.push(ge[l]);else this.options.saveMissingTo==="all"?he=this.languageUtils.toResolveHierarchy(s.lng||this.language):he.push(s.lng||this.language);const Se=(l,S,z)=>{const I=C&&z!==_?z:Y;this.options.missingKeyHandler?this.options.missingKeyHandler(l,c,S,I,H,s):this.backendConnector?.saveMissing&&this.backendConnector.saveMissing(l,c,S,I,H,s),this.emit("missingKey",l,c,S,_)};this.options.saveMissing&&(this.options.saveMissingPlurals&&L?he.forEach(l=>{const S=this.pluralResolver.getSuffixes(l,s);ae&&s[`defaultValue${this.options.pluralSeparator}zero`]&&S.indexOf(`${this.options.pluralSeparator}zero`)<0&&S.push(`${this.options.pluralSeparator}zero`),S.forEach(z=>{Se([l],a+z,s[`defaultValue${z}`]||se)})}):Se(he,a,se))}_=this.extendTranslation(_,t,s,p,n),B&&_===a&&this.options.appendNamespaceToMissingKey&&(_=`${c}${h}${a}`),(B||N)&&this.options.parseMissingKeyHandler&&(_=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${c}${h}${a}`:a,N?_:void 0,s))}return o?(p.res=_,p.usedParams=this.getUsedParamsDetails(s),p):_}extendTranslation(t,r,n,s,o){if(this.i18nFormat?.parse)t=this.i18nFormat.parse(t,{...this.options.interpolation.defaultVariables,...n},n.lng||this.language||s.usedLng,s.usedNS,s.usedKey,{resolved:s});else if(!n.skipInterpolation){n.interpolation&&this.interpolator.init({...n,interpolation:{...this.options.interpolation,...n.interpolation}});const u=R(t)&&(n?.interpolation?.skipOnVariables!==void 0?n.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let c;if(u){const d=t.match(this.interpolator.nestingRegexp);c=d&&d.length}let h=n.replace&&!R(n.replace)?n.replace:n;if(this.options.interpolation.defaultVariables&&(h={...this.options.interpolation.defaultVariables,...h}),t=this.interpolator.interpolate(t,h,n.lng||this.language||s.usedLng,n),u){const d=t.match(this.interpolator.nestingRegexp),y=d&&d.length;c<y&&(n.nest=!1)}!n.lng&&s&&s.res&&(n.lng=this.language||s.usedLng),n.nest!==!1&&(t=this.interpolator.nest(t,(...d)=>o?.[0]===d[0]&&!n.context?(this.logger.warn(`It seems you are nesting recursively key: ${d[0]} in key: ${r[0]}`),null):this.translate(...d,r),n)),n.interpolation&&this.interpolator.reset()}const i=n.postProcess||this.options.postProcess,a=R(i)?[i]:i;return t!=null&&a?.length&&n.applyPostProcessor!==!1&&(t=Cr.handle(a,t,r,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...s,usedParams:this.getUsedParamsDetails(n)},...n}:n,this)),t}resolve(t,r={}){let n,s,o,i,a;return R(t)&&(t=[t]),t.forEach(u=>{if(this.isValidLookup(n))return;const c=this.extractFromKey(u,r),h=c.key;s=h;let d=c.namespaces;this.options.fallbackNS&&(d=d.concat(this.options.fallbackNS));const y=r.count!==void 0&&!R(r.count),p=y&&!r.ordinal&&r.count===0,_=r.context!==void 0&&(R(r.context)||typeof r.context=="number")&&r.context!=="",k=r.lngs?r.lngs:this.languageUtils.toResolveHierarchy(r.lng||this.language,r.fallbackLng);d.forEach(j=>{this.isValidLookup(n)||(a=j,!Rr[`${k[0]}-${j}`]&&this.utils?.hasLoadedNamespace&&!this.utils?.hasLoadedNamespace(a)&&(Rr[`${k[0]}-${j}`]=!0,this.logger.warn(`key "${s}" for languages "${k.join(", ")}" won't get resolved as namespace "${a}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),k.forEach(D=>{if(this.isValidLookup(n))return;i=D;const P=[h];if(this.i18nFormat?.addLookupKeys)this.i18nFormat.addLookupKeys(P,h,D,j,r);else{let L;y&&(L=this.pluralResolver.getSuffix(D,r.count,r));const C=`${this.options.pluralSeparator}zero`,M=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(y&&(r.ordinal&&L.indexOf(M)===0&&P.push(h+L.replace(M,this.options.pluralSeparator)),P.push(h+L),p&&P.push(h+C)),_){const K=`${h}${this.options.contextSeparator||"_"}${r.context}`;P.push(K),y&&(r.ordinal&&L.indexOf(M)===0&&P.push(K+L.replace(M,this.options.pluralSeparator)),P.push(K+L),p&&P.push(K+C))}}let Z;for(;Z=P.pop();)this.isValidLookup(n)||(o=Z,n=this.getResource(D,j,Z,r))}))})}),{res:n,usedKey:s,exactUsedKey:o,usedLng:i,usedNS:a}}isValidLookup(t){return t!==void 0&&!(!this.options.returnNull&&t===null)&&!(!this.options.returnEmptyString&&t==="")}getResource(t,r,n,s={}){return this.i18nFormat?.getResource?this.i18nFormat.getResource(t,r,n,s):this.resourceStore.getResource(t,r,n,s)}getUsedParamsDetails(t={}){const r=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],n=t.replace&&!R(t.replace);let s=n?t.replace:t;if(n&&typeof t.count<"u"&&(s.count=t.count),this.options.interpolation.defaultVariables&&(s={...this.options.interpolation.defaultVariables,...s}),!n){s={...s};for(const o of r)delete s[o]}return s}static hasDefaultValue(t){const r="defaultValue";for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&r===n.substring(0,r.length)&&t[n]!==void 0)return!0;return!1}}class Ar{constructor(t){this.options=t,this.supportedLngs=this.options.supportedLngs||!1,this.logger=je.create("languageUtils")}getScriptPartFromCode(t){if(t=st(t),!t||t.indexOf("-")<0)return null;const r=t.split("-");return r.length===2||(r.pop(),r[r.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(r.join("-"))}getLanguagePartFromCode(t){if(t=st(t),!t||t.indexOf("-")<0)return t;const r=t.split("-");return this.formatLanguageCode(r[0])}formatLanguageCode(t){if(R(t)&&t.indexOf("-")>-1){let r;try{r=Intl.getCanonicalLocales(t)[0]}catch{}return r&&this.options.lowerCaseLng&&(r=r.toLowerCase()),r||(this.options.lowerCaseLng?t.toLowerCase():t)}return this.options.cleanCode||this.options.lowerCaseLng?t.toLowerCase():t}isSupportedCode(t){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(t=this.getLanguagePartFromCode(t)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(t)>-1}getBestMatchFromCodes(t){if(!t)return null;let r;return t.forEach(n=>{if(r)return;const s=this.formatLanguageCode(n);(!this.options.supportedLngs||this.isSupportedCode(s))&&(r=s)}),!r&&this.options.supportedLngs&&t.forEach(n=>{if(r)return;const s=this.getScriptPartFromCode(n);if(this.isSupportedCode(s))return r=s;const o=this.getLanguagePartFromCode(n);if(this.isSupportedCode(o))return r=o;r=this.options.supportedLngs.find(i=>{if(i===o)return i;if(!(i.indexOf("-")<0&&o.indexOf("-")<0)&&(i.indexOf("-")>0&&o.indexOf("-")<0&&i.substring(0,i.indexOf("-"))===o||i.indexOf(o)===0&&o.length>1))return i})}),r||(r=this.getFallbackCodes(this.options.fallbackLng)[0]),r}getFallbackCodes(t,r){if(!t)return[];if(typeof t=="function"&&(t=t(r)),R(t)&&(t=[t]),Array.isArray(t))return t;if(!r)return t.default||[];let n=t[r];return n||(n=t[this.getScriptPartFromCode(r)]),n||(n=t[this.formatLanguageCode(r)]),n||(n=t[this.getLanguagePartFromCode(r)]),n||(n=t.default),n||[]}toResolveHierarchy(t,r){const n=this.getFallbackCodes((r===!1?[]:r)||this.options.fallbackLng||[],t),s=[],o=i=>{i&&(this.isSupportedCode(i)?s.push(i):this.logger.warn(`rejecting language code not found in supportedLngs: ${i}`))};return R(t)&&(t.indexOf("-")>-1||t.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&o(this.formatLanguageCode(t)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&o(this.getScriptPartFromCode(t)),this.options.load!=="currentOnly"&&o(this.getLanguagePartFromCode(t))):R(t)&&o(this.formatLanguageCode(t)),n.forEach(i=>{s.indexOf(i)<0&&o(this.formatLanguageCode(i))}),s}}const Tr={zero:0,one:1,two:2,few:3,many:4,other:5},Dr={select:e=>e===1?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class Is{constructor(t,r={}){this.languageUtils=t,this.options=r,this.logger=je.create("pluralResolver"),this.pluralRulesCache={}}clearCache(){this.pluralRulesCache={}}getRule(t,r={}){const n=st(t==="dev"?"en":t),s=r.ordinal?"ordinal":"cardinal",o=JSON.stringify({cleanedCode:n,type:s});if(o in this.pluralRulesCache)return this.pluralRulesCache[o];let i;try{i=new Intl.PluralRules(n,{type:s})}catch{if(!Intl)return this.logger.error("No Intl support, please use an Intl polyfill!"),Dr;if(!t.match(/-|_/))return Dr;const u=this.languageUtils.getLanguagePartFromCode(t);i=this.getRule(u,r)}return this.pluralRulesCache[o]=i,i}needsPlural(t,r={}){let n=this.getRule(t,r);return n||(n=this.getRule("dev",r)),n?.resolvedOptions().pluralCategories.length>1}getPluralFormsOfKey(t,r,n={}){return this.getSuffixes(t,n).map(s=>`${r}${s}`)}getSuffixes(t,r={}){let n=this.getRule(t,r);return n||(n=this.getRule("dev",r)),n?n.resolvedOptions().pluralCategories.sort((s,o)=>Tr[s]-Tr[o]).map(s=>`${this.options.prepend}${r.ordinal?`ordinal${this.options.prepend}`:""}${s}`):[]}getSuffix(t,r,n={}){const s=this.getRule(t,n);return s?`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:""}${s.select(r)}`:(this.logger.warn(`no plural rule found for: ${t}`),this.getSuffix("dev",r,n))}}const Ir=(e,t,r,n=".",s=!0)=>{let o=$s(e,t,r);return!o&&s&&R(r)&&(o=Zt(e,r,n),o===void 0&&(o=Zt(t,r,n))),o},Bt=e=>e.replace(/\$/g,"$$$$");class Vr{constructor(t={}){this.logger=je.create("interpolator"),this.options=t,this.format=t?.interpolation?.format||(r=>r),this.init(t)}init(t={}){t.interpolation||(t.interpolation={escapeValue:!0});const{escape:r,escapeValue:n,useRawValueToEscape:s,prefix:o,prefixEscaped:i,suffix:a,suffixEscaped:u,formatSeparator:c,unescapeSuffix:h,unescapePrefix:d,nestingPrefix:y,nestingPrefixEscaped:p,nestingSuffix:_,nestingSuffixEscaped:k,nestingOptionsSeparator:j,maxReplaces:D,alwaysFormat:P}=t.interpolation;this.escape=r!==void 0?r:zs,this.escapeValue=n!==void 0?n:!0,this.useRawValueToEscape=s!==void 0?s:!1,this.prefix=o?We(o):i||"{{",this.suffix=a?We(a):u||"}}",this.formatSeparator=c||",",this.unescapePrefix=h?"":d||"-",this.unescapeSuffix=this.unescapePrefix?"":h||"",this.nestingPrefix=y?We(y):p||We("$t("),this.nestingSuffix=_?We(_):k||We(")"),this.nestingOptionsSeparator=j||",",this.maxReplaces=D||1e3,this.alwaysFormat=P!==void 0?P:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const t=(r,n)=>r?.source===n?(r.lastIndex=0,r):new RegExp(n,"g");this.regexp=t(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=t(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=t(this.nestingRegexp,`${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`)}interpolate(t,r,n,s){let o,i,a;const u=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},c=p=>{if(p.indexOf(this.formatSeparator)<0){const D=Ir(r,u,p,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(D,void 0,n,{...s,...r,interpolationkey:p}):D}const _=p.split(this.formatSeparator),k=_.shift().trim(),j=_.join(this.formatSeparator).trim();return this.format(Ir(r,u,k,this.options.keySeparator,this.options.ignoreJSONStructure),j,n,{...s,...r,interpolationkey:k})};this.resetRegExp();const h=s?.missingInterpolationHandler||this.options.missingInterpolationHandler,d=s?.interpolation?.skipOnVariables!==void 0?s.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:p=>Bt(p)},{regex:this.regexp,safeValue:p=>this.escapeValue?Bt(this.escape(p)):Bt(p)}].forEach(p=>{for(a=0;o=p.regex.exec(t);){const _=o[1].trim();if(i=c(_),i===void 0)if(typeof h=="function"){const j=h(t,o,s);i=R(j)?j:""}else if(s&&Object.prototype.hasOwnProperty.call(s,_))i="";else if(d){i=o[0];continue}else this.logger.warn(`missed to pass in variable ${_} for interpolating ${t}`),i="";else!R(i)&&!this.useRawValueToEscape&&(i=Fr(i));const k=p.safeValue(i);if(t=t.replace(o[0],k),d?(p.regex.lastIndex+=i.length,p.regex.lastIndex-=o[0].length):p.regex.lastIndex=0,a++,a>=this.maxReplaces)break}}),t}nest(t,r,n={}){let s,o,i;const a=(u,c)=>{const h=this.nestingOptionsSeparator;if(u.indexOf(h)<0)return u;const d=u.split(new RegExp(`${h}[ ]*{`));let y=`{${d[1]}`;u=d[0],y=this.interpolate(y,i);const p=y.match(/'/g),_=y.match(/"/g);((p?.length??0)%2===0&&!_||_.length%2!==0)&&(y=y.replace(/'/g,'"'));try{i=JSON.parse(y),c&&(i={...c,...i})}catch(k){return this.logger.warn(`failed parsing options string in nesting for key ${u}`,k),`${u}${h}${y}`}return i.defaultValue&&i.defaultValue.indexOf(this.prefix)>-1&&delete i.defaultValue,u};for(;s=this.nestingRegexp.exec(t);){let u=[];i={...n},i=i.replace&&!R(i.replace)?i.replace:i,i.applyPostProcessor=!1,delete i.defaultValue;const c=/{.*}/.test(s[1])?s[1].lastIndexOf("}")+1:s[1].indexOf(this.formatSeparator);if(c!==-1&&(u=s[1].slice(c).split(this.formatSeparator).map(h=>h.trim()).filter(Boolean),s[1]=s[1].slice(0,c)),o=r(a.call(this,s[1].trim(),i),i),o&&s[0]===t&&!R(o))return o;R(o)||(o=Fr(o)),o||(this.logger.warn(`missed to resolve ${s[1]} for nesting ${t}`),o=""),u.length&&(o=u.reduce((h,d)=>this.format(h,d,n.lng,{...n,interpolationkey:s[1].trim()}),o.trim())),t=t.replace(s[0],o),this.regexp.lastIndex=0}return t}}const Vs=e=>{let t=e.toLowerCase().trim();const r={};if(e.indexOf("(")>-1){const n=e.split("(");t=n[0].toLowerCase().trim();const s=n[1].substring(0,n[1].length-1);t==="currency"&&s.indexOf(":")<0?r.currency||(r.currency=s.trim()):t==="relativetime"&&s.indexOf(":")<0?r.range||(r.range=s.trim()):s.split(";").forEach(i=>{if(i){const[a,...u]=i.split(":"),c=u.join(":").trim().replace(/^'+|'+$/g,""),h=a.trim();r[h]||(r[h]=c),c==="false"&&(r[h]=!1),c==="true"&&(r[h]=!0),isNaN(c)||(r[h]=parseInt(c,10))}})}return{formatName:t,formatOptions:r}},Zr=e=>{const t={};return(r,n,s)=>{let o=s;s&&s.interpolationkey&&s.formatParams&&s.formatParams[s.interpolationkey]&&s[s.interpolationkey]&&(o={...o,[s.interpolationkey]:void 0});const i=n+JSON.stringify(o);let a=t[i];return a||(a=e(st(n),s),t[i]=a),a(r)}},Zs=e=>(t,r,n)=>e(st(r),n)(t);class Us{constructor(t={}){this.logger=je.create("formatter"),this.options=t,this.init(t)}init(t,r={interpolation:{}}){this.formatSeparator=r.interpolation.formatSeparator||",";const n=r.cacheInBuiltFormats?Zr:Zs;this.formats={number:n((s,o)=>{const i=new Intl.NumberFormat(s,{...o});return a=>i.format(a)}),currency:n((s,o)=>{const i=new Intl.NumberFormat(s,{...o,style:"currency"});return a=>i.format(a)}),datetime:n((s,o)=>{const i=new Intl.DateTimeFormat(s,{...o});return a=>i.format(a)}),relativetime:n((s,o)=>{const i=new Intl.RelativeTimeFormat(s,{...o});return a=>i.format(a,o.range||"day")}),list:n((s,o)=>{const i=new Intl.ListFormat(s,{...o});return a=>i.format(a)})}}add(t,r){this.formats[t.toLowerCase().trim()]=r}addCached(t,r){this.formats[t.toLowerCase().trim()]=Zr(r)}format(t,r,n,s={}){const o=r.split(this.formatSeparator);if(o.length>1&&o[0].indexOf("(")>1&&o[0].indexOf(")")<0&&o.find(a=>a.indexOf(")")>-1)){const a=o.findIndex(u=>u.indexOf(")")>-1);o[0]=[o[0],...o.splice(1,a)].join(this.formatSeparator)}return o.reduce((a,u)=>{const{formatName:c,formatOptions:h}=Vs(u);if(this.formats[c]){let d=a;try{const y=s?.formatParams?.[s.interpolationkey]||{},p=y.locale||y.lng||s.locale||s.lng||n;d=this.formats[c](a,p,{...h,...s,...y})}catch(y){this.logger.warn(y)}return d}else this.logger.warn(`there was no format function for ${c}`);return a},t)}}const Ms=(e,t)=>{e.pending[t]!==void 0&&(delete e.pending[t],e.pendingCount--)};class Bs extends vt{constructor(t,r,n,s={}){super(),this.backend=t,this.store=r,this.services=n,this.languageUtils=n.languageUtils,this.options=s,this.logger=je.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=s.maxParallelReads||10,this.readingCalls=0,this.maxRetries=s.maxRetries>=0?s.maxRetries:5,this.retryTimeout=s.retryTimeout>=1?s.retryTimeout:350,this.state={},this.queue=[],this.backend?.init?.(n,s.backend,s)}queueLoad(t,r,n,s){const o={},i={},a={},u={};return t.forEach(c=>{let h=!0;r.forEach(d=>{const y=`${c}|${d}`;!n.reload&&this.store.hasResourceBundle(c,d)?this.state[y]=2:this.state[y]<0||(this.state[y]===1?i[y]===void 0&&(i[y]=!0):(this.state[y]=1,h=!1,i[y]===void 0&&(i[y]=!0),o[y]===void 0&&(o[y]=!0),u[d]===void 0&&(u[d]=!0)))}),h||(a[c]=!0)}),(Object.keys(o).length||Object.keys(i).length)&&this.queue.push({pending:i,pendingCount:Object.keys(i).length,loaded:{},errors:[],callback:s}),{toLoad:Object.keys(o),pending:Object.keys(i),toLoadLanguages:Object.keys(a),toLoadNamespaces:Object.keys(u)}}loaded(t,r,n){const s=t.split("|"),o=s[0],i=s[1];r&&this.emit("failedLoading",o,i,r),!r&&n&&this.store.addResourceBundle(o,i,n,void 0,void 0,{skipCopy:!0}),this.state[t]=r?-1:2,r&&n&&(this.state[t]=0);const a={};this.queue.forEach(u=>{js(u.loaded,[o],i),Ms(u,t),r&&u.errors.push(r),u.pendingCount===0&&!u.done&&(Object.keys(u.loaded).forEach(c=>{a[c]||(a[c]={});const h=u.loaded[c];h.length&&h.forEach(d=>{a[c][d]===void 0&&(a[c][d]=!0)})}),u.done=!0,u.errors.length?u.callback(u.errors):u.callback())}),this.emit("loaded",a),this.queue=this.queue.filter(u=>!u.done)}read(t,r,n,s=0,o=this.retryTimeout,i){if(!t.length)return i(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:t,ns:r,fcName:n,tried:s,wait:o,callback:i});return}this.readingCalls++;const a=(c,h)=>{if(this.readingCalls--,this.waitingReads.length>0){const d=this.waitingReads.shift();this.read(d.lng,d.ns,d.fcName,d.tried,d.wait,d.callback)}if(c&&h&&s<this.maxRetries){setTimeout(()=>{this.read.call(this,t,r,n,s+1,o*2,i)},o);return}i(c,h)},u=this.backend[n].bind(this.backend);if(u.length===2){try{const c=u(t,r);c&&typeof c.then=="function"?c.then(h=>a(null,h)).catch(a):a(null,c)}catch(c){a(c)}return}return u(t,r,a)}prepareLoading(t,r,n={},s){if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),s&&s();R(t)&&(t=this.languageUtils.toResolveHierarchy(t)),R(r)&&(r=[r]);const o=this.queueLoad(t,r,n,s);if(!o.toLoad.length)return o.pending.length||s(),null;o.toLoad.forEach(i=>{this.loadOne(i)})}load(t,r,n){this.prepareLoading(t,r,{},n)}reload(t,r,n){this.prepareLoading(t,r,{reload:!0},n)}loadOne(t,r=""){const n=t.split("|"),s=n[0],o=n[1];this.read(s,o,"read",void 0,void 0,(i,a)=>{i&&this.logger.warn(`${r}loading namespace ${o} for language ${s} failed`,i),!i&&a&&this.logger.log(`${r}loaded namespace ${o} for language ${s}`,a),this.loaded(t,i,a)})}saveMissing(t,r,n,s,o,i={},a=()=>{}){if(this.services?.utils?.hasLoadedNamespace&&!this.services?.utils?.hasLoadedNamespace(r)){this.logger.warn(`did not save key "${n}" as the namespace "${r}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(n==null||n==="")){if(this.backend?.create){const u={...i,isUpdate:o},c=this.backend.create.bind(this.backend);if(c.length<6)try{let h;c.length===5?h=c(t,r,n,s,u):h=c(t,r,n,s),h&&typeof h.then=="function"?h.then(d=>a(null,d)).catch(a):a(null,h)}catch(h){a(h)}else c(t,r,n,s,a,u)}!t||!t[0]||this.store.addResource(t[0],r,n,s)}}}const Kt=()=>({debug:!1,initAsync:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:e=>{let t={};if(typeof e[1]=="object"&&(t=e[1]),R(e[1])&&(t.defaultValue=e[1]),R(e[2])&&(t.tDescription=e[2]),typeof e[2]=="object"||typeof e[3]=="object"){const r=e[3]||e[2];Object.keys(r).forEach(n=>{t[n]=r[n]})}return t},interpolation:{escapeValue:!0,format:e=>e,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),Ur=e=>(R(e.ns)&&(e.ns=[e.ns]),R(e.fallbackLng)&&(e.fallbackLng=[e.fallbackLng]),R(e.fallbackNS)&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs?.indexOf?.("cimode")<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),typeof e.initImmediate=="boolean"&&(e.initAsync=e.initImmediate),e),bt=()=>{},Ks=e=>{Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach(r=>{typeof e[r]=="function"&&(e[r]=e[r].bind(e))})};class ot extends vt{constructor(t={},r){if(super(),this.options=Ur(t),this.services={},this.logger=je,this.modules={external:[]},Ks(this),r&&!this.isInitialized&&!t.isClone){if(!this.options.initAsync)return this.init(t,r),this;setTimeout(()=>{this.init(t,r)},0)}}init(t={},r){this.isInitializing=!0,typeof t=="function"&&(r=t,t={}),t.defaultNS==null&&t.ns&&(R(t.ns)?t.defaultNS=t.ns:t.ns.indexOf("translation")<0&&(t.defaultNS=t.ns[0]));const n=Kt();this.options={...n,...this.options,...Ur(t)},this.options.interpolation={...n.interpolation,...this.options.interpolation},t.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=t.keySeparator),t.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=t.nsSeparator),typeof this.options.overloadTranslationOptionHandler!="function"&&(this.options.overloadTranslationOptionHandler=n.overloadTranslationOptionHandler),this.options.debug===!0&&typeof console<"u"&&console.warn("i18next is maintained with support from locize.com — consider powering your project with managed localization (AI, CDN, integrations): https://locize.com");const s=c=>c?typeof c=="function"?new c:c:null;if(!this.options.isClone){this.modules.logger?je.init(s(this.modules.logger),this.options):je.init(null,this.options);let c;this.modules.formatter?c=this.modules.formatter:c=Us;const h=new Ar(this.options);this.store=new zr(this.options.resources,this.options);const d=this.services;d.logger=je,d.resourceStore=this.store,d.languageUtils=h,d.pluralResolver=new Is(h,{prepend:this.options.pluralSeparator,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),this.options.interpolation.format&&this.options.interpolation.format!==n.interpolation.format&&this.logger.deprecate("init: you are still using the legacy format function, please use the new approach: https://www.i18next.com/translation-function/formatting"),c&&(!this.options.interpolation.format||this.options.interpolation.format===n.interpolation.format)&&(d.formatter=s(c),d.formatter.init&&d.formatter.init(d,this.options),this.options.interpolation.format=d.formatter.format.bind(d.formatter)),d.interpolator=new Vr(this.options),d.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},d.backendConnector=new Bs(s(this.modules.backend),d.resourceStore,d,this.options),d.backendConnector.on("*",(p,..._)=>{this.emit(p,..._)}),this.modules.languageDetector&&(d.languageDetector=s(this.modules.languageDetector),d.languageDetector.init&&d.languageDetector.init(d,this.options.detection,this.options)),this.modules.i18nFormat&&(d.i18nFormat=s(this.modules.i18nFormat),d.i18nFormat.init&&d.i18nFormat.init(this)),this.translator=new _t(this.services,this.options),this.translator.on("*",(p,..._)=>{this.emit(p,..._)}),this.modules.external.forEach(p=>{p.init&&p.init(this)})}if(this.format=this.options.interpolation.format,r||(r=bt),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const c=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);c.length>0&&c[0]!=="dev"&&(this.options.lng=c[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(c=>{this[c]=(...h)=>this.store[c](...h)}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(c=>{this[c]=(...h)=>(this.store[c](...h),this)});const a=rt(),u=()=>{const c=(h,d)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),a.resolve(d),r(h,d)};if(this.languages&&!this.isInitialized)return c(null,this.t.bind(this));this.changeLanguage(this.options.lng,c)};return this.options.resources||!this.options.initAsync?u():setTimeout(u,0),a}loadResources(t,r=bt){let n=r;const s=R(t)?t:this.language;if(typeof t=="function"&&(n=t),!this.options.resources||this.options.partialBundledLanguages){if(s?.toLowerCase()==="cimode"&&(!this.options.preload||this.options.preload.length===0))return n();const o=[],i=a=>{if(!a||a==="cimode")return;this.services.languageUtils.toResolveHierarchy(a).forEach(c=>{c!=="cimode"&&o.indexOf(c)<0&&o.push(c)})};s?i(s):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(u=>i(u)),this.options.preload?.forEach?.(a=>i(a)),this.services.backendConnector.load(o,this.options.ns,a=>{!a&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),n(a)})}else n(null)}reloadResources(t,r,n){const s=rt();return typeof t=="function"&&(n=t,t=void 0),typeof r=="function"&&(n=r,r=void 0),t||(t=this.languages),r||(r=this.options.ns),n||(n=bt),this.services.backendConnector.reload(t,r,o=>{s.resolve(),n(o)}),s}use(t){if(!t)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!t.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return t.type==="backend"&&(this.modules.backend=t),(t.type==="logger"||t.log&&t.warn&&t.error)&&(this.modules.logger=t),t.type==="languageDetector"&&(this.modules.languageDetector=t),t.type==="i18nFormat"&&(this.modules.i18nFormat=t),t.type==="postProcessor"&&Cr.addPostProcessor(t),t.type==="formatter"&&(this.modules.formatter=t),t.type==="3rdParty"&&this.modules.external.push(t),this}setResolvedLanguage(t){if(!(!t||!this.languages)&&!(["cimode","dev"].indexOf(t)>-1)){for(let r=0;r<this.languages.length;r++){const n=this.languages[r];if(!(["cimode","dev"].indexOf(n)>-1)&&this.store.hasLanguageSomeTranslations(n)){this.resolvedLanguage=n;break}}!this.resolvedLanguage&&this.languages.indexOf(t)<0&&this.store.hasLanguageSomeTranslations(t)&&(this.resolvedLanguage=t,this.languages.unshift(t))}}changeLanguage(t,r){this.isLanguageChangingTo=t;const n=rt();this.emit("languageChanging",t);const s=a=>{this.language=a,this.languages=this.services.languageUtils.toResolveHierarchy(a),this.resolvedLanguage=void 0,this.setResolvedLanguage(a)},o=(a,u)=>{u?this.isLanguageChangingTo===t&&(s(u),this.translator.changeLanguage(u),this.isLanguageChangingTo=void 0,this.emit("languageChanged",u),this.logger.log("languageChanged",u)):this.isLanguageChangingTo=void 0,n.resolve((...c)=>this.t(...c)),r&&r(a,(...c)=>this.t(...c))},i=a=>{!t&&!a&&this.services.languageDetector&&(a=[]);const u=R(a)?a:a&&a[0],c=this.store.hasLanguageSomeTranslations(u)?u:this.services.languageUtils.getBestMatchFromCodes(R(a)?[a]:a);c&&(this.language||s(c),this.translator.language||this.translator.changeLanguage(c),this.services.languageDetector?.cacheUserLanguage?.(c)),this.loadResources(c,h=>{o(h,c)})};return!t&&this.services.languageDetector&&!this.services.languageDetector.async?i(this.services.languageDetector.detect()):!t&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(i):this.services.languageDetector.detect(i):i(t),n}getFixedT(t,r,n){const s=(o,i,...a)=>{let u;typeof i!="object"?u=this.options.overloadTranslationOptionHandler([o,i].concat(a)):u={...i},u.lng=u.lng||s.lng,u.lngs=u.lngs||s.lngs,u.ns=u.ns||s.ns,u.keyPrefix!==""&&(u.keyPrefix=u.keyPrefix||n||s.keyPrefix);const c=this.options.keySeparator||".";let h;return u.keyPrefix&&Array.isArray(o)?h=o.map(d=>(typeof d=="function"&&(d=Ut(d,{...this.options,...i})),`${u.keyPrefix}${c}${d}`)):(typeof o=="function"&&(o=Ut(o,{...this.options,...i})),h=u.keyPrefix?`${u.keyPrefix}${c}${o}`:o),this.t(h,u)};return R(t)?s.lng=t:s.lngs=t,s.ns=r,s.keyPrefix=n,s}t(...t){return this.translator?.translate(...t)}exists(...t){return this.translator?.exists(...t)}setDefaultNamespace(t){this.options.defaultNS=t}hasLoadedNamespace(t,r={}){if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const n=r.lng||this.resolvedLanguage||this.languages[0],s=this.options?this.options.fallbackLng:!1,o=this.languages[this.languages.length-1];if(n.toLowerCase()==="cimode")return!0;const i=(a,u)=>{const c=this.services.backendConnector.state[`${a}|${u}`];return c===-1||c===0||c===2};if(r.precheck){const a=r.precheck(this,i);if(a!==void 0)return a}return!!(this.hasResourceBundle(n,t)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||i(n,t)&&(!s||i(o,t)))}loadNamespaces(t,r){const n=rt();return this.options.ns?(R(t)&&(t=[t]),t.forEach(s=>{this.options.ns.indexOf(s)<0&&this.options.ns.push(s)}),this.loadResources(s=>{n.resolve(),r&&r(s)}),n):(r&&r(),Promise.resolve())}loadLanguages(t,r){const n=rt();R(t)&&(t=[t]);const s=this.options.preload||[],o=t.filter(i=>s.indexOf(i)<0&&this.services.languageUtils.isSupportedCode(i));return o.length?(this.options.preload=s.concat(o),this.loadResources(i=>{n.resolve(),r&&r(i)}),n):(r&&r(),Promise.resolve())}dir(t){if(t||(t=this.resolvedLanguage||(this.languages?.length>0?this.languages[0]:this.language)),!t)return"rtl";try{const s=new Intl.Locale(t);if(s&&s.getTextInfo){const o=s.getTextInfo();if(o&&o.direction)return o.direction}}catch{}const r=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],n=this.services?.languageUtils||new Ar(Kt());return t.toLowerCase().indexOf("-latn")>1?"ltr":r.indexOf(n.getLanguagePartFromCode(t))>-1||t.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(t={},r){const n=new ot(t,r);return n.createInstance=ot.createInstance,n}cloneInstance(t={},r=bt){const n=t.forkResourceStore;n&&delete t.forkResourceStore;const s={...this.options,...t,isClone:!0},o=new ot(s);if((t.debug!==void 0||t.prefix!==void 0)&&(o.logger=o.logger.clone(t)),["store","services","language"].forEach(a=>{o[a]=this[a]}),o.services={...this.services},o.services.utils={hasLoadedNamespace:o.hasLoadedNamespace.bind(o)},n){const a=Object.keys(this.store.data).reduce((u,c)=>(u[c]={...this.store.data[c]},u[c]=Object.keys(u[c]).reduce((h,d)=>(h[d]={...u[c][d]},h),u[c]),u),{});o.store=new zr(a,s),o.services.resourceStore=o.store}if(t.interpolation){const u={...Kt().interpolation,...this.options.interpolation,...t.interpolation},c={...s,interpolation:u};o.services.interpolator=new Vr(c)}return o.translator=new _t(o.services,s),o.translator.on("*",(a,...u)=>{o.emit(a,...u)}),o.init(s,r),o.translator.options=s,o.translator.backendConnector.services.utils={hasLoadedNamespace:o.hasLoadedNamespace.bind(o)},o}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const ye=ot.createInstance();ye.createInstance,ye.dir,ye.init,ye.loadResources,ye.reloadResources,ye.use,ye.changeLanguage,ye.getFixedT,ye.t,ye.exists,ye.setDefaultNamespace,ye.hasLoadedNamespace,ye.loadNamespaces,ye.loadLanguages;const Js=V.createContext({i18n:ye});var Jt={exports:{}},it={},Mr;function Hs(){if(Mr)return it;Mr=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function r(n,s,o){var i=null;if(o!==void 0&&(i=""+o),s.key!==void 0&&(i=""+s.key),"key"in s){o={};for(var a in s)a!=="key"&&(o[a]=s[a])}else o=s;return s=o.ref,{$$typeof:e,type:n,key:i,ref:s!==void 0?s:null,props:o}}return it.Fragment=t,it.jsx=r,it.jsxs=r,it}var wt={},Br;function Ws(){return Br||(Br=1,process.env.NODE_ENV!=="production"&&(function(){function e(l){if(l==null)return null;if(typeof l=="function")return l.$$typeof===ze?null:l.displayName||l.name||null;if(typeof l=="string")return l;switch(l){case j:return"Fragment";case P:return"Profiler";case D:return"StrictMode";case M:return"Suspense";case K:return"SuspenseList";case Q:return"Activity"}if(typeof l=="object")switch(typeof l.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),l.$$typeof){case k:return"Portal";case L:return l.displayName||"Context";case Z:return(l._context.displayName||"Context")+".Consumer";case C:var S=l.render;return l=l.displayName,l||(l=S.displayName||S.name||"",l=l!==""?"ForwardRef("+l+")":"ForwardRef"),l;case ae:return S=l.displayName||null,S!==null?S:e(l.type)||"Memo";case se:S=l._payload,l=l._init;try{return e(l(S))}catch{}}return null}function t(l){return""+l}function r(l){try{t(l);var S=!1}catch{S=!0}if(S){S=console;var z=S.error,I=typeof Symbol=="function"&&Symbol.toStringTag&&l[Symbol.toStringTag]||l.constructor.name||"Object";return z.call(S,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",I),t(l)}}function n(l){if(l===j)return"<>";if(typeof l=="object"&&l!==null&&l.$$typeof===se)return"<...>";try{var S=e(l);return S?"<"+S+">":"<...>"}catch{return"<...>"}}function s(){var l=T.A;return l===null?null:l.getOwner()}function o(){return Error("react-stack-top-frame")}function i(l){if(N.call(l,"key")){var S=Object.getOwnPropertyDescriptor(l,"key").get;if(S&&S.isReactWarning)return!1}return l.key!==void 0}function a(l,S){function z(){Y||(Y=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",S))}z.isReactWarning=!0,Object.defineProperty(l,"key",{get:z,configurable:!0})}function u(){var l=e(this.type);return H[l]||(H[l]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),l=this.props.ref,l!==void 0?l:null}function c(l,S,z,I,Ce,Ne){var U=z.ref;return l={$$typeof:_,type:l,key:S,props:z,_owner:I},(U!==void 0?U:null)!==null?Object.defineProperty(l,"ref",{enumerable:!1,get:u}):Object.defineProperty(l,"ref",{enumerable:!1,value:null}),l._store={},Object.defineProperty(l._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(l,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(l,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:Ce}),Object.defineProperty(l,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:Ne}),Object.freeze&&(Object.freeze(l.props),Object.freeze(l)),l}function h(l,S,z,I,Ce,Ne){var U=S.children;if(U!==void 0)if(I)if(B(U)){for(I=0;I<U.length;I++)d(U[I]);Object.freeze&&Object.freeze(U)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else d(U);if(N.call(S,"key")){U=e(l);var pe=Object.keys(S).filter(function(Je){return Je!=="key"});I=0<pe.length?"{key: someKey, "+pe.join(": ..., ")+": ...}":"{key: someKey}",Se[U+I]||(pe=0<pe.length?"{"+pe.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
7
- let props = %s;
8
- <%s {...props} />
9
- React keys must be passed directly to JSX without using spread:
10
- let props = %s;
11
- <%s key={someKey} {...props} />`,I,U,pe,U),Se[U+I]=!0)}if(U=null,z!==void 0&&(r(z),U=""+z),i(S)&&(r(S.key),U=""+S.key),"key"in S){z={};for(var Re in S)Re!=="key"&&(z[Re]=S[Re])}else z=S;return U&&a(z,typeof l=="function"?l.displayName||l.name||"Unknown":l),c(l,U,z,s(),Ce,Ne)}function d(l){y(l)?l._store&&(l._store.validated=1):typeof l=="object"&&l!==null&&l.$$typeof===se&&(l._payload.status==="fulfilled"?y(l._payload.value)&&l._payload.value._store&&(l._payload.value._store.validated=1):l._store&&(l._store.validated=1))}function y(l){return typeof l=="object"&&l!==null&&l.$$typeof===_}var p=V,_=Symbol.for("react.transitional.element"),k=Symbol.for("react.portal"),j=Symbol.for("react.fragment"),D=Symbol.for("react.strict_mode"),P=Symbol.for("react.profiler"),Z=Symbol.for("react.consumer"),L=Symbol.for("react.context"),C=Symbol.for("react.forward_ref"),M=Symbol.for("react.suspense"),K=Symbol.for("react.suspense_list"),ae=Symbol.for("react.memo"),se=Symbol.for("react.lazy"),Q=Symbol.for("react.activity"),ze=Symbol.for("react.client.reference"),T=p.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,N=Object.prototype.hasOwnProperty,B=Array.isArray,ee=console.createTask?console.createTask:function(){return null};p={react_stack_bottom_frame:function(l){return l()}};var Y,H={},he=p.react_stack_bottom_frame.bind(p,o)(),ge=ee(n(o)),Se={};wt.Fragment=j,wt.jsx=function(l,S,z){var I=1e4>T.recentlyCreatedOwnerStacks++;return h(l,S,z,!1,I?Error("react-stack-top-frame"):he,I?ee(n(l)):ge)},wt.jsxs=function(l,S,z){var I=1e4>T.recentlyCreatedOwnerStacks++;return h(l,S,z,!0,I?Error("react-stack-top-frame"):he,I?ee(n(l)):ge)}})()),wt}var Kr;function qs(){return Kr||(Kr=1,process.env.NODE_ENV==="production"?Jt.exports=Hs():Jt.exports=Ws()),Jt.exports}qs();function Ys(e){const{i18n:t}=V.useContext(Js),[r,n]=V.useState(!1);return g.jsx("div",{className:"flex flex-col gap-6",children:g.jsxs(b.Card,{className:b.cn("transition-opacity",{"opacity-50":e.form.formState.isSubmitting}),children:[g.jsxs(b.CardHeader,{children:[g.jsx(b.CardTitle,{className:"text-2xl",children:t.t("auth.loginForm.form.title")}),g.jsx(b.CardDescription,{children:t.t("auth.loginForm.form.description")})]}),g.jsx(b.CardContent,{children:g.jsx(b.Form,{...e.form,children:g.jsx("form",{onSubmit:e.form.handleSubmit(e.submit),children:g.jsxs("div",{className:"flex flex-col gap-6",children:[g.jsxs("div",{className:"grid gap-2",children:[g.jsx(b.Label,{htmlFor:"email",children:t.t("auth.loginForm.form.emailLabel")}),g.jsx(b.FormField,{control:e.form.control,name:"email",render:({field:s})=>g.jsxs(b.FormItem,{children:[g.jsx(b.FormControl,{children:g.jsx(b.Input,{disabled:e.form.formState.isSubmitting,type:"email",placeholder:"m@example.com",required:!0,"data-testid":me.loginForm.emailInput,...s})}),g.jsx(b.FormMessage,{})]})})]}),g.jsxs("div",{className:"grid gap-2",children:[g.jsxs("div",{className:"flex items-center",children:[g.jsx(b.Label,{htmlFor:"password",children:t.t("auth.loginForm.form.passwordLabel")}),g.jsx(xe.Link,{to:"/auth/start-reset-password",className:"ml-auto inline-block text-sm underline-offset-4 hover:underline","data-testid":me.loginForm.resetPasswordLink,children:t.t("auth.loginForm.form.forgotPasswordMessage")})]}),g.jsx(b.FormField,{control:e.form.control,name:"password",render:({field:s})=>g.jsxs(b.FormItem,{children:[g.jsx(b.FormControl,{className:"relative",children:g.jsxs("div",{className:"relative",children:[r?g.jsx(Oe.EyeOff,{className:"absolute right-3 top-1/2 transform -translate-y-1/2 text-gray-500 z-10 cursor-pointer",onClick:()=>{n(!1)}}):g.jsx(Oe.EyeIcon,{className:"absolute right-3 top-1/2 transform -translate-y-1/2 text-gray-500 z-10 cursor-pointer",onClick:()=>{n(!0)}}),g.jsx(b.Input,{placeholder:"********",disabled:e.form.formState.isSubmitting,"data-testid":me.loginForm.passwordInput,...s,className:"pr-10","aria-invalid":!!e.form.formState.errors?.password,type:r?"text":"password"})]})}),g.jsx(b.FormMessage,{})]})})]}),g.jsxs(b.Button,{type:"submit",className:"w-full cursor-pointer",disabled:e.form.formState.isSubmitting,"data-testid":me.loginForm.submitButton,children:[t.t("auth.loginForm.form.submitButtonLabel"),e.form.formState.isSubmitting&&g.jsx(Oe.Loader2Icon,{className:"animate-spin"})]}),g.jsxs(b.FieldDescription,{className:"text-center",children:[t.t("auth.loginForm.form.dontHaveAccountMessage")," ",g.jsx(xe.Link,{to:"/auth/signup","data-testid":me.loginForm.signUpFormLink,children:t.t("auth.loginForm.form.dontHaveAccountLink")})]})]})})})})]})})}function Gs(e){const[t,r]=V.useState(!1);return g.jsx("div",{className:"flex flex-col gap-6",children:g.jsxs(b.Card,{className:b.cn({"opacity-50":e.form.formState.isSubmitting}),children:[g.jsxs(b.CardHeader,{children:[g.jsx(b.CardTitle,{className:"text-2xl",children:e.i18n.t("auth.signUpForm.form.title")}),g.jsx(b.CardDescription,{children:e.i18n.t("auth.signUpForm.form.description")})]}),g.jsx(b.CardContent,{children:g.jsx(b.Form,{...e.form,children:g.jsx("form",{onSubmit:e.form.handleSubmit(e.submit),children:g.jsxs("div",{className:"flex flex-col gap-6",children:[g.jsxs("div",{className:"grid gap-2",children:[g.jsx(b.Label,{children:e.i18n.t("auth.signUpForm.form.emailLabel")}),g.jsx(b.FormField,{control:e.form.control,name:"email",render:({field:n})=>g.jsx(b.FormItem,{children:g.jsx(b.FormControl,{children:g.jsx(b.Input,{disabled:e.form.formState.isSubmitting,type:"email","data-testid":me.signupForm.emailInput,placeholder:"m@example.com",required:!0,...n})})})})]}),g.jsxs("div",{className:"grid gap-2",children:[g.jsxs("div",{className:"flex items-center",children:[g.jsx(b.Label,{children:e.i18n.t("auth.signUpForm.form.passwordLabel")}),g.jsx(xe.Link,{to:"/auth/start-reset-password",className:"ml-auto inline-block text-sm underline-offset-4 hover:underline",children:e.i18n.t("auth.signUpForm.form.forgotPasswordMessage")})]}),g.jsx(b.FormField,{control:e.form.control,name:"password",render:({field:n,fieldState:s})=>g.jsx(b.FormItem,{children:g.jsx(b.FormControl,{className:"relative",children:g.jsxs(g.Fragment,{children:[g.jsxs("div",{className:"relative",children:[t?g.jsx(Oe.EyeOff,{className:"absolute right-3 top-1/2 transform -translate-y-1/2 text-gray-500 z-10 cursor-pointer",onClick:()=>{r(!1)}}):g.jsx(Oe.EyeIcon,{className:"absolute right-3 top-1/2 transform -translate-y-1/2 text-gray-500 z-10 cursor-pointer",onClick:()=>{r(!0)}}),g.jsx(b.Input,{disabled:e.form.formState.isSubmitting,type:t?"text":"password",placeholder:"********","aria-invalid":!!e.form.formState.errors?.password,"data-testid":me.signupForm.passwordInput,...n,className:"pr-10"})]}),s.invalid&&g.jsx(b.FieldError,{errors:[s.error]})]})})})})]}),g.jsxs(b.Button,{type:"submit",className:"w-full cursor-pointer",disabled:e.form.formState.isSubmitting,"data-testid":me.signupForm.submitButton,children:[e.i18n.t("auth.signUpForm.form.submitButtonLabel"),e.form.formState.isSubmitting&&g.jsx(Oe.Loader2Icon,{className:"animate-spin"})]}),g.jsxs(b.FieldDescription,{className:"text-center",children:[e.i18n.t("auth.signUpForm.form.loginLinkMessage")," ",g.jsx(xe.Link,{to:"/auth/login",children:e.i18n.t("auth.signUpForm.form.loginLink")})]})]})})})})]})})}function Xs(e){return g.jsx("div",{className:"flex flex-col gap-6",children:g.jsxs(b.Card,{className:b.cn("transition-opacity",{"opacity-50":e.form.formState.isSubmitting}),children:[g.jsxs(b.CardHeader,{children:[g.jsx(b.CardTitle,{className:"text-2xl",children:e.i18n.t("auth.startResetPasswordForm.form.title")}),g.jsx(b.CardDescription,{children:e.i18n.t("auth.startResetPasswordForm.form.description")})]}),g.jsx(b.CardContent,{children:g.jsx(b.Form,{...e.form,children:g.jsx("form",{onSubmit:e.form.handleSubmit(e.submit),children:g.jsxs("div",{className:"flex flex-col gap-6",children:[g.jsxs("div",{className:"grid gap-2",children:[g.jsx(b.Label,{htmlFor:"email",children:e.i18n.t("auth.startResetPasswordForm.form.emailLabel")}),g.jsx(b.FormField,{control:e.form.control,name:"email",render:({field:t})=>g.jsxs(b.FormItem,{children:[g.jsx(b.FormControl,{children:g.jsx(b.Input,{disabled:e.form.formState.isSubmitting,type:"email",placeholder:"m@example.com",required:!0,"data-testid":me.startResetPasswordForm.emailInput,...t})}),g.jsx(b.FormMessage,{})]})})]}),g.jsxs(b.Button,{type:"submit",className:"w-full cursor-pointer",disabled:e.form.formState.isSubmitting,"data-testid":me.startResetPasswordForm.submitButton,children:[e.i18n.t("auth.startResetPasswordForm.form.submitButtonLabel"),e.form.formState.isSubmitting&&g.jsx(Oe.Loader2Icon,{className:"animate-spin"})]}),g.jsxs(b.FieldDescription,{className:"text-center",children:[e.i18n.t("auth.startResetPasswordForm.form.loginLinkMessage")," ",g.jsx(xe.Link,{to:"/auth/login",children:e.i18n.t("auth.startResetPasswordForm.form.loginLink")})]})]})})})})]})})}function Qs(e){return g.jsx("div",{className:"flex flex-col gap-6",children:g.jsxs(b.Card,{children:[g.jsxs(b.CardHeader,{children:[g.jsx(b.CardTitle,{className:"text-2xl",children:e.i18n.t("auth.verifyEmailForm.form.title")}),g.jsx(b.CardDescription,{children:e.i18n.t("auth.verifyEmailForm.form.verifyEmailDescription")})]}),g.jsx(b.CardContent,{children:g.jsx(b.Form,{...e.form,children:g.jsx("form",{onSubmit:e.form.handleSubmit(e.submit),children:g.jsxs("div",{className:"flex flex-col gap-6",children:[g.jsxs("div",{className:"grid gap-2",children:[g.jsx(b.Label,{children:e.i18n.t("auth.verifyEmailForm.form.codeLabel")}),g.jsx(b.FormField,{control:e.form.control,name:"code",render:({field:t})=>g.jsx(b.FormItem,{children:g.jsx(b.FormControl,{children:g.jsx(b.Input,{type:"text",placeholder:"00001234","data-testid":me.verifyEmailForm.authCodeInput,required:!0,...t})})})})]}),g.jsx(b.Button,{type:"submit",className:"w-full cursor-pointer","data-testid":me.verifyEmailForm.submitButton,children:e.i18n.t("auth.verifyEmailForm.form.submitButtonLabel")}),g.jsxs(b.FieldDescription,{className:"text-center",children:[e.i18n.t("auth.verifyEmailForm.form.loginLinkMessage")," ",g.jsx(xe.Link,{to:"/auth/login",children:e.i18n.t("auth.verifyEmailForm.form.loginLink")})]})]})})})})]})})}const Ht="Authorization",Jr=()=>({user:{id:null,email:null,roles:[],is_enabled:!1,is_email_verified:!1},sessionID:null,isAuthenticated:!1,isLoaded:!1}),Ze=new xr.Store(Jr()),eo=new xr.Derived({fn:()=>!!Ze.state.user?.roles.find(e=>e.name==="admin"),deps:[Ze]});class to{accountStore;httpClient;constructor(t){this.httpClient=t,this.accountStore=Ze}initAuthData=()=>{const t=localStorage.getItem("token");t&&(this.httpClient.defaults.headers.common[Ht]=t)};load=async()=>{try{const{data:t}=await this.httpClient.get("/api/auth/account/me");Ze.setState(()=>({user:t.user,sessionID:t.session_id,isAuthenticated:!0,isLoaded:!0}))}catch{Ze.setState(t=>({...t,isLoaded:!0}))}};login=async t=>{const r=await this.httpClient.post("/api/auth/account/login",t),{user:n,token:s,session_id:o}=r.data;return this._initUserData({user:n,token:s,sessionID:o}),n};signup=async t=>this.httpClient.post("/api/auth/account/signup",t);verifyEmail=async t=>{const r=await this.httpClient.post("/api/auth/account/verify-email",t);this._initUserData(r.data)};logout=()=>{Ze.setState(()=>({...Jr(),isLoaded:!0})),this._clearAuthData()};startResetPassword=t=>this.httpClient.post("/api/auth/account/start-reset-password",t);confirmResetPassword=async t=>{const r=await this.httpClient.post("/api/auth/account/confirm-reset-password",t);this._initUserData(r.data)};_initUserData=({user:t,token:r,sessionID:n})=>{this._setAuthData(r),Ze.setState(()=>({user:t,isAuthenticated:!0,isLoaded:!0,sessionID:n}))};_setAuthData=t=>{localStorage.setItem("token",t),this.httpClient.defaults.headers.common[Ht]=t};_clearAuthData=()=>{localStorage.removeItem("token"),delete this.httpClient.defaults.headers.common[Ht]}}var at=e=>e.type==="checkbox",Ue=e=>e instanceof Date,we=e=>e==null;const Hr=e=>typeof e=="object";var oe=e=>!we(e)&&!Array.isArray(e)&&Hr(e)&&!Ue(e),ro=e=>oe(e)&&e.target?at(e.target)?e.target.checked:e.target.value:e,no=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,so=(e,t)=>e.has(no(t)),oo=e=>{const t=e.constructor&&e.constructor.prototype;return oe(t)&&t.hasOwnProperty("isPrototypeOf")},Wt=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function ue(e){if(e instanceof Date)return new Date(e);const t=typeof FileList<"u"&&e instanceof FileList;if(Wt&&(e instanceof Blob||t))return e;const r=Array.isArray(e);if(!r&&!(oe(e)&&oo(e)))return e;const n=r?[]:Object.create(Object.getPrototypeOf(e));for(const s in e)Object.prototype.hasOwnProperty.call(e,s)&&(n[s]=ue(e[s]));return n}var St=e=>/^\w*$/.test(e),re=e=>e===void 0,qt=e=>Array.isArray(e)?e.filter(Boolean):[],Yt=e=>qt(e.replace(/["|']|\]/g,"").split(/\.|\[/)),F=(e,t,r)=>{if(!t||!oe(e))return r;const n=(St(t)?[t]:Yt(t)).reduce((s,o)=>we(s)?s:s[o],e);return re(n)||n===e?re(e[t])?r:e[t]:n},$e=e=>typeof e=="boolean",Fe=e=>typeof e=="function",X=(e,t,r)=>{let n=-1;const s=St(t)?[t]:Yt(t),o=s.length,i=o-1;for(;++n<o;){const a=s[n];let u=r;if(n!==i){const c=e[a];u=oe(c)||Array.isArray(c)?c:isNaN(+s[n+1])?{}:[]}if(a==="__proto__"||a==="constructor"||a==="prototype")return;e[a]=u,e=e[a]}};const Wr={BLUR:"blur",FOCUS_OUT:"focusout"},Pe={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},Ae={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},io=V.createContext(null);io.displayName="HookFormControlContext";var ao=(e,t,r,n=!0)=>{const s={defaultValues:t._defaultValues};for(const o in e)Object.defineProperty(s,o,{get:()=>{const i=o;return t._proxyFormState[i]!==Pe.all&&(t._proxyFormState[i]=!n||Pe.all),e[i]}});return s};const uo=typeof window<"u"?V.useLayoutEffect:V.useEffect;var ke=e=>typeof e=="string",co=(e,t,r,n,s)=>ke(e)?(n&&t.watch.add(e),F(r,e,s)):Array.isArray(e)?e.map(o=>(n&&t.watch.add(o),F(r,o))):(n&&(t.watchAll=!0),r),Gt=e=>we(e)||!Hr(e);function Te(e,t,r=new WeakSet){if(Gt(e)||Gt(t))return Object.is(e,t);if(Ue(e)&&Ue(t))return Object.is(e.getTime(),t.getTime());const n=Object.keys(e),s=Object.keys(t);if(n.length!==s.length)return!1;if(r.has(e)||r.has(t))return!0;r.add(e),r.add(t);for(const o of n){const i=e[o];if(!s.includes(o))return!1;if(o!=="ref"){const a=t[o];if(Ue(i)&&Ue(a)||oe(i)&&oe(a)||Array.isArray(i)&&Array.isArray(a)?!Te(i,a,r):!Object.is(i,a))return!1}}return!0}const lo=V.createContext(null);lo.displayName="HookFormContext";var Xt=(e,t,r,n,s)=>t?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[n]:s||!0}}:{},ut=e=>Array.isArray(e)?e:[e],qr=()=>{let e=[];return{get observers(){return e},next:s=>{for(const o of e)o.next&&o.next(s)},subscribe:s=>(e.push(s),{unsubscribe:()=>{e=e.filter(o=>o!==s)}}),unsubscribe:()=>{e=[]}}};function Yr(e,t){const r={};for(const n in e)if(e.hasOwnProperty(n)){const s=e[n],o=t[n];if(s&&oe(s)&&o){const i=Yr(s,o);oe(i)&&(r[n]=i)}else e[n]&&(r[n]=o)}return r}var ve=e=>oe(e)&&!Object.keys(e).length,Qt=e=>e.type==="file",xt=e=>{if(!Wt)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},Gr=e=>e.type==="select-multiple",er=e=>e.type==="radio",fo=e=>er(e)||at(e),tr=e=>xt(e)&&e.isConnected;function ho(e,t){const r=t.slice(0,-1).length;let n=0;for(;n<r;)e=re(e)?n++:e[t[n++]];return e}function po(e){for(const t in e)if(e.hasOwnProperty(t)&&!re(e[t]))return!1;return!0}function ie(e,t){const r=Array.isArray(t)?t:St(t)?[t]:Yt(t),n=r.length===1?e:ho(e,r),s=r.length-1,o=r[s];return n&&delete n[o],s!==0&&(oe(n)&&ve(n)||Array.isArray(n)&&po(n))&&ie(e,r.slice(0,-1)),e}var mo=e=>{for(const t in e)if(Fe(e[t]))return!0;return!1};function Xr(e){return Array.isArray(e)||oe(e)&&!mo(e)}function rr(e,t={}){for(const r in e){const n=e[r];Xr(n)?(t[r]=Array.isArray(n)?[]:{},rr(n,t[r])):re(n)||(t[r]=!0)}return t}function qe(e,t,r){r||(r=rr(t));for(const n in e){const s=e[n];if(Xr(s))re(t)||Gt(r[n])?r[n]=rr(s,Array.isArray(s)?[]:{}):qe(s,we(t)?{}:t[n],r[n]);else{const o=t[n];r[n]=!Te(s,o)}}return r}const Qr={value:!1,isValid:!1},en={value:!0,isValid:!0};var tn=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(r=>r&&r.checked&&!r.disabled).map(r=>r.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!re(e[0].attributes.value)?re(e[0].value)||e[0].value===""?en:{value:e[0].value,isValid:!0}:en:Qr}return Qr},rn=(e,{valueAsNumber:t,valueAsDate:r,setValueAs:n})=>re(e)?e:t?e===""?NaN:e&&+e:r&&ke(e)?new Date(e):n?n(e):e;const nn={isValid:!1,value:null};var sn=e=>Array.isArray(e)?e.reduce((t,r)=>r&&r.checked&&!r.disabled?{isValid:!0,value:r.value}:t,nn):nn;function on(e){const t=e.ref;return Qt(t)?t.files:er(t)?sn(e.refs).value:Gr(t)?[...t.selectedOptions].map(({value:r})=>r):at(t)?tn(e.refs).value:rn(re(t.value)?e.ref.value:t.value,e)}var go=(e,t,r,n)=>{const s={};for(const o of e){const i=F(t,o);i&&X(s,o,i._f)}return{criteriaMode:r,names:[...e],fields:s,shouldUseNativeValidation:n}},kt=e=>e instanceof RegExp,ct=e=>re(e)?e:kt(e)?e.source:oe(e)?kt(e.value)?e.value.source:e.value:e,an=e=>({isOnSubmit:!e||e===Pe.onSubmit,isOnBlur:e===Pe.onBlur,isOnChange:e===Pe.onChange,isOnAll:e===Pe.all,isOnTouch:e===Pe.onTouched});const un="AsyncFunction";var yo=e=>!!e&&!!e.validate&&!!(Fe(e.validate)&&e.validate.constructor.name===un||oe(e.validate)&&Object.values(e.validate).find(t=>t.constructor.name===un)),vo=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),cn=(e,t,r)=>!r&&(t.watchAll||t.watch.has(e)||[...t.watch].some(n=>e.startsWith(n)&&/^\.\w+/.test(e.slice(n.length))));const lt=(e,t,r,n)=>{for(const s of r||Object.keys(e)){const o=F(e,s);if(o){const{_f:i,...a}=o;if(i){if(i.refs&&i.refs[0]&&t(i.refs[0],s)&&!n)return!0;if(i.ref&&t(i.ref,i.name)&&!n)return!0;if(lt(a,t))break}else if(oe(a)&&lt(a,t))break}}};function ln(e,t,r){const n=F(e,r);if(n||St(r))return{error:n,name:r};const s=r.split(".");for(;s.length;){const o=s.join("."),i=F(t,o),a=F(e,o);if(i&&!Array.isArray(i)&&r!==o)return{name:r};if(a&&a.type)return{name:o,error:a};if(a&&a.root&&a.root.type)return{name:`${o}.root`,error:a.root};s.pop()}return{name:r}}var _o=(e,t,r,n)=>{r(e);const{name:s,...o}=e;return ve(o)||Object.keys(o).length>=Object.keys(t).length||Object.keys(o).find(i=>t[i]===(!n||Pe.all))},bo=(e,t,r)=>!e||!t||e===t||ut(e).some(n=>n&&(r?n===t:n.startsWith(t)||t.startsWith(n))),wo=(e,t,r,n,s)=>s.isOnAll?!1:!r&&s.isOnTouch?!(t||e):(r?n.isOnBlur:s.isOnBlur)?!e:(r?n.isOnChange:s.isOnChange)?e:!0,So=(e,t)=>!qt(F(e,t)).length&&ie(e,t),xo=(e,t,r)=>{const n=ut(F(e,r));return X(n,"root",t[r]),X(e,r,n),e};function fn(e,t,r="validate"){if(ke(e)||Array.isArray(e)&&e.every(ke)||$e(e)&&!e)return{type:r,message:ke(e)?e:"",ref:t}}var Ye=e=>oe(e)&&!kt(e)?e:{value:e,message:""},dn=async(e,t,r,n,s,o)=>{const{ref:i,refs:a,required:u,maxLength:c,minLength:h,min:d,max:y,pattern:p,validate:_,name:k,valueAsNumber:j,mount:D}=e._f,P=F(r,k);if(!D||t.has(k))return{};const Z=a?a[0]:i,L=T=>{s&&Z.reportValidity&&(Z.setCustomValidity($e(T)?"":T||""),Z.reportValidity())},C={},M=er(i),K=at(i),ae=M||K,se=(j||Qt(i))&&re(i.value)&&re(P)||xt(i)&&i.value===""||P===""||Array.isArray(P)&&!P.length,Q=Xt.bind(null,k,n,C),ze=(T,N,B,ee=Ae.maxLength,Y=Ae.minLength)=>{const H=T?N:B;C[k]={type:T?ee:Y,message:H,ref:i,...Q(T?ee:Y,H)}};if(o?!Array.isArray(P)||!P.length:u&&(!ae&&(se||we(P))||$e(P)&&!P||K&&!tn(a).isValid||M&&!sn(a).isValid)){const{value:T,message:N}=ke(u)?{value:!!u,message:u}:Ye(u);if(T&&(C[k]={type:Ae.required,message:N,ref:Z,...Q(Ae.required,N)},!n))return L(N),C}if(!se&&(!we(d)||!we(y))){let T,N;const B=Ye(y),ee=Ye(d);if(!we(P)&&!isNaN(P)){const Y=i.valueAsNumber||P&&+P;we(B.value)||(T=Y>B.value),we(ee.value)||(N=Y<ee.value)}else{const Y=i.valueAsDate||new Date(P),H=Se=>new Date(new Date().toDateString()+" "+Se),he=i.type=="time",ge=i.type=="week";ke(B.value)&&P&&(T=he?H(P)>H(B.value):ge?P>B.value:Y>new Date(B.value)),ke(ee.value)&&P&&(N=he?H(P)<H(ee.value):ge?P<ee.value:Y<new Date(ee.value))}if((T||N)&&(ze(!!T,B.message,ee.message,Ae.max,Ae.min),!n))return L(C[k].message),C}if((c||h)&&!se&&(ke(P)||o&&Array.isArray(P))){const T=Ye(c),N=Ye(h),B=!we(T.value)&&P.length>+T.value,ee=!we(N.value)&&P.length<+N.value;if((B||ee)&&(ze(B,T.message,N.message),!n))return L(C[k].message),C}if(p&&!se&&ke(P)){const{value:T,message:N}=Ye(p);if(kt(T)&&!P.match(T)&&(C[k]={type:Ae.pattern,message:N,ref:i,...Q(Ae.pattern,N)},!n))return L(N),C}if(_){if(Fe(_)){const T=await _(P,r),N=fn(T,Z);if(N&&(C[k]={...N,...Q(Ae.validate,N.message)},!n))return L(N.message),C}else if(oe(_)){let T={};for(const N in _){if(!ve(T)&&!n)break;const B=fn(await _[N](P,r),Z,N);B&&(T={...B,...Q(N,B.message)},L(B.message),n&&(C[k]=T))}if(!ve(T)&&(C[k]={ref:Z,...T},!n))return C}}return L(!0),C};const ko={mode:Pe.onSubmit,reValidateMode:Pe.onChange,shouldFocusError:!0};function Eo(e={}){let t={...ko,...e},r={submitCount:0,isDirty:!1,isReady:!1,isLoading:Fe(t.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1},n={},s=oe(t.defaultValues)||oe(t.values)?ue(t.defaultValues||t.values)||{}:{},o=t.shouldUnregister?{}:ue(s),i={action:!1,mount:!1,watch:!1,keepIsValid:!1},a={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},u,c=0;const h={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},d={...h};let y={...d};const p={array:qr(),state:qr()},_=t.criteriaMode===Pe.all,k=f=>m=>{clearTimeout(c),c=setTimeout(f,m)},j=async f=>{if(!i.keepIsValid&&!t.disabled&&(d.isValid||y.isValid||f)){let m;t.resolver?(m=ve((await ae()).errors),D()):m=await Q(n,!0),m!==r.isValid&&p.state.next({isValid:m})}},D=(f,m)=>{!t.disabled&&(d.isValidating||d.validatingFields||y.isValidating||y.validatingFields)&&((f||Array.from(a.mount)).forEach(v=>{v&&(m?X(r.validatingFields,v,m):ie(r.validatingFields,v))}),p.state.next({validatingFields:r.validatingFields,isValidating:!ve(r.validatingFields)}))},P=(f,m=[],v,O,E=!0,x=!0)=>{if(O&&v&&!t.disabled){if(i.action=!0,x&&Array.isArray(F(n,f))){const $=v(F(n,f),O.argA,O.argB);E&&X(n,f,$)}if(x&&Array.isArray(F(r.errors,f))){const $=v(F(r.errors,f),O.argA,O.argB);E&&X(r.errors,f,$),So(r.errors,f)}if((d.touchedFields||y.touchedFields)&&x&&Array.isArray(F(r.touchedFields,f))){const $=v(F(r.touchedFields,f),O.argA,O.argB);E&&X(r.touchedFields,f,$)}(d.dirtyFields||y.dirtyFields)&&(r.dirtyFields=qe(s,o)),p.state.next({name:f,isDirty:T(f,m),dirtyFields:r.dirtyFields,errors:r.errors,isValid:r.isValid})}else X(o,f,m)},Z=(f,m)=>{X(r.errors,f,m),p.state.next({errors:r.errors})},L=f=>{r.errors=f,p.state.next({errors:r.errors,isValid:!1})},C=(f,m,v,O)=>{const E=F(n,f);if(E){const x=F(o,f,re(v)?F(s,f):v);re(x)||O&&O.defaultChecked||m?X(o,f,m?x:on(E._f)):ee(f,x),i.mount&&!i.action&&j()}},M=(f,m,v,O,E)=>{let x=!1,$=!1;const W={name:f};if(!t.disabled){if(!v||O){(d.isDirty||y.isDirty)&&($=r.isDirty,r.isDirty=W.isDirty=T(),x=$!==W.isDirty);const q=Te(F(s,f),m);$=!!F(r.dirtyFields,f),q?ie(r.dirtyFields,f):X(r.dirtyFields,f,!0),W.dirtyFields=r.dirtyFields,x=x||(d.dirtyFields||y.dirtyFields)&&$!==!q}if(v){const q=F(r.touchedFields,f);q||(X(r.touchedFields,f,v),W.touchedFields=r.touchedFields,x=x||(d.touchedFields||y.touchedFields)&&q!==v)}x&&E&&p.state.next(W)}return x?W:{}},K=(f,m,v,O)=>{const E=F(r.errors,f),x=(d.isValid||y.isValid)&&$e(m)&&r.isValid!==m;if(t.delayError&&v?(u=k(()=>Z(f,v)),u(t.delayError)):(clearTimeout(c),u=null,v?X(r.errors,f,v):ie(r.errors,f)),(v?!Te(E,v):E)||!ve(O)||x){const $={...O,...x&&$e(m)?{isValid:m}:{},errors:r.errors,name:f};r={...r,...$},p.state.next($)}},ae=async f=>(D(f,!0),await t.resolver(o,t.context,go(f||a.mount,n,t.criteriaMode,t.shouldUseNativeValidation))),se=async f=>{const{errors:m}=await ae(f);if(D(f),f)for(const v of f){const O=F(m,v);O?X(r.errors,v,O):ie(r.errors,v)}else r.errors=m;return m},Q=async(f,m,v={valid:!0})=>{for(const O in f){const E=f[O];if(E){const{_f:x,...$}=E;if(x){const W=a.array.has(x.name),q=E._f&&yo(E._f);q&&d.validatingFields&&D([x.name],!0);const be=await dn(E,a.disabled,o,_,t.shouldUseNativeValidation&&!m,W);if(q&&d.validatingFields&&D([x.name]),be[x.name]&&(v.valid=!1,m||e.shouldUseNativeValidation))break;!m&&(F(be,x.name)?W?xo(r.errors,be,x.name):X(r.errors,x.name,be[x.name]):ie(r.errors,x.name))}!ve($)&&await Q($,m,v)}}return v.valid},ze=()=>{for(const f of a.unMount){const m=F(n,f);m&&(m._f.refs?m._f.refs.every(v=>!tr(v)):!tr(m._f.ref))&&pe(f)}a.unMount=new Set},T=(f,m)=>!t.disabled&&(f&&m&&X(o,f,m),!Te(l(),s)),N=(f,m,v)=>co(f,a,{...i.mount?o:re(m)?s:ke(f)?{[f]:m}:m},v,m),B=f=>qt(F(i.mount?o:s,f,t.shouldUnregister?F(s,f,[]):[])),ee=(f,m,v={})=>{const O=F(n,f);let E=m;if(O){const x=O._f;x&&(!x.disabled&&X(o,f,rn(m,x)),E=xt(x.ref)&&we(m)?"":m,Gr(x.ref)?[...x.ref.options].forEach($=>$.selected=E.includes($.value)):x.refs?at(x.ref)?x.refs.forEach($=>{(!$.defaultChecked||!$.disabled)&&(Array.isArray(E)?$.checked=!!E.find(W=>W===$.value):$.checked=E===$.value||!!E)}):x.refs.forEach($=>$.checked=$.value===E):Qt(x.ref)?x.ref.value="":(x.ref.value=E,x.ref.type||p.state.next({name:f,values:ue(o)})))}(v.shouldDirty||v.shouldTouch)&&M(f,E,v.shouldTouch,v.shouldDirty,!0),v.shouldValidate&&Se(f)},Y=(f,m,v)=>{for(const O in m){if(!m.hasOwnProperty(O))return;const E=m[O],x=f+"."+O,$=F(n,x);(a.array.has(f)||oe(E)||$&&!$._f)&&!Ue(E)?Y(x,E,v):ee(x,E,v)}},H=(f,m,v={})=>{const O=F(n,f),E=a.array.has(f),x=ue(m);X(o,f,x),E?(p.array.next({name:f,values:ue(o)}),(d.isDirty||d.dirtyFields||y.isDirty||y.dirtyFields)&&v.shouldDirty&&p.state.next({name:f,dirtyFields:qe(s,o),isDirty:T(f,x)})):O&&!O._f&&!we(x)?Y(f,x,v):ee(f,x,v),cn(f,a)?p.state.next({...r,name:f,values:ue(o)}):p.state.next({name:i.mount?f:void 0,values:ue(o)})},he=async f=>{i.mount=!0;const m=f.target;let v=m.name,O=!0;const E=F(n,v),x=q=>{O=Number.isNaN(q)||Ue(q)&&isNaN(q.getTime())||Te(q,F(o,v,q))},$=an(t.mode),W=an(t.reValidateMode);if(E){let q,be;const He=m.type?on(E._f):ro(f),Ve=f.type===Wr.BLUR||f.type===Wr.FOCUS_OUT,cl=!vo(E._f)&&!t.resolver&&!F(r.errors,v)&&!E._f.deps||wo(Ve,F(r.touchedFields,v),r.isSubmitted,W,$),wr=cn(v,a,Ve);X(o,v,He),Ve?(!m||!m.readOnly)&&(E._f.onBlur&&E._f.onBlur(f),u&&u(0)):E._f.onChange&&E._f.onChange(f);const Sr=M(v,He,Ve),ll=!ve(Sr)||wr;if(!Ve&&p.state.next({name:v,type:f.type,values:ue(o)}),cl)return(d.isValid||y.isValid)&&(t.mode==="onBlur"?Ve&&j():Ve||j()),ll&&p.state.next({name:v,...wr?{}:Sr});if(!Ve&&wr&&p.state.next({...r}),t.resolver){const{errors:bs}=await ae([v]);if(D([v]),x(He),O){const fl=ln(r.errors,n,v),ws=ln(bs,n,fl.name||v);q=ws.error,v=ws.name,be=ve(bs)}}else D([v],!0),q=(await dn(E,a.disabled,o,_,t.shouldUseNativeValidation))[v],D([v]),x(He),O&&(q?be=!1:(d.isValid||y.isValid)&&(be=await Q(n,!0)));O&&(E._f.deps&&(!Array.isArray(E._f.deps)||E._f.deps.length>0)&&Se(E._f.deps),K(v,be,q,Sr))}},ge=(f,m)=>{if(F(r.errors,m)&&f.focus)return f.focus(),1},Se=async(f,m={})=>{let v,O;const E=ut(f);if(t.resolver){const x=await se(re(f)?f:E);v=ve(x),O=f?!E.some($=>F(x,$)):v}else f?(O=(await Promise.all(E.map(async x=>{const $=F(n,x);return await Q($&&$._f?{[x]:$}:$)}))).every(Boolean),!(!O&&!r.isValid)&&j()):O=v=await Q(n);return p.state.next({...!ke(f)||(d.isValid||y.isValid)&&v!==r.isValid?{}:{name:f},...t.resolver||!f?{isValid:v}:{},errors:r.errors}),m.shouldFocus&&!O&&lt(n,ge,f?E:a.mount),O},l=(f,m)=>{let v={...i.mount?o:s};return m&&(v=Yr(m.dirtyFields?r.dirtyFields:r.touchedFields,v)),re(f)?v:ke(f)?F(v,f):f.map(O=>F(v,O))},S=(f,m)=>({invalid:!!F((m||r).errors,f),isDirty:!!F((m||r).dirtyFields,f),error:F((m||r).errors,f),isValidating:!!F(r.validatingFields,f),isTouched:!!F((m||r).touchedFields,f)}),z=f=>{f&&ut(f).forEach(m=>ie(r.errors,m)),p.state.next({errors:f?r.errors:{}})},I=(f,m,v)=>{const O=(F(n,f,{_f:{}})._f||{}).ref,E=F(r.errors,f)||{},{ref:x,message:$,type:W,...q}=E;X(r.errors,f,{...q,...m,ref:O}),p.state.next({name:f,errors:r.errors,isValid:!1}),v&&v.shouldFocus&&O&&O.focus&&O.focus()},Ce=(f,m)=>Fe(f)?p.state.subscribe({next:v=>"values"in v&&f(N(void 0,m),v)}):N(f,m,!0),Ne=f=>p.state.subscribe({next:m=>{bo(f.name,m.name,f.exact)&&_o(m,f.formState||d,ul,f.reRenderRoot)&&f.callback({values:{...o},...r,...m,defaultValues:s})}}).unsubscribe,U=f=>(i.mount=!0,y={...y,...f.formState},Ne({...f,formState:{...h,...f.formState}})),pe=(f,m={})=>{for(const v of f?ut(f):a.mount)a.mount.delete(v),a.array.delete(v),m.keepValue||(ie(n,v),ie(o,v)),!m.keepError&&ie(r.errors,v),!m.keepDirty&&ie(r.dirtyFields,v),!m.keepTouched&&ie(r.touchedFields,v),!m.keepIsValidating&&ie(r.validatingFields,v),!t.shouldUnregister&&!m.keepDefaultValue&&ie(s,v);p.state.next({values:ue(o)}),p.state.next({...r,...m.keepDirty?{isDirty:T()}:{}}),!m.keepIsValid&&j()},Re=({disabled:f,name:m})=>{if($e(f)&&i.mount||f||a.disabled.has(m)){const E=a.disabled.has(m)!==!!f;f?a.disabled.add(m):a.disabled.delete(m),E&&i.mount&&!i.action&&j()}},Je=(f,m={})=>{let v=F(n,f);const O=$e(m.disabled)||$e(t.disabled);return X(n,f,{...v||{},_f:{...v&&v._f?v._f:{ref:{name:f}},name:f,mount:!0,...m}}),a.mount.add(f),v?Re({disabled:$e(m.disabled)?m.disabled:t.disabled,name:f}):C(f,!0,m.value),{...O?{disabled:m.disabled||t.disabled}:{},...t.progressive?{required:!!m.required,min:ct(m.min),max:ct(m.max),minLength:ct(m.minLength),maxLength:ct(m.maxLength),pattern:ct(m.pattern)}:{},name:f,onChange:he,onBlur:he,ref:E=>{if(E){Je(f,m),v=F(n,f);const x=re(E.value)&&E.querySelectorAll&&E.querySelectorAll("input,select,textarea")[0]||E,$=fo(x),W=v._f.refs||[];if($?W.find(q=>q===x):x===v._f.ref)return;X(n,f,{_f:{...v._f,...$?{refs:[...W.filter(tr),x,...Array.isArray(F(s,f))?[{}]:[]],ref:{type:x.type,name:f}}:{ref:x}}}),C(f,!1,void 0,x)}else v=F(n,f,{}),v._f&&(v._f.mount=!1),(t.shouldUnregister||m.shouldUnregister)&&!(so(a.array,f)&&i.action)&&a.unMount.add(f)}}},br=()=>t.shouldFocusError&&lt(n,ge,a.mount),ol=f=>{$e(f)&&(p.state.next({disabled:f}),lt(n,(m,v)=>{const O=F(n,v);O&&(m.disabled=O._f.disabled||f,Array.isArray(O._f.refs)&&O._f.refs.forEach(E=>{E.disabled=O._f.disabled||f}))},0,!1))},gs=(f,m)=>async v=>{let O;v&&(v.preventDefault&&v.preventDefault(),v.persist&&v.persist());let E=ue(o);if(p.state.next({isSubmitting:!0}),t.resolver){const{errors:x,values:$}=await ae();D(),r.errors=x,E=ue($)}else await Q(n);if(a.disabled.size)for(const x of a.disabled)ie(E,x);if(ie(r.errors,"root"),ve(r.errors)){p.state.next({errors:{}});try{await f(E,v)}catch(x){O=x}}else m&&await m({...r.errors},v),br(),setTimeout(br);if(p.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:ve(r.errors)&&!O,submitCount:r.submitCount+1,errors:r.errors}),O)throw O},il=(f,m={})=>{F(n,f)&&(re(m.defaultValue)?H(f,ue(F(s,f))):(H(f,m.defaultValue),X(s,f,ue(m.defaultValue))),m.keepTouched||ie(r.touchedFields,f),m.keepDirty||(ie(r.dirtyFields,f),r.isDirty=m.defaultValue?T(f,ue(F(s,f))):T()),m.keepError||(ie(r.errors,f),d.isValid&&j()),p.state.next({...r}))},ys=(f,m={})=>{const v=f?ue(f):s,O=ue(v),E=ve(f),x=E?s:O;if(m.keepDefaultValues||(s=v),!m.keepValues){if(m.keepDirtyValues){const $=new Set([...a.mount,...Object.keys(qe(s,o))]);for(const W of Array.from($)){const q=F(r.dirtyFields,W),be=F(o,W),He=F(x,W);q&&!re(be)?X(x,W,be):!q&&!re(He)&&H(W,He)}}else{if(Wt&&re(f))for(const $ of a.mount){const W=F(n,$);if(W&&W._f){const q=Array.isArray(W._f.refs)?W._f.refs[0]:W._f.ref;if(xt(q)){const be=q.closest("form");if(be){be.reset();break}}}}if(m.keepFieldsRef)for(const $ of a.mount)H($,F(x,$));else n={}}o=t.shouldUnregister?m.keepDefaultValues?ue(s):{}:ue(x),p.array.next({values:{...x}}),p.state.next({values:{...x}})}a={mount:m.keepDirtyValues?a.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},i.mount=!d.isValid||!!m.keepIsValid||!!m.keepDirtyValues||!t.shouldUnregister&&!ve(x),i.watch=!!t.shouldUnregister,i.keepIsValid=!!m.keepIsValid,i.action=!1,m.keepErrors||(r.errors={}),p.state.next({submitCount:m.keepSubmitCount?r.submitCount:0,isDirty:E?!1:m.keepDirty?r.isDirty:!!(m.keepDefaultValues&&!Te(f,s)),isSubmitted:m.keepIsSubmitted?r.isSubmitted:!1,dirtyFields:E?{}:m.keepDirtyValues?m.keepDefaultValues&&o?qe(s,o):r.dirtyFields:m.keepDefaultValues&&f?qe(s,f):m.keepDirty?r.dirtyFields:{},touchedFields:m.keepTouched?r.touchedFields:{},errors:m.keepErrors?r.errors:{},isSubmitSuccessful:m.keepIsSubmitSuccessful?r.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:s})},vs=(f,m)=>ys(Fe(f)?f(o):f,{...t.resetOptions,...m}),al=(f,m={})=>{const v=F(n,f),O=v&&v._f;if(O){const E=O.refs?O.refs[0]:O.ref;E.focus&&setTimeout(()=>{E.focus(),m.shouldSelect&&Fe(E.select)&&E.select()})}},ul=f=>{r={...r,...f}},_s={control:{register:Je,unregister:pe,getFieldState:S,handleSubmit:gs,setError:I,_subscribe:Ne,_runSchema:ae,_updateIsValidating:D,_focusError:br,_getWatch:N,_getDirty:T,_setValid:j,_setFieldArray:P,_setDisabledField:Re,_setErrors:L,_getFieldArray:B,_reset:ys,_resetDefaultValues:()=>Fe(t.defaultValues)&&t.defaultValues().then(f=>{vs(f,t.resetOptions),p.state.next({isLoading:!1})}),_removeUnmounted:ze,_disableForm:ol,_subjects:p,_proxyFormState:d,get _fields(){return n},get _formValues(){return o},get _state(){return i},set _state(f){i=f},get _defaultValues(){return s},get _names(){return a},set _names(f){a=f},get _formState(){return r},get _options(){return t},set _options(f){t={...t,...f}}},subscribe:U,trigger:Se,register:Je,handleSubmit:gs,watch:Ce,setValue:H,getValues:l,reset:vs,resetField:il,clearErrors:z,unregister:pe,setError:I,setFocus:al,getFieldState:S};return{..._s,formControl:_s}}function ft(e={}){const t=V.useRef(void 0),r=V.useRef(void 0),[n,s]=V.useState({isDirty:!1,isValidating:!1,isLoading:Fe(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,isReady:!1,defaultValues:Fe(e.defaultValues)?void 0:e.defaultValues});if(!t.current)if(e.formControl)t.current={...e.formControl,formState:n},e.defaultValues&&!Fe(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:i,...a}=Eo(e);t.current={...a,formState:n}}const o=t.current.control;return o._options=e,uo(()=>{const i=o._subscribe({formState:o._proxyFormState,callback:()=>s({...o._formState}),reRenderRoot:!0});return s(a=>({...a,isReady:!0})),o._formState.isReady=!0,i},[o]),V.useEffect(()=>o._disableForm(e.disabled),[o,e.disabled]),V.useEffect(()=>{e.mode&&(o._options.mode=e.mode),e.reValidateMode&&(o._options.reValidateMode=e.reValidateMode)},[o,e.mode,e.reValidateMode]),V.useEffect(()=>{e.errors&&(o._setErrors(e.errors),o._focusError())},[o,e.errors]),V.useEffect(()=>{e.shouldUnregister&&o._subjects.state.next({values:o._getWatch()})},[o,e.shouldUnregister]),V.useEffect(()=>{if(o._proxyFormState.isDirty){const i=o._getDirty();i!==n.isDirty&&o._subjects.state.next({isDirty:i})}},[o,n.isDirty]),V.useEffect(()=>{var i;e.values&&!Te(e.values,r.current)?(o._reset(e.values,{keepFieldsRef:!0,...o._options.resetOptions}),!((i=o._options.resetOptions)===null||i===void 0)&&i.keepIsValid||o._setValid(),r.current=e.values,s(a=>({...a}))):o._resetDefaultValues()},[o,e.values]),V.useEffect(()=>{o._state.mount||(o._setValid(),o._state.mount=!0),o._state.watch&&(o._state.watch=!1,o._subjects.state.next({...o._formState})),o._removeUnmounted()}),t.current.formState=V.useMemo(()=>ao(n,o),[o,n]),t.current}const hn=(e,t,r)=>{if(e&&"reportValidity"in e){const n=F(r,t);e.setCustomValidity(n&&n.message||""),e.reportValidity()}},nr=(e,t)=>{for(const r in t.fields){const n=t.fields[r];n&&n.ref&&"reportValidity"in n.ref?hn(n.ref,r,e):n&&n.refs&&n.refs.forEach(s=>hn(s,r,e))}},pn=(e,t)=>{t.shouldUseNativeValidation&&nr(e,t);const r={};for(const n in e){const s=F(t.fields,n),o=Object.assign(e[n]||{},{ref:s&&s.ref});if(Oo(t.names||Object.keys(e),n)){const i=Object.assign({},F(r,n));X(i,"root",o),X(r,n,i)}else X(r,n,o)}return r},Oo=(e,t)=>{const r=mn(t);return e.some(n=>mn(n).match(`^${r}\\.\\d+`))};function mn(e){return e.replace(/\]|\[/g,"")}function w(e,t,r){function n(a,u){if(a._zod||Object.defineProperty(a,"_zod",{value:{def:u,constr:i,traits:new Set},enumerable:!1}),a._zod.traits.has(e))return;a._zod.traits.add(e),t(a,u);const c=i.prototype,h=Object.keys(c);for(let d=0;d<h.length;d++){const y=h[d];y in a||(a[y]=c[y].bind(a))}}const s=r?.Parent??Object;class o extends s{}Object.defineProperty(o,"name",{value:e});function i(a){var u;const c=r?.Parent?new o:this;n(c,a),(u=c._zod).deferred??(u.deferred=[]);for(const h of c._zod.deferred)h();return c}return Object.defineProperty(i,"init",{value:n}),Object.defineProperty(i,Symbol.hasInstance,{value:a=>r?.Parent&&a instanceof r.Parent?!0:a?._zod?.traits?.has(e)}),Object.defineProperty(i,"name",{value:e}),i}class Ge extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class gn extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const yn={};function Me(e){return yn}function vn(e){const t=Object.values(e).filter(n=>typeof n=="number");return Object.entries(e).filter(([n,s])=>t.indexOf(+n)===-1).map(([n,s])=>s)}function sr(e,t){return typeof t=="bigint"?t.toString():t}function or(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function ir(e){return e==null}function ar(e){const t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}const _n=Symbol("evaluating");function J(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==_n)return n===void 0&&(n=_n,n=r()),n},set(s){Object.defineProperty(e,t,{value:s})},configurable:!0})}function Be(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function De(...e){const t={};for(const r of e){const n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function bn(e){return JSON.stringify(e)}function Fo(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const wn="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Et(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const Po=or(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function dt(e){if(Et(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const r=t.prototype;return!(Et(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function Sn(e){return dt(e)?{...e}:Array.isArray(e)?[...e]:e}const jo=new Set(["string","number","symbol"]);function Ot(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ie(e,t,r){const n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}function A(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function $o(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}function Lo(e,t){const r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const o=De(e._zod.def,{get shape(){const i={};for(const a in t){if(!(a in r.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&(i[a]=r.shape[a])}return Be(this,"shape",i),i},checks:[]});return Ie(e,o)}function zo(e,t){const r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const o=De(e._zod.def,{get shape(){const i={...e._zod.def.shape};for(const a in t){if(!(a in r.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&delete i[a]}return Be(this,"shape",i),i},checks:[]});return Ie(e,o)}function Co(e,t){if(!dt(t))throw new Error("Invalid input to extend: expected a plain object");const r=e._zod.def.checks;if(r&&r.length>0){const o=e._zod.def.shape;for(const i in t)if(Object.getOwnPropertyDescriptor(o,i)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const s=De(e._zod.def,{get shape(){const o={...e._zod.def.shape,...t};return Be(this,"shape",o),o}});return Ie(e,s)}function No(e,t){if(!dt(t))throw new Error("Invalid input to safeExtend: expected a plain object");const r=De(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t};return Be(this,"shape",n),n}});return Ie(e,r)}function Ro(e,t){const r=De(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t._zod.def.shape};return Be(this,"shape",n),n},get catchall(){return t._zod.def.catchall},checks:[]});return Ie(e,r)}function Ao(e,t,r){const s=t._zod.def.checks;if(s&&s.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const i=De(t._zod.def,{get shape(){const a=t._zod.def.shape,u={...a};if(r)for(const c in r){if(!(c in a))throw new Error(`Unrecognized key: "${c}"`);r[c]&&(u[c]=e?new e({type:"optional",innerType:a[c]}):a[c])}else for(const c in a)u[c]=e?new e({type:"optional",innerType:a[c]}):a[c];return Be(this,"shape",u),u},checks:[]});return Ie(t,i)}function To(e,t,r){const n=De(t._zod.def,{get shape(){const s=t._zod.def.shape,o={...s};if(r)for(const i in r){if(!(i in o))throw new Error(`Unrecognized key: "${i}"`);r[i]&&(o[i]=new e({type:"nonoptional",innerType:s[i]}))}else for(const i in s)o[i]=new e({type:"nonoptional",innerType:s[i]});return Be(this,"shape",o),o}});return Ie(t,n)}function Xe(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function xn(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function Ft(e){return typeof e=="string"?e:e?.message}function Ke(e,t,r){const n={...e,path:e.path??[]};if(!e.message){const s=Ft(e.inst?._zod.def?.error?.(e))??Ft(t?.error?.(e))??Ft(r.customError?.(e))??Ft(r.localeError?.(e))??"Invalid input";n.message=s}return delete n.inst,delete n.continue,t?.reportInput||delete n.input,n}function ur(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function ht(...e){const[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}const kn=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,sr,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},cr=w("$ZodError",kn),Pt=w("$ZodError",kn,{Parent:Error});function Do(e,t=r=>r.message){const r={},n=[];for(const s of e.issues)s.path.length>0?(r[s.path[0]]=r[s.path[0]]||[],r[s.path[0]].push(t(s))):n.push(t(s));return{formErrors:n,fieldErrors:r}}function Io(e,t=r=>r.message){const r={_errors:[]},n=s=>{for(const o of s.issues)if(o.code==="invalid_union"&&o.errors.length)o.errors.map(i=>n({issues:i}));else if(o.code==="invalid_key")n({issues:o.issues});else if(o.code==="invalid_element")n({issues:o.issues});else if(o.path.length===0)r._errors.push(t(o));else{let i=r,a=0;for(;a<o.path.length;){const u=o.path[a];a===o.path.length-1?(i[u]=i[u]||{_errors:[]},i[u]._errors.push(t(o))):i[u]=i[u]||{_errors:[]},i=i[u],a++}}};return n(e),r}const jt=e=>(t,r,n,s)=>{const o=n?Object.assign(n,{async:!1}):{async:!1},i=t._zod.run({value:r,issues:[]},o);if(i instanceof Promise)throw new Ge;if(i.issues.length){const a=new(s?.Err??e)(i.issues.map(u=>Ke(u,o,Me())));throw wn(a,s?.callee),a}return i.value},Vo=jt(Pt),$t=e=>async(t,r,n,s)=>{const o=n?Object.assign(n,{async:!0}):{async:!0};let i=t._zod.run({value:r,issues:[]},o);if(i instanceof Promise&&(i=await i),i.issues.length){const a=new(s?.Err??e)(i.issues.map(u=>Ke(u,o,Me())));throw wn(a,s?.callee),a}return i.value},Zo=$t(Pt),Lt=e=>(t,r,n)=>{const s=n?{...n,async:!1}:{async:!1},o=t._zod.run({value:r,issues:[]},s);if(o instanceof Promise)throw new Ge;return o.issues.length?{success:!1,error:new(e??cr)(o.issues.map(i=>Ke(i,s,Me())))}:{success:!0,data:o.value}},Uo=Lt(Pt),zt=e=>async(t,r,n)=>{const s=n?Object.assign(n,{async:!0}):{async:!0};let o=t._zod.run({value:r,issues:[]},s);return o instanceof Promise&&(o=await o),o.issues.length?{success:!1,error:new e(o.issues.map(i=>Ke(i,s,Me())))}:{success:!0,data:o.value}},Mo=zt(Pt),Bo=e=>(t,r,n)=>{const s=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return jt(e)(t,r,s)},Ko=e=>(t,r,n)=>jt(e)(t,r,n),Jo=e=>async(t,r,n)=>{const s=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return $t(e)(t,r,s)},Ho=e=>async(t,r,n)=>$t(e)(t,r,n),Wo=e=>(t,r,n)=>{const s=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Lt(e)(t,r,s)},qo=e=>(t,r,n)=>Lt(e)(t,r,n),Yo=e=>async(t,r,n)=>{const s=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return zt(e)(t,r,s)},Go=e=>async(t,r,n)=>zt(e)(t,r,n),Xo=/^[cC][^\s-]{8,}$/,Qo=/^[0-9a-z]+$/,ei=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,ti=/^[0-9a-vA-V]{20}$/,ri=/^[A-Za-z0-9]{27}$/,ni=/^[a-zA-Z0-9_-]{21}$/,si=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,oi=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,En=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,ii=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,ai="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function ui(){return new RegExp(ai,"u")}const ci=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,li=/^(([0-9a-fA-F]{1,4}:){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}|:))$/,fi=/^((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])\/([0-9]|[1-2][0-9]|3[0-2])$/,di=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,hi=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,On=/^[A-Za-z0-9_-]*$/,pi=/^\+[1-9]\d{6,14}$/,Fn="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",mi=new RegExp(`^${Fn}$`);function Pn(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function gi(e){return new RegExp(`^${Pn(e)}$`)}function yi(e){const t=Pn({precision:e.precision}),r=["Z"];e.local&&r.push(""),e.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const n=`${t}(?:${r.join("|")})`;return new RegExp(`^${Fn}T(?:${n})$`)}const vi=e=>{const t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},_i=/^[^A-Z]*$/,bi=/^[^a-z]*$/,Le=w("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),wi=w("$ZodCheckMaxLength",(e,t)=>{var r;Le.init(e,t),(r=e._zod.def).when??(r.when=n=>{const s=n.value;return!ir(s)&&s.length!==void 0}),e._zod.onattach.push(n=>{const s=n._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<s&&(n._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{const s=n.value;if(s.length<=t.maximum)return;const i=ur(s);n.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:s,inst:e,continue:!t.abort})}}),Si=w("$ZodCheckMinLength",(e,t)=>{var r;Le.init(e,t),(r=e._zod.def).when??(r.when=n=>{const s=n.value;return!ir(s)&&s.length!==void 0}),e._zod.onattach.push(n=>{const s=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>s&&(n._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{const s=n.value;if(s.length>=t.minimum)return;const i=ur(s);n.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:s,inst:e,continue:!t.abort})}}),xi=w("$ZodCheckLengthEquals",(e,t)=>{var r;Le.init(e,t),(r=e._zod.def).when??(r.when=n=>{const s=n.value;return!ir(s)&&s.length!==void 0}),e._zod.onattach.push(n=>{const s=n._zod.bag;s.minimum=t.length,s.maximum=t.length,s.length=t.length}),e._zod.check=n=>{const s=n.value,o=s.length;if(o===t.length)return;const i=ur(s),a=o>t.length;n.issues.push({origin:i,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Ct=w("$ZodCheckStringFormat",(e,t)=>{var r,n;Le.init(e,t),e._zod.onattach.push(s=>{const o=s._zod.bag;o.format=t.format,t.pattern&&(o.patterns??(o.patterns=new Set),o.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=s=>{t.pattern.lastIndex=0,!t.pattern.test(s.value)&&s.issues.push({origin:"string",code:"invalid_format",format:t.format,input:s.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),ki=w("$ZodCheckRegex",(e,t)=>{Ct.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Ei=w("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=_i),Ct.init(e,t)}),Oi=w("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=bi),Ct.init(e,t)}),Fi=w("$ZodCheckIncludes",(e,t)=>{Le.init(e,t);const r=Ot(t.includes),n=new RegExp(typeof t.position=="number"?`^.{${t.position}}${r}`:r);t.pattern=n,e._zod.onattach.push(s=>{const o=s._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),e._zod.check=s=>{s.value.includes(t.includes,t.position)||s.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:s.value,inst:e,continue:!t.abort})}}),Pi=w("$ZodCheckStartsWith",(e,t)=>{Le.init(e,t);const r=new RegExp(`^${Ot(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push(n=>{const s=n._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(r)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),ji=w("$ZodCheckEndsWith",(e,t)=>{Le.init(e,t);const r=new RegExp(`.*${Ot(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push(n=>{const s=n._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(r)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),$i=w("$ZodCheckOverwrite",(e,t)=>{Le.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});class Li{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const n=t.split(`
12
- `).filter(i=>i),s=Math.min(...n.map(i=>i.length-i.trimStart().length)),o=n.map(i=>i.slice(s)).map(i=>" ".repeat(this.indent*2)+i);for(const i of o)this.content.push(i)}compile(){const t=Function,r=this?.args,s=[...(this?.content??[""]).map(o=>` ${o}`)];return new t(...r,s.join(`
13
- `))}}const zi={major:4,minor:3,patch:5},ce=w("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=zi;const n=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&n.unshift(e);for(const s of n)for(const o of s._zod.onattach)o(e);if(n.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const s=(i,a,u)=>{let c=Xe(i),h;for(const d of a){if(d._zod.def.when){if(!d._zod.def.when(i))continue}else if(c)continue;const y=i.issues.length,p=d._zod.check(i);if(p instanceof Promise&&u?.async===!1)throw new Ge;if(h||p instanceof Promise)h=(h??Promise.resolve()).then(async()=>{await p,i.issues.length!==y&&(c||(c=Xe(i,y)))});else{if(i.issues.length===y)continue;c||(c=Xe(i,y))}}return h?h.then(()=>i):i},o=(i,a,u)=>{if(Xe(i))return i.aborted=!0,i;const c=s(a,n,u);if(c instanceof Promise){if(u.async===!1)throw new Ge;return c.then(h=>e._zod.parse(h,u))}return e._zod.parse(c,u)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if(a.direction==="backward"){const c=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return c instanceof Promise?c.then(h=>o(h,i,a)):o(c,i,a)}const u=e._zod.parse(i,a);if(u instanceof Promise){if(a.async===!1)throw new Ge;return u.then(c=>s(c,n,a))}return s(u,n,a)}}J(e,"~standard",()=>({validate:s=>{try{const o=Uo(e,s);return o.success?{value:o.data}:{issues:o.error?.issues}}catch{return Mo(e,s).then(i=>i.success?{value:i.data}:{issues:i.error?.issues})}},vendor:"zod",version:1}))}),lr=w("$ZodString",(e,t)=>{ce.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??vi(e._zod.bag),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),te=w("$ZodStringFormat",(e,t)=>{Ct.init(e,t),lr.init(e,t)}),Ci=w("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=oi),te.init(e,t)}),Ni=w("$ZodUUID",(e,t)=>{if(t.version){const n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(n===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=En(n))}else t.pattern??(t.pattern=En());te.init(e,t)}),Ri=w("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=ii),te.init(e,t)}),Ai=w("$ZodURL",(e,t)=>{te.init(e,t),e._zod.check=r=>{try{const n=r.value.trim(),s=new URL(n);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(s.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(s.protocol.endsWith(":")?s.protocol.slice(0,-1):s.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})),t.normalize?r.value=s.href:r.value=n;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),Ti=w("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=ui()),te.init(e,t)}),Di=w("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=ni),te.init(e,t)}),Ii=w("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Xo),te.init(e,t)}),Vi=w("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Qo),te.init(e,t)}),Zi=w("$ZodULID",(e,t)=>{t.pattern??(t.pattern=ei),te.init(e,t)}),Ui=w("$ZodXID",(e,t)=>{t.pattern??(t.pattern=ti),te.init(e,t)}),Mi=w("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=ri),te.init(e,t)}),Bi=w("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=yi(t)),te.init(e,t)}),Ki=w("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=mi),te.init(e,t)}),Ji=w("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=gi(t)),te.init(e,t)}),Hi=w("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=si),te.init(e,t)}),Wi=w("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=ci),te.init(e,t),e._zod.bag.format="ipv4"}),qi=w("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=li),te.init(e,t),e._zod.bag.format="ipv6",e._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}}),Yi=w("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=fi),te.init(e,t)}),Gi=w("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=di),te.init(e,t),e._zod.check=r=>{const n=r.value.split("/");try{if(n.length!==2)throw new Error;const[s,o]=n;if(!o)throw new Error;const i=Number(o);if(`${i}`!==o)throw new Error;if(i<0||i>128)throw new Error;new URL(`http://[${s}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function jn(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const Xi=w("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=hi),te.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{jn(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function Qi(e){if(!On.test(e))return!1;const t=e.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return jn(r)}const ea=w("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=On),te.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{Qi(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),ta=w("$ZodE164",(e,t)=>{t.pattern??(t.pattern=pi),te.init(e,t)});function ra(e,t=null){try{const r=e.split(".");if(r.length!==3)return!1;const[n]=r;if(!n)return!1;const s=JSON.parse(atob(n));return!("typ"in s&&s?.typ!=="JWT"||!s.alg||t&&(!("alg"in s)||s.alg!==t))}catch{return!1}}const na=w("$ZodJWT",(e,t)=>{te.init(e,t),e._zod.check=r=>{ra(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),sa=w("$ZodUnknown",(e,t)=>{ce.init(e,t),e._zod.parse=r=>r}),oa=w("$ZodNever",(e,t)=>{ce.init(e,t),e._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)});function $n(e,t,r){e.issues.length&&t.issues.push(...xn(r,e.issues)),t.value[r]=e.value}const ia=w("$ZodArray",(e,t)=>{ce.init(e,t),e._zod.parse=(r,n)=>{const s=r.value;if(!Array.isArray(s))return r.issues.push({expected:"array",code:"invalid_type",input:s,inst:e}),r;r.value=Array(s.length);const o=[];for(let i=0;i<s.length;i++){const a=s[i],u=t.element._zod.run({value:a,issues:[]},n);u instanceof Promise?o.push(u.then(c=>$n(c,r,i))):$n(u,r,i)}return o.length?Promise.all(o).then(()=>r):r}});function Nt(e,t,r,n,s){if(e.issues.length){if(s&&!(r in n))return;t.issues.push(...xn(r,e.issues))}e.value===void 0?r in n&&(t.value[r]=void 0):t.value[r]=e.value}function Ln(e){const t=Object.keys(e.shape);for(const n of t)if(!e.shape?.[n]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${n}": expected a Zod schema`);const r=$o(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function zn(e,t,r,n,s,o){const i=[],a=s.keySet,u=s.catchall._zod,c=u.def.type,h=u.optout==="optional";for(const d in t){if(a.has(d))continue;if(c==="never"){i.push(d);continue}const y=u.run({value:t[d],issues:[]},n);y instanceof Promise?e.push(y.then(p=>Nt(p,r,d,t,h))):Nt(y,r,d,t,h)}return i.length&&r.issues.push({code:"unrecognized_keys",keys:i,input:t,inst:o}),e.length?Promise.all(e).then(()=>r):r}const aa=w("$ZodObject",(e,t)=>{if(ce.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){const a=t.shape;Object.defineProperty(t,"shape",{get:()=>{const u={...a};return Object.defineProperty(t,"shape",{value:u}),u}})}const n=or(()=>Ln(t));J(e._zod,"propValues",()=>{const a=t.shape,u={};for(const c in a){const h=a[c]._zod;if(h.values){u[c]??(u[c]=new Set);for(const d of h.values)u[c].add(d)}}return u});const s=Et,o=t.catchall;let i;e._zod.parse=(a,u)=>{i??(i=n.value);const c=a.value;if(!s(c))return a.issues.push({expected:"object",code:"invalid_type",input:c,inst:e}),a;a.value={};const h=[],d=i.shape;for(const y of i.keys){const p=d[y],_=p._zod.optout==="optional",k=p._zod.run({value:c[y],issues:[]},u);k instanceof Promise?h.push(k.then(j=>Nt(j,a,y,c,_))):Nt(k,a,y,c,_)}return o?zn(h,c,a,u,n.value,e):h.length?Promise.all(h).then(()=>a):a}}),ua=w("$ZodObjectJIT",(e,t)=>{aa.init(e,t);const r=e._zod.parse,n=or(()=>Ln(t)),s=y=>{const p=new Li(["shape","payload","ctx"]),_=n.value,k=Z=>{const L=bn(Z);return`shape[${L}]._zod.run({ value: input[${L}], issues: [] }, ctx)`};p.write("const input = payload.value;");const j=Object.create(null);let D=0;for(const Z of _.keys)j[Z]=`key_${D++}`;p.write("const newResult = {};");for(const Z of _.keys){const L=j[Z],C=bn(Z),K=y[Z]?._zod?.optout==="optional";p.write(`const ${L} = ${k(Z)};`),K?p.write(`
14
- if (${L}.issues.length) {
6
+ <%s key={someKey} {...props} />`,G,X,ze,X),Ae[X+G]=!0)}if(X=null,W!==void 0&&(r(W),X=""+W),s($)&&(r($.key),X=""+$.key),"key"in $){W={};for(var He in $)He!=="key"&&(W[He]=$[He])}else W=$;return X&&a(W,typeof _=="function"?_.displayName||_.name||"Unknown":_),d(_,X,W,o(),We,qe)}function y(_){v(_)?_._store&&(_._store.validated=1):typeof _=="object"&&_!==null&&_.$$typeof===Se&&(_._payload.status==="fulfilled"?v(_._payload.value)&&_._payload.value._store&&(_._payload.value._store.validated=1):_._store&&(_._store.validated=1))}function v(_){return typeof _=="object"&&_!==null&&_.$$typeof===O}var h=P,O=Symbol.for("react.transitional.element"),S=Symbol.for("react.portal"),T=Symbol.for("react.fragment"),L=Symbol.for("react.strict_mode"),j=Symbol.for("react.profiler"),I=Symbol.for("react.consumer"),D=Symbol.for("react.context"),C=Symbol.for("react.forward_ref"),M=Symbol.for("react.suspense"),K=Symbol.for("react.suspense_list"),fe=Symbol.for("react.memo"),Se=Symbol.for("react.lazy"),he=Symbol.for("react.activity"),Je=Symbol.for("react.client.reference"),A=h.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Z=Object.prototype.hasOwnProperty,Y=Array.isArray,te=console.createTask?console.createTask:function(){return null};h={react_stack_bottom_frame:function(_){return _()}};var pe,ce={},Pe=h.react_stack_bottom_frame.bind(h,i)(),$e=te(n(i)),Ae={};Ge.Fragment=T,Ge.jsx=function(_,$,W){var G=1e4>A.recentlyCreatedOwnerStacks++;return w(_,$,W,!1,G?Error("react-stack-top-frame"):Pe,G?te(n(_)):$e)},Ge.jsxs=function(_,$,W){var G=1e4>A.recentlyCreatedOwnerStacks++;return w(_,$,W,!0,G?Error("react-stack-top-frame"):Pe,G?te(n(_)):$e)}})()),Ge}var sr;function Nn(){return sr||(sr=1,process.env.NODE_ENV==="production"?it.exports=In():it.exports=Ln()),it.exports}var f=Nn();const Rn=({reset:e,processing:t})=>f.jsx("div",{className:"fixed right-2 top-4",children:f.jsx(p.Button,{onClick:e,variant:t?"destructive":"secondary",size:"icon-sm",className:"cursor-pointer",disabled:t,children:f.jsx(ve.RefreshCw,{className:p.cn({"animate-spin":t})})})}),ae={loginForm:{emailInput:"login-form-email-input",passwordInput:"login-form-password-input",submitButton:"login-form-submit-button",signUpFormLink:"login-form-signup-link",resetPasswordLink:"login-form-reset-password-link"},signupForm:{emailInput:"signup-form-email-input",passwordInput:"signup-form-password-input",submitButton:"signup-form-submit-button"},verifyEmailForm:{authCodeInput:"verify-email-form-auth-code-input",submitButton:"verify-email-form-submit-button"},startResetPasswordForm:{emailInput:"start-reset-password-form-email-input",submitButton:"start-reset-password-form-submit-button"},confirmResetPasswordForm:{authCodeInput:"confirm-reset-password-form-auth-code-input",newPasswordInput:"confirm-reset-password-form-new-password-input",submitButton:"confirm-reset-password-form-submit-button"}};function Vn(e){const[t,r]=P.useState(!1);return f.jsx("div",{className:"flex flex-col gap-6",children:f.jsxs(p.Card,{children:[f.jsxs(p.CardHeader,{children:[f.jsx(p.CardTitle,{className:"text-2xl",children:e.i18n.t("auth.confirmResetPasswordForm.form.title")}),f.jsx(p.CardDescription,{children:e.i18n.t("auth.confirmResetPasswordForm.form.description")})]}),f.jsx(p.CardContent,{children:f.jsx(p.Form,{...e.form,children:f.jsx("form",{onSubmit:e.form.handleSubmit(e.submit),children:f.jsxs("div",{className:"flex flex-col gap-6",children:[f.jsxs("div",{className:"grid gap-2",children:[f.jsx(p.Label,{children:e.i18n.t("auth.confirmResetPasswordForm.form.authCodeInputLabel")}),f.jsx(p.FormField,{control:e.form.control,name:"code",render:({field:n})=>f.jsx(p.FormItem,{children:f.jsx(p.FormControl,{children:f.jsx(p.Input,{type:"text",placeholder:"00001234","data-testid":ae.confirmResetPasswordForm.authCodeInput,required:!0,...n})})})})]}),f.jsxs("div",{className:"grid gap-2",children:[f.jsx("div",{className:"flex items-center",children:f.jsx(p.Label,{children:e.i18n.t("auth.confirmResetPasswordForm.form.passwordInputLabel")})}),f.jsx(p.FormField,{control:e.form.control,name:"password",render:({field:n,fieldState:o})=>f.jsx(p.FormItem,{children:f.jsx(p.FormControl,{className:"relative",children:f.jsxs(f.Fragment,{children:[f.jsxs("div",{className:"relative",children:[t?f.jsx(ve.EyeOff,{className:"absolute right-3 top-1/2 transform -translate-y-1/2 text-gray-500 z-10 cursor-pointer",onClick:()=>{r(!1)}}):f.jsx(ve.EyeIcon,{className:"absolute right-3 top-1/2 transform -translate-y-1/2 text-gray-500 z-10 cursor-pointer",onClick:()=>{r(!0)}}),f.jsx(p.Input,{disabled:e.form.formState.isSubmitting,type:t?"text":"password",placeholder:"********","aria-invalid":!!e.form.formState.errors?.password,"data-testid":ae.confirmResetPasswordForm.newPasswordInput,...n,className:"pr-10"})]}),o.invalid&&f.jsx(p.FieldError,{errors:[o.error]})]})})})})]}),f.jsxs(p.Button,{type:"submit",className:"w-full cursor-pointer","data-testid":ae.confirmResetPasswordForm.submitButton,children:[e.i18n.t("auth.confirmResetPasswordForm.form.submitButtonLabel"),e.form.formState.isSubmitting&&f.jsx(ve.Loader2Icon,{className:"animate-spin"})]}),f.jsxs(p.FieldDescription,{className:"text-center",children:[e.i18n.t("auth.confirmResetPasswordForm.form.loginLinkMessage")," ",f.jsx(ge.Link,{to:"/auth/login",children:e.i18n.t("auth.confirmResetPasswordForm.form.loginLink")})]})]})})})})]})})}function Un(e){const{i18n:t}=P.useContext(Zn.LocaleContext),[r,n]=P.useState(!1);return f.jsx("div",{className:"flex flex-col gap-6",children:f.jsxs(p.Card,{className:p.cn("transition-opacity",{"opacity-50":e.form.formState.isSubmitting}),children:[f.jsxs(p.CardHeader,{children:[f.jsx(p.CardTitle,{className:"text-2xl",children:t.t("auth.loginForm.form.title")}),f.jsx(p.CardDescription,{children:t.t("auth.loginForm.form.description")})]}),f.jsx(p.CardContent,{children:f.jsx(p.Form,{...e.form,children:f.jsx("form",{onSubmit:e.form.handleSubmit(e.submit),children:f.jsxs("div",{className:"flex flex-col gap-6",children:[f.jsxs("div",{className:"grid gap-2",children:[f.jsx(p.Label,{htmlFor:"email",children:t.t("auth.loginForm.form.emailLabel")}),f.jsx(p.FormField,{control:e.form.control,name:"email",render:({field:o})=>f.jsxs(p.FormItem,{children:[f.jsx(p.FormControl,{children:f.jsx(p.Input,{disabled:e.form.formState.isSubmitting,type:"email",placeholder:"m@example.com",required:!0,"data-testid":ae.loginForm.emailInput,...o})}),f.jsx(p.FormMessage,{})]})})]}),f.jsxs("div",{className:"grid gap-2",children:[f.jsxs("div",{className:"flex items-center",children:[f.jsx(p.Label,{htmlFor:"password",children:t.t("auth.loginForm.form.passwordLabel")}),f.jsx(ge.Link,{to:"/auth/start-reset-password",className:"ml-auto inline-block text-sm underline-offset-4 hover:underline","data-testid":ae.loginForm.resetPasswordLink,children:t.t("auth.loginForm.form.forgotPasswordMessage")})]}),f.jsx(p.FormField,{control:e.form.control,name:"password",render:({field:o})=>f.jsxs(p.FormItem,{children:[f.jsx(p.FormControl,{className:"relative",children:f.jsxs("div",{className:"relative",children:[r?f.jsx(ve.EyeOff,{className:"absolute right-3 top-1/2 transform -translate-y-1/2 text-gray-500 z-10 cursor-pointer",onClick:()=>{n(!1)}}):f.jsx(ve.EyeIcon,{className:"absolute right-3 top-1/2 transform -translate-y-1/2 text-gray-500 z-10 cursor-pointer",onClick:()=>{n(!0)}}),f.jsx(p.Input,{placeholder:"********",disabled:e.form.formState.isSubmitting,"data-testid":ae.loginForm.passwordInput,...o,className:"pr-10","aria-invalid":!!e.form.formState.errors?.password,type:r?"text":"password"})]})}),f.jsx(p.FormMessage,{})]})})]}),f.jsxs(p.Button,{type:"submit",className:"w-full cursor-pointer",disabled:e.form.formState.isSubmitting,"data-testid":ae.loginForm.submitButton,children:[t.t("auth.loginForm.form.submitButtonLabel"),e.form.formState.isSubmitting&&f.jsx(ve.Loader2Icon,{className:"animate-spin"})]}),f.jsxs(p.FieldDescription,{className:"text-center",children:[t.t("auth.loginForm.form.dontHaveAccountMessage")," ",f.jsx(ge.Link,{to:"/auth/signup","data-testid":ae.loginForm.signUpFormLink,children:t.t("auth.loginForm.form.dontHaveAccountLink")})]})]})})})})]})})}function Mn(e){const[t,r]=P.useState(!1);return f.jsx("div",{className:"flex flex-col gap-6",children:f.jsxs(p.Card,{className:p.cn({"opacity-50":e.form.formState.isSubmitting}),children:[f.jsxs(p.CardHeader,{children:[f.jsx(p.CardTitle,{className:"text-2xl",children:e.i18n.t("auth.signUpForm.form.title")}),f.jsx(p.CardDescription,{children:e.i18n.t("auth.signUpForm.form.description")})]}),f.jsx(p.CardContent,{children:f.jsx(p.Form,{...e.form,children:f.jsx("form",{onSubmit:e.form.handleSubmit(e.submit),children:f.jsxs("div",{className:"flex flex-col gap-6",children:[f.jsxs("div",{className:"grid gap-2",children:[f.jsx(p.Label,{children:e.i18n.t("auth.signUpForm.form.emailLabel")}),f.jsx(p.FormField,{control:e.form.control,name:"email",render:({field:n})=>f.jsx(p.FormItem,{children:f.jsx(p.FormControl,{children:f.jsx(p.Input,{disabled:e.form.formState.isSubmitting,type:"email","data-testid":ae.signupForm.emailInput,placeholder:"m@example.com",required:!0,...n})})})})]}),f.jsxs("div",{className:"grid gap-2",children:[f.jsxs("div",{className:"flex items-center",children:[f.jsx(p.Label,{children:e.i18n.t("auth.signUpForm.form.passwordLabel")}),f.jsx(ge.Link,{to:"/auth/start-reset-password",className:"ml-auto inline-block text-sm underline-offset-4 hover:underline",children:e.i18n.t("auth.signUpForm.form.forgotPasswordMessage")})]}),f.jsx(p.FormField,{control:e.form.control,name:"password",render:({field:n,fieldState:o})=>f.jsx(p.FormItem,{children:f.jsx(p.FormControl,{className:"relative",children:f.jsxs(f.Fragment,{children:[f.jsxs("div",{className:"relative",children:[t?f.jsx(ve.EyeOff,{className:"absolute right-3 top-1/2 transform -translate-y-1/2 text-gray-500 z-10 cursor-pointer",onClick:()=>{r(!1)}}):f.jsx(ve.EyeIcon,{className:"absolute right-3 top-1/2 transform -translate-y-1/2 text-gray-500 z-10 cursor-pointer",onClick:()=>{r(!0)}}),f.jsx(p.Input,{disabled:e.form.formState.isSubmitting,type:t?"text":"password",placeholder:"********","aria-invalid":!!e.form.formState.errors?.password,"data-testid":ae.signupForm.passwordInput,...n,className:"pr-10"})]}),o.invalid&&f.jsx(p.FieldError,{errors:[o.error]})]})})})})]}),f.jsxs(p.Button,{type:"submit",className:"w-full cursor-pointer",disabled:e.form.formState.isSubmitting,"data-testid":ae.signupForm.submitButton,children:[e.i18n.t("auth.signUpForm.form.submitButtonLabel"),e.form.formState.isSubmitting&&f.jsx(ve.Loader2Icon,{className:"animate-spin"})]}),f.jsxs(p.FieldDescription,{className:"text-center",children:[e.i18n.t("auth.signUpForm.form.loginLinkMessage")," ",f.jsx(ge.Link,{to:"/auth/login",children:e.i18n.t("auth.signUpForm.form.loginLink")})]})]})})})})]})})}function Bn(e){return f.jsx("div",{className:"flex flex-col gap-6",children:f.jsxs(p.Card,{className:p.cn("transition-opacity",{"opacity-50":e.form.formState.isSubmitting}),children:[f.jsxs(p.CardHeader,{children:[f.jsx(p.CardTitle,{className:"text-2xl",children:e.i18n.t("auth.startResetPasswordForm.form.title")}),f.jsx(p.CardDescription,{children:e.i18n.t("auth.startResetPasswordForm.form.description")})]}),f.jsx(p.CardContent,{children:f.jsx(p.Form,{...e.form,children:f.jsx("form",{onSubmit:e.form.handleSubmit(e.submit),children:f.jsxs("div",{className:"flex flex-col gap-6",children:[f.jsxs("div",{className:"grid gap-2",children:[f.jsx(p.Label,{htmlFor:"email",children:e.i18n.t("auth.startResetPasswordForm.form.emailLabel")}),f.jsx(p.FormField,{control:e.form.control,name:"email",render:({field:t})=>f.jsxs(p.FormItem,{children:[f.jsx(p.FormControl,{children:f.jsx(p.Input,{disabled:e.form.formState.isSubmitting,type:"email",placeholder:"m@example.com",required:!0,"data-testid":ae.startResetPasswordForm.emailInput,...t})}),f.jsx(p.FormMessage,{})]})})]}),f.jsxs(p.Button,{type:"submit",className:"w-full cursor-pointer",disabled:e.form.formState.isSubmitting,"data-testid":ae.startResetPasswordForm.submitButton,children:[e.i18n.t("auth.startResetPasswordForm.form.submitButtonLabel"),e.form.formState.isSubmitting&&f.jsx(ve.Loader2Icon,{className:"animate-spin"})]}),f.jsxs(p.FieldDescription,{className:"text-center",children:[e.i18n.t("auth.startResetPasswordForm.form.loginLinkMessage")," ",f.jsx(ge.Link,{to:"/auth/login",children:e.i18n.t("auth.startResetPasswordForm.form.loginLink")})]})]})})})})]})})}function Jn(e){return f.jsx("div",{className:"flex flex-col gap-6",children:f.jsxs(p.Card,{children:[f.jsxs(p.CardHeader,{children:[f.jsx(p.CardTitle,{className:"text-2xl",children:e.i18n.t("auth.verifyEmailForm.form.title")}),f.jsx(p.CardDescription,{children:e.i18n.t("auth.verifyEmailForm.form.verifyEmailDescription")})]}),f.jsx(p.CardContent,{children:f.jsx(p.Form,{...e.form,children:f.jsx("form",{onSubmit:e.form.handleSubmit(e.submit),children:f.jsxs("div",{className:"flex flex-col gap-6",children:[f.jsxs("div",{className:"grid gap-2",children:[f.jsx(p.Label,{children:e.i18n.t("auth.verifyEmailForm.form.codeLabel")}),f.jsx(p.FormField,{control:e.form.control,name:"code",render:({field:t})=>f.jsx(p.FormItem,{children:f.jsx(p.FormControl,{children:f.jsx(p.Input,{type:"text",placeholder:"00001234","data-testid":ae.verifyEmailForm.authCodeInput,required:!0,...t})})})})]}),f.jsx(p.Button,{type:"submit",className:"w-full cursor-pointer","data-testid":ae.verifyEmailForm.submitButton,children:e.i18n.t("auth.verifyEmailForm.form.submitButtonLabel")}),f.jsxs(p.FieldDescription,{className:"text-center",children:[e.i18n.t("auth.verifyEmailForm.form.loginLinkMessage")," ",f.jsx(ge.Link,{to:"/auth/login",children:e.i18n.t("auth.verifyEmailForm.form.loginLink")})]})]})})})})]})})}const Ot="Authorization",ir=()=>({user:{id:null,email:null,roles:[],is_enabled:!1,is_email_verified:!1},sessionID:null,isAuthenticated:!1,isLoaded:!1}),Ce=new rr.Store(ir()),Wn=new rr.Derived({fn:()=>!!Ce.state.user?.roles.find(e=>e.name==="admin"),deps:[Ce]});class qn{accountStore;httpClient;constructor(t){this.httpClient=t,this.accountStore=Ce}initAuthData=()=>{const t=localStorage.getItem("token");t&&(this.httpClient.defaults.headers.common[Ot]=t)};load=async()=>{try{const{data:t}=await this.httpClient.get("/api/auth/account/me");Ce.setState(()=>({user:t.user,sessionID:t.session_id,isAuthenticated:!0,isLoaded:!0}))}catch{Ce.setState(t=>({...t,isLoaded:!0}))}};login=async t=>{const r=await this.httpClient.post("/api/auth/account/login",t),{user:n,token:o,session_id:i}=r.data;return this._initUserData({user:n,token:o,sessionID:i}),n};signup=async t=>this.httpClient.post("/api/auth/account/signup",t);verifyEmail=async t=>{const r=await this.httpClient.post("/api/auth/account/verify-email",t);this._initUserData(r.data)};logout=()=>{Ce.setState(()=>({...ir(),isLoaded:!0})),this._clearAuthData()};startResetPassword=t=>this.httpClient.post("/api/auth/account/start-reset-password",t);confirmResetPassword=async t=>{const r=await this.httpClient.post("/api/auth/account/confirm-reset-password",t);this._initUserData(r.data)};_initUserData=({user:t,token:r,sessionID:n})=>{this._setAuthData(r),Ce.setState(()=>({user:t,isAuthenticated:!0,isLoaded:!0,sessionID:n}))};_setAuthData=t=>{localStorage.setItem("token",t),this.httpClient.defaults.headers.common[Ot]=t};_clearAuthData=()=>{localStorage.removeItem("token"),delete this.httpClient.defaults.headers.common[Ot]}}var Ye=e=>e.type==="checkbox",De=e=>e instanceof Date,me=e=>e==null;const ar=e=>typeof e=="object";var Q=e=>!me(e)&&!Array.isArray(e)&&ar(e)&&!De(e),Hn=e=>Q(e)&&e.target?Ye(e.target)?e.target.checked:e.target.value:e,Kn=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,Gn=(e,t)=>e.has(Kn(t)),Yn=e=>{const t=e.constructor&&e.constructor.prototype;return Q(t)&&t.hasOwnProperty("isPrototypeOf")},xt=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function re(e){if(e instanceof Date)return new Date(e);const t=typeof FileList<"u"&&e instanceof FileList;if(xt&&(e instanceof Blob||t))return e;const r=Array.isArray(e);if(!r&&!(Q(e)&&Yn(e)))return e;const n=r?[]:Object.create(Object.getPrototypeOf(e));for(const o in e)Object.prototype.hasOwnProperty.call(e,o)&&(n[o]=re(e[o]));return n}var at=e=>/^\w*$/.test(e),q=e=>e===void 0,Ft=e=>Array.isArray(e)?e.filter(Boolean):[],jt=e=>Ft(e.replace(/["|']|\]/g,"").split(/\.|\[/)),z=(e,t,r)=>{if(!t||!Q(e))return r;const n=(at(t)?[t]:jt(t)).reduce((o,i)=>me(o)?o:o[i],e);return q(n)||n===e?q(e[t])?r:e[t]:n},ke=e=>typeof e=="boolean",we=e=>typeof e=="function",B=(e,t,r)=>{let n=-1;const o=at(t)?[t]:jt(t),i=o.length,s=i-1;for(;++n<i;){const a=o[n];let l=r;if(n!==s){const d=e[a];l=Q(d)||Array.isArray(d)?d:isNaN(+o[n+1])?{}:[]}if(a==="__proto__"||a==="constructor"||a==="prototype")return;e[a]=l,e=e[a]}};const cr={BLUR:"blur",FOCUS_OUT:"focusout"},be={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},Oe={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},Xn=P.createContext(null);Xn.displayName="HookFormControlContext";var Qn=(e,t,r,n=!0)=>{const o={defaultValues:t._defaultValues};for(const i in e)Object.defineProperty(o,i,{get:()=>{const s=i;return t._proxyFormState[s]!==be.all&&(t._proxyFormState[s]=!n||be.all),e[s]}});return o};const eo=typeof window<"u"?P.useLayoutEffect:P.useEffect;var _e=e=>typeof e=="string",to=(e,t,r,n,o)=>_e(e)?(n&&t.watch.add(e),z(r,e,o)):Array.isArray(e)?e.map(i=>(n&&t.watch.add(i),z(r,i))):(n&&(t.watchAll=!0),r),Pt=e=>me(e)||!ar(e);function xe(e,t,r=new WeakSet){if(Pt(e)||Pt(t))return Object.is(e,t);if(De(e)&&De(t))return Object.is(e.getTime(),t.getTime());const n=Object.keys(e),o=Object.keys(t);if(n.length!==o.length)return!1;if(r.has(e)||r.has(t))return!0;r.add(e),r.add(t);for(const i of n){const s=e[i];if(!o.includes(i))return!1;if(i!=="ref"){const a=t[i];if(De(s)&&De(a)||Q(s)&&Q(a)||Array.isArray(s)&&Array.isArray(a)?!xe(s,a,r):!Object.is(s,a))return!1}}return!0}const ro=P.createContext(null);ro.displayName="HookFormContext";var $t=(e,t,r,n,o)=>t?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[n]:o||!0}}:{},Xe=e=>Array.isArray(e)?e:[e],ur=()=>{let e=[];return{get observers(){return e},next:o=>{for(const i of e)i.next&&i.next(o)},subscribe:o=>(e.push(o),{unsubscribe:()=>{e=e.filter(i=>i!==o)}}),unsubscribe:()=>{e=[]}}};function lr(e,t){const r={};for(const n in e)if(e.hasOwnProperty(n)){const o=e[n],i=t[n];if(o&&Q(o)&&i){const s=lr(o,i);Q(s)&&(r[n]=s)}else e[n]&&(r[n]=i)}return r}var ue=e=>Q(e)&&!Object.keys(e).length,At=e=>e.type==="file",ct=e=>{if(!xt)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},fr=e=>e.type==="select-multiple",Tt=e=>e.type==="radio",no=e=>Tt(e)||Ye(e),Ct=e=>ct(e)&&e.isConnected;function oo(e,t){const r=t.slice(0,-1).length;let n=0;for(;n<r;)e=q(e)?n++:e[t[n++]];return e}function so(e){for(const t in e)if(e.hasOwnProperty(t)&&!q(e[t]))return!1;return!0}function ee(e,t){const r=Array.isArray(t)?t:at(t)?[t]:jt(t),n=r.length===1?e:oo(e,r),o=r.length-1,i=r[o];return n&&delete n[i],o!==0&&(Q(n)&&ue(n)||Array.isArray(n)&&so(n))&&ee(e,r.slice(0,-1)),e}var io=e=>{for(const t in e)if(we(e[t]))return!0;return!1};function dr(e){return Array.isArray(e)||Q(e)&&!io(e)}function Dt(e,t={}){for(const r in e){const n=e[r];dr(n)?(t[r]=Array.isArray(n)?[]:{},Dt(n,t[r])):q(n)||(t[r]=!0)}return t}function Re(e,t,r){r||(r=Dt(t));for(const n in e){const o=e[n];if(dr(o))q(t)||Pt(r[n])?r[n]=Dt(o,Array.isArray(o)?[]:{}):Re(o,me(t)?{}:t[n],r[n]);else{const i=t[n];r[n]=!xe(o,i)}}return r}const mr={value:!1,isValid:!1},hr={value:!0,isValid:!0};var pr=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(r=>r&&r.checked&&!r.disabled).map(r=>r.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!q(e[0].attributes.value)?q(e[0].value)||e[0].value===""?hr:{value:e[0].value,isValid:!0}:hr:mr}return mr},gr=(e,{valueAsNumber:t,valueAsDate:r,setValueAs:n})=>q(e)?e:t?e===""?NaN:e&&+e:r&&_e(e)?new Date(e):n?n(e):e;const _r={isValid:!1,value:null};var yr=e=>Array.isArray(e)?e.reduce((t,r)=>r&&r.checked&&!r.disabled?{isValid:!0,value:r.value}:t,_r):_r;function vr(e){const t=e.ref;return At(t)?t.files:Tt(t)?yr(e.refs).value:fr(t)?[...t.selectedOptions].map(({value:r})=>r):Ye(t)?pr(e.refs).value:gr(q(t.value)?e.ref.value:t.value,e)}var ao=(e,t,r,n)=>{const o={};for(const i of e){const s=z(t,i);s&&B(o,i,s._f)}return{criteriaMode:r,names:[...e],fields:o,shouldUseNativeValidation:n}},ut=e=>e instanceof RegExp,Qe=e=>q(e)?e:ut(e)?e.source:Q(e)?ut(e.value)?e.value.source:e.value:e,wr=e=>({isOnSubmit:!e||e===be.onSubmit,isOnBlur:e===be.onBlur,isOnChange:e===be.onChange,isOnAll:e===be.all,isOnTouch:e===be.onTouched});const br="AsyncFunction";var co=e=>!!e&&!!e.validate&&!!(we(e.validate)&&e.validate.constructor.name===br||Q(e.validate)&&Object.values(e.validate).find(t=>t.constructor.name===br)),uo=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),kr=(e,t,r)=>!r&&(t.watchAll||t.watch.has(e)||[...t.watch].some(n=>e.startsWith(n)&&/^\.\w+/.test(e.slice(n.length))));const et=(e,t,r,n)=>{for(const o of r||Object.keys(e)){const i=z(e,o);if(i){const{_f:s,...a}=i;if(s){if(s.refs&&s.refs[0]&&t(s.refs[0],o)&&!n)return!0;if(s.ref&&t(s.ref,s.name)&&!n)return!0;if(et(a,t))break}else if(Q(a)&&et(a,t))break}}};function Er(e,t,r){const n=z(e,r);if(n||at(r))return{error:n,name:r};const o=r.split(".");for(;o.length;){const i=o.join("."),s=z(t,i),a=z(e,i);if(s&&!Array.isArray(s)&&r!==i)return{name:r};if(a&&a.type)return{name:i,error:a};if(a&&a.root&&a.root.type)return{name:`${i}.root`,error:a.root};o.pop()}return{name:r}}var lo=(e,t,r,n)=>{r(e);const{name:o,...i}=e;return ue(i)||Object.keys(i).length>=Object.keys(t).length||Object.keys(i).find(s=>t[s]===(!n||be.all))},fo=(e,t,r)=>!e||!t||e===t||Xe(e).some(n=>n&&(r?n===t:n.startsWith(t)||t.startsWith(n))),mo=(e,t,r,n,o)=>o.isOnAll?!1:!r&&o.isOnTouch?!(t||e):(r?n.isOnBlur:o.isOnBlur)?!e:(r?n.isOnChange:o.isOnChange)?e:!0,ho=(e,t)=>!Ft(z(e,t)).length&&ee(e,t),po=(e,t,r)=>{const n=Xe(z(e,r));return B(n,"root",t[r]),B(e,r,n),e};function Sr(e,t,r="validate"){if(_e(e)||Array.isArray(e)&&e.every(_e)||ke(e)&&!e)return{type:r,message:_e(e)?e:"",ref:t}}var Ve=e=>Q(e)&&!ut(e)?e:{value:e,message:""},zr=async(e,t,r,n,o,i)=>{const{ref:s,refs:a,required:l,maxLength:d,minLength:w,min:y,max:v,pattern:h,validate:O,name:S,valueAsNumber:T,mount:L}=e._f,j=z(r,S);if(!L||t.has(S))return{};const I=a?a[0]:s,D=A=>{o&&I.reportValidity&&(I.setCustomValidity(ke(A)?"":A||""),I.reportValidity())},C={},M=Tt(s),K=Ye(s),fe=M||K,Se=(T||At(s))&&q(s.value)&&q(j)||ct(s)&&s.value===""||j===""||Array.isArray(j)&&!j.length,he=$t.bind(null,S,n,C),Je=(A,Z,Y,te=Oe.maxLength,pe=Oe.minLength)=>{const ce=A?Z:Y;C[S]={type:A?te:pe,message:ce,ref:s,...he(A?te:pe,ce)}};if(i?!Array.isArray(j)||!j.length:l&&(!fe&&(Se||me(j))||ke(j)&&!j||K&&!pr(a).isValid||M&&!yr(a).isValid)){const{value:A,message:Z}=_e(l)?{value:!!l,message:l}:Ve(l);if(A&&(C[S]={type:Oe.required,message:Z,ref:I,...he(Oe.required,Z)},!n))return D(Z),C}if(!Se&&(!me(y)||!me(v))){let A,Z;const Y=Ve(v),te=Ve(y);if(!me(j)&&!isNaN(j)){const pe=s.valueAsNumber||j&&+j;me(Y.value)||(A=pe>Y.value),me(te.value)||(Z=pe<te.value)}else{const pe=s.valueAsDate||new Date(j),ce=Ae=>new Date(new Date().toDateString()+" "+Ae),Pe=s.type=="time",$e=s.type=="week";_e(Y.value)&&j&&(A=Pe?ce(j)>ce(Y.value):$e?j>Y.value:pe>new Date(Y.value)),_e(te.value)&&j&&(Z=Pe?ce(j)<ce(te.value):$e?j<te.value:pe<new Date(te.value))}if((A||Z)&&(Je(!!A,Y.message,te.message,Oe.max,Oe.min),!n))return D(C[S].message),C}if((d||w)&&!Se&&(_e(j)||i&&Array.isArray(j))){const A=Ve(d),Z=Ve(w),Y=!me(A.value)&&j.length>+A.value,te=!me(Z.value)&&j.length<+Z.value;if((Y||te)&&(Je(Y,A.message,Z.message),!n))return D(C[S].message),C}if(h&&!Se&&_e(j)){const{value:A,message:Z}=Ve(h);if(ut(A)&&!j.match(A)&&(C[S]={type:Oe.pattern,message:Z,ref:s,...he(Oe.pattern,Z)},!n))return D(Z),C}if(O){if(we(O)){const A=await O(j,r),Z=Sr(A,I);if(Z&&(C[S]={...Z,...he(Oe.validate,Z.message)},!n))return D(Z.message),C}else if(Q(O)){let A={};for(const Z in O){if(!ue(A)&&!n)break;const Y=Sr(await O[Z](j,r),I,Z);Y&&(A={...Y,...he(Z,Y.message)},D(Y.message),n&&(C[S]=A))}if(!ue(A)&&(C[S]={ref:I,...A},!n))return C}}return D(!0),C};const go={mode:be.onSubmit,reValidateMode:be.onChange,shouldFocusError:!0};function _o(e={}){let t={...go,...e},r={submitCount:0,isDirty:!1,isReady:!1,isLoading:we(t.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1},n={},o=Q(t.defaultValues)||Q(t.values)?re(t.defaultValues||t.values)||{}:{},i=t.shouldUnregister?{}:re(o),s={action:!1,mount:!1,watch:!1,keepIsValid:!1},a={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},l,d=0;const w={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},y={...w};let v={...y};const h={array:ur(),state:ur()},O=t.criteriaMode===be.all,S=c=>u=>{clearTimeout(d),d=setTimeout(c,u)},T=async c=>{if(!s.keepIsValid&&!t.disabled&&(y.isValid||v.isValid||c)){let u;t.resolver?(u=ue((await fe()).errors),L()):u=await he(n,!0),u!==r.isValid&&h.state.next({isValid:u})}},L=(c,u)=>{!t.disabled&&(y.isValidating||y.validatingFields||v.isValidating||v.validatingFields)&&((c||Array.from(a.mount)).forEach(m=>{m&&(u?B(r.validatingFields,m,u):ee(r.validatingFields,m))}),h.state.next({validatingFields:r.validatingFields,isValidating:!ue(r.validatingFields)}))},j=(c,u=[],m,E,k=!0,b=!0)=>{if(E&&m&&!t.disabled){if(s.action=!0,b&&Array.isArray(z(n,c))){const x=m(z(n,c),E.argA,E.argB);k&&B(n,c,x)}if(b&&Array.isArray(z(r.errors,c))){const x=m(z(r.errors,c),E.argA,E.argB);k&&B(r.errors,c,x),ho(r.errors,c)}if((y.touchedFields||v.touchedFields)&&b&&Array.isArray(z(r.touchedFields,c))){const x=m(z(r.touchedFields,c),E.argA,E.argB);k&&B(r.touchedFields,c,x)}(y.dirtyFields||v.dirtyFields)&&(r.dirtyFields=Re(o,i)),h.state.next({name:c,isDirty:A(c,u),dirtyFields:r.dirtyFields,errors:r.errors,isValid:r.isValid})}else B(i,c,u)},I=(c,u)=>{B(r.errors,c,u),h.state.next({errors:r.errors})},D=c=>{r.errors=c,h.state.next({errors:r.errors,isValid:!1})},C=(c,u,m,E)=>{const k=z(n,c);if(k){const b=z(i,c,q(m)?z(o,c):m);q(b)||E&&E.defaultChecked||u?B(i,c,u?b:vr(k._f)):te(c,b),s.mount&&!s.action&&T()}},M=(c,u,m,E,k)=>{let b=!1,x=!1;const R={name:c};if(!t.disabled){if(!m||E){(y.isDirty||v.isDirty)&&(x=r.isDirty,r.isDirty=R.isDirty=A(),b=x!==R.isDirty);const V=xe(z(o,c),u);x=!!z(r.dirtyFields,c),V?ee(r.dirtyFields,c):B(r.dirtyFields,c,!0),R.dirtyFields=r.dirtyFields,b=b||(y.dirtyFields||v.dirtyFields)&&x!==!V}if(m){const V=z(r.touchedFields,c);V||(B(r.touchedFields,c,m),R.touchedFields=r.touchedFields,b=b||(y.touchedFields||v.touchedFields)&&V!==m)}b&&k&&h.state.next(R)}return b?R:{}},K=(c,u,m,E)=>{const k=z(r.errors,c),b=(y.isValid||v.isValid)&&ke(u)&&r.isValid!==u;if(t.delayError&&m?(l=S(()=>I(c,m)),l(t.delayError)):(clearTimeout(d),l=null,m?B(r.errors,c,m):ee(r.errors,c)),(m?!xe(k,m):k)||!ue(E)||b){const x={...E,...b&&ke(u)?{isValid:u}:{},errors:r.errors,name:c};r={...r,...x},h.state.next(x)}},fe=async c=>(L(c,!0),await t.resolver(i,t.context,ao(c||a.mount,n,t.criteriaMode,t.shouldUseNativeValidation))),Se=async c=>{const{errors:u}=await fe(c);if(L(c),c)for(const m of c){const E=z(u,m);E?B(r.errors,m,E):ee(r.errors,m)}else r.errors=u;return u},he=async(c,u,m={valid:!0})=>{for(const E in c){const k=c[E];if(k){const{_f:b,...x}=k;if(b){const R=a.array.has(b.name),V=k._f&&co(k._f);V&&y.validatingFields&&L([b.name],!0);const de=await zr(k,a.disabled,i,O,t.shouldUseNativeValidation&&!u,R);if(V&&y.validatingFields&&L([b.name]),de[b.name]&&(m.valid=!1,u||e.shouldUseNativeValidation))break;!u&&(z(de,b.name)?R?po(r.errors,de,b.name):B(r.errors,b.name,de[b.name]):ee(r.errors,b.name))}!ue(x)&&await he(x,u,m)}}return m.valid},Je=()=>{for(const c of a.unMount){const u=z(n,c);u&&(u._f.refs?u._f.refs.every(m=>!Ct(m)):!Ct(u._f.ref))&&ze(c)}a.unMount=new Set},A=(c,u)=>!t.disabled&&(c&&u&&B(i,c,u),!xe(_(),o)),Z=(c,u,m)=>to(c,a,{...s.mount?i:q(u)?o:_e(c)?{[c]:u}:u},m,u),Y=c=>Ft(z(s.mount?i:o,c,t.shouldUnregister?z(o,c,[]):[])),te=(c,u,m={})=>{const E=z(n,c);let k=u;if(E){const b=E._f;b&&(!b.disabled&&B(i,c,gr(u,b)),k=ct(b.ref)&&me(u)?"":u,fr(b.ref)?[...b.ref.options].forEach(x=>x.selected=k.includes(x.value)):b.refs?Ye(b.ref)?b.refs.forEach(x=>{(!x.defaultChecked||!x.disabled)&&(Array.isArray(k)?x.checked=!!k.find(R=>R===x.value):x.checked=k===x.value||!!k)}):b.refs.forEach(x=>x.checked=x.value===k):At(b.ref)?b.ref.value="":(b.ref.value=k,b.ref.type||h.state.next({name:c,values:re(i)})))}(m.shouldDirty||m.shouldTouch)&&M(c,k,m.shouldTouch,m.shouldDirty,!0),m.shouldValidate&&Ae(c)},pe=(c,u,m)=>{for(const E in u){if(!u.hasOwnProperty(E))return;const k=u[E],b=c+"."+E,x=z(n,b);(a.array.has(c)||Q(k)||x&&!x._f)&&!De(k)?pe(b,k,m):te(b,k,m)}},ce=(c,u,m={})=>{const E=z(n,c),k=a.array.has(c),b=re(u);B(i,c,b),k?(h.array.next({name:c,values:re(i)}),(y.isDirty||y.dirtyFields||v.isDirty||v.dirtyFields)&&m.shouldDirty&&h.state.next({name:c,dirtyFields:Re(o,i),isDirty:A(c,b)})):E&&!E._f&&!me(b)?pe(c,b,m):te(c,b,m),kr(c,a)?h.state.next({...r,name:c,values:re(i)}):h.state.next({name:s.mount?c:void 0,values:re(i)})},Pe=async c=>{s.mount=!0;const u=c.target;let m=u.name,E=!0;const k=z(n,m),b=V=>{E=Number.isNaN(V)||De(V)&&isNaN(V.getTime())||xe(V,z(i,m,V))},x=wr(t.mode),R=wr(t.reValidateMode);if(k){let V,de;const Ne=u.type?vr(k._f):Hn(c),Te=c.type===cr.BLUR||c.type===cr.FOCUS_OUT,tu=!uo(k._f)&&!t.resolver&&!z(r.errors,m)&&!k._f.deps||mo(Te,z(r.touchedFields,m),r.isSubmitted,R,x),er=kr(m,a,Te);B(i,m,Ne),Te?(!u||!u.readOnly)&&(k._f.onBlur&&k._f.onBlur(c),l&&l(0)):k._f.onChange&&k._f.onChange(c);const tr=M(m,Ne,Te),ru=!ue(tr)||er;if(!Te&&h.state.next({name:m,type:c.type,values:re(i)}),tu)return(y.isValid||v.isValid)&&(t.mode==="onBlur"?Te&&T():Te||T()),ru&&h.state.next({name:m,...er?{}:tr});if(!Te&&er&&h.state.next({...r}),t.resolver){const{errors:Cn}=await fe([m]);if(L([m]),b(Ne),E){const nu=Er(r.errors,n,m),Dn=Er(Cn,n,nu.name||m);V=Dn.error,m=Dn.name,de=ue(Cn)}}else L([m],!0),V=(await zr(k,a.disabled,i,O,t.shouldUseNativeValidation))[m],L([m]),b(Ne),E&&(V?de=!1:(y.isValid||v.isValid)&&(de=await he(n,!0)));E&&(k._f.deps&&(!Array.isArray(k._f.deps)||k._f.deps.length>0)&&Ae(k._f.deps),K(m,de,V,tr))}},$e=(c,u)=>{if(z(r.errors,u)&&c.focus)return c.focus(),1},Ae=async(c,u={})=>{let m,E;const k=Xe(c);if(t.resolver){const b=await Se(q(c)?c:k);m=ue(b),E=c?!k.some(x=>z(b,x)):m}else c?(E=(await Promise.all(k.map(async b=>{const x=z(n,b);return await he(x&&x._f?{[b]:x}:x)}))).every(Boolean),!(!E&&!r.isValid)&&T()):E=m=await he(n);return h.state.next({...!_e(c)||(y.isValid||v.isValid)&&m!==r.isValid?{}:{name:c},...t.resolver||!c?{isValid:m}:{},errors:r.errors}),u.shouldFocus&&!E&&et(n,$e,c?k:a.mount),E},_=(c,u)=>{let m={...s.mount?i:o};return u&&(m=lr(u.dirtyFields?r.dirtyFields:r.touchedFields,m)),q(c)?m:_e(c)?z(m,c):c.map(E=>z(m,E))},$=(c,u)=>({invalid:!!z((u||r).errors,c),isDirty:!!z((u||r).dirtyFields,c),error:z((u||r).errors,c),isValidating:!!z(r.validatingFields,c),isTouched:!!z((u||r).touchedFields,c)}),W=c=>{c&&Xe(c).forEach(u=>ee(r.errors,u)),h.state.next({errors:c?r.errors:{}})},G=(c,u,m)=>{const E=(z(n,c,{_f:{}})._f||{}).ref,k=z(r.errors,c)||{},{ref:b,message:x,type:R,...V}=k;B(r.errors,c,{...V,...u,ref:E}),h.state.next({name:c,errors:r.errors,isValid:!1}),m&&m.shouldFocus&&E&&E.focus&&E.focus()},We=(c,u)=>we(c)?h.state.subscribe({next:m=>"values"in m&&c(Z(void 0,u),m)}):Z(c,u,!0),qe=c=>h.state.subscribe({next:u=>{fo(c.name,u.name,c.exact)&&lo(u,c.formState||y,eu,c.reRenderRoot)&&c.callback({values:{...i},...r,...u,defaultValues:o})}}).unsubscribe,X=c=>(s.mount=!0,v={...v,...c.formState},qe({...c,formState:{...w,...c.formState}})),ze=(c,u={})=>{for(const m of c?Xe(c):a.mount)a.mount.delete(m),a.array.delete(m),u.keepValue||(ee(n,m),ee(i,m)),!u.keepError&&ee(r.errors,m),!u.keepDirty&&ee(r.dirtyFields,m),!u.keepTouched&&ee(r.touchedFields,m),!u.keepIsValidating&&ee(r.validatingFields,m),!t.shouldUnregister&&!u.keepDefaultValue&&ee(o,m);h.state.next({values:re(i)}),h.state.next({...r,...u.keepDirty?{isDirty:A()}:{}}),!u.keepIsValid&&T()},He=({disabled:c,name:u})=>{if(ke(c)&&s.mount||c||a.disabled.has(u)){const k=a.disabled.has(u)!==!!c;c?a.disabled.add(u):a.disabled.delete(u),k&&s.mount&&!s.action&&T()}},st=(c,u={})=>{let m=z(n,c);const E=ke(u.disabled)||ke(t.disabled);return B(n,c,{...m||{},_f:{...m&&m._f?m._f:{ref:{name:c}},name:c,mount:!0,...u}}),a.mount.add(c),m?He({disabled:ke(u.disabled)?u.disabled:t.disabled,name:c}):C(c,!0,u.value),{...E?{disabled:u.disabled||t.disabled}:{},...t.progressive?{required:!!u.required,min:Qe(u.min),max:Qe(u.max),minLength:Qe(u.minLength),maxLength:Qe(u.maxLength),pattern:Qe(u.pattern)}:{},name:c,onChange:Pe,onBlur:Pe,ref:k=>{if(k){st(c,u),m=z(n,c);const b=q(k.value)&&k.querySelectorAll&&k.querySelectorAll("input,select,textarea")[0]||k,x=no(b),R=m._f.refs||[];if(x?R.find(V=>V===b):b===m._f.ref)return;B(n,c,{_f:{...m._f,...x?{refs:[...R.filter(Ct),b,...Array.isArray(z(o,c))?[{}]:[]],ref:{type:b.type,name:c}}:{ref:b}}}),C(c,!1,void 0,b)}else m=z(n,c,{}),m._f&&(m._f.mount=!1),(t.shouldUnregister||u.shouldUnregister)&&!(Gn(a.array,c)&&s.action)&&a.unMount.add(c)}}},Qt=()=>t.shouldFocusError&&et(n,$e,a.mount),Yc=c=>{ke(c)&&(h.state.next({disabled:c}),et(n,(u,m)=>{const E=z(n,m);E&&(u.disabled=E._f.disabled||c,Array.isArray(E._f.refs)&&E._f.refs.forEach(k=>{k.disabled=E._f.disabled||c}))},0,!1))},Pn=(c,u)=>async m=>{let E;m&&(m.preventDefault&&m.preventDefault(),m.persist&&m.persist());let k=re(i);if(h.state.next({isSubmitting:!0}),t.resolver){const{errors:b,values:x}=await fe();L(),r.errors=b,k=re(x)}else await he(n);if(a.disabled.size)for(const b of a.disabled)ee(k,b);if(ee(r.errors,"root"),ue(r.errors)){h.state.next({errors:{}});try{await c(k,m)}catch(b){E=b}}else u&&await u({...r.errors},m),Qt(),setTimeout(Qt);if(h.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:ue(r.errors)&&!E,submitCount:r.submitCount+1,errors:r.errors}),E)throw E},Xc=(c,u={})=>{z(n,c)&&(q(u.defaultValue)?ce(c,re(z(o,c))):(ce(c,u.defaultValue),B(o,c,re(u.defaultValue))),u.keepTouched||ee(r.touchedFields,c),u.keepDirty||(ee(r.dirtyFields,c),r.isDirty=u.defaultValue?A(c,re(z(o,c))):A()),u.keepError||(ee(r.errors,c),y.isValid&&T()),h.state.next({...r}))},$n=(c,u={})=>{const m=c?re(c):o,E=re(m),k=ue(c),b=k?o:E;if(u.keepDefaultValues||(o=m),!u.keepValues){if(u.keepDirtyValues){const x=new Set([...a.mount,...Object.keys(Re(o,i))]);for(const R of Array.from(x)){const V=z(r.dirtyFields,R),de=z(i,R),Ne=z(b,R);V&&!q(de)?B(b,R,de):!V&&!q(Ne)&&ce(R,Ne)}}else{if(xt&&q(c))for(const x of a.mount){const R=z(n,x);if(R&&R._f){const V=Array.isArray(R._f.refs)?R._f.refs[0]:R._f.ref;if(ct(V)){const de=V.closest("form");if(de){de.reset();break}}}}if(u.keepFieldsRef)for(const x of a.mount)ce(x,z(b,x));else n={}}i=t.shouldUnregister?u.keepDefaultValues?re(o):{}:re(b),h.array.next({values:{...b}}),h.state.next({values:{...b}})}a={mount:u.keepDirtyValues?a.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},s.mount=!y.isValid||!!u.keepIsValid||!!u.keepDirtyValues||!t.shouldUnregister&&!ue(b),s.watch=!!t.shouldUnregister,s.keepIsValid=!!u.keepIsValid,s.action=!1,u.keepErrors||(r.errors={}),h.state.next({submitCount:u.keepSubmitCount?r.submitCount:0,isDirty:k?!1:u.keepDirty?r.isDirty:!!(u.keepDefaultValues&&!xe(c,o)),isSubmitted:u.keepIsSubmitted?r.isSubmitted:!1,dirtyFields:k?{}:u.keepDirtyValues?u.keepDefaultValues&&i?Re(o,i):r.dirtyFields:u.keepDefaultValues&&c?Re(o,c):u.keepDirty?r.dirtyFields:{},touchedFields:u.keepTouched?r.touchedFields:{},errors:u.keepErrors?r.errors:{},isSubmitSuccessful:u.keepIsSubmitSuccessful?r.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:o})},An=(c,u)=>$n(we(c)?c(i):c,{...t.resetOptions,...u}),Qc=(c,u={})=>{const m=z(n,c),E=m&&m._f;if(E){const k=E.refs?E.refs[0]:E.ref;k.focus&&setTimeout(()=>{k.focus(),u.shouldSelect&&we(k.select)&&k.select()})}},eu=c=>{r={...r,...c}},Tn={control:{register:st,unregister:ze,getFieldState:$,handleSubmit:Pn,setError:G,_subscribe:qe,_runSchema:fe,_updateIsValidating:L,_focusError:Qt,_getWatch:Z,_getDirty:A,_setValid:T,_setFieldArray:j,_setDisabledField:He,_setErrors:D,_getFieldArray:Y,_reset:$n,_resetDefaultValues:()=>we(t.defaultValues)&&t.defaultValues().then(c=>{An(c,t.resetOptions),h.state.next({isLoading:!1})}),_removeUnmounted:Je,_disableForm:Yc,_subjects:h,_proxyFormState:y,get _fields(){return n},get _formValues(){return i},get _state(){return s},set _state(c){s=c},get _defaultValues(){return o},get _names(){return a},set _names(c){a=c},get _formState(){return r},get _options(){return t},set _options(c){t={...t,...c}}},subscribe:X,trigger:Ae,register:st,handleSubmit:Pn,watch:We,setValue:ce,getValues:_,reset:An,resetField:Xc,clearErrors:W,unregister:ze,setError:G,setFocus:Qc,getFieldState:$};return{...Tn,formControl:Tn}}function tt(e={}){const t=P.useRef(void 0),r=P.useRef(void 0),[n,o]=P.useState({isDirty:!1,isValidating:!1,isLoading:we(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,isReady:!1,defaultValues:we(e.defaultValues)?void 0:e.defaultValues});if(!t.current)if(e.formControl)t.current={...e.formControl,formState:n},e.defaultValues&&!we(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:s,...a}=_o(e);t.current={...a,formState:n}}const i=t.current.control;return i._options=e,eo(()=>{const s=i._subscribe({formState:i._proxyFormState,callback:()=>o({...i._formState}),reRenderRoot:!0});return o(a=>({...a,isReady:!0})),i._formState.isReady=!0,s},[i]),P.useEffect(()=>i._disableForm(e.disabled),[i,e.disabled]),P.useEffect(()=>{e.mode&&(i._options.mode=e.mode),e.reValidateMode&&(i._options.reValidateMode=e.reValidateMode)},[i,e.mode,e.reValidateMode]),P.useEffect(()=>{e.errors&&(i._setErrors(e.errors),i._focusError())},[i,e.errors]),P.useEffect(()=>{e.shouldUnregister&&i._subjects.state.next({values:i._getWatch()})},[i,e.shouldUnregister]),P.useEffect(()=>{if(i._proxyFormState.isDirty){const s=i._getDirty();s!==n.isDirty&&i._subjects.state.next({isDirty:s})}},[i,n.isDirty]),P.useEffect(()=>{var s;e.values&&!xe(e.values,r.current)?(i._reset(e.values,{keepFieldsRef:!0,...i._options.resetOptions}),!((s=i._options.resetOptions)===null||s===void 0)&&s.keepIsValid||i._setValid(),r.current=e.values,o(a=>({...a}))):i._resetDefaultValues()},[i,e.values]),P.useEffect(()=>{i._state.mount||(i._setValid(),i._state.mount=!0),i._state.watch&&(i._state.watch=!1,i._subjects.state.next({...i._formState})),i._removeUnmounted()}),t.current.formState=P.useMemo(()=>Qn(n,i),[i,n]),t.current}const Or=(e,t,r)=>{if(e&&"reportValidity"in e){const n=z(r,t);e.setCustomValidity(n&&n.message||""),e.reportValidity()}},Zt=(e,t)=>{for(const r in t.fields){const n=t.fields[r];n&&n.ref&&"reportValidity"in n.ref?Or(n.ref,r,e):n&&n.refs&&n.refs.forEach(o=>Or(o,r,e))}},xr=(e,t)=>{t.shouldUseNativeValidation&&Zt(e,t);const r={};for(const n in e){const o=z(t.fields,n),i=Object.assign(e[n]||{},{ref:o&&o.ref});if(yo(t.names||Object.keys(e),n)){const s=Object.assign({},z(r,n));B(s,"root",i),B(r,n,s)}else B(r,n,i)}return r},yo=(e,t)=>{const r=Fr(t);return e.some(n=>Fr(n).match(`^${r}\\.\\d+`))};function Fr(e){return e.replace(/\]|\[/g,"")}function g(e,t,r){function n(a,l){if(a._zod||Object.defineProperty(a,"_zod",{value:{def:l,constr:s,traits:new Set},enumerable:!1}),a._zod.traits.has(e))return;a._zod.traits.add(e),t(a,l);const d=s.prototype,w=Object.keys(d);for(let y=0;y<w.length;y++){const v=w[y];v in a||(a[v]=d[v].bind(a))}}const o=r?.Parent??Object;class i extends o{}Object.defineProperty(i,"name",{value:e});function s(a){var l;const d=r?.Parent?new i:this;n(d,a),(l=d._zod).deferred??(l.deferred=[]);for(const w of d._zod.deferred)w();return d}return Object.defineProperty(s,"init",{value:n}),Object.defineProperty(s,Symbol.hasInstance,{value:a=>r?.Parent&&a instanceof r.Parent?!0:a?._zod?.traits?.has(e)}),Object.defineProperty(s,"name",{value:e}),s}class Ue extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class jr extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const Pr={};function Ze(e){return Pr}function $r(e){const t=Object.values(e).filter(n=>typeof n=="number");return Object.entries(e).filter(([n,o])=>t.indexOf(+n)===-1).map(([n,o])=>o)}function It(e,t){return typeof t=="bigint"?t.toString():t}function Lt(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function Nt(e){return e==null}function Rt(e){const t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}const Ar=Symbol("evaluating");function N(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==Ar)return n===void 0&&(n=Ar,n=r()),n},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function Ie(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function Fe(...e){const t={};for(const r of e){const n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function Tr(e){return JSON.stringify(e)}function vo(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const Cr="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function lt(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const wo=Lt(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function rt(e){if(lt(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const r=t.prototype;return!(lt(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function Dr(e){return rt(e)?{...e}:Array.isArray(e)?[...e]:e}const bo=new Set(["string","number","symbol"]);function ft(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function je(e,t,r){const n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}function F(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function ko(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}function Eo(e,t){const r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const i=Fe(e._zod.def,{get shape(){const s={};for(const a in t){if(!(a in r.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&(s[a]=r.shape[a])}return Ie(this,"shape",s),s},checks:[]});return je(e,i)}function So(e,t){const r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const i=Fe(e._zod.def,{get shape(){const s={...e._zod.def.shape};for(const a in t){if(!(a in r.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&delete s[a]}return Ie(this,"shape",s),s},checks:[]});return je(e,i)}function zo(e,t){if(!rt(t))throw new Error("Invalid input to extend: expected a plain object");const r=e._zod.def.checks;if(r&&r.length>0){const i=e._zod.def.shape;for(const s in t)if(Object.getOwnPropertyDescriptor(i,s)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const o=Fe(e._zod.def,{get shape(){const i={...e._zod.def.shape,...t};return Ie(this,"shape",i),i}});return je(e,o)}function Oo(e,t){if(!rt(t))throw new Error("Invalid input to safeExtend: expected a plain object");const r=Fe(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t};return Ie(this,"shape",n),n}});return je(e,r)}function xo(e,t){const r=Fe(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t._zod.def.shape};return Ie(this,"shape",n),n},get catchall(){return t._zod.def.catchall},checks:[]});return je(e,r)}function Fo(e,t,r){const o=t._zod.def.checks;if(o&&o.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const s=Fe(t._zod.def,{get shape(){const a=t._zod.def.shape,l={...a};if(r)for(const d in r){if(!(d in a))throw new Error(`Unrecognized key: "${d}"`);r[d]&&(l[d]=e?new e({type:"optional",innerType:a[d]}):a[d])}else for(const d in a)l[d]=e?new e({type:"optional",innerType:a[d]}):a[d];return Ie(this,"shape",l),l},checks:[]});return je(t,s)}function jo(e,t,r){const n=Fe(t._zod.def,{get shape(){const o=t._zod.def.shape,i={...o};if(r)for(const s in r){if(!(s in i))throw new Error(`Unrecognized key: "${s}"`);r[s]&&(i[s]=new e({type:"nonoptional",innerType:o[s]}))}else for(const s in o)i[s]=new e({type:"nonoptional",innerType:o[s]});return Ie(this,"shape",i),i}});return je(t,n)}function Me(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function Zr(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function dt(e){return typeof e=="string"?e:e?.message}function Le(e,t,r){const n={...e,path:e.path??[]};if(!e.message){const o=dt(e.inst?._zod.def?.error?.(e))??dt(t?.error?.(e))??dt(r.customError?.(e))??dt(r.localeError?.(e))??"Invalid input";n.message=o}return delete n.inst,delete n.continue,t?.reportInput||delete n.input,n}function Vt(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function nt(...e){const[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}const Ir=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,It,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Ut=g("$ZodError",Ir),mt=g("$ZodError",Ir,{Parent:Error});function Po(e,t=r=>r.message){const r={},n=[];for(const o of e.issues)o.path.length>0?(r[o.path[0]]=r[o.path[0]]||[],r[o.path[0]].push(t(o))):n.push(t(o));return{formErrors:n,fieldErrors:r}}function $o(e,t=r=>r.message){const r={_errors:[]},n=o=>{for(const i of o.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(s=>n({issues:s}));else if(i.code==="invalid_key")n({issues:i.issues});else if(i.code==="invalid_element")n({issues:i.issues});else if(i.path.length===0)r._errors.push(t(i));else{let s=r,a=0;for(;a<i.path.length;){const l=i.path[a];a===i.path.length-1?(s[l]=s[l]||{_errors:[]},s[l]._errors.push(t(i))):s[l]=s[l]||{_errors:[]},s=s[l],a++}}};return n(e),r}const ht=e=>(t,r,n,o)=>{const i=n?Object.assign(n,{async:!1}):{async:!1},s=t._zod.run({value:r,issues:[]},i);if(s instanceof Promise)throw new Ue;if(s.issues.length){const a=new(o?.Err??e)(s.issues.map(l=>Le(l,i,Ze())));throw Cr(a,o?.callee),a}return s.value},Ao=ht(mt),pt=e=>async(t,r,n,o)=>{const i=n?Object.assign(n,{async:!0}):{async:!0};let s=t._zod.run({value:r,issues:[]},i);if(s instanceof Promise&&(s=await s),s.issues.length){const a=new(o?.Err??e)(s.issues.map(l=>Le(l,i,Ze())));throw Cr(a,o?.callee),a}return s.value},To=pt(mt),gt=e=>(t,r,n)=>{const o=n?{...n,async:!1}:{async:!1},i=t._zod.run({value:r,issues:[]},o);if(i instanceof Promise)throw new Ue;return i.issues.length?{success:!1,error:new(e??Ut)(i.issues.map(s=>Le(s,o,Ze())))}:{success:!0,data:i.value}},Co=gt(mt),_t=e=>async(t,r,n)=>{const o=n?Object.assign(n,{async:!0}):{async:!0};let i=t._zod.run({value:r,issues:[]},o);return i instanceof Promise&&(i=await i),i.issues.length?{success:!1,error:new e(i.issues.map(s=>Le(s,o,Ze())))}:{success:!0,data:i.value}},Do=_t(mt),Zo=e=>(t,r,n)=>{const o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return ht(e)(t,r,o)},Io=e=>(t,r,n)=>ht(e)(t,r,n),Lo=e=>async(t,r,n)=>{const o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return pt(e)(t,r,o)},No=e=>async(t,r,n)=>pt(e)(t,r,n),Ro=e=>(t,r,n)=>{const o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return gt(e)(t,r,o)},Vo=e=>(t,r,n)=>gt(e)(t,r,n),Uo=e=>async(t,r,n)=>{const o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return _t(e)(t,r,o)},Mo=e=>async(t,r,n)=>_t(e)(t,r,n),Bo=/^[cC][^\s-]{8,}$/,Jo=/^[0-9a-z]+$/,Wo=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,qo=/^[0-9a-vA-V]{20}$/,Ho=/^[A-Za-z0-9]{27}$/,Ko=/^[a-zA-Z0-9_-]{21}$/,Go=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Yo=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Lr=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Xo=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Qo="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function es(){return new RegExp(Qo,"u")}const ts=/^(?:(?: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])$/,rs=/^(([0-9a-fA-F]{1,4}:){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}|:))$/,ns=/^((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])\/([0-9]|[1-2][0-9]|3[0-2])$/,os=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,ss=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Nr=/^[A-Za-z0-9_-]*$/,is=/^\+[1-9]\d{6,14}$/,Rr="(?:(?:\\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])))",as=new RegExp(`^${Rr}$`);function Vr(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function cs(e){return new RegExp(`^${Vr(e)}$`)}function us(e){const t=Vr({precision:e.precision}),r=["Z"];e.local&&r.push(""),e.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const n=`${t}(?:${r.join("|")})`;return new RegExp(`^${Rr}T(?:${n})$`)}const ls=e=>{const t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},fs=/^[^A-Z]*$/,ds=/^[^a-z]*$/,Ee=g("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),ms=g("$ZodCheckMaxLength",(e,t)=>{var r;Ee.init(e,t),(r=e._zod.def).when??(r.when=n=>{const o=n.value;return!Nt(o)&&o.length!==void 0}),e._zod.onattach.push(n=>{const o=n._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<o&&(n._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{const o=n.value;if(o.length<=t.maximum)return;const s=Vt(o);n.issues.push({origin:s,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),hs=g("$ZodCheckMinLength",(e,t)=>{var r;Ee.init(e,t),(r=e._zod.def).when??(r.when=n=>{const o=n.value;return!Nt(o)&&o.length!==void 0}),e._zod.onattach.push(n=>{const o=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>o&&(n._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{const o=n.value;if(o.length>=t.minimum)return;const s=Vt(o);n.issues.push({origin:s,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),ps=g("$ZodCheckLengthEquals",(e,t)=>{var r;Ee.init(e,t),(r=e._zod.def).when??(r.when=n=>{const o=n.value;return!Nt(o)&&o.length!==void 0}),e._zod.onattach.push(n=>{const o=n._zod.bag;o.minimum=t.length,o.maximum=t.length,o.length=t.length}),e._zod.check=n=>{const o=n.value,i=o.length;if(i===t.length)return;const s=Vt(o),a=i>t.length;n.issues.push({origin:s,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),yt=g("$ZodCheckStringFormat",(e,t)=>{var r,n;Ee.init(e,t),e._zod.onattach.push(o=>{const i=o._zod.bag;i.format=t.format,t.pattern&&(i.patterns??(i.patterns=new Set),i.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=o=>{t.pattern.lastIndex=0,!t.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),gs=g("$ZodCheckRegex",(e,t)=>{yt.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),_s=g("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=fs),yt.init(e,t)}),ys=g("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=ds),yt.init(e,t)}),vs=g("$ZodCheckIncludes",(e,t)=>{Ee.init(e,t);const r=ft(t.includes),n=new RegExp(typeof t.position=="number"?`^.{${t.position}}${r}`:r);t.pattern=n,e._zod.onattach.push(o=>{const i=o._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(n)}),e._zod.check=o=>{o.value.includes(t.includes,t.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),ws=g("$ZodCheckStartsWith",(e,t)=>{Ee.init(e,t);const r=new RegExp(`^${ft(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push(n=>{const o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),bs=g("$ZodCheckEndsWith",(e,t)=>{Ee.init(e,t);const r=new RegExp(`.*${ft(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push(n=>{const o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),ks=g("$ZodCheckOverwrite",(e,t)=>{Ee.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});class Es{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const n=t.split(`
7
+ `).filter(s=>s),o=Math.min(...n.map(s=>s.length-s.trimStart().length)),i=n.map(s=>s.slice(o)).map(s=>" ".repeat(this.indent*2)+s);for(const s of i)this.content.push(s)}compile(){const t=Function,r=this?.args,o=[...(this?.content??[""]).map(i=>` ${i}`)];return new t(...r,o.join(`
8
+ `))}}const Ss={major:4,minor:3,patch:5},ne=g("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Ss;const n=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&n.unshift(e);for(const o of n)for(const i of o._zod.onattach)i(e);if(n.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const o=(s,a,l)=>{let d=Me(s),w;for(const y of a){if(y._zod.def.when){if(!y._zod.def.when(s))continue}else if(d)continue;const v=s.issues.length,h=y._zod.check(s);if(h instanceof Promise&&l?.async===!1)throw new Ue;if(w||h instanceof Promise)w=(w??Promise.resolve()).then(async()=>{await h,s.issues.length!==v&&(d||(d=Me(s,v)))});else{if(s.issues.length===v)continue;d||(d=Me(s,v))}}return w?w.then(()=>s):s},i=(s,a,l)=>{if(Me(s))return s.aborted=!0,s;const d=o(a,n,l);if(d instanceof Promise){if(l.async===!1)throw new Ue;return d.then(w=>e._zod.parse(w,l))}return e._zod.parse(d,l)};e._zod.run=(s,a)=>{if(a.skipChecks)return e._zod.parse(s,a);if(a.direction==="backward"){const d=e._zod.parse({value:s.value,issues:[]},{...a,skipChecks:!0});return d instanceof Promise?d.then(w=>i(w,s,a)):i(d,s,a)}const l=e._zod.parse(s,a);if(l instanceof Promise){if(a.async===!1)throw new Ue;return l.then(d=>o(d,n,a))}return o(l,n,a)}}N(e,"~standard",()=>({validate:o=>{try{const i=Co(e,o);return i.success?{value:i.data}:{issues:i.error?.issues}}catch{return Do(e,o).then(s=>s.success?{value:s.data}:{issues:s.error?.issues})}},vendor:"zod",version:1}))}),Mt=g("$ZodString",(e,t)=>{ne.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??ls(e._zod.bag),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),J=g("$ZodStringFormat",(e,t)=>{yt.init(e,t),Mt.init(e,t)}),zs=g("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Yo),J.init(e,t)}),Os=g("$ZodUUID",(e,t)=>{if(t.version){const n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(n===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Lr(n))}else t.pattern??(t.pattern=Lr());J.init(e,t)}),xs=g("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Xo),J.init(e,t)}),Fs=g("$ZodURL",(e,t)=>{J.init(e,t),e._zod.check=r=>{try{const n=r.value.trim(),o=new URL(n);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(o.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})),t.normalize?r.value=o.href:r.value=n;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),js=g("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=es()),J.init(e,t)}),Ps=g("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=Ko),J.init(e,t)}),$s=g("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Bo),J.init(e,t)}),As=g("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Jo),J.init(e,t)}),Ts=g("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Wo),J.init(e,t)}),Cs=g("$ZodXID",(e,t)=>{t.pattern??(t.pattern=qo),J.init(e,t)}),Ds=g("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Ho),J.init(e,t)}),Zs=g("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=us(t)),J.init(e,t)}),Is=g("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=as),J.init(e,t)}),Ls=g("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=cs(t)),J.init(e,t)}),Ns=g("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Go),J.init(e,t)}),Rs=g("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=ts),J.init(e,t),e._zod.bag.format="ipv4"}),Vs=g("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=rs),J.init(e,t),e._zod.bag.format="ipv6",e._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}}),Us=g("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=ns),J.init(e,t)}),Ms=g("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=os),J.init(e,t),e._zod.check=r=>{const n=r.value.split("/");try{if(n.length!==2)throw new Error;const[o,i]=n;if(!i)throw new Error;const s=Number(i);if(`${s}`!==i)throw new Error;if(s<0||s>128)throw new Error;new URL(`http://[${o}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function Ur(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const Bs=g("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=ss),J.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{Ur(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function Js(e){if(!Nr.test(e))return!1;const t=e.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return Ur(r)}const Ws=g("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Nr),J.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{Js(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),qs=g("$ZodE164",(e,t)=>{t.pattern??(t.pattern=is),J.init(e,t)});function Hs(e,t=null){try{const r=e.split(".");if(r.length!==3)return!1;const[n]=r;if(!n)return!1;const o=JSON.parse(atob(n));return!("typ"in o&&o?.typ!=="JWT"||!o.alg||t&&(!("alg"in o)||o.alg!==t))}catch{return!1}}const Ks=g("$ZodJWT",(e,t)=>{J.init(e,t),e._zod.check=r=>{Hs(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),Gs=g("$ZodUnknown",(e,t)=>{ne.init(e,t),e._zod.parse=r=>r}),Ys=g("$ZodNever",(e,t)=>{ne.init(e,t),e._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)});function Mr(e,t,r){e.issues.length&&t.issues.push(...Zr(r,e.issues)),t.value[r]=e.value}const Xs=g("$ZodArray",(e,t)=>{ne.init(e,t),e._zod.parse=(r,n)=>{const o=r.value;if(!Array.isArray(o))return r.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),r;r.value=Array(o.length);const i=[];for(let s=0;s<o.length;s++){const a=o[s],l=t.element._zod.run({value:a,issues:[]},n);l instanceof Promise?i.push(l.then(d=>Mr(d,r,s))):Mr(l,r,s)}return i.length?Promise.all(i).then(()=>r):r}});function vt(e,t,r,n,o){if(e.issues.length){if(o&&!(r in n))return;t.issues.push(...Zr(r,e.issues))}e.value===void 0?r in n&&(t.value[r]=void 0):t.value[r]=e.value}function Br(e){const t=Object.keys(e.shape);for(const n of t)if(!e.shape?.[n]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${n}": expected a Zod schema`);const r=ko(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function Jr(e,t,r,n,o,i){const s=[],a=o.keySet,l=o.catchall._zod,d=l.def.type,w=l.optout==="optional";for(const y in t){if(a.has(y))continue;if(d==="never"){s.push(y);continue}const v=l.run({value:t[y],issues:[]},n);v instanceof Promise?e.push(v.then(h=>vt(h,r,y,t,w))):vt(v,r,y,t,w)}return s.length&&r.issues.push({code:"unrecognized_keys",keys:s,input:t,inst:i}),e.length?Promise.all(e).then(()=>r):r}const Qs=g("$ZodObject",(e,t)=>{if(ne.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){const a=t.shape;Object.defineProperty(t,"shape",{get:()=>{const l={...a};return Object.defineProperty(t,"shape",{value:l}),l}})}const n=Lt(()=>Br(t));N(e._zod,"propValues",()=>{const a=t.shape,l={};for(const d in a){const w=a[d]._zod;if(w.values){l[d]??(l[d]=new Set);for(const y of w.values)l[d].add(y)}}return l});const o=lt,i=t.catchall;let s;e._zod.parse=(a,l)=>{s??(s=n.value);const d=a.value;if(!o(d))return a.issues.push({expected:"object",code:"invalid_type",input:d,inst:e}),a;a.value={};const w=[],y=s.shape;for(const v of s.keys){const h=y[v],O=h._zod.optout==="optional",S=h._zod.run({value:d[v],issues:[]},l);S instanceof Promise?w.push(S.then(T=>vt(T,a,v,d,O))):vt(S,a,v,d,O)}return i?Jr(w,d,a,l,n.value,e):w.length?Promise.all(w).then(()=>a):a}}),ei=g("$ZodObjectJIT",(e,t)=>{Qs.init(e,t);const r=e._zod.parse,n=Lt(()=>Br(t)),o=v=>{const h=new Es(["shape","payload","ctx"]),O=n.value,S=I=>{const D=Tr(I);return`shape[${D}]._zod.run({ value: input[${D}], issues: [] }, ctx)`};h.write("const input = payload.value;");const T=Object.create(null);let L=0;for(const I of O.keys)T[I]=`key_${L++}`;h.write("const newResult = {};");for(const I of O.keys){const D=T[I],C=Tr(I),K=v[I]?._zod?.optout==="optional";h.write(`const ${D} = ${S(I)};`),K?h.write(`
9
+ if (${D}.issues.length) {
15
10
  if (${C} in input) {
16
- payload.issues = payload.issues.concat(${L}.issues.map(iss => ({
11
+ payload.issues = payload.issues.concat(${D}.issues.map(iss => ({
17
12
  ...iss,
18
13
  path: iss.path ? [${C}, ...iss.path] : [${C}]
19
14
  })));
20
15
  }
21
16
  }
22
17
 
23
- if (${L}.value === undefined) {
18
+ if (${D}.value === undefined) {
24
19
  if (${C} in input) {
25
20
  newResult[${C}] = undefined;
26
21
  }
27
22
  } else {
28
- newResult[${C}] = ${L}.value;
23
+ newResult[${C}] = ${D}.value;
29
24
  }
30
25
 
31
- `):p.write(`
32
- if (${L}.issues.length) {
33
- payload.issues = payload.issues.concat(${L}.issues.map(iss => ({
26
+ `):h.write(`
27
+ if (${D}.issues.length) {
28
+ payload.issues = payload.issues.concat(${D}.issues.map(iss => ({
34
29
  ...iss,
35
30
  path: iss.path ? [${C}, ...iss.path] : [${C}]
36
31
  })));
37
32
  }
38
33
 
39
- if (${L}.value === undefined) {
34
+ if (${D}.value === undefined) {
40
35
  if (${C} in input) {
41
36
  newResult[${C}] = undefined;
42
37
  }
43
38
  } else {
44
- newResult[${C}] = ${L}.value;
39
+ newResult[${C}] = ${D}.value;
45
40
  }
46
41
 
47
- `)}p.write("payload.value = newResult;"),p.write("return payload;");const P=p.compile();return(Z,L)=>P(y,Z,L)};let o;const i=Et,a=!yn.jitless,c=a&&Po.value,h=t.catchall;let d;e._zod.parse=(y,p)=>{d??(d=n.value);const _=y.value;return i(_)?a&&c&&p?.async===!1&&p.jitless!==!0?(o||(o=s(t.shape)),y=o(y,p),h?zn([],_,y,p,d,e):y):r(y,p):(y.issues.push({expected:"object",code:"invalid_type",input:_,inst:e}),y)}});function Cn(e,t,r,n){for(const o of e)if(o.issues.length===0)return t.value=o.value,t;const s=e.filter(o=>!Xe(o));return s.length===1?(t.value=s[0].value,s[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(o=>o.issues.map(i=>Ke(i,n,Me())))}),t)}const ca=w("$ZodUnion",(e,t)=>{ce.init(e,t),J(e._zod,"optin",()=>t.options.some(s=>s._zod.optin==="optional")?"optional":void 0),J(e._zod,"optout",()=>t.options.some(s=>s._zod.optout==="optional")?"optional":void 0),J(e._zod,"values",()=>{if(t.options.every(s=>s._zod.values))return new Set(t.options.flatMap(s=>Array.from(s._zod.values)))}),J(e._zod,"pattern",()=>{if(t.options.every(s=>s._zod.pattern)){const s=t.options.map(o=>o._zod.pattern);return new RegExp(`^(${s.map(o=>ar(o.source)).join("|")})$`)}});const r=t.options.length===1,n=t.options[0]._zod.run;e._zod.parse=(s,o)=>{if(r)return n(s,o);let i=!1;const a=[];for(const u of t.options){const c=u._zod.run({value:s.value,issues:[]},o);if(c instanceof Promise)a.push(c),i=!0;else{if(c.issues.length===0)return c;a.push(c)}}return i?Promise.all(a).then(u=>Cn(u,s,e,o)):Cn(a,s,e,o)}}),la=w("$ZodIntersection",(e,t)=>{ce.init(e,t),e._zod.parse=(r,n)=>{const s=r.value,o=t.left._zod.run({value:s,issues:[]},n),i=t.right._zod.run({value:s,issues:[]},n);return o instanceof Promise||i instanceof Promise?Promise.all([o,i]).then(([u,c])=>Nn(r,u,c)):Nn(r,o,i)}});function fr(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(dt(e)&&dt(t)){const r=Object.keys(t),n=Object.keys(e).filter(o=>r.indexOf(o)!==-1),s={...e,...t};for(const o of n){const i=fr(e[o],t[o]);if(!i.valid)return{valid:!1,mergeErrorPath:[o,...i.mergeErrorPath]};s[o]=i.data}return{valid:!0,data:s}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const r=[];for(let n=0;n<e.length;n++){const s=e[n],o=t[n],i=fr(s,o);if(!i.valid)return{valid:!1,mergeErrorPath:[n,...i.mergeErrorPath]};r.push(i.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function Nn(e,t,r){const n=new Map;let s;for(const a of t.issues)if(a.code==="unrecognized_keys"){s??(s=a);for(const u of a.keys)n.has(u)||n.set(u,{}),n.get(u).l=!0}else e.issues.push(a);for(const a of r.issues)if(a.code==="unrecognized_keys")for(const u of a.keys)n.has(u)||n.set(u,{}),n.get(u).r=!0;else e.issues.push(a);const o=[...n].filter(([,a])=>a.l&&a.r).map(([a])=>a);if(o.length&&s&&e.issues.push({...s,keys:o}),Xe(e))return e;const i=fr(t.value,r.value);if(!i.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(i.mergeErrorPath)}`);return e.value=i.data,e}const fa=w("$ZodEnum",(e,t)=>{ce.init(e,t);const r=vn(t.entries),n=new Set(r);e._zod.values=n,e._zod.pattern=new RegExp(`^(${r.filter(s=>jo.has(typeof s)).map(s=>typeof s=="string"?Ot(s):s.toString()).join("|")})$`),e._zod.parse=(s,o)=>{const i=s.value;return n.has(i)||s.issues.push({code:"invalid_value",values:r,input:i,inst:e}),s}}),da=w("$ZodTransform",(e,t)=>{ce.init(e,t),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new gn(e.constructor.name);const s=t.transform(r.value,r);if(n.async)return(s instanceof Promise?s:Promise.resolve(s)).then(i=>(r.value=i,r));if(s instanceof Promise)throw new Ge;return r.value=s,r}});function Rn(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const An=w("$ZodOptional",(e,t)=>{ce.init(e,t),e._zod.optin="optional",e._zod.optout="optional",J(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),J(e._zod,"pattern",()=>{const r=t.innerType._zod.pattern;return r?new RegExp(`^(${ar(r.source)})?$`):void 0}),e._zod.parse=(r,n)=>{if(t.innerType._zod.optin==="optional"){const s=t.innerType._zod.run(r,n);return s instanceof Promise?s.then(o=>Rn(o,r.value)):Rn(s,r.value)}return r.value===void 0?r:t.innerType._zod.run(r,n)}}),ha=w("$ZodExactOptional",(e,t)=>{An.init(e,t),J(e._zod,"values",()=>t.innerType._zod.values),J(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(r,n)=>t.innerType._zod.run(r,n)}),pa=w("$ZodNullable",(e,t)=>{ce.init(e,t),J(e._zod,"optin",()=>t.innerType._zod.optin),J(e._zod,"optout",()=>t.innerType._zod.optout),J(e._zod,"pattern",()=>{const r=t.innerType._zod.pattern;return r?new RegExp(`^(${ar(r.source)}|null)$`):void 0}),J(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(r,n)=>r.value===null?r:t.innerType._zod.run(r,n)}),ma=w("$ZodDefault",(e,t)=>{ce.init(e,t),e._zod.optin="optional",J(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);if(r.value===void 0)return r.value=t.defaultValue,r;const s=t.innerType._zod.run(r,n);return s instanceof Promise?s.then(o=>Tn(o,t)):Tn(s,t)}});function Tn(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const ga=w("$ZodPrefault",(e,t)=>{ce.init(e,t),e._zod.optin="optional",J(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>(n.direction==="backward"||r.value===void 0&&(r.value=t.defaultValue),t.innerType._zod.run(r,n))}),ya=w("$ZodNonOptional",(e,t)=>{ce.init(e,t),J(e._zod,"values",()=>{const r=t.innerType._zod.values;return r?new Set([...r].filter(n=>n!==void 0)):void 0}),e._zod.parse=(r,n)=>{const s=t.innerType._zod.run(r,n);return s instanceof Promise?s.then(o=>Dn(o,e)):Dn(s,e)}});function Dn(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const va=w("$ZodCatch",(e,t)=>{ce.init(e,t),J(e._zod,"optin",()=>t.innerType._zod.optin),J(e._zod,"optout",()=>t.innerType._zod.optout),J(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);const s=t.innerType._zod.run(r,n);return s instanceof Promise?s.then(o=>(r.value=o.value,o.issues.length&&(r.value=t.catchValue({...r,error:{issues:o.issues.map(i=>Ke(i,n,Me()))},input:r.value}),r.issues=[]),r)):(r.value=s.value,s.issues.length&&(r.value=t.catchValue({...r,error:{issues:s.issues.map(o=>Ke(o,n,Me()))},input:r.value}),r.issues=[]),r)}}),_a=w("$ZodPipe",(e,t)=>{ce.init(e,t),J(e._zod,"values",()=>t.in._zod.values),J(e._zod,"optin",()=>t.in._zod.optin),J(e._zod,"optout",()=>t.out._zod.optout),J(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,n)=>{if(n.direction==="backward"){const o=t.out._zod.run(r,n);return o instanceof Promise?o.then(i=>Rt(i,t.in,n)):Rt(o,t.in,n)}const s=t.in._zod.run(r,n);return s instanceof Promise?s.then(o=>Rt(o,t.out,n)):Rt(s,t.out,n)}});function Rt(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}const ba=w("$ZodReadonly",(e,t)=>{ce.init(e,t),J(e._zod,"propValues",()=>t.innerType._zod.propValues),J(e._zod,"values",()=>t.innerType._zod.values),J(e._zod,"optin",()=>t.innerType?._zod?.optin),J(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);const s=t.innerType._zod.run(r,n);return s instanceof Promise?s.then(In):In(s)}});function In(e){return e.value=Object.freeze(e.value),e}const wa=w("$ZodCustom",(e,t)=>{Le.init(e,t),ce.init(e,t),e._zod.parse=(r,n)=>r,e._zod.check=r=>{const n=r.value,s=t.fn(n);if(s instanceof Promise)return s.then(o=>Vn(o,r,n,e));Vn(s,r,n,e)}});function Vn(e,t,r,n){if(!e){const s={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(s.params=n._zod.def.params),t.issues.push(ht(s))}}var Zn;class Sa{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...r){const n=r[0];return this._map.set(t,n),n&&typeof n=="object"&&"id"in n&&this._idmap.set(n.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){const r=this._map.get(t);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(t),this}get(t){const r=t._zod.parent;if(r){const n={...this.get(r)??{}};delete n.id;const s={...n,...this._map.get(t)};return Object.keys(s).length?s:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function xa(){return new Sa}(Zn=globalThis).__zod_globalRegistry??(Zn.__zod_globalRegistry=xa());const pt=globalThis.__zod_globalRegistry;function ka(e,t){return new e({type:"string",...A(t)})}function Un(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...A(t)})}function Mn(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...A(t)})}function Ea(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...A(t)})}function Oa(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...A(t)})}function Fa(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...A(t)})}function Pa(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...A(t)})}function ja(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...A(t)})}function $a(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...A(t)})}function La(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...A(t)})}function za(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...A(t)})}function Ca(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...A(t)})}function Na(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...A(t)})}function Ra(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...A(t)})}function Aa(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...A(t)})}function Ta(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...A(t)})}function Da(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...A(t)})}function Ia(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...A(t)})}function Va(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...A(t)})}function Za(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...A(t)})}function Ua(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...A(t)})}function Ma(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...A(t)})}function Ba(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...A(t)})}function Ka(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...A(t)})}function Ja(e,t){return new e({type:"string",format:"date",check:"string_format",...A(t)})}function Ha(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...A(t)})}function Wa(e,t){return new e({type:"string",format:"duration",check:"string_format",...A(t)})}function qa(e){return new e({type:"unknown"})}function Ya(e,t){return new e({type:"never",...A(t)})}function Bn(e,t){return new wi({check:"max_length",...A(t),maximum:e})}function At(e,t){return new Si({check:"min_length",...A(t),minimum:e})}function Kn(e,t){return new xi({check:"length_equals",...A(t),length:e})}function Ga(e,t){return new ki({check:"string_format",format:"regex",...A(t),pattern:e})}function Xa(e){return new Ei({check:"string_format",format:"lowercase",...A(e)})}function Qa(e){return new Oi({check:"string_format",format:"uppercase",...A(e)})}function eu(e,t){return new Fi({check:"string_format",format:"includes",...A(t),includes:e})}function tu(e,t){return new Pi({check:"string_format",format:"starts_with",...A(t),prefix:e})}function ru(e,t){return new ji({check:"string_format",format:"ends_with",...A(t),suffix:e})}function Qe(e){return new $i({check:"overwrite",tx:e})}function nu(e){return Qe(t=>t.normalize(e))}function su(){return Qe(e=>e.trim())}function ou(){return Qe(e=>e.toLowerCase())}function iu(){return Qe(e=>e.toUpperCase())}function au(){return Qe(e=>Fo(e))}function uu(e,t,r){return new e({type:"array",element:t,...A(r)})}function cu(e,t,r){return new e({type:"custom",check:"custom",fn:t,...A(r)})}function lu(e){const t=fu(r=>(r.addIssue=n=>{if(typeof n=="string")r.issues.push(ht(n,r.value,t._zod.def));else{const s=n;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=r.value),s.inst??(s.inst=t),s.continue??(s.continue=!t._zod.def.abort),r.issues.push(ht(s))}},e(r.value,r)));return t}function fu(e,t){const r=new Le({check:"custom",...A(t)});return r._zod.check=e,r}function Jn(e){let t=e?.target??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??pt,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function de(e,t,r={path:[],schemaPath:[]}){var n;const s=e._zod.def,o=t.seen.get(e);if(o)return o.count++,r.schemaPath.includes(e)&&(o.cycle=r.path),o.schema;const i={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,i);const a=e._zod.toJSONSchema?.();if(a)i.schema=a;else{const h={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,i.schema,h);else{const y=i.schema,p=t.processors[s.type];if(!p)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${s.type}`);p(e,t,y,h)}const d=e._zod.parent;d&&(i.ref||(i.ref=d),de(d,t,h),t.seen.get(d).isParent=!0)}const u=t.metadataRegistry.get(e);return u&&Object.assign(i.schema,u),t.io==="input"&&_e(e)&&(delete i.schema.examples,delete i.schema.default),t.io==="input"&&i.schema._prefault&&((n=i.schema).default??(n.default=i.schema._prefault)),delete i.schema._prefault,t.seen.get(e).schema}function Hn(e,t){const r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");const n=new Map;for(const i of e.seen.entries()){const a=e.metadataRegistry.get(i[0])?.id;if(a){const u=n.get(a);if(u&&u!==i[0])throw new Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);n.set(a,i[0])}}const s=i=>{const a=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const d=e.external.registry.get(i[0])?.id,y=e.external.uri??(_=>_);if(d)return{ref:y(d)};const p=i[1].defId??i[1].schema.id??`schema${e.counter++}`;return i[1].defId=p,{defId:p,ref:`${y("__shared")}#/${a}/${p}`}}if(i[1]===r)return{ref:"#"};const c=`#/${a}/`,h=i[1].schema.id??`__schema${e.counter++}`;return{defId:h,ref:c+h}},o=i=>{if(i[1].schema.$ref)return;const a=i[1],{ref:u,defId:c}=s(i);a.def={...a.schema},c&&(a.defId=c);const h=a.schema;for(const d in h)delete h[d];h.$ref=u};if(e.cycles==="throw")for(const i of e.seen.entries()){const a=i[1];if(a.cycle)throw new Error(`Cycle detected: #/${a.cycle?.join("/")}/<root>
42
+ `)}h.write("payload.value = newResult;"),h.write("return payload;");const j=h.compile();return(I,D)=>j(v,I,D)};let i;const s=lt,a=!Pr.jitless,d=a&&wo.value,w=t.catchall;let y;e._zod.parse=(v,h)=>{y??(y=n.value);const O=v.value;return s(O)?a&&d&&h?.async===!1&&h.jitless!==!0?(i||(i=o(t.shape)),v=i(v,h),w?Jr([],O,v,h,y,e):v):r(v,h):(v.issues.push({expected:"object",code:"invalid_type",input:O,inst:e}),v)}});function Wr(e,t,r,n){for(const i of e)if(i.issues.length===0)return t.value=i.value,t;const o=e.filter(i=>!Me(i));return o.length===1?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(i=>i.issues.map(s=>Le(s,n,Ze())))}),t)}const ti=g("$ZodUnion",(e,t)=>{ne.init(e,t),N(e._zod,"optin",()=>t.options.some(o=>o._zod.optin==="optional")?"optional":void 0),N(e._zod,"optout",()=>t.options.some(o=>o._zod.optout==="optional")?"optional":void 0),N(e._zod,"values",()=>{if(t.options.every(o=>o._zod.values))return new Set(t.options.flatMap(o=>Array.from(o._zod.values)))}),N(e._zod,"pattern",()=>{if(t.options.every(o=>o._zod.pattern)){const o=t.options.map(i=>i._zod.pattern);return new RegExp(`^(${o.map(i=>Rt(i.source)).join("|")})$`)}});const r=t.options.length===1,n=t.options[0]._zod.run;e._zod.parse=(o,i)=>{if(r)return n(o,i);let s=!1;const a=[];for(const l of t.options){const d=l._zod.run({value:o.value,issues:[]},i);if(d instanceof Promise)a.push(d),s=!0;else{if(d.issues.length===0)return d;a.push(d)}}return s?Promise.all(a).then(l=>Wr(l,o,e,i)):Wr(a,o,e,i)}}),ri=g("$ZodIntersection",(e,t)=>{ne.init(e,t),e._zod.parse=(r,n)=>{const o=r.value,i=t.left._zod.run({value:o,issues:[]},n),s=t.right._zod.run({value:o,issues:[]},n);return i instanceof Promise||s instanceof Promise?Promise.all([i,s]).then(([l,d])=>qr(r,l,d)):qr(r,i,s)}});function Bt(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(rt(e)&&rt(t)){const r=Object.keys(t),n=Object.keys(e).filter(i=>r.indexOf(i)!==-1),o={...e,...t};for(const i of n){const s=Bt(e[i],t[i]);if(!s.valid)return{valid:!1,mergeErrorPath:[i,...s.mergeErrorPath]};o[i]=s.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const r=[];for(let n=0;n<e.length;n++){const o=e[n],i=t[n],s=Bt(o,i);if(!s.valid)return{valid:!1,mergeErrorPath:[n,...s.mergeErrorPath]};r.push(s.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function qr(e,t,r){const n=new Map;let o;for(const a of t.issues)if(a.code==="unrecognized_keys"){o??(o=a);for(const l of a.keys)n.has(l)||n.set(l,{}),n.get(l).l=!0}else e.issues.push(a);for(const a of r.issues)if(a.code==="unrecognized_keys")for(const l of a.keys)n.has(l)||n.set(l,{}),n.get(l).r=!0;else e.issues.push(a);const i=[...n].filter(([,a])=>a.l&&a.r).map(([a])=>a);if(i.length&&o&&e.issues.push({...o,keys:i}),Me(e))return e;const s=Bt(t.value,r.value);if(!s.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(s.mergeErrorPath)}`);return e.value=s.data,e}const ni=g("$ZodEnum",(e,t)=>{ne.init(e,t);const r=$r(t.entries),n=new Set(r);e._zod.values=n,e._zod.pattern=new RegExp(`^(${r.filter(o=>bo.has(typeof o)).map(o=>typeof o=="string"?ft(o):o.toString()).join("|")})$`),e._zod.parse=(o,i)=>{const s=o.value;return n.has(s)||o.issues.push({code:"invalid_value",values:r,input:s,inst:e}),o}}),oi=g("$ZodTransform",(e,t)=>{ne.init(e,t),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new jr(e.constructor.name);const o=t.transform(r.value,r);if(n.async)return(o instanceof Promise?o:Promise.resolve(o)).then(s=>(r.value=s,r));if(o instanceof Promise)throw new Ue;return r.value=o,r}});function Hr(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const Kr=g("$ZodOptional",(e,t)=>{ne.init(e,t),e._zod.optin="optional",e._zod.optout="optional",N(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),N(e._zod,"pattern",()=>{const r=t.innerType._zod.pattern;return r?new RegExp(`^(${Rt(r.source)})?$`):void 0}),e._zod.parse=(r,n)=>{if(t.innerType._zod.optin==="optional"){const o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>Hr(i,r.value)):Hr(o,r.value)}return r.value===void 0?r:t.innerType._zod.run(r,n)}}),si=g("$ZodExactOptional",(e,t)=>{Kr.init(e,t),N(e._zod,"values",()=>t.innerType._zod.values),N(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(r,n)=>t.innerType._zod.run(r,n)}),ii=g("$ZodNullable",(e,t)=>{ne.init(e,t),N(e._zod,"optin",()=>t.innerType._zod.optin),N(e._zod,"optout",()=>t.innerType._zod.optout),N(e._zod,"pattern",()=>{const r=t.innerType._zod.pattern;return r?new RegExp(`^(${Rt(r.source)}|null)$`):void 0}),N(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(r,n)=>r.value===null?r:t.innerType._zod.run(r,n)}),ai=g("$ZodDefault",(e,t)=>{ne.init(e,t),e._zod.optin="optional",N(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);if(r.value===void 0)return r.value=t.defaultValue,r;const o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>Gr(i,t)):Gr(o,t)}});function Gr(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const ci=g("$ZodPrefault",(e,t)=>{ne.init(e,t),e._zod.optin="optional",N(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>(n.direction==="backward"||r.value===void 0&&(r.value=t.defaultValue),t.innerType._zod.run(r,n))}),ui=g("$ZodNonOptional",(e,t)=>{ne.init(e,t),N(e._zod,"values",()=>{const r=t.innerType._zod.values;return r?new Set([...r].filter(n=>n!==void 0)):void 0}),e._zod.parse=(r,n)=>{const o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>Yr(i,e)):Yr(o,e)}});function Yr(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const li=g("$ZodCatch",(e,t)=>{ne.init(e,t),N(e._zod,"optin",()=>t.innerType._zod.optin),N(e._zod,"optout",()=>t.innerType._zod.optout),N(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);const o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>(r.value=i.value,i.issues.length&&(r.value=t.catchValue({...r,error:{issues:i.issues.map(s=>Le(s,n,Ze()))},input:r.value}),r.issues=[]),r)):(r.value=o.value,o.issues.length&&(r.value=t.catchValue({...r,error:{issues:o.issues.map(i=>Le(i,n,Ze()))},input:r.value}),r.issues=[]),r)}}),fi=g("$ZodPipe",(e,t)=>{ne.init(e,t),N(e._zod,"values",()=>t.in._zod.values),N(e._zod,"optin",()=>t.in._zod.optin),N(e._zod,"optout",()=>t.out._zod.optout),N(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,n)=>{if(n.direction==="backward"){const i=t.out._zod.run(r,n);return i instanceof Promise?i.then(s=>wt(s,t.in,n)):wt(i,t.in,n)}const o=t.in._zod.run(r,n);return o instanceof Promise?o.then(i=>wt(i,t.out,n)):wt(o,t.out,n)}});function wt(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}const di=g("$ZodReadonly",(e,t)=>{ne.init(e,t),N(e._zod,"propValues",()=>t.innerType._zod.propValues),N(e._zod,"values",()=>t.innerType._zod.values),N(e._zod,"optin",()=>t.innerType?._zod?.optin),N(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);const o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(Xr):Xr(o)}});function Xr(e){return e.value=Object.freeze(e.value),e}const mi=g("$ZodCustom",(e,t)=>{Ee.init(e,t),ne.init(e,t),e._zod.parse=(r,n)=>r,e._zod.check=r=>{const n=r.value,o=t.fn(n);if(o instanceof Promise)return o.then(i=>Qr(i,r,n,e));Qr(o,r,n,e)}});function Qr(e,t,r,n){if(!e){const o={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(o.params=n._zod.def.params),t.issues.push(nt(o))}}var en;class hi{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...r){const n=r[0];return this._map.set(t,n),n&&typeof n=="object"&&"id"in n&&this._idmap.set(n.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){const r=this._map.get(t);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(t),this}get(t){const r=t._zod.parent;if(r){const n={...this.get(r)??{}};delete n.id;const o={...n,...this._map.get(t)};return Object.keys(o).length?o:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function pi(){return new hi}(en=globalThis).__zod_globalRegistry??(en.__zod_globalRegistry=pi());const ot=globalThis.__zod_globalRegistry;function gi(e,t){return new e({type:"string",...F(t)})}function tn(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...F(t)})}function rn(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...F(t)})}function _i(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...F(t)})}function yi(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...F(t)})}function vi(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...F(t)})}function wi(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...F(t)})}function bi(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...F(t)})}function ki(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...F(t)})}function Ei(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...F(t)})}function Si(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...F(t)})}function zi(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...F(t)})}function Oi(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...F(t)})}function xi(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...F(t)})}function Fi(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...F(t)})}function ji(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...F(t)})}function Pi(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...F(t)})}function $i(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...F(t)})}function Ai(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...F(t)})}function Ti(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...F(t)})}function Ci(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...F(t)})}function Di(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...F(t)})}function Zi(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...F(t)})}function Ii(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...F(t)})}function Li(e,t){return new e({type:"string",format:"date",check:"string_format",...F(t)})}function Ni(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...F(t)})}function Ri(e,t){return new e({type:"string",format:"duration",check:"string_format",...F(t)})}function Vi(e){return new e({type:"unknown"})}function Ui(e,t){return new e({type:"never",...F(t)})}function nn(e,t){return new ms({check:"max_length",...F(t),maximum:e})}function bt(e,t){return new hs({check:"min_length",...F(t),minimum:e})}function on(e,t){return new ps({check:"length_equals",...F(t),length:e})}function Mi(e,t){return new gs({check:"string_format",format:"regex",...F(t),pattern:e})}function Bi(e){return new _s({check:"string_format",format:"lowercase",...F(e)})}function Ji(e){return new ys({check:"string_format",format:"uppercase",...F(e)})}function Wi(e,t){return new vs({check:"string_format",format:"includes",...F(t),includes:e})}function qi(e,t){return new ws({check:"string_format",format:"starts_with",...F(t),prefix:e})}function Hi(e,t){return new bs({check:"string_format",format:"ends_with",...F(t),suffix:e})}function Be(e){return new ks({check:"overwrite",tx:e})}function Ki(e){return Be(t=>t.normalize(e))}function Gi(){return Be(e=>e.trim())}function Yi(){return Be(e=>e.toLowerCase())}function Xi(){return Be(e=>e.toUpperCase())}function Qi(){return Be(e=>vo(e))}function ea(e,t,r){return new e({type:"array",element:t,...F(r)})}function ta(e,t,r){return new e({type:"custom",check:"custom",fn:t,...F(r)})}function ra(e){const t=na(r=>(r.addIssue=n=>{if(typeof n=="string")r.issues.push(nt(n,r.value,t._zod.def));else{const o=n;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=r.value),o.inst??(o.inst=t),o.continue??(o.continue=!t._zod.def.abort),r.issues.push(nt(o))}},e(r.value,r)));return t}function na(e,t){const r=new Ee({check:"custom",...F(t)});return r._zod.check=e,r}function sn(e){let t=e?.target??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??ot,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function ie(e,t,r={path:[],schemaPath:[]}){var n;const o=e._zod.def,i=t.seen.get(e);if(i)return i.count++,r.schemaPath.includes(e)&&(i.cycle=r.path),i.schema;const s={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,s);const a=e._zod.toJSONSchema?.();if(a)s.schema=a;else{const w={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,s.schema,w);else{const v=s.schema,h=t.processors[o.type];if(!h)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);h(e,t,v,w)}const y=e._zod.parent;y&&(s.ref||(s.ref=y),ie(y,t,w),t.seen.get(y).isParent=!0)}const l=t.metadataRegistry.get(e);return l&&Object.assign(s.schema,l),t.io==="input"&&le(e)&&(delete s.schema.examples,delete s.schema.default),t.io==="input"&&s.schema._prefault&&((n=s.schema).default??(n.default=s.schema._prefault)),delete s.schema._prefault,t.seen.get(e).schema}function an(e,t){const r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");const n=new Map;for(const s of e.seen.entries()){const a=e.metadataRegistry.get(s[0])?.id;if(a){const l=n.get(a);if(l&&l!==s[0])throw new Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);n.set(a,s[0])}}const o=s=>{const a=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const y=e.external.registry.get(s[0])?.id,v=e.external.uri??(O=>O);if(y)return{ref:v(y)};const h=s[1].defId??s[1].schema.id??`schema${e.counter++}`;return s[1].defId=h,{defId:h,ref:`${v("__shared")}#/${a}/${h}`}}if(s[1]===r)return{ref:"#"};const d=`#/${a}/`,w=s[1].schema.id??`__schema${e.counter++}`;return{defId:w,ref:d+w}},i=s=>{if(s[1].schema.$ref)return;const a=s[1],{ref:l,defId:d}=o(s);a.def={...a.schema},d&&(a.defId=d);const w=a.schema;for(const y in w)delete w[y];w.$ref=l};if(e.cycles==="throw")for(const s of e.seen.entries()){const a=s[1];if(a.cycle)throw new Error(`Cycle detected: #/${a.cycle?.join("/")}/<root>
48
43
 
49
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const i of e.seen.entries()){const a=i[1];if(t===i[0]){o(i);continue}if(e.external){const c=e.external.registry.get(i[0])?.id;if(t!==i[0]&&c){o(i);continue}}if(e.metadataRegistry.get(i[0])?.id){o(i);continue}if(a.cycle){o(i);continue}if(a.count>1&&e.reused==="ref"){o(i);continue}}}function Wn(e,t){const r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");const n=i=>{const a=e.seen.get(i);if(a.ref===null)return;const u=a.def??a.schema,c={...u},h=a.ref;if(a.ref=null,h){n(h);const y=e.seen.get(h),p=y.schema;if(p.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(u.allOf=u.allOf??[],u.allOf.push(p)):Object.assign(u,p),Object.assign(u,c),i._zod.parent===h)for(const k in u)k==="$ref"||k==="allOf"||k in c||delete u[k];if(p.$ref)for(const k in u)k==="$ref"||k==="allOf"||k in y.def&&JSON.stringify(u[k])===JSON.stringify(y.def[k])&&delete u[k]}const d=i._zod.parent;if(d&&d!==h){n(d);const y=e.seen.get(d);if(y?.schema.$ref&&(u.$ref=y.schema.$ref,y.def))for(const p in u)p==="$ref"||p==="allOf"||p in y.def&&JSON.stringify(u[p])===JSON.stringify(y.def[p])&&delete u[p]}e.override({zodSchema:i,jsonSchema:u,path:a.path??[]})};for(const i of[...e.seen.entries()].reverse())n(i[0]);const s={};if(e.target==="draft-2020-12"?s.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?s.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?s.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){const i=e.external.registry.get(t)?.id;if(!i)throw new Error("Schema is missing an `id` property");s.$id=e.external.uri(i)}Object.assign(s,r.def??r.schema);const o=e.external?.defs??{};for(const i of e.seen.entries()){const a=i[1];a.def&&a.defId&&(o[a.defId]=a.def)}e.external||Object.keys(o).length>0&&(e.target==="draft-2020-12"?s.$defs=o:s.definitions=o);try{const i=JSON.parse(JSON.stringify(s));return Object.defineProperty(i,"~standard",{value:{...t["~standard"],jsonSchema:{input:Tt(t,"input",e.processors),output:Tt(t,"output",e.processors)}},enumerable:!1,writable:!1}),i}catch{throw new Error("Error converting schema to JSON.")}}function _e(e,t){const r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);const n=e._zod.def;if(n.type==="transform")return!0;if(n.type==="array")return _e(n.element,r);if(n.type==="set")return _e(n.valueType,r);if(n.type==="lazy")return _e(n.getter(),r);if(n.type==="promise"||n.type==="optional"||n.type==="nonoptional"||n.type==="nullable"||n.type==="readonly"||n.type==="default"||n.type==="prefault")return _e(n.innerType,r);if(n.type==="intersection")return _e(n.left,r)||_e(n.right,r);if(n.type==="record"||n.type==="map")return _e(n.keyType,r)||_e(n.valueType,r);if(n.type==="pipe")return _e(n.in,r)||_e(n.out,r);if(n.type==="object"){for(const s in n.shape)if(_e(n.shape[s],r))return!0;return!1}if(n.type==="union"){for(const s of n.options)if(_e(s,r))return!0;return!1}if(n.type==="tuple"){for(const s of n.items)if(_e(s,r))return!0;return!!(n.rest&&_e(n.rest,r))}return!1}const du=(e,t={})=>r=>{const n=Jn({...r,processors:t});return de(e,n),Hn(n,e),Wn(n,e)},Tt=(e,t,r={})=>n=>{const{libraryOptions:s,target:o}=n??{},i=Jn({...s??{},target:o,io:t,processors:r});return de(e,i),Hn(i,e),Wn(i,e)},hu={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},pu=(e,t,r,n)=>{const s=r;s.type="string";const{minimum:o,maximum:i,format:a,patterns:u,contentEncoding:c}=e._zod.bag;if(typeof o=="number"&&(s.minLength=o),typeof i=="number"&&(s.maxLength=i),a&&(s.format=hu[a]??a,s.format===""&&delete s.format,a==="time"&&delete s.format),c&&(s.contentEncoding=c),u&&u.size>0){const h=[...u];h.length===1?s.pattern=h[0].source:h.length>1&&(s.allOf=[...h.map(d=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:d.source}))])}},mu=(e,t,r,n)=>{r.not={}},gu=(e,t,r,n)=>{},yu=(e,t,r,n)=>{const s=e._zod.def,o=vn(s.entries);o.every(i=>typeof i=="number")&&(r.type="number"),o.every(i=>typeof i=="string")&&(r.type="string"),r.enum=o},vu=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},_u=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},bu=(e,t,r,n)=>{const s=r,o=e._zod.def,{minimum:i,maximum:a}=e._zod.bag;typeof i=="number"&&(s.minItems=i),typeof a=="number"&&(s.maxItems=a),s.type="array",s.items=de(o.element,t,{...n,path:[...n.path,"items"]})},wu=(e,t,r,n)=>{const s=r,o=e._zod.def;s.type="object",s.properties={};const i=o.shape;for(const c in i)s.properties[c]=de(i[c],t,{...n,path:[...n.path,"properties",c]});const a=new Set(Object.keys(i)),u=new Set([...a].filter(c=>{const h=o.shape[c]._zod;return t.io==="input"?h.optin===void 0:h.optout===void 0}));u.size>0&&(s.required=Array.from(u)),o.catchall?._zod.def.type==="never"?s.additionalProperties=!1:o.catchall?o.catchall&&(s.additionalProperties=de(o.catchall,t,{...n,path:[...n.path,"additionalProperties"]})):t.io==="output"&&(s.additionalProperties=!1)},Su=(e,t,r,n)=>{const s=e._zod.def,o=s.inclusive===!1,i=s.options.map((a,u)=>de(a,t,{...n,path:[...n.path,o?"oneOf":"anyOf",u]}));o?r.oneOf=i:r.anyOf=i},xu=(e,t,r,n)=>{const s=e._zod.def,o=de(s.left,t,{...n,path:[...n.path,"allOf",0]}),i=de(s.right,t,{...n,path:[...n.path,"allOf",1]}),a=c=>"allOf"in c&&Object.keys(c).length===1,u=[...a(o)?o.allOf:[o],...a(i)?i.allOf:[i]];r.allOf=u},ku=(e,t,r,n)=>{const s=e._zod.def,o=de(s.innerType,t,n),i=t.seen.get(e);t.target==="openapi-3.0"?(i.ref=s.innerType,r.nullable=!0):r.anyOf=[o,{type:"null"}]},Eu=(e,t,r,n)=>{const s=e._zod.def;de(s.innerType,t,n);const o=t.seen.get(e);o.ref=s.innerType},Ou=(e,t,r,n)=>{const s=e._zod.def;de(s.innerType,t,n);const o=t.seen.get(e);o.ref=s.innerType,r.default=JSON.parse(JSON.stringify(s.defaultValue))},Fu=(e,t,r,n)=>{const s=e._zod.def;de(s.innerType,t,n);const o=t.seen.get(e);o.ref=s.innerType,t.io==="input"&&(r._prefault=JSON.parse(JSON.stringify(s.defaultValue)))},Pu=(e,t,r,n)=>{const s=e._zod.def;de(s.innerType,t,n);const o=t.seen.get(e);o.ref=s.innerType;let i;try{i=s.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}r.default=i},ju=(e,t,r,n)=>{const s=e._zod.def,o=t.io==="input"?s.in._zod.def.type==="transform"?s.out:s.in:s.out;de(o,t,n);const i=t.seen.get(e);i.ref=o},$u=(e,t,r,n)=>{const s=e._zod.def;de(s.innerType,t,n);const o=t.seen.get(e);o.ref=s.innerType,r.readOnly=!0},qn=(e,t,r,n)=>{const s=e._zod.def;de(s.innerType,t,n);const o=t.seen.get(e);o.ref=s.innerType};function Yn(e,t){try{var r=e()}catch(n){return t(n)}return r&&r.then?r.then(void 0,t):r}function Lu(e,t){for(var r={};e.length;){var n=e[0],s=n.code,o=n.message,i=n.path.join(".");if(!r[i])if("unionErrors"in n){var a=n.unionErrors[0].errors[0];r[i]={message:a.message,type:a.code}}else r[i]={message:o,type:s};if("unionErrors"in n&&n.unionErrors.forEach(function(h){return h.errors.forEach(function(d){return e.push(d)})}),t){var u=r[i].types,c=u&&u[n.code];r[i]=Xt(i,t,r,s,c?[].concat(c,n.message):n.message)}e.shift()}return r}function zu(e,t){for(var r={};e.length;){var n=e[0],s=n.code,o=n.message,i=n.path.join(".");if(!r[i])if(n.code==="invalid_union"&&n.errors.length>0){var a=n.errors[0][0];r[i]={message:a.message,type:a.code}}else r[i]={message:o,type:s};if(n.code==="invalid_union"&&n.errors.forEach(function(h){return h.forEach(function(d){return e.push(d)})}),t){var u=r[i].types,c=u&&u[n.code];r[i]=Xt(i,t,r,s,c?[].concat(c,n.message):n.message)}e.shift()}return r}function dr(e,t,r){if(r===void 0&&(r={}),(function(n){return"_def"in n&&typeof n._def=="object"&&"typeName"in n._def})(e))return function(n,s,o){try{return Promise.resolve(Yn(function(){return Promise.resolve(e[r.mode==="sync"?"parse":"parseAsync"](n,t)).then(function(i){return o.shouldUseNativeValidation&&nr({},o),{errors:{},values:r.raw?Object.assign({},n):i}})},function(i){if((function(a){return Array.isArray(a?.issues)})(i))return{values:{},errors:pn(Lu(i.errors,!o.shouldUseNativeValidation&&o.criteriaMode==="all"),o)};throw i}))}catch(i){return Promise.reject(i)}};if((function(n){return"_zod"in n&&typeof n._zod=="object"})(e))return function(n,s,o){try{return Promise.resolve(Yn(function(){return Promise.resolve((r.mode==="sync"?Vo:Zo)(e,n,t)).then(function(i){return o.shouldUseNativeValidation&&nr({},o),{errors:{},values:r.raw?Object.assign({},n):i}})},function(i){if((function(a){return a instanceof cr})(i))return{values:{},errors:pn(zu(i.issues,!o.shouldUseNativeValidation&&o.criteriaMode==="all"),o)};throw i}))}catch(i){return Promise.reject(i)}};throw new Error("Invalid input: not a Zod schema")}const Cu=w("ZodISODateTime",(e,t)=>{Bi.init(e,t),ne.init(e,t)});function Nu(e){return Ka(Cu,e)}const Ru=w("ZodISODate",(e,t)=>{Ki.init(e,t),ne.init(e,t)});function Au(e){return Ja(Ru,e)}const Tu=w("ZodISOTime",(e,t)=>{Ji.init(e,t),ne.init(e,t)});function Du(e){return Ha(Tu,e)}const Iu=w("ZodISODuration",(e,t)=>{Hi.init(e,t),ne.init(e,t)});function Vu(e){return Wa(Iu,e)}const Ee=w("ZodError",(e,t)=>{cr.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:r=>Io(e,r)},flatten:{value:r=>Do(e,r)},addIssue:{value:r=>{e.issues.push(r),e.message=JSON.stringify(e.issues,sr,2)}},addIssues:{value:r=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,sr,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),Zu=jt(Ee),Uu=$t(Ee),Mu=Lt(Ee),Bu=zt(Ee),Ku=Bo(Ee),Ju=Ko(Ee),Hu=Jo(Ee),Wu=Ho(Ee),qu=Wo(Ee),Yu=qo(Ee),Gu=Yo(Ee),Xu=Go(Ee),le=w("ZodType",(e,t)=>(ce.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Tt(e,"input"),output:Tt(e,"output")}}),e.toJSONSchema=du(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...r)=>e.clone(De(t,{checks:[...t.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),{parent:!0}),e.with=e.check,e.clone=(r,n)=>Ie(e,r,n),e.brand=()=>e,e.register=((r,n)=>(r.add(e,n),e)),e.parse=(r,n)=>Zu(e,r,n,{callee:e.parse}),e.safeParse=(r,n)=>Mu(e,r,n),e.parseAsync=async(r,n)=>Uu(e,r,n,{callee:e.parseAsync}),e.safeParseAsync=async(r,n)=>Bu(e,r,n),e.spa=e.safeParseAsync,e.encode=(r,n)=>Ku(e,r,n),e.decode=(r,n)=>Ju(e,r,n),e.encodeAsync=async(r,n)=>Hu(e,r,n),e.decodeAsync=async(r,n)=>Wu(e,r,n),e.safeEncode=(r,n)=>qu(e,r,n),e.safeDecode=(r,n)=>Yu(e,r,n),e.safeEncodeAsync=async(r,n)=>Gu(e,r,n),e.safeDecodeAsync=async(r,n)=>Xu(e,r,n),e.refine=(r,n)=>e.check(Mc(r,n)),e.superRefine=r=>e.check(Bc(r)),e.overwrite=r=>e.check(Qe(r)),e.optional=()=>ns(e),e.exactOptional=()=>$c(e),e.nullable=()=>ss(e),e.nullish=()=>ns(ss(e)),e.nonoptional=r=>Ac(e,r),e.array=()=>bc(e),e.or=r=>xc([e,r]),e.and=r=>Ec(e,r),e.transform=r=>is(e,Pc(r)),e.default=r=>Cc(e,r),e.prefault=r=>Rc(e,r),e.catch=r=>Dc(e,r),e.pipe=r=>is(e,r),e.readonly=()=>Zc(e),e.describe=r=>{const n=e.clone();return pt.add(n,{description:r}),n},Object.defineProperty(e,"description",{get(){return pt.get(e)?.description},configurable:!0}),e.meta=(...r)=>{if(r.length===0)return pt.get(e);const n=e.clone();return pt.add(n,r[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=r=>r(e),e)),Gn=w("_ZodString",(e,t)=>{lr.init(e,t),le.init(e,t),e._zod.processJSONSchema=(n,s,o)=>pu(e,n,s);const r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,e.regex=(...n)=>e.check(Ga(...n)),e.includes=(...n)=>e.check(eu(...n)),e.startsWith=(...n)=>e.check(tu(...n)),e.endsWith=(...n)=>e.check(ru(...n)),e.min=(...n)=>e.check(At(...n)),e.max=(...n)=>e.check(Bn(...n)),e.length=(...n)=>e.check(Kn(...n)),e.nonempty=(...n)=>e.check(At(1,...n)),e.lowercase=n=>e.check(Xa(n)),e.uppercase=n=>e.check(Qa(n)),e.trim=()=>e.check(su()),e.normalize=(...n)=>e.check(nu(...n)),e.toLowerCase=()=>e.check(ou()),e.toUpperCase=()=>e.check(iu()),e.slugify=()=>e.check(au())}),Qu=w("ZodString",(e,t)=>{lr.init(e,t),Gn.init(e,t),e.email=r=>e.check(Un(Xn,r)),e.url=r=>e.check(ja(ec,r)),e.jwt=r=>e.check(Ba(mc,r)),e.emoji=r=>e.check($a(tc,r)),e.guid=r=>e.check(Mn(es,r)),e.uuid=r=>e.check(Ea(Dt,r)),e.uuidv4=r=>e.check(Oa(Dt,r)),e.uuidv6=r=>e.check(Fa(Dt,r)),e.uuidv7=r=>e.check(Pa(Dt,r)),e.nanoid=r=>e.check(La(rc,r)),e.guid=r=>e.check(Mn(es,r)),e.cuid=r=>e.check(za(nc,r)),e.cuid2=r=>e.check(Ca(sc,r)),e.ulid=r=>e.check(Na(oc,r)),e.base64=r=>e.check(Za(dc,r)),e.base64url=r=>e.check(Ua(hc,r)),e.xid=r=>e.check(Ra(ic,r)),e.ksuid=r=>e.check(Aa(ac,r)),e.ipv4=r=>e.check(Ta(uc,r)),e.ipv6=r=>e.check(Da(cc,r)),e.cidrv4=r=>e.check(Ia(lc,r)),e.cidrv6=r=>e.check(Va(fc,r)),e.e164=r=>e.check(Ma(pc,r)),e.datetime=r=>e.check(Nu(r)),e.date=r=>e.check(Au(r)),e.time=r=>e.check(Du(r)),e.duration=r=>e.check(Vu(r))});function hr(e){return ka(Qu,e)}const ne=w("ZodStringFormat",(e,t)=>{te.init(e,t),Gn.init(e,t)}),Xn=w("ZodEmail",(e,t)=>{Ri.init(e,t),ne.init(e,t)});function Qn(e){return Un(Xn,e)}const es=w("ZodGUID",(e,t)=>{Ci.init(e,t),ne.init(e,t)}),Dt=w("ZodUUID",(e,t)=>{Ni.init(e,t),ne.init(e,t)}),ec=w("ZodURL",(e,t)=>{Ai.init(e,t),ne.init(e,t)}),tc=w("ZodEmoji",(e,t)=>{Ti.init(e,t),ne.init(e,t)}),rc=w("ZodNanoID",(e,t)=>{Di.init(e,t),ne.init(e,t)}),nc=w("ZodCUID",(e,t)=>{Ii.init(e,t),ne.init(e,t)}),sc=w("ZodCUID2",(e,t)=>{Vi.init(e,t),ne.init(e,t)}),oc=w("ZodULID",(e,t)=>{Zi.init(e,t),ne.init(e,t)}),ic=w("ZodXID",(e,t)=>{Ui.init(e,t),ne.init(e,t)}),ac=w("ZodKSUID",(e,t)=>{Mi.init(e,t),ne.init(e,t)}),uc=w("ZodIPv4",(e,t)=>{Wi.init(e,t),ne.init(e,t)}),cc=w("ZodIPv6",(e,t)=>{qi.init(e,t),ne.init(e,t)}),lc=w("ZodCIDRv4",(e,t)=>{Yi.init(e,t),ne.init(e,t)}),fc=w("ZodCIDRv6",(e,t)=>{Gi.init(e,t),ne.init(e,t)}),dc=w("ZodBase64",(e,t)=>{Xi.init(e,t),ne.init(e,t)}),hc=w("ZodBase64URL",(e,t)=>{ea.init(e,t),ne.init(e,t)}),pc=w("ZodE164",(e,t)=>{ta.init(e,t),ne.init(e,t)}),mc=w("ZodJWT",(e,t)=>{na.init(e,t),ne.init(e,t)}),gc=w("ZodUnknown",(e,t)=>{sa.init(e,t),le.init(e,t),e._zod.processJSONSchema=(r,n,s)=>gu()});function ts(){return qa(gc)}const yc=w("ZodNever",(e,t)=>{oa.init(e,t),le.init(e,t),e._zod.processJSONSchema=(r,n,s)=>mu(e,r,n)});function vc(e){return Ya(yc,e)}const _c=w("ZodArray",(e,t)=>{ia.init(e,t),le.init(e,t),e._zod.processJSONSchema=(r,n,s)=>bu(e,r,n,s),e.element=t.element,e.min=(r,n)=>e.check(At(r,n)),e.nonempty=r=>e.check(At(1,r)),e.max=(r,n)=>e.check(Bn(r,n)),e.length=(r,n)=>e.check(Kn(r,n)),e.unwrap=()=>e.element});function bc(e,t){return uu(_c,e,t)}const wc=w("ZodObject",(e,t)=>{ua.init(e,t),le.init(e,t),e._zod.processJSONSchema=(r,n,s)=>wu(e,r,n,s),J(e,"shape",()=>t.shape),e.keyof=()=>Oc(Object.keys(e._zod.def.shape)),e.catchall=r=>e.clone({...e._zod.def,catchall:r}),e.passthrough=()=>e.clone({...e._zod.def,catchall:ts()}),e.loose=()=>e.clone({...e._zod.def,catchall:ts()}),e.strict=()=>e.clone({...e._zod.def,catchall:vc()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=r=>Co(e,r),e.safeExtend=r=>No(e,r),e.merge=r=>Ro(e,r),e.pick=r=>Lo(e,r),e.omit=r=>zo(e,r),e.partial=(...r)=>Ao(rs,e,r[0]),e.required=(...r)=>To(os,e,r[0])});function pr(e,t){const r={type:"object",shape:e??{},...A(t)};return new wc(r)}const Sc=w("ZodUnion",(e,t)=>{ca.init(e,t),le.init(e,t),e._zod.processJSONSchema=(r,n,s)=>Su(e,r,n,s),e.options=t.options});function xc(e,t){return new Sc({type:"union",options:e,...A(t)})}const kc=w("ZodIntersection",(e,t)=>{la.init(e,t),le.init(e,t),e._zod.processJSONSchema=(r,n,s)=>xu(e,r,n,s)});function Ec(e,t){return new kc({type:"intersection",left:e,right:t})}const mr=w("ZodEnum",(e,t)=>{fa.init(e,t),le.init(e,t),e._zod.processJSONSchema=(n,s,o)=>yu(e,n,s),e.enum=t.entries,e.options=Object.values(t.entries);const r=new Set(Object.keys(t.entries));e.extract=(n,s)=>{const o={};for(const i of n)if(r.has(i))o[i]=t.entries[i];else throw new Error(`Key ${i} not found in enum`);return new mr({...t,checks:[],...A(s),entries:o})},e.exclude=(n,s)=>{const o={...t.entries};for(const i of n)if(r.has(i))delete o[i];else throw new Error(`Key ${i} not found in enum`);return new mr({...t,checks:[],...A(s),entries:o})}});function Oc(e,t){const r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new mr({type:"enum",entries:r,...A(t)})}const Fc=w("ZodTransform",(e,t)=>{da.init(e,t),le.init(e,t),e._zod.processJSONSchema=(r,n,s)=>_u(e,r),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new gn(e.constructor.name);r.addIssue=o=>{if(typeof o=="string")r.issues.push(ht(o,r.value,t));else{const i=o;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=r.value),i.inst??(i.inst=e),r.issues.push(ht(i))}};const s=t.transform(r.value,r);return s instanceof Promise?s.then(o=>(r.value=o,r)):(r.value=s,r)}});function Pc(e){return new Fc({type:"transform",transform:e})}const rs=w("ZodOptional",(e,t)=>{An.init(e,t),le.init(e,t),e._zod.processJSONSchema=(r,n,s)=>qn(e,r,n,s),e.unwrap=()=>e._zod.def.innerType});function ns(e){return new rs({type:"optional",innerType:e})}const jc=w("ZodExactOptional",(e,t)=>{ha.init(e,t),le.init(e,t),e._zod.processJSONSchema=(r,n,s)=>qn(e,r,n,s),e.unwrap=()=>e._zod.def.innerType});function $c(e){return new jc({type:"optional",innerType:e})}const Lc=w("ZodNullable",(e,t)=>{pa.init(e,t),le.init(e,t),e._zod.processJSONSchema=(r,n,s)=>ku(e,r,n,s),e.unwrap=()=>e._zod.def.innerType});function ss(e){return new Lc({type:"nullable",innerType:e})}const zc=w("ZodDefault",(e,t)=>{ma.init(e,t),le.init(e,t),e._zod.processJSONSchema=(r,n,s)=>Ou(e,r,n,s),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Cc(e,t){return new zc({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():Sn(t)}})}const Nc=w("ZodPrefault",(e,t)=>{ga.init(e,t),le.init(e,t),e._zod.processJSONSchema=(r,n,s)=>Fu(e,r,n,s),e.unwrap=()=>e._zod.def.innerType});function Rc(e,t){return new Nc({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():Sn(t)}})}const os=w("ZodNonOptional",(e,t)=>{ya.init(e,t),le.init(e,t),e._zod.processJSONSchema=(r,n,s)=>Eu(e,r,n,s),e.unwrap=()=>e._zod.def.innerType});function Ac(e,t){return new os({type:"nonoptional",innerType:e,...A(t)})}const Tc=w("ZodCatch",(e,t)=>{va.init(e,t),le.init(e,t),e._zod.processJSONSchema=(r,n,s)=>Pu(e,r,n,s),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Dc(e,t){return new Tc({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const Ic=w("ZodPipe",(e,t)=>{_a.init(e,t),le.init(e,t),e._zod.processJSONSchema=(r,n,s)=>ju(e,r,n,s),e.in=t.in,e.out=t.out});function is(e,t){return new Ic({type:"pipe",in:e,out:t})}const Vc=w("ZodReadonly",(e,t)=>{ba.init(e,t),le.init(e,t),e._zod.processJSONSchema=(r,n,s)=>$u(e,r,n,s),e.unwrap=()=>e._zod.def.innerType});function Zc(e){return new Vc({type:"readonly",innerType:e})}const Uc=w("ZodCustom",(e,t)=>{wa.init(e,t),le.init(e,t),e._zod.processJSONSchema=(r,n,s)=>vu(e,r)});function Mc(e,t={}){return cu(Uc,e,t)}function Bc(e){return lu(e)}const fe={notificationsErrorsMap:{"User is not enabled":"auth.loginForm.errors.notifications.userIsNotEnabled","Email not verified":"auth.loginForm.errors.notifications.emailNotVerified","Email not found":"auth.loginForm.errors.notifications.emailNotFound","Invalid password":"auth.loginForm.errors.notifications.invalidPassword","Email is already used":"auth.signUpForm.errors.notifications.emailAlreadyExists","Wrong verification code":"auth.verifyEmailForm.errors.notifications.wrongAuthCode","Start reset password failed, email not found":"auth.startResetPasswordForm.errors.notifications.emailNotFound","Confirm reset password failed, wrong code":"auth.confirmResetPasswordForm.errors.notifications.wrongAuthCode"},fieldsErrorsMap:{"User is not enabled":"email","Email not verified":"email","Email not found":"email","Invalid password":"password","Email is already used":"email","Start reset password failed, email not found":"email"},ru:{confirmResetPasswordForm:{form:{title:"Подтверждение сброса пароля",description:"Введите код подтверждения, чтобы сбросить пароль.",passwordInputLabel:"Новый пароль",authCodeInputLabel:"Код подтверждения",submitButtonLabel:"Сбросить пароль",loginLinkMessage:"Вспомнили пароль?",loginLink:"Войти в систему"},success:{notifications:{confirmResetPasswordSuccess:"Пароль успешно сброшен"}},errors:{fields:{passwordToSmall:"Минимальная длина пароля - 8 символов"},notifications:{unknownError:"Не удалось сбросить пароль",unknownErrorDescription:"Пожалуйста, попробуйте еще раз или обратитесь в службу поддержки",wrongAuthCode:"Неверный код подтверждения"}}},startResetPasswordForm:{form:{title:"Сброс пароля",description:"Введите вашу почту, чтобы получить ссылку на сброс пароля.",emailLabel:"Электронная почта",submitButtonLabel:"Отправить ссылку на сброс пароля",loginLinkMessage:"Вспомнили пароль?",loginLink:"Войти в систему"},errors:{notifications:{unknownError:"Неизвестная ошибка",unknownErrorDescription:"Пожалуйста, попробуйте еще раз позже, либо обратитесь в службу поддержки",emailNotFound:"Пользователь с email {{email}} не найден"}},success:{notifications:{startResetPasswordSuccess:"Ссылка на сброс пароля отправлена на вашу почту"}}},verifyEmailForm:{form:{title:"Подтверждение почты",submitButtonLabel:"Подтвердить",codeLabel:"Код подтверждения",verifyEmailDescription:"Введите код подтверждения, отправленный на вашу почту.",loginLinkMessage:"Почта уже подтверждена?",loginLink:"Войти"},success:{notifications:{verifyEmailSuccess:"Почта успешно подтверждена"}},errors:{notifications:{wrongAuthCode:"Неверный код подтверждения",unknownError:"Неизвестная ошибка",unknownErrorDescription:"Пожалуйста, попробуйте еще раз, либо обратитесь в службу поддержки"}}},loginForm:{form:{title:"Вход",description:"Введите данные для входа",emailLabel:"Email",passwordLabel:"Пароль",forgotPasswordMessage:"Забыли пароль?",submitButtonLabel:"Войти",dontHaveAccountMessage:"Нет аккаунта?",dontHaveAccountLink:"Зарегистрироваться"},errors:{notifications:{emailNotFound:"Пользователь с email {{email}} не найден",userIsNotEnabled:"Пользователь не активирован",emailNotVerified:"Почта не подтверждена",invalidPassword:"Неверный пароль",unknownError:"Не удалось войти в систему",unknownErrorDescription:"Попробуйте войти позже, либо обратитесь в службу поддержки"}},success:{notifications:{loginSuccess:"Вы успешно вошли в систему"}}},signUpForm:{form:{title:"Регистрация",description:"Введите данные для регистрации",emailLabel:"Email",passwordLabel:"Пароль",submitButtonLabel:"Зарегистрироваться",forgotPasswordMessage:"Забыли пароль?",loginLinkMessage:"Уже есть аккаунт?",loginLink:"Войти"},errors:{notifications:{unknownError:"Ошибка регистрации",unknownErrorDescription:"Пожалуйста, попробуйте еще раз или обратитесь к администратору",emailAlreadyExists:"Пользователь с email {{email}} уже существует"},fields:{passwordToSmall:"Минимальная длина пароля - 8 символов"}},success:{notifications:{signUpSuccess:"Вы успешно зарегистрированы"}}}},en:{confirmResetPasswordForm:{form:{title:"Confirm password reset",description:"Enter your new password to confirm the reset.",submitButtonLabel:"Confirm reset",passwordInputLabel:"New password",authCodeInputLabel:"Auth code",confirmPasswordLabel:"Confirm new password",loginLinkMessage:"Already have an account?",loginLink:"Login"},success:{notifications:{confirmResetPasswordSuccess:"Password reset confirmed"}},errors:{fields:{passwordToSmall:"Minimum password length is 8 characters"},notifications:{wrongAuthCode:"Wrong auth code",unknownError:"Unknown error",unknownErrorDescription:"Please try again or contact support"}}},startResetPasswordForm:{form:{title:"Start password reset",description:"Enter your email to receive a password reset link.",submitButtonLabel:"Send reset link",emailLabel:"Email",resetPasswordDescription:"Enter your email to receive a password reset link.",loginLinkMessage:"Already have an account?",loginLink:"Login"},success:{notifications:{startResetPasswordSuccess:"Reset link sent successfully"}},errors:{notifications:{emailNotFound:"User with email {{email}} not found",unknownError:"Unknown error",unknownErrorDescription:"Please try again or contact support"}}},verifyEmailForm:{form:{title:"Verify email",submitButtonLabel:"Verify",codeLabel:"Verification code",verifyEmailDescription:"Enter the verification code sent to your email.",loginLinkMessage:"Email already verified?",loginLink:"Login"},success:{notifications:{verifyEmailSuccess:"Email successfully verified"}},errors:{notifications:{wrongAuthCode:"Wrong verification code",unknownError:"Unknown error",unknownErrorDescription:"Please try again or contact support"}}},loginForm:{form:{title:"Login",description:"Enter your login details",emailLabel:"Email",passwordLabel:"Password",forgotPasswordMessage:"Forgot password?",submitButtonLabel:"Login",dontHaveAccountMessage:"Don't have an account?",dontHaveAccountLink:"Register"},errors:{notifications:{emailNotFound:"User with email {{email}} not found",userIsNotEnabled:"User is not enabled",emailNotVerified:"Email not verified",invalidPassword:"Invalid password",unknownError:"Unknown error",unknownErrorDescription:"Please try again or contact support"}},success:{notifications:{loginSuccess:"You have successfully logged in"}}},signUpForm:{form:{title:"Registration",description:"Enter your registration details",emailLabel:"Email",passwordLabel:"Password",submitButtonLabel:"Register",forgotPasswordMessage:"Forgot password?",loginLinkMessage:"Already have an account?",loginLink:"Login"},errors:{notifications:{unknownError:"Signup failed",unknownErrorDescription:"Please try again or contact the administrator",emailAlreadyExists:"User with email {{email}} already exists"}},success:{notifications:{signUpSuccess:"You have successfully registered"}}}}},Kc=({i18n:e,auth:t})=>{const r=V.useMemo(()=>pr({code:hr(),password:hr().min(8,{message:e.t("auth.confirmResetPasswordForm.errors.fields.passwordToSmall")})}),[]),n=ft({resolver:dr(r),defaultValues:{code:"",password:""}}),s=xe.useNavigate();return{submit:V.useCallback(i=>{t.confirmResetPassword(i).then(()=>{b.toast.success(e.t("auth.confirmResetPasswordForm.success.notifications.confirmResetPasswordSuccess")),s({to:"/"})}).catch(a=>{if(a.status===400){const u=a.response.data.detail;if(fe.fieldsErrorsMap[u]&&n.setError(fe.fieldsErrorsMap[u],{}),fe.notificationsErrorsMap[u]){const c=fe.notificationsErrorsMap[u];b.toast.error(e.t(c,i));return}b.toast.error(e.t("auth.confirmResetPasswordForm.errors.notifications.unknownError"),{description:e.t("auth.confirmResetPasswordForm.errors.notifications.unknownErrorDescription")})}})},[]),form:n}},Jc=({auth:e,i18n:t})=>{const r=xe.useNavigate(),n=ft({defaultValues:{email:"",password:""}}),s=V.useCallback(o=>e.login(o).then(()=>{r({to:"/"}),b.toast.success(t.t("auth.loginForm.success.notifications.loginSuccess"))}).catch(i=>{if(i.status===400&&(fe.fieldsErrorsMap[i.response.data.detail]&&n.setError(fe.fieldsErrorsMap[i.response.data.detail],{}),fe.notificationsErrorsMap[i.response.data.detail])){b.toast.error(t.t(fe.notificationsErrorsMap[i.response.data.detail],o));return}b.toast.error(t.t("auth.loginForm.errors.notifications.unknownError"),{description:t.t("auth.loginForm.errors.notifications.unknownErrorDescription")})}),[e.login,t,n.setError,r]);return{form:n,submit:s}},Hc=({auth:e,i18n:t})=>{const r=V.useMemo(()=>pr({email:Qn(),password:hr().min(8,{message:t.t("auth.signUpForm.errors.fields.passwordToSmall")})}),[]),n=ft({resolver:dr(r),defaultValues:{email:"",password:""}}),s=xe.useNavigate();return{submit:V.useCallback(i=>{e.signup(i).then(()=>{s({to:"/auth/verify-email"}).then(()=>{b.toast.success(t.t("auth.signUpForm.success.notifications.signUpSuccess"))})}).catch(a=>{if(a.status===400){fe.fieldsErrorsMap[a.response.data.detail]&&n.setError(fe.fieldsErrorsMap[a.response.data.detail],{});const u=a.response.data.detail;if(fe.notificationsErrorsMap[u]){const c=fe.notificationsErrorsMap[u];b.toast.error(t.t(c,i))}return}b.toast.error(t.t("auth.signUpForm.errors.notifications.unknownError"),{description:t.t("auth.signUpForm.errors.notifications.unknownErrorDescription")})})},[n.setError,s]),form:n}},Wc=({i18n:e,auth:t})=>{const r=xe.useNavigate(),n=V.useMemo(()=>pr({email:Qn()}),[]),s=ft({resolver:dr(n),defaultValues:{email:""}}),o=V.useCallback(i=>{t.startResetPassword(i).then(()=>{b.toast.success(e.t("auth.startResetPasswordForm.success.notifications.startResetPasswordSuccess")),r({to:"/auth/confirm-reset-password"})}).catch(a=>{if(a.status===400&&(fe.fieldsErrorsMap[a.response.data.detail]&&s.setError(fe.fieldsErrorsMap[a.response.data.detail],{}),fe.notificationsErrorsMap[a.response.data.detail])){b.toast.error(e.t(fe.notificationsErrorsMap[a.response.data.detail],i));return}b.toast.error(e.t("auth.startResetPasswordForm.errors.notifications.unknownError"),{description:e.t("auth.startResetPasswordForm.errors.notifications.unknownErrorDescription")})})},[]);return{form:s,submit:o}},qc=({auth:e,i18n:t})=>{const r=ft({defaultValues:{code:""}}),n=xe.useNavigate();return{submit:V.useCallback(o=>{e.verifyEmail(o).then(()=>{n({to:"/"}).then(()=>{b.toast.success(t.t("auth.verifyEmailForm.success.notifications.verifyEmailSuccess"))})}).catch(i=>{if(i.status===400){const a=i.response.data.detail,u=fe.notificationsErrorsMap[a];if(u){b.toast.error(t.t(u));return}}b.toast.error(t.t("auth.verifyEmailForm.errors.notifications.unknownError"),{description:t.t("auth.verifyEmailForm.errors.notifications.unknownErrorDescription")})})},[]),form:r}},as=V.createContext({auth:null});var It={exports:{}},gr={},Vt={exports:{}},yr={};var us;function Yc(){if(us)return yr;us=1;var e=V;function t(d,y){return d===y&&(d!==0||1/d===1/y)||d!==d&&y!==y}var r=typeof Object.is=="function"?Object.is:t,n=e.useState,s=e.useEffect,o=e.useLayoutEffect,i=e.useDebugValue;function a(d,y){var p=y(),_=n({inst:{value:p,getSnapshot:y}}),k=_[0].inst,j=_[1];return o(function(){k.value=p,k.getSnapshot=y,u(k)&&j({inst:k})},[d,p,y]),s(function(){return u(k)&&j({inst:k}),d(function(){u(k)&&j({inst:k})})},[d]),i(p),p}function u(d){var y=d.getSnapshot;d=d.value;try{var p=y();return!r(d,p)}catch{return!0}}function c(d,y){return y()}var h=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?c:a;return yr.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:h,yr}var vr={};var cs;function Gc(){return cs||(cs=1,process.env.NODE_ENV!=="production"&&(function(){function e(p,_){return p===_&&(p!==0||1/p===1/_)||p!==p&&_!==_}function t(p,_){h||s.startTransition===void 0||(h=!0,console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var k=_();if(!d){var j=_();o(k,j)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),d=!0)}j=i({inst:{value:k,getSnapshot:_}});var D=j[0].inst,P=j[1];return u(function(){D.value=k,D.getSnapshot=_,r(D)&&P({inst:D})},[p,k,_]),a(function(){return r(D)&&P({inst:D}),p(function(){r(D)&&P({inst:D})})},[p]),c(k),k}function r(p){var _=p.getSnapshot;p=p.value;try{var k=_();return!o(p,k)}catch{return!0}}function n(p,_){return _()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var s=V,o=typeof Object.is=="function"?Object.is:e,i=s.useState,a=s.useEffect,u=s.useLayoutEffect,c=s.useDebugValue,h=!1,d=!1,y=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?n:t;vr.useSyncExternalStore=s.useSyncExternalStore!==void 0?s.useSyncExternalStore:y,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),vr}var ls;function fs(){return ls||(ls=1,process.env.NODE_ENV==="production"?Vt.exports=Yc():Vt.exports=Gc()),Vt.exports}var ds;function Xc(){if(ds)return gr;ds=1;var e=V,t=fs();function r(c,h){return c===h&&(c!==0||1/c===1/h)||c!==c&&h!==h}var n=typeof Object.is=="function"?Object.is:r,s=t.useSyncExternalStore,o=e.useRef,i=e.useEffect,a=e.useMemo,u=e.useDebugValue;return gr.useSyncExternalStoreWithSelector=function(c,h,d,y,p){var _=o(null);if(_.current===null){var k={hasValue:!1,value:null};_.current=k}else k=_.current;_=a(function(){function D(M){if(!P){if(P=!0,Z=M,M=y(M),p!==void 0&&k.hasValue){var K=k.value;if(p(K,M))return L=K}return L=M}if(K=L,n(Z,M))return K;var ae=y(M);return p!==void 0&&p(K,ae)?(Z=M,K):(Z=M,L=ae)}var P=!1,Z,L,C=d===void 0?null:d;return[function(){return D(h())},C===null?void 0:function(){return D(C())}]},[h,d,y,p]);var j=s(c,_[0],_[1]);return i(function(){k.hasValue=!0,k.value=j},[j]),u(j),j},gr}var _r={};var hs;function Qc(){return hs||(hs=1,process.env.NODE_ENV!=="production"&&(function(){function e(c,h){return c===h&&(c!==0||1/c===1/h)||c!==c&&h!==h}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=V,r=fs(),n=typeof Object.is=="function"?Object.is:e,s=r.useSyncExternalStore,o=t.useRef,i=t.useEffect,a=t.useMemo,u=t.useDebugValue;_r.useSyncExternalStoreWithSelector=function(c,h,d,y,p){var _=o(null);if(_.current===null){var k={hasValue:!1,value:null};_.current=k}else k=_.current;_=a(function(){function D(M){if(!P){if(P=!0,Z=M,M=y(M),p!==void 0&&k.hasValue){var K=k.value;if(p(K,M))return L=K}return L=M}if(K=L,n(Z,M))return K;var ae=y(M);return p!==void 0&&p(K,ae)?(Z=M,K):(Z=M,L=ae)}var P=!1,Z,L,C=d===void 0?null:d;return[function(){return D(h())},C===null?void 0:function(){return D(C())}]},[h,d,y,p]);var j=s(c,_[0],_[1]);return i(function(){k.hasValue=!0,k.value=j},[j]),u(j),j},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),_r}var ps;function el(){return ps||(ps=1,process.env.NODE_ENV==="production"?It.exports=Xc():It.exports=Qc()),It.exports}var tl=el();function rl(e,t=n=>n,r={}){const n=r.equal??nl;return tl.useSyncExternalStoreWithSelector(e.subscribe,()=>e.state,()=>e.state,t,n)}function nl(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[n,s]of e)if(!t.has(n)||!Object.is(s,t.get(n)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();const r=ms(e);if(r.length!==ms(t).length)return!1;for(let n=0;n<r.length;n++)if(!Object.prototype.hasOwnProperty.call(t,r[n])||!Object.is(e[r[n]],t[r[n]]))return!1;return!0}function ms(e){return Object.keys(e).concat(Object.getOwnPropertySymbols(e))}const sl=({auth:e,children:t})=>{const r=xe.useNavigate(),{isLoaded:n,isAuthenticated:s}=rl(e.accountStore,a=>a),[o,i]=V.useState(0);return V.useEffect(()=>{const a=setInterval(()=>{i(u=>u===100?(clearInterval(a),u):u+1)},100);return()=>clearInterval(a)},[]),V.useEffect(()=>{e.initAuthData(),e.load()},[e]),V.useEffect(()=>{n&&!s&&r({to:"/auth/login"})},[n,s,r]),n&&s?g.jsx(as,{value:{auth:e},children:t}):o>5?g.jsx("div",{className:"flex items-center justify-center h-screen",children:g.jsxs("div",{className:"p-4 rounded w-1/2",children:[g.jsx("h2",{className:"text-center",children:"account loading..."}),g.jsx(b.Progress,{value:o})]})}):null};G.Auth=to,G.AuthContext=as,G.AuthContextProvider=sl,G.ConfirmResetPasswordForm=Os,G.DevPanel=Es,G.LoginForm=Ys,G.SignUpForm=Gs,G.StartResetPasswordForm=Xs,G.VerifyEmailForm=Qs,G.authE2EConfig=me,G.isAdmin=eo,G.locale=fe,G.useConfirmResetPasswordForm=Kc,G.useLoginForm=Jc,G.useSignUpForm=Hc,G.useStartResetPasswordForm=Wc,G.useVerifyEmailForm=qc,Object.defineProperty(G,Symbol.toStringTag,{value:"Module"})}));
44
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const s of e.seen.entries()){const a=s[1];if(t===s[0]){i(s);continue}if(e.external){const d=e.external.registry.get(s[0])?.id;if(t!==s[0]&&d){i(s);continue}}if(e.metadataRegistry.get(s[0])?.id){i(s);continue}if(a.cycle){i(s);continue}if(a.count>1&&e.reused==="ref"){i(s);continue}}}function cn(e,t){const r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");const n=s=>{const a=e.seen.get(s);if(a.ref===null)return;const l=a.def??a.schema,d={...l},w=a.ref;if(a.ref=null,w){n(w);const v=e.seen.get(w),h=v.schema;if(h.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(l.allOf=l.allOf??[],l.allOf.push(h)):Object.assign(l,h),Object.assign(l,d),s._zod.parent===w)for(const S in l)S==="$ref"||S==="allOf"||S in d||delete l[S];if(h.$ref)for(const S in l)S==="$ref"||S==="allOf"||S in v.def&&JSON.stringify(l[S])===JSON.stringify(v.def[S])&&delete l[S]}const y=s._zod.parent;if(y&&y!==w){n(y);const v=e.seen.get(y);if(v?.schema.$ref&&(l.$ref=v.schema.$ref,v.def))for(const h in l)h==="$ref"||h==="allOf"||h in v.def&&JSON.stringify(l[h])===JSON.stringify(v.def[h])&&delete l[h]}e.override({zodSchema:s,jsonSchema:l,path:a.path??[]})};for(const s of[...e.seen.entries()].reverse())n(s[0]);const o={};if(e.target==="draft-2020-12"?o.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?o.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?o.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){const s=e.external.registry.get(t)?.id;if(!s)throw new Error("Schema is missing an `id` property");o.$id=e.external.uri(s)}Object.assign(o,r.def??r.schema);const i=e.external?.defs??{};for(const s of e.seen.entries()){const a=s[1];a.def&&a.defId&&(i[a.defId]=a.def)}e.external||Object.keys(i).length>0&&(e.target==="draft-2020-12"?o.$defs=i:o.definitions=i);try{const s=JSON.parse(JSON.stringify(o));return Object.defineProperty(s,"~standard",{value:{...t["~standard"],jsonSchema:{input:kt(t,"input",e.processors),output:kt(t,"output",e.processors)}},enumerable:!1,writable:!1}),s}catch{throw new Error("Error converting schema to JSON.")}}function le(e,t){const r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);const n=e._zod.def;if(n.type==="transform")return!0;if(n.type==="array")return le(n.element,r);if(n.type==="set")return le(n.valueType,r);if(n.type==="lazy")return le(n.getter(),r);if(n.type==="promise"||n.type==="optional"||n.type==="nonoptional"||n.type==="nullable"||n.type==="readonly"||n.type==="default"||n.type==="prefault")return le(n.innerType,r);if(n.type==="intersection")return le(n.left,r)||le(n.right,r);if(n.type==="record"||n.type==="map")return le(n.keyType,r)||le(n.valueType,r);if(n.type==="pipe")return le(n.in,r)||le(n.out,r);if(n.type==="object"){for(const o in n.shape)if(le(n.shape[o],r))return!0;return!1}if(n.type==="union"){for(const o of n.options)if(le(o,r))return!0;return!1}if(n.type==="tuple"){for(const o of n.items)if(le(o,r))return!0;return!!(n.rest&&le(n.rest,r))}return!1}const oa=(e,t={})=>r=>{const n=sn({...r,processors:t});return ie(e,n),an(n,e),cn(n,e)},kt=(e,t,r={})=>n=>{const{libraryOptions:o,target:i}=n??{},s=sn({...o??{},target:i,io:t,processors:r});return ie(e,s),an(s,e),cn(s,e)},sa={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},ia=(e,t,r,n)=>{const o=r;o.type="string";const{minimum:i,maximum:s,format:a,patterns:l,contentEncoding:d}=e._zod.bag;if(typeof i=="number"&&(o.minLength=i),typeof s=="number"&&(o.maxLength=s),a&&(o.format=sa[a]??a,o.format===""&&delete o.format,a==="time"&&delete o.format),d&&(o.contentEncoding=d),l&&l.size>0){const w=[...l];w.length===1?o.pattern=w[0].source:w.length>1&&(o.allOf=[...w.map(y=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:y.source}))])}},aa=(e,t,r,n)=>{r.not={}},ca=(e,t,r,n)=>{},ua=(e,t,r,n)=>{const o=e._zod.def,i=$r(o.entries);i.every(s=>typeof s=="number")&&(r.type="number"),i.every(s=>typeof s=="string")&&(r.type="string"),r.enum=i},la=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},fa=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},da=(e,t,r,n)=>{const o=r,i=e._zod.def,{minimum:s,maximum:a}=e._zod.bag;typeof s=="number"&&(o.minItems=s),typeof a=="number"&&(o.maxItems=a),o.type="array",o.items=ie(i.element,t,{...n,path:[...n.path,"items"]})},ma=(e,t,r,n)=>{const o=r,i=e._zod.def;o.type="object",o.properties={};const s=i.shape;for(const d in s)o.properties[d]=ie(s[d],t,{...n,path:[...n.path,"properties",d]});const a=new Set(Object.keys(s)),l=new Set([...a].filter(d=>{const w=i.shape[d]._zod;return t.io==="input"?w.optin===void 0:w.optout===void 0}));l.size>0&&(o.required=Array.from(l)),i.catchall?._zod.def.type==="never"?o.additionalProperties=!1:i.catchall?i.catchall&&(o.additionalProperties=ie(i.catchall,t,{...n,path:[...n.path,"additionalProperties"]})):t.io==="output"&&(o.additionalProperties=!1)},ha=(e,t,r,n)=>{const o=e._zod.def,i=o.inclusive===!1,s=o.options.map((a,l)=>ie(a,t,{...n,path:[...n.path,i?"oneOf":"anyOf",l]}));i?r.oneOf=s:r.anyOf=s},pa=(e,t,r,n)=>{const o=e._zod.def,i=ie(o.left,t,{...n,path:[...n.path,"allOf",0]}),s=ie(o.right,t,{...n,path:[...n.path,"allOf",1]}),a=d=>"allOf"in d&&Object.keys(d).length===1,l=[...a(i)?i.allOf:[i],...a(s)?s.allOf:[s]];r.allOf=l},ga=(e,t,r,n)=>{const o=e._zod.def,i=ie(o.innerType,t,n),s=t.seen.get(e);t.target==="openapi-3.0"?(s.ref=o.innerType,r.nullable=!0):r.anyOf=[i,{type:"null"}]},_a=(e,t,r,n)=>{const o=e._zod.def;ie(o.innerType,t,n);const i=t.seen.get(e);i.ref=o.innerType},ya=(e,t,r,n)=>{const o=e._zod.def;ie(o.innerType,t,n);const i=t.seen.get(e);i.ref=o.innerType,r.default=JSON.parse(JSON.stringify(o.defaultValue))},va=(e,t,r,n)=>{const o=e._zod.def;ie(o.innerType,t,n);const i=t.seen.get(e);i.ref=o.innerType,t.io==="input"&&(r._prefault=JSON.parse(JSON.stringify(o.defaultValue)))},wa=(e,t,r,n)=>{const o=e._zod.def;ie(o.innerType,t,n);const i=t.seen.get(e);i.ref=o.innerType;let s;try{s=o.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}r.default=s},ba=(e,t,r,n)=>{const o=e._zod.def,i=t.io==="input"?o.in._zod.def.type==="transform"?o.out:o.in:o.out;ie(i,t,n);const s=t.seen.get(e);s.ref=i},ka=(e,t,r,n)=>{const o=e._zod.def;ie(o.innerType,t,n);const i=t.seen.get(e);i.ref=o.innerType,r.readOnly=!0},un=(e,t,r,n)=>{const o=e._zod.def;ie(o.innerType,t,n);const i=t.seen.get(e);i.ref=o.innerType};function ln(e,t){try{var r=e()}catch(n){return t(n)}return r&&r.then?r.then(void 0,t):r}function Ea(e,t){for(var r={};e.length;){var n=e[0],o=n.code,i=n.message,s=n.path.join(".");if(!r[s])if("unionErrors"in n){var a=n.unionErrors[0].errors[0];r[s]={message:a.message,type:a.code}}else r[s]={message:i,type:o};if("unionErrors"in n&&n.unionErrors.forEach(function(w){return w.errors.forEach(function(y){return e.push(y)})}),t){var l=r[s].types,d=l&&l[n.code];r[s]=$t(s,t,r,o,d?[].concat(d,n.message):n.message)}e.shift()}return r}function Sa(e,t){for(var r={};e.length;){var n=e[0],o=n.code,i=n.message,s=n.path.join(".");if(!r[s])if(n.code==="invalid_union"&&n.errors.length>0){var a=n.errors[0][0];r[s]={message:a.message,type:a.code}}else r[s]={message:i,type:o};if(n.code==="invalid_union"&&n.errors.forEach(function(w){return w.forEach(function(y){return e.push(y)})}),t){var l=r[s].types,d=l&&l[n.code];r[s]=$t(s,t,r,o,d?[].concat(d,n.message):n.message)}e.shift()}return r}function Jt(e,t,r){if(r===void 0&&(r={}),(function(n){return"_def"in n&&typeof n._def=="object"&&"typeName"in n._def})(e))return function(n,o,i){try{return Promise.resolve(ln(function(){return Promise.resolve(e[r.mode==="sync"?"parse":"parseAsync"](n,t)).then(function(s){return i.shouldUseNativeValidation&&Zt({},i),{errors:{},values:r.raw?Object.assign({},n):s}})},function(s){if((function(a){return Array.isArray(a?.issues)})(s))return{values:{},errors:xr(Ea(s.errors,!i.shouldUseNativeValidation&&i.criteriaMode==="all"),i)};throw s}))}catch(s){return Promise.reject(s)}};if((function(n){return"_zod"in n&&typeof n._zod=="object"})(e))return function(n,o,i){try{return Promise.resolve(ln(function(){return Promise.resolve((r.mode==="sync"?Ao:To)(e,n,t)).then(function(s){return i.shouldUseNativeValidation&&Zt({},i),{errors:{},values:r.raw?Object.assign({},n):s}})},function(s){if((function(a){return a instanceof Ut})(s))return{values:{},errors:xr(Sa(s.issues,!i.shouldUseNativeValidation&&i.criteriaMode==="all"),i)};throw s}))}catch(s){return Promise.reject(s)}};throw new Error("Invalid input: not a Zod schema")}const za=g("ZodISODateTime",(e,t)=>{Zs.init(e,t),H.init(e,t)});function Oa(e){return Ii(za,e)}const xa=g("ZodISODate",(e,t)=>{Is.init(e,t),H.init(e,t)});function Fa(e){return Li(xa,e)}const ja=g("ZodISOTime",(e,t)=>{Ls.init(e,t),H.init(e,t)});function Pa(e){return Ni(ja,e)}const $a=g("ZodISODuration",(e,t)=>{Ns.init(e,t),H.init(e,t)});function Aa(e){return Ri($a,e)}const ye=g("ZodError",(e,t)=>{Ut.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:r=>$o(e,r)},flatten:{value:r=>Po(e,r)},addIssue:{value:r=>{e.issues.push(r),e.message=JSON.stringify(e.issues,It,2)}},addIssues:{value:r=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,It,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),Ta=ht(ye),Ca=pt(ye),Da=gt(ye),Za=_t(ye),Ia=Zo(ye),La=Io(ye),Na=Lo(ye),Ra=No(ye),Va=Ro(ye),Ua=Vo(ye),Ma=Uo(ye),Ba=Mo(ye),oe=g("ZodType",(e,t)=>(ne.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:kt(e,"input"),output:kt(e,"output")}}),e.toJSONSchema=oa(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...r)=>e.clone(Fe(t,{checks:[...t.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),{parent:!0}),e.with=e.check,e.clone=(r,n)=>je(e,r,n),e.brand=()=>e,e.register=((r,n)=>(r.add(e,n),e)),e.parse=(r,n)=>Ta(e,r,n,{callee:e.parse}),e.safeParse=(r,n)=>Da(e,r,n),e.parseAsync=async(r,n)=>Ca(e,r,n,{callee:e.parseAsync}),e.safeParseAsync=async(r,n)=>Za(e,r,n),e.spa=e.safeParseAsync,e.encode=(r,n)=>Ia(e,r,n),e.decode=(r,n)=>La(e,r,n),e.encodeAsync=async(r,n)=>Na(e,r,n),e.decodeAsync=async(r,n)=>Ra(e,r,n),e.safeEncode=(r,n)=>Va(e,r,n),e.safeDecode=(r,n)=>Ua(e,r,n),e.safeEncodeAsync=async(r,n)=>Ma(e,r,n),e.safeDecodeAsync=async(r,n)=>Ba(e,r,n),e.refine=(r,n)=>e.check(Dc(r,n)),e.superRefine=r=>e.check(Zc(r)),e.overwrite=r=>e.check(Be(r)),e.optional=()=>_n(e),e.exactOptional=()=>kc(e),e.nullable=()=>yn(e),e.nullish=()=>_n(yn(e)),e.nonoptional=r=>Fc(e,r),e.array=()=>dc(e),e.or=r=>pc([e,r]),e.and=r=>_c(e,r),e.transform=r=>wn(e,wc(r)),e.default=r=>zc(e,r),e.prefault=r=>xc(e,r),e.catch=r=>Pc(e,r),e.pipe=r=>wn(e,r),e.readonly=()=>Tc(e),e.describe=r=>{const n=e.clone();return ot.add(n,{description:r}),n},Object.defineProperty(e,"description",{get(){return ot.get(e)?.description},configurable:!0}),e.meta=(...r)=>{if(r.length===0)return ot.get(e);const n=e.clone();return ot.add(n,r[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=r=>r(e),e)),fn=g("_ZodString",(e,t)=>{Mt.init(e,t),oe.init(e,t),e._zod.processJSONSchema=(n,o,i)=>ia(e,n,o);const r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,e.regex=(...n)=>e.check(Mi(...n)),e.includes=(...n)=>e.check(Wi(...n)),e.startsWith=(...n)=>e.check(qi(...n)),e.endsWith=(...n)=>e.check(Hi(...n)),e.min=(...n)=>e.check(bt(...n)),e.max=(...n)=>e.check(nn(...n)),e.length=(...n)=>e.check(on(...n)),e.nonempty=(...n)=>e.check(bt(1,...n)),e.lowercase=n=>e.check(Bi(n)),e.uppercase=n=>e.check(Ji(n)),e.trim=()=>e.check(Gi()),e.normalize=(...n)=>e.check(Ki(...n)),e.toLowerCase=()=>e.check(Yi()),e.toUpperCase=()=>e.check(Xi()),e.slugify=()=>e.check(Qi())}),Ja=g("ZodString",(e,t)=>{Mt.init(e,t),fn.init(e,t),e.email=r=>e.check(tn(dn,r)),e.url=r=>e.check(bi(Wa,r)),e.jwt=r=>e.check(Zi(ac,r)),e.emoji=r=>e.check(ki(qa,r)),e.guid=r=>e.check(rn(hn,r)),e.uuid=r=>e.check(_i(Et,r)),e.uuidv4=r=>e.check(yi(Et,r)),e.uuidv6=r=>e.check(vi(Et,r)),e.uuidv7=r=>e.check(wi(Et,r)),e.nanoid=r=>e.check(Ei(Ha,r)),e.guid=r=>e.check(rn(hn,r)),e.cuid=r=>e.check(Si(Ka,r)),e.cuid2=r=>e.check(zi(Ga,r)),e.ulid=r=>e.check(Oi(Ya,r)),e.base64=r=>e.check(Ti(oc,r)),e.base64url=r=>e.check(Ci(sc,r)),e.xid=r=>e.check(xi(Xa,r)),e.ksuid=r=>e.check(Fi(Qa,r)),e.ipv4=r=>e.check(ji(ec,r)),e.ipv6=r=>e.check(Pi(tc,r)),e.cidrv4=r=>e.check($i(rc,r)),e.cidrv6=r=>e.check(Ai(nc,r)),e.e164=r=>e.check(Di(ic,r)),e.datetime=r=>e.check(Oa(r)),e.date=r=>e.check(Fa(r)),e.time=r=>e.check(Pa(r)),e.duration=r=>e.check(Aa(r))});function Wt(e){return gi(Ja,e)}const H=g("ZodStringFormat",(e,t)=>{J.init(e,t),fn.init(e,t)}),dn=g("ZodEmail",(e,t)=>{xs.init(e,t),H.init(e,t)});function mn(e){return tn(dn,e)}const hn=g("ZodGUID",(e,t)=>{zs.init(e,t),H.init(e,t)}),Et=g("ZodUUID",(e,t)=>{Os.init(e,t),H.init(e,t)}),Wa=g("ZodURL",(e,t)=>{Fs.init(e,t),H.init(e,t)}),qa=g("ZodEmoji",(e,t)=>{js.init(e,t),H.init(e,t)}),Ha=g("ZodNanoID",(e,t)=>{Ps.init(e,t),H.init(e,t)}),Ka=g("ZodCUID",(e,t)=>{$s.init(e,t),H.init(e,t)}),Ga=g("ZodCUID2",(e,t)=>{As.init(e,t),H.init(e,t)}),Ya=g("ZodULID",(e,t)=>{Ts.init(e,t),H.init(e,t)}),Xa=g("ZodXID",(e,t)=>{Cs.init(e,t),H.init(e,t)}),Qa=g("ZodKSUID",(e,t)=>{Ds.init(e,t),H.init(e,t)}),ec=g("ZodIPv4",(e,t)=>{Rs.init(e,t),H.init(e,t)}),tc=g("ZodIPv6",(e,t)=>{Vs.init(e,t),H.init(e,t)}),rc=g("ZodCIDRv4",(e,t)=>{Us.init(e,t),H.init(e,t)}),nc=g("ZodCIDRv6",(e,t)=>{Ms.init(e,t),H.init(e,t)}),oc=g("ZodBase64",(e,t)=>{Bs.init(e,t),H.init(e,t)}),sc=g("ZodBase64URL",(e,t)=>{Ws.init(e,t),H.init(e,t)}),ic=g("ZodE164",(e,t)=>{qs.init(e,t),H.init(e,t)}),ac=g("ZodJWT",(e,t)=>{Ks.init(e,t),H.init(e,t)}),cc=g("ZodUnknown",(e,t)=>{Gs.init(e,t),oe.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ca()});function pn(){return Vi(cc)}const uc=g("ZodNever",(e,t)=>{Ys.init(e,t),oe.init(e,t),e._zod.processJSONSchema=(r,n,o)=>aa(e,r,n)});function lc(e){return Ui(uc,e)}const fc=g("ZodArray",(e,t)=>{Xs.init(e,t),oe.init(e,t),e._zod.processJSONSchema=(r,n,o)=>da(e,r,n,o),e.element=t.element,e.min=(r,n)=>e.check(bt(r,n)),e.nonempty=r=>e.check(bt(1,r)),e.max=(r,n)=>e.check(nn(r,n)),e.length=(r,n)=>e.check(on(r,n)),e.unwrap=()=>e.element});function dc(e,t){return ea(fc,e,t)}const mc=g("ZodObject",(e,t)=>{ei.init(e,t),oe.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ma(e,r,n,o),N(e,"shape",()=>t.shape),e.keyof=()=>yc(Object.keys(e._zod.def.shape)),e.catchall=r=>e.clone({...e._zod.def,catchall:r}),e.passthrough=()=>e.clone({...e._zod.def,catchall:pn()}),e.loose=()=>e.clone({...e._zod.def,catchall:pn()}),e.strict=()=>e.clone({...e._zod.def,catchall:lc()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=r=>zo(e,r),e.safeExtend=r=>Oo(e,r),e.merge=r=>xo(e,r),e.pick=r=>Eo(e,r),e.omit=r=>So(e,r),e.partial=(...r)=>Fo(gn,e,r[0]),e.required=(...r)=>jo(vn,e,r[0])});function qt(e,t){const r={type:"object",shape:e??{},...F(t)};return new mc(r)}const hc=g("ZodUnion",(e,t)=>{ti.init(e,t),oe.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ha(e,r,n,o),e.options=t.options});function pc(e,t){return new hc({type:"union",options:e,...F(t)})}const gc=g("ZodIntersection",(e,t)=>{ri.init(e,t),oe.init(e,t),e._zod.processJSONSchema=(r,n,o)=>pa(e,r,n,o)});function _c(e,t){return new gc({type:"intersection",left:e,right:t})}const Ht=g("ZodEnum",(e,t)=>{ni.init(e,t),oe.init(e,t),e._zod.processJSONSchema=(n,o,i)=>ua(e,n,o),e.enum=t.entries,e.options=Object.values(t.entries);const r=new Set(Object.keys(t.entries));e.extract=(n,o)=>{const i={};for(const s of n)if(r.has(s))i[s]=t.entries[s];else throw new Error(`Key ${s} not found in enum`);return new Ht({...t,checks:[],...F(o),entries:i})},e.exclude=(n,o)=>{const i={...t.entries};for(const s of n)if(r.has(s))delete i[s];else throw new Error(`Key ${s} not found in enum`);return new Ht({...t,checks:[],...F(o),entries:i})}});function yc(e,t){const r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new Ht({type:"enum",entries:r,...F(t)})}const vc=g("ZodTransform",(e,t)=>{oi.init(e,t),oe.init(e,t),e._zod.processJSONSchema=(r,n,o)=>fa(e,r),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new jr(e.constructor.name);r.addIssue=i=>{if(typeof i=="string")r.issues.push(nt(i,r.value,t));else{const s=i;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=r.value),s.inst??(s.inst=e),r.issues.push(nt(s))}};const o=t.transform(r.value,r);return o instanceof Promise?o.then(i=>(r.value=i,r)):(r.value=o,r)}});function wc(e){return new vc({type:"transform",transform:e})}const gn=g("ZodOptional",(e,t)=>{Kr.init(e,t),oe.init(e,t),e._zod.processJSONSchema=(r,n,o)=>un(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function _n(e){return new gn({type:"optional",innerType:e})}const bc=g("ZodExactOptional",(e,t)=>{si.init(e,t),oe.init(e,t),e._zod.processJSONSchema=(r,n,o)=>un(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function kc(e){return new bc({type:"optional",innerType:e})}const Ec=g("ZodNullable",(e,t)=>{ii.init(e,t),oe.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ga(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function yn(e){return new Ec({type:"nullable",innerType:e})}const Sc=g("ZodDefault",(e,t)=>{ai.init(e,t),oe.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ya(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function zc(e,t){return new Sc({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():Dr(t)}})}const Oc=g("ZodPrefault",(e,t)=>{ci.init(e,t),oe.init(e,t),e._zod.processJSONSchema=(r,n,o)=>va(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function xc(e,t){return new Oc({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():Dr(t)}})}const vn=g("ZodNonOptional",(e,t)=>{ui.init(e,t),oe.init(e,t),e._zod.processJSONSchema=(r,n,o)=>_a(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Fc(e,t){return new vn({type:"nonoptional",innerType:e,...F(t)})}const jc=g("ZodCatch",(e,t)=>{li.init(e,t),oe.init(e,t),e._zod.processJSONSchema=(r,n,o)=>wa(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Pc(e,t){return new jc({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const $c=g("ZodPipe",(e,t)=>{fi.init(e,t),oe.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ba(e,r,n,o),e.in=t.in,e.out=t.out});function wn(e,t){return new $c({type:"pipe",in:e,out:t})}const Ac=g("ZodReadonly",(e,t)=>{di.init(e,t),oe.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ka(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Tc(e){return new Ac({type:"readonly",innerType:e})}const Cc=g("ZodCustom",(e,t)=>{mi.init(e,t),oe.init(e,t),e._zod.processJSONSchema=(r,n,o)=>la(e,r)});function Dc(e,t={}){return ta(Cc,e,t)}function Zc(e){return ra(e)}const se={notificationsErrorsMap:{"User is not enabled":"auth.loginForm.errors.notifications.userIsNotEnabled","Email not verified":"auth.loginForm.errors.notifications.emailNotVerified","Email not found":"auth.loginForm.errors.notifications.emailNotFound","Invalid password":"auth.loginForm.errors.notifications.invalidPassword","Email is already used":"auth.signUpForm.errors.notifications.emailAlreadyExists","Wrong verification code":"auth.verifyEmailForm.errors.notifications.wrongAuthCode","Start reset password failed, email not found":"auth.startResetPasswordForm.errors.notifications.emailNotFound","Confirm reset password failed, wrong code":"auth.confirmResetPasswordForm.errors.notifications.wrongAuthCode"},fieldsErrorsMap:{"User is not enabled":"email","Email not verified":"email","Email not found":"email","Invalid password":"password","Email is already used":"email","Start reset password failed, email not found":"email"},ru:{confirmResetPasswordForm:{form:{title:"Подтверждение сброса пароля",description:"Введите код подтверждения, чтобы сбросить пароль.",passwordInputLabel:"Новый пароль",authCodeInputLabel:"Код подтверждения",submitButtonLabel:"Сбросить пароль",loginLinkMessage:"Вспомнили пароль?",loginLink:"Войти в систему"},success:{notifications:{confirmResetPasswordSuccess:"Пароль успешно сброшен"}},errors:{fields:{passwordToSmall:"Минимальная длина пароля - 8 символов"},notifications:{unknownError:"Не удалось сбросить пароль",unknownErrorDescription:"Пожалуйста, попробуйте еще раз или обратитесь в службу поддержки",wrongAuthCode:"Неверный код подтверждения"}}},startResetPasswordForm:{form:{title:"Сброс пароля",description:"Введите вашу почту, чтобы получить ссылку на сброс пароля.",emailLabel:"Электронная почта",submitButtonLabel:"Отправить ссылку на сброс пароля",loginLinkMessage:"Вспомнили пароль?",loginLink:"Войти в систему"},errors:{notifications:{unknownError:"Неизвестная ошибка",unknownErrorDescription:"Пожалуйста, попробуйте еще раз позже, либо обратитесь в службу поддержки",emailNotFound:"Пользователь с email {{email}} не найден"}},success:{notifications:{startResetPasswordSuccess:"Ссылка на сброс пароля отправлена на вашу почту"}}},verifyEmailForm:{form:{title:"Подтверждение почты",submitButtonLabel:"Подтвердить",codeLabel:"Код подтверждения",verifyEmailDescription:"Введите код подтверждения, отправленный на вашу почту.",loginLinkMessage:"Почта уже подтверждена?",loginLink:"Войти"},success:{notifications:{verifyEmailSuccess:"Почта успешно подтверждена"}},errors:{notifications:{wrongAuthCode:"Неверный код подтверждения",unknownError:"Неизвестная ошибка",unknownErrorDescription:"Пожалуйста, попробуйте еще раз, либо обратитесь в службу поддержки"}}},loginForm:{form:{title:"Вход",description:"Введите данные для входа",emailLabel:"Email",passwordLabel:"Пароль",forgotPasswordMessage:"Забыли пароль?",submitButtonLabel:"Войти",dontHaveAccountMessage:"Нет аккаунта?",dontHaveAccountLink:"Зарегистрироваться"},errors:{notifications:{emailNotFound:"Пользователь с email {{email}} не найден",userIsNotEnabled:"Пользователь не активирован",emailNotVerified:"Почта не подтверждена",invalidPassword:"Неверный пароль",unknownError:"Не удалось войти в систему",unknownErrorDescription:"Попробуйте войти позже, либо обратитесь в службу поддержки"}},success:{notifications:{loginSuccess:"Вы успешно вошли в систему"}}},signUpForm:{form:{title:"Регистрация",description:"Введите данные для регистрации",emailLabel:"Email",passwordLabel:"Пароль",submitButtonLabel:"Зарегистрироваться",forgotPasswordMessage:"Забыли пароль?",loginLinkMessage:"Уже есть аккаунт?",loginLink:"Войти"},errors:{notifications:{unknownError:"Ошибка регистрации",unknownErrorDescription:"Пожалуйста, попробуйте еще раз или обратитесь к администратору",emailAlreadyExists:"Пользователь с email {{email}} уже существует"},fields:{passwordToSmall:"Минимальная длина пароля - 8 символов"}},success:{notifications:{signUpSuccess:"Вы успешно зарегистрированы"}}}},en:{confirmResetPasswordForm:{form:{title:"Confirm password reset",description:"Enter your new password to confirm the reset.",submitButtonLabel:"Confirm reset",passwordInputLabel:"New password",authCodeInputLabel:"Auth code",confirmPasswordLabel:"Confirm new password",loginLinkMessage:"Already have an account?",loginLink:"Login"},success:{notifications:{confirmResetPasswordSuccess:"Password reset confirmed"}},errors:{fields:{passwordToSmall:"Minimum password length is 8 characters"},notifications:{wrongAuthCode:"Wrong auth code",unknownError:"Unknown error",unknownErrorDescription:"Please try again or contact support"}}},startResetPasswordForm:{form:{title:"Start password reset",description:"Enter your email to receive a password reset link.",submitButtonLabel:"Send reset link",emailLabel:"Email",resetPasswordDescription:"Enter your email to receive a password reset link.",loginLinkMessage:"Already have an account?",loginLink:"Login"},success:{notifications:{startResetPasswordSuccess:"Reset link sent successfully"}},errors:{notifications:{emailNotFound:"User with email {{email}} not found",unknownError:"Unknown error",unknownErrorDescription:"Please try again or contact support"}}},verifyEmailForm:{form:{title:"Verify email",submitButtonLabel:"Verify",codeLabel:"Verification code",verifyEmailDescription:"Enter the verification code sent to your email.",loginLinkMessage:"Email already verified?",loginLink:"Login"},success:{notifications:{verifyEmailSuccess:"Email successfully verified"}},errors:{notifications:{wrongAuthCode:"Wrong verification code",unknownError:"Unknown error",unknownErrorDescription:"Please try again or contact support"}}},loginForm:{form:{title:"Login",description:"Enter your login details",emailLabel:"Email",passwordLabel:"Password",forgotPasswordMessage:"Forgot password?",submitButtonLabel:"Login",dontHaveAccountMessage:"Don't have an account?",dontHaveAccountLink:"Register"},errors:{notifications:{emailNotFound:"User with email {{email}} not found",userIsNotEnabled:"User is not enabled",emailNotVerified:"Email not verified",invalidPassword:"Invalid password",unknownError:"Unknown error",unknownErrorDescription:"Please try again or contact support"}},success:{notifications:{loginSuccess:"You have successfully logged in"}}},signUpForm:{form:{title:"Registration",description:"Enter your registration details",emailLabel:"Email",passwordLabel:"Password",submitButtonLabel:"Register",forgotPasswordMessage:"Forgot password?",loginLinkMessage:"Already have an account?",loginLink:"Login"},errors:{notifications:{unknownError:"Signup failed",unknownErrorDescription:"Please try again or contact the administrator",emailAlreadyExists:"User with email {{email}} already exists"}},success:{notifications:{signUpSuccess:"You have successfully registered"}}}}},Ic=({i18n:e,auth:t})=>{const r=P.useMemo(()=>qt({code:Wt(),password:Wt().min(8,{message:e.t("auth.confirmResetPasswordForm.errors.fields.passwordToSmall")})}),[]),n=tt({resolver:Jt(r),defaultValues:{code:"",password:""}}),o=ge.useNavigate();return{submit:P.useCallback(s=>{t.confirmResetPassword(s).then(()=>{p.toast.success(e.t("auth.confirmResetPasswordForm.success.notifications.confirmResetPasswordSuccess")),o({to:"/"})}).catch(a=>{if(a.status===400){const l=a.response.data.detail;if(se.fieldsErrorsMap[l]&&n.setError(se.fieldsErrorsMap[l],{}),se.notificationsErrorsMap[l]){const d=se.notificationsErrorsMap[l];p.toast.error(e.t(d,s));return}p.toast.error(e.t("auth.confirmResetPasswordForm.errors.notifications.unknownError"),{description:e.t("auth.confirmResetPasswordForm.errors.notifications.unknownErrorDescription")})}})},[]),form:n}},Lc=({auth:e,i18n:t})=>{const r=ge.useNavigate(),n=tt({defaultValues:{email:"",password:""}}),o=P.useCallback(i=>e.login(i).then(()=>{r({to:"/"}),p.toast.success(t.t("auth.loginForm.success.notifications.loginSuccess"))}).catch(s=>{if(s.status===400&&(se.fieldsErrorsMap[s.response.data.detail]&&n.setError(se.fieldsErrorsMap[s.response.data.detail],{}),se.notificationsErrorsMap[s.response.data.detail])){p.toast.error(t.t(se.notificationsErrorsMap[s.response.data.detail],i));return}p.toast.error(t.t("auth.loginForm.errors.notifications.unknownError"),{description:t.t("auth.loginForm.errors.notifications.unknownErrorDescription")})}),[e.login,t,n.setError,r]);return{form:n,submit:o}},Nc=({auth:e,i18n:t})=>{const r=P.useMemo(()=>qt({email:mn(),password:Wt().min(8,{message:t.t("auth.signUpForm.errors.fields.passwordToSmall")})}),[]),n=tt({resolver:Jt(r),defaultValues:{email:"",password:""}}),o=ge.useNavigate();return{submit:P.useCallback(s=>{e.signup(s).then(()=>{o({to:"/auth/verify-email"}).then(()=>{p.toast.success(t.t("auth.signUpForm.success.notifications.signUpSuccess"))})}).catch(a=>{if(a.status===400){se.fieldsErrorsMap[a.response.data.detail]&&n.setError(se.fieldsErrorsMap[a.response.data.detail],{});const l=a.response.data.detail;if(se.notificationsErrorsMap[l]){const d=se.notificationsErrorsMap[l];p.toast.error(t.t(d,s))}return}p.toast.error(t.t("auth.signUpForm.errors.notifications.unknownError"),{description:t.t("auth.signUpForm.errors.notifications.unknownErrorDescription")})})},[n.setError,o]),form:n}},Rc=({i18n:e,auth:t})=>{const r=ge.useNavigate(),n=P.useMemo(()=>qt({email:mn()}),[]),o=tt({resolver:Jt(n),defaultValues:{email:""}}),i=P.useCallback(s=>{t.startResetPassword(s).then(()=>{p.toast.success(e.t("auth.startResetPasswordForm.success.notifications.startResetPasswordSuccess")),r({to:"/auth/confirm-reset-password"})}).catch(a=>{if(a.status===400&&(se.fieldsErrorsMap[a.response.data.detail]&&o.setError(se.fieldsErrorsMap[a.response.data.detail],{}),se.notificationsErrorsMap[a.response.data.detail])){p.toast.error(e.t(se.notificationsErrorsMap[a.response.data.detail],s));return}p.toast.error(e.t("auth.startResetPasswordForm.errors.notifications.unknownError"),{description:e.t("auth.startResetPasswordForm.errors.notifications.unknownErrorDescription")})})},[]);return{form:o,submit:i}},Vc=({auth:e,i18n:t})=>{const r=tt({defaultValues:{code:""}}),n=ge.useNavigate();return{submit:P.useCallback(i=>{e.verifyEmail(i).then(()=>{n({to:"/"}).then(()=>{p.toast.success(t.t("auth.verifyEmailForm.success.notifications.verifyEmailSuccess"))})}).catch(s=>{if(s.status===400){const a=s.response.data.detail,l=se.notificationsErrorsMap[a];if(l){p.toast.error(t.t(l));return}}p.toast.error(t.t("auth.verifyEmailForm.errors.notifications.unknownError"),{description:t.t("auth.verifyEmailForm.errors.notifications.unknownErrorDescription")})})},[]),form:r}},bn=P.createContext({});var St={exports:{}},Kt={},zt={exports:{}},Gt={};var kn;function Uc(){if(kn)return Gt;kn=1;var e=P;function t(y,v){return y===v&&(y!==0||1/y===1/v)||y!==y&&v!==v}var r=typeof Object.is=="function"?Object.is:t,n=e.useState,o=e.useEffect,i=e.useLayoutEffect,s=e.useDebugValue;function a(y,v){var h=v(),O=n({inst:{value:h,getSnapshot:v}}),S=O[0].inst,T=O[1];return i(function(){S.value=h,S.getSnapshot=v,l(S)&&T({inst:S})},[y,h,v]),o(function(){return l(S)&&T({inst:S}),y(function(){l(S)&&T({inst:S})})},[y]),s(h),h}function l(y){var v=y.getSnapshot;y=y.value;try{var h=v();return!r(y,h)}catch{return!0}}function d(y,v){return v()}var w=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?d:a;return Gt.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:w,Gt}var Yt={};var En;function Mc(){return En||(En=1,process.env.NODE_ENV!=="production"&&(function(){function e(h,O){return h===O&&(h!==0||1/h===1/O)||h!==h&&O!==O}function t(h,O){w||o.startTransition===void 0||(w=!0,console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var S=O();if(!y){var T=O();i(S,T)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),y=!0)}T=s({inst:{value:S,getSnapshot:O}});var L=T[0].inst,j=T[1];return l(function(){L.value=S,L.getSnapshot=O,r(L)&&j({inst:L})},[h,S,O]),a(function(){return r(L)&&j({inst:L}),h(function(){r(L)&&j({inst:L})})},[h]),d(S),S}function r(h){var O=h.getSnapshot;h=h.value;try{var S=O();return!i(h,S)}catch{return!0}}function n(h,O){return O()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var o=P,i=typeof Object.is=="function"?Object.is:e,s=o.useState,a=o.useEffect,l=o.useLayoutEffect,d=o.useDebugValue,w=!1,y=!1,v=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?n:t;Yt.useSyncExternalStore=o.useSyncExternalStore!==void 0?o.useSyncExternalStore:v,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),Yt}var Sn;function zn(){return Sn||(Sn=1,process.env.NODE_ENV==="production"?zt.exports=Uc():zt.exports=Mc()),zt.exports}var On;function Bc(){if(On)return Kt;On=1;var e=P,t=zn();function r(d,w){return d===w&&(d!==0||1/d===1/w)||d!==d&&w!==w}var n=typeof Object.is=="function"?Object.is:r,o=t.useSyncExternalStore,i=e.useRef,s=e.useEffect,a=e.useMemo,l=e.useDebugValue;return Kt.useSyncExternalStoreWithSelector=function(d,w,y,v,h){var O=i(null);if(O.current===null){var S={hasValue:!1,value:null};O.current=S}else S=O.current;O=a(function(){function L(M){if(!j){if(j=!0,I=M,M=v(M),h!==void 0&&S.hasValue){var K=S.value;if(h(K,M))return D=K}return D=M}if(K=D,n(I,M))return K;var fe=v(M);return h!==void 0&&h(K,fe)?(I=M,K):(I=M,D=fe)}var j=!1,I,D,C=y===void 0?null:y;return[function(){return L(w())},C===null?void 0:function(){return L(C())}]},[w,y,v,h]);var T=o(d,O[0],O[1]);return s(function(){S.hasValue=!0,S.value=T},[T]),l(T),T},Kt}var Xt={};var xn;function Jc(){return xn||(xn=1,process.env.NODE_ENV!=="production"&&(function(){function e(d,w){return d===w&&(d!==0||1/d===1/w)||d!==d&&w!==w}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=P,r=zn(),n=typeof Object.is=="function"?Object.is:e,o=r.useSyncExternalStore,i=t.useRef,s=t.useEffect,a=t.useMemo,l=t.useDebugValue;Xt.useSyncExternalStoreWithSelector=function(d,w,y,v,h){var O=i(null);if(O.current===null){var S={hasValue:!1,value:null};O.current=S}else S=O.current;O=a(function(){function L(M){if(!j){if(j=!0,I=M,M=v(M),h!==void 0&&S.hasValue){var K=S.value;if(h(K,M))return D=K}return D=M}if(K=D,n(I,M))return K;var fe=v(M);return h!==void 0&&h(K,fe)?(I=M,K):(I=M,D=fe)}var j=!1,I,D,C=y===void 0?null:y;return[function(){return L(w())},C===null?void 0:function(){return L(C())}]},[w,y,v,h]);var T=o(d,O[0],O[1]);return s(function(){S.hasValue=!0,S.value=T},[T]),l(T),T},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),Xt}var Fn;function Wc(){return Fn||(Fn=1,process.env.NODE_ENV==="production"?St.exports=Bc():St.exports=Jc()),St.exports}var qc=Wc();function Hc(e,t=n=>n,r={}){const n=r.equal??Kc;return qc.useSyncExternalStoreWithSelector(e.subscribe,()=>e.state,()=>e.state,t,n)}function Kc(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[n,o]of e)if(!t.has(n)||!Object.is(o,t.get(n)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();const r=jn(e);if(r.length!==jn(t).length)return!1;for(let n=0;n<r.length;n++)if(!Object.prototype.hasOwnProperty.call(t,r[n])||!Object.is(e[r[n]],t[r[n]]))return!1;return!0}function jn(e){return Object.keys(e).concat(Object.getOwnPropertySymbols(e))}const Gc=({auth:e,children:t})=>{const r=ge.useNavigate(),{isLoaded:n,isAuthenticated:o}=Hc(e.accountStore,a=>a),[i,s]=P.useState(0);return P.useEffect(()=>{const a=setInterval(()=>{s(l=>l===100?(clearInterval(a),l):l+1)},100);return()=>clearInterval(a)},[]),P.useEffect(()=>{e.initAuthData(),e.load().then(()=>{s(100)})},[e]),P.useEffect(()=>{n&&!o&&r({to:"/auth/login"})},[n,o,r]),n&&o?f.jsx(bn,{value:{auth:e},children:t}):i>5?f.jsx("div",{className:"flex items-center justify-center h-screen",children:f.jsxs("div",{className:"p-4 rounded w-1/2",children:[f.jsx("h2",{className:"text-center",children:"account loading..."}),f.jsx(p.Progress,{value:i})]})}):null};U.Auth=qn,U.AuthContext=bn,U.AuthContextProvider=Gc,U.ConfirmResetPasswordForm=Vn,U.DevPanel=Rn,U.LoginForm=Un,U.SignUpForm=Mn,U.StartResetPasswordForm=Bn,U.VerifyEmailForm=Jn,U.authE2EConfig=ae,U.isAdmin=Wn,U.locale=se,U.useConfirmResetPasswordForm=Ic,U.useLoginForm=Lc,U.useSignUpForm=Nc,U.useStartResetPasswordForm=Rc,U.useVerifyEmailForm=Vc,Object.defineProperty(U,Symbol.toStringTag,{value:"Module"})}));