import{m as i}from"./vendor-ui-CflGdlft.js";document.addEventListener("alpine:init",()=>{i.data("formsComponent",()=>({contactForm:{firstName:"",lastName:"",email:"",subject:"",message:""},contactErrors:{},isSubmittingContact:!1,regForm:{username:"",email:"",password:"",confirmPassword:"",agreeToTerms:!1},regErrors:{},isSubmittingReg:!1,passwordStrength:{score:0,level:"weak"},files:[],isDragging:!1,wizardStep:1,wizardData:{personal:{firstName:"",lastName:"",email:""},account:{username:"",password:""},address:{street:"",city:"",zip:""}},wizardErrors:{personal:{},account:{},address:{}},validate(e,s){let t,a;switch(e){case"contact":t=this.contactErrors,a=this.contactForm;break;case"registration":t=this.regErrors,a=this.regForm;break;default:return}switch(s){case"firstName":t.firstName=a.firstName.length<2?"First name must be at least 2 characters":"";break;case"lastName":t.lastName=a.lastName.length<2?"Last name must be at least 2 characters":"";break;case"email":const r=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;t.email=r.test(a.email)?"":"Please enter a valid email address";break;case"username":t.username=a.username.length<3?"Username must be at least 3 characters":"";break;case"password":this.updatePasswordStrength(),t.password=this.passwordStrength.score<3?"Password is too weak":"";break;case"confirmPassword":t.confirmPassword=a.password!==a.confirmPassword?"Passwords do not match":"";break}},updatePasswordStrength(){const e=this.regForm.password;let s=0;e.length>=8&&s++,/[a-z]/.test(e)&&s++,/[A-Z]/.test(e)&&s++,/[0-9]/.test(e)&&s++,/[^A-Za-z0-9]/.test(e)&&s++;const t=["weak","weak","fair","good","strong"];this.passwordStrength={score:s,level:t[Math.floor(s/1.2)]}},handleFiles(e){const s=e.target.files||e.dataTransfer.files;for(let t=0;t<s.length;t++){const a=s[t];this.files.push({id:Date.now()+t,name:a.name,size:(a.size/1024).toFixed(2)+" KB",progress:0,status:"uploading"}),this.simulateUpload(this.files[this.files.length-1])}},simulateUpload(e){const s=setInterval(()=>{e.progress+=10,e.progress>=100&&(e.progress=100,e.status="complete",clearInterval(s))},200)},removeFile(e){this.files=this.files.filter(s=>s.id!==e)},nextStep(){this.wizardStep<3&&this.wizardStep++},prevStep(){this.wizardStep>1&&this.wizardStep--},goToStep(e){this.wizardStep=e},async submitContactForm(){this.isSubmittingContact=!0,await new Promise(e=>setTimeout(e,1500)),this.isSubmittingContact=!1,alert("Contact form submitted!")},async submitRegForm(){this.isSubmittingReg=!0,await new Promise(e=>setTimeout(e,1500)),this.isSubmittingReg=!1,alert("Registration form submitted!")}}))});
