"use client"; import { Button } from "@/components/ui/button"; import { Card, CardContent } from "@/components/ui/card"; import { Field, FieldDescription, FieldGroup, FieldLabel, FieldSeparator, } from "@/components/ui/field"; import { Input } from "@/components/ui/input"; import { authClient, googleSignInAvailable } from "@/lib/auth/client"; import { cn } from "@/lib/utils/ui"; import { RiLoader4Line } from "@remixicon/react"; import { useRouter } from "next/navigation"; import { useState, useMemo, type FormEvent } from "react"; import { toast } from "sonner"; import { Logo } from "../logo"; import { AuthErrorAlert } from "./auth-error-alert"; import { AuthHeader } from "./auth-header"; import AuthSidebar from "./auth-sidebar"; import { GoogleAuthButton } from "./google-auth-button"; import { RiCheckLine, RiCloseLine } from "@remixicon/react"; interface PasswordValidation { hasLowercase: boolean; hasUppercase: boolean; hasNumber: boolean; hasSpecial: boolean; hasMinLength: boolean; hasMaxLength: boolean; isValid: boolean; } function validatePassword(password: string): PasswordValidation { const hasLowercase = /[a-z]/.test(password); const hasUppercase = /[A-Z]/.test(password); const hasNumber = /\d/.test(password); const hasSpecial = /[!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?`~]/.test(password); const hasMinLength = password.length >= 7; const hasMaxLength = password.length <= 23; return { hasLowercase, hasUppercase, hasNumber, hasSpecial, hasMinLength, hasMaxLength, isValid: hasLowercase && hasUppercase && hasNumber && hasSpecial && hasMinLength && hasMaxLength, }; } function PasswordRequirement({ met, label, }: { met: boolean; label: string; }) { return (