'use client';
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./form-wrapper.cjs"),s=require("./password-field.cjs"),d=require("./email-field.cjs"),n=require("./phone-field.cjs"),l=require("./verification-code.cjs"),a=require("./field-error.cjs"),o={email:/^[^\s@]+@[^\s@]+\.[^\s@]+$/,phone:/^\+?[\d\s\-\(\)]+$/,password:{minLength:8,maxLength:128,requireUppercase:/[A-Z]/,requireLowercase:/[a-z]/,requireNumbers:/\d/,requireSpecialChars:/[!@#$%^&*(),.?":{}|<>_\-+=\[\]\\;'\/~`]/},verificationCode:{numeric:/^\d+$/,alphanumeric:/^[a-zA-Z0-9]+$/}},m={isValidEmail:e=>o.email.test(e),isValidPhone:e=>o.phone.test(e),isStrongPassword:e=>{const r=o.password;return e.length>=r.minLength&&e.length<=r.maxLength&&r.requireUppercase.test(e)&&r.requireLowercase.test(e)&&r.requireNumbers.test(e)&&r.requireSpecialChars.test(e)},isValidVerificationCode:(e,r,t="numeric")=>e.length!==r?!1:t==="numeric"?o.verificationCode.numeric.test(e):o.verificationCode.alphanumeric.test(e)},F={PasswordField:s.PasswordField,PasswordConfirmationField:s.PasswordConfirmationField,EmailField:d.EmailField,PhoneField:n.PhoneField,VerificationCode:l.VerificationCode},c={FormWrapper:i.FormWrapper,FieldError:a.default},f={useFormContext:i.useFormContext,useFormField:i.useFormField,useFieldError:a.useFieldError},u={signIn:{fields:["email","password"],validation:{email:{required:!0,validateFormat:!0},password:{required:!0,minLength:1}}},signUp:{fields:["email","password","passwordConfirmation"],validation:{email:{required:!0,validateFormat:!0},password:{required:!0,showStrength:!0},passwordConfirmation:{required:!0,mustMatch:"password"}}},resetPassword:{fields:["email"],validation:{email:{required:!0,validateFormat:!0}}},changePassword:{fields:["currentPassword","newPassword","confirmPassword"],validation:{currentPassword:{required:!0},newPassword:{required:!0,showStrength:!0},confirmPassword:{required:!0,mustMatch:"newPassword"}}},verifyEmail:{fields:["verificationCode"],validation:{verificationCode:{required:!0,length:6,type:"numeric"}}},verifyPhone:{fields:["phone","verificationCode"],validation:{phone:{required:!0,validateFormat:!0},verificationCode:{required:!0,length:6,type:"numeric"}}},setupMFA:{fields:["verificationCode"],validation:{verificationCode:{required:!0,length:6,type:"numeric"}}},verifyMFA:{fields:["verificationCode"],validation:{verificationCode:{required:!0,length:6,type:"numeric"}}},organizationInvite:{fields:["email"],validation:{email:{required:!0,validateFormat:!0}}}};function h(e,r={}){const t=u[e];return{...t,...r,validation:{...t.validation,...r.validation}}}function p(e,r){switch(r.type){case"SET_VALUE":return{...e,values:{...e.values,[r.field]:r.value},isDirty:!0,errors:{...e.errors,[r.field]:""}};case"SET_ERROR":return{...e,errors:{...e.errors,[r.field]:r.error||""}};case"SET_TOUCHED":return{...e,touched:{...e.touched,[r.field]:r.touched}};case"SET_SUBMITTING":return{...e,isSubmitting:r.isSubmitting};case"RESET_FORM":return{values:r.initialValues||{},errors:{},touched:{},isSubmitting:!1,isValid:!0,isDirty:!1};case"CLEAR_ERRORS":return{...e,errors:{}};default:return e}}exports.FormContext=i.FormContext;exports.FormWrapper=i.FormWrapper;exports.useFormContext=i.useFormContext;exports.useFormField=i.useFormField;exports.PasswordConfirmationField=s.PasswordConfirmationField;exports.PasswordField=s.PasswordField;exports.EmailField=d.EmailField;exports.PhoneField=n.PhoneField;exports.VerificationCode=l.VerificationCode;exports.FieldError=a.FieldError;exports.useFieldError=a.useFieldError;exports.FormFields=F;exports.FormHooks=f;exports.FormPresets=u;exports.FormUtilities=c;exports.ValidationHelpers=m;exports.ValidationRules=o;exports.buildForm=h;exports.formReducer=p;
//# sourceMappingURL=index.cjs.map
