import{b as I,a as k,r as u,c as B,e as F,f as e,F as A,j as d,S as R,A as C,T as t,R as f,I as p,g,h as c,i as K,y as T,o as N,G as L,z as _,C as j,B as w,D as z,E as H,s as E}from"./index.8aed0a19.js";import{P as M}from"./paths.3971dbe6.js";import{P as W}from"./Page.7007a3b0.js";function D({token:s}){const o=I(),r=k(),[n,S]=u.exports.useState(!1),[i,y]=u.exports.useState(!1),P=B().shape({}),l=F({resolver:N(P)}),{handleSubmit:x,setError:b,formState:{errors:m,isSubmitting:v}}=l;return e(A,{methods:l,onSubmit:x(async h=>{try{await T.post("/forget-password",{...h,token:s}),console.log(h),await new Promise(a=>setTimeout(a,500)),o.current&&r("/auth/login",{replace:!0})}catch(a){console.log(a.response.data),o.current&&b("afterSubmit",{...a,message:a.response.data.message})}}),children:d(R,{spacing:3,children:[!!m.afterSubmit&&e(C,{severity:"error",children:m.afterSubmit.message}),e(t,{children:"Kata Sandi Baru"}),e(f,{name:"new_password",label:"Kata Sandi Baru",type:n?"text":"password",InputProps:{endAdornment:e(p,{position:"end",children:e(g,{onClick:()=>S(!n),edge:"end",children:e(c,{icon:n?"eva:eye-fill":"eva:eye-off-fill"})})})}}),e(t,{children:"Konfirmasi Kata Sandi "}),e(f,{name:"confirm_new_password",label:"Konfirmasi Kata Sandi",type:i?"text":"password",InputProps:{endAdornment:e(p,{position:"end",children:e(g,{onClick:()=>y(!i),edge:"end",children:e(c,{icon:i?"eva:eye-fill":"eva:eye-off-fill"})})})}}),e(K,{fullWidth:!0,size:"large",type:"submit",variant:"contained",loading:v,children:"Reset Password"})]})})}const G=E("div")(({theme:s})=>({display:"flex",height:"100%",alignItems:"center",padding:s.spacing(12,0)}));function J(){const[s,o]=L(),r=s.get("token");return e(W,{title:"Verify",sx:{height:1},children:d(G,{children:[e(_,{}),e(j,{children:d(w,{sx:{maxWidth:480,mx:"auto"},children:[e(z,{size:"small",component:H,to:M.login,startIcon:e(c,{icon:"eva:arrow-ios-back-fill",width:20,height:20}),sx:{mb:3},children:"Back"}),e(t,{variant:"h3",paragraph:!0}),e(t,{sx:{color:"text.secondary"},children:"Please enter your new password."}),e(w,{sx:{mt:5,mb:3},children:e(D,{token:r})})]})})]})})}export{J as default};
