(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[48],{9082:function(e,a,s){Promise.resolve().then(s.bind(s,67611))},67611:function(e,a,s){"use strict";s.r(a),s.d(a,{default:function(){return l}});var t=s(57437),r=s(2265),n=s(27648),i=s(99376);function o(){(0,i.useRouter)();let e=(0,i.useSearchParams)().get("token"),[a,s]=(0,r.useState)(""),[o,l]=(0,r.useState)(""),[d,u]=(0,r.useState)(!1),[c,p]=(0,r.useState)(""),[h,x]=(0,r.useState)(!1),m=async s=>{if(s.preventDefault(),a!==o){p("Password tidak cocok");return}if(a.length<8){p("Password minimal 8 karakter");return}u(!0),p("");try{let s=await fetch("/api/auth/reset-password",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:e,password:a})}),t=await s.json();if(!s.ok)throw Error(t.error||"Terjadi kesalahan");x(!0)}catch(e){p(e.message)}finally{u(!1)}};return e?(0,t.jsxs)("div",{style:{width:"100%",maxWidth:"420px",position:"relative",zIndex:1},children:[(0,t.jsxs)("div",{style:{textAlign:"center",marginBottom:"40px"},children:[(0,t.jsx)("h1",{style:{fontSize:"24px",fontWeight:700,color:"#f1f5f9",marginBottom:"8px"},children:"Reset Password"}),(0,t.jsx)("p",{style:{color:"#64748b",fontSize:"14px"},children:"Masukkan password baru Anda."})]}),(0,t.jsx)("div",{className:"card",style:{padding:"32px"},children:h?(0,t.jsxs)("div",{style:{textAlign:"center"},children:[(0,t.jsx)("div",{style:{fontSize:"48px",marginBottom:"16px"},children:"✅"}),(0,t.jsx)("h3",{style:{color:"#10b981",marginBottom:"8px"},children:"Password Berhasil Diubah"}),(0,t.jsx)("p",{style:{color:"#94a3b8",fontSize:"14px",marginBottom:"24px"},children:"Silakan login dengan password baru Anda."}),(0,t.jsx)(n.default,{href:"/auth/login",className:"btn btn-primary",style:{display:"block",padding:"12px"},children:"Ke Halaman Login"})]}):(0,t.jsxs)("form",{onSubmit:m,children:[c&&(0,t.jsxs)("div",{style:{padding:"12px",background:"rgba(239,68,68,0.1)",border:"1px solid rgba(239,68,68,0.2)",borderRadius:"8px",color:"#ef4444",fontSize:"13px",marginBottom:"16px"},children:["❌ ",c]}),(0,t.jsxs)("div",{style:{marginBottom:"16px"},children:[(0,t.jsx)("label",{className:"label",children:"Password Baru"}),(0,t.jsx)("input",{className:"input",type:"password",placeholder:"Minimal 8 karakter",value:a,onChange:e=>s(e.target.value),required:!0})]}),(0,t.jsxs)("div",{style:{marginBottom:"24px"},children:[(0,t.jsx)("label",{className:"label",children:"Konfirmasi Password Baru"}),(0,t.jsx)("input",{className:"input",type:"password",placeholder:"Ulangi password baru",value:o,onChange:e=>l(e.target.value),required:!0})]}),(0,t.jsx)("button",{type:"submit",className:"btn btn-primary",style:{width:"100%",padding:"13px",fontSize:"15px"},disabled:d||!a||!o,children:d?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"spinner"})," Menyimpan..."]}):"Simpan Password Baru"})]})})]}):(0,t.jsxs)("div",{style:{textAlign:"center",padding:"40px",color:"#ef4444"},children:["Token tidak valid. Silakan ulangi proses lupa password.",(0,t.jsx)("br",{}),(0,t.jsx)("br",{}),(0,t.jsx)(n.default,{href:"/auth/forgot-password",style:{color:"#f59e0b"},children:"Kembali"})]})}function l(){return(0,t.jsxs)("main",{style:{minHeight:"100vh",background:"#0a0a0f",display:"flex",alignItems:"center",justifyContent:"center",padding:"24px"},children:[(0,t.jsx)("div",{style:{position:"fixed",top:"20%",left:"30%",width:400,height:400,background:"radial-gradient(circle, rgba(245,158,11,0.06), transparent 70%)",borderRadius:"50%",pointerEvents:"none"}}),(0,t.jsx)(r.Suspense,{fallback:(0,t.jsx)("span",{className:"spinner"}),children:(0,t.jsx)(o,{})})]})}},99376:function(e,a,s){"use strict";var t=s(35475);s.o(t,"useParams")&&s.d(a,{useParams:function(){return t.useParams}}),s.o(t,"usePathname")&&s.d(a,{usePathname:function(){return t.usePathname}}),s.o(t,"useRouter")&&s.d(a,{useRouter:function(){return t.useRouter}}),s.o(t,"useSearchParams")&&s.d(a,{useSearchParams:function(){return t.useSearchParams}})}},function(e){e.O(0,[648,971,117,744],function(){return e(e.s=9082)}),_N_E=e.O()}]);