var e=(e,s,t)=>new Promise((a,r)=>{var l=e=>{try{n(t.next(e))}catch(s){r(s)}},o=e=>{try{n(t.throw(e))}catch(s){r(s)}},n=e=>e.done?a(e.value):Promise.resolve(e.value).then(l,o);n((t=t.apply(e,s)).next())});import{j as s,aX as t,aL as a,b0 as r,ad as l}from"./ui-vendor-BewJQzBv.js";import{r as o}from"./react-vendor-D6Nbkvjy.js";import{B as n,s as i}from"./home-components-zRcEiFkI.js";import{L as d,I as c}from"./admin-components-beYUcdNG.js";import{u as m}from"./case-study-components-DWRUehs-.js";import{u as h}from"./router-vendor-DmQqpneu.js";import"./supabase-vendor-aM9kV88h.js";import"./three-vendor-He8TdPNb.js";const u=()=>{const[u,x]=o.useState(""),[p,f]=o.useState(""),[w,j]=o.useState(!1),[v,b]=o.useState(!1),[g,N]=o.useState(!1),y=h(),{toast:P}=m();return o.useEffect(()=>{e(void 0,null,function*(){const{data:{session:e}}=yield i.auth.getSession();e||y("/forgot-password")})},[y]),s.jsxs("div",{className:"min-h-screen flex bg-white",children:[s.jsxs("div",{className:"w-1/2 bg-slate-800 flex flex-col justify-center items-center p-12 relative",children:[s.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-slate-700 to-slate-900"}),s.jsx("div",{className:"absolute bottom-20 right-20 w-64 h-64 bg-purple-600/20 rounded-full blur-3xl"}),s.jsxs("div",{className:"relative z-10 text-center",children:[s.jsx("div",{className:"w-24 h-24 rounded-full flex items-center justify-center mx-auto mb-8 overflow-hidden",children:s.jsx("img",{src:"/lovable-uploads/c9ee1f66-e991-4689-b22d-8a1d5f2c4df0.png",alt:"Marzelet Info Technology Logo",className:"w-full h-full object-contain",onError:e=>{e.currentTarget.style.display="none"}})}),s.jsx("h1",{className:"text-4xl font-bold text-white mb-6",children:"Marzelet Info Technology"}),s.jsx("p",{className:"text-xl text-slate-300 mb-12 max-w-md",children:"Set your new secure password"})]})]}),s.jsxs("div",{className:"w-1/2 bg-white flex flex-col justify-center p-12",children:[s.jsxs(n,{variant:"ghost",onClick:()=>y("/auth"),className:"self-start mb-8 text-slate-600 hover:text-slate-900",children:[s.jsx(t,{className:"w-4 h-4 mr-2"}),"Back to Sign In"]}),s.jsxs("div",{className:"max-w-md mx-auto w-full",children:[s.jsxs("div",{className:"text-center mb-8",children:[s.jsx("h2",{className:"text-3xl font-bold text-slate-900 mb-2",children:"Set New Password"}),s.jsx("p",{className:"text-slate-600",children:"Enter your new password below"})]}),s.jsxs("form",{onSubmit:s=>e(void 0,null,function*(){if(s.preventDefault(),u===p)if(u.length<6)P({title:"Password Too Short",description:"Password must be at least 6 characters long.",variant:"destructive"});else{N(!0);try{const{error:e}=yield i.auth.updateUser({password:u});if(e)throw e;P({title:"Password Updated",description:"Your password has been successfully updated."}),y("/auth")}catch(e){P({title:"Error",description:e.message,variant:"destructive"})}finally{N(!1)}}else P({title:"Password Mismatch",description:"Passwords do not match. Please try again.",variant:"destructive"})}),className:"space-y-6",children:[s.jsxs("div",{children:[s.jsx(d,{htmlFor:"password",className:"text-slate-700 font-medium",children:"New Password"}),s.jsxs("div",{className:"relative mt-2",children:[s.jsx(a,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-slate-400 w-5 h-5"}),s.jsx(c,{id:"password",type:w?"text":"password",value:u,onChange:e=>x(e.target.value),placeholder:"Enter new password",className:"pl-12 pr-12 h-12 bg-slate-50 border-slate-200",required:!0,minLength:6}),s.jsx("button",{type:"button",onClick:()=>j(!w),className:"absolute right-3 top-1/2 transform -translate-y-1/2 text-slate-400 hover:text-slate-600",children:w?s.jsx(r,{className:"w-5 h-5"}):s.jsx(l,{className:"w-5 h-5"})})]})]}),s.jsxs("div",{children:[s.jsx(d,{htmlFor:"confirmPassword",className:"text-slate-700 font-medium",children:"Confirm New Password"}),s.jsxs("div",{className:"relative mt-2",children:[s.jsx(a,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-slate-400 w-5 h-5"}),s.jsx(c,{id:"confirmPassword",type:v?"text":"password",value:p,onChange:e=>f(e.target.value),placeholder:"Confirm new password",className:"pl-12 pr-12 h-12 bg-slate-50 border-slate-200",required:!0,minLength:6}),s.jsx("button",{type:"button",onClick:()=>b(!v),className:"absolute right-3 top-1/2 transform -translate-y-1/2 text-slate-400 hover:text-slate-600",children:v?s.jsx(r,{className:"w-5 h-5"}):s.jsx(l,{className:"w-5 h-5"})})]})]}),s.jsx(n,{type:"submit",disabled:g,className:"w-full h-12 bg-orange-500 hover:bg-orange-600 text-white font-semibold rounded-lg",children:g?"Updating Password...":"Update Password"})]})]})]})]})};export{u as default};
