import{j as e,h as r,i as s,k as a,l as t}from"./ui-0c1fdf09.js";import{r as l}from"./vendor-d03f97b3.js";function o(){const[o,n]=l.useState({name:"",email:"",subject:"",package:"",message:""}),[i,d]=l.useState({}),[c,m]=l.useState({}),[u,g]=l.useState("idle"),[b,x]=l.useState(0);l.useEffect((()=>{b>0&&h()}),[o,b]);const h=()=>{const e={};return o.name.trim()||(e.name="Name is required"),o.email.trim()?/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i.test(o.email)||(e.email="Invalid email address"):e.email="Email is required",o.subject.trim()||(e.subject="Please let me know what you need"),o.message.trim()?o.message.trim().length<10&&(e.message="Message is too short"):e.message="Please tell me about your project",d(e),0===Object.keys(e).length},p=e=>{const{id:r,value:s}=e.target;n((e=>({...e,[r]:s}))),m((e=>({...e,[r]:!0})))},f=e=>{const{id:r}=e.target;m((e=>({...e,[r]:!0}))),h()},j=e=>c[e]&&i[e];return e.jsxs("form",{className:"space-y-5",onSubmit:async e=>{e.preventDefault(),x((e=>e+1));if(h()){g("loading");try{(await fetch("https://formspree.io/f/xanewdzl",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)})).ok?(g("success"),n({name:"",email:"",subject:"",package:"",message:""}),m({}),x(0)):g("error")}catch(r){console.error("Form submission error:",r),g("error")}}},noValidate:!0,children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex justify-between items-center mb-1",children:[e.jsx("label",{htmlFor:"name",className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:"Your Name"}),j("name")&&e.jsxs("span",{className:"text-red-500 text-xs flex items-center",children:[e.jsx(r,{size:12,className:"mr-1"}),i.name]})]}),e.jsx("input",{type:"text",id:"name",value:o.name,onChange:p,onBlur:f,className:`w-full px-4 py-3 rounded-lg border ${j("name")?"border-red-300 dark:border-red-600 focus:ring-red-500":"border-gray-300 dark:border-gray-600 focus:ring-blue-500"} bg-white dark:bg-gray-700/50 dark:backdrop-blur-sm focus:ring-2 focus:border-transparent transition-colors shadow-sm`,placeholder:"What should I call you?",disabled:"loading"===u,"aria-invalid":j("name")?"true":"false"})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex justify-between items-center mb-1",children:[e.jsx("label",{htmlFor:"email",className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:"Your Email"}),j("email")&&e.jsxs("span",{className:"text-red-500 text-xs flex items-center",children:[e.jsx(r,{size:12,className:"mr-1"}),i.email]})]}),e.jsx("input",{type:"email",id:"email",value:o.email,onChange:p,onBlur:f,className:`w-full px-4 py-3 rounded-lg border ${j("email")?"border-red-300 dark:border-red-600 focus:ring-red-500":"border-gray-300 dark:border-gray-600 focus:ring-blue-500"} bg-white dark:bg-gray-700/50 dark:backdrop-blur-sm focus:ring-2 focus:border-transparent transition-colors shadow-sm`,placeholder:"So I can get back to you",disabled:"loading"===u,"aria-invalid":j("email")?"true":"false"})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex justify-between items-center mb-1",children:[e.jsx("label",{htmlFor:"subject",className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:"What do you need?"}),j("subject")&&e.jsxs("span",{className:"text-red-500 text-xs flex items-center",children:[e.jsx(r,{size:12,className:"mr-1"}),i.subject]})]}),e.jsx("input",{type:"text",id:"subject",value:o.subject,onChange:p,onBlur:f,className:`w-full px-4 py-3 rounded-lg border ${j("subject")?"border-red-300 dark:border-red-600 focus:ring-red-500":"border-gray-300 dark:border-gray-600 focus:ring-blue-500"} bg-white dark:bg-gray-700/50 dark:backdrop-blur-sm focus:ring-2 focus:border-transparent transition-colors shadow-sm`,placeholder:"Website, SEO, content, etc.",disabled:"loading"===u,"aria-invalid":j("subject")?"true":"false"})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"package",className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Interested in a package?"}),e.jsxs("select",{id:"package",value:o.package,onChange:p,className:"w-full px-4 py-3 rounded-lg border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700/50 dark:backdrop-blur-sm focus:ring-2 focus:ring-blue-500 focus:border-transparent transition-colors shadow-sm appearance-none",disabled:"loading"===u,children:[e.jsx("option",{value:"",children:"Not sure yet (that's okay!)"}),e.jsx("option",{value:"strategy",children:"Strategy Plan ($2,750)"}),e.jsx("option",{value:"done-with-you",children:"Done-With-You ($3,250/month)"}),e.jsx("option",{value:"done-for-you",children:"Done-For-You ($5,995/month)"}),e.jsx("option",{value:"custom",children:"Something custom"})]})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex justify-between items-center mb-1",children:[e.jsx("label",{htmlFor:"message",className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:"Tell me about your project"}),j("message")&&e.jsxs("span",{className:"text-red-500 text-xs flex items-center",children:[e.jsx(r,{size:12,className:"mr-1"}),i.message]})]}),e.jsx("textarea",{id:"message",rows:5,value:o.message,onChange:p,onBlur:f,className:`w-full px-4 py-3 rounded-lg border ${j("message")?"border-red-300 dark:border-red-600 focus:ring-red-500":"border-gray-300 dark:border-gray-600 focus:ring-blue-500"} bg-white dark:bg-gray-700/50 dark:backdrop-blur-sm focus:ring-2 focus:border-transparent transition-colors shadow-sm resize-none`,placeholder:"What are you trying to accomplish? Any timeline or budget constraints?",disabled:"loading"===u,"aria-invalid":j("message")?"true":"false"})]}),e.jsx("div",{children:e.jsx("button",{type:"submit",className:"w-full px-6 py-3 bg-gradient-to-r from-blue-600 to-indigo-600 hover:from-blue-500 hover:to-indigo-500 text-white rounded-lg transition-all duration-300 relative overflow-hidden shadow-lg hover:shadow-blue-500/30 group disabled:opacity-70 disabled:cursor-not-allowed",disabled:"loading"===u,children:"loading"===u?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"opacity-0",children:"Send it"}),e.jsx("span",{className:"absolute inset-0 flex items-center justify-center",children:e.jsx(s,{className:"h-5 w-5 text-white animate-spin"})})]}):e.jsxs("span",{className:"flex items-center justify-center",children:[e.jsx("span",{children:"Send it"}),e.jsx(a,{size:16,className:"ml-2 group-hover:translate-x-1 group-hover:-translate-y-1 transition-transform"})]})})}),"success"===u&&e.jsxs("div",{className:"bg-green-50 dark:bg-green-900/20 text-green-800 dark:text-green-200 p-4 rounded-lg flex items-center",children:[e.jsx(t,{className:"h-5 w-5 mr-2 text-green-500"}),e.jsx("p",{className:"text-sm font-medium",children:"Got it! I'll get back to you soon."})]}),"error"===u&&e.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 text-red-800 dark:text-red-200 p-4 rounded-lg flex items-center",children:[e.jsx(r,{className:"h-5 w-5 mr-2 text-red-500"}),e.jsx("p",{className:"text-sm font-medium",children:"Something went wrong. Try emailing me directly at contact@enrizhulati.com instead."})]})]})}export{o as default}; //# sourceMappingURL=ContactForm-e983a557.js.map