formaze 1.0.6 → 1.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.
package/README.md CHANGED
@@ -9,6 +9,7 @@ Formaze is a flexible and customizable form validation package for react built w
9
9
  ## Installation
10
10
 
11
11
  You can install the package via npm.
12
+ **Added latest guides, (the [Changes](#changes)), you can use latest version, if you have any issue with previous versions**
12
13
 
13
14
  ```bash
14
15
  npm install formaze
@@ -22,34 +23,38 @@ npm install formaze
22
23
  // "use client"
23
24
  import { z } from "zod";
24
25
  import { useFormSchema, createFormValidator } from "formaze";
25
- /* for pre-styled css (check the styling guide below) */
26
+ /* pre-styled css (you can check the styling guide below) */
26
27
  import "formaze/dist/style.css";
27
28
 
28
29
  // create the validation schema
29
30
  const formSchema = useFormSchema({
30
- email: {
31
- type: "email",
32
- },
33
- password: {
34
- type: "password",
35
- minLength: {
36
- value: 8, // by default 6
37
- },
38
- },
31
+ email: { type: "email" },
32
+ password: { type: "password", minLength: { value: 8 } },
39
33
  });
40
34
 
41
35
  // create the form
42
- const Form = createFormValidator<typeof formSchema>();
36
+ const Form = createFormValidator(formSchema);
43
37
 
44
- export function RegistrationForm() {
38
+ export function MyForm() {
39
+ // for TypeScript
45
40
  function handleSubmit(data: z.infer<typeof formSchema>) {
46
- const result = formSchema.safeParse(data);
41
+ const result = formSchema.safeParse(data);
47
42
 
48
43
  if (!result.success) throw new Error("Invalid inputs");
49
44
 
50
45
  console.log(data);
51
46
  }
52
47
 
48
+ // for JavaScript
49
+ // /**@param {import("zod").infer<typeof formSchema>} data */
50
+ // function handleSubmit(data) {
51
+ // const result = formSchema.safeParse(data);
52
+
53
+ // if (!result.success) throw new Error("Invalid inputs");
54
+
55
+ // console.log(data);
56
+ // }
57
+
53
58
  return (
54
59
  <Form schema={formSchema} onSubmit={handleSubmit}>
55
60
  <Form.Input
@@ -87,10 +92,10 @@ email: {
87
92
  },
88
93
  password: {
89
94
  type: "password",
90
- minLength: {
91
- value: 8,
95
+ minLength: {
96
+ value: 8,
92
97
  message: "Password must be at least 8 characters",
93
- },
98
+ },
94
99
  maxLength: {
95
100
  value: 16,
96
101
  message: "Password must be less than 16 characters",
@@ -117,8 +122,8 @@ Though, you can directly use `zod` to define schema as well and pass it to the F
117
122
  import { z } from "zod";
118
123
 
119
124
  const formSchema = z.object({
120
- email: z.string().email(),
121
- name: z.string().min(3, { message: "Required" }),
125
+ email: z.string().email(),
126
+ name: z.string().min(3, { message: "Required" }),
122
127
  });
123
128
  ```
124
129
 
@@ -199,9 +204,15 @@ You just have to add `"use client"` directive at the top of your file where you
199
204
 
200
205
  ### `createFormValidator`
201
206
 
202
- The createFormValidator function returns a Form component with built-in form validation using Zod and React Hook Form. It simplifies the creation of forms that adhere to a Zod schema for type-safe validation.
207
+ The createFormValidator function accepts an argument which is a type of zod schema and returns a Form component with built-in form validation using Zod and React Hook Form. It simplifies the creation of forms that adhere to a Zod schema for type-safe validation.
208
+
209
+ #### Argument
210
+
211
+ **formSchema: `T`**
203
212
 
204
- **Returned Form Component Props**:
213
+ - Type: `T` (A Zod schema generated through useFormSchema or directly from Zod)
214
+
215
+ **Props of the Returned Form Component**:
205
216
 
206
217
  **schema: `T`**
207
218
 
@@ -218,7 +229,7 @@ const schema = useFormSchema({
218
229
  password: { type: "string", minLength: { value: 8 } },
219
230
  });
220
231
 
221
- const Form = createFormValidator<typeof schema>();
232
+ const Form = createFormValidator(schema);
222
233
 
223
234
  <Form schema={schema} onSubmit={handleSubmit} />;
224
235
  ```
@@ -295,14 +306,17 @@ The Form.Input component is a form input field that is connected to a Zod-based
295
306
 
296
307
  **Props:**
297
308
 
298
- - name: `keyof z.infer<T>`
299
- The name of the form field, which should correspond to one of the keys in the Zod schema used in the form. This connects the input to the form's validation logic.
309
+ - name: `keyof z.infer<T>`
310
+ - Description:
311
+ The name of the form field, which should correspond to one of the keys in the Zod schema used in the form. This connects the input to the form's validation logic.
300
312
 
301
- - label: `string` (optional)
302
- A label for the form field. This is used for displaying a descriptive text for the input field.
313
+ - label: `string` (optional)
314
+ - Description:
315
+ A label for the form field. This is used for displaying a descriptive text for the input field.
303
316
 
304
- - ...props: `React.HTMLAttributes<HTMLInputElement>`
305
- Any additional props that can be passed to an HTML input element. These props allow you to customize the input field, such as adding a placeholder, className, type, etc.
317
+ - ...props: `React.HTMLAttributes<HTMLInputElement>`
318
+ - Description:
319
+ Any additional props that can be passed to an HTML input element. These props allow you to customize the input field, such as adding a placeholder, className, type, etc.
306
320
 
307
321
  ### `useFormSchema`
308
322
 
@@ -323,15 +337,30 @@ useFormSchema is a utility function that generates a Zod schema based on the pro
323
337
  const schema = useFormSchema({
324
338
  email: { type: "email" },
325
339
  password: {
326
- type: "string",
327
- minLength: {
328
- value: 8,
329
- message: "Password must be at least 8 characters long",
330
- },
340
+ type: "string",
341
+ minLength: {
342
+ value: 8,
343
+ message: "Password must be at least 8 characters long",
344
+ },
331
345
  },
332
346
  });
333
347
  ```
334
348
 
335
349
  This schema can then be passed to the Form component returned by `createFormValidator`.
336
350
 
351
+ ## Changes
352
+
353
+ The `createFormValidator` has been changed to accept an argument which is a type of zod schema generated through useFormSchema or directly from Zod and the rest of the logic will be the same as before.
354
+
355
+ In order to give proper type support for JavaScript project and to simplify the defining process this change has been made.
356
+
357
+ **From this**
358
+ ```tsx
359
+ const Form = createFormValidator<typeof formSchema>(); ❌
360
+ ```
361
+ **To this**
362
+ ```tsx
363
+ const Form = createFormValidator(formSchema); ✔
364
+ ```
365
+
337
366
  ## (That's it!)
package/dist/formaze.js CHANGED
@@ -3256,46 +3256,48 @@ function Ot(...t) {
3256
3256
  function Ae(t) {
3257
3257
  return t[0].toUpperCase() + t.slice(1);
3258
3258
  }
3259
- const Sa = () => {
3260
- const t = ({
3261
- schema: e,
3262
- onSubmit: r,
3263
- defaultValues: s,
3264
- children: a,
3265
- className: n
3259
+ const Sa = (t) => {
3260
+ const e = ({
3261
+ schema: r,
3262
+ onSubmit: s,
3263
+ defaultValues: a,
3264
+ children: n,
3265
+ className: i,
3266
+ ...o
3266
3267
  }) => {
3267
- const i = Rs({
3268
- resolver: js(e),
3269
- defaultValues: s,
3268
+ const u = Rs({
3269
+ resolver: js(r),
3270
+ defaultValues: a,
3270
3271
  mode: "onSubmit"
3271
3272
  });
3272
- return /* @__PURE__ */ $.createElement(gs, { ...i }, /* @__PURE__ */ $.createElement(
3273
+ return /* @__PURE__ */ $.createElement(gs, { ...u }, /* @__PURE__ */ $.createElement(
3273
3274
  "form",
3274
3275
  {
3275
- onSubmit: i.handleSubmit(r),
3276
+ onSubmit: u.handleSubmit(s),
3276
3277
  className: Ot(
3277
3278
  "p-4 flex flex-col justify-center space-y-2 form-control",
3278
- n
3279
- )
3279
+ i
3280
+ ),
3281
+ ...o
3280
3282
  },
3281
- a
3283
+ n
3282
3284
  ));
3283
3285
  };
3284
- return t.Input = ({ name: e, label: r, className: s, ...a }) => {
3285
- const { register: n } = Zr();
3286
- return /* @__PURE__ */ $.createElement(vn, { name: e }, /* @__PURE__ */ $.createElement(yn, { htmlFor: e }, r), /* @__PURE__ */ $.createElement(
3286
+ return e.Input = ({ name: r, label: s, className: a, ...n }) => {
3287
+ const { register: i } = Zr();
3288
+ return /* @__PURE__ */ $.createElement(vn, { name: r }, /* @__PURE__ */ $.createElement(yn, { htmlFor: r }, s), /* @__PURE__ */ $.createElement(
3287
3289
  "input",
3288
3290
  {
3289
- id: e,
3290
- ...n(e),
3291
+ id: r,
3292
+ ...i(r),
3291
3293
  className: Ot(
3292
3294
  "mt-1 block w-full border border-gray-300 rounded-lg px-4 py-2 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent transition duration-200 form-input form-input-field",
3293
- s
3295
+ a
3294
3296
  ),
3295
- ...a
3297
+ ...n
3296
3298
  }
3297
3299
  ));
3298
- }, t;
3300
+ }, e;
3299
3301
  }, yn = $.forwardRef(({ children: t, htmlFor: e, className: r }, s) => /* @__PURE__ */ $.createElement(
3300
3302
  "label",
3301
3303
  {
@@ -1 +1 @@
1
- (function(Oe,M){typeof exports=="object"&&typeof module<"u"?M(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],M):(Oe=typeof globalThis<"u"?globalThis:Oe||self,M(Oe.Formaze={},Oe.React))})(this,function(Oe,M){"use strict";var st=t=>t.type==="checkbox",Ge=t=>t instanceof Date,se=t=>t==null;const lr=t=>typeof t=="object";var G=t=>!se(t)&&!Array.isArray(t)&&lr(t)&&!Ge(t),is=t=>G(t)&&t.target?st(t.target)?t.target.checked:t.target.value:t,os=t=>t.substring(0,t.search(/\.\d+(\.|$)/))||t,ls=(t,e)=>t.has(os(e)),cs=t=>{const e=t.constructor&&t.constructor.prototype;return G(e)&&e.hasOwnProperty("isPrototypeOf")},zt=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function ce(t){let e;const r=Array.isArray(t);if(t instanceof Date)e=new Date(t);else if(t instanceof Set)e=new Set(t);else if(!(zt&&(t instanceof Blob||t instanceof FileList))&&(r||G(t)))if(e=r?[]:{},!r&&!cs(t))e=t;else for(const s in t)t.hasOwnProperty(s)&&(e[s]=ce(t[s]));else return t;return e}var St=t=>Array.isArray(t)?t.filter(Boolean):[],W=t=>t===void 0,_=(t,e,r)=>{if(!e||!G(t))return r;const s=St(e.split(/[,[\].]+?/)).reduce((a,n)=>se(a)?a:a[n],t);return W(s)||s===t?W(t[e])?r:t[e]:s},ge=t=>typeof t=="boolean",Ut=t=>/^\w*$/.test(t),cr=t=>St(t.replace(/["|']|\]/g,"").split(/\.|\[/)),j=(t,e,r)=>{let s=-1;const a=Ut(e)?[e]:cr(e),n=a.length,i=n-1;for(;++s<n;){const o=a[s];let u=r;if(s!==i){const f=t[o];u=G(f)||Array.isArray(f)?f:isNaN(+a[s+1])?{}:[]}if(o==="__proto__")return;t[o]=u,t=t[o]}return t};const dr={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},ue={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},ke={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},ur=M.createContext(null),fr=()=>M.useContext(ur),ds=t=>{const{children:e,...r}=t;return M.createElement(ur.Provider,{value:r},e)};var us=(t,e,r,s=!0)=>{const a={defaultValues:e._defaultValues};for(const n in t)Object.defineProperty(a,n,{get:()=>{const i=n;return e._proxyFormState[i]!==ue.all&&(e._proxyFormState[i]=!s||ue.all),t[i]}});return a},oe=t=>G(t)&&!Object.keys(t).length,fs=(t,e,r,s)=>{r(t);const{name:a,...n}=t;return oe(n)||Object.keys(n).length>=Object.keys(e).length||Object.keys(n).find(i=>e[i]===ue.all)},Ct=t=>Array.isArray(t)?t:[t];function hs(t){const e=M.useRef(t);e.current=t,M.useEffect(()=>{const r=!t.disabled&&e.current.subject&&e.current.subject.subscribe({next:e.current.next});return()=>{r&&r.unsubscribe()}},[t.disabled])}var ye=t=>typeof t=="string",ps=(t,e,r,s,a)=>ye(t)?(s&&e.watch.add(t),_(r,t,a)):Array.isArray(t)?t.map(n=>(s&&e.watch.add(n),_(r,n))):(s&&(e.watchAll=!0),r),hr=(t,e,r,s,a)=>e?{...r[t],types:{...r[t]&&r[t].types?r[t].types:{},[s]:a||!0}}:{},pr=t=>({isOnSubmit:!t||t===ue.onSubmit,isOnBlur:t===ue.onBlur,isOnChange:t===ue.onChange,isOnAll:t===ue.all,isOnTouch:t===ue.onTouched}),mr=(t,e,r)=>!r&&(e.watchAll||e.watch.has(t)||[...e.watch].some(s=>t.startsWith(s)&&/^\.\w+/.test(t.slice(s.length))));const nt=(t,e,r,s)=>{for(const a of r||Object.keys(t)){const n=_(t,a);if(n){const{_f:i,...o}=n;if(i){if(i.refs&&i.refs[0]&&e(i.refs[0],a)&&!s)return!0;if(i.ref&&e(i.ref,i.name)&&!s)return!0;if(nt(o,e))break}else if(G(o)&&nt(o,e))break}}};var ms=(t,e,r)=>{const s=Ct(_(t,r));return j(s,"root",e[r]),j(t,r,s),t},Bt=t=>t.type==="file",Te=t=>typeof t=="function",Et=t=>{if(!zt)return!1;const e=t?t.ownerDocument:0;return t instanceof(e&&e.defaultView?e.defaultView.HTMLElement:HTMLElement)},At=t=>ye(t),Wt=t=>t.type==="radio",Nt=t=>t instanceof RegExp;const gr={value:!1,isValid:!1},yr={value:!0,isValid:!0};var vr=t=>{if(Array.isArray(t)){if(t.length>1){const e=t.filter(r=>r&&r.checked&&!r.disabled).map(r=>r.value);return{value:e,isValid:!!e.length}}return t[0].checked&&!t[0].disabled?t[0].attributes&&!W(t[0].attributes.value)?W(t[0].value)||t[0].value===""?yr:{value:t[0].value,isValid:!0}:yr:gr}return gr};const br={isValid:!1,value:null};var _r=t=>Array.isArray(t)?t.reduce((e,r)=>r&&r.checked&&!r.disabled?{isValid:!0,value:r.value}:e,br):br;function xr(t,e,r="validate"){if(At(t)||Array.isArray(t)&&t.every(At)||ge(t)&&!t)return{type:r,message:At(t)?t:"",ref:e}}var He=t=>G(t)&&!Nt(t)?t:{value:t,message:""},wr=async(t,e,r,s,a)=>{const{ref:n,refs:i,required:o,maxLength:u,minLength:f,min:p,max:x,pattern:Y,validate:B,name:P,valueAsNumber:q,mount:Z,disabled:L}=t._f,E=_(e,P);if(!Z||L)return{};const ae=i?i[0]:n,Q=w=>{s&&ae.reportValidity&&(ae.setCustomValidity(ge(w)?"":w||""),ae.reportValidity())},F={},Ne=Wt(n),We=st(n),xe=Ne||We,we=(q||Bt(n))&&W(n.value)&&W(E)||Et(n)&&n.value===""||E===""||Array.isArray(E)&&!E.length,te=hr.bind(null,P,r,F),Fe=(w,I,$,J=ke.maxLength,re=ke.minLength)=>{const ie=w?I:$;F[P]={type:w?J:re,message:ie,ref:n,...te(w?J:re,ie)}};if(a?!Array.isArray(E)||!E.length:o&&(!xe&&(we||se(E))||ge(E)&&!E||We&&!vr(i).isValid||Ne&&!_r(i).isValid)){const{value:w,message:I}=At(o)?{value:!!o,message:o}:He(o);if(w&&(F[P]={type:ke.required,message:I,ref:ae,...te(ke.required,I)},!r))return Q(I),F}if(!we&&(!se(p)||!se(x))){let w,I;const $=He(x),J=He(p);if(!se(E)&&!isNaN(E)){const re=n.valueAsNumber||E&&+E;se($.value)||(w=re>$.value),se(J.value)||(I=re<J.value)}else{const re=n.valueAsDate||new Date(E),ie=$e=>new Date(new Date().toDateString()+" "+$e),Ve=n.type=="time",me=n.type=="week";ye($.value)&&E&&(w=Ve?ie(E)>ie($.value):me?E>$.value:re>new Date($.value)),ye(J.value)&&E&&(I=Ve?ie(E)<ie(J.value):me?E<J.value:re<new Date(J.value))}if((w||I)&&(Fe(!!w,$.message,J.message,ke.max,ke.min),!r))return Q(F[P].message),F}if((u||f)&&!we&&(ye(E)||a&&Array.isArray(E))){const w=He(u),I=He(f),$=!se(w.value)&&E.length>+w.value,J=!se(I.value)&&E.length<+I.value;if(($||J)&&(Fe($,w.message,I.message),!r))return Q(F[P].message),F}if(Y&&!we&&ye(E)){const{value:w,message:I}=He(Y);if(Nt(w)&&!E.match(w)&&(F[P]={type:ke.pattern,message:I,ref:n,...te(ke.pattern,I)},!r))return Q(I),F}if(B){if(Te(B)){const w=await B(E,e),I=xr(w,ae);if(I&&(F[P]={...I,...te(ke.validate,I.message)},!r))return Q(I.message),F}else if(G(B)){let w={};for(const I in B){if(!oe(w)&&!r)break;const $=xr(await B[I](E,e),ae,I);$&&(w={...$,...te(I,$.message)},Q($.message),r&&(F[P]=w))}if(!oe(w)&&(F[P]={ref:ae,...w},!r))return F}}return Q(!0),F};function gs(t,e){const r=e.slice(0,-1).length;let s=0;for(;s<r;)t=W(t)?s++:t[e[s++]];return t}function ys(t){for(const e in t)if(t.hasOwnProperty(e)&&!W(t[e]))return!1;return!0}function H(t,e){const r=Array.isArray(e)?e:Ut(e)?[e]:cr(e),s=r.length===1?t:gs(t,r),a=r.length-1,n=r[a];return s&&delete s[n],a!==0&&(G(s)&&oe(s)||Array.isArray(s)&&ys(s))&&H(t,r.slice(0,-1)),t}var qt=()=>{let t=[];return{get observers(){return t},next:a=>{for(const n of t)n.next&&n.next(a)},subscribe:a=>(t.push(a),{unsubscribe:()=>{t=t.filter(n=>n!==a)}}),unsubscribe:()=>{t=[]}}},Vt=t=>se(t)||!lr(t);function Ie(t,e){if(Vt(t)||Vt(e))return t===e;if(Ge(t)&&Ge(e))return t.getTime()===e.getTime();const r=Object.keys(t),s=Object.keys(e);if(r.length!==s.length)return!1;for(const a of r){const n=t[a];if(!s.includes(a))return!1;if(a!=="ref"){const i=e[a];if(Ge(n)&&Ge(i)||G(n)&&G(i)||Array.isArray(n)&&Array.isArray(i)?!Ie(n,i):n!==i)return!1}}return!0}var kr=t=>t.type==="select-multiple",vs=t=>Wt(t)||st(t),Gt=t=>Et(t)&&t.isConnected,Tr=t=>{for(const e in t)if(Te(t[e]))return!0;return!1};function Ot(t,e={}){const r=Array.isArray(t);if(G(t)||r)for(const s in t)Array.isArray(t[s])||G(t[s])&&!Tr(t[s])?(e[s]=Array.isArray(t[s])?[]:{},Ot(t[s],e[s])):se(t[s])||(e[s]=!0);return e}function Sr(t,e,r){const s=Array.isArray(t);if(G(t)||s)for(const a in t)Array.isArray(t[a])||G(t[a])&&!Tr(t[a])?W(e)||Vt(r[a])?r[a]=Array.isArray(t[a])?Ot(t[a],[]):{...Ot(t[a])}:Sr(t[a],se(e)?{}:e[a],r[a]):r[a]=!Ie(t[a],e[a]);return r}var It=(t,e)=>Sr(t,e,Ot(e)),Cr=(t,{valueAsNumber:e,valueAsDate:r,setValueAs:s})=>W(t)?t:e?t===""?NaN:t&&+t:r&&ye(t)?new Date(t):s?s(t):t;function Ht(t){const e=t.ref;if(!(t.refs?t.refs.every(r=>r.disabled):e.disabled))return Bt(e)?e.files:Wt(e)?_r(t.refs).value:kr(e)?[...e.selectedOptions].map(({value:r})=>r):st(e)?vr(t.refs).value:Cr(W(e.value)?t.ref.value:e.value,t)}var bs=(t,e,r,s)=>{const a={};for(const n of t){const i=_(e,n);i&&j(a,n,i._f)}return{criteriaMode:r,names:[...t],fields:a,shouldUseNativeValidation:s}},at=t=>W(t)?t:Nt(t)?t.source:G(t)?Nt(t.value)?t.value.source:t.value:t;const Er="AsyncFunction";var _s=t=>(!t||!t.validate)&&!!(Te(t.validate)&&t.validate.constructor.name===Er||G(t.validate)&&Object.values(t.validate).find(e=>e.constructor.name===Er)),xs=t=>t.mount&&(t.required||t.min||t.max||t.maxLength||t.minLength||t.pattern||t.validate);function Ar(t,e,r){const s=_(t,r);if(s||Ut(r))return{error:s,name:r};const a=r.split(".");for(;a.length;){const n=a.join("."),i=_(e,n),o=_(t,n);if(i&&!Array.isArray(i)&&r!==n)return{name:r};if(o&&o.type)return{name:n,error:o};a.pop()}return{name:r}}var ws=(t,e,r,s,a)=>a.isOnAll?!1:!r&&a.isOnTouch?!(e||t):(r?s.isOnBlur:a.isOnBlur)?!t:(r?s.isOnChange:a.isOnChange)?t:!0,ks=(t,e)=>!St(_(t,e)).length&&H(t,e);const Ts={mode:ue.onSubmit,reValidateMode:ue.onChange,shouldFocusError:!0};function Ss(t={}){let e={...Ts,...t},r={submitCount:0,isDirty:!1,isLoading:Te(e.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1},s={},a=G(e.defaultValues)||G(e.values)?ce(e.defaultValues||e.values)||{}:{},n=e.shouldUnregister?{}:ce(a),i={action:!1,mount:!1,watch:!1},o={mount:new Set,unMount:new Set,array:new Set,watch:new Set},u,f=0;const p={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},x={values:qt(),array:qt(),state:qt()},Y=pr(e.mode),B=pr(e.reValidateMode),P=e.criteriaMode===ue.all,q=l=>c=>{clearTimeout(f),f=setTimeout(l,c)},Z=async l=>{if(p.isValid||l){const c=e.resolver?oe((await xe()).errors):await te(s,!0);c!==r.isValid&&x.state.next({isValid:c})}},L=(l,c)=>{(p.isValidating||p.validatingFields)&&((l||Array.from(o.mount)).forEach(d=>{d&&(c?j(r.validatingFields,d,c):H(r.validatingFields,d))}),x.state.next({validatingFields:r.validatingFields,isValidating:!oe(r.validatingFields)}))},E=(l,c=[],d,v,g=!0,m=!0)=>{if(v&&d){if(i.action=!0,m&&Array.isArray(_(s,l))){const T=d(_(s,l),v.argA,v.argB);g&&j(s,l,T)}if(m&&Array.isArray(_(r.errors,l))){const T=d(_(r.errors,l),v.argA,v.argB);g&&j(r.errors,l,T),ks(r.errors,l)}if(p.touchedFields&&m&&Array.isArray(_(r.touchedFields,l))){const T=d(_(r.touchedFields,l),v.argA,v.argB);g&&j(r.touchedFields,l,T)}p.dirtyFields&&(r.dirtyFields=It(a,n)),x.state.next({name:l,isDirty:w(l,c),dirtyFields:r.dirtyFields,errors:r.errors,isValid:r.isValid})}else j(n,l,c)},ae=(l,c)=>{j(r.errors,l,c),x.state.next({errors:r.errors})},Q=l=>{r.errors=l,x.state.next({errors:r.errors,isValid:!1})},F=(l,c,d,v)=>{const g=_(s,l);if(g){const m=_(n,l,W(d)?_(a,l):d);W(m)||v&&v.defaultChecked||c?j(n,l,c?m:Ht(g._f)):J(l,m),i.mount&&Z()}},Ne=(l,c,d,v,g)=>{let m=!1,T=!1;const R={name:l},X=!!(_(s,l)&&_(s,l)._f&&_(s,l)._f.disabled);if(!d||v){p.isDirty&&(T=r.isDirty,r.isDirty=R.isDirty=w(),m=T!==R.isDirty);const K=X||Ie(_(a,l),c);T=!!(!X&&_(r.dirtyFields,l)),K||X?H(r.dirtyFields,l):j(r.dirtyFields,l,!0),R.dirtyFields=r.dirtyFields,m=m||p.dirtyFields&&T!==!K}if(d){const K=_(r.touchedFields,l);K||(j(r.touchedFields,l,d),R.touchedFields=r.touchedFields,m=m||p.touchedFields&&K!==d)}return m&&g&&x.state.next(R),m?R:{}},We=(l,c,d,v)=>{const g=_(r.errors,l),m=p.isValid&&ge(c)&&r.isValid!==c;if(t.delayError&&d?(u=q(()=>ae(l,d)),u(t.delayError)):(clearTimeout(f),u=null,d?j(r.errors,l,d):H(r.errors,l)),(d?!Ie(g,d):g)||!oe(v)||m){const T={...v,...m&&ge(c)?{isValid:c}:{},errors:r.errors,name:l};r={...r,...T},x.state.next(T)}},xe=async l=>{L(l,!0);const c=await e.resolver(n,e.context,bs(l||o.mount,s,e.criteriaMode,e.shouldUseNativeValidation));return L(l),c},we=async l=>{const{errors:c}=await xe(l);if(l)for(const d of l){const v=_(c,d);v?j(r.errors,d,v):H(r.errors,d)}else r.errors=c;return c},te=async(l,c,d={valid:!0})=>{for(const v in l){const g=l[v];if(g){const{_f:m,...T}=g;if(m){const R=o.array.has(m.name),X=g._f&&_s(g._f);X&&p.validatingFields&&L([v],!0);const K=await wr(g,n,P,e.shouldUseNativeValidation&&!c,R);if(X&&p.validatingFields&&L([v]),K[m.name]&&(d.valid=!1,c))break;!c&&(_(K,m.name)?R?ms(r.errors,K,m.name):j(r.errors,m.name,K[m.name]):H(r.errors,m.name))}!oe(T)&&await te(T,c,d)}}return d.valid},Fe=()=>{for(const l of o.unMount){const c=_(s,l);c&&(c._f.refs?c._f.refs.every(d=>!Gt(d)):!Gt(c._f.ref))&&nr(l)}o.unMount=new Set},w=(l,c)=>(l&&c&&j(n,l,c),!Ie(de(),a)),I=(l,c,d)=>ps(l,o,{...i.mount?n:W(c)?a:ye(l)?{[l]:c}:c},d,c),$=l=>St(_(i.mount?n:a,l,t.shouldUnregister?_(a,l,[]):[])),J=(l,c,d={})=>{const v=_(s,l);let g=c;if(v){const m=v._f;m&&(!m.disabled&&j(n,l,Cr(c,m)),g=Et(m.ref)&&se(c)?"":c,kr(m.ref)?[...m.ref.options].forEach(T=>T.selected=g.includes(T.value)):m.refs?st(m.ref)?m.refs.length>1?m.refs.forEach(T=>(!T.defaultChecked||!T.disabled)&&(T.checked=Array.isArray(g)?!!g.find(R=>R===T.value):g===T.value)):m.refs[0]&&(m.refs[0].checked=!!g):m.refs.forEach(T=>T.checked=T.value===g):Bt(m.ref)?m.ref.value="":(m.ref.value=g,m.ref.type||x.values.next({name:l,values:{...n}})))}(d.shouldDirty||d.shouldTouch)&&Ne(l,g,d.shouldTouch,d.shouldDirty,!0),d.shouldValidate&&$e(l)},re=(l,c,d)=>{for(const v in c){const g=c[v],m=`${l}.${v}`,T=_(s,m);(o.array.has(l)||!Vt(g)||T&&!T._f)&&!Ge(g)?re(m,g,d):J(m,g,d)}},ie=(l,c,d={})=>{const v=_(s,l),g=o.array.has(l),m=ce(c);j(n,l,m),g?(x.array.next({name:l,values:{...n}}),(p.isDirty||p.dirtyFields)&&d.shouldDirty&&x.state.next({name:l,dirtyFields:It(a,n),isDirty:w(l,m)})):v&&!v._f&&!se(m)?re(l,m,d):J(l,m,d),mr(l,o)&&x.state.next({...r}),x.values.next({name:i.mount?l:void 0,values:{...n}})},Ve=async l=>{i.mount=!0;const c=l.target;let d=c.name,v=!0;const g=_(s,d),m=()=>c.type?Ht(g._f):is(l),T=R=>{v=Number.isNaN(R)||Ie(R,_(n,d,R))};if(g){let R,X;const K=m(),qe=l.type===dr.BLUR||l.type===dr.FOCUS_OUT,ma=!xs(g._f)&&!e.resolver&&!_(r.errors,d)&&!g._f.deps||ws(qe,_(r.touchedFields,d),r.isSubmitted,B,Y),ir=mr(d,o,qe);j(n,d,K),qe?(g._f.onBlur&&g._f.onBlur(l),u&&u(0)):g._f.onChange&&g._f.onChange(l);const or=Ne(d,K,qe,!1),ga=!oe(or)||ir;if(!qe&&x.values.next({name:d,type:l.type,values:{...n}}),ma)return p.isValid&&(t.mode==="onBlur"?qe&&Z():Z()),ga&&x.state.next({name:d,...ir?{}:or});if(!qe&&ir&&x.state.next({...r}),e.resolver){const{errors:ns}=await xe([d]);if(T(K),v){const ya=Ar(r.errors,s,d),as=Ar(ns,s,ya.name||d);R=as.error,d=as.name,X=oe(ns)}}else L([d],!0),R=(await wr(g,n,P,e.shouldUseNativeValidation))[d],L([d]),T(K),v&&(R?X=!1:p.isValid&&(X=await te(s,!0)));v&&(g._f.deps&&$e(g._f.deps),We(d,X,R,or))}},me=(l,c)=>{if(_(r.errors,c)&&l.focus)return l.focus(),1},$e=async(l,c={})=>{let d,v;const g=Ct(l);if(e.resolver){const m=await we(W(l)?l:g);d=oe(m),v=l?!g.some(T=>_(m,T)):d}else l?(v=(await Promise.all(g.map(async m=>{const T=_(s,m);return await te(T&&T._f?{[m]:T}:T)}))).every(Boolean),!(!v&&!r.isValid)&&Z()):v=d=await te(s);return x.state.next({...!ye(l)||p.isValid&&d!==r.isValid?{}:{name:l},...e.resolver||!l?{isValid:d}:{},errors:r.errors}),c.shouldFocus&&!v&&nt(s,me,l?g:o.mount),v},de=l=>{const c={...i.mount?n:a};return W(l)?c:ye(l)?_(c,l):l.map(d=>_(c,d))},Xr=(l,c)=>({invalid:!!_((c||r).errors,l),isDirty:!!_((c||r).dirtyFields,l),error:_((c||r).errors,l),isValidating:!!_(r.validatingFields,l),isTouched:!!_((c||r).touchedFields,l)}),ua=l=>{l&&Ct(l).forEach(c=>H(r.errors,c)),x.state.next({errors:l?r.errors:{}})},Kr=(l,c,d)=>{const v=(_(s,l,{_f:{}})._f||{}).ref,g=_(r.errors,l)||{},{ref:m,message:T,type:R,...X}=g;j(r.errors,l,{...X,...c,ref:v}),x.state.next({name:l,errors:r.errors,isValid:!1}),d&&d.shouldFocus&&v&&v.focus&&v.focus()},fa=(l,c)=>Te(l)?x.values.subscribe({next:d=>l(I(void 0,c),d)}):I(l,c,!0),nr=(l,c={})=>{for(const d of l?Ct(l):o.mount)o.mount.delete(d),o.array.delete(d),c.keepValue||(H(s,d),H(n,d)),!c.keepError&&H(r.errors,d),!c.keepDirty&&H(r.dirtyFields,d),!c.keepTouched&&H(r.touchedFields,d),!c.keepIsValidating&&H(r.validatingFields,d),!e.shouldUnregister&&!c.keepDefaultValue&&H(a,d);x.values.next({values:{...n}}),x.state.next({...r,...c.keepDirty?{isDirty:w()}:{}}),!c.keepIsValid&&Z()},Qr=({disabled:l,name:c,field:d,fields:v,value:g})=>{if(ge(l)&&i.mount||l){const m=l?void 0:W(g)?Ht(d?d._f:_(v,c)._f):g;j(n,c,m),Ne(c,m,!1,!1,!0)}},ar=(l,c={})=>{let d=_(s,l);const v=ge(c.disabled)||ge(t.disabled);return j(s,l,{...d||{},_f:{...d&&d._f?d._f:{ref:{name:l}},name:l,mount:!0,...c}}),o.mount.add(l),d?Qr({field:d,disabled:ge(c.disabled)?c.disabled:t.disabled,name:l,value:c.value}):F(l,!0,c.value),{...v?{disabled:c.disabled||t.disabled}:{},...e.progressive?{required:!!c.required,min:at(c.min),max:at(c.max),minLength:at(c.minLength),maxLength:at(c.maxLength),pattern:at(c.pattern)}:{},name:l,onChange:Ve,onBlur:Ve,ref:g=>{if(g){ar(l,c),d=_(s,l);const m=W(g.value)&&g.querySelectorAll&&g.querySelectorAll("input,select,textarea")[0]||g,T=vs(m),R=d._f.refs||[];if(T?R.find(X=>X===m):m===d._f.ref)return;j(s,l,{_f:{...d._f,...T?{refs:[...R.filter(Gt),m,...Array.isArray(_(a,l))?[{}]:[]],ref:{type:m.type,name:l}}:{ref:m}}}),F(l,!1,void 0,m)}else d=_(s,l,{}),d._f&&(d._f.mount=!1),(e.shouldUnregister||c.shouldUnregister)&&!(ls(o.array,l)&&i.action)&&o.unMount.add(l)}}},es=()=>e.shouldFocusError&&nt(s,me,o.mount),ha=l=>{ge(l)&&(x.state.next({disabled:l}),nt(s,(c,d)=>{const v=_(s,d);v&&(c.disabled=v._f.disabled||l,Array.isArray(v._f.refs)&&v._f.refs.forEach(g=>{g.disabled=v._f.disabled||l}))},0,!1))},ts=(l,c)=>async d=>{let v;d&&(d.preventDefault&&d.preventDefault(),d.persist&&d.persist());let g=ce(n);if(x.state.next({isSubmitting:!0}),e.resolver){const{errors:m,values:T}=await xe();r.errors=m,g=T}else await te(s);if(H(r.errors,"root"),oe(r.errors)){x.state.next({errors:{}});try{await l(g,d)}catch(m){v=m}}else c&&await c({...r.errors},d),es(),setTimeout(es);if(x.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:oe(r.errors)&&!v,submitCount:r.submitCount+1,errors:r.errors}),v)throw v},pa=(l,c={})=>{_(s,l)&&(W(c.defaultValue)?ie(l,ce(_(a,l))):(ie(l,c.defaultValue),j(a,l,ce(c.defaultValue))),c.keepTouched||H(r.touchedFields,l),c.keepDirty||(H(r.dirtyFields,l),r.isDirty=c.defaultValue?w(l,ce(_(a,l))):w()),c.keepError||(H(r.errors,l),p.isValid&&Z()),x.state.next({...r}))},rs=(l,c={})=>{const d=l?ce(l):a,v=ce(d),g=oe(l),m=g?a:v;if(c.keepDefaultValues||(a=d),!c.keepValues){if(c.keepDirtyValues)for(const T of o.mount)_(r.dirtyFields,T)?j(m,T,_(n,T)):ie(T,_(m,T));else{if(zt&&W(l))for(const T of o.mount){const R=_(s,T);if(R&&R._f){const X=Array.isArray(R._f.refs)?R._f.refs[0]:R._f.ref;if(Et(X)){const K=X.closest("form");if(K){K.reset();break}}}}s={}}n=t.shouldUnregister?c.keepDefaultValues?ce(a):{}:ce(m),x.array.next({values:{...m}}),x.values.next({values:{...m}})}o={mount:c.keepDirtyValues?o.mount:new Set,unMount:new Set,array:new Set,watch:new Set,watchAll:!1,focus:""},i.mount=!p.isValid||!!c.keepIsValid||!!c.keepDirtyValues,i.watch=!!t.shouldUnregister,x.state.next({submitCount:c.keepSubmitCount?r.submitCount:0,isDirty:g?!1:c.keepDirty?r.isDirty:!!(c.keepDefaultValues&&!Ie(l,a)),isSubmitted:c.keepIsSubmitted?r.isSubmitted:!1,dirtyFields:g?{}:c.keepDirtyValues?c.keepDefaultValues&&n?It(a,n):r.dirtyFields:c.keepDefaultValues&&l?It(a,l):c.keepDirty?r.dirtyFields:{},touchedFields:c.keepTouched?r.touchedFields:{},errors:c.keepErrors?r.errors:{},isSubmitSuccessful:c.keepIsSubmitSuccessful?r.isSubmitSuccessful:!1,isSubmitting:!1})},ss=(l,c)=>rs(Te(l)?l(n):l,c);return{control:{register:ar,unregister:nr,getFieldState:Xr,handleSubmit:ts,setError:Kr,_executeSchema:xe,_getWatch:I,_getDirty:w,_updateValid:Z,_removeUnmounted:Fe,_updateFieldArray:E,_updateDisabledField:Qr,_getFieldArray:$,_reset:rs,_resetDefaultValues:()=>Te(e.defaultValues)&&e.defaultValues().then(l=>{ss(l,e.resetOptions),x.state.next({isLoading:!1})}),_updateFormState:l=>{r={...r,...l}},_disableForm:ha,_subjects:x,_proxyFormState:p,_setErrors:Q,get _fields(){return s},get _formValues(){return n},get _state(){return i},set _state(l){i=l},get _defaultValues(){return a},get _names(){return o},set _names(l){o=l},get _formState(){return r},set _formState(l){r=l},get _options(){return e},set _options(l){e={...e,...l}}},trigger:$e,register:ar,handleSubmit:ts,watch:fa,setValue:ie,getValues:de,reset:ss,resetField:pa,clearErrors:ua,unregister:nr,setError:Kr,setFocus:(l,c={})=>{const d=_(s,l),v=d&&d._f;if(v){const g=v.refs?v.refs[0]:v.ref;g.focus&&(g.focus(),c.shouldSelect&&g.select())}},getFieldState:Xr}}function Cs(t={}){const e=M.useRef(),r=M.useRef(),[s,a]=M.useState({isDirty:!1,isValidating:!1,isLoading:Te(t.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1,defaultValues:Te(t.defaultValues)?void 0:t.defaultValues});e.current||(e.current={...Ss(t),formState:s});const n=e.current.control;return n._options=t,hs({subject:n._subjects.state,next:i=>{fs(i,n._proxyFormState,n._updateFormState)&&a({...n._formState})}}),M.useEffect(()=>n._disableForm(t.disabled),[n,t.disabled]),M.useEffect(()=>{if(n._proxyFormState.isDirty){const i=n._getDirty();i!==s.isDirty&&n._subjects.state.next({isDirty:i})}},[n,s.isDirty]),M.useEffect(()=>{t.values&&!Ie(t.values,r.current)?(n._reset(t.values,n._options.resetOptions),r.current=t.values,a(i=>({...i}))):n._resetDefaultValues()},[t.values,n]),M.useEffect(()=>{t.errors&&n._setErrors(t.errors)},[t.errors,n]),M.useEffect(()=>{n._state.mount||(n._updateValid(),n._state.mount=!0),n._state.watch&&(n._state.watch=!1,n._subjects.state.next({...n._formState})),n._removeUnmounted()}),M.useEffect(()=>{t.shouldUnregister&&n._subjects.values.next({values:n._getWatch()})},[t.shouldUnregister,n]),e.current.formState=us(s,n),e.current}const Nr=(t,e,r)=>{if(t&&"reportValidity"in t){const s=_(r,e);t.setCustomValidity(s&&s.message||""),t.reportValidity()}},Vr=(t,e)=>{for(const r in e.fields){const s=e.fields[r];s&&s.ref&&"reportValidity"in s.ref?Nr(s.ref,r,t):s.refs&&s.refs.forEach(a=>Nr(a,r,t))}},Es=(t,e)=>{e.shouldUseNativeValidation&&Vr(t,e);const r={};for(const s in t){const a=_(e.fields,s),n=Object.assign(t[s]||{},{ref:a&&a.ref});if(As(e.names||Object.keys(t),s)){const i=Object.assign({},_(r,s));j(i,"root",n),j(r,s,i)}else j(r,s,n)}return r},As=(t,e)=>t.some(r=>r.startsWith(e+"."));var Ns=function(t,e){for(var r={};t.length;){var s=t[0],a=s.code,n=s.message,i=s.path.join(".");if(!r[i])if("unionErrors"in s){var o=s.unionErrors[0].errors[0];r[i]={message:o.message,type:o.code}}else r[i]={message:n,type:a};if("unionErrors"in s&&s.unionErrors.forEach(function(p){return p.errors.forEach(function(x){return t.push(x)})}),e){var u=r[i].types,f=u&&u[s.code];r[i]=hr(i,e,r,a,f?[].concat(f,s.message):s.message)}t.shift()}return r},Vs=function(t,e,r){return r===void 0&&(r={}),function(s,a,n){try{return Promise.resolve(function(i,o){try{var u=Promise.resolve(t[r.mode==="sync"?"parse":"parseAsync"](s,e)).then(function(f){return n.shouldUseNativeValidation&&Vr({},n),{errors:{},values:r.raw?s:f}})}catch(f){return o(f)}return u&&u.then?u.then(void 0,o):u}(0,function(i){if(function(o){return Array.isArray(o==null?void 0:o.errors)}(i))return{values:{},errors:Es(Ns(i.errors,!n.shouldUseNativeValidation&&n.criteriaMode==="all"),n)};throw i}))}catch(i){return Promise.reject(i)}}};function Or(t){var e,r,s="";if(typeof t=="string"||typeof t=="number")s+=t;else if(typeof t=="object")if(Array.isArray(t)){var a=t.length;for(e=0;e<a;e++)t[e]&&(r=Or(t[e]))&&(s&&(s+=" "),s+=r)}else for(r in t)t[r]&&(s&&(s+=" "),s+=r);return s}function Os(){for(var t,e,r=0,s="",a=arguments.length;r<a;r++)(t=arguments[r])&&(e=Or(t))&&(s&&(s+=" "),s+=e);return s}const Yt="-",Is=t=>{const e=Rs(t),{conflictingClassGroups:r,conflictingClassGroupModifiers:s}=t;return{getClassGroupId:i=>{const o=i.split(Yt);return o[0]===""&&o.length!==1&&o.shift(),Ir(o,e)||Zs(i)},getConflictingClassGroupIds:(i,o)=>{const u=r[i]||[];return o&&s[i]?[...u,...s[i]]:u}}},Ir=(t,e)=>{var i;if(t.length===0)return e.classGroupId;const r=t[0],s=e.nextPart.get(r),a=s?Ir(t.slice(1),s):void 0;if(a)return a;if(e.validators.length===0)return;const n=t.join(Yt);return(i=e.validators.find(({validator:o})=>o(n)))==null?void 0:i.classGroupId},Zr=/^\[(.+)\]$/,Zs=t=>{if(Zr.test(t)){const e=Zr.exec(t)[1],r=e==null?void 0:e.substring(0,e.indexOf(":"));if(r)return"arbitrary.."+r}},Rs=t=>{const{theme:e,prefix:r}=t,s={nextPart:new Map,validators:[]};return js(Object.entries(t.classGroups),r).forEach(([n,i])=>{Jt(i,s,n,e)}),s},Jt=(t,e,r,s)=>{t.forEach(a=>{if(typeof a=="string"){const n=a===""?e:Rr(e,a);n.classGroupId=r;return}if(typeof a=="function"){if(Ms(a)){Jt(a(s),e,r,s);return}e.validators.push({validator:a,classGroupId:r});return}Object.entries(a).forEach(([n,i])=>{Jt(i,Rr(e,n),r,s)})})},Rr=(t,e)=>{let r=t;return e.split(Yt).forEach(s=>{r.nextPart.has(s)||r.nextPart.set(s,{nextPart:new Map,validators:[]}),r=r.nextPart.get(s)}),r},Ms=t=>t.isThemeGetter,js=(t,e)=>e?t.map(([r,s])=>{const a=s.map(n=>typeof n=="string"?e+n:typeof n=="object"?Object.fromEntries(Object.entries(n).map(([i,o])=>[e+i,o])):n);return[r,a]}):t,Ds=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,r=new Map,s=new Map;const a=(n,i)=>{r.set(n,i),e++,e>t&&(e=0,s=r,r=new Map)};return{get(n){let i=r.get(n);if(i!==void 0)return i;if((i=s.get(n))!==void 0)return a(n,i),i},set(n,i){r.has(n)?r.set(n,i):a(n,i)}}},Mr="!",Ls=t=>{const{separator:e,experimentalParseClassName:r}=t,s=e.length===1,a=e[0],n=e.length,i=o=>{const u=[];let f=0,p=0,x;for(let Z=0;Z<o.length;Z++){let L=o[Z];if(f===0){if(L===a&&(s||o.slice(Z,Z+n)===e)){u.push(o.slice(p,Z)),p=Z+n;continue}if(L==="/"){x=Z;continue}}L==="["?f++:L==="]"&&f--}const Y=u.length===0?o:o.substring(p),B=Y.startsWith(Mr),P=B?Y.substring(1):Y,q=x&&x>p?x-p:void 0;return{modifiers:u,hasImportantModifier:B,baseClassName:P,maybePostfixModifierPosition:q}};return r?o=>r({className:o,parseClassName:i}):i},Ps=t=>{if(t.length<=1)return t;const e=[];let r=[];return t.forEach(s=>{s[0]==="["?(e.push(...r.sort(),s),r=[]):r.push(s)}),e.push(...r.sort()),e},Fs=t=>({cache:Ds(t.cacheSize),parseClassName:Ls(t),...Is(t)}),$s=/\s+/,zs=(t,e)=>{const{parseClassName:r,getClassGroupId:s,getConflictingClassGroupIds:a}=e,n=[],i=t.trim().split($s);let o="";for(let u=i.length-1;u>=0;u-=1){const f=i[u],{modifiers:p,hasImportantModifier:x,baseClassName:Y,maybePostfixModifierPosition:B}=r(f);let P=!!B,q=s(P?Y.substring(0,B):Y);if(!q){if(!P){o=f+(o.length>0?" "+o:o);continue}if(q=s(Y),!q){o=f+(o.length>0?" "+o:o);continue}P=!1}const Z=Ps(p).join(":"),L=x?Z+Mr:Z,E=L+q;if(n.includes(E))continue;n.push(E);const ae=a(q,P);for(let Q=0;Q<ae.length;++Q){const F=ae[Q];n.push(L+F)}o=f+(o.length>0?" "+o:o)}return o};function Us(){let t=0,e,r,s="";for(;t<arguments.length;)(e=arguments[t++])&&(r=jr(e))&&(s&&(s+=" "),s+=r);return s}const jr=t=>{if(typeof t=="string")return t;let e,r="";for(let s=0;s<t.length;s++)t[s]&&(e=jr(t[s]))&&(r&&(r+=" "),r+=e);return r};function Bs(t,...e){let r,s,a,n=i;function i(u){const f=e.reduce((p,x)=>x(p),t());return r=Fs(f),s=r.cache.get,a=r.cache.set,n=o,o(u)}function o(u){const f=s(u);if(f)return f;const p=zs(u,r);return a(u,p),p}return function(){return n(Us.apply(null,arguments))}}const D=t=>{const e=r=>r[t]||[];return e.isThemeGetter=!0,e},Dr=/^\[(?:([a-z-]+):)?(.+)\]$/i,Ws=/^\d+\/\d+$/,qs=new Set(["px","full","screen"]),Gs=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Hs=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Ys=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,Js=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Xs=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Se=t=>Ye(t)||qs.has(t)||Ws.test(t),Ze=t=>Je(t,"length",an),Ye=t=>!!t&&!Number.isNaN(Number(t)),Xt=t=>Je(t,"number",Ye),it=t=>!!t&&Number.isInteger(Number(t)),Ks=t=>t.endsWith("%")&&Ye(t.slice(0,-1)),N=t=>Dr.test(t),Re=t=>Gs.test(t),Qs=new Set(["length","size","percentage"]),en=t=>Je(t,Qs,Lr),tn=t=>Je(t,"position",Lr),rn=new Set(["image","url"]),sn=t=>Je(t,rn,ln),nn=t=>Je(t,"",on),ot=()=>!0,Je=(t,e,r)=>{const s=Dr.exec(t);return s?s[1]?typeof e=="string"?s[1]===e:e.has(s[1]):r(s[2]):!1},an=t=>Hs.test(t)&&!Ys.test(t),Lr=()=>!1,on=t=>Js.test(t),ln=t=>Xs.test(t),cn=Bs(()=>{const t=D("colors"),e=D("spacing"),r=D("blur"),s=D("brightness"),a=D("borderColor"),n=D("borderRadius"),i=D("borderSpacing"),o=D("borderWidth"),u=D("contrast"),f=D("grayscale"),p=D("hueRotate"),x=D("invert"),Y=D("gap"),B=D("gradientColorStops"),P=D("gradientColorStopPositions"),q=D("inset"),Z=D("margin"),L=D("opacity"),E=D("padding"),ae=D("saturate"),Q=D("scale"),F=D("sepia"),Ne=D("skew"),We=D("space"),xe=D("translate"),we=()=>["auto","contain","none"],te=()=>["auto","hidden","clip","visible","scroll"],Fe=()=>["auto",N,e],w=()=>[N,e],I=()=>["",Se,Ze],$=()=>["auto",Ye,N],J=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],re=()=>["solid","dashed","dotted","double","none"],ie=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],Ve=()=>["start","end","center","between","around","evenly","stretch"],me=()=>["","0",N],$e=()=>["auto","avoid","all","avoid-page","page","left","right","column"],de=()=>[Ye,N];return{cacheSize:500,separator:":",theme:{colors:[ot],spacing:[Se,Ze],blur:["none","",Re,N],brightness:de(),borderColor:[t],borderRadius:["none","","full",Re,N],borderSpacing:w(),borderWidth:I(),contrast:de(),grayscale:me(),hueRotate:de(),invert:me(),gap:w(),gradientColorStops:[t],gradientColorStopPositions:[Ks,Ze],inset:Fe(),margin:Fe(),opacity:de(),padding:w(),saturate:de(),scale:de(),sepia:me(),skew:de(),space:w(),translate:w()},classGroups:{aspect:[{aspect:["auto","square","video",N]}],container:["container"],columns:[{columns:[Re]}],"break-after":[{"break-after":$e()}],"break-before":[{"break-before":$e()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...J(),N]}],overflow:[{overflow:te()}],"overflow-x":[{"overflow-x":te()}],"overflow-y":[{"overflow-y":te()}],overscroll:[{overscroll:we()}],"overscroll-x":[{"overscroll-x":we()}],"overscroll-y":[{"overscroll-y":we()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[q]}],"inset-x":[{"inset-x":[q]}],"inset-y":[{"inset-y":[q]}],start:[{start:[q]}],end:[{end:[q]}],top:[{top:[q]}],right:[{right:[q]}],bottom:[{bottom:[q]}],left:[{left:[q]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",it,N]}],basis:[{basis:Fe()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",N]}],grow:[{grow:me()}],shrink:[{shrink:me()}],order:[{order:["first","last","none",it,N]}],"grid-cols":[{"grid-cols":[ot]}],"col-start-end":[{col:["auto",{span:["full",it,N]},N]}],"col-start":[{"col-start":$()}],"col-end":[{"col-end":$()}],"grid-rows":[{"grid-rows":[ot]}],"row-start-end":[{row:["auto",{span:[it,N]},N]}],"row-start":[{"row-start":$()}],"row-end":[{"row-end":$()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",N]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",N]}],gap:[{gap:[Y]}],"gap-x":[{"gap-x":[Y]}],"gap-y":[{"gap-y":[Y]}],"justify-content":[{justify:["normal",...Ve()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...Ve(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...Ve(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[E]}],px:[{px:[E]}],py:[{py:[E]}],ps:[{ps:[E]}],pe:[{pe:[E]}],pt:[{pt:[E]}],pr:[{pr:[E]}],pb:[{pb:[E]}],pl:[{pl:[E]}],m:[{m:[Z]}],mx:[{mx:[Z]}],my:[{my:[Z]}],ms:[{ms:[Z]}],me:[{me:[Z]}],mt:[{mt:[Z]}],mr:[{mr:[Z]}],mb:[{mb:[Z]}],ml:[{ml:[Z]}],"space-x":[{"space-x":[We]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[We]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",N,e]}],"min-w":[{"min-w":[N,e,"min","max","fit"]}],"max-w":[{"max-w":[N,e,"none","full","min","max","fit","prose",{screen:[Re]},Re]}],h:[{h:[N,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[N,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[N,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[N,e,"auto","min","max","fit"]}],"font-size":[{text:["base",Re,Ze]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Xt]}],"font-family":[{font:[ot]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractons"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",N]}],"line-clamp":[{"line-clamp":["none",Ye,Xt]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Se,N]}],"list-image":[{"list-image":["none",N]}],"list-style-type":[{list:["none","disc","decimal",N]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[t]}],"placeholder-opacity":[{"placeholder-opacity":[L]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[t]}],"text-opacity":[{"text-opacity":[L]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...re(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Se,Ze]}],"underline-offset":[{"underline-offset":["auto",Se,N]}],"text-decoration-color":[{decoration:[t]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:w()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",N]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",N]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[L]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...J(),tn]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",en]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},sn]}],"bg-color":[{bg:[t]}],"gradient-from-pos":[{from:[P]}],"gradient-via-pos":[{via:[P]}],"gradient-to-pos":[{to:[P]}],"gradient-from":[{from:[B]}],"gradient-via":[{via:[B]}],"gradient-to":[{to:[B]}],rounded:[{rounded:[n]}],"rounded-s":[{"rounded-s":[n]}],"rounded-e":[{"rounded-e":[n]}],"rounded-t":[{"rounded-t":[n]}],"rounded-r":[{"rounded-r":[n]}],"rounded-b":[{"rounded-b":[n]}],"rounded-l":[{"rounded-l":[n]}],"rounded-ss":[{"rounded-ss":[n]}],"rounded-se":[{"rounded-se":[n]}],"rounded-ee":[{"rounded-ee":[n]}],"rounded-es":[{"rounded-es":[n]}],"rounded-tl":[{"rounded-tl":[n]}],"rounded-tr":[{"rounded-tr":[n]}],"rounded-br":[{"rounded-br":[n]}],"rounded-bl":[{"rounded-bl":[n]}],"border-w":[{border:[o]}],"border-w-x":[{"border-x":[o]}],"border-w-y":[{"border-y":[o]}],"border-w-s":[{"border-s":[o]}],"border-w-e":[{"border-e":[o]}],"border-w-t":[{"border-t":[o]}],"border-w-r":[{"border-r":[o]}],"border-w-b":[{"border-b":[o]}],"border-w-l":[{"border-l":[o]}],"border-opacity":[{"border-opacity":[L]}],"border-style":[{border:[...re(),"hidden"]}],"divide-x":[{"divide-x":[o]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[o]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[L]}],"divide-style":[{divide:re()}],"border-color":[{border:[a]}],"border-color-x":[{"border-x":[a]}],"border-color-y":[{"border-y":[a]}],"border-color-t":[{"border-t":[a]}],"border-color-r":[{"border-r":[a]}],"border-color-b":[{"border-b":[a]}],"border-color-l":[{"border-l":[a]}],"divide-color":[{divide:[a]}],"outline-style":[{outline:["",...re()]}],"outline-offset":[{"outline-offset":[Se,N]}],"outline-w":[{outline:[Se,Ze]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:I()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[L]}],"ring-offset-w":[{"ring-offset":[Se,Ze]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",Re,nn]}],"shadow-color":[{shadow:[ot]}],opacity:[{opacity:[L]}],"mix-blend":[{"mix-blend":[...ie(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":ie()}],filter:[{filter:["","none"]}],blur:[{blur:[r]}],brightness:[{brightness:[s]}],contrast:[{contrast:[u]}],"drop-shadow":[{"drop-shadow":["","none",Re,N]}],grayscale:[{grayscale:[f]}],"hue-rotate":[{"hue-rotate":[p]}],invert:[{invert:[x]}],saturate:[{saturate:[ae]}],sepia:[{sepia:[F]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[r]}],"backdrop-brightness":[{"backdrop-brightness":[s]}],"backdrop-contrast":[{"backdrop-contrast":[u]}],"backdrop-grayscale":[{"backdrop-grayscale":[f]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[p]}],"backdrop-invert":[{"backdrop-invert":[x]}],"backdrop-opacity":[{"backdrop-opacity":[L]}],"backdrop-saturate":[{"backdrop-saturate":[ae]}],"backdrop-sepia":[{"backdrop-sepia":[F]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[i]}],"border-spacing-x":[{"border-spacing-x":[i]}],"border-spacing-y":[{"border-spacing-y":[i]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",N]}],duration:[{duration:de()}],ease:[{ease:["linear","in","out","in-out",N]}],delay:[{delay:de()}],animate:[{animate:["none","spin","ping","pulse","bounce",N]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[Q]}],"scale-x":[{"scale-x":[Q]}],"scale-y":[{"scale-y":[Q]}],rotate:[{rotate:[it,N]}],"translate-x":[{"translate-x":[xe]}],"translate-y":[{"translate-y":[xe]}],"skew-x":[{"skew-x":[Ne]}],"skew-y":[{"skew-y":[Ne]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",N]}],accent:[{accent:["auto",t]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",N]}],"caret-color":[{caret:[t]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":w()}],"scroll-mx":[{"scroll-mx":w()}],"scroll-my":[{"scroll-my":w()}],"scroll-ms":[{"scroll-ms":w()}],"scroll-me":[{"scroll-me":w()}],"scroll-mt":[{"scroll-mt":w()}],"scroll-mr":[{"scroll-mr":w()}],"scroll-mb":[{"scroll-mb":w()}],"scroll-ml":[{"scroll-ml":w()}],"scroll-p":[{"scroll-p":w()}],"scroll-px":[{"scroll-px":w()}],"scroll-py":[{"scroll-py":w()}],"scroll-ps":[{"scroll-ps":w()}],"scroll-pe":[{"scroll-pe":w()}],"scroll-pt":[{"scroll-pt":w()}],"scroll-pr":[{"scroll-pr":w()}],"scroll-pb":[{"scroll-pb":w()}],"scroll-pl":[{"scroll-pl":w()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",N]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[Se,Ze,Xt]}],stroke:[{stroke:[t,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}});function Zt(...t){return cn(Os(t))}function Ce(t){return t[0].toUpperCase()+t.slice(1)}const dn=()=>{const t=({schema:e,onSubmit:r,defaultValues:s,children:a,className:n})=>{const i=Cs({resolver:Vs(e),defaultValues:s,mode:"onSubmit"});return M.createElement(ds,{...i},M.createElement("form",{onSubmit:i.handleSubmit(r),className:Zt("p-4 flex flex-col justify-center space-y-2 form-control",n)},a))};return t.Input=({name:e,label:r,className:s,...a})=>{const{register:n}=fr();return M.createElement(fn,{name:e},M.createElement(un,{htmlFor:e},r),M.createElement("input",{id:e,...n(e),className:Zt("mt-1 block w-full border border-gray-300 rounded-lg px-4 py-2 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent transition duration-200 form-input form-input-field",s),...a}))},t},un=M.forwardRef(({children:t,htmlFor:e,className:r},s)=>M.createElement("label",{ref:s,className:Zt("text-sm font-medium text-gray-700 form-label",r),htmlFor:e},t)),fn=M.forwardRef(({name:t,className:e,children:r},s)=>{var n;const{formState:{errors:a}}=fr();return M.createElement("div",{className:`flex flex-col form-field ${a[t]?"text-red-600 form-field-error":""}`,ref:s},r,a[t]?M.createElement("span",{className:Zt("text-red-600 text-sm form-field-error-text",e)},(n=a[t])==null?void 0:n.message):null)});var O;(function(t){t.assertEqual=a=>a;function e(a){}t.assertIs=e;function r(a){throw new Error}t.assertNever=r,t.arrayToEnum=a=>{const n={};for(const i of a)n[i]=i;return n},t.getValidEnumValues=a=>{const n=t.objectKeys(a).filter(o=>typeof a[a[o]]!="number"),i={};for(const o of n)i[o]=a[o];return t.objectValues(i)},t.objectValues=a=>t.objectKeys(a).map(function(n){return a[n]}),t.objectKeys=typeof Object.keys=="function"?a=>Object.keys(a):a=>{const n=[];for(const i in a)Object.prototype.hasOwnProperty.call(a,i)&&n.push(i);return n},t.find=(a,n)=>{for(const i of a)if(n(i))return i},t.isInteger=typeof Number.isInteger=="function"?a=>Number.isInteger(a):a=>typeof a=="number"&&isFinite(a)&&Math.floor(a)===a;function s(a,n=" | "){return a.map(i=>typeof i=="string"?`'${i}'`:i).join(n)}t.joinValues=s,t.jsonStringifyReplacer=(a,n)=>typeof n=="bigint"?n.toString():n})(O||(O={}));var Kt;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(Kt||(Kt={}));const b=O.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Me=t=>{switch(typeof t){case"undefined":return b.undefined;case"string":return b.string;case"number":return isNaN(t)?b.nan:b.number;case"boolean":return b.boolean;case"function":return b.function;case"bigint":return b.bigint;case"symbol":return b.symbol;case"object":return Array.isArray(t)?b.array:t===null?b.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?b.promise:typeof Map<"u"&&t instanceof Map?b.map:typeof Set<"u"&&t instanceof Set?b.set:typeof Date<"u"&&t instanceof Date?b.date:b.object;default:return b.unknown}},h=O.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),hn=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:");class le extends Error{constructor(e){super(),this.issues=[],this.addIssue=s=>{this.issues=[...this.issues,s]},this.addIssues=(s=[])=>{this.issues=[...this.issues,...s]};const r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){const r=e||function(n){return n.message},s={_errors:[]},a=n=>{for(const i of n.issues)if(i.code==="invalid_union")i.unionErrors.map(a);else if(i.code==="invalid_return_type")a(i.returnTypeError);else if(i.code==="invalid_arguments")a(i.argumentsError);else if(i.path.length===0)s._errors.push(r(i));else{let o=s,u=0;for(;u<i.path.length;){const f=i.path[u];u===i.path.length-1?(o[f]=o[f]||{_errors:[]},o[f]._errors.push(r(i))):o[f]=o[f]||{_errors:[]},o=o[f],u++}}};return a(this),s}static assert(e){if(!(e instanceof le))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,O.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){const r={},s=[];for(const a of this.issues)a.path.length>0?(r[a.path[0]]=r[a.path[0]]||[],r[a.path[0]].push(e(a))):s.push(e(a));return{formErrors:s,fieldErrors:r}}get formErrors(){return this.flatten()}}le.create=t=>new le(t);const Xe=(t,e)=>{let r;switch(t.code){case h.invalid_type:t.received===b.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case h.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,O.jsonStringifyReplacer)}`;break;case h.unrecognized_keys:r=`Unrecognized key(s) in object: ${O.joinValues(t.keys,", ")}`;break;case h.invalid_union:r="Invalid input";break;case h.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${O.joinValues(t.options)}`;break;case h.invalid_enum_value:r=`Invalid enum value. Expected ${O.joinValues(t.options)}, received '${t.received}'`;break;case h.invalid_arguments:r="Invalid function arguments";break;case h.invalid_return_type:r="Invalid function return type";break;case h.invalid_date:r="Invalid date";break;case h.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:O.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case h.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case h.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case h.custom:r="Invalid input";break;case h.invalid_intersection_types:r="Intersection results could not be merged";break;case h.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case h.not_finite:r="Number must be finite";break;default:r=e.defaultError,O.assertNever(t)}return{message:r}};let Pr=Xe;function pn(t){Pr=t}function Rt(){return Pr}const Mt=t=>{const{data:e,path:r,errorMaps:s,issueData:a}=t,n=[...r,...a.path||[]],i={...a,path:n};if(a.message!==void 0)return{...a,path:n,message:a.message};let o="";const u=s.filter(f=>!!f).slice().reverse();for(const f of u)o=f(i,{data:e,defaultError:o}).message;return{...a,path:n,message:o}},mn=[];function y(t,e){const r=Rt(),s=Mt({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===Xe?void 0:Xe].filter(a=>!!a)});t.common.issues.push(s)}class ee{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){const s=[];for(const a of r){if(a.status==="aborted")return C;a.status==="dirty"&&e.dirty(),s.push(a.value)}return{status:e.value,value:s}}static async mergeObjectAsync(e,r){const s=[];for(const a of r){const n=await a.key,i=await a.value;s.push({key:n,value:i})}return ee.mergeObjectSync(e,s)}static mergeObjectSync(e,r){const s={};for(const a of r){const{key:n,value:i}=a;if(n.status==="aborted"||i.status==="aborted")return C;n.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),n.value!=="__proto__"&&(typeof i.value<"u"||a.alwaysSet)&&(s[n.value]=i.value)}return{status:e.value,value:s}}}const C=Object.freeze({status:"aborted"}),Ke=t=>({status:"dirty",value:t}),ne=t=>({status:"valid",value:t}),Qt=t=>t.status==="aborted",er=t=>t.status==="dirty",lt=t=>t.status==="valid",ct=t=>typeof Promise<"u"&&t instanceof Promise;function jt(t,e,r,s){if(typeof e=="function"?t!==e||!s:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e.get(t)}function Fr(t,e,r,s,a){if(typeof e=="function"?t!==e||!a:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e.set(t,r),r}typeof SuppressedError=="function"&&SuppressedError;var k;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(k||(k={}));var dt,ut;class ve{constructor(e,r,s,a){this._cachedPath=[],this.parent=e,this.data=r,this._path=s,this._key=a}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const $r=(t,e)=>{if(lt(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const r=new le(t.common.issues);return this._error=r,this._error}}};function A(t){if(!t)return{};const{errorMap:e,invalid_type_error:r,required_error:s,description:a}=t;if(e&&(r||s))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:a}:{errorMap:(i,o)=>{var u,f;const{message:p}=t;return i.code==="invalid_enum_value"?{message:p??o.defaultError}:typeof o.data>"u"?{message:(u=p??s)!==null&&u!==void 0?u:o.defaultError}:i.code!=="invalid_type"?{message:o.defaultError}:{message:(f=p??r)!==null&&f!==void 0?f:o.defaultError}},description:a}}class V{constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(e){return Me(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:Me(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new ee,ctx:{common:e.parent.common,data:e.data,parsedType:Me(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const r=this._parse(e);if(ct(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){const r=this._parse(e);return Promise.resolve(r)}parse(e,r){const s=this.safeParse(e,r);if(s.success)return s.data;throw s.error}safeParse(e,r){var s;const a={common:{issues:[],async:(s=r==null?void 0:r.async)!==null&&s!==void 0?s:!1,contextualErrorMap:r==null?void 0:r.errorMap},path:(r==null?void 0:r.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Me(e)},n=this._parseSync({data:e,path:a.path,parent:a});return $r(a,n)}async parseAsync(e,r){const s=await this.safeParseAsync(e,r);if(s.success)return s.data;throw s.error}async safeParseAsync(e,r){const s={common:{issues:[],contextualErrorMap:r==null?void 0:r.errorMap,async:!0},path:(r==null?void 0:r.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Me(e)},a=this._parse({data:e,path:s.path,parent:s}),n=await(ct(a)?a:Promise.resolve(a));return $r(s,n)}refine(e,r){const s=a=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(a):r;return this._refinement((a,n)=>{const i=e(a),o=()=>n.addIssue({code:h.custom,...s(a)});return typeof Promise<"u"&&i instanceof Promise?i.then(u=>u?!0:(o(),!1)):i?!0:(o(),!1)})}refinement(e,r){return this._refinement((s,a)=>e(s)?!0:(a.addIssue(typeof r=="function"?r(s,a):r),!1))}_refinement(e){return new pe({schema:this,typeName:S.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return _e.create(this,this._def)}nullable(){return Pe.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return he.create(this,this._def)}promise(){return rt.create(this,this._def)}or(e){return mt.create([this,e],this._def)}and(e){return gt.create(this,e,this._def)}transform(e){return new pe({...A(this._def),schema:this,typeName:S.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const r=typeof e=="function"?e:()=>e;return new xt({...A(this._def),innerType:this,defaultValue:r,typeName:S.ZodDefault})}brand(){return new sr({typeName:S.ZodBranded,type:this,...A(this._def)})}catch(e){const r=typeof e=="function"?e:()=>e;return new wt({...A(this._def),innerType:this,catchValue:r,typeName:S.ZodCatch})}describe(e){const r=this.constructor;return new r({...this._def,description:e})}pipe(e){return kt.create(this,e)}readonly(){return Tt.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const gn=/^c[^\s-]{8,}$/i,yn=/^[0-9a-z]+$/,vn=/^[0-9A-HJKMNP-TV-Z]{26}$/,bn=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,_n=/^[a-z0-9_-]{21}$/i,xn=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,wn=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,kn="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let tr;const Tn=/^(?:(?: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])$/,Sn=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,Cn=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,zr="((\\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])))",En=new RegExp(`^${zr}$`);function Ur(t){let e="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`),e}function An(t){return new RegExp(`^${Ur(t)}$`)}function Br(t){let e=`${zr}T${Ur(t)}`;const r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function Nn(t,e){return!!((e==="v4"||!e)&&Tn.test(t)||(e==="v6"||!e)&&Sn.test(t))}class fe extends V{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==b.string){const n=this._getOrReturnCtx(e);return y(n,{code:h.invalid_type,expected:b.string,received:n.parsedType}),C}const s=new ee;let a;for(const n of this._def.checks)if(n.kind==="min")e.data.length<n.value&&(a=this._getOrReturnCtx(e,a),y(a,{code:h.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),s.dirty());else if(n.kind==="max")e.data.length>n.value&&(a=this._getOrReturnCtx(e,a),y(a,{code:h.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),s.dirty());else if(n.kind==="length"){const i=e.data.length>n.value,o=e.data.length<n.value;(i||o)&&(a=this._getOrReturnCtx(e,a),i?y(a,{code:h.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}):o&&y(a,{code:h.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}),s.dirty())}else if(n.kind==="email")wn.test(e.data)||(a=this._getOrReturnCtx(e,a),y(a,{validation:"email",code:h.invalid_string,message:n.message}),s.dirty());else if(n.kind==="emoji")tr||(tr=new RegExp(kn,"u")),tr.test(e.data)||(a=this._getOrReturnCtx(e,a),y(a,{validation:"emoji",code:h.invalid_string,message:n.message}),s.dirty());else if(n.kind==="uuid")bn.test(e.data)||(a=this._getOrReturnCtx(e,a),y(a,{validation:"uuid",code:h.invalid_string,message:n.message}),s.dirty());else if(n.kind==="nanoid")_n.test(e.data)||(a=this._getOrReturnCtx(e,a),y(a,{validation:"nanoid",code:h.invalid_string,message:n.message}),s.dirty());else if(n.kind==="cuid")gn.test(e.data)||(a=this._getOrReturnCtx(e,a),y(a,{validation:"cuid",code:h.invalid_string,message:n.message}),s.dirty());else if(n.kind==="cuid2")yn.test(e.data)||(a=this._getOrReturnCtx(e,a),y(a,{validation:"cuid2",code:h.invalid_string,message:n.message}),s.dirty());else if(n.kind==="ulid")vn.test(e.data)||(a=this._getOrReturnCtx(e,a),y(a,{validation:"ulid",code:h.invalid_string,message:n.message}),s.dirty());else if(n.kind==="url")try{new URL(e.data)}catch{a=this._getOrReturnCtx(e,a),y(a,{validation:"url",code:h.invalid_string,message:n.message}),s.dirty()}else n.kind==="regex"?(n.regex.lastIndex=0,n.regex.test(e.data)||(a=this._getOrReturnCtx(e,a),y(a,{validation:"regex",code:h.invalid_string,message:n.message}),s.dirty())):n.kind==="trim"?e.data=e.data.trim():n.kind==="includes"?e.data.includes(n.value,n.position)||(a=this._getOrReturnCtx(e,a),y(a,{code:h.invalid_string,validation:{includes:n.value,position:n.position},message:n.message}),s.dirty()):n.kind==="toLowerCase"?e.data=e.data.toLowerCase():n.kind==="toUpperCase"?e.data=e.data.toUpperCase():n.kind==="startsWith"?e.data.startsWith(n.value)||(a=this._getOrReturnCtx(e,a),y(a,{code:h.invalid_string,validation:{startsWith:n.value},message:n.message}),s.dirty()):n.kind==="endsWith"?e.data.endsWith(n.value)||(a=this._getOrReturnCtx(e,a),y(a,{code:h.invalid_string,validation:{endsWith:n.value},message:n.message}),s.dirty()):n.kind==="datetime"?Br(n).test(e.data)||(a=this._getOrReturnCtx(e,a),y(a,{code:h.invalid_string,validation:"datetime",message:n.message}),s.dirty()):n.kind==="date"?En.test(e.data)||(a=this._getOrReturnCtx(e,a),y(a,{code:h.invalid_string,validation:"date",message:n.message}),s.dirty()):n.kind==="time"?An(n).test(e.data)||(a=this._getOrReturnCtx(e,a),y(a,{code:h.invalid_string,validation:"time",message:n.message}),s.dirty()):n.kind==="duration"?xn.test(e.data)||(a=this._getOrReturnCtx(e,a),y(a,{validation:"duration",code:h.invalid_string,message:n.message}),s.dirty()):n.kind==="ip"?Nn(e.data,n.version)||(a=this._getOrReturnCtx(e,a),y(a,{validation:"ip",code:h.invalid_string,message:n.message}),s.dirty()):n.kind==="base64"?Cn.test(e.data)||(a=this._getOrReturnCtx(e,a),y(a,{validation:"base64",code:h.invalid_string,message:n.message}),s.dirty()):O.assertNever(n);return{status:s.value,value:e.data}}_regex(e,r,s){return this.refinement(a=>e.test(a),{validation:r,code:h.invalid_string,...k.errToObj(s)})}_addCheck(e){return new fe({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...k.errToObj(e)})}url(e){return this._addCheck({kind:"url",...k.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...k.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...k.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...k.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...k.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...k.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...k.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...k.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...k.errToObj(e)})}datetime(e){var r,s;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(r=e==null?void 0:e.offset)!==null&&r!==void 0?r:!1,local:(s=e==null?void 0:e.local)!==null&&s!==void 0?s:!1,...k.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,...k.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...k.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...k.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r==null?void 0:r.position,...k.errToObj(r==null?void 0:r.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...k.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...k.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...k.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...k.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...k.errToObj(r)})}nonempty(e){return this.min(1,k.errToObj(e))}trim(){return new fe({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new fe({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new fe({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get minLength(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}}fe.create=t=>{var e;return new fe({checks:[],typeName:S.ZodString,coerce:(e=t==null?void 0:t.coerce)!==null&&e!==void 0?e:!1,...A(t)})};function Vn(t,e){const r=(t.toString().split(".")[1]||"").length,s=(e.toString().split(".")[1]||"").length,a=r>s?r:s,n=parseInt(t.toFixed(a).replace(".","")),i=parseInt(e.toFixed(a).replace(".",""));return n%i/Math.pow(10,a)}class je extends V{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==b.number){const n=this._getOrReturnCtx(e);return y(n,{code:h.invalid_type,expected:b.number,received:n.parsedType}),C}let s;const a=new ee;for(const n of this._def.checks)n.kind==="int"?O.isInteger(e.data)||(s=this._getOrReturnCtx(e,s),y(s,{code:h.invalid_type,expected:"integer",received:"float",message:n.message}),a.dirty()):n.kind==="min"?(n.inclusive?e.data<n.value:e.data<=n.value)&&(s=this._getOrReturnCtx(e,s),y(s,{code:h.too_small,minimum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),a.dirty()):n.kind==="max"?(n.inclusive?e.data>n.value:e.data>=n.value)&&(s=this._getOrReturnCtx(e,s),y(s,{code:h.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),a.dirty()):n.kind==="multipleOf"?Vn(e.data,n.value)!==0&&(s=this._getOrReturnCtx(e,s),y(s,{code:h.not_multiple_of,multipleOf:n.value,message:n.message}),a.dirty()):n.kind==="finite"?Number.isFinite(e.data)||(s=this._getOrReturnCtx(e,s),y(s,{code:h.not_finite,message:n.message}),a.dirty()):O.assertNever(n);return{status:a.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,k.toString(r))}gt(e,r){return this.setLimit("min",e,!1,k.toString(r))}lte(e,r){return this.setLimit("max",e,!0,k.toString(r))}lt(e,r){return this.setLimit("max",e,!1,k.toString(r))}setLimit(e,r,s,a){return new je({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:s,message:k.toString(a)}]})}_addCheck(e){return new je({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:k.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:k.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:k.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:k.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:k.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:k.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:k.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:k.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:k.toString(e)})}get minValue(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&O.isInteger(e.value))}get isFinite(){let e=null,r=null;for(const s of this._def.checks){if(s.kind==="finite"||s.kind==="int"||s.kind==="multipleOf")return!0;s.kind==="min"?(r===null||s.value>r)&&(r=s.value):s.kind==="max"&&(e===null||s.value<e)&&(e=s.value)}return Number.isFinite(r)&&Number.isFinite(e)}}je.create=t=>new je({checks:[],typeName:S.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...A(t)});class De extends V{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce&&(e.data=BigInt(e.data)),this._getType(e)!==b.bigint){const n=this._getOrReturnCtx(e);return y(n,{code:h.invalid_type,expected:b.bigint,received:n.parsedType}),C}let s;const a=new ee;for(const n of this._def.checks)n.kind==="min"?(n.inclusive?e.data<n.value:e.data<=n.value)&&(s=this._getOrReturnCtx(e,s),y(s,{code:h.too_small,type:"bigint",minimum:n.value,inclusive:n.inclusive,message:n.message}),a.dirty()):n.kind==="max"?(n.inclusive?e.data>n.value:e.data>=n.value)&&(s=this._getOrReturnCtx(e,s),y(s,{code:h.too_big,type:"bigint",maximum:n.value,inclusive:n.inclusive,message:n.message}),a.dirty()):n.kind==="multipleOf"?e.data%n.value!==BigInt(0)&&(s=this._getOrReturnCtx(e,s),y(s,{code:h.not_multiple_of,multipleOf:n.value,message:n.message}),a.dirty()):O.assertNever(n);return{status:a.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,k.toString(r))}gt(e,r){return this.setLimit("min",e,!1,k.toString(r))}lte(e,r){return this.setLimit("max",e,!0,k.toString(r))}lt(e,r){return this.setLimit("max",e,!1,k.toString(r))}setLimit(e,r,s,a){return new De({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:s,message:k.toString(a)}]})}_addCheck(e){return new De({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:k.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:k.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:k.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:k.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:k.toString(r)})}get minValue(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}}De.create=t=>{var e;return new De({checks:[],typeName:S.ZodBigInt,coerce:(e=t==null?void 0:t.coerce)!==null&&e!==void 0?e:!1,...A(t)})};class ft extends V{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==b.boolean){const s=this._getOrReturnCtx(e);return y(s,{code:h.invalid_type,expected:b.boolean,received:s.parsedType}),C}return ne(e.data)}}ft.create=t=>new ft({typeName:S.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...A(t)});class ze extends V{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==b.date){const n=this._getOrReturnCtx(e);return y(n,{code:h.invalid_type,expected:b.date,received:n.parsedType}),C}if(isNaN(e.data.getTime())){const n=this._getOrReturnCtx(e);return y(n,{code:h.invalid_date}),C}const s=new ee;let a;for(const n of this._def.checks)n.kind==="min"?e.data.getTime()<n.value&&(a=this._getOrReturnCtx(e,a),y(a,{code:h.too_small,message:n.message,inclusive:!0,exact:!1,minimum:n.value,type:"date"}),s.dirty()):n.kind==="max"?e.data.getTime()>n.value&&(a=this._getOrReturnCtx(e,a),y(a,{code:h.too_big,message:n.message,inclusive:!0,exact:!1,maximum:n.value,type:"date"}),s.dirty()):O.assertNever(n);return{status:s.value,value:new Date(e.data.getTime())}}_addCheck(e){return new ze({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:k.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:k.toString(r)})}get minDate(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}}ze.create=t=>new ze({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:S.ZodDate,...A(t)});class Dt extends V{_parse(e){if(this._getType(e)!==b.symbol){const s=this._getOrReturnCtx(e);return y(s,{code:h.invalid_type,expected:b.symbol,received:s.parsedType}),C}return ne(e.data)}}Dt.create=t=>new Dt({typeName:S.ZodSymbol,...A(t)});class ht extends V{_parse(e){if(this._getType(e)!==b.undefined){const s=this._getOrReturnCtx(e);return y(s,{code:h.invalid_type,expected:b.undefined,received:s.parsedType}),C}return ne(e.data)}}ht.create=t=>new ht({typeName:S.ZodUndefined,...A(t)});class pt extends V{_parse(e){if(this._getType(e)!==b.null){const s=this._getOrReturnCtx(e);return y(s,{code:h.invalid_type,expected:b.null,received:s.parsedType}),C}return ne(e.data)}}pt.create=t=>new pt({typeName:S.ZodNull,...A(t)});class Qe extends V{constructor(){super(...arguments),this._any=!0}_parse(e){return ne(e.data)}}Qe.create=t=>new Qe({typeName:S.ZodAny,...A(t)});class Ue extends V{constructor(){super(...arguments),this._unknown=!0}_parse(e){return ne(e.data)}}Ue.create=t=>new Ue({typeName:S.ZodUnknown,...A(t)});class Ee extends V{_parse(e){const r=this._getOrReturnCtx(e);return y(r,{code:h.invalid_type,expected:b.never,received:r.parsedType}),C}}Ee.create=t=>new Ee({typeName:S.ZodNever,...A(t)});class Lt extends V{_parse(e){if(this._getType(e)!==b.undefined){const s=this._getOrReturnCtx(e);return y(s,{code:h.invalid_type,expected:b.void,received:s.parsedType}),C}return ne(e.data)}}Lt.create=t=>new Lt({typeName:S.ZodVoid,...A(t)});class he extends V{_parse(e){const{ctx:r,status:s}=this._processInputParams(e),a=this._def;if(r.parsedType!==b.array)return y(r,{code:h.invalid_type,expected:b.array,received:r.parsedType}),C;if(a.exactLength!==null){const i=r.data.length>a.exactLength.value,o=r.data.length<a.exactLength.value;(i||o)&&(y(r,{code:i?h.too_big:h.too_small,minimum:o?a.exactLength.value:void 0,maximum:i?a.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:a.exactLength.message}),s.dirty())}if(a.minLength!==null&&r.data.length<a.minLength.value&&(y(r,{code:h.too_small,minimum:a.minLength.value,type:"array",inclusive:!0,exact:!1,message:a.minLength.message}),s.dirty()),a.maxLength!==null&&r.data.length>a.maxLength.value&&(y(r,{code:h.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),s.dirty()),r.common.async)return Promise.all([...r.data].map((i,o)=>a.type._parseAsync(new ve(r,i,r.path,o)))).then(i=>ee.mergeArray(s,i));const n=[...r.data].map((i,o)=>a.type._parseSync(new ve(r,i,r.path,o)));return ee.mergeArray(s,n)}get element(){return this._def.type}min(e,r){return new he({...this._def,minLength:{value:e,message:k.toString(r)}})}max(e,r){return new he({...this._def,maxLength:{value:e,message:k.toString(r)}})}length(e,r){return new he({...this._def,exactLength:{value:e,message:k.toString(r)}})}nonempty(e){return this.min(1,e)}}he.create=(t,e)=>new he({type:t,minLength:null,maxLength:null,exactLength:null,typeName:S.ZodArray,...A(e)});function et(t){if(t instanceof z){const e={};for(const r in t.shape){const s=t.shape[r];e[r]=_e.create(et(s))}return new z({...t._def,shape:()=>e})}else return t instanceof he?new he({...t._def,type:et(t.element)}):t instanceof _e?_e.create(et(t.unwrap())):t instanceof Pe?Pe.create(et(t.unwrap())):t instanceof be?be.create(t.items.map(e=>et(e))):t}class z extends V{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),r=O.objectKeys(e);return this._cached={shape:e,keys:r}}_parse(e){if(this._getType(e)!==b.object){const f=this._getOrReturnCtx(e);return y(f,{code:h.invalid_type,expected:b.object,received:f.parsedType}),C}const{status:s,ctx:a}=this._processInputParams(e),{shape:n,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof Ee&&this._def.unknownKeys==="strip"))for(const f in a.data)i.includes(f)||o.push(f);const u=[];for(const f of i){const p=n[f],x=a.data[f];u.push({key:{status:"valid",value:f},value:p._parse(new ve(a,x,a.path,f)),alwaysSet:f in a.data})}if(this._def.catchall instanceof Ee){const f=this._def.unknownKeys;if(f==="passthrough")for(const p of o)u.push({key:{status:"valid",value:p},value:{status:"valid",value:a.data[p]}});else if(f==="strict")o.length>0&&(y(a,{code:h.unrecognized_keys,keys:o}),s.dirty());else if(f!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const f=this._def.catchall;for(const p of o){const x=a.data[p];u.push({key:{status:"valid",value:p},value:f._parse(new ve(a,x,a.path,p)),alwaysSet:p in a.data})}}return a.common.async?Promise.resolve().then(async()=>{const f=[];for(const p of u){const x=await p.key,Y=await p.value;f.push({key:x,value:Y,alwaysSet:p.alwaysSet})}return f}).then(f=>ee.mergeObjectSync(s,f)):ee.mergeObjectSync(s,u)}get shape(){return this._def.shape()}strict(e){return k.errToObj,new z({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,s)=>{var a,n,i,o;const u=(i=(n=(a=this._def).errorMap)===null||n===void 0?void 0:n.call(a,r,s).message)!==null&&i!==void 0?i:s.defaultError;return r.code==="unrecognized_keys"?{message:(o=k.errToObj(e).message)!==null&&o!==void 0?o:u}:{message:u}}}:{}})}strip(){return new z({...this._def,unknownKeys:"strip"})}passthrough(){return new z({...this._def,unknownKeys:"passthrough"})}extend(e){return new z({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new z({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:S.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new z({...this._def,catchall:e})}pick(e){const r={};return O.objectKeys(e).forEach(s=>{e[s]&&this.shape[s]&&(r[s]=this.shape[s])}),new z({...this._def,shape:()=>r})}omit(e){const r={};return O.objectKeys(this.shape).forEach(s=>{e[s]||(r[s]=this.shape[s])}),new z({...this._def,shape:()=>r})}deepPartial(){return et(this)}partial(e){const r={};return O.objectKeys(this.shape).forEach(s=>{const a=this.shape[s];e&&!e[s]?r[s]=a:r[s]=a.optional()}),new z({...this._def,shape:()=>r})}required(e){const r={};return O.objectKeys(this.shape).forEach(s=>{if(e&&!e[s])r[s]=this.shape[s];else{let n=this.shape[s];for(;n instanceof _e;)n=n._def.innerType;r[s]=n}}),new z({...this._def,shape:()=>r})}keyof(){return Wr(O.objectKeys(this.shape))}}z.create=(t,e)=>new z({shape:()=>t,unknownKeys:"strip",catchall:Ee.create(),typeName:S.ZodObject,...A(e)}),z.strictCreate=(t,e)=>new z({shape:()=>t,unknownKeys:"strict",catchall:Ee.create(),typeName:S.ZodObject,...A(e)}),z.lazycreate=(t,e)=>new z({shape:t,unknownKeys:"strip",catchall:Ee.create(),typeName:S.ZodObject,...A(e)});class mt extends V{_parse(e){const{ctx:r}=this._processInputParams(e),s=this._def.options;function a(n){for(const o of n)if(o.result.status==="valid")return o.result;for(const o of n)if(o.result.status==="dirty")return r.common.issues.push(...o.ctx.common.issues),o.result;const i=n.map(o=>new le(o.ctx.common.issues));return y(r,{code:h.invalid_union,unionErrors:i}),C}if(r.common.async)return Promise.all(s.map(async n=>{const i={...r,common:{...r.common,issues:[]},parent:null};return{result:await n._parseAsync({data:r.data,path:r.path,parent:i}),ctx:i}})).then(a);{let n;const i=[];for(const u of s){const f={...r,common:{...r.common,issues:[]},parent:null},p=u._parseSync({data:r.data,path:r.path,parent:f});if(p.status==="valid")return p;p.status==="dirty"&&!n&&(n={result:p,ctx:f}),f.common.issues.length&&i.push(f.common.issues)}if(n)return r.common.issues.push(...n.ctx.common.issues),n.result;const o=i.map(u=>new le(u));return y(r,{code:h.invalid_union,unionErrors:o}),C}}get options(){return this._def.options}}mt.create=(t,e)=>new mt({options:t,typeName:S.ZodUnion,...A(e)});const Ae=t=>t instanceof vt?Ae(t.schema):t instanceof pe?Ae(t.innerType()):t instanceof bt?[t.value]:t instanceof Le?t.options:t instanceof _t?O.objectValues(t.enum):t instanceof xt?Ae(t._def.innerType):t instanceof ht?[void 0]:t instanceof pt?[null]:t instanceof _e?[void 0,...Ae(t.unwrap())]:t instanceof Pe?[null,...Ae(t.unwrap())]:t instanceof sr||t instanceof Tt?Ae(t.unwrap()):t instanceof wt?Ae(t._def.innerType):[];class Pt extends V{_parse(e){const{ctx:r}=this._processInputParams(e);if(r.parsedType!==b.object)return y(r,{code:h.invalid_type,expected:b.object,received:r.parsedType}),C;const s=this.discriminator,a=r.data[s],n=this.optionsMap.get(a);return n?r.common.async?n._parseAsync({data:r.data,path:r.path,parent:r}):n._parseSync({data:r.data,path:r.path,parent:r}):(y(r,{code:h.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[s]}),C)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,s){const a=new Map;for(const n of r){const i=Ae(n.shape[e]);if(!i.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const o of i){if(a.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);a.set(o,n)}}return new Pt({typeName:S.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:a,...A(s)})}}function rr(t,e){const r=Me(t),s=Me(e);if(t===e)return{valid:!0,data:t};if(r===b.object&&s===b.object){const a=O.objectKeys(e),n=O.objectKeys(t).filter(o=>a.indexOf(o)!==-1),i={...t,...e};for(const o of n){const u=rr(t[o],e[o]);if(!u.valid)return{valid:!1};i[o]=u.data}return{valid:!0,data:i}}else if(r===b.array&&s===b.array){if(t.length!==e.length)return{valid:!1};const a=[];for(let n=0;n<t.length;n++){const i=t[n],o=e[n],u=rr(i,o);if(!u.valid)return{valid:!1};a.push(u.data)}return{valid:!0,data:a}}else return r===b.date&&s===b.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}class gt extends V{_parse(e){const{status:r,ctx:s}=this._processInputParams(e),a=(n,i)=>{if(Qt(n)||Qt(i))return C;const o=rr(n.value,i.value);return o.valid?((er(n)||er(i))&&r.dirty(),{status:r.value,value:o.data}):(y(s,{code:h.invalid_intersection_types}),C)};return s.common.async?Promise.all([this._def.left._parseAsync({data:s.data,path:s.path,parent:s}),this._def.right._parseAsync({data:s.data,path:s.path,parent:s})]).then(([n,i])=>a(n,i)):a(this._def.left._parseSync({data:s.data,path:s.path,parent:s}),this._def.right._parseSync({data:s.data,path:s.path,parent:s}))}}gt.create=(t,e,r)=>new gt({left:t,right:e,typeName:S.ZodIntersection,...A(r)});class be extends V{_parse(e){const{status:r,ctx:s}=this._processInputParams(e);if(s.parsedType!==b.array)return y(s,{code:h.invalid_type,expected:b.array,received:s.parsedType}),C;if(s.data.length<this._def.items.length)return y(s,{code:h.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),C;!this._def.rest&&s.data.length>this._def.items.length&&(y(s,{code:h.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());const n=[...s.data].map((i,o)=>{const u=this._def.items[o]||this._def.rest;return u?u._parse(new ve(s,i,s.path,o)):null}).filter(i=>!!i);return s.common.async?Promise.all(n).then(i=>ee.mergeArray(r,i)):ee.mergeArray(r,n)}get items(){return this._def.items}rest(e){return new be({...this._def,rest:e})}}be.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new be({items:t,typeName:S.ZodTuple,rest:null,...A(e)})};class yt extends V{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:r,ctx:s}=this._processInputParams(e);if(s.parsedType!==b.object)return y(s,{code:h.invalid_type,expected:b.object,received:s.parsedType}),C;const a=[],n=this._def.keyType,i=this._def.valueType;for(const o in s.data)a.push({key:n._parse(new ve(s,o,s.path,o)),value:i._parse(new ve(s,s.data[o],s.path,o)),alwaysSet:o in s.data});return s.common.async?ee.mergeObjectAsync(r,a):ee.mergeObjectSync(r,a)}get element(){return this._def.valueType}static create(e,r,s){return r instanceof V?new yt({keyType:e,valueType:r,typeName:S.ZodRecord,...A(s)}):new yt({keyType:fe.create(),valueType:e,typeName:S.ZodRecord,...A(r)})}}class Ft extends V{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:r,ctx:s}=this._processInputParams(e);if(s.parsedType!==b.map)return y(s,{code:h.invalid_type,expected:b.map,received:s.parsedType}),C;const a=this._def.keyType,n=this._def.valueType,i=[...s.data.entries()].map(([o,u],f)=>({key:a._parse(new ve(s,o,s.path,[f,"key"])),value:n._parse(new ve(s,u,s.path,[f,"value"]))}));if(s.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const u of i){const f=await u.key,p=await u.value;if(f.status==="aborted"||p.status==="aborted")return C;(f.status==="dirty"||p.status==="dirty")&&r.dirty(),o.set(f.value,p.value)}return{status:r.value,value:o}})}else{const o=new Map;for(const u of i){const f=u.key,p=u.value;if(f.status==="aborted"||p.status==="aborted")return C;(f.status==="dirty"||p.status==="dirty")&&r.dirty(),o.set(f.value,p.value)}return{status:r.value,value:o}}}}Ft.create=(t,e,r)=>new Ft({valueType:e,keyType:t,typeName:S.ZodMap,...A(r)});class Be extends V{_parse(e){const{status:r,ctx:s}=this._processInputParams(e);if(s.parsedType!==b.set)return y(s,{code:h.invalid_type,expected:b.set,received:s.parsedType}),C;const a=this._def;a.minSize!==null&&s.data.size<a.minSize.value&&(y(s,{code:h.too_small,minimum:a.minSize.value,type:"set",inclusive:!0,exact:!1,message:a.minSize.message}),r.dirty()),a.maxSize!==null&&s.data.size>a.maxSize.value&&(y(s,{code:h.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),r.dirty());const n=this._def.valueType;function i(u){const f=new Set;for(const p of u){if(p.status==="aborted")return C;p.status==="dirty"&&r.dirty(),f.add(p.value)}return{status:r.value,value:f}}const o=[...s.data.values()].map((u,f)=>n._parse(new ve(s,u,s.path,f)));return s.common.async?Promise.all(o).then(u=>i(u)):i(o)}min(e,r){return new Be({...this._def,minSize:{value:e,message:k.toString(r)}})}max(e,r){return new Be({...this._def,maxSize:{value:e,message:k.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}}Be.create=(t,e)=>new Be({valueType:t,minSize:null,maxSize:null,typeName:S.ZodSet,...A(e)});class tt extends V{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:r}=this._processInputParams(e);if(r.parsedType!==b.function)return y(r,{code:h.invalid_type,expected:b.function,received:r.parsedType}),C;function s(o,u){return Mt({data:o,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Rt(),Xe].filter(f=>!!f),issueData:{code:h.invalid_arguments,argumentsError:u}})}function a(o,u){return Mt({data:o,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Rt(),Xe].filter(f=>!!f),issueData:{code:h.invalid_return_type,returnTypeError:u}})}const n={errorMap:r.common.contextualErrorMap},i=r.data;if(this._def.returns instanceof rt){const o=this;return ne(async function(...u){const f=new le([]),p=await o._def.args.parseAsync(u,n).catch(B=>{throw f.addIssue(s(u,B)),f}),x=await Reflect.apply(i,this,p);return await o._def.returns._def.type.parseAsync(x,n).catch(B=>{throw f.addIssue(a(x,B)),f})})}else{const o=this;return ne(function(...u){const f=o._def.args.safeParse(u,n);if(!f.success)throw new le([s(u,f.error)]);const p=Reflect.apply(i,this,f.data),x=o._def.returns.safeParse(p,n);if(!x.success)throw new le([a(p,x.error)]);return x.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new tt({...this._def,args:be.create(e).rest(Ue.create())})}returns(e){return new tt({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,s){return new tt({args:e||be.create([]).rest(Ue.create()),returns:r||Ue.create(),typeName:S.ZodFunction,...A(s)})}}class vt extends V{get schema(){return this._def.getter()}_parse(e){const{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}}vt.create=(t,e)=>new vt({getter:t,typeName:S.ZodLazy,...A(e)});class bt extends V{_parse(e){if(e.data!==this._def.value){const r=this._getOrReturnCtx(e);return y(r,{received:r.data,code:h.invalid_literal,expected:this._def.value}),C}return{status:"valid",value:e.data}}get value(){return this._def.value}}bt.create=(t,e)=>new bt({value:t,typeName:S.ZodLiteral,...A(e)});function Wr(t,e){return new Le({values:t,typeName:S.ZodEnum,...A(e)})}class Le extends V{constructor(){super(...arguments),dt.set(this,void 0)}_parse(e){if(typeof e.data!="string"){const r=this._getOrReturnCtx(e),s=this._def.values;return y(r,{expected:O.joinValues(s),received:r.parsedType,code:h.invalid_type}),C}if(jt(this,dt)||Fr(this,dt,new Set(this._def.values)),!jt(this,dt).has(e.data)){const r=this._getOrReturnCtx(e),s=this._def.values;return y(r,{received:r.data,code:h.invalid_enum_value,options:s}),C}return ne(e.data)}get options(){return this._def.values}get enum(){const e={};for(const r of this._def.values)e[r]=r;return e}get Values(){const e={};for(const r of this._def.values)e[r]=r;return e}get Enum(){const e={};for(const r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return Le.create(e,{...this._def,...r})}exclude(e,r=this._def){return Le.create(this.options.filter(s=>!e.includes(s)),{...this._def,...r})}}dt=new WeakMap,Le.create=Wr;class _t extends V{constructor(){super(...arguments),ut.set(this,void 0)}_parse(e){const r=O.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(e);if(s.parsedType!==b.string&&s.parsedType!==b.number){const a=O.objectValues(r);return y(s,{expected:O.joinValues(a),received:s.parsedType,code:h.invalid_type}),C}if(jt(this,ut)||Fr(this,ut,new Set(O.getValidEnumValues(this._def.values))),!jt(this,ut).has(e.data)){const a=O.objectValues(r);return y(s,{received:s.data,code:h.invalid_enum_value,options:a}),C}return ne(e.data)}get enum(){return this._def.values}}ut=new WeakMap,_t.create=(t,e)=>new _t({values:t,typeName:S.ZodNativeEnum,...A(e)});class rt extends V{unwrap(){return this._def.type}_parse(e){const{ctx:r}=this._processInputParams(e);if(r.parsedType!==b.promise&&r.common.async===!1)return y(r,{code:h.invalid_type,expected:b.promise,received:r.parsedType}),C;const s=r.parsedType===b.promise?r.data:Promise.resolve(r.data);return ne(s.then(a=>this._def.type.parseAsync(a,{path:r.path,errorMap:r.common.contextualErrorMap})))}}rt.create=(t,e)=>new rt({type:t,typeName:S.ZodPromise,...A(e)});class pe extends V{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===S.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:r,ctx:s}=this._processInputParams(e),a=this._def.effect||null,n={addIssue:i=>{y(s,i),i.fatal?r.abort():r.dirty()},get path(){return s.path}};if(n.addIssue=n.addIssue.bind(n),a.type==="preprocess"){const i=a.transform(s.data,n);if(s.common.async)return Promise.resolve(i).then(async o=>{if(r.value==="aborted")return C;const u=await this._def.schema._parseAsync({data:o,path:s.path,parent:s});return u.status==="aborted"?C:u.status==="dirty"||r.value==="dirty"?Ke(u.value):u});{if(r.value==="aborted")return C;const o=this._def.schema._parseSync({data:i,path:s.path,parent:s});return o.status==="aborted"?C:o.status==="dirty"||r.value==="dirty"?Ke(o.value):o}}if(a.type==="refinement"){const i=o=>{const u=a.refinement(o,n);if(s.common.async)return Promise.resolve(u);if(u instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(s.common.async===!1){const o=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});return o.status==="aborted"?C:(o.status==="dirty"&&r.dirty(),i(o.value),{status:r.value,value:o.value})}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(o=>o.status==="aborted"?C:(o.status==="dirty"&&r.dirty(),i(o.value).then(()=>({status:r.value,value:o.value}))))}if(a.type==="transform")if(s.common.async===!1){const i=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!lt(i))return i;const o=a.transform(i.value,n);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:o}}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(i=>lt(i)?Promise.resolve(a.transform(i.value,n)).then(o=>({status:r.value,value:o})):i);O.assertNever(a)}}pe.create=(t,e,r)=>new pe({schema:t,typeName:S.ZodEffects,effect:e,...A(r)}),pe.createWithPreprocess=(t,e,r)=>new pe({schema:e,effect:{type:"preprocess",transform:t},typeName:S.ZodEffects,...A(r)});class _e extends V{_parse(e){return this._getType(e)===b.undefined?ne(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}_e.create=(t,e)=>new _e({innerType:t,typeName:S.ZodOptional,...A(e)});class Pe extends V{_parse(e){return this._getType(e)===b.null?ne(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Pe.create=(t,e)=>new Pe({innerType:t,typeName:S.ZodNullable,...A(e)});class xt extends V{_parse(e){const{ctx:r}=this._processInputParams(e);let s=r.data;return r.parsedType===b.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:r.path,parent:r})}removeDefault(){return this._def.innerType}}xt.create=(t,e)=>new xt({innerType:t,typeName:S.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...A(e)});class wt extends V{_parse(e){const{ctx:r}=this._processInputParams(e),s={...r,common:{...r.common,issues:[]}},a=this._def.innerType._parse({data:s.data,path:s.path,parent:{...s}});return ct(a)?a.then(n=>({status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new le(s.common.issues)},input:s.data})})):{status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new le(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}}wt.create=(t,e)=>new wt({innerType:t,typeName:S.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...A(e)});class $t extends V{_parse(e){if(this._getType(e)!==b.nan){const s=this._getOrReturnCtx(e);return y(s,{code:h.invalid_type,expected:b.nan,received:s.parsedType}),C}return{status:"valid",value:e.data}}}$t.create=t=>new $t({typeName:S.ZodNaN,...A(t)});const On=Symbol("zod_brand");class sr extends V{_parse(e){const{ctx:r}=this._processInputParams(e),s=r.data;return this._def.type._parse({data:s,path:r.path,parent:r})}unwrap(){return this._def.type}}class kt extends V{_parse(e){const{status:r,ctx:s}=this._processInputParams(e);if(s.common.async)return(async()=>{const n=await this._def.in._parseAsync({data:s.data,path:s.path,parent:s});return n.status==="aborted"?C:n.status==="dirty"?(r.dirty(),Ke(n.value)):this._def.out._parseAsync({data:n.value,path:s.path,parent:s})})();{const a=this._def.in._parseSync({data:s.data,path:s.path,parent:s});return a.status==="aborted"?C:a.status==="dirty"?(r.dirty(),{status:"dirty",value:a.value}):this._def.out._parseSync({data:a.value,path:s.path,parent:s})}}static create(e,r){return new kt({in:e,out:r,typeName:S.ZodPipeline})}}class Tt extends V{_parse(e){const r=this._def.innerType._parse(e),s=a=>(lt(a)&&(a.value=Object.freeze(a.value)),a);return ct(r)?r.then(a=>s(a)):s(r)}unwrap(){return this._def.innerType}}Tt.create=(t,e)=>new Tt({innerType:t,typeName:S.ZodReadonly,...A(e)});function qr(t,e={},r){return t?Qe.create().superRefine((s,a)=>{var n,i;if(!t(s)){const o=typeof e=="function"?e(s):typeof e=="string"?{message:e}:e,u=(i=(n=o.fatal)!==null&&n!==void 0?n:r)!==null&&i!==void 0?i:!0,f=typeof o=="string"?{message:o}:o;a.addIssue({code:"custom",...f,fatal:u})}}):Qe.create()}const In={object:z.lazycreate};var S;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(S||(S={}));const Zn=(t,e={message:`Input not instance of ${t.name}`})=>qr(r=>r instanceof t,e),Gr=fe.create,Hr=je.create,Rn=$t.create,Mn=De.create,Yr=ft.create,jn=ze.create,Dn=Dt.create,Ln=ht.create,Pn=pt.create,Fn=Qe.create,$n=Ue.create,zn=Ee.create,Un=Lt.create,Bn=he.create,Wn=z.create,qn=z.strictCreate,Gn=mt.create,Hn=Pt.create,Yn=gt.create,Jn=be.create,Xn=yt.create,Kn=Ft.create,Qn=Be.create,ea=tt.create,ta=vt.create,ra=bt.create,sa=Le.create,na=_t.create,aa=rt.create,Jr=pe.create,ia=_e.create,oa=Pe.create,la=pe.createWithPreprocess,ca=kt.create;var U=Object.freeze({__proto__:null,defaultErrorMap:Xe,setErrorMap:pn,getErrorMap:Rt,makeIssue:Mt,EMPTY_PATH:mn,addIssueToContext:y,ParseStatus:ee,INVALID:C,DIRTY:Ke,OK:ne,isAborted:Qt,isDirty:er,isValid:lt,isAsync:ct,get util(){return O},get objectUtil(){return Kt},ZodParsedType:b,getParsedType:Me,ZodType:V,datetimeRegex:Br,ZodString:fe,ZodNumber:je,ZodBigInt:De,ZodBoolean:ft,ZodDate:ze,ZodSymbol:Dt,ZodUndefined:ht,ZodNull:pt,ZodAny:Qe,ZodUnknown:Ue,ZodNever:Ee,ZodVoid:Lt,ZodArray:he,ZodObject:z,ZodUnion:mt,ZodDiscriminatedUnion:Pt,ZodIntersection:gt,ZodTuple:be,ZodRecord:yt,ZodMap:Ft,ZodSet:Be,ZodFunction:tt,ZodLazy:vt,ZodLiteral:bt,ZodEnum:Le,ZodNativeEnum:_t,ZodPromise:rt,ZodEffects:pe,ZodTransformer:pe,ZodOptional:_e,ZodNullable:Pe,ZodDefault:xt,ZodCatch:wt,ZodNaN:$t,BRAND:On,ZodBranded:sr,ZodPipeline:kt,ZodReadonly:Tt,custom:qr,Schema:V,ZodSchema:V,late:In,get ZodFirstPartyTypeKind(){return S},coerce:{string:t=>fe.create({...t,coerce:!0}),number:t=>je.create({...t,coerce:!0}),boolean:t=>ft.create({...t,coerce:!0}),bigint:t=>De.create({...t,coerce:!0}),date:t=>ze.create({...t,coerce:!0})},any:Fn,array:Bn,bigint:Mn,boolean:Yr,date:jn,discriminatedUnion:Hn,effect:Jr,enum:sa,function:ea,instanceof:Zn,intersection:Yn,lazy:ta,literal:ra,map:Kn,nan:Rn,nativeEnum:na,never:zn,null:Pn,nullable:oa,number:Hr,object:Wn,oboolean:()=>Yr().optional(),onumber:()=>Hr().optional(),optional:ia,ostring:()=>Gr().optional(),pipeline:ca,preprocess:la,promise:aa,record:Xn,set:Qn,strictObject:qn,string:Gr,symbol:Dn,transformer:Jr,tuple:Jn,undefined:Ln,union:Gn,unknown:$n,void:Un,NEVER:C,ZodIssueCode:h,quotelessJson:hn,ZodError:le});const da=t=>{var r,s;const e={};for(const[a,n]of Object.entries(t)){let i;switch(n.type){case"string":n.optional?i=U.optional(U.string()):(i=U.string().min(1,{message:n.customMessage||"This field is required"}),n.minLength&&(i=i.min(n.minLength.value,n.minLength.message||`${Ce(a)} must be at least ${n.minLength.value} character long`)),n.maxLength&&(i=i.max(n.maxLength.value,n.maxLength.message||`${Ce(a)} must be at most ${n.maxLength.value} character`)),n.regex&&(i=i.regex(n.regex.value,n.regex.message)));break;case"email":n.optional?i=U.optional(U.string().email(n.customMessage||"Invalid email")):i=U.string().email(n.customMessage||"Invalid email");break;case"password":n.optional?i=U.optional(U.string()):(i=U.string().min(6,n.customMessage||`${Ce(a)} must be at least ${n.minLength?n.minLength.value:6} character long`),n.minLength&&(i=i.min(n.minLength.value,n.minLength.message||`${Ce(a)} must be at least ${n.minLength.value} character long`)),n.maxLength&&(i=i.max(n.maxLength.value,n.maxLength.message||`${Ce(a)} must be at most ${n.maxLength.value} character`)),n.regex&&(i=i.regex(n.regex.value,n.regex.message)));break;case"number":n.optional?i=U.optional(U.preprocess(o=>Number(o),U.number())):(i=U.preprocess(o=>Number(o),U.number()).refine(o=>Number(o),`${n.customMessage||"This field is required"}`),n.min&&(i=i.refine(o=>n.min&&typeof n.min.value=="number"?o>=n.min.value:o,{message:n.min.message||`${Ce(a)} must be greater than or equal to ${n.min.value}`})),n.max&&(i=i.refine(o=>n.max&&typeof n.max.value=="number"?o<=n.max.value:o,{message:n.max.message||`${Ce(a)} must be less than or equal to ${n.max.value}`})));break;case"date":n.optional?i=U.preprocess(o=>new Date(o),U.date()):(i=U.preprocess(o=>new Date(o),U.date()).refine(o=>new Date(o.toString()),n.customMessage||"Invalid date format"),n.min&&(i=i.refine(o=>{var u;return new Date(o.toString())>new Date((u=n.min)==null?void 0:u.value)},n.min.message||`${Ce(a)} must be greater than ${new Date((r=n.min)==null?void 0:r.value).toLocaleDateString("en-IN",{dateStyle:"medium"})}`)),n.max&&(i=i.refine(o=>{var u;return new Date(o.toString())<new Date((u=n.max)==null?void 0:u.value)},n.max.message||`${Ce(a)} must be less than ${new Date((s=n.max)==null?void 0:s.value).toLocaleDateString("en-IN",{dateStyle:"medium"})}`)));break;case"boolean":n.optional?i=U.preprocess(o=>o==="true"||o===!0,U.boolean()):i=U.preprocess(o=>o==="true"||o===!0,U.boolean()).refine(o=>!!o,{message:n.customMessage||"Invalid value"});break;default:throw new Error("Unsupported field type")}e[a]=i}return U.object(e)};Oe.createFormValidator=dn,Oe.useFormSchema=da,Object.defineProperty(Oe,Symbol.toStringTag,{value:"Module"})});
1
+ (function(Oe,M){typeof exports=="object"&&typeof module<"u"?M(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],M):(Oe=typeof globalThis<"u"?globalThis:Oe||self,M(Oe.Formaze={},Oe.React))})(this,function(Oe,M){"use strict";var st=t=>t.type==="checkbox",Ge=t=>t instanceof Date,se=t=>t==null;const lr=t=>typeof t=="object";var G=t=>!se(t)&&!Array.isArray(t)&&lr(t)&&!Ge(t),is=t=>G(t)&&t.target?st(t.target)?t.target.checked:t.target.value:t,os=t=>t.substring(0,t.search(/\.\d+(\.|$)/))||t,ls=(t,e)=>t.has(os(e)),cs=t=>{const e=t.constructor&&t.constructor.prototype;return G(e)&&e.hasOwnProperty("isPrototypeOf")},zt=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function ce(t){let e;const r=Array.isArray(t);if(t instanceof Date)e=new Date(t);else if(t instanceof Set)e=new Set(t);else if(!(zt&&(t instanceof Blob||t instanceof FileList))&&(r||G(t)))if(e=r?[]:{},!r&&!cs(t))e=t;else for(const s in t)t.hasOwnProperty(s)&&(e[s]=ce(t[s]));else return t;return e}var St=t=>Array.isArray(t)?t.filter(Boolean):[],W=t=>t===void 0,_=(t,e,r)=>{if(!e||!G(t))return r;const s=St(e.split(/[,[\].]+?/)).reduce((a,n)=>se(a)?a:a[n],t);return W(s)||s===t?W(t[e])?r:t[e]:s},ge=t=>typeof t=="boolean",Ut=t=>/^\w*$/.test(t),cr=t=>St(t.replace(/["|']|\]/g,"").split(/\.|\[/)),j=(t,e,r)=>{let s=-1;const a=Ut(e)?[e]:cr(e),n=a.length,i=n-1;for(;++s<n;){const o=a[s];let u=r;if(s!==i){const f=t[o];u=G(f)||Array.isArray(f)?f:isNaN(+a[s+1])?{}:[]}if(o==="__proto__")return;t[o]=u,t=t[o]}return t};const dr={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},ue={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},ke={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},ur=M.createContext(null),fr=()=>M.useContext(ur),ds=t=>{const{children:e,...r}=t;return M.createElement(ur.Provider,{value:r},e)};var us=(t,e,r,s=!0)=>{const a={defaultValues:e._defaultValues};for(const n in t)Object.defineProperty(a,n,{get:()=>{const i=n;return e._proxyFormState[i]!==ue.all&&(e._proxyFormState[i]=!s||ue.all),t[i]}});return a},oe=t=>G(t)&&!Object.keys(t).length,fs=(t,e,r,s)=>{r(t);const{name:a,...n}=t;return oe(n)||Object.keys(n).length>=Object.keys(e).length||Object.keys(n).find(i=>e[i]===ue.all)},Ct=t=>Array.isArray(t)?t:[t];function hs(t){const e=M.useRef(t);e.current=t,M.useEffect(()=>{const r=!t.disabled&&e.current.subject&&e.current.subject.subscribe({next:e.current.next});return()=>{r&&r.unsubscribe()}},[t.disabled])}var ye=t=>typeof t=="string",ps=(t,e,r,s,a)=>ye(t)?(s&&e.watch.add(t),_(r,t,a)):Array.isArray(t)?t.map(n=>(s&&e.watch.add(n),_(r,n))):(s&&(e.watchAll=!0),r),hr=(t,e,r,s,a)=>e?{...r[t],types:{...r[t]&&r[t].types?r[t].types:{},[s]:a||!0}}:{},pr=t=>({isOnSubmit:!t||t===ue.onSubmit,isOnBlur:t===ue.onBlur,isOnChange:t===ue.onChange,isOnAll:t===ue.all,isOnTouch:t===ue.onTouched}),mr=(t,e,r)=>!r&&(e.watchAll||e.watch.has(t)||[...e.watch].some(s=>t.startsWith(s)&&/^\.\w+/.test(t.slice(s.length))));const nt=(t,e,r,s)=>{for(const a of r||Object.keys(t)){const n=_(t,a);if(n){const{_f:i,...o}=n;if(i){if(i.refs&&i.refs[0]&&e(i.refs[0],a)&&!s)return!0;if(i.ref&&e(i.ref,i.name)&&!s)return!0;if(nt(o,e))break}else if(G(o)&&nt(o,e))break}}};var ms=(t,e,r)=>{const s=Ct(_(t,r));return j(s,"root",e[r]),j(t,r,s),t},Bt=t=>t.type==="file",Te=t=>typeof t=="function",Et=t=>{if(!zt)return!1;const e=t?t.ownerDocument:0;return t instanceof(e&&e.defaultView?e.defaultView.HTMLElement:HTMLElement)},At=t=>ye(t),Wt=t=>t.type==="radio",Nt=t=>t instanceof RegExp;const gr={value:!1,isValid:!1},yr={value:!0,isValid:!0};var vr=t=>{if(Array.isArray(t)){if(t.length>1){const e=t.filter(r=>r&&r.checked&&!r.disabled).map(r=>r.value);return{value:e,isValid:!!e.length}}return t[0].checked&&!t[0].disabled?t[0].attributes&&!W(t[0].attributes.value)?W(t[0].value)||t[0].value===""?yr:{value:t[0].value,isValid:!0}:yr:gr}return gr};const br={isValid:!1,value:null};var _r=t=>Array.isArray(t)?t.reduce((e,r)=>r&&r.checked&&!r.disabled?{isValid:!0,value:r.value}:e,br):br;function xr(t,e,r="validate"){if(At(t)||Array.isArray(t)&&t.every(At)||ge(t)&&!t)return{type:r,message:At(t)?t:"",ref:e}}var He=t=>G(t)&&!Nt(t)?t:{value:t,message:""},wr=async(t,e,r,s,a)=>{const{ref:n,refs:i,required:o,maxLength:u,minLength:f,min:p,max:x,pattern:Y,validate:B,name:P,valueAsNumber:q,mount:Z,disabled:L}=t._f,E=_(e,P);if(!Z||L)return{};const ae=i?i[0]:n,Q=w=>{s&&ae.reportValidity&&(ae.setCustomValidity(ge(w)?"":w||""),ae.reportValidity())},F={},Ne=Wt(n),We=st(n),xe=Ne||We,we=(q||Bt(n))&&W(n.value)&&W(E)||Et(n)&&n.value===""||E===""||Array.isArray(E)&&!E.length,te=hr.bind(null,P,r,F),Fe=(w,I,$,J=ke.maxLength,re=ke.minLength)=>{const ie=w?I:$;F[P]={type:w?J:re,message:ie,ref:n,...te(w?J:re,ie)}};if(a?!Array.isArray(E)||!E.length:o&&(!xe&&(we||se(E))||ge(E)&&!E||We&&!vr(i).isValid||Ne&&!_r(i).isValid)){const{value:w,message:I}=At(o)?{value:!!o,message:o}:He(o);if(w&&(F[P]={type:ke.required,message:I,ref:ae,...te(ke.required,I)},!r))return Q(I),F}if(!we&&(!se(p)||!se(x))){let w,I;const $=He(x),J=He(p);if(!se(E)&&!isNaN(E)){const re=n.valueAsNumber||E&&+E;se($.value)||(w=re>$.value),se(J.value)||(I=re<J.value)}else{const re=n.valueAsDate||new Date(E),ie=$e=>new Date(new Date().toDateString()+" "+$e),Ve=n.type=="time",me=n.type=="week";ye($.value)&&E&&(w=Ve?ie(E)>ie($.value):me?E>$.value:re>new Date($.value)),ye(J.value)&&E&&(I=Ve?ie(E)<ie(J.value):me?E<J.value:re<new Date(J.value))}if((w||I)&&(Fe(!!w,$.message,J.message,ke.max,ke.min),!r))return Q(F[P].message),F}if((u||f)&&!we&&(ye(E)||a&&Array.isArray(E))){const w=He(u),I=He(f),$=!se(w.value)&&E.length>+w.value,J=!se(I.value)&&E.length<+I.value;if(($||J)&&(Fe($,w.message,I.message),!r))return Q(F[P].message),F}if(Y&&!we&&ye(E)){const{value:w,message:I}=He(Y);if(Nt(w)&&!E.match(w)&&(F[P]={type:ke.pattern,message:I,ref:n,...te(ke.pattern,I)},!r))return Q(I),F}if(B){if(Te(B)){const w=await B(E,e),I=xr(w,ae);if(I&&(F[P]={...I,...te(ke.validate,I.message)},!r))return Q(I.message),F}else if(G(B)){let w={};for(const I in B){if(!oe(w)&&!r)break;const $=xr(await B[I](E,e),ae,I);$&&(w={...$,...te(I,$.message)},Q($.message),r&&(F[P]=w))}if(!oe(w)&&(F[P]={ref:ae,...w},!r))return F}}return Q(!0),F};function gs(t,e){const r=e.slice(0,-1).length;let s=0;for(;s<r;)t=W(t)?s++:t[e[s++]];return t}function ys(t){for(const e in t)if(t.hasOwnProperty(e)&&!W(t[e]))return!1;return!0}function H(t,e){const r=Array.isArray(e)?e:Ut(e)?[e]:cr(e),s=r.length===1?t:gs(t,r),a=r.length-1,n=r[a];return s&&delete s[n],a!==0&&(G(s)&&oe(s)||Array.isArray(s)&&ys(s))&&H(t,r.slice(0,-1)),t}var qt=()=>{let t=[];return{get observers(){return t},next:a=>{for(const n of t)n.next&&n.next(a)},subscribe:a=>(t.push(a),{unsubscribe:()=>{t=t.filter(n=>n!==a)}}),unsubscribe:()=>{t=[]}}},Vt=t=>se(t)||!lr(t);function Ie(t,e){if(Vt(t)||Vt(e))return t===e;if(Ge(t)&&Ge(e))return t.getTime()===e.getTime();const r=Object.keys(t),s=Object.keys(e);if(r.length!==s.length)return!1;for(const a of r){const n=t[a];if(!s.includes(a))return!1;if(a!=="ref"){const i=e[a];if(Ge(n)&&Ge(i)||G(n)&&G(i)||Array.isArray(n)&&Array.isArray(i)?!Ie(n,i):n!==i)return!1}}return!0}var kr=t=>t.type==="select-multiple",vs=t=>Wt(t)||st(t),Gt=t=>Et(t)&&t.isConnected,Tr=t=>{for(const e in t)if(Te(t[e]))return!0;return!1};function Ot(t,e={}){const r=Array.isArray(t);if(G(t)||r)for(const s in t)Array.isArray(t[s])||G(t[s])&&!Tr(t[s])?(e[s]=Array.isArray(t[s])?[]:{},Ot(t[s],e[s])):se(t[s])||(e[s]=!0);return e}function Sr(t,e,r){const s=Array.isArray(t);if(G(t)||s)for(const a in t)Array.isArray(t[a])||G(t[a])&&!Tr(t[a])?W(e)||Vt(r[a])?r[a]=Array.isArray(t[a])?Ot(t[a],[]):{...Ot(t[a])}:Sr(t[a],se(e)?{}:e[a],r[a]):r[a]=!Ie(t[a],e[a]);return r}var It=(t,e)=>Sr(t,e,Ot(e)),Cr=(t,{valueAsNumber:e,valueAsDate:r,setValueAs:s})=>W(t)?t:e?t===""?NaN:t&&+t:r&&ye(t)?new Date(t):s?s(t):t;function Ht(t){const e=t.ref;if(!(t.refs?t.refs.every(r=>r.disabled):e.disabled))return Bt(e)?e.files:Wt(e)?_r(t.refs).value:kr(e)?[...e.selectedOptions].map(({value:r})=>r):st(e)?vr(t.refs).value:Cr(W(e.value)?t.ref.value:e.value,t)}var bs=(t,e,r,s)=>{const a={};for(const n of t){const i=_(e,n);i&&j(a,n,i._f)}return{criteriaMode:r,names:[...t],fields:a,shouldUseNativeValidation:s}},at=t=>W(t)?t:Nt(t)?t.source:G(t)?Nt(t.value)?t.value.source:t.value:t;const Er="AsyncFunction";var _s=t=>(!t||!t.validate)&&!!(Te(t.validate)&&t.validate.constructor.name===Er||G(t.validate)&&Object.values(t.validate).find(e=>e.constructor.name===Er)),xs=t=>t.mount&&(t.required||t.min||t.max||t.maxLength||t.minLength||t.pattern||t.validate);function Ar(t,e,r){const s=_(t,r);if(s||Ut(r))return{error:s,name:r};const a=r.split(".");for(;a.length;){const n=a.join("."),i=_(e,n),o=_(t,n);if(i&&!Array.isArray(i)&&r!==n)return{name:r};if(o&&o.type)return{name:n,error:o};a.pop()}return{name:r}}var ws=(t,e,r,s,a)=>a.isOnAll?!1:!r&&a.isOnTouch?!(e||t):(r?s.isOnBlur:a.isOnBlur)?!t:(r?s.isOnChange:a.isOnChange)?t:!0,ks=(t,e)=>!St(_(t,e)).length&&H(t,e);const Ts={mode:ue.onSubmit,reValidateMode:ue.onChange,shouldFocusError:!0};function Ss(t={}){let e={...Ts,...t},r={submitCount:0,isDirty:!1,isLoading:Te(e.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1},s={},a=G(e.defaultValues)||G(e.values)?ce(e.defaultValues||e.values)||{}:{},n=e.shouldUnregister?{}:ce(a),i={action:!1,mount:!1,watch:!1},o={mount:new Set,unMount:new Set,array:new Set,watch:new Set},u,f=0;const p={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},x={values:qt(),array:qt(),state:qt()},Y=pr(e.mode),B=pr(e.reValidateMode),P=e.criteriaMode===ue.all,q=l=>c=>{clearTimeout(f),f=setTimeout(l,c)},Z=async l=>{if(p.isValid||l){const c=e.resolver?oe((await xe()).errors):await te(s,!0);c!==r.isValid&&x.state.next({isValid:c})}},L=(l,c)=>{(p.isValidating||p.validatingFields)&&((l||Array.from(o.mount)).forEach(d=>{d&&(c?j(r.validatingFields,d,c):H(r.validatingFields,d))}),x.state.next({validatingFields:r.validatingFields,isValidating:!oe(r.validatingFields)}))},E=(l,c=[],d,v,g=!0,m=!0)=>{if(v&&d){if(i.action=!0,m&&Array.isArray(_(s,l))){const T=d(_(s,l),v.argA,v.argB);g&&j(s,l,T)}if(m&&Array.isArray(_(r.errors,l))){const T=d(_(r.errors,l),v.argA,v.argB);g&&j(r.errors,l,T),ks(r.errors,l)}if(p.touchedFields&&m&&Array.isArray(_(r.touchedFields,l))){const T=d(_(r.touchedFields,l),v.argA,v.argB);g&&j(r.touchedFields,l,T)}p.dirtyFields&&(r.dirtyFields=It(a,n)),x.state.next({name:l,isDirty:w(l,c),dirtyFields:r.dirtyFields,errors:r.errors,isValid:r.isValid})}else j(n,l,c)},ae=(l,c)=>{j(r.errors,l,c),x.state.next({errors:r.errors})},Q=l=>{r.errors=l,x.state.next({errors:r.errors,isValid:!1})},F=(l,c,d,v)=>{const g=_(s,l);if(g){const m=_(n,l,W(d)?_(a,l):d);W(m)||v&&v.defaultChecked||c?j(n,l,c?m:Ht(g._f)):J(l,m),i.mount&&Z()}},Ne=(l,c,d,v,g)=>{let m=!1,T=!1;const R={name:l},X=!!(_(s,l)&&_(s,l)._f&&_(s,l)._f.disabled);if(!d||v){p.isDirty&&(T=r.isDirty,r.isDirty=R.isDirty=w(),m=T!==R.isDirty);const K=X||Ie(_(a,l),c);T=!!(!X&&_(r.dirtyFields,l)),K||X?H(r.dirtyFields,l):j(r.dirtyFields,l,!0),R.dirtyFields=r.dirtyFields,m=m||p.dirtyFields&&T!==!K}if(d){const K=_(r.touchedFields,l);K||(j(r.touchedFields,l,d),R.touchedFields=r.touchedFields,m=m||p.touchedFields&&K!==d)}return m&&g&&x.state.next(R),m?R:{}},We=(l,c,d,v)=>{const g=_(r.errors,l),m=p.isValid&&ge(c)&&r.isValid!==c;if(t.delayError&&d?(u=q(()=>ae(l,d)),u(t.delayError)):(clearTimeout(f),u=null,d?j(r.errors,l,d):H(r.errors,l)),(d?!Ie(g,d):g)||!oe(v)||m){const T={...v,...m&&ge(c)?{isValid:c}:{},errors:r.errors,name:l};r={...r,...T},x.state.next(T)}},xe=async l=>{L(l,!0);const c=await e.resolver(n,e.context,bs(l||o.mount,s,e.criteriaMode,e.shouldUseNativeValidation));return L(l),c},we=async l=>{const{errors:c}=await xe(l);if(l)for(const d of l){const v=_(c,d);v?j(r.errors,d,v):H(r.errors,d)}else r.errors=c;return c},te=async(l,c,d={valid:!0})=>{for(const v in l){const g=l[v];if(g){const{_f:m,...T}=g;if(m){const R=o.array.has(m.name),X=g._f&&_s(g._f);X&&p.validatingFields&&L([v],!0);const K=await wr(g,n,P,e.shouldUseNativeValidation&&!c,R);if(X&&p.validatingFields&&L([v]),K[m.name]&&(d.valid=!1,c))break;!c&&(_(K,m.name)?R?ms(r.errors,K,m.name):j(r.errors,m.name,K[m.name]):H(r.errors,m.name))}!oe(T)&&await te(T,c,d)}}return d.valid},Fe=()=>{for(const l of o.unMount){const c=_(s,l);c&&(c._f.refs?c._f.refs.every(d=>!Gt(d)):!Gt(c._f.ref))&&nr(l)}o.unMount=new Set},w=(l,c)=>(l&&c&&j(n,l,c),!Ie(de(),a)),I=(l,c,d)=>ps(l,o,{...i.mount?n:W(c)?a:ye(l)?{[l]:c}:c},d,c),$=l=>St(_(i.mount?n:a,l,t.shouldUnregister?_(a,l,[]):[])),J=(l,c,d={})=>{const v=_(s,l);let g=c;if(v){const m=v._f;m&&(!m.disabled&&j(n,l,Cr(c,m)),g=Et(m.ref)&&se(c)?"":c,kr(m.ref)?[...m.ref.options].forEach(T=>T.selected=g.includes(T.value)):m.refs?st(m.ref)?m.refs.length>1?m.refs.forEach(T=>(!T.defaultChecked||!T.disabled)&&(T.checked=Array.isArray(g)?!!g.find(R=>R===T.value):g===T.value)):m.refs[0]&&(m.refs[0].checked=!!g):m.refs.forEach(T=>T.checked=T.value===g):Bt(m.ref)?m.ref.value="":(m.ref.value=g,m.ref.type||x.values.next({name:l,values:{...n}})))}(d.shouldDirty||d.shouldTouch)&&Ne(l,g,d.shouldTouch,d.shouldDirty,!0),d.shouldValidate&&$e(l)},re=(l,c,d)=>{for(const v in c){const g=c[v],m=`${l}.${v}`,T=_(s,m);(o.array.has(l)||!Vt(g)||T&&!T._f)&&!Ge(g)?re(m,g,d):J(m,g,d)}},ie=(l,c,d={})=>{const v=_(s,l),g=o.array.has(l),m=ce(c);j(n,l,m),g?(x.array.next({name:l,values:{...n}}),(p.isDirty||p.dirtyFields)&&d.shouldDirty&&x.state.next({name:l,dirtyFields:It(a,n),isDirty:w(l,m)})):v&&!v._f&&!se(m)?re(l,m,d):J(l,m,d),mr(l,o)&&x.state.next({...r}),x.values.next({name:i.mount?l:void 0,values:{...n}})},Ve=async l=>{i.mount=!0;const c=l.target;let d=c.name,v=!0;const g=_(s,d),m=()=>c.type?Ht(g._f):is(l),T=R=>{v=Number.isNaN(R)||Ie(R,_(n,d,R))};if(g){let R,X;const K=m(),qe=l.type===dr.BLUR||l.type===dr.FOCUS_OUT,ma=!xs(g._f)&&!e.resolver&&!_(r.errors,d)&&!g._f.deps||ws(qe,_(r.touchedFields,d),r.isSubmitted,B,Y),ir=mr(d,o,qe);j(n,d,K),qe?(g._f.onBlur&&g._f.onBlur(l),u&&u(0)):g._f.onChange&&g._f.onChange(l);const or=Ne(d,K,qe,!1),ga=!oe(or)||ir;if(!qe&&x.values.next({name:d,type:l.type,values:{...n}}),ma)return p.isValid&&(t.mode==="onBlur"?qe&&Z():Z()),ga&&x.state.next({name:d,...ir?{}:or});if(!qe&&ir&&x.state.next({...r}),e.resolver){const{errors:ns}=await xe([d]);if(T(K),v){const ya=Ar(r.errors,s,d),as=Ar(ns,s,ya.name||d);R=as.error,d=as.name,X=oe(ns)}}else L([d],!0),R=(await wr(g,n,P,e.shouldUseNativeValidation))[d],L([d]),T(K),v&&(R?X=!1:p.isValid&&(X=await te(s,!0)));v&&(g._f.deps&&$e(g._f.deps),We(d,X,R,or))}},me=(l,c)=>{if(_(r.errors,c)&&l.focus)return l.focus(),1},$e=async(l,c={})=>{let d,v;const g=Ct(l);if(e.resolver){const m=await we(W(l)?l:g);d=oe(m),v=l?!g.some(T=>_(m,T)):d}else l?(v=(await Promise.all(g.map(async m=>{const T=_(s,m);return await te(T&&T._f?{[m]:T}:T)}))).every(Boolean),!(!v&&!r.isValid)&&Z()):v=d=await te(s);return x.state.next({...!ye(l)||p.isValid&&d!==r.isValid?{}:{name:l},...e.resolver||!l?{isValid:d}:{},errors:r.errors}),c.shouldFocus&&!v&&nt(s,me,l?g:o.mount),v},de=l=>{const c={...i.mount?n:a};return W(l)?c:ye(l)?_(c,l):l.map(d=>_(c,d))},Xr=(l,c)=>({invalid:!!_((c||r).errors,l),isDirty:!!_((c||r).dirtyFields,l),error:_((c||r).errors,l),isValidating:!!_(r.validatingFields,l),isTouched:!!_((c||r).touchedFields,l)}),ua=l=>{l&&Ct(l).forEach(c=>H(r.errors,c)),x.state.next({errors:l?r.errors:{}})},Kr=(l,c,d)=>{const v=(_(s,l,{_f:{}})._f||{}).ref,g=_(r.errors,l)||{},{ref:m,message:T,type:R,...X}=g;j(r.errors,l,{...X,...c,ref:v}),x.state.next({name:l,errors:r.errors,isValid:!1}),d&&d.shouldFocus&&v&&v.focus&&v.focus()},fa=(l,c)=>Te(l)?x.values.subscribe({next:d=>l(I(void 0,c),d)}):I(l,c,!0),nr=(l,c={})=>{for(const d of l?Ct(l):o.mount)o.mount.delete(d),o.array.delete(d),c.keepValue||(H(s,d),H(n,d)),!c.keepError&&H(r.errors,d),!c.keepDirty&&H(r.dirtyFields,d),!c.keepTouched&&H(r.touchedFields,d),!c.keepIsValidating&&H(r.validatingFields,d),!e.shouldUnregister&&!c.keepDefaultValue&&H(a,d);x.values.next({values:{...n}}),x.state.next({...r,...c.keepDirty?{isDirty:w()}:{}}),!c.keepIsValid&&Z()},Qr=({disabled:l,name:c,field:d,fields:v,value:g})=>{if(ge(l)&&i.mount||l){const m=l?void 0:W(g)?Ht(d?d._f:_(v,c)._f):g;j(n,c,m),Ne(c,m,!1,!1,!0)}},ar=(l,c={})=>{let d=_(s,l);const v=ge(c.disabled)||ge(t.disabled);return j(s,l,{...d||{},_f:{...d&&d._f?d._f:{ref:{name:l}},name:l,mount:!0,...c}}),o.mount.add(l),d?Qr({field:d,disabled:ge(c.disabled)?c.disabled:t.disabled,name:l,value:c.value}):F(l,!0,c.value),{...v?{disabled:c.disabled||t.disabled}:{},...e.progressive?{required:!!c.required,min:at(c.min),max:at(c.max),minLength:at(c.minLength),maxLength:at(c.maxLength),pattern:at(c.pattern)}:{},name:l,onChange:Ve,onBlur:Ve,ref:g=>{if(g){ar(l,c),d=_(s,l);const m=W(g.value)&&g.querySelectorAll&&g.querySelectorAll("input,select,textarea")[0]||g,T=vs(m),R=d._f.refs||[];if(T?R.find(X=>X===m):m===d._f.ref)return;j(s,l,{_f:{...d._f,...T?{refs:[...R.filter(Gt),m,...Array.isArray(_(a,l))?[{}]:[]],ref:{type:m.type,name:l}}:{ref:m}}}),F(l,!1,void 0,m)}else d=_(s,l,{}),d._f&&(d._f.mount=!1),(e.shouldUnregister||c.shouldUnregister)&&!(ls(o.array,l)&&i.action)&&o.unMount.add(l)}}},es=()=>e.shouldFocusError&&nt(s,me,o.mount),ha=l=>{ge(l)&&(x.state.next({disabled:l}),nt(s,(c,d)=>{const v=_(s,d);v&&(c.disabled=v._f.disabled||l,Array.isArray(v._f.refs)&&v._f.refs.forEach(g=>{g.disabled=v._f.disabled||l}))},0,!1))},ts=(l,c)=>async d=>{let v;d&&(d.preventDefault&&d.preventDefault(),d.persist&&d.persist());let g=ce(n);if(x.state.next({isSubmitting:!0}),e.resolver){const{errors:m,values:T}=await xe();r.errors=m,g=T}else await te(s);if(H(r.errors,"root"),oe(r.errors)){x.state.next({errors:{}});try{await l(g,d)}catch(m){v=m}}else c&&await c({...r.errors},d),es(),setTimeout(es);if(x.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:oe(r.errors)&&!v,submitCount:r.submitCount+1,errors:r.errors}),v)throw v},pa=(l,c={})=>{_(s,l)&&(W(c.defaultValue)?ie(l,ce(_(a,l))):(ie(l,c.defaultValue),j(a,l,ce(c.defaultValue))),c.keepTouched||H(r.touchedFields,l),c.keepDirty||(H(r.dirtyFields,l),r.isDirty=c.defaultValue?w(l,ce(_(a,l))):w()),c.keepError||(H(r.errors,l),p.isValid&&Z()),x.state.next({...r}))},rs=(l,c={})=>{const d=l?ce(l):a,v=ce(d),g=oe(l),m=g?a:v;if(c.keepDefaultValues||(a=d),!c.keepValues){if(c.keepDirtyValues)for(const T of o.mount)_(r.dirtyFields,T)?j(m,T,_(n,T)):ie(T,_(m,T));else{if(zt&&W(l))for(const T of o.mount){const R=_(s,T);if(R&&R._f){const X=Array.isArray(R._f.refs)?R._f.refs[0]:R._f.ref;if(Et(X)){const K=X.closest("form");if(K){K.reset();break}}}}s={}}n=t.shouldUnregister?c.keepDefaultValues?ce(a):{}:ce(m),x.array.next({values:{...m}}),x.values.next({values:{...m}})}o={mount:c.keepDirtyValues?o.mount:new Set,unMount:new Set,array:new Set,watch:new Set,watchAll:!1,focus:""},i.mount=!p.isValid||!!c.keepIsValid||!!c.keepDirtyValues,i.watch=!!t.shouldUnregister,x.state.next({submitCount:c.keepSubmitCount?r.submitCount:0,isDirty:g?!1:c.keepDirty?r.isDirty:!!(c.keepDefaultValues&&!Ie(l,a)),isSubmitted:c.keepIsSubmitted?r.isSubmitted:!1,dirtyFields:g?{}:c.keepDirtyValues?c.keepDefaultValues&&n?It(a,n):r.dirtyFields:c.keepDefaultValues&&l?It(a,l):c.keepDirty?r.dirtyFields:{},touchedFields:c.keepTouched?r.touchedFields:{},errors:c.keepErrors?r.errors:{},isSubmitSuccessful:c.keepIsSubmitSuccessful?r.isSubmitSuccessful:!1,isSubmitting:!1})},ss=(l,c)=>rs(Te(l)?l(n):l,c);return{control:{register:ar,unregister:nr,getFieldState:Xr,handleSubmit:ts,setError:Kr,_executeSchema:xe,_getWatch:I,_getDirty:w,_updateValid:Z,_removeUnmounted:Fe,_updateFieldArray:E,_updateDisabledField:Qr,_getFieldArray:$,_reset:rs,_resetDefaultValues:()=>Te(e.defaultValues)&&e.defaultValues().then(l=>{ss(l,e.resetOptions),x.state.next({isLoading:!1})}),_updateFormState:l=>{r={...r,...l}},_disableForm:ha,_subjects:x,_proxyFormState:p,_setErrors:Q,get _fields(){return s},get _formValues(){return n},get _state(){return i},set _state(l){i=l},get _defaultValues(){return a},get _names(){return o},set _names(l){o=l},get _formState(){return r},set _formState(l){r=l},get _options(){return e},set _options(l){e={...e,...l}}},trigger:$e,register:ar,handleSubmit:ts,watch:fa,setValue:ie,getValues:de,reset:ss,resetField:pa,clearErrors:ua,unregister:nr,setError:Kr,setFocus:(l,c={})=>{const d=_(s,l),v=d&&d._f;if(v){const g=v.refs?v.refs[0]:v.ref;g.focus&&(g.focus(),c.shouldSelect&&g.select())}},getFieldState:Xr}}function Cs(t={}){const e=M.useRef(),r=M.useRef(),[s,a]=M.useState({isDirty:!1,isValidating:!1,isLoading:Te(t.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1,defaultValues:Te(t.defaultValues)?void 0:t.defaultValues});e.current||(e.current={...Ss(t),formState:s});const n=e.current.control;return n._options=t,hs({subject:n._subjects.state,next:i=>{fs(i,n._proxyFormState,n._updateFormState)&&a({...n._formState})}}),M.useEffect(()=>n._disableForm(t.disabled),[n,t.disabled]),M.useEffect(()=>{if(n._proxyFormState.isDirty){const i=n._getDirty();i!==s.isDirty&&n._subjects.state.next({isDirty:i})}},[n,s.isDirty]),M.useEffect(()=>{t.values&&!Ie(t.values,r.current)?(n._reset(t.values,n._options.resetOptions),r.current=t.values,a(i=>({...i}))):n._resetDefaultValues()},[t.values,n]),M.useEffect(()=>{t.errors&&n._setErrors(t.errors)},[t.errors,n]),M.useEffect(()=>{n._state.mount||(n._updateValid(),n._state.mount=!0),n._state.watch&&(n._state.watch=!1,n._subjects.state.next({...n._formState})),n._removeUnmounted()}),M.useEffect(()=>{t.shouldUnregister&&n._subjects.values.next({values:n._getWatch()})},[t.shouldUnregister,n]),e.current.formState=us(s,n),e.current}const Nr=(t,e,r)=>{if(t&&"reportValidity"in t){const s=_(r,e);t.setCustomValidity(s&&s.message||""),t.reportValidity()}},Vr=(t,e)=>{for(const r in e.fields){const s=e.fields[r];s&&s.ref&&"reportValidity"in s.ref?Nr(s.ref,r,t):s.refs&&s.refs.forEach(a=>Nr(a,r,t))}},Es=(t,e)=>{e.shouldUseNativeValidation&&Vr(t,e);const r={};for(const s in t){const a=_(e.fields,s),n=Object.assign(t[s]||{},{ref:a&&a.ref});if(As(e.names||Object.keys(t),s)){const i=Object.assign({},_(r,s));j(i,"root",n),j(r,s,i)}else j(r,s,n)}return r},As=(t,e)=>t.some(r=>r.startsWith(e+"."));var Ns=function(t,e){for(var r={};t.length;){var s=t[0],a=s.code,n=s.message,i=s.path.join(".");if(!r[i])if("unionErrors"in s){var o=s.unionErrors[0].errors[0];r[i]={message:o.message,type:o.code}}else r[i]={message:n,type:a};if("unionErrors"in s&&s.unionErrors.forEach(function(p){return p.errors.forEach(function(x){return t.push(x)})}),e){var u=r[i].types,f=u&&u[s.code];r[i]=hr(i,e,r,a,f?[].concat(f,s.message):s.message)}t.shift()}return r},Vs=function(t,e,r){return r===void 0&&(r={}),function(s,a,n){try{return Promise.resolve(function(i,o){try{var u=Promise.resolve(t[r.mode==="sync"?"parse":"parseAsync"](s,e)).then(function(f){return n.shouldUseNativeValidation&&Vr({},n),{errors:{},values:r.raw?s:f}})}catch(f){return o(f)}return u&&u.then?u.then(void 0,o):u}(0,function(i){if(function(o){return Array.isArray(o==null?void 0:o.errors)}(i))return{values:{},errors:Es(Ns(i.errors,!n.shouldUseNativeValidation&&n.criteriaMode==="all"),n)};throw i}))}catch(i){return Promise.reject(i)}}};function Or(t){var e,r,s="";if(typeof t=="string"||typeof t=="number")s+=t;else if(typeof t=="object")if(Array.isArray(t)){var a=t.length;for(e=0;e<a;e++)t[e]&&(r=Or(t[e]))&&(s&&(s+=" "),s+=r)}else for(r in t)t[r]&&(s&&(s+=" "),s+=r);return s}function Os(){for(var t,e,r=0,s="",a=arguments.length;r<a;r++)(t=arguments[r])&&(e=Or(t))&&(s&&(s+=" "),s+=e);return s}const Yt="-",Is=t=>{const e=Rs(t),{conflictingClassGroups:r,conflictingClassGroupModifiers:s}=t;return{getClassGroupId:i=>{const o=i.split(Yt);return o[0]===""&&o.length!==1&&o.shift(),Ir(o,e)||Zs(i)},getConflictingClassGroupIds:(i,o)=>{const u=r[i]||[];return o&&s[i]?[...u,...s[i]]:u}}},Ir=(t,e)=>{var i;if(t.length===0)return e.classGroupId;const r=t[0],s=e.nextPart.get(r),a=s?Ir(t.slice(1),s):void 0;if(a)return a;if(e.validators.length===0)return;const n=t.join(Yt);return(i=e.validators.find(({validator:o})=>o(n)))==null?void 0:i.classGroupId},Zr=/^\[(.+)\]$/,Zs=t=>{if(Zr.test(t)){const e=Zr.exec(t)[1],r=e==null?void 0:e.substring(0,e.indexOf(":"));if(r)return"arbitrary.."+r}},Rs=t=>{const{theme:e,prefix:r}=t,s={nextPart:new Map,validators:[]};return js(Object.entries(t.classGroups),r).forEach(([n,i])=>{Jt(i,s,n,e)}),s},Jt=(t,e,r,s)=>{t.forEach(a=>{if(typeof a=="string"){const n=a===""?e:Rr(e,a);n.classGroupId=r;return}if(typeof a=="function"){if(Ms(a)){Jt(a(s),e,r,s);return}e.validators.push({validator:a,classGroupId:r});return}Object.entries(a).forEach(([n,i])=>{Jt(i,Rr(e,n),r,s)})})},Rr=(t,e)=>{let r=t;return e.split(Yt).forEach(s=>{r.nextPart.has(s)||r.nextPart.set(s,{nextPart:new Map,validators:[]}),r=r.nextPart.get(s)}),r},Ms=t=>t.isThemeGetter,js=(t,e)=>e?t.map(([r,s])=>{const a=s.map(n=>typeof n=="string"?e+n:typeof n=="object"?Object.fromEntries(Object.entries(n).map(([i,o])=>[e+i,o])):n);return[r,a]}):t,Ds=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,r=new Map,s=new Map;const a=(n,i)=>{r.set(n,i),e++,e>t&&(e=0,s=r,r=new Map)};return{get(n){let i=r.get(n);if(i!==void 0)return i;if((i=s.get(n))!==void 0)return a(n,i),i},set(n,i){r.has(n)?r.set(n,i):a(n,i)}}},Mr="!",Ls=t=>{const{separator:e,experimentalParseClassName:r}=t,s=e.length===1,a=e[0],n=e.length,i=o=>{const u=[];let f=0,p=0,x;for(let Z=0;Z<o.length;Z++){let L=o[Z];if(f===0){if(L===a&&(s||o.slice(Z,Z+n)===e)){u.push(o.slice(p,Z)),p=Z+n;continue}if(L==="/"){x=Z;continue}}L==="["?f++:L==="]"&&f--}const Y=u.length===0?o:o.substring(p),B=Y.startsWith(Mr),P=B?Y.substring(1):Y,q=x&&x>p?x-p:void 0;return{modifiers:u,hasImportantModifier:B,baseClassName:P,maybePostfixModifierPosition:q}};return r?o=>r({className:o,parseClassName:i}):i},Ps=t=>{if(t.length<=1)return t;const e=[];let r=[];return t.forEach(s=>{s[0]==="["?(e.push(...r.sort(),s),r=[]):r.push(s)}),e.push(...r.sort()),e},Fs=t=>({cache:Ds(t.cacheSize),parseClassName:Ls(t),...Is(t)}),$s=/\s+/,zs=(t,e)=>{const{parseClassName:r,getClassGroupId:s,getConflictingClassGroupIds:a}=e,n=[],i=t.trim().split($s);let o="";for(let u=i.length-1;u>=0;u-=1){const f=i[u],{modifiers:p,hasImportantModifier:x,baseClassName:Y,maybePostfixModifierPosition:B}=r(f);let P=!!B,q=s(P?Y.substring(0,B):Y);if(!q){if(!P){o=f+(o.length>0?" "+o:o);continue}if(q=s(Y),!q){o=f+(o.length>0?" "+o:o);continue}P=!1}const Z=Ps(p).join(":"),L=x?Z+Mr:Z,E=L+q;if(n.includes(E))continue;n.push(E);const ae=a(q,P);for(let Q=0;Q<ae.length;++Q){const F=ae[Q];n.push(L+F)}o=f+(o.length>0?" "+o:o)}return o};function Us(){let t=0,e,r,s="";for(;t<arguments.length;)(e=arguments[t++])&&(r=jr(e))&&(s&&(s+=" "),s+=r);return s}const jr=t=>{if(typeof t=="string")return t;let e,r="";for(let s=0;s<t.length;s++)t[s]&&(e=jr(t[s]))&&(r&&(r+=" "),r+=e);return r};function Bs(t,...e){let r,s,a,n=i;function i(u){const f=e.reduce((p,x)=>x(p),t());return r=Fs(f),s=r.cache.get,a=r.cache.set,n=o,o(u)}function o(u){const f=s(u);if(f)return f;const p=zs(u,r);return a(u,p),p}return function(){return n(Us.apply(null,arguments))}}const D=t=>{const e=r=>r[t]||[];return e.isThemeGetter=!0,e},Dr=/^\[(?:([a-z-]+):)?(.+)\]$/i,Ws=/^\d+\/\d+$/,qs=new Set(["px","full","screen"]),Gs=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Hs=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Ys=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,Js=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Xs=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Se=t=>Ye(t)||qs.has(t)||Ws.test(t),Ze=t=>Je(t,"length",an),Ye=t=>!!t&&!Number.isNaN(Number(t)),Xt=t=>Je(t,"number",Ye),it=t=>!!t&&Number.isInteger(Number(t)),Ks=t=>t.endsWith("%")&&Ye(t.slice(0,-1)),N=t=>Dr.test(t),Re=t=>Gs.test(t),Qs=new Set(["length","size","percentage"]),en=t=>Je(t,Qs,Lr),tn=t=>Je(t,"position",Lr),rn=new Set(["image","url"]),sn=t=>Je(t,rn,ln),nn=t=>Je(t,"",on),ot=()=>!0,Je=(t,e,r)=>{const s=Dr.exec(t);return s?s[1]?typeof e=="string"?s[1]===e:e.has(s[1]):r(s[2]):!1},an=t=>Hs.test(t)&&!Ys.test(t),Lr=()=>!1,on=t=>Js.test(t),ln=t=>Xs.test(t),cn=Bs(()=>{const t=D("colors"),e=D("spacing"),r=D("blur"),s=D("brightness"),a=D("borderColor"),n=D("borderRadius"),i=D("borderSpacing"),o=D("borderWidth"),u=D("contrast"),f=D("grayscale"),p=D("hueRotate"),x=D("invert"),Y=D("gap"),B=D("gradientColorStops"),P=D("gradientColorStopPositions"),q=D("inset"),Z=D("margin"),L=D("opacity"),E=D("padding"),ae=D("saturate"),Q=D("scale"),F=D("sepia"),Ne=D("skew"),We=D("space"),xe=D("translate"),we=()=>["auto","contain","none"],te=()=>["auto","hidden","clip","visible","scroll"],Fe=()=>["auto",N,e],w=()=>[N,e],I=()=>["",Se,Ze],$=()=>["auto",Ye,N],J=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],re=()=>["solid","dashed","dotted","double","none"],ie=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],Ve=()=>["start","end","center","between","around","evenly","stretch"],me=()=>["","0",N],$e=()=>["auto","avoid","all","avoid-page","page","left","right","column"],de=()=>[Ye,N];return{cacheSize:500,separator:":",theme:{colors:[ot],spacing:[Se,Ze],blur:["none","",Re,N],brightness:de(),borderColor:[t],borderRadius:["none","","full",Re,N],borderSpacing:w(),borderWidth:I(),contrast:de(),grayscale:me(),hueRotate:de(),invert:me(),gap:w(),gradientColorStops:[t],gradientColorStopPositions:[Ks,Ze],inset:Fe(),margin:Fe(),opacity:de(),padding:w(),saturate:de(),scale:de(),sepia:me(),skew:de(),space:w(),translate:w()},classGroups:{aspect:[{aspect:["auto","square","video",N]}],container:["container"],columns:[{columns:[Re]}],"break-after":[{"break-after":$e()}],"break-before":[{"break-before":$e()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...J(),N]}],overflow:[{overflow:te()}],"overflow-x":[{"overflow-x":te()}],"overflow-y":[{"overflow-y":te()}],overscroll:[{overscroll:we()}],"overscroll-x":[{"overscroll-x":we()}],"overscroll-y":[{"overscroll-y":we()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[q]}],"inset-x":[{"inset-x":[q]}],"inset-y":[{"inset-y":[q]}],start:[{start:[q]}],end:[{end:[q]}],top:[{top:[q]}],right:[{right:[q]}],bottom:[{bottom:[q]}],left:[{left:[q]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",it,N]}],basis:[{basis:Fe()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",N]}],grow:[{grow:me()}],shrink:[{shrink:me()}],order:[{order:["first","last","none",it,N]}],"grid-cols":[{"grid-cols":[ot]}],"col-start-end":[{col:["auto",{span:["full",it,N]},N]}],"col-start":[{"col-start":$()}],"col-end":[{"col-end":$()}],"grid-rows":[{"grid-rows":[ot]}],"row-start-end":[{row:["auto",{span:[it,N]},N]}],"row-start":[{"row-start":$()}],"row-end":[{"row-end":$()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",N]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",N]}],gap:[{gap:[Y]}],"gap-x":[{"gap-x":[Y]}],"gap-y":[{"gap-y":[Y]}],"justify-content":[{justify:["normal",...Ve()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...Ve(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...Ve(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[E]}],px:[{px:[E]}],py:[{py:[E]}],ps:[{ps:[E]}],pe:[{pe:[E]}],pt:[{pt:[E]}],pr:[{pr:[E]}],pb:[{pb:[E]}],pl:[{pl:[E]}],m:[{m:[Z]}],mx:[{mx:[Z]}],my:[{my:[Z]}],ms:[{ms:[Z]}],me:[{me:[Z]}],mt:[{mt:[Z]}],mr:[{mr:[Z]}],mb:[{mb:[Z]}],ml:[{ml:[Z]}],"space-x":[{"space-x":[We]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[We]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",N,e]}],"min-w":[{"min-w":[N,e,"min","max","fit"]}],"max-w":[{"max-w":[N,e,"none","full","min","max","fit","prose",{screen:[Re]},Re]}],h:[{h:[N,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[N,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[N,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[N,e,"auto","min","max","fit"]}],"font-size":[{text:["base",Re,Ze]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Xt]}],"font-family":[{font:[ot]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractons"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",N]}],"line-clamp":[{"line-clamp":["none",Ye,Xt]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Se,N]}],"list-image":[{"list-image":["none",N]}],"list-style-type":[{list:["none","disc","decimal",N]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[t]}],"placeholder-opacity":[{"placeholder-opacity":[L]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[t]}],"text-opacity":[{"text-opacity":[L]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...re(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Se,Ze]}],"underline-offset":[{"underline-offset":["auto",Se,N]}],"text-decoration-color":[{decoration:[t]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:w()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",N]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",N]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[L]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...J(),tn]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",en]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},sn]}],"bg-color":[{bg:[t]}],"gradient-from-pos":[{from:[P]}],"gradient-via-pos":[{via:[P]}],"gradient-to-pos":[{to:[P]}],"gradient-from":[{from:[B]}],"gradient-via":[{via:[B]}],"gradient-to":[{to:[B]}],rounded:[{rounded:[n]}],"rounded-s":[{"rounded-s":[n]}],"rounded-e":[{"rounded-e":[n]}],"rounded-t":[{"rounded-t":[n]}],"rounded-r":[{"rounded-r":[n]}],"rounded-b":[{"rounded-b":[n]}],"rounded-l":[{"rounded-l":[n]}],"rounded-ss":[{"rounded-ss":[n]}],"rounded-se":[{"rounded-se":[n]}],"rounded-ee":[{"rounded-ee":[n]}],"rounded-es":[{"rounded-es":[n]}],"rounded-tl":[{"rounded-tl":[n]}],"rounded-tr":[{"rounded-tr":[n]}],"rounded-br":[{"rounded-br":[n]}],"rounded-bl":[{"rounded-bl":[n]}],"border-w":[{border:[o]}],"border-w-x":[{"border-x":[o]}],"border-w-y":[{"border-y":[o]}],"border-w-s":[{"border-s":[o]}],"border-w-e":[{"border-e":[o]}],"border-w-t":[{"border-t":[o]}],"border-w-r":[{"border-r":[o]}],"border-w-b":[{"border-b":[o]}],"border-w-l":[{"border-l":[o]}],"border-opacity":[{"border-opacity":[L]}],"border-style":[{border:[...re(),"hidden"]}],"divide-x":[{"divide-x":[o]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[o]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[L]}],"divide-style":[{divide:re()}],"border-color":[{border:[a]}],"border-color-x":[{"border-x":[a]}],"border-color-y":[{"border-y":[a]}],"border-color-t":[{"border-t":[a]}],"border-color-r":[{"border-r":[a]}],"border-color-b":[{"border-b":[a]}],"border-color-l":[{"border-l":[a]}],"divide-color":[{divide:[a]}],"outline-style":[{outline:["",...re()]}],"outline-offset":[{"outline-offset":[Se,N]}],"outline-w":[{outline:[Se,Ze]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:I()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[L]}],"ring-offset-w":[{"ring-offset":[Se,Ze]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",Re,nn]}],"shadow-color":[{shadow:[ot]}],opacity:[{opacity:[L]}],"mix-blend":[{"mix-blend":[...ie(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":ie()}],filter:[{filter:["","none"]}],blur:[{blur:[r]}],brightness:[{brightness:[s]}],contrast:[{contrast:[u]}],"drop-shadow":[{"drop-shadow":["","none",Re,N]}],grayscale:[{grayscale:[f]}],"hue-rotate":[{"hue-rotate":[p]}],invert:[{invert:[x]}],saturate:[{saturate:[ae]}],sepia:[{sepia:[F]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[r]}],"backdrop-brightness":[{"backdrop-brightness":[s]}],"backdrop-contrast":[{"backdrop-contrast":[u]}],"backdrop-grayscale":[{"backdrop-grayscale":[f]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[p]}],"backdrop-invert":[{"backdrop-invert":[x]}],"backdrop-opacity":[{"backdrop-opacity":[L]}],"backdrop-saturate":[{"backdrop-saturate":[ae]}],"backdrop-sepia":[{"backdrop-sepia":[F]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[i]}],"border-spacing-x":[{"border-spacing-x":[i]}],"border-spacing-y":[{"border-spacing-y":[i]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",N]}],duration:[{duration:de()}],ease:[{ease:["linear","in","out","in-out",N]}],delay:[{delay:de()}],animate:[{animate:["none","spin","ping","pulse","bounce",N]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[Q]}],"scale-x":[{"scale-x":[Q]}],"scale-y":[{"scale-y":[Q]}],rotate:[{rotate:[it,N]}],"translate-x":[{"translate-x":[xe]}],"translate-y":[{"translate-y":[xe]}],"skew-x":[{"skew-x":[Ne]}],"skew-y":[{"skew-y":[Ne]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",N]}],accent:[{accent:["auto",t]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",N]}],"caret-color":[{caret:[t]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":w()}],"scroll-mx":[{"scroll-mx":w()}],"scroll-my":[{"scroll-my":w()}],"scroll-ms":[{"scroll-ms":w()}],"scroll-me":[{"scroll-me":w()}],"scroll-mt":[{"scroll-mt":w()}],"scroll-mr":[{"scroll-mr":w()}],"scroll-mb":[{"scroll-mb":w()}],"scroll-ml":[{"scroll-ml":w()}],"scroll-p":[{"scroll-p":w()}],"scroll-px":[{"scroll-px":w()}],"scroll-py":[{"scroll-py":w()}],"scroll-ps":[{"scroll-ps":w()}],"scroll-pe":[{"scroll-pe":w()}],"scroll-pt":[{"scroll-pt":w()}],"scroll-pr":[{"scroll-pr":w()}],"scroll-pb":[{"scroll-pb":w()}],"scroll-pl":[{"scroll-pl":w()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",N]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[Se,Ze,Xt]}],stroke:[{stroke:[t,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}});function Zt(...t){return cn(Os(t))}function Ce(t){return t[0].toUpperCase()+t.slice(1)}const dn=t=>{const e=({schema:r,onSubmit:s,defaultValues:a,children:n,className:i,...o})=>{const u=Cs({resolver:Vs(r),defaultValues:a,mode:"onSubmit"});return M.createElement(ds,{...u},M.createElement("form",{onSubmit:u.handleSubmit(s),className:Zt("p-4 flex flex-col justify-center space-y-2 form-control",i),...o},n))};return e.Input=({name:r,label:s,className:a,...n})=>{const{register:i}=fr();return M.createElement(fn,{name:r},M.createElement(un,{htmlFor:r},s),M.createElement("input",{id:r,...i(r),className:Zt("mt-1 block w-full border border-gray-300 rounded-lg px-4 py-2 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent transition duration-200 form-input form-input-field",a),...n}))},e},un=M.forwardRef(({children:t,htmlFor:e,className:r},s)=>M.createElement("label",{ref:s,className:Zt("text-sm font-medium text-gray-700 form-label",r),htmlFor:e},t)),fn=M.forwardRef(({name:t,className:e,children:r},s)=>{var n;const{formState:{errors:a}}=fr();return M.createElement("div",{className:`flex flex-col form-field ${a[t]?"text-red-600 form-field-error":""}`,ref:s},r,a[t]?M.createElement("span",{className:Zt("text-red-600 text-sm form-field-error-text",e)},(n=a[t])==null?void 0:n.message):null)});var O;(function(t){t.assertEqual=a=>a;function e(a){}t.assertIs=e;function r(a){throw new Error}t.assertNever=r,t.arrayToEnum=a=>{const n={};for(const i of a)n[i]=i;return n},t.getValidEnumValues=a=>{const n=t.objectKeys(a).filter(o=>typeof a[a[o]]!="number"),i={};for(const o of n)i[o]=a[o];return t.objectValues(i)},t.objectValues=a=>t.objectKeys(a).map(function(n){return a[n]}),t.objectKeys=typeof Object.keys=="function"?a=>Object.keys(a):a=>{const n=[];for(const i in a)Object.prototype.hasOwnProperty.call(a,i)&&n.push(i);return n},t.find=(a,n)=>{for(const i of a)if(n(i))return i},t.isInteger=typeof Number.isInteger=="function"?a=>Number.isInteger(a):a=>typeof a=="number"&&isFinite(a)&&Math.floor(a)===a;function s(a,n=" | "){return a.map(i=>typeof i=="string"?`'${i}'`:i).join(n)}t.joinValues=s,t.jsonStringifyReplacer=(a,n)=>typeof n=="bigint"?n.toString():n})(O||(O={}));var Kt;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(Kt||(Kt={}));const b=O.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Me=t=>{switch(typeof t){case"undefined":return b.undefined;case"string":return b.string;case"number":return isNaN(t)?b.nan:b.number;case"boolean":return b.boolean;case"function":return b.function;case"bigint":return b.bigint;case"symbol":return b.symbol;case"object":return Array.isArray(t)?b.array:t===null?b.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?b.promise:typeof Map<"u"&&t instanceof Map?b.map:typeof Set<"u"&&t instanceof Set?b.set:typeof Date<"u"&&t instanceof Date?b.date:b.object;default:return b.unknown}},h=O.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),hn=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:");class le extends Error{constructor(e){super(),this.issues=[],this.addIssue=s=>{this.issues=[...this.issues,s]},this.addIssues=(s=[])=>{this.issues=[...this.issues,...s]};const r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){const r=e||function(n){return n.message},s={_errors:[]},a=n=>{for(const i of n.issues)if(i.code==="invalid_union")i.unionErrors.map(a);else if(i.code==="invalid_return_type")a(i.returnTypeError);else if(i.code==="invalid_arguments")a(i.argumentsError);else if(i.path.length===0)s._errors.push(r(i));else{let o=s,u=0;for(;u<i.path.length;){const f=i.path[u];u===i.path.length-1?(o[f]=o[f]||{_errors:[]},o[f]._errors.push(r(i))):o[f]=o[f]||{_errors:[]},o=o[f],u++}}};return a(this),s}static assert(e){if(!(e instanceof le))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,O.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){const r={},s=[];for(const a of this.issues)a.path.length>0?(r[a.path[0]]=r[a.path[0]]||[],r[a.path[0]].push(e(a))):s.push(e(a));return{formErrors:s,fieldErrors:r}}get formErrors(){return this.flatten()}}le.create=t=>new le(t);const Xe=(t,e)=>{let r;switch(t.code){case h.invalid_type:t.received===b.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case h.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,O.jsonStringifyReplacer)}`;break;case h.unrecognized_keys:r=`Unrecognized key(s) in object: ${O.joinValues(t.keys,", ")}`;break;case h.invalid_union:r="Invalid input";break;case h.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${O.joinValues(t.options)}`;break;case h.invalid_enum_value:r=`Invalid enum value. Expected ${O.joinValues(t.options)}, received '${t.received}'`;break;case h.invalid_arguments:r="Invalid function arguments";break;case h.invalid_return_type:r="Invalid function return type";break;case h.invalid_date:r="Invalid date";break;case h.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:O.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case h.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case h.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case h.custom:r="Invalid input";break;case h.invalid_intersection_types:r="Intersection results could not be merged";break;case h.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case h.not_finite:r="Number must be finite";break;default:r=e.defaultError,O.assertNever(t)}return{message:r}};let Pr=Xe;function pn(t){Pr=t}function Rt(){return Pr}const Mt=t=>{const{data:e,path:r,errorMaps:s,issueData:a}=t,n=[...r,...a.path||[]],i={...a,path:n};if(a.message!==void 0)return{...a,path:n,message:a.message};let o="";const u=s.filter(f=>!!f).slice().reverse();for(const f of u)o=f(i,{data:e,defaultError:o}).message;return{...a,path:n,message:o}},mn=[];function y(t,e){const r=Rt(),s=Mt({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===Xe?void 0:Xe].filter(a=>!!a)});t.common.issues.push(s)}class ee{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){const s=[];for(const a of r){if(a.status==="aborted")return C;a.status==="dirty"&&e.dirty(),s.push(a.value)}return{status:e.value,value:s}}static async mergeObjectAsync(e,r){const s=[];for(const a of r){const n=await a.key,i=await a.value;s.push({key:n,value:i})}return ee.mergeObjectSync(e,s)}static mergeObjectSync(e,r){const s={};for(const a of r){const{key:n,value:i}=a;if(n.status==="aborted"||i.status==="aborted")return C;n.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),n.value!=="__proto__"&&(typeof i.value<"u"||a.alwaysSet)&&(s[n.value]=i.value)}return{status:e.value,value:s}}}const C=Object.freeze({status:"aborted"}),Ke=t=>({status:"dirty",value:t}),ne=t=>({status:"valid",value:t}),Qt=t=>t.status==="aborted",er=t=>t.status==="dirty",lt=t=>t.status==="valid",ct=t=>typeof Promise<"u"&&t instanceof Promise;function jt(t,e,r,s){if(typeof e=="function"?t!==e||!s:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e.get(t)}function Fr(t,e,r,s,a){if(typeof e=="function"?t!==e||!a:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e.set(t,r),r}typeof SuppressedError=="function"&&SuppressedError;var k;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(k||(k={}));var dt,ut;class ve{constructor(e,r,s,a){this._cachedPath=[],this.parent=e,this.data=r,this._path=s,this._key=a}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const $r=(t,e)=>{if(lt(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const r=new le(t.common.issues);return this._error=r,this._error}}};function A(t){if(!t)return{};const{errorMap:e,invalid_type_error:r,required_error:s,description:a}=t;if(e&&(r||s))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:a}:{errorMap:(i,o)=>{var u,f;const{message:p}=t;return i.code==="invalid_enum_value"?{message:p??o.defaultError}:typeof o.data>"u"?{message:(u=p??s)!==null&&u!==void 0?u:o.defaultError}:i.code!=="invalid_type"?{message:o.defaultError}:{message:(f=p??r)!==null&&f!==void 0?f:o.defaultError}},description:a}}class V{constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(e){return Me(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:Me(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new ee,ctx:{common:e.parent.common,data:e.data,parsedType:Me(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const r=this._parse(e);if(ct(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){const r=this._parse(e);return Promise.resolve(r)}parse(e,r){const s=this.safeParse(e,r);if(s.success)return s.data;throw s.error}safeParse(e,r){var s;const a={common:{issues:[],async:(s=r==null?void 0:r.async)!==null&&s!==void 0?s:!1,contextualErrorMap:r==null?void 0:r.errorMap},path:(r==null?void 0:r.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Me(e)},n=this._parseSync({data:e,path:a.path,parent:a});return $r(a,n)}async parseAsync(e,r){const s=await this.safeParseAsync(e,r);if(s.success)return s.data;throw s.error}async safeParseAsync(e,r){const s={common:{issues:[],contextualErrorMap:r==null?void 0:r.errorMap,async:!0},path:(r==null?void 0:r.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Me(e)},a=this._parse({data:e,path:s.path,parent:s}),n=await(ct(a)?a:Promise.resolve(a));return $r(s,n)}refine(e,r){const s=a=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(a):r;return this._refinement((a,n)=>{const i=e(a),o=()=>n.addIssue({code:h.custom,...s(a)});return typeof Promise<"u"&&i instanceof Promise?i.then(u=>u?!0:(o(),!1)):i?!0:(o(),!1)})}refinement(e,r){return this._refinement((s,a)=>e(s)?!0:(a.addIssue(typeof r=="function"?r(s,a):r),!1))}_refinement(e){return new pe({schema:this,typeName:S.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return _e.create(this,this._def)}nullable(){return Pe.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return he.create(this,this._def)}promise(){return rt.create(this,this._def)}or(e){return mt.create([this,e],this._def)}and(e){return gt.create(this,e,this._def)}transform(e){return new pe({...A(this._def),schema:this,typeName:S.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const r=typeof e=="function"?e:()=>e;return new xt({...A(this._def),innerType:this,defaultValue:r,typeName:S.ZodDefault})}brand(){return new sr({typeName:S.ZodBranded,type:this,...A(this._def)})}catch(e){const r=typeof e=="function"?e:()=>e;return new wt({...A(this._def),innerType:this,catchValue:r,typeName:S.ZodCatch})}describe(e){const r=this.constructor;return new r({...this._def,description:e})}pipe(e){return kt.create(this,e)}readonly(){return Tt.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const gn=/^c[^\s-]{8,}$/i,yn=/^[0-9a-z]+$/,vn=/^[0-9A-HJKMNP-TV-Z]{26}$/,bn=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,_n=/^[a-z0-9_-]{21}$/i,xn=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,wn=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,kn="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let tr;const Tn=/^(?:(?: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])$/,Sn=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,Cn=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,zr="((\\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])))",En=new RegExp(`^${zr}$`);function Ur(t){let e="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`),e}function An(t){return new RegExp(`^${Ur(t)}$`)}function Br(t){let e=`${zr}T${Ur(t)}`;const r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function Nn(t,e){return!!((e==="v4"||!e)&&Tn.test(t)||(e==="v6"||!e)&&Sn.test(t))}class fe extends V{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==b.string){const n=this._getOrReturnCtx(e);return y(n,{code:h.invalid_type,expected:b.string,received:n.parsedType}),C}const s=new ee;let a;for(const n of this._def.checks)if(n.kind==="min")e.data.length<n.value&&(a=this._getOrReturnCtx(e,a),y(a,{code:h.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),s.dirty());else if(n.kind==="max")e.data.length>n.value&&(a=this._getOrReturnCtx(e,a),y(a,{code:h.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),s.dirty());else if(n.kind==="length"){const i=e.data.length>n.value,o=e.data.length<n.value;(i||o)&&(a=this._getOrReturnCtx(e,a),i?y(a,{code:h.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}):o&&y(a,{code:h.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}),s.dirty())}else if(n.kind==="email")wn.test(e.data)||(a=this._getOrReturnCtx(e,a),y(a,{validation:"email",code:h.invalid_string,message:n.message}),s.dirty());else if(n.kind==="emoji")tr||(tr=new RegExp(kn,"u")),tr.test(e.data)||(a=this._getOrReturnCtx(e,a),y(a,{validation:"emoji",code:h.invalid_string,message:n.message}),s.dirty());else if(n.kind==="uuid")bn.test(e.data)||(a=this._getOrReturnCtx(e,a),y(a,{validation:"uuid",code:h.invalid_string,message:n.message}),s.dirty());else if(n.kind==="nanoid")_n.test(e.data)||(a=this._getOrReturnCtx(e,a),y(a,{validation:"nanoid",code:h.invalid_string,message:n.message}),s.dirty());else if(n.kind==="cuid")gn.test(e.data)||(a=this._getOrReturnCtx(e,a),y(a,{validation:"cuid",code:h.invalid_string,message:n.message}),s.dirty());else if(n.kind==="cuid2")yn.test(e.data)||(a=this._getOrReturnCtx(e,a),y(a,{validation:"cuid2",code:h.invalid_string,message:n.message}),s.dirty());else if(n.kind==="ulid")vn.test(e.data)||(a=this._getOrReturnCtx(e,a),y(a,{validation:"ulid",code:h.invalid_string,message:n.message}),s.dirty());else if(n.kind==="url")try{new URL(e.data)}catch{a=this._getOrReturnCtx(e,a),y(a,{validation:"url",code:h.invalid_string,message:n.message}),s.dirty()}else n.kind==="regex"?(n.regex.lastIndex=0,n.regex.test(e.data)||(a=this._getOrReturnCtx(e,a),y(a,{validation:"regex",code:h.invalid_string,message:n.message}),s.dirty())):n.kind==="trim"?e.data=e.data.trim():n.kind==="includes"?e.data.includes(n.value,n.position)||(a=this._getOrReturnCtx(e,a),y(a,{code:h.invalid_string,validation:{includes:n.value,position:n.position},message:n.message}),s.dirty()):n.kind==="toLowerCase"?e.data=e.data.toLowerCase():n.kind==="toUpperCase"?e.data=e.data.toUpperCase():n.kind==="startsWith"?e.data.startsWith(n.value)||(a=this._getOrReturnCtx(e,a),y(a,{code:h.invalid_string,validation:{startsWith:n.value},message:n.message}),s.dirty()):n.kind==="endsWith"?e.data.endsWith(n.value)||(a=this._getOrReturnCtx(e,a),y(a,{code:h.invalid_string,validation:{endsWith:n.value},message:n.message}),s.dirty()):n.kind==="datetime"?Br(n).test(e.data)||(a=this._getOrReturnCtx(e,a),y(a,{code:h.invalid_string,validation:"datetime",message:n.message}),s.dirty()):n.kind==="date"?En.test(e.data)||(a=this._getOrReturnCtx(e,a),y(a,{code:h.invalid_string,validation:"date",message:n.message}),s.dirty()):n.kind==="time"?An(n).test(e.data)||(a=this._getOrReturnCtx(e,a),y(a,{code:h.invalid_string,validation:"time",message:n.message}),s.dirty()):n.kind==="duration"?xn.test(e.data)||(a=this._getOrReturnCtx(e,a),y(a,{validation:"duration",code:h.invalid_string,message:n.message}),s.dirty()):n.kind==="ip"?Nn(e.data,n.version)||(a=this._getOrReturnCtx(e,a),y(a,{validation:"ip",code:h.invalid_string,message:n.message}),s.dirty()):n.kind==="base64"?Cn.test(e.data)||(a=this._getOrReturnCtx(e,a),y(a,{validation:"base64",code:h.invalid_string,message:n.message}),s.dirty()):O.assertNever(n);return{status:s.value,value:e.data}}_regex(e,r,s){return this.refinement(a=>e.test(a),{validation:r,code:h.invalid_string,...k.errToObj(s)})}_addCheck(e){return new fe({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...k.errToObj(e)})}url(e){return this._addCheck({kind:"url",...k.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...k.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...k.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...k.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...k.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...k.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...k.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...k.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...k.errToObj(e)})}datetime(e){var r,s;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(r=e==null?void 0:e.offset)!==null&&r!==void 0?r:!1,local:(s=e==null?void 0:e.local)!==null&&s!==void 0?s:!1,...k.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,...k.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...k.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...k.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r==null?void 0:r.position,...k.errToObj(r==null?void 0:r.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...k.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...k.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...k.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...k.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...k.errToObj(r)})}nonempty(e){return this.min(1,k.errToObj(e))}trim(){return new fe({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new fe({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new fe({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get minLength(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}}fe.create=t=>{var e;return new fe({checks:[],typeName:S.ZodString,coerce:(e=t==null?void 0:t.coerce)!==null&&e!==void 0?e:!1,...A(t)})};function Vn(t,e){const r=(t.toString().split(".")[1]||"").length,s=(e.toString().split(".")[1]||"").length,a=r>s?r:s,n=parseInt(t.toFixed(a).replace(".","")),i=parseInt(e.toFixed(a).replace(".",""));return n%i/Math.pow(10,a)}class je extends V{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==b.number){const n=this._getOrReturnCtx(e);return y(n,{code:h.invalid_type,expected:b.number,received:n.parsedType}),C}let s;const a=new ee;for(const n of this._def.checks)n.kind==="int"?O.isInteger(e.data)||(s=this._getOrReturnCtx(e,s),y(s,{code:h.invalid_type,expected:"integer",received:"float",message:n.message}),a.dirty()):n.kind==="min"?(n.inclusive?e.data<n.value:e.data<=n.value)&&(s=this._getOrReturnCtx(e,s),y(s,{code:h.too_small,minimum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),a.dirty()):n.kind==="max"?(n.inclusive?e.data>n.value:e.data>=n.value)&&(s=this._getOrReturnCtx(e,s),y(s,{code:h.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),a.dirty()):n.kind==="multipleOf"?Vn(e.data,n.value)!==0&&(s=this._getOrReturnCtx(e,s),y(s,{code:h.not_multiple_of,multipleOf:n.value,message:n.message}),a.dirty()):n.kind==="finite"?Number.isFinite(e.data)||(s=this._getOrReturnCtx(e,s),y(s,{code:h.not_finite,message:n.message}),a.dirty()):O.assertNever(n);return{status:a.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,k.toString(r))}gt(e,r){return this.setLimit("min",e,!1,k.toString(r))}lte(e,r){return this.setLimit("max",e,!0,k.toString(r))}lt(e,r){return this.setLimit("max",e,!1,k.toString(r))}setLimit(e,r,s,a){return new je({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:s,message:k.toString(a)}]})}_addCheck(e){return new je({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:k.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:k.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:k.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:k.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:k.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:k.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:k.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:k.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:k.toString(e)})}get minValue(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&O.isInteger(e.value))}get isFinite(){let e=null,r=null;for(const s of this._def.checks){if(s.kind==="finite"||s.kind==="int"||s.kind==="multipleOf")return!0;s.kind==="min"?(r===null||s.value>r)&&(r=s.value):s.kind==="max"&&(e===null||s.value<e)&&(e=s.value)}return Number.isFinite(r)&&Number.isFinite(e)}}je.create=t=>new je({checks:[],typeName:S.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...A(t)});class De extends V{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce&&(e.data=BigInt(e.data)),this._getType(e)!==b.bigint){const n=this._getOrReturnCtx(e);return y(n,{code:h.invalid_type,expected:b.bigint,received:n.parsedType}),C}let s;const a=new ee;for(const n of this._def.checks)n.kind==="min"?(n.inclusive?e.data<n.value:e.data<=n.value)&&(s=this._getOrReturnCtx(e,s),y(s,{code:h.too_small,type:"bigint",minimum:n.value,inclusive:n.inclusive,message:n.message}),a.dirty()):n.kind==="max"?(n.inclusive?e.data>n.value:e.data>=n.value)&&(s=this._getOrReturnCtx(e,s),y(s,{code:h.too_big,type:"bigint",maximum:n.value,inclusive:n.inclusive,message:n.message}),a.dirty()):n.kind==="multipleOf"?e.data%n.value!==BigInt(0)&&(s=this._getOrReturnCtx(e,s),y(s,{code:h.not_multiple_of,multipleOf:n.value,message:n.message}),a.dirty()):O.assertNever(n);return{status:a.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,k.toString(r))}gt(e,r){return this.setLimit("min",e,!1,k.toString(r))}lte(e,r){return this.setLimit("max",e,!0,k.toString(r))}lt(e,r){return this.setLimit("max",e,!1,k.toString(r))}setLimit(e,r,s,a){return new De({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:s,message:k.toString(a)}]})}_addCheck(e){return new De({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:k.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:k.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:k.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:k.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:k.toString(r)})}get minValue(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}}De.create=t=>{var e;return new De({checks:[],typeName:S.ZodBigInt,coerce:(e=t==null?void 0:t.coerce)!==null&&e!==void 0?e:!1,...A(t)})};class ft extends V{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==b.boolean){const s=this._getOrReturnCtx(e);return y(s,{code:h.invalid_type,expected:b.boolean,received:s.parsedType}),C}return ne(e.data)}}ft.create=t=>new ft({typeName:S.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...A(t)});class ze extends V{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==b.date){const n=this._getOrReturnCtx(e);return y(n,{code:h.invalid_type,expected:b.date,received:n.parsedType}),C}if(isNaN(e.data.getTime())){const n=this._getOrReturnCtx(e);return y(n,{code:h.invalid_date}),C}const s=new ee;let a;for(const n of this._def.checks)n.kind==="min"?e.data.getTime()<n.value&&(a=this._getOrReturnCtx(e,a),y(a,{code:h.too_small,message:n.message,inclusive:!0,exact:!1,minimum:n.value,type:"date"}),s.dirty()):n.kind==="max"?e.data.getTime()>n.value&&(a=this._getOrReturnCtx(e,a),y(a,{code:h.too_big,message:n.message,inclusive:!0,exact:!1,maximum:n.value,type:"date"}),s.dirty()):O.assertNever(n);return{status:s.value,value:new Date(e.data.getTime())}}_addCheck(e){return new ze({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:k.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:k.toString(r)})}get minDate(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}}ze.create=t=>new ze({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:S.ZodDate,...A(t)});class Dt extends V{_parse(e){if(this._getType(e)!==b.symbol){const s=this._getOrReturnCtx(e);return y(s,{code:h.invalid_type,expected:b.symbol,received:s.parsedType}),C}return ne(e.data)}}Dt.create=t=>new Dt({typeName:S.ZodSymbol,...A(t)});class ht extends V{_parse(e){if(this._getType(e)!==b.undefined){const s=this._getOrReturnCtx(e);return y(s,{code:h.invalid_type,expected:b.undefined,received:s.parsedType}),C}return ne(e.data)}}ht.create=t=>new ht({typeName:S.ZodUndefined,...A(t)});class pt extends V{_parse(e){if(this._getType(e)!==b.null){const s=this._getOrReturnCtx(e);return y(s,{code:h.invalid_type,expected:b.null,received:s.parsedType}),C}return ne(e.data)}}pt.create=t=>new pt({typeName:S.ZodNull,...A(t)});class Qe extends V{constructor(){super(...arguments),this._any=!0}_parse(e){return ne(e.data)}}Qe.create=t=>new Qe({typeName:S.ZodAny,...A(t)});class Ue extends V{constructor(){super(...arguments),this._unknown=!0}_parse(e){return ne(e.data)}}Ue.create=t=>new Ue({typeName:S.ZodUnknown,...A(t)});class Ee extends V{_parse(e){const r=this._getOrReturnCtx(e);return y(r,{code:h.invalid_type,expected:b.never,received:r.parsedType}),C}}Ee.create=t=>new Ee({typeName:S.ZodNever,...A(t)});class Lt extends V{_parse(e){if(this._getType(e)!==b.undefined){const s=this._getOrReturnCtx(e);return y(s,{code:h.invalid_type,expected:b.void,received:s.parsedType}),C}return ne(e.data)}}Lt.create=t=>new Lt({typeName:S.ZodVoid,...A(t)});class he extends V{_parse(e){const{ctx:r,status:s}=this._processInputParams(e),a=this._def;if(r.parsedType!==b.array)return y(r,{code:h.invalid_type,expected:b.array,received:r.parsedType}),C;if(a.exactLength!==null){const i=r.data.length>a.exactLength.value,o=r.data.length<a.exactLength.value;(i||o)&&(y(r,{code:i?h.too_big:h.too_small,minimum:o?a.exactLength.value:void 0,maximum:i?a.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:a.exactLength.message}),s.dirty())}if(a.minLength!==null&&r.data.length<a.minLength.value&&(y(r,{code:h.too_small,minimum:a.minLength.value,type:"array",inclusive:!0,exact:!1,message:a.minLength.message}),s.dirty()),a.maxLength!==null&&r.data.length>a.maxLength.value&&(y(r,{code:h.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),s.dirty()),r.common.async)return Promise.all([...r.data].map((i,o)=>a.type._parseAsync(new ve(r,i,r.path,o)))).then(i=>ee.mergeArray(s,i));const n=[...r.data].map((i,o)=>a.type._parseSync(new ve(r,i,r.path,o)));return ee.mergeArray(s,n)}get element(){return this._def.type}min(e,r){return new he({...this._def,minLength:{value:e,message:k.toString(r)}})}max(e,r){return new he({...this._def,maxLength:{value:e,message:k.toString(r)}})}length(e,r){return new he({...this._def,exactLength:{value:e,message:k.toString(r)}})}nonempty(e){return this.min(1,e)}}he.create=(t,e)=>new he({type:t,minLength:null,maxLength:null,exactLength:null,typeName:S.ZodArray,...A(e)});function et(t){if(t instanceof z){const e={};for(const r in t.shape){const s=t.shape[r];e[r]=_e.create(et(s))}return new z({...t._def,shape:()=>e})}else return t instanceof he?new he({...t._def,type:et(t.element)}):t instanceof _e?_e.create(et(t.unwrap())):t instanceof Pe?Pe.create(et(t.unwrap())):t instanceof be?be.create(t.items.map(e=>et(e))):t}class z extends V{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),r=O.objectKeys(e);return this._cached={shape:e,keys:r}}_parse(e){if(this._getType(e)!==b.object){const f=this._getOrReturnCtx(e);return y(f,{code:h.invalid_type,expected:b.object,received:f.parsedType}),C}const{status:s,ctx:a}=this._processInputParams(e),{shape:n,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof Ee&&this._def.unknownKeys==="strip"))for(const f in a.data)i.includes(f)||o.push(f);const u=[];for(const f of i){const p=n[f],x=a.data[f];u.push({key:{status:"valid",value:f},value:p._parse(new ve(a,x,a.path,f)),alwaysSet:f in a.data})}if(this._def.catchall instanceof Ee){const f=this._def.unknownKeys;if(f==="passthrough")for(const p of o)u.push({key:{status:"valid",value:p},value:{status:"valid",value:a.data[p]}});else if(f==="strict")o.length>0&&(y(a,{code:h.unrecognized_keys,keys:o}),s.dirty());else if(f!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const f=this._def.catchall;for(const p of o){const x=a.data[p];u.push({key:{status:"valid",value:p},value:f._parse(new ve(a,x,a.path,p)),alwaysSet:p in a.data})}}return a.common.async?Promise.resolve().then(async()=>{const f=[];for(const p of u){const x=await p.key,Y=await p.value;f.push({key:x,value:Y,alwaysSet:p.alwaysSet})}return f}).then(f=>ee.mergeObjectSync(s,f)):ee.mergeObjectSync(s,u)}get shape(){return this._def.shape()}strict(e){return k.errToObj,new z({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,s)=>{var a,n,i,o;const u=(i=(n=(a=this._def).errorMap)===null||n===void 0?void 0:n.call(a,r,s).message)!==null&&i!==void 0?i:s.defaultError;return r.code==="unrecognized_keys"?{message:(o=k.errToObj(e).message)!==null&&o!==void 0?o:u}:{message:u}}}:{}})}strip(){return new z({...this._def,unknownKeys:"strip"})}passthrough(){return new z({...this._def,unknownKeys:"passthrough"})}extend(e){return new z({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new z({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:S.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new z({...this._def,catchall:e})}pick(e){const r={};return O.objectKeys(e).forEach(s=>{e[s]&&this.shape[s]&&(r[s]=this.shape[s])}),new z({...this._def,shape:()=>r})}omit(e){const r={};return O.objectKeys(this.shape).forEach(s=>{e[s]||(r[s]=this.shape[s])}),new z({...this._def,shape:()=>r})}deepPartial(){return et(this)}partial(e){const r={};return O.objectKeys(this.shape).forEach(s=>{const a=this.shape[s];e&&!e[s]?r[s]=a:r[s]=a.optional()}),new z({...this._def,shape:()=>r})}required(e){const r={};return O.objectKeys(this.shape).forEach(s=>{if(e&&!e[s])r[s]=this.shape[s];else{let n=this.shape[s];for(;n instanceof _e;)n=n._def.innerType;r[s]=n}}),new z({...this._def,shape:()=>r})}keyof(){return Wr(O.objectKeys(this.shape))}}z.create=(t,e)=>new z({shape:()=>t,unknownKeys:"strip",catchall:Ee.create(),typeName:S.ZodObject,...A(e)}),z.strictCreate=(t,e)=>new z({shape:()=>t,unknownKeys:"strict",catchall:Ee.create(),typeName:S.ZodObject,...A(e)}),z.lazycreate=(t,e)=>new z({shape:t,unknownKeys:"strip",catchall:Ee.create(),typeName:S.ZodObject,...A(e)});class mt extends V{_parse(e){const{ctx:r}=this._processInputParams(e),s=this._def.options;function a(n){for(const o of n)if(o.result.status==="valid")return o.result;for(const o of n)if(o.result.status==="dirty")return r.common.issues.push(...o.ctx.common.issues),o.result;const i=n.map(o=>new le(o.ctx.common.issues));return y(r,{code:h.invalid_union,unionErrors:i}),C}if(r.common.async)return Promise.all(s.map(async n=>{const i={...r,common:{...r.common,issues:[]},parent:null};return{result:await n._parseAsync({data:r.data,path:r.path,parent:i}),ctx:i}})).then(a);{let n;const i=[];for(const u of s){const f={...r,common:{...r.common,issues:[]},parent:null},p=u._parseSync({data:r.data,path:r.path,parent:f});if(p.status==="valid")return p;p.status==="dirty"&&!n&&(n={result:p,ctx:f}),f.common.issues.length&&i.push(f.common.issues)}if(n)return r.common.issues.push(...n.ctx.common.issues),n.result;const o=i.map(u=>new le(u));return y(r,{code:h.invalid_union,unionErrors:o}),C}}get options(){return this._def.options}}mt.create=(t,e)=>new mt({options:t,typeName:S.ZodUnion,...A(e)});const Ae=t=>t instanceof vt?Ae(t.schema):t instanceof pe?Ae(t.innerType()):t instanceof bt?[t.value]:t instanceof Le?t.options:t instanceof _t?O.objectValues(t.enum):t instanceof xt?Ae(t._def.innerType):t instanceof ht?[void 0]:t instanceof pt?[null]:t instanceof _e?[void 0,...Ae(t.unwrap())]:t instanceof Pe?[null,...Ae(t.unwrap())]:t instanceof sr||t instanceof Tt?Ae(t.unwrap()):t instanceof wt?Ae(t._def.innerType):[];class Pt extends V{_parse(e){const{ctx:r}=this._processInputParams(e);if(r.parsedType!==b.object)return y(r,{code:h.invalid_type,expected:b.object,received:r.parsedType}),C;const s=this.discriminator,a=r.data[s],n=this.optionsMap.get(a);return n?r.common.async?n._parseAsync({data:r.data,path:r.path,parent:r}):n._parseSync({data:r.data,path:r.path,parent:r}):(y(r,{code:h.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[s]}),C)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,s){const a=new Map;for(const n of r){const i=Ae(n.shape[e]);if(!i.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const o of i){if(a.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);a.set(o,n)}}return new Pt({typeName:S.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:a,...A(s)})}}function rr(t,e){const r=Me(t),s=Me(e);if(t===e)return{valid:!0,data:t};if(r===b.object&&s===b.object){const a=O.objectKeys(e),n=O.objectKeys(t).filter(o=>a.indexOf(o)!==-1),i={...t,...e};for(const o of n){const u=rr(t[o],e[o]);if(!u.valid)return{valid:!1};i[o]=u.data}return{valid:!0,data:i}}else if(r===b.array&&s===b.array){if(t.length!==e.length)return{valid:!1};const a=[];for(let n=0;n<t.length;n++){const i=t[n],o=e[n],u=rr(i,o);if(!u.valid)return{valid:!1};a.push(u.data)}return{valid:!0,data:a}}else return r===b.date&&s===b.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}class gt extends V{_parse(e){const{status:r,ctx:s}=this._processInputParams(e),a=(n,i)=>{if(Qt(n)||Qt(i))return C;const o=rr(n.value,i.value);return o.valid?((er(n)||er(i))&&r.dirty(),{status:r.value,value:o.data}):(y(s,{code:h.invalid_intersection_types}),C)};return s.common.async?Promise.all([this._def.left._parseAsync({data:s.data,path:s.path,parent:s}),this._def.right._parseAsync({data:s.data,path:s.path,parent:s})]).then(([n,i])=>a(n,i)):a(this._def.left._parseSync({data:s.data,path:s.path,parent:s}),this._def.right._parseSync({data:s.data,path:s.path,parent:s}))}}gt.create=(t,e,r)=>new gt({left:t,right:e,typeName:S.ZodIntersection,...A(r)});class be extends V{_parse(e){const{status:r,ctx:s}=this._processInputParams(e);if(s.parsedType!==b.array)return y(s,{code:h.invalid_type,expected:b.array,received:s.parsedType}),C;if(s.data.length<this._def.items.length)return y(s,{code:h.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),C;!this._def.rest&&s.data.length>this._def.items.length&&(y(s,{code:h.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());const n=[...s.data].map((i,o)=>{const u=this._def.items[o]||this._def.rest;return u?u._parse(new ve(s,i,s.path,o)):null}).filter(i=>!!i);return s.common.async?Promise.all(n).then(i=>ee.mergeArray(r,i)):ee.mergeArray(r,n)}get items(){return this._def.items}rest(e){return new be({...this._def,rest:e})}}be.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new be({items:t,typeName:S.ZodTuple,rest:null,...A(e)})};class yt extends V{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:r,ctx:s}=this._processInputParams(e);if(s.parsedType!==b.object)return y(s,{code:h.invalid_type,expected:b.object,received:s.parsedType}),C;const a=[],n=this._def.keyType,i=this._def.valueType;for(const o in s.data)a.push({key:n._parse(new ve(s,o,s.path,o)),value:i._parse(new ve(s,s.data[o],s.path,o)),alwaysSet:o in s.data});return s.common.async?ee.mergeObjectAsync(r,a):ee.mergeObjectSync(r,a)}get element(){return this._def.valueType}static create(e,r,s){return r instanceof V?new yt({keyType:e,valueType:r,typeName:S.ZodRecord,...A(s)}):new yt({keyType:fe.create(),valueType:e,typeName:S.ZodRecord,...A(r)})}}class Ft extends V{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:r,ctx:s}=this._processInputParams(e);if(s.parsedType!==b.map)return y(s,{code:h.invalid_type,expected:b.map,received:s.parsedType}),C;const a=this._def.keyType,n=this._def.valueType,i=[...s.data.entries()].map(([o,u],f)=>({key:a._parse(new ve(s,o,s.path,[f,"key"])),value:n._parse(new ve(s,u,s.path,[f,"value"]))}));if(s.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const u of i){const f=await u.key,p=await u.value;if(f.status==="aborted"||p.status==="aborted")return C;(f.status==="dirty"||p.status==="dirty")&&r.dirty(),o.set(f.value,p.value)}return{status:r.value,value:o}})}else{const o=new Map;for(const u of i){const f=u.key,p=u.value;if(f.status==="aborted"||p.status==="aborted")return C;(f.status==="dirty"||p.status==="dirty")&&r.dirty(),o.set(f.value,p.value)}return{status:r.value,value:o}}}}Ft.create=(t,e,r)=>new Ft({valueType:e,keyType:t,typeName:S.ZodMap,...A(r)});class Be extends V{_parse(e){const{status:r,ctx:s}=this._processInputParams(e);if(s.parsedType!==b.set)return y(s,{code:h.invalid_type,expected:b.set,received:s.parsedType}),C;const a=this._def;a.minSize!==null&&s.data.size<a.minSize.value&&(y(s,{code:h.too_small,minimum:a.minSize.value,type:"set",inclusive:!0,exact:!1,message:a.minSize.message}),r.dirty()),a.maxSize!==null&&s.data.size>a.maxSize.value&&(y(s,{code:h.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),r.dirty());const n=this._def.valueType;function i(u){const f=new Set;for(const p of u){if(p.status==="aborted")return C;p.status==="dirty"&&r.dirty(),f.add(p.value)}return{status:r.value,value:f}}const o=[...s.data.values()].map((u,f)=>n._parse(new ve(s,u,s.path,f)));return s.common.async?Promise.all(o).then(u=>i(u)):i(o)}min(e,r){return new Be({...this._def,minSize:{value:e,message:k.toString(r)}})}max(e,r){return new Be({...this._def,maxSize:{value:e,message:k.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}}Be.create=(t,e)=>new Be({valueType:t,minSize:null,maxSize:null,typeName:S.ZodSet,...A(e)});class tt extends V{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:r}=this._processInputParams(e);if(r.parsedType!==b.function)return y(r,{code:h.invalid_type,expected:b.function,received:r.parsedType}),C;function s(o,u){return Mt({data:o,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Rt(),Xe].filter(f=>!!f),issueData:{code:h.invalid_arguments,argumentsError:u}})}function a(o,u){return Mt({data:o,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Rt(),Xe].filter(f=>!!f),issueData:{code:h.invalid_return_type,returnTypeError:u}})}const n={errorMap:r.common.contextualErrorMap},i=r.data;if(this._def.returns instanceof rt){const o=this;return ne(async function(...u){const f=new le([]),p=await o._def.args.parseAsync(u,n).catch(B=>{throw f.addIssue(s(u,B)),f}),x=await Reflect.apply(i,this,p);return await o._def.returns._def.type.parseAsync(x,n).catch(B=>{throw f.addIssue(a(x,B)),f})})}else{const o=this;return ne(function(...u){const f=o._def.args.safeParse(u,n);if(!f.success)throw new le([s(u,f.error)]);const p=Reflect.apply(i,this,f.data),x=o._def.returns.safeParse(p,n);if(!x.success)throw new le([a(p,x.error)]);return x.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new tt({...this._def,args:be.create(e).rest(Ue.create())})}returns(e){return new tt({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,s){return new tt({args:e||be.create([]).rest(Ue.create()),returns:r||Ue.create(),typeName:S.ZodFunction,...A(s)})}}class vt extends V{get schema(){return this._def.getter()}_parse(e){const{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}}vt.create=(t,e)=>new vt({getter:t,typeName:S.ZodLazy,...A(e)});class bt extends V{_parse(e){if(e.data!==this._def.value){const r=this._getOrReturnCtx(e);return y(r,{received:r.data,code:h.invalid_literal,expected:this._def.value}),C}return{status:"valid",value:e.data}}get value(){return this._def.value}}bt.create=(t,e)=>new bt({value:t,typeName:S.ZodLiteral,...A(e)});function Wr(t,e){return new Le({values:t,typeName:S.ZodEnum,...A(e)})}class Le extends V{constructor(){super(...arguments),dt.set(this,void 0)}_parse(e){if(typeof e.data!="string"){const r=this._getOrReturnCtx(e),s=this._def.values;return y(r,{expected:O.joinValues(s),received:r.parsedType,code:h.invalid_type}),C}if(jt(this,dt)||Fr(this,dt,new Set(this._def.values)),!jt(this,dt).has(e.data)){const r=this._getOrReturnCtx(e),s=this._def.values;return y(r,{received:r.data,code:h.invalid_enum_value,options:s}),C}return ne(e.data)}get options(){return this._def.values}get enum(){const e={};for(const r of this._def.values)e[r]=r;return e}get Values(){const e={};for(const r of this._def.values)e[r]=r;return e}get Enum(){const e={};for(const r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return Le.create(e,{...this._def,...r})}exclude(e,r=this._def){return Le.create(this.options.filter(s=>!e.includes(s)),{...this._def,...r})}}dt=new WeakMap,Le.create=Wr;class _t extends V{constructor(){super(...arguments),ut.set(this,void 0)}_parse(e){const r=O.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(e);if(s.parsedType!==b.string&&s.parsedType!==b.number){const a=O.objectValues(r);return y(s,{expected:O.joinValues(a),received:s.parsedType,code:h.invalid_type}),C}if(jt(this,ut)||Fr(this,ut,new Set(O.getValidEnumValues(this._def.values))),!jt(this,ut).has(e.data)){const a=O.objectValues(r);return y(s,{received:s.data,code:h.invalid_enum_value,options:a}),C}return ne(e.data)}get enum(){return this._def.values}}ut=new WeakMap,_t.create=(t,e)=>new _t({values:t,typeName:S.ZodNativeEnum,...A(e)});class rt extends V{unwrap(){return this._def.type}_parse(e){const{ctx:r}=this._processInputParams(e);if(r.parsedType!==b.promise&&r.common.async===!1)return y(r,{code:h.invalid_type,expected:b.promise,received:r.parsedType}),C;const s=r.parsedType===b.promise?r.data:Promise.resolve(r.data);return ne(s.then(a=>this._def.type.parseAsync(a,{path:r.path,errorMap:r.common.contextualErrorMap})))}}rt.create=(t,e)=>new rt({type:t,typeName:S.ZodPromise,...A(e)});class pe extends V{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===S.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:r,ctx:s}=this._processInputParams(e),a=this._def.effect||null,n={addIssue:i=>{y(s,i),i.fatal?r.abort():r.dirty()},get path(){return s.path}};if(n.addIssue=n.addIssue.bind(n),a.type==="preprocess"){const i=a.transform(s.data,n);if(s.common.async)return Promise.resolve(i).then(async o=>{if(r.value==="aborted")return C;const u=await this._def.schema._parseAsync({data:o,path:s.path,parent:s});return u.status==="aborted"?C:u.status==="dirty"||r.value==="dirty"?Ke(u.value):u});{if(r.value==="aborted")return C;const o=this._def.schema._parseSync({data:i,path:s.path,parent:s});return o.status==="aborted"?C:o.status==="dirty"||r.value==="dirty"?Ke(o.value):o}}if(a.type==="refinement"){const i=o=>{const u=a.refinement(o,n);if(s.common.async)return Promise.resolve(u);if(u instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(s.common.async===!1){const o=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});return o.status==="aborted"?C:(o.status==="dirty"&&r.dirty(),i(o.value),{status:r.value,value:o.value})}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(o=>o.status==="aborted"?C:(o.status==="dirty"&&r.dirty(),i(o.value).then(()=>({status:r.value,value:o.value}))))}if(a.type==="transform")if(s.common.async===!1){const i=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!lt(i))return i;const o=a.transform(i.value,n);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:o}}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(i=>lt(i)?Promise.resolve(a.transform(i.value,n)).then(o=>({status:r.value,value:o})):i);O.assertNever(a)}}pe.create=(t,e,r)=>new pe({schema:t,typeName:S.ZodEffects,effect:e,...A(r)}),pe.createWithPreprocess=(t,e,r)=>new pe({schema:e,effect:{type:"preprocess",transform:t},typeName:S.ZodEffects,...A(r)});class _e extends V{_parse(e){return this._getType(e)===b.undefined?ne(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}_e.create=(t,e)=>new _e({innerType:t,typeName:S.ZodOptional,...A(e)});class Pe extends V{_parse(e){return this._getType(e)===b.null?ne(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Pe.create=(t,e)=>new Pe({innerType:t,typeName:S.ZodNullable,...A(e)});class xt extends V{_parse(e){const{ctx:r}=this._processInputParams(e);let s=r.data;return r.parsedType===b.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:r.path,parent:r})}removeDefault(){return this._def.innerType}}xt.create=(t,e)=>new xt({innerType:t,typeName:S.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...A(e)});class wt extends V{_parse(e){const{ctx:r}=this._processInputParams(e),s={...r,common:{...r.common,issues:[]}},a=this._def.innerType._parse({data:s.data,path:s.path,parent:{...s}});return ct(a)?a.then(n=>({status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new le(s.common.issues)},input:s.data})})):{status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new le(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}}wt.create=(t,e)=>new wt({innerType:t,typeName:S.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...A(e)});class $t extends V{_parse(e){if(this._getType(e)!==b.nan){const s=this._getOrReturnCtx(e);return y(s,{code:h.invalid_type,expected:b.nan,received:s.parsedType}),C}return{status:"valid",value:e.data}}}$t.create=t=>new $t({typeName:S.ZodNaN,...A(t)});const On=Symbol("zod_brand");class sr extends V{_parse(e){const{ctx:r}=this._processInputParams(e),s=r.data;return this._def.type._parse({data:s,path:r.path,parent:r})}unwrap(){return this._def.type}}class kt extends V{_parse(e){const{status:r,ctx:s}=this._processInputParams(e);if(s.common.async)return(async()=>{const n=await this._def.in._parseAsync({data:s.data,path:s.path,parent:s});return n.status==="aborted"?C:n.status==="dirty"?(r.dirty(),Ke(n.value)):this._def.out._parseAsync({data:n.value,path:s.path,parent:s})})();{const a=this._def.in._parseSync({data:s.data,path:s.path,parent:s});return a.status==="aborted"?C:a.status==="dirty"?(r.dirty(),{status:"dirty",value:a.value}):this._def.out._parseSync({data:a.value,path:s.path,parent:s})}}static create(e,r){return new kt({in:e,out:r,typeName:S.ZodPipeline})}}class Tt extends V{_parse(e){const r=this._def.innerType._parse(e),s=a=>(lt(a)&&(a.value=Object.freeze(a.value)),a);return ct(r)?r.then(a=>s(a)):s(r)}unwrap(){return this._def.innerType}}Tt.create=(t,e)=>new Tt({innerType:t,typeName:S.ZodReadonly,...A(e)});function qr(t,e={},r){return t?Qe.create().superRefine((s,a)=>{var n,i;if(!t(s)){const o=typeof e=="function"?e(s):typeof e=="string"?{message:e}:e,u=(i=(n=o.fatal)!==null&&n!==void 0?n:r)!==null&&i!==void 0?i:!0,f=typeof o=="string"?{message:o}:o;a.addIssue({code:"custom",...f,fatal:u})}}):Qe.create()}const In={object:z.lazycreate};var S;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(S||(S={}));const Zn=(t,e={message:`Input not instance of ${t.name}`})=>qr(r=>r instanceof t,e),Gr=fe.create,Hr=je.create,Rn=$t.create,Mn=De.create,Yr=ft.create,jn=ze.create,Dn=Dt.create,Ln=ht.create,Pn=pt.create,Fn=Qe.create,$n=Ue.create,zn=Ee.create,Un=Lt.create,Bn=he.create,Wn=z.create,qn=z.strictCreate,Gn=mt.create,Hn=Pt.create,Yn=gt.create,Jn=be.create,Xn=yt.create,Kn=Ft.create,Qn=Be.create,ea=tt.create,ta=vt.create,ra=bt.create,sa=Le.create,na=_t.create,aa=rt.create,Jr=pe.create,ia=_e.create,oa=Pe.create,la=pe.createWithPreprocess,ca=kt.create;var U=Object.freeze({__proto__:null,defaultErrorMap:Xe,setErrorMap:pn,getErrorMap:Rt,makeIssue:Mt,EMPTY_PATH:mn,addIssueToContext:y,ParseStatus:ee,INVALID:C,DIRTY:Ke,OK:ne,isAborted:Qt,isDirty:er,isValid:lt,isAsync:ct,get util(){return O},get objectUtil(){return Kt},ZodParsedType:b,getParsedType:Me,ZodType:V,datetimeRegex:Br,ZodString:fe,ZodNumber:je,ZodBigInt:De,ZodBoolean:ft,ZodDate:ze,ZodSymbol:Dt,ZodUndefined:ht,ZodNull:pt,ZodAny:Qe,ZodUnknown:Ue,ZodNever:Ee,ZodVoid:Lt,ZodArray:he,ZodObject:z,ZodUnion:mt,ZodDiscriminatedUnion:Pt,ZodIntersection:gt,ZodTuple:be,ZodRecord:yt,ZodMap:Ft,ZodSet:Be,ZodFunction:tt,ZodLazy:vt,ZodLiteral:bt,ZodEnum:Le,ZodNativeEnum:_t,ZodPromise:rt,ZodEffects:pe,ZodTransformer:pe,ZodOptional:_e,ZodNullable:Pe,ZodDefault:xt,ZodCatch:wt,ZodNaN:$t,BRAND:On,ZodBranded:sr,ZodPipeline:kt,ZodReadonly:Tt,custom:qr,Schema:V,ZodSchema:V,late:In,get ZodFirstPartyTypeKind(){return S},coerce:{string:t=>fe.create({...t,coerce:!0}),number:t=>je.create({...t,coerce:!0}),boolean:t=>ft.create({...t,coerce:!0}),bigint:t=>De.create({...t,coerce:!0}),date:t=>ze.create({...t,coerce:!0})},any:Fn,array:Bn,bigint:Mn,boolean:Yr,date:jn,discriminatedUnion:Hn,effect:Jr,enum:sa,function:ea,instanceof:Zn,intersection:Yn,lazy:ta,literal:ra,map:Kn,nan:Rn,nativeEnum:na,never:zn,null:Pn,nullable:oa,number:Hr,object:Wn,oboolean:()=>Yr().optional(),onumber:()=>Hr().optional(),optional:ia,ostring:()=>Gr().optional(),pipeline:ca,preprocess:la,promise:aa,record:Xn,set:Qn,strictObject:qn,string:Gr,symbol:Dn,transformer:Jr,tuple:Jn,undefined:Ln,union:Gn,unknown:$n,void:Un,NEVER:C,ZodIssueCode:h,quotelessJson:hn,ZodError:le});const da=t=>{var r,s;const e={};for(const[a,n]of Object.entries(t)){let i;switch(n.type){case"string":n.optional?i=U.optional(U.string()):(i=U.string().min(1,{message:n.customMessage||"This field is required"}),n.minLength&&(i=i.min(n.minLength.value,n.minLength.message||`${Ce(a)} must be at least ${n.minLength.value} character long`)),n.maxLength&&(i=i.max(n.maxLength.value,n.maxLength.message||`${Ce(a)} must be at most ${n.maxLength.value} character`)),n.regex&&(i=i.regex(n.regex.value,n.regex.message)));break;case"email":n.optional?i=U.optional(U.string().email(n.customMessage||"Invalid email")):i=U.string().email(n.customMessage||"Invalid email");break;case"password":n.optional?i=U.optional(U.string()):(i=U.string().min(6,n.customMessage||`${Ce(a)} must be at least ${n.minLength?n.minLength.value:6} character long`),n.minLength&&(i=i.min(n.minLength.value,n.minLength.message||`${Ce(a)} must be at least ${n.minLength.value} character long`)),n.maxLength&&(i=i.max(n.maxLength.value,n.maxLength.message||`${Ce(a)} must be at most ${n.maxLength.value} character`)),n.regex&&(i=i.regex(n.regex.value,n.regex.message)));break;case"number":n.optional?i=U.optional(U.preprocess(o=>Number(o),U.number())):(i=U.preprocess(o=>Number(o),U.number()).refine(o=>Number(o),`${n.customMessage||"This field is required"}`),n.min&&(i=i.refine(o=>n.min&&typeof n.min.value=="number"?o>=n.min.value:o,{message:n.min.message||`${Ce(a)} must be greater than or equal to ${n.min.value}`})),n.max&&(i=i.refine(o=>n.max&&typeof n.max.value=="number"?o<=n.max.value:o,{message:n.max.message||`${Ce(a)} must be less than or equal to ${n.max.value}`})));break;case"date":n.optional?i=U.preprocess(o=>new Date(o),U.date()):(i=U.preprocess(o=>new Date(o),U.date()).refine(o=>new Date(o.toString()),n.customMessage||"Invalid date format"),n.min&&(i=i.refine(o=>{var u;return new Date(o.toString())>new Date((u=n.min)==null?void 0:u.value)},n.min.message||`${Ce(a)} must be greater than ${new Date((r=n.min)==null?void 0:r.value).toLocaleDateString("en-IN",{dateStyle:"medium"})}`)),n.max&&(i=i.refine(o=>{var u;return new Date(o.toString())<new Date((u=n.max)==null?void 0:u.value)},n.max.message||`${Ce(a)} must be less than ${new Date((s=n.max)==null?void 0:s.value).toLocaleDateString("en-IN",{dateStyle:"medium"})}`)));break;case"boolean":n.optional?i=U.preprocess(o=>o==="true"||o===!0,U.boolean()):i=U.preprocess(o=>o==="true"||o===!0,U.boolean()).refine(o=>!!o,{message:n.customMessage||"Invalid value"});break;default:throw new Error("Unsupported field type")}e[a]=i}return U.object(e)};Oe.createFormValidator=dn,Oe.useFormSchema=da,Object.defineProperty(Oe,Symbol.toStringTag,{value:"Module"})});
package/dist/index.d.ts CHANGED
@@ -9,6 +9,7 @@ interface FormProps<T extends z.ZodSchema>
9
9
  children: React.ReactNode;
10
10
  }
11
11
 
12
+ // @ts-ignore
12
13
  interface InputProps<T extends z.ZodSchema>
13
14
  extends React.InputHTMLAttributes<HTMLInputElement> {
14
15
  name: keyof z.infer<T>;
@@ -103,7 +104,7 @@ type SchemaKeyValuePair<T extends SchemaConfig<Record<string, FieldConfig>>> = {
103
104
  * The returned Form component also includes an Input component for form fields with automatic schema-based validation.
104
105
  *
105
106
  * @template T - The Zod schema used to define the structure and validation rules for the form.
106
- *
107
+ * @param {T} formSchema - Zod schema generated through useFormSchema or directly from Zod.
107
108
  * @returns {{
108
109
  * ({schema, children, className, onSubmit, ...props}: FormProps<T>): JSX.Element;
109
110
  * Input: ({label, name, className, ...props}: InputProps<T>) => JSX.Element;
@@ -129,7 +130,7 @@ type SchemaKeyValuePair<T extends SchemaConfig<Record<string, FieldConfig>>> = {
129
130
  * });
130
131
  *
131
132
  * // Generate the Form component
132
- * const MyForm = createFormValidator<typeof schema>();
133
+ * const MyForm = createFormValidator(schema);
133
134
  *
134
135
  * <MyForm schema={schema} onSubmit={(data) => {}}>
135
136
  * <MyForm.Input name="email" label="Email" type="email" />
@@ -138,8 +139,16 @@ type SchemaKeyValuePair<T extends SchemaConfig<Record<string, FieldConfig>>> = {
138
139
  * </MyForm>;
139
140
  */
140
141
 
141
- declare const createFormValidator: <T extends z.ZodSchema>() => {
142
- ({ schema, onSubmit, children, className }: FormProps<T>): JSX.Element;
142
+ declare const createFormValidator: <T extends z.ZodSchema>(
143
+ formSchema: T
144
+ ) => {
145
+ ({
146
+ schema,
147
+ onSubmit,
148
+ children,
149
+ className,
150
+ ...props
151
+ }: FormProps<T>): JSX.Element;
143
152
  Input({ name, label, className, ...props }: InputProps<T>): JSX.Element;
144
153
  };
145
154
 
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "An easy form validation package for react, built by using React hook form and zod library",
4
4
  "main": "dist/formaze.js",
5
5
  "types": "dist/index.d.ts",
6
- "version": "1.0.6",
6
+ "version": "1.0.8",
7
7
  "type": "module",
8
8
  "keywords": [
9
9
  "react",